UNPKG

1.18 MBPlain TextView Raw
1#!/usr/bin/env node
2/**
3 * Relay v2.0.0
4 *
5 * Copyright (c) 2013-present, Facebook, Inc.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */
10module.exports =
11/******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
47/******/ __webpack_require__.d = function(exports, name, getter) {
48/******/ if(!__webpack_require__.o(exports, name)) {
49/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50/******/ }
51/******/ };
52/******/
53/******/ // define __esModule on exports
54/******/ __webpack_require__.r = function(exports) {
55/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57/******/ }
58/******/ Object.defineProperty(exports, '__esModule', { value: true });
59/******/ };
60/******/
61/******/ // create a fake namespace object
62/******/ // mode & 1: value is a module id, require it
63/******/ // mode & 2: merge all properties of value into the ns
64/******/ // mode & 4: return value when already ns object
65/******/ // mode & 8|1: behave like require
66/******/ __webpack_require__.t = function(value, mode) {
67/******/ if(mode & 1) value = __webpack_require__(value);
68/******/ if(mode & 8) return value;
69/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70/******/ var ns = Object.create(null);
71/******/ __webpack_require__.r(ns);
72/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74/******/ return ns;
75/******/ };
76/******/
77/******/ // getDefaultExport function for compatibility with non-harmony modules
78/******/ __webpack_require__.n = function(module) {
79/******/ var getter = module && module.__esModule ?
80/******/ function getDefault() { return module['default']; } :
81/******/ function getModuleExports() { return module; };
82/******/ __webpack_require__.d(getter, 'a', getter);
83/******/ return getter;
84/******/ };
85/******/
86/******/ // Object.prototype.hasOwnProperty.call
87/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ // __webpack_public_path__
90/******/ __webpack_require__.p = "";
91/******/
92/******/
93/******/ // Load entry module and return exports
94/******/ return __webpack_require__(__webpack_require__.s = 94);
95/******/ })
96/************************************************************************/
97/******/ ([
98/* 0 */
99/***/ (function(module, exports) {
100
101module.exports = require("graphql");
102
103/***/ }),
104/* 1 */
105/***/ (function(module, exports, __webpack_require__) {
106
107"use strict";
108/**
109 * Copyright (c) Facebook, Inc. and its affiliates.
110 *
111 * This source code is licensed under the MIT license found in the
112 * LICENSE file in the root directory of this source tree.
113 *
114 * strict
115 * @format
116 */
117
118
119/**
120 * Creates an error describing invalid application code (GraphQL/Schema)
121 * that must be fixed by the end developer. This should only be used
122 * for local errors that don't affect processing of other user code.
123 */
124function createUserError(message, locations, nodes) {
125 var _nodes;
126
127 var messageWithLocations = message;
128
129 if (locations != null) {
130 var printedLocations = printLocations(locations);
131 messageWithLocations = printedLocations.length === 0 ? message : [message].concat(printedLocations).join('\n\n') + '\n';
132 }
133
134 return new (__webpack_require__(0).GraphQLError)(messageWithLocations, (_nodes = nodes) !== null && _nodes !== void 0 ? _nodes : []);
135}
136/**
137 * Similar to createUserError but for errors that are *not* recoverable:
138 * the compiler should not continue to process other inputs because their
139 * validity can't be determined.
140 */
141
142
143function createNonRecoverableUserError(message, locations, nodes) {
144 var _nodes2;
145
146 var messageWithLocations = message;
147
148 if (locations != null) {
149 var printedLocations = printLocations(locations);
150 messageWithLocations = printedLocations.length === 0 ? message : [message].concat(printedLocations).join('\n\n') + '\n';
151 }
152
153 var error = new (__webpack_require__(0).GraphQLError)(messageWithLocations, (_nodes2 = nodes) !== null && _nodes2 !== void 0 ? _nodes2 : []);
154 return new Error(error.message);
155}
156/**
157 * Creates an error describing a problem with the compiler itself - such
158 * as a broken invariant - that must be fixed within the compiler.
159 */
160
161
162function createCompilerError(message, locations, nodes) {
163 var _nodes3;
164
165 var messageWithLocations = message;
166
167 if (locations != null) {
168 var printedLocations = printLocations(locations);
169 messageWithLocations = printedLocations.length === 0 ? message : [message].concat(printedLocations).join('\n\n') + '\n';
170 }
171
172 var error = new (__webpack_require__(0).GraphQLError)("Internal Error: ".concat(messageWithLocations), (_nodes3 = nodes) !== null && _nodes3 !== void 0 ? _nodes3 : []);
173 return new Error(error.message);
174}
175/**
176 * Merges the results of multiple user errors into one so that they
177 * can be reported in bulk.
178 */
179
180
181function createCombinedError(errors, maybePrefix) {
182 var prefix = maybePrefix != null ? "".concat(maybePrefix, ": ") : '';
183 return new Error("".concat(prefix, "Encountered ").concat(errors.length, " error(s):\n") + errors.map(function (error) {
184 return String(error).split('\n').map(function (line, index) {
185 return index === 0 ? "- ".concat(line) : " ".concat(line);
186 }).join('\n');
187 }).join('\n'));
188}
189/**
190 * Iterates over the elements of some iterable value, calling the
191 * supplied callback for each item with a guard for user errors.
192 * Returns null if the iteration completed without errors, otherwise
193 * returns an array of all the user errors encountered.
194 *
195 * Note that non-user errors are rethrown since they are
196 * non-recoverable.
197 */
198
199
200function eachWithErrors(iterable, fn) {
201 var errors = [];
202 var _iteratorNormalCompletion = true;
203 var _didIteratorError = false;
204 var _iteratorError = undefined;
205
206 try {
207 for (var _iterator = iterable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
208 var item = _step.value;
209
210 try {
211 fn(item);
212 } catch (error) {
213 if (error instanceof __webpack_require__(0).GraphQLError) {
214 errors.push(error);
215 } else {
216 throw error;
217 }
218 }
219 }
220 } catch (err) {
221 _didIteratorError = true;
222 _iteratorError = err;
223 } finally {
224 try {
225 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
226 _iterator["return"]();
227 }
228 } finally {
229 if (_didIteratorError) {
230 throw _iteratorError;
231 }
232 }
233 }
234
235 if (errors.length !== 0) {
236 return errors;
237 }
238
239 return null;
240}
241
242function printLocations(locations) {
243 var printedLocations = [];
244 var _iteratorNormalCompletion2 = true;
245 var _didIteratorError2 = false;
246 var _iteratorError2 = undefined;
247
248 try {
249 for (var _iterator2 = locations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
250 var location = _step2.value;
251 var sourceLocation = location;
252
253 while (sourceLocation.kind === 'Derived') {
254 sourceLocation = sourceLocation.source;
255 }
256
257 switch (sourceLocation.kind) {
258 case 'Source':
259 {
260 // source location
261 var prefix = sourceLocation === location ? 'Source: ' : 'Source (derived): ';
262 printedLocations.push(prefix + highlightSourceAtLocation(sourceLocation.source, getLocation(sourceLocation.source, sourceLocation.start)));
263 break;
264 }
265
266 case 'Generated':
267 {
268 printedLocations.push('Source: (generated)');
269 break;
270 }
271
272 case 'Unknown':
273 {
274 printedLocations.push('Source: (unknown)');
275 break;
276 }
277
278 default:
279 {
280 sourceLocation;
281 throw createCompilerError("RelayCompilerError: cannot print location '".concat(String(sourceLocation), "'."));
282 }
283 }
284 }
285 } catch (err) {
286 _didIteratorError2 = true;
287 _iteratorError2 = err;
288 } finally {
289 try {
290 if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
291 _iterator2["return"]();
292 }
293 } finally {
294 if (_didIteratorError2) {
295 throw _iteratorError2;
296 }
297 }
298 }
299
300 return printedLocations;
301}
302/**
303 * Render a helpful description of the location of the error in the GraphQL
304 * Source document.
305 */
306
307
308function highlightSourceAtLocation(source, location) {
309 var firstLineColumnOffset = source.locationOffset.column - 1;
310 var body = whitespace(firstLineColumnOffset) + source.body;
311 var lineIndex = location.line - 1;
312 var lineOffset = source.locationOffset.line - 1;
313 var lineNum = location.line + lineOffset;
314 var columnOffset = location.line === 1 ? firstLineColumnOffset : 0;
315 var columnNum = location.column + columnOffset;
316 var lines = body.split(/\r\n|[\n\r]/g);
317 return "".concat(source.name, " (").concat(lineNum, ":").concat(columnNum, ")\n") + printPrefixedLines([// Lines specified like this: ["prefix", "string"],
318 ["".concat(lineNum - 1, ": "), lines[lineIndex - 1]], ["".concat(lineNum, ": "), lines[lineIndex]], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1, ": "), lines[lineIndex + 1]]]);
319}
320
321function printPrefixedLines(lines) {
322 var existingLines = lines.filter(function (_ref) {
323 var _ = _ref[0],
324 line = _ref[1];
325 return line !== undefined;
326 });
327 var padLen = 0;
328 var _iteratorNormalCompletion3 = true;
329 var _didIteratorError3 = false;
330 var _iteratorError3 = undefined;
331
332 try {
333 for (var _iterator3 = existingLines[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
334 var _step3$value = _step3.value,
335 prefix = _step3$value[0];
336 padLen = Math.max(padLen, prefix.length);
337 }
338 } catch (err) {
339 _didIteratorError3 = true;
340 _iteratorError3 = err;
341 } finally {
342 try {
343 if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
344 _iterator3["return"]();
345 }
346 } finally {
347 if (_didIteratorError3) {
348 throw _iteratorError3;
349 }
350 }
351 }
352
353 return existingLines.map(function (_ref2) {
354 var prefix = _ref2[0],
355 line = _ref2[1];
356 return lpad(padLen, prefix) + line;
357 }).join('\n');
358}
359
360function whitespace(len) {
361 return Array(len + 1).join(' ');
362}
363
364function lpad(len, str) {
365 return whitespace(len - str.length) + str;
366}
367
368function getLocation(source, position) {
369 var lineRegexp = /\r\n|[\n\r]/g;
370 var line = 1;
371 var column = position + 1;
372 var match;
373
374 while ((match = lineRegexp.exec(source.body)) && match.index < position) {
375 line += 1;
376 column = position + 1 - (match.index + match[0].length);
377 }
378
379 return {
380 line: line,
381 column: column
382 };
383}
384
385module.exports = {
386 createCombinedError: createCombinedError,
387 createCompilerError: createCompilerError,
388 createNonRecoverableUserError: createNonRecoverableUserError,
389 createUserError: createUserError,
390 eachWithErrors: eachWithErrors
391};
392
393/***/ }),
394/* 2 */
395/***/ (function(module, exports, __webpack_require__) {
396
397"use strict";
398
399
400Object.defineProperty(exports, "__esModule", {
401 value: true
402});
403var _exportNames = {
404 react: true,
405 assertNode: true,
406 createTypeAnnotationBasedOnTypeof: true,
407 createUnionTypeAnnotation: true,
408 cloneNode: true,
409 clone: true,
410 cloneDeep: true,
411 cloneWithoutLoc: true,
412 addComment: true,
413 addComments: true,
414 inheritInnerComments: true,
415 inheritLeadingComments: true,
416 inheritsComments: true,
417 inheritTrailingComments: true,
418 removeComments: true,
419 ensureBlock: true,
420 toBindingIdentifierName: true,
421 toBlock: true,
422 toComputedKey: true,
423 toExpression: true,
424 toIdentifier: true,
425 toKeyAlias: true,
426 toSequenceExpression: true,
427 toStatement: true,
428 valueToNode: true,
429 appendToMemberExpression: true,
430 inherits: true,
431 prependToMemberExpression: true,
432 removeProperties: true,
433 removePropertiesDeep: true,
434 removeTypeDuplicates: true,
435 getBindingIdentifiers: true,
436 getOuterBindingIdentifiers: true,
437 traverse: true,
438 traverseFast: true,
439 shallowEqual: true,
440 is: true,
441 isBinding: true,
442 isBlockScoped: true,
443 isImmutable: true,
444 isLet: true,
445 isNode: true,
446 isNodesEquivalent: true,
447 isReferenced: true,
448 isScope: true,
449 isSpecifierDefault: true,
450 isType: true,
451 isValidES3Identifier: true,
452 isValidIdentifier: true,
453 isVar: true,
454 matchesPattern: true,
455 validate: true,
456 buildMatchMemberExpression: true
457};
458Object.defineProperty(exports, "assertNode", {
459 enumerable: true,
460 get: function () {
461 return _assertNode.default;
462 }
463});
464Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", {
465 enumerable: true,
466 get: function () {
467 return _createTypeAnnotationBasedOnTypeof.default;
468 }
469});
470Object.defineProperty(exports, "createUnionTypeAnnotation", {
471 enumerable: true,
472 get: function () {
473 return _createUnionTypeAnnotation.default;
474 }
475});
476Object.defineProperty(exports, "cloneNode", {
477 enumerable: true,
478 get: function () {
479 return _cloneNode.default;
480 }
481});
482Object.defineProperty(exports, "clone", {
483 enumerable: true,
484 get: function () {
485 return _clone.default;
486 }
487});
488Object.defineProperty(exports, "cloneDeep", {
489 enumerable: true,
490 get: function () {
491 return _cloneDeep.default;
492 }
493});
494Object.defineProperty(exports, "cloneWithoutLoc", {
495 enumerable: true,
496 get: function () {
497 return _cloneWithoutLoc.default;
498 }
499});
500Object.defineProperty(exports, "addComment", {
501 enumerable: true,
502 get: function () {
503 return _addComment.default;
504 }
505});
506Object.defineProperty(exports, "addComments", {
507 enumerable: true,
508 get: function () {
509 return _addComments.default;
510 }
511});
512Object.defineProperty(exports, "inheritInnerComments", {
513 enumerable: true,
514 get: function () {
515 return _inheritInnerComments.default;
516 }
517});
518Object.defineProperty(exports, "inheritLeadingComments", {
519 enumerable: true,
520 get: function () {
521 return _inheritLeadingComments.default;
522 }
523});
524Object.defineProperty(exports, "inheritsComments", {
525 enumerable: true,
526 get: function () {
527 return _inheritsComments.default;
528 }
529});
530Object.defineProperty(exports, "inheritTrailingComments", {
531 enumerable: true,
532 get: function () {
533 return _inheritTrailingComments.default;
534 }
535});
536Object.defineProperty(exports, "removeComments", {
537 enumerable: true,
538 get: function () {
539 return _removeComments.default;
540 }
541});
542Object.defineProperty(exports, "ensureBlock", {
543 enumerable: true,
544 get: function () {
545 return _ensureBlock.default;
546 }
547});
548Object.defineProperty(exports, "toBindingIdentifierName", {
549 enumerable: true,
550 get: function () {
551 return _toBindingIdentifierName.default;
552 }
553});
554Object.defineProperty(exports, "toBlock", {
555 enumerable: true,
556 get: function () {
557 return _toBlock.default;
558 }
559});
560Object.defineProperty(exports, "toComputedKey", {
561 enumerable: true,
562 get: function () {
563 return _toComputedKey.default;
564 }
565});
566Object.defineProperty(exports, "toExpression", {
567 enumerable: true,
568 get: function () {
569 return _toExpression.default;
570 }
571});
572Object.defineProperty(exports, "toIdentifier", {
573 enumerable: true,
574 get: function () {
575 return _toIdentifier.default;
576 }
577});
578Object.defineProperty(exports, "toKeyAlias", {
579 enumerable: true,
580 get: function () {
581 return _toKeyAlias.default;
582 }
583});
584Object.defineProperty(exports, "toSequenceExpression", {
585 enumerable: true,
586 get: function () {
587 return _toSequenceExpression.default;
588 }
589});
590Object.defineProperty(exports, "toStatement", {
591 enumerable: true,
592 get: function () {
593 return _toStatement.default;
594 }
595});
596Object.defineProperty(exports, "valueToNode", {
597 enumerable: true,
598 get: function () {
599 return _valueToNode.default;
600 }
601});
602Object.defineProperty(exports, "appendToMemberExpression", {
603 enumerable: true,
604 get: function () {
605 return _appendToMemberExpression.default;
606 }
607});
608Object.defineProperty(exports, "inherits", {
609 enumerable: true,
610 get: function () {
611 return _inherits.default;
612 }
613});
614Object.defineProperty(exports, "prependToMemberExpression", {
615 enumerable: true,
616 get: function () {
617 return _prependToMemberExpression.default;
618 }
619});
620Object.defineProperty(exports, "removeProperties", {
621 enumerable: true,
622 get: function () {
623 return _removeProperties.default;
624 }
625});
626Object.defineProperty(exports, "removePropertiesDeep", {
627 enumerable: true,
628 get: function () {
629 return _removePropertiesDeep.default;
630 }
631});
632Object.defineProperty(exports, "removeTypeDuplicates", {
633 enumerable: true,
634 get: function () {
635 return _removeTypeDuplicates.default;
636 }
637});
638Object.defineProperty(exports, "getBindingIdentifiers", {
639 enumerable: true,
640 get: function () {
641 return _getBindingIdentifiers.default;
642 }
643});
644Object.defineProperty(exports, "getOuterBindingIdentifiers", {
645 enumerable: true,
646 get: function () {
647 return _getOuterBindingIdentifiers.default;
648 }
649});
650Object.defineProperty(exports, "traverse", {
651 enumerable: true,
652 get: function () {
653 return _traverse.default;
654 }
655});
656Object.defineProperty(exports, "traverseFast", {
657 enumerable: true,
658 get: function () {
659 return _traverseFast.default;
660 }
661});
662Object.defineProperty(exports, "shallowEqual", {
663 enumerable: true,
664 get: function () {
665 return _shallowEqual.default;
666 }
667});
668Object.defineProperty(exports, "is", {
669 enumerable: true,
670 get: function () {
671 return _is.default;
672 }
673});
674Object.defineProperty(exports, "isBinding", {
675 enumerable: true,
676 get: function () {
677 return _isBinding.default;
678 }
679});
680Object.defineProperty(exports, "isBlockScoped", {
681 enumerable: true,
682 get: function () {
683 return _isBlockScoped.default;
684 }
685});
686Object.defineProperty(exports, "isImmutable", {
687 enumerable: true,
688 get: function () {
689 return _isImmutable.default;
690 }
691});
692Object.defineProperty(exports, "isLet", {
693 enumerable: true,
694 get: function () {
695 return _isLet.default;
696 }
697});
698Object.defineProperty(exports, "isNode", {
699 enumerable: true,
700 get: function () {
701 return _isNode.default;
702 }
703});
704Object.defineProperty(exports, "isNodesEquivalent", {
705 enumerable: true,
706 get: function () {
707 return _isNodesEquivalent.default;
708 }
709});
710Object.defineProperty(exports, "isReferenced", {
711 enumerable: true,
712 get: function () {
713 return _isReferenced.default;
714 }
715});
716Object.defineProperty(exports, "isScope", {
717 enumerable: true,
718 get: function () {
719 return _isScope.default;
720 }
721});
722Object.defineProperty(exports, "isSpecifierDefault", {
723 enumerable: true,
724 get: function () {
725 return _isSpecifierDefault.default;
726 }
727});
728Object.defineProperty(exports, "isType", {
729 enumerable: true,
730 get: function () {
731 return _isType.default;
732 }
733});
734Object.defineProperty(exports, "isValidES3Identifier", {
735 enumerable: true,
736 get: function () {
737 return _isValidES3Identifier.default;
738 }
739});
740Object.defineProperty(exports, "isValidIdentifier", {
741 enumerable: true,
742 get: function () {
743 return _isValidIdentifier.default;
744 }
745});
746Object.defineProperty(exports, "isVar", {
747 enumerable: true,
748 get: function () {
749 return _isVar.default;
750 }
751});
752Object.defineProperty(exports, "matchesPattern", {
753 enumerable: true,
754 get: function () {
755 return _matchesPattern.default;
756 }
757});
758Object.defineProperty(exports, "validate", {
759 enumerable: true,
760 get: function () {
761 return _validate.default;
762 }
763});
764Object.defineProperty(exports, "buildMatchMemberExpression", {
765 enumerable: true,
766 get: function () {
767 return _buildMatchMemberExpression.default;
768 }
769});
770exports.react = void 0;
771
772var _isReactComponent = _interopRequireDefault(__webpack_require__(123));
773
774var _isCompatTag = _interopRequireDefault(__webpack_require__(124));
775
776var _buildChildren = _interopRequireDefault(__webpack_require__(125));
777
778var _assertNode = _interopRequireDefault(__webpack_require__(136));
779
780var _generated = __webpack_require__(137);
781
782Object.keys(_generated).forEach(function (key) {
783 if (key === "default" || key === "__esModule") return;
784 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
785 Object.defineProperty(exports, key, {
786 enumerable: true,
787 get: function () {
788 return _generated[key];
789 }
790 });
791});
792
793var _createTypeAnnotationBasedOnTypeof = _interopRequireDefault(__webpack_require__(138));
794
795var _createUnionTypeAnnotation = _interopRequireDefault(__webpack_require__(139));
796
797var _generated2 = __webpack_require__(15);
798
799Object.keys(_generated2).forEach(function (key) {
800 if (key === "default" || key === "__esModule") return;
801 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
802 Object.defineProperty(exports, key, {
803 enumerable: true,
804 get: function () {
805 return _generated2[key];
806 }
807 });
808});
809
810var _cloneNode = _interopRequireDefault(__webpack_require__(28));
811
812var _clone = _interopRequireDefault(__webpack_require__(60));
813
814var _cloneDeep = _interopRequireDefault(__webpack_require__(140));
815
816var _cloneWithoutLoc = _interopRequireDefault(__webpack_require__(141));
817
818var _addComment = _interopRequireDefault(__webpack_require__(142));
819
820var _addComments = _interopRequireDefault(__webpack_require__(61));
821
822var _inheritInnerComments = _interopRequireDefault(__webpack_require__(62));
823
824var _inheritLeadingComments = _interopRequireDefault(__webpack_require__(63));
825
826var _inheritsComments = _interopRequireDefault(__webpack_require__(64));
827
828var _inheritTrailingComments = _interopRequireDefault(__webpack_require__(65));
829
830var _removeComments = _interopRequireDefault(__webpack_require__(144));
831
832var _generated3 = __webpack_require__(145);
833
834Object.keys(_generated3).forEach(function (key) {
835 if (key === "default" || key === "__esModule") return;
836 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
837 Object.defineProperty(exports, key, {
838 enumerable: true,
839 get: function () {
840 return _generated3[key];
841 }
842 });
843});
844
845var _constants = __webpack_require__(21);
846
847Object.keys(_constants).forEach(function (key) {
848 if (key === "default" || key === "__esModule") return;
849 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
850 Object.defineProperty(exports, key, {
851 enumerable: true,
852 get: function () {
853 return _constants[key];
854 }
855 });
856});
857
858var _ensureBlock = _interopRequireDefault(__webpack_require__(146));
859
860var _toBindingIdentifierName = _interopRequireDefault(__webpack_require__(147));
861
862var _toBlock = _interopRequireDefault(__webpack_require__(66));
863
864var _toComputedKey = _interopRequireDefault(__webpack_require__(148));
865
866var _toExpression = _interopRequireDefault(__webpack_require__(149));
867
868var _toIdentifier = _interopRequireDefault(__webpack_require__(67));
869
870var _toKeyAlias = _interopRequireDefault(__webpack_require__(150));
871
872var _toSequenceExpression = _interopRequireDefault(__webpack_require__(151));
873
874var _toStatement = _interopRequireDefault(__webpack_require__(153));
875
876var _valueToNode = _interopRequireDefault(__webpack_require__(154));
877
878var _definitions = __webpack_require__(16);
879
880Object.keys(_definitions).forEach(function (key) {
881 if (key === "default" || key === "__esModule") return;
882 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
883 Object.defineProperty(exports, key, {
884 enumerable: true,
885 get: function () {
886 return _definitions[key];
887 }
888 });
889});
890
891var _appendToMemberExpression = _interopRequireDefault(__webpack_require__(157));
892
893var _inherits = _interopRequireDefault(__webpack_require__(158));
894
895var _prependToMemberExpression = _interopRequireDefault(__webpack_require__(159));
896
897var _removeProperties = _interopRequireDefault(__webpack_require__(70));
898
899var _removePropertiesDeep = _interopRequireDefault(__webpack_require__(68));
900
901var _removeTypeDuplicates = _interopRequireDefault(__webpack_require__(59));
902
903var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(32));
904
905var _getOuterBindingIdentifiers = _interopRequireDefault(__webpack_require__(160));
906
907var _traverse = _interopRequireDefault(__webpack_require__(161));
908
909var _traverseFast = _interopRequireDefault(__webpack_require__(69));
910
911var _shallowEqual = _interopRequireDefault(__webpack_require__(39));
912
913var _is = _interopRequireDefault(__webpack_require__(41));
914
915var _isBinding = _interopRequireDefault(__webpack_require__(162));
916
917var _isBlockScoped = _interopRequireDefault(__webpack_require__(163));
918
919var _isImmutable = _interopRequireDefault(__webpack_require__(164));
920
921var _isLet = _interopRequireDefault(__webpack_require__(71));
922
923var _isNode = _interopRequireDefault(__webpack_require__(58));
924
925var _isNodesEquivalent = _interopRequireDefault(__webpack_require__(165));
926
927var _isReferenced = _interopRequireDefault(__webpack_require__(166));
928
929var _isScope = _interopRequireDefault(__webpack_require__(167));
930
931var _isSpecifierDefault = _interopRequireDefault(__webpack_require__(168));
932
933var _isType = _interopRequireDefault(__webpack_require__(42));
934
935var _isValidES3Identifier = _interopRequireDefault(__webpack_require__(169));
936
937var _isValidIdentifier = _interopRequireDefault(__webpack_require__(27));
938
939var _isVar = _interopRequireDefault(__webpack_require__(170));
940
941var _matchesPattern = _interopRequireDefault(__webpack_require__(56));
942
943var _validate = _interopRequireDefault(__webpack_require__(57));
944
945var _buildMatchMemberExpression = _interopRequireDefault(__webpack_require__(55));
946
947var _generated4 = __webpack_require__(12);
948
949Object.keys(_generated4).forEach(function (key) {
950 if (key === "default" || key === "__esModule") return;
951 if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
952 Object.defineProperty(exports, key, {
953 enumerable: true,
954 get: function () {
955 return _generated4[key];
956 }
957 });
958});
959
960function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
961
962const react = {
963 isReactComponent: _isReactComponent.default,
964 isCompatTag: _isCompatTag.default,
965 buildChildren: _buildChildren.default
966};
967exports.react = react;
968
969/***/ }),
970/* 3 */
971/***/ (function(module, exports, __webpack_require__) {
972
973"use strict";
974/**
975 * Copyright (c) Facebook, Inc. and its affiliates.
976 *
977 * This source code is licensed under the MIT license found in the
978 * LICENSE file in the root directory of this source tree.
979 *
980 *
981 * @format
982 */
983
984
985var ID = 'id';
986var ID_TYPE = 'ID';
987
988/**
989 * Determine if the given type may implement the named type:
990 * - it is the named type
991 * - it implements the named interface
992 * - it is an abstract type and *some* of its concrete types may
993 * implement the named type
994 */
995function mayImplement(schema, type, typeName) {
996 var unmodifiedType = getRawType(type);
997 return unmodifiedType.toString() === typeName || implementsInterface(unmodifiedType, typeName) || isAbstractType(unmodifiedType) && hasConcreteTypeThatImplements(schema, unmodifiedType, typeName);
998}
999
1000function canHaveSelections(type) {
1001 return type instanceof __webpack_require__(0).GraphQLObjectType || type instanceof __webpack_require__(0).GraphQLInterfaceType;
1002}
1003/**
1004 * Implements duck typing that checks whether a type has an id field of the ID
1005 * type. This is approximating what we can hopefully do with the __id proposal
1006 * a bit more cleanly.
1007 *
1008 * https://github.com/graphql/graphql-future/blob/master/01%20-%20__id.md
1009 */
1010
1011
1012function hasID(schema, type) {
1013 var unmodifiedType = getRawType(type);
1014 !(unmodifiedType instanceof __webpack_require__(0).GraphQLObjectType || unmodifiedType instanceof __webpack_require__(0).GraphQLInterfaceType) ? true ? __webpack_require__(4)(false, 'GraphQLSchemaUtils.hasID(): Expected a concrete type or interface, ' + 'got type `%s`.', type) : undefined : void 0;
1015 var idType = schema.getType(ID_TYPE);
1016 var idField = unmodifiedType.getFields()[ID];
1017 return idField && getRawType(idField.type) === idType;
1018}
1019/**
1020 * Determine if a type is abstract (not concrete).
1021 *
1022 * Note: This is used in place of the `graphql` version of the function in order
1023 * to not break `instanceof` checks with Jest. This version also unwraps
1024 * non-null/list wrapper types.
1025 */
1026
1027
1028function isAbstractType(type) {
1029 var rawType = getRawType(type);
1030 return rawType instanceof __webpack_require__(0).GraphQLInterfaceType || rawType instanceof __webpack_require__(0).GraphQLUnionType;
1031}
1032
1033function isUnionType(type) {
1034 return type instanceof __webpack_require__(0).GraphQLUnionType;
1035}
1036/**
1037 * Get the unmodified type, with list/null wrappers removed.
1038 */
1039
1040
1041function getRawType(type) {
1042 return __webpack_require__(183)(__webpack_require__(0).getNamedType(type));
1043}
1044/**
1045 * Gets the non-list type, removing the list wrapper if present.
1046 */
1047
1048
1049function getSingularType(type) {
1050 var unmodifiedType = type;
1051
1052 while (unmodifiedType instanceof __webpack_require__(0).GraphQLList) {
1053 unmodifiedType = unmodifiedType.ofType;
1054 }
1055
1056 return unmodifiedType;
1057}
1058/**
1059 * @public
1060 */
1061
1062
1063function implementsInterface(type, interfaceName) {
1064 return getInterfaces(type).some(function (interfaceType) {
1065 return interfaceType.toString() === interfaceName;
1066 });
1067}
1068/**
1069 * @private
1070 */
1071
1072
1073function hasConcreteTypeThatImplements(schema, type, interfaceName) {
1074 return isAbstractType(type) && getConcreteTypes(schema, type).some(function (concreteType) {
1075 return implementsInterface(concreteType, interfaceName);
1076 });
1077}
1078/**
1079 * @private
1080 */
1081
1082
1083function getConcreteTypes(schema, type) {
1084 return schema.getPossibleTypes(__webpack_require__(0).assertAbstractType(type));
1085}
1086/**
1087 * @private
1088 */
1089
1090
1091function getInterfaces(type) {
1092 if (type instanceof __webpack_require__(0).GraphQLObjectType) {
1093 return type.getInterfaces();
1094 }
1095
1096 return [];
1097}
1098/**
1099 * @public
1100 *
1101 * Determine if an AST node contains a fragment/operation definition.
1102 */
1103
1104
1105function isExecutableDefinitionAST(ast) {
1106 return ast.kind === 'FragmentDefinition' || ast.kind === 'OperationDefinition';
1107}
1108/**
1109 * @public
1110 *
1111 * Determine if an AST node contains a schema definition.
1112 */
1113
1114
1115function isSchemaDefinitionAST(ast) {
1116 return ast.kind === 'SchemaDefinition' || ast.kind === 'ScalarTypeDefinition' || ast.kind === 'ObjectTypeDefinition' || ast.kind === 'InterfaceTypeDefinition' || ast.kind === 'UnionTypeDefinition' || ast.kind === 'EnumTypeDefinition' || ast.kind === 'InputObjectTypeDefinition' || ast.kind === 'DirectiveDefinition' || ast.kind === 'ScalarTypeExtension' || ast.kind === 'ObjectTypeExtension' || ast.kind === 'InterfaceTypeExtension' || ast.kind === 'UnionTypeExtension' || ast.kind === 'EnumTypeExtension' || ast.kind === 'InputObjectTypeExtension';
1117}
1118
1119function assertTypeWithFields(type) {
1120 !(type instanceof __webpack_require__(0).GraphQLObjectType || type instanceof __webpack_require__(0).GraphQLInterfaceType) ? true ? __webpack_require__(4)(false, 'GraphQLSchemaUtils: Expected type `%s` to be an object or interface type.', type) : undefined : void 0;
1121 return type;
1122}
1123/**
1124 * Helper for calling `typeFromAST()` with a clear warning when the type does
1125 * not exist. This enables the pattern `assertXXXType(getTypeFromAST(...))`,
1126 * emitting distinct errors for unknown types vs types of the wrong category.
1127 */
1128
1129
1130function getTypeFromAST(schema, ast) {
1131 var type = __webpack_require__(0).typeFromAST(schema, ast);
1132
1133 !__webpack_require__(0).isType(type) ? true ? __webpack_require__(4)(false, 'GraphQLSchemaUtils: Unknown type `%s`.', __webpack_require__(0).print(ast)) : undefined : void 0;
1134 return type;
1135}
1136
1137module.exports = {
1138 assertTypeWithFields: assertTypeWithFields,
1139 canHaveSelections: canHaveSelections,
1140 getNullableType: __webpack_require__(0).getNullableType,
1141 getRawType: getRawType,
1142 getSingularType: getSingularType,
1143 getTypeFromAST: getTypeFromAST,
1144 hasID: hasID,
1145 implementsInterface: implementsInterface,
1146 isAbstractType: isAbstractType,
1147 isUnionType: isUnionType,
1148 isExecutableDefinitionAST: isExecutableDefinitionAST,
1149 isSchemaDefinitionAST: isSchemaDefinitionAST,
1150 mayImplement: mayImplement
1151};
1152
1153/***/ }),
1154/* 4 */
1155/***/ (function(module, exports) {
1156
1157module.exports = require("fbjs/lib/invariant");
1158
1159/***/ }),
1160/* 5 */
1161/***/ (function(module, exports) {
1162
1163function _interopRequireDefault(obj) {
1164 return obj && obj.__esModule ? obj : {
1165 default: obj
1166 };
1167}
1168
1169module.exports = _interopRequireDefault;
1170
1171/***/ }),
1172/* 6 */
1173/***/ (function(module, exports) {
1174
1175module.exports = require("path");
1176
1177/***/ }),
1178/* 7 */
1179/***/ (function(module, exports, __webpack_require__) {
1180
1181"use strict";
1182/**
1183 * Copyright (c) Facebook, Inc. and its affiliates.
1184 *
1185 * This source code is licensed under the MIT license found in the
1186 * LICENSE file in the root directory of this source tree.
1187 *
1188 *
1189 * @format
1190 */
1191
1192
1193var _asyncToGenerator = __webpack_require__(18);
1194
1195var enabled = false;
1196var traces = [{
1197 ph: 'M',
1198 pid: 0,
1199 tid: 0,
1200 name: 'process_name',
1201 args: {
1202 name: 'relay-compiler'
1203 }
1204}, {
1205 ph: 'M',
1206 pid: 0,
1207 tid: 0,
1208 name: 'thread_name',
1209 args: {
1210 name: 'relay-compiler'
1211 }
1212}];
1213var stack = [];
1214
1215function enable() {
1216 enabled = true;
1217}
1218
1219function getTraces() {
1220 return traces;
1221}
1222/**
1223 * Run the provided function as part of a stack profile.
1224 */
1225
1226
1227function run(name, fn) {
1228 return instrument(fn, name)();
1229}
1230/**
1231 * Run the provided async function as part context in a stack profile.
1232 * See instrumentAsyncContext() for limitations and usage notes.
1233 */
1234
1235
1236function asyncContext(name, fn) {
1237 return instrumentAsyncContext(fn, name)();
1238}
1239/**
1240 * Wait for the provided async operation as an async profile.
1241 */
1242
1243
1244function waitFor(name, fn) {
1245 return instrumentWait(fn, name)();
1246}
1247/**
1248 * Return a new instrumented sync function to be part of a stack profile.
1249 *
1250 * This instruments synchronous functions to be displayed in a stack
1251 * visualization. To instrument async functions, see instrumentAsyncContext()
1252 * and instrumentWait().
1253 */
1254
1255
1256function instrument(fn, name) {
1257 if (!enabled) {
1258 return fn;
1259 }
1260
1261 var profileName = name || fn.displayName || fn.name;
1262
1263 var instrumented = function instrumented() {
1264 var traceId = start(profileName);
1265
1266 try {
1267 return fn.apply(this, arguments);
1268 } finally {
1269 end(traceId);
1270 }
1271 };
1272
1273 instrumented.displayName = profileName;
1274 return instrumented;
1275}
1276/**
1277 * Return a new instrumented async function which provides context for a stack.
1278 *
1279 * Because the resulting profiling information will be incorporated into a
1280 * stack visualization, the instrumented function must represent a distinct
1281 * region of time which does not overlap with any other async context.
1282 *
1283 * In other words, functions instrumented with instrumentAsyncContext must not
1284 * run in parallel via Promise.all().
1285 *
1286 * To instrument functions which will run in parallel, use instrumentWait().
1287 */
1288
1289
1290function instrumentAsyncContext(fn, name) {
1291 if (!enabled) {
1292 return fn;
1293 }
1294
1295 var profileName = name || fn.displayName || fn.name;
1296
1297 var instrumented =
1298 /*#__PURE__*/
1299 function () {
1300 var _instrumented = _asyncToGenerator(function* () {
1301 var traceId = start(profileName);
1302
1303 try {
1304 return yield fn.apply(this, arguments);
1305 } finally {
1306 end(traceId);
1307 }
1308 });
1309
1310 return function instrumented() {
1311 return _instrumented.apply(this, arguments);
1312 };
1313 }();
1314
1315 instrumented.displayName = profileName;
1316 return instrumented;
1317}
1318/**
1319 * Return a new instrumented function which performs an awaited async operation.
1320 *
1321 * The instrumented function is not included in the overall run time of the
1322 * compiler, instead it captures the time waiting on some asynchronous external
1323 * resource such as network or filesystem which are often run in parallel.
1324 */
1325
1326
1327function instrumentWait(fn, name) {
1328 if (!enabled) {
1329 return fn;
1330 }
1331
1332 var profileName = name || fn.displayName || fn.name;
1333
1334 var instrumented =
1335 /*#__PURE__*/
1336 function () {
1337 var _instrumented2 = _asyncToGenerator(function* () {
1338 var traceId = startWait(profileName);
1339
1340 try {
1341 return yield fn.apply(this, arguments);
1342 } finally {
1343 end(traceId);
1344 }
1345 });
1346
1347 return function instrumented() {
1348 return _instrumented2.apply(this, arguments);
1349 };
1350 }();
1351
1352 instrumented.displayName = profileName;
1353 return instrumented;
1354}
1355
1356var T_ZERO = process.hrtime(); // Return a Uint32 of microtime duration since program start.
1357
1358function microtime() {
1359 var hrtime = process.hrtime(T_ZERO); // eslint-disable-next-line no-bitwise
1360
1361 return 0 | hrtime[0] * 1e6 + Math.round(hrtime[1] / 1e3);
1362}
1363/**
1364 * Start a stack profile with a particular name, returns an ID to pass to end().
1365 *
1366 * Other profiles may start before this one ends, which will be represented as
1367 * nested operations, however all nested operations must end before this ends.
1368 *
1369 * In particular, be careful to end after errors.
1370 */
1371
1372
1373function start(name) {
1374 var beginTrace = {
1375 ph: 'B',
1376 name: name,
1377 pid: 0,
1378 tid: 0,
1379 ts: microtime()
1380 };
1381 traces.push(beginTrace);
1382 stack.push(beginTrace);
1383 return traces.length - 1;
1384}
1385
1386var asyncID = 0;
1387/**
1388 * Start an async wait profile with a particular name, returns an ID to pass
1389 * to end().
1390 *
1391 * Other profiles may start before this one ends, which will be represented as
1392 * nested operations, however all nested operations must end before this ends.
1393 *
1394 * In particular, be careful to end after errors.
1395 */
1396
1397function startWait(name) {
1398 traces.push({
1399 ph: 'b',
1400 name: name,
1401 cat: 'wait',
1402 id: asyncID++,
1403 pid: 0,
1404 tid: 0,
1405 ts: microtime()
1406 });
1407 return traces.length - 1;
1408}
1409
1410function end(traceIdx) {
1411 var trace = traces[traceIdx];
1412
1413 if (trace.ph === 'b') {
1414 traces.push({
1415 ph: 'e',
1416 cat: trace.cat,
1417 name: trace.name,
1418 id: trace.id,
1419 pid: trace.pid,
1420 tid: trace.tid,
1421 ts: microtime()
1422 });
1423 return;
1424 }
1425
1426 !(trace.ph === 'B') ? true ? __webpack_require__(4)(false, 'Begin trace phase') : undefined : void 0;
1427 !(stack.pop() === trace) ? true ? __webpack_require__(4)(false, 'GraphQLCompilerProfiler: The profile trace %s ended before nested traces. ' + 'If it is async, try using Profile.waitFor or Profile.profileWait.', trace.name) : undefined : void 0;
1428 var prevTrace = traces[traces.length - 1];
1429
1430 if (trace === prevTrace) {
1431 traces[traceIdx] = {
1432 ph: 'X',
1433 name: trace.name,
1434 pid: trace.pid,
1435 tid: trace.tid,
1436 ts: trace.ts,
1437 dur: microtime() - trace.ts
1438 };
1439 return;
1440 }
1441
1442 traces.push({
1443 ph: 'E',
1444 name: trace.name,
1445 pid: trace.pid,
1446 tid: trace.tid,
1447 ts: microtime()
1448 });
1449}
1450
1451module.exports = {
1452 enable: enable,
1453 getTraces: getTraces,
1454 run: run,
1455 asyncContext: asyncContext,
1456 waitFor: waitFor,
1457 instrument: instrument,
1458 instrumentAsyncContext: instrumentAsyncContext,
1459 instrumentWait: instrumentWait,
1460 start: start,
1461 startWait: startWait,
1462 end: end
1463};
1464
1465/***/ }),
1466/* 8 */
1467/***/ (function(module, exports, __webpack_require__) {
1468
1469"use strict";
1470/**
1471 * Copyright (c) Facebook, Inc. and its affiliates.
1472 *
1473 * This source code is licensed under the MIT license found in the
1474 * LICENSE file in the root directory of this source tree.
1475 *
1476 * strict
1477 * @format
1478 */
1479
1480
1481/**
1482 * type NAME = any;
1483 */
1484function anyTypeAlias(name) {
1485 return __webpack_require__(2).typeAlias(__webpack_require__(2).identifier(name), null, __webpack_require__(2).anyTypeAnnotation());
1486}
1487/**
1488 * {|
1489 * PROPS
1490 * |}
1491 */
1492
1493
1494function exactObjectTypeAnnotation(props) {
1495 var typeAnnotation = __webpack_require__(2).objectTypeAnnotation(props);
1496
1497 typeAnnotation.exact = true;
1498 return typeAnnotation;
1499}
1500/**
1501 * export type NAME = TYPE
1502 */
1503
1504
1505function exportType(name, type) {
1506 return __webpack_require__(2).exportNamedDeclaration(__webpack_require__(2).typeAlias(__webpack_require__(2).identifier(name), null, type), [], null);
1507}
1508/**
1509 * import type {NAMES[0], NAMES[1], ...} from 'MODULE';
1510 */
1511
1512
1513function importTypes(names, module) {
1514 var importDeclaration = __webpack_require__(2).importDeclaration(names.map(function (name) {
1515 return __webpack_require__(2).importSpecifier(__webpack_require__(2).identifier(name), __webpack_require__(2).identifier(name));
1516 }), __webpack_require__(2).stringLiteral(module));
1517
1518 importDeclaration.importKind = 'type';
1519 return importDeclaration;
1520}
1521/**
1522 * Create an intersection type if needed.
1523 *
1524 * TYPES[0] & TYPES[1] & ...
1525 */
1526
1527
1528function intersectionTypeAnnotation(types) {
1529 !(types.length > 0) ? true ? __webpack_require__(4)(false, 'RelayFlowBabelFactories: cannot create an intersection of 0 types') : undefined : void 0;
1530 return types.length === 1 ? types[0] : __webpack_require__(2).intersectionTypeAnnotation(types);
1531}
1532
1533function lineComments() {
1534 for (var _len = arguments.length, lines = new Array(_len), _key = 0; _key < _len; _key++) {
1535 lines[_key] = arguments[_key];
1536 }
1537
1538 /* $FlowFixMe(>=0.70.0) This comment suppresses an error found when
1539 * Flow v0.70 was deployed. To see the error delete this comment and
1540 * run Flow. */
1541 return lines.map(function (line) {
1542 return {
1543 type: 'CommentLine',
1544 value: ' ' + line
1545 };
1546 });
1547}
1548/**
1549 * $ReadOnlyArray<TYPE>
1550 */
1551
1552
1553function readOnlyArrayOfType(thing) {
1554 return __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier('$ReadOnlyArray'), __webpack_require__(2).typeParameterInstantiation([thing]));
1555}
1556/**
1557 * +KEY: VALUE
1558 */
1559
1560
1561function readOnlyObjectTypeProperty(key, value) {
1562 var prop = __webpack_require__(2).objectTypeProperty(__webpack_require__(2).identifier(key), value);
1563
1564 prop.variance = __webpack_require__(2).variance('plus');
1565 return prop;
1566}
1567
1568function stringLiteralTypeAnnotation(value) {
1569 return __webpack_require__(2).stringLiteralTypeAnnotation(value);
1570}
1571/**
1572 * Create a union type if needed.
1573 *
1574 * TYPES[0] | TYPES[1] | ...
1575 */
1576
1577
1578function unionTypeAnnotation(types) {
1579 !(types.length > 0) ? true ? __webpack_require__(4)(false, 'RelayFlowBabelFactories: cannot create a union of 0 types') : undefined : void 0;
1580 return types.length === 1 ? types[0] : __webpack_require__(2).unionTypeAnnotation(types);
1581}
1582
1583module.exports = {
1584 anyTypeAlias: anyTypeAlias,
1585 exactObjectTypeAnnotation: exactObjectTypeAnnotation,
1586 exportType: exportType,
1587 importTypes: importTypes,
1588 intersectionTypeAnnotation: intersectionTypeAnnotation,
1589 lineComments: lineComments,
1590 readOnlyArrayOfType: readOnlyArrayOfType,
1591 readOnlyObjectTypeProperty: readOnlyObjectTypeProperty,
1592 stringLiteralTypeAnnotation: stringLiteralTypeAnnotation,
1593 unionTypeAnnotation: unionTypeAnnotation
1594};
1595
1596/***/ }),
1597/* 9 */
1598/***/ (function(module, exports, __webpack_require__) {
1599
1600var defineProperty = __webpack_require__(38);
1601
1602function _objectSpread(target) {
1603 for (var i = 1; i < arguments.length; i++) {
1604 var source = arguments[i] != null ? arguments[i] : {};
1605 var ownKeys = Object.keys(source);
1606
1607 if (typeof Object.getOwnPropertySymbols === 'function') {
1608 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
1609 return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1610 }));
1611 }
1612
1613 ownKeys.forEach(function (key) {
1614 defineProperty(target, key, source[key]);
1615 });
1616 }
1617
1618 return target;
1619}
1620
1621module.exports = _objectSpread;
1622
1623/***/ }),
1624/* 10 */
1625/***/ (function(module, exports, __webpack_require__) {
1626
1627"use strict";
1628/**
1629 * Copyright (c) Facebook, Inc. and its affiliates.
1630 *
1631 * This source code is licensed under the MIT license found in the
1632 * LICENSE file in the root directory of this source tree.
1633 *
1634 * strict-local
1635 * @format
1636 */
1637
1638
1639var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
1640
1641/**
1642 * @public
1643 *
1644 * Helper for writing compiler transforms that apply "map" and/or "filter"-style
1645 * operations to compiler contexts. The `visitor` argument accepts a map of IR
1646 * kinds to user-defined functions that can map nodes of that kind to new values
1647 * (of the same kind).
1648 *
1649 * If a visitor function is defined for a kind, the visitor function is
1650 * responsible for traversing its children (by calling `this.traverse(node)`)
1651 * and returning either the input (to indicate no changes), a new node (to
1652 * indicate changes), or null/undefined (to indicate the removal of that node
1653 * from the output).
1654 *
1655 * If a visitor function is *not* defined for a kind, a default traversal is
1656 * used to evaluate its children.
1657 *
1658 * The `stateInitializer` argument accepts an optional function to construct the
1659 * state for each document (fragment or root) in the context. Any documents for
1660 * which the initializer returns null/undefined is deleted from the context
1661 * without being traversed.
1662 *
1663 * Example: Alias all scalar fields with the reverse of their name:
1664 *
1665 * ```
1666 * transform(context, {
1667 * ScalarField: visitScalarField,
1668 * });
1669 *
1670 * function visitScalarField(field: ScalarField, state: State): ?ScalarField {
1671 * // Traverse child nodes - for a scalar field these are the arguments &
1672 * // directives.
1673 * const nextField = this.traverse(field, state);
1674 * // Return a new node with a different alias.
1675 * return {
1676 * ...nextField,
1677 * alias: nextField.name.split('').reverse().join(''),
1678 * };
1679 * }
1680 * ```
1681 */
1682function transform(context, visitor, stateInitializer) {
1683 var transformer = new Transformer(context, visitor);
1684 return context.withMutations(function (ctx) {
1685 var nextContext = ctx;
1686
1687 var errors = __webpack_require__(1).eachWithErrors(context.documents(), function (prevNode) {
1688 var nextNode;
1689
1690 if (stateInitializer === undefined) {
1691 nextNode = transformer.visit(prevNode, undefined);
1692 } else {
1693 var _state = stateInitializer(prevNode);
1694
1695 if (_state != null) {
1696 nextNode = transformer.visit(prevNode, _state);
1697 }
1698 }
1699
1700 if (!nextNode) {
1701 nextContext = nextContext.remove(prevNode.name);
1702 } else if (nextNode !== prevNode) {
1703 nextContext = nextContext.replace(nextNode);
1704 }
1705 });
1706
1707 if (errors != null && errors.length !== 0) {
1708 throw __webpack_require__(1).createCombinedError(errors);
1709 }
1710
1711 return nextContext;
1712 });
1713}
1714/**
1715 * @internal
1716 */
1717
1718
1719var Transformer =
1720/*#__PURE__*/
1721function () {
1722 function Transformer(context, visitor) {
1723 this._context = context;
1724 this._states = [];
1725 this._visitor = visitor;
1726 }
1727 /**
1728 * @public
1729 *
1730 * Returns the original compiler context that is being transformed. This can
1731 * be used to look up fragments by name, for example.
1732 */
1733
1734
1735 var _proto = Transformer.prototype;
1736
1737 _proto.getContext = function getContext() {
1738 return this._context;
1739 };
1740 /**
1741 * @public
1742 *
1743 * Transforms the node, calling a user-defined visitor function if defined for
1744 * the node's kind. Uses the given state for this portion of the traversal.
1745 *
1746 * Note: This differs from `traverse` in that it calls a visitor function for
1747 * the node itself.
1748 */
1749
1750
1751 _proto.visit = function visit(node, state) {
1752 this._states.push(state);
1753
1754 var nextNode = this._visit(node);
1755
1756 this._states.pop();
1757
1758 return nextNode;
1759 };
1760 /**
1761 * @public
1762 *
1763 * Transforms the children of the given node, skipping the user-defined
1764 * visitor function for the node itself. Uses the given state for this portion
1765 * of the traversal.
1766 *
1767 * Note: This differs from `visit` in that it does not call a visitor function
1768 * for the node itself.
1769 */
1770
1771
1772 _proto.traverse = function traverse(node, state) {
1773 this._states.push(state);
1774
1775 var nextNode = this._traverse(node);
1776
1777 this._states.pop();
1778
1779 return nextNode;
1780 };
1781
1782 _proto._visit = function _visit(node) {
1783 var nodeVisitor = this._visitor[node.kind];
1784
1785 if (nodeVisitor) {
1786 // If a handler for the kind is defined, it is responsible for calling
1787 // `traverse` to transform children as necessary.
1788 var _state2 = this._getState();
1789
1790 var nextNode = nodeVisitor.call(this, node, _state2);
1791 return nextNode;
1792 } // Otherwise traverse is called automatically.
1793
1794
1795 return this._traverse(node);
1796 };
1797
1798 _proto._traverse = function _traverse(prevNode) {
1799 var nextNode;
1800
1801 switch (prevNode.kind) {
1802 case 'Argument':
1803 nextNode = this._traverseChildren(prevNode, null, ['value']);
1804 break;
1805
1806 case 'Literal':
1807 case 'LocalArgumentDefinition':
1808 case 'RootArgumentDefinition':
1809 case 'Variable':
1810 nextNode = prevNode;
1811 break;
1812
1813 case 'Defer':
1814 nextNode = this._traverseChildren(prevNode, ['selections'], ['if']);
1815 break;
1816
1817 case 'Stream':
1818 nextNode = this._traverseChildren(prevNode, ['selections'], ['if', 'initialCount']);
1819 break;
1820
1821 case 'Directive':
1822 nextNode = this._traverseChildren(prevNode, ['args']);
1823 break;
1824
1825 case 'MatchBranch':
1826 nextNode = this._traverseChildren(prevNode, ['selections']);
1827
1828 if (!nextNode.selections.length) {
1829 nextNode = null;
1830 }
1831
1832 break;
1833
1834 case 'FragmentSpread':
1835 case 'ScalarField':
1836 nextNode = this._traverseChildren(prevNode, ['args', 'directives']);
1837 break;
1838
1839 case 'LinkedField':
1840 nextNode = this._traverseChildren(prevNode, ['args', 'directives', 'selections']);
1841
1842 if (!nextNode.selections.length) {
1843 nextNode = null;
1844 }
1845
1846 break;
1847
1848 case 'ListValue':
1849 nextNode = this._traverseChildren(prevNode, ['items']);
1850 break;
1851
1852 case 'MatchField':
1853 nextNode = this._traverseChildren(prevNode, ['args', 'directives', 'selections']);
1854 break;
1855
1856 case 'ObjectFieldValue':
1857 nextNode = this._traverseChildren(prevNode, null, ['value']);
1858 break;
1859
1860 case 'ObjectValue':
1861 nextNode = this._traverseChildren(prevNode, ['fields']);
1862 break;
1863
1864 case 'Condition':
1865 nextNode = this._traverseChildren(prevNode, ['directives', 'selections'], ['condition']);
1866
1867 if (!nextNode.selections.length) {
1868 nextNode = null;
1869 }
1870
1871 break;
1872
1873 case 'InlineFragment':
1874 nextNode = this._traverseChildren(prevNode, ['directives', 'selections']);
1875
1876 if (!nextNode.selections.length) {
1877 nextNode = null;
1878 }
1879
1880 break;
1881
1882 case 'Fragment':
1883 case 'Root':
1884 nextNode = this._traverseChildren(prevNode, ['argumentDefinitions', 'directives', 'selections']);
1885 break;
1886
1887 case 'Request':
1888 nextNode = this._traverseChildren(prevNode, null, ['fragment', 'root']);
1889 break;
1890
1891 case 'SplitOperation':
1892 nextNode = this._traverseChildren(prevNode, ['selections']);
1893 break;
1894
1895 default:
1896 prevNode;
1897 true ? true ? __webpack_require__(4)(false, 'GraphQLIRTransformer: Unknown kind `%s`.', prevNode.kind) : undefined : undefined;
1898 }
1899
1900 return nextNode;
1901 };
1902
1903 _proto._traverseChildren = function _traverseChildren(prevNode, pluralKeys, singularKeys) {
1904 var _this = this;
1905
1906 var nextNode;
1907 pluralKeys && pluralKeys.forEach(function (key) {
1908 var prevItems = prevNode[key];
1909
1910 if (!prevItems) {
1911 return;
1912 }
1913
1914 !Array.isArray(prevItems) ? true ? __webpack_require__(4)(false, 'GraphQLIRTransformer: Expected data for `%s` to be an array, got `%s`.', key, prevItems) : undefined : void 0;
1915
1916 var nextItems = _this._map(prevItems);
1917
1918 if (nextNode || nextItems !== prevItems) {
1919 nextNode = nextNode || (0, _objectSpread2["default"])({}, prevNode);
1920 nextNode[key] = nextItems;
1921 }
1922 });
1923 singularKeys && singularKeys.forEach(function (key) {
1924 var prevItem = prevNode[key];
1925
1926 if (!prevItem) {
1927 return;
1928 }
1929
1930 var nextItem = _this._visit(prevItem);
1931
1932 if (nextNode || nextItem !== prevItem) {
1933 nextNode = nextNode || (0, _objectSpread2["default"])({}, prevNode);
1934 nextNode[key] = nextItem;
1935 }
1936 });
1937 return nextNode || prevNode;
1938 };
1939
1940 _proto._map = function _map(prevItems) {
1941 var _this2 = this;
1942
1943 var nextItems;
1944 prevItems.forEach(function (prevItem, index) {
1945 var nextItem = _this2._visit(prevItem);
1946
1947 if (nextItems || nextItem !== prevItem) {
1948 nextItems = nextItems || prevItems.slice(0, index);
1949
1950 if (nextItem) {
1951 nextItems.push(nextItem);
1952 }
1953 }
1954 });
1955 return nextItems || prevItems;
1956 };
1957
1958 _proto._getState = function _getState() {
1959 !this._states.length ? true ? __webpack_require__(4)(false, 'GraphQLIRTransformer: Expected a current state to be set but found none. ' + 'This is usually the result of mismatched number of pushState()/popState() ' + 'calls.') : undefined : void 0;
1960 return this._states[this._states.length - 1];
1961 };
1962
1963 return Transformer;
1964}();
1965
1966module.exports = {
1967 transform: transform
1968};
1969
1970/***/ }),
1971/* 11 */
1972/***/ (function(module, exports, __webpack_require__) {
1973
1974var arrayWithoutHoles = __webpack_require__(108);
1975
1976var iterableToArray = __webpack_require__(109);
1977
1978var nonIterableSpread = __webpack_require__(110);
1979
1980function _toConsumableArray(arr) {
1981 return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
1982}
1983
1984module.exports = _toConsumableArray;
1985
1986/***/ }),
1987/* 12 */
1988/***/ (function(module, exports, __webpack_require__) {
1989
1990"use strict";
1991
1992
1993Object.defineProperty(exports, "__esModule", {
1994 value: true
1995});
1996exports.isArrayExpression = isArrayExpression;
1997exports.isAssignmentExpression = isAssignmentExpression;
1998exports.isBinaryExpression = isBinaryExpression;
1999exports.isInterpreterDirective = isInterpreterDirective;
2000exports.isDirective = isDirective;
2001exports.isDirectiveLiteral = isDirectiveLiteral;
2002exports.isBlockStatement = isBlockStatement;
2003exports.isBreakStatement = isBreakStatement;
2004exports.isCallExpression = isCallExpression;
2005exports.isCatchClause = isCatchClause;
2006exports.isConditionalExpression = isConditionalExpression;
2007exports.isContinueStatement = isContinueStatement;
2008exports.isDebuggerStatement = isDebuggerStatement;
2009exports.isDoWhileStatement = isDoWhileStatement;
2010exports.isEmptyStatement = isEmptyStatement;
2011exports.isExpressionStatement = isExpressionStatement;
2012exports.isFile = isFile;
2013exports.isForInStatement = isForInStatement;
2014exports.isForStatement = isForStatement;
2015exports.isFunctionDeclaration = isFunctionDeclaration;
2016exports.isFunctionExpression = isFunctionExpression;
2017exports.isIdentifier = isIdentifier;
2018exports.isIfStatement = isIfStatement;
2019exports.isLabeledStatement = isLabeledStatement;
2020exports.isStringLiteral = isStringLiteral;
2021exports.isNumericLiteral = isNumericLiteral;
2022exports.isNullLiteral = isNullLiteral;
2023exports.isBooleanLiteral = isBooleanLiteral;
2024exports.isRegExpLiteral = isRegExpLiteral;
2025exports.isLogicalExpression = isLogicalExpression;
2026exports.isMemberExpression = isMemberExpression;
2027exports.isNewExpression = isNewExpression;
2028exports.isProgram = isProgram;
2029exports.isObjectExpression = isObjectExpression;
2030exports.isObjectMethod = isObjectMethod;
2031exports.isObjectProperty = isObjectProperty;
2032exports.isRestElement = isRestElement;
2033exports.isReturnStatement = isReturnStatement;
2034exports.isSequenceExpression = isSequenceExpression;
2035exports.isSwitchCase = isSwitchCase;
2036exports.isSwitchStatement = isSwitchStatement;
2037exports.isThisExpression = isThisExpression;
2038exports.isThrowStatement = isThrowStatement;
2039exports.isTryStatement = isTryStatement;
2040exports.isUnaryExpression = isUnaryExpression;
2041exports.isUpdateExpression = isUpdateExpression;
2042exports.isVariableDeclaration = isVariableDeclaration;
2043exports.isVariableDeclarator = isVariableDeclarator;
2044exports.isWhileStatement = isWhileStatement;
2045exports.isWithStatement = isWithStatement;
2046exports.isAssignmentPattern = isAssignmentPattern;
2047exports.isArrayPattern = isArrayPattern;
2048exports.isArrowFunctionExpression = isArrowFunctionExpression;
2049exports.isClassBody = isClassBody;
2050exports.isClassDeclaration = isClassDeclaration;
2051exports.isClassExpression = isClassExpression;
2052exports.isExportAllDeclaration = isExportAllDeclaration;
2053exports.isExportDefaultDeclaration = isExportDefaultDeclaration;
2054exports.isExportNamedDeclaration = isExportNamedDeclaration;
2055exports.isExportSpecifier = isExportSpecifier;
2056exports.isForOfStatement = isForOfStatement;
2057exports.isImportDeclaration = isImportDeclaration;
2058exports.isImportDefaultSpecifier = isImportDefaultSpecifier;
2059exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier;
2060exports.isImportSpecifier = isImportSpecifier;
2061exports.isMetaProperty = isMetaProperty;
2062exports.isClassMethod = isClassMethod;
2063exports.isObjectPattern = isObjectPattern;
2064exports.isSpreadElement = isSpreadElement;
2065exports.isSuper = isSuper;
2066exports.isTaggedTemplateExpression = isTaggedTemplateExpression;
2067exports.isTemplateElement = isTemplateElement;
2068exports.isTemplateLiteral = isTemplateLiteral;
2069exports.isYieldExpression = isYieldExpression;
2070exports.isAnyTypeAnnotation = isAnyTypeAnnotation;
2071exports.isArrayTypeAnnotation = isArrayTypeAnnotation;
2072exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation;
2073exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation;
2074exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation;
2075exports.isClassImplements = isClassImplements;
2076exports.isDeclareClass = isDeclareClass;
2077exports.isDeclareFunction = isDeclareFunction;
2078exports.isDeclareInterface = isDeclareInterface;
2079exports.isDeclareModule = isDeclareModule;
2080exports.isDeclareModuleExports = isDeclareModuleExports;
2081exports.isDeclareTypeAlias = isDeclareTypeAlias;
2082exports.isDeclareOpaqueType = isDeclareOpaqueType;
2083exports.isDeclareVariable = isDeclareVariable;
2084exports.isDeclareExportDeclaration = isDeclareExportDeclaration;
2085exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration;
2086exports.isDeclaredPredicate = isDeclaredPredicate;
2087exports.isExistsTypeAnnotation = isExistsTypeAnnotation;
2088exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation;
2089exports.isFunctionTypeParam = isFunctionTypeParam;
2090exports.isGenericTypeAnnotation = isGenericTypeAnnotation;
2091exports.isInferredPredicate = isInferredPredicate;
2092exports.isInterfaceExtends = isInterfaceExtends;
2093exports.isInterfaceDeclaration = isInterfaceDeclaration;
2094exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation;
2095exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation;
2096exports.isMixedTypeAnnotation = isMixedTypeAnnotation;
2097exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation;
2098exports.isNullableTypeAnnotation = isNullableTypeAnnotation;
2099exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation;
2100exports.isNumberTypeAnnotation = isNumberTypeAnnotation;
2101exports.isObjectTypeAnnotation = isObjectTypeAnnotation;
2102exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot;
2103exports.isObjectTypeCallProperty = isObjectTypeCallProperty;
2104exports.isObjectTypeIndexer = isObjectTypeIndexer;
2105exports.isObjectTypeProperty = isObjectTypeProperty;
2106exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty;
2107exports.isOpaqueType = isOpaqueType;
2108exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier;
2109exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation;
2110exports.isStringTypeAnnotation = isStringTypeAnnotation;
2111exports.isThisTypeAnnotation = isThisTypeAnnotation;
2112exports.isTupleTypeAnnotation = isTupleTypeAnnotation;
2113exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation;
2114exports.isTypeAlias = isTypeAlias;
2115exports.isTypeAnnotation = isTypeAnnotation;
2116exports.isTypeCastExpression = isTypeCastExpression;
2117exports.isTypeParameter = isTypeParameter;
2118exports.isTypeParameterDeclaration = isTypeParameterDeclaration;
2119exports.isTypeParameterInstantiation = isTypeParameterInstantiation;
2120exports.isUnionTypeAnnotation = isUnionTypeAnnotation;
2121exports.isVariance = isVariance;
2122exports.isVoidTypeAnnotation = isVoidTypeAnnotation;
2123exports.isJSXAttribute = isJSXAttribute;
2124exports.isJSXClosingElement = isJSXClosingElement;
2125exports.isJSXElement = isJSXElement;
2126exports.isJSXEmptyExpression = isJSXEmptyExpression;
2127exports.isJSXExpressionContainer = isJSXExpressionContainer;
2128exports.isJSXSpreadChild = isJSXSpreadChild;
2129exports.isJSXIdentifier = isJSXIdentifier;
2130exports.isJSXMemberExpression = isJSXMemberExpression;
2131exports.isJSXNamespacedName = isJSXNamespacedName;
2132exports.isJSXOpeningElement = isJSXOpeningElement;
2133exports.isJSXSpreadAttribute = isJSXSpreadAttribute;
2134exports.isJSXText = isJSXText;
2135exports.isJSXFragment = isJSXFragment;
2136exports.isJSXOpeningFragment = isJSXOpeningFragment;
2137exports.isJSXClosingFragment = isJSXClosingFragment;
2138exports.isNoop = isNoop;
2139exports.isParenthesizedExpression = isParenthesizedExpression;
2140exports.isAwaitExpression = isAwaitExpression;
2141exports.isBindExpression = isBindExpression;
2142exports.isClassProperty = isClassProperty;
2143exports.isOptionalMemberExpression = isOptionalMemberExpression;
2144exports.isOptionalCallExpression = isOptionalCallExpression;
2145exports.isClassPrivateProperty = isClassPrivateProperty;
2146exports.isImport = isImport;
2147exports.isDecorator = isDecorator;
2148exports.isDoExpression = isDoExpression;
2149exports.isExportDefaultSpecifier = isExportDefaultSpecifier;
2150exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier;
2151exports.isPrivateName = isPrivateName;
2152exports.isBigIntLiteral = isBigIntLiteral;
2153exports.isTSParameterProperty = isTSParameterProperty;
2154exports.isTSDeclareFunction = isTSDeclareFunction;
2155exports.isTSDeclareMethod = isTSDeclareMethod;
2156exports.isTSQualifiedName = isTSQualifiedName;
2157exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration;
2158exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration;
2159exports.isTSPropertySignature = isTSPropertySignature;
2160exports.isTSMethodSignature = isTSMethodSignature;
2161exports.isTSIndexSignature = isTSIndexSignature;
2162exports.isTSAnyKeyword = isTSAnyKeyword;
2163exports.isTSNumberKeyword = isTSNumberKeyword;
2164exports.isTSObjectKeyword = isTSObjectKeyword;
2165exports.isTSBooleanKeyword = isTSBooleanKeyword;
2166exports.isTSStringKeyword = isTSStringKeyword;
2167exports.isTSSymbolKeyword = isTSSymbolKeyword;
2168exports.isTSVoidKeyword = isTSVoidKeyword;
2169exports.isTSUndefinedKeyword = isTSUndefinedKeyword;
2170exports.isTSNullKeyword = isTSNullKeyword;
2171exports.isTSNeverKeyword = isTSNeverKeyword;
2172exports.isTSThisType = isTSThisType;
2173exports.isTSFunctionType = isTSFunctionType;
2174exports.isTSConstructorType = isTSConstructorType;
2175exports.isTSTypeReference = isTSTypeReference;
2176exports.isTSTypePredicate = isTSTypePredicate;
2177exports.isTSTypeQuery = isTSTypeQuery;
2178exports.isTSTypeLiteral = isTSTypeLiteral;
2179exports.isTSArrayType = isTSArrayType;
2180exports.isTSTupleType = isTSTupleType;
2181exports.isTSUnionType = isTSUnionType;
2182exports.isTSIntersectionType = isTSIntersectionType;
2183exports.isTSConditionalType = isTSConditionalType;
2184exports.isTSInferType = isTSInferType;
2185exports.isTSParenthesizedType = isTSParenthesizedType;
2186exports.isTSTypeOperator = isTSTypeOperator;
2187exports.isTSIndexedAccessType = isTSIndexedAccessType;
2188exports.isTSMappedType = isTSMappedType;
2189exports.isTSLiteralType = isTSLiteralType;
2190exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments;
2191exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration;
2192exports.isTSInterfaceBody = isTSInterfaceBody;
2193exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration;
2194exports.isTSAsExpression = isTSAsExpression;
2195exports.isTSTypeAssertion = isTSTypeAssertion;
2196exports.isTSEnumDeclaration = isTSEnumDeclaration;
2197exports.isTSEnumMember = isTSEnumMember;
2198exports.isTSModuleDeclaration = isTSModuleDeclaration;
2199exports.isTSModuleBlock = isTSModuleBlock;
2200exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration;
2201exports.isTSExternalModuleReference = isTSExternalModuleReference;
2202exports.isTSNonNullExpression = isTSNonNullExpression;
2203exports.isTSExportAssignment = isTSExportAssignment;
2204exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration;
2205exports.isTSTypeAnnotation = isTSTypeAnnotation;
2206exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation;
2207exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration;
2208exports.isTSTypeParameter = isTSTypeParameter;
2209exports.isExpression = isExpression;
2210exports.isBinary = isBinary;
2211exports.isScopable = isScopable;
2212exports.isBlockParent = isBlockParent;
2213exports.isBlock = isBlock;
2214exports.isStatement = isStatement;
2215exports.isTerminatorless = isTerminatorless;
2216exports.isCompletionStatement = isCompletionStatement;
2217exports.isConditional = isConditional;
2218exports.isLoop = isLoop;
2219exports.isWhile = isWhile;
2220exports.isExpressionWrapper = isExpressionWrapper;
2221exports.isFor = isFor;
2222exports.isForXStatement = isForXStatement;
2223exports.isFunction = isFunction;
2224exports.isFunctionParent = isFunctionParent;
2225exports.isPureish = isPureish;
2226exports.isDeclaration = isDeclaration;
2227exports.isPatternLike = isPatternLike;
2228exports.isLVal = isLVal;
2229exports.isTSEntityName = isTSEntityName;
2230exports.isLiteral = isLiteral;
2231exports.isImmutable = isImmutable;
2232exports.isUserWhitespacable = isUserWhitespacable;
2233exports.isMethod = isMethod;
2234exports.isObjectMember = isObjectMember;
2235exports.isProperty = isProperty;
2236exports.isUnaryLike = isUnaryLike;
2237exports.isPattern = isPattern;
2238exports.isClass = isClass;
2239exports.isModuleDeclaration = isModuleDeclaration;
2240exports.isExportDeclaration = isExportDeclaration;
2241exports.isModuleSpecifier = isModuleSpecifier;
2242exports.isFlow = isFlow;
2243exports.isFlowType = isFlowType;
2244exports.isFlowBaseAnnotation = isFlowBaseAnnotation;
2245exports.isFlowDeclaration = isFlowDeclaration;
2246exports.isFlowPredicate = isFlowPredicate;
2247exports.isJSX = isJSX;
2248exports.isPrivate = isPrivate;
2249exports.isTSTypeElement = isTSTypeElement;
2250exports.isTSType = isTSType;
2251exports.isNumberLiteral = isNumberLiteral;
2252exports.isRegexLiteral = isRegexLiteral;
2253exports.isRestProperty = isRestProperty;
2254exports.isSpreadProperty = isSpreadProperty;
2255
2256var _shallowEqual = _interopRequireDefault(__webpack_require__(39));
2257
2258function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2259
2260function isArrayExpression(node, opts) {
2261 if (!node) return false;
2262 const nodeType = node.type;
2263
2264 if (nodeType === "ArrayExpression") {
2265 if (typeof opts === "undefined") {
2266 return true;
2267 } else {
2268 return (0, _shallowEqual.default)(node, opts);
2269 }
2270 }
2271
2272 return false;
2273}
2274
2275function isAssignmentExpression(node, opts) {
2276 if (!node) return false;
2277 const nodeType = node.type;
2278
2279 if (nodeType === "AssignmentExpression") {
2280 if (typeof opts === "undefined") {
2281 return true;
2282 } else {
2283 return (0, _shallowEqual.default)(node, opts);
2284 }
2285 }
2286
2287 return false;
2288}
2289
2290function isBinaryExpression(node, opts) {
2291 if (!node) return false;
2292 const nodeType = node.type;
2293
2294 if (nodeType === "BinaryExpression") {
2295 if (typeof opts === "undefined") {
2296 return true;
2297 } else {
2298 return (0, _shallowEqual.default)(node, opts);
2299 }
2300 }
2301
2302 return false;
2303}
2304
2305function isInterpreterDirective(node, opts) {
2306 if (!node) return false;
2307 const nodeType = node.type;
2308
2309 if (nodeType === "InterpreterDirective") {
2310 if (typeof opts === "undefined") {
2311 return true;
2312 } else {
2313 return (0, _shallowEqual.default)(node, opts);
2314 }
2315 }
2316
2317 return false;
2318}
2319
2320function isDirective(node, opts) {
2321 if (!node) return false;
2322 const nodeType = node.type;
2323
2324 if (nodeType === "Directive") {
2325 if (typeof opts === "undefined") {
2326 return true;
2327 } else {
2328 return (0, _shallowEqual.default)(node, opts);
2329 }
2330 }
2331
2332 return false;
2333}
2334
2335function isDirectiveLiteral(node, opts) {
2336 if (!node) return false;
2337 const nodeType = node.type;
2338
2339 if (nodeType === "DirectiveLiteral") {
2340 if (typeof opts === "undefined") {
2341 return true;
2342 } else {
2343 return (0, _shallowEqual.default)(node, opts);
2344 }
2345 }
2346
2347 return false;
2348}
2349
2350function isBlockStatement(node, opts) {
2351 if (!node) return false;
2352 const nodeType = node.type;
2353
2354 if (nodeType === "BlockStatement") {
2355 if (typeof opts === "undefined") {
2356 return true;
2357 } else {
2358 return (0, _shallowEqual.default)(node, opts);
2359 }
2360 }
2361
2362 return false;
2363}
2364
2365function isBreakStatement(node, opts) {
2366 if (!node) return false;
2367 const nodeType = node.type;
2368
2369 if (nodeType === "BreakStatement") {
2370 if (typeof opts === "undefined") {
2371 return true;
2372 } else {
2373 return (0, _shallowEqual.default)(node, opts);
2374 }
2375 }
2376
2377 return false;
2378}
2379
2380function isCallExpression(node, opts) {
2381 if (!node) return false;
2382 const nodeType = node.type;
2383
2384 if (nodeType === "CallExpression") {
2385 if (typeof opts === "undefined") {
2386 return true;
2387 } else {
2388 return (0, _shallowEqual.default)(node, opts);
2389 }
2390 }
2391
2392 return false;
2393}
2394
2395function isCatchClause(node, opts) {
2396 if (!node) return false;
2397 const nodeType = node.type;
2398
2399 if (nodeType === "CatchClause") {
2400 if (typeof opts === "undefined") {
2401 return true;
2402 } else {
2403 return (0, _shallowEqual.default)(node, opts);
2404 }
2405 }
2406
2407 return false;
2408}
2409
2410function isConditionalExpression(node, opts) {
2411 if (!node) return false;
2412 const nodeType = node.type;
2413
2414 if (nodeType === "ConditionalExpression") {
2415 if (typeof opts === "undefined") {
2416 return true;
2417 } else {
2418 return (0, _shallowEqual.default)(node, opts);
2419 }
2420 }
2421
2422 return false;
2423}
2424
2425function isContinueStatement(node, opts) {
2426 if (!node) return false;
2427 const nodeType = node.type;
2428
2429 if (nodeType === "ContinueStatement") {
2430 if (typeof opts === "undefined") {
2431 return true;
2432 } else {
2433 return (0, _shallowEqual.default)(node, opts);
2434 }
2435 }
2436
2437 return false;
2438}
2439
2440function isDebuggerStatement(node, opts) {
2441 if (!node) return false;
2442 const nodeType = node.type;
2443
2444 if (nodeType === "DebuggerStatement") {
2445 if (typeof opts === "undefined") {
2446 return true;
2447 } else {
2448 return (0, _shallowEqual.default)(node, opts);
2449 }
2450 }
2451
2452 return false;
2453}
2454
2455function isDoWhileStatement(node, opts) {
2456 if (!node) return false;
2457 const nodeType = node.type;
2458
2459 if (nodeType === "DoWhileStatement") {
2460 if (typeof opts === "undefined") {
2461 return true;
2462 } else {
2463 return (0, _shallowEqual.default)(node, opts);
2464 }
2465 }
2466
2467 return false;
2468}
2469
2470function isEmptyStatement(node, opts) {
2471 if (!node) return false;
2472 const nodeType = node.type;
2473
2474 if (nodeType === "EmptyStatement") {
2475 if (typeof opts === "undefined") {
2476 return true;
2477 } else {
2478 return (0, _shallowEqual.default)(node, opts);
2479 }
2480 }
2481
2482 return false;
2483}
2484
2485function isExpressionStatement(node, opts) {
2486 if (!node) return false;
2487 const nodeType = node.type;
2488
2489 if (nodeType === "ExpressionStatement") {
2490 if (typeof opts === "undefined") {
2491 return true;
2492 } else {
2493 return (0, _shallowEqual.default)(node, opts);
2494 }
2495 }
2496
2497 return false;
2498}
2499
2500function isFile(node, opts) {
2501 if (!node) return false;
2502 const nodeType = node.type;
2503
2504 if (nodeType === "File") {
2505 if (typeof opts === "undefined") {
2506 return true;
2507 } else {
2508 return (0, _shallowEqual.default)(node, opts);
2509 }
2510 }
2511
2512 return false;
2513}
2514
2515function isForInStatement(node, opts) {
2516 if (!node) return false;
2517 const nodeType = node.type;
2518
2519 if (nodeType === "ForInStatement") {
2520 if (typeof opts === "undefined") {
2521 return true;
2522 } else {
2523 return (0, _shallowEqual.default)(node, opts);
2524 }
2525 }
2526
2527 return false;
2528}
2529
2530function isForStatement(node, opts) {
2531 if (!node) return false;
2532 const nodeType = node.type;
2533
2534 if (nodeType === "ForStatement") {
2535 if (typeof opts === "undefined") {
2536 return true;
2537 } else {
2538 return (0, _shallowEqual.default)(node, opts);
2539 }
2540 }
2541
2542 return false;
2543}
2544
2545function isFunctionDeclaration(node, opts) {
2546 if (!node) return false;
2547 const nodeType = node.type;
2548
2549 if (nodeType === "FunctionDeclaration") {
2550 if (typeof opts === "undefined") {
2551 return true;
2552 } else {
2553 return (0, _shallowEqual.default)(node, opts);
2554 }
2555 }
2556
2557 return false;
2558}
2559
2560function isFunctionExpression(node, opts) {
2561 if (!node) return false;
2562 const nodeType = node.type;
2563
2564 if (nodeType === "FunctionExpression") {
2565 if (typeof opts === "undefined") {
2566 return true;
2567 } else {
2568 return (0, _shallowEqual.default)(node, opts);
2569 }
2570 }
2571
2572 return false;
2573}
2574
2575function isIdentifier(node, opts) {
2576 if (!node) return false;
2577 const nodeType = node.type;
2578
2579 if (nodeType === "Identifier") {
2580 if (typeof opts === "undefined") {
2581 return true;
2582 } else {
2583 return (0, _shallowEqual.default)(node, opts);
2584 }
2585 }
2586
2587 return false;
2588}
2589
2590function isIfStatement(node, opts) {
2591 if (!node) return false;
2592 const nodeType = node.type;
2593
2594 if (nodeType === "IfStatement") {
2595 if (typeof opts === "undefined") {
2596 return true;
2597 } else {
2598 return (0, _shallowEqual.default)(node, opts);
2599 }
2600 }
2601
2602 return false;
2603}
2604
2605function isLabeledStatement(node, opts) {
2606 if (!node) return false;
2607 const nodeType = node.type;
2608
2609 if (nodeType === "LabeledStatement") {
2610 if (typeof opts === "undefined") {
2611 return true;
2612 } else {
2613 return (0, _shallowEqual.default)(node, opts);
2614 }
2615 }
2616
2617 return false;
2618}
2619
2620function isStringLiteral(node, opts) {
2621 if (!node) return false;
2622 const nodeType = node.type;
2623
2624 if (nodeType === "StringLiteral") {
2625 if (typeof opts === "undefined") {
2626 return true;
2627 } else {
2628 return (0, _shallowEqual.default)(node, opts);
2629 }
2630 }
2631
2632 return false;
2633}
2634
2635function isNumericLiteral(node, opts) {
2636 if (!node) return false;
2637 const nodeType = node.type;
2638
2639 if (nodeType === "NumericLiteral") {
2640 if (typeof opts === "undefined") {
2641 return true;
2642 } else {
2643 return (0, _shallowEqual.default)(node, opts);
2644 }
2645 }
2646
2647 return false;
2648}
2649
2650function isNullLiteral(node, opts) {
2651 if (!node) return false;
2652 const nodeType = node.type;
2653
2654 if (nodeType === "NullLiteral") {
2655 if (typeof opts === "undefined") {
2656 return true;
2657 } else {
2658 return (0, _shallowEqual.default)(node, opts);
2659 }
2660 }
2661
2662 return false;
2663}
2664
2665function isBooleanLiteral(node, opts) {
2666 if (!node) return false;
2667 const nodeType = node.type;
2668
2669 if (nodeType === "BooleanLiteral") {
2670 if (typeof opts === "undefined") {
2671 return true;
2672 } else {
2673 return (0, _shallowEqual.default)(node, opts);
2674 }
2675 }
2676
2677 return false;
2678}
2679
2680function isRegExpLiteral(node, opts) {
2681 if (!node) return false;
2682 const nodeType = node.type;
2683
2684 if (nodeType === "RegExpLiteral") {
2685 if (typeof opts === "undefined") {
2686 return true;
2687 } else {
2688 return (0, _shallowEqual.default)(node, opts);
2689 }
2690 }
2691
2692 return false;
2693}
2694
2695function isLogicalExpression(node, opts) {
2696 if (!node) return false;
2697 const nodeType = node.type;
2698
2699 if (nodeType === "LogicalExpression") {
2700 if (typeof opts === "undefined") {
2701 return true;
2702 } else {
2703 return (0, _shallowEqual.default)(node, opts);
2704 }
2705 }
2706
2707 return false;
2708}
2709
2710function isMemberExpression(node, opts) {
2711 if (!node) return false;
2712 const nodeType = node.type;
2713
2714 if (nodeType === "MemberExpression") {
2715 if (typeof opts === "undefined") {
2716 return true;
2717 } else {
2718 return (0, _shallowEqual.default)(node, opts);
2719 }
2720 }
2721
2722 return false;
2723}
2724
2725function isNewExpression(node, opts) {
2726 if (!node) return false;
2727 const nodeType = node.type;
2728
2729 if (nodeType === "NewExpression") {
2730 if (typeof opts === "undefined") {
2731 return true;
2732 } else {
2733 return (0, _shallowEqual.default)(node, opts);
2734 }
2735 }
2736
2737 return false;
2738}
2739
2740function isProgram(node, opts) {
2741 if (!node) return false;
2742 const nodeType = node.type;
2743
2744 if (nodeType === "Program") {
2745 if (typeof opts === "undefined") {
2746 return true;
2747 } else {
2748 return (0, _shallowEqual.default)(node, opts);
2749 }
2750 }
2751
2752 return false;
2753}
2754
2755function isObjectExpression(node, opts) {
2756 if (!node) return false;
2757 const nodeType = node.type;
2758
2759 if (nodeType === "ObjectExpression") {
2760 if (typeof opts === "undefined") {
2761 return true;
2762 } else {
2763 return (0, _shallowEqual.default)(node, opts);
2764 }
2765 }
2766
2767 return false;
2768}
2769
2770function isObjectMethod(node, opts) {
2771 if (!node) return false;
2772 const nodeType = node.type;
2773
2774 if (nodeType === "ObjectMethod") {
2775 if (typeof opts === "undefined") {
2776 return true;
2777 } else {
2778 return (0, _shallowEqual.default)(node, opts);
2779 }
2780 }
2781
2782 return false;
2783}
2784
2785function isObjectProperty(node, opts) {
2786 if (!node) return false;
2787 const nodeType = node.type;
2788
2789 if (nodeType === "ObjectProperty") {
2790 if (typeof opts === "undefined") {
2791 return true;
2792 } else {
2793 return (0, _shallowEqual.default)(node, opts);
2794 }
2795 }
2796
2797 return false;
2798}
2799
2800function isRestElement(node, opts) {
2801 if (!node) return false;
2802 const nodeType = node.type;
2803
2804 if (nodeType === "RestElement") {
2805 if (typeof opts === "undefined") {
2806 return true;
2807 } else {
2808 return (0, _shallowEqual.default)(node, opts);
2809 }
2810 }
2811
2812 return false;
2813}
2814
2815function isReturnStatement(node, opts) {
2816 if (!node) return false;
2817 const nodeType = node.type;
2818
2819 if (nodeType === "ReturnStatement") {
2820 if (typeof opts === "undefined") {
2821 return true;
2822 } else {
2823 return (0, _shallowEqual.default)(node, opts);
2824 }
2825 }
2826
2827 return false;
2828}
2829
2830function isSequenceExpression(node, opts) {
2831 if (!node) return false;
2832 const nodeType = node.type;
2833
2834 if (nodeType === "SequenceExpression") {
2835 if (typeof opts === "undefined") {
2836 return true;
2837 } else {
2838 return (0, _shallowEqual.default)(node, opts);
2839 }
2840 }
2841
2842 return false;
2843}
2844
2845function isSwitchCase(node, opts) {
2846 if (!node) return false;
2847 const nodeType = node.type;
2848
2849 if (nodeType === "SwitchCase") {
2850 if (typeof opts === "undefined") {
2851 return true;
2852 } else {
2853 return (0, _shallowEqual.default)(node, opts);
2854 }
2855 }
2856
2857 return false;
2858}
2859
2860function isSwitchStatement(node, opts) {
2861 if (!node) return false;
2862 const nodeType = node.type;
2863
2864 if (nodeType === "SwitchStatement") {
2865 if (typeof opts === "undefined") {
2866 return true;
2867 } else {
2868 return (0, _shallowEqual.default)(node, opts);
2869 }
2870 }
2871
2872 return false;
2873}
2874
2875function isThisExpression(node, opts) {
2876 if (!node) return false;
2877 const nodeType = node.type;
2878
2879 if (nodeType === "ThisExpression") {
2880 if (typeof opts === "undefined") {
2881 return true;
2882 } else {
2883 return (0, _shallowEqual.default)(node, opts);
2884 }
2885 }
2886
2887 return false;
2888}
2889
2890function isThrowStatement(node, opts) {
2891 if (!node) return false;
2892 const nodeType = node.type;
2893
2894 if (nodeType === "ThrowStatement") {
2895 if (typeof opts === "undefined") {
2896 return true;
2897 } else {
2898 return (0, _shallowEqual.default)(node, opts);
2899 }
2900 }
2901
2902 return false;
2903}
2904
2905function isTryStatement(node, opts) {
2906 if (!node) return false;
2907 const nodeType = node.type;
2908
2909 if (nodeType === "TryStatement") {
2910 if (typeof opts === "undefined") {
2911 return true;
2912 } else {
2913 return (0, _shallowEqual.default)(node, opts);
2914 }
2915 }
2916
2917 return false;
2918}
2919
2920function isUnaryExpression(node, opts) {
2921 if (!node) return false;
2922 const nodeType = node.type;
2923
2924 if (nodeType === "UnaryExpression") {
2925 if (typeof opts === "undefined") {
2926 return true;
2927 } else {
2928 return (0, _shallowEqual.default)(node, opts);
2929 }
2930 }
2931
2932 return false;
2933}
2934
2935function isUpdateExpression(node, opts) {
2936 if (!node) return false;
2937 const nodeType = node.type;
2938
2939 if (nodeType === "UpdateExpression") {
2940 if (typeof opts === "undefined") {
2941 return true;
2942 } else {
2943 return (0, _shallowEqual.default)(node, opts);
2944 }
2945 }
2946
2947 return false;
2948}
2949
2950function isVariableDeclaration(node, opts) {
2951 if (!node) return false;
2952 const nodeType = node.type;
2953
2954 if (nodeType === "VariableDeclaration") {
2955 if (typeof opts === "undefined") {
2956 return true;
2957 } else {
2958 return (0, _shallowEqual.default)(node, opts);
2959 }
2960 }
2961
2962 return false;
2963}
2964
2965function isVariableDeclarator(node, opts) {
2966 if (!node) return false;
2967 const nodeType = node.type;
2968
2969 if (nodeType === "VariableDeclarator") {
2970 if (typeof opts === "undefined") {
2971 return true;
2972 } else {
2973 return (0, _shallowEqual.default)(node, opts);
2974 }
2975 }
2976
2977 return false;
2978}
2979
2980function isWhileStatement(node, opts) {
2981 if (!node) return false;
2982 const nodeType = node.type;
2983
2984 if (nodeType === "WhileStatement") {
2985 if (typeof opts === "undefined") {
2986 return true;
2987 } else {
2988 return (0, _shallowEqual.default)(node, opts);
2989 }
2990 }
2991
2992 return false;
2993}
2994
2995function isWithStatement(node, opts) {
2996 if (!node) return false;
2997 const nodeType = node.type;
2998
2999 if (nodeType === "WithStatement") {
3000 if (typeof opts === "undefined") {
3001 return true;
3002 } else {
3003 return (0, _shallowEqual.default)(node, opts);
3004 }
3005 }
3006
3007 return false;
3008}
3009
3010function isAssignmentPattern(node, opts) {
3011 if (!node) return false;
3012 const nodeType = node.type;
3013
3014 if (nodeType === "AssignmentPattern") {
3015 if (typeof opts === "undefined") {
3016 return true;
3017 } else {
3018 return (0, _shallowEqual.default)(node, opts);
3019 }
3020 }
3021
3022 return false;
3023}
3024
3025function isArrayPattern(node, opts) {
3026 if (!node) return false;
3027 const nodeType = node.type;
3028
3029 if (nodeType === "ArrayPattern") {
3030 if (typeof opts === "undefined") {
3031 return true;
3032 } else {
3033 return (0, _shallowEqual.default)(node, opts);
3034 }
3035 }
3036
3037 return false;
3038}
3039
3040function isArrowFunctionExpression(node, opts) {
3041 if (!node) return false;
3042 const nodeType = node.type;
3043
3044 if (nodeType === "ArrowFunctionExpression") {
3045 if (typeof opts === "undefined") {
3046 return true;
3047 } else {
3048 return (0, _shallowEqual.default)(node, opts);
3049 }
3050 }
3051
3052 return false;
3053}
3054
3055function isClassBody(node, opts) {
3056 if (!node) return false;
3057 const nodeType = node.type;
3058
3059 if (nodeType === "ClassBody") {
3060 if (typeof opts === "undefined") {
3061 return true;
3062 } else {
3063 return (0, _shallowEqual.default)(node, opts);
3064 }
3065 }
3066
3067 return false;
3068}
3069
3070function isClassDeclaration(node, opts) {
3071 if (!node) return false;
3072 const nodeType = node.type;
3073
3074 if (nodeType === "ClassDeclaration") {
3075 if (typeof opts === "undefined") {
3076 return true;
3077 } else {
3078 return (0, _shallowEqual.default)(node, opts);
3079 }
3080 }
3081
3082 return false;
3083}
3084
3085function isClassExpression(node, opts) {
3086 if (!node) return false;
3087 const nodeType = node.type;
3088
3089 if (nodeType === "ClassExpression") {
3090 if (typeof opts === "undefined") {
3091 return true;
3092 } else {
3093 return (0, _shallowEqual.default)(node, opts);
3094 }
3095 }
3096
3097 return false;
3098}
3099
3100function isExportAllDeclaration(node, opts) {
3101 if (!node) return false;
3102 const nodeType = node.type;
3103
3104 if (nodeType === "ExportAllDeclaration") {
3105 if (typeof opts === "undefined") {
3106 return true;
3107 } else {
3108 return (0, _shallowEqual.default)(node, opts);
3109 }
3110 }
3111
3112 return false;
3113}
3114
3115function isExportDefaultDeclaration(node, opts) {
3116 if (!node) return false;
3117 const nodeType = node.type;
3118
3119 if (nodeType === "ExportDefaultDeclaration") {
3120 if (typeof opts === "undefined") {
3121 return true;
3122 } else {
3123 return (0, _shallowEqual.default)(node, opts);
3124 }
3125 }
3126
3127 return false;
3128}
3129
3130function isExportNamedDeclaration(node, opts) {
3131 if (!node) return false;
3132 const nodeType = node.type;
3133
3134 if (nodeType === "ExportNamedDeclaration") {
3135 if (typeof opts === "undefined") {
3136 return true;
3137 } else {
3138 return (0, _shallowEqual.default)(node, opts);
3139 }
3140 }
3141
3142 return false;
3143}
3144
3145function isExportSpecifier(node, opts) {
3146 if (!node) return false;
3147 const nodeType = node.type;
3148
3149 if (nodeType === "ExportSpecifier") {
3150 if (typeof opts === "undefined") {
3151 return true;
3152 } else {
3153 return (0, _shallowEqual.default)(node, opts);
3154 }
3155 }
3156
3157 return false;
3158}
3159
3160function isForOfStatement(node, opts) {
3161 if (!node) return false;
3162 const nodeType = node.type;
3163
3164 if (nodeType === "ForOfStatement") {
3165 if (typeof opts === "undefined") {
3166 return true;
3167 } else {
3168 return (0, _shallowEqual.default)(node, opts);
3169 }
3170 }
3171
3172 return false;
3173}
3174
3175function isImportDeclaration(node, opts) {
3176 if (!node) return false;
3177 const nodeType = node.type;
3178
3179 if (nodeType === "ImportDeclaration") {
3180 if (typeof opts === "undefined") {
3181 return true;
3182 } else {
3183 return (0, _shallowEqual.default)(node, opts);
3184 }
3185 }
3186
3187 return false;
3188}
3189
3190function isImportDefaultSpecifier(node, opts) {
3191 if (!node) return false;
3192 const nodeType = node.type;
3193
3194 if (nodeType === "ImportDefaultSpecifier") {
3195 if (typeof opts === "undefined") {
3196 return true;
3197 } else {
3198 return (0, _shallowEqual.default)(node, opts);
3199 }
3200 }
3201
3202 return false;
3203}
3204
3205function isImportNamespaceSpecifier(node, opts) {
3206 if (!node) return false;
3207 const nodeType = node.type;
3208
3209 if (nodeType === "ImportNamespaceSpecifier") {
3210 if (typeof opts === "undefined") {
3211 return true;
3212 } else {
3213 return (0, _shallowEqual.default)(node, opts);
3214 }
3215 }
3216
3217 return false;
3218}
3219
3220function isImportSpecifier(node, opts) {
3221 if (!node) return false;
3222 const nodeType = node.type;
3223
3224 if (nodeType === "ImportSpecifier") {
3225 if (typeof opts === "undefined") {
3226 return true;
3227 } else {
3228 return (0, _shallowEqual.default)(node, opts);
3229 }
3230 }
3231
3232 return false;
3233}
3234
3235function isMetaProperty(node, opts) {
3236 if (!node) return false;
3237 const nodeType = node.type;
3238
3239 if (nodeType === "MetaProperty") {
3240 if (typeof opts === "undefined") {
3241 return true;
3242 } else {
3243 return (0, _shallowEqual.default)(node, opts);
3244 }
3245 }
3246
3247 return false;
3248}
3249
3250function isClassMethod(node, opts) {
3251 if (!node) return false;
3252 const nodeType = node.type;
3253
3254 if (nodeType === "ClassMethod") {
3255 if (typeof opts === "undefined") {
3256 return true;
3257 } else {
3258 return (0, _shallowEqual.default)(node, opts);
3259 }
3260 }
3261
3262 return false;
3263}
3264
3265function isObjectPattern(node, opts) {
3266 if (!node) return false;
3267 const nodeType = node.type;
3268
3269 if (nodeType === "ObjectPattern") {
3270 if (typeof opts === "undefined") {
3271 return true;
3272 } else {
3273 return (0, _shallowEqual.default)(node, opts);
3274 }
3275 }
3276
3277 return false;
3278}
3279
3280function isSpreadElement(node, opts) {
3281 if (!node) return false;
3282 const nodeType = node.type;
3283
3284 if (nodeType === "SpreadElement") {
3285 if (typeof opts === "undefined") {
3286 return true;
3287 } else {
3288 return (0, _shallowEqual.default)(node, opts);
3289 }
3290 }
3291
3292 return false;
3293}
3294
3295function isSuper(node, opts) {
3296 if (!node) return false;
3297 const nodeType = node.type;
3298
3299 if (nodeType === "Super") {
3300 if (typeof opts === "undefined") {
3301 return true;
3302 } else {
3303 return (0, _shallowEqual.default)(node, opts);
3304 }
3305 }
3306
3307 return false;
3308}
3309
3310function isTaggedTemplateExpression(node, opts) {
3311 if (!node) return false;
3312 const nodeType = node.type;
3313
3314 if (nodeType === "TaggedTemplateExpression") {
3315 if (typeof opts === "undefined") {
3316 return true;
3317 } else {
3318 return (0, _shallowEqual.default)(node, opts);
3319 }
3320 }
3321
3322 return false;
3323}
3324
3325function isTemplateElement(node, opts) {
3326 if (!node) return false;
3327 const nodeType = node.type;
3328
3329 if (nodeType === "TemplateElement") {
3330 if (typeof opts === "undefined") {
3331 return true;
3332 } else {
3333 return (0, _shallowEqual.default)(node, opts);
3334 }
3335 }
3336
3337 return false;
3338}
3339
3340function isTemplateLiteral(node, opts) {
3341 if (!node) return false;
3342 const nodeType = node.type;
3343
3344 if (nodeType === "TemplateLiteral") {
3345 if (typeof opts === "undefined") {
3346 return true;
3347 } else {
3348 return (0, _shallowEqual.default)(node, opts);
3349 }
3350 }
3351
3352 return false;
3353}
3354
3355function isYieldExpression(node, opts) {
3356 if (!node) return false;
3357 const nodeType = node.type;
3358
3359 if (nodeType === "YieldExpression") {
3360 if (typeof opts === "undefined") {
3361 return true;
3362 } else {
3363 return (0, _shallowEqual.default)(node, opts);
3364 }
3365 }
3366
3367 return false;
3368}
3369
3370function isAnyTypeAnnotation(node, opts) {
3371 if (!node) return false;
3372 const nodeType = node.type;
3373
3374 if (nodeType === "AnyTypeAnnotation") {
3375 if (typeof opts === "undefined") {
3376 return true;
3377 } else {
3378 return (0, _shallowEqual.default)(node, opts);
3379 }
3380 }
3381
3382 return false;
3383}
3384
3385function isArrayTypeAnnotation(node, opts) {
3386 if (!node) return false;
3387 const nodeType = node.type;
3388
3389 if (nodeType === "ArrayTypeAnnotation") {
3390 if (typeof opts === "undefined") {
3391 return true;
3392 } else {
3393 return (0, _shallowEqual.default)(node, opts);
3394 }
3395 }
3396
3397 return false;
3398}
3399
3400function isBooleanTypeAnnotation(node, opts) {
3401 if (!node) return false;
3402 const nodeType = node.type;
3403
3404 if (nodeType === "BooleanTypeAnnotation") {
3405 if (typeof opts === "undefined") {
3406 return true;
3407 } else {
3408 return (0, _shallowEqual.default)(node, opts);
3409 }
3410 }
3411
3412 return false;
3413}
3414
3415function isBooleanLiteralTypeAnnotation(node, opts) {
3416 if (!node) return false;
3417 const nodeType = node.type;
3418
3419 if (nodeType === "BooleanLiteralTypeAnnotation") {
3420 if (typeof opts === "undefined") {
3421 return true;
3422 } else {
3423 return (0, _shallowEqual.default)(node, opts);
3424 }
3425 }
3426
3427 return false;
3428}
3429
3430function isNullLiteralTypeAnnotation(node, opts) {
3431 if (!node) return false;
3432 const nodeType = node.type;
3433
3434 if (nodeType === "NullLiteralTypeAnnotation") {
3435 if (typeof opts === "undefined") {
3436 return true;
3437 } else {
3438 return (0, _shallowEqual.default)(node, opts);
3439 }
3440 }
3441
3442 return false;
3443}
3444
3445function isClassImplements(node, opts) {
3446 if (!node) return false;
3447 const nodeType = node.type;
3448
3449 if (nodeType === "ClassImplements") {
3450 if (typeof opts === "undefined") {
3451 return true;
3452 } else {
3453 return (0, _shallowEqual.default)(node, opts);
3454 }
3455 }
3456
3457 return false;
3458}
3459
3460function isDeclareClass(node, opts) {
3461 if (!node) return false;
3462 const nodeType = node.type;
3463
3464 if (nodeType === "DeclareClass") {
3465 if (typeof opts === "undefined") {
3466 return true;
3467 } else {
3468 return (0, _shallowEqual.default)(node, opts);
3469 }
3470 }
3471
3472 return false;
3473}
3474
3475function isDeclareFunction(node, opts) {
3476 if (!node) return false;
3477 const nodeType = node.type;
3478
3479 if (nodeType === "DeclareFunction") {
3480 if (typeof opts === "undefined") {
3481 return true;
3482 } else {
3483 return (0, _shallowEqual.default)(node, opts);
3484 }
3485 }
3486
3487 return false;
3488}
3489
3490function isDeclareInterface(node, opts) {
3491 if (!node) return false;
3492 const nodeType = node.type;
3493
3494 if (nodeType === "DeclareInterface") {
3495 if (typeof opts === "undefined") {
3496 return true;
3497 } else {
3498 return (0, _shallowEqual.default)(node, opts);
3499 }
3500 }
3501
3502 return false;
3503}
3504
3505function isDeclareModule(node, opts) {
3506 if (!node) return false;
3507 const nodeType = node.type;
3508
3509 if (nodeType === "DeclareModule") {
3510 if (typeof opts === "undefined") {
3511 return true;
3512 } else {
3513 return (0, _shallowEqual.default)(node, opts);
3514 }
3515 }
3516
3517 return false;
3518}
3519
3520function isDeclareModuleExports(node, opts) {
3521 if (!node) return false;
3522 const nodeType = node.type;
3523
3524 if (nodeType === "DeclareModuleExports") {
3525 if (typeof opts === "undefined") {
3526 return true;
3527 } else {
3528 return (0, _shallowEqual.default)(node, opts);
3529 }
3530 }
3531
3532 return false;
3533}
3534
3535function isDeclareTypeAlias(node, opts) {
3536 if (!node) return false;
3537 const nodeType = node.type;
3538
3539 if (nodeType === "DeclareTypeAlias") {
3540 if (typeof opts === "undefined") {
3541 return true;
3542 } else {
3543 return (0, _shallowEqual.default)(node, opts);
3544 }
3545 }
3546
3547 return false;
3548}
3549
3550function isDeclareOpaqueType(node, opts) {
3551 if (!node) return false;
3552 const nodeType = node.type;
3553
3554 if (nodeType === "DeclareOpaqueType") {
3555 if (typeof opts === "undefined") {
3556 return true;
3557 } else {
3558 return (0, _shallowEqual.default)(node, opts);
3559 }
3560 }
3561
3562 return false;
3563}
3564
3565function isDeclareVariable(node, opts) {
3566 if (!node) return false;
3567 const nodeType = node.type;
3568
3569 if (nodeType === "DeclareVariable") {
3570 if (typeof opts === "undefined") {
3571 return true;
3572 } else {
3573 return (0, _shallowEqual.default)(node, opts);
3574 }
3575 }
3576
3577 return false;
3578}
3579
3580function isDeclareExportDeclaration(node, opts) {
3581 if (!node) return false;
3582 const nodeType = node.type;
3583
3584 if (nodeType === "DeclareExportDeclaration") {
3585 if (typeof opts === "undefined") {
3586 return true;
3587 } else {
3588 return (0, _shallowEqual.default)(node, opts);
3589 }
3590 }
3591
3592 return false;
3593}
3594
3595function isDeclareExportAllDeclaration(node, opts) {
3596 if (!node) return false;
3597 const nodeType = node.type;
3598
3599 if (nodeType === "DeclareExportAllDeclaration") {
3600 if (typeof opts === "undefined") {
3601 return true;
3602 } else {
3603 return (0, _shallowEqual.default)(node, opts);
3604 }
3605 }
3606
3607 return false;
3608}
3609
3610function isDeclaredPredicate(node, opts) {
3611 if (!node) return false;
3612 const nodeType = node.type;
3613
3614 if (nodeType === "DeclaredPredicate") {
3615 if (typeof opts === "undefined") {
3616 return true;
3617 } else {
3618 return (0, _shallowEqual.default)(node, opts);
3619 }
3620 }
3621
3622 return false;
3623}
3624
3625function isExistsTypeAnnotation(node, opts) {
3626 if (!node) return false;
3627 const nodeType = node.type;
3628
3629 if (nodeType === "ExistsTypeAnnotation") {
3630 if (typeof opts === "undefined") {
3631 return true;
3632 } else {
3633 return (0, _shallowEqual.default)(node, opts);
3634 }
3635 }
3636
3637 return false;
3638}
3639
3640function isFunctionTypeAnnotation(node, opts) {
3641 if (!node) return false;
3642 const nodeType = node.type;
3643
3644 if (nodeType === "FunctionTypeAnnotation") {
3645 if (typeof opts === "undefined") {
3646 return true;
3647 } else {
3648 return (0, _shallowEqual.default)(node, opts);
3649 }
3650 }
3651
3652 return false;
3653}
3654
3655function isFunctionTypeParam(node, opts) {
3656 if (!node) return false;
3657 const nodeType = node.type;
3658
3659 if (nodeType === "FunctionTypeParam") {
3660 if (typeof opts === "undefined") {
3661 return true;
3662 } else {
3663 return (0, _shallowEqual.default)(node, opts);
3664 }
3665 }
3666
3667 return false;
3668}
3669
3670function isGenericTypeAnnotation(node, opts) {
3671 if (!node) return false;
3672 const nodeType = node.type;
3673
3674 if (nodeType === "GenericTypeAnnotation") {
3675 if (typeof opts === "undefined") {
3676 return true;
3677 } else {
3678 return (0, _shallowEqual.default)(node, opts);
3679 }
3680 }
3681
3682 return false;
3683}
3684
3685function isInferredPredicate(node, opts) {
3686 if (!node) return false;
3687 const nodeType = node.type;
3688
3689 if (nodeType === "InferredPredicate") {
3690 if (typeof opts === "undefined") {
3691 return true;
3692 } else {
3693 return (0, _shallowEqual.default)(node, opts);
3694 }
3695 }
3696
3697 return false;
3698}
3699
3700function isInterfaceExtends(node, opts) {
3701 if (!node) return false;
3702 const nodeType = node.type;
3703
3704 if (nodeType === "InterfaceExtends") {
3705 if (typeof opts === "undefined") {
3706 return true;
3707 } else {
3708 return (0, _shallowEqual.default)(node, opts);
3709 }
3710 }
3711
3712 return false;
3713}
3714
3715function isInterfaceDeclaration(node, opts) {
3716 if (!node) return false;
3717 const nodeType = node.type;
3718
3719 if (nodeType === "InterfaceDeclaration") {
3720 if (typeof opts === "undefined") {
3721 return true;
3722 } else {
3723 return (0, _shallowEqual.default)(node, opts);
3724 }
3725 }
3726
3727 return false;
3728}
3729
3730function isInterfaceTypeAnnotation(node, opts) {
3731 if (!node) return false;
3732 const nodeType = node.type;
3733
3734 if (nodeType === "InterfaceTypeAnnotation") {
3735 if (typeof opts === "undefined") {
3736 return true;
3737 } else {
3738 return (0, _shallowEqual.default)(node, opts);
3739 }
3740 }
3741
3742 return false;
3743}
3744
3745function isIntersectionTypeAnnotation(node, opts) {
3746 if (!node) return false;
3747 const nodeType = node.type;
3748
3749 if (nodeType === "IntersectionTypeAnnotation") {
3750 if (typeof opts === "undefined") {
3751 return true;
3752 } else {
3753 return (0, _shallowEqual.default)(node, opts);
3754 }
3755 }
3756
3757 return false;
3758}
3759
3760function isMixedTypeAnnotation(node, opts) {
3761 if (!node) return false;
3762 const nodeType = node.type;
3763
3764 if (nodeType === "MixedTypeAnnotation") {
3765 if (typeof opts === "undefined") {
3766 return true;
3767 } else {
3768 return (0, _shallowEqual.default)(node, opts);
3769 }
3770 }
3771
3772 return false;
3773}
3774
3775function isEmptyTypeAnnotation(node, opts) {
3776 if (!node) return false;
3777 const nodeType = node.type;
3778
3779 if (nodeType === "EmptyTypeAnnotation") {
3780 if (typeof opts === "undefined") {
3781 return true;
3782 } else {
3783 return (0, _shallowEqual.default)(node, opts);
3784 }
3785 }
3786
3787 return false;
3788}
3789
3790function isNullableTypeAnnotation(node, opts) {
3791 if (!node) return false;
3792 const nodeType = node.type;
3793
3794 if (nodeType === "NullableTypeAnnotation") {
3795 if (typeof opts === "undefined") {
3796 return true;
3797 } else {
3798 return (0, _shallowEqual.default)(node, opts);
3799 }
3800 }
3801
3802 return false;
3803}
3804
3805function isNumberLiteralTypeAnnotation(node, opts) {
3806 if (!node) return false;
3807 const nodeType = node.type;
3808
3809 if (nodeType === "NumberLiteralTypeAnnotation") {
3810 if (typeof opts === "undefined") {
3811 return true;
3812 } else {
3813 return (0, _shallowEqual.default)(node, opts);
3814 }
3815 }
3816
3817 return false;
3818}
3819
3820function isNumberTypeAnnotation(node, opts) {
3821 if (!node) return false;
3822 const nodeType = node.type;
3823
3824 if (nodeType === "NumberTypeAnnotation") {
3825 if (typeof opts === "undefined") {
3826 return true;
3827 } else {
3828 return (0, _shallowEqual.default)(node, opts);
3829 }
3830 }
3831
3832 return false;
3833}
3834
3835function isObjectTypeAnnotation(node, opts) {
3836 if (!node) return false;
3837 const nodeType = node.type;
3838
3839 if (nodeType === "ObjectTypeAnnotation") {
3840 if (typeof opts === "undefined") {
3841 return true;
3842 } else {
3843 return (0, _shallowEqual.default)(node, opts);
3844 }
3845 }
3846
3847 return false;
3848}
3849
3850function isObjectTypeInternalSlot(node, opts) {
3851 if (!node) return false;
3852 const nodeType = node.type;
3853
3854 if (nodeType === "ObjectTypeInternalSlot") {
3855 if (typeof opts === "undefined") {
3856 return true;
3857 } else {
3858 return (0, _shallowEqual.default)(node, opts);
3859 }
3860 }
3861
3862 return false;
3863}
3864
3865function isObjectTypeCallProperty(node, opts) {
3866 if (!node) return false;
3867 const nodeType = node.type;
3868
3869 if (nodeType === "ObjectTypeCallProperty") {
3870 if (typeof opts === "undefined") {
3871 return true;
3872 } else {
3873 return (0, _shallowEqual.default)(node, opts);
3874 }
3875 }
3876
3877 return false;
3878}
3879
3880function isObjectTypeIndexer(node, opts) {
3881 if (!node) return false;
3882 const nodeType = node.type;
3883
3884 if (nodeType === "ObjectTypeIndexer") {
3885 if (typeof opts === "undefined") {
3886 return true;
3887 } else {
3888 return (0, _shallowEqual.default)(node, opts);
3889 }
3890 }
3891
3892 return false;
3893}
3894
3895function isObjectTypeProperty(node, opts) {
3896 if (!node) return false;
3897 const nodeType = node.type;
3898
3899 if (nodeType === "ObjectTypeProperty") {
3900 if (typeof opts === "undefined") {
3901 return true;
3902 } else {
3903 return (0, _shallowEqual.default)(node, opts);
3904 }
3905 }
3906
3907 return false;
3908}
3909
3910function isObjectTypeSpreadProperty(node, opts) {
3911 if (!node) return false;
3912 const nodeType = node.type;
3913
3914 if (nodeType === "ObjectTypeSpreadProperty") {
3915 if (typeof opts === "undefined") {
3916 return true;
3917 } else {
3918 return (0, _shallowEqual.default)(node, opts);
3919 }
3920 }
3921
3922 return false;
3923}
3924
3925function isOpaqueType(node, opts) {
3926 if (!node) return false;
3927 const nodeType = node.type;
3928
3929 if (nodeType === "OpaqueType") {
3930 if (typeof opts === "undefined") {
3931 return true;
3932 } else {
3933 return (0, _shallowEqual.default)(node, opts);
3934 }
3935 }
3936
3937 return false;
3938}
3939
3940function isQualifiedTypeIdentifier(node, opts) {
3941 if (!node) return false;
3942 const nodeType = node.type;
3943
3944 if (nodeType === "QualifiedTypeIdentifier") {
3945 if (typeof opts === "undefined") {
3946 return true;
3947 } else {
3948 return (0, _shallowEqual.default)(node, opts);
3949 }
3950 }
3951
3952 return false;
3953}
3954
3955function isStringLiteralTypeAnnotation(node, opts) {
3956 if (!node) return false;
3957 const nodeType = node.type;
3958
3959 if (nodeType === "StringLiteralTypeAnnotation") {
3960 if (typeof opts === "undefined") {
3961 return true;
3962 } else {
3963 return (0, _shallowEqual.default)(node, opts);
3964 }
3965 }
3966
3967 return false;
3968}
3969
3970function isStringTypeAnnotation(node, opts) {
3971 if (!node) return false;
3972 const nodeType = node.type;
3973
3974 if (nodeType === "StringTypeAnnotation") {
3975 if (typeof opts === "undefined") {
3976 return true;
3977 } else {
3978 return (0, _shallowEqual.default)(node, opts);
3979 }
3980 }
3981
3982 return false;
3983}
3984
3985function isThisTypeAnnotation(node, opts) {
3986 if (!node) return false;
3987 const nodeType = node.type;
3988
3989 if (nodeType === "ThisTypeAnnotation") {
3990 if (typeof opts === "undefined") {
3991 return true;
3992 } else {
3993 return (0, _shallowEqual.default)(node, opts);
3994 }
3995 }
3996
3997 return false;
3998}
3999
4000function isTupleTypeAnnotation(node, opts) {
4001 if (!node) return false;
4002 const nodeType = node.type;
4003
4004 if (nodeType === "TupleTypeAnnotation") {
4005 if (typeof opts === "undefined") {
4006 return true;
4007 } else {
4008 return (0, _shallowEqual.default)(node, opts);
4009 }
4010 }
4011
4012 return false;
4013}
4014
4015function isTypeofTypeAnnotation(node, opts) {
4016 if (!node) return false;
4017 const nodeType = node.type;
4018
4019 if (nodeType === "TypeofTypeAnnotation") {
4020 if (typeof opts === "undefined") {
4021 return true;
4022 } else {
4023 return (0, _shallowEqual.default)(node, opts);
4024 }
4025 }
4026
4027 return false;
4028}
4029
4030function isTypeAlias(node, opts) {
4031 if (!node) return false;
4032 const nodeType = node.type;
4033
4034 if (nodeType === "TypeAlias") {
4035 if (typeof opts === "undefined") {
4036 return true;
4037 } else {
4038 return (0, _shallowEqual.default)(node, opts);
4039 }
4040 }
4041
4042 return false;
4043}
4044
4045function isTypeAnnotation(node, opts) {
4046 if (!node) return false;
4047 const nodeType = node.type;
4048
4049 if (nodeType === "TypeAnnotation") {
4050 if (typeof opts === "undefined") {
4051 return true;
4052 } else {
4053 return (0, _shallowEqual.default)(node, opts);
4054 }
4055 }
4056
4057 return false;
4058}
4059
4060function isTypeCastExpression(node, opts) {
4061 if (!node) return false;
4062 const nodeType = node.type;
4063
4064 if (nodeType === "TypeCastExpression") {
4065 if (typeof opts === "undefined") {
4066 return true;
4067 } else {
4068 return (0, _shallowEqual.default)(node, opts);
4069 }
4070 }
4071
4072 return false;
4073}
4074
4075function isTypeParameter(node, opts) {
4076 if (!node) return false;
4077 const nodeType = node.type;
4078
4079 if (nodeType === "TypeParameter") {
4080 if (typeof opts === "undefined") {
4081 return true;
4082 } else {
4083 return (0, _shallowEqual.default)(node, opts);
4084 }
4085 }
4086
4087 return false;
4088}
4089
4090function isTypeParameterDeclaration(node, opts) {
4091 if (!node) return false;
4092 const nodeType = node.type;
4093
4094 if (nodeType === "TypeParameterDeclaration") {
4095 if (typeof opts === "undefined") {
4096 return true;
4097 } else {
4098 return (0, _shallowEqual.default)(node, opts);
4099 }
4100 }
4101
4102 return false;
4103}
4104
4105function isTypeParameterInstantiation(node, opts) {
4106 if (!node) return false;
4107 const nodeType = node.type;
4108
4109 if (nodeType === "TypeParameterInstantiation") {
4110 if (typeof opts === "undefined") {
4111 return true;
4112 } else {
4113 return (0, _shallowEqual.default)(node, opts);
4114 }
4115 }
4116
4117 return false;
4118}
4119
4120function isUnionTypeAnnotation(node, opts) {
4121 if (!node) return false;
4122 const nodeType = node.type;
4123
4124 if (nodeType === "UnionTypeAnnotation") {
4125 if (typeof opts === "undefined") {
4126 return true;
4127 } else {
4128 return (0, _shallowEqual.default)(node, opts);
4129 }
4130 }
4131
4132 return false;
4133}
4134
4135function isVariance(node, opts) {
4136 if (!node) return false;
4137 const nodeType = node.type;
4138
4139 if (nodeType === "Variance") {
4140 if (typeof opts === "undefined") {
4141 return true;
4142 } else {
4143 return (0, _shallowEqual.default)(node, opts);
4144 }
4145 }
4146
4147 return false;
4148}
4149
4150function isVoidTypeAnnotation(node, opts) {
4151 if (!node) return false;
4152 const nodeType = node.type;
4153
4154 if (nodeType === "VoidTypeAnnotation") {
4155 if (typeof opts === "undefined") {
4156 return true;
4157 } else {
4158 return (0, _shallowEqual.default)(node, opts);
4159 }
4160 }
4161
4162 return false;
4163}
4164
4165function isJSXAttribute(node, opts) {
4166 if (!node) return false;
4167 const nodeType = node.type;
4168
4169 if (nodeType === "JSXAttribute") {
4170 if (typeof opts === "undefined") {
4171 return true;
4172 } else {
4173 return (0, _shallowEqual.default)(node, opts);
4174 }
4175 }
4176
4177 return false;
4178}
4179
4180function isJSXClosingElement(node, opts) {
4181 if (!node) return false;
4182 const nodeType = node.type;
4183
4184 if (nodeType === "JSXClosingElement") {
4185 if (typeof opts === "undefined") {
4186 return true;
4187 } else {
4188 return (0, _shallowEqual.default)(node, opts);
4189 }
4190 }
4191
4192 return false;
4193}
4194
4195function isJSXElement(node, opts) {
4196 if (!node) return false;
4197 const nodeType = node.type;
4198
4199 if (nodeType === "JSXElement") {
4200 if (typeof opts === "undefined") {
4201 return true;
4202 } else {
4203 return (0, _shallowEqual.default)(node, opts);
4204 }
4205 }
4206
4207 return false;
4208}
4209
4210function isJSXEmptyExpression(node, opts) {
4211 if (!node) return false;
4212 const nodeType = node.type;
4213
4214 if (nodeType === "JSXEmptyExpression") {
4215 if (typeof opts === "undefined") {
4216 return true;
4217 } else {
4218 return (0, _shallowEqual.default)(node, opts);
4219 }
4220 }
4221
4222 return false;
4223}
4224
4225function isJSXExpressionContainer(node, opts) {
4226 if (!node) return false;
4227 const nodeType = node.type;
4228
4229 if (nodeType === "JSXExpressionContainer") {
4230 if (typeof opts === "undefined") {
4231 return true;
4232 } else {
4233 return (0, _shallowEqual.default)(node, opts);
4234 }
4235 }
4236
4237 return false;
4238}
4239
4240function isJSXSpreadChild(node, opts) {
4241 if (!node) return false;
4242 const nodeType = node.type;
4243
4244 if (nodeType === "JSXSpreadChild") {
4245 if (typeof opts === "undefined") {
4246 return true;
4247 } else {
4248 return (0, _shallowEqual.default)(node, opts);
4249 }
4250 }
4251
4252 return false;
4253}
4254
4255function isJSXIdentifier(node, opts) {
4256 if (!node) return false;
4257 const nodeType = node.type;
4258
4259 if (nodeType === "JSXIdentifier") {
4260 if (typeof opts === "undefined") {
4261 return true;
4262 } else {
4263 return (0, _shallowEqual.default)(node, opts);
4264 }
4265 }
4266
4267 return false;
4268}
4269
4270function isJSXMemberExpression(node, opts) {
4271 if (!node) return false;
4272 const nodeType = node.type;
4273
4274 if (nodeType === "JSXMemberExpression") {
4275 if (typeof opts === "undefined") {
4276 return true;
4277 } else {
4278 return (0, _shallowEqual.default)(node, opts);
4279 }
4280 }
4281
4282 return false;
4283}
4284
4285function isJSXNamespacedName(node, opts) {
4286 if (!node) return false;
4287 const nodeType = node.type;
4288
4289 if (nodeType === "JSXNamespacedName") {
4290 if (typeof opts === "undefined") {
4291 return true;
4292 } else {
4293 return (0, _shallowEqual.default)(node, opts);
4294 }
4295 }
4296
4297 return false;
4298}
4299
4300function isJSXOpeningElement(node, opts) {
4301 if (!node) return false;
4302 const nodeType = node.type;
4303
4304 if (nodeType === "JSXOpeningElement") {
4305 if (typeof opts === "undefined") {
4306 return true;
4307 } else {
4308 return (0, _shallowEqual.default)(node, opts);
4309 }
4310 }
4311
4312 return false;
4313}
4314
4315function isJSXSpreadAttribute(node, opts) {
4316 if (!node) return false;
4317 const nodeType = node.type;
4318
4319 if (nodeType === "JSXSpreadAttribute") {
4320 if (typeof opts === "undefined") {
4321 return true;
4322 } else {
4323 return (0, _shallowEqual.default)(node, opts);
4324 }
4325 }
4326
4327 return false;
4328}
4329
4330function isJSXText(node, opts) {
4331 if (!node) return false;
4332 const nodeType = node.type;
4333
4334 if (nodeType === "JSXText") {
4335 if (typeof opts === "undefined") {
4336 return true;
4337 } else {
4338 return (0, _shallowEqual.default)(node, opts);
4339 }
4340 }
4341
4342 return false;
4343}
4344
4345function isJSXFragment(node, opts) {
4346 if (!node) return false;
4347 const nodeType = node.type;
4348
4349 if (nodeType === "JSXFragment") {
4350 if (typeof opts === "undefined") {
4351 return true;
4352 } else {
4353 return (0, _shallowEqual.default)(node, opts);
4354 }
4355 }
4356
4357 return false;
4358}
4359
4360function isJSXOpeningFragment(node, opts) {
4361 if (!node) return false;
4362 const nodeType = node.type;
4363
4364 if (nodeType === "JSXOpeningFragment") {
4365 if (typeof opts === "undefined") {
4366 return true;
4367 } else {
4368 return (0, _shallowEqual.default)(node, opts);
4369 }
4370 }
4371
4372 return false;
4373}
4374
4375function isJSXClosingFragment(node, opts) {
4376 if (!node) return false;
4377 const nodeType = node.type;
4378
4379 if (nodeType === "JSXClosingFragment") {
4380 if (typeof opts === "undefined") {
4381 return true;
4382 } else {
4383 return (0, _shallowEqual.default)(node, opts);
4384 }
4385 }
4386
4387 return false;
4388}
4389
4390function isNoop(node, opts) {
4391 if (!node) return false;
4392 const nodeType = node.type;
4393
4394 if (nodeType === "Noop") {
4395 if (typeof opts === "undefined") {
4396 return true;
4397 } else {
4398 return (0, _shallowEqual.default)(node, opts);
4399 }
4400 }
4401
4402 return false;
4403}
4404
4405function isParenthesizedExpression(node, opts) {
4406 if (!node) return false;
4407 const nodeType = node.type;
4408
4409 if (nodeType === "ParenthesizedExpression") {
4410 if (typeof opts === "undefined") {
4411 return true;
4412 } else {
4413 return (0, _shallowEqual.default)(node, opts);
4414 }
4415 }
4416
4417 return false;
4418}
4419
4420function isAwaitExpression(node, opts) {
4421 if (!node) return false;
4422 const nodeType = node.type;
4423
4424 if (nodeType === "AwaitExpression") {
4425 if (typeof opts === "undefined") {
4426 return true;
4427 } else {
4428 return (0, _shallowEqual.default)(node, opts);
4429 }
4430 }
4431
4432 return false;
4433}
4434
4435function isBindExpression(node, opts) {
4436 if (!node) return false;
4437 const nodeType = node.type;
4438
4439 if (nodeType === "BindExpression") {
4440 if (typeof opts === "undefined") {
4441 return true;
4442 } else {
4443 return (0, _shallowEqual.default)(node, opts);
4444 }
4445 }
4446
4447 return false;
4448}
4449
4450function isClassProperty(node, opts) {
4451 if (!node) return false;
4452 const nodeType = node.type;
4453
4454 if (nodeType === "ClassProperty") {
4455 if (typeof opts === "undefined") {
4456 return true;
4457 } else {
4458 return (0, _shallowEqual.default)(node, opts);
4459 }
4460 }
4461
4462 return false;
4463}
4464
4465function isOptionalMemberExpression(node, opts) {
4466 if (!node) return false;
4467 const nodeType = node.type;
4468
4469 if (nodeType === "OptionalMemberExpression") {
4470 if (typeof opts === "undefined") {
4471 return true;
4472 } else {
4473 return (0, _shallowEqual.default)(node, opts);
4474 }
4475 }
4476
4477 return false;
4478}
4479
4480function isOptionalCallExpression(node, opts) {
4481 if (!node) return false;
4482 const nodeType = node.type;
4483
4484 if (nodeType === "OptionalCallExpression") {
4485 if (typeof opts === "undefined") {
4486 return true;
4487 } else {
4488 return (0, _shallowEqual.default)(node, opts);
4489 }
4490 }
4491
4492 return false;
4493}
4494
4495function isClassPrivateProperty(node, opts) {
4496 if (!node) return false;
4497 const nodeType = node.type;
4498
4499 if (nodeType === "ClassPrivateProperty") {
4500 if (typeof opts === "undefined") {
4501 return true;
4502 } else {
4503 return (0, _shallowEqual.default)(node, opts);
4504 }
4505 }
4506
4507 return false;
4508}
4509
4510function isImport(node, opts) {
4511 if (!node) return false;
4512 const nodeType = node.type;
4513
4514 if (nodeType === "Import") {
4515 if (typeof opts === "undefined") {
4516 return true;
4517 } else {
4518 return (0, _shallowEqual.default)(node, opts);
4519 }
4520 }
4521
4522 return false;
4523}
4524
4525function isDecorator(node, opts) {
4526 if (!node) return false;
4527 const nodeType = node.type;
4528
4529 if (nodeType === "Decorator") {
4530 if (typeof opts === "undefined") {
4531 return true;
4532 } else {
4533 return (0, _shallowEqual.default)(node, opts);
4534 }
4535 }
4536
4537 return false;
4538}
4539
4540function isDoExpression(node, opts) {
4541 if (!node) return false;
4542 const nodeType = node.type;
4543
4544 if (nodeType === "DoExpression") {
4545 if (typeof opts === "undefined") {
4546 return true;
4547 } else {
4548 return (0, _shallowEqual.default)(node, opts);
4549 }
4550 }
4551
4552 return false;
4553}
4554
4555function isExportDefaultSpecifier(node, opts) {
4556 if (!node) return false;
4557 const nodeType = node.type;
4558
4559 if (nodeType === "ExportDefaultSpecifier") {
4560 if (typeof opts === "undefined") {
4561 return true;
4562 } else {
4563 return (0, _shallowEqual.default)(node, opts);
4564 }
4565 }
4566
4567 return false;
4568}
4569
4570function isExportNamespaceSpecifier(node, opts) {
4571 if (!node) return false;
4572 const nodeType = node.type;
4573
4574 if (nodeType === "ExportNamespaceSpecifier") {
4575 if (typeof opts === "undefined") {
4576 return true;
4577 } else {
4578 return (0, _shallowEqual.default)(node, opts);
4579 }
4580 }
4581
4582 return false;
4583}
4584
4585function isPrivateName(node, opts) {
4586 if (!node) return false;
4587 const nodeType = node.type;
4588
4589 if (nodeType === "PrivateName") {
4590 if (typeof opts === "undefined") {
4591 return true;
4592 } else {
4593 return (0, _shallowEqual.default)(node, opts);
4594 }
4595 }
4596
4597 return false;
4598}
4599
4600function isBigIntLiteral(node, opts) {
4601 if (!node) return false;
4602 const nodeType = node.type;
4603
4604 if (nodeType === "BigIntLiteral") {
4605 if (typeof opts === "undefined") {
4606 return true;
4607 } else {
4608 return (0, _shallowEqual.default)(node, opts);
4609 }
4610 }
4611
4612 return false;
4613}
4614
4615function isTSParameterProperty(node, opts) {
4616 if (!node) return false;
4617 const nodeType = node.type;
4618
4619 if (nodeType === "TSParameterProperty") {
4620 if (typeof opts === "undefined") {
4621 return true;
4622 } else {
4623 return (0, _shallowEqual.default)(node, opts);
4624 }
4625 }
4626
4627 return false;
4628}
4629
4630function isTSDeclareFunction(node, opts) {
4631 if (!node) return false;
4632 const nodeType = node.type;
4633
4634 if (nodeType === "TSDeclareFunction") {
4635 if (typeof opts === "undefined") {
4636 return true;
4637 } else {
4638 return (0, _shallowEqual.default)(node, opts);
4639 }
4640 }
4641
4642 return false;
4643}
4644
4645function isTSDeclareMethod(node, opts) {
4646 if (!node) return false;
4647 const nodeType = node.type;
4648
4649 if (nodeType === "TSDeclareMethod") {
4650 if (typeof opts === "undefined") {
4651 return true;
4652 } else {
4653 return (0, _shallowEqual.default)(node, opts);
4654 }
4655 }
4656
4657 return false;
4658}
4659
4660function isTSQualifiedName(node, opts) {
4661 if (!node) return false;
4662 const nodeType = node.type;
4663
4664 if (nodeType === "TSQualifiedName") {
4665 if (typeof opts === "undefined") {
4666 return true;
4667 } else {
4668 return (0, _shallowEqual.default)(node, opts);
4669 }
4670 }
4671
4672 return false;
4673}
4674
4675function isTSCallSignatureDeclaration(node, opts) {
4676 if (!node) return false;
4677 const nodeType = node.type;
4678
4679 if (nodeType === "TSCallSignatureDeclaration") {
4680 if (typeof opts === "undefined") {
4681 return true;
4682 } else {
4683 return (0, _shallowEqual.default)(node, opts);
4684 }
4685 }
4686
4687 return false;
4688}
4689
4690function isTSConstructSignatureDeclaration(node, opts) {
4691 if (!node) return false;
4692 const nodeType = node.type;
4693
4694 if (nodeType === "TSConstructSignatureDeclaration") {
4695 if (typeof opts === "undefined") {
4696 return true;
4697 } else {
4698 return (0, _shallowEqual.default)(node, opts);
4699 }
4700 }
4701
4702 return false;
4703}
4704
4705function isTSPropertySignature(node, opts) {
4706 if (!node) return false;
4707 const nodeType = node.type;
4708
4709 if (nodeType === "TSPropertySignature") {
4710 if (typeof opts === "undefined") {
4711 return true;
4712 } else {
4713 return (0, _shallowEqual.default)(node, opts);
4714 }
4715 }
4716
4717 return false;
4718}
4719
4720function isTSMethodSignature(node, opts) {
4721 if (!node) return false;
4722 const nodeType = node.type;
4723
4724 if (nodeType === "TSMethodSignature") {
4725 if (typeof opts === "undefined") {
4726 return true;
4727 } else {
4728 return (0, _shallowEqual.default)(node, opts);
4729 }
4730 }
4731
4732 return false;
4733}
4734
4735function isTSIndexSignature(node, opts) {
4736 if (!node) return false;
4737 const nodeType = node.type;
4738
4739 if (nodeType === "TSIndexSignature") {
4740 if (typeof opts === "undefined") {
4741 return true;
4742 } else {
4743 return (0, _shallowEqual.default)(node, opts);
4744 }
4745 }
4746
4747 return false;
4748}
4749
4750function isTSAnyKeyword(node, opts) {
4751 if (!node) return false;
4752 const nodeType = node.type;
4753
4754 if (nodeType === "TSAnyKeyword") {
4755 if (typeof opts === "undefined") {
4756 return true;
4757 } else {
4758 return (0, _shallowEqual.default)(node, opts);
4759 }
4760 }
4761
4762 return false;
4763}
4764
4765function isTSNumberKeyword(node, opts) {
4766 if (!node) return false;
4767 const nodeType = node.type;
4768
4769 if (nodeType === "TSNumberKeyword") {
4770 if (typeof opts === "undefined") {
4771 return true;
4772 } else {
4773 return (0, _shallowEqual.default)(node, opts);
4774 }
4775 }
4776
4777 return false;
4778}
4779
4780function isTSObjectKeyword(node, opts) {
4781 if (!node) return false;
4782 const nodeType = node.type;
4783
4784 if (nodeType === "TSObjectKeyword") {
4785 if (typeof opts === "undefined") {
4786 return true;
4787 } else {
4788 return (0, _shallowEqual.default)(node, opts);
4789 }
4790 }
4791
4792 return false;
4793}
4794
4795function isTSBooleanKeyword(node, opts) {
4796 if (!node) return false;
4797 const nodeType = node.type;
4798
4799 if (nodeType === "TSBooleanKeyword") {
4800 if (typeof opts === "undefined") {
4801 return true;
4802 } else {
4803 return (0, _shallowEqual.default)(node, opts);
4804 }
4805 }
4806
4807 return false;
4808}
4809
4810function isTSStringKeyword(node, opts) {
4811 if (!node) return false;
4812 const nodeType = node.type;
4813
4814 if (nodeType === "TSStringKeyword") {
4815 if (typeof opts === "undefined") {
4816 return true;
4817 } else {
4818 return (0, _shallowEqual.default)(node, opts);
4819 }
4820 }
4821
4822 return false;
4823}
4824
4825function isTSSymbolKeyword(node, opts) {
4826 if (!node) return false;
4827 const nodeType = node.type;
4828
4829 if (nodeType === "TSSymbolKeyword") {
4830 if (typeof opts === "undefined") {
4831 return true;
4832 } else {
4833 return (0, _shallowEqual.default)(node, opts);
4834 }
4835 }
4836
4837 return false;
4838}
4839
4840function isTSVoidKeyword(node, opts) {
4841 if (!node) return false;
4842 const nodeType = node.type;
4843
4844 if (nodeType === "TSVoidKeyword") {
4845 if (typeof opts === "undefined") {
4846 return true;
4847 } else {
4848 return (0, _shallowEqual.default)(node, opts);
4849 }
4850 }
4851
4852 return false;
4853}
4854
4855function isTSUndefinedKeyword(node, opts) {
4856 if (!node) return false;
4857 const nodeType = node.type;
4858
4859 if (nodeType === "TSUndefinedKeyword") {
4860 if (typeof opts === "undefined") {
4861 return true;
4862 } else {
4863 return (0, _shallowEqual.default)(node, opts);
4864 }
4865 }
4866
4867 return false;
4868}
4869
4870function isTSNullKeyword(node, opts) {
4871 if (!node) return false;
4872 const nodeType = node.type;
4873
4874 if (nodeType === "TSNullKeyword") {
4875 if (typeof opts === "undefined") {
4876 return true;
4877 } else {
4878 return (0, _shallowEqual.default)(node, opts);
4879 }
4880 }
4881
4882 return false;
4883}
4884
4885function isTSNeverKeyword(node, opts) {
4886 if (!node) return false;
4887 const nodeType = node.type;
4888
4889 if (nodeType === "TSNeverKeyword") {
4890 if (typeof opts === "undefined") {
4891 return true;
4892 } else {
4893 return (0, _shallowEqual.default)(node, opts);
4894 }
4895 }
4896
4897 return false;
4898}
4899
4900function isTSThisType(node, opts) {
4901 if (!node) return false;
4902 const nodeType = node.type;
4903
4904 if (nodeType === "TSThisType") {
4905 if (typeof opts === "undefined") {
4906 return true;
4907 } else {
4908 return (0, _shallowEqual.default)(node, opts);
4909 }
4910 }
4911
4912 return false;
4913}
4914
4915function isTSFunctionType(node, opts) {
4916 if (!node) return false;
4917 const nodeType = node.type;
4918
4919 if (nodeType === "TSFunctionType") {
4920 if (typeof opts === "undefined") {
4921 return true;
4922 } else {
4923 return (0, _shallowEqual.default)(node, opts);
4924 }
4925 }
4926
4927 return false;
4928}
4929
4930function isTSConstructorType(node, opts) {
4931 if (!node) return false;
4932 const nodeType = node.type;
4933
4934 if (nodeType === "TSConstructorType") {
4935 if (typeof opts === "undefined") {
4936 return true;
4937 } else {
4938 return (0, _shallowEqual.default)(node, opts);
4939 }
4940 }
4941
4942 return false;
4943}
4944
4945function isTSTypeReference(node, opts) {
4946 if (!node) return false;
4947 const nodeType = node.type;
4948
4949 if (nodeType === "TSTypeReference") {
4950 if (typeof opts === "undefined") {
4951 return true;
4952 } else {
4953 return (0, _shallowEqual.default)(node, opts);
4954 }
4955 }
4956
4957 return false;
4958}
4959
4960function isTSTypePredicate(node, opts) {
4961 if (!node) return false;
4962 const nodeType = node.type;
4963
4964 if (nodeType === "TSTypePredicate") {
4965 if (typeof opts === "undefined") {
4966 return true;
4967 } else {
4968 return (0, _shallowEqual.default)(node, opts);
4969 }
4970 }
4971
4972 return false;
4973}
4974
4975function isTSTypeQuery(node, opts) {
4976 if (!node) return false;
4977 const nodeType = node.type;
4978
4979 if (nodeType === "TSTypeQuery") {
4980 if (typeof opts === "undefined") {
4981 return true;
4982 } else {
4983 return (0, _shallowEqual.default)(node, opts);
4984 }
4985 }
4986
4987 return false;
4988}
4989
4990function isTSTypeLiteral(node, opts) {
4991 if (!node) return false;
4992 const nodeType = node.type;
4993
4994 if (nodeType === "TSTypeLiteral") {
4995 if (typeof opts === "undefined") {
4996 return true;
4997 } else {
4998 return (0, _shallowEqual.default)(node, opts);
4999 }
5000 }
5001
5002 return false;
5003}
5004
5005function isTSArrayType(node, opts) {
5006 if (!node) return false;
5007 const nodeType = node.type;
5008
5009 if (nodeType === "TSArrayType") {
5010 if (typeof opts === "undefined") {
5011 return true;
5012 } else {
5013 return (0, _shallowEqual.default)(node, opts);
5014 }
5015 }
5016
5017 return false;
5018}
5019
5020function isTSTupleType(node, opts) {
5021 if (!node) return false;
5022 const nodeType = node.type;
5023
5024 if (nodeType === "TSTupleType") {
5025 if (typeof opts === "undefined") {
5026 return true;
5027 } else {
5028 return (0, _shallowEqual.default)(node, opts);
5029 }
5030 }
5031
5032 return false;
5033}
5034
5035function isTSUnionType(node, opts) {
5036 if (!node) return false;
5037 const nodeType = node.type;
5038
5039 if (nodeType === "TSUnionType") {
5040 if (typeof opts === "undefined") {
5041 return true;
5042 } else {
5043 return (0, _shallowEqual.default)(node, opts);
5044 }
5045 }
5046
5047 return false;
5048}
5049
5050function isTSIntersectionType(node, opts) {
5051 if (!node) return false;
5052 const nodeType = node.type;
5053
5054 if (nodeType === "TSIntersectionType") {
5055 if (typeof opts === "undefined") {
5056 return true;
5057 } else {
5058 return (0, _shallowEqual.default)(node, opts);
5059 }
5060 }
5061
5062 return false;
5063}
5064
5065function isTSConditionalType(node, opts) {
5066 if (!node) return false;
5067 const nodeType = node.type;
5068
5069 if (nodeType === "TSConditionalType") {
5070 if (typeof opts === "undefined") {
5071 return true;
5072 } else {
5073 return (0, _shallowEqual.default)(node, opts);
5074 }
5075 }
5076
5077 return false;
5078}
5079
5080function isTSInferType(node, opts) {
5081 if (!node) return false;
5082 const nodeType = node.type;
5083
5084 if (nodeType === "TSInferType") {
5085 if (typeof opts === "undefined") {
5086 return true;
5087 } else {
5088 return (0, _shallowEqual.default)(node, opts);
5089 }
5090 }
5091
5092 return false;
5093}
5094
5095function isTSParenthesizedType(node, opts) {
5096 if (!node) return false;
5097 const nodeType = node.type;
5098
5099 if (nodeType === "TSParenthesizedType") {
5100 if (typeof opts === "undefined") {
5101 return true;
5102 } else {
5103 return (0, _shallowEqual.default)(node, opts);
5104 }
5105 }
5106
5107 return false;
5108}
5109
5110function isTSTypeOperator(node, opts) {
5111 if (!node) return false;
5112 const nodeType = node.type;
5113
5114 if (nodeType === "TSTypeOperator") {
5115 if (typeof opts === "undefined") {
5116 return true;
5117 } else {
5118 return (0, _shallowEqual.default)(node, opts);
5119 }
5120 }
5121
5122 return false;
5123}
5124
5125function isTSIndexedAccessType(node, opts) {
5126 if (!node) return false;
5127 const nodeType = node.type;
5128
5129 if (nodeType === "TSIndexedAccessType") {
5130 if (typeof opts === "undefined") {
5131 return true;
5132 } else {
5133 return (0, _shallowEqual.default)(node, opts);
5134 }
5135 }
5136
5137 return false;
5138}
5139
5140function isTSMappedType(node, opts) {
5141 if (!node) return false;
5142 const nodeType = node.type;
5143
5144 if (nodeType === "TSMappedType") {
5145 if (typeof opts === "undefined") {
5146 return true;
5147 } else {
5148 return (0, _shallowEqual.default)(node, opts);
5149 }
5150 }
5151
5152 return false;
5153}
5154
5155function isTSLiteralType(node, opts) {
5156 if (!node) return false;
5157 const nodeType = node.type;
5158
5159 if (nodeType === "TSLiteralType") {
5160 if (typeof opts === "undefined") {
5161 return true;
5162 } else {
5163 return (0, _shallowEqual.default)(node, opts);
5164 }
5165 }
5166
5167 return false;
5168}
5169
5170function isTSExpressionWithTypeArguments(node, opts) {
5171 if (!node) return false;
5172 const nodeType = node.type;
5173
5174 if (nodeType === "TSExpressionWithTypeArguments") {
5175 if (typeof opts === "undefined") {
5176 return true;
5177 } else {
5178 return (0, _shallowEqual.default)(node, opts);
5179 }
5180 }
5181
5182 return false;
5183}
5184
5185function isTSInterfaceDeclaration(node, opts) {
5186 if (!node) return false;
5187 const nodeType = node.type;
5188
5189 if (nodeType === "TSInterfaceDeclaration") {
5190 if (typeof opts === "undefined") {
5191 return true;
5192 } else {
5193 return (0, _shallowEqual.default)(node, opts);
5194 }
5195 }
5196
5197 return false;
5198}
5199
5200function isTSInterfaceBody(node, opts) {
5201 if (!node) return false;
5202 const nodeType = node.type;
5203
5204 if (nodeType === "TSInterfaceBody") {
5205 if (typeof opts === "undefined") {
5206 return true;
5207 } else {
5208 return (0, _shallowEqual.default)(node, opts);
5209 }
5210 }
5211
5212 return false;
5213}
5214
5215function isTSTypeAliasDeclaration(node, opts) {
5216 if (!node) return false;
5217 const nodeType = node.type;
5218
5219 if (nodeType === "TSTypeAliasDeclaration") {
5220 if (typeof opts === "undefined") {
5221 return true;
5222 } else {
5223 return (0, _shallowEqual.default)(node, opts);
5224 }
5225 }
5226
5227 return false;
5228}
5229
5230function isTSAsExpression(node, opts) {
5231 if (!node) return false;
5232 const nodeType = node.type;
5233
5234 if (nodeType === "TSAsExpression") {
5235 if (typeof opts === "undefined") {
5236 return true;
5237 } else {
5238 return (0, _shallowEqual.default)(node, opts);
5239 }
5240 }
5241
5242 return false;
5243}
5244
5245function isTSTypeAssertion(node, opts) {
5246 if (!node) return false;
5247 const nodeType = node.type;
5248
5249 if (nodeType === "TSTypeAssertion") {
5250 if (typeof opts === "undefined") {
5251 return true;
5252 } else {
5253 return (0, _shallowEqual.default)(node, opts);
5254 }
5255 }
5256
5257 return false;
5258}
5259
5260function isTSEnumDeclaration(node, opts) {
5261 if (!node) return false;
5262 const nodeType = node.type;
5263
5264 if (nodeType === "TSEnumDeclaration") {
5265 if (typeof opts === "undefined") {
5266 return true;
5267 } else {
5268 return (0, _shallowEqual.default)(node, opts);
5269 }
5270 }
5271
5272 return false;
5273}
5274
5275function isTSEnumMember(node, opts) {
5276 if (!node) return false;
5277 const nodeType = node.type;
5278
5279 if (nodeType === "TSEnumMember") {
5280 if (typeof opts === "undefined") {
5281 return true;
5282 } else {
5283 return (0, _shallowEqual.default)(node, opts);
5284 }
5285 }
5286
5287 return false;
5288}
5289
5290function isTSModuleDeclaration(node, opts) {
5291 if (!node) return false;
5292 const nodeType = node.type;
5293
5294 if (nodeType === "TSModuleDeclaration") {
5295 if (typeof opts === "undefined") {
5296 return true;
5297 } else {
5298 return (0, _shallowEqual.default)(node, opts);
5299 }
5300 }
5301
5302 return false;
5303}
5304
5305function isTSModuleBlock(node, opts) {
5306 if (!node) return false;
5307 const nodeType = node.type;
5308
5309 if (nodeType === "TSModuleBlock") {
5310 if (typeof opts === "undefined") {
5311 return true;
5312 } else {
5313 return (0, _shallowEqual.default)(node, opts);
5314 }
5315 }
5316
5317 return false;
5318}
5319
5320function isTSImportEqualsDeclaration(node, opts) {
5321 if (!node) return false;
5322 const nodeType = node.type;
5323
5324 if (nodeType === "TSImportEqualsDeclaration") {
5325 if (typeof opts === "undefined") {
5326 return true;
5327 } else {
5328 return (0, _shallowEqual.default)(node, opts);
5329 }
5330 }
5331
5332 return false;
5333}
5334
5335function isTSExternalModuleReference(node, opts) {
5336 if (!node) return false;
5337 const nodeType = node.type;
5338
5339 if (nodeType === "TSExternalModuleReference") {
5340 if (typeof opts === "undefined") {
5341 return true;
5342 } else {
5343 return (0, _shallowEqual.default)(node, opts);
5344 }
5345 }
5346
5347 return false;
5348}
5349
5350function isTSNonNullExpression(node, opts) {
5351 if (!node) return false;
5352 const nodeType = node.type;
5353
5354 if (nodeType === "TSNonNullExpression") {
5355 if (typeof opts === "undefined") {
5356 return true;
5357 } else {
5358 return (0, _shallowEqual.default)(node, opts);
5359 }
5360 }
5361
5362 return false;
5363}
5364
5365function isTSExportAssignment(node, opts) {
5366 if (!node) return false;
5367 const nodeType = node.type;
5368
5369 if (nodeType === "TSExportAssignment") {
5370 if (typeof opts === "undefined") {
5371 return true;
5372 } else {
5373 return (0, _shallowEqual.default)(node, opts);
5374 }
5375 }
5376
5377 return false;
5378}
5379
5380function isTSNamespaceExportDeclaration(node, opts) {
5381 if (!node) return false;
5382 const nodeType = node.type;
5383
5384 if (nodeType === "TSNamespaceExportDeclaration") {
5385 if (typeof opts === "undefined") {
5386 return true;
5387 } else {
5388 return (0, _shallowEqual.default)(node, opts);
5389 }
5390 }
5391
5392 return false;
5393}
5394
5395function isTSTypeAnnotation(node, opts) {
5396 if (!node) return false;
5397 const nodeType = node.type;
5398
5399 if (nodeType === "TSTypeAnnotation") {
5400 if (typeof opts === "undefined") {
5401 return true;
5402 } else {
5403 return (0, _shallowEqual.default)(node, opts);
5404 }
5405 }
5406
5407 return false;
5408}
5409
5410function isTSTypeParameterInstantiation(node, opts) {
5411 if (!node) return false;
5412 const nodeType = node.type;
5413
5414 if (nodeType === "TSTypeParameterInstantiation") {
5415 if (typeof opts === "undefined") {
5416 return true;
5417 } else {
5418 return (0, _shallowEqual.default)(node, opts);
5419 }
5420 }
5421
5422 return false;
5423}
5424
5425function isTSTypeParameterDeclaration(node, opts) {
5426 if (!node) return false;
5427 const nodeType = node.type;
5428
5429 if (nodeType === "TSTypeParameterDeclaration") {
5430 if (typeof opts === "undefined") {
5431 return true;
5432 } else {
5433 return (0, _shallowEqual.default)(node, opts);
5434 }
5435 }
5436
5437 return false;
5438}
5439
5440function isTSTypeParameter(node, opts) {
5441 if (!node) return false;
5442 const nodeType = node.type;
5443
5444 if (nodeType === "TSTypeParameter") {
5445 if (typeof opts === "undefined") {
5446 return true;
5447 } else {
5448 return (0, _shallowEqual.default)(node, opts);
5449 }
5450 }
5451
5452 return false;
5453}
5454
5455function isExpression(node, opts) {
5456 if (!node) return false;
5457 const nodeType = node.type;
5458
5459 if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "ParenthesizedExpression" === nodeType || "AwaitExpression" === nodeType || "BindExpression" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType) {
5460 if (typeof opts === "undefined") {
5461 return true;
5462 } else {
5463 return (0, _shallowEqual.default)(node, opts);
5464 }
5465 }
5466
5467 return false;
5468}
5469
5470function isBinary(node, opts) {
5471 if (!node) return false;
5472 const nodeType = node.type;
5473
5474 if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) {
5475 if (typeof opts === "undefined") {
5476 return true;
5477 } else {
5478 return (0, _shallowEqual.default)(node, opts);
5479 }
5480 }
5481
5482 return false;
5483}
5484
5485function isScopable(node, opts) {
5486 if (!node) return false;
5487 const nodeType = node.type;
5488
5489 if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) {
5490 if (typeof opts === "undefined") {
5491 return true;
5492 } else {
5493 return (0, _shallowEqual.default)(node, opts);
5494 }
5495 }
5496
5497 return false;
5498}
5499
5500function isBlockParent(node, opts) {
5501 if (!node) return false;
5502 const nodeType = node.type;
5503
5504 if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType) {
5505 if (typeof opts === "undefined") {
5506 return true;
5507 } else {
5508 return (0, _shallowEqual.default)(node, opts);
5509 }
5510 }
5511
5512 return false;
5513}
5514
5515function isBlock(node, opts) {
5516 if (!node) return false;
5517 const nodeType = node.type;
5518
5519 if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType) {
5520 if (typeof opts === "undefined") {
5521 return true;
5522 } else {
5523 return (0, _shallowEqual.default)(node, opts);
5524 }
5525 }
5526
5527 return false;
5528}
5529
5530function isStatement(node, opts) {
5531 if (!node) return false;
5532 const nodeType = node.type;
5533
5534 if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType) {
5535 if (typeof opts === "undefined") {
5536 return true;
5537 } else {
5538 return (0, _shallowEqual.default)(node, opts);
5539 }
5540 }
5541
5542 return false;
5543}
5544
5545function isTerminatorless(node, opts) {
5546 if (!node) return false;
5547 const nodeType = node.type;
5548
5549 if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) {
5550 if (typeof opts === "undefined") {
5551 return true;
5552 } else {
5553 return (0, _shallowEqual.default)(node, opts);
5554 }
5555 }
5556
5557 return false;
5558}
5559
5560function isCompletionStatement(node, opts) {
5561 if (!node) return false;
5562 const nodeType = node.type;
5563
5564 if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) {
5565 if (typeof opts === "undefined") {
5566 return true;
5567 } else {
5568 return (0, _shallowEqual.default)(node, opts);
5569 }
5570 }
5571
5572 return false;
5573}
5574
5575function isConditional(node, opts) {
5576 if (!node) return false;
5577 const nodeType = node.type;
5578
5579 if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) {
5580 if (typeof opts === "undefined") {
5581 return true;
5582 } else {
5583 return (0, _shallowEqual.default)(node, opts);
5584 }
5585 }
5586
5587 return false;
5588}
5589
5590function isLoop(node, opts) {
5591 if (!node) return false;
5592 const nodeType = node.type;
5593
5594 if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) {
5595 if (typeof opts === "undefined") {
5596 return true;
5597 } else {
5598 return (0, _shallowEqual.default)(node, opts);
5599 }
5600 }
5601
5602 return false;
5603}
5604
5605function isWhile(node, opts) {
5606 if (!node) return false;
5607 const nodeType = node.type;
5608
5609 if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) {
5610 if (typeof opts === "undefined") {
5611 return true;
5612 } else {
5613 return (0, _shallowEqual.default)(node, opts);
5614 }
5615 }
5616
5617 return false;
5618}
5619
5620function isExpressionWrapper(node, opts) {
5621 if (!node) return false;
5622 const nodeType = node.type;
5623
5624 if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "TypeCastExpression" === nodeType || "ParenthesizedExpression" === nodeType) {
5625 if (typeof opts === "undefined") {
5626 return true;
5627 } else {
5628 return (0, _shallowEqual.default)(node, opts);
5629 }
5630 }
5631
5632 return false;
5633}
5634
5635function isFor(node, opts) {
5636 if (!node) return false;
5637 const nodeType = node.type;
5638
5639 if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) {
5640 if (typeof opts === "undefined") {
5641 return true;
5642 } else {
5643 return (0, _shallowEqual.default)(node, opts);
5644 }
5645 }
5646
5647 return false;
5648}
5649
5650function isForXStatement(node, opts) {
5651 if (!node) return false;
5652 const nodeType = node.type;
5653
5654 if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) {
5655 if (typeof opts === "undefined") {
5656 return true;
5657 } else {
5658 return (0, _shallowEqual.default)(node, opts);
5659 }
5660 }
5661
5662 return false;
5663}
5664
5665function isFunction(node, opts) {
5666 if (!node) return false;
5667 const nodeType = node.type;
5668
5669 if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) {
5670 if (typeof opts === "undefined") {
5671 return true;
5672 } else {
5673 return (0, _shallowEqual.default)(node, opts);
5674 }
5675 }
5676
5677 return false;
5678}
5679
5680function isFunctionParent(node, opts) {
5681 if (!node) return false;
5682 const nodeType = node.type;
5683
5684 if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType) {
5685 if (typeof opts === "undefined") {
5686 return true;
5687 } else {
5688 return (0, _shallowEqual.default)(node, opts);
5689 }
5690 }
5691
5692 return false;
5693}
5694
5695function isPureish(node, opts) {
5696 if (!node) return false;
5697 const nodeType = node.type;
5698
5699 if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "BigIntLiteral" === nodeType) {
5700 if (typeof opts === "undefined") {
5701 return true;
5702 } else {
5703 return (0, _shallowEqual.default)(node, opts);
5704 }
5705 }
5706
5707 return false;
5708}
5709
5710function isDeclaration(node, opts) {
5711 if (!node) return false;
5712 const nodeType = node.type;
5713
5714 if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType) {
5715 if (typeof opts === "undefined") {
5716 return true;
5717 } else {
5718 return (0, _shallowEqual.default)(node, opts);
5719 }
5720 }
5721
5722 return false;
5723}
5724
5725function isPatternLike(node, opts) {
5726 if (!node) return false;
5727 const nodeType = node.type;
5728
5729 if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) {
5730 if (typeof opts === "undefined") {
5731 return true;
5732 } else {
5733 return (0, _shallowEqual.default)(node, opts);
5734 }
5735 }
5736
5737 return false;
5738}
5739
5740function isLVal(node, opts) {
5741 if (!node) return false;
5742 const nodeType = node.type;
5743
5744 if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType) {
5745 if (typeof opts === "undefined") {
5746 return true;
5747 } else {
5748 return (0, _shallowEqual.default)(node, opts);
5749 }
5750 }
5751
5752 return false;
5753}
5754
5755function isTSEntityName(node, opts) {
5756 if (!node) return false;
5757 const nodeType = node.type;
5758
5759 if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType) {
5760 if (typeof opts === "undefined") {
5761 return true;
5762 } else {
5763 return (0, _shallowEqual.default)(node, opts);
5764 }
5765 }
5766
5767 return false;
5768}
5769
5770function isLiteral(node, opts) {
5771 if (!node) return false;
5772 const nodeType = node.type;
5773
5774 if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType) {
5775 if (typeof opts === "undefined") {
5776 return true;
5777 } else {
5778 return (0, _shallowEqual.default)(node, opts);
5779 }
5780 }
5781
5782 return false;
5783}
5784
5785function isImmutable(node, opts) {
5786 if (!node) return false;
5787 const nodeType = node.type;
5788
5789 if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "BigIntLiteral" === nodeType) {
5790 if (typeof opts === "undefined") {
5791 return true;
5792 } else {
5793 return (0, _shallowEqual.default)(node, opts);
5794 }
5795 }
5796
5797 return false;
5798}
5799
5800function isUserWhitespacable(node, opts) {
5801 if (!node) return false;
5802 const nodeType = node.type;
5803
5804 if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) {
5805 if (typeof opts === "undefined") {
5806 return true;
5807 } else {
5808 return (0, _shallowEqual.default)(node, opts);
5809 }
5810 }
5811
5812 return false;
5813}
5814
5815function isMethod(node, opts) {
5816 if (!node) return false;
5817 const nodeType = node.type;
5818
5819 if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType) {
5820 if (typeof opts === "undefined") {
5821 return true;
5822 } else {
5823 return (0, _shallowEqual.default)(node, opts);
5824 }
5825 }
5826
5827 return false;
5828}
5829
5830function isObjectMember(node, opts) {
5831 if (!node) return false;
5832 const nodeType = node.type;
5833
5834 if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) {
5835 if (typeof opts === "undefined") {
5836 return true;
5837 } else {
5838 return (0, _shallowEqual.default)(node, opts);
5839 }
5840 }
5841
5842 return false;
5843}
5844
5845function isProperty(node, opts) {
5846 if (!node) return false;
5847 const nodeType = node.type;
5848
5849 if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) {
5850 if (typeof opts === "undefined") {
5851 return true;
5852 } else {
5853 return (0, _shallowEqual.default)(node, opts);
5854 }
5855 }
5856
5857 return false;
5858}
5859
5860function isUnaryLike(node, opts) {
5861 if (!node) return false;
5862 const nodeType = node.type;
5863
5864 if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) {
5865 if (typeof opts === "undefined") {
5866 return true;
5867 } else {
5868 return (0, _shallowEqual.default)(node, opts);
5869 }
5870 }
5871
5872 return false;
5873}
5874
5875function isPattern(node, opts) {
5876 if (!node) return false;
5877 const nodeType = node.type;
5878
5879 if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType) {
5880 if (typeof opts === "undefined") {
5881 return true;
5882 } else {
5883 return (0, _shallowEqual.default)(node, opts);
5884 }
5885 }
5886
5887 return false;
5888}
5889
5890function isClass(node, opts) {
5891 if (!node) return false;
5892 const nodeType = node.type;
5893
5894 if (nodeType === "Class" || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType) {
5895 if (typeof opts === "undefined") {
5896 return true;
5897 } else {
5898 return (0, _shallowEqual.default)(node, opts);
5899 }
5900 }
5901
5902 return false;
5903}
5904
5905function isModuleDeclaration(node, opts) {
5906 if (!node) return false;
5907 const nodeType = node.type;
5908
5909 if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) {
5910 if (typeof opts === "undefined") {
5911 return true;
5912 } else {
5913 return (0, _shallowEqual.default)(node, opts);
5914 }
5915 }
5916
5917 return false;
5918}
5919
5920function isExportDeclaration(node, opts) {
5921 if (!node) return false;
5922 const nodeType = node.type;
5923
5924 if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) {
5925 if (typeof opts === "undefined") {
5926 return true;
5927 } else {
5928 return (0, _shallowEqual.default)(node, opts);
5929 }
5930 }
5931
5932 return false;
5933}
5934
5935function isModuleSpecifier(node, opts) {
5936 if (!node) return false;
5937 const nodeType = node.type;
5938
5939 if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType) {
5940 if (typeof opts === "undefined") {
5941 return true;
5942 } else {
5943 return (0, _shallowEqual.default)(node, opts);
5944 }
5945 }
5946
5947 return false;
5948}
5949
5950function isFlow(node, opts) {
5951 if (!node) return false;
5952 const nodeType = node.type;
5953
5954 if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) {
5955 if (typeof opts === "undefined") {
5956 return true;
5957 } else {
5958 return (0, _shallowEqual.default)(node, opts);
5959 }
5960 }
5961
5962 return false;
5963}
5964
5965function isFlowType(node, opts) {
5966 if (!node) return false;
5967 const nodeType = node.type;
5968
5969 if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) {
5970 if (typeof opts === "undefined") {
5971 return true;
5972 } else {
5973 return (0, _shallowEqual.default)(node, opts);
5974 }
5975 }
5976
5977 return false;
5978}
5979
5980function isFlowBaseAnnotation(node, opts) {
5981 if (!node) return false;
5982 const nodeType = node.type;
5983
5984 if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) {
5985 if (typeof opts === "undefined") {
5986 return true;
5987 } else {
5988 return (0, _shallowEqual.default)(node, opts);
5989 }
5990 }
5991
5992 return false;
5993}
5994
5995function isFlowDeclaration(node, opts) {
5996 if (!node) return false;
5997 const nodeType = node.type;
5998
5999 if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) {
6000 if (typeof opts === "undefined") {
6001 return true;
6002 } else {
6003 return (0, _shallowEqual.default)(node, opts);
6004 }
6005 }
6006
6007 return false;
6008}
6009
6010function isFlowPredicate(node, opts) {
6011 if (!node) return false;
6012 const nodeType = node.type;
6013
6014 if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) {
6015 if (typeof opts === "undefined") {
6016 return true;
6017 } else {
6018 return (0, _shallowEqual.default)(node, opts);
6019 }
6020 }
6021
6022 return false;
6023}
6024
6025function isJSX(node, opts) {
6026 if (!node) return false;
6027 const nodeType = node.type;
6028
6029 if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) {
6030 if (typeof opts === "undefined") {
6031 return true;
6032 } else {
6033 return (0, _shallowEqual.default)(node, opts);
6034 }
6035 }
6036
6037 return false;
6038}
6039
6040function isPrivate(node, opts) {
6041 if (!node) return false;
6042 const nodeType = node.type;
6043
6044 if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "PrivateName" === nodeType) {
6045 if (typeof opts === "undefined") {
6046 return true;
6047 } else {
6048 return (0, _shallowEqual.default)(node, opts);
6049 }
6050 }
6051
6052 return false;
6053}
6054
6055function isTSTypeElement(node, opts) {
6056 if (!node) return false;
6057 const nodeType = node.type;
6058
6059 if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) {
6060 if (typeof opts === "undefined") {
6061 return true;
6062 } else {
6063 return (0, _shallowEqual.default)(node, opts);
6064 }
6065 }
6066
6067 return false;
6068}
6069
6070function isTSType(node, opts) {
6071 if (!node) return false;
6072 const nodeType = node.type;
6073
6074 if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType) {
6075 if (typeof opts === "undefined") {
6076 return true;
6077 } else {
6078 return (0, _shallowEqual.default)(node, opts);
6079 }
6080 }
6081
6082 return false;
6083}
6084
6085function isNumberLiteral(node, opts) {
6086 console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
6087 if (!node) return false;
6088 const nodeType = node.type;
6089
6090 if (nodeType === "NumberLiteral") {
6091 if (typeof opts === "undefined") {
6092 return true;
6093 } else {
6094 return (0, _shallowEqual.default)(node, opts);
6095 }
6096 }
6097
6098 return false;
6099}
6100
6101function isRegexLiteral(node, opts) {
6102 console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
6103 if (!node) return false;
6104 const nodeType = node.type;
6105
6106 if (nodeType === "RegexLiteral") {
6107 if (typeof opts === "undefined") {
6108 return true;
6109 } else {
6110 return (0, _shallowEqual.default)(node, opts);
6111 }
6112 }
6113
6114 return false;
6115}
6116
6117function isRestProperty(node, opts) {
6118 console.trace("The node type RestProperty has been renamed to RestElement");
6119 if (!node) return false;
6120 const nodeType = node.type;
6121
6122 if (nodeType === "RestProperty") {
6123 if (typeof opts === "undefined") {
6124 return true;
6125 } else {
6126 return (0, _shallowEqual.default)(node, opts);
6127 }
6128 }
6129
6130 return false;
6131}
6132
6133function isSpreadProperty(node, opts) {
6134 console.trace("The node type SpreadProperty has been renamed to SpreadElement");
6135 if (!node) return false;
6136 const nodeType = node.type;
6137
6138 if (nodeType === "SpreadProperty") {
6139 if (typeof opts === "undefined") {
6140 return true;
6141 } else {
6142 return (0, _shallowEqual.default)(node, opts);
6143 }
6144 }
6145
6146 return false;
6147}
6148
6149/***/ }),
6150/* 13 */
6151/***/ (function(module, exports) {
6152
6153module.exports = require("fs");
6154
6155/***/ }),
6156/* 14 */
6157/***/ (function(module, exports) {
6158
6159module.exports = require("relay-runtime");
6160
6161/***/ }),
6162/* 15 */
6163/***/ (function(module, exports, __webpack_require__) {
6164
6165"use strict";
6166
6167
6168Object.defineProperty(exports, "__esModule", {
6169 value: true
6170});
6171exports.arrayExpression = exports.ArrayExpression = ArrayExpression;
6172exports.assignmentExpression = exports.AssignmentExpression = AssignmentExpression;
6173exports.binaryExpression = exports.BinaryExpression = BinaryExpression;
6174exports.interpreterDirective = exports.InterpreterDirective = InterpreterDirective;
6175exports.directive = exports.Directive = Directive;
6176exports.directiveLiteral = exports.DirectiveLiteral = DirectiveLiteral;
6177exports.blockStatement = exports.BlockStatement = BlockStatement;
6178exports.breakStatement = exports.BreakStatement = BreakStatement;
6179exports.callExpression = exports.CallExpression = CallExpression;
6180exports.catchClause = exports.CatchClause = CatchClause;
6181exports.conditionalExpression = exports.ConditionalExpression = ConditionalExpression;
6182exports.continueStatement = exports.ContinueStatement = ContinueStatement;
6183exports.debuggerStatement = exports.DebuggerStatement = DebuggerStatement;
6184exports.doWhileStatement = exports.DoWhileStatement = DoWhileStatement;
6185exports.emptyStatement = exports.EmptyStatement = EmptyStatement;
6186exports.expressionStatement = exports.ExpressionStatement = ExpressionStatement;
6187exports.file = exports.File = File;
6188exports.forInStatement = exports.ForInStatement = ForInStatement;
6189exports.forStatement = exports.ForStatement = ForStatement;
6190exports.functionDeclaration = exports.FunctionDeclaration = FunctionDeclaration;
6191exports.functionExpression = exports.FunctionExpression = FunctionExpression;
6192exports.identifier = exports.Identifier = Identifier;
6193exports.ifStatement = exports.IfStatement = IfStatement;
6194exports.labeledStatement = exports.LabeledStatement = LabeledStatement;
6195exports.stringLiteral = exports.StringLiteral = StringLiteral;
6196exports.numericLiteral = exports.NumericLiteral = NumericLiteral;
6197exports.nullLiteral = exports.NullLiteral = NullLiteral;
6198exports.booleanLiteral = exports.BooleanLiteral = BooleanLiteral;
6199exports.regExpLiteral = exports.RegExpLiteral = RegExpLiteral;
6200exports.logicalExpression = exports.LogicalExpression = LogicalExpression;
6201exports.memberExpression = exports.MemberExpression = MemberExpression;
6202exports.newExpression = exports.NewExpression = NewExpression;
6203exports.program = exports.Program = Program;
6204exports.objectExpression = exports.ObjectExpression = ObjectExpression;
6205exports.objectMethod = exports.ObjectMethod = ObjectMethod;
6206exports.objectProperty = exports.ObjectProperty = ObjectProperty;
6207exports.restElement = exports.RestElement = RestElement;
6208exports.returnStatement = exports.ReturnStatement = ReturnStatement;
6209exports.sequenceExpression = exports.SequenceExpression = SequenceExpression;
6210exports.switchCase = exports.SwitchCase = SwitchCase;
6211exports.switchStatement = exports.SwitchStatement = SwitchStatement;
6212exports.thisExpression = exports.ThisExpression = ThisExpression;
6213exports.throwStatement = exports.ThrowStatement = ThrowStatement;
6214exports.tryStatement = exports.TryStatement = TryStatement;
6215exports.unaryExpression = exports.UnaryExpression = UnaryExpression;
6216exports.updateExpression = exports.UpdateExpression = UpdateExpression;
6217exports.variableDeclaration = exports.VariableDeclaration = VariableDeclaration;
6218exports.variableDeclarator = exports.VariableDeclarator = VariableDeclarator;
6219exports.whileStatement = exports.WhileStatement = WhileStatement;
6220exports.withStatement = exports.WithStatement = WithStatement;
6221exports.assignmentPattern = exports.AssignmentPattern = AssignmentPattern;
6222exports.arrayPattern = exports.ArrayPattern = ArrayPattern;
6223exports.arrowFunctionExpression = exports.ArrowFunctionExpression = ArrowFunctionExpression;
6224exports.classBody = exports.ClassBody = ClassBody;
6225exports.classDeclaration = exports.ClassDeclaration = ClassDeclaration;
6226exports.classExpression = exports.ClassExpression = ClassExpression;
6227exports.exportAllDeclaration = exports.ExportAllDeclaration = ExportAllDeclaration;
6228exports.exportDefaultDeclaration = exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
6229exports.exportNamedDeclaration = exports.ExportNamedDeclaration = ExportNamedDeclaration;
6230exports.exportSpecifier = exports.ExportSpecifier = ExportSpecifier;
6231exports.forOfStatement = exports.ForOfStatement = ForOfStatement;
6232exports.importDeclaration = exports.ImportDeclaration = ImportDeclaration;
6233exports.importDefaultSpecifier = exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
6234exports.importNamespaceSpecifier = exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
6235exports.importSpecifier = exports.ImportSpecifier = ImportSpecifier;
6236exports.metaProperty = exports.MetaProperty = MetaProperty;
6237exports.classMethod = exports.ClassMethod = ClassMethod;
6238exports.objectPattern = exports.ObjectPattern = ObjectPattern;
6239exports.spreadElement = exports.SpreadElement = SpreadElement;
6240exports.super = exports.Super = Super;
6241exports.taggedTemplateExpression = exports.TaggedTemplateExpression = TaggedTemplateExpression;
6242exports.templateElement = exports.TemplateElement = TemplateElement;
6243exports.templateLiteral = exports.TemplateLiteral = TemplateLiteral;
6244exports.yieldExpression = exports.YieldExpression = YieldExpression;
6245exports.anyTypeAnnotation = exports.AnyTypeAnnotation = AnyTypeAnnotation;
6246exports.arrayTypeAnnotation = exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
6247exports.booleanTypeAnnotation = exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
6248exports.booleanLiteralTypeAnnotation = exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
6249exports.nullLiteralTypeAnnotation = exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
6250exports.classImplements = exports.ClassImplements = ClassImplements;
6251exports.declareClass = exports.DeclareClass = DeclareClass;
6252exports.declareFunction = exports.DeclareFunction = DeclareFunction;
6253exports.declareInterface = exports.DeclareInterface = DeclareInterface;
6254exports.declareModule = exports.DeclareModule = DeclareModule;
6255exports.declareModuleExports = exports.DeclareModuleExports = DeclareModuleExports;
6256exports.declareTypeAlias = exports.DeclareTypeAlias = DeclareTypeAlias;
6257exports.declareOpaqueType = exports.DeclareOpaqueType = DeclareOpaqueType;
6258exports.declareVariable = exports.DeclareVariable = DeclareVariable;
6259exports.declareExportDeclaration = exports.DeclareExportDeclaration = DeclareExportDeclaration;
6260exports.declareExportAllDeclaration = exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration;
6261exports.declaredPredicate = exports.DeclaredPredicate = DeclaredPredicate;
6262exports.existsTypeAnnotation = exports.ExistsTypeAnnotation = ExistsTypeAnnotation;
6263exports.functionTypeAnnotation = exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
6264exports.functionTypeParam = exports.FunctionTypeParam = FunctionTypeParam;
6265exports.genericTypeAnnotation = exports.GenericTypeAnnotation = GenericTypeAnnotation;
6266exports.inferredPredicate = exports.InferredPredicate = InferredPredicate;
6267exports.interfaceExtends = exports.InterfaceExtends = InterfaceExtends;
6268exports.interfaceDeclaration = exports.InterfaceDeclaration = InterfaceDeclaration;
6269exports.interfaceTypeAnnotation = exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation;
6270exports.intersectionTypeAnnotation = exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
6271exports.mixedTypeAnnotation = exports.MixedTypeAnnotation = MixedTypeAnnotation;
6272exports.emptyTypeAnnotation = exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
6273exports.nullableTypeAnnotation = exports.NullableTypeAnnotation = NullableTypeAnnotation;
6274exports.numberLiteralTypeAnnotation = exports.NumberLiteralTypeAnnotation = NumberLiteralTypeAnnotation;
6275exports.numberTypeAnnotation = exports.NumberTypeAnnotation = NumberTypeAnnotation;
6276exports.objectTypeAnnotation = exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
6277exports.objectTypeInternalSlot = exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot;
6278exports.objectTypeCallProperty = exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
6279exports.objectTypeIndexer = exports.ObjectTypeIndexer = ObjectTypeIndexer;
6280exports.objectTypeProperty = exports.ObjectTypeProperty = ObjectTypeProperty;
6281exports.objectTypeSpreadProperty = exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty;
6282exports.opaqueType = exports.OpaqueType = OpaqueType;
6283exports.qualifiedTypeIdentifier = exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
6284exports.stringLiteralTypeAnnotation = exports.StringLiteralTypeAnnotation = StringLiteralTypeAnnotation;
6285exports.stringTypeAnnotation = exports.StringTypeAnnotation = StringTypeAnnotation;
6286exports.thisTypeAnnotation = exports.ThisTypeAnnotation = ThisTypeAnnotation;
6287exports.tupleTypeAnnotation = exports.TupleTypeAnnotation = TupleTypeAnnotation;
6288exports.typeofTypeAnnotation = exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
6289exports.typeAlias = exports.TypeAlias = TypeAlias;
6290exports.typeAnnotation = exports.TypeAnnotation = TypeAnnotation;
6291exports.typeCastExpression = exports.TypeCastExpression = TypeCastExpression;
6292exports.typeParameter = exports.TypeParameter = TypeParameter;
6293exports.typeParameterDeclaration = exports.TypeParameterDeclaration = TypeParameterDeclaration;
6294exports.typeParameterInstantiation = exports.TypeParameterInstantiation = TypeParameterInstantiation;
6295exports.unionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
6296exports.variance = exports.Variance = Variance;
6297exports.voidTypeAnnotation = exports.VoidTypeAnnotation = VoidTypeAnnotation;
6298exports.jSXAttribute = exports.jsxAttribute = exports.JSXAttribute = JSXAttribute;
6299exports.jSXClosingElement = exports.jsxClosingElement = exports.JSXClosingElement = JSXClosingElement;
6300exports.jSXElement = exports.jsxElement = exports.JSXElement = JSXElement;
6301exports.jSXEmptyExpression = exports.jsxEmptyExpression = exports.JSXEmptyExpression = JSXEmptyExpression;
6302exports.jSXExpressionContainer = exports.jsxExpressionContainer = exports.JSXExpressionContainer = JSXExpressionContainer;
6303exports.jSXSpreadChild = exports.jsxSpreadChild = exports.JSXSpreadChild = JSXSpreadChild;
6304exports.jSXIdentifier = exports.jsxIdentifier = exports.JSXIdentifier = JSXIdentifier;
6305exports.jSXMemberExpression = exports.jsxMemberExpression = exports.JSXMemberExpression = JSXMemberExpression;
6306exports.jSXNamespacedName = exports.jsxNamespacedName = exports.JSXNamespacedName = JSXNamespacedName;
6307exports.jSXOpeningElement = exports.jsxOpeningElement = exports.JSXOpeningElement = JSXOpeningElement;
6308exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = exports.JSXSpreadAttribute = JSXSpreadAttribute;
6309exports.jSXText = exports.jsxText = exports.JSXText = JSXText;
6310exports.jSXFragment = exports.jsxFragment = exports.JSXFragment = JSXFragment;
6311exports.jSXOpeningFragment = exports.jsxOpeningFragment = exports.JSXOpeningFragment = JSXOpeningFragment;
6312exports.jSXClosingFragment = exports.jsxClosingFragment = exports.JSXClosingFragment = JSXClosingFragment;
6313exports.noop = exports.Noop = Noop;
6314exports.parenthesizedExpression = exports.ParenthesizedExpression = ParenthesizedExpression;
6315exports.awaitExpression = exports.AwaitExpression = AwaitExpression;
6316exports.bindExpression = exports.BindExpression = BindExpression;
6317exports.classProperty = exports.ClassProperty = ClassProperty;
6318exports.optionalMemberExpression = exports.OptionalMemberExpression = OptionalMemberExpression;
6319exports.optionalCallExpression = exports.OptionalCallExpression = OptionalCallExpression;
6320exports.classPrivateProperty = exports.ClassPrivateProperty = ClassPrivateProperty;
6321exports.import = exports.Import = Import;
6322exports.decorator = exports.Decorator = Decorator;
6323exports.doExpression = exports.DoExpression = DoExpression;
6324exports.exportDefaultSpecifier = exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
6325exports.exportNamespaceSpecifier = exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
6326exports.privateName = exports.PrivateName = PrivateName;
6327exports.bigIntLiteral = exports.BigIntLiteral = BigIntLiteral;
6328exports.tSParameterProperty = exports.tsParameterProperty = exports.TSParameterProperty = TSParameterProperty;
6329exports.tSDeclareFunction = exports.tsDeclareFunction = exports.TSDeclareFunction = TSDeclareFunction;
6330exports.tSDeclareMethod = exports.tsDeclareMethod = exports.TSDeclareMethod = TSDeclareMethod;
6331exports.tSQualifiedName = exports.tsQualifiedName = exports.TSQualifiedName = TSQualifiedName;
6332exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration;
6333exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = exports.TSConstructSignatureDeclaration = TSConstructSignatureDeclaration;
6334exports.tSPropertySignature = exports.tsPropertySignature = exports.TSPropertySignature = TSPropertySignature;
6335exports.tSMethodSignature = exports.tsMethodSignature = exports.TSMethodSignature = TSMethodSignature;
6336exports.tSIndexSignature = exports.tsIndexSignature = exports.TSIndexSignature = TSIndexSignature;
6337exports.tSAnyKeyword = exports.tsAnyKeyword = exports.TSAnyKeyword = TSAnyKeyword;
6338exports.tSNumberKeyword = exports.tsNumberKeyword = exports.TSNumberKeyword = TSNumberKeyword;
6339exports.tSObjectKeyword = exports.tsObjectKeyword = exports.TSObjectKeyword = TSObjectKeyword;
6340exports.tSBooleanKeyword = exports.tsBooleanKeyword = exports.TSBooleanKeyword = TSBooleanKeyword;
6341exports.tSStringKeyword = exports.tsStringKeyword = exports.TSStringKeyword = TSStringKeyword;
6342exports.tSSymbolKeyword = exports.tsSymbolKeyword = exports.TSSymbolKeyword = TSSymbolKeyword;
6343exports.tSVoidKeyword = exports.tsVoidKeyword = exports.TSVoidKeyword = TSVoidKeyword;
6344exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = exports.TSUndefinedKeyword = TSUndefinedKeyword;
6345exports.tSNullKeyword = exports.tsNullKeyword = exports.TSNullKeyword = TSNullKeyword;
6346exports.tSNeverKeyword = exports.tsNeverKeyword = exports.TSNeverKeyword = TSNeverKeyword;
6347exports.tSThisType = exports.tsThisType = exports.TSThisType = TSThisType;
6348exports.tSFunctionType = exports.tsFunctionType = exports.TSFunctionType = TSFunctionType;
6349exports.tSConstructorType = exports.tsConstructorType = exports.TSConstructorType = TSConstructorType;
6350exports.tSTypeReference = exports.tsTypeReference = exports.TSTypeReference = TSTypeReference;
6351exports.tSTypePredicate = exports.tsTypePredicate = exports.TSTypePredicate = TSTypePredicate;
6352exports.tSTypeQuery = exports.tsTypeQuery = exports.TSTypeQuery = TSTypeQuery;
6353exports.tSTypeLiteral = exports.tsTypeLiteral = exports.TSTypeLiteral = TSTypeLiteral;
6354exports.tSArrayType = exports.tsArrayType = exports.TSArrayType = TSArrayType;
6355exports.tSTupleType = exports.tsTupleType = exports.TSTupleType = TSTupleType;
6356exports.tSUnionType = exports.tsUnionType = exports.TSUnionType = TSUnionType;
6357exports.tSIntersectionType = exports.tsIntersectionType = exports.TSIntersectionType = TSIntersectionType;
6358exports.tSConditionalType = exports.tsConditionalType = exports.TSConditionalType = TSConditionalType;
6359exports.tSInferType = exports.tsInferType = exports.TSInferType = TSInferType;
6360exports.tSParenthesizedType = exports.tsParenthesizedType = exports.TSParenthesizedType = TSParenthesizedType;
6361exports.tSTypeOperator = exports.tsTypeOperator = exports.TSTypeOperator = TSTypeOperator;
6362exports.tSIndexedAccessType = exports.tsIndexedAccessType = exports.TSIndexedAccessType = TSIndexedAccessType;
6363exports.tSMappedType = exports.tsMappedType = exports.TSMappedType = TSMappedType;
6364exports.tSLiteralType = exports.tsLiteralType = exports.TSLiteralType = TSLiteralType;
6365exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments;
6366exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = exports.TSInterfaceDeclaration = TSInterfaceDeclaration;
6367exports.tSInterfaceBody = exports.tsInterfaceBody = exports.TSInterfaceBody = TSInterfaceBody;
6368exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration;
6369exports.tSAsExpression = exports.tsAsExpression = exports.TSAsExpression = TSAsExpression;
6370exports.tSTypeAssertion = exports.tsTypeAssertion = exports.TSTypeAssertion = TSTypeAssertion;
6371exports.tSEnumDeclaration = exports.tsEnumDeclaration = exports.TSEnumDeclaration = TSEnumDeclaration;
6372exports.tSEnumMember = exports.tsEnumMember = exports.TSEnumMember = TSEnumMember;
6373exports.tSModuleDeclaration = exports.tsModuleDeclaration = exports.TSModuleDeclaration = TSModuleDeclaration;
6374exports.tSModuleBlock = exports.tsModuleBlock = exports.TSModuleBlock = TSModuleBlock;
6375exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration;
6376exports.tSExternalModuleReference = exports.tsExternalModuleReference = exports.TSExternalModuleReference = TSExternalModuleReference;
6377exports.tSNonNullExpression = exports.tsNonNullExpression = exports.TSNonNullExpression = TSNonNullExpression;
6378exports.tSExportAssignment = exports.tsExportAssignment = exports.TSExportAssignment = TSExportAssignment;
6379exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration;
6380exports.tSTypeAnnotation = exports.tsTypeAnnotation = exports.TSTypeAnnotation = TSTypeAnnotation;
6381exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = exports.TSTypeParameterInstantiation = TSTypeParameterInstantiation;
6382exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = exports.TSTypeParameterDeclaration = TSTypeParameterDeclaration;
6383exports.tSTypeParameter = exports.tsTypeParameter = exports.TSTypeParameter = TSTypeParameter;
6384exports.numberLiteral = exports.NumberLiteral = NumberLiteral;
6385exports.regexLiteral = exports.RegexLiteral = RegexLiteral;
6386exports.restProperty = exports.RestProperty = RestProperty;
6387exports.spreadProperty = exports.SpreadProperty = SpreadProperty;
6388
6389var _builder = _interopRequireDefault(__webpack_require__(127));
6390
6391function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6392
6393function ArrayExpression(...args) {
6394 return (0, _builder.default)("ArrayExpression", ...args);
6395}
6396
6397function AssignmentExpression(...args) {
6398 return (0, _builder.default)("AssignmentExpression", ...args);
6399}
6400
6401function BinaryExpression(...args) {
6402 return (0, _builder.default)("BinaryExpression", ...args);
6403}
6404
6405function InterpreterDirective(...args) {
6406 return (0, _builder.default)("InterpreterDirective", ...args);
6407}
6408
6409function Directive(...args) {
6410 return (0, _builder.default)("Directive", ...args);
6411}
6412
6413function DirectiveLiteral(...args) {
6414 return (0, _builder.default)("DirectiveLiteral", ...args);
6415}
6416
6417function BlockStatement(...args) {
6418 return (0, _builder.default)("BlockStatement", ...args);
6419}
6420
6421function BreakStatement(...args) {
6422 return (0, _builder.default)("BreakStatement", ...args);
6423}
6424
6425function CallExpression(...args) {
6426 return (0, _builder.default)("CallExpression", ...args);
6427}
6428
6429function CatchClause(...args) {
6430 return (0, _builder.default)("CatchClause", ...args);
6431}
6432
6433function ConditionalExpression(...args) {
6434 return (0, _builder.default)("ConditionalExpression", ...args);
6435}
6436
6437function ContinueStatement(...args) {
6438 return (0, _builder.default)("ContinueStatement", ...args);
6439}
6440
6441function DebuggerStatement(...args) {
6442 return (0, _builder.default)("DebuggerStatement", ...args);
6443}
6444
6445function DoWhileStatement(...args) {
6446 return (0, _builder.default)("DoWhileStatement", ...args);
6447}
6448
6449function EmptyStatement(...args) {
6450 return (0, _builder.default)("EmptyStatement", ...args);
6451}
6452
6453function ExpressionStatement(...args) {
6454 return (0, _builder.default)("ExpressionStatement", ...args);
6455}
6456
6457function File(...args) {
6458 return (0, _builder.default)("File", ...args);
6459}
6460
6461function ForInStatement(...args) {
6462 return (0, _builder.default)("ForInStatement", ...args);
6463}
6464
6465function ForStatement(...args) {
6466 return (0, _builder.default)("ForStatement", ...args);
6467}
6468
6469function FunctionDeclaration(...args) {
6470 return (0, _builder.default)("FunctionDeclaration", ...args);
6471}
6472
6473function FunctionExpression(...args) {
6474 return (0, _builder.default)("FunctionExpression", ...args);
6475}
6476
6477function Identifier(...args) {
6478 return (0, _builder.default)("Identifier", ...args);
6479}
6480
6481function IfStatement(...args) {
6482 return (0, _builder.default)("IfStatement", ...args);
6483}
6484
6485function LabeledStatement(...args) {
6486 return (0, _builder.default)("LabeledStatement", ...args);
6487}
6488
6489function StringLiteral(...args) {
6490 return (0, _builder.default)("StringLiteral", ...args);
6491}
6492
6493function NumericLiteral(...args) {
6494 return (0, _builder.default)("NumericLiteral", ...args);
6495}
6496
6497function NullLiteral(...args) {
6498 return (0, _builder.default)("NullLiteral", ...args);
6499}
6500
6501function BooleanLiteral(...args) {
6502 return (0, _builder.default)("BooleanLiteral", ...args);
6503}
6504
6505function RegExpLiteral(...args) {
6506 return (0, _builder.default)("RegExpLiteral", ...args);
6507}
6508
6509function LogicalExpression(...args) {
6510 return (0, _builder.default)("LogicalExpression", ...args);
6511}
6512
6513function MemberExpression(...args) {
6514 return (0, _builder.default)("MemberExpression", ...args);
6515}
6516
6517function NewExpression(...args) {
6518 return (0, _builder.default)("NewExpression", ...args);
6519}
6520
6521function Program(...args) {
6522 return (0, _builder.default)("Program", ...args);
6523}
6524
6525function ObjectExpression(...args) {
6526 return (0, _builder.default)("ObjectExpression", ...args);
6527}
6528
6529function ObjectMethod(...args) {
6530 return (0, _builder.default)("ObjectMethod", ...args);
6531}
6532
6533function ObjectProperty(...args) {
6534 return (0, _builder.default)("ObjectProperty", ...args);
6535}
6536
6537function RestElement(...args) {
6538 return (0, _builder.default)("RestElement", ...args);
6539}
6540
6541function ReturnStatement(...args) {
6542 return (0, _builder.default)("ReturnStatement", ...args);
6543}
6544
6545function SequenceExpression(...args) {
6546 return (0, _builder.default)("SequenceExpression", ...args);
6547}
6548
6549function SwitchCase(...args) {
6550 return (0, _builder.default)("SwitchCase", ...args);
6551}
6552
6553function SwitchStatement(...args) {
6554 return (0, _builder.default)("SwitchStatement", ...args);
6555}
6556
6557function ThisExpression(...args) {
6558 return (0, _builder.default)("ThisExpression", ...args);
6559}
6560
6561function ThrowStatement(...args) {
6562 return (0, _builder.default)("ThrowStatement", ...args);
6563}
6564
6565function TryStatement(...args) {
6566 return (0, _builder.default)("TryStatement", ...args);
6567}
6568
6569function UnaryExpression(...args) {
6570 return (0, _builder.default)("UnaryExpression", ...args);
6571}
6572
6573function UpdateExpression(...args) {
6574 return (0, _builder.default)("UpdateExpression", ...args);
6575}
6576
6577function VariableDeclaration(...args) {
6578 return (0, _builder.default)("VariableDeclaration", ...args);
6579}
6580
6581function VariableDeclarator(...args) {
6582 return (0, _builder.default)("VariableDeclarator", ...args);
6583}
6584
6585function WhileStatement(...args) {
6586 return (0, _builder.default)("WhileStatement", ...args);
6587}
6588
6589function WithStatement(...args) {
6590 return (0, _builder.default)("WithStatement", ...args);
6591}
6592
6593function AssignmentPattern(...args) {
6594 return (0, _builder.default)("AssignmentPattern", ...args);
6595}
6596
6597function ArrayPattern(...args) {
6598 return (0, _builder.default)("ArrayPattern", ...args);
6599}
6600
6601function ArrowFunctionExpression(...args) {
6602 return (0, _builder.default)("ArrowFunctionExpression", ...args);
6603}
6604
6605function ClassBody(...args) {
6606 return (0, _builder.default)("ClassBody", ...args);
6607}
6608
6609function ClassDeclaration(...args) {
6610 return (0, _builder.default)("ClassDeclaration", ...args);
6611}
6612
6613function ClassExpression(...args) {
6614 return (0, _builder.default)("ClassExpression", ...args);
6615}
6616
6617function ExportAllDeclaration(...args) {
6618 return (0, _builder.default)("ExportAllDeclaration", ...args);
6619}
6620
6621function ExportDefaultDeclaration(...args) {
6622 return (0, _builder.default)("ExportDefaultDeclaration", ...args);
6623}
6624
6625function ExportNamedDeclaration(...args) {
6626 return (0, _builder.default)("ExportNamedDeclaration", ...args);
6627}
6628
6629function ExportSpecifier(...args) {
6630 return (0, _builder.default)("ExportSpecifier", ...args);
6631}
6632
6633function ForOfStatement(...args) {
6634 return (0, _builder.default)("ForOfStatement", ...args);
6635}
6636
6637function ImportDeclaration(...args) {
6638 return (0, _builder.default)("ImportDeclaration", ...args);
6639}
6640
6641function ImportDefaultSpecifier(...args) {
6642 return (0, _builder.default)("ImportDefaultSpecifier", ...args);
6643}
6644
6645function ImportNamespaceSpecifier(...args) {
6646 return (0, _builder.default)("ImportNamespaceSpecifier", ...args);
6647}
6648
6649function ImportSpecifier(...args) {
6650 return (0, _builder.default)("ImportSpecifier", ...args);
6651}
6652
6653function MetaProperty(...args) {
6654 return (0, _builder.default)("MetaProperty", ...args);
6655}
6656
6657function ClassMethod(...args) {
6658 return (0, _builder.default)("ClassMethod", ...args);
6659}
6660
6661function ObjectPattern(...args) {
6662 return (0, _builder.default)("ObjectPattern", ...args);
6663}
6664
6665function SpreadElement(...args) {
6666 return (0, _builder.default)("SpreadElement", ...args);
6667}
6668
6669function Super(...args) {
6670 return (0, _builder.default)("Super", ...args);
6671}
6672
6673function TaggedTemplateExpression(...args) {
6674 return (0, _builder.default)("TaggedTemplateExpression", ...args);
6675}
6676
6677function TemplateElement(...args) {
6678 return (0, _builder.default)("TemplateElement", ...args);
6679}
6680
6681function TemplateLiteral(...args) {
6682 return (0, _builder.default)("TemplateLiteral", ...args);
6683}
6684
6685function YieldExpression(...args) {
6686 return (0, _builder.default)("YieldExpression", ...args);
6687}
6688
6689function AnyTypeAnnotation(...args) {
6690 return (0, _builder.default)("AnyTypeAnnotation", ...args);
6691}
6692
6693function ArrayTypeAnnotation(...args) {
6694 return (0, _builder.default)("ArrayTypeAnnotation", ...args);
6695}
6696
6697function BooleanTypeAnnotation(...args) {
6698 return (0, _builder.default)("BooleanTypeAnnotation", ...args);
6699}
6700
6701function BooleanLiteralTypeAnnotation(...args) {
6702 return (0, _builder.default)("BooleanLiteralTypeAnnotation", ...args);
6703}
6704
6705function NullLiteralTypeAnnotation(...args) {
6706 return (0, _builder.default)("NullLiteralTypeAnnotation", ...args);
6707}
6708
6709function ClassImplements(...args) {
6710 return (0, _builder.default)("ClassImplements", ...args);
6711}
6712
6713function DeclareClass(...args) {
6714 return (0, _builder.default)("DeclareClass", ...args);
6715}
6716
6717function DeclareFunction(...args) {
6718 return (0, _builder.default)("DeclareFunction", ...args);
6719}
6720
6721function DeclareInterface(...args) {
6722 return (0, _builder.default)("DeclareInterface", ...args);
6723}
6724
6725function DeclareModule(...args) {
6726 return (0, _builder.default)("DeclareModule", ...args);
6727}
6728
6729function DeclareModuleExports(...args) {
6730 return (0, _builder.default)("DeclareModuleExports", ...args);
6731}
6732
6733function DeclareTypeAlias(...args) {
6734 return (0, _builder.default)("DeclareTypeAlias", ...args);
6735}
6736
6737function DeclareOpaqueType(...args) {
6738 return (0, _builder.default)("DeclareOpaqueType", ...args);
6739}
6740
6741function DeclareVariable(...args) {
6742 return (0, _builder.default)("DeclareVariable", ...args);
6743}
6744
6745function DeclareExportDeclaration(...args) {
6746 return (0, _builder.default)("DeclareExportDeclaration", ...args);
6747}
6748
6749function DeclareExportAllDeclaration(...args) {
6750 return (0, _builder.default)("DeclareExportAllDeclaration", ...args);
6751}
6752
6753function DeclaredPredicate(...args) {
6754 return (0, _builder.default)("DeclaredPredicate", ...args);
6755}
6756
6757function ExistsTypeAnnotation(...args) {
6758 return (0, _builder.default)("ExistsTypeAnnotation", ...args);
6759}
6760
6761function FunctionTypeAnnotation(...args) {
6762 return (0, _builder.default)("FunctionTypeAnnotation", ...args);
6763}
6764
6765function FunctionTypeParam(...args) {
6766 return (0, _builder.default)("FunctionTypeParam", ...args);
6767}
6768
6769function GenericTypeAnnotation(...args) {
6770 return (0, _builder.default)("GenericTypeAnnotation", ...args);
6771}
6772
6773function InferredPredicate(...args) {
6774 return (0, _builder.default)("InferredPredicate", ...args);
6775}
6776
6777function InterfaceExtends(...args) {
6778 return (0, _builder.default)("InterfaceExtends", ...args);
6779}
6780
6781function InterfaceDeclaration(...args) {
6782 return (0, _builder.default)("InterfaceDeclaration", ...args);
6783}
6784
6785function InterfaceTypeAnnotation(...args) {
6786 return (0, _builder.default)("InterfaceTypeAnnotation", ...args);
6787}
6788
6789function IntersectionTypeAnnotation(...args) {
6790 return (0, _builder.default)("IntersectionTypeAnnotation", ...args);
6791}
6792
6793function MixedTypeAnnotation(...args) {
6794 return (0, _builder.default)("MixedTypeAnnotation", ...args);
6795}
6796
6797function EmptyTypeAnnotation(...args) {
6798 return (0, _builder.default)("EmptyTypeAnnotation", ...args);
6799}
6800
6801function NullableTypeAnnotation(...args) {
6802 return (0, _builder.default)("NullableTypeAnnotation", ...args);
6803}
6804
6805function NumberLiteralTypeAnnotation(...args) {
6806 return (0, _builder.default)("NumberLiteralTypeAnnotation", ...args);
6807}
6808
6809function NumberTypeAnnotation(...args) {
6810 return (0, _builder.default)("NumberTypeAnnotation", ...args);
6811}
6812
6813function ObjectTypeAnnotation(...args) {
6814 return (0, _builder.default)("ObjectTypeAnnotation", ...args);
6815}
6816
6817function ObjectTypeInternalSlot(...args) {
6818 return (0, _builder.default)("ObjectTypeInternalSlot", ...args);
6819}
6820
6821function ObjectTypeCallProperty(...args) {
6822 return (0, _builder.default)("ObjectTypeCallProperty", ...args);
6823}
6824
6825function ObjectTypeIndexer(...args) {
6826 return (0, _builder.default)("ObjectTypeIndexer", ...args);
6827}
6828
6829function ObjectTypeProperty(...args) {
6830 return (0, _builder.default)("ObjectTypeProperty", ...args);
6831}
6832
6833function ObjectTypeSpreadProperty(...args) {
6834 return (0, _builder.default)("ObjectTypeSpreadProperty", ...args);
6835}
6836
6837function OpaqueType(...args) {
6838 return (0, _builder.default)("OpaqueType", ...args);
6839}
6840
6841function QualifiedTypeIdentifier(...args) {
6842 return (0, _builder.default)("QualifiedTypeIdentifier", ...args);
6843}
6844
6845function StringLiteralTypeAnnotation(...args) {
6846 return (0, _builder.default)("StringLiteralTypeAnnotation", ...args);
6847}
6848
6849function StringTypeAnnotation(...args) {
6850 return (0, _builder.default)("StringTypeAnnotation", ...args);
6851}
6852
6853function ThisTypeAnnotation(...args) {
6854 return (0, _builder.default)("ThisTypeAnnotation", ...args);
6855}
6856
6857function TupleTypeAnnotation(...args) {
6858 return (0, _builder.default)("TupleTypeAnnotation", ...args);
6859}
6860
6861function TypeofTypeAnnotation(...args) {
6862 return (0, _builder.default)("TypeofTypeAnnotation", ...args);
6863}
6864
6865function TypeAlias(...args) {
6866 return (0, _builder.default)("TypeAlias", ...args);
6867}
6868
6869function TypeAnnotation(...args) {
6870 return (0, _builder.default)("TypeAnnotation", ...args);
6871}
6872
6873function TypeCastExpression(...args) {
6874 return (0, _builder.default)("TypeCastExpression", ...args);
6875}
6876
6877function TypeParameter(...args) {
6878 return (0, _builder.default)("TypeParameter", ...args);
6879}
6880
6881function TypeParameterDeclaration(...args) {
6882 return (0, _builder.default)("TypeParameterDeclaration", ...args);
6883}
6884
6885function TypeParameterInstantiation(...args) {
6886 return (0, _builder.default)("TypeParameterInstantiation", ...args);
6887}
6888
6889function UnionTypeAnnotation(...args) {
6890 return (0, _builder.default)("UnionTypeAnnotation", ...args);
6891}
6892
6893function Variance(...args) {
6894 return (0, _builder.default)("Variance", ...args);
6895}
6896
6897function VoidTypeAnnotation(...args) {
6898 return (0, _builder.default)("VoidTypeAnnotation", ...args);
6899}
6900
6901function JSXAttribute(...args) {
6902 return (0, _builder.default)("JSXAttribute", ...args);
6903}
6904
6905function JSXClosingElement(...args) {
6906 return (0, _builder.default)("JSXClosingElement", ...args);
6907}
6908
6909function JSXElement(...args) {
6910 return (0, _builder.default)("JSXElement", ...args);
6911}
6912
6913function JSXEmptyExpression(...args) {
6914 return (0, _builder.default)("JSXEmptyExpression", ...args);
6915}
6916
6917function JSXExpressionContainer(...args) {
6918 return (0, _builder.default)("JSXExpressionContainer", ...args);
6919}
6920
6921function JSXSpreadChild(...args) {
6922 return (0, _builder.default)("JSXSpreadChild", ...args);
6923}
6924
6925function JSXIdentifier(...args) {
6926 return (0, _builder.default)("JSXIdentifier", ...args);
6927}
6928
6929function JSXMemberExpression(...args) {
6930 return (0, _builder.default)("JSXMemberExpression", ...args);
6931}
6932
6933function JSXNamespacedName(...args) {
6934 return (0, _builder.default)("JSXNamespacedName", ...args);
6935}
6936
6937function JSXOpeningElement(...args) {
6938 return (0, _builder.default)("JSXOpeningElement", ...args);
6939}
6940
6941function JSXSpreadAttribute(...args) {
6942 return (0, _builder.default)("JSXSpreadAttribute", ...args);
6943}
6944
6945function JSXText(...args) {
6946 return (0, _builder.default)("JSXText", ...args);
6947}
6948
6949function JSXFragment(...args) {
6950 return (0, _builder.default)("JSXFragment", ...args);
6951}
6952
6953function JSXOpeningFragment(...args) {
6954 return (0, _builder.default)("JSXOpeningFragment", ...args);
6955}
6956
6957function JSXClosingFragment(...args) {
6958 return (0, _builder.default)("JSXClosingFragment", ...args);
6959}
6960
6961function Noop(...args) {
6962 return (0, _builder.default)("Noop", ...args);
6963}
6964
6965function ParenthesizedExpression(...args) {
6966 return (0, _builder.default)("ParenthesizedExpression", ...args);
6967}
6968
6969function AwaitExpression(...args) {
6970 return (0, _builder.default)("AwaitExpression", ...args);
6971}
6972
6973function BindExpression(...args) {
6974 return (0, _builder.default)("BindExpression", ...args);
6975}
6976
6977function ClassProperty(...args) {
6978 return (0, _builder.default)("ClassProperty", ...args);
6979}
6980
6981function OptionalMemberExpression(...args) {
6982 return (0, _builder.default)("OptionalMemberExpression", ...args);
6983}
6984
6985function OptionalCallExpression(...args) {
6986 return (0, _builder.default)("OptionalCallExpression", ...args);
6987}
6988
6989function ClassPrivateProperty(...args) {
6990 return (0, _builder.default)("ClassPrivateProperty", ...args);
6991}
6992
6993function Import(...args) {
6994 return (0, _builder.default)("Import", ...args);
6995}
6996
6997function Decorator(...args) {
6998 return (0, _builder.default)("Decorator", ...args);
6999}
7000
7001function DoExpression(...args) {
7002 return (0, _builder.default)("DoExpression", ...args);
7003}
7004
7005function ExportDefaultSpecifier(...args) {
7006 return (0, _builder.default)("ExportDefaultSpecifier", ...args);
7007}
7008
7009function ExportNamespaceSpecifier(...args) {
7010 return (0, _builder.default)("ExportNamespaceSpecifier", ...args);
7011}
7012
7013function PrivateName(...args) {
7014 return (0, _builder.default)("PrivateName", ...args);
7015}
7016
7017function BigIntLiteral(...args) {
7018 return (0, _builder.default)("BigIntLiteral", ...args);
7019}
7020
7021function TSParameterProperty(...args) {
7022 return (0, _builder.default)("TSParameterProperty", ...args);
7023}
7024
7025function TSDeclareFunction(...args) {
7026 return (0, _builder.default)("TSDeclareFunction", ...args);
7027}
7028
7029function TSDeclareMethod(...args) {
7030 return (0, _builder.default)("TSDeclareMethod", ...args);
7031}
7032
7033function TSQualifiedName(...args) {
7034 return (0, _builder.default)("TSQualifiedName", ...args);
7035}
7036
7037function TSCallSignatureDeclaration(...args) {
7038 return (0, _builder.default)("TSCallSignatureDeclaration", ...args);
7039}
7040
7041function TSConstructSignatureDeclaration(...args) {
7042 return (0, _builder.default)("TSConstructSignatureDeclaration", ...args);
7043}
7044
7045function TSPropertySignature(...args) {
7046 return (0, _builder.default)("TSPropertySignature", ...args);
7047}
7048
7049function TSMethodSignature(...args) {
7050 return (0, _builder.default)("TSMethodSignature", ...args);
7051}
7052
7053function TSIndexSignature(...args) {
7054 return (0, _builder.default)("TSIndexSignature", ...args);
7055}
7056
7057function TSAnyKeyword(...args) {
7058 return (0, _builder.default)("TSAnyKeyword", ...args);
7059}
7060
7061function TSNumberKeyword(...args) {
7062 return (0, _builder.default)("TSNumberKeyword", ...args);
7063}
7064
7065function TSObjectKeyword(...args) {
7066 return (0, _builder.default)("TSObjectKeyword", ...args);
7067}
7068
7069function TSBooleanKeyword(...args) {
7070 return (0, _builder.default)("TSBooleanKeyword", ...args);
7071}
7072
7073function TSStringKeyword(...args) {
7074 return (0, _builder.default)("TSStringKeyword", ...args);
7075}
7076
7077function TSSymbolKeyword(...args) {
7078 return (0, _builder.default)("TSSymbolKeyword", ...args);
7079}
7080
7081function TSVoidKeyword(...args) {
7082 return (0, _builder.default)("TSVoidKeyword", ...args);
7083}
7084
7085function TSUndefinedKeyword(...args) {
7086 return (0, _builder.default)("TSUndefinedKeyword", ...args);
7087}
7088
7089function TSNullKeyword(...args) {
7090 return (0, _builder.default)("TSNullKeyword", ...args);
7091}
7092
7093function TSNeverKeyword(...args) {
7094 return (0, _builder.default)("TSNeverKeyword", ...args);
7095}
7096
7097function TSThisType(...args) {
7098 return (0, _builder.default)("TSThisType", ...args);
7099}
7100
7101function TSFunctionType(...args) {
7102 return (0, _builder.default)("TSFunctionType", ...args);
7103}
7104
7105function TSConstructorType(...args) {
7106 return (0, _builder.default)("TSConstructorType", ...args);
7107}
7108
7109function TSTypeReference(...args) {
7110 return (0, _builder.default)("TSTypeReference", ...args);
7111}
7112
7113function TSTypePredicate(...args) {
7114 return (0, _builder.default)("TSTypePredicate", ...args);
7115}
7116
7117function TSTypeQuery(...args) {
7118 return (0, _builder.default)("TSTypeQuery", ...args);
7119}
7120
7121function TSTypeLiteral(...args) {
7122 return (0, _builder.default)("TSTypeLiteral", ...args);
7123}
7124
7125function TSArrayType(...args) {
7126 return (0, _builder.default)("TSArrayType", ...args);
7127}
7128
7129function TSTupleType(...args) {
7130 return (0, _builder.default)("TSTupleType", ...args);
7131}
7132
7133function TSUnionType(...args) {
7134 return (0, _builder.default)("TSUnionType", ...args);
7135}
7136
7137function TSIntersectionType(...args) {
7138 return (0, _builder.default)("TSIntersectionType", ...args);
7139}
7140
7141function TSConditionalType(...args) {
7142 return (0, _builder.default)("TSConditionalType", ...args);
7143}
7144
7145function TSInferType(...args) {
7146 return (0, _builder.default)("TSInferType", ...args);
7147}
7148
7149function TSParenthesizedType(...args) {
7150 return (0, _builder.default)("TSParenthesizedType", ...args);
7151}
7152
7153function TSTypeOperator(...args) {
7154 return (0, _builder.default)("TSTypeOperator", ...args);
7155}
7156
7157function TSIndexedAccessType(...args) {
7158 return (0, _builder.default)("TSIndexedAccessType", ...args);
7159}
7160
7161function TSMappedType(...args) {
7162 return (0, _builder.default)("TSMappedType", ...args);
7163}
7164
7165function TSLiteralType(...args) {
7166 return (0, _builder.default)("TSLiteralType", ...args);
7167}
7168
7169function TSExpressionWithTypeArguments(...args) {
7170 return (0, _builder.default)("TSExpressionWithTypeArguments", ...args);
7171}
7172
7173function TSInterfaceDeclaration(...args) {
7174 return (0, _builder.default)("TSInterfaceDeclaration", ...args);
7175}
7176
7177function TSInterfaceBody(...args) {
7178 return (0, _builder.default)("TSInterfaceBody", ...args);
7179}
7180
7181function TSTypeAliasDeclaration(...args) {
7182 return (0, _builder.default)("TSTypeAliasDeclaration", ...args);
7183}
7184
7185function TSAsExpression(...args) {
7186 return (0, _builder.default)("TSAsExpression", ...args);
7187}
7188
7189function TSTypeAssertion(...args) {
7190 return (0, _builder.default)("TSTypeAssertion", ...args);
7191}
7192
7193function TSEnumDeclaration(...args) {
7194 return (0, _builder.default)("TSEnumDeclaration", ...args);
7195}
7196
7197function TSEnumMember(...args) {
7198 return (0, _builder.default)("TSEnumMember", ...args);
7199}
7200
7201function TSModuleDeclaration(...args) {
7202 return (0, _builder.default)("TSModuleDeclaration", ...args);
7203}
7204
7205function TSModuleBlock(...args) {
7206 return (0, _builder.default)("TSModuleBlock", ...args);
7207}
7208
7209function TSImportEqualsDeclaration(...args) {
7210 return (0, _builder.default)("TSImportEqualsDeclaration", ...args);
7211}
7212
7213function TSExternalModuleReference(...args) {
7214 return (0, _builder.default)("TSExternalModuleReference", ...args);
7215}
7216
7217function TSNonNullExpression(...args) {
7218 return (0, _builder.default)("TSNonNullExpression", ...args);
7219}
7220
7221function TSExportAssignment(...args) {
7222 return (0, _builder.default)("TSExportAssignment", ...args);
7223}
7224
7225function TSNamespaceExportDeclaration(...args) {
7226 return (0, _builder.default)("TSNamespaceExportDeclaration", ...args);
7227}
7228
7229function TSTypeAnnotation(...args) {
7230 return (0, _builder.default)("TSTypeAnnotation", ...args);
7231}
7232
7233function TSTypeParameterInstantiation(...args) {
7234 return (0, _builder.default)("TSTypeParameterInstantiation", ...args);
7235}
7236
7237function TSTypeParameterDeclaration(...args) {
7238 return (0, _builder.default)("TSTypeParameterDeclaration", ...args);
7239}
7240
7241function TSTypeParameter(...args) {
7242 return (0, _builder.default)("TSTypeParameter", ...args);
7243}
7244
7245function NumberLiteral(...args) {
7246 console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
7247 return NumberLiteral("NumberLiteral", ...args);
7248}
7249
7250function RegexLiteral(...args) {
7251 console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
7252 return RegexLiteral("RegexLiteral", ...args);
7253}
7254
7255function RestProperty(...args) {
7256 console.trace("The node type RestProperty has been renamed to RestElement");
7257 return RestProperty("RestProperty", ...args);
7258}
7259
7260function SpreadProperty(...args) {
7261 console.trace("The node type SpreadProperty has been renamed to SpreadElement");
7262 return SpreadProperty("SpreadProperty", ...args);
7263}
7264
7265/***/ }),
7266/* 16 */
7267/***/ (function(module, exports, __webpack_require__) {
7268
7269"use strict";
7270
7271
7272Object.defineProperty(exports, "__esModule", {
7273 value: true
7274});
7275Object.defineProperty(exports, "VISITOR_KEYS", {
7276 enumerable: true,
7277 get: function () {
7278 return _utils.VISITOR_KEYS;
7279 }
7280});
7281Object.defineProperty(exports, "ALIAS_KEYS", {
7282 enumerable: true,
7283 get: function () {
7284 return _utils.ALIAS_KEYS;
7285 }
7286});
7287Object.defineProperty(exports, "FLIPPED_ALIAS_KEYS", {
7288 enumerable: true,
7289 get: function () {
7290 return _utils.FLIPPED_ALIAS_KEYS;
7291 }
7292});
7293Object.defineProperty(exports, "NODE_FIELDS", {
7294 enumerable: true,
7295 get: function () {
7296 return _utils.NODE_FIELDS;
7297 }
7298});
7299Object.defineProperty(exports, "BUILDER_KEYS", {
7300 enumerable: true,
7301 get: function () {
7302 return _utils.BUILDER_KEYS;
7303 }
7304});
7305Object.defineProperty(exports, "DEPRECATED_KEYS", {
7306 enumerable: true,
7307 get: function () {
7308 return _utils.DEPRECATED_KEYS;
7309 }
7310});
7311exports.TYPES = void 0;
7312
7313function _toFastProperties() {
7314 const data = _interopRequireDefault(__webpack_require__(129));
7315
7316 _toFastProperties = function () {
7317 return data;
7318 };
7319
7320 return data;
7321}
7322
7323__webpack_require__(40);
7324
7325__webpack_require__(43);
7326
7327__webpack_require__(131);
7328
7329__webpack_require__(132);
7330
7331__webpack_require__(133);
7332
7333__webpack_require__(134);
7334
7335__webpack_require__(135);
7336
7337var _utils = __webpack_require__(19);
7338
7339function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7340
7341(0, _toFastProperties().default)(_utils.VISITOR_KEYS);
7342(0, _toFastProperties().default)(_utils.ALIAS_KEYS);
7343(0, _toFastProperties().default)(_utils.FLIPPED_ALIAS_KEYS);
7344(0, _toFastProperties().default)(_utils.NODE_FIELDS);
7345(0, _toFastProperties().default)(_utils.BUILDER_KEYS);
7346(0, _toFastProperties().default)(_utils.DEPRECATED_KEYS);
7347const TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS));
7348exports.TYPES = TYPES;
7349
7350/***/ }),
7351/* 17 */
7352/***/ (function(module, exports, __webpack_require__) {
7353
7354"use strict";
7355/**
7356 * Copyright (c) Facebook, Inc. and its affiliates.
7357 *
7358 * This source code is licensed under the MIT license found in the
7359 * LICENSE file in the root directory of this source tree.
7360 *
7361 * strict
7362 * @format
7363 */
7364
7365
7366var AFTER = 'after';
7367var BEFORE = 'before';
7368var FIRST = 'first';
7369var KEY = 'key';
7370var LAST = 'last';
7371module.exports = {
7372 AFTER: AFTER,
7373 BEFORE: BEFORE,
7374 FIRST: FIRST,
7375 KEY: KEY,
7376 LAST: LAST
7377};
7378
7379/***/ }),
7380/* 18 */
7381/***/ (function(module, exports) {
7382
7383function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
7384 try {
7385 var info = gen[key](arg);
7386 var value = info.value;
7387 } catch (error) {
7388 reject(error);
7389 return;
7390 }
7391
7392 if (info.done) {
7393 resolve(value);
7394 } else {
7395 Promise.resolve(value).then(_next, _throw);
7396 }
7397}
7398
7399function _asyncToGenerator(fn) {
7400 return function () {
7401 var self = this,
7402 args = arguments;
7403 return new Promise(function (resolve, reject) {
7404 var gen = fn.apply(self, args);
7405
7406 function _next(value) {
7407 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
7408 }
7409
7410 function _throw(err) {
7411 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
7412 }
7413
7414 _next(undefined);
7415 });
7416 };
7417}
7418
7419module.exports = _asyncToGenerator;
7420
7421/***/ }),
7422/* 19 */
7423/***/ (function(module, exports, __webpack_require__) {
7424
7425"use strict";
7426
7427
7428Object.defineProperty(exports, "__esModule", {
7429 value: true
7430});
7431exports.validate = validate;
7432exports.typeIs = typeIs;
7433exports.validateType = validateType;
7434exports.validateOptional = validateOptional;
7435exports.validateOptionalType = validateOptionalType;
7436exports.arrayOf = arrayOf;
7437exports.arrayOfType = arrayOfType;
7438exports.validateArrayOfType = validateArrayOfType;
7439exports.assertEach = assertEach;
7440exports.assertOneOf = assertOneOf;
7441exports.assertNodeType = assertNodeType;
7442exports.assertNodeOrValueType = assertNodeOrValueType;
7443exports.assertValueType = assertValueType;
7444exports.chain = chain;
7445exports.default = defineType;
7446exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = void 0;
7447
7448var _is = _interopRequireDefault(__webpack_require__(41));
7449
7450function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7451
7452const VISITOR_KEYS = {};
7453exports.VISITOR_KEYS = VISITOR_KEYS;
7454const ALIAS_KEYS = {};
7455exports.ALIAS_KEYS = ALIAS_KEYS;
7456const FLIPPED_ALIAS_KEYS = {};
7457exports.FLIPPED_ALIAS_KEYS = FLIPPED_ALIAS_KEYS;
7458const NODE_FIELDS = {};
7459exports.NODE_FIELDS = NODE_FIELDS;
7460const BUILDER_KEYS = {};
7461exports.BUILDER_KEYS = BUILDER_KEYS;
7462const DEPRECATED_KEYS = {};
7463exports.DEPRECATED_KEYS = DEPRECATED_KEYS;
7464
7465function getType(val) {
7466 if (Array.isArray(val)) {
7467 return "array";
7468 } else if (val === null) {
7469 return "null";
7470 } else if (val === undefined) {
7471 return "undefined";
7472 } else {
7473 return typeof val;
7474 }
7475}
7476
7477function validate(validate) {
7478 return {
7479 validate
7480 };
7481}
7482
7483function typeIs(typeName) {
7484 return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType(...typeName);
7485}
7486
7487function validateType(typeName) {
7488 return validate(typeIs(typeName));
7489}
7490
7491function validateOptional(validate) {
7492 return {
7493 validate,
7494 optional: true
7495 };
7496}
7497
7498function validateOptionalType(typeName) {
7499 return {
7500 validate: typeIs(typeName),
7501 optional: true
7502 };
7503}
7504
7505function arrayOf(elementType) {
7506 return chain(assertValueType("array"), assertEach(elementType));
7507}
7508
7509function arrayOfType(typeName) {
7510 return arrayOf(typeIs(typeName));
7511}
7512
7513function validateArrayOfType(typeName) {
7514 return validate(arrayOfType(typeName));
7515}
7516
7517function assertEach(callback) {
7518 function validator(node, key, val) {
7519 if (!Array.isArray(val)) return;
7520
7521 for (let i = 0; i < val.length; i++) {
7522 callback(node, `${key}[${i}]`, val[i]);
7523 }
7524 }
7525
7526 validator.each = callback;
7527 return validator;
7528}
7529
7530function assertOneOf(...values) {
7531 function validate(node, key, val) {
7532 if (values.indexOf(val) < 0) {
7533 throw new TypeError(`Property ${key} expected value to be one of ${JSON.stringify(values)} but got ${JSON.stringify(val)}`);
7534 }
7535 }
7536
7537 validate.oneOf = values;
7538 return validate;
7539}
7540
7541function assertNodeType(...types) {
7542 function validate(node, key, val) {
7543 let valid = false;
7544
7545 for (const type of types) {
7546 if ((0, _is.default)(type, val)) {
7547 valid = true;
7548 break;
7549 }
7550 }
7551
7552 if (!valid) {
7553 throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} ` + `but instead got ${JSON.stringify(val && val.type)}`);
7554 }
7555 }
7556
7557 validate.oneOfNodeTypes = types;
7558 return validate;
7559}
7560
7561function assertNodeOrValueType(...types) {
7562 function validate(node, key, val) {
7563 let valid = false;
7564
7565 for (const type of types) {
7566 if (getType(val) === type || (0, _is.default)(type, val)) {
7567 valid = true;
7568 break;
7569 }
7570 }
7571
7572 if (!valid) {
7573 throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} ` + `but instead got ${JSON.stringify(val && val.type)}`);
7574 }
7575 }
7576
7577 validate.oneOfNodeOrValueTypes = types;
7578 return validate;
7579}
7580
7581function assertValueType(type) {
7582 function validate(node, key, val) {
7583 const valid = getType(val) === type;
7584
7585 if (!valid) {
7586 throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`);
7587 }
7588 }
7589
7590 validate.type = type;
7591 return validate;
7592}
7593
7594function chain(...fns) {
7595 function validate(...args) {
7596 for (const fn of fns) {
7597 fn(...args);
7598 }
7599 }
7600
7601 validate.chainOf = fns;
7602 return validate;
7603}
7604
7605function defineType(type, opts = {}) {
7606 const inherits = opts.inherits && store[opts.inherits] || {};
7607 const fields = opts.fields || inherits.fields || {};
7608 const visitor = opts.visitor || inherits.visitor || [];
7609 const aliases = opts.aliases || inherits.aliases || [];
7610 const builder = opts.builder || inherits.builder || opts.visitor || [];
7611
7612 if (opts.deprecatedAlias) {
7613 DEPRECATED_KEYS[opts.deprecatedAlias] = type;
7614 }
7615
7616 for (const key of visitor.concat(builder)) {
7617 fields[key] = fields[key] || {};
7618 }
7619
7620 for (const key in fields) {
7621 const field = fields[key];
7622
7623 if (builder.indexOf(key) === -1) {
7624 field.optional = true;
7625 }
7626
7627 if (field.default === undefined) {
7628 field.default = null;
7629 } else if (!field.validate) {
7630 field.validate = assertValueType(getType(field.default));
7631 }
7632 }
7633
7634 VISITOR_KEYS[type] = opts.visitor = visitor;
7635 BUILDER_KEYS[type] = opts.builder = builder;
7636 NODE_FIELDS[type] = opts.fields = fields;
7637 ALIAS_KEYS[type] = opts.aliases = aliases;
7638 aliases.forEach(alias => {
7639 FLIPPED_ALIAS_KEYS[alias] = FLIPPED_ALIAS_KEYS[alias] || [];
7640 FLIPPED_ALIAS_KEYS[alias].push(type);
7641 });
7642 store[type] = opts;
7643}
7644
7645const store = {};
7646
7647/***/ }),
7648/* 20 */
7649/***/ (function(module, exports, __webpack_require__) {
7650
7651"use strict";
7652/**
7653 * Copyright (c) Facebook, Inc. and its affiliates.
7654 *
7655 * This source code is licensed under the MIT license found in the
7656 * LICENSE file in the root directory of this source tree.
7657 *
7658 * strict-local
7659 * @format
7660 */
7661
7662
7663/**
7664 * Determine if a type is the same type (same name and class) as another type.
7665 * Needed if we're comparing IRs created at different times: we don't yet have
7666 * an IR schema, so the type we assign to an IR field could be !== than
7667 * what we assign to it after adding some schema definitions or extensions.
7668 */
7669function isEquivalentType(typeA, typeB) {
7670 // Easy short-circuit: equal types are equal.
7671 if (typeA === typeB) {
7672 return true;
7673 } // If either type is non-null, the other must also be non-null.
7674
7675
7676 if (typeA instanceof __webpack_require__(0).GraphQLNonNull && typeB instanceof __webpack_require__(0).GraphQLNonNull) {
7677 return isEquivalentType(typeA.ofType, typeB.ofType);
7678 } // If either type is a list, the other must also be a list.
7679
7680
7681 if (typeA instanceof __webpack_require__(0).GraphQLList && typeB instanceof __webpack_require__(0).GraphQLList) {
7682 return isEquivalentType(typeA.ofType, typeB.ofType);
7683 } // Make sure the two types are of the same class
7684
7685
7686 if (typeA.constructor.name === typeB.constructor.name) {
7687 var rawA = __webpack_require__(3).getRawType(typeA);
7688
7689 var rawB = __webpack_require__(3).getRawType(typeB); // And they must have the exact same name
7690
7691
7692 return rawA.name === rawB.name;
7693 } // Otherwise the types are not equal.
7694
7695
7696 return false;
7697}
7698
7699module.exports = isEquivalentType;
7700
7701/***/ }),
7702/* 21 */
7703/***/ (function(module, exports, __webpack_require__) {
7704
7705"use strict";
7706
7707
7708Object.defineProperty(exports, "__esModule", {
7709 value: true
7710});
7711exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = void 0;
7712const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"];
7713exports.STATEMENT_OR_BLOCK_KEYS = STATEMENT_OR_BLOCK_KEYS;
7714const FLATTENABLE_KEYS = ["body", "expressions"];
7715exports.FLATTENABLE_KEYS = FLATTENABLE_KEYS;
7716const FOR_INIT_KEYS = ["left", "init"];
7717exports.FOR_INIT_KEYS = FOR_INIT_KEYS;
7718const COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"];
7719exports.COMMENT_KEYS = COMMENT_KEYS;
7720const LOGICAL_OPERATORS = ["||", "&&", "??"];
7721exports.LOGICAL_OPERATORS = LOGICAL_OPERATORS;
7722const UPDATE_OPERATORS = ["++", "--"];
7723exports.UPDATE_OPERATORS = UPDATE_OPERATORS;
7724const BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="];
7725exports.BOOLEAN_NUMBER_BINARY_OPERATORS = BOOLEAN_NUMBER_BINARY_OPERATORS;
7726const EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="];
7727exports.EQUALITY_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS;
7728const COMPARISON_BINARY_OPERATORS = [...EQUALITY_BINARY_OPERATORS, "in", "instanceof"];
7729exports.COMPARISON_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS;
7730const BOOLEAN_BINARY_OPERATORS = [...COMPARISON_BINARY_OPERATORS, ...BOOLEAN_NUMBER_BINARY_OPERATORS];
7731exports.BOOLEAN_BINARY_OPERATORS = BOOLEAN_BINARY_OPERATORS;
7732const NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"];
7733exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS;
7734const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS];
7735exports.BINARY_OPERATORS = BINARY_OPERATORS;
7736const BOOLEAN_UNARY_OPERATORS = ["delete", "!"];
7737exports.BOOLEAN_UNARY_OPERATORS = BOOLEAN_UNARY_OPERATORS;
7738const NUMBER_UNARY_OPERATORS = ["+", "-", "~"];
7739exports.NUMBER_UNARY_OPERATORS = NUMBER_UNARY_OPERATORS;
7740const STRING_UNARY_OPERATORS = ["typeof"];
7741exports.STRING_UNARY_OPERATORS = STRING_UNARY_OPERATORS;
7742const UNARY_OPERATORS = ["void", "throw", ...BOOLEAN_UNARY_OPERATORS, ...NUMBER_UNARY_OPERATORS, ...STRING_UNARY_OPERATORS];
7743exports.UNARY_OPERATORS = UNARY_OPERATORS;
7744const INHERIT_KEYS = {
7745 optional: ["typeAnnotation", "typeParameters", "returnType"],
7746 force: ["start", "loc", "end"]
7747};
7748exports.INHERIT_KEYS = INHERIT_KEYS;
7749const BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
7750exports.BLOCK_SCOPED_SYMBOL = BLOCK_SCOPED_SYMBOL;
7751const NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
7752exports.NOT_LOCAL_BINDING = NOT_LOCAL_BINDING;
7753
7754/***/ }),
7755/* 22 */
7756/***/ (function(module, exports) {
7757
7758module.exports = require("nullthrows");
7759
7760/***/ }),
7761/* 23 */
7762/***/ (function(module, exports, __webpack_require__) {
7763
7764"use strict";
7765/**
7766 * Copyright (c) Facebook, Inc. and its affiliates.
7767 *
7768 * This source code is licensed under the MIT license found in the
7769 * LICENSE file in the root directory of this source tree.
7770 *
7771 *
7772 * @format
7773 */
7774
7775
7776var NodeKeys = {
7777 Argument: ['value'],
7778 Condition: ['condition', 'selections'],
7779 Defer: ['selections', 'if'],
7780 Directive: ['args'],
7781 Fragment: ['argumentDefinitions', 'directives', 'selections'],
7782 FragmentSpread: ['args', 'directives'],
7783 InlineFragment: ['directives', 'selections'],
7784 LinkedField: ['args', 'directives', 'selections'],
7785 Literal: [],
7786 LocalArgumentDefinition: [],
7787 MatchField: ['args', 'directives', 'selections'],
7788 MatchBranch: ['selections'],
7789 Request: ['fragment', 'root'],
7790 Root: ['argumentDefinitions', 'directives', 'selections'],
7791 RootArgumentDefinition: [],
7792 ScalarField: ['args', 'directives'],
7793 SplitOperation: ['selections'],
7794 Stream: ['selections', 'if', 'initialCount'],
7795 Variable: []
7796};
7797
7798function visitIR(root, visitor) {
7799 return __webpack_require__(0).visit(root, visitor, NodeKeys);
7800}
7801
7802module.exports = {
7803 visit: visitIR
7804};
7805
7806/***/ }),
7807/* 24 */
7808/***/ (function(module, exports) {
7809
7810module.exports = require("chalk");
7811
7812/***/ }),
7813/* 25 */
7814/***/ (function(module, exports) {
7815
7816module.exports = require("immutable");
7817
7818/***/ }),
7819/* 26 */
7820/***/ (function(module, exports, __webpack_require__) {
7821
7822"use strict";
7823/**
7824 * Copyright (c) Facebook, Inc. and its affiliates.
7825 *
7826 * This source code is licensed under the MIT license found in the
7827 * LICENSE file in the root directory of this source tree.
7828 *
7829 * strict-local
7830 * @format
7831 */
7832
7833
7834// Transforms applied to the code used to process a query response.
7835var relaySchemaExtensions = [__webpack_require__(86).SCHEMA_EXTENSION, __webpack_require__(48).SCHEMA_EXTENSION, __webpack_require__(47).SCHEMA_EXTENSION, __webpack_require__(87).SCHEMA_EXTENSION]; // Transforms applied to both operations and fragments for both reading and
7836// writing from the store.
7837
7838var relayCommonTransforms = [__webpack_require__(86).transform, __webpack_require__(203).transform, __webpack_require__(47).transform, __webpack_require__(73).transform, __webpack_require__(48).transform, __webpack_require__(87).transform]; // Transforms applied to fragments used for reading data from a store
7839
7840var relayFragmentTransforms = [__webpack_require__(204).transform, __webpack_require__(34).transformWithOptions({
7841 flattenAbstractTypes: true
7842}), __webpack_require__(89).transform]; // Transforms applied to queries/mutations/subscriptions that are used for
7843// fetching data from the server and parsing those responses.
7844
7845var relayQueryTransforms = [__webpack_require__(205).transform, __webpack_require__(208).transform, __webpack_require__(209).transform, __webpack_require__(210).transform]; // Transforms applied to the code used to process a query response.
7846
7847var relayCodegenTransforms = [__webpack_require__(211).transform, __webpack_require__(212).transform, __webpack_require__(213).transform, __webpack_require__(34).transformWithOptions({
7848 flattenAbstractTypes: true
7849}), __webpack_require__(89).transform, __webpack_require__(92).transform, __webpack_require__(93).transform]; // Transforms applied before printing the query sent to the server.
7850
7851var relayPrintTransforms = [__webpack_require__(34).transformWithOptions({}), __webpack_require__(92).transform, __webpack_require__(214).transform, __webpack_require__(93).transform, __webpack_require__(215).transform];
7852module.exports = {
7853 commonTransforms: relayCommonTransforms,
7854 codegenTransforms: relayCodegenTransforms,
7855 fragmentTransforms: relayFragmentTransforms,
7856 printTransforms: relayPrintTransforms,
7857 queryTransforms: relayQueryTransforms,
7858 schemaExtensions: relaySchemaExtensions
7859};
7860
7861/***/ }),
7862/* 27 */
7863/***/ (function(module, exports, __webpack_require__) {
7864
7865"use strict";
7866
7867
7868Object.defineProperty(exports, "__esModule", {
7869 value: true
7870});
7871exports.default = isValidIdentifier;
7872
7873function _esutils() {
7874 const data = _interopRequireDefault(__webpack_require__(130));
7875
7876 _esutils = function () {
7877 return data;
7878 };
7879
7880 return data;
7881}
7882
7883function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7884
7885function isValidIdentifier(name) {
7886 if (typeof name !== "string" || _esutils().default.keyword.isReservedWordES6(name, true)) {
7887 return false;
7888 } else if (name === "await") {
7889 return false;
7890 } else {
7891 return _esutils().default.keyword.isIdentifierNameES6(name);
7892 }
7893}
7894
7895/***/ }),
7896/* 28 */
7897/***/ (function(module, exports, __webpack_require__) {
7898
7899"use strict";
7900
7901
7902Object.defineProperty(exports, "__esModule", {
7903 value: true
7904});
7905exports.default = cloneNode;
7906
7907var _definitions = __webpack_require__(16);
7908
7909const has = Function.call.bind(Object.prototype.hasOwnProperty);
7910
7911function cloneIfNode(obj, deep) {
7912 if (obj && typeof obj.type === "string" && obj.type !== "CommentLine" && obj.type !== "CommentBlock") {
7913 return cloneNode(obj, deep);
7914 }
7915
7916 return obj;
7917}
7918
7919function cloneIfNodeOrArray(obj, deep) {
7920 if (Array.isArray(obj)) {
7921 return obj.map(node => cloneIfNode(node, deep));
7922 }
7923
7924 return cloneIfNode(obj, deep);
7925}
7926
7927function cloneNode(node, deep = true) {
7928 if (!node) return node;
7929 const {
7930 type
7931 } = node;
7932 const newNode = {
7933 type
7934 };
7935
7936 if (type === "Identifier") {
7937 newNode.name = node.name;
7938 } else if (!has(_definitions.NODE_FIELDS, type)) {
7939 throw new Error(`Unknown node type: "${type}"`);
7940 } else {
7941 for (const field of Object.keys(_definitions.NODE_FIELDS[type])) {
7942 if (has(node, field)) {
7943 newNode[field] = deep ? cloneIfNodeOrArray(node[field], true) : node[field];
7944 }
7945 }
7946 }
7947
7948 if (has(node, "loc")) {
7949 newNode.loc = node.loc;
7950 }
7951
7952 if (has(node, "leadingComments")) {
7953 newNode.leadingComments = node.leadingComments;
7954 }
7955
7956 if (has(node, "innerComments")) {
7957 newNode.innerComments = node.innerCmments;
7958 }
7959
7960 if (has(node, "trailingComments")) {
7961 newNode.trailingComments = node.trailingComments;
7962 }
7963
7964 if (has(node, "extra")) {
7965 newNode.extra = Object.assign({}, node.extra);
7966 }
7967
7968 return newNode;
7969}
7970
7971/***/ }),
7972/* 29 */
7973/***/ (function(module, exports) {
7974
7975module.exports = require("util");
7976
7977/***/ }),
7978/* 30 */
7979/***/ (function(module, exports, __webpack_require__) {
7980
7981"use strict";
7982/**
7983 * Copyright (c) Facebook, Inc. and its affiliates.
7984 *
7985 * This source code is licensed under the MIT license found in the
7986 * LICENSE file in the root directory of this source tree.
7987 *
7988 *
7989 * @format
7990 * @emails oncall+relay
7991 */
7992
7993
7994var _asyncToGenerator = __webpack_require__(18);
7995
7996var MAX_ATTEMPT_LIMIT = 5;
7997
7998function delay(delayMs) {
7999 return new Promise(function (resolve) {
8000 return setTimeout(resolve, delayMs);
8001 });
8002}
8003
8004var GraphQLWatchmanClient =
8005/*#__PURE__*/
8006function () {
8007 GraphQLWatchmanClient.isAvailable = function isAvailable() {
8008 return new Promise(function (resolve) {
8009 var client = new GraphQLWatchmanClient(MAX_ATTEMPT_LIMIT);
8010 client.on('error', function () {
8011 resolve(false);
8012 client.end();
8013 });
8014 client.hasCapability('relative_root').then(function (hasRelativeRoot) {
8015 resolve(hasRelativeRoot);
8016 client.end();
8017 }, function () {
8018 resolve(false);
8019 client.end();
8020 });
8021 });
8022 };
8023
8024 function GraphQLWatchmanClient() {
8025 var attemptLimit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
8026 this._client = new (__webpack_require__(77).Client)();
8027 this._attemptLimit = Math.max(Math.min(MAX_ATTEMPT_LIMIT, attemptLimit), 0);
8028 }
8029
8030 var _proto = GraphQLWatchmanClient.prototype;
8031
8032 _proto._command = function _command() {
8033 var _this = this;
8034
8035 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8036 args[_key] = arguments[_key];
8037 }
8038
8039 return new Promise(function (resolve, reject) {
8040 _this._client.command(args, function (error, response) {
8041 if (error) {
8042 reject(error);
8043 } else {
8044 resolve(response);
8045 }
8046 });
8047 });
8048 };
8049
8050 _proto.command =
8051 /*#__PURE__*/
8052 function () {
8053 var _command = _asyncToGenerator(function* () {
8054 var attempt = 0;
8055
8056 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
8057 args[_key2] = arguments[_key2];
8058 }
8059
8060 while (true) {
8061 try {
8062 attempt++;
8063 return yield this._command.apply(this, args);
8064 } catch (error) {
8065 if (attempt > this._attemptLimit) {
8066 throw error;
8067 }
8068
8069 yield delay(Math.pow(2, attempt) * 500);
8070
8071 this._client.end();
8072
8073 this._client = new (__webpack_require__(77).Client)();
8074 }
8075 }
8076 });
8077
8078 return function command() {
8079 return _command.apply(this, arguments);
8080 };
8081 }();
8082
8083 _proto.hasCapability =
8084 /*#__PURE__*/
8085 function () {
8086 var _hasCapability = _asyncToGenerator(function* (capability) {
8087 var resp = yield this.command('list-capabilities');
8088 return resp.capabilities.includes(capability);
8089 });
8090
8091 return function hasCapability(_x) {
8092 return _hasCapability.apply(this, arguments);
8093 };
8094 }();
8095
8096 _proto.watchProject =
8097 /*#__PURE__*/
8098 function () {
8099 var _watchProject = _asyncToGenerator(function* (baseDir) {
8100 var resp = yield this.command('watch-project', baseDir);
8101
8102 if ('warning' in resp) {
8103 console.error('Warning:', resp.warning);
8104 }
8105
8106 return {
8107 root: resp.watch,
8108 relativePath: resp.relative_path
8109 };
8110 });
8111
8112 return function watchProject(_x2) {
8113 return _watchProject.apply(this, arguments);
8114 };
8115 }();
8116
8117 _proto.on = function on(event, callback) {
8118 this._client.on(event, callback);
8119 };
8120
8121 _proto.end = function end() {
8122 this._client.end();
8123 };
8124
8125 return GraphQLWatchmanClient;
8126}();
8127
8128module.exports = GraphQLWatchmanClient;
8129
8130/***/ }),
8131/* 31 */
8132/***/ (function(module, exports, __webpack_require__) {
8133
8134"use strict";
8135/**
8136 * Copyright (c) Facebook, Inc. and its affiliates.
8137 *
8138 * This source code is licensed under the MIT license found in the
8139 * LICENSE file in the root directory of this source tree.
8140 *
8141 * strict-local
8142 * @format
8143 */
8144
8145
8146var _asyncToGenerator = __webpack_require__(18);
8147
8148var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
8149
8150/**
8151 * CodegenDirectory is a helper class for scripts that generate code into one
8152 * output directory. The purpose is to make it easy to only write files that
8153 * have changed and delete files that are no longer generated.
8154 * It gives statistics about added/removed/updated/unchanged in the end.
8155 * The class also has an option to "validate" which means that no file
8156 * operations are performed and only the statistics are created for what would
8157 * have happened. If there's anything but "unchanged", someone probably forgot
8158 * to run the codegen script.
8159 *
8160 * Example:
8161 *
8162 * const dir = new CodegenDirectory('/some/path/generated', {filesystem: require('fs')});
8163 * // write files in case content changed (less watchman/mtime changes)
8164 * dir.writeFile('OneFile.js', contents);
8165 * dir.writeFile('OtherFile.js', contents);
8166 *
8167 * // delete files that are not generated
8168 * dir.deleteExtraFiles();
8169 *
8170 * // arrays of file names to print or whatever
8171 * dir.changes.created
8172 * dir.changes.updated
8173 * dir.changes.deleted
8174 * dir.changes.unchanged
8175 */
8176var CodegenDirectory =
8177/*#__PURE__*/
8178function () {
8179 function CodegenDirectory(dir, _ref) {
8180 var _this = this;
8181
8182 var filesystem = _ref.filesystem,
8183 onlyValidate = _ref.onlyValidate;
8184 this._filesystem = filesystem || __webpack_require__(13);
8185 this.onlyValidate = onlyValidate;
8186
8187 if (this._filesystem.existsSync(dir)) {
8188 !this._filesystem.statSync(dir).isDirectory() ? true ? __webpack_require__(4)(false, 'Expected `%s` to be a directory.', dir) : undefined : void 0;
8189 } else if (!this.onlyValidate) {
8190 var dirs = [dir];
8191
8192 var parent = __webpack_require__(6).dirname(dir);
8193
8194 while (!this._filesystem.existsSync(parent)) {
8195 dirs.unshift(parent);
8196 parent = __webpack_require__(6).dirname(parent);
8197 }
8198
8199 dirs.forEach(function (d) {
8200 return _this._filesystem.mkdirSync(d);
8201 });
8202 }
8203
8204 this._files = new Set();
8205 this.changes = {
8206 deleted: [],
8207 updated: [],
8208 created: [],
8209 unchanged: []
8210 };
8211 this._dir = dir;
8212 }
8213
8214 CodegenDirectory.combineChanges = function combineChanges(dirs) {
8215 var changes = {
8216 deleted: [],
8217 updated: [],
8218 created: [],
8219 unchanged: []
8220 };
8221 dirs.forEach(function (dir) {
8222 var _changes$deleted, _changes$updated, _changes$created, _changes$unchanged;
8223
8224 (_changes$deleted = changes.deleted).push.apply(_changes$deleted, (0, _toConsumableArray2["default"])(dir.changes.deleted));
8225
8226 (_changes$updated = changes.updated).push.apply(_changes$updated, (0, _toConsumableArray2["default"])(dir.changes.updated));
8227
8228 (_changes$created = changes.created).push.apply(_changes$created, (0, _toConsumableArray2["default"])(dir.changes.created));
8229
8230 (_changes$unchanged = changes.unchanged).push.apply(_changes$unchanged, (0, _toConsumableArray2["default"])(dir.changes.unchanged));
8231 });
8232 return changes;
8233 };
8234
8235 CodegenDirectory.hasChanges = function hasChanges(changes) {
8236 return changes.created.length > 0 || changes.updated.length > 0 || changes.deleted.length > 0;
8237 };
8238
8239 CodegenDirectory.printChanges = function printChanges(changes, options) {
8240 __webpack_require__(7).run('CodegenDirectory.printChanges', function () {
8241 var output = [];
8242
8243 function printFiles(label, files) {
8244 if (files.length > 0) {
8245 output.push(label + ':');
8246 files.forEach(function (file) {
8247 output.push(' - ' + file);
8248 });
8249 }
8250 }
8251
8252 if (options.onlyValidate) {
8253 printFiles('Missing', changes.created);
8254 printFiles('Out of date', changes.updated);
8255 printFiles('Extra', changes.deleted);
8256 } else {
8257 printFiles('Created', changes.created);
8258 printFiles('Updated', changes.updated);
8259 printFiles('Deleted', changes.deleted);
8260 output.push("Unchanged: ".concat(changes.unchanged.length, " files"));
8261 } // eslint-disable-next-line no-console
8262
8263
8264 console.log(output.join('\n'));
8265 });
8266 };
8267
8268 CodegenDirectory.getAddedRemovedFiles = function getAddedRemovedFiles(dirs) {
8269 var added = [];
8270 var removed = [];
8271 dirs.forEach(function (dir) {
8272 dir.changes.created.forEach(function (name) {
8273 added.push(dir.getPath(name));
8274 });
8275 dir.changes.deleted.forEach(function (name) {
8276 removed.push(dir.getPath(name));
8277 });
8278 });
8279 return {
8280 added: added,
8281 removed: removed
8282 };
8283 };
8284
8285 CodegenDirectory.sourceControlAddRemove =
8286 /*#__PURE__*/
8287 function () {
8288 var _sourceControlAddRemove = _asyncToGenerator(function* (sourceControl, dirs) {
8289 var _CodegenDirectory$get = CodegenDirectory.getAddedRemovedFiles(dirs),
8290 added = _CodegenDirectory$get.added,
8291 removed = _CodegenDirectory$get.removed;
8292
8293 sourceControl.addRemove(added, removed);
8294 });
8295
8296 return function sourceControlAddRemove(_x, _x2) {
8297 return _sourceControlAddRemove.apply(this, arguments);
8298 };
8299 }();
8300
8301 var _proto = CodegenDirectory.prototype;
8302
8303 _proto.printChanges = function printChanges() {
8304 CodegenDirectory.printChanges(this.changes, {
8305 onlyValidate: this.onlyValidate
8306 });
8307 };
8308
8309 _proto.read = function read(filename) {
8310 var filePath = __webpack_require__(6).join(this._dir, filename);
8311
8312 if (this._filesystem.existsSync(filePath)) {
8313 return this._filesystem.readFileSync(filePath, 'utf8');
8314 }
8315
8316 return null;
8317 };
8318
8319 _proto.markUnchanged = function markUnchanged(filename) {
8320 this._addGenerated(filename);
8321
8322 this.changes.unchanged.push(filename);
8323 };
8324 /**
8325 * Marks a files as updated or out of date without actually writing the file.
8326 * This is probably only be useful when doing validation without intention to
8327 * actually write to disk.
8328 */
8329
8330
8331 _proto.markUpdated = function markUpdated(filename) {
8332 this._addGenerated(filename);
8333
8334 this.changes.updated.push(filename);
8335 };
8336
8337 _proto.writeFile = function writeFile(filename, content) {
8338 var _this2 = this;
8339
8340 __webpack_require__(7).run('CodegenDirectory.writeFile', function () {
8341 _this2._addGenerated(filename);
8342
8343 var filePath = __webpack_require__(6).join(_this2._dir, filename);
8344
8345 if (_this2._filesystem.existsSync(filePath)) {
8346 var existingContent = _this2._filesystem.readFileSync(filePath, 'utf8');
8347
8348 if (existingContent === content) {
8349 _this2.changes.unchanged.push(filename);
8350 } else {
8351 _this2._writeFile(filePath, content);
8352
8353 _this2.changes.updated.push(filename);
8354 }
8355 } else {
8356 _this2._writeFile(filePath, content);
8357
8358 _this2.changes.created.push(filename);
8359 }
8360 });
8361 };
8362
8363 _proto._writeFile = function _writeFile(filePath, content) {
8364 if (!this.onlyValidate) {
8365 this._filesystem.writeFileSync(filePath, content, 'utf8');
8366 }
8367 };
8368 /**
8369 * Deletes all non-generated files, except for invisible "dot" files (ie.
8370 * files with names starting with ".") and any files matching the supplied
8371 * filePatternToKeep.
8372 */
8373
8374
8375 _proto.deleteExtraFiles = function deleteExtraFiles(filePatternToKeep) {
8376 var _this3 = this;
8377
8378 __webpack_require__(7).run('CodegenDirectory.deleteExtraFiles', function () {
8379 _this3._filesystem.readdirSync(_this3._dir).forEach(function (actualFile) {
8380 var shouldFileExist = _this3._files.has(actualFile) || /^\./.test(actualFile) || filePatternToKeep != null && filePatternToKeep.test(actualFile);
8381
8382 if (shouldFileExist) {
8383 return;
8384 }
8385
8386 if (!_this3.onlyValidate) {
8387 try {
8388 _this3._filesystem.unlinkSync(__webpack_require__(6).join(_this3._dir, actualFile));
8389 } catch (_unused) {
8390 throw new Error('CodegenDirectory: Failed to delete `' + actualFile + '` in `' + _this3._dir + '`.');
8391 }
8392 }
8393
8394 _this3.changes.deleted.push(actualFile);
8395 });
8396 });
8397 };
8398
8399 _proto.getPath = function getPath(filename) {
8400 return __webpack_require__(6).join(this._dir, filename);
8401 };
8402
8403 _proto._addGenerated = function _addGenerated(filename) {
8404 !!this._files.has(filename) ? true ? __webpack_require__(4)(false, 'CodegenDirectory: Tried to generate `%s` twice in `%s`.', filename, this._dir) : undefined : void 0;
8405
8406 this._files.add(filename);
8407 };
8408
8409 return CodegenDirectory;
8410}();
8411
8412module.exports = CodegenDirectory;
8413
8414/***/ }),
8415/* 32 */
8416/***/ (function(module, exports, __webpack_require__) {
8417
8418"use strict";
8419
8420
8421Object.defineProperty(exports, "__esModule", {
8422 value: true
8423});
8424exports.default = getBindingIdentifiers;
8425
8426var _generated = __webpack_require__(12);
8427
8428function getBindingIdentifiers(node, duplicates, outerOnly) {
8429 let search = [].concat(node);
8430 const ids = Object.create(null);
8431
8432 while (search.length) {
8433 const id = search.shift();
8434 if (!id) continue;
8435 const keys = getBindingIdentifiers.keys[id.type];
8436
8437 if ((0, _generated.isIdentifier)(id)) {
8438 if (duplicates) {
8439 const _ids = ids[id.name] = ids[id.name] || [];
8440
8441 _ids.push(id);
8442 } else {
8443 ids[id.name] = id;
8444 }
8445
8446 continue;
8447 }
8448
8449 if ((0, _generated.isExportDeclaration)(id)) {
8450 if ((0, _generated.isDeclaration)(id.declaration)) {
8451 search.push(id.declaration);
8452 }
8453
8454 continue;
8455 }
8456
8457 if (outerOnly) {
8458 if ((0, _generated.isFunctionDeclaration)(id)) {
8459 search.push(id.id);
8460 continue;
8461 }
8462
8463 if ((0, _generated.isFunctionExpression)(id)) {
8464 continue;
8465 }
8466 }
8467
8468 if (keys) {
8469 for (let i = 0; i < keys.length; i++) {
8470 const key = keys[i];
8471
8472 if (id[key]) {
8473 search = search.concat(id[key]);
8474 }
8475 }
8476 }
8477 }
8478
8479 return ids;
8480}
8481
8482getBindingIdentifiers.keys = {
8483 DeclareClass: ["id"],
8484 DeclareFunction: ["id"],
8485 DeclareModule: ["id"],
8486 DeclareVariable: ["id"],
8487 DeclareInterface: ["id"],
8488 DeclareTypeAlias: ["id"],
8489 DeclareOpaqueType: ["id"],
8490 InterfaceDeclaration: ["id"],
8491 TypeAlias: ["id"],
8492 OpaqueType: ["id"],
8493 CatchClause: ["param"],
8494 LabeledStatement: ["label"],
8495 UnaryExpression: ["argument"],
8496 AssignmentExpression: ["left"],
8497 ImportSpecifier: ["local"],
8498 ImportNamespaceSpecifier: ["local"],
8499 ImportDefaultSpecifier: ["local"],
8500 ImportDeclaration: ["specifiers"],
8501 ExportSpecifier: ["exported"],
8502 ExportNamespaceSpecifier: ["exported"],
8503 ExportDefaultSpecifier: ["exported"],
8504 FunctionDeclaration: ["id", "params"],
8505 FunctionExpression: ["id", "params"],
8506 ArrowFunctionExpression: ["params"],
8507 ObjectMethod: ["params"],
8508 ClassMethod: ["params"],
8509 ForInStatement: ["left"],
8510 ForOfStatement: ["left"],
8511 ClassDeclaration: ["id"],
8512 ClassExpression: ["id"],
8513 RestElement: ["argument"],
8514 UpdateExpression: ["argument"],
8515 ObjectProperty: ["value"],
8516 AssignmentPattern: ["left"],
8517 ArrayPattern: ["elements"],
8518 ObjectPattern: ["properties"],
8519 VariableDeclaration: ["declarations"],
8520 VariableDeclarator: ["id"]
8521};
8522
8523/***/ }),
8524/* 33 */
8525/***/ (function(module, exports, __webpack_require__) {
8526
8527"use strict";
8528/**
8529 * Copyright (c) Facebook, Inc. and its affiliates.
8530 *
8531 * This source code is licensed under the MIT license found in the
8532 * LICENSE file in the root directory of this source tree.
8533 *
8534 * strict
8535 * @format
8536 */
8537
8538
8539function getLiteralArgumentValues(args) {
8540 var values = {};
8541 args.forEach(function (arg) {
8542 !(arg.value.kind === 'Literal') ? true ? __webpack_require__(4)(false, 'getLiteralArgumentValues(): Expected all args to be literals.') : undefined : void 0;
8543 values[arg.name] = arg.value.value;
8544 });
8545 return values;
8546}
8547
8548module.exports = getLiteralArgumentValues;
8549
8550/***/ }),
8551/* 34 */
8552/***/ (function(module, exports, __webpack_require__) {
8553
8554"use strict";
8555/**
8556 * Copyright (c) Facebook, Inc. and its affiliates.
8557 *
8558 * This source code is licensed under the MIT license found in the
8559 * LICENSE file in the root directory of this source tree.
8560 *
8561 * @format
8562 *
8563 */
8564
8565
8566var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
8567
8568/**
8569 * Transform that flattens inline fragments, fragment spreads, and conditionals.
8570 *
8571 * Inline fragments are inlined (replaced with their selections) when:
8572 * - The fragment type matches the type of its parent.
8573 * - The fragment has an abstract type and the `flattenAbstractTypes` option has
8574 * been set.
8575 * - The 'flattenInlineFragments' option has been set.
8576 */
8577function flattenTransformImpl(context, options) {
8578 var state = {
8579 flattenAbstractTypes: !!(options && options.flattenAbstractTypes),
8580 flattenInlineFragments: !!(options && options.flattenInlineFragments),
8581 parentType: null
8582 };
8583 return __webpack_require__(10).transform(context, {
8584 Root: flattenSelections,
8585 Fragment: flattenSelections,
8586 Condition: flattenSelections,
8587 InlineFragment: flattenSelections,
8588 LinkedField: flattenSelections,
8589 MatchField: flattenSelections
8590 }, function () {
8591 return state;
8592 });
8593}
8594/**
8595 * @private
8596 */
8597
8598
8599function flattenSelections(node, state) {
8600 // Determine the current type.
8601 var parentType = state.parentType;
8602 var type = node.kind === 'Condition' || node.kind === 'Defer' || node.kind === 'Stream' ? parentType : node.kind === 'InlineFragment' ? node.typeCondition : node.type;
8603
8604 if (type == null) {
8605 throw __webpack_require__(1).createCompilerError('FlattenTransform: Expected a parent type.', [node.loc]);
8606 } // Flatten the selections in this node, creating a new node with flattened
8607 // selections if possible, then deeply traverse the flattened node, while
8608 // keeping track of the parent type.
8609
8610
8611 var nextSelections = new Map();
8612 var hasFlattened = flattenSelectionsInto(nextSelections, node, state, type);
8613 var flattenedNode = hasFlattened ? (0, _objectSpread2["default"])({}, node, {
8614 selections: Array.from(nextSelections.values())
8615 }) : node;
8616 state.parentType = type;
8617 var deeplyFlattenedNode = this.traverse(flattenedNode, state);
8618 state.parentType = parentType;
8619 return deeplyFlattenedNode;
8620}
8621/**
8622 * @private
8623 */
8624
8625
8626function flattenSelectionsInto(flattenedSelections, node, state, type) {
8627 var hasFlattened = false;
8628 node.selections.forEach(function (selection) {
8629 if (selection.kind === 'InlineFragment' && shouldFlattenInlineFragment(selection, state, type)) {
8630 hasFlattened = true;
8631 flattenSelectionsInto(flattenedSelections, selection, state, type);
8632 return;
8633 }
8634
8635 var nodeIdentifier = __webpack_require__(75)(selection);
8636
8637 var flattenedSelection = flattenedSelections.get(nodeIdentifier); // If this selection hasn't been seen before, keep track of it.
8638
8639 if (!flattenedSelection) {
8640 flattenedSelections.set(nodeIdentifier, selection);
8641 return;
8642 } // Otherwise a similar selection exists which should be merged.
8643
8644
8645 hasFlattened = true;
8646
8647 if (flattenedSelection.kind === 'InlineFragment') {
8648 if (selection.kind !== 'InlineFragment') {
8649 throw __webpack_require__(1).createCompilerError("FlattenTransform: Expected an InlineFragment, got a '".concat(selection.kind, "'"), [selection.loc]);
8650 }
8651
8652 flattenedSelections.set(nodeIdentifier, (0, _objectSpread2["default"])({}, flattenedSelection, {
8653 selections: mergeSelections(flattenedSelection, selection, state, selection.typeCondition)
8654 }));
8655 } else if (flattenedSelection.kind === 'Condition') {
8656 if (selection.kind !== 'Condition') {
8657 throw __webpack_require__(1).createCompilerError("FlattenTransform: Expected a Condition, got a '".concat(selection.kind, "'"), [selection.loc]);
8658 }
8659
8660 flattenedSelections.set(nodeIdentifier, (0, _objectSpread2["default"])({}, flattenedSelection, {
8661 selections: mergeSelections(flattenedSelection, selection, state, type)
8662 }));
8663 } else if (flattenedSelection.kind === 'FragmentSpread') {// Ignore duplicate fragment spreads.
8664 } else if (flattenedSelection.kind === 'MatchField' || flattenedSelection.kind === 'MatchBranch') {// Ignore duplicate matches that select the same fragments and
8665 // modules (encoded in the identifier)
8666 // Also ignore incremental data placeholders
8667 } else if (flattenedSelection.kind === 'Defer') {
8668 if (selection.kind !== 'Defer') {
8669 throw __webpack_require__(1).createCompilerError("FlattenTransform: Expected a Defer, got a '".concat(selection.kind, "'"), [selection.loc]);
8670 }
8671
8672 flattenedSelections.set(nodeIdentifier, (0, _objectSpread2["default"])({
8673 kind: 'Defer'
8674 }, flattenedSelection, {
8675 selections: mergeSelections(flattenedSelection, selection, state, type)
8676 }));
8677 } else if (flattenedSelection.kind === 'Stream') {
8678 if (selection.kind !== 'Stream') {
8679 throw __webpack_require__(1).createCompilerError("FlattenTransform: Expected a Stream, got a '".concat(selection.kind, "'"), [selection.loc]);
8680 }
8681
8682 flattenedSelections.set(nodeIdentifier, (0, _objectSpread2["default"])({
8683 kind: 'Stream'
8684 }, flattenedSelection, {
8685 selections: mergeSelections(flattenedSelection, selection, state, type)
8686 }));
8687 } else if (flattenedSelection.kind === 'LinkedField') {
8688 if (selection.kind !== 'LinkedField') {
8689 throw __webpack_require__(1).createCompilerError("FlattenTransform: Expected a LinkedField, got a '".concat(selection.kind, "'"), [selection.loc]);
8690 } // Note: arguments are intentionally reversed to avoid rebuilds
8691
8692
8693 assertUniqueArgsForAlias(selection, flattenedSelection);
8694 flattenedSelections.set(nodeIdentifier, (0, _objectSpread2["default"])({
8695 kind: 'LinkedField'
8696 }, flattenedSelection, {
8697 handles: mergeHandles(flattenedSelection, selection),
8698 selections: mergeSelections(flattenedSelection, selection, state, selection.type)
8699 }));
8700 } else if (flattenedSelection.kind === 'ScalarField') {
8701 if (selection.kind !== 'ScalarField') {
8702 throw __webpack_require__(1).createCompilerError("FlattenTransform: Expected a ScalarField, got a '".concat(selection.kind, "'"), [selection.loc]);
8703 } // Note: arguments are intentionally reversed to avoid rebuilds
8704
8705
8706 assertUniqueArgsForAlias(selection, flattenedSelection);
8707 flattenedSelections.set(nodeIdentifier, (0, _objectSpread2["default"])({
8708 kind: 'ScalarField'
8709 }, flattenedSelection, {
8710 // Note: arguments are intentionally reversed to avoid rebuilds
8711 handles: mergeHandles(selection, flattenedSelection)
8712 }));
8713 } else {
8714 flattenedSelection.kind;
8715 throw __webpack_require__(1).createCompilerError("FlattenTransform: Unknown kind '".concat(flattenedSelection.kind, "'"));
8716 }
8717 });
8718 return hasFlattened;
8719}
8720/**
8721 * @private
8722 */
8723
8724
8725function mergeSelections(nodeA, nodeB, state, type) {
8726 var flattenedSelections = new Map();
8727 flattenSelectionsInto(flattenedSelections, nodeA, state, type);
8728 flattenSelectionsInto(flattenedSelections, nodeB, state, type);
8729 return Array.from(flattenedSelections.values());
8730}
8731/**
8732 * @private
8733 * TODO(T19327202) This is redundant with OverlappingFieldsCanBeMergedRule once
8734 * it can be enabled.
8735 */
8736
8737
8738function assertUniqueArgsForAlias(field, otherField) {
8739 if (!areEqualFields(field, otherField)) {
8740 var _field$alias;
8741
8742 throw __webpack_require__(1).createUserError('Expected all fields on the same parent with ' + "the name or alias '".concat((_field$alias = field.alias) !== null && _field$alias !== void 0 ? _field$alias : field.name, "' to have the same name and arguments."), [field.loc, otherField.loc]);
8743 }
8744}
8745/**
8746 * @private
8747 */
8748
8749
8750function shouldFlattenInlineFragment(fragment, state, type) {
8751 return state.flattenInlineFragments || fragment.typeCondition.name === __webpack_require__(3).getRawType(type).name || state.flattenAbstractTypes && __webpack_require__(3).isAbstractType(fragment.typeCondition);
8752}
8753/**
8754 * @private
8755 *
8756 * Verify that two fields are equal in all properties other than their
8757 * selections.
8758 */
8759
8760
8761function areEqualFields(thisField, thatField) {
8762 return thisField.kind === thatField.kind && thisField.name === thatField.name && thisField.alias === thatField.alias && areEqualArgs(thisField.args, thatField.args);
8763}
8764/**
8765 * Verify that two sets of arguments are equivalent - same argument names
8766 * and values. Notably this ignores the types of arguments and values, which
8767 * may not always be inferred identically.
8768 */
8769
8770
8771function areEqualArgs(thisArgs, thatArgs) {
8772 return thisArgs.length === thatArgs.length && thisArgs.every(function (thisArg, index) {
8773 var thatArg = thatArgs[index];
8774 return thisArg.name === thatArg.name && thisArg.value.kind === thatArg.value.kind && thisArg.value.variableName === thatArg.value.variableName && __webpack_require__(184)(thisArg.value.value, thatArg.value.value);
8775 });
8776}
8777/**
8778 * @private
8779 */
8780
8781
8782function mergeHandles(nodeA, nodeB) {
8783 if (!nodeA.handles) {
8784 return nodeB.handles;
8785 }
8786
8787 if (!nodeB.handles) {
8788 return nodeA.handles;
8789 }
8790
8791 var uniqueItems = new Map();
8792 nodeA.handles.concat(nodeB.handles).forEach(function (item) {
8793 return uniqueItems.set(item.name + item.key, item);
8794 });
8795 return Array.from(uniqueItems.values());
8796}
8797
8798function transformWithOptions(options) {
8799 return function flattenTransform(context) {
8800 return flattenTransformImpl(context, options);
8801 };
8802}
8803
8804module.exports = {
8805 transformWithOptions: transformWithOptions
8806};
8807
8808/***/ }),
8809/* 35 */
8810/***/ (function(module, exports) {
8811
8812module.exports = require("crypto");
8813
8814/***/ }),
8815/* 36 */
8816/***/ (function(module, exports, __webpack_require__) {
8817
8818"use strict";
8819/**
8820 * Copyright (c) Facebook, Inc. and its affiliates.
8821 *
8822 * This source code is licensed under the MIT license found in the
8823 * LICENSE file in the root directory of this source tree.
8824 *
8825 *
8826 * @format
8827 */
8828
8829
8830var _asyncToGenerator = __webpack_require__(18);
8831
8832var SUBSCRIPTION_NAME = 'graphql-codegen';
8833var QUERY_RETRIES = 3;
8834
8835function queryFiles(_x, _x2, _x3) {
8836 return _queryFiles.apply(this, arguments);
8837}
8838
8839function _queryFiles() {
8840 _queryFiles = _asyncToGenerator(function* (baseDir, expression, filter) {
8841 return yield __webpack_require__(7).waitFor('Watchman:query',
8842 /*#__PURE__*/
8843 _asyncToGenerator(function* () {
8844 var client = new (__webpack_require__(30))(QUERY_RETRIES);
8845
8846 var _ref = yield Promise.all([client.watchProject(baseDir), getFields(client)]),
8847 watchResp = _ref[0],
8848 fields = _ref[1];
8849
8850 var resp = yield client.command('query', watchResp.root, {
8851 expression: expression,
8852 fields: fields,
8853 relative_root: watchResp.relativePath
8854 });
8855 client.end();
8856 return updateFiles(new Set(), baseDir, filter, resp.files);
8857 }));
8858 });
8859 return _queryFiles.apply(this, arguments);
8860}
8861
8862function queryDirectories(_x4, _x5) {
8863 return _queryDirectories.apply(this, arguments);
8864}
8865
8866function _queryDirectories() {
8867 _queryDirectories = _asyncToGenerator(function* (baseDir, expression) {
8868 return yield __webpack_require__(7).waitFor('Watchman:query',
8869 /*#__PURE__*/
8870 _asyncToGenerator(function* () {
8871 var client = new (__webpack_require__(30))();
8872 var watchResp = yield client.watchProject(baseDir);
8873 var resp = yield client.command('query', watchResp.root, {
8874 expression: expression,
8875 fields: ['name'],
8876 relative_root: watchResp.relativePath
8877 });
8878 client.end();
8879 return resp.files;
8880 }));
8881 });
8882 return _queryDirectories.apply(this, arguments);
8883}
8884
8885function getFields(_x6) {
8886 return _getFields.apply(this, arguments);
8887} // For use when not using Watchman.
8888
8889
8890function _getFields() {
8891 _getFields = _asyncToGenerator(function* (client) {
8892 var fields = ['name', 'exists'];
8893
8894 if (yield client.hasCapability('field-content.sha1hex')) {
8895 fields.push('content.sha1hex');
8896 }
8897
8898 return fields;
8899 });
8900 return _getFields.apply(this, arguments);
8901}
8902
8903function queryFilepaths(_x7, _x8, _x9) {
8904 return _queryFilepaths.apply(this, arguments);
8905}
8906/**
8907 * Provides a simplified API to the watchman API.
8908 * Given some base directory and a list of subdirectories it calls the callback
8909 * with watchman change events on file changes.
8910 */
8911
8912
8913function _queryFilepaths() {
8914 _queryFilepaths = _asyncToGenerator(function* (baseDir, filepaths, filter) {
8915 // Construct WatchmanChange objects as an intermediate step before
8916 // calling updateFiles to produce file content.
8917 var files = filepaths.map(function (filepath) {
8918 return {
8919 name: filepath,
8920 exists: true,
8921 'content.sha1hex': null
8922 };
8923 });
8924 return updateFiles(new Set(), baseDir, filter, files);
8925 });
8926 return _queryFilepaths.apply(this, arguments);
8927}
8928
8929function watch(_x10, _x11, _x12) {
8930 return _watch.apply(this, arguments);
8931}
8932
8933function _watch() {
8934 _watch = _asyncToGenerator(function* (baseDir, expression, callback) {
8935 return yield __webpack_require__(7).waitFor('Watchman:subscribe',
8936 /*#__PURE__*/
8937 _asyncToGenerator(function* () {
8938 var client = new (__webpack_require__(30))();
8939 var watchResp = yield client.watchProject(baseDir);
8940 yield makeSubscription(client, watchResp.root, watchResp.relativePath, expression, callback);
8941 }));
8942 });
8943 return _watch.apply(this, arguments);
8944}
8945
8946function makeSubscription(_x13, _x14, _x15, _x16, _x17) {
8947 return _makeSubscription.apply(this, arguments);
8948}
8949/**
8950 * Further simplifies `watch` and calls the callback on every change with a
8951 * full list of files that match the conditions.
8952 */
8953
8954
8955function _makeSubscription() {
8956 _makeSubscription = _asyncToGenerator(function* (client, root, relativePath, expression, callback) {
8957 client.on('subscription', function (resp) {
8958 if (resp.subscription === SUBSCRIPTION_NAME) {
8959 callback(resp);
8960 }
8961 });
8962 var fields = yield getFields(client);
8963 yield client.command('subscribe', root, SUBSCRIPTION_NAME, {
8964 expression: expression,
8965 fields: fields,
8966 relative_root: relativePath
8967 });
8968 });
8969 return _makeSubscription.apply(this, arguments);
8970}
8971
8972function watchFiles(_x18, _x19, _x20, _x21) {
8973 return _watchFiles.apply(this, arguments);
8974}
8975/**
8976 * Similar to watchFiles, but takes an async function. The `compile` function
8977 * is awaited and not called in parallel. If multiple changes are triggered
8978 * before a compile finishes, the latest version is called after the compile
8979 * finished.
8980 *
8981 * TODO: Consider changing from a Promise to abortable, so we can abort mid
8982 * compilation.
8983 */
8984
8985
8986function _watchFiles() {
8987 _watchFiles = _asyncToGenerator(function* (baseDir, expression, filter, callback) {
8988 var files = new Set();
8989 yield watch(baseDir, expression, function (changes) {
8990 if (!changes.files) {
8991 // Watchmen fires a change without files when a watchman state changes,
8992 // for example during an hg update.
8993 return;
8994 }
8995
8996 files = updateFiles(files, baseDir, filter, changes.files);
8997 callback(files);
8998 });
8999 });
9000 return _watchFiles.apply(this, arguments);
9001}
9002
9003function watchCompile(_x22, _x23, _x24, _x25) {
9004 return _watchCompile.apply(this, arguments);
9005}
9006
9007function _watchCompile() {
9008 _watchCompile = _asyncToGenerator(function* (baseDir, expression, filter, compile) {
9009 var compiling = false;
9010 var needsCompiling = false;
9011 var latestFiles = null;
9012 watchFiles(baseDir, expression, filter,
9013 /*#__PURE__*/
9014 function () {
9015 var _ref5 = _asyncToGenerator(function* (files) {
9016 needsCompiling = true;
9017 latestFiles = files;
9018
9019 if (compiling) {
9020 return;
9021 }
9022
9023 compiling = true;
9024
9025 while (needsCompiling) {
9026 needsCompiling = false;
9027 yield compile(latestFiles);
9028 }
9029
9030 compiling = false;
9031 });
9032
9033 return function (_x26) {
9034 return _ref5.apply(this, arguments);
9035 };
9036 }());
9037 });
9038 return _watchCompile.apply(this, arguments);
9039}
9040
9041function updateFiles(files, baseDir, filter, fileChanges) {
9042 var fileMap = new Map();
9043 files.forEach(function (file) {
9044 file.exists && fileMap.set(file.relPath, file);
9045 });
9046 fileChanges.forEach(function (_ref2) {
9047 var name = _ref2.name,
9048 exists = _ref2.exists,
9049 hash = _ref2['content.sha1hex'];
9050 var shouldRemove = !exists;
9051
9052 if (!shouldRemove) {
9053 var _file = {
9054 exists: true,
9055 relPath: name,
9056 hash: hash || hashFile(__webpack_require__(6).join(baseDir, name))
9057 };
9058
9059 if (filter(_file)) {
9060 fileMap.set(name, _file);
9061 } else {
9062 shouldRemove = true;
9063 }
9064 }
9065
9066 shouldRemove && fileMap.set(name, {
9067 exists: false,
9068 relPath: name
9069 });
9070 });
9071 return new Set(fileMap.values());
9072}
9073
9074function hashFile(filename) {
9075 var content = __webpack_require__(13).readFileSync(filename);
9076
9077 return __webpack_require__(35).createHash('sha1').update(content).digest('hex');
9078}
9079
9080module.exports = {
9081 queryDirectories: queryDirectories,
9082 queryFiles: queryFiles,
9083 queryFilepaths: queryFilepaths,
9084 watch: watch,
9085 watchFiles: watchFiles,
9086 watchCompile: watchCompile
9087};
9088
9089/***/ }),
9090/* 37 */
9091/***/ (function(module, exports, __webpack_require__) {
9092
9093"use strict";
9094/**
9095 * Copyright (c) Facebook, Inc. and its affiliates.
9096 *
9097 * This source code is licensed under the MIT license found in the
9098 * LICENSE file in the root directory of this source tree.
9099 *
9100 *
9101 * @format
9102 */
9103
9104
9105function validateOrThrow(document, schema, rules) {
9106 var validationErrors = __webpack_require__(0).validate(schema, document, rules);
9107
9108 if (validationErrors && validationErrors.length > 0) {
9109 var formattedErrors = validationErrors.map(__webpack_require__(0).formatError);
9110 var errorMessages = validationErrors.map(function (e) {
9111 return e.toString();
9112 });
9113 var error = new Error(__webpack_require__(29).format('You supplied a GraphQL document with validation errors:\n%s', errorMessages.join('\n')));
9114 error.validationErrors = formattedErrors;
9115 throw error;
9116 }
9117}
9118
9119module.exports = {
9120 GLOBAL_RULES: [__webpack_require__(0).KnownArgumentNamesRule,
9121 /* Some rules are not enabled (potentially non-exhaustive)
9122 *
9123 * - KnownFragmentNamesRule: RelayClassic generates fragments at runtime,
9124 * so RelayCompat queries might reference fragments unknown in build time.
9125 * - NoFragmentCyclesRule: Because of @argumentDefinitions, this validation
9126 * incorrectly flags a subset of fragments using @include/@skip as
9127 * recursive.
9128 * - NoUndefinedVariablesRule: Because of @argumentDefinitions, this
9129 * validation incorrectly marks some fragment variables as undefined.
9130 * - NoUnusedFragmentsRule: Queries generated dynamically with RelayCompat
9131 * might use unused fragments.
9132 * - OverlappingFieldsCanBeMergedRule: RelayClassic auto-resolves
9133 * overlapping fields by generating aliases.
9134 */
9135 __webpack_require__(0).NoUnusedVariablesRule, __webpack_require__(0).UniqueArgumentNamesRule, __webpack_require__(0).UniqueFragmentNamesRule, __webpack_require__(0).UniqueInputFieldNamesRule, __webpack_require__(0).UniqueOperationNamesRule, __webpack_require__(0).UniqueVariableNamesRule],
9136 LOCAL_RULES: [
9137 /* Some rules are not enabled (potentially non-exhaustive)
9138 *
9139 * - FieldsOnCorrectTypeRule: is not aware of @fixme_fat_interface.
9140 * - KnownDirectivesRule: doesn't pass with @arguments and other Relay
9141 * directives.
9142 * - ScalarLeafsRule: is violated by the @match directive since these rules
9143 * run before any transform steps.
9144 */
9145 __webpack_require__(0).FragmentsOnCompositeTypesRule, __webpack_require__(0).KnownTypeNamesRule, __webpack_require__(0).LoneAnonymousOperationRule, __webpack_require__(0).PossibleFragmentSpreadsRule, __webpack_require__(0).ValuesOfCorrectTypeRule, __webpack_require__(0).VariablesAreInputTypesRule, __webpack_require__(0).VariablesInAllowedPositionRule],
9146 validate: __webpack_require__(7).instrument(validateOrThrow, 'GraphQLValidator.validate')
9147};
9148
9149/***/ }),
9150/* 38 */
9151/***/ (function(module, exports) {
9152
9153function _defineProperty(obj, key, value) {
9154 if (key in obj) {
9155 Object.defineProperty(obj, key, {
9156 value: value,
9157 enumerable: true,
9158 configurable: true,
9159 writable: true
9160 });
9161 } else {
9162 obj[key] = value;
9163 }
9164
9165 return obj;
9166}
9167
9168module.exports = _defineProperty;
9169
9170/***/ }),
9171/* 39 */
9172/***/ (function(module, exports, __webpack_require__) {
9173
9174"use strict";
9175
9176
9177Object.defineProperty(exports, "__esModule", {
9178 value: true
9179});
9180exports.default = shallowEqual;
9181
9182function shallowEqual(actual, expected) {
9183 const keys = Object.keys(expected);
9184
9185 for (const key of keys) {
9186 if (actual[key] !== expected[key]) {
9187 return false;
9188 }
9189 }
9190
9191 return true;
9192}
9193
9194/***/ }),
9195/* 40 */
9196/***/ (function(module, exports, __webpack_require__) {
9197
9198"use strict";
9199
9200
9201Object.defineProperty(exports, "__esModule", {
9202 value: true
9203});
9204exports.patternLikeCommon = exports.functionDeclarationCommon = exports.functionTypeAnnotationCommon = exports.functionCommon = void 0;
9205
9206var _isValidIdentifier = _interopRequireDefault(__webpack_require__(27));
9207
9208var _constants = __webpack_require__(21);
9209
9210var _utils = _interopRequireWildcard(__webpack_require__(19));
9211
9212function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
9213
9214function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9215
9216(0, _utils.default)("ArrayExpression", {
9217 fields: {
9218 elements: {
9219 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "Expression", "SpreadElement"))),
9220 default: []
9221 }
9222 },
9223 visitor: ["elements"],
9224 aliases: ["Expression"]
9225});
9226(0, _utils.default)("AssignmentExpression", {
9227 fields: {
9228 operator: {
9229 validate: (0, _utils.assertValueType)("string")
9230 },
9231 left: {
9232 validate: (0, _utils.assertNodeType)("LVal")
9233 },
9234 right: {
9235 validate: (0, _utils.assertNodeType)("Expression")
9236 }
9237 },
9238 builder: ["operator", "left", "right"],
9239 visitor: ["left", "right"],
9240 aliases: ["Expression"]
9241});
9242(0, _utils.default)("BinaryExpression", {
9243 builder: ["operator", "left", "right"],
9244 fields: {
9245 operator: {
9246 validate: (0, _utils.assertOneOf)(..._constants.BINARY_OPERATORS)
9247 },
9248 left: {
9249 validate: (0, _utils.assertNodeType)("Expression")
9250 },
9251 right: {
9252 validate: (0, _utils.assertNodeType)("Expression")
9253 }
9254 },
9255 visitor: ["left", "right"],
9256 aliases: ["Binary", "Expression"]
9257});
9258(0, _utils.default)("InterpreterDirective", {
9259 builder: ["value"],
9260 fields: {
9261 value: {
9262 validate: (0, _utils.assertValueType)("string")
9263 }
9264 }
9265});
9266(0, _utils.default)("Directive", {
9267 visitor: ["value"],
9268 fields: {
9269 value: {
9270 validate: (0, _utils.assertNodeType)("DirectiveLiteral")
9271 }
9272 }
9273});
9274(0, _utils.default)("DirectiveLiteral", {
9275 builder: ["value"],
9276 fields: {
9277 value: {
9278 validate: (0, _utils.assertValueType)("string")
9279 }
9280 }
9281});
9282(0, _utils.default)("BlockStatement", {
9283 builder: ["body", "directives"],
9284 visitor: ["directives", "body"],
9285 fields: {
9286 directives: {
9287 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))),
9288 default: []
9289 },
9290 body: {
9291 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
9292 }
9293 },
9294 aliases: ["Scopable", "BlockParent", "Block", "Statement"]
9295});
9296(0, _utils.default)("BreakStatement", {
9297 visitor: ["label"],
9298 fields: {
9299 label: {
9300 validate: (0, _utils.assertNodeType)("Identifier"),
9301 optional: true
9302 }
9303 },
9304 aliases: ["Statement", "Terminatorless", "CompletionStatement"]
9305});
9306(0, _utils.default)("CallExpression", {
9307 visitor: ["callee", "arguments", "typeParameters", "typeArguments"],
9308 builder: ["callee", "arguments"],
9309 aliases: ["Expression"],
9310 fields: {
9311 callee: {
9312 validate: (0, _utils.assertNodeType)("Expression")
9313 },
9314 arguments: {
9315 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName")))
9316 },
9317 optional: {
9318 validate: (0, _utils.assertOneOf)(true, false),
9319 optional: true
9320 },
9321 typeArguments: {
9322 validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
9323 optional: true
9324 },
9325 typeParameters: {
9326 validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"),
9327 optional: true
9328 }
9329 }
9330});
9331(0, _utils.default)("CatchClause", {
9332 visitor: ["param", "body"],
9333 fields: {
9334 param: {
9335 validate: (0, _utils.assertNodeType)("Identifier"),
9336 optional: true
9337 },
9338 body: {
9339 validate: (0, _utils.assertNodeType)("BlockStatement")
9340 }
9341 },
9342 aliases: ["Scopable", "BlockParent"]
9343});
9344(0, _utils.default)("ConditionalExpression", {
9345 visitor: ["test", "consequent", "alternate"],
9346 fields: {
9347 test: {
9348 validate: (0, _utils.assertNodeType)("Expression")
9349 },
9350 consequent: {
9351 validate: (0, _utils.assertNodeType)("Expression")
9352 },
9353 alternate: {
9354 validate: (0, _utils.assertNodeType)("Expression")
9355 }
9356 },
9357 aliases: ["Expression", "Conditional"]
9358});
9359(0, _utils.default)("ContinueStatement", {
9360 visitor: ["label"],
9361 fields: {
9362 label: {
9363 validate: (0, _utils.assertNodeType)("Identifier"),
9364 optional: true
9365 }
9366 },
9367 aliases: ["Statement", "Terminatorless", "CompletionStatement"]
9368});
9369(0, _utils.default)("DebuggerStatement", {
9370 aliases: ["Statement"]
9371});
9372(0, _utils.default)("DoWhileStatement", {
9373 visitor: ["test", "body"],
9374 fields: {
9375 test: {
9376 validate: (0, _utils.assertNodeType)("Expression")
9377 },
9378 body: {
9379 validate: (0, _utils.assertNodeType)("Statement")
9380 }
9381 },
9382 aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"]
9383});
9384(0, _utils.default)("EmptyStatement", {
9385 aliases: ["Statement"]
9386});
9387(0, _utils.default)("ExpressionStatement", {
9388 visitor: ["expression"],
9389 fields: {
9390 expression: {
9391 validate: (0, _utils.assertNodeType)("Expression")
9392 }
9393 },
9394 aliases: ["Statement", "ExpressionWrapper"]
9395});
9396(0, _utils.default)("File", {
9397 builder: ["program", "comments", "tokens"],
9398 visitor: ["program"],
9399 fields: {
9400 program: {
9401 validate: (0, _utils.assertNodeType)("Program")
9402 }
9403 }
9404});
9405(0, _utils.default)("ForInStatement", {
9406 visitor: ["left", "right", "body"],
9407 aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
9408 fields: {
9409 left: {
9410 validate: (0, _utils.assertNodeType)("VariableDeclaration", "LVal")
9411 },
9412 right: {
9413 validate: (0, _utils.assertNodeType)("Expression")
9414 },
9415 body: {
9416 validate: (0, _utils.assertNodeType)("Statement")
9417 }
9418 }
9419});
9420(0, _utils.default)("ForStatement", {
9421 visitor: ["init", "test", "update", "body"],
9422 aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"],
9423 fields: {
9424 init: {
9425 validate: (0, _utils.assertNodeType)("VariableDeclaration", "Expression"),
9426 optional: true
9427 },
9428 test: {
9429 validate: (0, _utils.assertNodeType)("Expression"),
9430 optional: true
9431 },
9432 update: {
9433 validate: (0, _utils.assertNodeType)("Expression"),
9434 optional: true
9435 },
9436 body: {
9437 validate: (0, _utils.assertNodeType)("Statement")
9438 }
9439 }
9440});
9441const functionCommon = {
9442 params: {
9443 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("LVal")))
9444 },
9445 generator: {
9446 default: false,
9447 validate: (0, _utils.assertValueType)("boolean")
9448 },
9449 async: {
9450 validate: (0, _utils.assertValueType)("boolean"),
9451 default: false
9452 }
9453};
9454exports.functionCommon = functionCommon;
9455const functionTypeAnnotationCommon = {
9456 returnType: {
9457 validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
9458 optional: true
9459 },
9460 typeParameters: {
9461 validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
9462 optional: true
9463 }
9464};
9465exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon;
9466const functionDeclarationCommon = Object.assign({}, functionCommon, {
9467 declare: {
9468 validate: (0, _utils.assertValueType)("boolean"),
9469 optional: true
9470 },
9471 id: {
9472 validate: (0, _utils.assertNodeType)("Identifier"),
9473 optional: true
9474 }
9475});
9476exports.functionDeclarationCommon = functionDeclarationCommon;
9477(0, _utils.default)("FunctionDeclaration", {
9478 builder: ["id", "params", "body", "generator", "async"],
9479 visitor: ["id", "params", "body", "returnType", "typeParameters"],
9480 fields: Object.assign({}, functionDeclarationCommon, functionTypeAnnotationCommon, {
9481 body: {
9482 validate: (0, _utils.assertNodeType)("BlockStatement")
9483 }
9484 }),
9485 aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"]
9486});
9487(0, _utils.default)("FunctionExpression", {
9488 inherits: "FunctionDeclaration",
9489 aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
9490 fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
9491 id: {
9492 validate: (0, _utils.assertNodeType)("Identifier"),
9493 optional: true
9494 },
9495 body: {
9496 validate: (0, _utils.assertNodeType)("BlockStatement")
9497 }
9498 })
9499});
9500const patternLikeCommon = {
9501 typeAnnotation: {
9502 validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
9503 optional: true
9504 },
9505 decorators: {
9506 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator")))
9507 }
9508};
9509exports.patternLikeCommon = patternLikeCommon;
9510(0, _utils.default)("Identifier", {
9511 builder: ["name"],
9512 visitor: ["typeAnnotation"],
9513 aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"],
9514 fields: Object.assign({}, patternLikeCommon, {
9515 name: {
9516 validate: (0, _utils.chain)(function (node, key, val) {
9517 if (!(0, _isValidIdentifier.default)(val)) {}
9518 }, (0, _utils.assertValueType)("string"))
9519 },
9520 optional: {
9521 validate: (0, _utils.assertValueType)("boolean"),
9522 optional: true
9523 }
9524 })
9525});
9526(0, _utils.default)("IfStatement", {
9527 visitor: ["test", "consequent", "alternate"],
9528 aliases: ["Statement", "Conditional"],
9529 fields: {
9530 test: {
9531 validate: (0, _utils.assertNodeType)("Expression")
9532 },
9533 consequent: {
9534 validate: (0, _utils.assertNodeType)("Statement")
9535 },
9536 alternate: {
9537 optional: true,
9538 validate: (0, _utils.assertNodeType)("Statement")
9539 }
9540 }
9541});
9542(0, _utils.default)("LabeledStatement", {
9543 visitor: ["label", "body"],
9544 aliases: ["Statement"],
9545 fields: {
9546 label: {
9547 validate: (0, _utils.assertNodeType)("Identifier")
9548 },
9549 body: {
9550 validate: (0, _utils.assertNodeType)("Statement")
9551 }
9552 }
9553});
9554(0, _utils.default)("StringLiteral", {
9555 builder: ["value"],
9556 fields: {
9557 value: {
9558 validate: (0, _utils.assertValueType)("string")
9559 }
9560 },
9561 aliases: ["Expression", "Pureish", "Literal", "Immutable"]
9562});
9563(0, _utils.default)("NumericLiteral", {
9564 builder: ["value"],
9565 deprecatedAlias: "NumberLiteral",
9566 fields: {
9567 value: {
9568 validate: (0, _utils.assertValueType)("number")
9569 }
9570 },
9571 aliases: ["Expression", "Pureish", "Literal", "Immutable"]
9572});
9573(0, _utils.default)("NullLiteral", {
9574 aliases: ["Expression", "Pureish", "Literal", "Immutable"]
9575});
9576(0, _utils.default)("BooleanLiteral", {
9577 builder: ["value"],
9578 fields: {
9579 value: {
9580 validate: (0, _utils.assertValueType)("boolean")
9581 }
9582 },
9583 aliases: ["Expression", "Pureish", "Literal", "Immutable"]
9584});
9585(0, _utils.default)("RegExpLiteral", {
9586 builder: ["pattern", "flags"],
9587 deprecatedAlias: "RegexLiteral",
9588 aliases: ["Expression", "Literal"],
9589 fields: {
9590 pattern: {
9591 validate: (0, _utils.assertValueType)("string")
9592 },
9593 flags: {
9594 validate: (0, _utils.assertValueType)("string"),
9595 default: ""
9596 }
9597 }
9598});
9599(0, _utils.default)("LogicalExpression", {
9600 builder: ["operator", "left", "right"],
9601 visitor: ["left", "right"],
9602 aliases: ["Binary", "Expression"],
9603 fields: {
9604 operator: {
9605 validate: (0, _utils.assertOneOf)(..._constants.LOGICAL_OPERATORS)
9606 },
9607 left: {
9608 validate: (0, _utils.assertNodeType)("Expression")
9609 },
9610 right: {
9611 validate: (0, _utils.assertNodeType)("Expression")
9612 }
9613 }
9614});
9615(0, _utils.default)("MemberExpression", {
9616 builder: ["object", "property", "computed", "optional"],
9617 visitor: ["object", "property"],
9618 aliases: ["Expression", "LVal"],
9619 fields: {
9620 object: {
9621 validate: (0, _utils.assertNodeType)("Expression")
9622 },
9623 property: {
9624 validate: function () {
9625 const normal = (0, _utils.assertNodeType)("Identifier", "PrivateName");
9626 const computed = (0, _utils.assertNodeType)("Expression");
9627 return function (node, key, val) {
9628 const validator = node.computed ? computed : normal;
9629 validator(node, key, val);
9630 };
9631 }()
9632 },
9633 computed: {
9634 default: false
9635 },
9636 optional: {
9637 validate: (0, _utils.assertOneOf)(true, false),
9638 optional: true
9639 }
9640 }
9641});
9642(0, _utils.default)("NewExpression", {
9643 inherits: "CallExpression"
9644});
9645(0, _utils.default)("Program", {
9646 visitor: ["directives", "body"],
9647 builder: ["body", "directives", "sourceType", "interpreter"],
9648 fields: {
9649 sourceFile: {
9650 validate: (0, _utils.assertValueType)("string")
9651 },
9652 sourceType: {
9653 validate: (0, _utils.assertOneOf)("script", "module"),
9654 default: "script"
9655 },
9656 interpreter: {
9657 validate: (0, _utils.assertNodeType)("InterpreterDirective"),
9658 default: null,
9659 optional: true
9660 },
9661 directives: {
9662 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))),
9663 default: []
9664 },
9665 body: {
9666 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
9667 }
9668 },
9669 aliases: ["Scopable", "BlockParent", "Block"]
9670});
9671(0, _utils.default)("ObjectExpression", {
9672 visitor: ["properties"],
9673 aliases: ["Expression"],
9674 fields: {
9675 properties: {
9676 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadElement")))
9677 }
9678 }
9679});
9680(0, _utils.default)("ObjectMethod", {
9681 builder: ["kind", "key", "params", "body", "computed"],
9682 fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
9683 kind: {
9684 validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("method", "get", "set")),
9685 default: "method"
9686 },
9687 computed: {
9688 validate: (0, _utils.assertValueType)("boolean"),
9689 default: false
9690 },
9691 key: {
9692 validate: function () {
9693 const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
9694 const computed = (0, _utils.assertNodeType)("Expression");
9695 return function (node, key, val) {
9696 const validator = node.computed ? computed : normal;
9697 validator(node, key, val);
9698 };
9699 }()
9700 },
9701 decorators: {
9702 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator")))
9703 },
9704 body: {
9705 validate: (0, _utils.assertNodeType)("BlockStatement")
9706 }
9707 }),
9708 visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
9709 aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"]
9710});
9711(0, _utils.default)("ObjectProperty", {
9712 builder: ["key", "value", "computed", "shorthand", "decorators"],
9713 fields: {
9714 computed: {
9715 validate: (0, _utils.assertValueType)("boolean"),
9716 default: false
9717 },
9718 key: {
9719 validate: function () {
9720 const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
9721 const computed = (0, _utils.assertNodeType)("Expression");
9722 return function (node, key, val) {
9723 const validator = node.computed ? computed : normal;
9724 validator(node, key, val);
9725 };
9726 }()
9727 },
9728 value: {
9729 validate: (0, _utils.assertNodeType)("Expression", "PatternLike")
9730 },
9731 shorthand: {
9732 validate: (0, _utils.assertValueType)("boolean"),
9733 default: false
9734 },
9735 decorators: {
9736 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
9737 optional: true
9738 }
9739 },
9740 visitor: ["key", "value", "decorators"],
9741 aliases: ["UserWhitespacable", "Property", "ObjectMember"]
9742});
9743(0, _utils.default)("RestElement", {
9744 visitor: ["argument", "typeAnnotation"],
9745 builder: ["argument"],
9746 aliases: ["LVal", "PatternLike"],
9747 deprecatedAlias: "RestProperty",
9748 fields: Object.assign({}, patternLikeCommon, {
9749 argument: {
9750 validate: (0, _utils.assertNodeType)("LVal")
9751 }
9752 })
9753});
9754(0, _utils.default)("ReturnStatement", {
9755 visitor: ["argument"],
9756 aliases: ["Statement", "Terminatorless", "CompletionStatement"],
9757 fields: {
9758 argument: {
9759 validate: (0, _utils.assertNodeType)("Expression"),
9760 optional: true
9761 }
9762 }
9763});
9764(0, _utils.default)("SequenceExpression", {
9765 visitor: ["expressions"],
9766 fields: {
9767 expressions: {
9768 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression")))
9769 }
9770 },
9771 aliases: ["Expression"]
9772});
9773(0, _utils.default)("SwitchCase", {
9774 visitor: ["test", "consequent"],
9775 fields: {
9776 test: {
9777 validate: (0, _utils.assertNodeType)("Expression"),
9778 optional: true
9779 },
9780 consequent: {
9781 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
9782 }
9783 }
9784});
9785(0, _utils.default)("SwitchStatement", {
9786 visitor: ["discriminant", "cases"],
9787 aliases: ["Statement", "BlockParent", "Scopable"],
9788 fields: {
9789 discriminant: {
9790 validate: (0, _utils.assertNodeType)("Expression")
9791 },
9792 cases: {
9793 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("SwitchCase")))
9794 }
9795 }
9796});
9797(0, _utils.default)("ThisExpression", {
9798 aliases: ["Expression"]
9799});
9800(0, _utils.default)("ThrowStatement", {
9801 visitor: ["argument"],
9802 aliases: ["Statement", "Terminatorless", "CompletionStatement"],
9803 fields: {
9804 argument: {
9805 validate: (0, _utils.assertNodeType)("Expression")
9806 }
9807 }
9808});
9809(0, _utils.default)("TryStatement", {
9810 visitor: ["block", "handler", "finalizer"],
9811 aliases: ["Statement"],
9812 fields: {
9813 block: {
9814 validate: (0, _utils.assertNodeType)("BlockStatement")
9815 },
9816 handler: {
9817 optional: true,
9818 validate: (0, _utils.assertNodeType)("CatchClause")
9819 },
9820 finalizer: {
9821 optional: true,
9822 validate: (0, _utils.assertNodeType)("BlockStatement")
9823 }
9824 }
9825});
9826(0, _utils.default)("UnaryExpression", {
9827 builder: ["operator", "argument", "prefix"],
9828 fields: {
9829 prefix: {
9830 default: true
9831 },
9832 argument: {
9833 validate: (0, _utils.assertNodeType)("Expression")
9834 },
9835 operator: {
9836 validate: (0, _utils.assertOneOf)(..._constants.UNARY_OPERATORS)
9837 }
9838 },
9839 visitor: ["argument"],
9840 aliases: ["UnaryLike", "Expression"]
9841});
9842(0, _utils.default)("UpdateExpression", {
9843 builder: ["operator", "argument", "prefix"],
9844 fields: {
9845 prefix: {
9846 default: false
9847 },
9848 argument: {
9849 validate: (0, _utils.assertNodeType)("Expression")
9850 },
9851 operator: {
9852 validate: (0, _utils.assertOneOf)(..._constants.UPDATE_OPERATORS)
9853 }
9854 },
9855 visitor: ["argument"],
9856 aliases: ["Expression"]
9857});
9858(0, _utils.default)("VariableDeclaration", {
9859 builder: ["kind", "declarations"],
9860 visitor: ["declarations"],
9861 aliases: ["Statement", "Declaration"],
9862 fields: {
9863 declare: {
9864 validate: (0, _utils.assertValueType)("boolean"),
9865 optional: true
9866 },
9867 kind: {
9868 validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("var", "let", "const"))
9869 },
9870 declarations: {
9871 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("VariableDeclarator")))
9872 }
9873 }
9874});
9875(0, _utils.default)("VariableDeclarator", {
9876 visitor: ["id", "init"],
9877 fields: {
9878 id: {
9879 validate: (0, _utils.assertNodeType)("LVal")
9880 },
9881 definite: {
9882 optional: true,
9883 validate: (0, _utils.assertValueType)("boolean")
9884 },
9885 init: {
9886 optional: true,
9887 validate: (0, _utils.assertNodeType)("Expression")
9888 }
9889 }
9890});
9891(0, _utils.default)("WhileStatement", {
9892 visitor: ["test", "body"],
9893 aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"],
9894 fields: {
9895 test: {
9896 validate: (0, _utils.assertNodeType)("Expression")
9897 },
9898 body: {
9899 validate: (0, _utils.assertNodeType)("BlockStatement", "Statement")
9900 }
9901 }
9902});
9903(0, _utils.default)("WithStatement", {
9904 visitor: ["object", "body"],
9905 aliases: ["Statement"],
9906 fields: {
9907 object: {
9908 validate: (0, _utils.assertNodeType)("Expression")
9909 },
9910 body: {
9911 validate: (0, _utils.assertNodeType)("BlockStatement", "Statement")
9912 }
9913 }
9914});
9915
9916/***/ }),
9917/* 41 */
9918/***/ (function(module, exports, __webpack_require__) {
9919
9920"use strict";
9921
9922
9923Object.defineProperty(exports, "__esModule", {
9924 value: true
9925});
9926exports.default = is;
9927
9928var _shallowEqual = _interopRequireDefault(__webpack_require__(39));
9929
9930var _isType = _interopRequireDefault(__webpack_require__(42));
9931
9932function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9933
9934function is(type, node, opts) {
9935 if (!node) return false;
9936 const matches = (0, _isType.default)(node.type, type);
9937 if (!matches) return false;
9938
9939 if (typeof opts === "undefined") {
9940 return true;
9941 } else {
9942 return (0, _shallowEqual.default)(node, opts);
9943 }
9944}
9945
9946/***/ }),
9947/* 42 */
9948/***/ (function(module, exports, __webpack_require__) {
9949
9950"use strict";
9951
9952
9953Object.defineProperty(exports, "__esModule", {
9954 value: true
9955});
9956exports.default = isType;
9957
9958var _definitions = __webpack_require__(16);
9959
9960function isType(nodeType, targetType) {
9961 if (nodeType === targetType) return true;
9962 if (_definitions.ALIAS_KEYS[targetType]) return false;
9963 const aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType];
9964
9965 if (aliases) {
9966 if (aliases[0] === nodeType) return true;
9967
9968 for (const alias of aliases) {
9969 if (nodeType === alias) return true;
9970 }
9971 }
9972
9973 return false;
9974}
9975
9976/***/ }),
9977/* 43 */
9978/***/ (function(module, exports, __webpack_require__) {
9979
9980"use strict";
9981
9982
9983Object.defineProperty(exports, "__esModule", {
9984 value: true
9985});
9986exports.classMethodOrDeclareMethodCommon = exports.classMethodOrPropertyCommon = void 0;
9987
9988var _utils = _interopRequireWildcard(__webpack_require__(19));
9989
9990var _core = __webpack_require__(40);
9991
9992function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
9993
9994(0, _utils.default)("AssignmentPattern", {
9995 visitor: ["left", "right"],
9996 builder: ["left", "right"],
9997 aliases: ["Pattern", "PatternLike", "LVal"],
9998 fields: Object.assign({}, _core.patternLikeCommon, {
9999 left: {
10000 validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern")
10001 },
10002 right: {
10003 validate: (0, _utils.assertNodeType)("Expression")
10004 },
10005 decorators: {
10006 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator")))
10007 }
10008 })
10009});
10010(0, _utils.default)("ArrayPattern", {
10011 visitor: ["elements", "typeAnnotation"],
10012 builder: ["elements"],
10013 aliases: ["Pattern", "PatternLike", "LVal"],
10014 fields: Object.assign({}, _core.patternLikeCommon, {
10015 elements: {
10016 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("PatternLike")))
10017 },
10018 decorators: {
10019 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator")))
10020 }
10021 })
10022});
10023(0, _utils.default)("ArrowFunctionExpression", {
10024 builder: ["params", "body", "async"],
10025 visitor: ["params", "body", "returnType", "typeParameters"],
10026 aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
10027 fields: Object.assign({}, _core.functionCommon, _core.functionTypeAnnotationCommon, {
10028 expression: {
10029 validate: (0, _utils.assertValueType)("boolean")
10030 },
10031 body: {
10032 validate: (0, _utils.assertNodeType)("BlockStatement", "Expression")
10033 }
10034 })
10035});
10036(0, _utils.default)("ClassBody", {
10037 visitor: ["body"],
10038 fields: {
10039 body: {
10040 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ClassMethod", "ClassProperty", "ClassPrivateProperty", "TSDeclareMethod", "TSIndexSignature")))
10041 }
10042 }
10043});
10044const classCommon = {
10045 typeParameters: {
10046 validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
10047 optional: true
10048 },
10049 body: {
10050 validate: (0, _utils.assertNodeType)("ClassBody")
10051 },
10052 superClass: {
10053 optional: true,
10054 validate: (0, _utils.assertNodeType)("Expression")
10055 },
10056 superTypeParameters: {
10057 validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
10058 optional: true
10059 },
10060 implements: {
10061 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "ClassImplements"))),
10062 optional: true
10063 }
10064};
10065(0, _utils.default)("ClassDeclaration", {
10066 builder: ["id", "superClass", "body", "decorators"],
10067 visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"],
10068 aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"],
10069 fields: Object.assign({}, classCommon, {
10070 declare: {
10071 validate: (0, _utils.assertValueType)("boolean"),
10072 optional: true
10073 },
10074 abstract: {
10075 validate: (0, _utils.assertValueType)("boolean"),
10076 optional: true
10077 },
10078 id: {
10079 validate: (0, _utils.assertNodeType)("Identifier"),
10080 optional: true
10081 },
10082 decorators: {
10083 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
10084 optional: true
10085 }
10086 })
10087});
10088(0, _utils.default)("ClassExpression", {
10089 inherits: "ClassDeclaration",
10090 aliases: ["Scopable", "Class", "Expression", "Pureish"],
10091 fields: Object.assign({}, classCommon, {
10092 id: {
10093 optional: true,
10094 validate: (0, _utils.assertNodeType)("Identifier")
10095 },
10096 body: {
10097 validate: (0, _utils.assertNodeType)("ClassBody")
10098 },
10099 superClass: {
10100 optional: true,
10101 validate: (0, _utils.assertNodeType)("Expression")
10102 },
10103 decorators: {
10104 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
10105 optional: true
10106 }
10107 })
10108});
10109(0, _utils.default)("ExportAllDeclaration", {
10110 visitor: ["source"],
10111 aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
10112 fields: {
10113 source: {
10114 validate: (0, _utils.assertNodeType)("StringLiteral")
10115 }
10116 }
10117});
10118(0, _utils.default)("ExportDefaultDeclaration", {
10119 visitor: ["declaration"],
10120 aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
10121 fields: {
10122 declaration: {
10123 validate: (0, _utils.assertNodeType)("FunctionDeclaration", "TSDeclareFunction", "ClassDeclaration", "Expression")
10124 }
10125 }
10126});
10127(0, _utils.default)("ExportNamedDeclaration", {
10128 visitor: ["declaration", "specifiers", "source"],
10129 aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
10130 fields: {
10131 declaration: {
10132 validate: (0, _utils.assertNodeType)("Declaration"),
10133 optional: true
10134 },
10135 specifiers: {
10136 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ExportSpecifier", "ExportDefaultSpecifier", "ExportNamespaceSpecifier")))
10137 },
10138 source: {
10139 validate: (0, _utils.assertNodeType)("StringLiteral"),
10140 optional: true
10141 }
10142 }
10143});
10144(0, _utils.default)("ExportSpecifier", {
10145 visitor: ["local", "exported"],
10146 aliases: ["ModuleSpecifier"],
10147 fields: {
10148 local: {
10149 validate: (0, _utils.assertNodeType)("Identifier")
10150 },
10151 exported: {
10152 validate: (0, _utils.assertNodeType)("Identifier")
10153 }
10154 }
10155});
10156(0, _utils.default)("ForOfStatement", {
10157 visitor: ["left", "right", "body"],
10158 aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
10159 fields: {
10160 left: {
10161 validate: (0, _utils.assertNodeType)("VariableDeclaration", "LVal")
10162 },
10163 right: {
10164 validate: (0, _utils.assertNodeType)("Expression")
10165 },
10166 body: {
10167 validate: (0, _utils.assertNodeType)("Statement")
10168 },
10169 await: {
10170 default: false,
10171 validate: (0, _utils.assertValueType)("boolean")
10172 }
10173 }
10174});
10175(0, _utils.default)("ImportDeclaration", {
10176 visitor: ["specifiers", "source"],
10177 aliases: ["Statement", "Declaration", "ModuleDeclaration"],
10178 fields: {
10179 specifiers: {
10180 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier")))
10181 },
10182 source: {
10183 validate: (0, _utils.assertNodeType)("StringLiteral")
10184 }
10185 }
10186});
10187(0, _utils.default)("ImportDefaultSpecifier", {
10188 visitor: ["local"],
10189 aliases: ["ModuleSpecifier"],
10190 fields: {
10191 local: {
10192 validate: (0, _utils.assertNodeType)("Identifier")
10193 }
10194 }
10195});
10196(0, _utils.default)("ImportNamespaceSpecifier", {
10197 visitor: ["local"],
10198 aliases: ["ModuleSpecifier"],
10199 fields: {
10200 local: {
10201 validate: (0, _utils.assertNodeType)("Identifier")
10202 }
10203 }
10204});
10205(0, _utils.default)("ImportSpecifier", {
10206 visitor: ["local", "imported"],
10207 aliases: ["ModuleSpecifier"],
10208 fields: {
10209 local: {
10210 validate: (0, _utils.assertNodeType)("Identifier")
10211 },
10212 imported: {
10213 validate: (0, _utils.assertNodeType)("Identifier")
10214 },
10215 importKind: {
10216 validate: (0, _utils.assertOneOf)(null, "type", "typeof")
10217 }
10218 }
10219});
10220(0, _utils.default)("MetaProperty", {
10221 visitor: ["meta", "property"],
10222 aliases: ["Expression"],
10223 fields: {
10224 meta: {
10225 validate: (0, _utils.assertNodeType)("Identifier")
10226 },
10227 property: {
10228 validate: (0, _utils.assertNodeType)("Identifier")
10229 }
10230 }
10231});
10232const classMethodOrPropertyCommon = {
10233 abstract: {
10234 validate: (0, _utils.assertValueType)("boolean"),
10235 optional: true
10236 },
10237 accessibility: {
10238 validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("public", "private", "protected")),
10239 optional: true
10240 },
10241 static: {
10242 validate: (0, _utils.assertValueType)("boolean"),
10243 optional: true
10244 },
10245 computed: {
10246 default: false,
10247 validate: (0, _utils.assertValueType)("boolean")
10248 },
10249 optional: {
10250 validate: (0, _utils.assertValueType)("boolean"),
10251 optional: true
10252 },
10253 key: {
10254 validate: (0, _utils.chain)(function () {
10255 const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
10256 const computed = (0, _utils.assertNodeType)("Expression");
10257 return function (node, key, val) {
10258 const validator = node.computed ? computed : normal;
10259 validator(node, key, val);
10260 };
10261 }(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression"))
10262 }
10263};
10264exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon;
10265const classMethodOrDeclareMethodCommon = Object.assign({}, _core.functionCommon, classMethodOrPropertyCommon, {
10266 kind: {
10267 validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("get", "set", "method", "constructor")),
10268 default: "method"
10269 },
10270 access: {
10271 validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("public", "private", "protected")),
10272 optional: true
10273 },
10274 decorators: {
10275 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
10276 optional: true
10277 }
10278});
10279exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon;
10280(0, _utils.default)("ClassMethod", {
10281 aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
10282 builder: ["kind", "key", "params", "body", "computed", "static"],
10283 visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
10284 fields: Object.assign({}, classMethodOrDeclareMethodCommon, _core.functionTypeAnnotationCommon, {
10285 body: {
10286 validate: (0, _utils.assertNodeType)("BlockStatement")
10287 }
10288 })
10289});
10290(0, _utils.default)("ObjectPattern", {
10291 visitor: ["properties", "typeAnnotation"],
10292 builder: ["properties"],
10293 aliases: ["Pattern", "PatternLike", "LVal"],
10294 fields: Object.assign({}, _core.patternLikeCommon, {
10295 properties: {
10296 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("RestElement", "ObjectProperty")))
10297 }
10298 })
10299});
10300(0, _utils.default)("SpreadElement", {
10301 visitor: ["argument"],
10302 aliases: ["UnaryLike"],
10303 deprecatedAlias: "SpreadProperty",
10304 fields: {
10305 argument: {
10306 validate: (0, _utils.assertNodeType)("Expression")
10307 }
10308 }
10309});
10310(0, _utils.default)("Super", {
10311 aliases: ["Expression"]
10312});
10313(0, _utils.default)("TaggedTemplateExpression", {
10314 visitor: ["tag", "quasi"],
10315 aliases: ["Expression"],
10316 fields: {
10317 tag: {
10318 validate: (0, _utils.assertNodeType)("Expression")
10319 },
10320 quasi: {
10321 validate: (0, _utils.assertNodeType)("TemplateLiteral")
10322 },
10323 typeParameters: {
10324 validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
10325 optional: true
10326 }
10327 }
10328});
10329(0, _utils.default)("TemplateElement", {
10330 builder: ["value", "tail"],
10331 fields: {
10332 value: {},
10333 tail: {
10334 validate: (0, _utils.assertValueType)("boolean"),
10335 default: false
10336 }
10337 }
10338});
10339(0, _utils.default)("TemplateLiteral", {
10340 visitor: ["quasis", "expressions"],
10341 aliases: ["Expression", "Literal"],
10342 fields: {
10343 quasis: {
10344 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TemplateElement")))
10345 },
10346 expressions: {
10347 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression")))
10348 }
10349 }
10350});
10351(0, _utils.default)("YieldExpression", {
10352 builder: ["argument", "delegate"],
10353 visitor: ["argument"],
10354 aliases: ["Expression", "Terminatorless"],
10355 fields: {
10356 delegate: {
10357 validate: (0, _utils.assertValueType)("boolean"),
10358 default: false
10359 },
10360 argument: {
10361 optional: true,
10362 validate: (0, _utils.assertNodeType)("Expression")
10363 }
10364 }
10365});
10366
10367/***/ }),
10368/* 44 */
10369/***/ (function(module, exports, __webpack_require__) {
10370
10371"use strict";
10372
10373
10374Object.defineProperty(exports, "__esModule", {
10375 value: true
10376});
10377exports.default = inherit;
10378
10379function _uniq() {
10380 const data = _interopRequireDefault(__webpack_require__(143));
10381
10382 _uniq = function () {
10383 return data;
10384 };
10385
10386 return data;
10387}
10388
10389function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10390
10391function inherit(key, child, parent) {
10392 if (child && parent) {
10393 child[key] = (0, _uniq().default)([].concat(child[key], parent[key]).filter(Boolean));
10394 }
10395}
10396
10397/***/ }),
10398/* 45 */
10399/***/ (function(module, exports, __webpack_require__) {
10400
10401"use strict";
10402
10403
10404Object.defineProperty(exports, "__esModule", {
10405 value: true
10406});
10407exports.Identifier = Identifier;
10408exports.SpreadElement = exports.RestElement = RestElement;
10409exports.ObjectPattern = exports.ObjectExpression = ObjectExpression;
10410exports.ObjectMethod = ObjectMethod;
10411exports.ObjectProperty = ObjectProperty;
10412exports.ArrayPattern = exports.ArrayExpression = ArrayExpression;
10413exports.RegExpLiteral = RegExpLiteral;
10414exports.BooleanLiteral = BooleanLiteral;
10415exports.NullLiteral = NullLiteral;
10416exports.NumericLiteral = NumericLiteral;
10417exports.StringLiteral = StringLiteral;
10418exports.BigIntLiteral = BigIntLiteral;
10419
10420function t() {
10421 const data = _interopRequireWildcard(__webpack_require__(2));
10422
10423 t = function () {
10424 return data;
10425 };
10426
10427 return data;
10428}
10429
10430function _jsesc() {
10431 const data = _interopRequireDefault(__webpack_require__(178));
10432
10433 _jsesc = function () {
10434 return data;
10435 };
10436
10437 return data;
10438}
10439
10440function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10441
10442function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
10443
10444function Identifier(node) {
10445 this.exactSource(node.loc, () => {
10446 this.word(node.name);
10447 });
10448}
10449
10450function RestElement(node) {
10451 this.token("...");
10452 this.print(node.argument, node);
10453}
10454
10455function ObjectExpression(node) {
10456 const props = node.properties;
10457 this.token("{");
10458 this.printInnerComments(node);
10459
10460 if (props.length) {
10461 this.space();
10462 this.printList(props, node, {
10463 indent: true,
10464 statement: true
10465 });
10466 this.space();
10467 }
10468
10469 this.token("}");
10470}
10471
10472function ObjectMethod(node) {
10473 this.printJoin(node.decorators, node);
10474
10475 this._methodHead(node);
10476
10477 this.space();
10478 this.print(node.body, node);
10479}
10480
10481function ObjectProperty(node) {
10482 this.printJoin(node.decorators, node);
10483
10484 if (node.computed) {
10485 this.token("[");
10486 this.print(node.key, node);
10487 this.token("]");
10488 } else {
10489 if (t().isAssignmentPattern(node.value) && t().isIdentifier(node.key) && node.key.name === node.value.left.name) {
10490 this.print(node.value, node);
10491 return;
10492 }
10493
10494 this.print(node.key, node);
10495
10496 if (node.shorthand && t().isIdentifier(node.key) && t().isIdentifier(node.value) && node.key.name === node.value.name) {
10497 return;
10498 }
10499 }
10500
10501 this.token(":");
10502 this.space();
10503 this.print(node.value, node);
10504}
10505
10506function ArrayExpression(node) {
10507 const elems = node.elements;
10508 const len = elems.length;
10509 this.token("[");
10510 this.printInnerComments(node);
10511
10512 for (let i = 0; i < elems.length; i++) {
10513 const elem = elems[i];
10514
10515 if (elem) {
10516 if (i > 0) this.space();
10517 this.print(elem, node);
10518 if (i < len - 1) this.token(",");
10519 } else {
10520 this.token(",");
10521 }
10522 }
10523
10524 this.token("]");
10525}
10526
10527function RegExpLiteral(node) {
10528 this.word(`/${node.pattern}/${node.flags}`);
10529}
10530
10531function BooleanLiteral(node) {
10532 this.word(node.value ? "true" : "false");
10533}
10534
10535function NullLiteral() {
10536 this.word("null");
10537}
10538
10539function NumericLiteral(node) {
10540 const raw = this.getPossibleRaw(node);
10541 const value = node.value + "";
10542
10543 if (raw == null) {
10544 this.number(value);
10545 } else if (this.format.minified) {
10546 this.number(raw.length < value.length ? raw : value);
10547 } else {
10548 this.number(raw);
10549 }
10550}
10551
10552function StringLiteral(node) {
10553 const raw = this.getPossibleRaw(node);
10554
10555 if (!this.format.minified && raw != null) {
10556 this.token(raw);
10557 return;
10558 }
10559
10560 const opts = this.format.jsescOption;
10561
10562 if (this.format.jsonCompatibleStrings) {
10563 opts.json = true;
10564 }
10565
10566 const val = (0, _jsesc().default)(node.value, opts);
10567 return this.token(val);
10568}
10569
10570function BigIntLiteral(node) {
10571 const raw = this.getPossibleRaw(node);
10572
10573 if (!this.format.minified && raw != null) {
10574 this.token(raw);
10575 return;
10576 }
10577
10578 this.token(node.value);
10579}
10580
10581/***/ }),
10582/* 46 */
10583/***/ (function(module, exports, __webpack_require__) {
10584
10585"use strict";
10586/**
10587 * Copyright (c) Facebook, Inc. and its affiliates.
10588 *
10589 * This source code is licensed under the MIT license found in the
10590 * LICENSE file in the root directory of this source tree.
10591 *
10592 * strict-local
10593 * @format
10594 */
10595
10596
10597function getInputObjectTypeIdentifier(type) {
10598 return type.name;
10599}
10600
10601function transformScalarType(type, state, objectProps) {
10602 if (type instanceof __webpack_require__(0).GraphQLNonNull) {
10603 return transformNonNullableScalarType(type.ofType, state, objectProps);
10604 } else {
10605 return __webpack_require__(2).nullableTypeAnnotation(transformNonNullableScalarType(type, state, objectProps));
10606 }
10607}
10608
10609function transformNonNullableScalarType(type, state, objectProps) {
10610 if (type instanceof __webpack_require__(0).GraphQLList) {
10611 return __webpack_require__(8).readOnlyArrayOfType(transformScalarType(type.ofType, state, objectProps));
10612 } else if (type instanceof __webpack_require__(0).GraphQLObjectType || type instanceof __webpack_require__(0).GraphQLUnionType || type instanceof __webpack_require__(0).GraphQLInterfaceType) {
10613 return objectProps;
10614 } else if (type instanceof __webpack_require__(0).GraphQLScalarType) {
10615 return transformGraphQLScalarType(type, state);
10616 } else if (type instanceof __webpack_require__(0).GraphQLEnumType) {
10617 return transformGraphQLEnumType(type, state);
10618 } else {
10619 throw new Error("Could not convert from GraphQL type ".concat(type.toString()));
10620 }
10621}
10622
10623function transformGraphQLScalarType(type, state) {
10624 var customType = state.customScalars[type.name];
10625
10626 switch (customType || type.name) {
10627 case 'ID':
10628 case 'String':
10629 return __webpack_require__(2).stringTypeAnnotation();
10630
10631 case 'Float':
10632 case 'Int':
10633 return __webpack_require__(2).numberTypeAnnotation();
10634
10635 case 'Boolean':
10636 return __webpack_require__(2).booleanTypeAnnotation();
10637
10638 default:
10639 return customType == null ? __webpack_require__(2).anyTypeAnnotation() : __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier(customType));
10640 }
10641}
10642
10643function transformGraphQLEnumType(type, state) {
10644 state.usedEnums[type.name] = type;
10645 return __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier(type.name));
10646}
10647
10648function transformInputType(type, state) {
10649 if (type instanceof __webpack_require__(0).GraphQLNonNull) {
10650 return transformNonNullableInputType(type.ofType, state);
10651 } else {
10652 return __webpack_require__(2).nullableTypeAnnotation(transformNonNullableInputType(type, state));
10653 }
10654}
10655
10656function transformNonNullableInputType(type, state) {
10657 if (type instanceof __webpack_require__(0).GraphQLList) {
10658 return __webpack_require__(8).readOnlyArrayOfType(transformInputType(type.ofType, state));
10659 } else if (type instanceof __webpack_require__(0).GraphQLScalarType) {
10660 return transformGraphQLScalarType(type, state);
10661 } else if (type instanceof __webpack_require__(0).GraphQLEnumType) {
10662 return transformGraphQLEnumType(type, state);
10663 } else if (type instanceof __webpack_require__(0).GraphQLInputObjectType) {
10664 var typeIdentifier = getInputObjectTypeIdentifier(type);
10665
10666 if (state.generatedInputObjectTypes[typeIdentifier]) {
10667 return __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier(typeIdentifier));
10668 }
10669
10670 state.generatedInputObjectTypes[typeIdentifier] = 'pending';
10671 var fields = type.getFields();
10672 var props = Object.keys(fields).map(function (key) {
10673 return fields[key];
10674 }).map(function (field) {
10675 var property = __webpack_require__(2).objectTypeProperty(__webpack_require__(2).identifier(field.name), transformInputType(field.type, state));
10676
10677 if (state.optionalInputFields.indexOf(field.name) >= 0 || !(field.type instanceof __webpack_require__(0).GraphQLNonNull)) {
10678 property.optional = true;
10679 }
10680
10681 return property;
10682 });
10683 state.generatedInputObjectTypes[typeIdentifier] = __webpack_require__(8).exactObjectTypeAnnotation(props);
10684 return __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier(typeIdentifier));
10685 } else {
10686 throw new Error("Could not convert from GraphQL type ".concat(type.toString()));
10687 }
10688}
10689
10690module.exports = {
10691 transformInputType: transformInputType,
10692 transformScalarType: transformScalarType
10693};
10694
10695/***/ }),
10696/* 47 */
10697/***/ (function(module, exports, __webpack_require__) {
10698
10699"use strict";
10700/**
10701 * Copyright (c) Facebook, Inc. and its affiliates.
10702 *
10703 * This source code is licensed under the MIT license found in the
10704 * LICENSE file in the root directory of this source tree.
10705 *
10706 * strict-local
10707 * @format
10708 */
10709
10710
10711var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
10712
10713var RELAY = 'relay';
10714var SCHEMA_EXTENSION = "\ndirective @relay(\n # Marks a connection field as containing nodes without 'id' fields.\n # This is used to silence the warning when diffing connections.\n isConnectionWithoutNodeID: Boolean,\n\n # Marks a fragment as intended for pattern matching (as opposed to fetching).\n # Used in Classic only.\n pattern: Boolean,\n\n # Marks a fragment as being backed by a GraphQLList.\n plural: Boolean,\n\n # Marks a fragment spread which should be unmasked if provided false\n mask: Boolean = true,\n\n # Selectively pass variables down into a fragment. Only used in Classic.\n variables: [String!],\n) on FRAGMENT_DEFINITION | FRAGMENT_SPREAD | INLINE_FRAGMENT | FIELD\n";
10715/**
10716 * A transform that extracts `@relay(plural: Boolean)` directives and converts
10717 * them to metadata that can be accessed at runtime.
10718 */
10719
10720function relayRelayDirectiveTransform(context) {
10721 return __webpack_require__(10).transform(context, {
10722 Fragment: visitRelayMetadata(fragmentMetadata),
10723 FragmentSpread: visitRelayMetadata(fragmentSpreadMetadata)
10724 });
10725}
10726
10727function visitRelayMetadata(metadataFn) {
10728 return function (node) {
10729 var relayDirective = node.directives.find(function (_ref) {
10730 var name = _ref.name;
10731 return name === RELAY;
10732 });
10733
10734 if (!relayDirective) {
10735 return this.traverse(node);
10736 }
10737
10738 var argValues = __webpack_require__(33)(relayDirective.args);
10739
10740 var metadata = metadataFn(argValues);
10741 return this.traverse((0, _objectSpread2["default"])({}, node, {
10742 directives: node.directives.filter(function (directive) {
10743 return directive !== relayDirective;
10744 }),
10745 metadata: (0, _objectSpread2["default"])({}, node.metadata || {}, metadata)
10746 }));
10747 };
10748}
10749
10750function fragmentMetadata(_ref2) {
10751 var mask = _ref2.mask,
10752 plural = _ref2.plural;
10753 !(plural === undefined || typeof plural === 'boolean') ? true ? __webpack_require__(4)(false, 'RelayRelayDirectiveTransform: Expected the "plural" argument to @relay ' + 'to be a boolean literal if specified.') : undefined : void 0;
10754 !(mask === undefined || typeof mask === 'boolean') ? true ? __webpack_require__(4)(false, 'RelayRelayDirectiveTransform: Expected the "mask" argument to @relay ' + 'to be a boolean literal if specified.') : undefined : void 0;
10755 return {
10756 mask: mask,
10757 plural: plural
10758 };
10759}
10760
10761function fragmentSpreadMetadata(_ref3) {
10762 var mask = _ref3.mask;
10763 !(mask === undefined || typeof mask === 'boolean') ? true ? __webpack_require__(4)(false, 'RelayRelayDirectiveTransform: Expected the "mask" argument to @relay ' + 'to be a boolean literal if specified.') : undefined : void 0;
10764 return {
10765 mask: mask
10766 };
10767}
10768
10769module.exports = {
10770 RELAY: RELAY,
10771 SCHEMA_EXTENSION: SCHEMA_EXTENSION,
10772 transform: relayRelayDirectiveTransform
10773};
10774
10775/***/ }),
10776/* 48 */
10777/***/ (function(module, exports, __webpack_require__) {
10778
10779"use strict";
10780/**
10781 * Copyright (c) Facebook, Inc. and its affiliates.
10782 *
10783 * This source code is licensed under the MIT license found in the
10784 * LICENSE file in the root directory of this source tree.
10785 *
10786 * strict-local
10787 * @format
10788 */
10789
10790
10791var SUPPORTED_ARGUMENT_NAME = 'supported';
10792var JS_FIELD_TYPE = 'JSDependency';
10793var JS_FIELD_ARG = 'module';
10794var JS_FIELD_NAME = 'js';
10795var SCHEMA_EXTENSION = "\n directive @match on FIELD\n\n directive @module(\n name: String!\n ) on FRAGMENT_SPREAD\n";
10796/**
10797 * This transform rewrites LinkedField nodes with @match and rewrites them
10798 * into MatchField nodes with a `supported` argument and MatchBranch selections.
10799 */
10800
10801function relayMatchTransform(context) {
10802 return __webpack_require__(10).transform(context, {
10803 // $FlowFixMe this transform intentionally changes the AST node type
10804 LinkedField: visitLinkedField,
10805 InlineFragment: visitInlineFragment
10806 }, function (node) {
10807 return node.type;
10808 });
10809}
10810
10811function visitInlineFragment(node, state) {
10812 return this.traverse(node, node.typeCondition);
10813}
10814
10815function visitLinkedField(node, parentType) {
10816 var _transformedNode$alia;
10817
10818 var transformedNode = this.traverse(node, node.type);
10819 var matchDirective = transformedNode.directives.find(function (directive) {
10820 return directive.name === 'match';
10821 });
10822
10823 if (matchDirective == null) {
10824 return transformedNode;
10825 }
10826
10827 var rawType = __webpack_require__(3).getRawType(parentType);
10828
10829 if (!(rawType instanceof __webpack_require__(0).GraphQLInterfaceType || rawType instanceof __webpack_require__(0).GraphQLObjectType)) {
10830 throw __webpack_require__(1).createUserError('@match may only be used on fields whose parent type is an interface ' + "or object, field '".concat(node.name, "' has invalid type '").concat(String(parentType), "'"), [node.loc]);
10831 }
10832
10833 var context = this.getContext();
10834 var schema = context.serverSchema;
10835 var jsModuleType = schema.getType(JS_FIELD_TYPE);
10836
10837 if (jsModuleType == null || !(jsModuleType instanceof __webpack_require__(0).GraphQLScalarType)) {
10838 throw new Error("RelayMatchTransform: Expected schema to define a scalar '".concat(JS_FIELD_TYPE, "' type."));
10839 }
10840
10841 var currentField = rawType.getFields()[transformedNode.name];
10842 var supportedArg = currentField.args.find(function (_ref2) {
10843 var name = _ref2.name;
10844 return SUPPORTED_ARGUMENT_NAME;
10845 });
10846 var supportedArgType = supportedArg != null ? __webpack_require__(0).getNullableType(supportedArg.type) : null;
10847 var supportedArgOfType = supportedArgType != null && supportedArgType instanceof __webpack_require__(0).GraphQLList ? supportedArgType.ofType : null;
10848
10849 if (supportedArg == null || supportedArgType == null || supportedArgOfType == null || __webpack_require__(0).getNullableType(supportedArgOfType) !== __webpack_require__(0).GraphQLString) {
10850 throw new Error('RelayMatchTransform: @match used on an incompatible ' + "field '".concat(transformedNode.name, "'. @match may only ") + "be used with fields that can accept '".concat(SUPPORTED_ARGUMENT_NAME, "' ") + "argument with type '[String!]!'.");
10851 }
10852
10853 var unionType = transformedNode.type;
10854
10855 if (!(unionType instanceof __webpack_require__(0).GraphQLUnionType)) {
10856 throw new Error('RelayMatchTransform: You are trying to apply @match ' + "directive to a field '".concat(transformedNode.name, "' that has unsupported ") + "output type. '".concat(transformedNode.name, "' output type should be union ") + 'type of object types.');
10857 }
10858
10859 var seenTypes = new Map();
10860 var typeToSelectionMap = {};
10861 var selections = [];
10862 transformedNode.selections.forEach(function (matchSelection) {
10863 var _ref, _moduleDirective$args;
10864
10865 if (matchSelection.kind !== 'FragmentSpread') {
10866 throw new Error('RelayMatchTransform: all selections in a @match field should be ' + "fragment spreads, got '".concat(matchSelection.kind, "'."));
10867 }
10868
10869 var fragment = context.getFragment(matchSelection.name);
10870
10871 if (!(fragment.type instanceof __webpack_require__(0).GraphQLObjectType)) {
10872 throw new Error('RelayMatchTransform: all fragment spreads in a @match field should ' + 'be for fragments on an object type. Union or interface type ' + "'".concat(fragment.type.name, "' for '...").concat(fragment.name, "' is not supported."));
10873 }
10874
10875 var matchedType = fragment.type;
10876
10877 if (seenTypes.has(matchedType)) {
10878 throw new Error('RelayMatchTransform: Each "match" type has to appear at-most once. ' + "Type '".concat(matchedType.name, "' was matched in both ") + "'...".concat(matchSelection.name, "' and '...").concat(seenTypes.get(matchedType) || '(unknown)', "'."));
10879 }
10880
10881 seenTypes.set(matchedType, matchSelection.name);
10882 var belongsToUnion = unionType.getTypes().includes(matchedType);
10883
10884 if (!belongsToUnion) {
10885 throw new Error("RelayMatchTransform: Unsupported type '".concat(matchedType.toString(), "' in ") + 'the list of matches in the @match. Type ' + "\"".concat(matchedType.toString(), "\" does not belong to the union ") + "\"".concat(unionType.toString(), "\"."));
10886 }
10887
10888 var jsField = matchedType.getFields()[JS_FIELD_NAME];
10889 var jsFieldArg = jsField ? jsField.args.find(function (arg) {
10890 return arg.name === JS_FIELD_ARG;
10891 }) : null;
10892
10893 if (jsField == null || jsFieldArg == null || __webpack_require__(0).getNullableType(jsFieldArg.type) !== __webpack_require__(0).GraphQLString || jsField.type.name !== jsModuleType.name // object identity fails in tests
10894 ) {
10895 throw new Error("RelayMatchTransform: expcted type '".concat(matchedType.name, "' to have a '").concat(JS_FIELD_NAME, "(").concat(JS_FIELD_ARG, ": String!): ").concat(JS_FIELD_TYPE, "' field ."));
10896 }
10897
10898 var moduleDirective = matchSelection.directives.find(function (directive) {
10899 return directive.name === 'module';
10900 });
10901
10902 if (moduleDirective == null || matchSelection.directives.length !== 1) {
10903 throw new Error('RelayMatchTransform: Fragment spreads in a @match field must have a ' + "'@module' directive and no other directives, got invalid directives " + "on fragment spread '...".concat(matchSelection.name, "'"));
10904 }
10905
10906 var moduleDirectiveArgs = __webpack_require__(33)(moduleDirective.args);
10907
10908 typeToSelectionMap[String(matchedType)] = {
10909 component: moduleDirectiveArgs.name,
10910 fragment: matchSelection.name
10911 };
10912 var normalizationName = __webpack_require__(74)(matchSelection.name) + '.graphql';
10913 var moduleField = {
10914 alias: '__match_component',
10915 args: [{
10916 kind: 'Argument',
10917 name: JS_FIELD_ARG,
10918 type: jsFieldArg.type,
10919 value: {
10920 kind: 'Literal',
10921 loc: (_ref = (_moduleDirective$args = moduleDirective.args[0]) === null || _moduleDirective$args === void 0 ? void 0 : _moduleDirective$args.loc) !== null && _ref !== void 0 ? _ref : moduleDirective.loc,
10922 metadata: {},
10923 value: moduleDirectiveArgs.name
10924 },
10925 loc: moduleDirective.loc,
10926 metadata: {}
10927 }],
10928 directives: [],
10929 handles: null,
10930 kind: 'ScalarField',
10931 loc: moduleDirective.loc,
10932 metadata: {
10933 storageKey: '__match_component'
10934 },
10935 name: JS_FIELD_NAME,
10936 type: jsModuleType
10937 };
10938 var fragmentField = {
10939 alias: '__match_fragment',
10940 args: [{
10941 kind: 'Argument',
10942 name: JS_FIELD_ARG,
10943 type: jsFieldArg.type,
10944 value: {
10945 kind: 'Literal',
10946 loc: matchSelection.loc,
10947 metadata: {},
10948 value: normalizationName
10949 },
10950 loc: matchSelection.loc,
10951 metadata: {}
10952 }],
10953 directives: [],
10954 handles: null,
10955 kind: 'ScalarField',
10956 loc: matchSelection.loc,
10957 metadata: {
10958 storageKey: '__match_fragment'
10959 },
10960 name: JS_FIELD_NAME,
10961 type: jsModuleType
10962 };
10963 selections.push({
10964 kind: 'MatchBranch',
10965 loc: matchSelection.loc,
10966 module: moduleDirectiveArgs.name,
10967 name: matchSelection.name,
10968 selections: [{
10969 args: [],
10970 directives: [],
10971 kind: 'FragmentSpread',
10972 loc: matchSelection.loc,
10973 metadata: {},
10974 name: matchSelection.name
10975 }, {
10976 directives: [],
10977 kind: 'InlineFragment',
10978 loc: matchSelection.loc,
10979 metadata: {},
10980 selections: [moduleField, fragmentField],
10981 typeCondition: matchedType
10982 }],
10983 type: matchedType
10984 });
10985 });
10986 var stableArgs = [];
10987 Object.keys(typeToSelectionMap).sort().forEach(function (typeName) {
10988 var _typeToSelectionMap$t = typeToSelectionMap[typeName],
10989 component = _typeToSelectionMap$t.component,
10990 fragment = _typeToSelectionMap$t.fragment;
10991 stableArgs.push("".concat(fragment, ":").concat(component));
10992 });
10993 var storageKey = ((_transformedNode$alia = transformedNode.alias) !== null && _transformedNode$alia !== void 0 ? _transformedNode$alia : transformedNode.name) + "(".concat(stableArgs.join(','), ")");
10994 var matchField = {
10995 kind: 'MatchField',
10996 alias: transformedNode.alias,
10997 args: [{
10998 kind: 'Argument',
10999 name: SUPPORTED_ARGUMENT_NAME,
11000 type: supportedArg.type,
11001 value: {
11002 kind: 'Literal',
11003 loc: node.loc,
11004 metadata: {},
11005 value: Array.from(seenTypes.keys()).map(function (type) {
11006 return type.name;
11007 })
11008 },
11009 loc: node.loc,
11010 metadata: {}
11011 }],
11012 directives: [],
11013 handles: null,
11014 loc: node.loc,
11015 metadata: {
11016 storageKey: storageKey
11017 },
11018 name: transformedNode.name,
11019 type: unionType,
11020 selections: selections
11021 }; // $FlowFixMe intentionally changing the result type in this transform
11022
11023 return matchField;
11024}
11025
11026module.exports = {
11027 SCHEMA_EXTENSION: SCHEMA_EXTENSION,
11028 transform: relayMatchTransform
11029};
11030
11031/***/ }),
11032/* 49 */
11033/***/ (function(module, exports, __webpack_require__) {
11034
11035"use strict";
11036/**
11037 * Copyright (c) Facebook, Inc. and its affiliates.
11038 *
11039 * This source code is licensed under the MIT license found in the
11040 * LICENSE file in the root directory of this source tree.
11041 *
11042 *
11043 * @format
11044 */
11045
11046
11047var INDENT = ' ';
11048/**
11049 * Converts a GraphQLIR node into a GraphQL string. Custom Relay
11050 * extensions (directives) are not supported; to print fragments with
11051 * variables or fragment spreads with arguments, transform the node
11052 * prior to printing.
11053 */
11054
11055function print(node) {
11056 switch (node.kind) {
11057 case 'Fragment':
11058 return "fragment ".concat(node.name, " on ").concat(String(node.type)) + printFragmentArgumentDefinitions(node.argumentDefinitions) + printDirectives(node.directives) + printSelections(node, '') + '\n';
11059
11060 case 'Root':
11061 return "".concat(node.operation, " ").concat(node.name) + printArgumentDefinitions(node.argumentDefinitions) + printDirectives(node.directives) + printSelections(node, '') + '\n';
11062
11063 case 'SplitOperation':
11064 return "SplitOperation ".concat(node.name, " on ").concat(String(node.type)) + printSelections(node, '') + '\n';
11065
11066 default:
11067 node;
11068 true ? true ? __webpack_require__(4)(false, 'GraphQLIRPrinter: Unsupported IR node `%s`.', node.kind) : undefined : undefined;
11069 }
11070}
11071
11072function printSelections(node, indent, parentDirectives) {
11073 var selections = node.selections;
11074
11075 if (selections == null) {
11076 return '';
11077 }
11078
11079 var printed = selections.map(function (selection) {
11080 return printSelection(selection, indent, parentDirectives);
11081 });
11082 return printed.length ? " {\n".concat(indent + INDENT).concat(printed.join('\n' + indent + INDENT), "\n").concat(indent, "}") : '';
11083}
11084/**
11085 * Prints a field without subselections.
11086 */
11087
11088
11089function printField(field) {
11090 var parentDirectives = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
11091 return (field.alias != null ? field.alias + ': ' + field.name : field.name) + printArguments(field.args) + parentDirectives + printDirectives(field.directives) + printHandles(field);
11092}
11093
11094function printSelection(selection, indent) {
11095 var parentDirectives = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
11096 var str;
11097
11098 if (selection.kind === 'LinkedField') {
11099 str = printField(selection, parentDirectives);
11100 str += printSelections(selection, indent + INDENT);
11101 } else if (selection.kind === 'MatchField') {
11102 str = printField(selection, parentDirectives);
11103 str += printSelections(selection, indent + INDENT);
11104 } else if (selection.kind === 'MatchBranch') {
11105 str = selection.selections.map(function (matchSelection) {
11106 return printSelection(matchSelection, indent);
11107 }).join('\n' + indent + INDENT);
11108 } else if (selection.kind === 'ScalarField') {
11109 str = printField(selection, parentDirectives);
11110 } else if (selection.kind === 'InlineFragment') {
11111 str = '... on ' + selection.typeCondition.toString();
11112 str += parentDirectives;
11113 str += printDirectives(selection.directives);
11114 str += printSelections(selection, indent + INDENT);
11115 } else if (selection.kind === 'FragmentSpread') {
11116 str = '...' + selection.name;
11117 str += parentDirectives;
11118 str += printFragmentArguments(selection.args);
11119 str += printDirectives(selection.directives);
11120 } else if (selection.kind === 'Condition') {
11121 var value = printValue(selection.condition); // For Flow
11122
11123 !(value != null) ? true ? __webpack_require__(4)(false, 'GraphQLIRPrinter: Expected a variable for condition, got a literal `null`.') : undefined : void 0;
11124 var condStr = selection.passingValue ? ' @include' : ' @skip';
11125 condStr += '(if: ' + value + ')';
11126 condStr += parentDirectives; // For multi-selection conditions, pushes the condition down to each
11127
11128 var subSelections = selection.selections.map(function (sel) {
11129 return printSelection(sel, indent, condStr);
11130 });
11131 str = subSelections.join('\n' + INDENT);
11132 } else if (selection.kind === 'Stream') {
11133 var streamStr = " @stream(label: \"".concat(selection.label, "\"");
11134
11135 if (selection["if"] !== null) {
11136 var _printValue;
11137
11138 streamStr += ", if: ".concat((_printValue = printValue(selection["if"])) !== null && _printValue !== void 0 ? _printValue : '');
11139 }
11140
11141 if (selection.initialCount !== null) {
11142 var _printValue2;
11143
11144 streamStr += ", initial_count: ".concat((_printValue2 = printValue(selection.initialCount)) !== null && _printValue2 !== void 0 ? _printValue2 : '');
11145 }
11146
11147 streamStr += ')';
11148 streamStr += parentDirectives;
11149
11150 var _subSelections = selection.selections.map(function (sel) {
11151 return printSelection(sel, indent, streamStr);
11152 });
11153
11154 str = _subSelections.join('\n' + INDENT);
11155 } else if (selection.kind === 'Defer') {
11156 var deferStr = " @defer(label: \"".concat(selection.label, "\"");
11157
11158 if (selection["if"] !== null) {
11159 var _printValue3;
11160
11161 deferStr += ", if: ".concat((_printValue3 = printValue(selection["if"])) !== null && _printValue3 !== void 0 ? _printValue3 : '');
11162 }
11163
11164 deferStr += ')';
11165 deferStr += parentDirectives;
11166
11167 var _subSelections2 = selection.selections.map(function (sel) {
11168 return printSelection(sel, indent, deferStr);
11169 });
11170
11171 str = _subSelections2.join('\n' + INDENT);
11172 } else {
11173 selection;
11174 true ? true ? __webpack_require__(4)(false, 'GraphQLIRPrinter: Unknown selection kind `%s`.', selection.kind) : undefined : undefined;
11175 }
11176
11177 return str;
11178}
11179
11180function printArgumentDefinitions(argumentDefinitions) {
11181 var printed = argumentDefinitions.map(function (def) {
11182 var str = "$".concat(def.name, ": ").concat(def.type.toString());
11183
11184 if (def.defaultValue != null) {
11185 str += ' = ' + printLiteral(def.defaultValue, def.type);
11186 }
11187
11188 return str;
11189 });
11190 return printed.length ? "(\n".concat(INDENT).concat(printed.join('\n' + INDENT), "\n)") : '';
11191}
11192
11193function printFragmentArgumentDefinitions(argumentDefinitions) {
11194 var printed;
11195 argumentDefinitions.forEach(function (def) {
11196 if (def.kind !== 'LocalArgumentDefinition') {
11197 return;
11198 }
11199
11200 printed = printed || [];
11201 var str = "".concat(def.name, ": {type: \"").concat(def.type.toString(), "\"");
11202
11203 if (def.defaultValue != null) {
11204 str += ", defaultValue: ".concat(printLiteral(def.defaultValue, def.type));
11205 }
11206
11207 str += '}';
11208 printed.push(str);
11209 });
11210 return printed && printed.length ? " @argumentDefinitions(\n".concat(INDENT).concat(printed.join('\n' + INDENT), "\n)") : '';
11211}
11212
11213function printHandles(field) {
11214 if (!field.handles) {
11215 return '';
11216 }
11217
11218 var printed = field.handles.map(function (handle) {
11219 // For backward compatibility and also because this module is shared by ComponentScript.
11220 var key = handle.key === __webpack_require__(76).DEFAULT_HANDLE_KEY ? '' : ", key: \"".concat(handle.key, "\"");
11221 var filters = handle.filters == null ? '' : ", filters: ".concat(JSON.stringify(Array.from(handle.filters).sort()));
11222 return "@__clientField(handle: \"".concat(handle.name, "\"").concat(key).concat(filters, ")");
11223 });
11224 return printed.length ? ' ' + printed.join(' ') : '';
11225}
11226
11227function printDirectives(directives) {
11228 var printed = directives.map(function (directive) {
11229 return '@' + directive.name + printArguments(directive.args);
11230 });
11231 return printed.length ? ' ' + printed.join(' ') : '';
11232}
11233
11234function printFragmentArguments(args) {
11235 var printedArgs = printArguments(args);
11236
11237 if (!printedArgs.length) {
11238 return '';
11239 }
11240
11241 return " @arguments".concat(printedArgs);
11242}
11243
11244function printArguments(args) {
11245 var printed = [];
11246 args.forEach(function (arg) {
11247 var printedValue = printValue(arg.value, arg.type);
11248
11249 if (printedValue != null) {
11250 printed.push(arg.name + ': ' + printedValue);
11251 }
11252 });
11253 return printed.length ? '(' + printed.join(', ') + ')' : '';
11254}
11255
11256function printValue(value, type) {
11257 if (type instanceof __webpack_require__(0).GraphQLNonNull) {
11258 type = type.ofType;
11259 }
11260
11261 if (value.kind === 'Variable') {
11262 return '$' + value.variableName;
11263 } else if (value.kind === 'ObjectValue') {
11264 !(type instanceof __webpack_require__(0).GraphQLInputObjectType) ? true ? __webpack_require__(4)(false, 'GraphQLIRPrinter: Need an InputObject type to print objects.') : undefined : void 0;
11265 var typeFields = type.getFields();
11266 var pairs = value.fields.map(function (field) {
11267 var innerValue = printValue(field.value, typeFields[field.name].type);
11268 return innerValue == null ? null : field.name + ': ' + innerValue;
11269 }).filter(Boolean);
11270 return '{' + pairs.join(', ') + '}';
11271 } else if (value.kind === 'ListValue') {
11272 !(type instanceof __webpack_require__(0).GraphQLList) ? true ? __webpack_require__(4)(false, 'GraphQLIRPrinter: Need a type in order to print arrays.') : undefined : void 0;
11273 var innerType = type.ofType;
11274 return "[".concat(value.items.map(function (i) {
11275 return printValue(i, innerType);
11276 }).join(', '), "]");
11277 } else if (value.value != null) {
11278 return printLiteral(value.value, type);
11279 } else {
11280 return null;
11281 }
11282}
11283
11284function printLiteral(value, type) {
11285 if (type instanceof __webpack_require__(0).GraphQLNonNull) {
11286 type = type.ofType;
11287 }
11288
11289 if (type instanceof __webpack_require__(0).GraphQLEnumType) {
11290 !(typeof value === 'string') ? true ? __webpack_require__(4)(false, 'GraphQLIRPrinter: Expected value of type %s to be a string, got `%s`.', type.name, value) : undefined : void 0;
11291 return value;
11292 }
11293
11294 if (Array.isArray(value)) {
11295 !(type instanceof __webpack_require__(0).GraphQLList) ? true ? __webpack_require__(4)(false, 'GraphQLIRPrinter: Need a type in order to print arrays.') : undefined : void 0;
11296 var itemType = type.ofType;
11297 return '[' + value.map(function (item) {
11298 return printLiteral(item, itemType);
11299 }).join(', ') + ']';
11300 } else if (typeof value === 'object' && value != null) {
11301 var fields = [];
11302 !(type instanceof __webpack_require__(0).GraphQLInputObjectType) ? true ? __webpack_require__(4)(false, 'GraphQLIRPrinter: Need an InputObject type to print objects.') : undefined : void 0;
11303 var typeFields = type.getFields();
11304
11305 for (var key in value) {
11306 if (value.hasOwnProperty(key)) {
11307 fields.push(key + ': ' + printLiteral(value[key], typeFields[key].type));
11308 }
11309 }
11310
11311 return '{' + fields.join(', ') + '}';
11312 } else if (type instanceof __webpack_require__(0).GraphQLList && value != null) {
11313 // Not an array, but still a list. Treat as list-of-one as per spec 3.1.7:
11314 // http://facebook.github.io/graphql/October2016/#sec-Lists
11315 return printLiteral(value, type.ofType);
11316 } else {
11317 return JSON.stringify(value);
11318 }
11319}
11320
11321module.exports = {
11322 print: print,
11323 printField: printField,
11324 printArguments: printArguments,
11325 printDirectives: printDirectives
11326};
11327
11328/***/ }),
11329/* 50 */
11330/***/ (function(module, exports, __webpack_require__) {
11331
11332"use strict";
11333/**
11334 * Copyright (c) Facebook, Inc. and its affiliates.
11335 *
11336 * This source code is licensed under the MIT license found in the
11337 * LICENSE file in the root directory of this source tree.
11338 *
11339 *
11340 * @format
11341 */
11342
11343
11344function convertASTDocuments(schema, documents, validationRules, transform) {
11345 return __webpack_require__(7).run('ASTConvert.convertASTDocuments', function () {
11346 var definitions = definitionsFromDocuments(documents);
11347 var astDefinitions = [];
11348 documents.forEach(function (doc) {
11349 doc.definitions.forEach(function (definition) {
11350 if (__webpack_require__(3).isExecutableDefinitionAST(definition)) {
11351 astDefinitions.push(definition);
11352 }
11353 });
11354 });
11355 return convertASTDefinitions(schema, definitions, validationRules, transform);
11356 });
11357}
11358
11359function convertASTDocumentsWithBase(schema, baseDocuments, documents, validationRules, transform) {
11360 return __webpack_require__(7).run('ASTConvert.convertASTDocumentsWithBase', function () {
11361 var baseDefinitions = definitionsFromDocuments(baseDocuments);
11362 var definitions = definitionsFromDocuments(documents);
11363 var requiredDefinitions = new Map();
11364 var baseMap = new Map();
11365 baseDefinitions.forEach(function (definition) {
11366 if (__webpack_require__(3).isExecutableDefinitionAST(definition)) {
11367 var definitionName = definition.name && definition.name.value; // If there's no name, no reason to put in the map
11368
11369 if (definitionName) {
11370 if (baseMap.has(definitionName)) {
11371 throw new Error("Duplicate definition of '".concat(definitionName, "'."));
11372 }
11373
11374 baseMap.set(definitionName, definition);
11375 }
11376 }
11377 });
11378 var definitionsToVisit = [];
11379 definitions.forEach(function (definition) {
11380 if (__webpack_require__(3).isExecutableDefinitionAST(definition)) {
11381 definitionsToVisit.push(definition);
11382 }
11383 });
11384
11385 while (definitionsToVisit.length > 0) {
11386 var definition = definitionsToVisit.pop();
11387 var name = definition.name && definition.name.value;
11388
11389 if (!name) {
11390 continue;
11391 }
11392
11393 if (requiredDefinitions.has(name)) {
11394 if (requiredDefinitions.get(name) !== definition) {
11395 throw new Error("Duplicate definition of '".concat(name, "'."));
11396 }
11397
11398 continue;
11399 }
11400
11401 requiredDefinitions.set(name, definition);
11402
11403 __webpack_require__(0).visit(definition, {
11404 FragmentSpread: function FragmentSpread(spread) {
11405 var baseDefinition = baseMap.get(spread.name.value);
11406
11407 if (baseDefinition) {
11408 // We only need to add those definitions not already included
11409 // in definitions
11410 definitionsToVisit.push(baseDefinition);
11411 }
11412 }
11413 });
11414 }
11415
11416 var definitionsToConvert = [];
11417 requiredDefinitions.forEach(function (definition) {
11418 return definitionsToConvert.push(definition);
11419 });
11420 return convertASTDefinitions(schema, definitionsToConvert, validationRules, transform);
11421 });
11422}
11423
11424function convertASTDefinitions(schema, definitions, validationRules, transform) {
11425 var operationDefinitions = [];
11426 definitions.forEach(function (definition) {
11427 if (__webpack_require__(3).isExecutableDefinitionAST(definition)) {
11428 operationDefinitions.push(definition);
11429 }
11430 });
11431 var validationAST = {
11432 kind: 'Document',
11433 definitions: operationDefinitions
11434 }; // Will throw an error if there are validation issues
11435
11436 __webpack_require__(37).validate(validationAST, schema, validationRules);
11437
11438 return transform(schema, operationDefinitions);
11439}
11440
11441function definitionsFromDocuments(documents) {
11442 var definitions = [];
11443 documents.forEach(function (doc) {
11444 doc.definitions.forEach(function (definition) {
11445 return definitions.push(definition);
11446 });
11447 });
11448 return definitions;
11449}
11450/**
11451 * Extends a GraphQLSchema with a list of schema extensions in string form.
11452 */
11453
11454
11455function transformASTSchema(schema, schemaExtensions) {
11456 return __webpack_require__(7).run('ASTConvert.transformASTSchema', function () {
11457 if (schemaExtensions.length === 0) {
11458 return schema;
11459 }
11460
11461 var extension = schemaExtensions.join('\n');
11462 return cachedExtend(schema, extension, function () {
11463 return __webpack_require__(0).extendSchema(schema, __webpack_require__(0).parse(extension));
11464 });
11465 });
11466}
11467/**
11468 * Extends a GraphQLSchema with a list of schema extensions in AST form.
11469 */
11470
11471
11472function extendASTSchema(baseSchema, documents) {
11473 return __webpack_require__(7).run('ASTConvert.extendASTSchema', function () {
11474 var schemaExtensions = [];
11475 documents.forEach(function (doc) {
11476 doc.definitions.forEach(function (definition) {
11477 if (__webpack_require__(3).isSchemaDefinitionAST(definition)) {
11478 schemaExtensions.push(definition);
11479 }
11480 });
11481 });
11482
11483 if (schemaExtensions.length === 0) {
11484 return baseSchema;
11485 }
11486
11487 var key = schemaExtensions.map(__webpack_require__(0).print).join('\n');
11488 return cachedExtend(baseSchema, key, function () {
11489 return __webpack_require__(0).extendSchema(baseSchema, {
11490 kind: 'Document',
11491 definitions: schemaExtensions
11492 }, // TODO T24511737 figure out if this is dangerous
11493 {
11494 assumeValid: true
11495 });
11496 });
11497 });
11498}
11499
11500var extendedSchemas = new Map();
11501
11502function cachedExtend(schema, key, compute) {
11503 var cache = extendedSchemas.get(schema);
11504
11505 if (!cache) {
11506 cache = {};
11507 extendedSchemas.set(schema, cache);
11508 }
11509
11510 var extendedSchema = cache[key];
11511
11512 if (!extendedSchema) {
11513 extendedSchema = compute();
11514 cache[key] = extendedSchema;
11515 }
11516
11517 return extendedSchema;
11518}
11519
11520module.exports = {
11521 convertASTDocuments: convertASTDocuments,
11522 convertASTDocumentsWithBase: convertASTDocumentsWithBase,
11523 extendASTSchema: extendASTSchema,
11524 transformASTSchema: transformASTSchema
11525};
11526
11527/***/ }),
11528/* 51 */
11529/***/ (function(module, exports, __webpack_require__) {
11530
11531"use strict";
11532/**
11533 * Copyright (c) Facebook, Inc. and its affiliates.
11534 *
11535 * This source code is licensed under the MIT license found in the
11536 * LICENSE file in the root directory of this source tree.
11537 *
11538 *
11539 * @format
11540 */
11541
11542
11543/**
11544 * An immutable representation of a corpus of documents being compiled together.
11545 * For each document, the context stores the IR and any validation errors.
11546 */
11547var GraphQLCompilerContext =
11548/*#__PURE__*/
11549function () {
11550 function GraphQLCompilerContext(serverSchema, clientSchema) {
11551 this._isMutable = false;
11552 this._documents = new (__webpack_require__(25).OrderedMap)();
11553 this._withTransform = new WeakMap();
11554 this.serverSchema = serverSchema; // If a separate client schema doesn't exist, use the server schema.
11555
11556 this.clientSchema = clientSchema || serverSchema;
11557 }
11558 /**
11559 * Returns the documents for the context in the order they were added.
11560 */
11561
11562
11563 var _proto = GraphQLCompilerContext.prototype;
11564
11565 _proto.documents = function documents() {
11566 return this._documents.toArray();
11567 };
11568
11569 _proto.forEachDocument = function forEachDocument(fn) {
11570 this._documents.forEach(fn);
11571 };
11572
11573 _proto.replace = function replace(node) {
11574 return this._update(this._documents.update(node.name, function (existing) {
11575 !existing ? true ? __webpack_require__(4)(false, 'GraphQLCompilerContext: Expected to replace existing node %s, but' + 'one was not found in the context.', node.name) : undefined : void 0;
11576 return node;
11577 }));
11578 };
11579
11580 _proto.add = function add(node) {
11581 return this._update(this._documents.update(node.name, function (existing) {
11582 !!existing ? true ? __webpack_require__(4)(false, 'GraphQLCompilerContext: Duplicate document named `%s`. GraphQL ' + 'fragments and roots must have unique names.', node.name) : undefined : void 0;
11583 return node;
11584 }));
11585 };
11586
11587 _proto.addAll = function addAll(nodes) {
11588 return this.withMutations(function (mutable) {
11589 return nodes.reduce(function (ctx, definition) {
11590 return ctx.add(definition);
11591 }, mutable);
11592 });
11593 };
11594 /**
11595 * Apply a list of compiler transforms and return a new compiler context.
11596 */
11597
11598
11599 _proto.applyTransforms = function applyTransforms(transforms, reporter) {
11600 var _this = this;
11601
11602 return __webpack_require__(7).run('applyTransforms', function () {
11603 return transforms.reduce(function (ctx, transform) {
11604 return ctx.applyTransform(transform, reporter);
11605 }, _this);
11606 });
11607 };
11608 /**
11609 * Applies a transform to this context, returning a new context.
11610 *
11611 * This is memoized such that applying the same sequence of transforms will
11612 * not result in duplicated work.
11613 */
11614
11615
11616 _proto.applyTransform = function applyTransform(transform, reporter) {
11617 var transformed = this._withTransform.get(transform);
11618
11619 if (!transformed) {
11620 var start = process.hrtime();
11621 transformed = __webpack_require__(7).instrument(transform)(this);
11622 var delta = process.hrtime(start);
11623 var deltaMs = Math.round((delta[0] * 1e9 + delta[1]) / 1e6);
11624 reporter && reporter.reportTime(transform.name, deltaMs);
11625
11626 this._withTransform.set(transform, transformed);
11627 }
11628
11629 return transformed;
11630 };
11631
11632 _proto.get = function get(name) {
11633 return this._documents.get(name);
11634 };
11635
11636 _proto.getFragment = function getFragment(name) {
11637 var node = this._get(name);
11638
11639 if (node.kind !== 'Fragment') {
11640 var childModule = name.substring(0, name.lastIndexOf('_'));
11641 throw __webpack_require__(197).createUserError('GraphQLCompilerContext: Cannot find fragment `%s`.' + ' Please make sure the fragment exists in `%s`.', name, childModule);
11642 }
11643
11644 return node;
11645 };
11646
11647 _proto.getRoot = function getRoot(name) {
11648 var node = this._get(name);
11649
11650 !(node.kind === 'Root') ? true ? __webpack_require__(4)(false, 'GraphQLCompilerContext: Expected `%s` to be a root, got `%s`.', name, node.kind) : undefined : void 0;
11651 return node;
11652 };
11653
11654 _proto.remove = function remove(name) {
11655 return this._update(this._documents["delete"](name));
11656 };
11657
11658 _proto.withMutations = function withMutations(fn) {
11659 var mutableCopy = this._update(this._documents.asMutable());
11660
11661 mutableCopy._isMutable = true;
11662 var result = fn(mutableCopy);
11663 result._isMutable = false;
11664 result._documents = result._documents.asImmutable();
11665 return this._documents === result._documents ? this : result;
11666 };
11667
11668 _proto._get = function _get(name) {
11669 var document = this._documents.get(name);
11670
11671 !document ? true ? __webpack_require__(4)(false, 'GraphQLCompilerContext: Unknown document `%s`.', name) : undefined : void 0;
11672 return document;
11673 };
11674
11675 _proto._update = function _update(documents) {
11676 var context = this._isMutable ? this : new GraphQLCompilerContext(this.serverSchema, this.clientSchema);
11677 context._documents = documents;
11678 return context;
11679 };
11680
11681 return GraphQLCompilerContext;
11682}();
11683
11684module.exports = GraphQLCompilerContext;
11685
11686/***/ }),
11687/* 52 */
11688/***/ (function(module, exports, __webpack_require__) {
11689
11690"use strict";
11691/**
11692 * Copyright (c) Facebook, Inc. and its affiliates.
11693 *
11694 * This source code is licensed under the MIT license found in the
11695 * LICENSE file in the root directory of this source tree.
11696 *
11697 *
11698 * @format
11699 */
11700
11701
11702function generate(node) {
11703 switch (node.kind) {
11704 case 'Fragment':
11705 return __webpack_require__(82).generate(node);
11706
11707 case 'Request':
11708 return {
11709 kind: 'Request',
11710 fragment: __webpack_require__(82).generate(node.fragment),
11711 operation: __webpack_require__(84).generate(node.root),
11712 params: {
11713 operationKind: node.root.operation,
11714 name: node.name,
11715 id: node.id,
11716 text: node.text,
11717 metadata: node.metadata
11718 }
11719 };
11720
11721 case 'SplitOperation':
11722 return __webpack_require__(84).generate(node);
11723 }
11724
11725 throw __webpack_require__(1).createCompilerError("RelayCodeGenerator: Unknown AST kind '".concat(node.kind, "'."), [node.loc]);
11726}
11727
11728module.exports = {
11729 generate: generate
11730};
11731
11732/***/ }),
11733/* 53 */
11734/***/ (function(module, exports, __webpack_require__) {
11735
11736"use strict";
11737
11738
11739__webpack_require__(95);
11740
11741__webpack_require__(96);
11742
11743__webpack_require__(97);
11744
11745__webpack_require__(98);
11746
11747__webpack_require__(99);
11748
11749__webpack_require__(100);
11750
11751__webpack_require__(101);
11752
11753__webpack_require__(102);
11754
11755__webpack_require__(103);
11756
11757__webpack_require__(104);
11758
11759__webpack_require__(105);
11760
11761if (global._babelPolyfill && typeof console !== "undefined" && console.warn) {
11762 console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended " + "and may have consequences if different versions of the polyfills are applied sequentially. " + "If you do need to load the polyfill more than once, use @babel/polyfill/noConflict " + "instead to bypass the warning.");
11763}
11764
11765global._babelPolyfill = true;
11766
11767/***/ }),
11768/* 54 */
11769/***/ (function(module, exports, __webpack_require__) {
11770
11771"use strict";
11772
11773
11774Object.defineProperty(exports, "__esModule", {
11775 value: true
11776});
11777exports.needsWhitespace = needsWhitespace;
11778exports.needsWhitespaceBefore = needsWhitespaceBefore;
11779exports.needsWhitespaceAfter = needsWhitespaceAfter;
11780exports.needsParens = needsParens;
11781
11782var whitespace = _interopRequireWildcard(__webpack_require__(122));
11783
11784var parens = _interopRequireWildcard(__webpack_require__(171));
11785
11786function t() {
11787 const data = _interopRequireWildcard(__webpack_require__(2));
11788
11789 t = function () {
11790 return data;
11791 };
11792
11793 return data;
11794}
11795
11796function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
11797
11798function expandAliases(obj) {
11799 const newObj = {};
11800
11801 function add(type, func) {
11802 const fn = newObj[type];
11803 newObj[type] = fn ? function (node, parent, stack) {
11804 const result = fn(node, parent, stack);
11805 return result == null ? func(node, parent, stack) : result;
11806 } : func;
11807 }
11808
11809 for (const type of Object.keys(obj)) {
11810 const aliases = t().FLIPPED_ALIAS_KEYS[type];
11811
11812 if (aliases) {
11813 for (const alias of aliases) {
11814 add(alias, obj[type]);
11815 }
11816 } else {
11817 add(type, obj[type]);
11818 }
11819 }
11820
11821 return newObj;
11822}
11823
11824const expandedParens = expandAliases(parens);
11825const expandedWhitespaceNodes = expandAliases(whitespace.nodes);
11826const expandedWhitespaceList = expandAliases(whitespace.list);
11827
11828function find(obj, node, parent, printStack) {
11829 const fn = obj[node.type];
11830 return fn ? fn(node, parent, printStack) : null;
11831}
11832
11833function isOrHasCallExpression(node) {
11834 if (t().isCallExpression(node)) {
11835 return true;
11836 }
11837
11838 if (t().isMemberExpression(node)) {
11839 return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
11840 } else {
11841 return false;
11842 }
11843}
11844
11845function needsWhitespace(node, parent, type) {
11846 if (!node) return 0;
11847
11848 if (t().isExpressionStatement(node)) {
11849 node = node.expression;
11850 }
11851
11852 let linesInfo = find(expandedWhitespaceNodes, node, parent);
11853
11854 if (!linesInfo) {
11855 const items = find(expandedWhitespaceList, node, parent);
11856
11857 if (items) {
11858 for (let i = 0; i < items.length; i++) {
11859 linesInfo = needsWhitespace(items[i], node, type);
11860 if (linesInfo) break;
11861 }
11862 }
11863 }
11864
11865 if (typeof linesInfo === "object" && linesInfo !== null) {
11866 return linesInfo[type] || 0;
11867 }
11868
11869 return 0;
11870}
11871
11872function needsWhitespaceBefore(node, parent) {
11873 return needsWhitespace(node, parent, "before");
11874}
11875
11876function needsWhitespaceAfter(node, parent) {
11877 return needsWhitespace(node, parent, "after");
11878}
11879
11880function needsParens(node, parent, printStack) {
11881 if (!parent) return false;
11882
11883 if (t().isNewExpression(parent) && parent.callee === node) {
11884 if (isOrHasCallExpression(node)) return true;
11885 }
11886
11887 return find(expandedParens, node, parent, printStack);
11888}
11889
11890/***/ }),
11891/* 55 */
11892/***/ (function(module, exports, __webpack_require__) {
11893
11894"use strict";
11895
11896
11897Object.defineProperty(exports, "__esModule", {
11898 value: true
11899});
11900exports.default = buildMatchMemberExpression;
11901
11902var _matchesPattern = _interopRequireDefault(__webpack_require__(56));
11903
11904function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11905
11906function buildMatchMemberExpression(match, allowPartial) {
11907 const parts = match.split(".");
11908 return member => (0, _matchesPattern.default)(member, parts, allowPartial);
11909}
11910
11911/***/ }),
11912/* 56 */
11913/***/ (function(module, exports, __webpack_require__) {
11914
11915"use strict";
11916
11917
11918Object.defineProperty(exports, "__esModule", {
11919 value: true
11920});
11921exports.default = matchesPattern;
11922
11923var _generated = __webpack_require__(12);
11924
11925function matchesPattern(member, match, allowPartial) {
11926 if (!(0, _generated.isMemberExpression)(member)) return false;
11927 const parts = Array.isArray(match) ? match : match.split(".");
11928 const nodes = [];
11929 let node;
11930
11931 for (node = member; (0, _generated.isMemberExpression)(node); node = node.object) {
11932 nodes.push(node.property);
11933 }
11934
11935 nodes.push(node);
11936 if (nodes.length < parts.length) return false;
11937 if (!allowPartial && nodes.length > parts.length) return false;
11938
11939 for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) {
11940 const node = nodes[j];
11941 let value;
11942
11943 if ((0, _generated.isIdentifier)(node)) {
11944 value = node.name;
11945 } else if ((0, _generated.isStringLiteral)(node)) {
11946 value = node.value;
11947 } else {
11948 return false;
11949 }
11950
11951 if (parts[i] !== value) return false;
11952 }
11953
11954 return true;
11955}
11956
11957/***/ }),
11958/* 57 */
11959/***/ (function(module, exports, __webpack_require__) {
11960
11961"use strict";
11962
11963
11964Object.defineProperty(exports, "__esModule", {
11965 value: true
11966});
11967exports.default = validate;
11968
11969var _definitions = __webpack_require__(16);
11970
11971function validate(node, key, val) {
11972 if (!node) return;
11973 const fields = _definitions.NODE_FIELDS[node.type];
11974 if (!fields) return;
11975 const field = fields[key];
11976 if (!field || !field.validate) return;
11977 if (field.optional && val == null) return;
11978 field.validate(node, key, val);
11979}
11980
11981/***/ }),
11982/* 58 */
11983/***/ (function(module, exports, __webpack_require__) {
11984
11985"use strict";
11986
11987
11988Object.defineProperty(exports, "__esModule", {
11989 value: true
11990});
11991exports.default = isNode;
11992
11993var _definitions = __webpack_require__(16);
11994
11995function isNode(node) {
11996 return !!(node && _definitions.VISITOR_KEYS[node.type]);
11997}
11998
11999/***/ }),
12000/* 59 */
12001/***/ (function(module, exports, __webpack_require__) {
12002
12003"use strict";
12004
12005
12006Object.defineProperty(exports, "__esModule", {
12007 value: true
12008});
12009exports.default = removeTypeDuplicates;
12010
12011var _generated = __webpack_require__(12);
12012
12013function removeTypeDuplicates(nodes) {
12014 const generics = {};
12015 const bases = {};
12016 const typeGroups = [];
12017 const types = [];
12018
12019 for (let i = 0; i < nodes.length; i++) {
12020 const node = nodes[i];
12021 if (!node) continue;
12022
12023 if (types.indexOf(node) >= 0) {
12024 continue;
12025 }
12026
12027 if ((0, _generated.isAnyTypeAnnotation)(node)) {
12028 return [node];
12029 }
12030
12031 if ((0, _generated.isFlowBaseAnnotation)(node)) {
12032 bases[node.type] = node;
12033 continue;
12034 }
12035
12036 if ((0, _generated.isUnionTypeAnnotation)(node)) {
12037 if (typeGroups.indexOf(node.types) < 0) {
12038 nodes = nodes.concat(node.types);
12039 typeGroups.push(node.types);
12040 }
12041
12042 continue;
12043 }
12044
12045 if ((0, _generated.isGenericTypeAnnotation)(node)) {
12046 const name = node.id.name;
12047
12048 if (generics[name]) {
12049 let existing = generics[name];
12050
12051 if (existing.typeParameters) {
12052 if (node.typeParameters) {
12053 existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params));
12054 }
12055 } else {
12056 existing = node.typeParameters;
12057 }
12058 } else {
12059 generics[name] = node;
12060 }
12061
12062 continue;
12063 }
12064
12065 types.push(node);
12066 }
12067
12068 for (const type in bases) {
12069 types.push(bases[type]);
12070 }
12071
12072 for (const name in generics) {
12073 types.push(generics[name]);
12074 }
12075
12076 return types;
12077}
12078
12079/***/ }),
12080/* 60 */
12081/***/ (function(module, exports, __webpack_require__) {
12082
12083"use strict";
12084
12085
12086Object.defineProperty(exports, "__esModule", {
12087 value: true
12088});
12089exports.default = clone;
12090
12091var _cloneNode = _interopRequireDefault(__webpack_require__(28));
12092
12093function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12094
12095function clone(node) {
12096 return (0, _cloneNode.default)(node, false);
12097}
12098
12099/***/ }),
12100/* 61 */
12101/***/ (function(module, exports, __webpack_require__) {
12102
12103"use strict";
12104
12105
12106Object.defineProperty(exports, "__esModule", {
12107 value: true
12108});
12109exports.default = addComments;
12110
12111function addComments(node, type, comments) {
12112 if (!comments || !node) return node;
12113 const key = `${type}Comments`;
12114
12115 if (node[key]) {
12116 if (type === "leading") {
12117 node[key] = comments.concat(node[key]);
12118 } else {
12119 node[key] = node[key].concat(comments);
12120 }
12121 } else {
12122 node[key] = comments;
12123 }
12124
12125 return node;
12126}
12127
12128/***/ }),
12129/* 62 */
12130/***/ (function(module, exports, __webpack_require__) {
12131
12132"use strict";
12133
12134
12135Object.defineProperty(exports, "__esModule", {
12136 value: true
12137});
12138exports.default = inheritInnerComments;
12139
12140var _inherit = _interopRequireDefault(__webpack_require__(44));
12141
12142function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12143
12144function inheritInnerComments(child, parent) {
12145 (0, _inherit.default)("innerComments", child, parent);
12146}
12147
12148/***/ }),
12149/* 63 */
12150/***/ (function(module, exports, __webpack_require__) {
12151
12152"use strict";
12153
12154
12155Object.defineProperty(exports, "__esModule", {
12156 value: true
12157});
12158exports.default = inheritLeadingComments;
12159
12160var _inherit = _interopRequireDefault(__webpack_require__(44));
12161
12162function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12163
12164function inheritLeadingComments(child, parent) {
12165 (0, _inherit.default)("leadingComments", child, parent);
12166}
12167
12168/***/ }),
12169/* 64 */
12170/***/ (function(module, exports, __webpack_require__) {
12171
12172"use strict";
12173
12174
12175Object.defineProperty(exports, "__esModule", {
12176 value: true
12177});
12178exports.default = inheritsComments;
12179
12180var _inheritTrailingComments = _interopRequireDefault(__webpack_require__(65));
12181
12182var _inheritLeadingComments = _interopRequireDefault(__webpack_require__(63));
12183
12184var _inheritInnerComments = _interopRequireDefault(__webpack_require__(62));
12185
12186function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12187
12188function inheritsComments(child, parent) {
12189 (0, _inheritTrailingComments.default)(child, parent);
12190 (0, _inheritLeadingComments.default)(child, parent);
12191 (0, _inheritInnerComments.default)(child, parent);
12192 return child;
12193}
12194
12195/***/ }),
12196/* 65 */
12197/***/ (function(module, exports, __webpack_require__) {
12198
12199"use strict";
12200
12201
12202Object.defineProperty(exports, "__esModule", {
12203 value: true
12204});
12205exports.default = inheritTrailingComments;
12206
12207var _inherit = _interopRequireDefault(__webpack_require__(44));
12208
12209function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12210
12211function inheritTrailingComments(child, parent) {
12212 (0, _inherit.default)("trailingComments", child, parent);
12213}
12214
12215/***/ }),
12216/* 66 */
12217/***/ (function(module, exports, __webpack_require__) {
12218
12219"use strict";
12220
12221
12222Object.defineProperty(exports, "__esModule", {
12223 value: true
12224});
12225exports.default = toBlock;
12226
12227var _generated = __webpack_require__(12);
12228
12229var _generated2 = __webpack_require__(15);
12230
12231function toBlock(node, parent) {
12232 if ((0, _generated.isBlockStatement)(node)) {
12233 return node;
12234 }
12235
12236 let blockNodes = [];
12237
12238 if ((0, _generated.isEmptyStatement)(node)) {
12239 blockNodes = [];
12240 } else {
12241 if (!(0, _generated.isStatement)(node)) {
12242 if ((0, _generated.isFunction)(parent)) {
12243 node = (0, _generated2.returnStatement)(node);
12244 } else {
12245 node = (0, _generated2.expressionStatement)(node);
12246 }
12247 }
12248
12249 blockNodes = [node];
12250 }
12251
12252 return (0, _generated2.blockStatement)(blockNodes);
12253}
12254
12255/***/ }),
12256/* 67 */
12257/***/ (function(module, exports, __webpack_require__) {
12258
12259"use strict";
12260
12261
12262Object.defineProperty(exports, "__esModule", {
12263 value: true
12264});
12265exports.default = toIdentifier;
12266
12267var _isValidIdentifier = _interopRequireDefault(__webpack_require__(27));
12268
12269function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12270
12271function toIdentifier(name) {
12272 name = name + "";
12273 name = name.replace(/[^a-zA-Z0-9$_]/g, "-");
12274 name = name.replace(/^[-0-9]+/, "");
12275 name = name.replace(/[-\s]+(.)?/g, function (match, c) {
12276 return c ? c.toUpperCase() : "";
12277 });
12278
12279 if (!(0, _isValidIdentifier.default)(name)) {
12280 name = `_${name}`;
12281 }
12282
12283 return name || "_";
12284}
12285
12286/***/ }),
12287/* 68 */
12288/***/ (function(module, exports, __webpack_require__) {
12289
12290"use strict";
12291
12292
12293Object.defineProperty(exports, "__esModule", {
12294 value: true
12295});
12296exports.default = removePropertiesDeep;
12297
12298var _traverseFast = _interopRequireDefault(__webpack_require__(69));
12299
12300var _removeProperties = _interopRequireDefault(__webpack_require__(70));
12301
12302function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12303
12304function removePropertiesDeep(tree, opts) {
12305 (0, _traverseFast.default)(tree, _removeProperties.default, opts);
12306 return tree;
12307}
12308
12309/***/ }),
12310/* 69 */
12311/***/ (function(module, exports, __webpack_require__) {
12312
12313"use strict";
12314
12315
12316Object.defineProperty(exports, "__esModule", {
12317 value: true
12318});
12319exports.default = traverseFast;
12320
12321var _definitions = __webpack_require__(16);
12322
12323function traverseFast(node, enter, opts) {
12324 if (!node) return;
12325 const keys = _definitions.VISITOR_KEYS[node.type];
12326 if (!keys) return;
12327 opts = opts || {};
12328 enter(node, opts);
12329
12330 for (const key of keys) {
12331 const subNode = node[key];
12332
12333 if (Array.isArray(subNode)) {
12334 for (const node of subNode) {
12335 traverseFast(node, enter, opts);
12336 }
12337 } else {
12338 traverseFast(subNode, enter, opts);
12339 }
12340 }
12341}
12342
12343/***/ }),
12344/* 70 */
12345/***/ (function(module, exports, __webpack_require__) {
12346
12347"use strict";
12348
12349
12350Object.defineProperty(exports, "__esModule", {
12351 value: true
12352});
12353exports.default = removeProperties;
12354
12355var _constants = __webpack_require__(21);
12356
12357const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"];
12358
12359const CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS);
12360
12361function removeProperties(node, opts = {}) {
12362 const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS;
12363
12364 for (const key of map) {
12365 if (node[key] != null) node[key] = undefined;
12366 }
12367
12368 for (const key in node) {
12369 if (key[0] === "_" && node[key] != null) node[key] = undefined;
12370 }
12371
12372 const symbols = Object.getOwnPropertySymbols(node);
12373
12374 for (const sym of symbols) {
12375 node[sym] = null;
12376 }
12377}
12378
12379/***/ }),
12380/* 71 */
12381/***/ (function(module, exports, __webpack_require__) {
12382
12383"use strict";
12384
12385
12386Object.defineProperty(exports, "__esModule", {
12387 value: true
12388});
12389exports.default = isLet;
12390
12391var _generated = __webpack_require__(12);
12392
12393var _constants = __webpack_require__(21);
12394
12395function isLet(node) {
12396 return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]);
12397}
12398
12399/***/ }),
12400/* 72 */
12401/***/ (function(module, exports, __webpack_require__) {
12402
12403"use strict";
12404
12405
12406Object.defineProperty(exports, "__esModule", {
12407 value: true
12408});
12409exports.ImportSpecifier = ImportSpecifier;
12410exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
12411exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
12412exports.ExportSpecifier = ExportSpecifier;
12413exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
12414exports.ExportAllDeclaration = ExportAllDeclaration;
12415exports.ExportNamedDeclaration = ExportNamedDeclaration;
12416exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
12417exports.ImportDeclaration = ImportDeclaration;
12418exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
12419
12420function t() {
12421 const data = _interopRequireWildcard(__webpack_require__(2));
12422
12423 t = function () {
12424 return data;
12425 };
12426
12427 return data;
12428}
12429
12430function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
12431
12432function ImportSpecifier(node) {
12433 if (node.importKind === "type" || node.importKind === "typeof") {
12434 this.word(node.importKind);
12435 this.space();
12436 }
12437
12438 this.print(node.imported, node);
12439
12440 if (node.local && node.local.name !== node.imported.name) {
12441 this.space();
12442 this.word("as");
12443 this.space();
12444 this.print(node.local, node);
12445 }
12446}
12447
12448function ImportDefaultSpecifier(node) {
12449 this.print(node.local, node);
12450}
12451
12452function ExportDefaultSpecifier(node) {
12453 this.print(node.exported, node);
12454}
12455
12456function ExportSpecifier(node) {
12457 this.print(node.local, node);
12458
12459 if (node.exported && node.local.name !== node.exported.name) {
12460 this.space();
12461 this.word("as");
12462 this.space();
12463 this.print(node.exported, node);
12464 }
12465}
12466
12467function ExportNamespaceSpecifier(node) {
12468 this.token("*");
12469 this.space();
12470 this.word("as");
12471 this.space();
12472 this.print(node.exported, node);
12473}
12474
12475function ExportAllDeclaration(node) {
12476 this.word("export");
12477 this.space();
12478
12479 if (node.exportKind === "type") {
12480 this.word("type");
12481 this.space();
12482 }
12483
12484 this.token("*");
12485 this.space();
12486 this.word("from");
12487 this.space();
12488 this.print(node.source, node);
12489 this.semicolon();
12490}
12491
12492function ExportNamedDeclaration(node) {
12493 if (this.format.decoratorsBeforeExport && t().isClassDeclaration(node.declaration)) {
12494 this.printJoin(node.declaration.decorators, node);
12495 }
12496
12497 this.word("export");
12498 this.space();
12499 ExportDeclaration.apply(this, arguments);
12500}
12501
12502function ExportDefaultDeclaration(node) {
12503 if (this.format.decoratorsBeforeExport && t().isClassDeclaration(node.declaration)) {
12504 this.printJoin(node.declaration.decorators, node);
12505 }
12506
12507 this.word("export");
12508 this.space();
12509 this.word("default");
12510 this.space();
12511 ExportDeclaration.apply(this, arguments);
12512}
12513
12514function ExportDeclaration(node) {
12515 if (node.declaration) {
12516 const declar = node.declaration;
12517 this.print(declar, node);
12518 if (!t().isStatement(declar)) this.semicolon();
12519 } else {
12520 if (node.exportKind === "type") {
12521 this.word("type");
12522 this.space();
12523 }
12524
12525 const specifiers = node.specifiers.slice(0);
12526 let hasSpecial = false;
12527
12528 while (true) {
12529 const first = specifiers[0];
12530
12531 if (t().isExportDefaultSpecifier(first) || t().isExportNamespaceSpecifier(first)) {
12532 hasSpecial = true;
12533 this.print(specifiers.shift(), node);
12534
12535 if (specifiers.length) {
12536 this.token(",");
12537 this.space();
12538 }
12539 } else {
12540 break;
12541 }
12542 }
12543
12544 if (specifiers.length || !specifiers.length && !hasSpecial) {
12545 this.token("{");
12546
12547 if (specifiers.length) {
12548 this.space();
12549 this.printList(specifiers, node);
12550 this.space();
12551 }
12552
12553 this.token("}");
12554 }
12555
12556 if (node.source) {
12557 this.space();
12558 this.word("from");
12559 this.space();
12560 this.print(node.source, node);
12561 }
12562
12563 this.semicolon();
12564 }
12565}
12566
12567function ImportDeclaration(node) {
12568 this.word("import");
12569 this.space();
12570
12571 if (node.importKind === "type" || node.importKind === "typeof") {
12572 this.word(node.importKind);
12573 this.space();
12574 }
12575
12576 const specifiers = node.specifiers.slice(0);
12577
12578 if (specifiers && specifiers.length) {
12579 while (true) {
12580 const first = specifiers[0];
12581
12582 if (t().isImportDefaultSpecifier(first) || t().isImportNamespaceSpecifier(first)) {
12583 this.print(specifiers.shift(), node);
12584
12585 if (specifiers.length) {
12586 this.token(",");
12587 this.space();
12588 }
12589 } else {
12590 break;
12591 }
12592 }
12593
12594 if (specifiers.length) {
12595 this.token("{");
12596 this.space();
12597 this.printList(specifiers, node);
12598 this.space();
12599 this.token("}");
12600 }
12601
12602 this.space();
12603 this.word("from");
12604 this.space();
12605 }
12606
12607 this.print(node.source, node);
12608 this.semicolon();
12609}
12610
12611function ImportNamespaceSpecifier(node) {
12612 this.token("*");
12613 this.space();
12614 this.word("as");
12615 this.space();
12616 this.print(node.local, node);
12617}
12618
12619/***/ }),
12620/* 73 */
12621/***/ (function(module, exports, __webpack_require__) {
12622
12623"use strict";
12624/**
12625 * Copyright (c) Facebook, Inc. and its affiliates.
12626 *
12627 * This source code is licensed under the MIT license found in the
12628 * LICENSE file in the root directory of this source tree.
12629 *
12630 * All rights reserved.
12631 *
12632 *
12633 * @format
12634 */
12635
12636
12637var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
12638
12639/**
12640 * A transform that inlines fragment spreads with the @relay(mask: false)
12641 * directive.
12642 */
12643function relayMaskTransform(context) {
12644 return __webpack_require__(10).transform(context, {
12645 FragmentSpread: visitFragmentSpread,
12646 Fragment: visitFragment
12647 }, function () {
12648 return {
12649 reachableArguments: []
12650 };
12651 });
12652}
12653
12654function visitFragment(fragment, state) {
12655 var result = this.traverse(fragment, state);
12656
12657 if (state.reachableArguments.length === 0) {
12658 return result;
12659 }
12660
12661 var schema = this.getContext().serverSchema;
12662 var joinedArgumentDefinitions = joinFragmentArgumentDefinitions(schema, fragment, state.reachableArguments);
12663 return (0, _objectSpread2["default"])({}, result, {
12664 argumentDefinitions: joinedArgumentDefinitions
12665 });
12666}
12667
12668function visitFragmentSpread(fragmentSpread, state) {
12669 if (!isUnmaskedSpread(fragmentSpread)) {
12670 return fragmentSpread;
12671 }
12672
12673 !(fragmentSpread.args.length === 0) ? true ? __webpack_require__(4)(false, 'RelayMaskTransform: Cannot unmask fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : undefined : void 0;
12674 var context = this.getContext();
12675 var fragment = context.getFragment(fragmentSpread.name);
12676 var result = {
12677 kind: 'InlineFragment',
12678 directives: fragmentSpread.directives,
12679 loc: {
12680 kind: 'Derived',
12681 source: fragmentSpread.loc
12682 },
12683 metadata: fragmentSpread.metadata,
12684 selections: fragment.selections,
12685 typeCondition: fragment.type
12686 };
12687 !!fragment.argumentDefinitions.find(function (argDef) {
12688 return argDef.kind === 'LocalArgumentDefinition';
12689 }) ? true ? __webpack_require__(4)(false, 'RelayMaskTransform: Cannot unmask fragment spread `%s` because it has local ' + 'argument definition.', fragmentSpread.name) : undefined : void 0; // Note: defer validating arguments to the containing fragment in order
12690 // to list all invalid variables/arguments instead of only one.
12691
12692 var _iteratorNormalCompletion = true;
12693 var _didIteratorError = false;
12694 var _iteratorError = undefined;
12695
12696 try {
12697 for (var _iterator = fragment.argumentDefinitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12698 var argDef = _step.value;
12699 state.reachableArguments.push({
12700 argDef: argDef,
12701 source: fragmentSpread.name
12702 });
12703 }
12704 } catch (err) {
12705 _didIteratorError = true;
12706 _iteratorError = err;
12707 } finally {
12708 try {
12709 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
12710 _iterator["return"]();
12711 }
12712 } finally {
12713 if (_didIteratorError) {
12714 throw _iteratorError;
12715 }
12716 }
12717 }
12718
12719 return this.traverse(result, state);
12720}
12721/**
12722 * @private
12723 */
12724
12725
12726function isUnmaskedSpread(spread) {
12727 return Boolean(spread.metadata && spread.metadata.mask === false);
12728}
12729/**
12730 * @private
12731 *
12732 * Attempts to join the argument definitions for a root fragment
12733 * and any unmasked fragment spreads reachable from that root fragment,
12734 * returning a combined list of arguments or throwing if the same
12735 * variable(s) are used in incompatible ways in different fragments.
12736 */
12737
12738
12739function joinFragmentArgumentDefinitions(schema, fragment, reachableArguments) {
12740 var joinedArgumentDefinitions = new Map();
12741 fragment.argumentDefinitions.forEach(function (prevArgDef) {
12742 joinedArgumentDefinitions.set(prevArgDef.name, prevArgDef);
12743 });
12744 var errors = [];
12745 reachableArguments.forEach(function (nextArg) {
12746 var nextArgDef = nextArg.argDef,
12747 source = nextArg.source;
12748 var prevArgDef = joinedArgumentDefinitions.get(nextArgDef.name);
12749
12750 if (prevArgDef) {
12751 var joinedArgDef = joinArgumentDefinition(schema, prevArgDef, nextArgDef);
12752
12753 if (joinedArgDef === null) {
12754 errors.push("Variable `$".concat(nextArgDef.name, "` in `").concat(source, "`"));
12755 } else {
12756 joinedArgumentDefinitions.set(joinedArgDef.name, joinedArgDef);
12757 }
12758 } else {
12759 joinedArgumentDefinitions.set(nextArgDef.name, nextArgDef);
12760 }
12761 });
12762
12763 if (errors.length) {
12764 throw new Error('RelayMaskTransform: Cannot unmask one or more fragments in ' + "`".concat(fragment.name, "`, the following variables are referenced more ") + 'than once with incompatible kinds/types:\n' + errors.map(function (msg) {
12765 return "* ".concat(msg);
12766 }).join('\n'));
12767 }
12768
12769 return Array.from(joinedArgumentDefinitions.values());
12770}
12771/**
12772 * @private
12773 *
12774 * Attempts to join two argument definitions, returning a single argument
12775 * definition that is compatible with both of the inputs:
12776 * - If the kind, name, or defaultValue is different then the arguments
12777 * cannot be joined, indicated by returning null.
12778 * - If either of next/prev is a subtype of the other, return the one
12779 * that is the subtype: a more narrow type can flow into a more general
12780 * type but not the inverse.
12781 * - Otherwise there is no subtyping relation between prev/next, so return
12782 * null to indicate they cannot be joined.
12783 */
12784
12785
12786function joinArgumentDefinition(schema, prevArgDef, nextArgDef) {
12787 if (prevArgDef.kind !== nextArgDef.kind || prevArgDef.name !== nextArgDef.name || // Only LocalArgumentDefinition defines defaultValue
12788 prevArgDef.defaultValue !== nextArgDef.defaultValue) {
12789 return null;
12790 } else if (__webpack_require__(0).isTypeSubTypeOf(schema, nextArgDef.type, prevArgDef.type)) {
12791 // prevArgDef is less strict than nextArgDef
12792 return nextArgDef;
12793 } else if (__webpack_require__(0).isTypeSubTypeOf(schema, prevArgDef.type, nextArgDef.type)) {
12794 return prevArgDef;
12795 } else {
12796 return null;
12797 }
12798}
12799
12800module.exports = {
12801 transform: relayMaskTransform
12802};
12803
12804/***/ }),
12805/* 74 */
12806/***/ (function(module, exports, __webpack_require__) {
12807
12808"use strict";
12809/**
12810 * Copyright (c) Facebook, Inc. and its affiliates.
12811 *
12812 * This source code is licensed under the MIT license found in the
12813 * LICENSE file in the root directory of this source tree.
12814 *
12815 * strict
12816 * @format
12817 */
12818
12819
12820function getNormalizationOperationName(name) {
12821 return "".concat(name, "$normalization");
12822}
12823
12824module.exports = getNormalizationOperationName;
12825
12826/***/ }),
12827/* 75 */
12828/***/ (function(module, exports, __webpack_require__) {
12829
12830"use strict";
12831/**
12832 * Copyright (c) Facebook, Inc. and its affiliates.
12833 *
12834 * This source code is licensed under the MIT license found in the
12835 * LICENSE file in the root directory of this source tree.
12836 *
12837 *
12838 * @format
12839 */
12840
12841
12842/**
12843 * Generates an identifier that is unique to a given selection: the alias for
12844 * fields, the type for inline fragments, and a summary of the condition
12845 * variable and passing value for conditions.
12846 */
12847function getIdentifierForSelection(node) {
12848 if (node.kind === 'LinkedField' || node.kind === 'ScalarField') {
12849 return node.directives.length === 0 ? node.alias || node.name : (node.alias || node.name) + __webpack_require__(49).printDirectives(node.directives);
12850 } else if (node.kind === 'FragmentSpread') {
12851 return node.args.length === 0 ? '...' + node.name : '...' + node.name + __webpack_require__(49).printArguments(node.args);
12852 } else if (node.kind === 'MatchField') {
12853 var _node$metadata;
12854
12855 var storageKey = (_node$metadata = node.metadata) === null || _node$metadata === void 0 ? void 0 : _node$metadata.storageKey;
12856 !(typeof storageKey === 'string') ? true ? __webpack_require__(4)(false, 'getIdentifierForSelection: Expected MatchField `%s` to have a precomputed storageKey.', node.name) : undefined : void 0;
12857 return 'M:' + storageKey;
12858 } else if (node.kind === 'MatchBranch') {
12859 return 'B:' + node.name + '$' + node.module;
12860 } else if (node.kind === 'Defer') {
12861 return 'D:' + node.label;
12862 } else if (node.kind === 'Stream') {
12863 return 'S:' + node.label;
12864 } else if (node.kind === 'InlineFragment') {
12865 return 'I:' + node.typeCondition.name;
12866 } else if (node.kind === 'Condition') {
12867 return 'C:' + (node.condition.kind === 'Variable' ? '$' + node.condition.variableName : String(node.condition.value)) + String(node.passingValue);
12868 } else {
12869 true ? true ? __webpack_require__(4)(false, 'getIdentifierForSelection: Unexpected kind `%s`.', node.kind) : undefined : undefined;
12870 }
12871}
12872
12873module.exports = getIdentifierForSelection;
12874
12875/***/ }),
12876/* 76 */
12877/***/ (function(module, exports, __webpack_require__) {
12878
12879"use strict";
12880/**
12881 * Copyright (c) Facebook, Inc. and its affiliates.
12882 *
12883 * This source code is licensed under the MIT license found in the
12884 * LICENSE file in the root directory of this source tree.
12885 *
12886 * strict
12887 * @format
12888 */
12889
12890
12891module.exports = {
12892 DEFAULT_HANDLE_KEY: ''
12893};
12894
12895/***/ }),
12896/* 77 */
12897/***/ (function(module, exports) {
12898
12899module.exports = require("fb-watchman");
12900
12901/***/ }),
12902/* 78 */
12903/***/ (function(module, exports) {
12904
12905module.exports = require("os");
12906
12907/***/ }),
12908/* 79 */
12909/***/ (function(module, exports, __webpack_require__) {
12910
12911"use strict";
12912/**
12913 * Copyright (c) Facebook, Inc. and its affiliates.
12914 *
12915 * This source code is licensed under the MIT license found in the
12916 * LICENSE file in the root directory of this source tree.
12917 *
12918 *
12919 * @format
12920 */
12921
12922
12923var ASTCache =
12924/*#__PURE__*/
12925function () {
12926 function ASTCache(config) {
12927 this._documents = new Map();
12928 this._baseDir = config.baseDir;
12929 this._parse = __webpack_require__(7).instrument(config.parse, 'ASTCache.parseFn');
12930 } // Short-term: we don't do subscriptions/delta updates, instead always use all definitions
12931
12932
12933 var _proto = ASTCache.prototype;
12934
12935 _proto.documents = function documents() {
12936 return __webpack_require__(25).Map(this._documents);
12937 }; // parse should return the set of changes
12938
12939
12940 _proto.parseFiles = function parseFiles(files) {
12941 var _this = this;
12942
12943 var documents = __webpack_require__(25).Map();
12944
12945 files.forEach(function (file) {
12946 if (!file.exists) {
12947 _this._documents["delete"](file.relPath);
12948
12949 return;
12950 }
12951
12952 var doc = function () {
12953 try {
12954 return _this._parse(_this._baseDir, file);
12955 } catch (error) {
12956 throw new Error("Parse error: ".concat(error, " in \"").concat(file.relPath, "\""));
12957 }
12958 }();
12959
12960 if (!doc) {
12961 _this._documents["delete"](file.relPath);
12962
12963 return;
12964 }
12965
12966 documents = documents.set(file.relPath, doc);
12967
12968 _this._documents.set(file.relPath, doc);
12969 });
12970 return documents;
12971 };
12972
12973 return ASTCache;
12974}();
12975
12976module.exports = ASTCache;
12977
12978/***/ }),
12979/* 80 */
12980/***/ (function(module, exports, __webpack_require__) {
12981
12982"use strict";
12983/**
12984 * Copyright (c) Facebook, Inc. and its affiliates.
12985 *
12986 * This source code is licensed under the MIT license found in the
12987 * LICENSE file in the root directory of this source tree.
12988 *
12989 * strict-local
12990 * @format
12991 */
12992
12993
12994var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
12995
12996function DisallowIdAsAliasValidationRule(context) {
12997 return {
12998 Field: function Field(field) {
12999 if (field.alias && field.alias.value === 'id' && field.name.value !== 'id') {
13000 throw new Error('RelayValidator: Relay does not allow aliasing fields to `id`. ' + 'This name is reserved for the globally unique `id` field on ' + '`Node`.');
13001 }
13002 }
13003 };
13004}
13005
13006var relayLocalRules = (0, _toConsumableArray2["default"])(__webpack_require__(37).LOCAL_RULES).concat([DisallowIdAsAliasValidationRule]);
13007module.exports = {
13008 GLOBAL_RULES: __webpack_require__(37).GLOBAL_RULES,
13009 LOCAL_RULES: relayLocalRules,
13010 validate: __webpack_require__(37).validate
13011};
13012
13013/***/ }),
13014/* 81 */
13015/***/ (function(module, exports, __webpack_require__) {
13016
13017"use strict";
13018/**
13019 * Copyright (c) Facebook, Inc. and its affiliates.
13020 *
13021 * This source code is licensed under the MIT license found in the
13022 * LICENSE file in the root directory of this source tree.
13023 *
13024 *
13025 * @format
13026 */
13027
13028
13029var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
13030
13031var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
13032
13033var ARGUMENT_DEFINITIONS = 'argumentDefinitions';
13034var ARGUMENTS = 'arguments';
13035/**
13036 * @internal
13037 *
13038 * This directive is not intended for use by developers directly. To set a field
13039 * handle in product code use a compiler plugin.
13040 */
13041
13042var CLIENT_FIELD = '__clientField';
13043var CLIENT_FIELD_HANDLE = 'handle';
13044var CLIENT_FIELD_KEY = 'key';
13045var CLIENT_FIELD_FILTERS = 'filters';
13046var INCLUDE = 'include';
13047var SKIP = 'skip';
13048var IF = 'if';
13049/**
13050 * Transforms GraphQL text into Relay Compiler's internal, strongly-typed
13051 * intermediate representation (IR).
13052 */
13053
13054function parse(schema, text, filename) {
13055 var ast = __webpack_require__(0).parse(new (__webpack_require__(0).Source)(text, filename)); // TODO T24511737 figure out if this is dangerous
13056
13057
13058 schema = __webpack_require__(0).extendSchema(schema, ast, {
13059 assumeValid: true
13060 });
13061 var parser = new RelayParser(schema, ast.definitions);
13062 return parser.transform();
13063}
13064/**
13065 * Transforms untyped GraphQL parse trees (ASTs) into Relay Compiler's
13066 * internal, strongly-typed intermediate representation (IR).
13067 */
13068
13069
13070function transform(schema, definitions) {
13071 return __webpack_require__(7).run('RelayParser.transform', function () {
13072 var parser = new RelayParser(schema, definitions);
13073 return parser.transform();
13074 });
13075}
13076/**
13077 * @private
13078 */
13079
13080
13081var RelayParser =
13082/*#__PURE__*/
13083function () {
13084 function RelayParser(schema, definitions) {
13085 var _this = this;
13086
13087 this._definitions = new Map(); // leaving this configurable to make it easy to experiment w changing later
13088
13089 this._getFieldDefinition = __webpack_require__(196).getFieldDefinitionLegacy;
13090 this._schema = schema;
13091 var duplicated = new Set();
13092 definitions.forEach(function (def) {
13093 if (__webpack_require__(3).isExecutableDefinitionAST(def)) {
13094 var name = getName(def);
13095
13096 if (_this._definitions.has(name)) {
13097 duplicated.add(name);
13098 return;
13099 }
13100
13101 _this._definitions.set(name, def);
13102 }
13103 });
13104
13105 if (duplicated.size) {
13106 throw new Error('RelayParser: Encountered duplicate defintitions for one or more ' + 'documents: each document must have a unique name. Duplicated documents:\n' + Array.from(duplicated, function (name) {
13107 return "- ".concat(name);
13108 }).join('\n'));
13109 }
13110 }
13111
13112 var _proto = RelayParser.prototype;
13113
13114 _proto.transform = function transform() {
13115 var _this2 = this;
13116
13117 var errors;
13118 var nodes = [];
13119 var entries = new Map(); // Construct a mapping of name to definition ast + variable definitions.
13120 // This allows the subsequent AST -> IR tranformation to reference the
13121 // defined arguments of referenced fragments.
13122
13123 errors = __webpack_require__(1).eachWithErrors(this._definitions, function (_ref2) {
13124 var name = _ref2[0],
13125 definition = _ref2[1];
13126
13127 var variableDefinitions = _this2._buildArgumentDefinitions(definition);
13128
13129 entries.set(name, {
13130 definition: definition,
13131 variableDefinitions: variableDefinitions
13132 });
13133 }); // Convert the ASTs to IR.
13134
13135 if (errors == null) {
13136 errors = __webpack_require__(1).eachWithErrors(entries.values(), function (_ref3) {
13137 var definition = _ref3.definition,
13138 variableDefinitions = _ref3.variableDefinitions;
13139 var node = parseDefinition(_this2._schema, _this2._getFieldDefinition, entries, definition, variableDefinitions);
13140 nodes.push(node);
13141 });
13142 }
13143
13144 if (errors != null && errors.length !== 0) {
13145 throw __webpack_require__(1).createCombinedError(errors, 'RelayParser');
13146 }
13147
13148 return nodes;
13149 };
13150 /**
13151 * Constructs a mapping of variable names to definitions for the given
13152 * operation/fragment definition.
13153 */
13154
13155
13156 _proto._buildArgumentDefinitions = function _buildArgumentDefinitions(definition) {
13157 switch (definition.kind) {
13158 case 'OperationDefinition':
13159 return this._buildOperationArgumentDefinitions(definition);
13160
13161 case 'FragmentDefinition':
13162 return this._buildFragmentArgumentDefinitions(definition);
13163
13164 default:
13165 definition;
13166 throw __webpack_require__(1).createCompilerError("Unexpected ast kind '".concat(definition.kind, "'."), [definition]);
13167 }
13168 };
13169 /**
13170 * Constructs a mapping of variable names to definitions using the
13171 * variables defined in `@argumentDefinitions`.
13172 */
13173
13174
13175 _proto._buildFragmentArgumentDefinitions = function _buildFragmentArgumentDefinitions(fragment) {
13176 var _this3 = this;
13177
13178 var variableDirectives = (fragment.directives || []).filter(function (directive) {
13179 return getName(directive) === ARGUMENT_DEFINITIONS;
13180 });
13181
13182 if (!variableDirectives.length) {
13183 return new Map();
13184 }
13185
13186 if (variableDirectives.length !== 1) {
13187 throw __webpack_require__(1).createUserError("Directive @".concat(ARGUMENT_DEFINITIONS, " may be defined at most once per ") + 'fragment.', null, variableDirectives);
13188 }
13189
13190 var variableDirective = variableDirectives[0]; // $FlowIssue: refining directly on `variableDirective.arguments` doesn't
13191 // work, below accesses all report arguments could still be null/undefined.
13192
13193 var args = variableDirective.arguments;
13194
13195 if (variableDirective == null || !Array.isArray(args)) {
13196 return new Map();
13197 }
13198
13199 if (!args.length) {
13200 throw __webpack_require__(1).createUserError("Directive @".concat(ARGUMENT_DEFINITIONS, " requires arguments: remove the ") + 'directive to skip defining local variables for this fragment.', null, [variableDirective]);
13201 }
13202
13203 var variables = new Map();
13204 args.forEach(function (arg) {
13205 var argName = getName(arg);
13206 var previousVariable = variables.get(argName);
13207
13208 if (previousVariable != null) {
13209 throw __webpack_require__(1).createUserError("Duplicate definition for variable '$".concat(argName, "'."), null, [previousVariable.ast, arg]);
13210 }
13211
13212 var value = transformLiteralValue(arg.value, arg);
13213
13214 if (Array.isArray(value) || typeof value !== 'object' || value === null || typeof value.type !== 'string') {
13215 throw __webpack_require__(1).createUserError("Expected definition for variable '$".concat(argName, "' to be an object ") + "with the shape: '{type: string, defaultValue?: mixed, nonNull?: " + "boolean, list?: boolean}'.", null, [arg.value]);
13216 }
13217
13218 var unknownKeys = Object.keys(value).filter(function (key) {
13219 return key !== 'type' && key !== 'defaultValue' && key !== 'nonNull' && key !== 'list';
13220 });
13221
13222 if (unknownKeys.length !== 0) {
13223 var unknownKeysString = "'" + unknownKeys.join("', '") + "'";
13224 throw __webpack_require__(1).createUserError("Expected definition for variable '$".concat(argName, "' to be an object ") + "with the following shape: '{type: string, defaultValue?: mixed, " + "nonNull?: boolean, list?: boolean}', got unknown key(s) " + "".concat(unknownKeysString, "."), null, [arg]);
13225 }
13226
13227 var typeAST = __webpack_require__(0).parseType(String(value.type));
13228
13229 var type = __webpack_require__(0).assertInputType(__webpack_require__(3).getTypeFromAST(_this3._schema, typeAST));
13230
13231 variables.set(argName, {
13232 ast: arg,
13233 defaultValue: value.defaultValue != null ? value.defaultValue : null,
13234 defined: true,
13235 name: argName,
13236 type: type
13237 });
13238 });
13239 return variables;
13240 };
13241 /**
13242 * Constructs a mapping of variable names to definitions using the
13243 * standard GraphQL syntax for variable definitions.
13244 */
13245
13246
13247 _proto._buildOperationArgumentDefinitions = function _buildOperationArgumentDefinitions(operation) {
13248 var _this4 = this;
13249
13250 var variableDefinitions = new Map();
13251 (operation.variableDefinitions || []).forEach(function (def) {
13252 var name = getName(def.variable);
13253
13254 var type = __webpack_require__(0).assertInputType(__webpack_require__(3).getTypeFromAST(_this4._schema, def.type));
13255
13256 var defaultValue = def.defaultValue ? transformLiteralValue(def.defaultValue, def) : null;
13257 var previousDefinition = variableDefinitions.get(name);
13258
13259 if (previousDefinition != null) {
13260 throw __webpack_require__(1).createUserError("Duplicate definition for variable '$".concat(name, "'."), null, [previousDefinition.ast, def]);
13261 }
13262
13263 variableDefinitions.set(name, {
13264 ast: def,
13265 defaultValue: defaultValue,
13266 defined: true,
13267 name: name,
13268 type: type
13269 });
13270 });
13271 return variableDefinitions;
13272 };
13273
13274 return RelayParser;
13275}();
13276/**
13277 * @private
13278 */
13279
13280
13281function parseDefinition(schema, getFieldDefinition, entries, definition, variableDefinitions) {
13282 var parser = new GraphQLDefinitionParser(schema, getFieldDefinition, entries, definition, variableDefinitions);
13283 return parser.transform();
13284}
13285/**
13286 * @private
13287 */
13288
13289
13290var GraphQLDefinitionParser =
13291/*#__PURE__*/
13292function () {
13293 function GraphQLDefinitionParser(schema, getFieldDefinition, entries, definition, variableDefinitions) {
13294 this._definition = definition;
13295 this._entries = entries;
13296 this._getFieldDefinition = getFieldDefinition;
13297 this._schema = schema;
13298 this._variableDefinitions = variableDefinitions;
13299 this._unknownVariables = new Map();
13300 }
13301
13302 var _proto2 = GraphQLDefinitionParser.prototype;
13303
13304 _proto2.transform = function transform() {
13305 var definition = this._definition;
13306
13307 switch (definition.kind) {
13308 case 'OperationDefinition':
13309 return this._transformOperation(definition);
13310
13311 case 'FragmentDefinition':
13312 return this._transformFragment(definition);
13313
13314 default:
13315 definition;
13316 throw __webpack_require__(1).createCompilerError("Unsupported definition type ".concat(definition.kind), [definition]);
13317 }
13318 };
13319
13320 _proto2._getErrorContext = function _getErrorContext() {
13321 var message = "document `".concat(getName(this._definition), "`");
13322
13323 if (this._definition.loc && this._definition.loc.source) {
13324 message += " file: `".concat(this._definition.loc.source.name, "`");
13325 }
13326
13327 return message;
13328 };
13329
13330 _proto2._recordAndVerifyVariableReference = function _recordAndVerifyVariableReference(variable, name, usedAsType) {
13331 // Special case for variables used in @arguments where we currently
13332 // aren't guaranteed to be able to resolve the type.
13333 if (usedAsType == null) {
13334 if (!this._variableDefinitions.has(name) && !this._unknownVariables.has(name)) {
13335 this._unknownVariables.set(name, {
13336 ast: variable,
13337 type: null
13338 });
13339 }
13340
13341 return;
13342 }
13343
13344 var variableDefinition = this._variableDefinitions.get(name);
13345
13346 if (variableDefinition != null) {
13347 // If the variable is defined, all usages must be compatible
13348 var effectiveType = variableDefinition.type;
13349
13350 if (variableDefinition.defaultValue != null) {
13351 // If a default value is defined then it is guaranteed to be used
13352 // at runtime such that the effective type of the variable is non-null
13353 effectiveType = new (__webpack_require__(0).GraphQLNonNull)(__webpack_require__(3).getNullableType(effectiveType));
13354 }
13355
13356 if (!__webpack_require__(0).isTypeSubTypeOf(this._schema, effectiveType, usedAsType)) {
13357 throw __webpack_require__(1).createUserError("Variable '$".concat(name, "' was defined as type '").concat(String(variableDefinition.type), "' but used in a location expecting the type '").concat(String(usedAsType), "'"), null, [variableDefinition.ast, variable]);
13358 }
13359 } else {
13360 var previous = this._unknownVariables.get(name);
13361
13362 if (!previous || !previous.type) {
13363 // No previous usage, current type is strongest
13364 this._unknownVariables.set(name, {
13365 ast: variable,
13366 type: usedAsType
13367 });
13368 } else {
13369 var previousType = previous.type,
13370 previousVariable = previous.ast;
13371
13372 if (!(__webpack_require__(0).isTypeSubTypeOf(this._schema, usedAsType, previousType) || __webpack_require__(0).isTypeSubTypeOf(this._schema, previousType, usedAsType))) {
13373 throw __webpack_require__(1).createUserError("Variable '$".concat(name, "' was used in locations expecting the conflicting types '").concat(String(previousType), "' and '").concat(String(usedAsType), "'. Source: ").concat(this._getErrorContext()), null, [previousVariable, variable]);
13374 } // If the new used type has stronger requirements, use that type as reference,
13375 // otherwise keep referencing the previous type
13376
13377
13378 if (__webpack_require__(0).isTypeSubTypeOf(this._schema, usedAsType, previousType)) {
13379 this._unknownVariables.set(name, {
13380 ast: variable,
13381 type: usedAsType
13382 });
13383 }
13384 }
13385 }
13386 };
13387
13388 _proto2._transformFragment = function _transformFragment(fragment) {
13389 var directives = this._transformDirectives((fragment.directives || []).filter(function (directive) {
13390 return getName(directive) !== ARGUMENT_DEFINITIONS;
13391 }));
13392
13393 var type = __webpack_require__(0).assertCompositeType(__webpack_require__(3).getTypeFromAST(this._schema, fragment.typeCondition));
13394
13395 var selections = this._transformSelections(fragment.selectionSet, type);
13396
13397 var argumentDefinitions = (0, _toConsumableArray2["default"])(buildArgumentDefinitions(this._variableDefinitions));
13398 var _iteratorNormalCompletion = true;
13399 var _didIteratorError = false;
13400 var _iteratorError = undefined;
13401
13402 try {
13403 for (var _iterator = this._unknownVariables[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
13404 var _step$value = _step.value,
13405 name = _step$value[0],
13406 variableReference = _step$value[1];
13407 argumentDefinitions.push({
13408 kind: 'RootArgumentDefinition',
13409 loc: buildLocation(variableReference.ast.loc),
13410 metadata: null,
13411 name: name,
13412 // $FlowFixMe - could be null
13413 type: variableReference.type
13414 });
13415 }
13416 } catch (err) {
13417 _didIteratorError = true;
13418 _iteratorError = err;
13419 } finally {
13420 try {
13421 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
13422 _iterator["return"]();
13423 }
13424 } finally {
13425 if (_didIteratorError) {
13426 throw _iteratorError;
13427 }
13428 }
13429 }
13430
13431 return {
13432 kind: 'Fragment',
13433 directives: directives,
13434 loc: buildLocation(fragment.loc),
13435 metadata: null,
13436 name: getName(fragment),
13437 selections: selections,
13438 type: type,
13439 argumentDefinitions: argumentDefinitions
13440 };
13441 };
13442
13443 _proto2._transformOperation = function _transformOperation(definition) {
13444 var name = getName(definition);
13445
13446 var directives = this._transformDirectives(definition.directives || []);
13447
13448 var type;
13449 var operation;
13450
13451 switch (definition.operation) {
13452 case 'query':
13453 operation = 'query';
13454 type = __webpack_require__(0).assertCompositeType(this._schema.getQueryType());
13455 break;
13456
13457 case 'mutation':
13458 operation = 'mutation';
13459 type = __webpack_require__(0).assertCompositeType(this._schema.getMutationType());
13460 break;
13461
13462 case 'subscription':
13463 operation = 'subscription';
13464 type = __webpack_require__(0).assertCompositeType(this._schema.getSubscriptionType());
13465 break;
13466
13467 default:
13468 definition.operation;
13469 throw __webpack_require__(1).createCompilerError("Unknown ast kind '".concat(definition.operation, "'. Source: ").concat(this._getErrorContext(), "."), null, [definition]);
13470 }
13471
13472 if (!definition.selectionSet) {
13473 throw __webpack_require__(1).createUserError("Expected operation to have selections. Source: ".concat(this._getErrorContext()), null, [definition]);
13474 }
13475
13476 var selections = this._transformSelections(definition.selectionSet, type);
13477
13478 var argumentDefinitions = buildArgumentDefinitions(this._variableDefinitions);
13479
13480 if (this._unknownVariables.size !== 0) {
13481 throw __webpack_require__(1).createUserError("Query '".concat(name, "' references undefined variables."), null, Array.from(this._unknownVariables.values(), function (variableReference) {
13482 return variableReference.ast;
13483 }));
13484 }
13485
13486 return {
13487 kind: 'Root',
13488 operation: operation,
13489 loc: buildLocation(definition.loc),
13490 metadata: null,
13491 name: name,
13492 argumentDefinitions: argumentDefinitions,
13493 directives: directives,
13494 selections: selections,
13495 type: type
13496 };
13497 };
13498
13499 _proto2._transformSelections = function _transformSelections(selectionSet, parentType) {
13500 var _this5 = this;
13501
13502 return selectionSet.selections.map(function (selection) {
13503 var node;
13504
13505 if (selection.kind === 'Field') {
13506 node = _this5._transformField(selection, parentType);
13507 } else if (selection.kind === 'FragmentSpread') {
13508 node = _this5._transformFragmentSpread(selection, parentType);
13509 } else if (selection.kind === 'InlineFragment') {
13510 node = _this5._transformInlineFragment(selection, parentType);
13511 } else {
13512 selection.kind;
13513 throw __webpack_require__(1).createCompilerError("Unknown ast kind '".concat(selection.kind, "'. Source: ").concat(_this5._getErrorContext(), "."), [selection]);
13514 }
13515
13516 var _this5$_splitConditio = _this5._splitConditions(node.directives),
13517 conditions = _this5$_splitConditio[0],
13518 directives = _this5$_splitConditio[1];
13519
13520 var conditionalNodes = applyConditions(conditions, // $FlowFixMe(>=0.28.0)
13521 [(0, _objectSpread2["default"])({}, node, {
13522 directives: directives
13523 })]);
13524
13525 if (conditionalNodes.length !== 1) {
13526 throw __webpack_require__(1).createCompilerError("Expected exactly one condition node. Source: ".concat(_this5._getErrorContext()), null, selection.directives);
13527 }
13528
13529 return conditionalNodes[0];
13530 });
13531 };
13532
13533 _proto2._transformInlineFragment = function _transformInlineFragment(fragment, parentType) {
13534 var typeCondition = __webpack_require__(0).assertCompositeType(fragment.typeCondition ? __webpack_require__(3).getTypeFromAST(this._schema, fragment.typeCondition) : parentType);
13535
13536 var directives = this._transformDirectives(fragment.directives || []);
13537
13538 var selections = this._transformSelections(fragment.selectionSet, typeCondition);
13539
13540 return {
13541 kind: 'InlineFragment',
13542 directives: directives,
13543 loc: buildLocation(fragment.loc),
13544 metadata: null,
13545 selections: selections,
13546 typeCondition: typeCondition
13547 };
13548 };
13549
13550 _proto2._transformFragmentSpread = function _transformFragmentSpread(fragmentSpread, parentType) {
13551 var _this6 = this;
13552
13553 var fragmentName = getName(fragmentSpread);
13554
13555 var _partitionArray = partitionArray(fragmentSpread.directives || [], function (directive) {
13556 return getName(directive) !== ARGUMENTS;
13557 }),
13558 otherDirectives = _partitionArray[0],
13559 argumentDirectives = _partitionArray[1];
13560
13561 if (argumentDirectives.length > 1) {
13562 throw __webpack_require__(1).createUserError("Directive @".concat(ARGUMENTS, " may be used at most once per a fragment spread. ") + "Source: ".concat(this._getErrorContext()), null, argumentDirectives);
13563 }
13564
13565 var fragmentDefinition = this._entries.get(fragmentName);
13566
13567 var fragmentArgumentDefinitions = fragmentDefinition === null || fragmentDefinition === void 0 ? void 0 : fragmentDefinition.variableDefinitions;
13568 var args;
13569
13570 if (argumentDirectives.length) {
13571 args = (argumentDirectives[0].arguments || []).map(function (arg) {
13572 var _ref;
13573
13574 var argName = getName(arg);
13575 var argValue = arg.value;
13576 var argumentDefinition = fragmentArgumentDefinitions != null ? fragmentArgumentDefinitions.get(argName) : null;
13577 var argumentType = (_ref = argumentDefinition === null || argumentDefinition === void 0 ? void 0 : argumentDefinition.type) !== null && _ref !== void 0 ? _ref : null;
13578
13579 if (argValue.kind === 'Variable') {
13580 // TODO: check the type of the variable and use the type
13581 return {
13582 kind: 'Argument',
13583 loc: buildLocation(arg.loc),
13584 metadata: null,
13585 name: argName,
13586 value: _this6._transformVariable(argValue, null),
13587 type: null
13588 };
13589 } else {
13590 if (argumentType == null) {
13591 var _this$_entries$get;
13592
13593 throw __webpack_require__(1).createUserError("Literal @".concat(ARGUMENTS, " values are only supported when the ") + "argument is defined with @".concat(ARGUMENT_DEFINITIONS, ". Check ") + "the definition of fragment '".concat(fragmentName, "'."), null, [arg.value, (_this$_entries$get = _this6._entries.get(fragmentName)) === null || _this$_entries$get === void 0 ? void 0 : _this$_entries$get.definition].filter(Boolean));
13594 }
13595
13596 var _value = _this6._transformValue(argValue, argumentType);
13597
13598 return {
13599 kind: 'Argument',
13600 loc: buildLocation(arg.loc),
13601 metadata: null,
13602 name: argName,
13603 value: _value,
13604 type: argumentType
13605 };
13606 }
13607 });
13608 }
13609
13610 var directives = this._transformDirectives(otherDirectives);
13611
13612 return {
13613 kind: 'FragmentSpread',
13614 args: args || [],
13615 metadata: null,
13616 loc: buildLocation(fragmentSpread.loc),
13617 name: fragmentName,
13618 directives: directives
13619 };
13620 };
13621
13622 _proto2._transformField = function _transformField(field, parentType) {
13623 var name = getName(field);
13624
13625 var fieldDef = this._getFieldDefinition(this._schema, parentType, name, field);
13626
13627 if (fieldDef == null) {
13628 throw __webpack_require__(1).createUserError("Unknown field '".concat(name, "' on type '").concat(String(parentType), "'. Source: ").concat(this._getErrorContext()), null, [field]);
13629 }
13630
13631 var alias = field.alias ? field.alias.value : null;
13632
13633 var args = this._transformArguments(field.arguments || [], fieldDef.args);
13634
13635 var _partitionArray2 = partitionArray(field.directives || [], function (directive) {
13636 return getName(directive) !== CLIENT_FIELD;
13637 }),
13638 otherDirectives = _partitionArray2[0],
13639 clientFieldDirectives = _partitionArray2[1];
13640
13641 var directives = this._transformDirectives(otherDirectives);
13642
13643 var type = __webpack_require__(0).assertOutputType(fieldDef.type);
13644
13645 var handles = this._transformHandle(name, args, clientFieldDirectives);
13646
13647 if (__webpack_require__(0).isLeafType(__webpack_require__(0).getNamedType(type))) {
13648 if (field.selectionSet && field.selectionSet.selections && field.selectionSet.selections.length) {
13649 throw __webpack_require__(1).createUserError("Expected no selections for scalar field '".concat(name, "'. Source: ").concat(this._getErrorContext()), null, [field]);
13650 }
13651
13652 return {
13653 kind: 'ScalarField',
13654 alias: alias,
13655 args: args,
13656 directives: directives,
13657 handles: handles,
13658 loc: buildLocation(field.loc),
13659 metadata: null,
13660 name: name,
13661 type: assertScalarFieldType(type)
13662 };
13663 } else {
13664 var selections = field.selectionSet ? this._transformSelections(field.selectionSet, type) : null;
13665
13666 if (selections == null || selections.length === 0) {
13667 throw __webpack_require__(1).createUserError("Expected at least one selection for non-scalar field '".concat(name, "' on type '").concat(String(type), "'. Source: ").concat(this._getErrorContext(), "."), null, [field]);
13668 }
13669
13670 return {
13671 kind: 'LinkedField',
13672 alias: alias,
13673 args: args,
13674 directives: directives,
13675 handles: handles,
13676 loc: buildLocation(field.loc),
13677 metadata: null,
13678 name: name,
13679 selections: selections,
13680 type: type
13681 };
13682 }
13683 };
13684
13685 _proto2._transformHandle = function _transformHandle(fieldName, fieldArgs, clientFieldDirectives) {
13686 var _this7 = this;
13687
13688 var handles;
13689 clientFieldDirectives.forEach(function (clientFieldDirective) {
13690 var handleArgument = (clientFieldDirective.arguments || []).find(function (arg) {
13691 return getName(arg) === CLIENT_FIELD_HANDLE;
13692 });
13693
13694 if (handleArgument) {
13695 var name = null;
13696
13697 var key = __webpack_require__(76).DEFAULT_HANDLE_KEY;
13698
13699 var filters = null;
13700 var maybeHandle = transformLiteralValue(handleArgument.value, handleArgument);
13701
13702 if (typeof maybeHandle !== 'string') {
13703 throw __webpack_require__(1).createUserError("Expected a string literal argument for the @".concat(CLIENT_FIELD, " directive. ") + "Source: ".concat(_this7._getErrorContext()), null, [handleArgument.value]);
13704 }
13705
13706 name = maybeHandle;
13707 var keyArgument = (clientFieldDirective.arguments || []).find(function (arg) {
13708 return getName(arg) === CLIENT_FIELD_KEY;
13709 });
13710
13711 if (keyArgument) {
13712 var maybeKey = transformLiteralValue(keyArgument.value, keyArgument);
13713
13714 if (typeof maybeKey !== 'string') {
13715 throw __webpack_require__(1).createUserError("Expected a string literal argument for the @".concat(CLIENT_FIELD, " directive. ") + "Source: ".concat(_this7._getErrorContext()), null, [keyArgument.value]);
13716 }
13717
13718 key = maybeKey;
13719 }
13720
13721 var filtersArgument = (clientFieldDirective.arguments || []).find(function (arg) {
13722 return getName(arg) === CLIENT_FIELD_FILTERS;
13723 });
13724
13725 if (filtersArgument) {
13726 var maybeFilters = transformLiteralValue(filtersArgument.value, filtersArgument);
13727
13728 if (!(Array.isArray(maybeFilters) && maybeFilters.every(function (filter) {
13729 return typeof filter === 'string' && fieldArgs.some(function (fieldArg) {
13730 return fieldArg.name === filter;
13731 });
13732 }))) {
13733 throw __webpack_require__(1).createUserError("Expected an array of argument names on field '".concat(fieldName, "'. ") + "Source: ".concat(_this7._getErrorContext()), null, [filtersArgument.value]);
13734 } // $FlowFixMe
13735
13736
13737 filters = maybeFilters;
13738 }
13739
13740 handles = handles || [];
13741 handles.push({
13742 name: name,
13743 key: key,
13744 filters: filters
13745 });
13746 }
13747 });
13748 return handles;
13749 };
13750
13751 _proto2._transformDirectives = function _transformDirectives(directives) {
13752 var _this8 = this;
13753
13754 return directives.map(function (directive) {
13755 var name = getName(directive);
13756
13757 var directiveDef = _this8._schema.getDirective(name);
13758
13759 if (directiveDef == null) {
13760 throw __webpack_require__(1).createUserError("Unknown directive '".concat(name, "'. Source: ").concat(_this8._getErrorContext()), null, [directive]);
13761 }
13762
13763 var args = _this8._transformArguments(directive.arguments || [], directiveDef.args);
13764
13765 return {
13766 kind: 'Directive',
13767 loc: buildLocation(directive.loc),
13768 metadata: null,
13769 name: name,
13770 args: args
13771 };
13772 });
13773 };
13774
13775 _proto2._transformArguments = function _transformArguments(args, argumentDefinitions) {
13776 var _this9 = this;
13777
13778 return args.map(function (arg) {
13779 var argName = getName(arg);
13780 var argDef = argumentDefinitions.find(function (def) {
13781 return def.name === argName;
13782 });
13783
13784 if (argDef == null) {
13785 throw __webpack_require__(1).createUserError("Unknown argument '".concat(argName, "'. Source: ").concat(_this9._getErrorContext()), null, [arg]);
13786 }
13787
13788 var value = _this9._transformValue(arg.value, argDef.type);
13789
13790 return {
13791 kind: 'Argument',
13792 loc: buildLocation(arg.loc),
13793 metadata: null,
13794 name: argName,
13795 value: value,
13796 type: argDef.type
13797 };
13798 });
13799 };
13800
13801 _proto2._splitConditions = function _splitConditions(mixedDirectives) {
13802 var _this10 = this;
13803
13804 var _partitionArray3 = partitionArray(mixedDirectives, function (directive) {
13805 return directive.name === INCLUDE || directive.name === SKIP;
13806 }),
13807 conditionDirectives = _partitionArray3[0],
13808 otherDirectives = _partitionArray3[1];
13809
13810 var conditions = conditionDirectives.map(function (directive) {
13811 var passingValue = directive.name === INCLUDE;
13812 var arg = directive.args[0];
13813
13814 if (arg == null || arg.name !== IF) {
13815 throw __webpack_require__(1).createUserError("Expected an 'if' argument to @".concat(directive.name, ". Source: ").concat(_this10._getErrorContext()), [directive.loc]);
13816 }
13817
13818 if (!(arg.value.kind === 'Variable' || arg.value.kind === 'Literal')) {
13819 throw __webpack_require__(1).createUserError("Expected the 'if' argument to @".concat(directive.name, " to be a variable or literal. Source: ").concat(_this10._getErrorContext()), [directive.loc]);
13820 }
13821
13822 return {
13823 kind: 'Condition',
13824 condition: arg.value,
13825 loc: directive.loc,
13826 metadata: null,
13827 passingValue: passingValue,
13828 selections: []
13829 };
13830 });
13831 var sortedConditions = conditions.sort(function (a, b) {
13832 if (a.condition.kind === 'Variable' && b.condition.kind === 'Variable') {
13833 return a.condition.variableName < b.condition.variableName ? -1 : a.condition.variableName > b.condition.variableName ? 1 : 0;
13834 } else {
13835 // sort literals earlier, variables later
13836 return a.condition.kind === 'Variable' ? 1 : b.condition.kind === 'Variable' ? -1 : 0;
13837 }
13838 });
13839 return [sortedConditions, otherDirectives];
13840 };
13841
13842 _proto2._transformVariable = function _transformVariable(ast, usedAsType) {
13843 var variableName = getName(ast);
13844
13845 this._recordAndVerifyVariableReference(ast, variableName, usedAsType);
13846
13847 return {
13848 kind: 'Variable',
13849 loc: buildLocation(ast.loc),
13850 metadata: null,
13851 variableName: variableName,
13852 type: usedAsType
13853 };
13854 };
13855 /**
13856 * Transforms and validates argument values according to the expected
13857 * type.
13858 */
13859
13860
13861 _proto2._transformValue = function _transformValue(ast, type) {
13862 if (ast.kind === 'Variable') {
13863 // Special case variables since there is no value to parse
13864 return this._transformVariable(ast, type);
13865 } else if (ast.kind === 'NullValue') {
13866 // Special case null literals since there is no value to parse
13867 if (type instanceof __webpack_require__(0).GraphQLNonNull) {
13868 throw __webpack_require__(1).createUserError("Expected a value matching type '".concat(String(type), "'."), null, [ast]);
13869 }
13870
13871 return {
13872 kind: 'Literal',
13873 loc: buildLocation(ast.loc),
13874 metadata: null,
13875 value: null
13876 };
13877 } else {
13878 return this._transformNonNullLiteral(ast, type);
13879 }
13880 };
13881 /**
13882 * Transforms and validates non-null literal (non-variable) values
13883 * according to the expected type.
13884 */
13885
13886
13887 _proto2._transformNonNullLiteral = function _transformNonNullLiteral(ast, type) {
13888 var _this11 = this;
13889
13890 // Transform the value based on the type without a non-null wrapper.
13891 // Note that error messages should still use the original `type`
13892 // since that accurately describes to the user what the expected
13893 // type is (using nullableType would suggest that `null` is legal
13894 // even when it may not be, for example).
13895 var nullableType = __webpack_require__(3).getNullableType(type);
13896
13897 if (nullableType instanceof __webpack_require__(0).GraphQLList) {
13898 if (ast.kind !== 'ListValue') {
13899 // Parse singular (non-list) values flowing into a list type
13900 // as scalars, ie without wrapping them in an array.
13901 return this._transformValue(ast, nullableType.ofType);
13902 }
13903
13904 var itemType = __webpack_require__(0).assertInputType(nullableType.ofType);
13905
13906 var literalList = [];
13907 var items = [];
13908 var areAllItemsScalar = true;
13909 ast.values.forEach(function (item) {
13910 var itemValue = _this11._transformValue(item, itemType);
13911
13912 if (itemValue.kind === 'Literal') {
13913 literalList.push(itemValue.value);
13914 }
13915
13916 items.push(itemValue);
13917 areAllItemsScalar = areAllItemsScalar && itemValue.kind === 'Literal';
13918 });
13919
13920 if (areAllItemsScalar) {
13921 return {
13922 kind: 'Literal',
13923 loc: buildLocation(ast.loc),
13924 metadata: null,
13925 value: literalList
13926 };
13927 } else {
13928 return {
13929 kind: 'ListValue',
13930 loc: buildLocation(ast.loc),
13931 metadata: null,
13932 items: items
13933 };
13934 }
13935 } else if (nullableType instanceof __webpack_require__(0).GraphQLInputObjectType) {
13936 var objectType = nullableType;
13937
13938 if (ast.kind !== 'ObjectValue') {
13939 throw __webpack_require__(1).createUserError("Expected a value matching type '".concat(String(type), "'."), null, [ast]);
13940 }
13941
13942 var literalObject = {};
13943 var fields = [];
13944 var areAllFieldsScalar = true;
13945 ast.fields.forEach(function (field) {
13946 var fieldName = getName(field);
13947 var fieldConfig = objectType.getFields()[fieldName];
13948
13949 if (fieldConfig == null) {
13950 throw __webpack_require__(1).createUserError("Uknown field '".concat(fieldName, "' on type '").concat(String(type), "'."), null, [field]);
13951 }
13952
13953 var fieldType = __webpack_require__(0).assertInputType(fieldConfig.type);
13954
13955 var fieldValue = _this11._transformValue(field.value, fieldType);
13956
13957 if (fieldValue.kind === 'Literal') {
13958 literalObject[field.name.value] = fieldValue.value;
13959 }
13960
13961 fields.push({
13962 kind: 'ObjectFieldValue',
13963 loc: buildLocation(field.loc),
13964 metadata: null,
13965 name: fieldName,
13966 value: fieldValue
13967 });
13968 areAllFieldsScalar = areAllFieldsScalar && fieldValue.kind === 'Literal';
13969 });
13970
13971 if (areAllFieldsScalar) {
13972 return {
13973 kind: 'Literal',
13974 loc: buildLocation(ast.loc),
13975 metadata: null,
13976 value: literalObject
13977 };
13978 } else {
13979 return {
13980 kind: 'ObjectValue',
13981 loc: buildLocation(ast.loc),
13982 metadata: null,
13983 fields: fields
13984 };
13985 }
13986 } else if (nullableType === __webpack_require__(0).GraphQLID) {
13987 // GraphQLID's parseLiteral() always returns the string value. However
13988 // the int/string distinction may be important at runtime, so this
13989 // transform parses int/string literals into the corresponding JS types.
13990 if (ast.kind === 'IntValue') {
13991 return {
13992 kind: 'Literal',
13993 loc: buildLocation(ast.loc),
13994 metadata: null,
13995 value: parseInt(ast.value, 10)
13996 };
13997 } else if (ast.kind === 'StringValue') {
13998 return {
13999 kind: 'Literal',
14000 loc: buildLocation(ast.loc),
14001 metadata: null,
14002 value: ast.value
14003 };
14004 } else {
14005 throw __webpack_require__(1).createUserError("Invalid value, expected a value matching type '".concat(String(type), "'."), null, [ast]);
14006 }
14007 } else if (nullableType instanceof __webpack_require__(0).GraphQLScalarType || nullableType instanceof __webpack_require__(0).GraphQLEnumType) {
14008 var _value2 = nullableType.parseLiteral(ast);
14009
14010 if (_value2 == null) {
14011 // parseLiteral() should return a non-null JavaScript value
14012 // if the ast value is valid for the type.
14013 throw __webpack_require__(1).createUserError("Expected a value matching type '".concat(String(type), "'."), null, [ast]);
14014 }
14015
14016 return {
14017 kind: 'Literal',
14018 loc: buildLocation(ast.loc),
14019 metadata: null,
14020 value: _value2
14021 };
14022 } else {
14023 nullableType;
14024 throw __webpack_require__(1).createCompilerError("Unsupported type '".concat(String(type), "' for input value, expected a GraphQLList, ") + 'GraphQLInputObjectType, GraphQLEnumType, or GraphQLScalarType.', null, [ast]);
14025 }
14026 };
14027
14028 return GraphQLDefinitionParser;
14029}();
14030/**
14031 * @private
14032 */
14033
14034
14035function transformLiteralValue(ast, context) {
14036 switch (ast.kind) {
14037 case 'IntValue':
14038 return parseInt(ast.value, 10);
14039
14040 case 'FloatValue':
14041 return parseFloat(ast.value);
14042
14043 case 'StringValue':
14044 return ast.value;
14045
14046 case 'BooleanValue':
14047 // Note: duplicated because Flow does not understand fall-through cases
14048 return ast.value;
14049
14050 case 'EnumValue':
14051 // Note: duplicated because Flow does not understand fall-through cases
14052 return ast.value;
14053
14054 case 'ListValue':
14055 return ast.values.map(function (item) {
14056 return transformLiteralValue(item, context);
14057 });
14058
14059 case 'NullValue':
14060 return null;
14061
14062 case 'ObjectValue':
14063 {
14064 var objectValue = {};
14065 ast.fields.forEach(function (field) {
14066 var fieldName = getName(field);
14067 var value = transformLiteralValue(field.value, context);
14068 objectValue[fieldName] = value;
14069 });
14070 return objectValue;
14071 }
14072
14073 case 'Variable':
14074 throw __webpack_require__(1).createUserError('Unexpected variable where a literal (static) value is required.', null, [ast, context]);
14075
14076 default:
14077 ast.kind;
14078 throw __webpack_require__(1).createCompilerError("Unknown ast kind '".concat(ast.kind, "'."), [ast]);
14079 }
14080}
14081/**
14082 * @private
14083 */
14084
14085
14086function buildArgumentDefinitions(variables) {
14087 return Array.from(variables.values(), function (_ref4) {
14088 var ast = _ref4.ast,
14089 name = _ref4.name,
14090 type = _ref4.type,
14091 defaultValue = _ref4.defaultValue;
14092 return {
14093 kind: 'LocalArgumentDefinition',
14094 loc: buildLocation(ast.loc),
14095 metadata: null,
14096 name: name,
14097 type: type,
14098 defaultValue: defaultValue
14099 };
14100 });
14101}
14102/**
14103 * @private
14104 */
14105
14106
14107function buildLocation(loc) {
14108 if (loc == null) {
14109 return {
14110 kind: 'Unknown'
14111 };
14112 }
14113
14114 return {
14115 kind: 'Source',
14116 start: loc.start,
14117 end: loc.end,
14118 source: loc.source
14119 };
14120}
14121/**
14122 * @private
14123 */
14124
14125
14126function isScalarFieldType(type) {
14127 var namedType = __webpack_require__(0).getNamedType(type);
14128
14129 return namedType instanceof __webpack_require__(0).GraphQLScalarType || namedType instanceof __webpack_require__(0).GraphQLEnumType;
14130}
14131/**
14132 * @private
14133 */
14134
14135
14136function assertScalarFieldType(type) {
14137 if (!isScalarFieldType(type)) {
14138 throw __webpack_require__(1).createUserError("Expected a scalar field type, got type '".concat(String(type), "'."));
14139 }
14140
14141 return type;
14142}
14143/**
14144 * @private
14145 */
14146
14147
14148function applyConditions(conditions, selections) {
14149 var nextSelections = selections;
14150 conditions.forEach(function (condition) {
14151 nextSelections = [(0, _objectSpread2["default"])({}, condition, {
14152 selections: nextSelections
14153 })];
14154 });
14155 return nextSelections;
14156}
14157/**
14158 * @private
14159 */
14160
14161
14162function getName(ast) {
14163 var _ast$name;
14164
14165 var name = (_ast$name = ast.name) === null || _ast$name === void 0 ? void 0 : _ast$name.value;
14166
14167 if (typeof name !== 'string') {
14168 throw __webpack_require__(1).createCompilerError("Expected ast node to have a 'name'.", null, [ast]);
14169 }
14170
14171 return name;
14172}
14173/**
14174 * Partitions an array given a predicate. All elements satisfying the predicate
14175 * are part of the first returned array, and all elements that don't are in the
14176 * second.
14177 *
14178 * @private
14179 */
14180
14181
14182function partitionArray(array, predicate) {
14183 var first = [];
14184 var second = [];
14185
14186 for (var i = 0; i < array.length; i++) {
14187 var item = array[i];
14188
14189 if (predicate(item)) {
14190 first.push(item);
14191 } else {
14192 second.push(item);
14193 }
14194 }
14195
14196 return [first, second];
14197}
14198
14199module.exports = {
14200 parse: parse,
14201 transform: transform
14202};
14203
14204/***/ }),
14205/* 82 */
14206/***/ (function(module, exports, __webpack_require__) {
14207
14208"use strict";
14209/**
14210 * Copyright (c) Facebook, Inc. and its affiliates.
14211 *
14212 * This source code is licensed under the MIT license found in the
14213 * LICENSE file in the root directory of this source tree.
14214 *
14215 *
14216 * @format
14217 */
14218
14219
14220var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
14221
14222/**
14223 * @public
14224 *
14225 * Converts a GraphQLIR node into a plain JS object representation that can be
14226 * used at runtime.
14227 */
14228function generate(node) {
14229 return __webpack_require__(23).visit(node, ReaderCodeGenVisitor);
14230}
14231
14232var ReaderCodeGenVisitor = {
14233 leave: {
14234 Request: function Request(node) {
14235 throw __webpack_require__(1).createCompilerError('ReaderCodeGenerator: unexpeted Request node.');
14236 },
14237 Fragment: function Fragment(node) {
14238 var metadata = null;
14239
14240 if (node.metadata != null) {
14241 var _node$metadata = node.metadata,
14242 mask = _node$metadata.mask,
14243 plural = _node$metadata.plural,
14244 connection = _node$metadata.connection,
14245 refetch = _node$metadata.refetch;
14246
14247 if (Array.isArray(connection)) {
14248 var _metadata;
14249
14250 metadata = (_metadata = metadata) !== null && _metadata !== void 0 ? _metadata : {};
14251 metadata.connection = connection;
14252 }
14253
14254 if (typeof mask === 'boolean') {
14255 var _metadata2;
14256
14257 metadata = (_metadata2 = metadata) !== null && _metadata2 !== void 0 ? _metadata2 : {};
14258 metadata.mask = mask;
14259 }
14260
14261 if (typeof plural === 'boolean') {
14262 var _metadata3;
14263
14264 metadata = (_metadata3 = metadata) !== null && _metadata3 !== void 0 ? _metadata3 : {};
14265 metadata.plural = plural;
14266 }
14267
14268 if (typeof refetch === 'object') {
14269 var _metadata4;
14270
14271 metadata = (_metadata4 = metadata) !== null && _metadata4 !== void 0 ? _metadata4 : {};
14272 metadata.refetch = {
14273 connection: refetch.connection,
14274 operation: __webpack_require__(83).moduleDependency(refetch.operation + '.graphql'),
14275 fragmentPathInResult: refetch.fragmentPathInResult
14276 };
14277 }
14278 }
14279
14280 return {
14281 kind: 'Fragment',
14282 name: node.name,
14283 type: node.type.toString(),
14284 metadata: metadata,
14285 argumentDefinitions: node.argumentDefinitions,
14286 selections: node.selections
14287 };
14288 },
14289 LocalArgumentDefinition: function LocalArgumentDefinition(node) {
14290 return {
14291 kind: 'LocalArgument',
14292 name: node.name,
14293 type: node.type.toString(),
14294 defaultValue: node.defaultValue
14295 };
14296 },
14297 RootArgumentDefinition: function RootArgumentDefinition(node) {
14298 return {
14299 kind: 'RootArgument',
14300 name: node.name,
14301 type: node.type ? node.type.toString() : null
14302 };
14303 },
14304 Condition: function Condition(node, key, parent, ancestors) {
14305 if (node.condition.kind !== 'Variable') {
14306 throw __webpack_require__(1).createCompilerError("ReaderCodeGenerator: Expected 'Condition' with static value to be " + 'pruned or inlined', [node.condition.loc]);
14307 }
14308
14309 return {
14310 kind: 'Condition',
14311 passingValue: node.passingValue,
14312 condition: node.condition.variableName,
14313 selections: node.selections
14314 };
14315 },
14316 FragmentSpread: function FragmentSpread(node) {
14317 return {
14318 kind: 'FragmentSpread',
14319 name: node.name,
14320 args: valuesOrNull(sortByName(node.args))
14321 };
14322 },
14323 InlineFragment: function InlineFragment(node) {
14324 return {
14325 kind: 'InlineFragment',
14326 type: node.typeCondition.toString(),
14327 selections: node.selections
14328 };
14329 },
14330 LinkedField: function LinkedField(node) {
14331 // Note: it is important that the arguments of this field be sorted to
14332 // ensure stable generation of storage keys for equivalent arguments
14333 // which may have originally appeared in different orders across an app.
14334 // TODO(T37646905) enable this invariant after splitting the
14335 // RelayCodeGenerator-test and running the RelayFieldHandleTransform on
14336 // Reader ASTs.
14337 //
14338 // invariant(
14339 // node.handles == null,
14340 // 'ReaderCodeGenerator: unexpected handles',
14341 // );
14342 var type = __webpack_require__(3).getRawType(node.type);
14343
14344 var field = {
14345 kind: 'LinkedField',
14346 alias: node.alias,
14347 name: node.name,
14348 storageKey: null,
14349 args: valuesOrNull(sortByName(node.args)),
14350 concreteType: !__webpack_require__(3).isAbstractType(type) ? type.toString() : null,
14351 plural: isPlural(node.type),
14352 selections: node.selections
14353 }; // Precompute storageKey if possible
14354
14355 var storageKey = getStaticStorageKey(field, node.metadata);
14356
14357 if (storageKey) {
14358 field = (0, _objectSpread2["default"])({}, field, {
14359 storageKey: storageKey
14360 });
14361 }
14362
14363 return field;
14364 },
14365 MatchField: function MatchField(node, key, parent, ancestors) {
14366 var matchesByType = {};
14367 node.selections.forEach(function (selection) {
14368 var _regExpMatch$;
14369
14370 if (selection.kind === 'ScalarField' && selection.name === '__typename') {
14371 // The RelayGenerateTypename transform will add a __typename selection
14372 // to the selections of the match field.
14373 return;
14374 }
14375
14376 if (selection.kind !== 'MatchBranch') {
14377 throw __webpack_require__(1).createCompilerError("ReaderCodeGenerator: Expected selection for MatchField '".concat(node.name, "' to be a 'MatchBranch', got '").concat(selection.kind, "'."), [selection.loc]);
14378 }
14379
14380 if (matchesByType.hasOwnProperty(selection.type)) {
14381 throw __webpack_require__(1).createCompilerError('ReaderCodeGenerator: Each @match type can appear at-most once. ' + "Type '".concat(String(selection.type), "' was duplicated."), selection.type, [selection.loc]);
14382 }
14383
14384 var fragmentName = selection.name;
14385 var regExpMatch = fragmentName.match(/^([a-zA-Z][a-zA-Z0-9]*)(?:_([a-zA-Z][_a-zA-Z0-9]*))?$/);
14386
14387 if (!regExpMatch) {
14388 throw __webpack_require__(1).createCompilerError('ReaderCodeGenerator: @match fragments should be named ' + "'FragmentName_propName', got '".concat(fragmentName, "'."), [selection.loc]);
14389 }
14390
14391 var fragmentPropName = (_regExpMatch$ = regExpMatch[2]) !== null && _regExpMatch$ !== void 0 ? _regExpMatch$ : 'matchData';
14392 matchesByType[selection.type] = {
14393 fragmentPropName: fragmentPropName,
14394 fragmentName: fragmentName
14395 };
14396 });
14397 var field = {
14398 kind: 'MatchField',
14399 alias: node.alias,
14400 name: node.name,
14401 storageKey: null,
14402 args: valuesOrNull(sortByName(node.args)),
14403 matchesByType: matchesByType
14404 }; // Precompute storageKey if possible
14405
14406 var storageKey = getStaticStorageKey(field, node.metadata);
14407
14408 if (storageKey) {
14409 field = (0, _objectSpread2["default"])({}, field, {
14410 storageKey: storageKey
14411 });
14412 }
14413
14414 return field;
14415 },
14416 ScalarField: function ScalarField(node) {
14417 // Note: it is important that the arguments of this field be sorted to
14418 // ensure stable generation of storage keys for equivalent arguments
14419 // which may have originally appeared in different orders across an app.
14420 // TODO(T37646905) enable this invariant after splitting the
14421 // RelayCodeGenerator-test and running the RelayFieldHandleTransform on
14422 // Reader ASTs.
14423 //
14424 // invariant(
14425 // node.handles == null,
14426 // 'ReaderCodeGenerator: unexpected handles',
14427 var field = {
14428 kind: 'ScalarField',
14429 alias: node.alias,
14430 name: node.name,
14431 args: valuesOrNull(sortByName(node.args)),
14432 storageKey: null
14433 }; // Precompute storageKey if possible
14434
14435 var storageKey = getStaticStorageKey(field, node.metadata);
14436
14437 if (storageKey) {
14438 field = (0, _objectSpread2["default"])({}, field, {
14439 storageKey: storageKey
14440 });
14441 }
14442
14443 return field;
14444 },
14445 SplitOperation: function SplitOperation(node, key, parent) {
14446 return {
14447 kind: 'SplitOperation',
14448 name: node.name,
14449 metadata: null,
14450 selections: node.selections
14451 };
14452 },
14453 Variable: function Variable(node, key, parent) {
14454 return {
14455 kind: 'Variable',
14456 name: parent.name,
14457 variableName: node.variableName,
14458 type: parent.type ? parent.type.toString() : null
14459 };
14460 },
14461 Literal: function Literal(node, key, parent) {
14462 return {
14463 kind: 'Literal',
14464 name: parent.name,
14465 value: __webpack_require__(14).stableCopy(node.value),
14466 type: parent.type ? parent.type.toString() : null
14467 };
14468 },
14469 Argument: function Argument(node, key, parent, ancestors) {
14470 if (!['Variable', 'Literal'].includes(node.value.kind)) {
14471 var valueString = JSON.stringify(node.value, null, 2);
14472 throw __webpack_require__(1).createUserError('ReaderCodeGenerator: Complex argument values (Lists or ' + 'InputObjects with nested variables) are not supported.', [node.value.loc]);
14473 }
14474
14475 return node.value.value !== null ? node.value : null;
14476 }
14477 }
14478};
14479
14480function isPlural(type) {
14481 return __webpack_require__(3).getNullableType(type) instanceof __webpack_require__(0).GraphQLList;
14482}
14483
14484function valuesOrNull(array) {
14485 return !array || array.length === 0 ? null : array;
14486}
14487
14488function sortByName(array) {
14489 return array instanceof Array ? array.slice().sort(function (a, b) {
14490 return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
14491 }) : array;
14492}
14493/**
14494 * Pre-computes storage key if possible and advantageous. Storage keys are
14495 * generated for fields with supplied arguments that are all statically known
14496 * (ie. literals, no variables) at build time.
14497 */
14498
14499
14500function getStaticStorageKey(field, metadata) {
14501 var metadataStorageKey = metadata === null || metadata === void 0 ? void 0 : metadata.storageKey;
14502
14503 if (typeof metadataStorageKey === 'string') {
14504 return metadataStorageKey;
14505 }
14506
14507 if (!field.args || field.args.length === 0 || field.args.some(function (arg) {
14508 return arg.kind !== 'Literal';
14509 })) {
14510 return null;
14511 }
14512
14513 return __webpack_require__(14).getStorageKey(field, {});
14514}
14515
14516module.exports = {
14517 generate: generate
14518};
14519
14520/***/ }),
14521/* 83 */
14522/***/ (function(module, exports, __webpack_require__) {
14523
14524"use strict";
14525/**
14526 * Copyright (c) Facebook, Inc. and its affiliates.
14527 *
14528 * This source code is licensed under the MIT license found in the
14529 * LICENSE file in the root directory of this source tree.
14530 *
14531 * strict
14532 * @format
14533 */
14534
14535/**
14536 * Marks a string of code as code to be replaced later.
14537 */
14538
14539function moduleDependency(code) {
14540 return "@@MODULE_START@@".concat(code, "@@MODULE_END@@");
14541}
14542/**
14543 * After JSON.stringify'ing some code that contained parts marked with `mark()`,
14544 * this post-processes the JSON to convert the marked code strings to raw code.
14545 *
14546 * Example:
14547 * CodeMarker.postProcess(
14548 * JSON.stringify({code: CodeMarker.mark('alert(1)')})
14549 * )
14550 */
14551
14552
14553function postProcess(json, printModule) {
14554 return json.replace(/"@@MODULE_START@@(.*?)@@MODULE_END@@"/g, function (_, moduleName) {
14555 return printModule(moduleName);
14556 });
14557}
14558
14559module.exports = {
14560 moduleDependency: moduleDependency,
14561 postProcess: postProcess
14562};
14563
14564/***/ }),
14565/* 84 */
14566/***/ (function(module, exports, __webpack_require__) {
14567
14568"use strict";
14569/**
14570 * Copyright (c) Facebook, Inc. and its affiliates.
14571 *
14572 * This source code is licensed under the MIT license found in the
14573 * LICENSE file in the root directory of this source tree.
14574 *
14575 *
14576 * @format
14577 */
14578
14579
14580var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
14581
14582function generate(node) {
14583 if (node.kind !== 'Root' && node.kind !== 'SplitOperation') {
14584 throw __webpack_require__(1).createCompilerError("NormalizationCodeGenerator: Unsupported AST kind '".concat(node.kind, "'."), [node.loc]);
14585 }
14586
14587 return __webpack_require__(23).visit(node, NormalizationCodeGenVisitor);
14588}
14589
14590var NormalizationCodeGenVisitor = {
14591 leave: {
14592 Root: function Root(node) {
14593 return {
14594 kind: 'Operation',
14595 name: node.name,
14596 argumentDefinitions: node.argumentDefinitions,
14597 selections: flattenArray(node.selections)
14598 };
14599 },
14600 Request: function Request(node) {
14601 throw __webpack_require__(1).createCompilerError('NormalizationCodeGenerator: unexpected Request node.');
14602 },
14603 Fragment: function Fragment(node) {
14604 throw __webpack_require__(1).createCompilerError('NormalizationCodeGenerator: unexpected Fragment node.');
14605 },
14606 LocalArgumentDefinition: function LocalArgumentDefinition(node) {
14607 return {
14608 kind: 'LocalArgument',
14609 name: node.name,
14610 type: node.type.toString(),
14611 defaultValue: node.defaultValue
14612 };
14613 },
14614 RootArgumentDefinition: function RootArgumentDefinition(node) {
14615 return {
14616 kind: 'RootArgument',
14617 name: node.name,
14618 type: node.type ? node.type.toString() : null
14619 };
14620 },
14621 Condition: function Condition(node, key, parent, ancestors) {
14622 if (node.condition.kind !== 'Variable') {
14623 throw __webpack_require__(1).createCompilerError("NormalizationCodeGenerator: Expected 'Condition' with static " + 'value to be pruned or inlined', [node.condition.loc]);
14624 }
14625
14626 return {
14627 kind: 'Condition',
14628 passingValue: node.passingValue,
14629 condition: node.condition.variableName,
14630 selections: flattenArray(node.selections)
14631 };
14632 },
14633 Defer: function Defer(node, key, parent, ancestors) {
14634 var _node$if2;
14635
14636 if (!(node["if"] == null || node["if"].kind === 'Variable' || node["if"].kind === 'Literal' && node["if"].value === true)) {
14637 var _ref, _node$if;
14638
14639 throw __webpack_require__(1).createCompilerError('NormalizationCodeGenerator: Expected @defer `if` condition to be ' + 'a variable, unspecified, or the literal `true`.', [(_ref = (_node$if = node["if"]) === null || _node$if === void 0 ? void 0 : _node$if.loc) !== null && _ref !== void 0 ? _ref : node.loc]);
14640 }
14641
14642 return {
14643 "if": ((_node$if2 = node["if"]) === null || _node$if2 === void 0 ? void 0 : _node$if2.kind) === 'Variable' ? node["if"].variableName : null,
14644 kind: 'Defer',
14645 label: node.label,
14646 metadata: node.metadata,
14647 selections: flattenArray(node.selections)
14648 };
14649 },
14650 FragmentSpread: function FragmentSpread(node) {
14651 // TODO(T37646905) enable this invariant after splitting the
14652 // RelayCodeGenerator-test and running the InlineFragmentsTransform on
14653 // normalization ASTs.
14654 //
14655 // throw new Error(
14656 // 'NormalizationCodeGenerator: unexpected FragmentSpread node.',
14657 // );
14658 return [];
14659 },
14660 InlineFragment: function InlineFragment(node) {
14661 return {
14662 kind: 'InlineFragment',
14663 type: node.typeCondition.toString(),
14664 selections: flattenArray(node.selections)
14665 };
14666 },
14667 LinkedField: function LinkedField(node) {
14668 // Note: it is important that the arguments of this field be sorted to
14669 // ensure stable generation of storage keys for equivalent arguments
14670 // which may have originally appeared in different orders across an app.
14671 var handles = node.handles && node.handles.map(function (handle) {
14672 return {
14673 kind: 'LinkedHandle',
14674 alias: node.alias,
14675 name: node.name,
14676 args: valuesOrNull(sortByName(node.args)),
14677 handle: handle.name,
14678 key: handle.key,
14679 filters: handle.filters
14680 };
14681 }) || [];
14682
14683 var type = __webpack_require__(3).getRawType(node.type);
14684
14685 var field = {
14686 kind: 'LinkedField',
14687 alias: node.alias,
14688 name: node.name,
14689 storageKey: null,
14690 args: valuesOrNull(sortByName(node.args)),
14691 concreteType: !__webpack_require__(3).isAbstractType(type) ? type.toString() : null,
14692 plural: isPlural(node.type),
14693 selections: flattenArray(node.selections)
14694 }; // Precompute storageKey if possible
14695
14696 var storageKey = getStaticStorageKey(field, node.metadata);
14697
14698 if (storageKey) {
14699 field = (0, _objectSpread2["default"])({}, field, {
14700 storageKey: storageKey
14701 });
14702 }
14703
14704 return [field].concat(handles);
14705 },
14706 MatchField: function MatchField(node, key, parent, ancestors) {
14707 var selections = flattenArray(node.selections);
14708 var matchesByType = {};
14709 selections.forEach(function (selection) {
14710 var _regExpMatch$;
14711
14712 if (selection.kind === 'ScalarField' && selection.name === '__typename') {
14713 // The RelayGenerateTypename transform will add a __typename selection
14714 // to the selections of the match field.
14715 return;
14716 }
14717
14718 if (selection.kind !== 'MatchBranch') {
14719 throw __webpack_require__(1).createCompilerError("NormalizationCodeGenerator: Expected selection for MatchField '".concat(node.name, "' to be a 'MatchBranch', got '").concat(selection.kind, "'."), [selection.loc]);
14720 }
14721
14722 if (matchesByType.hasOwnProperty(selection.type)) {
14723 throw __webpack_require__(1).createCompilerError('NormalizationCodeGenerator: Each @match type can appear at-most ' + "once. Type '".concat(String(selection.type), "' was duplicated."), selection.type, [selection.loc]);
14724 }
14725
14726 var fragmentName = selection.name;
14727 var regExpMatch = fragmentName.match(/^([a-zA-Z][a-zA-Z0-9]*)(?:_([a-zA-Z][_a-zA-Z0-9]*))?$/);
14728
14729 if (!regExpMatch) {
14730 throw __webpack_require__(1).createCompilerError('NormalizationCodeGenerator: @match fragments should be named ' + "'FragmentName_propName', got '".concat(fragmentName, "'."), [selection.loc]);
14731 }
14732
14733 var fragmentPropName = (_regExpMatch$ = regExpMatch[2]) !== null && _regExpMatch$ !== void 0 ? _regExpMatch$ : 'matchData';
14734 matchesByType[selection.type] = {
14735 fragmentPropName: fragmentPropName,
14736 fragmentName: fragmentName
14737 };
14738 });
14739 var field = {
14740 kind: 'MatchField',
14741 alias: node.alias,
14742 name: node.name,
14743 storageKey: null,
14744 args: valuesOrNull(sortByName(node.args)),
14745 matchesByType: matchesByType
14746 }; // Precompute storageKey if possible
14747
14748 var storageKey = getStaticStorageKey(field, node.metadata);
14749
14750 if (storageKey) {
14751 field = (0, _objectSpread2["default"])({}, field, {
14752 storageKey: storageKey
14753 });
14754 }
14755
14756 return field;
14757 },
14758 ScalarField: function ScalarField(node) {
14759 // Note: it is important that the arguments of this field be sorted to
14760 // ensure stable generation of storage keys for equivalent arguments
14761 // which may have originally appeared in different orders across an app.
14762 var handles = node.handles && node.handles.map(function (handle) {
14763 return {
14764 kind: 'ScalarHandle',
14765 alias: node.alias,
14766 name: node.name,
14767 args: valuesOrNull(sortByName(node.args)),
14768 handle: handle.name,
14769 key: handle.key,
14770 filters: handle.filters
14771 };
14772 }) || [];
14773 var field = {
14774 kind: 'ScalarField',
14775 alias: node.alias,
14776 name: node.name,
14777 args: valuesOrNull(sortByName(node.args)),
14778 storageKey: null
14779 }; // Precompute storageKey if possible
14780
14781 var storageKey = getStaticStorageKey(field, node.metadata);
14782
14783 if (storageKey) {
14784 field = (0, _objectSpread2["default"])({}, field, {
14785 storageKey: storageKey
14786 });
14787 }
14788
14789 return [field].concat(handles);
14790 },
14791 SplitOperation: function SplitOperation(node, key, parent) {
14792 return {
14793 kind: 'SplitOperation',
14794 name: node.name,
14795 metadata: node.metadata,
14796 selections: flattenArray(node.selections)
14797 };
14798 },
14799 Stream: function Stream(node, key, parent, ancestors) {
14800 var _node$if4;
14801
14802 if (!(node["if"] == null || node["if"].kind === 'Variable' || node["if"].kind === 'Literal' && node["if"].value === true)) {
14803 var _ref2, _node$if3;
14804
14805 throw __webpack_require__(1).createCompilerError('NormalizationCodeGenerator: Expected @stream `if` condition to be ' + 'a variable, unspecified, or the literal `true`.', [(_ref2 = (_node$if3 = node["if"]) === null || _node$if3 === void 0 ? void 0 : _node$if3.loc) !== null && _ref2 !== void 0 ? _ref2 : node.loc]);
14806 }
14807
14808 return {
14809 "if": ((_node$if4 = node["if"]) === null || _node$if4 === void 0 ? void 0 : _node$if4.kind) === 'Variable' ? node["if"].variableName : null,
14810 kind: 'Stream',
14811 label: node.label,
14812 metadata: node.metadata,
14813 selections: flattenArray(node.selections)
14814 };
14815 },
14816 Variable: function Variable(node, key, parent) {
14817 return {
14818 kind: 'Variable',
14819 name: parent.name,
14820 variableName: node.variableName,
14821 type: parent.type ? parent.type.toString() : null
14822 };
14823 },
14824 Literal: function Literal(node, key, parent) {
14825 return {
14826 kind: 'Literal',
14827 name: parent.name,
14828 value: __webpack_require__(14).stableCopy(node.value),
14829 type: parent.type ? parent.type.toString() : null
14830 };
14831 },
14832 Argument: function Argument(node, key, parent, ancestors) {
14833 if (!['Variable', 'Literal'].includes(node.value.kind)) {
14834 throw __webpack_require__(1).createUserError('RelayCodeGenerator: Complex argument values (Lists or ' + 'InputObjects with nested variables) are not supported.', [node.value.loc]);
14835 }
14836
14837 return node.value.value !== null ? node.value : null;
14838 }
14839 }
14840};
14841
14842function isPlural(type) {
14843 return __webpack_require__(3).getNullableType(type) instanceof __webpack_require__(0).GraphQLList;
14844}
14845
14846function valuesOrNull(array) {
14847 return !array || array.length === 0 ? null : array;
14848}
14849
14850function flattenArray(array) {
14851 return array ? Array.prototype.concat.apply([], array) : [];
14852}
14853
14854function sortByName(array) {
14855 return array instanceof Array ? array.slice().sort(function (a, b) {
14856 return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
14857 }) : array;
14858}
14859/**
14860 * Pre-computes storage key if possible and advantageous. Storage keys are
14861 * generated for fields with supplied arguments that are all statically known
14862 * (ie. literals, no variables) at build time.
14863 */
14864
14865
14866function getStaticStorageKey(field, metadata) {
14867 var metadataStorageKey = metadata === null || metadata === void 0 ? void 0 : metadata.storageKey;
14868
14869 if (typeof metadataStorageKey === 'string') {
14870 return metadataStorageKey;
14871 }
14872
14873 if (!field.args || field.args.length === 0 || field.args.some(function (arg) {
14874 return arg.kind !== 'Literal';
14875 })) {
14876 return null;
14877 }
14878
14879 return __webpack_require__(14).getStorageKey(field, {});
14880}
14881
14882module.exports = {
14883 generate: generate
14884};
14885
14886/***/ }),
14887/* 85 */
14888/***/ (function(module, exports, __webpack_require__) {
14889
14890"use strict";
14891/**
14892 * Copyright (c) Facebook, Inc. and its affiliates.
14893 *
14894 * This source code is licensed under the MIT license found in the
14895 * LICENSE file in the root directory of this source tree.
14896 *
14897 * strict-local
14898 * @format
14899 */
14900
14901
14902/**
14903 * Helpers to retieve the name of the document from which the input derives:
14904 * this is either the name of the input itself (if it is not a derived node)
14905 * or the metadata.derivedFrom property for derived nodes.
14906 */
14907// Version for generated nodes
14908function getReaderSourceDefinitionName(node) {
14909 var _node$params$metadata, _node$metadata;
14910
14911 var _ref = node.kind === 'Request' ? [node.params.name, (_node$params$metadata = node.params.metadata) === null || _node$params$metadata === void 0 ? void 0 : _node$params$metadata.derivedFrom] : node.kind === 'SplitOperation' ? [node.name, (_node$metadata = node.metadata) === null || _node$metadata === void 0 ? void 0 : _node$metadata.derivedFrom] : [node.name, null],
14912 name = _ref[0],
14913 derivedFrom = _ref[1];
14914
14915 return typeof derivedFrom === 'string' ? derivedFrom : name;
14916} // Version for IR
14917
14918
14919function getSourceDefinitionName(node) {
14920 var _node$metadata2;
14921
14922 var derivedFrom = node.kind === 'Request' || node.kind === 'Root' || node.kind === 'SplitOperation' ? (_node$metadata2 = node.metadata) === null || _node$metadata2 === void 0 ? void 0 : _node$metadata2.derivedFrom : null;
14923 return typeof derivedFrom === 'string' ? derivedFrom : node.name;
14924}
14925
14926module.exports = {
14927 getReaderSourceDefinitionName: getReaderSourceDefinitionName,
14928 getSourceDefinitionName: getSourceDefinitionName
14929};
14930
14931/***/ }),
14932/* 86 */
14933/***/ (function(module, exports, __webpack_require__) {
14934
14935"use strict";
14936/**
14937 * Copyright (c) Facebook, Inc. and its affiliates.
14938 *
14939 * This source code is licensed under the MIT license found in the
14940 * LICENSE file in the root directory of this source tree.
14941 *
14942 *
14943 * @format
14944 */
14945
14946
14947var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
14948
14949var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
14950
14951var CONNECTION = 'connection';
14952var HANDLER = 'handler';
14953/**
14954 * @public
14955 *
14956 * Transforms fields with the `@connection` directive:
14957 * - Verifies that the field type is connection-like.
14958 * - Adds a `handle` property to the field, either the user-provided `handle`
14959 * argument or the default value "connection".
14960 * - Inserts a sub-fragment on the field to ensure that standard connection
14961 * fields are fetched (e.g. cursors, node ids, page info).
14962 */
14963
14964function relayConnectionTransform(context) {
14965 return __webpack_require__(10).transform(context, {
14966 Fragment: visitFragmentOrRoot,
14967 LinkedField: visitLinkedOrMatchField,
14968 MatchField: visitLinkedOrMatchField,
14969 Root: visitFragmentOrRoot
14970 }, function (node) {
14971 return {
14972 path: [],
14973 connectionMetadata: [],
14974 definitionName: node.name
14975 };
14976 });
14977}
14978
14979var SCHEMA_EXTENSION = 'directive @connection(key: String!, filters: [String], handler: String) on FIELD';
14980/**
14981 * @internal
14982 */
14983
14984function visitFragmentOrRoot(node, options) {
14985 var transformedNode = this.traverse(node, options);
14986 var connectionMetadata = options.connectionMetadata;
14987
14988 if (connectionMetadata.length) {
14989 return (0, _objectSpread2["default"])({}, transformedNode, {
14990 metadata: (0, _objectSpread2["default"])({}, transformedNode.metadata, {
14991 connection: connectionMetadata
14992 })
14993 });
14994 }
14995
14996 return transformedNode;
14997}
14998/**
14999 * @internal
15000 */
15001
15002
15003function visitLinkedOrMatchField(field, options) {
15004 var _handler;
15005
15006 var isPlural = __webpack_require__(3).getNullableType(field.type) instanceof __webpack_require__(0).GraphQLList;
15007
15008 options.path.push(isPlural ? null : field.alias || field.name);
15009 var transformedField = this.traverse(field, options);
15010 var connectionDirective = field.directives.find(function (directive) {
15011 return directive.name === CONNECTION;
15012 });
15013
15014 if (!connectionDirective) {
15015 options.path.pop();
15016 return transformedField;
15017 }
15018
15019 var definitionName = options.definitionName;
15020 validateConnectionSelection(definitionName, transformedField);
15021 validateConnectionType(definitionName, transformedField);
15022 var pathHasPlural = options.path.includes(null);
15023 var firstArg = findArg(transformedField, __webpack_require__(17).FIRST);
15024 var lastArg = findArg(transformedField, __webpack_require__(17).LAST);
15025 var direction = null;
15026 var countArg = null;
15027 var cursorArg = null;
15028
15029 if (firstArg && !lastArg) {
15030 direction = 'forward';
15031 countArg = firstArg;
15032 cursorArg = findArg(transformedField, __webpack_require__(17).AFTER);
15033 } else if (lastArg && !firstArg) {
15034 direction = 'backward';
15035 countArg = lastArg;
15036 cursorArg = findArg(transformedField, __webpack_require__(17).BEFORE);
15037 } else if (lastArg && firstArg) {
15038 direction = 'bidirectional'; // TODO(T26511885) Maybe add connection metadata to this case
15039 }
15040
15041 var countVariable = countArg && countArg.value.kind === 'Variable' ? countArg.value.variableName : null;
15042 var cursorVariable = cursorArg && cursorArg.value.kind === 'Variable' ? cursorArg.value.variableName : null;
15043 options.connectionMetadata.push({
15044 count: countVariable,
15045 cursor: cursorVariable,
15046 direction: direction,
15047 path: pathHasPlural ? null : (0, _toConsumableArray2["default"])(options.path)
15048 });
15049 options.path.pop();
15050
15051 var _getLiteralArgumentVa = __webpack_require__(33)(connectionDirective.args),
15052 handler = _getLiteralArgumentVa.handler,
15053 key = _getLiteralArgumentVa.key,
15054 filters = _getLiteralArgumentVa.filters;
15055
15056 if (handler != null && typeof handler !== 'string') {
15057 var _ref, _handleArg$value;
15058
15059 var handleArg = connectionDirective.args.find(function (arg) {
15060 return arg.name === 'key';
15061 });
15062 throw __webpack_require__(1).createUserError("Expected the ".concat(HANDLER, " argument to ") + "@".concat(CONNECTION, " to be a string literal for field ").concat(field.name, "."), [(_ref = handleArg === null || handleArg === void 0 ? void 0 : (_handleArg$value = handleArg.value) === null || _handleArg$value === void 0 ? void 0 : _handleArg$value.loc) !== null && _ref !== void 0 ? _ref : connectionDirective.loc]);
15063 }
15064
15065 if (typeof key !== 'string') {
15066 var _ref2, _keyArg$value;
15067
15068 var keyArg = connectionDirective.args.find(function (arg) {
15069 return arg.name === 'key';
15070 });
15071 throw __webpack_require__(1).createUserError("Expected the ".concat(__webpack_require__(17).KEY, " argument to ") + "@".concat(CONNECTION, " to be a string literal for field ").concat(field.name, "."), [(_ref2 = keyArg === null || keyArg === void 0 ? void 0 : (_keyArg$value = keyArg.value) === null || _keyArg$value === void 0 ? void 0 : _keyArg$value.loc) !== null && _ref2 !== void 0 ? _ref2 : connectionDirective.loc]);
15072 }
15073
15074 var postfix = field.alias || field.name;
15075
15076 if (!key.endsWith('_' + postfix)) {
15077 var _ref3, _keyArg$value2;
15078
15079 var _keyArg = connectionDirective.args.find(function (arg) {
15080 return arg.name === 'key';
15081 });
15082
15083 throw __webpack_require__(1).createUserError("Expected the ".concat(__webpack_require__(17).KEY, " argument to ") + "@".concat(CONNECTION, " to be of form <SomeName>_").concat(postfix, ", got '").concat(key, "'. ") + 'For detailed explanation, check out ' + 'https://facebook.github.io/relay/docs/en/pagination-container.html#connection', [(_ref3 = _keyArg === null || _keyArg === void 0 ? void 0 : (_keyArg$value2 = _keyArg.value) === null || _keyArg$value2 === void 0 ? void 0 : _keyArg$value2.loc) !== null && _ref3 !== void 0 ? _ref3 : connectionDirective.loc]);
15084 }
15085
15086 var generateFilters = function generateFilters() {
15087 var filteredVariableArgs = field.args.filter(function (arg) {
15088 return !__webpack_require__(14).ConnectionInterface.isConnectionCall({
15089 name: arg.name,
15090 value: null
15091 });
15092 }).map(function (arg) {
15093 return arg.name;
15094 });
15095 return filteredVariableArgs.length === 0 ? null : filteredVariableArgs;
15096 };
15097
15098 var handle = {
15099 name: (_handler = handler) !== null && _handler !== void 0 ? _handler : CONNECTION,
15100 key: key,
15101 filters: filters || generateFilters()
15102 };
15103
15104 if (direction !== null) {
15105 var fragment = generateConnectionFragment(this.getContext(), transformedField.loc, transformedField.type, direction);
15106 transformedField = (0, _objectSpread2["default"])({}, transformedField, {
15107 selections: transformedField.selections.concat(fragment)
15108 });
15109 }
15110
15111 return (0, _objectSpread2["default"])({}, transformedField, {
15112 directives: transformedField.directives.filter(function (directive) {
15113 return directive.name !== CONNECTION;
15114 }),
15115 handles: transformedField.handles ? (0, _toConsumableArray2["default"])(transformedField.handles).concat([handle]) : [handle]
15116 });
15117}
15118/**
15119 * @internal
15120 *
15121 * Generates a fragment on the given type that fetches the minimal connection
15122 * fields in order to merge different pagination results together at runtime.
15123 */
15124
15125
15126function generateConnectionFragment(context, loc, type, direction) {
15127 var _ConnectionInterface$ = __webpack_require__(14).ConnectionInterface.get(),
15128 CURSOR = _ConnectionInterface$.CURSOR,
15129 EDGES = _ConnectionInterface$.EDGES,
15130 END_CURSOR = _ConnectionInterface$.END_CURSOR,
15131 HAS_NEXT_PAGE = _ConnectionInterface$.HAS_NEXT_PAGE,
15132 HAS_PREV_PAGE = _ConnectionInterface$.HAS_PREV_PAGE,
15133 NODE = _ConnectionInterface$.NODE,
15134 PAGE_INFO = _ConnectionInterface$.PAGE_INFO,
15135 START_CURSOR = _ConnectionInterface$.START_CURSOR;
15136
15137 var compositeType = __webpack_require__(0).assertCompositeType(__webpack_require__(3).getNullableType(type));
15138
15139 var pageInfo = PAGE_INFO;
15140
15141 if (direction === 'forward') {
15142 pageInfo += "{\n ".concat(END_CURSOR, "\n ").concat(HAS_NEXT_PAGE, "\n }");
15143 } else if (direction === 'backward') {
15144 pageInfo += "{\n ".concat(HAS_PREV_PAGE, "\n ").concat(START_CURSOR, "\n }");
15145 } else {
15146 pageInfo += "{\n ".concat(END_CURSOR, "\n ").concat(HAS_NEXT_PAGE, "\n ").concat(HAS_PREV_PAGE, "\n ").concat(START_CURSOR, "\n }");
15147 }
15148
15149 var fragmentString = "fragment ConnectionFragment on ".concat(String(compositeType), " {\n ").concat(EDGES, " {\n ").concat(CURSOR, "\n ").concat(NODE, " {\n __typename # rely on GenerateRequisiteFieldTransform to add \"id\"\n }\n }\n ").concat(pageInfo, "\n }");
15150
15151 var ast = __webpack_require__(0).parse(fragmentString);
15152
15153 var fragmentAST = ast.definitions[0];
15154
15155 if (fragmentAST == null || fragmentAST.kind !== 'FragmentDefinition') {
15156 throw __webpack_require__(1).createCompilerError('RelayConnectionTransform: Expected a fragment definition AST.', null, [fragmentAST].filter(Boolean));
15157 }
15158
15159 var fragment = __webpack_require__(81).transform(context.clientSchema, [fragmentAST])[0];
15160
15161 if (fragment == null || fragment.kind !== 'Fragment') {
15162 throw __webpack_require__(1).createCompilerError('RelayConnectionTransform: Expected a connection fragment.', [fragment === null || fragment === void 0 ? void 0 : fragment.loc].filter(Boolean));
15163 }
15164
15165 return {
15166 directives: [],
15167 kind: 'InlineFragment',
15168 loc: {
15169 kind: 'Derived',
15170 source: loc
15171 },
15172 metadata: null,
15173 selections: fragment.selections,
15174 typeCondition: compositeType
15175 };
15176}
15177
15178function findArg(field, argName) {
15179 return field.args && field.args.find(function (arg) {
15180 return arg.name === argName;
15181 });
15182}
15183/**
15184 * @internal
15185 *
15186 * Validates that the selection is a valid connection:
15187 * - Specifies a first or last argument to prevent accidental, unconstrained
15188 * data access.
15189 * - Has an `edges` selection, otherwise there is nothing to paginate.
15190 *
15191 * TODO: This implementation requires the edges field to be a direct selection
15192 * and not contained within an inline fragment or fragment spread. It's
15193 * technically possible to remove this restriction if this pattern becomes
15194 * common/necessary.
15195 */
15196
15197
15198function validateConnectionSelection(definitionName, field) {
15199 var _ConnectionInterface$2 = __webpack_require__(14).ConnectionInterface.get(),
15200 EDGES = _ConnectionInterface$2.EDGES;
15201
15202 if (!findArg(field, __webpack_require__(17).FIRST) && !findArg(field, __webpack_require__(17).LAST)) {
15203 throw __webpack_require__(1).createUserError("Expected field `".concat(field.name, ": ") + "".concat(String(field.type), "` to have a ").concat(__webpack_require__(17).FIRST, " or ").concat(__webpack_require__(17).LAST, " argument in ") + "document `".concat(definitionName, "`."), [field.loc]);
15204 }
15205
15206 if (!field.selections.some(function (selection) {
15207 return selection.kind === 'LinkedField' && selection.name === EDGES;
15208 })) {
15209 throw __webpack_require__(1).createUserError("Expected field `".concat(field.name, ": ") + "".concat(String(field.type), "` to have a ").concat(EDGES, " selection in document ") + "`".concat(definitionName, "`."), [field.loc]);
15210 }
15211}
15212/**
15213 * @internal
15214 *
15215 * Validates that the type satisfies the Connection specification:
15216 * - The type has an edges field, and edges have scalar `cursor` and object
15217 * `node` fields.
15218 * - The type has a page info field which is an object with the correct
15219 * subfields.
15220 */
15221
15222
15223function validateConnectionType(definitionName, field) {
15224 var type = field.type;
15225
15226 var _ConnectionInterface$3 = __webpack_require__(14).ConnectionInterface.get(),
15227 CURSOR = _ConnectionInterface$3.CURSOR,
15228 EDGES = _ConnectionInterface$3.EDGES,
15229 END_CURSOR = _ConnectionInterface$3.END_CURSOR,
15230 HAS_NEXT_PAGE = _ConnectionInterface$3.HAS_NEXT_PAGE,
15231 HAS_PREV_PAGE = _ConnectionInterface$3.HAS_PREV_PAGE,
15232 NODE = _ConnectionInterface$3.NODE,
15233 PAGE_INFO = _ConnectionInterface$3.PAGE_INFO,
15234 START_CURSOR = _ConnectionInterface$3.START_CURSOR;
15235
15236 var typeWithFields = __webpack_require__(3).assertTypeWithFields(__webpack_require__(3).getNullableType(type));
15237
15238 var typeFields = typeWithFields.getFields();
15239 var edges = typeFields[EDGES];
15240
15241 if (edges == null) {
15242 throw __webpack_require__(1).createUserError("Expected type '".concat(String(type), "' to have an '").concat(EDGES, "' field in document '").concat(definitionName, "'."), [field.loc]);
15243 }
15244
15245 var edgesType = __webpack_require__(3).getNullableType(edges.type);
15246
15247 if (!(edgesType instanceof __webpack_require__(0).GraphQLList)) {
15248 throw __webpack_require__(1).createUserError("Expected '".concat(EDGES, "' field on type '").concat(String(type), "' to be a list type in document '").concat(definitionName, "'."), [field.loc]);
15249 }
15250
15251 var edgeType = __webpack_require__(3).getNullableType(edgesType.ofType);
15252
15253 if (!(edgeType instanceof __webpack_require__(0).GraphQLObjectType)) {
15254 throw __webpack_require__(1).createUserError("Expected '".concat(EDGES, "' field on type '").concat(String(type), "' to be a list of objects in document '").concat(definitionName, "'."), [field.loc]);
15255 }
15256
15257 var node = edgeType.getFields()[NODE];
15258
15259 if (node == null) {
15260 throw __webpack_require__(1).createUserError("Expected type '".concat(String(type), "' to have have a '").concat(EDGES, " { ").concat(NODE, " }' field in in document '").concat(definitionName, "'."), [field.loc]);
15261 }
15262
15263 var nodeType = __webpack_require__(3).getNullableType(node.type);
15264
15265 if (!(nodeType instanceof __webpack_require__(0).GraphQLInterfaceType || nodeType instanceof __webpack_require__(0).GraphQLUnionType || nodeType instanceof __webpack_require__(0).GraphQLObjectType)) {
15266 throw __webpack_require__(1).createUserError("Expected type '".concat(String(type), "' to have a '").concat(EDGES, " { ").concat(NODE, " }' field for which the type is an interface, object, or union in document '").concat(definitionName, "'."), [field.loc]);
15267 }
15268
15269 var cursor = edgeType.getFields()[CURSOR];
15270
15271 if (cursor == null || !(__webpack_require__(3).getNullableType(cursor.type) instanceof __webpack_require__(0).GraphQLScalarType)) {
15272 throw __webpack_require__(1).createUserError("Expected type '".concat(String(type), "' to have a '").concat(EDGES, " { ").concat(CURSOR, " }' scalar field in document '").concat(definitionName, "'."), [field.loc]);
15273 }
15274
15275 var pageInfo = typeFields[PAGE_INFO];
15276
15277 if (pageInfo == null) {
15278 throw __webpack_require__(1).createUserError("Expected type '".concat(String(type), "' to have a '").concat(EDGES, " { ").concat(PAGE_INFO, " }' field in document '").concat(definitionName, "'."), [field.loc]);
15279 }
15280
15281 var pageInfoType = __webpack_require__(3).getNullableType(pageInfo.type);
15282
15283 if (!(pageInfoType instanceof __webpack_require__(0).GraphQLObjectType)) {
15284 throw __webpack_require__(1).createUserError("Expected type '".concat(String(type), "' to have a '").concat(EDGES, " { ").concat(PAGE_INFO, " }' field with object type in document '").concat(definitionName, "'."), [field.loc]);
15285 }
15286
15287 [END_CURSOR, HAS_NEXT_PAGE, HAS_PREV_PAGE, START_CURSOR].forEach(function (fieldName) {
15288 var pageInfoField = pageInfoType.getFields()[fieldName];
15289
15290 if (pageInfoField == null || !(__webpack_require__(3).getNullableType(pageInfoField.type) instanceof __webpack_require__(0).GraphQLScalarType)) {
15291 throw __webpack_require__(1).createUserError("Expected type '".concat(String(pageInfo.type), "' to have a '").concat(fieldName, "' scalar field in document '").concat(definitionName, "'."), [field.loc]);
15292 }
15293 });
15294}
15295
15296module.exports = {
15297 CONNECTION: CONNECTION,
15298 SCHEMA_EXTENSION: SCHEMA_EXTENSION,
15299 transform: relayConnectionTransform
15300};
15301
15302/***/ }),
15303/* 87 */
15304/***/ (function(module, exports, __webpack_require__) {
15305
15306"use strict";
15307/**
15308 * Copyright (c) Facebook, Inc. and its affiliates.
15309 *
15310 * This source code is licensed under the MIT license found in the
15311 * LICENSE file in the root directory of this source tree.
15312 *
15313 * strict-local
15314 * @format
15315 */
15316
15317
15318var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
15319
15320var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
15321
15322var VIEWER_TYPE_NAME = 'Viewer';
15323var VIEWER_FIELD_NAME = 'viewer';
15324var NODE_TYPE_NAME = 'Node';
15325var NODE_FIELD_NAME = 'node';
15326var SCHEMA_EXTENSION = "\n directive @refetchable(\n queryName: String!\n ) on FRAGMENT_DEFINITION\n";
15327/**
15328 * This transform synthesizes "refetch" queries for fragments that
15329 * are trivially refetchable. This is comprised of three main stages:
15330 *
15331 * 1. Validating that fragments marked with @refetchable qualify for
15332 * refetch query generation; mainly this means that the fragment
15333 * type is able to be refetched in some canonical way.
15334 * 2. Determining the variable definitions to use for each generated
15335 * query. GraphQL does not have a notion of fragment-local variables
15336 * at all, and although Relay adds this concept developers are still
15337 * allowed to reference global variables. This necessitates a
15338 * visiting all reachable fragments for each @refetchable fragment,
15339 * and finding the union of all global variables expceted to be defined.
15340 * 3. Building the refetch queries, a straightforward copying transform from
15341 * Fragment to Root IR nodes.
15342 */
15343
15344function relayRefetchableFragmentTransform(context) {
15345 var schema = context.serverSchema;
15346 var queryType = schema.getQueryType();
15347
15348 if (queryType == null) {
15349 throw __webpack_require__(1).createUserError('Expected the schema to define a query type.');
15350 }
15351
15352 var refetchOperations = buildRefetchMap(context);
15353 var nextContext = context;
15354
15355 var errors = __webpack_require__(1).eachWithErrors(refetchOperations, function (_ref2) {
15356 var refetchName = _ref2[0],
15357 fragment = _ref2[1];
15358 // Build a refetch operation according to the fragment's type:
15359 // the logic here is purely name-based, the actual transform
15360 // functions provide detailed validation as well as case-specific
15361 // error messages.
15362 var refetchDescriptor;
15363
15364 if (__webpack_require__(20)(fragment.type, queryType)) {
15365 refetchDescriptor = buildRefetchOperationOnQueryType(schema, fragment, refetchName);
15366 } else if (String(fragment.type) === VIEWER_TYPE_NAME) {
15367 // Validate that the schema conforms to the informal Viewer spec
15368 // and build the refetch query accordingly.
15369 refetchDescriptor = buildRefetchOperationOnViewerType(schema, fragment, refetchName);
15370 } else if (String(fragment.type) === NODE_TYPE_NAME || fragment.type instanceof __webpack_require__(0).GraphQLObjectType && fragment.type.getInterfaces().some(function (interfaceType) {
15371 return String(interfaceType) === NODE_TYPE_NAME;
15372 })) {
15373 // Validate that the schema conforms to the Object Identity (Node) spec
15374 // and build the refetch query accordingly.
15375 refetchDescriptor = buildRefetchOperationOnNodeType(schema, fragment, refetchName);
15376 } else {
15377 throw __webpack_require__(1).createUserError("Invalid use of @refetchable on fragment '".concat(fragment.name, "', only fragments on the Query type, Viewer type, Node type, or types implementing Node are supported."), [fragment.loc]);
15378 }
15379
15380 if (refetchDescriptor != null) {
15381 var _connectionMetadata;
15382
15383 var _refetchDescriptor = refetchDescriptor,
15384 path = _refetchDescriptor.path,
15385 node = _refetchDescriptor.node;
15386 var connectionMetadata = extractConnectionMetadata(fragment);
15387 nextContext = nextContext.replace((0, _objectSpread2["default"])({}, fragment, {
15388 metadata: (0, _objectSpread2["default"])({}, fragment.metadata || {}, {
15389 refetch: {
15390 connection: (_connectionMetadata = connectionMetadata) !== null && _connectionMetadata !== void 0 ? _connectionMetadata : null,
15391 operation: refetchName,
15392 fragmentPathInResult: path
15393 }
15394 })
15395 }));
15396 nextContext = nextContext.add((0, _objectSpread2["default"])({}, node, {
15397 metadata: (0, _objectSpread2["default"])({}, node.metadata || {}, {
15398 derivedFrom: fragment.name
15399 })
15400 }));
15401 }
15402 });
15403
15404 if (errors != null && errors.length) {
15405 throw __webpack_require__(1).createCombinedError(errors, 'RelayRefetchableFragmentTransform');
15406 }
15407
15408 return nextContext;
15409}
15410/**
15411 * Walk the documents of a compiler context and create a mapping of
15412 * refetch operation names to the source fragment from which the refetch
15413 * operation should be derived.
15414 */
15415
15416
15417function buildRefetchMap(context) {
15418 var refetchOperations = new Map();
15419
15420 var errors = __webpack_require__(1).eachWithErrors(context.documents(), function (node) {
15421 if (node.kind !== 'Fragment') {
15422 return;
15423 }
15424
15425 var refetchName = getRefetchQueryName(node);
15426
15427 if (refetchName === null) {
15428 return;
15429 }
15430
15431 var previousOperation = refetchOperations.get(refetchName);
15432
15433 if (previousOperation != null) {
15434 throw __webpack_require__(1).createUserError("Duplicate definition for @refetchable operation '".concat(refetchName, "' from fragments '").concat(node.name, "' and '").concat(previousOperation.name, "'"), [node.loc, previousOperation.loc]);
15435 }
15436
15437 refetchOperations.set(refetchName, node);
15438 });
15439
15440 if (errors != null && errors.length !== 0) {
15441 throw __webpack_require__(1).createCombinedError(errors, 'RelayRefetchableFragmentTransform');
15442 }
15443
15444 var transformed = __webpack_require__(88)(context);
15445
15446 return new Map(Array.from(refetchOperations.entries(), function (_ref3) {
15447 var name = _ref3[0],
15448 fragment = _ref3[1];
15449 return [name, transformed.getFragment(fragment.name)];
15450 }));
15451}
15452/**
15453 * Validate that any @connection usage is valid for refetching:
15454 * - Variables are used for both the "count" and "cursor" arguments
15455 * (after/first or before/last)
15456 * - Exactly one connection
15457 * - Has a stable path to the connection data
15458 *
15459 * Returns connection metadata to add to the transformed fragment or undefined
15460 * if there is no connection.
15461 */
15462
15463
15464function extractConnectionMetadata(fragment) {
15465 var fields = [];
15466 var connectionField = null;
15467 var path = null;
15468
15469 __webpack_require__(23).visit(fragment, {
15470 LinkedField: {
15471 enter: function enter(field) {
15472 fields.push(field);
15473
15474 if (field.handles && field.handles.some(function (handle) {
15475 return handle.name === 'connection';
15476 }) || field.directives.some(function (directive) {
15477 return directive.name === 'connection';
15478 })) {
15479 // Disallow multiple @connections
15480 if (connectionField != null) {
15481 throw __webpack_require__(1).createUserError("Invalid use of @refetchable with @connection in fragment '".concat(fragment.name, "', at most once @connection can appear in a refetchable fragment."), [field.loc]);
15482 } // Disallow connections within plurals
15483
15484
15485 var pluralOnPath = fields.find(function (pathField) {
15486 return __webpack_require__(0).getNullableType(pathField.type) instanceof __webpack_require__(0).GraphQLList;
15487 });
15488
15489 if (pluralOnPath) {
15490 throw __webpack_require__(1).createUserError("Invalid use of @refetchable with @connection in fragment '".concat(fragment.name, "', refetchable connections cannot appear inside plural fields."), [field.loc, pluralOnPath.loc]);
15491 }
15492
15493 connectionField = field;
15494 path = fields.map(function (pathField) {
15495 var _pathField$alias;
15496
15497 return (_pathField$alias = pathField.alias) !== null && _pathField$alias !== void 0 ? _pathField$alias : pathField.name;
15498 });
15499 }
15500 }
15501 },
15502 leave: function leave() {
15503 fields.pop();
15504 }
15505 });
15506
15507 if (connectionField == null || path == null) {
15508 return;
15509 } // Validate arguments: if either of before/last appear they must both appear
15510 // and use variables (not scalar values)
15511
15512
15513 var backward = null;
15514 var before = findArgument(connectionField, 'before');
15515 var last = findArgument(connectionField, 'last');
15516
15517 if (before || last) {
15518 if (!before || !last || before.value.kind !== 'Variable' || last.value.kind !== 'Variable') {
15519 throw __webpack_require__(1).createUserError("Invalid use of @refetchable with @connection in fragment '".concat(fragment.name, "', refetchable connections must use variables for the before and last arguments."), [connectionField.loc, before && before.value.kind !== 'Variable' ? before.value.loc : null, last && last.value.kind !== 'Variable' ? last.value.loc : null].filter(Boolean));
15520 }
15521
15522 backward = {
15523 count: last.value.variableName,
15524 cursor: before.value.variableName
15525 };
15526 } // Validate arguments: if either of after/first appear they must both appear
15527 // and use variables (not scalar values)
15528
15529
15530 var forward = null;
15531 var after = findArgument(connectionField, 'after');
15532 var first = findArgument(connectionField, 'first');
15533
15534 if (after || first) {
15535 if (!after || !first || after.value.kind !== 'Variable' || first.value.kind !== 'Variable') {
15536 throw __webpack_require__(1).createUserError("Invalid use of @refetchable with @connection in fragment '".concat(fragment.name, "', refetchable connections must use variables for the after and first arguments."), [connectionField.loc, after && after.value.kind !== 'Variable' ? after.value.loc : null, first && first.value.kind !== 'Variable' ? first.value.loc : null].filter(Boolean));
15537 }
15538
15539 forward = {
15540 count: first.value.variableName,
15541 cursor: after.value.variableName
15542 };
15543 }
15544
15545 return {
15546 forward: forward,
15547 backward: backward,
15548 path: path
15549 };
15550}
15551
15552function buildOperationArgumentDefinitions(argumentDefinitions) {
15553 return argumentDefinitions.map(function (argDef) {
15554 if (argDef.kind === 'LocalArgumentDefinition') {
15555 return argDef;
15556 } else {
15557 return {
15558 kind: 'LocalArgumentDefinition',
15559 name: argDef.name,
15560 type: argDef.type,
15561 defaultValue: null,
15562 loc: argDef.loc,
15563 metadata: null
15564 };
15565 }
15566 });
15567}
15568
15569function buildFragmentSpread(fragment) {
15570 var args = [];
15571 var _iteratorNormalCompletion = true;
15572 var _didIteratorError = false;
15573 var _iteratorError = undefined;
15574
15575 try {
15576 for (var _iterator = fragment.argumentDefinitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
15577 var argDef = _step.value;
15578
15579 if (argDef.kind !== 'LocalArgumentDefinition') {
15580 continue;
15581 }
15582
15583 args.push({
15584 kind: 'Argument',
15585 loc: {
15586 kind: 'Derived',
15587 source: argDef.loc
15588 },
15589 metadata: null,
15590 name: argDef.name,
15591 type: argDef.type,
15592 value: {
15593 kind: 'Variable',
15594 loc: {
15595 kind: 'Derived',
15596 source: argDef.loc
15597 },
15598 metadata: null,
15599 variableName: argDef.name,
15600 type: argDef.type
15601 }
15602 });
15603 }
15604 } catch (err) {
15605 _didIteratorError = true;
15606 _iteratorError = err;
15607 } finally {
15608 try {
15609 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
15610 _iterator["return"]();
15611 }
15612 } finally {
15613 if (_didIteratorError) {
15614 throw _iteratorError;
15615 }
15616 }
15617 }
15618
15619 return {
15620 args: args,
15621 directives: [],
15622 kind: 'FragmentSpread',
15623 loc: {
15624 kind: 'Derived',
15625 source: fragment.loc
15626 },
15627 metadata: null,
15628 name: fragment.name
15629 };
15630}
15631
15632function buildRefetchOperationOnQueryType(schema, fragment, queryName) {
15633 var queryType = __webpack_require__(22)(schema.getQueryType());
15634
15635 return {
15636 path: [],
15637 node: {
15638 argumentDefinitions: buildOperationArgumentDefinitions(fragment.argumentDefinitions),
15639 directives: [],
15640 kind: 'Root',
15641 loc: {
15642 kind: 'Derived',
15643 source: fragment.loc
15644 },
15645 metadata: null,
15646 name: queryName,
15647 operation: 'query',
15648 selections: [buildFragmentSpread(fragment)],
15649 type: queryType
15650 }
15651 };
15652}
15653
15654function buildRefetchOperationOnViewerType(schema, fragment, queryName) {
15655 // Handle fragments on viewer
15656 var queryType = __webpack_require__(22)(schema.getQueryType());
15657
15658 var viewerType = schema.getType(VIEWER_TYPE_NAME);
15659 var viewerField = queryType.getFields()[VIEWER_FIELD_NAME];
15660
15661 if (!(viewerType instanceof __webpack_require__(0).GraphQLObjectType && viewerField != null && viewerField.type instanceof __webpack_require__(0).GraphQLObjectType && __webpack_require__(20)(viewerField.type, viewerType) && viewerField.args.length === 0 && __webpack_require__(20)(fragment.type, viewerType))) {
15662 throw __webpack_require__(1).createUserError("Invalid use of @refetchable on fragment '".concat(fragment.name, "', check that your schema defines a 'Viewer' object type and has a 'viewer: Viewer' field on the query type."), [fragment.loc]);
15663 }
15664
15665 return {
15666 path: [VIEWER_FIELD_NAME],
15667 node: {
15668 argumentDefinitions: buildOperationArgumentDefinitions(fragment.argumentDefinitions),
15669 directives: [],
15670 kind: 'Root',
15671 loc: {
15672 kind: 'Derived',
15673 source: fragment.loc
15674 },
15675 metadata: null,
15676 name: queryName,
15677 operation: 'query',
15678 selections: [{
15679 alias: null,
15680 args: [],
15681 directives: [],
15682 handles: null,
15683 kind: 'LinkedField',
15684 loc: {
15685 kind: 'Derived',
15686 source: fragment.loc
15687 },
15688 metadata: null,
15689 name: VIEWER_FIELD_NAME,
15690 selections: [buildFragmentSpread(fragment)],
15691 type: viewerType
15692 }],
15693 type: queryType
15694 }
15695 };
15696}
15697
15698function buildRefetchOperationOnNodeType(schema, fragment, queryName) {
15699 var queryType = __webpack_require__(22)(schema.getQueryType());
15700
15701 var nodeType = schema.getType(NODE_TYPE_NAME);
15702 var nodeField = queryType.getFields()[NODE_FIELD_NAME];
15703
15704 if (!(nodeType instanceof __webpack_require__(0).GraphQLInterfaceType && nodeField != null && nodeField.type instanceof __webpack_require__(0).GraphQLInterfaceType && __webpack_require__(20)(nodeField.type, nodeType) && nodeField.args.length === 1 && nodeField.args[0].name === 'id' && __webpack_require__(20)(__webpack_require__(0).getNullableType(nodeField.args[0].type), __webpack_require__(0).GraphQLID) && ( // the fragment must be on Node or on a type that implements Node
15705 fragment.type instanceof __webpack_require__(0).GraphQLInterfaceType && __webpack_require__(20)(fragment.type, nodeType) || fragment.type instanceof __webpack_require__(0).GraphQLObjectType && fragment.type.getInterfaces().some(function (interfaceType) {
15706 return __webpack_require__(20)(interfaceType, nodeType);
15707 })))) {
15708 throw __webpack_require__(1).createUserError("Invalid use of @refetchable on fragment '".concat(fragment.name, "', check that your schema defines a 'Node { id: ID }' interface and has a 'node(id: ID): Node' field on the query type (the id argument may also be non-null)."), [fragment.loc]);
15709 }
15710
15711 var argumentDefinitions = buildOperationArgumentDefinitions(fragment.argumentDefinitions);
15712 var idArgument = argumentDefinitions.find(function (argDef) {
15713 return argDef.name === 'id';
15714 });
15715
15716 if (idArgument != null) {
15717 throw __webpack_require__(1).createUserError("Invalid use of @refetchable on fragment '".concat(fragment.name, "', this fragment already has an '$id' variable in scope."), [idArgument.loc]);
15718 }
15719
15720 var idSelection = fragment.selections.find(function (selection) {
15721 return selection.kind === 'ScalarField' && selection.name === 'id' && selection.alias == null && __webpack_require__(20)(__webpack_require__(0).getNullableType(selection.type), __webpack_require__(0).GraphQLID);
15722 });
15723
15724 if (idSelection == null) {
15725 throw __webpack_require__(1).createUserError("Invalid use of @refetchable on fragment '".concat(fragment.name, "', refetchable fragments on Node (or types implementing Node) must fetch the 'id' field without an alias."), [fragment.loc]);
15726 }
15727
15728 var idArgType = new (__webpack_require__(0).GraphQLNonNull)(__webpack_require__(0).GraphQLID);
15729 var argumentDefinitionsWithId = (0, _toConsumableArray2["default"])(argumentDefinitions).concat([{
15730 defaultValue: null,
15731 kind: 'LocalArgumentDefinition',
15732 loc: {
15733 kind: 'Derived',
15734 source: fragment.loc
15735 },
15736 metadata: null,
15737 name: 'id',
15738 type: idArgType
15739 }]);
15740 return {
15741 path: [NODE_FIELD_NAME],
15742 node: {
15743 argumentDefinitions: argumentDefinitionsWithId,
15744 directives: [],
15745 kind: 'Root',
15746 loc: {
15747 kind: 'Derived',
15748 source: fragment.loc
15749 },
15750 metadata: null,
15751 name: queryName,
15752 operation: 'query',
15753 selections: [{
15754 alias: null,
15755 args: [{
15756 kind: 'Argument',
15757 loc: {
15758 kind: 'Derived',
15759 source: fragment.loc
15760 },
15761 metadata: null,
15762 name: 'id',
15763 type: idArgType,
15764 value: {
15765 kind: 'Variable',
15766 loc: {
15767 kind: 'Derived',
15768 source: fragment.loc
15769 },
15770 metadata: null,
15771 variableName: 'id',
15772 type: idArgType
15773 }
15774 }],
15775 directives: [],
15776 handles: null,
15777 kind: 'LinkedField',
15778 loc: {
15779 kind: 'Derived',
15780 source: fragment.loc
15781 },
15782 metadata: null,
15783 name: NODE_FIELD_NAME,
15784 selections: [buildFragmentSpread(fragment)],
15785 type: nodeType
15786 }],
15787 type: queryType
15788 }
15789 };
15790}
15791
15792function getRefetchQueryName(fragment) {
15793 var refetchableDirective = fragment.directives.find(function (directive) {
15794 return directive.name === 'refetchable';
15795 });
15796
15797 if (refetchableDirective == null) {
15798 return null;
15799 }
15800
15801 var refetchArguments = __webpack_require__(33)(refetchableDirective.args);
15802
15803 var queryName = refetchArguments.queryName;
15804
15805 if (typeof queryName !== 'string') {
15806 var _ref;
15807
15808 var queryNameArg = refetchableDirective.args.find(function (arg) {
15809 return arg.name === 'queryName';
15810 });
15811 throw __webpack_require__(1).createCompilerError("Expected the 'name' argument of @refetchable to be a string, got '".concat(String(queryName), "'."), [(_ref = queryNameArg === null || queryNameArg === void 0 ? void 0 : queryNameArg.loc) !== null && _ref !== void 0 ? _ref : refetchableDirective.loc]);
15812 }
15813
15814 return queryName;
15815}
15816
15817function findArgument(field, argumentName) {
15818 var _field$args$find;
15819
15820 return (_field$args$find = field.args.find(function (arg) {
15821 return arg.name === argumentName;
15822 })) !== null && _field$args$find !== void 0 ? _field$args$find : null;
15823}
15824
15825module.exports = {
15826 SCHEMA_EXTENSION: SCHEMA_EXTENSION,
15827 transform: relayRefetchableFragmentTransform
15828};
15829
15830/***/ }),
15831/* 88 */
15832/***/ (function(module, exports, __webpack_require__) {
15833
15834"use strict";
15835/**
15836 * Copyright (c) Facebook, Inc. and its affiliates.
15837 *
15838 * This source code is licensed under the MIT license found in the
15839 * LICENSE file in the root directory of this source tree.
15840 *
15841 * strict-local
15842 * @format
15843 */
15844
15845
15846var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
15847
15848/**
15849 * Returns a transformed version of the input context where each document's
15850 * argument definitions are updated to accurately describe the root variables
15851 * used (or reachable) from that document:
15852 * - Fragment argument definitions are updated to include local argument
15853 * definitions and any root variables that are referenced
15854 * by the fragment (or any fragments it transitively spreads).
15855 * - Root argument definitions are updated to reflect the variables
15856 * referenced locally and all root variables referenced by any
15857 * fragments it (transitively) spreads.
15858 */
15859function inferRootArgumentDefinitions(context) {
15860 // This transform does two main tasks:
15861 // - Determine the set of root variables referenced locally in each
15862 // fragment. Note that RootArgumentDefinitions in the fragment's
15863 // argumentDefinitions can contain spurious entries for legacy
15864 // reasons. Instead of using those the fragment is traversed
15865 // to reanalyze variable usage.
15866 // - Determine the set of root variables that are transitively referenced
15867 // by each fragment, ie the union of all root variables used in the
15868 // fragment and any fragments it transitively spreads.
15869 // Cache fragments as they are transformed to avoid duplicate processing.
15870 // Because @argument values don't matter (only variable names/types),
15871 // each reachable fragment only has to be checked once.
15872 var transformed = new Map();
15873 var nextContext = new (__webpack_require__(51))(context.serverSchema, context.clientSchema);
15874 return nextContext.addAll(Array.from(context.documents(), function (node) {
15875 switch (node.kind) {
15876 case 'Fragment':
15877 {
15878 var argumentDefinitions = transformFragmentArguments(context, transformed, node);
15879 return (0, _objectSpread2["default"])({}, node, {
15880 argumentDefinitions: Array.from(argumentDefinitions.values())
15881 });
15882 }
15883
15884 case 'Root':
15885 {
15886 return transformRoot(context, transformed, node);
15887 }
15888
15889 case 'SplitOperation':
15890 {
15891 return node;
15892 }
15893
15894 default:
15895 {
15896 node;
15897 throw __webpack_require__(1).createCompilerError("inferRootArgumentDefinitions: Unsupported kind '".concat(node.kind, "'."));
15898 }
15899 }
15900 }));
15901}
15902
15903function transformRoot(context, transformed, root) {
15904 // Ignore argument definitions, determine what root variables are
15905 // transitively referenced
15906 var argumentDefinitions = new Map();
15907 var localArgumentDefinitions = new Map();
15908 var _iteratorNormalCompletion = true;
15909 var _didIteratorError = false;
15910 var _iteratorError = undefined;
15911
15912 try {
15913 for (var _iterator = root.argumentDefinitions.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
15914 var _step$value = _step.value,
15915 name = _step$value[0],
15916 argDef = _step$value[1];
15917
15918 if (argDef.kind === 'LocalArgumentDefinition') {
15919 localArgumentDefinitions.set(name, argDef);
15920 }
15921 }
15922 } catch (err) {
15923 _didIteratorError = true;
15924 _iteratorError = err;
15925 } finally {
15926 try {
15927 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
15928 _iterator["return"]();
15929 }
15930 } finally {
15931 if (_didIteratorError) {
15932 throw _iteratorError;
15933 }
15934 }
15935 }
15936
15937 visit(context, transformed, argumentDefinitions, root);
15938 return (0, _objectSpread2["default"])({}, root, {
15939 argumentDefinitions: Array.from(argumentDefinitions.values(), function (argDef) {
15940 var _ref, _ref2;
15941
15942 if (argDef.kind !== 'RootArgumentDefinition') {
15943 throw __webpack_require__(1).createCompilerError("inferRootArgumentDefinitions: Expected inferred variable '$".concat(argDef.name, "' to be a root variables."), [argDef.loc]);
15944 }
15945
15946 var localDefinition = localArgumentDefinitions.get(argDef.name);
15947 return {
15948 defaultValue: (_ref = localDefinition === null || localDefinition === void 0 ? void 0 : localDefinition.defaultValue) !== null && _ref !== void 0 ? _ref : null,
15949 kind: 'LocalArgumentDefinition',
15950 loc: argDef.loc,
15951 metadata: null,
15952 name: argDef.name,
15953 type: (_ref2 = localDefinition === null || localDefinition === void 0 ? void 0 : localDefinition.type) !== null && _ref2 !== void 0 ? _ref2 : argDef.type
15954 };
15955 })
15956 });
15957}
15958
15959function transformFragmentArguments(context, transformed, fragment) {
15960 var name = fragment.name;
15961 var transformedArguments = transformed.get(name);
15962
15963 if (transformedArguments != null) {
15964 return transformedArguments;
15965 } // Start with only the explicitly defined local arguments, recover the
15966 // correct set of root variables excluding invalid @arguments values.
15967
15968
15969 var argumentDefinitions = new Map();
15970 fragment.argumentDefinitions.forEach(function (argDef) {
15971 if (argDef.kind === 'LocalArgumentDefinition') {
15972 argumentDefinitions.set(argDef.name, argDef);
15973 }
15974 }); // Break cycles by initially caching a version that only has local
15975 // arguments. If the current fragment is reached again, it won't have
15976 // any root variables to add to its parents. The traversal below will
15977 // find any root variables and update the cached version of the
15978 // fragment.
15979
15980 transformed.set(name, argumentDefinitions);
15981 visit(context, transformed, argumentDefinitions, fragment);
15982 transformed.set(name, argumentDefinitions);
15983 return argumentDefinitions;
15984}
15985
15986function visit(context, transformed, argumentDefinitions, node) {
15987 __webpack_require__(23).visit(node, {
15988 FragmentSpread: function FragmentSpread(fragmentSpread) {
15989 var fragment;
15990
15991 try {
15992 fragment = context.getFragment(fragmentSpread.name);
15993 } catch (_unused) {
15994 // Handle cases where a compat fragment references a classic fragment
15995 // that is not accessible to Relay compiler
15996 // TODO: disallow unknown fragment references
15997 // throw createCompilerError(
15998 // `Document '${node.name}' referenced unknown fragment '${
15999 // fragmentSpread.name
16000 // }'.`,
16001 // [fragmentSpread.loc],
16002 // );
16003 return false;
16004 }
16005
16006 var referencedFragmentArguments = transformFragmentArguments(context, transformed, fragment); // Detect root variables being passed as the value of @arguments;
16007 // recover the expected type from the corresponding argument definitions.
16008
16009 fragmentSpread.args.forEach(function (arg) {
16010 var argDef = referencedFragmentArguments.get(arg.name);
16011
16012 if (argDef != null && arg.value.kind === 'Variable' && !argumentDefinitions.has(arg.value.variableName)) {
16013 argumentDefinitions.set(arg.value.variableName, {
16014 kind: 'RootArgumentDefinition',
16015 loc: {
16016 kind: 'Derived',
16017 source: arg.loc
16018 },
16019 metadata: null,
16020 name: arg.value.variableName,
16021 type: argDef.type
16022 });
16023 }
16024 }); // Merge any root variables referenced by the spread fragment
16025 // into this (parent) fragment's arguments.
16026
16027 var _iteratorNormalCompletion2 = true;
16028 var _didIteratorError2 = false;
16029 var _iteratorError2 = undefined;
16030
16031 try {
16032 for (var _iterator2 = referencedFragmentArguments.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
16033 var argDef = _step2.value;
16034
16035 if (argDef.kind === 'RootArgumentDefinition' && !argumentDefinitions.has(argDef.name)) {
16036 argumentDefinitions.set(argDef.name, argDef);
16037 }
16038 }
16039 } catch (err) {
16040 _didIteratorError2 = true;
16041 _iteratorError2 = err;
16042 } finally {
16043 try {
16044 if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
16045 _iterator2["return"]();
16046 }
16047 } finally {
16048 if (_didIteratorError2) {
16049 throw _iteratorError2;
16050 }
16051 }
16052 }
16053
16054 return false;
16055 },
16056 Argument: function Argument(argument) {
16057 if (argument.value.kind !== 'Variable') {
16058 return false;
16059 }
16060
16061 var variable = argument.value;
16062
16063 if (argument.type == null && variable.type == null) {
16064 return;
16065 }
16066
16067 if (!argumentDefinitions.has(variable.variableName)) {
16068 // root variable
16069 argumentDefinitions.set(variable.variableName, {
16070 kind: 'RootArgumentDefinition',
16071 loc: {
16072 kind: 'Derived',
16073 source: argument.loc
16074 },
16075 metadata: null,
16076 name: variable.variableName,
16077 type: variable.type || argument.type
16078 });
16079 }
16080
16081 return false;
16082 },
16083 Condition: function Condition(condition) {
16084 var _variable$type;
16085
16086 if (condition.condition.kind !== 'Variable') {
16087 return;
16088 }
16089
16090 var variable = condition.condition;
16091 var type = (_variable$type = variable.type) !== null && _variable$type !== void 0 ? _variable$type : new (__webpack_require__(0).GraphQLNonNull)(__webpack_require__(0).GraphQLBoolean);
16092
16093 if (!argumentDefinitions.has(variable.variableName)) {
16094 // root variable
16095 argumentDefinitions.set(variable.variableName, {
16096 kind: 'RootArgumentDefinition',
16097 loc: {
16098 kind: 'Derived',
16099 source: condition.loc
16100 },
16101 metadata: null,
16102 name: variable.variableName,
16103 type: type
16104 });
16105 }
16106 }
16107 });
16108}
16109
16110module.exports = inferRootArgumentDefinitions;
16111
16112/***/ }),
16113/* 89 */
16114/***/ (function(module, exports, __webpack_require__) {
16115
16116"use strict";
16117/**
16118 * Copyright (c) Facebook, Inc. and its affiliates.
16119 *
16120 * This source code is licensed under the MIT license found in the
16121 * LICENSE file in the root directory of this source tree.
16122 *
16123 *
16124 * @format
16125 */
16126
16127
16128var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
16129
16130var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
16131
16132/**
16133 * A transform that removes redundant fields and fragment spreads. Redundancy is
16134 * defined in this context as any selection that is guaranteed to already be
16135 * fetched by an ancestor selection. This can occur in two cases:
16136 *
16137 * 1. Simple duplicates at the same level of the document can always be skipped:
16138 *
16139 * ```
16140 * fragment Foo on FooType {
16141 * id
16142 * id
16143 * ...Bar
16144 * ...Bar
16145 * }
16146 * ```
16147 *
16148 * Becomes
16149 *
16150 * ```
16151 * fragment Foo on FooType {
16152 * id
16153 * ...Bar
16154 * }
16155 * ```
16156 *
16157 * 2. Inline fragments and conditions introduce the possibility for duplication
16158 * at different levels of the tree. Whenever a selection is fetched in a parent,
16159 * it is redundant to also fetch it in a child:
16160 *
16161 * ```
16162 * fragment Foo on FooType {
16163 * id
16164 * ... on OtherType {
16165 * id # 1
16166 * }
16167 * ... on FooType @include(if: $cond) {
16168 * id # 2
16169 * }
16170 * }
16171 * ```
16172 *
16173 * Becomes:
16174 *
16175 * ```
16176 * fragment Foo on FooType {
16177 * id
16178 * }
16179 * ```
16180 *
16181 * In this example:
16182 * - 1 can be skipped because `id` is already fetched by the parent. Even
16183 * though the type is different (FooType/OtherType), the inline fragment
16184 * cannot match without the outer fragment matching so the outer `id` is
16185 * guaranteed to already be fetched.
16186 * - 2 can be skipped for similar reasons: it doesn't matter if the condition
16187 * holds, `id` is already fetched by the parent regardless.
16188 *
16189 * This transform also handles more complicated cases in which selections are
16190 * nested:
16191 *
16192 * ```
16193 * fragment Foo on FooType {
16194 * a {
16195 * bb
16196 * }
16197 * ... on OtherType {
16198 * a {
16199 * bb # 1
16200 * cc
16201 * }
16202 * }
16203 * }
16204 * ```
16205 *
16206 * Becomes
16207 *
16208 * ```
16209 * fragment Foo on FooType {
16210 * a {
16211 * bb
16212 * }
16213 * ... on OtherType {
16214 * a {
16215 * cc
16216 * }
16217 * }
16218 * }
16219 * ```
16220 *
16221 * 1 can be skipped because it is already fetched at the outer level.
16222 */
16223function skipRedundantNodesTransform(context) {
16224 return __webpack_require__(10).transform(context, {
16225 Root: visitNode,
16226 Fragment: visitNode
16227 });
16228}
16229
16230function visitNode(node) {
16231 return transformNode(node, new (__webpack_require__(25).Map)()).node;
16232}
16233/**
16234 * The most straightforward approach would be two passes: one to record the
16235 * structure of the document, one to prune duplicates. This implementation uses
16236 * a single pass. Selections are sorted with fields first, "conditionals"
16237 * (inline fragments & conditions) last. This means that all fields that are
16238 * guaranteed to be fetched are encountered prior to any duplicates that may be
16239 * fetched within a conditional.
16240 *
16241 * Because selections fetched within a conditional are not guaranteed to be
16242 * fetched in the parent, a fork of the selection map is created when entering a
16243 * conditional. The sort ensures that guaranteed fields have already been seen
16244 * prior to the clone.
16245 */
16246
16247
16248function transformNode(node, selectionMap) {
16249 var selections = [];
16250 sortSelections(node.selections).forEach(function (selection) {
16251 var identifier = __webpack_require__(75)(selection);
16252
16253 switch (selection.kind) {
16254 case 'ScalarField':
16255 case 'FragmentSpread':
16256 {
16257 if (!selectionMap.has(identifier)) {
16258 selections.push(selection);
16259 selectionMap = selectionMap.set(identifier, null);
16260 }
16261
16262 break;
16263 }
16264
16265 case 'Defer':
16266 case 'Stream':
16267 case 'MatchBranch':
16268 case 'MatchField':
16269 case 'LinkedField':
16270 {
16271 var transformed = transformNode(selection, selectionMap.get(identifier) || new (__webpack_require__(25).Map)());
16272
16273 if (transformed.node) {
16274 selections.push(transformed.node);
16275 selectionMap = selectionMap.set(identifier, transformed.selectionMap);
16276 }
16277
16278 break;
16279 }
16280
16281 case 'InlineFragment':
16282 case 'Condition':
16283 {
16284 // Fork the selection map to prevent conditional selections from
16285 // affecting the outer "guaranteed" selections.
16286 var _transformed = transformNode(selection, selectionMap.get(identifier) || selectionMap);
16287
16288 if (_transformed.node) {
16289 selections.push(_transformed.node);
16290 selectionMap = selectionMap.set(identifier, _transformed.selectionMap);
16291 }
16292
16293 break;
16294 }
16295
16296 default:
16297 selection;
16298 true ? true ? __webpack_require__(4)(false, 'SkipRedundantNodesTransform: Unexpected node kind `%s`.', selection.kind) : undefined : undefined;
16299 }
16300 });
16301 var nextNode = selections.length ? (0, _objectSpread2["default"])({}, node, {
16302 selections: selections
16303 }) : null;
16304 return {
16305 selectionMap: selectionMap,
16306 node: nextNode
16307 };
16308}
16309/**
16310 * Sort inline fragments and conditions after other selections.
16311 */
16312
16313
16314function sortSelections(selections) {
16315 return (0, _toConsumableArray2["default"])(selections).sort(function (a, b) {
16316 return a.kind === 'InlineFragment' || a.kind === 'Condition' ? 1 : b.kind === 'InlineFragment' || b.kind === 'Condition' ? -1 : 0;
16317 });
16318}
16319
16320module.exports = {
16321 transform: skipRedundantNodesTransform
16322};
16323
16324/***/ }),
16325/* 90 */
16326/***/ (function(module, exports, __webpack_require__) {
16327
16328"use strict";
16329/**
16330 * Copyright (c) Facebook, Inc. and its affiliates.
16331 *
16332 * This source code is licensed under the MIT license found in the
16333 * LICENSE file in the root directory of this source tree.
16334 *
16335 * strict-local
16336 * @format
16337 */
16338
16339
16340/**
16341 * Creates a scope for a `Root`, with each argument mapped to a variable of the
16342 * same name. Example:
16343 *
16344 * Query:
16345 * query Foo($id: ID, $size: Int = 42) { ... }
16346 *
16347 * Scope:
16348 * {
16349 * id: $id,
16350 * size: $size,
16351 * }
16352 *
16353 * Note that even though a default value is defined for $size, the scope must
16354 * assume that this could be overridden at runtime. The value cannot be decided
16355 * statically and therefore is set to a variable.
16356 */
16357function getRootScope(definitions) {
16358 var scope = {};
16359 definitions.forEach(function (definition) {
16360 scope[definition.name] = {
16361 kind: 'Variable',
16362 metadata: null,
16363 variableName: definition.name,
16364 type: definition.type
16365 };
16366 });
16367 return scope;
16368}
16369/**
16370 * Creates a scope for a `Fragment` by translating fragment spread arguments in
16371 * the context of a parent scope into a new scope and validating them against
16372 * the argument definitions.
16373 *
16374 *
16375 * Parent Scope:
16376 * {
16377 * active: $parentActive
16378 * }
16379 *
16380 * Fragment Spread:
16381 * ...Bar(size: 42, enabled: $active)
16382 *
16383 * Fragment:
16384 * fragment Bar on Foo @argumentDefinitions(
16385 * id: {type: "ID"}
16386 * size: {type: "Int"}
16387 * enabled: {type: "Boolean}
16388 * scale: {type: "Int", imports: "pixelRatio"}
16389 * )
16390 *
16391 * Scope:
16392 * {
16393 * // No argument is provided for $id, it gets the default value which in this
16394 * // case is `null`:
16395 * id: null,
16396 *
16397 * // The parent passes 42 as a literal value for $size:
16398 * size: 42,
16399 *
16400 * // The parent passes a variable as the value of $enabled. This variable is
16401 * // resolved in the parent scope to the value $parentActive, which becomes
16402 * // the value of $enabled:
16403 * $enabled: $parentActive,
16404 *
16405 * // $scale imports pixelRatio from the root scope. Since any argument in a
16406 * // root scope maps to a variable of the same name, that means the value of
16407 * // pixelRatio in the root is $pixelRatio:
16408 * $scale: $pixelRatio,
16409 * }
16410 */
16411
16412
16413function getFragmentScope(definitions, args, parentScope, spread) {
16414 var argMap = new Map();
16415 args.forEach(function (arg) {
16416 if (arg.value.kind === 'Literal') {
16417 argMap.set(arg.name, arg.value);
16418 } else if (arg.value.kind === 'Variable') {
16419 argMap.set(arg.name, parentScope[arg.value.variableName]);
16420 }
16421 });
16422 var fragmentScope = {};
16423
16424 var errors = __webpack_require__(1).eachWithErrors(definitions, function (definition) {
16425 if (definition.kind === 'RootArgumentDefinition') {
16426 if (argMap.has(definition.name)) {
16427 var _ref;
16428
16429 var argNode = args.find(function (a) {
16430 return a.name === definition.name;
16431 });
16432 throw __webpack_require__(1).createUserError("Unexpected argument '".concat(definition.name, "' supplied to fragment '").concat(spread.name, "'. @arguments may only be provided for variables defined in the fragment's @argumentDefinitions."), [(_ref = argNode === null || argNode === void 0 ? void 0 : argNode.loc) !== null && _ref !== void 0 ? _ref : spread.loc]);
16433 }
16434
16435 fragmentScope[definition.name] = {
16436 kind: 'Variable',
16437 metadata: null,
16438 variableName: definition.name,
16439 type: definition.type
16440 };
16441 } else {
16442 var arg = argMap.get(definition.name);
16443
16444 if (arg == null || arg.kind === 'Literal' && arg.value == null) {
16445 // No variable or literal null was passed, fall back to default
16446 // value.
16447 if (definition.defaultValue == null && definition.type instanceof __webpack_require__(0).GraphQLNonNull) {
16448 var _ref2;
16449
16450 var _argNode = args.find(function (a) {
16451 return a.name === definition.name;
16452 });
16453
16454 throw __webpack_require__(1).createUserError("No value found for required argument '".concat(definition.name, ": ").concat(String(definition.type), "' on fragment '").concat(spread.name, "'."), [(_ref2 = _argNode === null || _argNode === void 0 ? void 0 : _argNode.loc) !== null && _ref2 !== void 0 ? _ref2 : spread.loc]);
16455 }
16456
16457 fragmentScope[definition.name] = {
16458 kind: 'Literal',
16459 value: definition.defaultValue
16460 };
16461 } else {
16462 // Variable or non-null literal.
16463 fragmentScope[definition.name] = arg;
16464 }
16465 }
16466 });
16467
16468 if (errors != null && errors.length) {
16469 throw __webpack_require__(1).createCombinedError(errors);
16470 }
16471
16472 return fragmentScope;
16473}
16474
16475module.exports = {
16476 getFragmentScope: getFragmentScope,
16477 getRootScope: getRootScope
16478};
16479
16480/***/ }),
16481/* 91 */
16482/***/ (function(module, exports, __webpack_require__) {
16483
16484"use strict";
16485/**
16486 * Copyright (c) Facebook, Inc. and its affiliates.
16487 *
16488 * This source code is licensed under the MIT license found in the
16489 * LICENSE file in the root directory of this source tree.
16490 *
16491 * strict-local
16492 * @format
16493 */
16494
16495
16496function hasUnaliasedSelection(field, fieldName) {
16497 return field.selections.some(function (selection) {
16498 return selection.kind === 'ScalarField' && selection.alias == null && selection.name === fieldName;
16499 });
16500}
16501
16502module.exports = {
16503 hasUnaliasedSelection: hasUnaliasedSelection
16504};
16505
16506/***/ }),
16507/* 92 */
16508/***/ (function(module, exports, __webpack_require__) {
16509
16510"use strict";
16511/**
16512 * Copyright (c) Facebook, Inc. and its affiliates.
16513 *
16514 * This source code is licensed under the MIT license found in the
16515 * LICENSE file in the root directory of this source tree.
16516 *
16517 * strict-local
16518 * @format
16519 */
16520
16521
16522var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
16523
16524var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
16525
16526var TYPENAME_KEY = '__typename';
16527var STRING_TYPE = 'String';
16528
16529/**
16530 * A transform that adds `__typename` field on any `LinkedField` of a union or
16531 * interface type where there is no unaliased `__typename` selection.
16532 */
16533function relayGenerateTypeNameTransform(context) {
16534 var stringType = __webpack_require__(0).assertLeafType(context.serverSchema.getType(STRING_TYPE));
16535
16536 var typenameField = {
16537 kind: 'ScalarField',
16538 alias: null,
16539 args: [],
16540 directives: [],
16541 handles: null,
16542 loc: {
16543 kind: 'Generated'
16544 },
16545 metadata: null,
16546 name: TYPENAME_KEY,
16547 type: stringType
16548 };
16549 var state = {
16550 typenameField: typenameField
16551 };
16552 return __webpack_require__(10).transform(context, {
16553 LinkedField: visitLinkedOrMatchField,
16554 MatchField: visitLinkedOrMatchField
16555 }, function () {
16556 return state;
16557 });
16558}
16559
16560function visitLinkedOrMatchField(field, state) {
16561 var transformedNode = this.traverse(field, state);
16562
16563 if (__webpack_require__(3).isAbstractType(transformedNode.type) && !__webpack_require__(91).hasUnaliasedSelection(transformedNode, TYPENAME_KEY)) {
16564 return (0, _objectSpread2["default"])({}, transformedNode, {
16565 selections: [state.typenameField].concat((0, _toConsumableArray2["default"])(transformedNode.selections))
16566 });
16567 }
16568
16569 return transformedNode;
16570}
16571
16572module.exports = {
16573 transform: relayGenerateTypeNameTransform
16574};
16575
16576/***/ }),
16577/* 93 */
16578/***/ (function(module, exports, __webpack_require__) {
16579
16580"use strict";
16581/**
16582 * Copyright (c) Facebook, Inc. and its affiliates.
16583 *
16584 * This source code is licensed under the MIT license found in the
16585 * LICENSE file in the root directory of this source tree.
16586 *
16587 * strict-local
16588 * @format
16589 */
16590
16591
16592/**
16593 * A transform that removes any directives that were not present in the
16594 * server schema.
16595 */
16596function filterDirectivesTransform(context) {
16597 return __webpack_require__(10).transform(context, {
16598 Directive: visitDirective
16599 });
16600}
16601/**
16602 * @internal
16603 *
16604 * Skip directives not defined in the original schema.
16605 */
16606
16607
16608function visitDirective(directive) {
16609 if (this.getContext().serverSchema.getDirectives().some(function (schemaDirective) {
16610 return schemaDirective.name === directive.name;
16611 })) {
16612 return directive;
16613 }
16614
16615 return null;
16616}
16617
16618module.exports = {
16619 transform: filterDirectivesTransform
16620};
16621
16622/***/ }),
16623/* 94 */
16624/***/ (function(module, exports, __webpack_require__) {
16625
16626"use strict";
16627/**
16628 * Copyright (c) Facebook, Inc. and its affiliates.
16629 *
16630 * This source code is licensed under the MIT license found in the
16631 * LICENSE file in the root directory of this source tree.
16632 *
16633 *
16634 * @format
16635 */
16636
16637
16638__webpack_require__(53);
16639
16640// Collect args
16641var argv = __webpack_require__(106).usage('Create Relay generated files\n\n' + '$0 --schema <path> --src <path> [--watch]').options({
16642 schema: {
16643 describe: 'Path to schema.graphql or schema.json',
16644 demandOption: true,
16645 type: 'string'
16646 },
16647 src: {
16648 describe: 'Root directory of application code',
16649 demandOption: true,
16650 type: 'string'
16651 },
16652 include: {
16653 array: true,
16654 "default": ['**'],
16655 describe: 'Directories to include under src',
16656 type: 'string'
16657 },
16658 exclude: {
16659 array: true,
16660 "default": ['**/node_modules/**', '**/__mocks__/**', '**/__tests__/**', '**/__generated__/**'],
16661 describe: 'Directories to ignore under src',
16662 type: 'string'
16663 },
16664 extensions: {
16665 array: true,
16666 describe: 'File extensions to compile (defaults to extensions provided by the ' + 'language plugin)',
16667 type: 'string'
16668 },
16669 verbose: {
16670 describe: 'More verbose logging',
16671 type: 'boolean'
16672 },
16673 quiet: {
16674 describe: 'No output to stdout',
16675 type: 'boolean'
16676 },
16677 watchman: {
16678 describe: 'Use watchman when not in watch mode',
16679 type: 'boolean',
16680 "default": true
16681 },
16682 watch: {
16683 describe: 'If specified, watches files and regenerates on changes',
16684 type: 'boolean'
16685 },
16686 validate: {
16687 describe: 'Looks for pending changes and exits with non-zero code instead of ' + 'writing to disk',
16688 type: 'boolean',
16689 "default": false
16690 },
16691 'persist-output': {
16692 describe: 'A path to a .json file where persisted query metadata should be saved'
16693 },
16694 noFutureProofEnums: {
16695 describe: 'This option controls whether or not a catch-all entry is added to enum type definitions ' + 'for values that may be added in the future. Enabling this means you will have to update ' + 'your application whenever the GraphQL server schema adds new enum values to prevent it ' + 'from breaking.',
16696 "default": false
16697 },
16698 language: {
16699 describe: 'The name of the language plugin used for input files and artifacts',
16700 type: 'string',
16701 "default": 'javascript'
16702 },
16703 artifactDirectory: {
16704 describe: 'A specific directory to output all artifacts to. When enabling this ' + 'the babel plugin needs `artifactDirectory` set as well.',
16705 type: 'string',
16706 "default": null
16707 }
16708}).help().argv; // Run script with args
16709// $FlowFixMe: Invalid types for yargs. Please fix this when touching this code.
16710
16711
16712__webpack_require__(107).main(argv)["catch"](function (error) {
16713 console.error(String(error.stack || error));
16714 process.exit(1);
16715});
16716
16717/***/ }),
16718/* 95 */
16719/***/ (function(module, exports) {
16720
16721module.exports = require("core-js/es6");
16722
16723/***/ }),
16724/* 96 */
16725/***/ (function(module, exports) {
16726
16727module.exports = require("core-js/fn/array/includes");
16728
16729/***/ }),
16730/* 97 */
16731/***/ (function(module, exports) {
16732
16733module.exports = require("core-js/fn/string/pad-start");
16734
16735/***/ }),
16736/* 98 */
16737/***/ (function(module, exports) {
16738
16739module.exports = require("core-js/fn/string/pad-end");
16740
16741/***/ }),
16742/* 99 */
16743/***/ (function(module, exports) {
16744
16745module.exports = require("core-js/fn/symbol/async-iterator");
16746
16747/***/ }),
16748/* 100 */
16749/***/ (function(module, exports) {
16750
16751module.exports = require("core-js/fn/object/get-own-property-descriptors");
16752
16753/***/ }),
16754/* 101 */
16755/***/ (function(module, exports) {
16756
16757module.exports = require("core-js/fn/object/values");
16758
16759/***/ }),
16760/* 102 */
16761/***/ (function(module, exports) {
16762
16763module.exports = require("core-js/fn/object/entries");
16764
16765/***/ }),
16766/* 103 */
16767/***/ (function(module, exports) {
16768
16769module.exports = require("core-js/fn/promise/finally");
16770
16771/***/ }),
16772/* 104 */
16773/***/ (function(module, exports) {
16774
16775module.exports = require("core-js/web");
16776
16777/***/ }),
16778/* 105 */
16779/***/ (function(module, exports) {
16780
16781module.exports = require("regenerator-runtime/runtime");
16782
16783/***/ }),
16784/* 106 */
16785/***/ (function(module, exports) {
16786
16787module.exports = require("yargs");
16788
16789/***/ }),
16790/* 107 */
16791/***/ (function(module, exports, __webpack_require__) {
16792
16793"use strict";
16794/**
16795 * Copyright (c) Facebook, Inc. and its affiliates.
16796 *
16797 * This source code is licensed under the MIT license found in the
16798 * LICENSE file in the root directory of this source tree.
16799 *
16800 *
16801 * @format
16802 */
16803
16804
16805var _asyncToGenerator = __webpack_require__(18);
16806
16807var _defineProperty2 = __webpack_require__(5)(__webpack_require__(38));
16808
16809var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
16810
16811__webpack_require__(53);
16812
16813function buildWatchExpression(options) {
16814 return ['allof', ['type', 'f'], ['anyof'].concat((0, _toConsumableArray2["default"])(options.extensions.map(function (ext) {
16815 return ['suffix', ext];
16816 }))), ['anyof'].concat((0, _toConsumableArray2["default"])(options.include.map(function (include) {
16817 return ['match', include, 'wholename'];
16818 })))].concat((0, _toConsumableArray2["default"])(options.exclude.map(function (exclude) {
16819 return ['not', ['match', exclude, 'wholename']];
16820 })));
16821}
16822
16823function getFilepathsFromGlob(baseDir, options) {
16824 var extensions = options.extensions,
16825 include = options.include,
16826 exclude = options.exclude;
16827 var patterns = include.map(function (inc) {
16828 return "".concat(inc, "/*.+(").concat(extensions.join('|'), ")");
16829 });
16830
16831 var glob = __webpack_require__(111);
16832
16833 return glob.sync(patterns, {
16834 cwd: baseDir,
16835 ignore: exclude
16836 });
16837}
16838
16839/**
16840 * Unless the requested plugin is the builtin `javascript` one, import a
16841 * language plugin as either a CommonJS or ES2015 module.
16842 *
16843 * When importing, first check if it’s a path to an existing file, otherwise
16844 * assume it’s a package and prepend the plugin namespace prefix.
16845 *
16846 * Make sure to always use Node's `require` function, which otherwise would get
16847 * replaced with `__webpack_require__` when bundled using webpack, by using
16848 * `eval` to get it at runtime.
16849 */
16850function getLanguagePlugin(language) {
16851 if (language === 'javascript') {
16852 return __webpack_require__(112)();
16853 } else {
16854 var pluginPath = __webpack_require__(6).resolve(process.cwd(), language);
16855
16856 var requirePath = __webpack_require__(13).existsSync(pluginPath) ? pluginPath : "relay-compiler-language-".concat(language);
16857
16858 try {
16859 // eslint-disable-next-line no-eval
16860 var languagePlugin = eval('require')(requirePath);
16861
16862 if (languagePlugin["default"]) {
16863 languagePlugin = languagePlugin["default"];
16864 }
16865
16866 if (typeof languagePlugin === 'function') {
16867 return languagePlugin();
16868 } else {
16869 throw new Error('Expected plugin to export a function.');
16870 }
16871 } catch (err) {
16872 var e = new Error("Unable to load language plugin ".concat(requirePath, ": ").concat(err.message));
16873 e.stack = err.stack;
16874 throw e;
16875 }
16876 }
16877}
16878
16879function main(_x) {
16880 return _main.apply(this, arguments);
16881}
16882
16883function _main() {
16884 _main = _asyncToGenerator(function* (options) {
16885 var _parserConfigs;
16886
16887 var schemaPath = __webpack_require__(6).resolve(process.cwd(), options.schema);
16888
16889 if (!__webpack_require__(13).existsSync(schemaPath)) {
16890 throw new Error("--schema path does not exist: ".concat(schemaPath, "."));
16891 }
16892
16893 var srcDir = __webpack_require__(6).resolve(process.cwd(), options.src);
16894
16895 if (!__webpack_require__(13).existsSync(srcDir)) {
16896 throw new Error("--src path does not exist: ".concat(srcDir, "."));
16897 }
16898
16899 var persistedQueryPath = options.persistOutput;
16900
16901 if (typeof persistedQueryPath === 'string') {
16902 persistedQueryPath = __webpack_require__(6).resolve(process.cwd(), persistedQueryPath);
16903
16904 var persistOutputDir = __webpack_require__(6).dirname(persistedQueryPath);
16905
16906 if (!__webpack_require__(13).existsSync(persistOutputDir)) {
16907 throw new Error("--persist-output path does not exist: ".concat(persistedQueryPath, "."));
16908 }
16909 }
16910
16911 if (options.watch && !options.watchman) {
16912 throw new Error('Watchman is required to watch for changes.');
16913 }
16914
16915 if (options.watch && !hasWatchmanRootFile(srcDir)) {
16916 throw new Error("\n--watch requires that the src directory have a valid watchman \"root\" file.\n\nRoot files can include:\n- A .git/ Git folder\n- A .hg/ Mercurial folder\n- A .watchmanconfig file\n\nEnsure that one such file exists in ".concat(srcDir, " or its parents.\n ").trim());
16917 }
16918
16919 if (options.verbose && options.quiet) {
16920 throw new Error("I can't be quiet and verbose at the same time");
16921 }
16922
16923 var reporter = new (__webpack_require__(188))({
16924 verbose: options.verbose,
16925 quiet: options.quiet
16926 });
16927 var useWatchman = options.watchman && (yield __webpack_require__(30).isAvailable());
16928 var schema = getSchema(schemaPath);
16929 var languagePlugin = getLanguagePlugin(options.language);
16930 var inputExtensions = options.extensions || languagePlugin.inputExtensions;
16931 var outputExtension = languagePlugin.outputExtension;
16932 var sourceParserName = inputExtensions.join('/');
16933 var sourceWriterName = outputExtension;
16934
16935 var sourceModuleParser = __webpack_require__(189)(languagePlugin.findGraphQLTags);
16936
16937 var providedArtifactDirectory = options.artifactDirectory;
16938 var artifactDirectory = providedArtifactDirectory != null ? __webpack_require__(6).resolve(process.cwd(), providedArtifactDirectory) : null;
16939 var generatedDirectoryName = artifactDirectory || '__generated__';
16940 var sourceSearchOptions = {
16941 extensions: inputExtensions,
16942 include: options.include,
16943 exclude: ['**/*.graphql.*'].concat((0, _toConsumableArray2["default"])(options.exclude)) // Do not include artifacts
16944
16945 };
16946 var graphqlSearchOptions = {
16947 extensions: ['graphql'],
16948 include: options.include,
16949 exclude: [__webpack_require__(6).relative(srcDir, schemaPath)].concat(options.exclude)
16950 };
16951 var parserConfigs = (_parserConfigs = {}, (0, _defineProperty2["default"])(_parserConfigs, sourceParserName, {
16952 baseDir: srcDir,
16953 getFileFilter: sourceModuleParser.getFileFilter,
16954 getParser: sourceModuleParser.getParser,
16955 getSchema: function getSchema() {
16956 return schema;
16957 },
16958 watchmanExpression: useWatchman ? buildWatchExpression(sourceSearchOptions) : null,
16959 filepaths: useWatchman ? null : getFilepathsFromGlob(srcDir, sourceSearchOptions)
16960 }), (0, _defineProperty2["default"])(_parserConfigs, "graphql", {
16961 baseDir: srcDir,
16962 getParser: __webpack_require__(193).getParser,
16963 getSchema: function getSchema() {
16964 return schema;
16965 },
16966 watchmanExpression: useWatchman ? buildWatchExpression(graphqlSearchOptions) : null,
16967 filepaths: useWatchman ? null : getFilepathsFromGlob(srcDir, graphqlSearchOptions)
16968 }), _parserConfigs);
16969 var writerConfigs = (0, _defineProperty2["default"])({}, sourceWriterName, {
16970 writeFiles: getRelayFileWriter(srcDir, languagePlugin, options.noFutureProofEnums, artifactDirectory, persistedQueryPath),
16971 isGeneratedFile: function isGeneratedFile(filePath) {
16972 return filePath.endsWith('.graphql.' + outputExtension) && filePath.includes(generatedDirectoryName);
16973 },
16974 parser: sourceParserName,
16975 baseParsers: ['graphql']
16976 });
16977 var codegenRunner = new (__webpack_require__(194))({
16978 reporter: reporter,
16979 parserConfigs: parserConfigs,
16980 writerConfigs: writerConfigs,
16981 onlyValidate: options.validate,
16982 // TODO: allow passing in a flag or detect?
16983 sourceControl: null
16984 });
16985
16986 if (!options.validate && !options.watch && options.watchman) {
16987 // eslint-disable-next-line no-console
16988 console.log('HINT: pass --watch to keep watching for changes.');
16989 }
16990
16991 var result = options.watch ? yield codegenRunner.watchAll() : yield codegenRunner.compileAll();
16992
16993 if (result === 'ERROR') {
16994 process.exit(100);
16995 }
16996
16997 if (options.validate && result !== 'NO_CHANGES') {
16998 process.exit(101);
16999 }
17000 });
17001 return _main.apply(this, arguments);
17002}
17003
17004function getRelayFileWriter(baseDir, languagePlugin, noFutureProofEnums, outputDir, persistedQueryPath) {
17005 return function (_ref) {
17006 var onlyValidate = _ref.onlyValidate,
17007 schema = _ref.schema,
17008 documents = _ref.documents,
17009 baseDocuments = _ref.baseDocuments,
17010 sourceControl = _ref.sourceControl,
17011 reporter = _ref.reporter;
17012 var persistQuery;
17013 var queryMap;
17014
17015 if (persistedQueryPath != null) {
17016 queryMap = new Map();
17017
17018 persistQuery = function persistQuery(text, id) {
17019 queryMap.set(id, text);
17020 return Promise.resolve(id);
17021 };
17022 }
17023
17024 var results = __webpack_require__(195).writeAll({
17025 config: {
17026 baseDir: baseDir,
17027 compilerTransforms: {
17028 commonTransforms: __webpack_require__(26).commonTransforms,
17029 codegenTransforms: __webpack_require__(26).codegenTransforms,
17030 fragmentTransforms: __webpack_require__(26).fragmentTransforms,
17031 printTransforms: __webpack_require__(26).printTransforms,
17032 queryTransforms: __webpack_require__(26).queryTransforms
17033 },
17034 customScalars: {},
17035 formatModule: languagePlugin.formatModule,
17036 optionalInputFieldsForFlow: [],
17037 schemaExtensions: __webpack_require__(26).schemaExtensions,
17038 useHaste: false,
17039 noFutureProofEnums: noFutureProofEnums,
17040 extension: languagePlugin.outputExtension,
17041 typeGenerator: languagePlugin.typeGenerator,
17042 outputDir: outputDir,
17043 persistQuery: persistQuery
17044 },
17045 onlyValidate: onlyValidate,
17046 schema: schema,
17047 baseDocuments: baseDocuments,
17048 documents: documents,
17049 reporter: reporter,
17050 sourceControl: sourceControl
17051 });
17052
17053 if (queryMap != null && persistedQueryPath != null) {
17054 var object = {};
17055 var _iteratorNormalCompletion = true;
17056 var _didIteratorError = false;
17057 var _iteratorError = undefined;
17058
17059 try {
17060 for (var _iterator = queryMap.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
17061 var _step$value = _step.value,
17062 key = _step$value[0],
17063 value = _step$value[1];
17064 object[key] = value;
17065 }
17066 } catch (err) {
17067 _didIteratorError = true;
17068 _iteratorError = err;
17069 } finally {
17070 try {
17071 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
17072 _iterator["return"]();
17073 }
17074 } finally {
17075 if (_didIteratorError) {
17076 throw _iteratorError;
17077 }
17078 }
17079 }
17080
17081 var data = JSON.stringify(object, null, 2);
17082
17083 __webpack_require__(13).writeFileSync(persistedQueryPath, data, 'utf8');
17084 }
17085
17086 return results;
17087 };
17088}
17089
17090function getSchema(schemaPath) {
17091 try {
17092 var source = __webpack_require__(13).readFileSync(schemaPath, 'utf8');
17093
17094 if (__webpack_require__(6).extname(schemaPath) === '.json') {
17095 source = __webpack_require__(0).printSchema(__webpack_require__(0).buildClientSchema(JSON.parse(source).data));
17096 }
17097
17098 source = "\n directive @include(if: Boolean) on FRAGMENT_SPREAD | FIELD\n directive @skip(if: Boolean) on FRAGMENT_SPREAD | FIELD\n\n ".concat(source, "\n ");
17099 return __webpack_require__(0).buildASTSchema(__webpack_require__(0).parse(source), {
17100 assumeValid: true
17101 });
17102 } catch (error) {
17103 throw new Error("\nError loading schema. Expected the schema to be a .graphql or a .json\nfile, describing your GraphQL server's API. Error detail:\n\n".concat(error.stack, "\n ").trim());
17104 }
17105} // Ensure that a watchman "root" file exists in the given directory
17106// or a parent so that it can be watched
17107
17108
17109var WATCHMAN_ROOT_FILES = ['.git', '.hg', '.watchmanconfig'];
17110
17111function hasWatchmanRootFile(testPath) {
17112 while (__webpack_require__(6).dirname(testPath) !== testPath) {
17113 if (WATCHMAN_ROOT_FILES.some(function (file) {
17114 return __webpack_require__(13).existsSync(__webpack_require__(6).join(testPath, file));
17115 })) {
17116 return true;
17117 }
17118
17119 testPath = __webpack_require__(6).dirname(testPath);
17120 }
17121
17122 return false;
17123}
17124
17125module.exports = {
17126 main: main
17127};
17128
17129/***/ }),
17130/* 108 */
17131/***/ (function(module, exports) {
17132
17133function _arrayWithoutHoles(arr) {
17134 if (Array.isArray(arr)) {
17135 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
17136 arr2[i] = arr[i];
17137 }
17138
17139 return arr2;
17140 }
17141}
17142
17143module.exports = _arrayWithoutHoles;
17144
17145/***/ }),
17146/* 109 */
17147/***/ (function(module, exports) {
17148
17149function _iterableToArray(iter) {
17150 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
17151}
17152
17153module.exports = _iterableToArray;
17154
17155/***/ }),
17156/* 110 */
17157/***/ (function(module, exports) {
17158
17159function _nonIterableSpread() {
17160 throw new TypeError("Invalid attempt to spread non-iterable instance");
17161}
17162
17163module.exports = _nonIterableSpread;
17164
17165/***/ }),
17166/* 111 */
17167/***/ (function(module, exports) {
17168
17169module.exports = require("fast-glob");
17170
17171/***/ }),
17172/* 112 */
17173/***/ (function(module, exports, __webpack_require__) {
17174
17175"use strict";
17176/**
17177 * Copyright (c) Facebook, Inc. and its affiliates.
17178 *
17179 * This source code is licensed under the MIT license found in the
17180 * LICENSE file in the root directory of this source tree.
17181 *
17182 * strict-local
17183 * @format
17184 */
17185
17186
17187module.exports = function () {
17188 return {
17189 inputExtensions: ['js', 'jsx'],
17190 outputExtension: 'js',
17191 typeGenerator: __webpack_require__(113),
17192 formatModule: __webpack_require__(185),
17193 findGraphQLTags: __webpack_require__(186).find
17194 };
17195};
17196
17197/***/ }),
17198/* 113 */
17199/***/ (function(module, exports, __webpack_require__) {
17200
17201"use strict";
17202/**
17203 * Copyright (c) Facebook, Inc. and its affiliates.
17204 *
17205 * This source code is licensed under the MIT license found in the
17206 * LICENSE file in the root directory of this source tree.
17207 *
17208 *
17209 * @format
17210 */
17211
17212
17213var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
17214
17215var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
17216
17217function generate(node, options) {
17218 var ast = __webpack_require__(23).visit(node, createVisitor(options));
17219
17220 return __webpack_require__(114)["default"](ast).code;
17221}
17222
17223function makeProp(_ref, state, unmasked, concreteType) {
17224 var key = _ref.key,
17225 schemaName = _ref.schemaName,
17226 value = _ref.value,
17227 conditional = _ref.conditional,
17228 nodeType = _ref.nodeType,
17229 nodeSelections = _ref.nodeSelections;
17230
17231 if (nodeType) {
17232 value = __webpack_require__(46).transformScalarType(nodeType, state, selectionsToBabel([Array.from(__webpack_require__(22)(nodeSelections).values())], state, unmasked));
17233 }
17234
17235 if (schemaName === '__typename' && concreteType) {
17236 value = __webpack_require__(2).stringLiteralTypeAnnotation(concreteType);
17237 }
17238
17239 var typeProperty = __webpack_require__(8).readOnlyObjectTypeProperty(key, value);
17240
17241 if (conditional) {
17242 typeProperty.optional = true;
17243 }
17244
17245 return typeProperty;
17246}
17247
17248var isTypenameSelection = function isTypenameSelection(selection) {
17249 return selection.schemaName === '__typename';
17250};
17251
17252var hasTypenameSelection = function hasTypenameSelection(selections) {
17253 return selections.some(isTypenameSelection);
17254};
17255
17256var onlySelectsTypename = function onlySelectsTypename(selections) {
17257 return selections.every(isTypenameSelection);
17258};
17259
17260function selectionsToBabel(selections, state, unmasked, refTypeName) {
17261 var baseFields = new Map();
17262 var byConcreteType = {};
17263 flattenArray(selections).forEach(function (selection) {
17264 var concreteType = selection.concreteType;
17265
17266 if (concreteType) {
17267 var _byConcreteType$concr;
17268
17269 byConcreteType[concreteType] = (_byConcreteType$concr = byConcreteType[concreteType]) !== null && _byConcreteType$concr !== void 0 ? _byConcreteType$concr : [];
17270 byConcreteType[concreteType].push(selection);
17271 } else {
17272 var previousSel = baseFields.get(selection.key);
17273 baseFields.set(selection.key, previousSel ? mergeSelection(selection, previousSel) : selection);
17274 }
17275 });
17276 var types = [];
17277
17278 if (Object.keys(byConcreteType).length && onlySelectsTypename(Array.from(baseFields.values())) && (hasTypenameSelection(Array.from(baseFields.values())) || Object.keys(byConcreteType).every(function (type) {
17279 return hasTypenameSelection(byConcreteType[type]);
17280 }))) {
17281 (function () {
17282 var typenameAliases = new Set();
17283
17284 var _loop = function _loop(concreteType) {
17285 types.push(groupRefs((0, _toConsumableArray2["default"])(Array.from(baseFields.values())).concat((0, _toConsumableArray2["default"])(byConcreteType[concreteType]))).map(function (selection) {
17286 if (selection.schemaName === '__typename') {
17287 typenameAliases.add(selection.key);
17288 }
17289
17290 return makeProp(selection, state, unmasked, concreteType);
17291 }));
17292 };
17293
17294 for (var concreteType in byConcreteType) {
17295 _loop(concreteType);
17296 } // It might be some other type then the listed concrete types. Ideally, we
17297 // would set the type to diff(string, set of listed concrete types), but
17298 // this doesn't exist in Flow at the time.
17299
17300
17301 types.push(Array.from(typenameAliases).map(function (typenameAlias) {
17302 var otherProp = __webpack_require__(8).readOnlyObjectTypeProperty(typenameAlias, __webpack_require__(2).stringLiteralTypeAnnotation('%other'));
17303
17304 otherProp.leadingComments = __webpack_require__(8).lineComments("This will never be '%other', but we need some", 'value in case none of the concrete values match.');
17305 return otherProp;
17306 }));
17307 })();
17308 } else {
17309 var selectionMap = selectionsToMap(Array.from(baseFields.values()));
17310
17311 for (var concreteType in byConcreteType) {
17312 selectionMap = mergeSelections(selectionMap, selectionsToMap(byConcreteType[concreteType].map(function (sel) {
17313 return (0, _objectSpread2["default"])({}, sel, {
17314 conditional: true
17315 });
17316 })));
17317 }
17318
17319 var selectionMapValues = groupRefs(Array.from(selectionMap.values())).map(function (sel) {
17320 return isTypenameSelection(sel) && sel.concreteType ? makeProp((0, _objectSpread2["default"])({}, sel, {
17321 conditional: false
17322 }), state, unmasked, sel.concreteType) : makeProp(sel, state, unmasked);
17323 });
17324 types.push(selectionMapValues);
17325 }
17326
17327 return __webpack_require__(8).unionTypeAnnotation(types.map(function (props) {
17328 if (refTypeName) {
17329 props.push(__webpack_require__(8).readOnlyObjectTypeProperty('$refType', __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier(refTypeName))));
17330 }
17331
17332 return unmasked ? __webpack_require__(2).objectTypeAnnotation(props) : __webpack_require__(8).exactObjectTypeAnnotation(props);
17333 }));
17334}
17335
17336function mergeSelection(a, b) {
17337 if (!a) {
17338 return (0, _objectSpread2["default"])({}, b, {
17339 conditional: true
17340 });
17341 }
17342
17343 return (0, _objectSpread2["default"])({}, a, {
17344 nodeSelections: a.nodeSelections ? mergeSelections(a.nodeSelections, __webpack_require__(22)(b.nodeSelections)) : null,
17345 conditional: a.conditional && b.conditional
17346 });
17347}
17348
17349function mergeSelections(a, b) {
17350 var merged = new Map();
17351 var _iteratorNormalCompletion = true;
17352 var _didIteratorError = false;
17353 var _iteratorError = undefined;
17354
17355 try {
17356 for (var _iterator = a.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
17357 var _step$value = _step.value,
17358 key = _step$value[0],
17359 value = _step$value[1];
17360 merged.set(key, value);
17361 }
17362 } catch (err) {
17363 _didIteratorError = true;
17364 _iteratorError = err;
17365 } finally {
17366 try {
17367 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
17368 _iterator["return"]();
17369 }
17370 } finally {
17371 if (_didIteratorError) {
17372 throw _iteratorError;
17373 }
17374 }
17375 }
17376
17377 var _iteratorNormalCompletion2 = true;
17378 var _didIteratorError2 = false;
17379 var _iteratorError2 = undefined;
17380
17381 try {
17382 for (var _iterator2 = b.entries()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
17383 var _step2$value = _step2.value,
17384 key = _step2$value[0],
17385 value = _step2$value[1];
17386 merged.set(key, mergeSelection(a.get(key), value));
17387 }
17388 } catch (err) {
17389 _didIteratorError2 = true;
17390 _iteratorError2 = err;
17391 } finally {
17392 try {
17393 if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
17394 _iterator2["return"]();
17395 }
17396 } finally {
17397 if (_didIteratorError2) {
17398 throw _iteratorError2;
17399 }
17400 }
17401 }
17402
17403 return merged;
17404}
17405
17406function isPlural(node) {
17407 return Boolean(node.metadata && node.metadata.plural);
17408}
17409
17410function createVisitor(options) {
17411 var state = {
17412 customScalars: options.customScalars,
17413 enumsHasteModule: options.enumsHasteModule,
17414 existingFragmentNames: options.existingFragmentNames,
17415 generatedFragments: new Set(),
17416 generatedInputObjectTypes: {},
17417 optionalInputFields: options.optionalInputFields,
17418 usedEnums: {},
17419 usedFragments: new Set(),
17420 useHaste: options.useHaste,
17421 useSingleArtifactDirectory: options.useSingleArtifactDirectory,
17422 noFutureProofEnums: options.noFutureProofEnums
17423 };
17424 var hasMatchField = false;
17425 return {
17426 leave: {
17427 Root: function Root(node) {
17428 var inputVariablesType = generateInputVariablesType(node, state);
17429 var inputObjectTypes = generateInputObjectTypes(state);
17430
17431 var responseType = __webpack_require__(8).exportType("".concat(node.name, "Response"), selectionsToBabel(node.selections, state, false));
17432
17433 var operationType = __webpack_require__(8).exportType(node.name, __webpack_require__(8).exactObjectTypeAnnotation([__webpack_require__(2).objectTypeProperty(__webpack_require__(2).identifier('variables'), __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier("".concat(node.name, "Variables")))), __webpack_require__(2).objectTypeProperty(__webpack_require__(2).identifier('response'), __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier("".concat(node.name, "Response"))))]));
17434
17435 var importedTypes = [];
17436
17437 if (hasMatchField) {
17438 importedTypes.push('MatchPointer');
17439 }
17440
17441 return __webpack_require__(2).program((0, _toConsumableArray2["default"])(getFragmentImports(state)).concat((0, _toConsumableArray2["default"])(getEnumDefinitions(state)), [importedTypes.length ? __webpack_require__(8).importTypes(importedTypes, 'relay-runtime') : null], (0, _toConsumableArray2["default"])(inputObjectTypes), [inputVariablesType, responseType, operationType]).filter(Boolean));
17442 },
17443 Fragment: function Fragment(node) {
17444 var selections = flattenArray(node.selections);
17445 var numConecreteSelections = selections.filter(function (s) {
17446 return s.concreteType;
17447 }).length;
17448 selections = selections.map(function (selection) {
17449 if (numConecreteSelections <= 1 && isTypenameSelection(selection) && !__webpack_require__(3).isAbstractType(node.type)) {
17450 return [(0, _objectSpread2["default"])({}, selection, {
17451 concreteType: node.type.toString()
17452 })];
17453 }
17454
17455 return [selection];
17456 });
17457 state.generatedFragments.add(node.name);
17458 var refTypeName = getRefTypeName(node.name);
17459
17460 var refType = __webpack_require__(2).declareExportDeclaration(__webpack_require__(2).declareOpaqueType(__webpack_require__(2).identifier(refTypeName), null, __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier('FragmentReference'))));
17461
17462 var unmasked = node.metadata && node.metadata.mask === false;
17463 var baseType = selectionsToBabel(selections, state, unmasked, unmasked ? undefined : refTypeName);
17464 var type = isPlural(node) ? __webpack_require__(8).readOnlyArrayOfType(baseType) : baseType;
17465 var importedTypes = ['FragmentReference'];
17466
17467 if (hasMatchField) {
17468 importedTypes.push('MatchPointer');
17469 }
17470
17471 return __webpack_require__(2).program((0, _toConsumableArray2["default"])(getFragmentImports(state)).concat((0, _toConsumableArray2["default"])(getEnumDefinitions(state)), [__webpack_require__(8).importTypes(importedTypes, 'relay-runtime'), refType, __webpack_require__(8).exportType(node.name, type)]));
17472 },
17473 InlineFragment: function InlineFragment(node) {
17474 var typeCondition = node.typeCondition;
17475 return flattenArray(node.selections).map(function (typeSelection) {
17476 return __webpack_require__(3).isAbstractType(typeCondition) ? (0, _objectSpread2["default"])({}, typeSelection, {
17477 conditional: true
17478 }) : (0, _objectSpread2["default"])({}, typeSelection, {
17479 concreteType: typeCondition.toString()
17480 });
17481 });
17482 },
17483 Condition: function Condition(node) {
17484 return flattenArray(node.selections).map(function (selection) {
17485 return (0, _objectSpread2["default"])({}, selection, {
17486 conditional: true
17487 });
17488 });
17489 },
17490 ScalarField: function ScalarField(node) {
17491 var _node$alias;
17492
17493 return [{
17494 key: (_node$alias = node.alias) !== null && _node$alias !== void 0 ? _node$alias : node.name,
17495 schemaName: node.name,
17496 value: __webpack_require__(46).transformScalarType(node.type, state)
17497 }];
17498 },
17499 LinkedField: function LinkedField(node) {
17500 var _node$alias2;
17501
17502 return [{
17503 key: (_node$alias2 = node.alias) !== null && _node$alias2 !== void 0 ? _node$alias2 : node.name,
17504 schemaName: node.name,
17505 nodeType: node.type,
17506 nodeSelections: selectionsToMap(flattenArray(node.selections))
17507 }];
17508 },
17509 MatchField: function MatchField(node) {
17510 var _node$alias3;
17511
17512 hasMatchField = true;
17513 return [{
17514 key: (_node$alias3 = node.alias) !== null && _node$alias3 !== void 0 ? _node$alias3 : node.name,
17515 schemaName: node.name,
17516 value: __webpack_require__(2).nullableTypeAnnotation(__webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier('MatchPointer')))
17517 }];
17518 },
17519 FragmentSpread: function FragmentSpread(node) {
17520 state.usedFragments.add(node.name);
17521 return [{
17522 key: '__fragments_' + node.name,
17523 ref: node.name
17524 }];
17525 }
17526 }
17527 };
17528}
17529
17530function selectionsToMap(selections) {
17531 var map = new Map();
17532 selections.forEach(function (selection) {
17533 var previousSel = map.get(selection.key);
17534 map.set(selection.key, previousSel ? mergeSelection(previousSel, selection) : selection);
17535 });
17536 return map;
17537}
17538
17539function flattenArray(arrayOfArrays) {
17540 var result = [];
17541 arrayOfArrays.forEach(function (array) {
17542 return result.push.apply(result, (0, _toConsumableArray2["default"])(array));
17543 });
17544 return result;
17545}
17546
17547function generateInputObjectTypes(state) {
17548 return Object.keys(state.generatedInputObjectTypes).map(function (typeIdentifier) {
17549 var inputObjectType = state.generatedInputObjectTypes[typeIdentifier];
17550 !(typeof inputObjectType !== 'string') ? true ? __webpack_require__(4)(false, 'RelayCompilerFlowGenerator: Expected input object type to have been' + ' defined before calling `generateInputObjectTypes`') : undefined : void 0;
17551 return __webpack_require__(8).exportType(typeIdentifier, inputObjectType);
17552 });
17553}
17554
17555function generateInputVariablesType(node, state) {
17556 return __webpack_require__(8).exportType("".concat(node.name, "Variables"), __webpack_require__(8).exactObjectTypeAnnotation(node.argumentDefinitions.map(function (arg) {
17557 var property = __webpack_require__(2).objectTypeProperty(__webpack_require__(2).identifier(arg.name), __webpack_require__(46).transformInputType(arg.type, state));
17558
17559 if (!(arg.type instanceof __webpack_require__(0).GraphQLNonNull)) {
17560 property.optional = true;
17561 }
17562
17563 return property;
17564 })));
17565}
17566
17567function groupRefs(props) {
17568 var result = [];
17569 var refs = [];
17570 props.forEach(function (prop) {
17571 if (prop.ref) {
17572 refs.push(prop.ref);
17573 } else {
17574 result.push(prop);
17575 }
17576 });
17577
17578 if (refs.length > 0) {
17579 var value = __webpack_require__(8).intersectionTypeAnnotation(refs.map(function (ref) {
17580 return __webpack_require__(2).genericTypeAnnotation(__webpack_require__(2).identifier(getRefTypeName(ref)));
17581 }));
17582
17583 result.push({
17584 key: '$fragmentRefs',
17585 conditional: false,
17586 value: value
17587 });
17588 }
17589
17590 return result;
17591}
17592
17593function getFragmentImports(state) {
17594 var imports = [];
17595
17596 if (state.usedFragments.size > 0) {
17597 var usedFragments = Array.from(state.usedFragments).sort();
17598 var _iteratorNormalCompletion3 = true;
17599 var _didIteratorError3 = false;
17600 var _iteratorError3 = undefined;
17601
17602 try {
17603 for (var _iterator3 = usedFragments[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
17604 var usedFragment = _step3.value;
17605 var refTypeName = getRefTypeName(usedFragment);
17606
17607 if (!state.generatedFragments.has(usedFragment)) {
17608 if (state.useHaste && state.existingFragmentNames.has(usedFragment)) {
17609 // TODO(T22653277) support non-haste environments when importing
17610 // fragments
17611 imports.push(__webpack_require__(8).importTypes([refTypeName], usedFragment + '.graphql'));
17612 } else if (state.useSingleArtifactDirectory && state.existingFragmentNames.has(usedFragment)) {
17613 imports.push(__webpack_require__(8).importTypes([refTypeName], './' + usedFragment + '.graphql'));
17614 } else {
17615 imports.push(__webpack_require__(8).anyTypeAlias(refTypeName));
17616 }
17617 }
17618 }
17619 } catch (err) {
17620 _didIteratorError3 = true;
17621 _iteratorError3 = err;
17622 } finally {
17623 try {
17624 if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
17625 _iterator3["return"]();
17626 }
17627 } finally {
17628 if (_didIteratorError3) {
17629 throw _iteratorError3;
17630 }
17631 }
17632 }
17633 }
17634
17635 return imports;
17636}
17637
17638function getEnumDefinitions(_ref2) {
17639 var enumsHasteModule = _ref2.enumsHasteModule,
17640 usedEnums = _ref2.usedEnums,
17641 noFutureProofEnums = _ref2.noFutureProofEnums;
17642 var enumNames = Object.keys(usedEnums).sort();
17643
17644 if (enumNames.length === 0) {
17645 return [];
17646 }
17647
17648 if (enumsHasteModule) {
17649 return [__webpack_require__(8).importTypes(enumNames, enumsHasteModule)];
17650 }
17651
17652 return enumNames.map(function (name) {
17653 var values = usedEnums[name].getValues().map(function (_ref3) {
17654 var value = _ref3.value;
17655 return value;
17656 });
17657 values.sort();
17658
17659 if (!noFutureProofEnums) {
17660 values.push('%future added value');
17661 }
17662
17663 return __webpack_require__(8).exportType(name, __webpack_require__(2).unionTypeAnnotation(values.map(function (value) {
17664 return __webpack_require__(2).stringLiteralTypeAnnotation(value);
17665 })));
17666 });
17667}
17668
17669function getRefTypeName(name) {
17670 return "".concat(name, "$ref");
17671}
17672
17673var FLOW_TRANSFORMS = [__webpack_require__(47).transform, __webpack_require__(73).transform, __webpack_require__(48).transform, __webpack_require__(34).transformWithOptions({})];
17674module.exports = {
17675 generate: __webpack_require__(7).instrument(generate, 'RelayFlowGenerator.generate'),
17676 transforms: FLOW_TRANSFORMS
17677};
17678
17679/***/ }),
17680/* 114 */
17681/***/ (function(module, exports, __webpack_require__) {
17682
17683"use strict";
17684
17685
17686Object.defineProperty(exports, "__esModule", {
17687 value: true
17688});
17689exports.default = _default;
17690exports.CodeGenerator = void 0;
17691
17692var _sourceMap = _interopRequireDefault(__webpack_require__(115));
17693
17694var _printer = _interopRequireDefault(__webpack_require__(117));
17695
17696function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17697
17698class Generator extends _printer.default {
17699 constructor(ast, opts = {}, code) {
17700 const format = normalizeOptions(code, opts);
17701 const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
17702 super(format, map);
17703 this.ast = ast;
17704 }
17705
17706 generate() {
17707 return super.generate(this.ast);
17708 }
17709
17710}
17711
17712function normalizeOptions(code, opts) {
17713 const format = {
17714 auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
17715 auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
17716 shouldPrintComment: opts.shouldPrintComment,
17717 retainLines: opts.retainLines,
17718 retainFunctionParens: opts.retainFunctionParens,
17719 comments: opts.comments == null || opts.comments,
17720 compact: opts.compact,
17721 minified: opts.minified,
17722 concise: opts.concise,
17723 jsonCompatibleStrings: opts.jsonCompatibleStrings,
17724 indent: {
17725 adjustMultilineComment: true,
17726 style: " ",
17727 base: 0
17728 },
17729 decoratorsBeforeExport: !!opts.decoratorsBeforeExport,
17730 jsescOption: Object.assign({
17731 quotes: "double",
17732 wrap: true
17733 }, opts.jsescOption)
17734 };
17735
17736 if (format.minified) {
17737 format.compact = true;
17738
17739 format.shouldPrintComment = format.shouldPrintComment || (() => format.comments);
17740 } else {
17741 format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0);
17742 }
17743
17744 if (format.compact === "auto") {
17745 format.compact = code.length > 500000;
17746
17747 if (format.compact) {
17748 console.error("[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`);
17749 }
17750 }
17751
17752 if (format.compact) {
17753 format.indent.adjustMultilineComment = false;
17754 }
17755
17756 return format;
17757}
17758
17759class CodeGenerator {
17760 constructor(ast, opts, code) {
17761 this._generator = new Generator(ast, opts, code);
17762 }
17763
17764 generate() {
17765 return this._generator.generate();
17766 }
17767
17768}
17769
17770exports.CodeGenerator = CodeGenerator;
17771
17772function _default(ast, opts, code) {
17773 const gen = new Generator(ast, opts, code);
17774 return gen.generate();
17775}
17776
17777/***/ }),
17778/* 115 */
17779/***/ (function(module, exports, __webpack_require__) {
17780
17781"use strict";
17782
17783
17784Object.defineProperty(exports, "__esModule", {
17785 value: true
17786});
17787exports.default = void 0;
17788
17789function _sourceMap() {
17790 const data = _interopRequireDefault(__webpack_require__(116));
17791
17792 _sourceMap = function () {
17793 return data;
17794 };
17795
17796 return data;
17797}
17798
17799function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17800
17801class SourceMap {
17802 constructor(opts, code) {
17803 this._cachedMap = null;
17804 this._code = code;
17805 this._opts = opts;
17806 this._rawMappings = [];
17807 }
17808
17809 get() {
17810 if (!this._cachedMap) {
17811 const map = this._cachedMap = new (_sourceMap().default.SourceMapGenerator)({
17812 sourceRoot: this._opts.sourceRoot
17813 });
17814 const code = this._code;
17815
17816 if (typeof code === "string") {
17817 map.setSourceContent(this._opts.sourceFileName, code);
17818 } else if (typeof code === "object") {
17819 Object.keys(code).forEach(sourceFileName => {
17820 map.setSourceContent(sourceFileName, code[sourceFileName]);
17821 });
17822 }
17823
17824 this._rawMappings.forEach(map.addMapping, map);
17825 }
17826
17827 return this._cachedMap.toJSON();
17828 }
17829
17830 getRawMappings() {
17831 return this._rawMappings.slice();
17832 }
17833
17834 mark(generatedLine, generatedColumn, line, column, identifierName, filename, force) {
17835 if (this._lastGenLine !== generatedLine && line === null) return;
17836
17837 if (!force && this._lastGenLine === generatedLine && this._lastSourceLine === line && this._lastSourceColumn === column) {
17838 return;
17839 }
17840
17841 this._cachedMap = null;
17842 this._lastGenLine = generatedLine;
17843 this._lastSourceLine = line;
17844 this._lastSourceColumn = column;
17845
17846 this._rawMappings.push({
17847 name: identifierName || undefined,
17848 generated: {
17849 line: generatedLine,
17850 column: generatedColumn
17851 },
17852 source: line == null ? undefined : filename || this._opts.sourceFileName,
17853 original: line == null ? undefined : {
17854 line: line,
17855 column: column
17856 }
17857 });
17858 }
17859
17860}
17861
17862exports.default = SourceMap;
17863
17864/***/ }),
17865/* 116 */
17866/***/ (function(module, exports) {
17867
17868module.exports = require("source-map");
17869
17870/***/ }),
17871/* 117 */
17872/***/ (function(module, exports, __webpack_require__) {
17873
17874"use strict";
17875
17876
17877Object.defineProperty(exports, "__esModule", {
17878 value: true
17879});
17880exports.default = void 0;
17881
17882function _isInteger() {
17883 const data = _interopRequireDefault(__webpack_require__(118));
17884
17885 _isInteger = function () {
17886 return data;
17887 };
17888
17889 return data;
17890}
17891
17892function _repeat() {
17893 const data = _interopRequireDefault(__webpack_require__(119));
17894
17895 _repeat = function () {
17896 return data;
17897 };
17898
17899 return data;
17900}
17901
17902var _buffer = _interopRequireDefault(__webpack_require__(120));
17903
17904var n = _interopRequireWildcard(__webpack_require__(54));
17905
17906function t() {
17907 const data = _interopRequireWildcard(__webpack_require__(2));
17908
17909 t = function () {
17910 return data;
17911 };
17912
17913 return data;
17914}
17915
17916var generatorFunctions = _interopRequireWildcard(__webpack_require__(172));
17917
17918function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
17919
17920function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17921
17922const SCIENTIFIC_NOTATION = /e/i;
17923const ZERO_DECIMAL_INTEGER = /\.0+$/;
17924const NON_DECIMAL_LITERAL = /^0[box]/;
17925
17926class Printer {
17927 constructor(format, map) {
17928 this.inForStatementInitCounter = 0;
17929 this._printStack = [];
17930 this._indent = 0;
17931 this._insideAux = false;
17932 this._printedCommentStarts = {};
17933 this._parenPushNewlineState = null;
17934 this._noLineTerminator = false;
17935 this._printAuxAfterOnNextUserNode = false;
17936 this._printedComments = new WeakSet();
17937 this._endsWithInteger = false;
17938 this._endsWithWord = false;
17939 this.format = format || {};
17940 this._buf = new _buffer.default(map);
17941 }
17942
17943 generate(ast) {
17944 this.print(ast);
17945
17946 this._maybeAddAuxComment();
17947
17948 return this._buf.get();
17949 }
17950
17951 indent() {
17952 if (this.format.compact || this.format.concise) return;
17953 this._indent++;
17954 }
17955
17956 dedent() {
17957 if (this.format.compact || this.format.concise) return;
17958 this._indent--;
17959 }
17960
17961 semicolon(force = false) {
17962 this._maybeAddAuxComment();
17963
17964 this._append(";", !force);
17965 }
17966
17967 rightBrace() {
17968 if (this.format.minified) {
17969 this._buf.removeLastSemicolon();
17970 }
17971
17972 this.token("}");
17973 }
17974
17975 space(force = false) {
17976 if (this.format.compact) return;
17977
17978 if (this._buf.hasContent() && !this.endsWith(" ") && !this.endsWith("\n") || force) {
17979 this._space();
17980 }
17981 }
17982
17983 word(str) {
17984 if (this._endsWithWord || this.endsWith("/") && str.indexOf("/") === 0) {
17985 this._space();
17986 }
17987
17988 this._maybeAddAuxComment();
17989
17990 this._append(str);
17991
17992 this._endsWithWord = true;
17993 }
17994
17995 number(str) {
17996 this.word(str);
17997 this._endsWithInteger = (0, _isInteger().default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
17998 }
17999
18000 token(str) {
18001 if (str === "--" && this.endsWith("!") || str[0] === "+" && this.endsWith("+") || str[0] === "-" && this.endsWith("-") || str[0] === "." && this._endsWithInteger) {
18002 this._space();
18003 }
18004
18005 this._maybeAddAuxComment();
18006
18007 this._append(str);
18008 }
18009
18010 newline(i) {
18011 if (this.format.retainLines || this.format.compact) return;
18012
18013 if (this.format.concise) {
18014 this.space();
18015 return;
18016 }
18017
18018 if (this.endsWith("\n\n")) return;
18019 if (typeof i !== "number") i = 1;
18020 i = Math.min(2, i);
18021 if (this.endsWith("{\n") || this.endsWith(":\n")) i--;
18022 if (i <= 0) return;
18023
18024 for (let j = 0; j < i; j++) {
18025 this._newline();
18026 }
18027 }
18028
18029 endsWith(str) {
18030 return this._buf.endsWith(str);
18031 }
18032
18033 removeTrailingNewline() {
18034 this._buf.removeTrailingNewline();
18035 }
18036
18037 exactSource(loc, cb) {
18038 this._catchUp("start", loc);
18039
18040 this._buf.exactSource(loc, cb);
18041 }
18042
18043 source(prop, loc) {
18044 this._catchUp(prop, loc);
18045
18046 this._buf.source(prop, loc);
18047 }
18048
18049 withSource(prop, loc, cb) {
18050 this._catchUp(prop, loc);
18051
18052 this._buf.withSource(prop, loc, cb);
18053 }
18054
18055 _space() {
18056 this._append(" ", true);
18057 }
18058
18059 _newline() {
18060 this._append("\n", true);
18061 }
18062
18063 _append(str, queue = false) {
18064 this._maybeAddParen(str);
18065
18066 this._maybeIndent(str);
18067
18068 if (queue) this._buf.queue(str);else this._buf.append(str);
18069 this._endsWithWord = false;
18070 this._endsWithInteger = false;
18071 }
18072
18073 _maybeIndent(str) {
18074 if (this._indent && this.endsWith("\n") && str[0] !== "\n") {
18075 this._buf.queue(this._getIndent());
18076 }
18077 }
18078
18079 _maybeAddParen(str) {
18080 const parenPushNewlineState = this._parenPushNewlineState;
18081 if (!parenPushNewlineState) return;
18082 this._parenPushNewlineState = null;
18083 let i;
18084
18085 for (i = 0; i < str.length && str[i] === " "; i++) continue;
18086
18087 if (i === str.length) return;
18088 const cha = str[i];
18089
18090 if (cha !== "\n") {
18091 if (cha !== "/") return;
18092 if (i + 1 === str.length) return;
18093 const chaPost = str[i + 1];
18094 if (chaPost !== "/" && chaPost !== "*") return;
18095 }
18096
18097 this.token("(");
18098 this.indent();
18099 parenPushNewlineState.printed = true;
18100 }
18101
18102 _catchUp(prop, loc) {
18103 if (!this.format.retainLines) return;
18104 const pos = loc ? loc[prop] : null;
18105
18106 if (pos && pos.line !== null) {
18107 const count = pos.line - this._buf.getCurrentLine();
18108
18109 for (let i = 0; i < count; i++) {
18110 this._newline();
18111 }
18112 }
18113 }
18114
18115 _getIndent() {
18116 return (0, _repeat().default)(this.format.indent.style, this._indent);
18117 }
18118
18119 startTerminatorless(isLabel = false) {
18120 if (isLabel) {
18121 this._noLineTerminator = true;
18122 return null;
18123 } else {
18124 return this._parenPushNewlineState = {
18125 printed: false
18126 };
18127 }
18128 }
18129
18130 endTerminatorless(state) {
18131 this._noLineTerminator = false;
18132
18133 if (state && state.printed) {
18134 this.dedent();
18135 this.newline();
18136 this.token(")");
18137 }
18138 }
18139
18140 print(node, parent) {
18141 if (!node) return;
18142 const oldConcise = this.format.concise;
18143
18144 if (node._compact) {
18145 this.format.concise = true;
18146 }
18147
18148 const printMethod = this[node.type];
18149
18150 if (!printMethod) {
18151 throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node && node.constructor.name)}`);
18152 }
18153
18154 this._printStack.push(node);
18155
18156 const oldInAux = this._insideAux;
18157 this._insideAux = !node.loc;
18158
18159 this._maybeAddAuxComment(this._insideAux && !oldInAux);
18160
18161 let needsParens = n.needsParens(node, parent, this._printStack);
18162
18163 if (this.format.retainFunctionParens && node.type === "FunctionExpression" && node.extra && node.extra.parenthesized) {
18164 needsParens = true;
18165 }
18166
18167 if (needsParens) this.token("(");
18168
18169 this._printLeadingComments(node, parent);
18170
18171 const loc = t().isProgram(node) || t().isFile(node) ? null : node.loc;
18172 this.withSource("start", loc, () => {
18173 this[node.type](node, parent);
18174 });
18175
18176 this._printTrailingComments(node, parent);
18177
18178 if (needsParens) this.token(")");
18179
18180 this._printStack.pop();
18181
18182 this.format.concise = oldConcise;
18183 this._insideAux = oldInAux;
18184 }
18185
18186 _maybeAddAuxComment(enteredPositionlessNode) {
18187 if (enteredPositionlessNode) this._printAuxBeforeComment();
18188 if (!this._insideAux) this._printAuxAfterComment();
18189 }
18190
18191 _printAuxBeforeComment() {
18192 if (this._printAuxAfterOnNextUserNode) return;
18193 this._printAuxAfterOnNextUserNode = true;
18194 const comment = this.format.auxiliaryCommentBefore;
18195
18196 if (comment) {
18197 this._printComment({
18198 type: "CommentBlock",
18199 value: comment
18200 });
18201 }
18202 }
18203
18204 _printAuxAfterComment() {
18205 if (!this._printAuxAfterOnNextUserNode) return;
18206 this._printAuxAfterOnNextUserNode = false;
18207 const comment = this.format.auxiliaryCommentAfter;
18208
18209 if (comment) {
18210 this._printComment({
18211 type: "CommentBlock",
18212 value: comment
18213 });
18214 }
18215 }
18216
18217 getPossibleRaw(node) {
18218 const extra = node.extra;
18219
18220 if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) {
18221 return extra.raw;
18222 }
18223 }
18224
18225 printJoin(nodes, parent, opts = {}) {
18226 if (!nodes || !nodes.length) return;
18227 if (opts.indent) this.indent();
18228 const newlineOpts = {
18229 addNewlines: opts.addNewlines
18230 };
18231
18232 for (let i = 0; i < nodes.length; i++) {
18233 const node = nodes[i];
18234 if (!node) continue;
18235 if (opts.statement) this._printNewline(true, node, parent, newlineOpts);
18236 this.print(node, parent);
18237
18238 if (opts.iterator) {
18239 opts.iterator(node, i);
18240 }
18241
18242 if (opts.separator && i < nodes.length - 1) {
18243 opts.separator.call(this);
18244 }
18245
18246 if (opts.statement) this._printNewline(false, node, parent, newlineOpts);
18247 }
18248
18249 if (opts.indent) this.dedent();
18250 }
18251
18252 printAndIndentOnComments(node, parent) {
18253 const indent = node.leadingComments && node.leadingComments.length > 0;
18254 if (indent) this.indent();
18255 this.print(node, parent);
18256 if (indent) this.dedent();
18257 }
18258
18259 printBlock(parent) {
18260 const node = parent.body;
18261
18262 if (!t().isEmptyStatement(node)) {
18263 this.space();
18264 }
18265
18266 this.print(node, parent);
18267 }
18268
18269 _printTrailingComments(node, parent) {
18270 this._printComments(this._getComments(false, node, parent));
18271 }
18272
18273 _printLeadingComments(node, parent) {
18274 this._printComments(this._getComments(true, node, parent));
18275 }
18276
18277 printInnerComments(node, indent = true) {
18278 if (!node.innerComments || !node.innerComments.length) return;
18279 if (indent) this.indent();
18280
18281 this._printComments(node.innerComments);
18282
18283 if (indent) this.dedent();
18284 }
18285
18286 printSequence(nodes, parent, opts = {}) {
18287 opts.statement = true;
18288 return this.printJoin(nodes, parent, opts);
18289 }
18290
18291 printList(items, parent, opts = {}) {
18292 if (opts.separator == null) {
18293 opts.separator = commaSeparator;
18294 }
18295
18296 return this.printJoin(items, parent, opts);
18297 }
18298
18299 _printNewline(leading, node, parent, opts) {
18300 if (this.format.retainLines || this.format.compact) return;
18301
18302 if (this.format.concise) {
18303 this.space();
18304 return;
18305 }
18306
18307 let lines = 0;
18308
18309 if (this._buf.hasContent()) {
18310 if (!leading) lines++;
18311 if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0;
18312 const needs = leading ? n.needsWhitespaceBefore : n.needsWhitespaceAfter;
18313 if (needs(node, parent)) lines++;
18314 }
18315
18316 this.newline(lines);
18317 }
18318
18319 _getComments(leading, node) {
18320 return node && (leading ? node.leadingComments : node.trailingComments) || [];
18321 }
18322
18323 _printComment(comment) {
18324 if (!this.format.shouldPrintComment(comment.value)) return;
18325 if (comment.ignore) return;
18326 if (this._printedComments.has(comment)) return;
18327
18328 this._printedComments.add(comment);
18329
18330 if (comment.start != null) {
18331 if (this._printedCommentStarts[comment.start]) return;
18332 this._printedCommentStarts[comment.start] = true;
18333 }
18334
18335 const isBlockComment = comment.type === "CommentBlock";
18336 this.newline(this._buf.hasContent() && !this._noLineTerminator && isBlockComment ? 1 : 0);
18337 if (!this.endsWith("[") && !this.endsWith("{")) this.space();
18338 let val = !isBlockComment && !this._noLineTerminator ? `//${comment.value}\n` : `/*${comment.value}*/`;
18339
18340 if (isBlockComment && this.format.indent.adjustMultilineComment) {
18341 const offset = comment.loc && comment.loc.start.column;
18342
18343 if (offset) {
18344 const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
18345 val = val.replace(newlineRegex, "\n");
18346 }
18347
18348 const indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn());
18349 val = val.replace(/\n(?!$)/g, `\n${(0, _repeat().default)(" ", indentSize)}`);
18350 }
18351
18352 if (this.endsWith("/")) this._space();
18353 this.withSource("start", comment.loc, () => {
18354 this._append(val);
18355 });
18356 this.newline(isBlockComment && !this._noLineTerminator ? 1 : 0);
18357 }
18358
18359 _printComments(comments) {
18360 if (!comments || !comments.length) return;
18361
18362 for (const comment of comments) {
18363 this._printComment(comment);
18364 }
18365 }
18366
18367}
18368
18369exports.default = Printer;
18370Object.assign(Printer.prototype, generatorFunctions);
18371
18372function commaSeparator() {
18373 this.token(",");
18374 this.space();
18375}
18376
18377/***/ }),
18378/* 118 */
18379/***/ (function(module, exports) {
18380
18381module.exports = require("lodash/isInteger");
18382
18383/***/ }),
18384/* 119 */
18385/***/ (function(module, exports) {
18386
18387module.exports = require("lodash/repeat");
18388
18389/***/ }),
18390/* 120 */
18391/***/ (function(module, exports, __webpack_require__) {
18392
18393"use strict";
18394
18395
18396Object.defineProperty(exports, "__esModule", {
18397 value: true
18398});
18399exports.default = void 0;
18400
18401function _trimRight() {
18402 const data = _interopRequireDefault(__webpack_require__(121));
18403
18404 _trimRight = function () {
18405 return data;
18406 };
18407
18408 return data;
18409}
18410
18411function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18412
18413const SPACES_RE = /^[ \t]+$/;
18414
18415class Buffer {
18416 constructor(map) {
18417 this._map = null;
18418 this._buf = [];
18419 this._last = "";
18420 this._queue = [];
18421 this._position = {
18422 line: 1,
18423 column: 0
18424 };
18425 this._sourcePosition = {
18426 identifierName: null,
18427 line: null,
18428 column: null,
18429 filename: null
18430 };
18431 this._disallowedPop = null;
18432 this._map = map;
18433 }
18434
18435 get() {
18436 this._flush();
18437
18438 const map = this._map;
18439 const result = {
18440 code: (0, _trimRight().default)(this._buf.join("")),
18441 map: null,
18442 rawMappings: map && map.getRawMappings()
18443 };
18444
18445 if (map) {
18446 Object.defineProperty(result, "map", {
18447 configurable: true,
18448 enumerable: true,
18449
18450 get() {
18451 return this.map = map.get();
18452 },
18453
18454 set(value) {
18455 Object.defineProperty(this, "map", {
18456 value,
18457 writable: true
18458 });
18459 }
18460
18461 });
18462 }
18463
18464 return result;
18465 }
18466
18467 append(str) {
18468 this._flush();
18469
18470 const {
18471 line,
18472 column,
18473 filename,
18474 identifierName,
18475 force
18476 } = this._sourcePosition;
18477
18478 this._append(str, line, column, identifierName, filename, force);
18479 }
18480
18481 queue(str) {
18482 if (str === "\n") {
18483 while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) {
18484 this._queue.shift();
18485 }
18486 }
18487
18488 const {
18489 line,
18490 column,
18491 filename,
18492 identifierName,
18493 force
18494 } = this._sourcePosition;
18495
18496 this._queue.unshift([str, line, column, identifierName, filename, force]);
18497 }
18498
18499 _flush() {
18500 let item;
18501
18502 while (item = this._queue.pop()) this._append(...item);
18503 }
18504
18505 _append(str, line, column, identifierName, filename, force) {
18506 if (this._map && str[0] !== "\n") {
18507 this._map.mark(this._position.line, this._position.column, line, column, identifierName, filename, force);
18508 }
18509
18510 this._buf.push(str);
18511
18512 this._last = str[str.length - 1];
18513
18514 for (let i = 0; i < str.length; i++) {
18515 if (str[i] === "\n") {
18516 this._position.line++;
18517 this._position.column = 0;
18518 } else {
18519 this._position.column++;
18520 }
18521 }
18522 }
18523
18524 removeTrailingNewline() {
18525 if (this._queue.length > 0 && this._queue[0][0] === "\n") {
18526 this._queue.shift();
18527 }
18528 }
18529
18530 removeLastSemicolon() {
18531 if (this._queue.length > 0 && this._queue[0][0] === ";") {
18532 this._queue.shift();
18533 }
18534 }
18535
18536 endsWith(suffix) {
18537 if (suffix.length === 1) {
18538 let last;
18539
18540 if (this._queue.length > 0) {
18541 const str = this._queue[0][0];
18542 last = str[str.length - 1];
18543 } else {
18544 last = this._last;
18545 }
18546
18547 return last === suffix;
18548 }
18549
18550 const end = this._last + this._queue.reduce((acc, item) => item[0] + acc, "");
18551
18552 if (suffix.length <= end.length) {
18553 return end.slice(-suffix.length) === suffix;
18554 }
18555
18556 return false;
18557 }
18558
18559 hasContent() {
18560 return this._queue.length > 0 || !!this._last;
18561 }
18562
18563 exactSource(loc, cb) {
18564 this.source("start", loc, true);
18565 cb();
18566 this.source("end", loc);
18567
18568 this._disallowPop("start", loc);
18569 }
18570
18571 source(prop, loc, force) {
18572 if (prop && !loc) return;
18573
18574 this._normalizePosition(prop, loc, this._sourcePosition, force);
18575 }
18576
18577 withSource(prop, loc, cb) {
18578 if (!this._map) return cb();
18579 const originalLine = this._sourcePosition.line;
18580 const originalColumn = this._sourcePosition.column;
18581 const originalFilename = this._sourcePosition.filename;
18582 const originalIdentifierName = this._sourcePosition.identifierName;
18583 this.source(prop, loc);
18584 cb();
18585
18586 if ((!this._sourcePosition.force || this._sourcePosition.line !== originalLine || this._sourcePosition.column !== originalColumn || this._sourcePosition.filename !== originalFilename) && (!this._disallowedPop || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename)) {
18587 this._sourcePosition.line = originalLine;
18588 this._sourcePosition.column = originalColumn;
18589 this._sourcePosition.filename = originalFilename;
18590 this._sourcePosition.identifierName = originalIdentifierName;
18591 this._sourcePosition.force = false;
18592 this._disallowedPop = null;
18593 }
18594 }
18595
18596 _disallowPop(prop, loc) {
18597 if (prop && !loc) return;
18598 this._disallowedPop = this._normalizePosition(prop, loc);
18599 }
18600
18601 _normalizePosition(prop, loc, targetObj, force) {
18602 const pos = loc ? loc[prop] : null;
18603
18604 if (targetObj === undefined) {
18605 targetObj = {
18606 identifierName: null,
18607 line: null,
18608 column: null,
18609 filename: null,
18610 force: false
18611 };
18612 }
18613
18614 const origLine = targetObj.line;
18615 const origColumn = targetObj.column;
18616 const origFilename = targetObj.filename;
18617 targetObj.identifierName = prop === "start" && loc && loc.identifierName || null;
18618 targetObj.line = pos ? pos.line : null;
18619 targetObj.column = pos ? pos.column : null;
18620 targetObj.filename = loc && loc.filename || null;
18621
18622 if (force || targetObj.line !== origLine || targetObj.column !== origColumn || targetObj.filename !== origFilename) {
18623 targetObj.force = force;
18624 }
18625
18626 return targetObj;
18627 }
18628
18629 getCurrentColumn() {
18630 const extra = this._queue.reduce((acc, item) => item[0] + acc, "");
18631
18632 const lastIndex = extra.lastIndexOf("\n");
18633 return lastIndex === -1 ? this._position.column + extra.length : extra.length - 1 - lastIndex;
18634 }
18635
18636 getCurrentLine() {
18637 const extra = this._queue.reduce((acc, item) => item[0] + acc, "");
18638
18639 let count = 0;
18640
18641 for (let i = 0; i < extra.length; i++) {
18642 if (extra[i] === "\n") count++;
18643 }
18644
18645 return this._position.line + count;
18646 }
18647
18648}
18649
18650exports.default = Buffer;
18651
18652/***/ }),
18653/* 121 */
18654/***/ (function(module, exports) {
18655
18656module.exports = require("trim-right");
18657
18658/***/ }),
18659/* 122 */
18660/***/ (function(module, exports, __webpack_require__) {
18661
18662"use strict";
18663
18664
18665Object.defineProperty(exports, "__esModule", {
18666 value: true
18667});
18668exports.list = exports.nodes = void 0;
18669
18670function t() {
18671 const data = _interopRequireWildcard(__webpack_require__(2));
18672
18673 t = function () {
18674 return data;
18675 };
18676
18677 return data;
18678}
18679
18680function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
18681
18682function crawl(node, state = {}) {
18683 if (t().isMemberExpression(node)) {
18684 crawl(node.object, state);
18685 if (node.computed) crawl(node.property, state);
18686 } else if (t().isBinary(node) || t().isAssignmentExpression(node)) {
18687 crawl(node.left, state);
18688 crawl(node.right, state);
18689 } else if (t().isCallExpression(node)) {
18690 state.hasCall = true;
18691 crawl(node.callee, state);
18692 } else if (t().isFunction(node)) {
18693 state.hasFunction = true;
18694 } else if (t().isIdentifier(node)) {
18695 state.hasHelper = state.hasHelper || isHelper(node.callee);
18696 }
18697
18698 return state;
18699}
18700
18701function isHelper(node) {
18702 if (t().isMemberExpression(node)) {
18703 return isHelper(node.object) || isHelper(node.property);
18704 } else if (t().isIdentifier(node)) {
18705 return node.name === "require" || node.name[0] === "_";
18706 } else if (t().isCallExpression(node)) {
18707 return isHelper(node.callee);
18708 } else if (t().isBinary(node) || t().isAssignmentExpression(node)) {
18709 return t().isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
18710 } else {
18711 return false;
18712 }
18713}
18714
18715function isType(node) {
18716 return t().isLiteral(node) || t().isObjectExpression(node) || t().isArrayExpression(node) || t().isIdentifier(node) || t().isMemberExpression(node);
18717}
18718
18719const nodes = {
18720 AssignmentExpression(node) {
18721 const state = crawl(node.right);
18722
18723 if (state.hasCall && state.hasHelper || state.hasFunction) {
18724 return {
18725 before: state.hasFunction,
18726 after: true
18727 };
18728 }
18729 },
18730
18731 SwitchCase(node, parent) {
18732 return {
18733 before: node.consequent.length || parent.cases[0] === node,
18734 after: !node.consequent.length && parent.cases[parent.cases.length - 1] === node
18735 };
18736 },
18737
18738 LogicalExpression(node) {
18739 if (t().isFunction(node.left) || t().isFunction(node.right)) {
18740 return {
18741 after: true
18742 };
18743 }
18744 },
18745
18746 Literal(node) {
18747 if (node.value === "use strict") {
18748 return {
18749 after: true
18750 };
18751 }
18752 },
18753
18754 CallExpression(node) {
18755 if (t().isFunction(node.callee) || isHelper(node)) {
18756 return {
18757 before: true,
18758 after: true
18759 };
18760 }
18761 },
18762
18763 VariableDeclaration(node) {
18764 for (let i = 0; i < node.declarations.length; i++) {
18765 const declar = node.declarations[i];
18766 let enabled = isHelper(declar.id) && !isType(declar.init);
18767
18768 if (!enabled) {
18769 const state = crawl(declar.init);
18770 enabled = isHelper(declar.init) && state.hasCall || state.hasFunction;
18771 }
18772
18773 if (enabled) {
18774 return {
18775 before: true,
18776 after: true
18777 };
18778 }
18779 }
18780 },
18781
18782 IfStatement(node) {
18783 if (t().isBlockStatement(node.consequent)) {
18784 return {
18785 before: true,
18786 after: true
18787 };
18788 }
18789 }
18790
18791};
18792exports.nodes = nodes;
18793
18794nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) {
18795 if (parent.properties[0] === node) {
18796 return {
18797 before: true
18798 };
18799 }
18800};
18801
18802nodes.ObjectTypeCallProperty = function (node, parent) {
18803 if (parent.callProperties[0] === node && (!parent.properties || !parent.properties.length)) {
18804 return {
18805 before: true
18806 };
18807 }
18808};
18809
18810nodes.ObjectTypeIndexer = function (node, parent) {
18811 if (parent.indexers[0] === node && (!parent.properties || !parent.properties.length) && (!parent.callProperties || !parent.callProperties.length)) {
18812 return {
18813 before: true
18814 };
18815 }
18816};
18817
18818nodes.ObjectTypeInternalSlot = function (node, parent) {
18819 if (parent.internalSlots[0] === node && (!parent.properties || !parent.properties.length) && (!parent.callProperties || !parent.callProperties.length) && (!parent.indexers || !parent.indexers.length)) {
18820 return {
18821 before: true
18822 };
18823 }
18824};
18825
18826const list = {
18827 VariableDeclaration(node) {
18828 return node.declarations.map(decl => decl.init);
18829 },
18830
18831 ArrayExpression(node) {
18832 return node.elements;
18833 },
18834
18835 ObjectExpression(node) {
18836 return node.properties;
18837 }
18838
18839};
18840exports.list = list;
18841[["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function ([type, amounts]) {
18842 if (typeof amounts === "boolean") {
18843 amounts = {
18844 after: amounts,
18845 before: amounts
18846 };
18847 }
18848
18849 [type].concat(t().FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
18850 nodes[type] = function () {
18851 return amounts;
18852 };
18853 });
18854});
18855
18856/***/ }),
18857/* 123 */
18858/***/ (function(module, exports, __webpack_require__) {
18859
18860"use strict";
18861
18862
18863Object.defineProperty(exports, "__esModule", {
18864 value: true
18865});
18866exports.default = void 0;
18867
18868var _buildMatchMemberExpression = _interopRequireDefault(__webpack_require__(55));
18869
18870function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18871
18872const isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component");
18873var _default = isReactComponent;
18874exports.default = _default;
18875
18876/***/ }),
18877/* 124 */
18878/***/ (function(module, exports, __webpack_require__) {
18879
18880"use strict";
18881
18882
18883Object.defineProperty(exports, "__esModule", {
18884 value: true
18885});
18886exports.default = isCompatTag;
18887
18888function isCompatTag(tagName) {
18889 return !!tagName && /^[a-z]/.test(tagName);
18890}
18891
18892/***/ }),
18893/* 125 */
18894/***/ (function(module, exports, __webpack_require__) {
18895
18896"use strict";
18897
18898
18899Object.defineProperty(exports, "__esModule", {
18900 value: true
18901});
18902exports.default = buildChildren;
18903
18904var _generated = __webpack_require__(12);
18905
18906var _cleanJSXElementLiteralChild = _interopRequireDefault(__webpack_require__(126));
18907
18908function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18909
18910function buildChildren(node) {
18911 const elements = [];
18912
18913 for (let i = 0; i < node.children.length; i++) {
18914 let child = node.children[i];
18915
18916 if ((0, _generated.isJSXText)(child)) {
18917 (0, _cleanJSXElementLiteralChild.default)(child, elements);
18918 continue;
18919 }
18920
18921 if ((0, _generated.isJSXExpressionContainer)(child)) child = child.expression;
18922 if ((0, _generated.isJSXEmptyExpression)(child)) continue;
18923 elements.push(child);
18924 }
18925
18926 return elements;
18927}
18928
18929/***/ }),
18930/* 126 */
18931/***/ (function(module, exports, __webpack_require__) {
18932
18933"use strict";
18934
18935
18936Object.defineProperty(exports, "__esModule", {
18937 value: true
18938});
18939exports.default = cleanJSXElementLiteralChild;
18940
18941var _generated = __webpack_require__(15);
18942
18943function cleanJSXElementLiteralChild(child, args) {
18944 const lines = child.value.split(/\r\n|\n|\r/);
18945 let lastNonEmptyLine = 0;
18946
18947 for (let i = 0; i < lines.length; i++) {
18948 if (lines[i].match(/[^ \t]/)) {
18949 lastNonEmptyLine = i;
18950 }
18951 }
18952
18953 let str = "";
18954
18955 for (let i = 0; i < lines.length; i++) {
18956 const line = lines[i];
18957 const isFirstLine = i === 0;
18958 const isLastLine = i === lines.length - 1;
18959 const isLastNonEmptyLine = i === lastNonEmptyLine;
18960 let trimmedLine = line.replace(/\t/g, " ");
18961
18962 if (!isFirstLine) {
18963 trimmedLine = trimmedLine.replace(/^[ ]+/, "");
18964 }
18965
18966 if (!isLastLine) {
18967 trimmedLine = trimmedLine.replace(/[ ]+$/, "");
18968 }
18969
18970 if (trimmedLine) {
18971 if (!isLastNonEmptyLine) {
18972 trimmedLine += " ";
18973 }
18974
18975 str += trimmedLine;
18976 }
18977 }
18978
18979 if (str) args.push((0, _generated.stringLiteral)(str));
18980}
18981
18982/***/ }),
18983/* 127 */
18984/***/ (function(module, exports, __webpack_require__) {
18985
18986"use strict";
18987
18988
18989Object.defineProperty(exports, "__esModule", {
18990 value: true
18991});
18992exports.default = builder;
18993
18994function _clone() {
18995 const data = _interopRequireDefault(__webpack_require__(128));
18996
18997 _clone = function () {
18998 return data;
18999 };
19000
19001 return data;
19002}
19003
19004var _definitions = __webpack_require__(16);
19005
19006var _validate = _interopRequireDefault(__webpack_require__(57));
19007
19008function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19009
19010function builder(type, ...args) {
19011 const keys = _definitions.BUILDER_KEYS[type];
19012 const countArgs = args.length;
19013
19014 if (countArgs > keys.length) {
19015 throw new Error(`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`);
19016 }
19017
19018 const node = {
19019 type
19020 };
19021 let i = 0;
19022 keys.forEach(key => {
19023 const field = _definitions.NODE_FIELDS[type][key];
19024 let arg;
19025 if (i < countArgs) arg = args[i];
19026 if (arg === undefined) arg = (0, _clone().default)(field.default);
19027 node[key] = arg;
19028 i++;
19029 });
19030
19031 for (const key in node) {
19032 (0, _validate.default)(node, key, node[key]);
19033 }
19034
19035 return node;
19036}
19037
19038/***/ }),
19039/* 128 */
19040/***/ (function(module, exports) {
19041
19042module.exports = require("lodash/clone");
19043
19044/***/ }),
19045/* 129 */
19046/***/ (function(module, exports) {
19047
19048module.exports = require("to-fast-properties");
19049
19050/***/ }),
19051/* 130 */
19052/***/ (function(module, exports) {
19053
19054module.exports = require("esutils");
19055
19056/***/ }),
19057/* 131 */
19058/***/ (function(module, exports, __webpack_require__) {
19059
19060"use strict";
19061
19062
19063var _utils = _interopRequireWildcard(__webpack_require__(19));
19064
19065function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
19066
19067const defineInterfaceishType = (name, typeParameterType = "TypeParameterDeclaration") => {
19068 (0, _utils.default)(name, {
19069 builder: ["id", "typeParameters", "extends", "body"],
19070 visitor: ["id", "typeParameters", "extends", "mixins", "implements", "body"],
19071 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19072 fields: {
19073 id: (0, _utils.validateType)("Identifier"),
19074 typeParameters: (0, _utils.validateOptionalType)(typeParameterType),
19075 extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
19076 mixins: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
19077 implements: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ClassImplements")),
19078 body: (0, _utils.validateType)("ObjectTypeAnnotation")
19079 }
19080 });
19081};
19082
19083(0, _utils.default)("AnyTypeAnnotation", {
19084 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19085});
19086(0, _utils.default)("ArrayTypeAnnotation", {
19087 visitor: ["elementType"],
19088 aliases: ["Flow", "FlowType"],
19089 fields: {
19090 elementType: (0, _utils.validateType)("FlowType")
19091 }
19092});
19093(0, _utils.default)("BooleanTypeAnnotation", {
19094 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19095});
19096(0, _utils.default)("BooleanLiteralTypeAnnotation", {
19097 builder: ["value"],
19098 aliases: ["Flow", "FlowType"],
19099 fields: {
19100 value: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
19101 }
19102});
19103(0, _utils.default)("NullLiteralTypeAnnotation", {
19104 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19105});
19106(0, _utils.default)("ClassImplements", {
19107 visitor: ["id", "typeParameters"],
19108 aliases: ["Flow"],
19109 fields: {
19110 id: (0, _utils.validateType)("Identifier"),
19111 typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
19112 }
19113});
19114defineInterfaceishType("DeclareClass", "TypeParameterInstantiation");
19115(0, _utils.default)("DeclareFunction", {
19116 visitor: ["id"],
19117 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19118 fields: {
19119 id: (0, _utils.validateType)("Identifier"),
19120 predicate: (0, _utils.validateOptionalType)("DeclaredPredicate")
19121 }
19122});
19123defineInterfaceishType("DeclareInterface");
19124(0, _utils.default)("DeclareModule", {
19125 builder: ["id", "body", "kind"],
19126 visitor: ["id", "body"],
19127 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19128 fields: {
19129 id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
19130 body: (0, _utils.validateType)("BlockStatement"),
19131 kind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("CommonJS", "ES"))
19132 }
19133});
19134(0, _utils.default)("DeclareModuleExports", {
19135 visitor: ["typeAnnotation"],
19136 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19137 fields: {
19138 typeAnnotation: (0, _utils.validateType)("TypeAnnotation")
19139 }
19140});
19141(0, _utils.default)("DeclareTypeAlias", {
19142 visitor: ["id", "typeParameters", "right"],
19143 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19144 fields: {
19145 id: (0, _utils.validateType)("Identifier"),
19146 typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
19147 right: (0, _utils.validateType)("FlowType")
19148 }
19149});
19150(0, _utils.default)("DeclareOpaqueType", {
19151 visitor: ["id", "typeParameters", "supertype"],
19152 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19153 fields: {
19154 id: (0, _utils.validateType)("Identifier"),
19155 typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
19156 supertype: (0, _utils.validateOptionalType)("FlowType")
19157 }
19158});
19159(0, _utils.default)("DeclareVariable", {
19160 visitor: ["id"],
19161 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19162 fields: {
19163 id: (0, _utils.validateType)("Identifier")
19164 }
19165});
19166(0, _utils.default)("DeclareExportDeclaration", {
19167 visitor: ["declaration", "specifiers", "source"],
19168 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19169 fields: {
19170 declaration: (0, _utils.validateOptionalType)("Flow"),
19171 specifiers: (0, _utils.validateOptional)((0, _utils.arrayOfType)(["ExportSpecifier", "ExportNamespaceSpecifier"])),
19172 source: (0, _utils.validateOptionalType)("StringLiteral"),
19173 default: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
19174 }
19175});
19176(0, _utils.default)("DeclareExportAllDeclaration", {
19177 visitor: ["source"],
19178 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19179 fields: {
19180 source: (0, _utils.validateType)("StringLiteral"),
19181 exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)(["type", "value"]))
19182 }
19183});
19184(0, _utils.default)("DeclaredPredicate", {
19185 visitor: ["value"],
19186 aliases: ["Flow", "FlowPredicate"],
19187 fields: {
19188 value: (0, _utils.validateType)("Flow")
19189 }
19190});
19191(0, _utils.default)("ExistsTypeAnnotation", {
19192 aliases: ["Flow", "FlowType"]
19193});
19194(0, _utils.default)("FunctionTypeAnnotation", {
19195 visitor: ["typeParameters", "params", "rest", "returnType"],
19196 aliases: ["Flow", "FlowType"],
19197 fields: {
19198 typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
19199 params: (0, _utils.validate)((0, _utils.arrayOfType)("FunctionTypeParam")),
19200 rest: (0, _utils.validateOptionalType)("FunctionTypeParam"),
19201 returnType: (0, _utils.validateType)("FlowType")
19202 }
19203});
19204(0, _utils.default)("FunctionTypeParam", {
19205 visitor: ["name", "typeAnnotation"],
19206 aliases: ["Flow"],
19207 fields: {
19208 name: (0, _utils.validateOptionalType)("Identifier"),
19209 typeAnnotation: (0, _utils.validateType)("FlowType"),
19210 optional: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
19211 }
19212});
19213(0, _utils.default)("GenericTypeAnnotation", {
19214 visitor: ["id", "typeParameters"],
19215 aliases: ["Flow", "FlowType"],
19216 fields: {
19217 id: (0, _utils.validateType)("Identifier"),
19218 typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
19219 }
19220});
19221(0, _utils.default)("InferredPredicate", {
19222 aliases: ["Flow", "FlowPredicate"]
19223});
19224(0, _utils.default)("InterfaceExtends", {
19225 visitor: ["id", "typeParameters"],
19226 aliases: ["Flow"],
19227 fields: {
19228 id: (0, _utils.validateType)("Identifier"),
19229 typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
19230 }
19231});
19232defineInterfaceishType("InterfaceDeclaration");
19233(0, _utils.default)("InterfaceTypeAnnotation", {
19234 visitor: ["extends", "body"],
19235 aliases: ["Flow", "FlowType"],
19236 fields: {
19237 extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
19238 body: (0, _utils.validateType)("ObjectTypeAnnotation")
19239 }
19240});
19241(0, _utils.default)("IntersectionTypeAnnotation", {
19242 visitor: ["types"],
19243 aliases: ["Flow", "FlowType"],
19244 fields: {
19245 types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
19246 }
19247});
19248(0, _utils.default)("MixedTypeAnnotation", {
19249 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19250});
19251(0, _utils.default)("EmptyTypeAnnotation", {
19252 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19253});
19254(0, _utils.default)("NullableTypeAnnotation", {
19255 visitor: ["typeAnnotation"],
19256 aliases: ["Flow", "FlowType"],
19257 fields: {
19258 typeAnnotation: (0, _utils.validateType)("FlowType")
19259 }
19260});
19261(0, _utils.default)("NumberLiteralTypeAnnotation", {
19262 builder: ["value"],
19263 aliases: ["Flow", "FlowType"],
19264 fields: {
19265 value: (0, _utils.validate)((0, _utils.assertValueType)("number"))
19266 }
19267});
19268(0, _utils.default)("NumberTypeAnnotation", {
19269 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19270});
19271(0, _utils.default)("ObjectTypeAnnotation", {
19272 visitor: ["properties", "indexers", "callProperties", "internalSlots"],
19273 aliases: ["Flow", "FlowType"],
19274 builder: ["properties", "indexers", "callProperties", "internalSlots", "exact"],
19275 fields: {
19276 properties: (0, _utils.validate)((0, _utils.arrayOfType)(["ObjectTypeProperty", "ObjectTypeSpreadProperty"])),
19277 indexers: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeIndexer")),
19278 callProperties: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeCallProperty")),
19279 internalSlots: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeInternalSlot")),
19280 exact: {
19281 validate: (0, _utils.assertValueType)("boolean"),
19282 default: false
19283 }
19284 }
19285});
19286(0, _utils.default)("ObjectTypeInternalSlot", {
19287 visitor: ["id", "value", "optional", "static", "method"],
19288 aliases: ["Flow", "UserWhitespacable"],
19289 fields: {
19290 id: (0, _utils.validateType)("Identifier"),
19291 value: (0, _utils.validateType)("FlowType"),
19292 optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
19293 static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
19294 method: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
19295 }
19296});
19297(0, _utils.default)("ObjectTypeCallProperty", {
19298 visitor: ["value"],
19299 aliases: ["Flow", "UserWhitespacable"],
19300 fields: {
19301 value: (0, _utils.validateType)("FlowType"),
19302 static: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
19303 }
19304});
19305(0, _utils.default)("ObjectTypeIndexer", {
19306 visitor: ["id", "key", "value", "variance"],
19307 aliases: ["Flow", "UserWhitespacable"],
19308 fields: {
19309 id: (0, _utils.validateOptionalType)("Identifier"),
19310 key: (0, _utils.validateType)("FlowType"),
19311 value: (0, _utils.validateType)("FlowType"),
19312 static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
19313 variance: (0, _utils.validateOptionalType)("Variance")
19314 }
19315});
19316(0, _utils.default)("ObjectTypeProperty", {
19317 visitor: ["key", "value", "variance"],
19318 aliases: ["Flow", "UserWhitespacable"],
19319 fields: {
19320 key: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
19321 value: (0, _utils.validateType)("FlowType"),
19322 kind: (0, _utils.validate)((0, _utils.assertOneOf)("init", "get", "set")),
19323 static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
19324 proto: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
19325 optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
19326 variance: (0, _utils.validateOptionalType)("Variance")
19327 }
19328});
19329(0, _utils.default)("ObjectTypeSpreadProperty", {
19330 visitor: ["argument"],
19331 aliases: ["Flow", "UserWhitespacable"],
19332 fields: {
19333 argument: (0, _utils.validateType)("FlowType")
19334 }
19335});
19336(0, _utils.default)("OpaqueType", {
19337 visitor: ["id", "typeParameters", "supertype", "impltype"],
19338 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19339 fields: {
19340 id: (0, _utils.validateType)("Identifier"),
19341 typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
19342 supertype: (0, _utils.validateOptionalType)("FlowType"),
19343 impltype: (0, _utils.validateType)("FlowType")
19344 }
19345});
19346(0, _utils.default)("QualifiedTypeIdentifier", {
19347 visitor: ["id", "qualification"],
19348 aliases: ["Flow"],
19349 fields: {
19350 id: (0, _utils.validateType)("Identifier"),
19351 qualification: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"])
19352 }
19353});
19354(0, _utils.default)("StringLiteralTypeAnnotation", {
19355 builder: ["value"],
19356 aliases: ["Flow", "FlowType"],
19357 fields: {
19358 value: (0, _utils.validate)((0, _utils.assertValueType)("string"))
19359 }
19360});
19361(0, _utils.default)("StringTypeAnnotation", {
19362 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19363});
19364(0, _utils.default)("ThisTypeAnnotation", {
19365 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19366});
19367(0, _utils.default)("TupleTypeAnnotation", {
19368 visitor: ["types"],
19369 aliases: ["Flow", "FlowType"],
19370 fields: {
19371 types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
19372 }
19373});
19374(0, _utils.default)("TypeofTypeAnnotation", {
19375 visitor: ["argument"],
19376 aliases: ["Flow", "FlowType"],
19377 fields: {
19378 argument: (0, _utils.validateType)("FlowType")
19379 }
19380});
19381(0, _utils.default)("TypeAlias", {
19382 visitor: ["id", "typeParameters", "right"],
19383 aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
19384 fields: {
19385 id: (0, _utils.validateType)("Identifier"),
19386 typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
19387 right: (0, _utils.validateType)("FlowType")
19388 }
19389});
19390(0, _utils.default)("TypeAnnotation", {
19391 aliases: ["Flow"],
19392 visitor: ["typeAnnotation"],
19393 fields: {
19394 typeAnnotation: (0, _utils.validateType)("FlowType")
19395 }
19396});
19397(0, _utils.default)("TypeCastExpression", {
19398 visitor: ["expression", "typeAnnotation"],
19399 aliases: ["Flow", "ExpressionWrapper", "Expression"],
19400 fields: {
19401 expression: (0, _utils.validateType)("Expression"),
19402 typeAnnotation: (0, _utils.validateType)("TypeAnnotation")
19403 }
19404});
19405(0, _utils.default)("TypeParameter", {
19406 aliases: ["Flow"],
19407 visitor: ["bound", "default", "variance"],
19408 fields: {
19409 name: (0, _utils.validate)((0, _utils.assertValueType)("string")),
19410 bound: (0, _utils.validateOptionalType)("TypeAnnotation"),
19411 default: (0, _utils.validateOptionalType)("FlowType"),
19412 variance: (0, _utils.validateOptionalType)("Variance")
19413 }
19414});
19415(0, _utils.default)("TypeParameterDeclaration", {
19416 aliases: ["Flow"],
19417 visitor: ["params"],
19418 fields: {
19419 params: (0, _utils.validate)((0, _utils.arrayOfType)("TypeParameter"))
19420 }
19421});
19422(0, _utils.default)("TypeParameterInstantiation", {
19423 aliases: ["Flow"],
19424 visitor: ["params"],
19425 fields: {
19426 params: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
19427 }
19428});
19429(0, _utils.default)("UnionTypeAnnotation", {
19430 visitor: ["types"],
19431 aliases: ["Flow", "FlowType"],
19432 fields: {
19433 types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
19434 }
19435});
19436(0, _utils.default)("Variance", {
19437 aliases: ["Flow"],
19438 builder: ["kind"],
19439 fields: {
19440 kind: (0, _utils.validate)((0, _utils.assertOneOf)("minus", "plus"))
19441 }
19442});
19443(0, _utils.default)("VoidTypeAnnotation", {
19444 aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
19445});
19446
19447/***/ }),
19448/* 132 */
19449/***/ (function(module, exports, __webpack_require__) {
19450
19451"use strict";
19452
19453
19454var _utils = _interopRequireWildcard(__webpack_require__(19));
19455
19456function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
19457
19458(0, _utils.default)("JSXAttribute", {
19459 visitor: ["name", "value"],
19460 aliases: ["JSX", "Immutable"],
19461 fields: {
19462 name: {
19463 validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXNamespacedName")
19464 },
19465 value: {
19466 optional: true,
19467 validate: (0, _utils.assertNodeType)("JSXElement", "JSXFragment", "StringLiteral", "JSXExpressionContainer")
19468 }
19469 }
19470});
19471(0, _utils.default)("JSXClosingElement", {
19472 visitor: ["name"],
19473 aliases: ["JSX", "Immutable"],
19474 fields: {
19475 name: {
19476 validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression")
19477 }
19478 }
19479});
19480(0, _utils.default)("JSXElement", {
19481 builder: ["openingElement", "closingElement", "children", "selfClosing"],
19482 visitor: ["openingElement", "children", "closingElement"],
19483 aliases: ["JSX", "Immutable", "Expression"],
19484 fields: {
19485 openingElement: {
19486 validate: (0, _utils.assertNodeType)("JSXOpeningElement")
19487 },
19488 closingElement: {
19489 optional: true,
19490 validate: (0, _utils.assertNodeType)("JSXClosingElement")
19491 },
19492 children: {
19493 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
19494 }
19495 }
19496});
19497(0, _utils.default)("JSXEmptyExpression", {
19498 aliases: ["JSX"]
19499});
19500(0, _utils.default)("JSXExpressionContainer", {
19501 visitor: ["expression"],
19502 aliases: ["JSX", "Immutable"],
19503 fields: {
19504 expression: {
19505 validate: (0, _utils.assertNodeType)("Expression")
19506 }
19507 }
19508});
19509(0, _utils.default)("JSXSpreadChild", {
19510 visitor: ["expression"],
19511 aliases: ["JSX", "Immutable"],
19512 fields: {
19513 expression: {
19514 validate: (0, _utils.assertNodeType)("Expression")
19515 }
19516 }
19517});
19518(0, _utils.default)("JSXIdentifier", {
19519 builder: ["name"],
19520 aliases: ["JSX"],
19521 fields: {
19522 name: {
19523 validate: (0, _utils.assertValueType)("string")
19524 }
19525 }
19526});
19527(0, _utils.default)("JSXMemberExpression", {
19528 visitor: ["object", "property"],
19529 aliases: ["JSX"],
19530 fields: {
19531 object: {
19532 validate: (0, _utils.assertNodeType)("JSXMemberExpression", "JSXIdentifier")
19533 },
19534 property: {
19535 validate: (0, _utils.assertNodeType)("JSXIdentifier")
19536 }
19537 }
19538});
19539(0, _utils.default)("JSXNamespacedName", {
19540 visitor: ["namespace", "name"],
19541 aliases: ["JSX"],
19542 fields: {
19543 namespace: {
19544 validate: (0, _utils.assertNodeType)("JSXIdentifier")
19545 },
19546 name: {
19547 validate: (0, _utils.assertNodeType)("JSXIdentifier")
19548 }
19549 }
19550});
19551(0, _utils.default)("JSXOpeningElement", {
19552 builder: ["name", "attributes", "selfClosing"],
19553 visitor: ["name", "attributes"],
19554 aliases: ["JSX", "Immutable"],
19555 fields: {
19556 name: {
19557 validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression")
19558 },
19559 selfClosing: {
19560 default: false,
19561 validate: (0, _utils.assertValueType)("boolean")
19562 },
19563 attributes: {
19564 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXAttribute", "JSXSpreadAttribute")))
19565 },
19566 typeParameters: {
19567 validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
19568 optional: true
19569 }
19570 }
19571});
19572(0, _utils.default)("JSXSpreadAttribute", {
19573 visitor: ["argument"],
19574 aliases: ["JSX"],
19575 fields: {
19576 argument: {
19577 validate: (0, _utils.assertNodeType)("Expression")
19578 }
19579 }
19580});
19581(0, _utils.default)("JSXText", {
19582 aliases: ["JSX", "Immutable"],
19583 builder: ["value"],
19584 fields: {
19585 value: {
19586 validate: (0, _utils.assertValueType)("string")
19587 }
19588 }
19589});
19590(0, _utils.default)("JSXFragment", {
19591 builder: ["openingFragment", "closingFragment", "children"],
19592 visitor: ["openingFragment", "children", "closingFragment"],
19593 aliases: ["JSX", "Immutable", "Expression"],
19594 fields: {
19595 openingFragment: {
19596 validate: (0, _utils.assertNodeType)("JSXOpeningFragment")
19597 },
19598 closingFragment: {
19599 validate: (0, _utils.assertNodeType)("JSXClosingFragment")
19600 },
19601 children: {
19602 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
19603 }
19604 }
19605});
19606(0, _utils.default)("JSXOpeningFragment", {
19607 aliases: ["JSX", "Immutable"]
19608});
19609(0, _utils.default)("JSXClosingFragment", {
19610 aliases: ["JSX", "Immutable"]
19611});
19612
19613/***/ }),
19614/* 133 */
19615/***/ (function(module, exports, __webpack_require__) {
19616
19617"use strict";
19618
19619
19620var _utils = _interopRequireWildcard(__webpack_require__(19));
19621
19622function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
19623
19624(0, _utils.default)("Noop", {
19625 visitor: []
19626});
19627(0, _utils.default)("ParenthesizedExpression", {
19628 visitor: ["expression"],
19629 aliases: ["Expression", "ExpressionWrapper"],
19630 fields: {
19631 expression: {
19632 validate: (0, _utils.assertNodeType)("Expression")
19633 }
19634 }
19635});
19636
19637/***/ }),
19638/* 134 */
19639/***/ (function(module, exports, __webpack_require__) {
19640
19641"use strict";
19642
19643
19644var _utils = _interopRequireWildcard(__webpack_require__(19));
19645
19646var _es = __webpack_require__(43);
19647
19648function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
19649
19650(0, _utils.default)("AwaitExpression", {
19651 builder: ["argument"],
19652 visitor: ["argument"],
19653 aliases: ["Expression", "Terminatorless"],
19654 fields: {
19655 argument: {
19656 validate: (0, _utils.assertNodeType)("Expression")
19657 }
19658 }
19659});
19660(0, _utils.default)("BindExpression", {
19661 visitor: ["object", "callee"],
19662 aliases: ["Expression"],
19663 fields: {}
19664});
19665(0, _utils.default)("ClassProperty", {
19666 visitor: ["key", "value", "typeAnnotation", "decorators"],
19667 builder: ["key", "value", "typeAnnotation", "decorators", "computed"],
19668 aliases: ["Property"],
19669 fields: Object.assign({}, _es.classMethodOrPropertyCommon, {
19670 value: {
19671 validate: (0, _utils.assertNodeType)("Expression"),
19672 optional: true
19673 },
19674 definite: {
19675 validate: (0, _utils.assertValueType)("boolean"),
19676 optional: true
19677 },
19678 typeAnnotation: {
19679 validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
19680 optional: true
19681 },
19682 decorators: {
19683 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
19684 optional: true
19685 },
19686 readonly: {
19687 validate: (0, _utils.assertValueType)("boolean"),
19688 optional: true
19689 }
19690 })
19691});
19692(0, _utils.default)("OptionalMemberExpression", {
19693 builder: ["object", "property", "computed", "optional"],
19694 visitor: ["object", "property"],
19695 aliases: ["Expression"],
19696 fields: {
19697 object: {
19698 validate: (0, _utils.assertNodeType)("Expression")
19699 },
19700 property: {
19701 validate: function () {
19702 const normal = (0, _utils.assertNodeType)("Identifier");
19703 const computed = (0, _utils.assertNodeType)("Expression");
19704 return function (node, key, val) {
19705 const validator = node.computed ? computed : normal;
19706 validator(node, key, val);
19707 };
19708 }()
19709 },
19710 computed: {
19711 default: false
19712 },
19713 optional: {
19714 validate: (0, _utils.assertValueType)("boolean")
19715 }
19716 }
19717});
19718(0, _utils.default)("OptionalCallExpression", {
19719 visitor: ["callee", "arguments", "typeParameters", "typeArguments"],
19720 builder: ["callee", "arguments", "optional"],
19721 aliases: ["Expression"],
19722 fields: {
19723 callee: {
19724 validate: (0, _utils.assertNodeType)("Expression")
19725 },
19726 arguments: {
19727 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName")))
19728 },
19729 optional: {
19730 validate: (0, _utils.assertValueType)("boolean")
19731 },
19732 typeArguments: {
19733 validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
19734 optional: true
19735 },
19736 typeParameters: {
19737 validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"),
19738 optional: true
19739 }
19740 }
19741});
19742(0, _utils.default)("ClassPrivateProperty", {
19743 visitor: ["key", "value"],
19744 builder: ["key", "value"],
19745 aliases: ["Property", "Private"],
19746 fields: {
19747 key: {
19748 validate: (0, _utils.assertNodeType)("PrivateName")
19749 },
19750 value: {
19751 validate: (0, _utils.assertNodeType)("Expression"),
19752 optional: true
19753 }
19754 }
19755});
19756(0, _utils.default)("Import", {
19757 aliases: ["Expression"]
19758});
19759(0, _utils.default)("Decorator", {
19760 visitor: ["expression"],
19761 fields: {
19762 expression: {
19763 validate: (0, _utils.assertNodeType)("Expression")
19764 }
19765 }
19766});
19767(0, _utils.default)("DoExpression", {
19768 visitor: ["body"],
19769 aliases: ["Expression"],
19770 fields: {
19771 body: {
19772 validate: (0, _utils.assertNodeType)("BlockStatement")
19773 }
19774 }
19775});
19776(0, _utils.default)("ExportDefaultSpecifier", {
19777 visitor: ["exported"],
19778 aliases: ["ModuleSpecifier"],
19779 fields: {
19780 exported: {
19781 validate: (0, _utils.assertNodeType)("Identifier")
19782 }
19783 }
19784});
19785(0, _utils.default)("ExportNamespaceSpecifier", {
19786 visitor: ["exported"],
19787 aliases: ["ModuleSpecifier"],
19788 fields: {
19789 exported: {
19790 validate: (0, _utils.assertNodeType)("Identifier")
19791 }
19792 }
19793});
19794(0, _utils.default)("PrivateName", {
19795 visitor: ["id"],
19796 aliases: ["Private"],
19797 fields: {
19798 id: {
19799 validate: (0, _utils.assertNodeType)("Identifier")
19800 }
19801 }
19802});
19803(0, _utils.default)("BigIntLiteral", {
19804 builder: ["value"],
19805 fields: {
19806 value: {
19807 validate: (0, _utils.assertValueType)("string")
19808 }
19809 },
19810 aliases: ["Expression", "Pureish", "Literal", "Immutable"]
19811});
19812
19813/***/ }),
19814/* 135 */
19815/***/ (function(module, exports, __webpack_require__) {
19816
19817"use strict";
19818
19819
19820var _utils = _interopRequireWildcard(__webpack_require__(19));
19821
19822var _core = __webpack_require__(40);
19823
19824var _es = __webpack_require__(43);
19825
19826function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
19827
19828const bool = (0, _utils.assertValueType)("boolean");
19829const tSFunctionTypeAnnotationCommon = {
19830 returnType: {
19831 validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
19832 optional: true
19833 },
19834 typeParameters: {
19835 validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
19836 optional: true
19837 }
19838};
19839(0, _utils.default)("TSParameterProperty", {
19840 aliases: ["LVal"],
19841 visitor: ["parameter"],
19842 fields: {
19843 accessibility: {
19844 validate: (0, _utils.assertOneOf)("public", "private", "protected"),
19845 optional: true
19846 },
19847 readonly: {
19848 validate: (0, _utils.assertValueType)("boolean"),
19849 optional: true
19850 },
19851 parameter: {
19852 validate: (0, _utils.assertNodeType)("Identifier", "AssignmentPattern")
19853 }
19854 }
19855});
19856(0, _utils.default)("TSDeclareFunction", {
19857 aliases: ["Statement", "Declaration"],
19858 visitor: ["id", "typeParameters", "params", "returnType"],
19859 fields: Object.assign({}, _core.functionDeclarationCommon, tSFunctionTypeAnnotationCommon)
19860});
19861(0, _utils.default)("TSDeclareMethod", {
19862 visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
19863 fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, tSFunctionTypeAnnotationCommon)
19864});
19865(0, _utils.default)("TSQualifiedName", {
19866 aliases: ["TSEntityName"],
19867 visitor: ["left", "right"],
19868 fields: {
19869 left: (0, _utils.validateType)("TSEntityName"),
19870 right: (0, _utils.validateType)("Identifier")
19871 }
19872});
19873const signatureDeclarationCommon = {
19874 typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
19875 parameters: (0, _utils.validateArrayOfType)(["Identifier", "RestElement"]),
19876 typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
19877};
19878const callConstructSignatureDeclaration = {
19879 aliases: ["TSTypeElement"],
19880 visitor: ["typeParameters", "parameters", "typeAnnotation"],
19881 fields: signatureDeclarationCommon
19882};
19883(0, _utils.default)("TSCallSignatureDeclaration", callConstructSignatureDeclaration);
19884(0, _utils.default)("TSConstructSignatureDeclaration", callConstructSignatureDeclaration);
19885const namedTypeElementCommon = {
19886 key: (0, _utils.validateType)("Expression"),
19887 computed: (0, _utils.validate)(bool),
19888 optional: (0, _utils.validateOptional)(bool)
19889};
19890(0, _utils.default)("TSPropertySignature", {
19891 aliases: ["TSTypeElement"],
19892 visitor: ["key", "typeAnnotation", "initializer"],
19893 fields: Object.assign({}, namedTypeElementCommon, {
19894 readonly: (0, _utils.validateOptional)(bool),
19895 typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
19896 initializer: (0, _utils.validateOptionalType)("Expression")
19897 })
19898});
19899(0, _utils.default)("TSMethodSignature", {
19900 aliases: ["TSTypeElement"],
19901 visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
19902 fields: Object.assign({}, signatureDeclarationCommon, namedTypeElementCommon)
19903});
19904(0, _utils.default)("TSIndexSignature", {
19905 aliases: ["TSTypeElement"],
19906 visitor: ["parameters", "typeAnnotation"],
19907 fields: {
19908 readonly: (0, _utils.validateOptional)(bool),
19909 parameters: (0, _utils.validateArrayOfType)("Identifier"),
19910 typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
19911 }
19912});
19913const tsKeywordTypes = ["TSAnyKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSBooleanKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSVoidKeyword", "TSUndefinedKeyword", "TSNullKeyword", "TSNeverKeyword"];
19914
19915for (const type of tsKeywordTypes) {
19916 (0, _utils.default)(type, {
19917 aliases: ["TSType"],
19918 visitor: [],
19919 fields: {}
19920 });
19921}
19922
19923(0, _utils.default)("TSThisType", {
19924 aliases: ["TSType"],
19925 visitor: [],
19926 fields: {}
19927});
19928const fnOrCtr = {
19929 aliases: ["TSType"],
19930 visitor: ["typeParameters", "typeAnnotation"],
19931 fields: signatureDeclarationCommon
19932};
19933(0, _utils.default)("TSFunctionType", fnOrCtr);
19934(0, _utils.default)("TSConstructorType", fnOrCtr);
19935(0, _utils.default)("TSTypeReference", {
19936 aliases: ["TSType"],
19937 visitor: ["typeName", "typeParameters"],
19938 fields: {
19939 typeName: (0, _utils.validateType)("TSEntityName"),
19940 typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
19941 }
19942});
19943(0, _utils.default)("TSTypePredicate", {
19944 aliases: ["TSType"],
19945 visitor: ["parameterName", "typeAnnotation"],
19946 fields: {
19947 parameterName: (0, _utils.validateType)(["Identifier", "TSThisType"]),
19948 typeAnnotation: (0, _utils.validateType)("TSTypeAnnotation")
19949 }
19950});
19951(0, _utils.default)("TSTypeQuery", {
19952 aliases: ["TSType"],
19953 visitor: ["exprName"],
19954 fields: {
19955 exprName: (0, _utils.validateType)("TSEntityName")
19956 }
19957});
19958(0, _utils.default)("TSTypeLiteral", {
19959 aliases: ["TSType"],
19960 visitor: ["members"],
19961 fields: {
19962 members: (0, _utils.validateArrayOfType)("TSTypeElement")
19963 }
19964});
19965(0, _utils.default)("TSArrayType", {
19966 aliases: ["TSType"],
19967 visitor: ["elementType"],
19968 fields: {
19969 elementType: (0, _utils.validateType)("TSType")
19970 }
19971});
19972(0, _utils.default)("TSTupleType", {
19973 aliases: ["TSType"],
19974 visitor: ["elementTypes"],
19975 fields: {
19976 elementTypes: (0, _utils.validateArrayOfType)("TSType")
19977 }
19978});
19979const unionOrIntersection = {
19980 aliases: ["TSType"],
19981 visitor: ["types"],
19982 fields: {
19983 types: (0, _utils.validateArrayOfType)("TSType")
19984 }
19985};
19986(0, _utils.default)("TSUnionType", unionOrIntersection);
19987(0, _utils.default)("TSIntersectionType", unionOrIntersection);
19988(0, _utils.default)("TSConditionalType", {
19989 aliases: ["TSType"],
19990 visitor: ["checkType", "extendsType", "trueType", "falseType"],
19991 fields: {
19992 checkType: (0, _utils.validateType)("TSType"),
19993 extendsType: (0, _utils.validateType)("TSType"),
19994 trueType: (0, _utils.validateType)("TSType"),
19995 falseType: (0, _utils.validateType)("TSType")
19996 }
19997});
19998(0, _utils.default)("TSInferType", {
19999 aliases: ["TSType"],
20000 visitor: ["typeParameter"],
20001 fields: {
20002 typeParameter: (0, _utils.validateType)("TSTypeParameter")
20003 }
20004});
20005(0, _utils.default)("TSParenthesizedType", {
20006 aliases: ["TSType"],
20007 visitor: ["typeAnnotation"],
20008 fields: {
20009 typeAnnotation: (0, _utils.validateType)("TSType")
20010 }
20011});
20012(0, _utils.default)("TSTypeOperator", {
20013 aliases: ["TSType"],
20014 visitor: ["typeAnnotation"],
20015 fields: {
20016 operator: (0, _utils.validate)((0, _utils.assertValueType)("string")),
20017 typeAnnotation: (0, _utils.validateType)("TSType")
20018 }
20019});
20020(0, _utils.default)("TSIndexedAccessType", {
20021 aliases: ["TSType"],
20022 visitor: ["objectType", "indexType"],
20023 fields: {
20024 objectType: (0, _utils.validateType)("TSType"),
20025 indexType: (0, _utils.validateType)("TSType")
20026 }
20027});
20028(0, _utils.default)("TSMappedType", {
20029 aliases: ["TSType"],
20030 visitor: ["typeParameter", "typeAnnotation"],
20031 fields: {
20032 readonly: (0, _utils.validateOptional)(bool),
20033 typeParameter: (0, _utils.validateType)("TSTypeParameter"),
20034 optional: (0, _utils.validateOptional)(bool),
20035 typeAnnotation: (0, _utils.validateOptionalType)("TSType")
20036 }
20037});
20038(0, _utils.default)("TSLiteralType", {
20039 aliases: ["TSType"],
20040 visitor: ["literal"],
20041 fields: {
20042 literal: (0, _utils.validateType)(["NumericLiteral", "StringLiteral", "BooleanLiteral"])
20043 }
20044});
20045(0, _utils.default)("TSExpressionWithTypeArguments", {
20046 aliases: ["TSType"],
20047 visitor: ["expression", "typeParameters"],
20048 fields: {
20049 expression: (0, _utils.validateType)("TSEntityName"),
20050 typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
20051 }
20052});
20053(0, _utils.default)("TSInterfaceDeclaration", {
20054 aliases: ["Statement", "Declaration"],
20055 visitor: ["id", "typeParameters", "extends", "body"],
20056 fields: {
20057 declare: (0, _utils.validateOptional)(bool),
20058 id: (0, _utils.validateType)("Identifier"),
20059 typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
20060 extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("TSExpressionWithTypeArguments")),
20061 body: (0, _utils.validateType)("TSInterfaceBody")
20062 }
20063});
20064(0, _utils.default)("TSInterfaceBody", {
20065 visitor: ["body"],
20066 fields: {
20067 body: (0, _utils.validateArrayOfType)("TSTypeElement")
20068 }
20069});
20070(0, _utils.default)("TSTypeAliasDeclaration", {
20071 aliases: ["Statement", "Declaration"],
20072 visitor: ["id", "typeParameters", "typeAnnotation"],
20073 fields: {
20074 declare: (0, _utils.validateOptional)(bool),
20075 id: (0, _utils.validateType)("Identifier"),
20076 typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
20077 typeAnnotation: (0, _utils.validateType)("TSType")
20078 }
20079});
20080(0, _utils.default)("TSAsExpression", {
20081 aliases: ["Expression"],
20082 visitor: ["expression", "typeAnnotation"],
20083 fields: {
20084 expression: (0, _utils.validateType)("Expression"),
20085 typeAnnotation: (0, _utils.validateType)("TSType")
20086 }
20087});
20088(0, _utils.default)("TSTypeAssertion", {
20089 aliases: ["Expression"],
20090 visitor: ["typeAnnotation", "expression"],
20091 fields: {
20092 typeAnnotation: (0, _utils.validateType)("TSType"),
20093 expression: (0, _utils.validateType)("Expression")
20094 }
20095});
20096(0, _utils.default)("TSEnumDeclaration", {
20097 aliases: ["Statement", "Declaration"],
20098 visitor: ["id", "members"],
20099 fields: {
20100 declare: (0, _utils.validateOptional)(bool),
20101 const: (0, _utils.validateOptional)(bool),
20102 id: (0, _utils.validateType)("Identifier"),
20103 members: (0, _utils.validateArrayOfType)("TSEnumMember"),
20104 initializer: (0, _utils.validateOptionalType)("Expression")
20105 }
20106});
20107(0, _utils.default)("TSEnumMember", {
20108 visitor: ["id", "initializer"],
20109 fields: {
20110 id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
20111 initializer: (0, _utils.validateOptionalType)("Expression")
20112 }
20113});
20114(0, _utils.default)("TSModuleDeclaration", {
20115 aliases: ["Statement", "Declaration"],
20116 visitor: ["id", "body"],
20117 fields: {
20118 declare: (0, _utils.validateOptional)(bool),
20119 global: (0, _utils.validateOptional)(bool),
20120 id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
20121 body: (0, _utils.validateType)(["TSModuleBlock", "TSModuleDeclaration"])
20122 }
20123});
20124(0, _utils.default)("TSModuleBlock", {
20125 visitor: ["body"],
20126 fields: {
20127 body: (0, _utils.validateArrayOfType)("Statement")
20128 }
20129});
20130(0, _utils.default)("TSImportEqualsDeclaration", {
20131 aliases: ["Statement"],
20132 visitor: ["id", "moduleReference"],
20133 fields: {
20134 isExport: (0, _utils.validate)(bool),
20135 id: (0, _utils.validateType)("Identifier"),
20136 moduleReference: (0, _utils.validateType)(["TSEntityName", "TSExternalModuleReference"])
20137 }
20138});
20139(0, _utils.default)("TSExternalModuleReference", {
20140 visitor: ["expression"],
20141 fields: {
20142 expression: (0, _utils.validateType)("StringLiteral")
20143 }
20144});
20145(0, _utils.default)("TSNonNullExpression", {
20146 aliases: ["Expression"],
20147 visitor: ["expression"],
20148 fields: {
20149 expression: (0, _utils.validateType)("Expression")
20150 }
20151});
20152(0, _utils.default)("TSExportAssignment", {
20153 aliases: ["Statement"],
20154 visitor: ["expression"],
20155 fields: {
20156 expression: (0, _utils.validateType)("Expression")
20157 }
20158});
20159(0, _utils.default)("TSNamespaceExportDeclaration", {
20160 aliases: ["Statement"],
20161 visitor: ["id"],
20162 fields: {
20163 id: (0, _utils.validateType)("Identifier")
20164 }
20165});
20166(0, _utils.default)("TSTypeAnnotation", {
20167 visitor: ["typeAnnotation"],
20168 fields: {
20169 typeAnnotation: {
20170 validate: (0, _utils.assertNodeType)("TSType")
20171 }
20172 }
20173});
20174(0, _utils.default)("TSTypeParameterInstantiation", {
20175 visitor: ["params"],
20176 fields: {
20177 params: {
20178 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSType")))
20179 }
20180 }
20181});
20182(0, _utils.default)("TSTypeParameterDeclaration", {
20183 visitor: ["params"],
20184 fields: {
20185 params: {
20186 validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSTypeParameter")))
20187 }
20188 }
20189});
20190(0, _utils.default)("TSTypeParameter", {
20191 visitor: ["constraint", "default"],
20192 fields: {
20193 name: {
20194 validate: (0, _utils.assertValueType)("string")
20195 },
20196 constraint: {
20197 validate: (0, _utils.assertNodeType)("TSType"),
20198 optional: true
20199 },
20200 default: {
20201 validate: (0, _utils.assertNodeType)("TSType"),
20202 optional: true
20203 }
20204 }
20205});
20206
20207/***/ }),
20208/* 136 */
20209/***/ (function(module, exports, __webpack_require__) {
20210
20211"use strict";
20212
20213
20214Object.defineProperty(exports, "__esModule", {
20215 value: true
20216});
20217exports.default = assertNode;
20218
20219var _isNode = _interopRequireDefault(__webpack_require__(58));
20220
20221function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20222
20223function assertNode(node) {
20224 if (!(0, _isNode.default)(node)) {
20225 const type = node && node.type || JSON.stringify(node);
20226 throw new TypeError(`Not a valid node of type "${type}"`);
20227 }
20228}
20229
20230/***/ }),
20231/* 137 */
20232/***/ (function(module, exports, __webpack_require__) {
20233
20234"use strict";
20235
20236
20237Object.defineProperty(exports, "__esModule", {
20238 value: true
20239});
20240exports.assertArrayExpression = assertArrayExpression;
20241exports.assertAssignmentExpression = assertAssignmentExpression;
20242exports.assertBinaryExpression = assertBinaryExpression;
20243exports.assertInterpreterDirective = assertInterpreterDirective;
20244exports.assertDirective = assertDirective;
20245exports.assertDirectiveLiteral = assertDirectiveLiteral;
20246exports.assertBlockStatement = assertBlockStatement;
20247exports.assertBreakStatement = assertBreakStatement;
20248exports.assertCallExpression = assertCallExpression;
20249exports.assertCatchClause = assertCatchClause;
20250exports.assertConditionalExpression = assertConditionalExpression;
20251exports.assertContinueStatement = assertContinueStatement;
20252exports.assertDebuggerStatement = assertDebuggerStatement;
20253exports.assertDoWhileStatement = assertDoWhileStatement;
20254exports.assertEmptyStatement = assertEmptyStatement;
20255exports.assertExpressionStatement = assertExpressionStatement;
20256exports.assertFile = assertFile;
20257exports.assertForInStatement = assertForInStatement;
20258exports.assertForStatement = assertForStatement;
20259exports.assertFunctionDeclaration = assertFunctionDeclaration;
20260exports.assertFunctionExpression = assertFunctionExpression;
20261exports.assertIdentifier = assertIdentifier;
20262exports.assertIfStatement = assertIfStatement;
20263exports.assertLabeledStatement = assertLabeledStatement;
20264exports.assertStringLiteral = assertStringLiteral;
20265exports.assertNumericLiteral = assertNumericLiteral;
20266exports.assertNullLiteral = assertNullLiteral;
20267exports.assertBooleanLiteral = assertBooleanLiteral;
20268exports.assertRegExpLiteral = assertRegExpLiteral;
20269exports.assertLogicalExpression = assertLogicalExpression;
20270exports.assertMemberExpression = assertMemberExpression;
20271exports.assertNewExpression = assertNewExpression;
20272exports.assertProgram = assertProgram;
20273exports.assertObjectExpression = assertObjectExpression;
20274exports.assertObjectMethod = assertObjectMethod;
20275exports.assertObjectProperty = assertObjectProperty;
20276exports.assertRestElement = assertRestElement;
20277exports.assertReturnStatement = assertReturnStatement;
20278exports.assertSequenceExpression = assertSequenceExpression;
20279exports.assertSwitchCase = assertSwitchCase;
20280exports.assertSwitchStatement = assertSwitchStatement;
20281exports.assertThisExpression = assertThisExpression;
20282exports.assertThrowStatement = assertThrowStatement;
20283exports.assertTryStatement = assertTryStatement;
20284exports.assertUnaryExpression = assertUnaryExpression;
20285exports.assertUpdateExpression = assertUpdateExpression;
20286exports.assertVariableDeclaration = assertVariableDeclaration;
20287exports.assertVariableDeclarator = assertVariableDeclarator;
20288exports.assertWhileStatement = assertWhileStatement;
20289exports.assertWithStatement = assertWithStatement;
20290exports.assertAssignmentPattern = assertAssignmentPattern;
20291exports.assertArrayPattern = assertArrayPattern;
20292exports.assertArrowFunctionExpression = assertArrowFunctionExpression;
20293exports.assertClassBody = assertClassBody;
20294exports.assertClassDeclaration = assertClassDeclaration;
20295exports.assertClassExpression = assertClassExpression;
20296exports.assertExportAllDeclaration = assertExportAllDeclaration;
20297exports.assertExportDefaultDeclaration = assertExportDefaultDeclaration;
20298exports.assertExportNamedDeclaration = assertExportNamedDeclaration;
20299exports.assertExportSpecifier = assertExportSpecifier;
20300exports.assertForOfStatement = assertForOfStatement;
20301exports.assertImportDeclaration = assertImportDeclaration;
20302exports.assertImportDefaultSpecifier = assertImportDefaultSpecifier;
20303exports.assertImportNamespaceSpecifier = assertImportNamespaceSpecifier;
20304exports.assertImportSpecifier = assertImportSpecifier;
20305exports.assertMetaProperty = assertMetaProperty;
20306exports.assertClassMethod = assertClassMethod;
20307exports.assertObjectPattern = assertObjectPattern;
20308exports.assertSpreadElement = assertSpreadElement;
20309exports.assertSuper = assertSuper;
20310exports.assertTaggedTemplateExpression = assertTaggedTemplateExpression;
20311exports.assertTemplateElement = assertTemplateElement;
20312exports.assertTemplateLiteral = assertTemplateLiteral;
20313exports.assertYieldExpression = assertYieldExpression;
20314exports.assertAnyTypeAnnotation = assertAnyTypeAnnotation;
20315exports.assertArrayTypeAnnotation = assertArrayTypeAnnotation;
20316exports.assertBooleanTypeAnnotation = assertBooleanTypeAnnotation;
20317exports.assertBooleanLiteralTypeAnnotation = assertBooleanLiteralTypeAnnotation;
20318exports.assertNullLiteralTypeAnnotation = assertNullLiteralTypeAnnotation;
20319exports.assertClassImplements = assertClassImplements;
20320exports.assertDeclareClass = assertDeclareClass;
20321exports.assertDeclareFunction = assertDeclareFunction;
20322exports.assertDeclareInterface = assertDeclareInterface;
20323exports.assertDeclareModule = assertDeclareModule;
20324exports.assertDeclareModuleExports = assertDeclareModuleExports;
20325exports.assertDeclareTypeAlias = assertDeclareTypeAlias;
20326exports.assertDeclareOpaqueType = assertDeclareOpaqueType;
20327exports.assertDeclareVariable = assertDeclareVariable;
20328exports.assertDeclareExportDeclaration = assertDeclareExportDeclaration;
20329exports.assertDeclareExportAllDeclaration = assertDeclareExportAllDeclaration;
20330exports.assertDeclaredPredicate = assertDeclaredPredicate;
20331exports.assertExistsTypeAnnotation = assertExistsTypeAnnotation;
20332exports.assertFunctionTypeAnnotation = assertFunctionTypeAnnotation;
20333exports.assertFunctionTypeParam = assertFunctionTypeParam;
20334exports.assertGenericTypeAnnotation = assertGenericTypeAnnotation;
20335exports.assertInferredPredicate = assertInferredPredicate;
20336exports.assertInterfaceExtends = assertInterfaceExtends;
20337exports.assertInterfaceDeclaration = assertInterfaceDeclaration;
20338exports.assertInterfaceTypeAnnotation = assertInterfaceTypeAnnotation;
20339exports.assertIntersectionTypeAnnotation = assertIntersectionTypeAnnotation;
20340exports.assertMixedTypeAnnotation = assertMixedTypeAnnotation;
20341exports.assertEmptyTypeAnnotation = assertEmptyTypeAnnotation;
20342exports.assertNullableTypeAnnotation = assertNullableTypeAnnotation;
20343exports.assertNumberLiteralTypeAnnotation = assertNumberLiteralTypeAnnotation;
20344exports.assertNumberTypeAnnotation = assertNumberTypeAnnotation;
20345exports.assertObjectTypeAnnotation = assertObjectTypeAnnotation;
20346exports.assertObjectTypeInternalSlot = assertObjectTypeInternalSlot;
20347exports.assertObjectTypeCallProperty = assertObjectTypeCallProperty;
20348exports.assertObjectTypeIndexer = assertObjectTypeIndexer;
20349exports.assertObjectTypeProperty = assertObjectTypeProperty;
20350exports.assertObjectTypeSpreadProperty = assertObjectTypeSpreadProperty;
20351exports.assertOpaqueType = assertOpaqueType;
20352exports.assertQualifiedTypeIdentifier = assertQualifiedTypeIdentifier;
20353exports.assertStringLiteralTypeAnnotation = assertStringLiteralTypeAnnotation;
20354exports.assertStringTypeAnnotation = assertStringTypeAnnotation;
20355exports.assertThisTypeAnnotation = assertThisTypeAnnotation;
20356exports.assertTupleTypeAnnotation = assertTupleTypeAnnotation;
20357exports.assertTypeofTypeAnnotation = assertTypeofTypeAnnotation;
20358exports.assertTypeAlias = assertTypeAlias;
20359exports.assertTypeAnnotation = assertTypeAnnotation;
20360exports.assertTypeCastExpression = assertTypeCastExpression;
20361exports.assertTypeParameter = assertTypeParameter;
20362exports.assertTypeParameterDeclaration = assertTypeParameterDeclaration;
20363exports.assertTypeParameterInstantiation = assertTypeParameterInstantiation;
20364exports.assertUnionTypeAnnotation = assertUnionTypeAnnotation;
20365exports.assertVariance = assertVariance;
20366exports.assertVoidTypeAnnotation = assertVoidTypeAnnotation;
20367exports.assertJSXAttribute = assertJSXAttribute;
20368exports.assertJSXClosingElement = assertJSXClosingElement;
20369exports.assertJSXElement = assertJSXElement;
20370exports.assertJSXEmptyExpression = assertJSXEmptyExpression;
20371exports.assertJSXExpressionContainer = assertJSXExpressionContainer;
20372exports.assertJSXSpreadChild = assertJSXSpreadChild;
20373exports.assertJSXIdentifier = assertJSXIdentifier;
20374exports.assertJSXMemberExpression = assertJSXMemberExpression;
20375exports.assertJSXNamespacedName = assertJSXNamespacedName;
20376exports.assertJSXOpeningElement = assertJSXOpeningElement;
20377exports.assertJSXSpreadAttribute = assertJSXSpreadAttribute;
20378exports.assertJSXText = assertJSXText;
20379exports.assertJSXFragment = assertJSXFragment;
20380exports.assertJSXOpeningFragment = assertJSXOpeningFragment;
20381exports.assertJSXClosingFragment = assertJSXClosingFragment;
20382exports.assertNoop = assertNoop;
20383exports.assertParenthesizedExpression = assertParenthesizedExpression;
20384exports.assertAwaitExpression = assertAwaitExpression;
20385exports.assertBindExpression = assertBindExpression;
20386exports.assertClassProperty = assertClassProperty;
20387exports.assertOptionalMemberExpression = assertOptionalMemberExpression;
20388exports.assertOptionalCallExpression = assertOptionalCallExpression;
20389exports.assertClassPrivateProperty = assertClassPrivateProperty;
20390exports.assertImport = assertImport;
20391exports.assertDecorator = assertDecorator;
20392exports.assertDoExpression = assertDoExpression;
20393exports.assertExportDefaultSpecifier = assertExportDefaultSpecifier;
20394exports.assertExportNamespaceSpecifier = assertExportNamespaceSpecifier;
20395exports.assertPrivateName = assertPrivateName;
20396exports.assertBigIntLiteral = assertBigIntLiteral;
20397exports.assertTSParameterProperty = assertTSParameterProperty;
20398exports.assertTSDeclareFunction = assertTSDeclareFunction;
20399exports.assertTSDeclareMethod = assertTSDeclareMethod;
20400exports.assertTSQualifiedName = assertTSQualifiedName;
20401exports.assertTSCallSignatureDeclaration = assertTSCallSignatureDeclaration;
20402exports.assertTSConstructSignatureDeclaration = assertTSConstructSignatureDeclaration;
20403exports.assertTSPropertySignature = assertTSPropertySignature;
20404exports.assertTSMethodSignature = assertTSMethodSignature;
20405exports.assertTSIndexSignature = assertTSIndexSignature;
20406exports.assertTSAnyKeyword = assertTSAnyKeyword;
20407exports.assertTSNumberKeyword = assertTSNumberKeyword;
20408exports.assertTSObjectKeyword = assertTSObjectKeyword;
20409exports.assertTSBooleanKeyword = assertTSBooleanKeyword;
20410exports.assertTSStringKeyword = assertTSStringKeyword;
20411exports.assertTSSymbolKeyword = assertTSSymbolKeyword;
20412exports.assertTSVoidKeyword = assertTSVoidKeyword;
20413exports.assertTSUndefinedKeyword = assertTSUndefinedKeyword;
20414exports.assertTSNullKeyword = assertTSNullKeyword;
20415exports.assertTSNeverKeyword = assertTSNeverKeyword;
20416exports.assertTSThisType = assertTSThisType;
20417exports.assertTSFunctionType = assertTSFunctionType;
20418exports.assertTSConstructorType = assertTSConstructorType;
20419exports.assertTSTypeReference = assertTSTypeReference;
20420exports.assertTSTypePredicate = assertTSTypePredicate;
20421exports.assertTSTypeQuery = assertTSTypeQuery;
20422exports.assertTSTypeLiteral = assertTSTypeLiteral;
20423exports.assertTSArrayType = assertTSArrayType;
20424exports.assertTSTupleType = assertTSTupleType;
20425exports.assertTSUnionType = assertTSUnionType;
20426exports.assertTSIntersectionType = assertTSIntersectionType;
20427exports.assertTSConditionalType = assertTSConditionalType;
20428exports.assertTSInferType = assertTSInferType;
20429exports.assertTSParenthesizedType = assertTSParenthesizedType;
20430exports.assertTSTypeOperator = assertTSTypeOperator;
20431exports.assertTSIndexedAccessType = assertTSIndexedAccessType;
20432exports.assertTSMappedType = assertTSMappedType;
20433exports.assertTSLiteralType = assertTSLiteralType;
20434exports.assertTSExpressionWithTypeArguments = assertTSExpressionWithTypeArguments;
20435exports.assertTSInterfaceDeclaration = assertTSInterfaceDeclaration;
20436exports.assertTSInterfaceBody = assertTSInterfaceBody;
20437exports.assertTSTypeAliasDeclaration = assertTSTypeAliasDeclaration;
20438exports.assertTSAsExpression = assertTSAsExpression;
20439exports.assertTSTypeAssertion = assertTSTypeAssertion;
20440exports.assertTSEnumDeclaration = assertTSEnumDeclaration;
20441exports.assertTSEnumMember = assertTSEnumMember;
20442exports.assertTSModuleDeclaration = assertTSModuleDeclaration;
20443exports.assertTSModuleBlock = assertTSModuleBlock;
20444exports.assertTSImportEqualsDeclaration = assertTSImportEqualsDeclaration;
20445exports.assertTSExternalModuleReference = assertTSExternalModuleReference;
20446exports.assertTSNonNullExpression = assertTSNonNullExpression;
20447exports.assertTSExportAssignment = assertTSExportAssignment;
20448exports.assertTSNamespaceExportDeclaration = assertTSNamespaceExportDeclaration;
20449exports.assertTSTypeAnnotation = assertTSTypeAnnotation;
20450exports.assertTSTypeParameterInstantiation = assertTSTypeParameterInstantiation;
20451exports.assertTSTypeParameterDeclaration = assertTSTypeParameterDeclaration;
20452exports.assertTSTypeParameter = assertTSTypeParameter;
20453exports.assertExpression = assertExpression;
20454exports.assertBinary = assertBinary;
20455exports.assertScopable = assertScopable;
20456exports.assertBlockParent = assertBlockParent;
20457exports.assertBlock = assertBlock;
20458exports.assertStatement = assertStatement;
20459exports.assertTerminatorless = assertTerminatorless;
20460exports.assertCompletionStatement = assertCompletionStatement;
20461exports.assertConditional = assertConditional;
20462exports.assertLoop = assertLoop;
20463exports.assertWhile = assertWhile;
20464exports.assertExpressionWrapper = assertExpressionWrapper;
20465exports.assertFor = assertFor;
20466exports.assertForXStatement = assertForXStatement;
20467exports.assertFunction = assertFunction;
20468exports.assertFunctionParent = assertFunctionParent;
20469exports.assertPureish = assertPureish;
20470exports.assertDeclaration = assertDeclaration;
20471exports.assertPatternLike = assertPatternLike;
20472exports.assertLVal = assertLVal;
20473exports.assertTSEntityName = assertTSEntityName;
20474exports.assertLiteral = assertLiteral;
20475exports.assertImmutable = assertImmutable;
20476exports.assertUserWhitespacable = assertUserWhitespacable;
20477exports.assertMethod = assertMethod;
20478exports.assertObjectMember = assertObjectMember;
20479exports.assertProperty = assertProperty;
20480exports.assertUnaryLike = assertUnaryLike;
20481exports.assertPattern = assertPattern;
20482exports.assertClass = assertClass;
20483exports.assertModuleDeclaration = assertModuleDeclaration;
20484exports.assertExportDeclaration = assertExportDeclaration;
20485exports.assertModuleSpecifier = assertModuleSpecifier;
20486exports.assertFlow = assertFlow;
20487exports.assertFlowType = assertFlowType;
20488exports.assertFlowBaseAnnotation = assertFlowBaseAnnotation;
20489exports.assertFlowDeclaration = assertFlowDeclaration;
20490exports.assertFlowPredicate = assertFlowPredicate;
20491exports.assertJSX = assertJSX;
20492exports.assertPrivate = assertPrivate;
20493exports.assertTSTypeElement = assertTSTypeElement;
20494exports.assertTSType = assertTSType;
20495exports.assertNumberLiteral = assertNumberLiteral;
20496exports.assertRegexLiteral = assertRegexLiteral;
20497exports.assertRestProperty = assertRestProperty;
20498exports.assertSpreadProperty = assertSpreadProperty;
20499
20500var _is = _interopRequireDefault(__webpack_require__(41));
20501
20502function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20503
20504function assert(type, node, opts) {
20505 if (!(0, _is.default)(type, node, opts)) {
20506 throw new Error(`Expected type "${type}" with option ${JSON.stringify(opts)}, but instead got "${node.type}".`);
20507 }
20508}
20509
20510function assertArrayExpression(node, opts = {}) {
20511 assert("ArrayExpression", node, opts);
20512}
20513
20514function assertAssignmentExpression(node, opts = {}) {
20515 assert("AssignmentExpression", node, opts);
20516}
20517
20518function assertBinaryExpression(node, opts = {}) {
20519 assert("BinaryExpression", node, opts);
20520}
20521
20522function assertInterpreterDirective(node, opts = {}) {
20523 assert("InterpreterDirective", node, opts);
20524}
20525
20526function assertDirective(node, opts = {}) {
20527 assert("Directive", node, opts);
20528}
20529
20530function assertDirectiveLiteral(node, opts = {}) {
20531 assert("DirectiveLiteral", node, opts);
20532}
20533
20534function assertBlockStatement(node, opts = {}) {
20535 assert("BlockStatement", node, opts);
20536}
20537
20538function assertBreakStatement(node, opts = {}) {
20539 assert("BreakStatement", node, opts);
20540}
20541
20542function assertCallExpression(node, opts = {}) {
20543 assert("CallExpression", node, opts);
20544}
20545
20546function assertCatchClause(node, opts = {}) {
20547 assert("CatchClause", node, opts);
20548}
20549
20550function assertConditionalExpression(node, opts = {}) {
20551 assert("ConditionalExpression", node, opts);
20552}
20553
20554function assertContinueStatement(node, opts = {}) {
20555 assert("ContinueStatement", node, opts);
20556}
20557
20558function assertDebuggerStatement(node, opts = {}) {
20559 assert("DebuggerStatement", node, opts);
20560}
20561
20562function assertDoWhileStatement(node, opts = {}) {
20563 assert("DoWhileStatement", node, opts);
20564}
20565
20566function assertEmptyStatement(node, opts = {}) {
20567 assert("EmptyStatement", node, opts);
20568}
20569
20570function assertExpressionStatement(node, opts = {}) {
20571 assert("ExpressionStatement", node, opts);
20572}
20573
20574function assertFile(node, opts = {}) {
20575 assert("File", node, opts);
20576}
20577
20578function assertForInStatement(node, opts = {}) {
20579 assert("ForInStatement", node, opts);
20580}
20581
20582function assertForStatement(node, opts = {}) {
20583 assert("ForStatement", node, opts);
20584}
20585
20586function assertFunctionDeclaration(node, opts = {}) {
20587 assert("FunctionDeclaration", node, opts);
20588}
20589
20590function assertFunctionExpression(node, opts = {}) {
20591 assert("FunctionExpression", node, opts);
20592}
20593
20594function assertIdentifier(node, opts = {}) {
20595 assert("Identifier", node, opts);
20596}
20597
20598function assertIfStatement(node, opts = {}) {
20599 assert("IfStatement", node, opts);
20600}
20601
20602function assertLabeledStatement(node, opts = {}) {
20603 assert("LabeledStatement", node, opts);
20604}
20605
20606function assertStringLiteral(node, opts = {}) {
20607 assert("StringLiteral", node, opts);
20608}
20609
20610function assertNumericLiteral(node, opts = {}) {
20611 assert("NumericLiteral", node, opts);
20612}
20613
20614function assertNullLiteral(node, opts = {}) {
20615 assert("NullLiteral", node, opts);
20616}
20617
20618function assertBooleanLiteral(node, opts = {}) {
20619 assert("BooleanLiteral", node, opts);
20620}
20621
20622function assertRegExpLiteral(node, opts = {}) {
20623 assert("RegExpLiteral", node, opts);
20624}
20625
20626function assertLogicalExpression(node, opts = {}) {
20627 assert("LogicalExpression", node, opts);
20628}
20629
20630function assertMemberExpression(node, opts = {}) {
20631 assert("MemberExpression", node, opts);
20632}
20633
20634function assertNewExpression(node, opts = {}) {
20635 assert("NewExpression", node, opts);
20636}
20637
20638function assertProgram(node, opts = {}) {
20639 assert("Program", node, opts);
20640}
20641
20642function assertObjectExpression(node, opts = {}) {
20643 assert("ObjectExpression", node, opts);
20644}
20645
20646function assertObjectMethod(node, opts = {}) {
20647 assert("ObjectMethod", node, opts);
20648}
20649
20650function assertObjectProperty(node, opts = {}) {
20651 assert("ObjectProperty", node, opts);
20652}
20653
20654function assertRestElement(node, opts = {}) {
20655 assert("RestElement", node, opts);
20656}
20657
20658function assertReturnStatement(node, opts = {}) {
20659 assert("ReturnStatement", node, opts);
20660}
20661
20662function assertSequenceExpression(node, opts = {}) {
20663 assert("SequenceExpression", node, opts);
20664}
20665
20666function assertSwitchCase(node, opts = {}) {
20667 assert("SwitchCase", node, opts);
20668}
20669
20670function assertSwitchStatement(node, opts = {}) {
20671 assert("SwitchStatement", node, opts);
20672}
20673
20674function assertThisExpression(node, opts = {}) {
20675 assert("ThisExpression", node, opts);
20676}
20677
20678function assertThrowStatement(node, opts = {}) {
20679 assert("ThrowStatement", node, opts);
20680}
20681
20682function assertTryStatement(node, opts = {}) {
20683 assert("TryStatement", node, opts);
20684}
20685
20686function assertUnaryExpression(node, opts = {}) {
20687 assert("UnaryExpression", node, opts);
20688}
20689
20690function assertUpdateExpression(node, opts = {}) {
20691 assert("UpdateExpression", node, opts);
20692}
20693
20694function assertVariableDeclaration(node, opts = {}) {
20695 assert("VariableDeclaration", node, opts);
20696}
20697
20698function assertVariableDeclarator(node, opts = {}) {
20699 assert("VariableDeclarator", node, opts);
20700}
20701
20702function assertWhileStatement(node, opts = {}) {
20703 assert("WhileStatement", node, opts);
20704}
20705
20706function assertWithStatement(node, opts = {}) {
20707 assert("WithStatement", node, opts);
20708}
20709
20710function assertAssignmentPattern(node, opts = {}) {
20711 assert("AssignmentPattern", node, opts);
20712}
20713
20714function assertArrayPattern(node, opts = {}) {
20715 assert("ArrayPattern", node, opts);
20716}
20717
20718function assertArrowFunctionExpression(node, opts = {}) {
20719 assert("ArrowFunctionExpression", node, opts);
20720}
20721
20722function assertClassBody(node, opts = {}) {
20723 assert("ClassBody", node, opts);
20724}
20725
20726function assertClassDeclaration(node, opts = {}) {
20727 assert("ClassDeclaration", node, opts);
20728}
20729
20730function assertClassExpression(node, opts = {}) {
20731 assert("ClassExpression", node, opts);
20732}
20733
20734function assertExportAllDeclaration(node, opts = {}) {
20735 assert("ExportAllDeclaration", node, opts);
20736}
20737
20738function assertExportDefaultDeclaration(node, opts = {}) {
20739 assert("ExportDefaultDeclaration", node, opts);
20740}
20741
20742function assertExportNamedDeclaration(node, opts = {}) {
20743 assert("ExportNamedDeclaration", node, opts);
20744}
20745
20746function assertExportSpecifier(node, opts = {}) {
20747 assert("ExportSpecifier", node, opts);
20748}
20749
20750function assertForOfStatement(node, opts = {}) {
20751 assert("ForOfStatement", node, opts);
20752}
20753
20754function assertImportDeclaration(node, opts = {}) {
20755 assert("ImportDeclaration", node, opts);
20756}
20757
20758function assertImportDefaultSpecifier(node, opts = {}) {
20759 assert("ImportDefaultSpecifier", node, opts);
20760}
20761
20762function assertImportNamespaceSpecifier(node, opts = {}) {
20763 assert("ImportNamespaceSpecifier", node, opts);
20764}
20765
20766function assertImportSpecifier(node, opts = {}) {
20767 assert("ImportSpecifier", node, opts);
20768}
20769
20770function assertMetaProperty(node, opts = {}) {
20771 assert("MetaProperty", node, opts);
20772}
20773
20774function assertClassMethod(node, opts = {}) {
20775 assert("ClassMethod", node, opts);
20776}
20777
20778function assertObjectPattern(node, opts = {}) {
20779 assert("ObjectPattern", node, opts);
20780}
20781
20782function assertSpreadElement(node, opts = {}) {
20783 assert("SpreadElement", node, opts);
20784}
20785
20786function assertSuper(node, opts = {}) {
20787 assert("Super", node, opts);
20788}
20789
20790function assertTaggedTemplateExpression(node, opts = {}) {
20791 assert("TaggedTemplateExpression", node, opts);
20792}
20793
20794function assertTemplateElement(node, opts = {}) {
20795 assert("TemplateElement", node, opts);
20796}
20797
20798function assertTemplateLiteral(node, opts = {}) {
20799 assert("TemplateLiteral", node, opts);
20800}
20801
20802function assertYieldExpression(node, opts = {}) {
20803 assert("YieldExpression", node, opts);
20804}
20805
20806function assertAnyTypeAnnotation(node, opts = {}) {
20807 assert("AnyTypeAnnotation", node, opts);
20808}
20809
20810function assertArrayTypeAnnotation(node, opts = {}) {
20811 assert("ArrayTypeAnnotation", node, opts);
20812}
20813
20814function assertBooleanTypeAnnotation(node, opts = {}) {
20815 assert("BooleanTypeAnnotation", node, opts);
20816}
20817
20818function assertBooleanLiteralTypeAnnotation(node, opts = {}) {
20819 assert("BooleanLiteralTypeAnnotation", node, opts);
20820}
20821
20822function assertNullLiteralTypeAnnotation(node, opts = {}) {
20823 assert("NullLiteralTypeAnnotation", node, opts);
20824}
20825
20826function assertClassImplements(node, opts = {}) {
20827 assert("ClassImplements", node, opts);
20828}
20829
20830function assertDeclareClass(node, opts = {}) {
20831 assert("DeclareClass", node, opts);
20832}
20833
20834function assertDeclareFunction(node, opts = {}) {
20835 assert("DeclareFunction", node, opts);
20836}
20837
20838function assertDeclareInterface(node, opts = {}) {
20839 assert("DeclareInterface", node, opts);
20840}
20841
20842function assertDeclareModule(node, opts = {}) {
20843 assert("DeclareModule", node, opts);
20844}
20845
20846function assertDeclareModuleExports(node, opts = {}) {
20847 assert("DeclareModuleExports", node, opts);
20848}
20849
20850function assertDeclareTypeAlias(node, opts = {}) {
20851 assert("DeclareTypeAlias", node, opts);
20852}
20853
20854function assertDeclareOpaqueType(node, opts = {}) {
20855 assert("DeclareOpaqueType", node, opts);
20856}
20857
20858function assertDeclareVariable(node, opts = {}) {
20859 assert("DeclareVariable", node, opts);
20860}
20861
20862function assertDeclareExportDeclaration(node, opts = {}) {
20863 assert("DeclareExportDeclaration", node, opts);
20864}
20865
20866function assertDeclareExportAllDeclaration(node, opts = {}) {
20867 assert("DeclareExportAllDeclaration", node, opts);
20868}
20869
20870function assertDeclaredPredicate(node, opts = {}) {
20871 assert("DeclaredPredicate", node, opts);
20872}
20873
20874function assertExistsTypeAnnotation(node, opts = {}) {
20875 assert("ExistsTypeAnnotation", node, opts);
20876}
20877
20878function assertFunctionTypeAnnotation(node, opts = {}) {
20879 assert("FunctionTypeAnnotation", node, opts);
20880}
20881
20882function assertFunctionTypeParam(node, opts = {}) {
20883 assert("FunctionTypeParam", node, opts);
20884}
20885
20886function assertGenericTypeAnnotation(node, opts = {}) {
20887 assert("GenericTypeAnnotation", node, opts);
20888}
20889
20890function assertInferredPredicate(node, opts = {}) {
20891 assert("InferredPredicate", node, opts);
20892}
20893
20894function assertInterfaceExtends(node, opts = {}) {
20895 assert("InterfaceExtends", node, opts);
20896}
20897
20898function assertInterfaceDeclaration(node, opts = {}) {
20899 assert("InterfaceDeclaration", node, opts);
20900}
20901
20902function assertInterfaceTypeAnnotation(node, opts = {}) {
20903 assert("InterfaceTypeAnnotation", node, opts);
20904}
20905
20906function assertIntersectionTypeAnnotation(node, opts = {}) {
20907 assert("IntersectionTypeAnnotation", node, opts);
20908}
20909
20910function assertMixedTypeAnnotation(node, opts = {}) {
20911 assert("MixedTypeAnnotation", node, opts);
20912}
20913
20914function assertEmptyTypeAnnotation(node, opts = {}) {
20915 assert("EmptyTypeAnnotation", node, opts);
20916}
20917
20918function assertNullableTypeAnnotation(node, opts = {}) {
20919 assert("NullableTypeAnnotation", node, opts);
20920}
20921
20922function assertNumberLiteralTypeAnnotation(node, opts = {}) {
20923 assert("NumberLiteralTypeAnnotation", node, opts);
20924}
20925
20926function assertNumberTypeAnnotation(node, opts = {}) {
20927 assert("NumberTypeAnnotation", node, opts);
20928}
20929
20930function assertObjectTypeAnnotation(node, opts = {}) {
20931 assert("ObjectTypeAnnotation", node, opts);
20932}
20933
20934function assertObjectTypeInternalSlot(node, opts = {}) {
20935 assert("ObjectTypeInternalSlot", node, opts);
20936}
20937
20938function assertObjectTypeCallProperty(node, opts = {}) {
20939 assert("ObjectTypeCallProperty", node, opts);
20940}
20941
20942function assertObjectTypeIndexer(node, opts = {}) {
20943 assert("ObjectTypeIndexer", node, opts);
20944}
20945
20946function assertObjectTypeProperty(node, opts = {}) {
20947 assert("ObjectTypeProperty", node, opts);
20948}
20949
20950function assertObjectTypeSpreadProperty(node, opts = {}) {
20951 assert("ObjectTypeSpreadProperty", node, opts);
20952}
20953
20954function assertOpaqueType(node, opts = {}) {
20955 assert("OpaqueType", node, opts);
20956}
20957
20958function assertQualifiedTypeIdentifier(node, opts = {}) {
20959 assert("QualifiedTypeIdentifier", node, opts);
20960}
20961
20962function assertStringLiteralTypeAnnotation(node, opts = {}) {
20963 assert("StringLiteralTypeAnnotation", node, opts);
20964}
20965
20966function assertStringTypeAnnotation(node, opts = {}) {
20967 assert("StringTypeAnnotation", node, opts);
20968}
20969
20970function assertThisTypeAnnotation(node, opts = {}) {
20971 assert("ThisTypeAnnotation", node, opts);
20972}
20973
20974function assertTupleTypeAnnotation(node, opts = {}) {
20975 assert("TupleTypeAnnotation", node, opts);
20976}
20977
20978function assertTypeofTypeAnnotation(node, opts = {}) {
20979 assert("TypeofTypeAnnotation", node, opts);
20980}
20981
20982function assertTypeAlias(node, opts = {}) {
20983 assert("TypeAlias", node, opts);
20984}
20985
20986function assertTypeAnnotation(node, opts = {}) {
20987 assert("TypeAnnotation", node, opts);
20988}
20989
20990function assertTypeCastExpression(node, opts = {}) {
20991 assert("TypeCastExpression", node, opts);
20992}
20993
20994function assertTypeParameter(node, opts = {}) {
20995 assert("TypeParameter", node, opts);
20996}
20997
20998function assertTypeParameterDeclaration(node, opts = {}) {
20999 assert("TypeParameterDeclaration", node, opts);
21000}
21001
21002function assertTypeParameterInstantiation(node, opts = {}) {
21003 assert("TypeParameterInstantiation", node, opts);
21004}
21005
21006function assertUnionTypeAnnotation(node, opts = {}) {
21007 assert("UnionTypeAnnotation", node, opts);
21008}
21009
21010function assertVariance(node, opts = {}) {
21011 assert("Variance", node, opts);
21012}
21013
21014function assertVoidTypeAnnotation(node, opts = {}) {
21015 assert("VoidTypeAnnotation", node, opts);
21016}
21017
21018function assertJSXAttribute(node, opts = {}) {
21019 assert("JSXAttribute", node, opts);
21020}
21021
21022function assertJSXClosingElement(node, opts = {}) {
21023 assert("JSXClosingElement", node, opts);
21024}
21025
21026function assertJSXElement(node, opts = {}) {
21027 assert("JSXElement", node, opts);
21028}
21029
21030function assertJSXEmptyExpression(node, opts = {}) {
21031 assert("JSXEmptyExpression", node, opts);
21032}
21033
21034function assertJSXExpressionContainer(node, opts = {}) {
21035 assert("JSXExpressionContainer", node, opts);
21036}
21037
21038function assertJSXSpreadChild(node, opts = {}) {
21039 assert("JSXSpreadChild", node, opts);
21040}
21041
21042function assertJSXIdentifier(node, opts = {}) {
21043 assert("JSXIdentifier", node, opts);
21044}
21045
21046function assertJSXMemberExpression(node, opts = {}) {
21047 assert("JSXMemberExpression", node, opts);
21048}
21049
21050function assertJSXNamespacedName(node, opts = {}) {
21051 assert("JSXNamespacedName", node, opts);
21052}
21053
21054function assertJSXOpeningElement(node, opts = {}) {
21055 assert("JSXOpeningElement", node, opts);
21056}
21057
21058function assertJSXSpreadAttribute(node, opts = {}) {
21059 assert("JSXSpreadAttribute", node, opts);
21060}
21061
21062function assertJSXText(node, opts = {}) {
21063 assert("JSXText", node, opts);
21064}
21065
21066function assertJSXFragment(node, opts = {}) {
21067 assert("JSXFragment", node, opts);
21068}
21069
21070function assertJSXOpeningFragment(node, opts = {}) {
21071 assert("JSXOpeningFragment", node, opts);
21072}
21073
21074function assertJSXClosingFragment(node, opts = {}) {
21075 assert("JSXClosingFragment", node, opts);
21076}
21077
21078function assertNoop(node, opts = {}) {
21079 assert("Noop", node, opts);
21080}
21081
21082function assertParenthesizedExpression(node, opts = {}) {
21083 assert("ParenthesizedExpression", node, opts);
21084}
21085
21086function assertAwaitExpression(node, opts = {}) {
21087 assert("AwaitExpression", node, opts);
21088}
21089
21090function assertBindExpression(node, opts = {}) {
21091 assert("BindExpression", node, opts);
21092}
21093
21094function assertClassProperty(node, opts = {}) {
21095 assert("ClassProperty", node, opts);
21096}
21097
21098function assertOptionalMemberExpression(node, opts = {}) {
21099 assert("OptionalMemberExpression", node, opts);
21100}
21101
21102function assertOptionalCallExpression(node, opts = {}) {
21103 assert("OptionalCallExpression", node, opts);
21104}
21105
21106function assertClassPrivateProperty(node, opts = {}) {
21107 assert("ClassPrivateProperty", node, opts);
21108}
21109
21110function assertImport(node, opts = {}) {
21111 assert("Import", node, opts);
21112}
21113
21114function assertDecorator(node, opts = {}) {
21115 assert("Decorator", node, opts);
21116}
21117
21118function assertDoExpression(node, opts = {}) {
21119 assert("DoExpression", node, opts);
21120}
21121
21122function assertExportDefaultSpecifier(node, opts = {}) {
21123 assert("ExportDefaultSpecifier", node, opts);
21124}
21125
21126function assertExportNamespaceSpecifier(node, opts = {}) {
21127 assert("ExportNamespaceSpecifier", node, opts);
21128}
21129
21130function assertPrivateName(node, opts = {}) {
21131 assert("PrivateName", node, opts);
21132}
21133
21134function assertBigIntLiteral(node, opts = {}) {
21135 assert("BigIntLiteral", node, opts);
21136}
21137
21138function assertTSParameterProperty(node, opts = {}) {
21139 assert("TSParameterProperty", node, opts);
21140}
21141
21142function assertTSDeclareFunction(node, opts = {}) {
21143 assert("TSDeclareFunction", node, opts);
21144}
21145
21146function assertTSDeclareMethod(node, opts = {}) {
21147 assert("TSDeclareMethod", node, opts);
21148}
21149
21150function assertTSQualifiedName(node, opts = {}) {
21151 assert("TSQualifiedName", node, opts);
21152}
21153
21154function assertTSCallSignatureDeclaration(node, opts = {}) {
21155 assert("TSCallSignatureDeclaration", node, opts);
21156}
21157
21158function assertTSConstructSignatureDeclaration(node, opts = {}) {
21159 assert("TSConstructSignatureDeclaration", node, opts);
21160}
21161
21162function assertTSPropertySignature(node, opts = {}) {
21163 assert("TSPropertySignature", node, opts);
21164}
21165
21166function assertTSMethodSignature(node, opts = {}) {
21167 assert("TSMethodSignature", node, opts);
21168}
21169
21170function assertTSIndexSignature(node, opts = {}) {
21171 assert("TSIndexSignature", node, opts);
21172}
21173
21174function assertTSAnyKeyword(node, opts = {}) {
21175 assert("TSAnyKeyword", node, opts);
21176}
21177
21178function assertTSNumberKeyword(node, opts = {}) {
21179 assert("TSNumberKeyword", node, opts);
21180}
21181
21182function assertTSObjectKeyword(node, opts = {}) {
21183 assert("TSObjectKeyword", node, opts);
21184}
21185
21186function assertTSBooleanKeyword(node, opts = {}) {
21187 assert("TSBooleanKeyword", node, opts);
21188}
21189
21190function assertTSStringKeyword(node, opts = {}) {
21191 assert("TSStringKeyword", node, opts);
21192}
21193
21194function assertTSSymbolKeyword(node, opts = {}) {
21195 assert("TSSymbolKeyword", node, opts);
21196}
21197
21198function assertTSVoidKeyword(node, opts = {}) {
21199 assert("TSVoidKeyword", node, opts);
21200}
21201
21202function assertTSUndefinedKeyword(node, opts = {}) {
21203 assert("TSUndefinedKeyword", node, opts);
21204}
21205
21206function assertTSNullKeyword(node, opts = {}) {
21207 assert("TSNullKeyword", node, opts);
21208}
21209
21210function assertTSNeverKeyword(node, opts = {}) {
21211 assert("TSNeverKeyword", node, opts);
21212}
21213
21214function assertTSThisType(node, opts = {}) {
21215 assert("TSThisType", node, opts);
21216}
21217
21218function assertTSFunctionType(node, opts = {}) {
21219 assert("TSFunctionType", node, opts);
21220}
21221
21222function assertTSConstructorType(node, opts = {}) {
21223 assert("TSConstructorType", node, opts);
21224}
21225
21226function assertTSTypeReference(node, opts = {}) {
21227 assert("TSTypeReference", node, opts);
21228}
21229
21230function assertTSTypePredicate(node, opts = {}) {
21231 assert("TSTypePredicate", node, opts);
21232}
21233
21234function assertTSTypeQuery(node, opts = {}) {
21235 assert("TSTypeQuery", node, opts);
21236}
21237
21238function assertTSTypeLiteral(node, opts = {}) {
21239 assert("TSTypeLiteral", node, opts);
21240}
21241
21242function assertTSArrayType(node, opts = {}) {
21243 assert("TSArrayType", node, opts);
21244}
21245
21246function assertTSTupleType(node, opts = {}) {
21247 assert("TSTupleType", node, opts);
21248}
21249
21250function assertTSUnionType(node, opts = {}) {
21251 assert("TSUnionType", node, opts);
21252}
21253
21254function assertTSIntersectionType(node, opts = {}) {
21255 assert("TSIntersectionType", node, opts);
21256}
21257
21258function assertTSConditionalType(node, opts = {}) {
21259 assert("TSConditionalType", node, opts);
21260}
21261
21262function assertTSInferType(node, opts = {}) {
21263 assert("TSInferType", node, opts);
21264}
21265
21266function assertTSParenthesizedType(node, opts = {}) {
21267 assert("TSParenthesizedType", node, opts);
21268}
21269
21270function assertTSTypeOperator(node, opts = {}) {
21271 assert("TSTypeOperator", node, opts);
21272}
21273
21274function assertTSIndexedAccessType(node, opts = {}) {
21275 assert("TSIndexedAccessType", node, opts);
21276}
21277
21278function assertTSMappedType(node, opts = {}) {
21279 assert("TSMappedType", node, opts);
21280}
21281
21282function assertTSLiteralType(node, opts = {}) {
21283 assert("TSLiteralType", node, opts);
21284}
21285
21286function assertTSExpressionWithTypeArguments(node, opts = {}) {
21287 assert("TSExpressionWithTypeArguments", node, opts);
21288}
21289
21290function assertTSInterfaceDeclaration(node, opts = {}) {
21291 assert("TSInterfaceDeclaration", node, opts);
21292}
21293
21294function assertTSInterfaceBody(node, opts = {}) {
21295 assert("TSInterfaceBody", node, opts);
21296}
21297
21298function assertTSTypeAliasDeclaration(node, opts = {}) {
21299 assert("TSTypeAliasDeclaration", node, opts);
21300}
21301
21302function assertTSAsExpression(node, opts = {}) {
21303 assert("TSAsExpression", node, opts);
21304}
21305
21306function assertTSTypeAssertion(node, opts = {}) {
21307 assert("TSTypeAssertion", node, opts);
21308}
21309
21310function assertTSEnumDeclaration(node, opts = {}) {
21311 assert("TSEnumDeclaration", node, opts);
21312}
21313
21314function assertTSEnumMember(node, opts = {}) {
21315 assert("TSEnumMember", node, opts);
21316}
21317
21318function assertTSModuleDeclaration(node, opts = {}) {
21319 assert("TSModuleDeclaration", node, opts);
21320}
21321
21322function assertTSModuleBlock(node, opts = {}) {
21323 assert("TSModuleBlock", node, opts);
21324}
21325
21326function assertTSImportEqualsDeclaration(node, opts = {}) {
21327 assert("TSImportEqualsDeclaration", node, opts);
21328}
21329
21330function assertTSExternalModuleReference(node, opts = {}) {
21331 assert("TSExternalModuleReference", node, opts);
21332}
21333
21334function assertTSNonNullExpression(node, opts = {}) {
21335 assert("TSNonNullExpression", node, opts);
21336}
21337
21338function assertTSExportAssignment(node, opts = {}) {
21339 assert("TSExportAssignment", node, opts);
21340}
21341
21342function assertTSNamespaceExportDeclaration(node, opts = {}) {
21343 assert("TSNamespaceExportDeclaration", node, opts);
21344}
21345
21346function assertTSTypeAnnotation(node, opts = {}) {
21347 assert("TSTypeAnnotation", node, opts);
21348}
21349
21350function assertTSTypeParameterInstantiation(node, opts = {}) {
21351 assert("TSTypeParameterInstantiation", node, opts);
21352}
21353
21354function assertTSTypeParameterDeclaration(node, opts = {}) {
21355 assert("TSTypeParameterDeclaration", node, opts);
21356}
21357
21358function assertTSTypeParameter(node, opts = {}) {
21359 assert("TSTypeParameter", node, opts);
21360}
21361
21362function assertExpression(node, opts = {}) {
21363 assert("Expression", node, opts);
21364}
21365
21366function assertBinary(node, opts = {}) {
21367 assert("Binary", node, opts);
21368}
21369
21370function assertScopable(node, opts = {}) {
21371 assert("Scopable", node, opts);
21372}
21373
21374function assertBlockParent(node, opts = {}) {
21375 assert("BlockParent", node, opts);
21376}
21377
21378function assertBlock(node, opts = {}) {
21379 assert("Block", node, opts);
21380}
21381
21382function assertStatement(node, opts = {}) {
21383 assert("Statement", node, opts);
21384}
21385
21386function assertTerminatorless(node, opts = {}) {
21387 assert("Terminatorless", node, opts);
21388}
21389
21390function assertCompletionStatement(node, opts = {}) {
21391 assert("CompletionStatement", node, opts);
21392}
21393
21394function assertConditional(node, opts = {}) {
21395 assert("Conditional", node, opts);
21396}
21397
21398function assertLoop(node, opts = {}) {
21399 assert("Loop", node, opts);
21400}
21401
21402function assertWhile(node, opts = {}) {
21403 assert("While", node, opts);
21404}
21405
21406function assertExpressionWrapper(node, opts = {}) {
21407 assert("ExpressionWrapper", node, opts);
21408}
21409
21410function assertFor(node, opts = {}) {
21411 assert("For", node, opts);
21412}
21413
21414function assertForXStatement(node, opts = {}) {
21415 assert("ForXStatement", node, opts);
21416}
21417
21418function assertFunction(node, opts = {}) {
21419 assert("Function", node, opts);
21420}
21421
21422function assertFunctionParent(node, opts = {}) {
21423 assert("FunctionParent", node, opts);
21424}
21425
21426function assertPureish(node, opts = {}) {
21427 assert("Pureish", node, opts);
21428}
21429
21430function assertDeclaration(node, opts = {}) {
21431 assert("Declaration", node, opts);
21432}
21433
21434function assertPatternLike(node, opts = {}) {
21435 assert("PatternLike", node, opts);
21436}
21437
21438function assertLVal(node, opts = {}) {
21439 assert("LVal", node, opts);
21440}
21441
21442function assertTSEntityName(node, opts = {}) {
21443 assert("TSEntityName", node, opts);
21444}
21445
21446function assertLiteral(node, opts = {}) {
21447 assert("Literal", node, opts);
21448}
21449
21450function assertImmutable(node, opts = {}) {
21451 assert("Immutable", node, opts);
21452}
21453
21454function assertUserWhitespacable(node, opts = {}) {
21455 assert("UserWhitespacable", node, opts);
21456}
21457
21458function assertMethod(node, opts = {}) {
21459 assert("Method", node, opts);
21460}
21461
21462function assertObjectMember(node, opts = {}) {
21463 assert("ObjectMember", node, opts);
21464}
21465
21466function assertProperty(node, opts = {}) {
21467 assert("Property", node, opts);
21468}
21469
21470function assertUnaryLike(node, opts = {}) {
21471 assert("UnaryLike", node, opts);
21472}
21473
21474function assertPattern(node, opts = {}) {
21475 assert("Pattern", node, opts);
21476}
21477
21478function assertClass(node, opts = {}) {
21479 assert("Class", node, opts);
21480}
21481
21482function assertModuleDeclaration(node, opts = {}) {
21483 assert("ModuleDeclaration", node, opts);
21484}
21485
21486function assertExportDeclaration(node, opts = {}) {
21487 assert("ExportDeclaration", node, opts);
21488}
21489
21490function assertModuleSpecifier(node, opts = {}) {
21491 assert("ModuleSpecifier", node, opts);
21492}
21493
21494function assertFlow(node, opts = {}) {
21495 assert("Flow", node, opts);
21496}
21497
21498function assertFlowType(node, opts = {}) {
21499 assert("FlowType", node, opts);
21500}
21501
21502function assertFlowBaseAnnotation(node, opts = {}) {
21503 assert("FlowBaseAnnotation", node, opts);
21504}
21505
21506function assertFlowDeclaration(node, opts = {}) {
21507 assert("FlowDeclaration", node, opts);
21508}
21509
21510function assertFlowPredicate(node, opts = {}) {
21511 assert("FlowPredicate", node, opts);
21512}
21513
21514function assertJSX(node, opts = {}) {
21515 assert("JSX", node, opts);
21516}
21517
21518function assertPrivate(node, opts = {}) {
21519 assert("Private", node, opts);
21520}
21521
21522function assertTSTypeElement(node, opts = {}) {
21523 assert("TSTypeElement", node, opts);
21524}
21525
21526function assertTSType(node, opts = {}) {
21527 assert("TSType", node, opts);
21528}
21529
21530function assertNumberLiteral(node, opts) {
21531 console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
21532 assert("NumberLiteral", node, opts);
21533}
21534
21535function assertRegexLiteral(node, opts) {
21536 console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
21537 assert("RegexLiteral", node, opts);
21538}
21539
21540function assertRestProperty(node, opts) {
21541 console.trace("The node type RestProperty has been renamed to RestElement");
21542 assert("RestProperty", node, opts);
21543}
21544
21545function assertSpreadProperty(node, opts) {
21546 console.trace("The node type SpreadProperty has been renamed to SpreadElement");
21547 assert("SpreadProperty", node, opts);
21548}
21549
21550/***/ }),
21551/* 138 */
21552/***/ (function(module, exports, __webpack_require__) {
21553
21554"use strict";
21555
21556
21557Object.defineProperty(exports, "__esModule", {
21558 value: true
21559});
21560exports.default = createTypeAnnotationBasedOnTypeof;
21561
21562var _generated = __webpack_require__(15);
21563
21564function createTypeAnnotationBasedOnTypeof(type) {
21565 if (type === "string") {
21566 return (0, _generated.stringTypeAnnotation)();
21567 } else if (type === "number") {
21568 return (0, _generated.numberTypeAnnotation)();
21569 } else if (type === "undefined") {
21570 return (0, _generated.voidTypeAnnotation)();
21571 } else if (type === "boolean") {
21572 return (0, _generated.booleanTypeAnnotation)();
21573 } else if (type === "function") {
21574 return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Function"));
21575 } else if (type === "object") {
21576 return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Object"));
21577 } else if (type === "symbol") {
21578 return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Symbol"));
21579 } else {
21580 throw new Error("Invalid typeof value");
21581 }
21582}
21583
21584/***/ }),
21585/* 139 */
21586/***/ (function(module, exports, __webpack_require__) {
21587
21588"use strict";
21589
21590
21591Object.defineProperty(exports, "__esModule", {
21592 value: true
21593});
21594exports.default = createUnionTypeAnnotation;
21595
21596var _generated = __webpack_require__(15);
21597
21598var _removeTypeDuplicates = _interopRequireDefault(__webpack_require__(59));
21599
21600function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21601
21602function createUnionTypeAnnotation(types) {
21603 const flattened = (0, _removeTypeDuplicates.default)(types);
21604
21605 if (flattened.length === 1) {
21606 return flattened[0];
21607 } else {
21608 return (0, _generated.unionTypeAnnotation)(flattened);
21609 }
21610}
21611
21612/***/ }),
21613/* 140 */
21614/***/ (function(module, exports, __webpack_require__) {
21615
21616"use strict";
21617
21618
21619Object.defineProperty(exports, "__esModule", {
21620 value: true
21621});
21622exports.default = cloneDeep;
21623
21624var _cloneNode = _interopRequireDefault(__webpack_require__(28));
21625
21626function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21627
21628function cloneDeep(node) {
21629 return (0, _cloneNode.default)(node);
21630}
21631
21632/***/ }),
21633/* 141 */
21634/***/ (function(module, exports, __webpack_require__) {
21635
21636"use strict";
21637
21638
21639Object.defineProperty(exports, "__esModule", {
21640 value: true
21641});
21642exports.default = cloneWithoutLoc;
21643
21644var _clone = _interopRequireDefault(__webpack_require__(60));
21645
21646function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21647
21648function cloneWithoutLoc(node) {
21649 const newNode = (0, _clone.default)(node);
21650 newNode.loc = null;
21651 return newNode;
21652}
21653
21654/***/ }),
21655/* 142 */
21656/***/ (function(module, exports, __webpack_require__) {
21657
21658"use strict";
21659
21660
21661Object.defineProperty(exports, "__esModule", {
21662 value: true
21663});
21664exports.default = addComment;
21665
21666var _addComments = _interopRequireDefault(__webpack_require__(61));
21667
21668function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21669
21670function addComment(node, type, content, line) {
21671 return (0, _addComments.default)(node, type, [{
21672 type: line ? "CommentLine" : "CommentBlock",
21673 value: content
21674 }]);
21675}
21676
21677/***/ }),
21678/* 143 */
21679/***/ (function(module, exports) {
21680
21681module.exports = require("lodash/uniq");
21682
21683/***/ }),
21684/* 144 */
21685/***/ (function(module, exports, __webpack_require__) {
21686
21687"use strict";
21688
21689
21690Object.defineProperty(exports, "__esModule", {
21691 value: true
21692});
21693exports.default = removeComments;
21694
21695var _constants = __webpack_require__(21);
21696
21697function removeComments(node) {
21698 _constants.COMMENT_KEYS.forEach(key => {
21699 node[key] = null;
21700 });
21701
21702 return node;
21703}
21704
21705/***/ }),
21706/* 145 */
21707/***/ (function(module, exports, __webpack_require__) {
21708
21709"use strict";
21710
21711
21712Object.defineProperty(exports, "__esModule", {
21713 value: true
21714});
21715exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.PRIVATE_TYPES = exports.JSX_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.FLOWTYPE_TYPES = exports.FLOW_TYPES = exports.MODULESPECIFIER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = exports.CLASS_TYPES = exports.PATTERN_TYPES = exports.UNARYLIKE_TYPES = exports.PROPERTY_TYPES = exports.OBJECTMEMBER_TYPES = exports.METHOD_TYPES = exports.USERWHITESPACABLE_TYPES = exports.IMMUTABLE_TYPES = exports.LITERAL_TYPES = exports.TSENTITYNAME_TYPES = exports.LVAL_TYPES = exports.PATTERNLIKE_TYPES = exports.DECLARATION_TYPES = exports.PUREISH_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FUNCTION_TYPES = exports.FORXSTATEMENT_TYPES = exports.FOR_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.WHILE_TYPES = exports.LOOP_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.SCOPABLE_TYPES = exports.BINARY_TYPES = exports.EXPRESSION_TYPES = void 0;
21716
21717var _definitions = __webpack_require__(16);
21718
21719const EXPRESSION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Expression"];
21720exports.EXPRESSION_TYPES = EXPRESSION_TYPES;
21721const BINARY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Binary"];
21722exports.BINARY_TYPES = BINARY_TYPES;
21723const SCOPABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Scopable"];
21724exports.SCOPABLE_TYPES = SCOPABLE_TYPES;
21725const BLOCKPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["BlockParent"];
21726exports.BLOCKPARENT_TYPES = BLOCKPARENT_TYPES;
21727const BLOCK_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Block"];
21728exports.BLOCK_TYPES = BLOCK_TYPES;
21729const STATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Statement"];
21730exports.STATEMENT_TYPES = STATEMENT_TYPES;
21731const TERMINATORLESS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Terminatorless"];
21732exports.TERMINATORLESS_TYPES = TERMINATORLESS_TYPES;
21733const COMPLETIONSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["CompletionStatement"];
21734exports.COMPLETIONSTATEMENT_TYPES = COMPLETIONSTATEMENT_TYPES;
21735const CONDITIONAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Conditional"];
21736exports.CONDITIONAL_TYPES = CONDITIONAL_TYPES;
21737const LOOP_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Loop"];
21738exports.LOOP_TYPES = LOOP_TYPES;
21739const WHILE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["While"];
21740exports.WHILE_TYPES = WHILE_TYPES;
21741const EXPRESSIONWRAPPER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExpressionWrapper"];
21742exports.EXPRESSIONWRAPPER_TYPES = EXPRESSIONWRAPPER_TYPES;
21743const FOR_TYPES = _definitions.FLIPPED_ALIAS_KEYS["For"];
21744exports.FOR_TYPES = FOR_TYPES;
21745const FORXSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ForXStatement"];
21746exports.FORXSTATEMENT_TYPES = FORXSTATEMENT_TYPES;
21747const FUNCTION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Function"];
21748exports.FUNCTION_TYPES = FUNCTION_TYPES;
21749const FUNCTIONPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FunctionParent"];
21750exports.FUNCTIONPARENT_TYPES = FUNCTIONPARENT_TYPES;
21751const PUREISH_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pureish"];
21752exports.PUREISH_TYPES = PUREISH_TYPES;
21753const DECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Declaration"];
21754exports.DECLARATION_TYPES = DECLARATION_TYPES;
21755const PATTERNLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["PatternLike"];
21756exports.PATTERNLIKE_TYPES = PATTERNLIKE_TYPES;
21757const LVAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["LVal"];
21758exports.LVAL_TYPES = LVAL_TYPES;
21759const TSENTITYNAME_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSEntityName"];
21760exports.TSENTITYNAME_TYPES = TSENTITYNAME_TYPES;
21761const LITERAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Literal"];
21762exports.LITERAL_TYPES = LITERAL_TYPES;
21763const IMMUTABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Immutable"];
21764exports.IMMUTABLE_TYPES = IMMUTABLE_TYPES;
21765const USERWHITESPACABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UserWhitespacable"];
21766exports.USERWHITESPACABLE_TYPES = USERWHITESPACABLE_TYPES;
21767const METHOD_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Method"];
21768exports.METHOD_TYPES = METHOD_TYPES;
21769const OBJECTMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ObjectMember"];
21770exports.OBJECTMEMBER_TYPES = OBJECTMEMBER_TYPES;
21771const PROPERTY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Property"];
21772exports.PROPERTY_TYPES = PROPERTY_TYPES;
21773const UNARYLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UnaryLike"];
21774exports.UNARYLIKE_TYPES = UNARYLIKE_TYPES;
21775const PATTERN_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pattern"];
21776exports.PATTERN_TYPES = PATTERN_TYPES;
21777const CLASS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Class"];
21778exports.CLASS_TYPES = CLASS_TYPES;
21779const MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"];
21780exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES;
21781const EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"];
21782exports.EXPORTDECLARATION_TYPES = EXPORTDECLARATION_TYPES;
21783const MODULESPECIFIER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleSpecifier"];
21784exports.MODULESPECIFIER_TYPES = MODULESPECIFIER_TYPES;
21785const FLOW_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Flow"];
21786exports.FLOW_TYPES = FLOW_TYPES;
21787const FLOWTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowType"];
21788exports.FLOWTYPE_TYPES = FLOWTYPE_TYPES;
21789const FLOWBASEANNOTATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"];
21790exports.FLOWBASEANNOTATION_TYPES = FLOWBASEANNOTATION_TYPES;
21791const FLOWDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowDeclaration"];
21792exports.FLOWDECLARATION_TYPES = FLOWDECLARATION_TYPES;
21793const FLOWPREDICATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowPredicate"];
21794exports.FLOWPREDICATE_TYPES = FLOWPREDICATE_TYPES;
21795const JSX_TYPES = _definitions.FLIPPED_ALIAS_KEYS["JSX"];
21796exports.JSX_TYPES = JSX_TYPES;
21797const PRIVATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Private"];
21798exports.PRIVATE_TYPES = PRIVATE_TYPES;
21799const TSTYPEELEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSTypeElement"];
21800exports.TSTYPEELEMENT_TYPES = TSTYPEELEMENT_TYPES;
21801const TSTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSType"];
21802exports.TSTYPE_TYPES = TSTYPE_TYPES;
21803
21804/***/ }),
21805/* 146 */
21806/***/ (function(module, exports, __webpack_require__) {
21807
21808"use strict";
21809
21810
21811Object.defineProperty(exports, "__esModule", {
21812 value: true
21813});
21814exports.default = ensureBlock;
21815
21816var _toBlock = _interopRequireDefault(__webpack_require__(66));
21817
21818function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21819
21820function ensureBlock(node, key = "body") {
21821 return node[key] = (0, _toBlock.default)(node[key], node);
21822}
21823
21824/***/ }),
21825/* 147 */
21826/***/ (function(module, exports, __webpack_require__) {
21827
21828"use strict";
21829
21830
21831Object.defineProperty(exports, "__esModule", {
21832 value: true
21833});
21834exports.default = toBindingIdentifierName;
21835
21836var _toIdentifier = _interopRequireDefault(__webpack_require__(67));
21837
21838function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21839
21840function toBindingIdentifierName(name) {
21841 name = (0, _toIdentifier.default)(name);
21842 if (name === "eval" || name === "arguments") name = "_" + name;
21843 return name;
21844}
21845
21846/***/ }),
21847/* 148 */
21848/***/ (function(module, exports, __webpack_require__) {
21849
21850"use strict";
21851
21852
21853Object.defineProperty(exports, "__esModule", {
21854 value: true
21855});
21856exports.default = toComputedKey;
21857
21858var _generated = __webpack_require__(12);
21859
21860var _generated2 = __webpack_require__(15);
21861
21862function toComputedKey(node, key = node.key || node.property) {
21863 if (!node.computed && (0, _generated.isIdentifier)(key)) key = (0, _generated2.stringLiteral)(key.name);
21864 return key;
21865}
21866
21867/***/ }),
21868/* 149 */
21869/***/ (function(module, exports, __webpack_require__) {
21870
21871"use strict";
21872
21873
21874Object.defineProperty(exports, "__esModule", {
21875 value: true
21876});
21877exports.default = toExpression;
21878
21879var _generated = __webpack_require__(12);
21880
21881function toExpression(node) {
21882 if ((0, _generated.isExpressionStatement)(node)) {
21883 node = node.expression;
21884 }
21885
21886 if ((0, _generated.isExpression)(node)) {
21887 return node;
21888 }
21889
21890 if ((0, _generated.isClass)(node)) {
21891 node.type = "ClassExpression";
21892 } else if ((0, _generated.isFunction)(node)) {
21893 node.type = "FunctionExpression";
21894 }
21895
21896 if (!(0, _generated.isExpression)(node)) {
21897 throw new Error(`cannot turn ${node.type} to an expression`);
21898 }
21899
21900 return node;
21901}
21902
21903/***/ }),
21904/* 150 */
21905/***/ (function(module, exports, __webpack_require__) {
21906
21907"use strict";
21908
21909
21910Object.defineProperty(exports, "__esModule", {
21911 value: true
21912});
21913exports.default = toKeyAlias;
21914
21915var _generated = __webpack_require__(12);
21916
21917var _cloneNode = _interopRequireDefault(__webpack_require__(28));
21918
21919var _removePropertiesDeep = _interopRequireDefault(__webpack_require__(68));
21920
21921function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21922
21923function toKeyAlias(node, key = node.key) {
21924 let alias;
21925
21926 if (node.kind === "method") {
21927 return toKeyAlias.increment() + "";
21928 } else if ((0, _generated.isIdentifier)(key)) {
21929 alias = key.name;
21930 } else if ((0, _generated.isStringLiteral)(key)) {
21931 alias = JSON.stringify(key.value);
21932 } else {
21933 alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneNode.default)(key)));
21934 }
21935
21936 if (node.computed) {
21937 alias = `[${alias}]`;
21938 }
21939
21940 if (node.static) {
21941 alias = `static:${alias}`;
21942 }
21943
21944 return alias;
21945}
21946
21947toKeyAlias.uid = 0;
21948
21949toKeyAlias.increment = function () {
21950 if (toKeyAlias.uid >= Number.MAX_SAFE_INTEGER) {
21951 return toKeyAlias.uid = 0;
21952 } else {
21953 return toKeyAlias.uid++;
21954 }
21955};
21956
21957/***/ }),
21958/* 151 */
21959/***/ (function(module, exports, __webpack_require__) {
21960
21961"use strict";
21962
21963
21964Object.defineProperty(exports, "__esModule", {
21965 value: true
21966});
21967exports.default = toSequenceExpression;
21968
21969var _gatherSequenceExpressions = _interopRequireDefault(__webpack_require__(152));
21970
21971function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21972
21973function toSequenceExpression(nodes, scope) {
21974 if (!nodes || !nodes.length) return;
21975 const declars = [];
21976 const result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars);
21977 if (!result) return;
21978
21979 for (const declar of declars) {
21980 scope.push(declar);
21981 }
21982
21983 return result;
21984}
21985
21986/***/ }),
21987/* 152 */
21988/***/ (function(module, exports, __webpack_require__) {
21989
21990"use strict";
21991
21992
21993Object.defineProperty(exports, "__esModule", {
21994 value: true
21995});
21996exports.default = gatherSequenceExpressions;
21997
21998var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(32));
21999
22000var _generated = __webpack_require__(12);
22001
22002var _generated2 = __webpack_require__(15);
22003
22004var _cloneNode = _interopRequireDefault(__webpack_require__(28));
22005
22006function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22007
22008function gatherSequenceExpressions(nodes, scope, declars) {
22009 const exprs = [];
22010 let ensureLastUndefined = true;
22011
22012 for (const node of nodes) {
22013 ensureLastUndefined = false;
22014
22015 if ((0, _generated.isExpression)(node)) {
22016 exprs.push(node);
22017 } else if ((0, _generated.isExpressionStatement)(node)) {
22018 exprs.push(node.expression);
22019 } else if ((0, _generated.isVariableDeclaration)(node)) {
22020 if (node.kind !== "var") return;
22021
22022 for (const declar of node.declarations) {
22023 const bindings = (0, _getBindingIdentifiers.default)(declar);
22024
22025 for (const key in bindings) {
22026 declars.push({
22027 kind: node.kind,
22028 id: (0, _cloneNode.default)(bindings[key])
22029 });
22030 }
22031
22032 if (declar.init) {
22033 exprs.push((0, _generated2.assignmentExpression)("=", declar.id, declar.init));
22034 }
22035 }
22036
22037 ensureLastUndefined = true;
22038 } else if ((0, _generated.isIfStatement)(node)) {
22039 const consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode();
22040 const alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode();
22041 if (!consequent || !alternate) return;
22042 exprs.push((0, _generated2.conditionalExpression)(node.test, consequent, alternate));
22043 } else if ((0, _generated.isBlockStatement)(node)) {
22044 const body = gatherSequenceExpressions(node.body, scope, declars);
22045 if (!body) return;
22046 exprs.push(body);
22047 } else if ((0, _generated.isEmptyStatement)(node)) {
22048 ensureLastUndefined = true;
22049 } else {
22050 return;
22051 }
22052 }
22053
22054 if (ensureLastUndefined) {
22055 exprs.push(scope.buildUndefinedNode());
22056 }
22057
22058 if (exprs.length === 1) {
22059 return exprs[0];
22060 } else {
22061 return (0, _generated2.sequenceExpression)(exprs);
22062 }
22063}
22064
22065/***/ }),
22066/* 153 */
22067/***/ (function(module, exports, __webpack_require__) {
22068
22069"use strict";
22070
22071
22072Object.defineProperty(exports, "__esModule", {
22073 value: true
22074});
22075exports.default = toStatement;
22076
22077var _generated = __webpack_require__(12);
22078
22079var _generated2 = __webpack_require__(15);
22080
22081function toStatement(node, ignore) {
22082 if ((0, _generated.isStatement)(node)) {
22083 return node;
22084 }
22085
22086 let mustHaveId = false;
22087 let newType;
22088
22089 if ((0, _generated.isClass)(node)) {
22090 mustHaveId = true;
22091 newType = "ClassDeclaration";
22092 } else if ((0, _generated.isFunction)(node)) {
22093 mustHaveId = true;
22094 newType = "FunctionDeclaration";
22095 } else if ((0, _generated.isAssignmentExpression)(node)) {
22096 return (0, _generated2.expressionStatement)(node);
22097 }
22098
22099 if (mustHaveId && !node.id) {
22100 newType = false;
22101 }
22102
22103 if (!newType) {
22104 if (ignore) {
22105 return false;
22106 } else {
22107 throw new Error(`cannot turn ${node.type} to a statement`);
22108 }
22109 }
22110
22111 node.type = newType;
22112 return node;
22113}
22114
22115/***/ }),
22116/* 154 */
22117/***/ (function(module, exports, __webpack_require__) {
22118
22119"use strict";
22120
22121
22122Object.defineProperty(exports, "__esModule", {
22123 value: true
22124});
22125exports.default = valueToNode;
22126
22127function _isPlainObject() {
22128 const data = _interopRequireDefault(__webpack_require__(155));
22129
22130 _isPlainObject = function () {
22131 return data;
22132 };
22133
22134 return data;
22135}
22136
22137function _isRegExp() {
22138 const data = _interopRequireDefault(__webpack_require__(156));
22139
22140 _isRegExp = function () {
22141 return data;
22142 };
22143
22144 return data;
22145}
22146
22147var _isValidIdentifier = _interopRequireDefault(__webpack_require__(27));
22148
22149var _generated = __webpack_require__(15);
22150
22151function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22152
22153function valueToNode(value) {
22154 if (value === undefined) {
22155 return (0, _generated.identifier)("undefined");
22156 }
22157
22158 if (value === true || value === false) {
22159 return (0, _generated.booleanLiteral)(value);
22160 }
22161
22162 if (value === null) {
22163 return (0, _generated.nullLiteral)();
22164 }
22165
22166 if (typeof value === "string") {
22167 return (0, _generated.stringLiteral)(value);
22168 }
22169
22170 if (typeof value === "number") {
22171 let result;
22172
22173 if (Number.isFinite(value)) {
22174 result = (0, _generated.numericLiteral)(Math.abs(value));
22175 } else {
22176 let numerator;
22177
22178 if (Number.isNaN(value)) {
22179 numerator = (0, _generated.numericLiteral)(0);
22180 } else {
22181 numerator = (0, _generated.numericLiteral)(1);
22182 }
22183
22184 result = (0, _generated.binaryExpression)("/", numerator, (0, _generated.numericLiteral)(0));
22185 }
22186
22187 if (value < 0 || Object.is(value, -0)) {
22188 result = (0, _generated.unaryExpression)("-", result);
22189 }
22190
22191 return result;
22192 }
22193
22194 if ((0, _isRegExp().default)(value)) {
22195 const pattern = value.source;
22196 const flags = value.toString().match(/\/([a-z]+|)$/)[1];
22197 return (0, _generated.regExpLiteral)(pattern, flags);
22198 }
22199
22200 if (Array.isArray(value)) {
22201 return (0, _generated.arrayExpression)(value.map(valueToNode));
22202 }
22203
22204 if ((0, _isPlainObject().default)(value)) {
22205 const props = [];
22206
22207 for (const key in value) {
22208 let nodeKey;
22209
22210 if ((0, _isValidIdentifier.default)(key)) {
22211 nodeKey = (0, _generated.identifier)(key);
22212 } else {
22213 nodeKey = (0, _generated.stringLiteral)(key);
22214 }
22215
22216 props.push((0, _generated.objectProperty)(nodeKey, valueToNode(value[key])));
22217 }
22218
22219 return (0, _generated.objectExpression)(props);
22220 }
22221
22222 throw new Error("don't know how to turn this value into a node");
22223}
22224
22225/***/ }),
22226/* 155 */
22227/***/ (function(module, exports) {
22228
22229module.exports = require("lodash/isPlainObject");
22230
22231/***/ }),
22232/* 156 */
22233/***/ (function(module, exports) {
22234
22235module.exports = require("lodash/isRegExp");
22236
22237/***/ }),
22238/* 157 */
22239/***/ (function(module, exports, __webpack_require__) {
22240
22241"use strict";
22242
22243
22244Object.defineProperty(exports, "__esModule", {
22245 value: true
22246});
22247exports.default = appendToMemberExpression;
22248
22249var _generated = __webpack_require__(15);
22250
22251function appendToMemberExpression(member, append, computed = false) {
22252 member.object = (0, _generated.memberExpression)(member.object, member.property, member.computed);
22253 member.property = append;
22254 member.computed = !!computed;
22255 return member;
22256}
22257
22258/***/ }),
22259/* 158 */
22260/***/ (function(module, exports, __webpack_require__) {
22261
22262"use strict";
22263
22264
22265Object.defineProperty(exports, "__esModule", {
22266 value: true
22267});
22268exports.default = inherits;
22269
22270var _constants = __webpack_require__(21);
22271
22272var _inheritsComments = _interopRequireDefault(__webpack_require__(64));
22273
22274function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22275
22276function inherits(child, parent) {
22277 if (!child || !parent) return child;
22278
22279 for (const key of _constants.INHERIT_KEYS.optional) {
22280 if (child[key] == null) {
22281 child[key] = parent[key];
22282 }
22283 }
22284
22285 for (const key in parent) {
22286 if (key[0] === "_" && key !== "__clone") child[key] = parent[key];
22287 }
22288
22289 for (const key of _constants.INHERIT_KEYS.force) {
22290 child[key] = parent[key];
22291 }
22292
22293 (0, _inheritsComments.default)(child, parent);
22294 return child;
22295}
22296
22297/***/ }),
22298/* 159 */
22299/***/ (function(module, exports, __webpack_require__) {
22300
22301"use strict";
22302
22303
22304Object.defineProperty(exports, "__esModule", {
22305 value: true
22306});
22307exports.default = prependToMemberExpression;
22308
22309var _generated = __webpack_require__(15);
22310
22311function prependToMemberExpression(member, prepend) {
22312 member.object = (0, _generated.memberExpression)(prepend, member.object);
22313 return member;
22314}
22315
22316/***/ }),
22317/* 160 */
22318/***/ (function(module, exports, __webpack_require__) {
22319
22320"use strict";
22321
22322
22323Object.defineProperty(exports, "__esModule", {
22324 value: true
22325});
22326exports.default = getOuterBindingIdentifiers;
22327
22328var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(32));
22329
22330function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22331
22332function getOuterBindingIdentifiers(node, duplicates) {
22333 return (0, _getBindingIdentifiers.default)(node, duplicates, true);
22334}
22335
22336/***/ }),
22337/* 161 */
22338/***/ (function(module, exports, __webpack_require__) {
22339
22340"use strict";
22341
22342
22343Object.defineProperty(exports, "__esModule", {
22344 value: true
22345});
22346exports.default = traverse;
22347
22348var _definitions = __webpack_require__(16);
22349
22350function traverse(node, handlers, state) {
22351 if (typeof handlers === "function") {
22352 handlers = {
22353 enter: handlers
22354 };
22355 }
22356
22357 const {
22358 enter,
22359 exit
22360 } = handlers;
22361 traverseSimpleImpl(node, enter, exit, state, []);
22362}
22363
22364function traverseSimpleImpl(node, enter, exit, state, ancestors) {
22365 const keys = _definitions.VISITOR_KEYS[node.type];
22366 if (!keys) return;
22367 if (enter) enter(node, ancestors, state);
22368
22369 for (const key of keys) {
22370 const subNode = node[key];
22371
22372 if (Array.isArray(subNode)) {
22373 for (let i = 0; i < subNode.length; i++) {
22374 const child = subNode[i];
22375 if (!child) continue;
22376 ancestors.push({
22377 node,
22378 key,
22379 index: i
22380 });
22381 traverseSimpleImpl(child, enter, exit, state, ancestors);
22382 ancestors.pop();
22383 }
22384 } else if (subNode) {
22385 ancestors.push({
22386 node,
22387 key
22388 });
22389 traverseSimpleImpl(subNode, enter, exit, state, ancestors);
22390 ancestors.pop();
22391 }
22392 }
22393
22394 if (exit) exit(node, ancestors, state);
22395}
22396
22397/***/ }),
22398/* 162 */
22399/***/ (function(module, exports, __webpack_require__) {
22400
22401"use strict";
22402
22403
22404Object.defineProperty(exports, "__esModule", {
22405 value: true
22406});
22407exports.default = isBinding;
22408
22409var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(32));
22410
22411function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22412
22413function isBinding(node, parent) {
22414 const keys = _getBindingIdentifiers.default.keys[parent.type];
22415
22416 if (keys) {
22417 for (let i = 0; i < keys.length; i++) {
22418 const key = keys[i];
22419 const val = parent[key];
22420
22421 if (Array.isArray(val)) {
22422 if (val.indexOf(node) >= 0) return true;
22423 } else {
22424 if (val === node) return true;
22425 }
22426 }
22427 }
22428
22429 return false;
22430}
22431
22432/***/ }),
22433/* 163 */
22434/***/ (function(module, exports, __webpack_require__) {
22435
22436"use strict";
22437
22438
22439Object.defineProperty(exports, "__esModule", {
22440 value: true
22441});
22442exports.default = isBlockScoped;
22443
22444var _generated = __webpack_require__(12);
22445
22446var _isLet = _interopRequireDefault(__webpack_require__(71));
22447
22448function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22449
22450function isBlockScoped(node) {
22451 return (0, _generated.isFunctionDeclaration)(node) || (0, _generated.isClassDeclaration)(node) || (0, _isLet.default)(node);
22452}
22453
22454/***/ }),
22455/* 164 */
22456/***/ (function(module, exports, __webpack_require__) {
22457
22458"use strict";
22459
22460
22461Object.defineProperty(exports, "__esModule", {
22462 value: true
22463});
22464exports.default = isImmutable;
22465
22466var _isType = _interopRequireDefault(__webpack_require__(42));
22467
22468var _generated = __webpack_require__(12);
22469
22470function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22471
22472function isImmutable(node) {
22473 if ((0, _isType.default)(node.type, "Immutable")) return true;
22474
22475 if ((0, _generated.isIdentifier)(node)) {
22476 if (node.name === "undefined") {
22477 return true;
22478 } else {
22479 return false;
22480 }
22481 }
22482
22483 return false;
22484}
22485
22486/***/ }),
22487/* 165 */
22488/***/ (function(module, exports, __webpack_require__) {
22489
22490"use strict";
22491
22492
22493Object.defineProperty(exports, "__esModule", {
22494 value: true
22495});
22496exports.default = isNodesEquivalent;
22497
22498var _definitions = __webpack_require__(16);
22499
22500function isNodesEquivalent(a, b) {
22501 if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) {
22502 return a === b;
22503 }
22504
22505 if (a.type !== b.type) {
22506 return false;
22507 }
22508
22509 const fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type);
22510 const visitorKeys = _definitions.VISITOR_KEYS[a.type];
22511
22512 for (const field of fields) {
22513 if (typeof a[field] !== typeof b[field]) {
22514 return false;
22515 }
22516
22517 if (Array.isArray(a[field])) {
22518 if (!Array.isArray(b[field])) {
22519 return false;
22520 }
22521
22522 if (a[field].length !== b[field].length) {
22523 return false;
22524 }
22525
22526 for (let i = 0; i < a[field].length; i++) {
22527 if (!isNodesEquivalent(a[field][i], b[field][i])) {
22528 return false;
22529 }
22530 }
22531
22532 continue;
22533 }
22534
22535 if (typeof a[field] === "object" && (!visitorKeys || !visitorKeys.includes(field))) {
22536 for (const key in a[field]) {
22537 if (a[field][key] !== b[field][key]) {
22538 return false;
22539 }
22540 }
22541
22542 continue;
22543 }
22544
22545 if (!isNodesEquivalent(a[field], b[field])) {
22546 return false;
22547 }
22548 }
22549
22550 return true;
22551}
22552
22553/***/ }),
22554/* 166 */
22555/***/ (function(module, exports, __webpack_require__) {
22556
22557"use strict";
22558
22559
22560Object.defineProperty(exports, "__esModule", {
22561 value: true
22562});
22563exports.default = isReferenced;
22564
22565function isReferenced(node, parent) {
22566 switch (parent.type) {
22567 case "MemberExpression":
22568 case "JSXMemberExpression":
22569 case "OptionalMemberExpression":
22570 if (parent.property === node) {
22571 return !!parent.computed;
22572 }
22573
22574 return parent.object === node;
22575
22576 case "VariableDeclarator":
22577 return parent.init === node;
22578
22579 case "ArrowFunctionExpression":
22580 return parent.body === node;
22581
22582 case "ExportSpecifier":
22583 if (parent.source) {
22584 return false;
22585 }
22586
22587 return parent.local === node;
22588
22589 case "ObjectProperty":
22590 case "ClassProperty":
22591 case "ClassPrivateProperty":
22592 case "ClassMethod":
22593 case "ObjectMethod":
22594 if (parent.key === node) {
22595 return !!parent.computed;
22596 }
22597
22598 return parent.value === node;
22599
22600 case "ClassDeclaration":
22601 case "ClassExpression":
22602 return parent.superClass === node;
22603
22604 case "AssignmentExpression":
22605 return parent.right === node;
22606
22607 case "AssignmentPattern":
22608 return parent.right === node;
22609
22610 case "LabeledStatement":
22611 return false;
22612
22613 case "CatchClause":
22614 return false;
22615
22616 case "RestElement":
22617 return false;
22618
22619 case "BreakStatement":
22620 case "ContinueStatement":
22621 return false;
22622
22623 case "FunctionDeclaration":
22624 case "FunctionExpression":
22625 return false;
22626
22627 case "ExportNamespaceSpecifier":
22628 case "ExportDefaultSpecifier":
22629 return false;
22630
22631 case "ImportDefaultSpecifier":
22632 case "ImportNamespaceSpecifier":
22633 case "ImportSpecifier":
22634 return false;
22635
22636 case "JSXAttribute":
22637 return false;
22638
22639 case "ObjectPattern":
22640 case "ArrayPattern":
22641 return false;
22642
22643 case "MetaProperty":
22644 return false;
22645
22646 case "ObjectTypeProperty":
22647 return parent.key !== node;
22648 }
22649
22650 return true;
22651}
22652
22653/***/ }),
22654/* 167 */
22655/***/ (function(module, exports, __webpack_require__) {
22656
22657"use strict";
22658
22659
22660Object.defineProperty(exports, "__esModule", {
22661 value: true
22662});
22663exports.default = isScope;
22664
22665var _generated = __webpack_require__(12);
22666
22667function isScope(node, parent) {
22668 if ((0, _generated.isBlockStatement)(node) && (0, _generated.isFunction)(parent, {
22669 body: node
22670 })) {
22671 return false;
22672 }
22673
22674 if ((0, _generated.isBlockStatement)(node) && (0, _generated.isCatchClause)(parent, {
22675 body: node
22676 })) {
22677 return false;
22678 }
22679
22680 return (0, _generated.isScopable)(node);
22681}
22682
22683/***/ }),
22684/* 168 */
22685/***/ (function(module, exports, __webpack_require__) {
22686
22687"use strict";
22688
22689
22690Object.defineProperty(exports, "__esModule", {
22691 value: true
22692});
22693exports.default = isSpecifierDefault;
22694
22695var _generated = __webpack_require__(12);
22696
22697function isSpecifierDefault(specifier) {
22698 return (0, _generated.isImportDefaultSpecifier)(specifier) || (0, _generated.isIdentifier)(specifier.imported || specifier.exported, {
22699 name: "default"
22700 });
22701}
22702
22703/***/ }),
22704/* 169 */
22705/***/ (function(module, exports, __webpack_require__) {
22706
22707"use strict";
22708
22709
22710Object.defineProperty(exports, "__esModule", {
22711 value: true
22712});
22713exports.default = isValidES3Identifier;
22714
22715var _isValidIdentifier = _interopRequireDefault(__webpack_require__(27));
22716
22717function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22718
22719const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]);
22720
22721function isValidES3Identifier(name) {
22722 return (0, _isValidIdentifier.default)(name) && !RESERVED_WORDS_ES3_ONLY.has(name);
22723}
22724
22725/***/ }),
22726/* 170 */
22727/***/ (function(module, exports, __webpack_require__) {
22728
22729"use strict";
22730
22731
22732Object.defineProperty(exports, "__esModule", {
22733 value: true
22734});
22735exports.default = isVar;
22736
22737var _generated = __webpack_require__(12);
22738
22739var _constants = __webpack_require__(21);
22740
22741function isVar(node) {
22742 return (0, _generated.isVariableDeclaration)(node, {
22743 kind: "var"
22744 }) && !node[_constants.BLOCK_SCOPED_SYMBOL];
22745}
22746
22747/***/ }),
22748/* 171 */
22749/***/ (function(module, exports, __webpack_require__) {
22750
22751"use strict";
22752
22753
22754Object.defineProperty(exports, "__esModule", {
22755 value: true
22756});
22757exports.FunctionTypeAnnotation = exports.NullableTypeAnnotation = NullableTypeAnnotation;
22758exports.UpdateExpression = UpdateExpression;
22759exports.ObjectExpression = ObjectExpression;
22760exports.DoExpression = DoExpression;
22761exports.Binary = Binary;
22762exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
22763exports.TSAsExpression = TSAsExpression;
22764exports.TSTypeAssertion = TSTypeAssertion;
22765exports.BinaryExpression = BinaryExpression;
22766exports.SequenceExpression = SequenceExpression;
22767exports.AwaitExpression = exports.YieldExpression = YieldExpression;
22768exports.ClassExpression = ClassExpression;
22769exports.UnaryLike = UnaryLike;
22770exports.FunctionExpression = FunctionExpression;
22771exports.ArrowFunctionExpression = ArrowFunctionExpression;
22772exports.ConditionalExpression = ConditionalExpression;
22773exports.AssignmentExpression = AssignmentExpression;
22774exports.NewExpression = NewExpression;
22775
22776function t() {
22777 const data = _interopRequireWildcard(__webpack_require__(2));
22778
22779 t = function () {
22780 return data;
22781 };
22782
22783 return data;
22784}
22785
22786function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
22787
22788const PRECEDENCE = {
22789 "||": 0,
22790 "&&": 1,
22791 "|": 2,
22792 "^": 3,
22793 "&": 4,
22794 "==": 5,
22795 "===": 5,
22796 "!=": 5,
22797 "!==": 5,
22798 "<": 6,
22799 ">": 6,
22800 "<=": 6,
22801 ">=": 6,
22802 in: 6,
22803 instanceof: 6,
22804 ">>": 7,
22805 "<<": 7,
22806 ">>>": 7,
22807 "+": 8,
22808 "-": 8,
22809 "*": 9,
22810 "/": 9,
22811 "%": 9,
22812 "**": 10
22813};
22814
22815const isClassExtendsClause = (node, parent) => (t().isClassDeclaration(parent) || t().isClassExpression(parent)) && parent.superClass === node;
22816
22817function NullableTypeAnnotation(node, parent) {
22818 return t().isArrayTypeAnnotation(parent);
22819}
22820
22821function UpdateExpression(node, parent) {
22822 return t().isMemberExpression(parent, {
22823 object: node
22824 }) || t().isCallExpression(parent, {
22825 callee: node
22826 }) || t().isNewExpression(parent, {
22827 callee: node
22828 }) || isClassExtendsClause(node, parent);
22829}
22830
22831function ObjectExpression(node, parent, printStack) {
22832 return isFirstInStatement(printStack, {
22833 considerArrow: true
22834 });
22835}
22836
22837function DoExpression(node, parent, printStack) {
22838 return isFirstInStatement(printStack);
22839}
22840
22841function Binary(node, parent) {
22842 if (node.operator === "**" && t().isBinaryExpression(parent, {
22843 operator: "**"
22844 })) {
22845 return parent.left === node;
22846 }
22847
22848 if (isClassExtendsClause(node, parent)) {
22849 return true;
22850 }
22851
22852 if ((t().isCallExpression(parent) || t().isNewExpression(parent)) && parent.callee === node || t().isUnaryLike(parent) || t().isMemberExpression(parent) && parent.object === node || t().isAwaitExpression(parent)) {
22853 return true;
22854 }
22855
22856 if (t().isBinary(parent)) {
22857 const parentOp = parent.operator;
22858 const parentPos = PRECEDENCE[parentOp];
22859 const nodeOp = node.operator;
22860 const nodePos = PRECEDENCE[nodeOp];
22861
22862 if (parentPos === nodePos && parent.right === node && !t().isLogicalExpression(parent) || parentPos > nodePos) {
22863 return true;
22864 }
22865 }
22866
22867 return false;
22868}
22869
22870function UnionTypeAnnotation(node, parent) {
22871 return t().isArrayTypeAnnotation(parent) || t().isNullableTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isUnionTypeAnnotation(parent);
22872}
22873
22874function TSAsExpression() {
22875 return true;
22876}
22877
22878function TSTypeAssertion() {
22879 return true;
22880}
22881
22882function BinaryExpression(node, parent) {
22883 return node.operator === "in" && (t().isVariableDeclarator(parent) || t().isFor(parent));
22884}
22885
22886function SequenceExpression(node, parent) {
22887 if (t().isForStatement(parent) || t().isThrowStatement(parent) || t().isReturnStatement(parent) || t().isIfStatement(parent) && parent.test === node || t().isWhileStatement(parent) && parent.test === node || t().isForInStatement(parent) && parent.right === node || t().isSwitchStatement(parent) && parent.discriminant === node || t().isExpressionStatement(parent) && parent.expression === node) {
22888 return false;
22889 }
22890
22891 return true;
22892}
22893
22894function YieldExpression(node, parent) {
22895 return t().isBinary(parent) || t().isUnaryLike(parent) || t().isCallExpression(parent) || t().isMemberExpression(parent) || t().isNewExpression(parent) || t().isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
22896}
22897
22898function ClassExpression(node, parent, printStack) {
22899 return isFirstInStatement(printStack, {
22900 considerDefaultExports: true
22901 });
22902}
22903
22904function UnaryLike(node, parent) {
22905 return t().isMemberExpression(parent, {
22906 object: node
22907 }) || t().isCallExpression(parent, {
22908 callee: node
22909 }) || t().isNewExpression(parent, {
22910 callee: node
22911 }) || t().isBinaryExpression(parent, {
22912 operator: "**",
22913 left: node
22914 }) || isClassExtendsClause(node, parent);
22915}
22916
22917function FunctionExpression(node, parent, printStack) {
22918 return isFirstInStatement(printStack, {
22919 considerDefaultExports: true
22920 });
22921}
22922
22923function ArrowFunctionExpression(node, parent) {
22924 return t().isExportDeclaration(parent) || ConditionalExpression(node, parent);
22925}
22926
22927function ConditionalExpression(node, parent) {
22928 if (t().isUnaryLike(parent) || t().isBinary(parent) || t().isConditionalExpression(parent, {
22929 test: node
22930 }) || t().isAwaitExpression(parent) || t().isTaggedTemplateExpression(parent) || t().isTSTypeAssertion(parent) || t().isTSAsExpression(parent)) {
22931 return true;
22932 }
22933
22934 return UnaryLike(node, parent);
22935}
22936
22937function AssignmentExpression(node) {
22938 if (t().isObjectPattern(node.left)) {
22939 return true;
22940 } else {
22941 return ConditionalExpression(...arguments);
22942 }
22943}
22944
22945function NewExpression(node, parent) {
22946 return isClassExtendsClause(node, parent);
22947}
22948
22949function isFirstInStatement(printStack, {
22950 considerArrow = false,
22951 considerDefaultExports = false
22952} = {}) {
22953 let i = printStack.length - 1;
22954 let node = printStack[i];
22955 i--;
22956 let parent = printStack[i];
22957
22958 while (i > 0) {
22959 if (t().isExpressionStatement(parent, {
22960 expression: node
22961 }) || t().isTaggedTemplateExpression(parent) || considerDefaultExports && t().isExportDefaultDeclaration(parent, {
22962 declaration: node
22963 }) || considerArrow && t().isArrowFunctionExpression(parent, {
22964 body: node
22965 })) {
22966 return true;
22967 }
22968
22969 if (t().isCallExpression(parent, {
22970 callee: node
22971 }) || t().isSequenceExpression(parent) && parent.expressions[0] === node || t().isMemberExpression(parent, {
22972 object: node
22973 }) || t().isConditional(parent, {
22974 test: node
22975 }) || t().isBinary(parent, {
22976 left: node
22977 }) || t().isAssignmentExpression(parent, {
22978 left: node
22979 })) {
22980 node = parent;
22981 i--;
22982 parent = printStack[i];
22983 } else {
22984 return false;
22985 }
22986 }
22987
22988 return false;
22989}
22990
22991/***/ }),
22992/* 172 */
22993/***/ (function(module, exports, __webpack_require__) {
22994
22995"use strict";
22996
22997
22998Object.defineProperty(exports, "__esModule", {
22999 value: true
23000});
23001
23002var _templateLiterals = __webpack_require__(173);
23003
23004Object.keys(_templateLiterals).forEach(function (key) {
23005 if (key === "default" || key === "__esModule") return;
23006 Object.defineProperty(exports, key, {
23007 enumerable: true,
23008 get: function () {
23009 return _templateLiterals[key];
23010 }
23011 });
23012});
23013
23014var _expressions = __webpack_require__(174);
23015
23016Object.keys(_expressions).forEach(function (key) {
23017 if (key === "default" || key === "__esModule") return;
23018 Object.defineProperty(exports, key, {
23019 enumerable: true,
23020 get: function () {
23021 return _expressions[key];
23022 }
23023 });
23024});
23025
23026var _statements = __webpack_require__(175);
23027
23028Object.keys(_statements).forEach(function (key) {
23029 if (key === "default" || key === "__esModule") return;
23030 Object.defineProperty(exports, key, {
23031 enumerable: true,
23032 get: function () {
23033 return _statements[key];
23034 }
23035 });
23036});
23037
23038var _classes = __webpack_require__(176);
23039
23040Object.keys(_classes).forEach(function (key) {
23041 if (key === "default" || key === "__esModule") return;
23042 Object.defineProperty(exports, key, {
23043 enumerable: true,
23044 get: function () {
23045 return _classes[key];
23046 }
23047 });
23048});
23049
23050var _methods = __webpack_require__(177);
23051
23052Object.keys(_methods).forEach(function (key) {
23053 if (key === "default" || key === "__esModule") return;
23054 Object.defineProperty(exports, key, {
23055 enumerable: true,
23056 get: function () {
23057 return _methods[key];
23058 }
23059 });
23060});
23061
23062var _modules = __webpack_require__(72);
23063
23064Object.keys(_modules).forEach(function (key) {
23065 if (key === "default" || key === "__esModule") return;
23066 Object.defineProperty(exports, key, {
23067 enumerable: true,
23068 get: function () {
23069 return _modules[key];
23070 }
23071 });
23072});
23073
23074var _types = __webpack_require__(45);
23075
23076Object.keys(_types).forEach(function (key) {
23077 if (key === "default" || key === "__esModule") return;
23078 Object.defineProperty(exports, key, {
23079 enumerable: true,
23080 get: function () {
23081 return _types[key];
23082 }
23083 });
23084});
23085
23086var _flow = __webpack_require__(179);
23087
23088Object.keys(_flow).forEach(function (key) {
23089 if (key === "default" || key === "__esModule") return;
23090 Object.defineProperty(exports, key, {
23091 enumerable: true,
23092 get: function () {
23093 return _flow[key];
23094 }
23095 });
23096});
23097
23098var _base = __webpack_require__(180);
23099
23100Object.keys(_base).forEach(function (key) {
23101 if (key === "default" || key === "__esModule") return;
23102 Object.defineProperty(exports, key, {
23103 enumerable: true,
23104 get: function () {
23105 return _base[key];
23106 }
23107 });
23108});
23109
23110var _jsx = __webpack_require__(181);
23111
23112Object.keys(_jsx).forEach(function (key) {
23113 if (key === "default" || key === "__esModule") return;
23114 Object.defineProperty(exports, key, {
23115 enumerable: true,
23116 get: function () {
23117 return _jsx[key];
23118 }
23119 });
23120});
23121
23122var _typescript = __webpack_require__(182);
23123
23124Object.keys(_typescript).forEach(function (key) {
23125 if (key === "default" || key === "__esModule") return;
23126 Object.defineProperty(exports, key, {
23127 enumerable: true,
23128 get: function () {
23129 return _typescript[key];
23130 }
23131 });
23132});
23133
23134/***/ }),
23135/* 173 */
23136/***/ (function(module, exports, __webpack_require__) {
23137
23138"use strict";
23139
23140
23141Object.defineProperty(exports, "__esModule", {
23142 value: true
23143});
23144exports.TaggedTemplateExpression = TaggedTemplateExpression;
23145exports.TemplateElement = TemplateElement;
23146exports.TemplateLiteral = TemplateLiteral;
23147
23148function TaggedTemplateExpression(node) {
23149 this.print(node.tag, node);
23150 this.print(node.typeParameters, node);
23151 this.print(node.quasi, node);
23152}
23153
23154function TemplateElement(node, parent) {
23155 const isFirst = parent.quasis[0] === node;
23156 const isLast = parent.quasis[parent.quasis.length - 1] === node;
23157 const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${");
23158 this.token(value);
23159}
23160
23161function TemplateLiteral(node) {
23162 const quasis = node.quasis;
23163
23164 for (let i = 0; i < quasis.length; i++) {
23165 this.print(quasis[i], node);
23166
23167 if (i + 1 < quasis.length) {
23168 this.print(node.expressions[i], node);
23169 }
23170 }
23171}
23172
23173/***/ }),
23174/* 174 */
23175/***/ (function(module, exports, __webpack_require__) {
23176
23177"use strict";
23178
23179
23180Object.defineProperty(exports, "__esModule", {
23181 value: true
23182});
23183exports.UnaryExpression = UnaryExpression;
23184exports.DoExpression = DoExpression;
23185exports.ParenthesizedExpression = ParenthesizedExpression;
23186exports.UpdateExpression = UpdateExpression;
23187exports.ConditionalExpression = ConditionalExpression;
23188exports.NewExpression = NewExpression;
23189exports.SequenceExpression = SequenceExpression;
23190exports.ThisExpression = ThisExpression;
23191exports.Super = Super;
23192exports.Decorator = Decorator;
23193exports.OptionalMemberExpression = OptionalMemberExpression;
23194exports.OptionalCallExpression = OptionalCallExpression;
23195exports.CallExpression = CallExpression;
23196exports.Import = Import;
23197exports.EmptyStatement = EmptyStatement;
23198exports.ExpressionStatement = ExpressionStatement;
23199exports.AssignmentPattern = AssignmentPattern;
23200exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression;
23201exports.BindExpression = BindExpression;
23202exports.MemberExpression = MemberExpression;
23203exports.MetaProperty = MetaProperty;
23204exports.PrivateName = PrivateName;
23205exports.AwaitExpression = exports.YieldExpression = void 0;
23206
23207function t() {
23208 const data = _interopRequireWildcard(__webpack_require__(2));
23209
23210 t = function () {
23211 return data;
23212 };
23213
23214 return data;
23215}
23216
23217var n = _interopRequireWildcard(__webpack_require__(54));
23218
23219function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
23220
23221function UnaryExpression(node) {
23222 if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof") {
23223 this.word(node.operator);
23224 this.space();
23225 } else {
23226 this.token(node.operator);
23227 }
23228
23229 this.print(node.argument, node);
23230}
23231
23232function DoExpression(node) {
23233 this.word("do");
23234 this.space();
23235 this.print(node.body, node);
23236}
23237
23238function ParenthesizedExpression(node) {
23239 this.token("(");
23240 this.print(node.expression, node);
23241 this.token(")");
23242}
23243
23244function UpdateExpression(node) {
23245 if (node.prefix) {
23246 this.token(node.operator);
23247 this.print(node.argument, node);
23248 } else {
23249 this.startTerminatorless(true);
23250 this.print(node.argument, node);
23251 this.endTerminatorless();
23252 this.token(node.operator);
23253 }
23254}
23255
23256function ConditionalExpression(node) {
23257 this.print(node.test, node);
23258 this.space();
23259 this.token("?");
23260 this.space();
23261 this.print(node.consequent, node);
23262 this.space();
23263 this.token(":");
23264 this.space();
23265 this.print(node.alternate, node);
23266}
23267
23268function NewExpression(node, parent) {
23269 this.word("new");
23270 this.space();
23271 this.print(node.callee, node);
23272
23273 if (this.format.minified && node.arguments.length === 0 && !node.optional && !t().isCallExpression(parent, {
23274 callee: node
23275 }) && !t().isMemberExpression(parent) && !t().isNewExpression(parent)) {
23276 return;
23277 }
23278
23279 this.print(node.typeArguments, node);
23280 this.print(node.typeParameters, node);
23281
23282 if (node.optional) {
23283 this.token("?.");
23284 }
23285
23286 this.token("(");
23287 this.printList(node.arguments, node);
23288 this.token(")");
23289}
23290
23291function SequenceExpression(node) {
23292 this.printList(node.expressions, node);
23293}
23294
23295function ThisExpression() {
23296 this.word("this");
23297}
23298
23299function Super() {
23300 this.word("super");
23301}
23302
23303function Decorator(node) {
23304 this.token("@");
23305 this.print(node.expression, node);
23306 this.newline();
23307}
23308
23309function OptionalMemberExpression(node) {
23310 this.print(node.object, node);
23311
23312 if (!node.computed && t().isMemberExpression(node.property)) {
23313 throw new TypeError("Got a MemberExpression for MemberExpression property");
23314 }
23315
23316 let computed = node.computed;
23317
23318 if (t().isLiteral(node.property) && typeof node.property.value === "number") {
23319 computed = true;
23320 }
23321
23322 if (node.optional) {
23323 this.token("?.");
23324 }
23325
23326 if (computed) {
23327 this.token("[");
23328 this.print(node.property, node);
23329 this.token("]");
23330 } else {
23331 if (!node.optional) {
23332 this.token(".");
23333 }
23334
23335 this.print(node.property, node);
23336 }
23337}
23338
23339function OptionalCallExpression(node) {
23340 this.print(node.callee, node);
23341 this.print(node.typeArguments, node);
23342 this.print(node.typeParameters, node);
23343
23344 if (node.optional) {
23345 this.token("?.");
23346 }
23347
23348 this.token("(");
23349 this.printList(node.arguments, node);
23350 this.token(")");
23351}
23352
23353function CallExpression(node) {
23354 this.print(node.callee, node);
23355 this.print(node.typeArguments, node);
23356 this.print(node.typeParameters, node);
23357 this.token("(");
23358 this.printList(node.arguments, node);
23359 this.token(")");
23360}
23361
23362function Import() {
23363 this.word("import");
23364}
23365
23366function buildYieldAwait(keyword) {
23367 return function (node) {
23368 this.word(keyword);
23369
23370 if (node.delegate) {
23371 this.token("*");
23372 }
23373
23374 if (node.argument) {
23375 this.space();
23376 const terminatorState = this.startTerminatorless();
23377 this.print(node.argument, node);
23378 this.endTerminatorless(terminatorState);
23379 }
23380 };
23381}
23382
23383const YieldExpression = buildYieldAwait("yield");
23384exports.YieldExpression = YieldExpression;
23385const AwaitExpression = buildYieldAwait("await");
23386exports.AwaitExpression = AwaitExpression;
23387
23388function EmptyStatement() {
23389 this.semicolon(true);
23390}
23391
23392function ExpressionStatement(node) {
23393 this.print(node.expression, node);
23394 this.semicolon();
23395}
23396
23397function AssignmentPattern(node) {
23398 this.print(node.left, node);
23399 if (node.left.optional) this.token("?");
23400 this.print(node.left.typeAnnotation, node);
23401 this.space();
23402 this.token("=");
23403 this.space();
23404 this.print(node.right, node);
23405}
23406
23407function AssignmentExpression(node, parent) {
23408 const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent);
23409
23410 if (parens) {
23411 this.token("(");
23412 }
23413
23414 this.print(node.left, node);
23415 this.space();
23416
23417 if (node.operator === "in" || node.operator === "instanceof") {
23418 this.word(node.operator);
23419 } else {
23420 this.token(node.operator);
23421 }
23422
23423 this.space();
23424 this.print(node.right, node);
23425
23426 if (parens) {
23427 this.token(")");
23428 }
23429}
23430
23431function BindExpression(node) {
23432 this.print(node.object, node);
23433 this.token("::");
23434 this.print(node.callee, node);
23435}
23436
23437function MemberExpression(node) {
23438 this.print(node.object, node);
23439
23440 if (!node.computed && t().isMemberExpression(node.property)) {
23441 throw new TypeError("Got a MemberExpression for MemberExpression property");
23442 }
23443
23444 let computed = node.computed;
23445
23446 if (t().isLiteral(node.property) && typeof node.property.value === "number") {
23447 computed = true;
23448 }
23449
23450 if (computed) {
23451 this.token("[");
23452 this.print(node.property, node);
23453 this.token("]");
23454 } else {
23455 this.token(".");
23456 this.print(node.property, node);
23457 }
23458}
23459
23460function MetaProperty(node) {
23461 this.print(node.meta, node);
23462 this.token(".");
23463 this.print(node.property, node);
23464}
23465
23466function PrivateName(node) {
23467 this.token("#");
23468 this.print(node.id, node);
23469}
23470
23471/***/ }),
23472/* 175 */
23473/***/ (function(module, exports, __webpack_require__) {
23474
23475"use strict";
23476
23477
23478Object.defineProperty(exports, "__esModule", {
23479 value: true
23480});
23481exports.WithStatement = WithStatement;
23482exports.IfStatement = IfStatement;
23483exports.ForStatement = ForStatement;
23484exports.WhileStatement = WhileStatement;
23485exports.DoWhileStatement = DoWhileStatement;
23486exports.LabeledStatement = LabeledStatement;
23487exports.TryStatement = TryStatement;
23488exports.CatchClause = CatchClause;
23489exports.SwitchStatement = SwitchStatement;
23490exports.SwitchCase = SwitchCase;
23491exports.DebuggerStatement = DebuggerStatement;
23492exports.VariableDeclaration = VariableDeclaration;
23493exports.VariableDeclarator = VariableDeclarator;
23494exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForOfStatement = exports.ForInStatement = void 0;
23495
23496function t() {
23497 const data = _interopRequireWildcard(__webpack_require__(2));
23498
23499 t = function () {
23500 return data;
23501 };
23502
23503 return data;
23504}
23505
23506function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
23507
23508function WithStatement(node) {
23509 this.word("with");
23510 this.space();
23511 this.token("(");
23512 this.print(node.object, node);
23513 this.token(")");
23514 this.printBlock(node);
23515}
23516
23517function IfStatement(node) {
23518 this.word("if");
23519 this.space();
23520 this.token("(");
23521 this.print(node.test, node);
23522 this.token(")");
23523 this.space();
23524 const needsBlock = node.alternate && t().isIfStatement(getLastStatement(node.consequent));
23525
23526 if (needsBlock) {
23527 this.token("{");
23528 this.newline();
23529 this.indent();
23530 }
23531
23532 this.printAndIndentOnComments(node.consequent, node);
23533
23534 if (needsBlock) {
23535 this.dedent();
23536 this.newline();
23537 this.token("}");
23538 }
23539
23540 if (node.alternate) {
23541 if (this.endsWith("}")) this.space();
23542 this.word("else");
23543 this.space();
23544 this.printAndIndentOnComments(node.alternate, node);
23545 }
23546}
23547
23548function getLastStatement(statement) {
23549 if (!t().isStatement(statement.body)) return statement;
23550 return getLastStatement(statement.body);
23551}
23552
23553function ForStatement(node) {
23554 this.word("for");
23555 this.space();
23556 this.token("(");
23557 this.inForStatementInitCounter++;
23558 this.print(node.init, node);
23559 this.inForStatementInitCounter--;
23560 this.token(";");
23561
23562 if (node.test) {
23563 this.space();
23564 this.print(node.test, node);
23565 }
23566
23567 this.token(";");
23568
23569 if (node.update) {
23570 this.space();
23571 this.print(node.update, node);
23572 }
23573
23574 this.token(")");
23575 this.printBlock(node);
23576}
23577
23578function WhileStatement(node) {
23579 this.word("while");
23580 this.space();
23581 this.token("(");
23582 this.print(node.test, node);
23583 this.token(")");
23584 this.printBlock(node);
23585}
23586
23587const buildForXStatement = function (op) {
23588 return function (node) {
23589 this.word("for");
23590 this.space();
23591
23592 if (op === "of" && node.await) {
23593 this.word("await");
23594 this.space();
23595 }
23596
23597 this.token("(");
23598 this.print(node.left, node);
23599 this.space();
23600 this.word(op);
23601 this.space();
23602 this.print(node.right, node);
23603 this.token(")");
23604 this.printBlock(node);
23605 };
23606};
23607
23608const ForInStatement = buildForXStatement("in");
23609exports.ForInStatement = ForInStatement;
23610const ForOfStatement = buildForXStatement("of");
23611exports.ForOfStatement = ForOfStatement;
23612
23613function DoWhileStatement(node) {
23614 this.word("do");
23615 this.space();
23616 this.print(node.body, node);
23617 this.space();
23618 this.word("while");
23619 this.space();
23620 this.token("(");
23621 this.print(node.test, node);
23622 this.token(")");
23623 this.semicolon();
23624}
23625
23626function buildLabelStatement(prefix, key = "label") {
23627 return function (node) {
23628 this.word(prefix);
23629 const label = node[key];
23630
23631 if (label) {
23632 this.space();
23633 const isLabel = key == "label";
23634 const terminatorState = this.startTerminatorless(isLabel);
23635 this.print(label, node);
23636 this.endTerminatorless(terminatorState);
23637 }
23638
23639 this.semicolon();
23640 };
23641}
23642
23643const ContinueStatement = buildLabelStatement("continue");
23644exports.ContinueStatement = ContinueStatement;
23645const ReturnStatement = buildLabelStatement("return", "argument");
23646exports.ReturnStatement = ReturnStatement;
23647const BreakStatement = buildLabelStatement("break");
23648exports.BreakStatement = BreakStatement;
23649const ThrowStatement = buildLabelStatement("throw", "argument");
23650exports.ThrowStatement = ThrowStatement;
23651
23652function LabeledStatement(node) {
23653 this.print(node.label, node);
23654 this.token(":");
23655 this.space();
23656 this.print(node.body, node);
23657}
23658
23659function TryStatement(node) {
23660 this.word("try");
23661 this.space();
23662 this.print(node.block, node);
23663 this.space();
23664
23665 if (node.handlers) {
23666 this.print(node.handlers[0], node);
23667 } else {
23668 this.print(node.handler, node);
23669 }
23670
23671 if (node.finalizer) {
23672 this.space();
23673 this.word("finally");
23674 this.space();
23675 this.print(node.finalizer, node);
23676 }
23677}
23678
23679function CatchClause(node) {
23680 this.word("catch");
23681 this.space();
23682
23683 if (node.param) {
23684 this.token("(");
23685 this.print(node.param, node);
23686 this.token(")");
23687 this.space();
23688 }
23689
23690 this.print(node.body, node);
23691}
23692
23693function SwitchStatement(node) {
23694 this.word("switch");
23695 this.space();
23696 this.token("(");
23697 this.print(node.discriminant, node);
23698 this.token(")");
23699 this.space();
23700 this.token("{");
23701 this.printSequence(node.cases, node, {
23702 indent: true,
23703
23704 addNewlines(leading, cas) {
23705 if (!leading && node.cases[node.cases.length - 1] === cas) return -1;
23706 }
23707
23708 });
23709 this.token("}");
23710}
23711
23712function SwitchCase(node) {
23713 if (node.test) {
23714 this.word("case");
23715 this.space();
23716 this.print(node.test, node);
23717 this.token(":");
23718 } else {
23719 this.word("default");
23720 this.token(":");
23721 }
23722
23723 if (node.consequent.length) {
23724 this.newline();
23725 this.printSequence(node.consequent, node, {
23726 indent: true
23727 });
23728 }
23729}
23730
23731function DebuggerStatement() {
23732 this.word("debugger");
23733 this.semicolon();
23734}
23735
23736function variableDeclarationIndent() {
23737 this.token(",");
23738 this.newline();
23739 if (this.endsWith("\n")) for (let i = 0; i < 4; i++) this.space(true);
23740}
23741
23742function constDeclarationIndent() {
23743 this.token(",");
23744 this.newline();
23745 if (this.endsWith("\n")) for (let i = 0; i < 6; i++) this.space(true);
23746}
23747
23748function VariableDeclaration(node, parent) {
23749 if (node.declare) {
23750 this.word("declare");
23751 this.space();
23752 }
23753
23754 this.word(node.kind);
23755 this.space();
23756 let hasInits = false;
23757
23758 if (!t().isFor(parent)) {
23759 for (const declar of node.declarations) {
23760 if (declar.init) {
23761 hasInits = true;
23762 }
23763 }
23764 }
23765
23766 let separator;
23767
23768 if (hasInits) {
23769 separator = node.kind === "const" ? constDeclarationIndent : variableDeclarationIndent;
23770 }
23771
23772 this.printList(node.declarations, node, {
23773 separator
23774 });
23775
23776 if (t().isFor(parent)) {
23777 if (parent.left === node || parent.init === node) return;
23778 }
23779
23780 this.semicolon();
23781}
23782
23783function VariableDeclarator(node) {
23784 this.print(node.id, node);
23785 if (node.definite) this.token("!");
23786 this.print(node.id.typeAnnotation, node);
23787
23788 if (node.init) {
23789 this.space();
23790 this.token("=");
23791 this.space();
23792 this.print(node.init, node);
23793 }
23794}
23795
23796/***/ }),
23797/* 176 */
23798/***/ (function(module, exports, __webpack_require__) {
23799
23800"use strict";
23801
23802
23803Object.defineProperty(exports, "__esModule", {
23804 value: true
23805});
23806exports.ClassExpression = exports.ClassDeclaration = ClassDeclaration;
23807exports.ClassBody = ClassBody;
23808exports.ClassProperty = ClassProperty;
23809exports.ClassPrivateProperty = ClassPrivateProperty;
23810exports.ClassMethod = ClassMethod;
23811exports._classMethodHead = _classMethodHead;
23812
23813function t() {
23814 const data = _interopRequireWildcard(__webpack_require__(2));
23815
23816 t = function () {
23817 return data;
23818 };
23819
23820 return data;
23821}
23822
23823function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
23824
23825function ClassDeclaration(node, parent) {
23826 if (!this.format.decoratorsBeforeExport || !t().isExportDefaultDeclaration(parent) && !t().isExportNamedDeclaration(parent)) {
23827 this.printJoin(node.decorators, node);
23828 }
23829
23830 if (node.declare) {
23831 this.word("declare");
23832 this.space();
23833 }
23834
23835 if (node.abstract) {
23836 this.word("abstract");
23837 this.space();
23838 }
23839
23840 this.word("class");
23841
23842 if (node.id) {
23843 this.space();
23844 this.print(node.id, node);
23845 }
23846
23847 this.print(node.typeParameters, node);
23848
23849 if (node.superClass) {
23850 this.space();
23851 this.word("extends");
23852 this.space();
23853 this.print(node.superClass, node);
23854 this.print(node.superTypeParameters, node);
23855 }
23856
23857 if (node.implements) {
23858 this.space();
23859 this.word("implements");
23860 this.space();
23861 this.printList(node.implements, node);
23862 }
23863
23864 this.space();
23865 this.print(node.body, node);
23866}
23867
23868function ClassBody(node) {
23869 this.token("{");
23870 this.printInnerComments(node);
23871
23872 if (node.body.length === 0) {
23873 this.token("}");
23874 } else {
23875 this.newline();
23876 this.indent();
23877 this.printSequence(node.body, node);
23878 this.dedent();
23879 if (!this.endsWith("\n")) this.newline();
23880 this.rightBrace();
23881 }
23882}
23883
23884function ClassProperty(node) {
23885 this.printJoin(node.decorators, node);
23886
23887 if (node.accessibility) {
23888 this.word(node.accessibility);
23889 this.space();
23890 }
23891
23892 if (node.static) {
23893 this.word("static");
23894 this.space();
23895 }
23896
23897 if (node.abstract) {
23898 this.word("abstract");
23899 this.space();
23900 }
23901
23902 if (node.readonly) {
23903 this.word("readonly");
23904 this.space();
23905 }
23906
23907 if (node.computed) {
23908 this.token("[");
23909 this.print(node.key, node);
23910 this.token("]");
23911 } else {
23912 this._variance(node);
23913
23914 this.print(node.key, node);
23915 }
23916
23917 if (node.optional) {
23918 this.token("?");
23919 }
23920
23921 if (node.definite) {
23922 this.token("!");
23923 }
23924
23925 this.print(node.typeAnnotation, node);
23926
23927 if (node.value) {
23928 this.space();
23929 this.token("=");
23930 this.space();
23931 this.print(node.value, node);
23932 }
23933
23934 this.semicolon();
23935}
23936
23937function ClassPrivateProperty(node) {
23938 if (node.static) {
23939 this.word("static");
23940 this.space();
23941 }
23942
23943 this.print(node.key, node);
23944 this.print(node.typeAnnotation, node);
23945
23946 if (node.value) {
23947 this.space();
23948 this.token("=");
23949 this.space();
23950 this.print(node.value, node);
23951 }
23952
23953 this.semicolon();
23954}
23955
23956function ClassMethod(node) {
23957 this._classMethodHead(node);
23958
23959 this.space();
23960 this.print(node.body, node);
23961}
23962
23963function _classMethodHead(node) {
23964 this.printJoin(node.decorators, node);
23965
23966 if (node.accessibility) {
23967 this.word(node.accessibility);
23968 this.space();
23969 }
23970
23971 if (node.abstract) {
23972 this.word("abstract");
23973 this.space();
23974 }
23975
23976 if (node.static) {
23977 this.word("static");
23978 this.space();
23979 }
23980
23981 this._methodHead(node);
23982}
23983
23984/***/ }),
23985/* 177 */
23986/***/ (function(module, exports, __webpack_require__) {
23987
23988"use strict";
23989
23990
23991Object.defineProperty(exports, "__esModule", {
23992 value: true
23993});
23994exports._params = _params;
23995exports._parameters = _parameters;
23996exports._param = _param;
23997exports._methodHead = _methodHead;
23998exports._predicate = _predicate;
23999exports._functionHead = _functionHead;
24000exports.FunctionDeclaration = exports.FunctionExpression = FunctionExpression;
24001exports.ArrowFunctionExpression = ArrowFunctionExpression;
24002
24003function t() {
24004 const data = _interopRequireWildcard(__webpack_require__(2));
24005
24006 t = function () {
24007 return data;
24008 };
24009
24010 return data;
24011}
24012
24013function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
24014
24015function _params(node) {
24016 this.print(node.typeParameters, node);
24017 this.token("(");
24018
24019 this._parameters(node.params, node);
24020
24021 this.token(")");
24022 this.print(node.returnType, node);
24023}
24024
24025function _parameters(parameters, parent) {
24026 for (let i = 0; i < parameters.length; i++) {
24027 this._param(parameters[i], parent);
24028
24029 if (i < parameters.length - 1) {
24030 this.token(",");
24031 this.space();
24032 }
24033 }
24034}
24035
24036function _param(parameter, parent) {
24037 this.printJoin(parameter.decorators, parameter);
24038 this.print(parameter, parent);
24039 if (parameter.optional) this.token("?");
24040 this.print(parameter.typeAnnotation, parameter);
24041}
24042
24043function _methodHead(node) {
24044 const kind = node.kind;
24045 const key = node.key;
24046
24047 if (kind === "get" || kind === "set") {
24048 this.word(kind);
24049 this.space();
24050 }
24051
24052 if (node.async) {
24053 this.word("async");
24054 this.space();
24055 }
24056
24057 if (kind === "method" || kind === "init") {
24058 if (node.generator) {
24059 this.token("*");
24060 }
24061 }
24062
24063 if (node.computed) {
24064 this.token("[");
24065 this.print(key, node);
24066 this.token("]");
24067 } else {
24068 this.print(key, node);
24069 }
24070
24071 if (node.optional) {
24072 this.token("?");
24073 }
24074
24075 this._params(node);
24076}
24077
24078function _predicate(node) {
24079 if (node.predicate) {
24080 if (!node.returnType) {
24081 this.token(":");
24082 }
24083
24084 this.space();
24085 this.print(node.predicate, node);
24086 }
24087}
24088
24089function _functionHead(node) {
24090 if (node.async) {
24091 this.word("async");
24092 this.space();
24093 }
24094
24095 this.word("function");
24096 if (node.generator) this.token("*");
24097 this.space();
24098
24099 if (node.id) {
24100 this.print(node.id, node);
24101 }
24102
24103 this._params(node);
24104
24105 this._predicate(node);
24106}
24107
24108function FunctionExpression(node) {
24109 this._functionHead(node);
24110
24111 this.space();
24112 this.print(node.body, node);
24113}
24114
24115function ArrowFunctionExpression(node) {
24116 if (node.async) {
24117 this.word("async");
24118 this.space();
24119 }
24120
24121 const firstParam = node.params[0];
24122
24123 if (node.params.length === 1 && t().isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
24124 this.print(firstParam, node);
24125 } else {
24126 this._params(node);
24127 }
24128
24129 this._predicate(node);
24130
24131 this.space();
24132 this.token("=>");
24133 this.space();
24134 this.print(node.body, node);
24135}
24136
24137function hasTypes(node, param) {
24138 return node.typeParameters || node.returnType || param.typeAnnotation || param.optional || param.trailingComments;
24139}
24140
24141/***/ }),
24142/* 178 */
24143/***/ (function(module, exports) {
24144
24145module.exports = require("jsesc");
24146
24147/***/ }),
24148/* 179 */
24149/***/ (function(module, exports, __webpack_require__) {
24150
24151"use strict";
24152
24153
24154Object.defineProperty(exports, "__esModule", {
24155 value: true
24156});
24157exports.AnyTypeAnnotation = AnyTypeAnnotation;
24158exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
24159exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
24160exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
24161exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
24162exports.DeclareClass = DeclareClass;
24163exports.DeclareFunction = DeclareFunction;
24164exports.InferredPredicate = InferredPredicate;
24165exports.DeclaredPredicate = DeclaredPredicate;
24166exports.DeclareInterface = DeclareInterface;
24167exports.DeclareModule = DeclareModule;
24168exports.DeclareModuleExports = DeclareModuleExports;
24169exports.DeclareTypeAlias = DeclareTypeAlias;
24170exports.DeclareOpaqueType = DeclareOpaqueType;
24171exports.DeclareVariable = DeclareVariable;
24172exports.DeclareExportDeclaration = DeclareExportDeclaration;
24173exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration;
24174exports.ExistsTypeAnnotation = ExistsTypeAnnotation;
24175exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
24176exports.FunctionTypeParam = FunctionTypeParam;
24177exports.GenericTypeAnnotation = exports.ClassImplements = exports.InterfaceExtends = InterfaceExtends;
24178exports._interfaceish = _interfaceish;
24179exports._variance = _variance;
24180exports.InterfaceDeclaration = InterfaceDeclaration;
24181exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation;
24182exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
24183exports.MixedTypeAnnotation = MixedTypeAnnotation;
24184exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
24185exports.NullableTypeAnnotation = NullableTypeAnnotation;
24186exports.NumberTypeAnnotation = NumberTypeAnnotation;
24187exports.StringTypeAnnotation = StringTypeAnnotation;
24188exports.ThisTypeAnnotation = ThisTypeAnnotation;
24189exports.TupleTypeAnnotation = TupleTypeAnnotation;
24190exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
24191exports.TypeAlias = TypeAlias;
24192exports.TypeAnnotation = TypeAnnotation;
24193exports.TypeParameterDeclaration = exports.TypeParameterInstantiation = TypeParameterInstantiation;
24194exports.TypeParameter = TypeParameter;
24195exports.OpaqueType = OpaqueType;
24196exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
24197exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot;
24198exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
24199exports.ObjectTypeIndexer = ObjectTypeIndexer;
24200exports.ObjectTypeProperty = ObjectTypeProperty;
24201exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty;
24202exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
24203exports.UnionTypeAnnotation = UnionTypeAnnotation;
24204exports.TypeCastExpression = TypeCastExpression;
24205exports.Variance = Variance;
24206exports.VoidTypeAnnotation = VoidTypeAnnotation;
24207Object.defineProperty(exports, "NumberLiteralTypeAnnotation", {
24208 enumerable: true,
24209 get: function () {
24210 return _types2.NumericLiteral;
24211 }
24212});
24213Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
24214 enumerable: true,
24215 get: function () {
24216 return _types2.StringLiteral;
24217 }
24218});
24219
24220function t() {
24221 const data = _interopRequireWildcard(__webpack_require__(2));
24222
24223 t = function () {
24224 return data;
24225 };
24226
24227 return data;
24228}
24229
24230var _modules = __webpack_require__(72);
24231
24232var _types2 = __webpack_require__(45);
24233
24234function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
24235
24236function AnyTypeAnnotation() {
24237 this.word("any");
24238}
24239
24240function ArrayTypeAnnotation(node) {
24241 this.print(node.elementType, node);
24242 this.token("[");
24243 this.token("]");
24244}
24245
24246function BooleanTypeAnnotation() {
24247 this.word("boolean");
24248}
24249
24250function BooleanLiteralTypeAnnotation(node) {
24251 this.word(node.value ? "true" : "false");
24252}
24253
24254function NullLiteralTypeAnnotation() {
24255 this.word("null");
24256}
24257
24258function DeclareClass(node, parent) {
24259 if (!t().isDeclareExportDeclaration(parent)) {
24260 this.word("declare");
24261 this.space();
24262 }
24263
24264 this.word("class");
24265 this.space();
24266
24267 this._interfaceish(node);
24268}
24269
24270function DeclareFunction(node, parent) {
24271 if (!t().isDeclareExportDeclaration(parent)) {
24272 this.word("declare");
24273 this.space();
24274 }
24275
24276 this.word("function");
24277 this.space();
24278 this.print(node.id, node);
24279 this.print(node.id.typeAnnotation.typeAnnotation, node);
24280
24281 if (node.predicate) {
24282 this.space();
24283 this.print(node.predicate, node);
24284 }
24285
24286 this.semicolon();
24287}
24288
24289function InferredPredicate() {
24290 this.token("%");
24291 this.word("checks");
24292}
24293
24294function DeclaredPredicate(node) {
24295 this.token("%");
24296 this.word("checks");
24297 this.token("(");
24298 this.print(node.value, node);
24299 this.token(")");
24300}
24301
24302function DeclareInterface(node) {
24303 this.word("declare");
24304 this.space();
24305 this.InterfaceDeclaration(node);
24306}
24307
24308function DeclareModule(node) {
24309 this.word("declare");
24310 this.space();
24311 this.word("module");
24312 this.space();
24313 this.print(node.id, node);
24314 this.space();
24315 this.print(node.body, node);
24316}
24317
24318function DeclareModuleExports(node) {
24319 this.word("declare");
24320 this.space();
24321 this.word("module");
24322 this.token(".");
24323 this.word("exports");
24324 this.print(node.typeAnnotation, node);
24325}
24326
24327function DeclareTypeAlias(node) {
24328 this.word("declare");
24329 this.space();
24330 this.TypeAlias(node);
24331}
24332
24333function DeclareOpaqueType(node, parent) {
24334 if (!t().isDeclareExportDeclaration(parent)) {
24335 this.word("declare");
24336 this.space();
24337 }
24338
24339 this.OpaqueType(node);
24340}
24341
24342function DeclareVariable(node, parent) {
24343 if (!t().isDeclareExportDeclaration(parent)) {
24344 this.word("declare");
24345 this.space();
24346 }
24347
24348 this.word("var");
24349 this.space();
24350 this.print(node.id, node);
24351 this.print(node.id.typeAnnotation, node);
24352 this.semicolon();
24353}
24354
24355function DeclareExportDeclaration(node) {
24356 this.word("declare");
24357 this.space();
24358 this.word("export");
24359 this.space();
24360
24361 if (node.default) {
24362 this.word("default");
24363 this.space();
24364 }
24365
24366 FlowExportDeclaration.apply(this, arguments);
24367}
24368
24369function DeclareExportAllDeclaration() {
24370 this.word("declare");
24371 this.space();
24372
24373 _modules.ExportAllDeclaration.apply(this, arguments);
24374}
24375
24376function FlowExportDeclaration(node) {
24377 if (node.declaration) {
24378 const declar = node.declaration;
24379 this.print(declar, node);
24380 if (!t().isStatement(declar)) this.semicolon();
24381 } else {
24382 this.token("{");
24383
24384 if (node.specifiers.length) {
24385 this.space();
24386 this.printList(node.specifiers, node);
24387 this.space();
24388 }
24389
24390 this.token("}");
24391
24392 if (node.source) {
24393 this.space();
24394 this.word("from");
24395 this.space();
24396 this.print(node.source, node);
24397 }
24398
24399 this.semicolon();
24400 }
24401}
24402
24403function ExistsTypeAnnotation() {
24404 this.token("*");
24405}
24406
24407function FunctionTypeAnnotation(node, parent) {
24408 this.print(node.typeParameters, node);
24409 this.token("(");
24410 this.printList(node.params, node);
24411
24412 if (node.rest) {
24413 if (node.params.length) {
24414 this.token(",");
24415 this.space();
24416 }
24417
24418 this.token("...");
24419 this.print(node.rest, node);
24420 }
24421
24422 this.token(")");
24423
24424 if (parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction" || parent.type === "ObjectTypeProperty" && parent.method) {
24425 this.token(":");
24426 } else {
24427 this.space();
24428 this.token("=>");
24429 }
24430
24431 this.space();
24432 this.print(node.returnType, node);
24433}
24434
24435function FunctionTypeParam(node) {
24436 this.print(node.name, node);
24437 if (node.optional) this.token("?");
24438
24439 if (node.name) {
24440 this.token(":");
24441 this.space();
24442 }
24443
24444 this.print(node.typeAnnotation, node);
24445}
24446
24447function InterfaceExtends(node) {
24448 this.print(node.id, node);
24449 this.print(node.typeParameters, node);
24450}
24451
24452function _interfaceish(node) {
24453 this.print(node.id, node);
24454 this.print(node.typeParameters, node);
24455
24456 if (node.extends.length) {
24457 this.space();
24458 this.word("extends");
24459 this.space();
24460 this.printList(node.extends, node);
24461 }
24462
24463 if (node.mixins && node.mixins.length) {
24464 this.space();
24465 this.word("mixins");
24466 this.space();
24467 this.printList(node.mixins, node);
24468 }
24469
24470 if (node.implements && node.implements.length) {
24471 this.space();
24472 this.word("implements");
24473 this.space();
24474 this.printList(node.implements, node);
24475 }
24476
24477 this.space();
24478 this.print(node.body, node);
24479}
24480
24481function _variance(node) {
24482 if (node.variance) {
24483 if (node.variance.kind === "plus") {
24484 this.token("+");
24485 } else if (node.variance.kind === "minus") {
24486 this.token("-");
24487 }
24488 }
24489}
24490
24491function InterfaceDeclaration(node) {
24492 this.word("interface");
24493 this.space();
24494
24495 this._interfaceish(node);
24496}
24497
24498function andSeparator() {
24499 this.space();
24500 this.token("&");
24501 this.space();
24502}
24503
24504function InterfaceTypeAnnotation(node) {
24505 this.word("interface");
24506
24507 if (node.extends && node.extends.length) {
24508 this.space();
24509 this.word("extends");
24510 this.space();
24511 this.printList(node.extends, node);
24512 }
24513
24514 this.space();
24515 this.print(node.body, node);
24516}
24517
24518function IntersectionTypeAnnotation(node) {
24519 this.printJoin(node.types, node, {
24520 separator: andSeparator
24521 });
24522}
24523
24524function MixedTypeAnnotation() {
24525 this.word("mixed");
24526}
24527
24528function EmptyTypeAnnotation() {
24529 this.word("empty");
24530}
24531
24532function NullableTypeAnnotation(node) {
24533 this.token("?");
24534 this.print(node.typeAnnotation, node);
24535}
24536
24537function NumberTypeAnnotation() {
24538 this.word("number");
24539}
24540
24541function StringTypeAnnotation() {
24542 this.word("string");
24543}
24544
24545function ThisTypeAnnotation() {
24546 this.word("this");
24547}
24548
24549function TupleTypeAnnotation(node) {
24550 this.token("[");
24551 this.printList(node.types, node);
24552 this.token("]");
24553}
24554
24555function TypeofTypeAnnotation(node) {
24556 this.word("typeof");
24557 this.space();
24558 this.print(node.argument, node);
24559}
24560
24561function TypeAlias(node) {
24562 this.word("type");
24563 this.space();
24564 this.print(node.id, node);
24565 this.print(node.typeParameters, node);
24566 this.space();
24567 this.token("=");
24568 this.space();
24569 this.print(node.right, node);
24570 this.semicolon();
24571}
24572
24573function TypeAnnotation(node) {
24574 this.token(":");
24575 this.space();
24576 if (node.optional) this.token("?");
24577 this.print(node.typeAnnotation, node);
24578}
24579
24580function TypeParameterInstantiation(node) {
24581 this.token("<");
24582 this.printList(node.params, node, {});
24583 this.token(">");
24584}
24585
24586function TypeParameter(node) {
24587 this._variance(node);
24588
24589 this.word(node.name);
24590
24591 if (node.bound) {
24592 this.print(node.bound, node);
24593 }
24594
24595 if (node.default) {
24596 this.space();
24597 this.token("=");
24598 this.space();
24599 this.print(node.default, node);
24600 }
24601}
24602
24603function OpaqueType(node) {
24604 this.word("opaque");
24605 this.space();
24606 this.word("type");
24607 this.space();
24608 this.print(node.id, node);
24609 this.print(node.typeParameters, node);
24610
24611 if (node.supertype) {
24612 this.token(":");
24613 this.space();
24614 this.print(node.supertype, node);
24615 }
24616
24617 if (node.impltype) {
24618 this.space();
24619 this.token("=");
24620 this.space();
24621 this.print(node.impltype, node);
24622 }
24623
24624 this.semicolon();
24625}
24626
24627function ObjectTypeAnnotation(node) {
24628 if (node.exact) {
24629 this.token("{|");
24630 } else {
24631 this.token("{");
24632 }
24633
24634 const props = node.properties.concat(node.callProperties || [], node.indexers || [], node.internalSlots || []);
24635
24636 if (props.length) {
24637 this.space();
24638 this.printJoin(props, node, {
24639 addNewlines(leading) {
24640 if (leading && !props[0]) return 1;
24641 },
24642
24643 indent: true,
24644 statement: true,
24645 iterator: () => {
24646 if (props.length !== 1) {
24647 this.token(",");
24648 this.space();
24649 }
24650 }
24651 });
24652 this.space();
24653 }
24654
24655 if (node.exact) {
24656 this.token("|}");
24657 } else {
24658 this.token("}");
24659 }
24660}
24661
24662function ObjectTypeInternalSlot(node) {
24663 if (node.static) {
24664 this.word("static");
24665 this.space();
24666 }
24667
24668 this.token("[");
24669 this.token("[");
24670 this.print(node.id, node);
24671 this.token("]");
24672 this.token("]");
24673 if (node.optional) this.token("?");
24674
24675 if (!node.method) {
24676 this.token(":");
24677 this.space();
24678 }
24679
24680 this.print(node.value, node);
24681}
24682
24683function ObjectTypeCallProperty(node) {
24684 if (node.static) {
24685 this.word("static");
24686 this.space();
24687 }
24688
24689 this.print(node.value, node);
24690}
24691
24692function ObjectTypeIndexer(node) {
24693 if (node.static) {
24694 this.word("static");
24695 this.space();
24696 }
24697
24698 this._variance(node);
24699
24700 this.token("[");
24701
24702 if (node.id) {
24703 this.print(node.id, node);
24704 this.token(":");
24705 this.space();
24706 }
24707
24708 this.print(node.key, node);
24709 this.token("]");
24710 this.token(":");
24711 this.space();
24712 this.print(node.value, node);
24713}
24714
24715function ObjectTypeProperty(node) {
24716 if (node.proto) {
24717 this.word("proto");
24718 this.space();
24719 }
24720
24721 if (node.static) {
24722 this.word("static");
24723 this.space();
24724 }
24725
24726 this._variance(node);
24727
24728 this.print(node.key, node);
24729 if (node.optional) this.token("?");
24730
24731 if (!node.method) {
24732 this.token(":");
24733 this.space();
24734 }
24735
24736 this.print(node.value, node);
24737}
24738
24739function ObjectTypeSpreadProperty(node) {
24740 this.token("...");
24741 this.print(node.argument, node);
24742}
24743
24744function QualifiedTypeIdentifier(node) {
24745 this.print(node.qualification, node);
24746 this.token(".");
24747 this.print(node.id, node);
24748}
24749
24750function orSeparator() {
24751 this.space();
24752 this.token("|");
24753 this.space();
24754}
24755
24756function UnionTypeAnnotation(node) {
24757 this.printJoin(node.types, node, {
24758 separator: orSeparator
24759 });
24760}
24761
24762function TypeCastExpression(node) {
24763 this.token("(");
24764 this.print(node.expression, node);
24765 this.print(node.typeAnnotation, node);
24766 this.token(")");
24767}
24768
24769function Variance(node) {
24770 if (node.kind === "plus") {
24771 this.token("+");
24772 } else {
24773 this.token("-");
24774 }
24775}
24776
24777function VoidTypeAnnotation() {
24778 this.word("void");
24779}
24780
24781/***/ }),
24782/* 180 */
24783/***/ (function(module, exports, __webpack_require__) {
24784
24785"use strict";
24786
24787
24788Object.defineProperty(exports, "__esModule", {
24789 value: true
24790});
24791exports.File = File;
24792exports.Program = Program;
24793exports.BlockStatement = BlockStatement;
24794exports.Noop = Noop;
24795exports.Directive = Directive;
24796exports.InterpreterDirective = InterpreterDirective;
24797Object.defineProperty(exports, "DirectiveLiteral", {
24798 enumerable: true,
24799 get: function () {
24800 return _types.StringLiteral;
24801 }
24802});
24803
24804var _types = __webpack_require__(45);
24805
24806function File(node) {
24807 if (node.program) {
24808 this.print(node.program.interpreter, node);
24809 }
24810
24811 this.print(node.program, node);
24812}
24813
24814function Program(node) {
24815 this.printInnerComments(node, false);
24816 this.printSequence(node.directives, node);
24817 if (node.directives && node.directives.length) this.newline();
24818 this.printSequence(node.body, node);
24819}
24820
24821function BlockStatement(node) {
24822 this.token("{");
24823 this.printInnerComments(node);
24824 const hasDirectives = node.directives && node.directives.length;
24825
24826 if (node.body.length || hasDirectives) {
24827 this.newline();
24828 this.printSequence(node.directives, node, {
24829 indent: true
24830 });
24831 if (hasDirectives) this.newline();
24832 this.printSequence(node.body, node, {
24833 indent: true
24834 });
24835 this.removeTrailingNewline();
24836 this.source("end", node.loc);
24837 if (!this.endsWith("\n")) this.newline();
24838 this.rightBrace();
24839 } else {
24840 this.source("end", node.loc);
24841 this.token("}");
24842 }
24843}
24844
24845function Noop() {}
24846
24847function Directive(node) {
24848 this.print(node.value, node);
24849 this.semicolon();
24850}
24851
24852function InterpreterDirective(node) {
24853 this.token(`#!${node.value}\n`);
24854}
24855
24856/***/ }),
24857/* 181 */
24858/***/ (function(module, exports, __webpack_require__) {
24859
24860"use strict";
24861
24862
24863Object.defineProperty(exports, "__esModule", {
24864 value: true
24865});
24866exports.JSXAttribute = JSXAttribute;
24867exports.JSXIdentifier = JSXIdentifier;
24868exports.JSXNamespacedName = JSXNamespacedName;
24869exports.JSXMemberExpression = JSXMemberExpression;
24870exports.JSXSpreadAttribute = JSXSpreadAttribute;
24871exports.JSXExpressionContainer = JSXExpressionContainer;
24872exports.JSXSpreadChild = JSXSpreadChild;
24873exports.JSXText = JSXText;
24874exports.JSXElement = JSXElement;
24875exports.JSXOpeningElement = JSXOpeningElement;
24876exports.JSXClosingElement = JSXClosingElement;
24877exports.JSXEmptyExpression = JSXEmptyExpression;
24878exports.JSXFragment = JSXFragment;
24879exports.JSXOpeningFragment = JSXOpeningFragment;
24880exports.JSXClosingFragment = JSXClosingFragment;
24881
24882function JSXAttribute(node) {
24883 this.print(node.name, node);
24884
24885 if (node.value) {
24886 this.token("=");
24887 this.print(node.value, node);
24888 }
24889}
24890
24891function JSXIdentifier(node) {
24892 this.word(node.name);
24893}
24894
24895function JSXNamespacedName(node) {
24896 this.print(node.namespace, node);
24897 this.token(":");
24898 this.print(node.name, node);
24899}
24900
24901function JSXMemberExpression(node) {
24902 this.print(node.object, node);
24903 this.token(".");
24904 this.print(node.property, node);
24905}
24906
24907function JSXSpreadAttribute(node) {
24908 this.token("{");
24909 this.token("...");
24910 this.print(node.argument, node);
24911 this.token("}");
24912}
24913
24914function JSXExpressionContainer(node) {
24915 this.token("{");
24916 this.print(node.expression, node);
24917 this.token("}");
24918}
24919
24920function JSXSpreadChild(node) {
24921 this.token("{");
24922 this.token("...");
24923 this.print(node.expression, node);
24924 this.token("}");
24925}
24926
24927function JSXText(node) {
24928 const raw = this.getPossibleRaw(node);
24929
24930 if (raw != null) {
24931 this.token(raw);
24932 } else {
24933 this.token(node.value);
24934 }
24935}
24936
24937function JSXElement(node) {
24938 const open = node.openingElement;
24939 this.print(open, node);
24940 if (open.selfClosing) return;
24941 this.indent();
24942
24943 for (const child of node.children) {
24944 this.print(child, node);
24945 }
24946
24947 this.dedent();
24948 this.print(node.closingElement, node);
24949}
24950
24951function spaceSeparator() {
24952 this.space();
24953}
24954
24955function JSXOpeningElement(node) {
24956 this.token("<");
24957 this.print(node.name, node);
24958 this.print(node.typeParameters, node);
24959
24960 if (node.attributes.length > 0) {
24961 this.space();
24962 this.printJoin(node.attributes, node, {
24963 separator: spaceSeparator
24964 });
24965 }
24966
24967 if (node.selfClosing) {
24968 this.space();
24969 this.token("/>");
24970 } else {
24971 this.token(">");
24972 }
24973}
24974
24975function JSXClosingElement(node) {
24976 this.token("</");
24977 this.print(node.name, node);
24978 this.token(">");
24979}
24980
24981function JSXEmptyExpression(node) {
24982 this.printInnerComments(node);
24983}
24984
24985function JSXFragment(node) {
24986 this.print(node.openingFragment, node);
24987 this.indent();
24988
24989 for (const child of node.children) {
24990 this.print(child, node);
24991 }
24992
24993 this.dedent();
24994 this.print(node.closingFragment, node);
24995}
24996
24997function JSXOpeningFragment() {
24998 this.token("<");
24999 this.token(">");
25000}
25001
25002function JSXClosingFragment() {
25003 this.token("</");
25004 this.token(">");
25005}
25006
25007/***/ }),
25008/* 182 */
25009/***/ (function(module, exports, __webpack_require__) {
25010
25011"use strict";
25012
25013
25014Object.defineProperty(exports, "__esModule", {
25015 value: true
25016});
25017exports.TSTypeAnnotation = TSTypeAnnotation;
25018exports.TSTypeParameterDeclaration = exports.TSTypeParameterInstantiation = TSTypeParameterInstantiation;
25019exports.TSTypeParameter = TSTypeParameter;
25020exports.TSParameterProperty = TSParameterProperty;
25021exports.TSDeclareFunction = TSDeclareFunction;
25022exports.TSDeclareMethod = TSDeclareMethod;
25023exports.TSQualifiedName = TSQualifiedName;
25024exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration;
25025exports.TSConstructSignatureDeclaration = TSConstructSignatureDeclaration;
25026exports.TSPropertySignature = TSPropertySignature;
25027exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName;
25028exports.TSMethodSignature = TSMethodSignature;
25029exports.TSIndexSignature = TSIndexSignature;
25030exports.TSAnyKeyword = TSAnyKeyword;
25031exports.TSNumberKeyword = TSNumberKeyword;
25032exports.TSObjectKeyword = TSObjectKeyword;
25033exports.TSBooleanKeyword = TSBooleanKeyword;
25034exports.TSStringKeyword = TSStringKeyword;
25035exports.TSSymbolKeyword = TSSymbolKeyword;
25036exports.TSVoidKeyword = TSVoidKeyword;
25037exports.TSUndefinedKeyword = TSUndefinedKeyword;
25038exports.TSNullKeyword = TSNullKeyword;
25039exports.TSNeverKeyword = TSNeverKeyword;
25040exports.TSThisType = TSThisType;
25041exports.TSFunctionType = TSFunctionType;
25042exports.TSConstructorType = TSConstructorType;
25043exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType;
25044exports.TSTypeReference = TSTypeReference;
25045exports.TSTypePredicate = TSTypePredicate;
25046exports.TSTypeQuery = TSTypeQuery;
25047exports.TSTypeLiteral = TSTypeLiteral;
25048exports.tsPrintTypeLiteralOrInterfaceBody = tsPrintTypeLiteralOrInterfaceBody;
25049exports.tsPrintBraced = tsPrintBraced;
25050exports.TSArrayType = TSArrayType;
25051exports.TSTupleType = TSTupleType;
25052exports.TSUnionType = TSUnionType;
25053exports.TSIntersectionType = TSIntersectionType;
25054exports.tsPrintUnionOrIntersectionType = tsPrintUnionOrIntersectionType;
25055exports.TSConditionalType = TSConditionalType;
25056exports.TSInferType = TSInferType;
25057exports.TSParenthesizedType = TSParenthesizedType;
25058exports.TSTypeOperator = TSTypeOperator;
25059exports.TSIndexedAccessType = TSIndexedAccessType;
25060exports.TSMappedType = TSMappedType;
25061exports.TSLiteralType = TSLiteralType;
25062exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments;
25063exports.TSInterfaceDeclaration = TSInterfaceDeclaration;
25064exports.TSInterfaceBody = TSInterfaceBody;
25065exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration;
25066exports.TSAsExpression = TSAsExpression;
25067exports.TSTypeAssertion = TSTypeAssertion;
25068exports.TSEnumDeclaration = TSEnumDeclaration;
25069exports.TSEnumMember = TSEnumMember;
25070exports.TSModuleDeclaration = TSModuleDeclaration;
25071exports.TSModuleBlock = TSModuleBlock;
25072exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration;
25073exports.TSExternalModuleReference = TSExternalModuleReference;
25074exports.TSNonNullExpression = TSNonNullExpression;
25075exports.TSExportAssignment = TSExportAssignment;
25076exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration;
25077exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
25078
25079function TSTypeAnnotation(node) {
25080 this.token(":");
25081 this.space();
25082 if (node.optional) this.token("?");
25083 this.print(node.typeAnnotation, node);
25084}
25085
25086function TSTypeParameterInstantiation(node) {
25087 this.token("<");
25088 this.printList(node.params, node, {});
25089 this.token(">");
25090}
25091
25092function TSTypeParameter(node) {
25093 this.word(node.name);
25094
25095 if (node.constraint) {
25096 this.space();
25097 this.word("extends");
25098 this.space();
25099 this.print(node.constraint, node);
25100 }
25101
25102 if (node.default) {
25103 this.space();
25104 this.token("=");
25105 this.space();
25106 this.print(node.default, node);
25107 }
25108}
25109
25110function TSParameterProperty(node) {
25111 if (node.accessibility) {
25112 this.word(node.accessibility);
25113 this.space();
25114 }
25115
25116 if (node.readonly) {
25117 this.word("readonly");
25118 this.space();
25119 }
25120
25121 this._param(node.parameter);
25122}
25123
25124function TSDeclareFunction(node) {
25125 if (node.declare) {
25126 this.word("declare");
25127 this.space();
25128 }
25129
25130 this._functionHead(node);
25131
25132 this.token(";");
25133}
25134
25135function TSDeclareMethod(node) {
25136 this._classMethodHead(node);
25137
25138 this.token(";");
25139}
25140
25141function TSQualifiedName(node) {
25142 this.print(node.left, node);
25143 this.token(".");
25144 this.print(node.right, node);
25145}
25146
25147function TSCallSignatureDeclaration(node) {
25148 this.tsPrintSignatureDeclarationBase(node);
25149}
25150
25151function TSConstructSignatureDeclaration(node) {
25152 this.word("new");
25153 this.space();
25154 this.tsPrintSignatureDeclarationBase(node);
25155}
25156
25157function TSPropertySignature(node) {
25158 const {
25159 readonly,
25160 initializer
25161 } = node;
25162
25163 if (readonly) {
25164 this.word("readonly");
25165 this.space();
25166 }
25167
25168 this.tsPrintPropertyOrMethodName(node);
25169 this.print(node.typeAnnotation, node);
25170
25171 if (initializer) {
25172 this.space();
25173 this.token("=");
25174 this.space();
25175 this.print(initializer, node);
25176 }
25177
25178 this.token(";");
25179}
25180
25181function tsPrintPropertyOrMethodName(node) {
25182 if (node.computed) {
25183 this.token("[");
25184 }
25185
25186 this.print(node.key, node);
25187
25188 if (node.computed) {
25189 this.token("]");
25190 }
25191
25192 if (node.optional) {
25193 this.token("?");
25194 }
25195}
25196
25197function TSMethodSignature(node) {
25198 this.tsPrintPropertyOrMethodName(node);
25199 this.tsPrintSignatureDeclarationBase(node);
25200 this.token(";");
25201}
25202
25203function TSIndexSignature(node) {
25204 const {
25205 readonly
25206 } = node;
25207
25208 if (readonly) {
25209 this.word("readonly");
25210 this.space();
25211 }
25212
25213 this.token("[");
25214
25215 this._parameters(node.parameters, node);
25216
25217 this.token("]");
25218 this.print(node.typeAnnotation, node);
25219 this.token(";");
25220}
25221
25222function TSAnyKeyword() {
25223 this.word("any");
25224}
25225
25226function TSNumberKeyword() {
25227 this.word("number");
25228}
25229
25230function TSObjectKeyword() {
25231 this.word("object");
25232}
25233
25234function TSBooleanKeyword() {
25235 this.word("boolean");
25236}
25237
25238function TSStringKeyword() {
25239 this.word("string");
25240}
25241
25242function TSSymbolKeyword() {
25243 this.word("symbol");
25244}
25245
25246function TSVoidKeyword() {
25247 this.word("void");
25248}
25249
25250function TSUndefinedKeyword() {
25251 this.word("undefined");
25252}
25253
25254function TSNullKeyword() {
25255 this.word("null");
25256}
25257
25258function TSNeverKeyword() {
25259 this.word("never");
25260}
25261
25262function TSThisType() {
25263 this.word("this");
25264}
25265
25266function TSFunctionType(node) {
25267 this.tsPrintFunctionOrConstructorType(node);
25268}
25269
25270function TSConstructorType(node) {
25271 this.word("new");
25272 this.space();
25273 this.tsPrintFunctionOrConstructorType(node);
25274}
25275
25276function tsPrintFunctionOrConstructorType(node) {
25277 const {
25278 typeParameters,
25279 parameters
25280 } = node;
25281 this.print(typeParameters, node);
25282 this.token("(");
25283
25284 this._parameters(parameters, node);
25285
25286 this.token(")");
25287 this.space();
25288 this.token("=>");
25289 this.space();
25290 this.print(node.typeAnnotation.typeAnnotation, node);
25291}
25292
25293function TSTypeReference(node) {
25294 this.print(node.typeName, node);
25295 this.print(node.typeParameters, node);
25296}
25297
25298function TSTypePredicate(node) {
25299 this.print(node.parameterName);
25300 this.space();
25301 this.word("is");
25302 this.space();
25303 this.print(node.typeAnnotation.typeAnnotation);
25304}
25305
25306function TSTypeQuery(node) {
25307 this.word("typeof");
25308 this.space();
25309 this.print(node.exprName);
25310}
25311
25312function TSTypeLiteral(node) {
25313 this.tsPrintTypeLiteralOrInterfaceBody(node.members, node);
25314}
25315
25316function tsPrintTypeLiteralOrInterfaceBody(members, node) {
25317 this.tsPrintBraced(members, node);
25318}
25319
25320function tsPrintBraced(members, node) {
25321 this.token("{");
25322
25323 if (members.length) {
25324 this.indent();
25325 this.newline();
25326
25327 for (const member of members) {
25328 this.print(member, node);
25329 this.newline();
25330 }
25331
25332 this.dedent();
25333 this.rightBrace();
25334 } else {
25335 this.token("}");
25336 }
25337}
25338
25339function TSArrayType(node) {
25340 this.print(node.elementType);
25341 this.token("[]");
25342}
25343
25344function TSTupleType(node) {
25345 this.token("[");
25346 this.printList(node.elementTypes, node);
25347 this.token("]");
25348}
25349
25350function TSUnionType(node) {
25351 this.tsPrintUnionOrIntersectionType(node, "|");
25352}
25353
25354function TSIntersectionType(node) {
25355 this.tsPrintUnionOrIntersectionType(node, "&");
25356}
25357
25358function tsPrintUnionOrIntersectionType(node, sep) {
25359 this.printJoin(node.types, node, {
25360 separator() {
25361 this.space();
25362 this.token(sep);
25363 this.space();
25364 }
25365
25366 });
25367}
25368
25369function TSConditionalType(node) {
25370 this.print(node.checkType);
25371 this.space();
25372 this.word("extends");
25373 this.space();
25374 this.print(node.extendsType);
25375 this.space();
25376 this.token("?");
25377 this.space();
25378 this.print(node.trueType);
25379 this.space();
25380 this.token(":");
25381 this.space();
25382 this.print(node.falseType);
25383}
25384
25385function TSInferType(node) {
25386 this.token("infer");
25387 this.space();
25388 this.print(node.typeParameter);
25389}
25390
25391function TSParenthesizedType(node) {
25392 this.token("(");
25393 this.print(node.typeAnnotation, node);
25394 this.token(")");
25395}
25396
25397function TSTypeOperator(node) {
25398 this.token(node.operator);
25399 this.space();
25400 this.print(node.typeAnnotation, node);
25401}
25402
25403function TSIndexedAccessType(node) {
25404 this.print(node.objectType, node);
25405 this.token("[");
25406 this.print(node.indexType, node);
25407 this.token("]");
25408}
25409
25410function TSMappedType(node) {
25411 const {
25412 readonly,
25413 typeParameter,
25414 optional
25415 } = node;
25416 this.token("{");
25417 this.space();
25418
25419 if (readonly) {
25420 tokenIfPlusMinus(this, readonly);
25421 this.word("readonly");
25422 this.space();
25423 }
25424
25425 this.token("[");
25426 this.word(typeParameter.name);
25427 this.space();
25428 this.word("in");
25429 this.space();
25430 this.print(typeParameter.constraint, typeParameter);
25431 this.token("]");
25432
25433 if (optional) {
25434 tokenIfPlusMinus(this, optional);
25435 this.token("?");
25436 }
25437
25438 this.token(":");
25439 this.space();
25440 this.print(node.typeAnnotation, node);
25441 this.space();
25442 this.token("}");
25443}
25444
25445function tokenIfPlusMinus(self, tok) {
25446 if (tok !== true) {
25447 self.token(tok);
25448 }
25449}
25450
25451function TSLiteralType(node) {
25452 this.print(node.literal, node);
25453}
25454
25455function TSExpressionWithTypeArguments(node) {
25456 this.print(node.expression, node);
25457 this.print(node.typeParameters, node);
25458}
25459
25460function TSInterfaceDeclaration(node) {
25461 const {
25462 declare,
25463 id,
25464 typeParameters,
25465 extends: extendz,
25466 body
25467 } = node;
25468
25469 if (declare) {
25470 this.word("declare");
25471 this.space();
25472 }
25473
25474 this.word("interface");
25475 this.space();
25476 this.print(id, node);
25477 this.print(typeParameters, node);
25478
25479 if (extendz) {
25480 this.space();
25481 this.word("extends");
25482 this.space();
25483 this.printList(extendz, node);
25484 }
25485
25486 this.space();
25487 this.print(body, node);
25488}
25489
25490function TSInterfaceBody(node) {
25491 this.tsPrintTypeLiteralOrInterfaceBody(node.body, node);
25492}
25493
25494function TSTypeAliasDeclaration(node) {
25495 const {
25496 declare,
25497 id,
25498 typeParameters,
25499 typeAnnotation
25500 } = node;
25501
25502 if (declare) {
25503 this.word("declare");
25504 this.space();
25505 }
25506
25507 this.word("type");
25508 this.space();
25509 this.print(id, node);
25510 this.print(typeParameters, node);
25511 this.space();
25512 this.token("=");
25513 this.space();
25514 this.print(typeAnnotation, node);
25515 this.token(";");
25516}
25517
25518function TSAsExpression(node) {
25519 const {
25520 expression,
25521 typeAnnotation
25522 } = node;
25523 this.print(expression, node);
25524 this.space();
25525 this.word("as");
25526 this.space();
25527 this.print(typeAnnotation, node);
25528}
25529
25530function TSTypeAssertion(node) {
25531 const {
25532 typeAnnotation,
25533 expression
25534 } = node;
25535 this.token("<");
25536 this.print(typeAnnotation, node);
25537 this.token(">");
25538 this.space();
25539 this.print(expression, node);
25540}
25541
25542function TSEnumDeclaration(node) {
25543 const {
25544 declare,
25545 const: isConst,
25546 id,
25547 members
25548 } = node;
25549
25550 if (declare) {
25551 this.word("declare");
25552 this.space();
25553 }
25554
25555 if (isConst) {
25556 this.word("const");
25557 this.space();
25558 }
25559
25560 this.word("enum");
25561 this.space();
25562 this.print(id, node);
25563 this.space();
25564 this.tsPrintBraced(members, node);
25565}
25566
25567function TSEnumMember(node) {
25568 const {
25569 id,
25570 initializer
25571 } = node;
25572 this.print(id, node);
25573
25574 if (initializer) {
25575 this.space();
25576 this.token("=");
25577 this.space();
25578 this.print(initializer, node);
25579 }
25580
25581 this.token(",");
25582}
25583
25584function TSModuleDeclaration(node) {
25585 const {
25586 declare,
25587 id
25588 } = node;
25589
25590 if (declare) {
25591 this.word("declare");
25592 this.space();
25593 }
25594
25595 if (!node.global) {
25596 this.word(id.type === "Identifier" ? "namespace" : "module");
25597 this.space();
25598 }
25599
25600 this.print(id, node);
25601
25602 if (!node.body) {
25603 this.token(";");
25604 return;
25605 }
25606
25607 let body = node.body;
25608
25609 while (body.type === "TSModuleDeclaration") {
25610 this.token(".");
25611 this.print(body.id, body);
25612 body = body.body;
25613 }
25614
25615 this.space();
25616 this.print(body, node);
25617}
25618
25619function TSModuleBlock(node) {
25620 this.tsPrintBraced(node.body, node);
25621}
25622
25623function TSImportEqualsDeclaration(node) {
25624 const {
25625 isExport,
25626 id,
25627 moduleReference
25628 } = node;
25629
25630 if (isExport) {
25631 this.word("export");
25632 this.space();
25633 }
25634
25635 this.word("import");
25636 this.space();
25637 this.print(id, node);
25638 this.space();
25639 this.token("=");
25640 this.space();
25641 this.print(moduleReference, node);
25642 this.token(";");
25643}
25644
25645function TSExternalModuleReference(node) {
25646 this.token("require(");
25647 this.print(node.expression, node);
25648 this.token(")");
25649}
25650
25651function TSNonNullExpression(node) {
25652 this.print(node.expression, node);
25653 this.token("!");
25654}
25655
25656function TSExportAssignment(node) {
25657 this.word("export");
25658 this.space();
25659 this.token("=");
25660 this.space();
25661 this.print(node.expression, node);
25662 this.token(";");
25663}
25664
25665function TSNamespaceExportDeclaration(node) {
25666 this.word("export");
25667 this.space();
25668 this.word("as");
25669 this.space();
25670 this.word("namespace");
25671 this.space();
25672 this.print(node.id, node);
25673}
25674
25675function tsPrintSignatureDeclarationBase(node) {
25676 const {
25677 typeParameters,
25678 parameters
25679 } = node;
25680 this.print(typeParameters, node);
25681 this.token("(");
25682
25683 this._parameters(parameters, node);
25684
25685 this.token(")");
25686 this.print(node.typeAnnotation, node);
25687}
25688
25689/***/ }),
25690/* 183 */
25691/***/ (function(module, exports, __webpack_require__) {
25692
25693"use strict";
25694/**
25695 * Copyright (c) Facebook, Inc. and its affiliates.
25696 *
25697 * This source code is licensed under the MIT license found in the
25698 * LICENSE file in the root directory of this source tree.
25699 *
25700 *
25701 * @format
25702 */
25703
25704
25705var nullthrows = function nullthrows(x) {
25706 var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Got unexpected null or undefined';
25707
25708 if (x != null) {
25709 return x;
25710 }
25711
25712 var error = new Error(message);
25713 error.framesToPop = 1; // Skip nullthrows own stack frame.
25714
25715 throw error;
25716};
25717
25718module.exports = nullthrows;
25719
25720/***/ }),
25721/* 184 */
25722/***/ (function(module, exports, __webpack_require__) {
25723
25724"use strict";
25725/**
25726 * Copyright (c) Facebook, Inc. and its affiliates.
25727 *
25728 * This source code is licensed under the MIT license found in the
25729 * LICENSE file in the root directory of this source tree.
25730 *
25731 *
25732 * @format
25733 */
25734
25735
25736var aStackPool = [];
25737var bStackPool = [];
25738/**
25739 * Checks if two values are equal. Values may be primitives, arrays, or objects.
25740 * Returns true if both arguments have the same keys and values.
25741 *
25742 * @see http://underscorejs.org
25743 * @copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
25744 * @license MIT
25745 */
25746
25747function areEqual(a, b) {
25748 var aStack = aStackPool.length ? aStackPool.pop() : [];
25749 var bStack = bStackPool.length ? bStackPool.pop() : [];
25750 var result = eq(a, b, aStack, bStack);
25751 aStack.length = 0;
25752 bStack.length = 0;
25753 aStackPool.push(aStack);
25754 bStackPool.push(bStack);
25755 return result;
25756}
25757
25758function eq(a, b, aStack, bStack) {
25759 if (a === b) {
25760 // Identical objects are equal. `0 === -0`, but they aren't identical.
25761 return a !== 0 || 1 / a === 1 / b;
25762 }
25763
25764 if (a == null || b == null) {
25765 // a or b can be `null` or `undefined`
25766 return false;
25767 }
25768
25769 if (typeof a !== 'object' || typeof b !== 'object') {
25770 return false;
25771 }
25772
25773 var objToStr = Object.prototype.toString;
25774 var className = objToStr.call(a);
25775
25776 if (className !== objToStr.call(b)) {
25777 return false;
25778 }
25779
25780 switch (className) {
25781 case '[object String]':
25782 return a === String(b);
25783
25784 case '[object Number]':
25785 return isNaN(a) || isNaN(b) ? false : a === Number(b);
25786
25787 case '[object Date]':
25788 case '[object Boolean]':
25789 return +a === +b;
25790
25791 case '[object RegExp]':
25792 return a.source === b.source && a.global === b.global && a.multiline === b.multiline && a.ignoreCase === b.ignoreCase;
25793 } // Assume equality for cyclic structures.
25794
25795
25796 var length = aStack.length;
25797
25798 while (length--) {
25799 if (aStack[length] === a) {
25800 return bStack[length] === b;
25801 }
25802 }
25803
25804 aStack.push(a);
25805 bStack.push(b);
25806 var size = 0; // Recursively compare objects and arrays.
25807
25808 if (className === '[object Array]') {
25809 size = a.length;
25810
25811 if (size !== b.length) {
25812 return false;
25813 } // Deep compare the contents, ignoring non-numeric properties.
25814
25815
25816 while (size--) {
25817 if (!eq(a[size], b[size], aStack, bStack)) {
25818 return false;
25819 }
25820 }
25821 } else {
25822 if (a.constructor !== b.constructor) {
25823 return false;
25824 }
25825
25826 if (a.hasOwnProperty('valueOf') && b.hasOwnProperty('valueOf')) {
25827 return a.valueOf() === b.valueOf();
25828 }
25829
25830 var keys = Object.keys(a);
25831
25832 if (keys.length !== Object.keys(b).length) {
25833 return false;
25834 }
25835
25836 for (var i = 0; i < keys.length; i++) {
25837 if (keys[i] === '_owner') {
25838 // HACK: Comparing deeply nested React trees is slow since you end up
25839 // comparing the entire tree (all ancestors and all children) and
25840 // likely not what you want if you're comparing two elements with
25841 // areEqual. We bail out here for now.
25842 continue;
25843 }
25844
25845 if (!b.hasOwnProperty(keys[i]) || !eq(a[keys[i]], b[keys[i]], aStack, bStack)) {
25846 return false;
25847 }
25848 }
25849 }
25850
25851 aStack.pop();
25852 bStack.pop();
25853 return true;
25854}
25855
25856module.exports = areEqual;
25857
25858/***/ }),
25859/* 185 */
25860/***/ (function(module, exports, __webpack_require__) {
25861
25862"use strict";
25863/**
25864 * Copyright (c) Facebook, Inc. and its affiliates.
25865 *
25866 * This source code is licensed under the MIT license found in the
25867 * LICENSE file in the root directory of this source tree.
25868 *
25869 *
25870 * @format
25871 */
25872
25873
25874var formatGeneratedModule = function formatGeneratedModule(_ref) {
25875 var moduleName = _ref.moduleName,
25876 documentType = _ref.documentType,
25877 docText = _ref.docText,
25878 concreteText = _ref.concreteText,
25879 typeText = _ref.typeText,
25880 hash = _ref.hash,
25881 sourceHash = _ref.sourceHash;
25882 var documentTypeImport = documentType ? "import type { ".concat(documentType, " } from 'relay-runtime';") : '';
25883 var docTextComment = docText ? '\n/*\n' + docText.trim() + '\n*/\n' : '';
25884 var hashText = hash ? "\n * ".concat(hash) : '';
25885 return "/**\n * ".concat('@', "flow", hashText, "\n */\n\n/* eslint-disable */\n\n'use strict';\n\n/*::\n").concat(documentTypeImport, "\n").concat(typeText || '', "\n*/\n\n").concat(docTextComment, "\nconst node/*: ").concat(documentType || 'empty', "*/ = ").concat(concreteText, ";\n// prettier-ignore\n(node/*: any*/).hash = '").concat(sourceHash, "';\nmodule.exports = node;\n");
25886};
25887
25888module.exports = formatGeneratedModule;
25889
25890/***/ }),
25891/* 186 */
25892/***/ (function(module, exports, __webpack_require__) {
25893
25894"use strict";
25895/**
25896 * Copyright (c) Facebook, Inc. and its affiliates.
25897 *
25898 * This source code is licensed under the MIT license found in the
25899 * LICENSE file in the root directory of this source tree.
25900 *
25901 *
25902 * @format
25903 */
25904
25905
25906// Attempt to be as inclusive as possible of source text.
25907var BABYLON_OPTIONS = {
25908 allowImportExportEverywhere: true,
25909 allowReturnOutsideFunction: true,
25910 allowSuperOutsideMethod: true,
25911 sourceType: 'module',
25912 plugins: [// Previously "*"
25913 'asyncGenerators', 'classProperties', ['decorators', {
25914 decoratorsBeforeExport: true
25915 }], 'doExpressions', 'dynamicImport', 'exportExtensions', 'flow', 'functionBind', 'functionSent', 'jsx', 'nullishCoalescingOperator', 'objectRestSpread', 'optionalChaining', 'optionalCatchBinding'],
25916 strictMode: false
25917};
25918
25919function find(text) {
25920 var result = [];
25921
25922 var ast = __webpack_require__(187).parse(text, BABYLON_OPTIONS);
25923
25924 var visitors = {
25925 CallExpression: function CallExpression(node) {
25926 var callee = node.callee;
25927
25928 if (!(callee.type === 'Identifier' && CREATE_CONTAINER_FUNCTIONS[callee.name] || callee.kind === 'MemberExpression' && callee.object.type === 'Identifier' && callee.object.value === 'Relay' && callee.property.type === 'Identifier' && CREATE_CONTAINER_FUNCTIONS[callee.property.name])) {
25929 traverse(node, visitors);
25930 return;
25931 }
25932
25933 var fragments = node.arguments[1];
25934
25935 if (fragments.type === 'ObjectExpression') {
25936 fragments.properties.forEach(function (property) {
25937 !(property.type === 'ObjectProperty' && property.key.type === 'Identifier' && property.value.type === 'TaggedTemplateExpression') ? true ? invariant(false, 'FindGraphQLTags: `%s` expects fragment definitions to be ' + '`key: graphql`.', node.callee.name) : undefined : void 0;
25938 !isGraphQLTag(property.value.tag) ? true ? invariant(false, 'FindGraphQLTags: `%s` expects fragment definitions to be tagged ' + 'with `graphql`, got `%s`.', node.callee.name, getSourceTextForLocation(text, property.value.tag.loc)) : undefined : void 0;
25939 result.push({
25940 keyName: property.key.name,
25941 template: getGraphQLText(property.value.quasi),
25942 sourceLocationOffset: getSourceLocationOffset(property.value.quasi)
25943 });
25944 });
25945 } else {
25946 !(fragments && fragments.type === 'TaggedTemplateExpression') ? true ? invariant(false, 'FindGraphQLTags: `%s` expects a second argument of fragment ' + 'definitions.', node.callee.name) : undefined : void 0;
25947 !isGraphQLTag(fragments.tag) ? true ? invariant(false, 'FindGraphQLTags: `%s` expects fragment definitions to be tagged ' + 'with `graphql`, got `%s`.', node.callee.name, getSourceTextForLocation(text, fragments.tag.loc)) : undefined : void 0;
25948 result.push({
25949 keyName: null,
25950 template: getGraphQLText(fragments.quasi),
25951 sourceLocationOffset: getSourceLocationOffset(fragments.quasi)
25952 });
25953 } // Visit remaining arguments
25954
25955
25956 for (var ii = 2; ii < node.arguments.length; ii++) {
25957 visit(node.arguments[ii], visitors);
25958 }
25959 },
25960 TaggedTemplateExpression: function TaggedTemplateExpression(node) {
25961 if (isGraphQLTag(node.tag)) {
25962 result.push({
25963 keyName: null,
25964 template: node.quasi.quasis[0].value.raw,
25965 sourceLocationOffset: getSourceLocationOffset(node.quasi)
25966 });
25967 }
25968 }
25969 };
25970 visit(ast, visitors);
25971 return result;
25972}
25973
25974var CREATE_CONTAINER_FUNCTIONS = Object.create(null, {
25975 createFragmentContainer: {
25976 value: true
25977 },
25978 createPaginationContainer: {
25979 value: true
25980 },
25981 createRefetchContainer: {
25982 value: true
25983 }
25984});
25985var IGNORED_KEYS = {
25986 comments: true,
25987 end: true,
25988 leadingComments: true,
25989 loc: true,
25990 name: true,
25991 start: true,
25992 trailingComments: true,
25993 type: true
25994};
25995
25996function isGraphQLTag(tag) {
25997 return tag.type === 'Identifier' && tag.name === 'graphql';
25998}
25999
26000function getTemplateNode(quasi) {
26001 var quasis = quasi.quasis;
26002 !(quasis && quasis.length === 1) ? true ? invariant(false, 'FindGraphQLTags: Substitutions are not allowed in graphql tags.') : undefined : void 0;
26003 return quasis[0];
26004}
26005
26006function getGraphQLText(quasi) {
26007 return getTemplateNode(quasi).value.raw;
26008}
26009
26010function getSourceLocationOffset(quasi) {
26011 var loc = getTemplateNode(quasi).loc.start;
26012 return {
26013 line: loc.line,
26014 column: loc.column + 1 // babylon is 0-indexed, graphql expects 1-indexed
26015
26016 };
26017}
26018
26019function getSourceTextForLocation(text, loc) {
26020 if (loc == null) {
26021 return '(source unavailable)';
26022 }
26023
26024 var lines = text.split('\n').slice(loc.start.line - 1, loc.end.line);
26025 lines[0] = lines[0].slice(loc.start.column);
26026 lines[lines.length - 1] = lines[lines.length - 1].slice(0, loc.end.column);
26027 return lines.join('\n');
26028}
26029
26030function invariant(condition, msg) {
26031 if (!condition) {
26032 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
26033 args[_key - 2] = arguments[_key];
26034 }
26035
26036 throw new Error(__webpack_require__(29).format.apply(__webpack_require__(29), [msg].concat(args)));
26037 }
26038}
26039
26040function visit(node, visitors) {
26041 var fn = visitors[node.type];
26042
26043 if (fn != null) {
26044 fn(node);
26045 return;
26046 }
26047
26048 traverse(node, visitors);
26049}
26050
26051function traverse(node, visitors) {
26052 for (var key in node) {
26053 if (IGNORED_KEYS[key]) {
26054 continue;
26055 }
26056
26057 var prop = node[key];
26058
26059 if (prop && typeof prop === 'object' && typeof prop.type === 'string') {
26060 visit(prop, visitors);
26061 } else if (Array.isArray(prop)) {
26062 prop.forEach(function (item) {
26063 if (item && typeof item === 'object' && typeof item.type === 'string') {
26064 visit(item, visitors);
26065 }
26066 });
26067 }
26068 }
26069}
26070
26071module.exports = {
26072 find: __webpack_require__(7).instrument(find, 'FindGraphQLTags.find')
26073};
26074
26075/***/ }),
26076/* 187 */
26077/***/ (function(module, exports, __webpack_require__) {
26078
26079"use strict";
26080
26081
26082Object.defineProperty(exports, '__esModule', { value: true });
26083
26084function _AwaitValue(value) {
26085 this.wrapped = value;
26086}
26087
26088function _AsyncGenerator(gen) {
26089 var front, back;
26090
26091 function send(key, arg) {
26092 return new Promise(function (resolve, reject) {
26093 var request = {
26094 key: key,
26095 arg: arg,
26096 resolve: resolve,
26097 reject: reject,
26098 next: null
26099 };
26100
26101 if (back) {
26102 back = back.next = request;
26103 } else {
26104 front = back = request;
26105 resume(key, arg);
26106 }
26107 });
26108 }
26109
26110 function resume(key, arg) {
26111 try {
26112 var result = gen[key](arg);
26113 var value = result.value;
26114 var wrappedAwait = value instanceof _AwaitValue;
26115 Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {
26116 if (wrappedAwait) {
26117 resume("next", arg);
26118 return;
26119 }
26120
26121 settle(result.done ? "return" : "normal", arg);
26122 }, function (err) {
26123 resume("throw", err);
26124 });
26125 } catch (err) {
26126 settle("throw", err);
26127 }
26128 }
26129
26130 function settle(type, value) {
26131 switch (type) {
26132 case "return":
26133 front.resolve({
26134 value: value,
26135 done: true
26136 });
26137 break;
26138
26139 case "throw":
26140 front.reject(value);
26141 break;
26142
26143 default:
26144 front.resolve({
26145 value: value,
26146 done: false
26147 });
26148 break;
26149 }
26150
26151 front = front.next;
26152
26153 if (front) {
26154 resume(front.key, front.arg);
26155 } else {
26156 back = null;
26157 }
26158 }
26159
26160 this._invoke = send;
26161
26162 if (typeof gen.return !== "function") {
26163 this.return = undefined;
26164 }
26165}
26166
26167if (typeof Symbol === "function" && Symbol.asyncIterator) {
26168 _AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
26169 return this;
26170 };
26171}
26172
26173_AsyncGenerator.prototype.next = function (arg) {
26174 return this._invoke("next", arg);
26175};
26176
26177_AsyncGenerator.prototype.throw = function (arg) {
26178 return this._invoke("throw", arg);
26179};
26180
26181_AsyncGenerator.prototype.return = function (arg) {
26182 return this._invoke("return", arg);
26183};
26184
26185function _inheritsLoose(subClass, superClass) {
26186 subClass.prototype = Object.create(superClass.prototype);
26187 subClass.prototype.constructor = subClass;
26188 subClass.__proto__ = superClass;
26189}
26190
26191var beforeExpr = true;
26192var startsExpr = true;
26193var isLoop = true;
26194var isAssign = true;
26195var prefix = true;
26196var postfix = true;
26197var TokenType = function TokenType(label, conf) {
26198 if (conf === void 0) {
26199 conf = {};
26200 }
26201
26202 this.label = label;
26203 this.keyword = conf.keyword;
26204 this.beforeExpr = !!conf.beforeExpr;
26205 this.startsExpr = !!conf.startsExpr;
26206 this.rightAssociative = !!conf.rightAssociative;
26207 this.isLoop = !!conf.isLoop;
26208 this.isAssign = !!conf.isAssign;
26209 this.prefix = !!conf.prefix;
26210 this.postfix = !!conf.postfix;
26211 this.binop = conf.binop === 0 ? 0 : conf.binop || null;
26212 this.updateContext = null;
26213};
26214
26215function KeywordTokenType(keyword, options) {
26216 if (options === void 0) {
26217 options = {};
26218 }
26219
26220 return new TokenType(keyword, Object.assign({}, options, {
26221 keyword: keyword
26222 }));
26223}
26224
26225function BinopTokenType(name, binop) {
26226 return new TokenType(name, {
26227 beforeExpr: beforeExpr,
26228 binop: binop
26229 });
26230}
26231
26232var types = {
26233 num: new TokenType("num", {
26234 startsExpr: startsExpr
26235 }),
26236 bigint: new TokenType("bigint", {
26237 startsExpr: startsExpr
26238 }),
26239 regexp: new TokenType("regexp", {
26240 startsExpr: startsExpr
26241 }),
26242 string: new TokenType("string", {
26243 startsExpr: startsExpr
26244 }),
26245 name: new TokenType("name", {
26246 startsExpr: startsExpr
26247 }),
26248 eof: new TokenType("eof"),
26249 bracketL: new TokenType("[", {
26250 beforeExpr: beforeExpr,
26251 startsExpr: startsExpr
26252 }),
26253 bracketR: new TokenType("]"),
26254 braceL: new TokenType("{", {
26255 beforeExpr: beforeExpr,
26256 startsExpr: startsExpr
26257 }),
26258 braceBarL: new TokenType("{|", {
26259 beforeExpr: beforeExpr,
26260 startsExpr: startsExpr
26261 }),
26262 braceR: new TokenType("}"),
26263 braceBarR: new TokenType("|}"),
26264 parenL: new TokenType("(", {
26265 beforeExpr: beforeExpr,
26266 startsExpr: startsExpr
26267 }),
26268 parenR: new TokenType(")"),
26269 comma: new TokenType(",", {
26270 beforeExpr: beforeExpr
26271 }),
26272 semi: new TokenType(";", {
26273 beforeExpr: beforeExpr
26274 }),
26275 colon: new TokenType(":", {
26276 beforeExpr: beforeExpr
26277 }),
26278 doubleColon: new TokenType("::", {
26279 beforeExpr: beforeExpr
26280 }),
26281 dot: new TokenType("."),
26282 question: new TokenType("?", {
26283 beforeExpr: beforeExpr
26284 }),
26285 questionDot: new TokenType("?."),
26286 arrow: new TokenType("=>", {
26287 beforeExpr: beforeExpr
26288 }),
26289 template: new TokenType("template"),
26290 ellipsis: new TokenType("...", {
26291 beforeExpr: beforeExpr
26292 }),
26293 backQuote: new TokenType("`", {
26294 startsExpr: startsExpr
26295 }),
26296 dollarBraceL: new TokenType("${", {
26297 beforeExpr: beforeExpr,
26298 startsExpr: startsExpr
26299 }),
26300 at: new TokenType("@"),
26301 hash: new TokenType("#"),
26302 interpreterDirective: new TokenType("#!..."),
26303 eq: new TokenType("=", {
26304 beforeExpr: beforeExpr,
26305 isAssign: isAssign
26306 }),
26307 assign: new TokenType("_=", {
26308 beforeExpr: beforeExpr,
26309 isAssign: isAssign
26310 }),
26311 incDec: new TokenType("++/--", {
26312 prefix: prefix,
26313 postfix: postfix,
26314 startsExpr: startsExpr
26315 }),
26316 bang: new TokenType("!", {
26317 beforeExpr: beforeExpr,
26318 prefix: prefix,
26319 startsExpr: startsExpr
26320 }),
26321 tilde: new TokenType("~", {
26322 beforeExpr: beforeExpr,
26323 prefix: prefix,
26324 startsExpr: startsExpr
26325 }),
26326 pipeline: new BinopTokenType("|>", 0),
26327 nullishCoalescing: new BinopTokenType("??", 1),
26328 logicalOR: new BinopTokenType("||", 1),
26329 logicalAND: new BinopTokenType("&&", 2),
26330 bitwiseOR: new BinopTokenType("|", 3),
26331 bitwiseXOR: new BinopTokenType("^", 4),
26332 bitwiseAND: new BinopTokenType("&", 5),
26333 equality: new BinopTokenType("==/!=", 6),
26334 relational: new BinopTokenType("</>", 7),
26335 bitShift: new BinopTokenType("<</>>", 8),
26336 plusMin: new TokenType("+/-", {
26337 beforeExpr: beforeExpr,
26338 binop: 9,
26339 prefix: prefix,
26340 startsExpr: startsExpr
26341 }),
26342 modulo: new BinopTokenType("%", 10),
26343 star: new BinopTokenType("*", 10),
26344 slash: new BinopTokenType("/", 10),
26345 exponent: new TokenType("**", {
26346 beforeExpr: beforeExpr,
26347 binop: 11,
26348 rightAssociative: true
26349 })
26350};
26351var keywords = {
26352 break: new KeywordTokenType("break"),
26353 case: new KeywordTokenType("case", {
26354 beforeExpr: beforeExpr
26355 }),
26356 catch: new KeywordTokenType("catch"),
26357 continue: new KeywordTokenType("continue"),
26358 debugger: new KeywordTokenType("debugger"),
26359 default: new KeywordTokenType("default", {
26360 beforeExpr: beforeExpr
26361 }),
26362 do: new KeywordTokenType("do", {
26363 isLoop: isLoop,
26364 beforeExpr: beforeExpr
26365 }),
26366 else: new KeywordTokenType("else", {
26367 beforeExpr: beforeExpr
26368 }),
26369 finally: new KeywordTokenType("finally"),
26370 for: new KeywordTokenType("for", {
26371 isLoop: isLoop
26372 }),
26373 function: new KeywordTokenType("function", {
26374 startsExpr: startsExpr
26375 }),
26376 if: new KeywordTokenType("if"),
26377 return: new KeywordTokenType("return", {
26378 beforeExpr: beforeExpr
26379 }),
26380 switch: new KeywordTokenType("switch"),
26381 throw: new KeywordTokenType("throw", {
26382 beforeExpr: beforeExpr,
26383 prefix: prefix,
26384 startsExpr: startsExpr
26385 }),
26386 try: new KeywordTokenType("try"),
26387 var: new KeywordTokenType("var"),
26388 let: new KeywordTokenType("let"),
26389 const: new KeywordTokenType("const"),
26390 while: new KeywordTokenType("while", {
26391 isLoop: isLoop
26392 }),
26393 with: new KeywordTokenType("with"),
26394 new: new KeywordTokenType("new", {
26395 beforeExpr: beforeExpr,
26396 startsExpr: startsExpr
26397 }),
26398 this: new KeywordTokenType("this", {
26399 startsExpr: startsExpr
26400 }),
26401 super: new KeywordTokenType("super", {
26402 startsExpr: startsExpr
26403 }),
26404 class: new KeywordTokenType("class"),
26405 extends: new KeywordTokenType("extends", {
26406 beforeExpr: beforeExpr
26407 }),
26408 export: new KeywordTokenType("export"),
26409 import: new KeywordTokenType("import", {
26410 startsExpr: startsExpr
26411 }),
26412 yield: new KeywordTokenType("yield", {
26413 beforeExpr: beforeExpr,
26414 startsExpr: startsExpr
26415 }),
26416 null: new KeywordTokenType("null", {
26417 startsExpr: startsExpr
26418 }),
26419 true: new KeywordTokenType("true", {
26420 startsExpr: startsExpr
26421 }),
26422 false: new KeywordTokenType("false", {
26423 startsExpr: startsExpr
26424 }),
26425 in: new KeywordTokenType("in", {
26426 beforeExpr: beforeExpr,
26427 binop: 7
26428 }),
26429 instanceof: new KeywordTokenType("instanceof", {
26430 beforeExpr: beforeExpr,
26431 binop: 7
26432 }),
26433 typeof: new KeywordTokenType("typeof", {
26434 beforeExpr: beforeExpr,
26435 prefix: prefix,
26436 startsExpr: startsExpr
26437 }),
26438 void: new KeywordTokenType("void", {
26439 beforeExpr: beforeExpr,
26440 prefix: prefix,
26441 startsExpr: startsExpr
26442 }),
26443 delete: new KeywordTokenType("delete", {
26444 beforeExpr: beforeExpr,
26445 prefix: prefix,
26446 startsExpr: startsExpr
26447 })
26448};
26449Object.keys(keywords).forEach(function (name) {
26450 types["_" + name] = keywords[name];
26451});
26452
26453function isSimpleProperty(node) {
26454 return node != null && node.type === "Property" && node.kind === "init" && node.method === false;
26455}
26456
26457var estree = (function (superClass) {
26458 return function (_superClass) {
26459 _inheritsLoose(_class, _superClass);
26460
26461 function _class() {
26462 return _superClass.apply(this, arguments) || this;
26463 }
26464
26465 var _proto = _class.prototype;
26466
26467 _proto.estreeParseRegExpLiteral = function estreeParseRegExpLiteral(_ref) {
26468 var pattern = _ref.pattern,
26469 flags = _ref.flags;
26470 var regex = null;
26471
26472 try {
26473 regex = new RegExp(pattern, flags);
26474 } catch (e) {}
26475
26476 var node = this.estreeParseLiteral(regex);
26477 node.regex = {
26478 pattern: pattern,
26479 flags: flags
26480 };
26481 return node;
26482 };
26483
26484 _proto.estreeParseLiteral = function estreeParseLiteral(value) {
26485 return this.parseLiteral(value, "Literal");
26486 };
26487
26488 _proto.directiveToStmt = function directiveToStmt(directive) {
26489 var directiveLiteral = directive.value;
26490 var stmt = this.startNodeAt(directive.start, directive.loc.start);
26491 var expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start);
26492 expression.value = directiveLiteral.value;
26493 expression.raw = directiveLiteral.extra.raw;
26494 stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end);
26495 stmt.directive = directiveLiteral.extra.raw.slice(1, -1);
26496 return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end);
26497 };
26498
26499 _proto.initFunction = function initFunction(node, isAsync) {
26500 _superClass.prototype.initFunction.call(this, node, isAsync);
26501
26502 node.expression = false;
26503 };
26504
26505 _proto.checkDeclaration = function checkDeclaration(node) {
26506 if (isSimpleProperty(node)) {
26507 this.checkDeclaration(node.value);
26508 } else {
26509 _superClass.prototype.checkDeclaration.call(this, node);
26510 }
26511 };
26512
26513 _proto.checkGetterSetterParams = function checkGetterSetterParams(method) {
26514 var prop = method;
26515 var paramCount = prop.kind === "get" ? 0 : 1;
26516 var start = prop.start;
26517
26518 if (prop.value.params.length !== paramCount) {
26519 if (prop.kind === "get") {
26520 this.raise(start, "getter must not have any formal parameters");
26521 } else {
26522 this.raise(start, "setter must have exactly one formal parameter");
26523 }
26524 }
26525
26526 if (prop.kind === "set" && prop.value.params[0].type === "RestElement") {
26527 this.raise(start, "setter function argument must not be a rest parameter");
26528 }
26529 };
26530
26531 _proto.checkLVal = function checkLVal(expr, isBinding, checkClashes, contextDescription) {
26532 var _this = this;
26533
26534 switch (expr.type) {
26535 case "ObjectPattern":
26536 expr.properties.forEach(function (prop) {
26537 _this.checkLVal(prop.type === "Property" ? prop.value : prop, isBinding, checkClashes, "object destructuring pattern");
26538 });
26539 break;
26540
26541 default:
26542 _superClass.prototype.checkLVal.call(this, expr, isBinding, checkClashes, contextDescription);
26543
26544 }
26545 };
26546
26547 _proto.checkPropClash = function checkPropClash(prop, propHash) {
26548 if (prop.computed || !isSimpleProperty(prop)) return;
26549 var key = prop.key;
26550 var name = key.type === "Identifier" ? key.name : String(key.value);
26551
26552 if (name === "__proto__") {
26553 if (propHash.proto) {
26554 this.raise(key.start, "Redefinition of __proto__ property");
26555 }
26556
26557 propHash.proto = true;
26558 }
26559 };
26560
26561 _proto.isStrictBody = function isStrictBody(node) {
26562 var isBlockStatement = node.body.type === "BlockStatement";
26563
26564 if (isBlockStatement && node.body.body.length > 0) {
26565 for (var _i2 = 0, _node$body$body2 = node.body.body; _i2 < _node$body$body2.length; _i2++) {
26566 var directive = _node$body$body2[_i2];
26567
26568 if (directive.type === "ExpressionStatement" && directive.expression.type === "Literal") {
26569 if (directive.expression.value === "use strict") return true;
26570 } else {
26571 break;
26572 }
26573 }
26574 }
26575
26576 return false;
26577 };
26578
26579 _proto.isValidDirective = function isValidDirective(stmt) {
26580 return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && (!stmt.expression.extra || !stmt.expression.extra.parenthesized);
26581 };
26582
26583 _proto.stmtToDirective = function stmtToDirective(stmt) {
26584 var directive = _superClass.prototype.stmtToDirective.call(this, stmt);
26585
26586 var value = stmt.expression.value;
26587 directive.value.value = value;
26588 return directive;
26589 };
26590
26591 _proto.parseBlockBody = function parseBlockBody(node, allowDirectives, topLevel, end) {
26592 var _this2 = this;
26593
26594 _superClass.prototype.parseBlockBody.call(this, node, allowDirectives, topLevel, end);
26595
26596 var directiveStatements = node.directives.map(function (d) {
26597 return _this2.directiveToStmt(d);
26598 });
26599 node.body = directiveStatements.concat(node.body);
26600 delete node.directives;
26601 };
26602
26603 _proto.pushClassMethod = function pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor) {
26604 this.parseMethod(method, isGenerator, isAsync, isConstructor, "MethodDefinition");
26605
26606 if (method.typeParameters) {
26607 method.value.typeParameters = method.typeParameters;
26608 delete method.typeParameters;
26609 }
26610
26611 classBody.body.push(method);
26612 };
26613
26614 _proto.parseExprAtom = function parseExprAtom(refShorthandDefaultPos) {
26615 switch (this.state.type) {
26616 case types.regexp:
26617 return this.estreeParseRegExpLiteral(this.state.value);
26618
26619 case types.num:
26620 case types.string:
26621 return this.estreeParseLiteral(this.state.value);
26622
26623 case types._null:
26624 return this.estreeParseLiteral(null);
26625
26626 case types._true:
26627 return this.estreeParseLiteral(true);
26628
26629 case types._false:
26630 return this.estreeParseLiteral(false);
26631
26632 default:
26633 return _superClass.prototype.parseExprAtom.call(this, refShorthandDefaultPos);
26634 }
26635 };
26636
26637 _proto.parseLiteral = function parseLiteral(value, type, startPos, startLoc) {
26638 var node = _superClass.prototype.parseLiteral.call(this, value, type, startPos, startLoc);
26639
26640 node.raw = node.extra.raw;
26641 delete node.extra;
26642 return node;
26643 };
26644
26645 _proto.parseFunctionBody = function parseFunctionBody(node, allowExpression) {
26646 _superClass.prototype.parseFunctionBody.call(this, node, allowExpression);
26647
26648 node.expression = node.body.type !== "BlockStatement";
26649 };
26650
26651 _proto.parseMethod = function parseMethod(node, isGenerator, isAsync, isConstructor, type) {
26652 var funcNode = this.startNode();
26653 funcNode.kind = node.kind;
26654 funcNode = _superClass.prototype.parseMethod.call(this, funcNode, isGenerator, isAsync, isConstructor, "FunctionExpression");
26655 delete funcNode.kind;
26656 node.value = funcNode;
26657 return this.finishNode(node, type);
26658 };
26659
26660 _proto.parseObjectMethod = function parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc) {
26661 var node = _superClass.prototype.parseObjectMethod.call(this, prop, isGenerator, isAsync, isPattern, containsEsc);
26662
26663 if (node) {
26664 node.type = "Property";
26665 if (node.kind === "method") node.kind = "init";
26666 node.shorthand = false;
26667 }
26668
26669 return node;
26670 };
26671
26672 _proto.parseObjectProperty = function parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos) {
26673 var node = _superClass.prototype.parseObjectProperty.call(this, prop, startPos, startLoc, isPattern, refShorthandDefaultPos);
26674
26675 if (node) {
26676 node.kind = "init";
26677 node.type = "Property";
26678 }
26679
26680 return node;
26681 };
26682
26683 _proto.toAssignable = function toAssignable(node, isBinding, contextDescription) {
26684 if (isSimpleProperty(node)) {
26685 this.toAssignable(node.value, isBinding, contextDescription);
26686 return node;
26687 }
26688
26689 return _superClass.prototype.toAssignable.call(this, node, isBinding, contextDescription);
26690 };
26691
26692 _proto.toAssignableObjectExpressionProp = function toAssignableObjectExpressionProp(prop, isBinding, isLast) {
26693 if (prop.kind === "get" || prop.kind === "set") {
26694 this.raise(prop.key.start, "Object pattern can't contain getter or setter");
26695 } else if (prop.method) {
26696 this.raise(prop.key.start, "Object pattern can't contain methods");
26697 } else {
26698 _superClass.prototype.toAssignableObjectExpressionProp.call(this, prop, isBinding, isLast);
26699 }
26700 };
26701
26702 return _class;
26703 }(superClass);
26704});
26705
26706function makePredicate(words) {
26707 var wordsArr = words.split(" ");
26708 return function (str) {
26709 return wordsArr.indexOf(str) >= 0;
26710 };
26711}
26712
26713var reservedWords = {
26714 "6": makePredicate("enum await"),
26715 strict: makePredicate("implements interface let package private protected public static yield"),
26716 strictBind: makePredicate("eval arguments")
26717};
26718var isKeyword = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super");
26719var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
26720var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F";
26721var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
26722var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
26723nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
26724var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 477, 28, 11, 0, 9, 21, 190, 52, 76, 44, 33, 24, 27, 35, 30, 0, 12, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 26, 230, 43, 117, 63, 32, 0, 257, 0, 11, 39, 8, 0, 22, 0, 12, 39, 3, 3, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 270, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 68, 12, 0, 67, 12, 65, 1, 31, 6129, 15, 754, 9486, 286, 82, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541];
26725var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 525, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 280, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239];
26726
26727function isInAstralSet(code, set) {
26728 var pos = 0x10000;
26729
26730 for (var i = 0; i < set.length; i += 2) {
26731 pos += set[i];
26732 if (pos > code) return false;
26733 pos += set[i + 1];
26734 if (pos >= code) return true;
26735 }
26736
26737 return false;
26738}
26739
26740function isIdentifierStart(code) {
26741 if (code < 65) return code === 36;
26742 if (code <= 90) return true;
26743 if (code < 97) return code === 95;
26744 if (code <= 122) return true;
26745
26746 if (code <= 0xffff) {
26747 return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
26748 }
26749
26750 return isInAstralSet(code, astralIdentifierStartCodes);
26751}
26752function isIteratorStart(current, next) {
26753 return current === 64 && next === 64;
26754}
26755function isIdentifierChar(code) {
26756 if (code < 48) return code === 36;
26757 if (code < 58) return true;
26758 if (code < 65) return false;
26759 if (code <= 90) return true;
26760 if (code < 97) return code === 95;
26761 if (code <= 122) return true;
26762
26763 if (code <= 0xffff) {
26764 return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
26765 }
26766
26767 return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
26768}
26769
26770var primitiveTypes = ["any", "bool", "boolean", "empty", "false", "mixed", "null", "number", "static", "string", "true", "typeof", "void"];
26771
26772function isEsModuleType(bodyElement) {
26773 return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
26774}
26775
26776function hasTypeImportKind(node) {
26777 return node.importKind === "type" || node.importKind === "typeof";
26778}
26779
26780function isMaybeDefaultImport(state) {
26781 return (state.type === types.name || !!state.type.keyword) && state.value !== "from";
26782}
26783
26784var exportSuggestions = {
26785 const: "declare export var",
26786 let: "declare export var",
26787 type: "export type",
26788 interface: "export interface"
26789};
26790
26791function partition(list, test) {
26792 var list1 = [];
26793 var list2 = [];
26794
26795 for (var i = 0; i < list.length; i++) {
26796 (test(list[i], i, list) ? list1 : list2).push(list[i]);
26797 }
26798
26799 return [list1, list2];
26800}
26801
26802var FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
26803var flow = (function (superClass) {
26804 return function (_superClass) {
26805 _inheritsLoose(_class, _superClass);
26806
26807 function _class(options, input) {
26808 var _this;
26809
26810 _this = _superClass.call(this, options, input) || this;
26811 _this.flowPragma = undefined;
26812 return _this;
26813 }
26814
26815 var _proto = _class.prototype;
26816
26817 _proto.shouldParseTypes = function shouldParseTypes() {
26818 return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
26819 };
26820
26821 _proto.addComment = function addComment(comment) {
26822 if (this.flowPragma === undefined) {
26823 var matches = FLOW_PRAGMA_REGEX.exec(comment.value);
26824
26825 if (!matches) {
26826 this.flowPragma = null;
26827 } else if (matches[1] === "flow") {
26828 this.flowPragma = "flow";
26829 } else if (matches[1] === "noflow") {
26830 this.flowPragma = "noflow";
26831 } else {
26832 throw new Error("Unexpected flow pragma");
26833 }
26834 }
26835
26836 return _superClass.prototype.addComment.call(this, comment);
26837 };
26838
26839 _proto.flowParseTypeInitialiser = function flowParseTypeInitialiser(tok) {
26840 var oldInType = this.state.inType;
26841 this.state.inType = true;
26842 this.expect(tok || types.colon);
26843 var type = this.flowParseType();
26844 this.state.inType = oldInType;
26845 return type;
26846 };
26847
26848 _proto.flowParsePredicate = function flowParsePredicate() {
26849 var node = this.startNode();
26850 var moduloLoc = this.state.startLoc;
26851 var moduloPos = this.state.start;
26852 this.expect(types.modulo);
26853 var checksLoc = this.state.startLoc;
26854 this.expectContextual("checks");
26855
26856 if (moduloLoc.line !== checksLoc.line || moduloLoc.column !== checksLoc.column - 1) {
26857 this.raise(moduloPos, "Spaces between ´%´ and ´checks´ are not allowed here.");
26858 }
26859
26860 if (this.eat(types.parenL)) {
26861 node.value = this.parseExpression();
26862 this.expect(types.parenR);
26863 return this.finishNode(node, "DeclaredPredicate");
26864 } else {
26865 return this.finishNode(node, "InferredPredicate");
26866 }
26867 };
26868
26869 _proto.flowParseTypeAndPredicateInitialiser = function flowParseTypeAndPredicateInitialiser() {
26870 var oldInType = this.state.inType;
26871 this.state.inType = true;
26872 this.expect(types.colon);
26873 var type = null;
26874 var predicate = null;
26875
26876 if (this.match(types.modulo)) {
26877 this.state.inType = oldInType;
26878 predicate = this.flowParsePredicate();
26879 } else {
26880 type = this.flowParseType();
26881 this.state.inType = oldInType;
26882
26883 if (this.match(types.modulo)) {
26884 predicate = this.flowParsePredicate();
26885 }
26886 }
26887
26888 return [type, predicate];
26889 };
26890
26891 _proto.flowParseDeclareClass = function flowParseDeclareClass(node) {
26892 this.next();
26893 this.flowParseInterfaceish(node, true);
26894 return this.finishNode(node, "DeclareClass");
26895 };
26896
26897 _proto.flowParseDeclareFunction = function flowParseDeclareFunction(node) {
26898 this.next();
26899 var id = node.id = this.parseIdentifier();
26900 var typeNode = this.startNode();
26901 var typeContainer = this.startNode();
26902
26903 if (this.isRelational("<")) {
26904 typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
26905 } else {
26906 typeNode.typeParameters = null;
26907 }
26908
26909 this.expect(types.parenL);
26910 var tmp = this.flowParseFunctionTypeParams();
26911 typeNode.params = tmp.params;
26912 typeNode.rest = tmp.rest;
26913 this.expect(types.parenR);
26914
26915 var _this$flowParseTypeAn = this.flowParseTypeAndPredicateInitialiser();
26916
26917 typeNode.returnType = _this$flowParseTypeAn[0];
26918 node.predicate = _this$flowParseTypeAn[1];
26919 typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
26920 id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
26921 this.finishNode(id, id.type);
26922 this.semicolon();
26923 return this.finishNode(node, "DeclareFunction");
26924 };
26925
26926 _proto.flowParseDeclare = function flowParseDeclare(node, insideModule) {
26927 if (this.match(types._class)) {
26928 return this.flowParseDeclareClass(node);
26929 } else if (this.match(types._function)) {
26930 return this.flowParseDeclareFunction(node);
26931 } else if (this.match(types._var)) {
26932 return this.flowParseDeclareVariable(node);
26933 } else if (this.isContextual("module")) {
26934 if (this.lookahead().type === types.dot) {
26935 return this.flowParseDeclareModuleExports(node);
26936 } else {
26937 if (insideModule) {
26938 this.unexpected(null, "`declare module` cannot be used inside another `declare module`");
26939 }
26940
26941 return this.flowParseDeclareModule(node);
26942 }
26943 } else if (this.isContextual("type")) {
26944 return this.flowParseDeclareTypeAlias(node);
26945 } else if (this.isContextual("opaque")) {
26946 return this.flowParseDeclareOpaqueType(node);
26947 } else if (this.isContextual("interface")) {
26948 return this.flowParseDeclareInterface(node);
26949 } else if (this.match(types._export)) {
26950 return this.flowParseDeclareExportDeclaration(node, insideModule);
26951 } else {
26952 throw this.unexpected();
26953 }
26954 };
26955
26956 _proto.flowParseDeclareVariable = function flowParseDeclareVariable(node) {
26957 this.next();
26958 node.id = this.flowParseTypeAnnotatableIdentifier(true);
26959 this.semicolon();
26960 return this.finishNode(node, "DeclareVariable");
26961 };
26962
26963 _proto.flowParseDeclareModule = function flowParseDeclareModule(node) {
26964 var _this2 = this;
26965
26966 this.next();
26967
26968 if (this.match(types.string)) {
26969 node.id = this.parseExprAtom();
26970 } else {
26971 node.id = this.parseIdentifier();
26972 }
26973
26974 var bodyNode = node.body = this.startNode();
26975 var body = bodyNode.body = [];
26976 this.expect(types.braceL);
26977
26978 while (!this.match(types.braceR)) {
26979 var _bodyNode = this.startNode();
26980
26981 if (this.match(types._import)) {
26982 var lookahead = this.lookahead();
26983
26984 if (lookahead.value !== "type" && lookahead.value !== "typeof") {
26985 this.unexpected(null, "Imports within a `declare module` body must always be `import type` or `import typeof`");
26986 }
26987
26988 this.next();
26989 this.parseImport(_bodyNode);
26990 } else {
26991 this.expectContextual("declare", "Only declares and type imports are allowed inside declare module");
26992 _bodyNode = this.flowParseDeclare(_bodyNode, true);
26993 }
26994
26995 body.push(_bodyNode);
26996 }
26997
26998 this.expect(types.braceR);
26999 this.finishNode(bodyNode, "BlockStatement");
27000 var kind = null;
27001 var hasModuleExport = false;
27002 var errorMessage = "Found both `declare module.exports` and `declare export` in the same module. " + "Modules can only have 1 since they are either an ES module or they are a CommonJS module";
27003 body.forEach(function (bodyElement) {
27004 if (isEsModuleType(bodyElement)) {
27005 if (kind === "CommonJS") {
27006 _this2.unexpected(bodyElement.start, errorMessage);
27007 }
27008
27009 kind = "ES";
27010 } else if (bodyElement.type === "DeclareModuleExports") {
27011 if (hasModuleExport) {
27012 _this2.unexpected(bodyElement.start, "Duplicate `declare module.exports` statement");
27013 }
27014
27015 if (kind === "ES") _this2.unexpected(bodyElement.start, errorMessage);
27016 kind = "CommonJS";
27017 hasModuleExport = true;
27018 }
27019 });
27020 node.kind = kind || "CommonJS";
27021 return this.finishNode(node, "DeclareModule");
27022 };
27023
27024 _proto.flowParseDeclareExportDeclaration = function flowParseDeclareExportDeclaration(node, insideModule) {
27025 this.expect(types._export);
27026
27027 if (this.eat(types._default)) {
27028 if (this.match(types._function) || this.match(types._class)) {
27029 node.declaration = this.flowParseDeclare(this.startNode());
27030 } else {
27031 node.declaration = this.flowParseType();
27032 this.semicolon();
27033 }
27034
27035 node.default = true;
27036 return this.finishNode(node, "DeclareExportDeclaration");
27037 } else {
27038 if (this.match(types._const) || this.match(types._let) || (this.isContextual("type") || this.isContextual("interface")) && !insideModule) {
27039 var label = this.state.value;
27040 var suggestion = exportSuggestions[label];
27041 this.unexpected(this.state.start, "`declare export " + label + "` is not supported. Use `" + suggestion + "` instead");
27042 }
27043
27044 if (this.match(types._var) || this.match(types._function) || this.match(types._class) || this.isContextual("opaque")) {
27045 node.declaration = this.flowParseDeclare(this.startNode());
27046 node.default = false;
27047 return this.finishNode(node, "DeclareExportDeclaration");
27048 } else if (this.match(types.star) || this.match(types.braceL) || this.isContextual("interface") || this.isContextual("type") || this.isContextual("opaque")) {
27049 node = this.parseExport(node);
27050
27051 if (node.type === "ExportNamedDeclaration") {
27052 node.type = "ExportDeclaration";
27053 node.default = false;
27054 delete node.exportKind;
27055 }
27056
27057 node.type = "Declare" + node.type;
27058 return node;
27059 }
27060 }
27061
27062 throw this.unexpected();
27063 };
27064
27065 _proto.flowParseDeclareModuleExports = function flowParseDeclareModuleExports(node) {
27066 this.expectContextual("module");
27067 this.expect(types.dot);
27068 this.expectContextual("exports");
27069 node.typeAnnotation = this.flowParseTypeAnnotation();
27070 this.semicolon();
27071 return this.finishNode(node, "DeclareModuleExports");
27072 };
27073
27074 _proto.flowParseDeclareTypeAlias = function flowParseDeclareTypeAlias(node) {
27075 this.next();
27076 this.flowParseTypeAlias(node);
27077 return this.finishNode(node, "DeclareTypeAlias");
27078 };
27079
27080 _proto.flowParseDeclareOpaqueType = function flowParseDeclareOpaqueType(node) {
27081 this.next();
27082 this.flowParseOpaqueType(node, true);
27083 return this.finishNode(node, "DeclareOpaqueType");
27084 };
27085
27086 _proto.flowParseDeclareInterface = function flowParseDeclareInterface(node) {
27087 this.next();
27088 this.flowParseInterfaceish(node);
27089 return this.finishNode(node, "DeclareInterface");
27090 };
27091
27092 _proto.flowParseInterfaceish = function flowParseInterfaceish(node, isClass) {
27093 if (isClass === void 0) {
27094 isClass = false;
27095 }
27096
27097 node.id = this.flowParseRestrictedIdentifier(!isClass);
27098
27099 if (this.isRelational("<")) {
27100 node.typeParameters = this.flowParseTypeParameterDeclaration();
27101 } else {
27102 node.typeParameters = null;
27103 }
27104
27105 node.extends = [];
27106 node.implements = [];
27107 node.mixins = [];
27108
27109 if (this.eat(types._extends)) {
27110 do {
27111 node.extends.push(this.flowParseInterfaceExtends());
27112 } while (!isClass && this.eat(types.comma));
27113 }
27114
27115 if (this.isContextual("mixins")) {
27116 this.next();
27117
27118 do {
27119 node.mixins.push(this.flowParseInterfaceExtends());
27120 } while (this.eat(types.comma));
27121 }
27122
27123 if (this.isContextual("implements")) {
27124 this.next();
27125
27126 do {
27127 node.implements.push(this.flowParseInterfaceExtends());
27128 } while (this.eat(types.comma));
27129 }
27130
27131 node.body = this.flowParseObjectType(isClass, false, false, isClass);
27132 };
27133
27134 _proto.flowParseInterfaceExtends = function flowParseInterfaceExtends() {
27135 var node = this.startNode();
27136 node.id = this.flowParseQualifiedTypeIdentifier();
27137
27138 if (this.isRelational("<")) {
27139 node.typeParameters = this.flowParseTypeParameterInstantiation();
27140 } else {
27141 node.typeParameters = null;
27142 }
27143
27144 return this.finishNode(node, "InterfaceExtends");
27145 };
27146
27147 _proto.flowParseInterface = function flowParseInterface(node) {
27148 this.flowParseInterfaceish(node);
27149 return this.finishNode(node, "InterfaceDeclaration");
27150 };
27151
27152 _proto.checkReservedType = function checkReservedType(word, startLoc) {
27153 if (primitiveTypes.indexOf(word) > -1) {
27154 this.raise(startLoc, "Cannot overwrite primitive type " + word);
27155 }
27156 };
27157
27158 _proto.flowParseRestrictedIdentifier = function flowParseRestrictedIdentifier(liberal) {
27159 this.checkReservedType(this.state.value, this.state.start);
27160 return this.parseIdentifier(liberal);
27161 };
27162
27163 _proto.flowParseTypeAlias = function flowParseTypeAlias(node) {
27164 node.id = this.flowParseRestrictedIdentifier();
27165
27166 if (this.isRelational("<")) {
27167 node.typeParameters = this.flowParseTypeParameterDeclaration();
27168 } else {
27169 node.typeParameters = null;
27170 }
27171
27172 node.right = this.flowParseTypeInitialiser(types.eq);
27173 this.semicolon();
27174 return this.finishNode(node, "TypeAlias");
27175 };
27176
27177 _proto.flowParseOpaqueType = function flowParseOpaqueType(node, declare) {
27178 this.expectContextual("type");
27179 node.id = this.flowParseRestrictedIdentifier(true);
27180
27181 if (this.isRelational("<")) {
27182 node.typeParameters = this.flowParseTypeParameterDeclaration();
27183 } else {
27184 node.typeParameters = null;
27185 }
27186
27187 node.supertype = null;
27188
27189 if (this.match(types.colon)) {
27190 node.supertype = this.flowParseTypeInitialiser(types.colon);
27191 }
27192
27193 node.impltype = null;
27194
27195 if (!declare) {
27196 node.impltype = this.flowParseTypeInitialiser(types.eq);
27197 }
27198
27199 this.semicolon();
27200 return this.finishNode(node, "OpaqueType");
27201 };
27202
27203 _proto.flowParseTypeParameter = function flowParseTypeParameter(allowDefault, requireDefault) {
27204 if (allowDefault === void 0) {
27205 allowDefault = true;
27206 }
27207
27208 if (requireDefault === void 0) {
27209 requireDefault = false;
27210 }
27211
27212 if (!allowDefault && requireDefault) {
27213 throw new Error("Cannot disallow a default value (`allowDefault`) while also requiring it (`requireDefault`).");
27214 }
27215
27216 var nodeStart = this.state.start;
27217 var node = this.startNode();
27218 var variance = this.flowParseVariance();
27219 var ident = this.flowParseTypeAnnotatableIdentifier();
27220 node.name = ident.name;
27221 node.variance = variance;
27222 node.bound = ident.typeAnnotation;
27223
27224 if (this.match(types.eq)) {
27225 if (allowDefault) {
27226 this.eat(types.eq);
27227 node.default = this.flowParseType();
27228 } else {
27229 this.unexpected();
27230 }
27231 } else {
27232 if (requireDefault) {
27233 this.unexpected(nodeStart, "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.");
27234 }
27235 }
27236
27237 return this.finishNode(node, "TypeParameter");
27238 };
27239
27240 _proto.flowParseTypeParameterDeclaration = function flowParseTypeParameterDeclaration(allowDefault) {
27241 if (allowDefault === void 0) {
27242 allowDefault = true;
27243 }
27244
27245 var oldInType = this.state.inType;
27246 var node = this.startNode();
27247 node.params = [];
27248 this.state.inType = true;
27249
27250 if (this.isRelational("<") || this.match(types.jsxTagStart)) {
27251 this.next();
27252 } else {
27253 this.unexpected();
27254 }
27255
27256 var defaultRequired = false;
27257
27258 do {
27259 var typeParameter = this.flowParseTypeParameter(allowDefault, defaultRequired);
27260 node.params.push(typeParameter);
27261
27262 if (typeParameter.default) {
27263 defaultRequired = true;
27264 }
27265
27266 if (!this.isRelational(">")) {
27267 this.expect(types.comma);
27268 }
27269 } while (!this.isRelational(">"));
27270
27271 this.expectRelational(">");
27272 this.state.inType = oldInType;
27273 return this.finishNode(node, "TypeParameterDeclaration");
27274 };
27275
27276 _proto.flowParseTypeParameterInstantiation = function flowParseTypeParameterInstantiation() {
27277 var node = this.startNode();
27278 var oldInType = this.state.inType;
27279 node.params = [];
27280 this.state.inType = true;
27281 this.expectRelational("<");
27282
27283 while (!this.isRelational(">")) {
27284 node.params.push(this.flowParseType());
27285
27286 if (!this.isRelational(">")) {
27287 this.expect(types.comma);
27288 }
27289 }
27290
27291 this.expectRelational(">");
27292 this.state.inType = oldInType;
27293 return this.finishNode(node, "TypeParameterInstantiation");
27294 };
27295
27296 _proto.flowParseInterfaceType = function flowParseInterfaceType() {
27297 var node = this.startNode();
27298 this.expectContextual("interface");
27299 node.extends = [];
27300
27301 if (this.eat(types._extends)) {
27302 do {
27303 node.extends.push(this.flowParseInterfaceExtends());
27304 } while (this.eat(types.comma));
27305 }
27306
27307 node.body = this.flowParseObjectType(false, false, false, false);
27308 return this.finishNode(node, "InterfaceTypeAnnotation");
27309 };
27310
27311 _proto.flowParseObjectPropertyKey = function flowParseObjectPropertyKey() {
27312 return this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
27313 };
27314
27315 _proto.flowParseObjectTypeIndexer = function flowParseObjectTypeIndexer(node, isStatic, variance) {
27316 node.static = isStatic;
27317
27318 if (this.lookahead().type === types.colon) {
27319 node.id = this.flowParseObjectPropertyKey();
27320 node.key = this.flowParseTypeInitialiser();
27321 } else {
27322 node.id = null;
27323 node.key = this.flowParseType();
27324 }
27325
27326 this.expect(types.bracketR);
27327 node.value = this.flowParseTypeInitialiser();
27328 node.variance = variance;
27329 return this.finishNode(node, "ObjectTypeIndexer");
27330 };
27331
27332 _proto.flowParseObjectTypeInternalSlot = function flowParseObjectTypeInternalSlot(node, isStatic) {
27333 node.static = isStatic;
27334 node.id = this.flowParseObjectPropertyKey();
27335 this.expect(types.bracketR);
27336 this.expect(types.bracketR);
27337
27338 if (this.isRelational("<") || this.match(types.parenL)) {
27339 node.method = true;
27340 node.optional = false;
27341 node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
27342 } else {
27343 node.method = false;
27344
27345 if (this.eat(types.question)) {
27346 node.optional = true;
27347 }
27348
27349 node.value = this.flowParseTypeInitialiser();
27350 }
27351
27352 return this.finishNode(node, "ObjectTypeInternalSlot");
27353 };
27354
27355 _proto.flowParseObjectTypeMethodish = function flowParseObjectTypeMethodish(node) {
27356 node.params = [];
27357 node.rest = null;
27358 node.typeParameters = null;
27359
27360 if (this.isRelational("<")) {
27361 node.typeParameters = this.flowParseTypeParameterDeclaration(false);
27362 }
27363
27364 this.expect(types.parenL);
27365
27366 while (!this.match(types.parenR) && !this.match(types.ellipsis)) {
27367 node.params.push(this.flowParseFunctionTypeParam());
27368
27369 if (!this.match(types.parenR)) {
27370 this.expect(types.comma);
27371 }
27372 }
27373
27374 if (this.eat(types.ellipsis)) {
27375 node.rest = this.flowParseFunctionTypeParam();
27376 }
27377
27378 this.expect(types.parenR);
27379 node.returnType = this.flowParseTypeInitialiser();
27380 return this.finishNode(node, "FunctionTypeAnnotation");
27381 };
27382
27383 _proto.flowParseObjectTypeCallProperty = function flowParseObjectTypeCallProperty(node, isStatic) {
27384 var valueNode = this.startNode();
27385 node.static = isStatic;
27386 node.value = this.flowParseObjectTypeMethodish(valueNode);
27387 return this.finishNode(node, "ObjectTypeCallProperty");
27388 };
27389
27390 _proto.flowParseObjectType = function flowParseObjectType(allowStatic, allowExact, allowSpread, allowProto) {
27391 var oldInType = this.state.inType;
27392 this.state.inType = true;
27393 var nodeStart = this.startNode();
27394 nodeStart.callProperties = [];
27395 nodeStart.properties = [];
27396 nodeStart.indexers = [];
27397 nodeStart.internalSlots = [];
27398 var endDelim;
27399 var exact;
27400
27401 if (allowExact && this.match(types.braceBarL)) {
27402 this.expect(types.braceBarL);
27403 endDelim = types.braceBarR;
27404 exact = true;
27405 } else {
27406 this.expect(types.braceL);
27407 endDelim = types.braceR;
27408 exact = false;
27409 }
27410
27411 nodeStart.exact = exact;
27412
27413 while (!this.match(endDelim)) {
27414 var isStatic = false;
27415 var protoStart = null;
27416 var node = this.startNode();
27417
27418 if (allowProto && this.isContextual("proto")) {
27419 var lookahead = this.lookahead();
27420
27421 if (lookahead.type !== types.colon && lookahead.type !== types.question) {
27422 this.next();
27423 protoStart = this.state.start;
27424 allowStatic = false;
27425 }
27426 }
27427
27428 if (allowStatic && this.isContextual("static")) {
27429 var _lookahead = this.lookahead();
27430
27431 if (_lookahead.type !== types.colon && _lookahead.type !== types.question) {
27432 this.next();
27433 isStatic = true;
27434 }
27435 }
27436
27437 var variance = this.flowParseVariance();
27438
27439 if (this.eat(types.bracketL)) {
27440 if (protoStart != null) {
27441 this.unexpected(protoStart);
27442 }
27443
27444 if (this.eat(types.bracketL)) {
27445 if (variance) {
27446 this.unexpected(variance.start);
27447 }
27448
27449 nodeStart.internalSlots.push(this.flowParseObjectTypeInternalSlot(node, isStatic));
27450 } else {
27451 nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
27452 }
27453 } else if (this.match(types.parenL) || this.isRelational("<")) {
27454 if (protoStart != null) {
27455 this.unexpected(protoStart);
27456 }
27457
27458 if (variance) {
27459 this.unexpected(variance.start);
27460 }
27461
27462 nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
27463 } else {
27464 var kind = "init";
27465
27466 if (this.isContextual("get") || this.isContextual("set")) {
27467 var _lookahead2 = this.lookahead();
27468
27469 if (_lookahead2.type === types.name || _lookahead2.type === types.string || _lookahead2.type === types.num) {
27470 kind = this.state.value;
27471 this.next();
27472 }
27473 }
27474
27475 nodeStart.properties.push(this.flowParseObjectTypeProperty(node, isStatic, protoStart, variance, kind, allowSpread));
27476 }
27477
27478 this.flowObjectTypeSemicolon();
27479 }
27480
27481 this.expect(endDelim);
27482 var out = this.finishNode(nodeStart, "ObjectTypeAnnotation");
27483 this.state.inType = oldInType;
27484 return out;
27485 };
27486
27487 _proto.flowParseObjectTypeProperty = function flowParseObjectTypeProperty(node, isStatic, protoStart, variance, kind, allowSpread) {
27488 if (this.match(types.ellipsis)) {
27489 if (!allowSpread) {
27490 this.unexpected(null, "Spread operator cannot appear in class or interface definitions");
27491 }
27492
27493 if (protoStart != null) {
27494 this.unexpected(protoStart);
27495 }
27496
27497 if (variance) {
27498 this.unexpected(variance.start, "Spread properties cannot have variance");
27499 }
27500
27501 this.expect(types.ellipsis);
27502 node.argument = this.flowParseType();
27503 return this.finishNode(node, "ObjectTypeSpreadProperty");
27504 } else {
27505 node.key = this.flowParseObjectPropertyKey();
27506 node.static = isStatic;
27507 node.proto = protoStart != null;
27508 node.kind = kind;
27509 var optional = false;
27510
27511 if (this.isRelational("<") || this.match(types.parenL)) {
27512 node.method = true;
27513
27514 if (protoStart != null) {
27515 this.unexpected(protoStart);
27516 }
27517
27518 if (variance) {
27519 this.unexpected(variance.start);
27520 }
27521
27522 node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
27523
27524 if (kind === "get" || kind === "set") {
27525 this.flowCheckGetterSetterParams(node);
27526 }
27527 } else {
27528 if (kind !== "init") this.unexpected();
27529 node.method = false;
27530
27531 if (this.eat(types.question)) {
27532 optional = true;
27533 }
27534
27535 node.value = this.flowParseTypeInitialiser();
27536 node.variance = variance;
27537 }
27538
27539 node.optional = optional;
27540 return this.finishNode(node, "ObjectTypeProperty");
27541 }
27542 };
27543
27544 _proto.flowCheckGetterSetterParams = function flowCheckGetterSetterParams(property) {
27545 var paramCount = property.kind === "get" ? 0 : 1;
27546 var start = property.start;
27547 var length = property.value.params.length + (property.value.rest ? 1 : 0);
27548
27549 if (length !== paramCount) {
27550 if (property.kind === "get") {
27551 this.raise(start, "getter must not have any formal parameters");
27552 } else {
27553 this.raise(start, "setter must have exactly one formal parameter");
27554 }
27555 }
27556
27557 if (property.kind === "set" && property.value.rest) {
27558 this.raise(start, "setter function argument must not be a rest parameter");
27559 }
27560 };
27561
27562 _proto.flowObjectTypeSemicolon = function flowObjectTypeSemicolon() {
27563 if (!this.eat(types.semi) && !this.eat(types.comma) && !this.match(types.braceR) && !this.match(types.braceBarR)) {
27564 this.unexpected();
27565 }
27566 };
27567
27568 _proto.flowParseQualifiedTypeIdentifier = function flowParseQualifiedTypeIdentifier(startPos, startLoc, id) {
27569 startPos = startPos || this.state.start;
27570 startLoc = startLoc || this.state.startLoc;
27571 var node = id || this.parseIdentifier();
27572
27573 while (this.eat(types.dot)) {
27574 var node2 = this.startNodeAt(startPos, startLoc);
27575 node2.qualification = node;
27576 node2.id = this.parseIdentifier();
27577 node = this.finishNode(node2, "QualifiedTypeIdentifier");
27578 }
27579
27580 return node;
27581 };
27582
27583 _proto.flowParseGenericType = function flowParseGenericType(startPos, startLoc, id) {
27584 var node = this.startNodeAt(startPos, startLoc);
27585 node.typeParameters = null;
27586 node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id);
27587
27588 if (this.isRelational("<")) {
27589 node.typeParameters = this.flowParseTypeParameterInstantiation();
27590 }
27591
27592 return this.finishNode(node, "GenericTypeAnnotation");
27593 };
27594
27595 _proto.flowParseTypeofType = function flowParseTypeofType() {
27596 var node = this.startNode();
27597 this.expect(types._typeof);
27598 node.argument = this.flowParsePrimaryType();
27599 return this.finishNode(node, "TypeofTypeAnnotation");
27600 };
27601
27602 _proto.flowParseTupleType = function flowParseTupleType() {
27603 var node = this.startNode();
27604 node.types = [];
27605 this.expect(types.bracketL);
27606
27607 while (this.state.pos < this.input.length && !this.match(types.bracketR)) {
27608 node.types.push(this.flowParseType());
27609 if (this.match(types.bracketR)) break;
27610 this.expect(types.comma);
27611 }
27612
27613 this.expect(types.bracketR);
27614 return this.finishNode(node, "TupleTypeAnnotation");
27615 };
27616
27617 _proto.flowParseFunctionTypeParam = function flowParseFunctionTypeParam() {
27618 var name = null;
27619 var optional = false;
27620 var typeAnnotation = null;
27621 var node = this.startNode();
27622 var lh = this.lookahead();
27623
27624 if (lh.type === types.colon || lh.type === types.question) {
27625 name = this.parseIdentifier();
27626
27627 if (this.eat(types.question)) {
27628 optional = true;
27629 }
27630
27631 typeAnnotation = this.flowParseTypeInitialiser();
27632 } else {
27633 typeAnnotation = this.flowParseType();
27634 }
27635
27636 node.name = name;
27637 node.optional = optional;
27638 node.typeAnnotation = typeAnnotation;
27639 return this.finishNode(node, "FunctionTypeParam");
27640 };
27641
27642 _proto.reinterpretTypeAsFunctionTypeParam = function reinterpretTypeAsFunctionTypeParam(type) {
27643 var node = this.startNodeAt(type.start, type.loc.start);
27644 node.name = null;
27645 node.optional = false;
27646 node.typeAnnotation = type;
27647 return this.finishNode(node, "FunctionTypeParam");
27648 };
27649
27650 _proto.flowParseFunctionTypeParams = function flowParseFunctionTypeParams(params) {
27651 if (params === void 0) {
27652 params = [];
27653 }
27654
27655 var rest = null;
27656
27657 while (!this.match(types.parenR) && !this.match(types.ellipsis)) {
27658 params.push(this.flowParseFunctionTypeParam());
27659
27660 if (!this.match(types.parenR)) {
27661 this.expect(types.comma);
27662 }
27663 }
27664
27665 if (this.eat(types.ellipsis)) {
27666 rest = this.flowParseFunctionTypeParam();
27667 }
27668
27669 return {
27670 params: params,
27671 rest: rest
27672 };
27673 };
27674
27675 _proto.flowIdentToTypeAnnotation = function flowIdentToTypeAnnotation(startPos, startLoc, node, id) {
27676 switch (id.name) {
27677 case "any":
27678 return this.finishNode(node, "AnyTypeAnnotation");
27679
27680 case "void":
27681 return this.finishNode(node, "VoidTypeAnnotation");
27682
27683 case "bool":
27684 case "boolean":
27685 return this.finishNode(node, "BooleanTypeAnnotation");
27686
27687 case "mixed":
27688 return this.finishNode(node, "MixedTypeAnnotation");
27689
27690 case "empty":
27691 return this.finishNode(node, "EmptyTypeAnnotation");
27692
27693 case "number":
27694 return this.finishNode(node, "NumberTypeAnnotation");
27695
27696 case "string":
27697 return this.finishNode(node, "StringTypeAnnotation");
27698
27699 default:
27700 return this.flowParseGenericType(startPos, startLoc, id);
27701 }
27702 };
27703
27704 _proto.flowParsePrimaryType = function flowParsePrimaryType() {
27705 var startPos = this.state.start;
27706 var startLoc = this.state.startLoc;
27707 var node = this.startNode();
27708 var tmp;
27709 var type;
27710 var isGroupedType = false;
27711 var oldNoAnonFunctionType = this.state.noAnonFunctionType;
27712
27713 switch (this.state.type) {
27714 case types.name:
27715 if (this.isContextual("interface")) {
27716 return this.flowParseInterfaceType();
27717 }
27718
27719 return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier());
27720
27721 case types.braceL:
27722 return this.flowParseObjectType(false, false, true, false);
27723
27724 case types.braceBarL:
27725 return this.flowParseObjectType(false, true, true, false);
27726
27727 case types.bracketL:
27728 return this.flowParseTupleType();
27729
27730 case types.relational:
27731 if (this.state.value === "<") {
27732 node.typeParameters = this.flowParseTypeParameterDeclaration(false);
27733 this.expect(types.parenL);
27734 tmp = this.flowParseFunctionTypeParams();
27735 node.params = tmp.params;
27736 node.rest = tmp.rest;
27737 this.expect(types.parenR);
27738 this.expect(types.arrow);
27739 node.returnType = this.flowParseType();
27740 return this.finishNode(node, "FunctionTypeAnnotation");
27741 }
27742
27743 break;
27744
27745 case types.parenL:
27746 this.next();
27747
27748 if (!this.match(types.parenR) && !this.match(types.ellipsis)) {
27749 if (this.match(types.name)) {
27750 var token = this.lookahead().type;
27751 isGroupedType = token !== types.question && token !== types.colon;
27752 } else {
27753 isGroupedType = true;
27754 }
27755 }
27756
27757 if (isGroupedType) {
27758 this.state.noAnonFunctionType = false;
27759 type = this.flowParseType();
27760 this.state.noAnonFunctionType = oldNoAnonFunctionType;
27761
27762 if (this.state.noAnonFunctionType || !(this.match(types.comma) || this.match(types.parenR) && this.lookahead().type === types.arrow)) {
27763 this.expect(types.parenR);
27764 return type;
27765 } else {
27766 this.eat(types.comma);
27767 }
27768 }
27769
27770 if (type) {
27771 tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
27772 } else {
27773 tmp = this.flowParseFunctionTypeParams();
27774 }
27775
27776 node.params = tmp.params;
27777 node.rest = tmp.rest;
27778 this.expect(types.parenR);
27779 this.expect(types.arrow);
27780 node.returnType = this.flowParseType();
27781 node.typeParameters = null;
27782 return this.finishNode(node, "FunctionTypeAnnotation");
27783
27784 case types.string:
27785 return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
27786
27787 case types._true:
27788 case types._false:
27789 node.value = this.match(types._true);
27790 this.next();
27791 return this.finishNode(node, "BooleanLiteralTypeAnnotation");
27792
27793 case types.plusMin:
27794 if (this.state.value === "-") {
27795 this.next();
27796
27797 if (!this.match(types.num)) {
27798 this.unexpected(null, "Unexpected token, expected \"number\"");
27799 }
27800
27801 return this.parseLiteral(-this.state.value, "NumberLiteralTypeAnnotation", node.start, node.loc.start);
27802 }
27803
27804 this.unexpected();
27805
27806 case types.num:
27807 return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
27808
27809 case types._null:
27810 this.next();
27811 return this.finishNode(node, "NullLiteralTypeAnnotation");
27812
27813 case types._this:
27814 this.next();
27815 return this.finishNode(node, "ThisTypeAnnotation");
27816
27817 case types.star:
27818 this.next();
27819 return this.finishNode(node, "ExistsTypeAnnotation");
27820
27821 default:
27822 if (this.state.type.keyword === "typeof") {
27823 return this.flowParseTypeofType();
27824 }
27825
27826 }
27827
27828 throw this.unexpected();
27829 };
27830
27831 _proto.flowParsePostfixType = function flowParsePostfixType() {
27832 var startPos = this.state.start,
27833 startLoc = this.state.startLoc;
27834 var type = this.flowParsePrimaryType();
27835
27836 while (!this.canInsertSemicolon() && this.match(types.bracketL)) {
27837 var node = this.startNodeAt(startPos, startLoc);
27838 node.elementType = type;
27839 this.expect(types.bracketL);
27840 this.expect(types.bracketR);
27841 type = this.finishNode(node, "ArrayTypeAnnotation");
27842 }
27843
27844 return type;
27845 };
27846
27847 _proto.flowParsePrefixType = function flowParsePrefixType() {
27848 var node = this.startNode();
27849
27850 if (this.eat(types.question)) {
27851 node.typeAnnotation = this.flowParsePrefixType();
27852 return this.finishNode(node, "NullableTypeAnnotation");
27853 } else {
27854 return this.flowParsePostfixType();
27855 }
27856 };
27857
27858 _proto.flowParseAnonFunctionWithoutParens = function flowParseAnonFunctionWithoutParens() {
27859 var param = this.flowParsePrefixType();
27860
27861 if (!this.state.noAnonFunctionType && this.eat(types.arrow)) {
27862 var node = this.startNodeAt(param.start, param.loc.start);
27863 node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
27864 node.rest = null;
27865 node.returnType = this.flowParseType();
27866 node.typeParameters = null;
27867 return this.finishNode(node, "FunctionTypeAnnotation");
27868 }
27869
27870 return param;
27871 };
27872
27873 _proto.flowParseIntersectionType = function flowParseIntersectionType() {
27874 var node = this.startNode();
27875 this.eat(types.bitwiseAND);
27876 var type = this.flowParseAnonFunctionWithoutParens();
27877 node.types = [type];
27878
27879 while (this.eat(types.bitwiseAND)) {
27880 node.types.push(this.flowParseAnonFunctionWithoutParens());
27881 }
27882
27883 return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
27884 };
27885
27886 _proto.flowParseUnionType = function flowParseUnionType() {
27887 var node = this.startNode();
27888 this.eat(types.bitwiseOR);
27889 var type = this.flowParseIntersectionType();
27890 node.types = [type];
27891
27892 while (this.eat(types.bitwiseOR)) {
27893 node.types.push(this.flowParseIntersectionType());
27894 }
27895
27896 return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation");
27897 };
27898
27899 _proto.flowParseType = function flowParseType() {
27900 var oldInType = this.state.inType;
27901 this.state.inType = true;
27902 var type = this.flowParseUnionType();
27903 this.state.inType = oldInType;
27904 this.state.exprAllowed = this.state.exprAllowed || this.state.noAnonFunctionType;
27905 return type;
27906 };
27907
27908 _proto.flowParseTypeAnnotation = function flowParseTypeAnnotation() {
27909 var node = this.startNode();
27910 node.typeAnnotation = this.flowParseTypeInitialiser();
27911 return this.finishNode(node, "TypeAnnotation");
27912 };
27913
27914 _proto.flowParseTypeAnnotatableIdentifier = function flowParseTypeAnnotatableIdentifier(allowPrimitiveOverride) {
27915 var ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier();
27916
27917 if (this.match(types.colon)) {
27918 ident.typeAnnotation = this.flowParseTypeAnnotation();
27919 this.finishNode(ident, ident.type);
27920 }
27921
27922 return ident;
27923 };
27924
27925 _proto.typeCastToParameter = function typeCastToParameter(node) {
27926 node.expression.typeAnnotation = node.typeAnnotation;
27927 return this.finishNodeAt(node.expression, node.expression.type, node.typeAnnotation.end, node.typeAnnotation.loc.end);
27928 };
27929
27930 _proto.flowParseVariance = function flowParseVariance() {
27931 var variance = null;
27932
27933 if (this.match(types.plusMin)) {
27934 variance = this.startNode();
27935
27936 if (this.state.value === "+") {
27937 variance.kind = "plus";
27938 } else {
27939 variance.kind = "minus";
27940 }
27941
27942 this.next();
27943 this.finishNode(variance, "Variance");
27944 }
27945
27946 return variance;
27947 };
27948
27949 _proto.parseFunctionBody = function parseFunctionBody(node, allowExpressionBody) {
27950 var _this3 = this;
27951
27952 if (allowExpressionBody) {
27953 return this.forwardNoArrowParamsConversionAt(node, function () {
27954 return _superClass.prototype.parseFunctionBody.call(_this3, node, true);
27955 });
27956 }
27957
27958 return _superClass.prototype.parseFunctionBody.call(this, node, false);
27959 };
27960
27961 _proto.parseFunctionBodyAndFinish = function parseFunctionBodyAndFinish(node, type, allowExpressionBody) {
27962 if (!allowExpressionBody && this.match(types.colon)) {
27963 var typeNode = this.startNode();
27964
27965 var _this$flowParseTypeAn2 = this.flowParseTypeAndPredicateInitialiser();
27966
27967 typeNode.typeAnnotation = _this$flowParseTypeAn2[0];
27968 node.predicate = _this$flowParseTypeAn2[1];
27969 node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
27970 }
27971
27972 _superClass.prototype.parseFunctionBodyAndFinish.call(this, node, type, allowExpressionBody);
27973 };
27974
27975 _proto.parseStatement = function parseStatement(declaration, topLevel) {
27976 if (this.state.strict && this.match(types.name) && this.state.value === "interface") {
27977 var node = this.startNode();
27978 this.next();
27979 return this.flowParseInterface(node);
27980 } else {
27981 var stmt = _superClass.prototype.parseStatement.call(this, declaration, topLevel);
27982
27983 if (this.flowPragma === undefined && !this.isValidDirective(stmt)) {
27984 this.flowPragma = null;
27985 }
27986
27987 return stmt;
27988 }
27989 };
27990
27991 _proto.parseExpressionStatement = function parseExpressionStatement(node, expr) {
27992 if (expr.type === "Identifier") {
27993 if (expr.name === "declare") {
27994 if (this.match(types._class) || this.match(types.name) || this.match(types._function) || this.match(types._var) || this.match(types._export)) {
27995 return this.flowParseDeclare(node);
27996 }
27997 } else if (this.match(types.name)) {
27998 if (expr.name === "interface") {
27999 return this.flowParseInterface(node);
28000 } else if (expr.name === "type") {
28001 return this.flowParseTypeAlias(node);
28002 } else if (expr.name === "opaque") {
28003 return this.flowParseOpaqueType(node, false);
28004 }
28005 }
28006 }
28007
28008 return _superClass.prototype.parseExpressionStatement.call(this, node, expr);
28009 };
28010
28011 _proto.shouldParseExportDeclaration = function shouldParseExportDeclaration() {
28012 return this.isContextual("type") || this.isContextual("interface") || this.isContextual("opaque") || _superClass.prototype.shouldParseExportDeclaration.call(this);
28013 };
28014
28015 _proto.isExportDefaultSpecifier = function isExportDefaultSpecifier() {
28016 if (this.match(types.name) && (this.state.value === "type" || this.state.value === "interface" || this.state.value == "opaque")) {
28017 return false;
28018 }
28019
28020 return _superClass.prototype.isExportDefaultSpecifier.call(this);
28021 };
28022
28023 _proto.parseConditional = function parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos) {
28024 var _this4 = this;
28025
28026 if (!this.match(types.question)) return expr;
28027
28028 if (refNeedsArrowPos) {
28029 var _state = this.state.clone();
28030
28031 try {
28032 return _superClass.prototype.parseConditional.call(this, expr, noIn, startPos, startLoc);
28033 } catch (err) {
28034 if (err instanceof SyntaxError) {
28035 this.state = _state;
28036 refNeedsArrowPos.start = err.pos || this.state.start;
28037 return expr;
28038 } else {
28039 throw err;
28040 }
28041 }
28042 }
28043
28044 this.expect(types.question);
28045 var state = this.state.clone();
28046 var originalNoArrowAt = this.state.noArrowAt;
28047 var node = this.startNodeAt(startPos, startLoc);
28048
28049 var _this$tryParseConditi = this.tryParseConditionalConsequent(),
28050 consequent = _this$tryParseConditi.consequent,
28051 failed = _this$tryParseConditi.failed;
28052
28053 var _this$getArrowLikeExp = this.getArrowLikeExpressions(consequent),
28054 valid = _this$getArrowLikeExp[0],
28055 invalid = _this$getArrowLikeExp[1];
28056
28057 if (failed || invalid.length > 0) {
28058 var noArrowAt = originalNoArrowAt.concat();
28059
28060 if (invalid.length > 0) {
28061 this.state = state;
28062 this.state.noArrowAt = noArrowAt;
28063
28064 for (var i = 0; i < invalid.length; i++) {
28065 noArrowAt.push(invalid[i].start);
28066 }
28067
28068 var _this$tryParseConditi2 = this.tryParseConditionalConsequent();
28069
28070 consequent = _this$tryParseConditi2.consequent;
28071 failed = _this$tryParseConditi2.failed;
28072
28073 var _this$getArrowLikeExp2 = this.getArrowLikeExpressions(consequent);
28074
28075 valid = _this$getArrowLikeExp2[0];
28076 invalid = _this$getArrowLikeExp2[1];
28077 }
28078
28079 if (failed && valid.length > 1) {
28080 this.raise(state.start, "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.");
28081 }
28082
28083 if (failed && valid.length === 1) {
28084 this.state = state;
28085 this.state.noArrowAt = noArrowAt.concat(valid[0].start);
28086
28087 var _this$tryParseConditi3 = this.tryParseConditionalConsequent();
28088
28089 consequent = _this$tryParseConditi3.consequent;
28090 failed = _this$tryParseConditi3.failed;
28091 }
28092
28093 this.getArrowLikeExpressions(consequent, true);
28094 }
28095
28096 this.state.noArrowAt = originalNoArrowAt;
28097 this.expect(types.colon);
28098 node.test = expr;
28099 node.consequent = consequent;
28100 node.alternate = this.forwardNoArrowParamsConversionAt(node, function () {
28101 return _this4.parseMaybeAssign(noIn, undefined, undefined, undefined);
28102 });
28103 return this.finishNode(node, "ConditionalExpression");
28104 };
28105
28106 _proto.tryParseConditionalConsequent = function tryParseConditionalConsequent() {
28107 this.state.noArrowParamsConversionAt.push(this.state.start);
28108 var consequent = this.parseMaybeAssign();
28109 var failed = !this.match(types.colon);
28110 this.state.noArrowParamsConversionAt.pop();
28111 return {
28112 consequent: consequent,
28113 failed: failed
28114 };
28115 };
28116
28117 _proto.getArrowLikeExpressions = function getArrowLikeExpressions(node, disallowInvalid) {
28118 var _this5 = this;
28119
28120 var stack = [node];
28121 var arrows = [];
28122
28123 while (stack.length !== 0) {
28124 var _node = stack.pop();
28125
28126 if (_node.type === "ArrowFunctionExpression") {
28127 if (_node.typeParameters || !_node.returnType) {
28128 this.toAssignableList(_node.params, true, "arrow function parameters");
28129
28130 _superClass.prototype.checkFunctionNameAndParams.call(this, _node, true);
28131 } else {
28132 arrows.push(_node);
28133 }
28134
28135 stack.push(_node.body);
28136 } else if (_node.type === "ConditionalExpression") {
28137 stack.push(_node.consequent);
28138 stack.push(_node.alternate);
28139 }
28140 }
28141
28142 if (disallowInvalid) {
28143 for (var i = 0; i < arrows.length; i++) {
28144 this.toAssignableList(node.params, true, "arrow function parameters");
28145 }
28146
28147 return [arrows, []];
28148 }
28149
28150 return partition(arrows, function (node) {
28151 try {
28152 _this5.toAssignableList(node.params, true, "arrow function parameters");
28153
28154 return true;
28155 } catch (err) {
28156 return false;
28157 }
28158 });
28159 };
28160
28161 _proto.forwardNoArrowParamsConversionAt = function forwardNoArrowParamsConversionAt(node, parse) {
28162 var result;
28163
28164 if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
28165 this.state.noArrowParamsConversionAt.push(this.state.start);
28166 result = parse();
28167 this.state.noArrowParamsConversionAt.pop();
28168 } else {
28169 result = parse();
28170 }
28171
28172 return result;
28173 };
28174
28175 _proto.parseParenItem = function parseParenItem(node, startPos, startLoc) {
28176 node = _superClass.prototype.parseParenItem.call(this, node, startPos, startLoc);
28177
28178 if (this.eat(types.question)) {
28179 node.optional = true;
28180 }
28181
28182 if (this.match(types.colon)) {
28183 var typeCastNode = this.startNodeAt(startPos, startLoc);
28184 typeCastNode.expression = node;
28185 typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
28186 return this.finishNode(typeCastNode, "TypeCastExpression");
28187 }
28188
28189 return node;
28190 };
28191
28192 _proto.assertModuleNodeAllowed = function assertModuleNodeAllowed(node) {
28193 if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
28194 return;
28195 }
28196
28197 _superClass.prototype.assertModuleNodeAllowed.call(this, node);
28198 };
28199
28200 _proto.parseExport = function parseExport(node) {
28201 node = _superClass.prototype.parseExport.call(this, node);
28202
28203 if (node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration") {
28204 node.exportKind = node.exportKind || "value";
28205 }
28206
28207 return node;
28208 };
28209
28210 _proto.parseExportDeclaration = function parseExportDeclaration(node) {
28211 if (this.isContextual("type")) {
28212 node.exportKind = "type";
28213 var declarationNode = this.startNode();
28214 this.next();
28215
28216 if (this.match(types.braceL)) {
28217 node.specifiers = this.parseExportSpecifiers();
28218 this.parseExportFrom(node);
28219 return null;
28220 } else {
28221 return this.flowParseTypeAlias(declarationNode);
28222 }
28223 } else if (this.isContextual("opaque")) {
28224 node.exportKind = "type";
28225
28226 var _declarationNode = this.startNode();
28227
28228 this.next();
28229 return this.flowParseOpaqueType(_declarationNode, false);
28230 } else if (this.isContextual("interface")) {
28231 node.exportKind = "type";
28232
28233 var _declarationNode2 = this.startNode();
28234
28235 this.next();
28236 return this.flowParseInterface(_declarationNode2);
28237 } else {
28238 return _superClass.prototype.parseExportDeclaration.call(this, node);
28239 }
28240 };
28241
28242 _proto.shouldParseExportStar = function shouldParseExportStar() {
28243 return _superClass.prototype.shouldParseExportStar.call(this) || this.isContextual("type") && this.lookahead().type === types.star;
28244 };
28245
28246 _proto.parseExportStar = function parseExportStar(node) {
28247 if (this.eatContextual("type")) {
28248 node.exportKind = "type";
28249 }
28250
28251 return _superClass.prototype.parseExportStar.call(this, node);
28252 };
28253
28254 _proto.parseExportNamespace = function parseExportNamespace(node) {
28255 if (node.exportKind === "type") {
28256 this.unexpected();
28257 }
28258
28259 return _superClass.prototype.parseExportNamespace.call(this, node);
28260 };
28261
28262 _proto.parseClassId = function parseClassId(node, isStatement, optionalId) {
28263 _superClass.prototype.parseClassId.call(this, node, isStatement, optionalId);
28264
28265 if (this.isRelational("<")) {
28266 node.typeParameters = this.flowParseTypeParameterDeclaration();
28267 }
28268 };
28269
28270 _proto.isKeyword = function isKeyword$$1(name) {
28271 if (this.state.inType && name === "void") {
28272 return false;
28273 } else {
28274 return _superClass.prototype.isKeyword.call(this, name);
28275 }
28276 };
28277
28278 _proto.readToken = function readToken(code) {
28279 var next = this.input.charCodeAt(this.state.pos + 1);
28280
28281 if (this.state.inType && (code === 62 || code === 60)) {
28282 return this.finishOp(types.relational, 1);
28283 } else if (isIteratorStart(code, next)) {
28284 this.state.isIterator = true;
28285 return _superClass.prototype.readWord.call(this);
28286 } else {
28287 return _superClass.prototype.readToken.call(this, code);
28288 }
28289 };
28290
28291 _proto.toAssignable = function toAssignable(node, isBinding, contextDescription) {
28292 if (node.type === "TypeCastExpression") {
28293 return _superClass.prototype.toAssignable.call(this, this.typeCastToParameter(node), isBinding, contextDescription);
28294 } else {
28295 return _superClass.prototype.toAssignable.call(this, node, isBinding, contextDescription);
28296 }
28297 };
28298
28299 _proto.toAssignableList = function toAssignableList(exprList, isBinding, contextDescription) {
28300 for (var i = 0; i < exprList.length; i++) {
28301 var expr = exprList[i];
28302
28303 if (expr && expr.type === "TypeCastExpression") {
28304 exprList[i] = this.typeCastToParameter(expr);
28305 }
28306 }
28307
28308 return _superClass.prototype.toAssignableList.call(this, exprList, isBinding, contextDescription);
28309 };
28310
28311 _proto.toReferencedList = function toReferencedList(exprList) {
28312 for (var i = 0; i < exprList.length; i++) {
28313 var expr = exprList[i];
28314
28315 if (expr && expr._exprListItem && expr.type === "TypeCastExpression") {
28316 this.raise(expr.start, "Unexpected type cast");
28317 }
28318 }
28319
28320 return exprList;
28321 };
28322
28323 _proto.parseExprListItem = function parseExprListItem(allowEmpty, refShorthandDefaultPos, refNeedsArrowPos) {
28324 var container = this.startNode();
28325
28326 var node = _superClass.prototype.parseExprListItem.call(this, allowEmpty, refShorthandDefaultPos, refNeedsArrowPos);
28327
28328 if (this.match(types.colon)) {
28329 container._exprListItem = true;
28330 container.expression = node;
28331 container.typeAnnotation = this.flowParseTypeAnnotation();
28332 return this.finishNode(container, "TypeCastExpression");
28333 } else {
28334 return node;
28335 }
28336 };
28337
28338 _proto.checkLVal = function checkLVal(expr, isBinding, checkClashes, contextDescription) {
28339 if (expr.type !== "TypeCastExpression") {
28340 return _superClass.prototype.checkLVal.call(this, expr, isBinding, checkClashes, contextDescription);
28341 }
28342 };
28343
28344 _proto.parseClassProperty = function parseClassProperty(node) {
28345 if (this.match(types.colon)) {
28346 node.typeAnnotation = this.flowParseTypeAnnotation();
28347 }
28348
28349 return _superClass.prototype.parseClassProperty.call(this, node);
28350 };
28351
28352 _proto.parseClassPrivateProperty = function parseClassPrivateProperty(node) {
28353 if (this.match(types.colon)) {
28354 node.typeAnnotation = this.flowParseTypeAnnotation();
28355 }
28356
28357 return _superClass.prototype.parseClassPrivateProperty.call(this, node);
28358 };
28359
28360 _proto.isClassMethod = function isClassMethod() {
28361 return this.isRelational("<") || _superClass.prototype.isClassMethod.call(this);
28362 };
28363
28364 _proto.isClassProperty = function isClassProperty() {
28365 return this.match(types.colon) || _superClass.prototype.isClassProperty.call(this);
28366 };
28367
28368 _proto.isNonstaticConstructor = function isNonstaticConstructor(method) {
28369 return !this.match(types.colon) && _superClass.prototype.isNonstaticConstructor.call(this, method);
28370 };
28371
28372 _proto.pushClassMethod = function pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor) {
28373 if (method.variance) {
28374 this.unexpected(method.variance.start);
28375 }
28376
28377 delete method.variance;
28378
28379 if (this.isRelational("<")) {
28380 method.typeParameters = this.flowParseTypeParameterDeclaration(false);
28381 }
28382
28383 _superClass.prototype.pushClassMethod.call(this, classBody, method, isGenerator, isAsync, isConstructor);
28384 };
28385
28386 _proto.pushClassPrivateMethod = function pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
28387 if (method.variance) {
28388 this.unexpected(method.variance.start);
28389 }
28390
28391 delete method.variance;
28392
28393 if (this.isRelational("<")) {
28394 method.typeParameters = this.flowParseTypeParameterDeclaration();
28395 }
28396
28397 _superClass.prototype.pushClassPrivateMethod.call(this, classBody, method, isGenerator, isAsync);
28398 };
28399
28400 _proto.parseClassSuper = function parseClassSuper(node) {
28401 _superClass.prototype.parseClassSuper.call(this, node);
28402
28403 if (node.superClass && this.isRelational("<")) {
28404 node.superTypeParameters = this.flowParseTypeParameterInstantiation();
28405 }
28406
28407 if (this.isContextual("implements")) {
28408 this.next();
28409 var implemented = node.implements = [];
28410
28411 do {
28412 var _node2 = this.startNode();
28413
28414 _node2.id = this.flowParseRestrictedIdentifier(true);
28415
28416 if (this.isRelational("<")) {
28417 _node2.typeParameters = this.flowParseTypeParameterInstantiation();
28418 } else {
28419 _node2.typeParameters = null;
28420 }
28421
28422 implemented.push(this.finishNode(_node2, "ClassImplements"));
28423 } while (this.eat(types.comma));
28424 }
28425 };
28426
28427 _proto.parsePropertyName = function parsePropertyName(node) {
28428 var variance = this.flowParseVariance();
28429
28430 var key = _superClass.prototype.parsePropertyName.call(this, node);
28431
28432 node.variance = variance;
28433 return key;
28434 };
28435
28436 _proto.parseObjPropValue = function parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos, containsEsc) {
28437 if (prop.variance) {
28438 this.unexpected(prop.variance.start);
28439 }
28440
28441 delete prop.variance;
28442 var typeParameters;
28443
28444 if (this.isRelational("<")) {
28445 typeParameters = this.flowParseTypeParameterDeclaration(false);
28446 if (!this.match(types.parenL)) this.unexpected();
28447 }
28448
28449 _superClass.prototype.parseObjPropValue.call(this, prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos, containsEsc);
28450
28451 if (typeParameters) {
28452 (prop.value || prop).typeParameters = typeParameters;
28453 }
28454 };
28455
28456 _proto.parseAssignableListItemTypes = function parseAssignableListItemTypes(param) {
28457 if (this.eat(types.question)) {
28458 if (param.type !== "Identifier") {
28459 throw this.raise(param.start, "A binding pattern parameter cannot be optional in an implementation signature.");
28460 }
28461
28462 param.optional = true;
28463 }
28464
28465 if (this.match(types.colon)) {
28466 param.typeAnnotation = this.flowParseTypeAnnotation();
28467 }
28468
28469 this.finishNode(param, param.type);
28470 return param;
28471 };
28472
28473 _proto.parseMaybeDefault = function parseMaybeDefault(startPos, startLoc, left) {
28474 var node = _superClass.prototype.parseMaybeDefault.call(this, startPos, startLoc, left);
28475
28476 if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
28477 this.raise(node.typeAnnotation.start, "Type annotations must come before default assignments, " + "e.g. instead of `age = 25: number` use `age: number = 25`");
28478 }
28479
28480 return node;
28481 };
28482
28483 _proto.shouldParseDefaultImport = function shouldParseDefaultImport(node) {
28484 if (!hasTypeImportKind(node)) {
28485 return _superClass.prototype.shouldParseDefaultImport.call(this, node);
28486 }
28487
28488 return isMaybeDefaultImport(this.state);
28489 };
28490
28491 _proto.parseImportSpecifierLocal = function parseImportSpecifierLocal(node, specifier, type, contextDescription) {
28492 specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true) : this.parseIdentifier();
28493 this.checkLVal(specifier.local, true, undefined, contextDescription);
28494 node.specifiers.push(this.finishNode(specifier, type));
28495 };
28496
28497 _proto.parseImportSpecifiers = function parseImportSpecifiers(node) {
28498 node.importKind = "value";
28499 var kind = null;
28500
28501 if (this.match(types._typeof)) {
28502 kind = "typeof";
28503 } else if (this.isContextual("type")) {
28504 kind = "type";
28505 }
28506
28507 if (kind) {
28508 var lh = this.lookahead();
28509
28510 if (kind === "type" && lh.type === types.star) {
28511 this.unexpected(lh.start);
28512 }
28513
28514 if (isMaybeDefaultImport(lh) || lh.type === types.braceL || lh.type === types.star) {
28515 this.next();
28516 node.importKind = kind;
28517 }
28518 }
28519
28520 _superClass.prototype.parseImportSpecifiers.call(this, node);
28521 };
28522
28523 _proto.parseImportSpecifier = function parseImportSpecifier(node) {
28524 var specifier = this.startNode();
28525 var firstIdentLoc = this.state.start;
28526 var firstIdent = this.parseIdentifier(true);
28527 var specifierTypeKind = null;
28528
28529 if (firstIdent.name === "type") {
28530 specifierTypeKind = "type";
28531 } else if (firstIdent.name === "typeof") {
28532 specifierTypeKind = "typeof";
28533 }
28534
28535 var isBinding = false;
28536
28537 if (this.isContextual("as") && !this.isLookaheadContextual("as")) {
28538 var as_ident = this.parseIdentifier(true);
28539
28540 if (specifierTypeKind !== null && !this.match(types.name) && !this.state.type.keyword) {
28541 specifier.imported = as_ident;
28542 specifier.importKind = specifierTypeKind;
28543 specifier.local = as_ident.__clone();
28544 } else {
28545 specifier.imported = firstIdent;
28546 specifier.importKind = null;
28547 specifier.local = this.parseIdentifier();
28548 }
28549 } else if (specifierTypeKind !== null && (this.match(types.name) || this.state.type.keyword)) {
28550 specifier.imported = this.parseIdentifier(true);
28551 specifier.importKind = specifierTypeKind;
28552
28553 if (this.eatContextual("as")) {
28554 specifier.local = this.parseIdentifier();
28555 } else {
28556 isBinding = true;
28557 specifier.local = specifier.imported.__clone();
28558 }
28559 } else {
28560 isBinding = true;
28561 specifier.imported = firstIdent;
28562 specifier.importKind = null;
28563 specifier.local = specifier.imported.__clone();
28564 }
28565
28566 var nodeIsTypeImport = hasTypeImportKind(node);
28567 var specifierIsTypeImport = hasTypeImportKind(specifier);
28568
28569 if (nodeIsTypeImport && specifierIsTypeImport) {
28570 this.raise(firstIdentLoc, "The `type` and `typeof` keywords on named imports can only be used on regular " + "`import` statements. It cannot be used with `import type` or `import typeof` statements");
28571 }
28572
28573 if (nodeIsTypeImport || specifierIsTypeImport) {
28574 this.checkReservedType(specifier.local.name, specifier.local.start);
28575 }
28576
28577 if (isBinding && !nodeIsTypeImport && !specifierIsTypeImport) {
28578 this.checkReservedWord(specifier.local.name, specifier.start, true, true);
28579 }
28580
28581 this.checkLVal(specifier.local, true, undefined, "import specifier");
28582 node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
28583 };
28584
28585 _proto.parseFunctionParams = function parseFunctionParams(node) {
28586 var kind = node.kind;
28587
28588 if (kind !== "get" && kind !== "set" && this.isRelational("<")) {
28589 node.typeParameters = this.flowParseTypeParameterDeclaration(false);
28590 }
28591
28592 _superClass.prototype.parseFunctionParams.call(this, node);
28593 };
28594
28595 _proto.parseVarHead = function parseVarHead(decl) {
28596 _superClass.prototype.parseVarHead.call(this, decl);
28597
28598 if (this.match(types.colon)) {
28599 decl.id.typeAnnotation = this.flowParseTypeAnnotation();
28600 this.finishNode(decl.id, decl.id.type);
28601 }
28602 };
28603
28604 _proto.parseAsyncArrowFromCallExpression = function parseAsyncArrowFromCallExpression(node, call) {
28605 if (this.match(types.colon)) {
28606 var oldNoAnonFunctionType = this.state.noAnonFunctionType;
28607 this.state.noAnonFunctionType = true;
28608 node.returnType = this.flowParseTypeAnnotation();
28609 this.state.noAnonFunctionType = oldNoAnonFunctionType;
28610 }
28611
28612 return _superClass.prototype.parseAsyncArrowFromCallExpression.call(this, node, call);
28613 };
28614
28615 _proto.shouldParseAsyncArrow = function shouldParseAsyncArrow() {
28616 return this.match(types.colon) || _superClass.prototype.shouldParseAsyncArrow.call(this);
28617 };
28618
28619 _proto.parseMaybeAssign = function parseMaybeAssign(noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos) {
28620 var _this6 = this;
28621
28622 var jsxError = null;
28623
28624 if (types.jsxTagStart && this.match(types.jsxTagStart)) {
28625 var state = this.state.clone();
28626
28627 try {
28628 return _superClass.prototype.parseMaybeAssign.call(this, noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos);
28629 } catch (err) {
28630 if (err instanceof SyntaxError) {
28631 this.state = state;
28632 this.state.context.length -= 2;
28633 jsxError = err;
28634 } else {
28635 throw err;
28636 }
28637 }
28638 }
28639
28640 if (jsxError != null || this.isRelational("<")) {
28641 var arrowExpression;
28642 var typeParameters;
28643
28644 try {
28645 typeParameters = this.flowParseTypeParameterDeclaration();
28646 arrowExpression = this.forwardNoArrowParamsConversionAt(typeParameters, function () {
28647 return _superClass.prototype.parseMaybeAssign.call(_this6, noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos);
28648 });
28649 arrowExpression.typeParameters = typeParameters;
28650 this.resetStartLocationFromNode(arrowExpression, typeParameters);
28651 } catch (err) {
28652 throw jsxError || err;
28653 }
28654
28655 if (arrowExpression.type === "ArrowFunctionExpression") {
28656 return arrowExpression;
28657 } else if (jsxError != null) {
28658 throw jsxError;
28659 } else {
28660 this.raise(typeParameters.start, "Expected an arrow function after this type parameter declaration");
28661 }
28662 }
28663
28664 return _superClass.prototype.parseMaybeAssign.call(this, noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos);
28665 };
28666
28667 _proto.parseArrow = function parseArrow(node) {
28668 if (this.match(types.colon)) {
28669 var state = this.state.clone();
28670
28671 try {
28672 var oldNoAnonFunctionType = this.state.noAnonFunctionType;
28673 this.state.noAnonFunctionType = true;
28674 var typeNode = this.startNode();
28675
28676 var _this$flowParseTypeAn3 = this.flowParseTypeAndPredicateInitialiser();
28677
28678 typeNode.typeAnnotation = _this$flowParseTypeAn3[0];
28679 node.predicate = _this$flowParseTypeAn3[1];
28680 this.state.noAnonFunctionType = oldNoAnonFunctionType;
28681 if (this.canInsertSemicolon()) this.unexpected();
28682 if (!this.match(types.arrow)) this.unexpected();
28683 node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
28684 } catch (err) {
28685 if (err instanceof SyntaxError) {
28686 this.state = state;
28687 } else {
28688 throw err;
28689 }
28690 }
28691 }
28692
28693 return _superClass.prototype.parseArrow.call(this, node);
28694 };
28695
28696 _proto.shouldParseArrow = function shouldParseArrow() {
28697 return this.match(types.colon) || _superClass.prototype.shouldParseArrow.call(this);
28698 };
28699
28700 _proto.setArrowFunctionParameters = function setArrowFunctionParameters(node, params) {
28701 if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
28702 node.params = params;
28703 } else {
28704 _superClass.prototype.setArrowFunctionParameters.call(this, node, params);
28705 }
28706 };
28707
28708 _proto.checkFunctionNameAndParams = function checkFunctionNameAndParams(node, isArrowFunction) {
28709 if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
28710 return;
28711 }
28712
28713 return _superClass.prototype.checkFunctionNameAndParams.call(this, node, isArrowFunction);
28714 };
28715
28716 _proto.parseParenAndDistinguishExpression = function parseParenAndDistinguishExpression(canBeArrow) {
28717 return _superClass.prototype.parseParenAndDistinguishExpression.call(this, canBeArrow && this.state.noArrowAt.indexOf(this.state.start) === -1);
28718 };
28719
28720 _proto.parseSubscripts = function parseSubscripts(base, startPos, startLoc, noCalls) {
28721 if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.indexOf(startPos) !== -1) {
28722 this.next();
28723 var node = this.startNodeAt(startPos, startLoc);
28724 node.callee = base;
28725 node.arguments = this.parseCallExpressionArguments(types.parenR, false);
28726 base = this.finishNode(node, "CallExpression");
28727 } else if (base.type === "Identifier" && base.name === "async" && this.isRelational("<")) {
28728 var state = this.state.clone();
28729 var error;
28730
28731 try {
28732 var _node3 = this.parseAsyncArrowWithTypeParameters(startPos, startLoc);
28733
28734 if (_node3) return _node3;
28735 } catch (e) {
28736 error = e;
28737 }
28738
28739 this.state = state;
28740
28741 try {
28742 return _superClass.prototype.parseSubscripts.call(this, base, startPos, startLoc, noCalls);
28743 } catch (e) {
28744 throw error || e;
28745 }
28746 }
28747
28748 return _superClass.prototype.parseSubscripts.call(this, base, startPos, startLoc, noCalls);
28749 };
28750
28751 _proto.parseSubscript = function parseSubscript(base, startPos, startLoc, noCalls, subscriptState) {
28752 if (this.match(types.questionDot) && this.isLookaheadRelational("<")) {
28753 this.expectPlugin("optionalChaining");
28754 subscriptState.optionalChainMember = true;
28755
28756 if (noCalls) {
28757 subscriptState.stop = true;
28758 return base;
28759 }
28760
28761 this.next();
28762 var node = this.startNodeAt(startPos, startLoc);
28763 node.callee = base;
28764 node.typeArguments = this.flowParseTypeParameterInstantiation();
28765 this.expect(types.parenL);
28766 node.arguments = this.parseCallExpressionArguments(types.parenR, false);
28767 node.optional = true;
28768 return this.finishNode(node, "OptionalCallExpression");
28769 } else if (!noCalls && this.shouldParseTypes() && this.isRelational("<")) {
28770 var _node4 = this.startNodeAt(startPos, startLoc);
28771
28772 _node4.callee = base;
28773 var state = this.state.clone();
28774
28775 try {
28776 _node4.typeArguments = this.flowParseTypeParameterInstantiation();
28777 this.expect(types.parenL);
28778 _node4.arguments = this.parseCallExpressionArguments(types.parenR, false);
28779
28780 if (subscriptState.optionalChainMember) {
28781 _node4.optional = false;
28782 return this.finishNode(_node4, "OptionalCallExpression");
28783 }
28784
28785 return this.finishNode(_node4, "CallExpression");
28786 } catch (e) {
28787 if (e instanceof SyntaxError) {
28788 this.state = state;
28789 } else {
28790 throw e;
28791 }
28792 }
28793 }
28794
28795 return _superClass.prototype.parseSubscript.call(this, base, startPos, startLoc, noCalls, subscriptState);
28796 };
28797
28798 _proto.parseNewArguments = function parseNewArguments(node) {
28799 var targs = null;
28800
28801 if (this.shouldParseTypes() && this.isRelational("<")) {
28802 var state = this.state.clone();
28803
28804 try {
28805 targs = this.flowParseTypeParameterInstantiation();
28806 } catch (e) {
28807 if (e instanceof SyntaxError) {
28808 this.state = state;
28809 } else {
28810 throw e;
28811 }
28812 }
28813 }
28814
28815 node.typeArguments = targs;
28816
28817 _superClass.prototype.parseNewArguments.call(this, node);
28818 };
28819
28820 _proto.parseAsyncArrowWithTypeParameters = function parseAsyncArrowWithTypeParameters(startPos, startLoc) {
28821 var node = this.startNodeAt(startPos, startLoc);
28822 this.parseFunctionParams(node);
28823 if (!this.parseArrow(node)) return;
28824 return this.parseArrowExpression(node, undefined, true);
28825 };
28826
28827 _proto.readToken_mult_modulo = function readToken_mult_modulo(code) {
28828 var next = this.input.charCodeAt(this.state.pos + 1);
28829
28830 if (code === 42 && next === 47 && this.state.hasFlowComment) {
28831 this.state.hasFlowComment = false;
28832 this.state.pos += 2;
28833 this.nextToken();
28834 return;
28835 }
28836
28837 _superClass.prototype.readToken_mult_modulo.call(this, code);
28838 };
28839
28840 _proto.skipBlockComment = function skipBlockComment() {
28841 if (this.hasPlugin("flow") && this.hasPlugin("flowComments") && this.skipFlowComment()) {
28842 this.hasFlowCommentCompletion();
28843 this.state.pos += this.skipFlowComment();
28844 this.state.hasFlowComment = true;
28845 return;
28846 }
28847
28848 var end;
28849
28850 if (this.hasPlugin("flow") && this.state.hasFlowComment) {
28851 end = this.input.indexOf("*-/", this.state.pos += 2);
28852 if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment");
28853 this.state.pos = end + 3;
28854 return;
28855 }
28856
28857 _superClass.prototype.skipBlockComment.call(this);
28858 };
28859
28860 _proto.skipFlowComment = function skipFlowComment() {
28861 var ch2 = this.input.charCodeAt(this.state.pos + 2);
28862 var ch3 = this.input.charCodeAt(this.state.pos + 3);
28863
28864 if (ch2 === 58 && ch3 === 58) {
28865 return 4;
28866 }
28867
28868 if (this.input.slice(this.state.pos + 2, 14) === "flow-include") {
28869 return 14;
28870 }
28871
28872 if (ch2 === 58 && ch3 !== 58) {
28873 return 2;
28874 }
28875
28876 return false;
28877 };
28878
28879 _proto.hasFlowCommentCompletion = function hasFlowCommentCompletion() {
28880 var end = this.input.indexOf("*/", this.state.pos);
28881
28882 if (end === -1) {
28883 this.raise(this.state.pos, "Unterminated comment");
28884 }
28885 };
28886
28887 return _class;
28888 }(superClass);
28889});
28890
28891var entities = {
28892 quot: "\"",
28893 amp: "&",
28894 apos: "'",
28895 lt: "<",
28896 gt: ">",
28897 nbsp: "\xA0",
28898 iexcl: "\xA1",
28899 cent: "\xA2",
28900 pound: "\xA3",
28901 curren: "\xA4",
28902 yen: "\xA5",
28903 brvbar: "\xA6",
28904 sect: "\xA7",
28905 uml: "\xA8",
28906 copy: "\xA9",
28907 ordf: "\xAA",
28908 laquo: "\xAB",
28909 not: "\xAC",
28910 shy: "\xAD",
28911 reg: "\xAE",
28912 macr: "\xAF",
28913 deg: "\xB0",
28914 plusmn: "\xB1",
28915 sup2: "\xB2",
28916 sup3: "\xB3",
28917 acute: "\xB4",
28918 micro: "\xB5",
28919 para: "\xB6",
28920 middot: "\xB7",
28921 cedil: "\xB8",
28922 sup1: "\xB9",
28923 ordm: "\xBA",
28924 raquo: "\xBB",
28925 frac14: "\xBC",
28926 frac12: "\xBD",
28927 frac34: "\xBE",
28928 iquest: "\xBF",
28929 Agrave: "\xC0",
28930 Aacute: "\xC1",
28931 Acirc: "\xC2",
28932 Atilde: "\xC3",
28933 Auml: "\xC4",
28934 Aring: "\xC5",
28935 AElig: "\xC6",
28936 Ccedil: "\xC7",
28937 Egrave: "\xC8",
28938 Eacute: "\xC9",
28939 Ecirc: "\xCA",
28940 Euml: "\xCB",
28941 Igrave: "\xCC",
28942 Iacute: "\xCD",
28943 Icirc: "\xCE",
28944 Iuml: "\xCF",
28945 ETH: "\xD0",
28946 Ntilde: "\xD1",
28947 Ograve: "\xD2",
28948 Oacute: "\xD3",
28949 Ocirc: "\xD4",
28950 Otilde: "\xD5",
28951 Ouml: "\xD6",
28952 times: "\xD7",
28953 Oslash: "\xD8",
28954 Ugrave: "\xD9",
28955 Uacute: "\xDA",
28956 Ucirc: "\xDB",
28957 Uuml: "\xDC",
28958 Yacute: "\xDD",
28959 THORN: "\xDE",
28960 szlig: "\xDF",
28961 agrave: "\xE0",
28962 aacute: "\xE1",
28963 acirc: "\xE2",
28964 atilde: "\xE3",
28965 auml: "\xE4",
28966 aring: "\xE5",
28967 aelig: "\xE6",
28968 ccedil: "\xE7",
28969 egrave: "\xE8",
28970 eacute: "\xE9",
28971 ecirc: "\xEA",
28972 euml: "\xEB",
28973 igrave: "\xEC",
28974 iacute: "\xED",
28975 icirc: "\xEE",
28976 iuml: "\xEF",
28977 eth: "\xF0",
28978 ntilde: "\xF1",
28979 ograve: "\xF2",
28980 oacute: "\xF3",
28981 ocirc: "\xF4",
28982 otilde: "\xF5",
28983 ouml: "\xF6",
28984 divide: "\xF7",
28985 oslash: "\xF8",
28986 ugrave: "\xF9",
28987 uacute: "\xFA",
28988 ucirc: "\xFB",
28989 uuml: "\xFC",
28990 yacute: "\xFD",
28991 thorn: "\xFE",
28992 yuml: "\xFF",
28993 OElig: "\u0152",
28994 oelig: "\u0153",
28995 Scaron: "\u0160",
28996 scaron: "\u0161",
28997 Yuml: "\u0178",
28998 fnof: "\u0192",
28999 circ: "\u02C6",
29000 tilde: "\u02DC",
29001 Alpha: "\u0391",
29002 Beta: "\u0392",
29003 Gamma: "\u0393",
29004 Delta: "\u0394",
29005 Epsilon: "\u0395",
29006 Zeta: "\u0396",
29007 Eta: "\u0397",
29008 Theta: "\u0398",
29009 Iota: "\u0399",
29010 Kappa: "\u039A",
29011 Lambda: "\u039B",
29012 Mu: "\u039C",
29013 Nu: "\u039D",
29014 Xi: "\u039E",
29015 Omicron: "\u039F",
29016 Pi: "\u03A0",
29017 Rho: "\u03A1",
29018 Sigma: "\u03A3",
29019 Tau: "\u03A4",
29020 Upsilon: "\u03A5",
29021 Phi: "\u03A6",
29022 Chi: "\u03A7",
29023 Psi: "\u03A8",
29024 Omega: "\u03A9",
29025 alpha: "\u03B1",
29026 beta: "\u03B2",
29027 gamma: "\u03B3",
29028 delta: "\u03B4",
29029 epsilon: "\u03B5",
29030 zeta: "\u03B6",
29031 eta: "\u03B7",
29032 theta: "\u03B8",
29033 iota: "\u03B9",
29034 kappa: "\u03BA",
29035 lambda: "\u03BB",
29036 mu: "\u03BC",
29037 nu: "\u03BD",
29038 xi: "\u03BE",
29039 omicron: "\u03BF",
29040 pi: "\u03C0",
29041 rho: "\u03C1",
29042 sigmaf: "\u03C2",
29043 sigma: "\u03C3",
29044 tau: "\u03C4",
29045 upsilon: "\u03C5",
29046 phi: "\u03C6",
29047 chi: "\u03C7",
29048 psi: "\u03C8",
29049 omega: "\u03C9",
29050 thetasym: "\u03D1",
29051 upsih: "\u03D2",
29052 piv: "\u03D6",
29053 ensp: "\u2002",
29054 emsp: "\u2003",
29055 thinsp: "\u2009",
29056 zwnj: "\u200C",
29057 zwj: "\u200D",
29058 lrm: "\u200E",
29059 rlm: "\u200F",
29060 ndash: "\u2013",
29061 mdash: "\u2014",
29062 lsquo: "\u2018",
29063 rsquo: "\u2019",
29064 sbquo: "\u201A",
29065 ldquo: "\u201C",
29066 rdquo: "\u201D",
29067 bdquo: "\u201E",
29068 dagger: "\u2020",
29069 Dagger: "\u2021",
29070 bull: "\u2022",
29071 hellip: "\u2026",
29072 permil: "\u2030",
29073 prime: "\u2032",
29074 Prime: "\u2033",
29075 lsaquo: "\u2039",
29076 rsaquo: "\u203A",
29077 oline: "\u203E",
29078 frasl: "\u2044",
29079 euro: "\u20AC",
29080 image: "\u2111",
29081 weierp: "\u2118",
29082 real: "\u211C",
29083 trade: "\u2122",
29084 alefsym: "\u2135",
29085 larr: "\u2190",
29086 uarr: "\u2191",
29087 rarr: "\u2192",
29088 darr: "\u2193",
29089 harr: "\u2194",
29090 crarr: "\u21B5",
29091 lArr: "\u21D0",
29092 uArr: "\u21D1",
29093 rArr: "\u21D2",
29094 dArr: "\u21D3",
29095 hArr: "\u21D4",
29096 forall: "\u2200",
29097 part: "\u2202",
29098 exist: "\u2203",
29099 empty: "\u2205",
29100 nabla: "\u2207",
29101 isin: "\u2208",
29102 notin: "\u2209",
29103 ni: "\u220B",
29104 prod: "\u220F",
29105 sum: "\u2211",
29106 minus: "\u2212",
29107 lowast: "\u2217",
29108 radic: "\u221A",
29109 prop: "\u221D",
29110 infin: "\u221E",
29111 ang: "\u2220",
29112 and: "\u2227",
29113 or: "\u2228",
29114 cap: "\u2229",
29115 cup: "\u222A",
29116 int: "\u222B",
29117 there4: "\u2234",
29118 sim: "\u223C",
29119 cong: "\u2245",
29120 asymp: "\u2248",
29121 ne: "\u2260",
29122 equiv: "\u2261",
29123 le: "\u2264",
29124 ge: "\u2265",
29125 sub: "\u2282",
29126 sup: "\u2283",
29127 nsub: "\u2284",
29128 sube: "\u2286",
29129 supe: "\u2287",
29130 oplus: "\u2295",
29131 otimes: "\u2297",
29132 perp: "\u22A5",
29133 sdot: "\u22C5",
29134 lceil: "\u2308",
29135 rceil: "\u2309",
29136 lfloor: "\u230A",
29137 rfloor: "\u230B",
29138 lang: "\u2329",
29139 rang: "\u232A",
29140 loz: "\u25CA",
29141 spades: "\u2660",
29142 clubs: "\u2663",
29143 hearts: "\u2665",
29144 diams: "\u2666"
29145};
29146
29147var lineBreak = /\r\n?|\n|\u2028|\u2029/;
29148var lineBreakG = new RegExp(lineBreak.source, "g");
29149function isNewLine(code) {
29150 switch (code) {
29151 case 10:
29152 case 13:
29153 case 8232:
29154 case 8233:
29155 return true;
29156
29157 default:
29158 return false;
29159 }
29160}
29161function isWhitespace(code) {
29162 switch (code) {
29163 case 0x0009:
29164 case 0x000b:
29165 case 0x000c:
29166 case 32:
29167 case 160:
29168 case 5760:
29169 case 0x2000:
29170 case 0x2001:
29171 case 0x2002:
29172 case 0x2003:
29173 case 0x2004:
29174 case 0x2005:
29175 case 0x2006:
29176 case 0x2007:
29177 case 0x2008:
29178 case 0x2009:
29179 case 0x200a:
29180 case 0x202f:
29181 case 0x205f:
29182 case 0x3000:
29183 case 0xfeff:
29184 return true;
29185
29186 default:
29187 return false;
29188 }
29189}
29190
29191var TokContext = function TokContext(token, isExpr, preserveSpace, override) {
29192 this.token = token;
29193 this.isExpr = !!isExpr;
29194 this.preserveSpace = !!preserveSpace;
29195 this.override = override;
29196};
29197var types$1 = {
29198 braceStatement: new TokContext("{", false),
29199 braceExpression: new TokContext("{", true),
29200 templateQuasi: new TokContext("${", true),
29201 parenStatement: new TokContext("(", false),
29202 parenExpression: new TokContext("(", true),
29203 template: new TokContext("`", true, true, function (p) {
29204 return p.readTmplToken();
29205 }),
29206 functionExpression: new TokContext("function", true)
29207};
29208
29209types.parenR.updateContext = types.braceR.updateContext = function () {
29210 if (this.state.context.length === 1) {
29211 this.state.exprAllowed = true;
29212 return;
29213 }
29214
29215 var out = this.state.context.pop();
29216
29217 if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) {
29218 this.state.context.pop();
29219 this.state.exprAllowed = false;
29220 } else if (out === types$1.templateQuasi) {
29221 this.state.exprAllowed = true;
29222 } else {
29223 this.state.exprAllowed = !out.isExpr;
29224 }
29225};
29226
29227types.name.updateContext = function (prevType) {
29228 if (this.state.value === "of" && this.curContext() === types$1.parenStatement) {
29229 this.state.exprAllowed = !prevType.beforeExpr;
29230 return;
29231 }
29232
29233 this.state.exprAllowed = false;
29234
29235 if (prevType === types._let || prevType === types._const || prevType === types._var) {
29236 if (lineBreak.test(this.input.slice(this.state.end))) {
29237 this.state.exprAllowed = true;
29238 }
29239 }
29240
29241 if (this.state.isIterator) {
29242 this.state.isIterator = false;
29243 }
29244};
29245
29246types.braceL.updateContext = function (prevType) {
29247 this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression);
29248 this.state.exprAllowed = true;
29249};
29250
29251types.dollarBraceL.updateContext = function () {
29252 this.state.context.push(types$1.templateQuasi);
29253 this.state.exprAllowed = true;
29254};
29255
29256types.parenL.updateContext = function (prevType) {
29257 var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
29258 this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression);
29259 this.state.exprAllowed = true;
29260};
29261
29262types.incDec.updateContext = function () {};
29263
29264types._function.updateContext = function (prevType) {
29265 if (this.state.exprAllowed && !this.braceIsBlock(prevType)) {
29266 this.state.context.push(types$1.functionExpression);
29267 }
29268
29269 this.state.exprAllowed = false;
29270};
29271
29272types.backQuote.updateContext = function () {
29273 if (this.curContext() === types$1.template) {
29274 this.state.context.pop();
29275 } else {
29276 this.state.context.push(types$1.template);
29277 }
29278
29279 this.state.exprAllowed = false;
29280};
29281
29282var HEX_NUMBER = /^[\da-fA-F]+$/;
29283var DECIMAL_NUMBER = /^\d+$/;
29284types$1.j_oTag = new TokContext("<tag", false);
29285types$1.j_cTag = new TokContext("</tag", false);
29286types$1.j_expr = new TokContext("<tag>...</tag>", true, true);
29287types.jsxName = new TokenType("jsxName");
29288types.jsxText = new TokenType("jsxText", {
29289 beforeExpr: true
29290});
29291types.jsxTagStart = new TokenType("jsxTagStart", {
29292 startsExpr: true
29293});
29294types.jsxTagEnd = new TokenType("jsxTagEnd");
29295
29296types.jsxTagStart.updateContext = function () {
29297 this.state.context.push(types$1.j_expr);
29298 this.state.context.push(types$1.j_oTag);
29299 this.state.exprAllowed = false;
29300};
29301
29302types.jsxTagEnd.updateContext = function (prevType) {
29303 var out = this.state.context.pop();
29304
29305 if (out === types$1.j_oTag && prevType === types.slash || out === types$1.j_cTag) {
29306 this.state.context.pop();
29307 this.state.exprAllowed = this.curContext() === types$1.j_expr;
29308 } else {
29309 this.state.exprAllowed = true;
29310 }
29311};
29312
29313function isFragment(object) {
29314 return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
29315}
29316
29317function getQualifiedJSXName(object) {
29318 if (object.type === "JSXIdentifier") {
29319 return object.name;
29320 }
29321
29322 if (object.type === "JSXNamespacedName") {
29323 return object.namespace.name + ":" + object.name.name;
29324 }
29325
29326 if (object.type === "JSXMemberExpression") {
29327 return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
29328 }
29329
29330 throw new Error("Node had unexpected type: " + object.type);
29331}
29332
29333var jsx = (function (superClass) {
29334 return function (_superClass) {
29335 _inheritsLoose(_class, _superClass);
29336
29337 function _class() {
29338 return _superClass.apply(this, arguments) || this;
29339 }
29340
29341 var _proto = _class.prototype;
29342
29343 _proto.jsxReadToken = function jsxReadToken() {
29344 var out = "";
29345 var chunkStart = this.state.pos;
29346
29347 for (;;) {
29348 if (this.state.pos >= this.input.length) {
29349 this.raise(this.state.start, "Unterminated JSX contents");
29350 }
29351
29352 var ch = this.input.charCodeAt(this.state.pos);
29353
29354 switch (ch) {
29355 case 60:
29356 case 123:
29357 if (this.state.pos === this.state.start) {
29358 if (ch === 60 && this.state.exprAllowed) {
29359 ++this.state.pos;
29360 return this.finishToken(types.jsxTagStart);
29361 }
29362
29363 return this.getTokenFromCode(ch);
29364 }
29365
29366 out += this.input.slice(chunkStart, this.state.pos);
29367 return this.finishToken(types.jsxText, out);
29368
29369 case 38:
29370 out += this.input.slice(chunkStart, this.state.pos);
29371 out += this.jsxReadEntity();
29372 chunkStart = this.state.pos;
29373 break;
29374
29375 default:
29376 if (isNewLine(ch)) {
29377 out += this.input.slice(chunkStart, this.state.pos);
29378 out += this.jsxReadNewLine(true);
29379 chunkStart = this.state.pos;
29380 } else {
29381 ++this.state.pos;
29382 }
29383
29384 }
29385 }
29386 };
29387
29388 _proto.jsxReadNewLine = function jsxReadNewLine(normalizeCRLF) {
29389 var ch = this.input.charCodeAt(this.state.pos);
29390 var out;
29391 ++this.state.pos;
29392
29393 if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
29394 ++this.state.pos;
29395 out = normalizeCRLF ? "\n" : "\r\n";
29396 } else {
29397 out = String.fromCharCode(ch);
29398 }
29399
29400 ++this.state.curLine;
29401 this.state.lineStart = this.state.pos;
29402 return out;
29403 };
29404
29405 _proto.jsxReadString = function jsxReadString(quote) {
29406 var out = "";
29407 var chunkStart = ++this.state.pos;
29408
29409 for (;;) {
29410 if (this.state.pos >= this.input.length) {
29411 this.raise(this.state.start, "Unterminated string constant");
29412 }
29413
29414 var ch = this.input.charCodeAt(this.state.pos);
29415 if (ch === quote) break;
29416
29417 if (ch === 38) {
29418 out += this.input.slice(chunkStart, this.state.pos);
29419 out += this.jsxReadEntity();
29420 chunkStart = this.state.pos;
29421 } else if (isNewLine(ch)) {
29422 out += this.input.slice(chunkStart, this.state.pos);
29423 out += this.jsxReadNewLine(false);
29424 chunkStart = this.state.pos;
29425 } else {
29426 ++this.state.pos;
29427 }
29428 }
29429
29430 out += this.input.slice(chunkStart, this.state.pos++);
29431 return this.finishToken(types.string, out);
29432 };
29433
29434 _proto.jsxReadEntity = function jsxReadEntity() {
29435 var str = "";
29436 var count = 0;
29437 var entity;
29438 var ch = this.input[this.state.pos];
29439 var startPos = ++this.state.pos;
29440
29441 while (this.state.pos < this.input.length && count++ < 10) {
29442 ch = this.input[this.state.pos++];
29443
29444 if (ch === ";") {
29445 if (str[0] === "#") {
29446 if (str[1] === "x") {
29447 str = str.substr(2);
29448
29449 if (HEX_NUMBER.test(str)) {
29450 entity = String.fromCodePoint(parseInt(str, 16));
29451 }
29452 } else {
29453 str = str.substr(1);
29454
29455 if (DECIMAL_NUMBER.test(str)) {
29456 entity = String.fromCodePoint(parseInt(str, 10));
29457 }
29458 }
29459 } else {
29460 entity = entities[str];
29461 }
29462
29463 break;
29464 }
29465
29466 str += ch;
29467 }
29468
29469 if (!entity) {
29470 this.state.pos = startPos;
29471 return "&";
29472 }
29473
29474 return entity;
29475 };
29476
29477 _proto.jsxReadWord = function jsxReadWord() {
29478 var ch;
29479 var start = this.state.pos;
29480
29481 do {
29482 ch = this.input.charCodeAt(++this.state.pos);
29483 } while (isIdentifierChar(ch) || ch === 45);
29484
29485 return this.finishToken(types.jsxName, this.input.slice(start, this.state.pos));
29486 };
29487
29488 _proto.jsxParseIdentifier = function jsxParseIdentifier() {
29489 var node = this.startNode();
29490
29491 if (this.match(types.jsxName)) {
29492 node.name = this.state.value;
29493 } else if (this.state.type.keyword) {
29494 node.name = this.state.type.keyword;
29495 } else {
29496 this.unexpected();
29497 }
29498
29499 this.next();
29500 return this.finishNode(node, "JSXIdentifier");
29501 };
29502
29503 _proto.jsxParseNamespacedName = function jsxParseNamespacedName() {
29504 var startPos = this.state.start;
29505 var startLoc = this.state.startLoc;
29506 var name = this.jsxParseIdentifier();
29507 if (!this.eat(types.colon)) return name;
29508 var node = this.startNodeAt(startPos, startLoc);
29509 node.namespace = name;
29510 node.name = this.jsxParseIdentifier();
29511 return this.finishNode(node, "JSXNamespacedName");
29512 };
29513
29514 _proto.jsxParseElementName = function jsxParseElementName() {
29515 var startPos = this.state.start;
29516 var startLoc = this.state.startLoc;
29517 var node = this.jsxParseNamespacedName();
29518
29519 while (this.eat(types.dot)) {
29520 var newNode = this.startNodeAt(startPos, startLoc);
29521 newNode.object = node;
29522 newNode.property = this.jsxParseIdentifier();
29523 node = this.finishNode(newNode, "JSXMemberExpression");
29524 }
29525
29526 return node;
29527 };
29528
29529 _proto.jsxParseAttributeValue = function jsxParseAttributeValue() {
29530 var node;
29531
29532 switch (this.state.type) {
29533 case types.braceL:
29534 node = this.jsxParseExpressionContainer();
29535
29536 if (node.expression.type === "JSXEmptyExpression") {
29537 throw this.raise(node.start, "JSX attributes must only be assigned a non-empty expression");
29538 } else {
29539 return node;
29540 }
29541
29542 case types.jsxTagStart:
29543 case types.string:
29544 return this.parseExprAtom();
29545
29546 default:
29547 throw this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text");
29548 }
29549 };
29550
29551 _proto.jsxParseEmptyExpression = function jsxParseEmptyExpression() {
29552 var node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc);
29553 return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc);
29554 };
29555
29556 _proto.jsxParseSpreadChild = function jsxParseSpreadChild() {
29557 var node = this.startNode();
29558 this.expect(types.braceL);
29559 this.expect(types.ellipsis);
29560 node.expression = this.parseExpression();
29561 this.expect(types.braceR);
29562 return this.finishNode(node, "JSXSpreadChild");
29563 };
29564
29565 _proto.jsxParseExpressionContainer = function jsxParseExpressionContainer() {
29566 var node = this.startNode();
29567 this.next();
29568
29569 if (this.match(types.braceR)) {
29570 node.expression = this.jsxParseEmptyExpression();
29571 } else {
29572 node.expression = this.parseExpression();
29573 }
29574
29575 this.expect(types.braceR);
29576 return this.finishNode(node, "JSXExpressionContainer");
29577 };
29578
29579 _proto.jsxParseAttribute = function jsxParseAttribute() {
29580 var node = this.startNode();
29581
29582 if (this.eat(types.braceL)) {
29583 this.expect(types.ellipsis);
29584 node.argument = this.parseMaybeAssign();
29585 this.expect(types.braceR);
29586 return this.finishNode(node, "JSXSpreadAttribute");
29587 }
29588
29589 node.name = this.jsxParseNamespacedName();
29590 node.value = this.eat(types.eq) ? this.jsxParseAttributeValue() : null;
29591 return this.finishNode(node, "JSXAttribute");
29592 };
29593
29594 _proto.jsxParseOpeningElementAt = function jsxParseOpeningElementAt(startPos, startLoc) {
29595 var node = this.startNodeAt(startPos, startLoc);
29596
29597 if (this.match(types.jsxTagEnd)) {
29598 this.expect(types.jsxTagEnd);
29599 return this.finishNode(node, "JSXOpeningFragment");
29600 }
29601
29602 node.name = this.jsxParseElementName();
29603 return this.jsxParseOpeningElementAfterName(node);
29604 };
29605
29606 _proto.jsxParseOpeningElementAfterName = function jsxParseOpeningElementAfterName(node) {
29607 var attributes = [];
29608
29609 while (!this.match(types.slash) && !this.match(types.jsxTagEnd)) {
29610 attributes.push(this.jsxParseAttribute());
29611 }
29612
29613 node.attributes = attributes;
29614 node.selfClosing = this.eat(types.slash);
29615 this.expect(types.jsxTagEnd);
29616 return this.finishNode(node, "JSXOpeningElement");
29617 };
29618
29619 _proto.jsxParseClosingElementAt = function jsxParseClosingElementAt(startPos, startLoc) {
29620 var node = this.startNodeAt(startPos, startLoc);
29621
29622 if (this.match(types.jsxTagEnd)) {
29623 this.expect(types.jsxTagEnd);
29624 return this.finishNode(node, "JSXClosingFragment");
29625 }
29626
29627 node.name = this.jsxParseElementName();
29628 this.expect(types.jsxTagEnd);
29629 return this.finishNode(node, "JSXClosingElement");
29630 };
29631
29632 _proto.jsxParseElementAt = function jsxParseElementAt(startPos, startLoc) {
29633 var node = this.startNodeAt(startPos, startLoc);
29634 var children = [];
29635 var openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
29636 var closingElement = null;
29637
29638 if (!openingElement.selfClosing) {
29639 contents: for (;;) {
29640 switch (this.state.type) {
29641 case types.jsxTagStart:
29642 startPos = this.state.start;
29643 startLoc = this.state.startLoc;
29644 this.next();
29645
29646 if (this.eat(types.slash)) {
29647 closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
29648 break contents;
29649 }
29650
29651 children.push(this.jsxParseElementAt(startPos, startLoc));
29652 break;
29653
29654 case types.jsxText:
29655 children.push(this.parseExprAtom());
29656 break;
29657
29658 case types.braceL:
29659 if (this.lookahead().type === types.ellipsis) {
29660 children.push(this.jsxParseSpreadChild());
29661 } else {
29662 children.push(this.jsxParseExpressionContainer());
29663 }
29664
29665 break;
29666
29667 default:
29668 throw this.unexpected();
29669 }
29670 }
29671
29672 if (isFragment(openingElement) && !isFragment(closingElement)) {
29673 this.raise(closingElement.start, "Expected corresponding JSX closing tag for <>");
29674 } else if (!isFragment(openingElement) && isFragment(closingElement)) {
29675 this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
29676 } else if (!isFragment(openingElement) && !isFragment(closingElement)) {
29677 if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
29678 this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
29679 }
29680 }
29681 }
29682
29683 if (isFragment(openingElement)) {
29684 node.openingFragment = openingElement;
29685 node.closingFragment = closingElement;
29686 } else {
29687 node.openingElement = openingElement;
29688 node.closingElement = closingElement;
29689 }
29690
29691 node.children = children;
29692
29693 if (this.match(types.relational) && this.state.value === "<") {
29694 this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag. " + "Did you want a JSX fragment <>...</>?");
29695 }
29696
29697 return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
29698 };
29699
29700 _proto.jsxParseElement = function jsxParseElement() {
29701 var startPos = this.state.start;
29702 var startLoc = this.state.startLoc;
29703 this.next();
29704 return this.jsxParseElementAt(startPos, startLoc);
29705 };
29706
29707 _proto.parseExprAtom = function parseExprAtom(refShortHandDefaultPos) {
29708 if (this.match(types.jsxText)) {
29709 return this.parseLiteral(this.state.value, "JSXText");
29710 } else if (this.match(types.jsxTagStart)) {
29711 return this.jsxParseElement();
29712 } else {
29713 return _superClass.prototype.parseExprAtom.call(this, refShortHandDefaultPos);
29714 }
29715 };
29716
29717 _proto.readToken = function readToken(code) {
29718 if (this.state.inPropertyName) return _superClass.prototype.readToken.call(this, code);
29719 var context = this.curContext();
29720
29721 if (context === types$1.j_expr) {
29722 return this.jsxReadToken();
29723 }
29724
29725 if (context === types$1.j_oTag || context === types$1.j_cTag) {
29726 if (isIdentifierStart(code)) {
29727 return this.jsxReadWord();
29728 }
29729
29730 if (code === 62) {
29731 ++this.state.pos;
29732 return this.finishToken(types.jsxTagEnd);
29733 }
29734
29735 if ((code === 34 || code === 39) && context === types$1.j_oTag) {
29736 return this.jsxReadString(code);
29737 }
29738 }
29739
29740 if (code === 60 && this.state.exprAllowed) {
29741 ++this.state.pos;
29742 return this.finishToken(types.jsxTagStart);
29743 }
29744
29745 return _superClass.prototype.readToken.call(this, code);
29746 };
29747
29748 _proto.updateContext = function updateContext(prevType) {
29749 if (this.match(types.braceL)) {
29750 var curContext = this.curContext();
29751
29752 if (curContext === types$1.j_oTag) {
29753 this.state.context.push(types$1.braceExpression);
29754 } else if (curContext === types$1.j_expr) {
29755 this.state.context.push(types$1.templateQuasi);
29756 } else {
29757 _superClass.prototype.updateContext.call(this, prevType);
29758 }
29759
29760 this.state.exprAllowed = true;
29761 } else if (this.match(types.slash) && prevType === types.jsxTagStart) {
29762 this.state.context.length -= 2;
29763 this.state.context.push(types$1.j_cTag);
29764 this.state.exprAllowed = false;
29765 } else {
29766 return _superClass.prototype.updateContext.call(this, prevType);
29767 }
29768 };
29769
29770 return _class;
29771 }(superClass);
29772});
29773
29774var defaultOptions = {
29775 sourceType: "script",
29776 sourceFilename: undefined,
29777 startLine: 1,
29778 allowAwaitOutsideFunction: false,
29779 allowReturnOutsideFunction: false,
29780 allowImportExportEverywhere: false,
29781 allowSuperOutsideMethod: false,
29782 plugins: [],
29783 strictMode: null,
29784 ranges: false,
29785 tokens: false
29786};
29787function getOptions(opts) {
29788 var options = {};
29789
29790 for (var key in defaultOptions) {
29791 options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key];
29792 }
29793
29794 return options;
29795}
29796
29797var Position = function Position(line, col) {
29798 this.line = line;
29799 this.column = col;
29800};
29801var SourceLocation = function SourceLocation(start, end) {
29802 this.start = start;
29803 this.end = end;
29804};
29805function getLineInfo(input, offset) {
29806 var line = 1;
29807 var lineStart = 0;
29808 var match;
29809 lineBreakG.lastIndex = 0;
29810
29811 while ((match = lineBreakG.exec(input)) && match.index < offset) {
29812 line++;
29813 lineStart = lineBreakG.lastIndex;
29814 }
29815
29816 return new Position(line, offset - lineStart);
29817}
29818
29819var BaseParser = function () {
29820 function BaseParser() {
29821 this.sawUnambiguousESM = false;
29822 }
29823
29824 var _proto = BaseParser.prototype;
29825
29826 _proto.isReservedWord = function isReservedWord(word) {
29827 if (word === "await") {
29828 return this.inModule;
29829 } else {
29830 return reservedWords[6](word);
29831 }
29832 };
29833
29834 _proto.hasPlugin = function hasPlugin(name) {
29835 return Object.hasOwnProperty.call(this.plugins, name);
29836 };
29837
29838 _proto.getPluginOption = function getPluginOption(plugin, name) {
29839 if (this.hasPlugin(plugin)) return this.plugins[plugin][name];
29840 };
29841
29842 return BaseParser;
29843}();
29844
29845function last(stack) {
29846 return stack[stack.length - 1];
29847}
29848
29849var CommentsParser = function (_BaseParser) {
29850 _inheritsLoose(CommentsParser, _BaseParser);
29851
29852 function CommentsParser() {
29853 return _BaseParser.apply(this, arguments) || this;
29854 }
29855
29856 var _proto = CommentsParser.prototype;
29857
29858 _proto.addComment = function addComment(comment) {
29859 if (this.filename) comment.loc.filename = this.filename;
29860 this.state.trailingComments.push(comment);
29861 this.state.leadingComments.push(comment);
29862 };
29863
29864 _proto.processComment = function processComment(node) {
29865 if (node.type === "Program" && node.body.length > 0) return;
29866 var stack = this.state.commentStack;
29867 var firstChild, lastChild, trailingComments, i, j;
29868
29869 if (this.state.trailingComments.length > 0) {
29870 if (this.state.trailingComments[0].start >= node.end) {
29871 trailingComments = this.state.trailingComments;
29872 this.state.trailingComments = [];
29873 } else {
29874 this.state.trailingComments.length = 0;
29875 }
29876 } else if (stack.length > 0) {
29877 var lastInStack = last(stack);
29878
29879 if (lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) {
29880 trailingComments = lastInStack.trailingComments;
29881 delete lastInStack.trailingComments;
29882 }
29883 }
29884
29885 if (stack.length > 0 && last(stack).start >= node.start) {
29886 firstChild = stack.pop();
29887 }
29888
29889 while (stack.length > 0 && last(stack).start >= node.start) {
29890 lastChild = stack.pop();
29891 }
29892
29893 if (!lastChild && firstChild) lastChild = firstChild;
29894
29895 if (firstChild && this.state.leadingComments.length > 0) {
29896 var lastComment = last(this.state.leadingComments);
29897
29898 if (firstChild.type === "ObjectProperty") {
29899 if (lastComment.start >= node.start) {
29900 if (this.state.commentPreviousNode) {
29901 for (j = 0; j < this.state.leadingComments.length; j++) {
29902 if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
29903 this.state.leadingComments.splice(j, 1);
29904 j--;
29905 }
29906 }
29907
29908 if (this.state.leadingComments.length > 0) {
29909 firstChild.trailingComments = this.state.leadingComments;
29910 this.state.leadingComments = [];
29911 }
29912 }
29913 }
29914 } else if (node.type === "CallExpression" && node.arguments && node.arguments.length) {
29915 var lastArg = last(node.arguments);
29916
29917 if (lastArg && lastComment.start >= lastArg.start && lastComment.end <= node.end) {
29918 if (this.state.commentPreviousNode) {
29919 for (j = 0; j < this.state.leadingComments.length; j++) {
29920 if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
29921 this.state.leadingComments.splice(j, 1);
29922 j--;
29923 }
29924 }
29925
29926 if (this.state.leadingComments.length > 0) {
29927 lastArg.trailingComments = this.state.leadingComments;
29928 this.state.leadingComments = [];
29929 }
29930 }
29931 }
29932 }
29933 }
29934
29935 if (lastChild) {
29936 if (lastChild.leadingComments) {
29937 if (lastChild !== node && lastChild.leadingComments.length > 0 && last(lastChild.leadingComments).end <= node.start) {
29938 node.leadingComments = lastChild.leadingComments;
29939 delete lastChild.leadingComments;
29940 } else {
29941 for (i = lastChild.leadingComments.length - 2; i >= 0; --i) {
29942 if (lastChild.leadingComments[i].end <= node.start) {
29943 node.leadingComments = lastChild.leadingComments.splice(0, i + 1);
29944 break;
29945 }
29946 }
29947 }
29948 }
29949 } else if (this.state.leadingComments.length > 0) {
29950 if (last(this.state.leadingComments).end <= node.start) {
29951 if (this.state.commentPreviousNode) {
29952 for (j = 0; j < this.state.leadingComments.length; j++) {
29953 if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
29954 this.state.leadingComments.splice(j, 1);
29955 j--;
29956 }
29957 }
29958 }
29959
29960 if (this.state.leadingComments.length > 0) {
29961 node.leadingComments = this.state.leadingComments;
29962 this.state.leadingComments = [];
29963 }
29964 } else {
29965 for (i = 0; i < this.state.leadingComments.length; i++) {
29966 if (this.state.leadingComments[i].end > node.start) {
29967 break;
29968 }
29969 }
29970
29971 var leadingComments = this.state.leadingComments.slice(0, i);
29972
29973 if (leadingComments.length) {
29974 node.leadingComments = leadingComments;
29975 }
29976
29977 trailingComments = this.state.leadingComments.slice(i);
29978
29979 if (trailingComments.length === 0) {
29980 trailingComments = null;
29981 }
29982 }
29983 }
29984
29985 this.state.commentPreviousNode = node;
29986
29987 if (trailingComments) {
29988 if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) {
29989 node.innerComments = trailingComments;
29990 } else {
29991 node.trailingComments = trailingComments;
29992 }
29993 }
29994
29995 stack.push(node);
29996 };
29997
29998 return CommentsParser;
29999}(BaseParser);
30000
30001var LocationParser = function (_CommentsParser) {
30002 _inheritsLoose(LocationParser, _CommentsParser);
30003
30004 function LocationParser() {
30005 return _CommentsParser.apply(this, arguments) || this;
30006 }
30007
30008 var _proto = LocationParser.prototype;
30009
30010 _proto.raise = function raise(pos, message, _temp) {
30011 var _ref = _temp === void 0 ? {} : _temp,
30012 missingPluginNames = _ref.missingPluginNames,
30013 code = _ref.code;
30014
30015 var loc = getLineInfo(this.input, pos);
30016 message += " (" + loc.line + ":" + loc.column + ")";
30017 var err = new SyntaxError(message);
30018 err.pos = pos;
30019 err.loc = loc;
30020
30021 if (missingPluginNames) {
30022 err.missingPlugin = missingPluginNames;
30023 }
30024
30025 if (code !== undefined) {
30026 err.code = code;
30027 }
30028
30029 throw err;
30030 };
30031
30032 return LocationParser;
30033}(CommentsParser);
30034
30035var State = function () {
30036 function State() {}
30037
30038 var _proto = State.prototype;
30039
30040 _proto.init = function init(options, input) {
30041 this.strict = options.strictMode === false ? false : options.sourceType === "module";
30042 this.input = input;
30043 this.potentialArrowAt = -1;
30044 this.noArrowAt = [];
30045 this.noArrowParamsConversionAt = [];
30046 this.inMethod = false;
30047 this.inFunction = false;
30048 this.inParameters = false;
30049 this.maybeInArrowParameters = false;
30050 this.inGenerator = false;
30051 this.inAsync = false;
30052 this.inPropertyName = false;
30053 this.inType = false;
30054 this.inClassProperty = false;
30055 this.noAnonFunctionType = false;
30056 this.hasFlowComment = false;
30057 this.isIterator = false;
30058 this.classLevel = 0;
30059 this.labels = [];
30060 this.decoratorStack = [[]];
30061 this.yieldInPossibleArrowParameters = null;
30062 this.tokens = [];
30063 this.comments = [];
30064 this.trailingComments = [];
30065 this.leadingComments = [];
30066 this.commentStack = [];
30067 this.commentPreviousNode = null;
30068 this.pos = this.lineStart = 0;
30069 this.curLine = options.startLine;
30070 this.type = types.eof;
30071 this.value = null;
30072 this.start = this.end = this.pos;
30073 this.startLoc = this.endLoc = this.curPosition();
30074 this.lastTokEndLoc = this.lastTokStartLoc = null;
30075 this.lastTokStart = this.lastTokEnd = this.pos;
30076 this.context = [types$1.braceStatement];
30077 this.exprAllowed = true;
30078 this.containsEsc = this.containsOctal = false;
30079 this.octalPosition = null;
30080 this.invalidTemplateEscapePosition = null;
30081 this.exportedIdentifiers = [];
30082 };
30083
30084 _proto.curPosition = function curPosition() {
30085 return new Position(this.curLine, this.pos - this.lineStart);
30086 };
30087
30088 _proto.clone = function clone(skipArrays) {
30089 var _this = this;
30090
30091 var state = new State();
30092 Object.keys(this).forEach(function (key) {
30093 var val = _this[key];
30094
30095 if ((!skipArrays || key === "context") && Array.isArray(val)) {
30096 val = val.slice();
30097 }
30098
30099 state[key] = val;
30100 });
30101 return state;
30102 };
30103
30104 return State;
30105}();
30106
30107var _isDigit = function isDigit(code) {
30108 return code >= 48 && code <= 57;
30109};
30110
30111var VALID_REGEX_FLAGS = "gmsiyu";
30112var forbiddenNumericSeparatorSiblings = {
30113 decBinOct: [46, 66, 69, 79, 95, 98, 101, 111],
30114 hex: [46, 88, 95, 120]
30115};
30116var allowedNumericSeparatorSiblings = {};
30117allowedNumericSeparatorSiblings.bin = [48, 49];
30118allowedNumericSeparatorSiblings.oct = allowedNumericSeparatorSiblings.bin.concat([50, 51, 52, 53, 54, 55]);
30119allowedNumericSeparatorSiblings.dec = allowedNumericSeparatorSiblings.oct.concat([56, 57]);
30120allowedNumericSeparatorSiblings.hex = allowedNumericSeparatorSiblings.dec.concat([65, 66, 67, 68, 69, 70, 97, 98, 99, 100, 101, 102]);
30121var Token = function Token(state) {
30122 this.type = state.type;
30123 this.value = state.value;
30124 this.start = state.start;
30125 this.end = state.end;
30126 this.loc = new SourceLocation(state.startLoc, state.endLoc);
30127};
30128
30129var Tokenizer = function (_LocationParser) {
30130 _inheritsLoose(Tokenizer, _LocationParser);
30131
30132 function Tokenizer(options, input) {
30133 var _this;
30134
30135 _this = _LocationParser.call(this) || this;
30136 _this.state = new State();
30137
30138 _this.state.init(options, input);
30139
30140 _this.isLookahead = false;
30141 return _this;
30142 }
30143
30144 var _proto = Tokenizer.prototype;
30145
30146 _proto.next = function next() {
30147 if (this.options.tokens && !this.isLookahead) {
30148 this.state.tokens.push(new Token(this.state));
30149 }
30150
30151 this.state.lastTokEnd = this.state.end;
30152 this.state.lastTokStart = this.state.start;
30153 this.state.lastTokEndLoc = this.state.endLoc;
30154 this.state.lastTokStartLoc = this.state.startLoc;
30155 this.nextToken();
30156 };
30157
30158 _proto.eat = function eat(type) {
30159 if (this.match(type)) {
30160 this.next();
30161 return true;
30162 } else {
30163 return false;
30164 }
30165 };
30166
30167 _proto.match = function match(type) {
30168 return this.state.type === type;
30169 };
30170
30171 _proto.isKeyword = function isKeyword$$1(word) {
30172 return isKeyword(word);
30173 };
30174
30175 _proto.lookahead = function lookahead() {
30176 var old = this.state;
30177 this.state = old.clone(true);
30178 this.isLookahead = true;
30179 this.next();
30180 this.isLookahead = false;
30181 var curr = this.state;
30182 this.state = old;
30183 return curr;
30184 };
30185
30186 _proto.setStrict = function setStrict(strict) {
30187 this.state.strict = strict;
30188 if (!this.match(types.num) && !this.match(types.string)) return;
30189 this.state.pos = this.state.start;
30190
30191 while (this.state.pos < this.state.lineStart) {
30192 this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1;
30193 --this.state.curLine;
30194 }
30195
30196 this.nextToken();
30197 };
30198
30199 _proto.curContext = function curContext() {
30200 return this.state.context[this.state.context.length - 1];
30201 };
30202
30203 _proto.nextToken = function nextToken() {
30204 var curContext = this.curContext();
30205 if (!curContext || !curContext.preserveSpace) this.skipSpace();
30206 this.state.containsOctal = false;
30207 this.state.octalPosition = null;
30208 this.state.start = this.state.pos;
30209 this.state.startLoc = this.state.curPosition();
30210
30211 if (this.state.pos >= this.input.length) {
30212 this.finishToken(types.eof);
30213 return;
30214 }
30215
30216 if (curContext.override) {
30217 curContext.override(this);
30218 } else {
30219 this.readToken(this.input.codePointAt(this.state.pos));
30220 }
30221 };
30222
30223 _proto.readToken = function readToken(code) {
30224 if (isIdentifierStart(code) || code === 92) {
30225 this.readWord();
30226 } else {
30227 this.getTokenFromCode(code);
30228 }
30229 };
30230
30231 _proto.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) {
30232 var comment = {
30233 type: block ? "CommentBlock" : "CommentLine",
30234 value: text,
30235 start: start,
30236 end: end,
30237 loc: new SourceLocation(startLoc, endLoc)
30238 };
30239
30240 if (!this.isLookahead) {
30241 if (this.options.tokens) this.state.tokens.push(comment);
30242 this.state.comments.push(comment);
30243 this.addComment(comment);
30244 }
30245 };
30246
30247 _proto.skipBlockComment = function skipBlockComment() {
30248 var startLoc = this.state.curPosition();
30249 var start = this.state.pos;
30250 var end = this.input.indexOf("*/", this.state.pos += 2);
30251 if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment");
30252 this.state.pos = end + 2;
30253 lineBreakG.lastIndex = start;
30254 var match;
30255
30256 while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) {
30257 ++this.state.curLine;
30258 this.state.lineStart = match.index + match[0].length;
30259 }
30260
30261 this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition());
30262 };
30263
30264 _proto.skipLineComment = function skipLineComment(startSkip) {
30265 var start = this.state.pos;
30266 var startLoc = this.state.curPosition();
30267 var ch = this.input.charCodeAt(this.state.pos += startSkip);
30268
30269 if (this.state.pos < this.input.length) {
30270 while (ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233 && ++this.state.pos < this.input.length) {
30271 ch = this.input.charCodeAt(this.state.pos);
30272 }
30273 }
30274
30275 this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition());
30276 };
30277
30278 _proto.skipSpace = function skipSpace() {
30279 loop: while (this.state.pos < this.input.length) {
30280 var ch = this.input.charCodeAt(this.state.pos);
30281
30282 switch (ch) {
30283 case 13:
30284 if (this.input.charCodeAt(this.state.pos + 1) === 10) {
30285 ++this.state.pos;
30286 }
30287
30288 case 10:
30289 case 8232:
30290 case 8233:
30291 ++this.state.pos;
30292 ++this.state.curLine;
30293 this.state.lineStart = this.state.pos;
30294 break;
30295
30296 case 47:
30297 switch (this.input.charCodeAt(this.state.pos + 1)) {
30298 case 42:
30299 this.skipBlockComment();
30300 break;
30301
30302 case 47:
30303 this.skipLineComment(2);
30304 break;
30305
30306 default:
30307 break loop;
30308 }
30309
30310 break;
30311
30312 default:
30313 if (isWhitespace(ch)) {
30314 ++this.state.pos;
30315 } else {
30316 break loop;
30317 }
30318
30319 }
30320 }
30321 };
30322
30323 _proto.finishToken = function finishToken(type, val) {
30324 this.state.end = this.state.pos;
30325 this.state.endLoc = this.state.curPosition();
30326 var prevType = this.state.type;
30327 this.state.type = type;
30328 this.state.value = val;
30329 this.updateContext(prevType);
30330 };
30331
30332 _proto.readToken_dot = function readToken_dot() {
30333 var next = this.input.charCodeAt(this.state.pos + 1);
30334
30335 if (next >= 48 && next <= 57) {
30336 this.readNumber(true);
30337 return;
30338 }
30339
30340 var next2 = this.input.charCodeAt(this.state.pos + 2);
30341
30342 if (next === 46 && next2 === 46) {
30343 this.state.pos += 3;
30344 this.finishToken(types.ellipsis);
30345 } else {
30346 ++this.state.pos;
30347 this.finishToken(types.dot);
30348 }
30349 };
30350
30351 _proto.readToken_slash = function readToken_slash() {
30352 if (this.state.exprAllowed && !this.state.inType) {
30353 ++this.state.pos;
30354 this.readRegexp();
30355 return;
30356 }
30357
30358 var next = this.input.charCodeAt(this.state.pos + 1);
30359
30360 if (next === 61) {
30361 this.finishOp(types.assign, 2);
30362 } else {
30363 this.finishOp(types.slash, 1);
30364 }
30365 };
30366
30367 _proto.readToken_interpreter = function readToken_interpreter() {
30368 if (this.state.pos !== 0 || this.state.input.length < 2) return false;
30369 var start = this.state.pos;
30370 this.state.pos += 1;
30371 var ch = this.input.charCodeAt(this.state.pos);
30372 if (ch !== 33) return false;
30373
30374 while (ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233 && ++this.state.pos < this.input.length) {
30375 ch = this.input.charCodeAt(this.state.pos);
30376 }
30377
30378 var value = this.input.slice(start + 2, this.state.pos);
30379 this.finishToken(types.interpreterDirective, value);
30380 return true;
30381 };
30382
30383 _proto.readToken_mult_modulo = function readToken_mult_modulo(code) {
30384 var type = code === 42 ? types.star : types.modulo;
30385 var width = 1;
30386 var next = this.input.charCodeAt(this.state.pos + 1);
30387 var exprAllowed = this.state.exprAllowed;
30388
30389 if (code === 42 && next === 42) {
30390 width++;
30391 next = this.input.charCodeAt(this.state.pos + 2);
30392 type = types.exponent;
30393 }
30394
30395 if (next === 61 && !exprAllowed) {
30396 width++;
30397 type = types.assign;
30398 }
30399
30400 this.finishOp(type, width);
30401 };
30402
30403 _proto.readToken_pipe_amp = function readToken_pipe_amp(code) {
30404 var next = this.input.charCodeAt(this.state.pos + 1);
30405
30406 if (next === code) {
30407 if (this.input.charCodeAt(this.state.pos + 2) === 61) {
30408 this.finishOp(types.assign, 3);
30409 } else {
30410 this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2);
30411 }
30412
30413 return;
30414 }
30415
30416 if (code === 124) {
30417 if (next === 62) {
30418 this.finishOp(types.pipeline, 2);
30419 return;
30420 } else if (next === 125 && this.hasPlugin("flow")) {
30421 this.finishOp(types.braceBarR, 2);
30422 return;
30423 }
30424 }
30425
30426 if (next === 61) {
30427 this.finishOp(types.assign, 2);
30428 return;
30429 }
30430
30431 this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1);
30432 };
30433
30434 _proto.readToken_caret = function readToken_caret() {
30435 var next = this.input.charCodeAt(this.state.pos + 1);
30436
30437 if (next === 61) {
30438 this.finishOp(types.assign, 2);
30439 } else {
30440 this.finishOp(types.bitwiseXOR, 1);
30441 }
30442 };
30443
30444 _proto.readToken_plus_min = function readToken_plus_min(code) {
30445 var next = this.input.charCodeAt(this.state.pos + 1);
30446
30447 if (next === code) {
30448 if (next === 45 && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) {
30449 this.skipLineComment(3);
30450 this.skipSpace();
30451 this.nextToken();
30452 return;
30453 }
30454
30455 this.finishOp(types.incDec, 2);
30456 return;
30457 }
30458
30459 if (next === 61) {
30460 this.finishOp(types.assign, 2);
30461 } else {
30462 this.finishOp(types.plusMin, 1);
30463 }
30464 };
30465
30466 _proto.readToken_lt_gt = function readToken_lt_gt(code) {
30467 var next = this.input.charCodeAt(this.state.pos + 1);
30468 var size = 1;
30469
30470 if (next === code) {
30471 size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2;
30472
30473 if (this.input.charCodeAt(this.state.pos + size) === 61) {
30474 this.finishOp(types.assign, size + 1);
30475 return;
30476 }
30477
30478 this.finishOp(types.bitShift, size);
30479 return;
30480 }
30481
30482 if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) {
30483 this.skipLineComment(4);
30484 this.skipSpace();
30485 this.nextToken();
30486 return;
30487 }
30488
30489 if (next === 61) {
30490 size = 2;
30491 }
30492
30493 this.finishOp(types.relational, size);
30494 };
30495
30496 _proto.readToken_eq_excl = function readToken_eq_excl(code) {
30497 var next = this.input.charCodeAt(this.state.pos + 1);
30498
30499 if (next === 61) {
30500 this.finishOp(types.equality, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
30501 return;
30502 }
30503
30504 if (code === 61 && next === 62) {
30505 this.state.pos += 2;
30506 this.finishToken(types.arrow);
30507 return;
30508 }
30509
30510 this.finishOp(code === 61 ? types.eq : types.bang, 1);
30511 };
30512
30513 _proto.readToken_question = function readToken_question() {
30514 var next = this.input.charCodeAt(this.state.pos + 1);
30515 var next2 = this.input.charCodeAt(this.state.pos + 2);
30516
30517 if (next === 63 && !this.state.inType) {
30518 if (next2 === 61) {
30519 this.finishOp(types.assign, 3);
30520 } else {
30521 this.finishOp(types.nullishCoalescing, 2);
30522 }
30523 } else if (next === 46 && !(next2 >= 48 && next2 <= 57)) {
30524 this.state.pos += 2;
30525 this.finishToken(types.questionDot);
30526 } else {
30527 ++this.state.pos;
30528 this.finishToken(types.question);
30529 }
30530 };
30531
30532 _proto.getTokenFromCode = function getTokenFromCode(code) {
30533 switch (code) {
30534 case 35:
30535 if (this.state.pos === 0 && this.readToken_interpreter()) {
30536 return;
30537 }
30538
30539 if ((this.hasPlugin("classPrivateProperties") || this.hasPlugin("classPrivateMethods")) && this.state.classLevel > 0) {
30540 ++this.state.pos;
30541 this.finishToken(types.hash);
30542 return;
30543 } else {
30544 this.raise(this.state.pos, "Unexpected character '" + String.fromCodePoint(code) + "'");
30545 }
30546
30547 case 46:
30548 this.readToken_dot();
30549 return;
30550
30551 case 40:
30552 ++this.state.pos;
30553 this.finishToken(types.parenL);
30554 return;
30555
30556 case 41:
30557 ++this.state.pos;
30558 this.finishToken(types.parenR);
30559 return;
30560
30561 case 59:
30562 ++this.state.pos;
30563 this.finishToken(types.semi);
30564 return;
30565
30566 case 44:
30567 ++this.state.pos;
30568 this.finishToken(types.comma);
30569 return;
30570
30571 case 91:
30572 ++this.state.pos;
30573 this.finishToken(types.bracketL);
30574 return;
30575
30576 case 93:
30577 ++this.state.pos;
30578 this.finishToken(types.bracketR);
30579 return;
30580
30581 case 123:
30582 if (this.hasPlugin("flow") && this.input.charCodeAt(this.state.pos + 1) === 124) {
30583 this.finishOp(types.braceBarL, 2);
30584 } else {
30585 ++this.state.pos;
30586 this.finishToken(types.braceL);
30587 }
30588
30589 return;
30590
30591 case 125:
30592 ++this.state.pos;
30593 this.finishToken(types.braceR);
30594 return;
30595
30596 case 58:
30597 if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
30598 this.finishOp(types.doubleColon, 2);
30599 } else {
30600 ++this.state.pos;
30601 this.finishToken(types.colon);
30602 }
30603
30604 return;
30605
30606 case 63:
30607 this.readToken_question();
30608 return;
30609
30610 case 64:
30611 ++this.state.pos;
30612 this.finishToken(types.at);
30613 return;
30614
30615 case 96:
30616 ++this.state.pos;
30617 this.finishToken(types.backQuote);
30618 return;
30619
30620 case 48:
30621 {
30622 var next = this.input.charCodeAt(this.state.pos + 1);
30623
30624 if (next === 120 || next === 88) {
30625 this.readRadixNumber(16);
30626 return;
30627 }
30628
30629 if (next === 111 || next === 79) {
30630 this.readRadixNumber(8);
30631 return;
30632 }
30633
30634 if (next === 98 || next === 66) {
30635 this.readRadixNumber(2);
30636 return;
30637 }
30638 }
30639
30640 case 49:
30641 case 50:
30642 case 51:
30643 case 52:
30644 case 53:
30645 case 54:
30646 case 55:
30647 case 56:
30648 case 57:
30649 this.readNumber(false);
30650 return;
30651
30652 case 34:
30653 case 39:
30654 this.readString(code);
30655 return;
30656
30657 case 47:
30658 this.readToken_slash();
30659 return;
30660
30661 case 37:
30662 case 42:
30663 this.readToken_mult_modulo(code);
30664 return;
30665
30666 case 124:
30667 case 38:
30668 this.readToken_pipe_amp(code);
30669 return;
30670
30671 case 94:
30672 this.readToken_caret();
30673 return;
30674
30675 case 43:
30676 case 45:
30677 this.readToken_plus_min(code);
30678 return;
30679
30680 case 60:
30681 case 62:
30682 this.readToken_lt_gt(code);
30683 return;
30684
30685 case 61:
30686 case 33:
30687 this.readToken_eq_excl(code);
30688 return;
30689
30690 case 126:
30691 this.finishOp(types.tilde, 1);
30692 return;
30693 }
30694
30695 this.raise(this.state.pos, "Unexpected character '" + String.fromCodePoint(code) + "'");
30696 };
30697
30698 _proto.finishOp = function finishOp(type, size) {
30699 var str = this.input.slice(this.state.pos, this.state.pos + size);
30700 this.state.pos += size;
30701 this.finishToken(type, str);
30702 };
30703
30704 _proto.readRegexp = function readRegexp() {
30705 var start = this.state.pos;
30706 var escaped, inClass;
30707
30708 for (;;) {
30709 if (this.state.pos >= this.input.length) {
30710 this.raise(start, "Unterminated regular expression");
30711 }
30712
30713 var ch = this.input.charAt(this.state.pos);
30714
30715 if (lineBreak.test(ch)) {
30716 this.raise(start, "Unterminated regular expression");
30717 }
30718
30719 if (escaped) {
30720 escaped = false;
30721 } else {
30722 if (ch === "[") {
30723 inClass = true;
30724 } else if (ch === "]" && inClass) {
30725 inClass = false;
30726 } else if (ch === "/" && !inClass) {
30727 break;
30728 }
30729
30730 escaped = ch === "\\";
30731 }
30732
30733 ++this.state.pos;
30734 }
30735
30736 var content = this.input.slice(start, this.state.pos);
30737 ++this.state.pos;
30738 var mods = "";
30739
30740 while (this.state.pos < this.input.length) {
30741 var char = this.input[this.state.pos];
30742 var charCode = this.input.codePointAt(this.state.pos);
30743
30744 if (VALID_REGEX_FLAGS.indexOf(char) > -1) {
30745 if (mods.indexOf(char) > -1) {
30746 this.raise(this.state.pos + 1, "Duplicate regular expression flag");
30747 }
30748
30749 ++this.state.pos;
30750 mods += char;
30751 } else if (isIdentifierChar(charCode) || charCode === 92) {
30752 this.raise(this.state.pos + 1, "Invalid regular expression flag");
30753 } else {
30754 break;
30755 }
30756 }
30757
30758 this.finishToken(types.regexp, {
30759 pattern: content,
30760 flags: mods
30761 });
30762 };
30763
30764 _proto.readInt = function readInt(radix, len) {
30765 var start = this.state.pos;
30766 var forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
30767 var allowedSiblings = radix === 16 ? allowedNumericSeparatorSiblings.hex : radix === 10 ? allowedNumericSeparatorSiblings.dec : radix === 8 ? allowedNumericSeparatorSiblings.oct : allowedNumericSeparatorSiblings.bin;
30768 var total = 0;
30769
30770 for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
30771 var code = this.input.charCodeAt(this.state.pos);
30772 var val = void 0;
30773
30774 if (this.hasPlugin("numericSeparator")) {
30775 var prev = this.input.charCodeAt(this.state.pos - 1);
30776 var next = this.input.charCodeAt(this.state.pos + 1);
30777
30778 if (code === 95) {
30779 if (allowedSiblings.indexOf(next) === -1) {
30780 this.raise(this.state.pos, "Invalid or unexpected token");
30781 }
30782
30783 if (forbiddenSiblings.indexOf(prev) > -1 || forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next)) {
30784 this.raise(this.state.pos, "Invalid or unexpected token");
30785 }
30786
30787 ++this.state.pos;
30788 continue;
30789 }
30790 }
30791
30792 if (code >= 97) {
30793 val = code - 97 + 10;
30794 } else if (code >= 65) {
30795 val = code - 65 + 10;
30796 } else if (_isDigit(code)) {
30797 val = code - 48;
30798 } else {
30799 val = Infinity;
30800 }
30801
30802 if (val >= radix) break;
30803 ++this.state.pos;
30804 total = total * radix + val;
30805 }
30806
30807 if (this.state.pos === start || len != null && this.state.pos - start !== len) {
30808 return null;
30809 }
30810
30811 return total;
30812 };
30813
30814 _proto.readRadixNumber = function readRadixNumber(radix) {
30815 var start = this.state.pos;
30816 var isBigInt = false;
30817 this.state.pos += 2;
30818 var val = this.readInt(radix);
30819
30820 if (val == null) {
30821 this.raise(this.state.start + 2, "Expected number in radix " + radix);
30822 }
30823
30824 if (this.hasPlugin("bigInt")) {
30825 if (this.input.charCodeAt(this.state.pos) === 110) {
30826 ++this.state.pos;
30827 isBigInt = true;
30828 }
30829 }
30830
30831 if (isIdentifierStart(this.input.codePointAt(this.state.pos))) {
30832 this.raise(this.state.pos, "Identifier directly after number");
30833 }
30834
30835 if (isBigInt) {
30836 var str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
30837 this.finishToken(types.bigint, str);
30838 return;
30839 }
30840
30841 this.finishToken(types.num, val);
30842 };
30843
30844 _proto.readNumber = function readNumber(startsWithDot) {
30845 var start = this.state.pos;
30846 var octal = this.input.charCodeAt(start) === 48;
30847 var isFloat = false;
30848 var isBigInt = false;
30849
30850 if (!startsWithDot && this.readInt(10) === null) {
30851 this.raise(start, "Invalid number");
30852 }
30853
30854 if (octal && this.state.pos == start + 1) octal = false;
30855 var next = this.input.charCodeAt(this.state.pos);
30856
30857 if (next === 46 && !octal) {
30858 ++this.state.pos;
30859 this.readInt(10);
30860 isFloat = true;
30861 next = this.input.charCodeAt(this.state.pos);
30862 }
30863
30864 if ((next === 69 || next === 101) && !octal) {
30865 next = this.input.charCodeAt(++this.state.pos);
30866
30867 if (next === 43 || next === 45) {
30868 ++this.state.pos;
30869 }
30870
30871 if (this.readInt(10) === null) this.raise(start, "Invalid number");
30872 isFloat = true;
30873 next = this.input.charCodeAt(this.state.pos);
30874 }
30875
30876 if (this.hasPlugin("bigInt")) {
30877 if (next === 110) {
30878 if (isFloat || octal) this.raise(start, "Invalid BigIntLiteral");
30879 ++this.state.pos;
30880 isBigInt = true;
30881 }
30882 }
30883
30884 if (isIdentifierStart(this.input.codePointAt(this.state.pos))) {
30885 this.raise(this.state.pos, "Identifier directly after number");
30886 }
30887
30888 var str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
30889
30890 if (isBigInt) {
30891 this.finishToken(types.bigint, str);
30892 return;
30893 }
30894
30895 var val;
30896
30897 if (isFloat) {
30898 val = parseFloat(str);
30899 } else if (!octal || str.length === 1) {
30900 val = parseInt(str, 10);
30901 } else if (this.state.strict) {
30902 this.raise(start, "Invalid number");
30903 } else if (/[89]/.test(str)) {
30904 val = parseInt(str, 10);
30905 } else {
30906 val = parseInt(str, 8);
30907 }
30908
30909 this.finishToken(types.num, val);
30910 };
30911
30912 _proto.readCodePoint = function readCodePoint(throwOnInvalid) {
30913 var ch = this.input.charCodeAt(this.state.pos);
30914 var code;
30915
30916 if (ch === 123) {
30917 var codePos = ++this.state.pos;
30918 code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos, throwOnInvalid);
30919 ++this.state.pos;
30920
30921 if (code === null) {
30922 --this.state.invalidTemplateEscapePosition;
30923 } else if (code > 0x10ffff) {
30924 if (throwOnInvalid) {
30925 this.raise(codePos, "Code point out of bounds");
30926 } else {
30927 this.state.invalidTemplateEscapePosition = codePos - 2;
30928 return null;
30929 }
30930 }
30931 } else {
30932 code = this.readHexChar(4, throwOnInvalid);
30933 }
30934
30935 return code;
30936 };
30937
30938 _proto.readString = function readString(quote) {
30939 var out = "",
30940 chunkStart = ++this.state.pos;
30941 var hasJsonStrings = this.hasPlugin("jsonStrings");
30942
30943 for (;;) {
30944 if (this.state.pos >= this.input.length) {
30945 this.raise(this.state.start, "Unterminated string constant");
30946 }
30947
30948 var ch = this.input.charCodeAt(this.state.pos);
30949 if (ch === quote) break;
30950
30951 if (ch === 92) {
30952 out += this.input.slice(chunkStart, this.state.pos);
30953 out += this.readEscapedChar(false);
30954 chunkStart = this.state.pos;
30955 } else if (hasJsonStrings && (ch === 8232 || ch === 8233)) {
30956 ++this.state.pos;
30957 } else if (isNewLine(ch)) {
30958 this.raise(this.state.start, "Unterminated string constant");
30959 } else {
30960 ++this.state.pos;
30961 }
30962 }
30963
30964 out += this.input.slice(chunkStart, this.state.pos++);
30965 this.finishToken(types.string, out);
30966 };
30967
30968 _proto.readTmplToken = function readTmplToken() {
30969 var out = "",
30970 chunkStart = this.state.pos,
30971 containsInvalid = false;
30972
30973 for (;;) {
30974 if (this.state.pos >= this.input.length) {
30975 this.raise(this.state.start, "Unterminated template");
30976 }
30977
30978 var ch = this.input.charCodeAt(this.state.pos);
30979
30980 if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
30981 if (this.state.pos === this.state.start && this.match(types.template)) {
30982 if (ch === 36) {
30983 this.state.pos += 2;
30984 this.finishToken(types.dollarBraceL);
30985 return;
30986 } else {
30987 ++this.state.pos;
30988 this.finishToken(types.backQuote);
30989 return;
30990 }
30991 }
30992
30993 out += this.input.slice(chunkStart, this.state.pos);
30994 this.finishToken(types.template, containsInvalid ? null : out);
30995 return;
30996 }
30997
30998 if (ch === 92) {
30999 out += this.input.slice(chunkStart, this.state.pos);
31000 var escaped = this.readEscapedChar(true);
31001
31002 if (escaped === null) {
31003 containsInvalid = true;
31004 } else {
31005 out += escaped;
31006 }
31007
31008 chunkStart = this.state.pos;
31009 } else if (isNewLine(ch)) {
31010 out += this.input.slice(chunkStart, this.state.pos);
31011 ++this.state.pos;
31012
31013 switch (ch) {
31014 case 13:
31015 if (this.input.charCodeAt(this.state.pos) === 10) {
31016 ++this.state.pos;
31017 }
31018
31019 case 10:
31020 out += "\n";
31021 break;
31022
31023 default:
31024 out += String.fromCharCode(ch);
31025 break;
31026 }
31027
31028 ++this.state.curLine;
31029 this.state.lineStart = this.state.pos;
31030 chunkStart = this.state.pos;
31031 } else {
31032 ++this.state.pos;
31033 }
31034 }
31035 };
31036
31037 _proto.readEscapedChar = function readEscapedChar(inTemplate) {
31038 var throwOnInvalid = !inTemplate;
31039 var ch = this.input.charCodeAt(++this.state.pos);
31040 ++this.state.pos;
31041
31042 switch (ch) {
31043 case 110:
31044 return "\n";
31045
31046 case 114:
31047 return "\r";
31048
31049 case 120:
31050 {
31051 var code = this.readHexChar(2, throwOnInvalid);
31052 return code === null ? null : String.fromCharCode(code);
31053 }
31054
31055 case 117:
31056 {
31057 var _code = this.readCodePoint(throwOnInvalid);
31058
31059 return _code === null ? null : String.fromCodePoint(_code);
31060 }
31061
31062 case 116:
31063 return "\t";
31064
31065 case 98:
31066 return "\b";
31067
31068 case 118:
31069 return "\x0B";
31070
31071 case 102:
31072 return "\f";
31073
31074 case 13:
31075 if (this.input.charCodeAt(this.state.pos) === 10) {
31076 ++this.state.pos;
31077 }
31078
31079 case 10:
31080 this.state.lineStart = this.state.pos;
31081 ++this.state.curLine;
31082 return "";
31083
31084 default:
31085 if (ch >= 48 && ch <= 55) {
31086 var codePos = this.state.pos - 1;
31087 var octalStr = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/)[0];
31088 var octal = parseInt(octalStr, 8);
31089
31090 if (octal > 255) {
31091 octalStr = octalStr.slice(0, -1);
31092 octal = parseInt(octalStr, 8);
31093 }
31094
31095 if (octal > 0) {
31096 if (inTemplate) {
31097 this.state.invalidTemplateEscapePosition = codePos;
31098 return null;
31099 } else if (this.state.strict) {
31100 this.raise(codePos, "Octal literal in strict mode");
31101 } else if (!this.state.containsOctal) {
31102 this.state.containsOctal = true;
31103 this.state.octalPosition = codePos;
31104 }
31105 }
31106
31107 this.state.pos += octalStr.length - 1;
31108 return String.fromCharCode(octal);
31109 }
31110
31111 return String.fromCharCode(ch);
31112 }
31113 };
31114
31115 _proto.readHexChar = function readHexChar(len, throwOnInvalid) {
31116 var codePos = this.state.pos;
31117 var n = this.readInt(16, len);
31118
31119 if (n === null) {
31120 if (throwOnInvalid) {
31121 this.raise(codePos, "Bad character escape sequence");
31122 } else {
31123 this.state.pos = codePos - 1;
31124 this.state.invalidTemplateEscapePosition = codePos - 1;
31125 }
31126 }
31127
31128 return n;
31129 };
31130
31131 _proto.readWord1 = function readWord1() {
31132 this.state.containsEsc = false;
31133 var word = "",
31134 first = true,
31135 chunkStart = this.state.pos;
31136
31137 while (this.state.pos < this.input.length) {
31138 var ch = this.input.codePointAt(this.state.pos);
31139
31140 if (isIdentifierChar(ch)) {
31141 this.state.pos += ch <= 0xffff ? 1 : 2;
31142 } else if (this.state.isIterator && ch === 64) {
31143 this.state.pos += 1;
31144 } else if (ch === 92) {
31145 this.state.containsEsc = true;
31146 word += this.input.slice(chunkStart, this.state.pos);
31147 var escStart = this.state.pos;
31148
31149 if (this.input.charCodeAt(++this.state.pos) !== 117) {
31150 this.raise(this.state.pos, "Expecting Unicode escape sequence \\uXXXX");
31151 }
31152
31153 ++this.state.pos;
31154 var esc = this.readCodePoint(true);
31155
31156 if (!(first ? isIdentifierStart : isIdentifierChar)(esc, true)) {
31157 this.raise(escStart, "Invalid Unicode escape");
31158 }
31159
31160 word += String.fromCodePoint(esc);
31161 chunkStart = this.state.pos;
31162 } else {
31163 break;
31164 }
31165
31166 first = false;
31167 }
31168
31169 return word + this.input.slice(chunkStart, this.state.pos);
31170 };
31171
31172 _proto.isIterator = function isIterator(word) {
31173 return word === "@@iterator" || word === "@@asyncIterator";
31174 };
31175
31176 _proto.readWord = function readWord() {
31177 var word = this.readWord1();
31178 var type = types.name;
31179
31180 if (this.isKeyword(word)) {
31181 if (this.state.containsEsc) {
31182 this.raise(this.state.pos, "Escape sequence in keyword " + word);
31183 }
31184
31185 type = keywords[word];
31186 }
31187
31188 if (this.state.isIterator && (!this.isIterator(word) || !this.state.inType)) {
31189 this.raise(this.state.pos, "Invalid identifier " + word);
31190 }
31191
31192 this.finishToken(type, word);
31193 };
31194
31195 _proto.braceIsBlock = function braceIsBlock(prevType) {
31196 if (prevType === types.colon) {
31197 var parent = this.curContext();
31198
31199 if (parent === types$1.braceStatement || parent === types$1.braceExpression) {
31200 return !parent.isExpr;
31201 }
31202 }
31203
31204 if (prevType === types._return) {
31205 return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
31206 }
31207
31208 if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR) {
31209 return true;
31210 }
31211
31212 if (prevType === types.braceL) {
31213 return this.curContext() === types$1.braceStatement;
31214 }
31215
31216 if (prevType === types.relational) {
31217 return true;
31218 }
31219
31220 return !this.state.exprAllowed;
31221 };
31222
31223 _proto.updateContext = function updateContext(prevType) {
31224 var type = this.state.type;
31225 var update;
31226
31227 if (type.keyword && (prevType === types.dot || prevType === types.questionDot)) {
31228 this.state.exprAllowed = false;
31229 } else if (update = type.updateContext) {
31230 update.call(this, prevType);
31231 } else {
31232 this.state.exprAllowed = type.beforeExpr;
31233 }
31234 };
31235
31236 return Tokenizer;
31237}(LocationParser);
31238
31239var UtilParser = function (_Tokenizer) {
31240 _inheritsLoose(UtilParser, _Tokenizer);
31241
31242 function UtilParser() {
31243 return _Tokenizer.apply(this, arguments) || this;
31244 }
31245
31246 var _proto = UtilParser.prototype;
31247
31248 _proto.addExtra = function addExtra(node, key, val) {
31249 if (!node) return;
31250 var extra = node.extra = node.extra || {};
31251 extra[key] = val;
31252 };
31253
31254 _proto.isRelational = function isRelational(op) {
31255 return this.match(types.relational) && this.state.value === op;
31256 };
31257
31258 _proto.isLookaheadRelational = function isLookaheadRelational(op) {
31259 var l = this.lookahead();
31260 return l.type == types.relational && l.value == op;
31261 };
31262
31263 _proto.expectRelational = function expectRelational(op) {
31264 if (this.isRelational(op)) {
31265 this.next();
31266 } else {
31267 this.unexpected(null, types.relational);
31268 }
31269 };
31270
31271 _proto.eatRelational = function eatRelational(op) {
31272 if (this.isRelational(op)) {
31273 this.next();
31274 return true;
31275 }
31276
31277 return false;
31278 };
31279
31280 _proto.isContextual = function isContextual(name) {
31281 return this.match(types.name) && this.state.value === name && !this.state.containsEsc;
31282 };
31283
31284 _proto.isLookaheadContextual = function isLookaheadContextual(name) {
31285 var l = this.lookahead();
31286 return l.type === types.name && l.value === name;
31287 };
31288
31289 _proto.eatContextual = function eatContextual(name) {
31290 return this.isContextual(name) && this.eat(types.name);
31291 };
31292
31293 _proto.expectContextual = function expectContextual(name, message) {
31294 if (!this.eatContextual(name)) this.unexpected(null, message);
31295 };
31296
31297 _proto.canInsertSemicolon = function canInsertSemicolon() {
31298 return this.match(types.eof) || this.match(types.braceR) || this.hasPrecedingLineBreak();
31299 };
31300
31301 _proto.hasPrecedingLineBreak = function hasPrecedingLineBreak() {
31302 return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
31303 };
31304
31305 _proto.isLineTerminator = function isLineTerminator() {
31306 return this.eat(types.semi) || this.canInsertSemicolon();
31307 };
31308
31309 _proto.semicolon = function semicolon() {
31310 if (!this.isLineTerminator()) this.unexpected(null, types.semi);
31311 };
31312
31313 _proto.expect = function expect(type, pos) {
31314 this.eat(type) || this.unexpected(pos, type);
31315 };
31316
31317 _proto.unexpected = function unexpected(pos, messageOrType) {
31318 if (messageOrType === void 0) {
31319 messageOrType = "Unexpected token";
31320 }
31321
31322 if (typeof messageOrType !== "string") {
31323 messageOrType = "Unexpected token, expected \"" + messageOrType.label + "\"";
31324 }
31325
31326 throw this.raise(pos != null ? pos : this.state.start, messageOrType);
31327 };
31328
31329 _proto.expectPlugin = function expectPlugin(name, pos) {
31330 if (!this.hasPlugin(name)) {
31331 throw this.raise(pos != null ? pos : this.state.start, "This experimental syntax requires enabling the parser plugin: '" + name + "'", {
31332 missingPluginNames: [name]
31333 });
31334 }
31335
31336 return true;
31337 };
31338
31339 _proto.expectOnePlugin = function expectOnePlugin(names, pos) {
31340 var _this = this;
31341
31342 if (!names.some(function (n) {
31343 return _this.hasPlugin(n);
31344 })) {
31345 throw this.raise(pos != null ? pos : this.state.start, "This experimental syntax requires enabling one of the following parser plugin(s): '" + names.join(", ") + "'", {
31346 missingPluginNames: names
31347 });
31348 }
31349 };
31350
31351 return UtilParser;
31352}(Tokenizer);
31353
31354var commentKeys = ["leadingComments", "trailingComments", "innerComments"];
31355
31356var Node = function () {
31357 function Node(parser, pos, loc) {
31358 this.type = "";
31359 this.start = pos;
31360 this.end = 0;
31361 this.loc = new SourceLocation(loc);
31362 if (parser && parser.options.ranges) this.range = [pos, 0];
31363 if (parser && parser.filename) this.loc.filename = parser.filename;
31364 }
31365
31366 var _proto = Node.prototype;
31367
31368 _proto.__clone = function __clone() {
31369 var _this = this;
31370
31371 var node2 = new Node();
31372 Object.keys(this).forEach(function (key) {
31373 if (commentKeys.indexOf(key) < 0) {
31374 node2[key] = _this[key];
31375 }
31376 });
31377 return node2;
31378 };
31379
31380 return Node;
31381}();
31382
31383var NodeUtils = function (_UtilParser) {
31384 _inheritsLoose(NodeUtils, _UtilParser);
31385
31386 function NodeUtils() {
31387 return _UtilParser.apply(this, arguments) || this;
31388 }
31389
31390 var _proto2 = NodeUtils.prototype;
31391
31392 _proto2.startNode = function startNode() {
31393 return new Node(this, this.state.start, this.state.startLoc);
31394 };
31395
31396 _proto2.startNodeAt = function startNodeAt(pos, loc) {
31397 return new Node(this, pos, loc);
31398 };
31399
31400 _proto2.startNodeAtNode = function startNodeAtNode(type) {
31401 return this.startNodeAt(type.start, type.loc.start);
31402 };
31403
31404 _proto2.finishNode = function finishNode(node, type) {
31405 return this.finishNodeAt(node, type, this.state.lastTokEnd, this.state.lastTokEndLoc);
31406 };
31407
31408 _proto2.finishNodeAt = function finishNodeAt(node, type, pos, loc) {
31409 node.type = type;
31410 node.end = pos;
31411 node.loc.end = loc;
31412 if (this.options.ranges) node.range[1] = pos;
31413 this.processComment(node);
31414 return node;
31415 };
31416
31417 _proto2.resetStartLocationFromNode = function resetStartLocationFromNode(node, locationNode) {
31418 node.start = locationNode.start;
31419 node.loc.start = locationNode.loc.start;
31420 if (this.options.ranges) node.range[0] = locationNode.range[0];
31421 };
31422
31423 return NodeUtils;
31424}(UtilParser);
31425
31426var LValParser = function (_NodeUtils) {
31427 _inheritsLoose(LValParser, _NodeUtils);
31428
31429 function LValParser() {
31430 return _NodeUtils.apply(this, arguments) || this;
31431 }
31432
31433 var _proto = LValParser.prototype;
31434
31435 _proto.toAssignable = function toAssignable(node, isBinding, contextDescription) {
31436 if (node) {
31437 switch (node.type) {
31438 case "Identifier":
31439 case "ObjectPattern":
31440 case "ArrayPattern":
31441 case "AssignmentPattern":
31442 break;
31443
31444 case "ObjectExpression":
31445 node.type = "ObjectPattern";
31446
31447 for (var index = 0; index < node.properties.length; index++) {
31448 var prop = node.properties[index];
31449 var isLast = index === node.properties.length - 1;
31450 this.toAssignableObjectExpressionProp(prop, isBinding, isLast);
31451 }
31452
31453 break;
31454
31455 case "ObjectProperty":
31456 this.toAssignable(node.value, isBinding, contextDescription);
31457 break;
31458
31459 case "SpreadElement":
31460 {
31461 this.checkToRestConversion(node);
31462 node.type = "RestElement";
31463 var arg = node.argument;
31464 this.toAssignable(arg, isBinding, contextDescription);
31465 break;
31466 }
31467
31468 case "ArrayExpression":
31469 node.type = "ArrayPattern";
31470 this.toAssignableList(node.elements, isBinding, contextDescription);
31471 break;
31472
31473 case "AssignmentExpression":
31474 if (node.operator === "=") {
31475 node.type = "AssignmentPattern";
31476 delete node.operator;
31477 } else {
31478 this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
31479 }
31480
31481 break;
31482
31483 case "MemberExpression":
31484 if (!isBinding) break;
31485
31486 default:
31487 {
31488 var message = "Invalid left-hand side" + (contextDescription ? " in " + contextDescription : "expression");
31489 this.raise(node.start, message);
31490 }
31491 }
31492 }
31493
31494 return node;
31495 };
31496
31497 _proto.toAssignableObjectExpressionProp = function toAssignableObjectExpressionProp(prop, isBinding, isLast) {
31498 if (prop.type === "ObjectMethod") {
31499 var error = prop.kind === "get" || prop.kind === "set" ? "Object pattern can't contain getter or setter" : "Object pattern can't contain methods";
31500 this.raise(prop.key.start, error);
31501 } else if (prop.type === "SpreadElement" && !isLast) {
31502 this.raise(prop.start, "The rest element has to be the last element when destructuring");
31503 } else {
31504 this.toAssignable(prop, isBinding, "object destructuring pattern");
31505 }
31506 };
31507
31508 _proto.toAssignableList = function toAssignableList(exprList, isBinding, contextDescription) {
31509 var end = exprList.length;
31510
31511 if (end) {
31512 var last = exprList[end - 1];
31513
31514 if (last && last.type === "RestElement") {
31515 --end;
31516 } else if (last && last.type === "SpreadElement") {
31517 last.type = "RestElement";
31518 var arg = last.argument;
31519 this.toAssignable(arg, isBinding, contextDescription);
31520
31521 if (["Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern"].indexOf(arg.type) === -1) {
31522 this.unexpected(arg.start);
31523 }
31524
31525 --end;
31526 }
31527 }
31528
31529 for (var i = 0; i < end; i++) {
31530 var elt = exprList[i];
31531
31532 if (elt && elt.type === "SpreadElement") {
31533 this.raise(elt.start, "The rest element has to be the last element when destructuring");
31534 }
31535
31536 if (elt) this.toAssignable(elt, isBinding, contextDescription);
31537 }
31538
31539 return exprList;
31540 };
31541
31542 _proto.toReferencedList = function toReferencedList(exprList) {
31543 return exprList;
31544 };
31545
31546 _proto.parseSpread = function parseSpread(refShorthandDefaultPos, refNeedsArrowPos) {
31547 var node = this.startNode();
31548 this.next();
31549 node.argument = this.parseMaybeAssign(false, refShorthandDefaultPos, undefined, refNeedsArrowPos);
31550 return this.finishNode(node, "SpreadElement");
31551 };
31552
31553 _proto.parseRest = function parseRest() {
31554 var node = this.startNode();
31555 this.next();
31556 node.argument = this.parseBindingAtom();
31557 return this.finishNode(node, "RestElement");
31558 };
31559
31560 _proto.shouldAllowYieldIdentifier = function shouldAllowYieldIdentifier() {
31561 return this.match(types._yield) && !this.state.strict && !this.state.inGenerator;
31562 };
31563
31564 _proto.parseBindingIdentifier = function parseBindingIdentifier() {
31565 return this.parseIdentifier(this.shouldAllowYieldIdentifier());
31566 };
31567
31568 _proto.parseBindingAtom = function parseBindingAtom() {
31569 switch (this.state.type) {
31570 case types._yield:
31571 case types.name:
31572 return this.parseBindingIdentifier();
31573
31574 case types.bracketL:
31575 {
31576 var node = this.startNode();
31577 this.next();
31578 node.elements = this.parseBindingList(types.bracketR, true);
31579 return this.finishNode(node, "ArrayPattern");
31580 }
31581
31582 case types.braceL:
31583 return this.parseObj(true);
31584
31585 default:
31586 throw this.unexpected();
31587 }
31588 };
31589
31590 _proto.parseBindingList = function parseBindingList(close, allowEmpty, allowModifiers) {
31591 var elts = [];
31592 var first = true;
31593
31594 while (!this.eat(close)) {
31595 if (first) {
31596 first = false;
31597 } else {
31598 this.expect(types.comma);
31599 }
31600
31601 if (allowEmpty && this.match(types.comma)) {
31602 elts.push(null);
31603 } else if (this.eat(close)) {
31604 break;
31605 } else if (this.match(types.ellipsis)) {
31606 elts.push(this.parseAssignableListItemTypes(this.parseRest()));
31607 this.expect(close);
31608 break;
31609 } else {
31610 var decorators = [];
31611
31612 if (this.match(types.at) && this.hasPlugin("decorators")) {
31613 this.raise(this.state.start, "Stage 2 decorators cannot be used to decorate parameters");
31614 }
31615
31616 while (this.match(types.at)) {
31617 decorators.push(this.parseDecorator());
31618 }
31619
31620 elts.push(this.parseAssignableListItem(allowModifiers, decorators));
31621 }
31622 }
31623
31624 return elts;
31625 };
31626
31627 _proto.parseAssignableListItem = function parseAssignableListItem(allowModifiers, decorators) {
31628 var left = this.parseMaybeDefault();
31629 this.parseAssignableListItemTypes(left);
31630 var elt = this.parseMaybeDefault(left.start, left.loc.start, left);
31631
31632 if (decorators.length) {
31633 left.decorators = decorators;
31634 }
31635
31636 return elt;
31637 };
31638
31639 _proto.parseAssignableListItemTypes = function parseAssignableListItemTypes(param) {
31640 return param;
31641 };
31642
31643 _proto.parseMaybeDefault = function parseMaybeDefault(startPos, startLoc, left) {
31644 startLoc = startLoc || this.state.startLoc;
31645 startPos = startPos || this.state.start;
31646 left = left || this.parseBindingAtom();
31647 if (!this.eat(types.eq)) return left;
31648 var node = this.startNodeAt(startPos, startLoc);
31649 node.left = left;
31650 node.right = this.parseMaybeAssign();
31651 return this.finishNode(node, "AssignmentPattern");
31652 };
31653
31654 _proto.checkLVal = function checkLVal(expr, isBinding, checkClashes, contextDescription) {
31655 switch (expr.type) {
31656 case "Identifier":
31657 this.checkReservedWord(expr.name, expr.start, false, true);
31658
31659 if (checkClashes) {
31660 var _key = "_" + expr.name;
31661
31662 if (checkClashes[_key]) {
31663 this.raise(expr.start, "Argument name clash in strict mode");
31664 } else {
31665 checkClashes[_key] = true;
31666 }
31667 }
31668
31669 break;
31670
31671 case "MemberExpression":
31672 if (isBinding) this.raise(expr.start, "Binding member expression");
31673 break;
31674
31675 case "ObjectPattern":
31676 for (var _i2 = 0, _expr$properties2 = expr.properties; _i2 < _expr$properties2.length; _i2++) {
31677 var prop = _expr$properties2[_i2];
31678 if (prop.type === "ObjectProperty") prop = prop.value;
31679 this.checkLVal(prop, isBinding, checkClashes, "object destructuring pattern");
31680 }
31681
31682 break;
31683
31684 case "ArrayPattern":
31685 for (var _i4 = 0, _expr$elements2 = expr.elements; _i4 < _expr$elements2.length; _i4++) {
31686 var elem = _expr$elements2[_i4];
31687
31688 if (elem) {
31689 this.checkLVal(elem, isBinding, checkClashes, "array destructuring pattern");
31690 }
31691 }
31692
31693 break;
31694
31695 case "AssignmentPattern":
31696 this.checkLVal(expr.left, isBinding, checkClashes, "assignment pattern");
31697 break;
31698
31699 case "RestElement":
31700 this.checkLVal(expr.argument, isBinding, checkClashes, "rest element");
31701 break;
31702
31703 default:
31704 {
31705 var message = (isBinding ? "Binding invalid" : "Invalid") + " left-hand side" + (contextDescription ? " in " + contextDescription : "expression");
31706 this.raise(expr.start, message);
31707 }
31708 }
31709 };
31710
31711 _proto.checkToRestConversion = function checkToRestConversion(node) {
31712 var validArgumentTypes = ["Identifier", "MemberExpression"];
31713
31714 if (validArgumentTypes.indexOf(node.argument.type) !== -1) {
31715 return;
31716 }
31717
31718 this.raise(node.argument.start, "Invalid rest operator's argument");
31719 };
31720
31721 return LValParser;
31722}(NodeUtils);
31723
31724var ExpressionParser = function (_LValParser) {
31725 _inheritsLoose(ExpressionParser, _LValParser);
31726
31727 function ExpressionParser() {
31728 return _LValParser.apply(this, arguments) || this;
31729 }
31730
31731 var _proto = ExpressionParser.prototype;
31732
31733 _proto.checkPropClash = function checkPropClash(prop, propHash) {
31734 if (prop.computed || prop.kind) return;
31735 var key = prop.key;
31736 var name = key.type === "Identifier" ? key.name : String(key.value);
31737
31738 if (name === "__proto__") {
31739 if (propHash.proto) {
31740 this.raise(key.start, "Redefinition of __proto__ property");
31741 }
31742
31743 propHash.proto = true;
31744 }
31745 };
31746
31747 _proto.getExpression = function getExpression() {
31748 this.nextToken();
31749 var expr = this.parseExpression();
31750
31751 if (!this.match(types.eof)) {
31752 this.unexpected();
31753 }
31754
31755 expr.comments = this.state.comments;
31756 return expr;
31757 };
31758
31759 _proto.parseExpression = function parseExpression(noIn, refShorthandDefaultPos) {
31760 var startPos = this.state.start;
31761 var startLoc = this.state.startLoc;
31762 var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos);
31763
31764 if (this.match(types.comma)) {
31765 var _node = this.startNodeAt(startPos, startLoc);
31766
31767 _node.expressions = [expr];
31768
31769 while (this.eat(types.comma)) {
31770 _node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos));
31771 }
31772
31773 this.toReferencedList(_node.expressions);
31774 return this.finishNode(_node, "SequenceExpression");
31775 }
31776
31777 return expr;
31778 };
31779
31780 _proto.parseMaybeAssign = function parseMaybeAssign(noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos) {
31781 var startPos = this.state.start;
31782 var startLoc = this.state.startLoc;
31783
31784 if (this.match(types._yield) && this.state.inGenerator) {
31785 var _left = this.parseYield();
31786
31787 if (afterLeftParse) {
31788 _left = afterLeftParse.call(this, _left, startPos, startLoc);
31789 }
31790
31791 return _left;
31792 }
31793
31794 var failOnShorthandAssign;
31795
31796 if (refShorthandDefaultPos) {
31797 failOnShorthandAssign = false;
31798 } else {
31799 refShorthandDefaultPos = {
31800 start: 0
31801 };
31802 failOnShorthandAssign = true;
31803 }
31804
31805 if (this.match(types.parenL) || this.match(types.name) || this.match(types._yield)) {
31806 this.state.potentialArrowAt = this.state.start;
31807 }
31808
31809 var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos, refNeedsArrowPos);
31810
31811 if (afterLeftParse) {
31812 left = afterLeftParse.call(this, left, startPos, startLoc);
31813 }
31814
31815 if (this.state.type.isAssign) {
31816 var _node2 = this.startNodeAt(startPos, startLoc);
31817
31818 var operator = this.state.value;
31819 _node2.operator = operator;
31820
31821 if (operator === "??=") {
31822 this.expectPlugin("nullishCoalescingOperator");
31823 this.expectPlugin("logicalAssignment");
31824 }
31825
31826 if (operator === "||=" || operator === "&&=") {
31827 this.expectPlugin("logicalAssignment");
31828 }
31829
31830 _node2.left = this.match(types.eq) ? this.toAssignable(left, undefined, "assignment expression") : left;
31831 refShorthandDefaultPos.start = 0;
31832 this.checkLVal(left, undefined, undefined, "assignment expression");
31833
31834 if (left.extra && left.extra.parenthesized) {
31835 var errorMsg;
31836
31837 if (left.type === "ObjectPattern") {
31838 errorMsg = "`({a}) = 0` use `({a} = 0)`";
31839 } else if (left.type === "ArrayPattern") {
31840 errorMsg = "`([a]) = 0` use `([a] = 0)`";
31841 }
31842
31843 if (errorMsg) {
31844 this.raise(left.start, "You're trying to assign to a parenthesized expression, eg. instead of " + errorMsg);
31845 }
31846 }
31847
31848 this.next();
31849 _node2.right = this.parseMaybeAssign(noIn);
31850 return this.finishNode(_node2, "AssignmentExpression");
31851 } else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
31852 this.unexpected(refShorthandDefaultPos.start);
31853 }
31854
31855 return left;
31856 };
31857
31858 _proto.parseMaybeConditional = function parseMaybeConditional(noIn, refShorthandDefaultPos, refNeedsArrowPos) {
31859 var startPos = this.state.start;
31860 var startLoc = this.state.startLoc;
31861 var potentialArrowAt = this.state.potentialArrowAt;
31862 var expr = this.parseExprOps(noIn, refShorthandDefaultPos);
31863
31864 if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
31865 return expr;
31866 }
31867
31868 if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
31869 return this.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos);
31870 };
31871
31872 _proto.parseConditional = function parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos) {
31873 if (this.eat(types.question)) {
31874 var _node3 = this.startNodeAt(startPos, startLoc);
31875
31876 _node3.test = expr;
31877 _node3.consequent = this.parseMaybeAssign();
31878 this.expect(types.colon);
31879 _node3.alternate = this.parseMaybeAssign(noIn);
31880 return this.finishNode(_node3, "ConditionalExpression");
31881 }
31882
31883 return expr;
31884 };
31885
31886 _proto.parseExprOps = function parseExprOps(noIn, refShorthandDefaultPos) {
31887 var startPos = this.state.start;
31888 var startLoc = this.state.startLoc;
31889 var potentialArrowAt = this.state.potentialArrowAt;
31890 var expr = this.parseMaybeUnary(refShorthandDefaultPos);
31891
31892 if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
31893 return expr;
31894 }
31895
31896 if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
31897 return expr;
31898 }
31899
31900 return this.parseExprOp(expr, startPos, startLoc, -1, noIn);
31901 };
31902
31903 _proto.parseExprOp = function parseExprOp(left, leftStartPos, leftStartLoc, minPrec, noIn) {
31904 var prec = this.state.type.binop;
31905
31906 if (prec != null && (!noIn || !this.match(types._in))) {
31907 if (prec > minPrec) {
31908 var _node4 = this.startNodeAt(leftStartPos, leftStartLoc);
31909
31910 var operator = this.state.value;
31911 _node4.left = left;
31912 _node4.operator = operator;
31913
31914 if (operator === "**" && left.type === "UnaryExpression" && !(left.extra && left.extra.parenthesized)) {
31915 this.raise(left.argument.start, "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");
31916 }
31917
31918 var op = this.state.type;
31919
31920 if (op === types.nullishCoalescing) {
31921 this.expectPlugin("nullishCoalescingOperator");
31922 } else if (op === types.pipeline) {
31923 this.expectPlugin("pipelineOperator");
31924 }
31925
31926 this.next();
31927 var startPos = this.state.start;
31928 var startLoc = this.state.startLoc;
31929
31930 if (op === types.pipeline) {
31931 if (this.match(types.name) && this.state.value === "await" && this.state.inAsync) {
31932 throw this.raise(this.state.start, "Unexpected \"await\" after pipeline body; await must have parentheses in minimal proposal");
31933 }
31934 }
31935
31936 _node4.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn);
31937 this.finishNode(_node4, op === types.logicalOR || op === types.logicalAND || op === types.nullishCoalescing ? "LogicalExpression" : "BinaryExpression");
31938 return this.parseExprOp(_node4, leftStartPos, leftStartLoc, minPrec, noIn);
31939 }
31940 }
31941
31942 return left;
31943 };
31944
31945 _proto.parseMaybeUnary = function parseMaybeUnary(refShorthandDefaultPos) {
31946 if (this.state.type.prefix) {
31947 var _node5 = this.startNode();
31948
31949 var update = this.match(types.incDec);
31950 _node5.operator = this.state.value;
31951 _node5.prefix = true;
31952
31953 if (_node5.operator === "throw") {
31954 this.expectPlugin("throwExpressions");
31955 }
31956
31957 this.next();
31958 _node5.argument = this.parseMaybeUnary();
31959
31960 if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
31961 this.unexpected(refShorthandDefaultPos.start);
31962 }
31963
31964 if (update) {
31965 this.checkLVal(_node5.argument, undefined, undefined, "prefix operation");
31966 } else if (this.state.strict && _node5.operator === "delete") {
31967 var arg = _node5.argument;
31968
31969 if (arg.type === "Identifier") {
31970 this.raise(_node5.start, "Deleting local variable in strict mode");
31971 } else if (arg.type === "MemberExpression" && arg.property.type === "PrivateName") {
31972 this.raise(_node5.start, "Deleting a private field is not allowed");
31973 }
31974 }
31975
31976 return this.finishNode(_node5, update ? "UpdateExpression" : "UnaryExpression");
31977 }
31978
31979 var startPos = this.state.start;
31980 var startLoc = this.state.startLoc;
31981 var expr = this.parseExprSubscripts(refShorthandDefaultPos);
31982 if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
31983
31984 while (this.state.type.postfix && !this.canInsertSemicolon()) {
31985 var _node6 = this.startNodeAt(startPos, startLoc);
31986
31987 _node6.operator = this.state.value;
31988 _node6.prefix = false;
31989 _node6.argument = expr;
31990 this.checkLVal(expr, undefined, undefined, "postfix operation");
31991 this.next();
31992 expr = this.finishNode(_node6, "UpdateExpression");
31993 }
31994
31995 return expr;
31996 };
31997
31998 _proto.parseExprSubscripts = function parseExprSubscripts(refShorthandDefaultPos) {
31999 var startPos = this.state.start;
32000 var startLoc = this.state.startLoc;
32001 var potentialArrowAt = this.state.potentialArrowAt;
32002 var expr = this.parseExprAtom(refShorthandDefaultPos);
32003
32004 if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
32005 return expr;
32006 }
32007
32008 if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
32009 return expr;
32010 }
32011
32012 return this.parseSubscripts(expr, startPos, startLoc);
32013 };
32014
32015 _proto.parseSubscripts = function parseSubscripts(base, startPos, startLoc, noCalls) {
32016 var state = {
32017 optionalChainMember: false,
32018 stop: false
32019 };
32020
32021 do {
32022 base = this.parseSubscript(base, startPos, startLoc, noCalls, state);
32023 } while (!state.stop);
32024
32025 return base;
32026 };
32027
32028 _proto.parseSubscript = function parseSubscript(base, startPos, startLoc, noCalls, state) {
32029 if (!noCalls && this.eat(types.doubleColon)) {
32030 var _node7 = this.startNodeAt(startPos, startLoc);
32031
32032 _node7.object = base;
32033 _node7.callee = this.parseNoCallExpr();
32034 state.stop = true;
32035 return this.parseSubscripts(this.finishNode(_node7, "BindExpression"), startPos, startLoc, noCalls);
32036 } else if (this.match(types.questionDot)) {
32037 this.expectPlugin("optionalChaining");
32038 state.optionalChainMember = true;
32039
32040 if (noCalls && this.lookahead().type == types.parenL) {
32041 state.stop = true;
32042 return base;
32043 }
32044
32045 this.next();
32046
32047 var _node8 = this.startNodeAt(startPos, startLoc);
32048
32049 if (this.eat(types.bracketL)) {
32050 _node8.object = base;
32051 _node8.property = this.parseExpression();
32052 _node8.computed = true;
32053 _node8.optional = true;
32054 this.expect(types.bracketR);
32055 return this.finishNode(_node8, "OptionalMemberExpression");
32056 } else if (this.eat(types.parenL)) {
32057 var possibleAsync = this.atPossibleAsync(base);
32058 _node8.callee = base;
32059 _node8.arguments = this.parseCallExpressionArguments(types.parenR, possibleAsync);
32060 _node8.optional = true;
32061 return this.finishNode(_node8, "OptionalCallExpression");
32062 } else {
32063 _node8.object = base;
32064 _node8.property = this.parseIdentifier(true);
32065 _node8.computed = false;
32066 _node8.optional = true;
32067 return this.finishNode(_node8, "OptionalMemberExpression");
32068 }
32069 } else if (this.eat(types.dot)) {
32070 var _node9 = this.startNodeAt(startPos, startLoc);
32071
32072 _node9.object = base;
32073 _node9.property = this.parseMaybePrivateName();
32074 _node9.computed = false;
32075
32076 if (state.optionalChainMember) {
32077 _node9.optional = false;
32078 return this.finishNode(_node9, "OptionalMemberExpression");
32079 }
32080
32081 return this.finishNode(_node9, "MemberExpression");
32082 } else if (this.eat(types.bracketL)) {
32083 var _node10 = this.startNodeAt(startPos, startLoc);
32084
32085 _node10.object = base;
32086 _node10.property = this.parseExpression();
32087 _node10.computed = true;
32088 this.expect(types.bracketR);
32089
32090 if (state.optionalChainMember) {
32091 _node10.optional = false;
32092 return this.finishNode(_node10, "OptionalMemberExpression");
32093 }
32094
32095 return this.finishNode(_node10, "MemberExpression");
32096 } else if (!noCalls && this.match(types.parenL)) {
32097 var _possibleAsync = this.atPossibleAsync(base);
32098
32099 this.next();
32100
32101 var _node11 = this.startNodeAt(startPos, startLoc);
32102
32103 _node11.callee = base;
32104 var refTrailingCommaPos = {
32105 start: -1
32106 };
32107 _node11.arguments = this.parseCallExpressionArguments(types.parenR, _possibleAsync, refTrailingCommaPos);
32108
32109 if (!state.optionalChainMember) {
32110 this.finishCallExpression(_node11);
32111 } else {
32112 this.finishOptionalCallExpression(_node11);
32113 }
32114
32115 if (_possibleAsync && this.shouldParseAsyncArrow()) {
32116 state.stop = true;
32117
32118 if (refTrailingCommaPos.start > -1) {
32119 this.raise(refTrailingCommaPos.start, "A trailing comma is not permitted after the rest element");
32120 }
32121
32122 return this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), _node11);
32123 } else {
32124 this.toReferencedList(_node11.arguments);
32125 }
32126
32127 return _node11;
32128 } else if (this.match(types.backQuote)) {
32129 return this.parseTaggedTemplateExpression(startPos, startLoc, base, state);
32130 } else {
32131 state.stop = true;
32132 return base;
32133 }
32134 };
32135
32136 _proto.parseTaggedTemplateExpression = function parseTaggedTemplateExpression(startPos, startLoc, base, state, typeArguments) {
32137 var node = this.startNodeAt(startPos, startLoc);
32138 node.tag = base;
32139 node.quasi = this.parseTemplate(true);
32140 if (typeArguments) node.typeParameters = typeArguments;
32141
32142 if (state.optionalChainMember) {
32143 this.raise(startPos, "Tagged Template Literals are not allowed in optionalChain");
32144 }
32145
32146 return this.finishNode(node, "TaggedTemplateExpression");
32147 };
32148
32149 _proto.atPossibleAsync = function atPossibleAsync(base) {
32150 return !this.state.containsEsc && this.state.potentialArrowAt === base.start && base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon();
32151 };
32152
32153 _proto.finishCallExpression = function finishCallExpression(node) {
32154 if (node.callee.type === "Import") {
32155 if (node.arguments.length !== 1) {
32156 this.raise(node.start, "import() requires exactly one argument");
32157 }
32158
32159 var importArg = node.arguments[0];
32160
32161 if (importArg && importArg.type === "SpreadElement") {
32162 this.raise(importArg.start, "... is not allowed in import()");
32163 }
32164 }
32165
32166 return this.finishNode(node, "CallExpression");
32167 };
32168
32169 _proto.finishOptionalCallExpression = function finishOptionalCallExpression(node) {
32170 if (node.callee.type === "Import") {
32171 if (node.arguments.length !== 1) {
32172 this.raise(node.start, "import() requires exactly one argument");
32173 }
32174
32175 var importArg = node.arguments[0];
32176
32177 if (importArg && importArg.type === "SpreadElement") {
32178 this.raise(importArg.start, "... is not allowed in import()");
32179 }
32180 }
32181
32182 return this.finishNode(node, "OptionalCallExpression");
32183 };
32184
32185 _proto.parseCallExpressionArguments = function parseCallExpressionArguments(close, possibleAsyncArrow, refTrailingCommaPos) {
32186 var elts = [];
32187 var innerParenStart;
32188 var first = true;
32189
32190 while (!this.eat(close)) {
32191 if (first) {
32192 first = false;
32193 } else {
32194 this.expect(types.comma);
32195 if (this.eat(close)) break;
32196 }
32197
32198 if (this.match(types.parenL) && !innerParenStart) {
32199 innerParenStart = this.state.start;
32200 }
32201
32202 elts.push(this.parseExprListItem(false, possibleAsyncArrow ? {
32203 start: 0
32204 } : undefined, possibleAsyncArrow ? {
32205 start: 0
32206 } : undefined, possibleAsyncArrow ? refTrailingCommaPos : undefined));
32207 }
32208
32209 if (possibleAsyncArrow && innerParenStart && this.shouldParseAsyncArrow()) {
32210 this.unexpected();
32211 }
32212
32213 return elts;
32214 };
32215
32216 _proto.shouldParseAsyncArrow = function shouldParseAsyncArrow() {
32217 return this.match(types.arrow);
32218 };
32219
32220 _proto.parseAsyncArrowFromCallExpression = function parseAsyncArrowFromCallExpression(node, call) {
32221 var oldYield = this.state.yieldInPossibleArrowParameters;
32222 this.state.yieldInPossibleArrowParameters = null;
32223 this.expect(types.arrow);
32224 this.parseArrowExpression(node, call.arguments, true);
32225 this.state.yieldInPossibleArrowParameters = oldYield;
32226 return node;
32227 };
32228
32229 _proto.parseNoCallExpr = function parseNoCallExpr() {
32230 var startPos = this.state.start;
32231 var startLoc = this.state.startLoc;
32232 return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
32233 };
32234
32235 _proto.parseExprAtom = function parseExprAtom(refShorthandDefaultPos) {
32236 var canBeArrow = this.state.potentialArrowAt === this.state.start;
32237 var node;
32238
32239 switch (this.state.type) {
32240 case types._super:
32241 if (!this.state.inMethod && !this.state.inClassProperty && !this.options.allowSuperOutsideMethod) {
32242 this.raise(this.state.start, "super is only allowed in object methods and classes");
32243 }
32244
32245 node = this.startNode();
32246 this.next();
32247
32248 if (!this.match(types.parenL) && !this.match(types.bracketL) && !this.match(types.dot)) {
32249 this.unexpected();
32250 }
32251
32252 if (this.match(types.parenL) && this.state.inMethod !== "constructor" && !this.options.allowSuperOutsideMethod) {
32253 this.raise(node.start, "super() is only valid inside a class constructor. " + "Make sure the method name is spelled exactly as 'constructor'.");
32254 }
32255
32256 return this.finishNode(node, "Super");
32257
32258 case types._import:
32259 if (this.lookahead().type === types.dot) {
32260 return this.parseImportMetaProperty();
32261 }
32262
32263 this.expectPlugin("dynamicImport");
32264 node = this.startNode();
32265 this.next();
32266
32267 if (!this.match(types.parenL)) {
32268 this.unexpected(null, types.parenL);
32269 }
32270
32271 return this.finishNode(node, "Import");
32272
32273 case types._this:
32274 node = this.startNode();
32275 this.next();
32276 return this.finishNode(node, "ThisExpression");
32277
32278 case types._yield:
32279 if (this.state.inGenerator) this.unexpected();
32280
32281 case types.name:
32282 {
32283 node = this.startNode();
32284 var allowAwait = this.state.value === "await" && (this.state.inAsync || !this.state.inFunction && this.options.allowAwaitOutsideFunction);
32285 var containsEsc = this.state.containsEsc;
32286 var allowYield = this.shouldAllowYieldIdentifier();
32287 var id = this.parseIdentifier(allowAwait || allowYield);
32288
32289 if (id.name === "await") {
32290 if (this.state.inAsync || this.inModule || !this.state.inFunction && this.options.allowAwaitOutsideFunction) {
32291 return this.parseAwait(node);
32292 }
32293 } else if (!containsEsc && id.name === "async" && this.match(types._function) && !this.canInsertSemicolon()) {
32294 this.next();
32295 return this.parseFunction(node, false, false, true);
32296 } else if (canBeArrow && id.name === "async" && this.match(types.name)) {
32297 var oldYield = this.state.yieldInPossibleArrowParameters;
32298 this.state.yieldInPossibleArrowParameters = null;
32299 var params = [this.parseIdentifier()];
32300 this.expect(types.arrow);
32301 this.parseArrowExpression(node, params, true);
32302 this.state.yieldInPossibleArrowParameters = oldYield;
32303 return node;
32304 }
32305
32306 if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
32307 var _oldYield = this.state.yieldInPossibleArrowParameters;
32308 this.state.yieldInPossibleArrowParameters = null;
32309 this.parseArrowExpression(node, [id]);
32310 this.state.yieldInPossibleArrowParameters = _oldYield;
32311 return node;
32312 }
32313
32314 return id;
32315 }
32316
32317 case types._do:
32318 {
32319 this.expectPlugin("doExpressions");
32320
32321 var _node12 = this.startNode();
32322
32323 this.next();
32324 var oldInFunction = this.state.inFunction;
32325 var oldLabels = this.state.labels;
32326 this.state.labels = [];
32327 this.state.inFunction = false;
32328 _node12.body = this.parseBlock(false);
32329 this.state.inFunction = oldInFunction;
32330 this.state.labels = oldLabels;
32331 return this.finishNode(_node12, "DoExpression");
32332 }
32333
32334 case types.regexp:
32335 {
32336 var value = this.state.value;
32337 node = this.parseLiteral(value.value, "RegExpLiteral");
32338 node.pattern = value.pattern;
32339 node.flags = value.flags;
32340 return node;
32341 }
32342
32343 case types.num:
32344 return this.parseLiteral(this.state.value, "NumericLiteral");
32345
32346 case types.bigint:
32347 return this.parseLiteral(this.state.value, "BigIntLiteral");
32348
32349 case types.string:
32350 return this.parseLiteral(this.state.value, "StringLiteral");
32351
32352 case types._null:
32353 node = this.startNode();
32354 this.next();
32355 return this.finishNode(node, "NullLiteral");
32356
32357 case types._true:
32358 case types._false:
32359 return this.parseBooleanLiteral();
32360
32361 case types.parenL:
32362 return this.parseParenAndDistinguishExpression(canBeArrow);
32363
32364 case types.bracketL:
32365 node = this.startNode();
32366 this.next();
32367 node.elements = this.parseExprList(types.bracketR, true, refShorthandDefaultPos);
32368 this.toReferencedList(node.elements);
32369 return this.finishNode(node, "ArrayExpression");
32370
32371 case types.braceL:
32372 return this.parseObj(false, refShorthandDefaultPos);
32373
32374 case types._function:
32375 return this.parseFunctionExpression();
32376
32377 case types.at:
32378 this.parseDecorators();
32379
32380 case types._class:
32381 node = this.startNode();
32382 this.takeDecorators(node);
32383 return this.parseClass(node, false);
32384
32385 case types._new:
32386 return this.parseNew();
32387
32388 case types.backQuote:
32389 return this.parseTemplate(false);
32390
32391 case types.doubleColon:
32392 {
32393 node = this.startNode();
32394 this.next();
32395 node.object = null;
32396 var callee = node.callee = this.parseNoCallExpr();
32397
32398 if (callee.type === "MemberExpression") {
32399 return this.finishNode(node, "BindExpression");
32400 } else {
32401 throw this.raise(callee.start, "Binding should be performed on object property.");
32402 }
32403 }
32404
32405 default:
32406 throw this.unexpected();
32407 }
32408 };
32409
32410 _proto.parseBooleanLiteral = function parseBooleanLiteral() {
32411 var node = this.startNode();
32412 node.value = this.match(types._true);
32413 this.next();
32414 return this.finishNode(node, "BooleanLiteral");
32415 };
32416
32417 _proto.parseMaybePrivateName = function parseMaybePrivateName() {
32418 var isPrivate = this.match(types.hash);
32419
32420 if (isPrivate) {
32421 this.expectOnePlugin(["classPrivateProperties", "classPrivateMethods"]);
32422
32423 var _node13 = this.startNode();
32424
32425 this.next();
32426 _node13.id = this.parseIdentifier(true);
32427 return this.finishNode(_node13, "PrivateName");
32428 } else {
32429 return this.parseIdentifier(true);
32430 }
32431 };
32432
32433 _proto.parseFunctionExpression = function parseFunctionExpression() {
32434 var node = this.startNode();
32435 var meta = this.parseIdentifier(true);
32436
32437 if (this.state.inGenerator && this.eat(types.dot)) {
32438 return this.parseMetaProperty(node, meta, "sent");
32439 }
32440
32441 return this.parseFunction(node, false);
32442 };
32443
32444 _proto.parseMetaProperty = function parseMetaProperty(node, meta, propertyName) {
32445 node.meta = meta;
32446
32447 if (meta.name === "function" && propertyName === "sent") {
32448 if (this.isContextual(propertyName)) {
32449 this.expectPlugin("functionSent");
32450 } else if (!this.hasPlugin("functionSent")) {
32451 this.unexpected();
32452 }
32453 }
32454
32455 var containsEsc = this.state.containsEsc;
32456 node.property = this.parseIdentifier(true);
32457
32458 if (node.property.name !== propertyName || containsEsc) {
32459 this.raise(node.property.start, "The only valid meta property for " + meta.name + " is " + meta.name + "." + propertyName);
32460 }
32461
32462 return this.finishNode(node, "MetaProperty");
32463 };
32464
32465 _proto.parseImportMetaProperty = function parseImportMetaProperty() {
32466 var node = this.startNode();
32467 var id = this.parseIdentifier(true);
32468 this.expect(types.dot);
32469
32470 if (id.name === "import") {
32471 if (this.isContextual("meta")) {
32472 this.expectPlugin("importMeta");
32473 } else if (!this.hasPlugin("importMeta")) {
32474 this.raise(id.start, "Dynamic imports require a parameter: import('a.js')");
32475 }
32476 }
32477
32478 if (!this.inModule) {
32479 this.raise(id.start, "import.meta may appear only with 'sourceType: \"module\"'", {
32480 code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
32481 });
32482 }
32483
32484 this.sawUnambiguousESM = true;
32485 return this.parseMetaProperty(node, id, "meta");
32486 };
32487
32488 _proto.parseLiteral = function parseLiteral(value, type, startPos, startLoc) {
32489 startPos = startPos || this.state.start;
32490 startLoc = startLoc || this.state.startLoc;
32491 var node = this.startNodeAt(startPos, startLoc);
32492 this.addExtra(node, "rawValue", value);
32493 this.addExtra(node, "raw", this.input.slice(startPos, this.state.end));
32494 node.value = value;
32495 this.next();
32496 return this.finishNode(node, type);
32497 };
32498
32499 _proto.parseParenExpression = function parseParenExpression() {
32500 this.expect(types.parenL);
32501 var val = this.parseExpression();
32502 this.expect(types.parenR);
32503 return val;
32504 };
32505
32506 _proto.parseParenAndDistinguishExpression = function parseParenAndDistinguishExpression(canBeArrow) {
32507 var startPos = this.state.start;
32508 var startLoc = this.state.startLoc;
32509 var val;
32510 this.expect(types.parenL);
32511 var oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
32512 var oldYield = this.state.yieldInPossibleArrowParameters;
32513 this.state.maybeInArrowParameters = true;
32514 this.state.yieldInPossibleArrowParameters = null;
32515 var innerStartPos = this.state.start;
32516 var innerStartLoc = this.state.startLoc;
32517 var exprList = [];
32518 var refShorthandDefaultPos = {
32519 start: 0
32520 };
32521 var refNeedsArrowPos = {
32522 start: 0
32523 };
32524 var first = true;
32525 var spreadStart;
32526 var optionalCommaStart;
32527
32528 while (!this.match(types.parenR)) {
32529 if (first) {
32530 first = false;
32531 } else {
32532 this.expect(types.comma, refNeedsArrowPos.start || null);
32533
32534 if (this.match(types.parenR)) {
32535 optionalCommaStart = this.state.start;
32536 break;
32537 }
32538 }
32539
32540 if (this.match(types.ellipsis)) {
32541 var spreadNodeStartPos = this.state.start;
32542 var spreadNodeStartLoc = this.state.startLoc;
32543 spreadStart = this.state.start;
32544 exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartPos, spreadNodeStartLoc));
32545
32546 if (this.match(types.comma) && this.lookahead().type === types.parenR) {
32547 this.raise(this.state.start, "A trailing comma is not permitted after the rest element");
32548 }
32549
32550 break;
32551 } else {
32552 exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos));
32553 }
32554 }
32555
32556 var innerEndPos = this.state.start;
32557 var innerEndLoc = this.state.startLoc;
32558 this.expect(types.parenR);
32559 this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
32560 var arrowNode = this.startNodeAt(startPos, startLoc);
32561
32562 if (canBeArrow && this.shouldParseArrow() && (arrowNode = this.parseArrow(arrowNode))) {
32563 for (var _i2 = 0; _i2 < exprList.length; _i2++) {
32564 var param = exprList[_i2];
32565
32566 if (param.extra && param.extra.parenthesized) {
32567 this.unexpected(param.extra.parenStart);
32568 }
32569 }
32570
32571 this.parseArrowExpression(arrowNode, exprList);
32572 this.state.yieldInPossibleArrowParameters = oldYield;
32573 return arrowNode;
32574 }
32575
32576 this.state.yieldInPossibleArrowParameters = oldYield;
32577
32578 if (!exprList.length) {
32579 this.unexpected(this.state.lastTokStart);
32580 }
32581
32582 if (optionalCommaStart) this.unexpected(optionalCommaStart);
32583 if (spreadStart) this.unexpected(spreadStart);
32584
32585 if (refShorthandDefaultPos.start) {
32586 this.unexpected(refShorthandDefaultPos.start);
32587 }
32588
32589 if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start);
32590
32591 if (exprList.length > 1) {
32592 val = this.startNodeAt(innerStartPos, innerStartLoc);
32593 val.expressions = exprList;
32594 this.toReferencedList(val.expressions);
32595 this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
32596 } else {
32597 val = exprList[0];
32598 }
32599
32600 this.addExtra(val, "parenthesized", true);
32601 this.addExtra(val, "parenStart", startPos);
32602 return val;
32603 };
32604
32605 _proto.shouldParseArrow = function shouldParseArrow() {
32606 return !this.canInsertSemicolon();
32607 };
32608
32609 _proto.parseArrow = function parseArrow(node) {
32610 if (this.eat(types.arrow)) {
32611 return node;
32612 }
32613 };
32614
32615 _proto.parseParenItem = function parseParenItem(node, startPos, startLoc) {
32616 return node;
32617 };
32618
32619 _proto.parseNew = function parseNew() {
32620 var node = this.startNode();
32621 var meta = this.parseIdentifier(true);
32622
32623 if (this.eat(types.dot)) {
32624 var metaProp = this.parseMetaProperty(node, meta, "target");
32625
32626 if (!this.state.inFunction && !this.state.inClassProperty) {
32627 var error = "new.target can only be used in functions";
32628
32629 if (this.hasPlugin("classProperties")) {
32630 error += " or class properties";
32631 }
32632
32633 this.raise(metaProp.start, error);
32634 }
32635
32636 return metaProp;
32637 }
32638
32639 node.callee = this.parseNoCallExpr();
32640
32641 if (node.callee.type === "OptionalMemberExpression" || node.callee.type === "OptionalCallExpression") {
32642 this.raise(this.state.lastTokEnd, "constructors in/after an Optional Chain are not allowed");
32643 }
32644
32645 if (this.eat(types.questionDot)) {
32646 this.raise(this.state.start, "constructors in/after an Optional Chain are not allowed");
32647 }
32648
32649 this.parseNewArguments(node);
32650 return this.finishNode(node, "NewExpression");
32651 };
32652
32653 _proto.parseNewArguments = function parseNewArguments(node) {
32654 if (this.eat(types.parenL)) {
32655 var args = this.parseExprList(types.parenR);
32656 this.toReferencedList(args);
32657 node.arguments = args;
32658 } else {
32659 node.arguments = [];
32660 }
32661 };
32662
32663 _proto.parseTemplateElement = function parseTemplateElement(isTagged) {
32664 var elem = this.startNode();
32665
32666 if (this.state.value === null) {
32667 if (!isTagged) {
32668 this.raise(this.state.invalidTemplateEscapePosition || 0, "Invalid escape sequence in template");
32669 } else {
32670 this.state.invalidTemplateEscapePosition = null;
32671 }
32672 }
32673
32674 elem.value = {
32675 raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"),
32676 cooked: this.state.value
32677 };
32678 this.next();
32679 elem.tail = this.match(types.backQuote);
32680 return this.finishNode(elem, "TemplateElement");
32681 };
32682
32683 _proto.parseTemplate = function parseTemplate(isTagged) {
32684 var node = this.startNode();
32685 this.next();
32686 node.expressions = [];
32687 var curElt = this.parseTemplateElement(isTagged);
32688 node.quasis = [curElt];
32689
32690 while (!curElt.tail) {
32691 this.expect(types.dollarBraceL);
32692 node.expressions.push(this.parseExpression());
32693 this.expect(types.braceR);
32694 node.quasis.push(curElt = this.parseTemplateElement(isTagged));
32695 }
32696
32697 this.next();
32698 return this.finishNode(node, "TemplateLiteral");
32699 };
32700
32701 _proto.parseObj = function parseObj(isPattern, refShorthandDefaultPos) {
32702 var decorators = [];
32703 var propHash = Object.create(null);
32704 var first = true;
32705 var node = this.startNode();
32706 node.properties = [];
32707 this.next();
32708 var firstRestLocation = null;
32709
32710 while (!this.eat(types.braceR)) {
32711 if (first) {
32712 first = false;
32713 } else {
32714 this.expect(types.comma);
32715 if (this.eat(types.braceR)) break;
32716 }
32717
32718 if (this.match(types.at)) {
32719 if (this.hasPlugin("decorators")) {
32720 this.raise(this.state.start, "Stage 2 decorators disallow object literal property decorators");
32721 } else {
32722 while (this.match(types.at)) {
32723 decorators.push(this.parseDecorator());
32724 }
32725 }
32726 }
32727
32728 var prop = this.startNode(),
32729 isGenerator = false,
32730 _isAsync = false,
32731 startPos = void 0,
32732 startLoc = void 0;
32733
32734 if (decorators.length) {
32735 prop.decorators = decorators;
32736 decorators = [];
32737 }
32738
32739 if (this.match(types.ellipsis)) {
32740 this.expectPlugin("objectRestSpread");
32741 prop = this.parseSpread(isPattern ? {
32742 start: 0
32743 } : undefined);
32744
32745 if (isPattern) {
32746 this.toAssignable(prop, true, "object pattern");
32747 }
32748
32749 node.properties.push(prop);
32750
32751 if (isPattern) {
32752 var position = this.state.start;
32753
32754 if (firstRestLocation !== null) {
32755 this.unexpected(firstRestLocation, "Cannot have multiple rest elements when destructuring");
32756 } else if (this.eat(types.braceR)) {
32757 break;
32758 } else if (this.match(types.comma) && this.lookahead().type === types.braceR) {
32759 this.unexpected(position, "A trailing comma is not permitted after the rest element");
32760 } else {
32761 firstRestLocation = position;
32762 continue;
32763 }
32764 } else {
32765 continue;
32766 }
32767 }
32768
32769 prop.method = false;
32770
32771 if (isPattern || refShorthandDefaultPos) {
32772 startPos = this.state.start;
32773 startLoc = this.state.startLoc;
32774 }
32775
32776 if (!isPattern) {
32777 isGenerator = this.eat(types.star);
32778 }
32779
32780 var containsEsc = this.state.containsEsc;
32781
32782 if (!isPattern && this.isContextual("async")) {
32783 if (isGenerator) this.unexpected();
32784 var asyncId = this.parseIdentifier();
32785
32786 if (this.match(types.colon) || this.match(types.parenL) || this.match(types.braceR) || this.match(types.eq) || this.match(types.comma)) {
32787 prop.key = asyncId;
32788 prop.computed = false;
32789 } else {
32790 _isAsync = true;
32791
32792 if (this.match(types.star)) {
32793 this.expectPlugin("asyncGenerators");
32794 this.next();
32795 isGenerator = true;
32796 }
32797
32798 this.parsePropertyName(prop);
32799 }
32800 } else {
32801 this.parsePropertyName(prop);
32802 }
32803
32804 this.parseObjPropValue(prop, startPos, startLoc, isGenerator, _isAsync, isPattern, refShorthandDefaultPos, containsEsc);
32805 this.checkPropClash(prop, propHash);
32806
32807 if (prop.shorthand) {
32808 this.addExtra(prop, "shorthand", true);
32809 }
32810
32811 node.properties.push(prop);
32812 }
32813
32814 if (firstRestLocation !== null) {
32815 this.unexpected(firstRestLocation, "The rest element has to be the last element when destructuring");
32816 }
32817
32818 if (decorators.length) {
32819 this.raise(this.state.start, "You have trailing decorators with no property");
32820 }
32821
32822 return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
32823 };
32824
32825 _proto.isGetterOrSetterMethod = function isGetterOrSetterMethod(prop, isPattern) {
32826 return !isPattern && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.match(types.string) || this.match(types.num) || this.match(types.bracketL) || this.match(types.name) || !!this.state.type.keyword);
32827 };
32828
32829 _proto.checkGetterSetterParams = function checkGetterSetterParams(method) {
32830 var paramCount = method.kind === "get" ? 0 : 1;
32831 var start = method.start;
32832
32833 if (method.params.length !== paramCount) {
32834 if (method.kind === "get") {
32835 this.raise(start, "getter must not have any formal parameters");
32836 } else {
32837 this.raise(start, "setter must have exactly one formal parameter");
32838 }
32839 }
32840
32841 if (method.kind === "set" && method.params[0].type === "RestElement") {
32842 this.raise(start, "setter function argument must not be a rest parameter");
32843 }
32844 };
32845
32846 _proto.parseObjectMethod = function parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc) {
32847 if (isAsync || isGenerator || this.match(types.parenL)) {
32848 if (isPattern) this.unexpected();
32849 prop.kind = "method";
32850 prop.method = true;
32851 return this.parseMethod(prop, isGenerator, isAsync, false, "ObjectMethod");
32852 }
32853
32854 if (!containsEsc && this.isGetterOrSetterMethod(prop, isPattern)) {
32855 if (isGenerator || isAsync) this.unexpected();
32856 prop.kind = prop.key.name;
32857 this.parsePropertyName(prop);
32858 this.parseMethod(prop, false, false, false, "ObjectMethod");
32859 this.checkGetterSetterParams(prop);
32860 return prop;
32861 }
32862 };
32863
32864 _proto.parseObjectProperty = function parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos) {
32865 prop.shorthand = false;
32866
32867 if (this.eat(types.colon)) {
32868 prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
32869 return this.finishNode(prop, "ObjectProperty");
32870 }
32871
32872 if (!prop.computed && prop.key.type === "Identifier") {
32873 this.checkReservedWord(prop.key.name, prop.key.start, true, true);
32874
32875 if (isPattern) {
32876 prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
32877 } else if (this.match(types.eq) && refShorthandDefaultPos) {
32878 if (!refShorthandDefaultPos.start) {
32879 refShorthandDefaultPos.start = this.state.start;
32880 }
32881
32882 prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
32883 } else {
32884 prop.value = prop.key.__clone();
32885 }
32886
32887 prop.shorthand = true;
32888 return this.finishNode(prop, "ObjectProperty");
32889 }
32890 };
32891
32892 _proto.parseObjPropValue = function parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos, containsEsc) {
32893 var node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos);
32894 if (!node) this.unexpected();
32895 return node;
32896 };
32897
32898 _proto.parsePropertyName = function parsePropertyName(prop) {
32899 if (this.eat(types.bracketL)) {
32900 prop.computed = true;
32901 prop.key = this.parseMaybeAssign();
32902 this.expect(types.bracketR);
32903 } else {
32904 var oldInPropertyName = this.state.inPropertyName;
32905 this.state.inPropertyName = true;
32906 prop.key = this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseMaybePrivateName();
32907
32908 if (prop.key.type !== "PrivateName") {
32909 prop.computed = false;
32910 }
32911
32912 this.state.inPropertyName = oldInPropertyName;
32913 }
32914
32915 return prop.key;
32916 };
32917
32918 _proto.initFunction = function initFunction(node, isAsync) {
32919 node.id = null;
32920 node.generator = false;
32921 node.async = !!isAsync;
32922 };
32923
32924 _proto.parseMethod = function parseMethod(node, isGenerator, isAsync, isConstructor, type) {
32925 var oldInFunc = this.state.inFunction;
32926 var oldInMethod = this.state.inMethod;
32927 var oldInGenerator = this.state.inGenerator;
32928 this.state.inFunction = true;
32929 this.state.inMethod = node.kind || true;
32930 this.state.inGenerator = isGenerator;
32931 this.initFunction(node, isAsync);
32932 node.generator = !!isGenerator;
32933 var allowModifiers = isConstructor;
32934 this.parseFunctionParams(node, allowModifiers);
32935 this.parseFunctionBodyAndFinish(node, type);
32936 this.state.inFunction = oldInFunc;
32937 this.state.inMethod = oldInMethod;
32938 this.state.inGenerator = oldInGenerator;
32939 return node;
32940 };
32941
32942 _proto.parseArrowExpression = function parseArrowExpression(node, params, isAsync) {
32943 if (this.state.yieldInPossibleArrowParameters) {
32944 this.raise(this.state.yieldInPossibleArrowParameters.start, "yield is not allowed in the parameters of an arrow function" + " inside a generator");
32945 }
32946
32947 var oldInFunc = this.state.inFunction;
32948 this.state.inFunction = true;
32949 this.initFunction(node, isAsync);
32950 if (params) this.setArrowFunctionParameters(node, params);
32951 var oldInGenerator = this.state.inGenerator;
32952 var oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
32953 this.state.inGenerator = false;
32954 this.state.maybeInArrowParameters = false;
32955 this.parseFunctionBody(node, true);
32956 this.state.inGenerator = oldInGenerator;
32957 this.state.inFunction = oldInFunc;
32958 this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
32959 return this.finishNode(node, "ArrowFunctionExpression");
32960 };
32961
32962 _proto.setArrowFunctionParameters = function setArrowFunctionParameters(node, params) {
32963 node.params = this.toAssignableList(params, true, "arrow function parameters");
32964 };
32965
32966 _proto.isStrictBody = function isStrictBody(node) {
32967 var isBlockStatement = node.body.type === "BlockStatement";
32968
32969 if (isBlockStatement && node.body.directives.length) {
32970 for (var _i4 = 0, _node$body$directives2 = node.body.directives; _i4 < _node$body$directives2.length; _i4++) {
32971 var directive = _node$body$directives2[_i4];
32972
32973 if (directive.value.value === "use strict") {
32974 return true;
32975 }
32976 }
32977 }
32978
32979 return false;
32980 };
32981
32982 _proto.parseFunctionBodyAndFinish = function parseFunctionBodyAndFinish(node, type, allowExpressionBody) {
32983 this.parseFunctionBody(node, allowExpressionBody);
32984 this.finishNode(node, type);
32985 };
32986
32987 _proto.parseFunctionBody = function parseFunctionBody(node, allowExpression) {
32988 var isExpression = allowExpression && !this.match(types.braceL);
32989 var oldInParameters = this.state.inParameters;
32990 var oldInAsync = this.state.inAsync;
32991 this.state.inParameters = false;
32992 this.state.inAsync = node.async;
32993
32994 if (isExpression) {
32995 node.body = this.parseMaybeAssign();
32996 } else {
32997 var oldInGen = this.state.inGenerator;
32998 var oldInFunc = this.state.inFunction;
32999 var oldLabels = this.state.labels;
33000 this.state.inGenerator = node.generator;
33001 this.state.inFunction = true;
33002 this.state.labels = [];
33003 node.body = this.parseBlock(true);
33004 this.state.inFunction = oldInFunc;
33005 this.state.inGenerator = oldInGen;
33006 this.state.labels = oldLabels;
33007 }
33008
33009 this.state.inAsync = oldInAsync;
33010 this.checkFunctionNameAndParams(node, allowExpression);
33011 this.state.inParameters = oldInParameters;
33012 };
33013
33014 _proto.checkFunctionNameAndParams = function checkFunctionNameAndParams(node, isArrowFunction) {
33015 var isStrict = this.isStrictBody(node);
33016 var checkLVal = this.state.strict || isStrict || isArrowFunction;
33017 var oldStrict = this.state.strict;
33018 if (isStrict) this.state.strict = isStrict;
33019
33020 if (checkLVal) {
33021 var nameHash = Object.create(null);
33022
33023 if (node.id) {
33024 this.checkLVal(node.id, true, undefined, "function name");
33025 }
33026
33027 for (var _i6 = 0, _node$params2 = node.params; _i6 < _node$params2.length; _i6++) {
33028 var param = _node$params2[_i6];
33029
33030 if (isStrict && param.type !== "Identifier") {
33031 this.raise(param.start, "Non-simple parameter in strict mode");
33032 }
33033
33034 this.checkLVal(param, true, nameHash, "function parameter list");
33035 }
33036 }
33037
33038 this.state.strict = oldStrict;
33039 };
33040
33041 _proto.parseExprList = function parseExprList(close, allowEmpty, refShorthandDefaultPos) {
33042 var elts = [];
33043 var first = true;
33044
33045 while (!this.eat(close)) {
33046 if (first) {
33047 first = false;
33048 } else {
33049 this.expect(types.comma);
33050 if (this.eat(close)) break;
33051 }
33052
33053 elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos));
33054 }
33055
33056 return elts;
33057 };
33058
33059 _proto.parseExprListItem = function parseExprListItem(allowEmpty, refShorthandDefaultPos, refNeedsArrowPos, refTrailingCommaPos) {
33060 var elt;
33061
33062 if (allowEmpty && this.match(types.comma)) {
33063 elt = null;
33064 } else if (this.match(types.ellipsis)) {
33065 var spreadNodeStartPos = this.state.start;
33066 var spreadNodeStartLoc = this.state.startLoc;
33067 elt = this.parseParenItem(this.parseSpread(refShorthandDefaultPos, refNeedsArrowPos), spreadNodeStartPos, spreadNodeStartLoc);
33068
33069 if (refTrailingCommaPos && this.match(types.comma)) {
33070 refTrailingCommaPos.start = this.state.start;
33071 }
33072 } else {
33073 elt = this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos);
33074 }
33075
33076 return elt;
33077 };
33078
33079 _proto.parseIdentifier = function parseIdentifier(liberal) {
33080 var node = this.startNode();
33081 var name = this.parseIdentifierName(node.start, liberal);
33082 node.name = name;
33083 node.loc.identifierName = name;
33084 return this.finishNode(node, "Identifier");
33085 };
33086
33087 _proto.parseIdentifierName = function parseIdentifierName(pos, liberal) {
33088 if (!liberal) {
33089 this.checkReservedWord(this.state.value, this.state.start, !!this.state.type.keyword, false);
33090 }
33091
33092 var name;
33093
33094 if (this.match(types.name)) {
33095 name = this.state.value;
33096 } else if (this.state.type.keyword) {
33097 name = this.state.type.keyword;
33098 } else {
33099 throw this.unexpected();
33100 }
33101
33102 if (!liberal && name === "await" && this.state.inAsync) {
33103 this.raise(pos, "invalid use of await inside of an async function");
33104 }
33105
33106 this.next();
33107 return name;
33108 };
33109
33110 _proto.checkReservedWord = function checkReservedWord(word, startLoc, checkKeywords, isBinding) {
33111 if (this.state.strict && (reservedWords.strict(word) || isBinding && reservedWords.strictBind(word))) {
33112 this.raise(startLoc, word + " is a reserved word in strict mode");
33113 }
33114
33115 if (this.state.inGenerator && word === "yield") {
33116 this.raise(startLoc, "yield is a reserved word inside generator functions");
33117 }
33118
33119 if (this.state.inClassProperty && word === "arguments") {
33120 this.raise(startLoc, "'arguments' is not allowed in class field initializer");
33121 }
33122
33123 if (this.isReservedWord(word) || checkKeywords && this.isKeyword(word)) {
33124 this.raise(startLoc, word + " is a reserved word");
33125 }
33126 };
33127
33128 _proto.parseAwait = function parseAwait(node) {
33129 if (!this.state.inAsync && (this.state.inFunction || !this.options.allowAwaitOutsideFunction)) {
33130 this.unexpected();
33131 }
33132
33133 if (this.match(types.star)) {
33134 this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.");
33135 }
33136
33137 node.argument = this.parseMaybeUnary();
33138 return this.finishNode(node, "AwaitExpression");
33139 };
33140
33141 _proto.parseYield = function parseYield() {
33142 var node = this.startNode();
33143
33144 if (this.state.inParameters) {
33145 this.raise(node.start, "yield is not allowed in generator parameters");
33146 }
33147
33148 if (this.state.maybeInArrowParameters && !this.state.yieldInPossibleArrowParameters) {
33149 this.state.yieldInPossibleArrowParameters = node;
33150 }
33151
33152 this.next();
33153
33154 if (this.match(types.semi) || this.canInsertSemicolon() || !this.match(types.star) && !this.state.type.startsExpr) {
33155 node.delegate = false;
33156 node.argument = null;
33157 } else {
33158 node.delegate = this.eat(types.star);
33159 node.argument = this.parseMaybeAssign();
33160 }
33161
33162 return this.finishNode(node, "YieldExpression");
33163 };
33164
33165 return ExpressionParser;
33166}(LValParser);
33167
33168var empty = [];
33169var loopLabel = {
33170 kind: "loop"
33171};
33172var switchLabel = {
33173 kind: "switch"
33174};
33175
33176var StatementParser = function (_ExpressionParser) {
33177 _inheritsLoose(StatementParser, _ExpressionParser);
33178
33179 function StatementParser() {
33180 return _ExpressionParser.apply(this, arguments) || this;
33181 }
33182
33183 var _proto = StatementParser.prototype;
33184
33185 _proto.parseTopLevel = function parseTopLevel(file, program) {
33186 program.sourceType = this.options.sourceType;
33187 program.interpreter = this.parseInterpreterDirective();
33188 this.parseBlockBody(program, true, true, types.eof);
33189 file.program = this.finishNode(program, "Program");
33190 file.comments = this.state.comments;
33191 if (this.options.tokens) file.tokens = this.state.tokens;
33192 return this.finishNode(file, "File");
33193 };
33194
33195 _proto.stmtToDirective = function stmtToDirective(stmt) {
33196 var expr = stmt.expression;
33197 var directiveLiteral = this.startNodeAt(expr.start, expr.loc.start);
33198 var directive = this.startNodeAt(stmt.start, stmt.loc.start);
33199 var raw = this.input.slice(expr.start, expr.end);
33200 var val = directiveLiteral.value = raw.slice(1, -1);
33201 this.addExtra(directiveLiteral, "raw", raw);
33202 this.addExtra(directiveLiteral, "rawValue", val);
33203 directive.value = this.finishNodeAt(directiveLiteral, "DirectiveLiteral", expr.end, expr.loc.end);
33204 return this.finishNodeAt(directive, "Directive", stmt.end, stmt.loc.end);
33205 };
33206
33207 _proto.parseInterpreterDirective = function parseInterpreterDirective() {
33208 if (!this.match(types.interpreterDirective)) {
33209 return null;
33210 }
33211
33212 var node = this.startNode();
33213 node.value = this.state.value;
33214 this.next();
33215 return this.finishNode(node, "InterpreterDirective");
33216 };
33217
33218 _proto.parseStatement = function parseStatement(declaration, topLevel) {
33219 if (this.match(types.at)) {
33220 this.parseDecorators(true);
33221 }
33222
33223 return this.parseStatementContent(declaration, topLevel);
33224 };
33225
33226 _proto.parseStatementContent = function parseStatementContent(declaration, topLevel) {
33227 var starttype = this.state.type;
33228 var node = this.startNode();
33229
33230 switch (starttype) {
33231 case types._break:
33232 case types._continue:
33233 return this.parseBreakContinueStatement(node, starttype.keyword);
33234
33235 case types._debugger:
33236 return this.parseDebuggerStatement(node);
33237
33238 case types._do:
33239 return this.parseDoStatement(node);
33240
33241 case types._for:
33242 return this.parseForStatement(node);
33243
33244 case types._function:
33245 if (this.lookahead().type === types.dot) break;
33246 if (!declaration) this.unexpected();
33247 return this.parseFunctionStatement(node);
33248
33249 case types._class:
33250 if (!declaration) this.unexpected();
33251 return this.parseClass(node, true);
33252
33253 case types._if:
33254 return this.parseIfStatement(node);
33255
33256 case types._return:
33257 return this.parseReturnStatement(node);
33258
33259 case types._switch:
33260 return this.parseSwitchStatement(node);
33261
33262 case types._throw:
33263 return this.parseThrowStatement(node);
33264
33265 case types._try:
33266 return this.parseTryStatement(node);
33267
33268 case types._let:
33269 case types._const:
33270 if (!declaration) this.unexpected();
33271
33272 case types._var:
33273 return this.parseVarStatement(node, starttype);
33274
33275 case types._while:
33276 return this.parseWhileStatement(node);
33277
33278 case types._with:
33279 return this.parseWithStatement(node);
33280
33281 case types.braceL:
33282 return this.parseBlock();
33283
33284 case types.semi:
33285 return this.parseEmptyStatement(node);
33286
33287 case types._export:
33288 case types._import:
33289 {
33290 var nextToken = this.lookahead();
33291
33292 if (nextToken.type === types.parenL || nextToken.type === types.dot) {
33293 break;
33294 }
33295
33296 if (!this.options.allowImportExportEverywhere && !topLevel) {
33297 this.raise(this.state.start, "'import' and 'export' may only appear at the top level");
33298 }
33299
33300 this.next();
33301 var result;
33302
33303 if (starttype == types._import) {
33304 result = this.parseImport(node);
33305
33306 if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
33307 this.sawUnambiguousESM = true;
33308 }
33309 } else {
33310 result = this.parseExport(node);
33311
33312 if (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportDefaultDeclaration") {
33313 this.sawUnambiguousESM = true;
33314 }
33315 }
33316
33317 this.assertModuleNodeAllowed(node);
33318 return result;
33319 }
33320
33321 case types.name:
33322 if (this.isContextual("async")) {
33323 var state = this.state.clone();
33324 this.next();
33325
33326 if (this.match(types._function) && !this.canInsertSemicolon()) {
33327 this.expect(types._function);
33328 return this.parseFunction(node, true, false, true);
33329 } else {
33330 this.state = state;
33331 }
33332 }
33333
33334 }
33335
33336 var maybeName = this.state.value;
33337 var expr = this.parseExpression();
33338
33339 if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon)) {
33340 return this.parseLabeledStatement(node, maybeName, expr);
33341 } else {
33342 return this.parseExpressionStatement(node, expr);
33343 }
33344 };
33345
33346 _proto.assertModuleNodeAllowed = function assertModuleNodeAllowed(node) {
33347 if (!this.options.allowImportExportEverywhere && !this.inModule) {
33348 this.raise(node.start, "'import' and 'export' may appear only with 'sourceType: \"module\"'", {
33349 code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
33350 });
33351 }
33352 };
33353
33354 _proto.takeDecorators = function takeDecorators(node) {
33355 var decorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
33356
33357 if (decorators.length) {
33358 node.decorators = decorators;
33359 this.resetStartLocationFromNode(node, decorators[0]);
33360 this.state.decoratorStack[this.state.decoratorStack.length - 1] = [];
33361 }
33362 };
33363
33364 _proto.canHaveLeadingDecorator = function canHaveLeadingDecorator() {
33365 return this.match(types._class);
33366 };
33367
33368 _proto.parseDecorators = function parseDecorators(allowExport) {
33369 var currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
33370
33371 while (this.match(types.at)) {
33372 var decorator = this.parseDecorator();
33373 currentContextDecorators.push(decorator);
33374 }
33375
33376 if (this.match(types._export)) {
33377 if (!allowExport) {
33378 this.unexpected();
33379 }
33380
33381 if (this.hasPlugin("decorators") && !this.getPluginOption("decorators", "decoratorsBeforeExport")) {
33382 this.raise(this.state.start, "Using the export keyword between a decorator and a class is not allowed. " + "Please use `export @dec class` instead.");
33383 }
33384 } else if (!this.canHaveLeadingDecorator()) {
33385 this.raise(this.state.start, "Leading decorators must be attached to a class declaration");
33386 }
33387 };
33388
33389 _proto.parseDecorator = function parseDecorator() {
33390 this.expectOnePlugin(["decorators-legacy", "decorators"]);
33391 var node = this.startNode();
33392 this.next();
33393
33394 if (this.hasPlugin("decorators")) {
33395 this.state.decoratorStack.push([]);
33396 var startPos = this.state.start;
33397 var startLoc = this.state.startLoc;
33398 var expr;
33399
33400 if (this.eat(types.parenL)) {
33401 expr = this.parseExpression();
33402 this.expect(types.parenR);
33403 } else {
33404 expr = this.parseIdentifier(false);
33405
33406 while (this.eat(types.dot)) {
33407 var _node = this.startNodeAt(startPos, startLoc);
33408
33409 _node.object = expr;
33410 _node.property = this.parseIdentifier(true);
33411 _node.computed = false;
33412 expr = this.finishNode(_node, "MemberExpression");
33413 }
33414 }
33415
33416 if (this.eat(types.parenL)) {
33417 var _node2 = this.startNodeAt(startPos, startLoc);
33418
33419 _node2.callee = expr;
33420 _node2.arguments = this.parseCallExpressionArguments(types.parenR, false);
33421 this.toReferencedList(_node2.arguments);
33422 expr = this.finishNode(_node2, "CallExpression");
33423 }
33424
33425 node.expression = expr;
33426 this.state.decoratorStack.pop();
33427 } else {
33428 node.expression = this.parseMaybeAssign();
33429 }
33430
33431 return this.finishNode(node, "Decorator");
33432 };
33433
33434 _proto.parseBreakContinueStatement = function parseBreakContinueStatement(node, keyword) {
33435 var isBreak = keyword === "break";
33436 this.next();
33437
33438 if (this.isLineTerminator()) {
33439 node.label = null;
33440 } else if (!this.match(types.name)) {
33441 this.unexpected();
33442 } else {
33443 node.label = this.parseIdentifier();
33444 this.semicolon();
33445 }
33446
33447 var i;
33448
33449 for (i = 0; i < this.state.labels.length; ++i) {
33450 var lab = this.state.labels[i];
33451
33452 if (node.label == null || lab.name === node.label.name) {
33453 if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
33454 if (node.label && isBreak) break;
33455 }
33456 }
33457
33458 if (i === this.state.labels.length) {
33459 this.raise(node.start, "Unsyntactic " + keyword);
33460 }
33461
33462 return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
33463 };
33464
33465 _proto.parseDebuggerStatement = function parseDebuggerStatement(node) {
33466 this.next();
33467 this.semicolon();
33468 return this.finishNode(node, "DebuggerStatement");
33469 };
33470
33471 _proto.parseDoStatement = function parseDoStatement(node) {
33472 this.next();
33473 this.state.labels.push(loopLabel);
33474 node.body = this.parseStatement(false);
33475 this.state.labels.pop();
33476 this.expect(types._while);
33477 node.test = this.parseParenExpression();
33478 this.eat(types.semi);
33479 return this.finishNode(node, "DoWhileStatement");
33480 };
33481
33482 _proto.parseForStatement = function parseForStatement(node) {
33483 this.next();
33484 this.state.labels.push(loopLabel);
33485 var forAwait = false;
33486
33487 if (this.state.inAsync && this.isContextual("await")) {
33488 this.expectPlugin("asyncGenerators");
33489 forAwait = true;
33490 this.next();
33491 }
33492
33493 this.expect(types.parenL);
33494
33495 if (this.match(types.semi)) {
33496 if (forAwait) {
33497 this.unexpected();
33498 }
33499
33500 return this.parseFor(node, null);
33501 }
33502
33503 if (this.match(types._var) || this.match(types._let) || this.match(types._const)) {
33504 var _init = this.startNode();
33505
33506 var varKind = this.state.type;
33507 this.next();
33508 this.parseVar(_init, true, varKind);
33509 this.finishNode(_init, "VariableDeclaration");
33510
33511 if (this.match(types._in) || this.isContextual("of")) {
33512 if (_init.declarations.length === 1) {
33513 var declaration = _init.declarations[0];
33514 var isForInInitializer = varKind === types._var && declaration.init && declaration.id.type != "ObjectPattern" && declaration.id.type != "ArrayPattern" && !this.isContextual("of");
33515
33516 if (this.state.strict && isForInInitializer) {
33517 this.raise(this.state.start, "for-in initializer in strict mode");
33518 } else if (isForInInitializer || !declaration.init) {
33519 return this.parseForIn(node, _init, forAwait);
33520 }
33521 }
33522 }
33523
33524 if (forAwait) {
33525 this.unexpected();
33526 }
33527
33528 return this.parseFor(node, _init);
33529 }
33530
33531 var refShorthandDefaultPos = {
33532 start: 0
33533 };
33534 var init = this.parseExpression(true, refShorthandDefaultPos);
33535
33536 if (this.match(types._in) || this.isContextual("of")) {
33537 var description = this.isContextual("of") ? "for-of statement" : "for-in statement";
33538 this.toAssignable(init, undefined, description);
33539 this.checkLVal(init, undefined, undefined, description);
33540 return this.parseForIn(node, init, forAwait);
33541 } else if (refShorthandDefaultPos.start) {
33542 this.unexpected(refShorthandDefaultPos.start);
33543 }
33544
33545 if (forAwait) {
33546 this.unexpected();
33547 }
33548
33549 return this.parseFor(node, init);
33550 };
33551
33552 _proto.parseFunctionStatement = function parseFunctionStatement(node) {
33553 this.next();
33554 return this.parseFunction(node, true);
33555 };
33556
33557 _proto.parseIfStatement = function parseIfStatement(node) {
33558 this.next();
33559 node.test = this.parseParenExpression();
33560 node.consequent = this.parseStatement(false);
33561 node.alternate = this.eat(types._else) ? this.parseStatement(false) : null;
33562 return this.finishNode(node, "IfStatement");
33563 };
33564
33565 _proto.parseReturnStatement = function parseReturnStatement(node) {
33566 if (!this.state.inFunction && !this.options.allowReturnOutsideFunction) {
33567 this.raise(this.state.start, "'return' outside of function");
33568 }
33569
33570 this.next();
33571
33572 if (this.isLineTerminator()) {
33573 node.argument = null;
33574 } else {
33575 node.argument = this.parseExpression();
33576 this.semicolon();
33577 }
33578
33579 return this.finishNode(node, "ReturnStatement");
33580 };
33581
33582 _proto.parseSwitchStatement = function parseSwitchStatement(node) {
33583 this.next();
33584 node.discriminant = this.parseParenExpression();
33585 var cases = node.cases = [];
33586 this.expect(types.braceL);
33587 this.state.labels.push(switchLabel);
33588 var cur;
33589
33590 for (var sawDefault; !this.match(types.braceR);) {
33591 if (this.match(types._case) || this.match(types._default)) {
33592 var isCase = this.match(types._case);
33593 if (cur) this.finishNode(cur, "SwitchCase");
33594 cases.push(cur = this.startNode());
33595 cur.consequent = [];
33596 this.next();
33597
33598 if (isCase) {
33599 cur.test = this.parseExpression();
33600 } else {
33601 if (sawDefault) {
33602 this.raise(this.state.lastTokStart, "Multiple default clauses");
33603 }
33604
33605 sawDefault = true;
33606 cur.test = null;
33607 }
33608
33609 this.expect(types.colon);
33610 } else {
33611 if (cur) {
33612 cur.consequent.push(this.parseStatement(true));
33613 } else {
33614 this.unexpected();
33615 }
33616 }
33617 }
33618
33619 if (cur) this.finishNode(cur, "SwitchCase");
33620 this.next();
33621 this.state.labels.pop();
33622 return this.finishNode(node, "SwitchStatement");
33623 };
33624
33625 _proto.parseThrowStatement = function parseThrowStatement(node) {
33626 this.next();
33627
33628 if (lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) {
33629 this.raise(this.state.lastTokEnd, "Illegal newline after throw");
33630 }
33631
33632 node.argument = this.parseExpression();
33633 this.semicolon();
33634 return this.finishNode(node, "ThrowStatement");
33635 };
33636
33637 _proto.parseTryStatement = function parseTryStatement(node) {
33638 this.next();
33639 node.block = this.parseBlock();
33640 node.handler = null;
33641
33642 if (this.match(types._catch)) {
33643 var clause = this.startNode();
33644 this.next();
33645
33646 if (this.match(types.parenL)) {
33647 this.expect(types.parenL);
33648 clause.param = this.parseBindingAtom();
33649 var clashes = Object.create(null);
33650 this.checkLVal(clause.param, true, clashes, "catch clause");
33651 this.expect(types.parenR);
33652 } else {
33653 this.expectPlugin("optionalCatchBinding");
33654 clause.param = null;
33655 }
33656
33657 clause.body = this.parseBlock();
33658 node.handler = this.finishNode(clause, "CatchClause");
33659 }
33660
33661 node.guardedHandlers = empty;
33662 node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
33663
33664 if (!node.handler && !node.finalizer) {
33665 this.raise(node.start, "Missing catch or finally clause");
33666 }
33667
33668 return this.finishNode(node, "TryStatement");
33669 };
33670
33671 _proto.parseVarStatement = function parseVarStatement(node, kind) {
33672 this.next();
33673 this.parseVar(node, false, kind);
33674 this.semicolon();
33675 return this.finishNode(node, "VariableDeclaration");
33676 };
33677
33678 _proto.parseWhileStatement = function parseWhileStatement(node) {
33679 this.next();
33680 node.test = this.parseParenExpression();
33681 this.state.labels.push(loopLabel);
33682 node.body = this.parseStatement(false);
33683 this.state.labels.pop();
33684 return this.finishNode(node, "WhileStatement");
33685 };
33686
33687 _proto.parseWithStatement = function parseWithStatement(node) {
33688 if (this.state.strict) {
33689 this.raise(this.state.start, "'with' in strict mode");
33690 }
33691
33692 this.next();
33693 node.object = this.parseParenExpression();
33694 node.body = this.parseStatement(false);
33695 return this.finishNode(node, "WithStatement");
33696 };
33697
33698 _proto.parseEmptyStatement = function parseEmptyStatement(node) {
33699 this.next();
33700 return this.finishNode(node, "EmptyStatement");
33701 };
33702
33703 _proto.parseLabeledStatement = function parseLabeledStatement(node, maybeName, expr) {
33704 for (var _i2 = 0, _this$state$labels2 = this.state.labels; _i2 < _this$state$labels2.length; _i2++) {
33705 var label = _this$state$labels2[_i2];
33706
33707 if (label.name === maybeName) {
33708 this.raise(expr.start, "Label '" + maybeName + "' is already declared");
33709 }
33710 }
33711
33712 var kind = this.state.type.isLoop ? "loop" : this.match(types._switch) ? "switch" : null;
33713
33714 for (var i = this.state.labels.length - 1; i >= 0; i--) {
33715 var _label = this.state.labels[i];
33716
33717 if (_label.statementStart === node.start) {
33718 _label.statementStart = this.state.start;
33719 _label.kind = kind;
33720 } else {
33721 break;
33722 }
33723 }
33724
33725 this.state.labels.push({
33726 name: maybeName,
33727 kind: kind,
33728 statementStart: this.state.start
33729 });
33730 node.body = this.parseStatement(true);
33731
33732 if (node.body.type == "ClassDeclaration" || node.body.type == "VariableDeclaration" && node.body.kind !== "var" || node.body.type == "FunctionDeclaration" && (this.state.strict || node.body.generator || node.body.async)) {
33733 this.raise(node.body.start, "Invalid labeled declaration");
33734 }
33735
33736 this.state.labels.pop();
33737 node.label = expr;
33738 return this.finishNode(node, "LabeledStatement");
33739 };
33740
33741 _proto.parseExpressionStatement = function parseExpressionStatement(node, expr) {
33742 node.expression = expr;
33743 this.semicolon();
33744 return this.finishNode(node, "ExpressionStatement");
33745 };
33746
33747 _proto.parseBlock = function parseBlock(allowDirectives) {
33748 var node = this.startNode();
33749 this.expect(types.braceL);
33750 this.parseBlockBody(node, allowDirectives, false, types.braceR);
33751 return this.finishNode(node, "BlockStatement");
33752 };
33753
33754 _proto.isValidDirective = function isValidDirective(stmt) {
33755 return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized;
33756 };
33757
33758 _proto.parseBlockBody = function parseBlockBody(node, allowDirectives, topLevel, end) {
33759 var body = node.body = [];
33760 var directives = node.directives = [];
33761 this.parseBlockOrModuleBlockBody(body, allowDirectives ? directives : undefined, topLevel, end);
33762 };
33763
33764 _proto.parseBlockOrModuleBlockBody = function parseBlockOrModuleBlockBody(body, directives, topLevel, end) {
33765 var parsedNonDirective = false;
33766 var oldStrict;
33767 var octalPosition;
33768
33769 while (!this.eat(end)) {
33770 if (!parsedNonDirective && this.state.containsOctal && !octalPosition) {
33771 octalPosition = this.state.octalPosition;
33772 }
33773
33774 var stmt = this.parseStatement(true, topLevel);
33775
33776 if (directives && !parsedNonDirective && this.isValidDirective(stmt)) {
33777 var directive = this.stmtToDirective(stmt);
33778 directives.push(directive);
33779
33780 if (oldStrict === undefined && directive.value.value === "use strict") {
33781 oldStrict = this.state.strict;
33782 this.setStrict(true);
33783
33784 if (octalPosition) {
33785 this.raise(octalPosition, "Octal literal in strict mode");
33786 }
33787 }
33788
33789 continue;
33790 }
33791
33792 parsedNonDirective = true;
33793 body.push(stmt);
33794 }
33795
33796 if (oldStrict === false) {
33797 this.setStrict(false);
33798 }
33799 };
33800
33801 _proto.parseFor = function parseFor(node, init) {
33802 node.init = init;
33803 this.expect(types.semi);
33804 node.test = this.match(types.semi) ? null : this.parseExpression();
33805 this.expect(types.semi);
33806 node.update = this.match(types.parenR) ? null : this.parseExpression();
33807 this.expect(types.parenR);
33808 node.body = this.parseStatement(false);
33809 this.state.labels.pop();
33810 return this.finishNode(node, "ForStatement");
33811 };
33812
33813 _proto.parseForIn = function parseForIn(node, init, forAwait) {
33814 var type = this.match(types._in) ? "ForInStatement" : "ForOfStatement";
33815
33816 if (forAwait) {
33817 this.eatContextual("of");
33818 } else {
33819 this.next();
33820 }
33821
33822 if (type === "ForOfStatement") {
33823 node.await = !!forAwait;
33824 }
33825
33826 node.left = init;
33827 node.right = this.parseExpression();
33828 this.expect(types.parenR);
33829 node.body = this.parseStatement(false);
33830 this.state.labels.pop();
33831 return this.finishNode(node, type);
33832 };
33833
33834 _proto.parseVar = function parseVar(node, isFor, kind) {
33835 var declarations = node.declarations = [];
33836 node.kind = kind.keyword;
33837
33838 for (;;) {
33839 var decl = this.startNode();
33840 this.parseVarHead(decl);
33841
33842 if (this.eat(types.eq)) {
33843 decl.init = this.parseMaybeAssign(isFor);
33844 } else {
33845 if (kind === types._const && !(this.match(types._in) || this.isContextual("of"))) {
33846 if (!this.hasPlugin("typescript")) {
33847 this.unexpected();
33848 }
33849 } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(types._in) || this.isContextual("of")))) {
33850 this.raise(this.state.lastTokEnd, "Complex binding patterns require an initialization value");
33851 }
33852
33853 decl.init = null;
33854 }
33855
33856 declarations.push(this.finishNode(decl, "VariableDeclarator"));
33857 if (!this.eat(types.comma)) break;
33858 }
33859
33860 return node;
33861 };
33862
33863 _proto.parseVarHead = function parseVarHead(decl) {
33864 decl.id = this.parseBindingAtom();
33865 this.checkLVal(decl.id, true, undefined, "variable declaration");
33866 };
33867
33868 _proto.parseFunction = function parseFunction(node, isStatement, allowExpressionBody, isAsync, optionalId) {
33869 var oldInFunc = this.state.inFunction;
33870 var oldInMethod = this.state.inMethod;
33871 var oldInGenerator = this.state.inGenerator;
33872 var oldInClassProperty = this.state.inClassProperty;
33873 this.state.inFunction = true;
33874 this.state.inMethod = false;
33875 this.state.inClassProperty = false;
33876 this.initFunction(node, isAsync);
33877
33878 if (this.match(types.star)) {
33879 if (node.async) {
33880 this.expectPlugin("asyncGenerators");
33881 }
33882
33883 node.generator = true;
33884 this.next();
33885 }
33886
33887 if (isStatement && !optionalId && !this.match(types.name) && !this.match(types._yield)) {
33888 this.unexpected();
33889 }
33890
33891 if (!isStatement) this.state.inGenerator = node.generator;
33892
33893 if (this.match(types.name) || this.match(types._yield)) {
33894 node.id = this.parseBindingIdentifier();
33895 }
33896
33897 if (isStatement) this.state.inGenerator = node.generator;
33898 this.parseFunctionParams(node);
33899 this.parseFunctionBodyAndFinish(node, isStatement ? "FunctionDeclaration" : "FunctionExpression", allowExpressionBody);
33900 this.state.inFunction = oldInFunc;
33901 this.state.inMethod = oldInMethod;
33902 this.state.inGenerator = oldInGenerator;
33903 this.state.inClassProperty = oldInClassProperty;
33904 return node;
33905 };
33906
33907 _proto.parseFunctionParams = function parseFunctionParams(node, allowModifiers) {
33908 var oldInParameters = this.state.inParameters;
33909 this.state.inParameters = true;
33910 this.expect(types.parenL);
33911 node.params = this.parseBindingList(types.parenR, false, allowModifiers);
33912 this.state.inParameters = oldInParameters;
33913 };
33914
33915 _proto.parseClass = function parseClass(node, isStatement, optionalId) {
33916 this.next();
33917 this.takeDecorators(node);
33918 this.parseClassId(node, isStatement, optionalId);
33919 this.parseClassSuper(node);
33920 this.parseClassBody(node);
33921 return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
33922 };
33923
33924 _proto.isClassProperty = function isClassProperty() {
33925 return this.match(types.eq) || this.match(types.semi) || this.match(types.braceR);
33926 };
33927
33928 _proto.isClassMethod = function isClassMethod() {
33929 return this.match(types.parenL);
33930 };
33931
33932 _proto.isNonstaticConstructor = function isNonstaticConstructor(method) {
33933 return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
33934 };
33935
33936 _proto.parseClassBody = function parseClassBody(node) {
33937 var oldStrict = this.state.strict;
33938 this.state.strict = true;
33939 this.state.classLevel++;
33940 var state = {
33941 hadConstructor: false
33942 };
33943 var decorators = [];
33944 var classBody = this.startNode();
33945 classBody.body = [];
33946 this.expect(types.braceL);
33947
33948 while (!this.eat(types.braceR)) {
33949 if (this.eat(types.semi)) {
33950 if (decorators.length > 0) {
33951 this.raise(this.state.lastTokEnd, "Decorators must not be followed by a semicolon");
33952 }
33953
33954 continue;
33955 }
33956
33957 if (this.match(types.at)) {
33958 decorators.push(this.parseDecorator());
33959 continue;
33960 }
33961
33962 var member = this.startNode();
33963
33964 if (decorators.length) {
33965 member.decorators = decorators;
33966 this.resetStartLocationFromNode(member, decorators[0]);
33967 decorators = [];
33968 }
33969
33970 this.parseClassMember(classBody, member, state);
33971
33972 if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
33973 this.raise(member.start, "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?");
33974 }
33975 }
33976
33977 if (decorators.length) {
33978 this.raise(this.state.start, "You have trailing decorators with no method");
33979 }
33980
33981 node.body = this.finishNode(classBody, "ClassBody");
33982 this.state.classLevel--;
33983 this.state.strict = oldStrict;
33984 };
33985
33986 _proto.parseClassMember = function parseClassMember(classBody, member, state) {
33987 var isStatic = false;
33988 var containsEsc = this.state.containsEsc;
33989
33990 if (this.match(types.name) && this.state.value === "static") {
33991 var key = this.parseIdentifier(true);
33992
33993 if (this.isClassMethod()) {
33994 var method = member;
33995 method.kind = "method";
33996 method.computed = false;
33997 method.key = key;
33998 method.static = false;
33999 this.pushClassMethod(classBody, method, false, false, false);
34000 return;
34001 } else if (this.isClassProperty()) {
34002 var prop = member;
34003 prop.computed = false;
34004 prop.key = key;
34005 prop.static = false;
34006 classBody.body.push(this.parseClassProperty(prop));
34007 return;
34008 } else if (containsEsc) {
34009 throw this.unexpected();
34010 }
34011
34012 isStatic = true;
34013 }
34014
34015 this.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
34016 };
34017
34018 _proto.parseClassMemberWithIsStatic = function parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
34019 var publicMethod = member;
34020 var privateMethod = member;
34021 var publicProp = member;
34022 var privateProp = member;
34023 var method = publicMethod;
34024 var publicMember = publicMethod;
34025 member.static = isStatic;
34026
34027 if (this.eat(types.star)) {
34028 method.kind = "method";
34029 this.parseClassPropertyName(method);
34030
34031 if (method.key.type === "PrivateName") {
34032 this.pushClassPrivateMethod(classBody, privateMethod, true, false);
34033 return;
34034 }
34035
34036 if (this.isNonstaticConstructor(publicMethod)) {
34037 this.raise(publicMethod.key.start, "Constructor can't be a generator");
34038 }
34039
34040 this.pushClassMethod(classBody, publicMethod, true, false, false);
34041 return;
34042 }
34043
34044 var key = this.parseClassPropertyName(member);
34045 var isPrivate = key.type === "PrivateName";
34046 var isSimple = key.type === "Identifier";
34047 this.parsePostMemberNameModifiers(publicMember);
34048
34049 if (this.isClassMethod()) {
34050 method.kind = "method";
34051
34052 if (isPrivate) {
34053 this.pushClassPrivateMethod(classBody, privateMethod, false, false);
34054 return;
34055 }
34056
34057 var isConstructor = this.isNonstaticConstructor(publicMethod);
34058
34059 if (isConstructor) {
34060 publicMethod.kind = "constructor";
34061
34062 if (publicMethod.decorators) {
34063 this.raise(publicMethod.start, "You can't attach decorators to a class constructor");
34064 }
34065
34066 if (state.hadConstructor && !this.hasPlugin("typescript")) {
34067 this.raise(key.start, "Duplicate constructor in the same class");
34068 }
34069
34070 state.hadConstructor = true;
34071 }
34072
34073 this.pushClassMethod(classBody, publicMethod, false, false, isConstructor);
34074 } else if (this.isClassProperty()) {
34075 if (isPrivate) {
34076 this.pushClassPrivateProperty(classBody, privateProp);
34077 } else {
34078 this.pushClassProperty(classBody, publicProp);
34079 }
34080 } else if (isSimple && key.name === "async" && !this.isLineTerminator()) {
34081 var isGenerator = this.match(types.star);
34082
34083 if (isGenerator) {
34084 this.expectPlugin("asyncGenerators");
34085 this.next();
34086 }
34087
34088 method.kind = "method";
34089 this.parseClassPropertyName(method);
34090
34091 if (method.key.type === "PrivateName") {
34092 this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
34093 } else {
34094 if (this.isNonstaticConstructor(publicMethod)) {
34095 this.raise(publicMethod.key.start, "Constructor can't be an async function");
34096 }
34097
34098 this.pushClassMethod(classBody, publicMethod, isGenerator, true, false);
34099 }
34100 } else if (isSimple && (key.name === "get" || key.name === "set") && !(this.isLineTerminator() && this.match(types.star))) {
34101 method.kind = key.name;
34102 this.parseClassPropertyName(publicMethod);
34103
34104 if (method.key.type === "PrivateName") {
34105 this.pushClassPrivateMethod(classBody, privateMethod, false, false);
34106 } else {
34107 if (this.isNonstaticConstructor(publicMethod)) {
34108 this.raise(publicMethod.key.start, "Constructor can't have get/set modifier");
34109 }
34110
34111 this.pushClassMethod(classBody, publicMethod, false, false, false);
34112 }
34113
34114 this.checkGetterSetterParams(publicMethod);
34115 } else if (this.isLineTerminator()) {
34116 if (isPrivate) {
34117 this.pushClassPrivateProperty(classBody, privateProp);
34118 } else {
34119 this.pushClassProperty(classBody, publicProp);
34120 }
34121 } else {
34122 this.unexpected();
34123 }
34124 };
34125
34126 _proto.parseClassPropertyName = function parseClassPropertyName(member) {
34127 var key = this.parsePropertyName(member);
34128
34129 if (!member.computed && member.static && (key.name === "prototype" || key.value === "prototype")) {
34130 this.raise(key.start, "Classes may not have static property named prototype");
34131 }
34132
34133 if (key.type === "PrivateName" && key.id.name === "constructor") {
34134 this.raise(key.start, "Classes may not have a private field named '#constructor'");
34135 }
34136
34137 return key;
34138 };
34139
34140 _proto.pushClassProperty = function pushClassProperty(classBody, prop) {
34141 if (this.isNonstaticConstructor(prop)) {
34142 this.raise(prop.key.start, "Classes may not have a non-static field named 'constructor'");
34143 }
34144
34145 classBody.body.push(this.parseClassProperty(prop));
34146 };
34147
34148 _proto.pushClassPrivateProperty = function pushClassPrivateProperty(classBody, prop) {
34149 this.expectPlugin("classPrivateProperties", prop.key.start);
34150 classBody.body.push(this.parseClassPrivateProperty(prop));
34151 };
34152
34153 _proto.pushClassMethod = function pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor) {
34154 classBody.body.push(this.parseMethod(method, isGenerator, isAsync, isConstructor, "ClassMethod"));
34155 };
34156
34157 _proto.pushClassPrivateMethod = function pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
34158 this.expectPlugin("classPrivateMethods", method.key.start);
34159 classBody.body.push(this.parseMethod(method, isGenerator, isAsync, false, "ClassPrivateMethod"));
34160 };
34161
34162 _proto.parsePostMemberNameModifiers = function parsePostMemberNameModifiers(methodOrProp) {};
34163
34164 _proto.parseAccessModifier = function parseAccessModifier() {
34165 return undefined;
34166 };
34167
34168 _proto.parseClassPrivateProperty = function parseClassPrivateProperty(node) {
34169 var oldInMethod = this.state.inMethod;
34170 this.state.inMethod = false;
34171 this.state.inClassProperty = true;
34172 node.value = this.eat(types.eq) ? this.parseMaybeAssign() : null;
34173 this.semicolon();
34174 this.state.inClassProperty = false;
34175 this.state.inMethod = oldInMethod;
34176 return this.finishNode(node, "ClassPrivateProperty");
34177 };
34178
34179 _proto.parseClassProperty = function parseClassProperty(node) {
34180 if (!node.typeAnnotation) {
34181 this.expectPlugin("classProperties");
34182 }
34183
34184 var oldInMethod = this.state.inMethod;
34185 this.state.inMethod = false;
34186 this.state.inClassProperty = true;
34187
34188 if (this.match(types.eq)) {
34189 this.expectPlugin("classProperties");
34190 this.next();
34191 node.value = this.parseMaybeAssign();
34192 } else {
34193 node.value = null;
34194 }
34195
34196 this.semicolon();
34197 this.state.inClassProperty = false;
34198 this.state.inMethod = oldInMethod;
34199 return this.finishNode(node, "ClassProperty");
34200 };
34201
34202 _proto.parseClassId = function parseClassId(node, isStatement, optionalId) {
34203 if (this.match(types.name)) {
34204 node.id = this.parseIdentifier();
34205 } else {
34206 if (optionalId || !isStatement) {
34207 node.id = null;
34208 } else {
34209 this.unexpected(null, "A class name is required");
34210 }
34211 }
34212 };
34213
34214 _proto.parseClassSuper = function parseClassSuper(node) {
34215 node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
34216 };
34217
34218 _proto.parseExport = function parseExport(node) {
34219 if (this.shouldParseExportStar()) {
34220 this.parseExportStar(node);
34221 if (node.type === "ExportAllDeclaration") return node;
34222 } else if (this.isExportDefaultSpecifier()) {
34223 this.expectPlugin("exportDefaultFrom");
34224 var specifier = this.startNode();
34225 specifier.exported = this.parseIdentifier(true);
34226 var specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
34227 node.specifiers = specifiers;
34228
34229 if (this.match(types.comma) && this.lookahead().type === types.star) {
34230 this.expect(types.comma);
34231
34232 var _specifier = this.startNode();
34233
34234 this.expect(types.star);
34235 this.expectContextual("as");
34236 _specifier.exported = this.parseIdentifier();
34237 specifiers.push(this.finishNode(_specifier, "ExportNamespaceSpecifier"));
34238 } else {
34239 this.parseExportSpecifiersMaybe(node);
34240 }
34241
34242 this.parseExportFrom(node, true);
34243 } else if (this.eat(types._default)) {
34244 node.declaration = this.parseExportDefaultExpression();
34245 this.checkExport(node, true, true);
34246 return this.finishNode(node, "ExportDefaultDeclaration");
34247 } else if (this.shouldParseExportDeclaration()) {
34248 if (this.isContextual("async")) {
34249 var next = this.lookahead();
34250
34251 if (next.type !== types._function) {
34252 this.unexpected(next.start, "Unexpected token, expected \"function\"");
34253 }
34254 }
34255
34256 node.specifiers = [];
34257 node.source = null;
34258 node.declaration = this.parseExportDeclaration(node);
34259 } else {
34260 node.declaration = null;
34261 node.specifiers = this.parseExportSpecifiers();
34262 this.parseExportFrom(node);
34263 }
34264
34265 this.checkExport(node, true);
34266 return this.finishNode(node, "ExportNamedDeclaration");
34267 };
34268
34269 _proto.parseExportDefaultExpression = function parseExportDefaultExpression() {
34270 var expr = this.startNode();
34271
34272 if (this.eat(types._function)) {
34273 return this.parseFunction(expr, true, false, false, true);
34274 } else if (this.isContextual("async") && this.lookahead().type === types._function) {
34275 this.eatContextual("async");
34276 this.eat(types._function);
34277 return this.parseFunction(expr, true, false, true, true);
34278 } else if (this.match(types._class)) {
34279 return this.parseClass(expr, true, true);
34280 } else if (this.match(types.at)) {
34281 if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport")) {
34282 this.unexpected(this.state.start, "Decorators must be placed *before* the 'export' keyword." + " You can set the 'decoratorsBeforeExport' option to false to use" + " the 'export @decorator class {}' syntax");
34283 }
34284
34285 this.parseDecorators(false);
34286 return this.parseClass(expr, true, true);
34287 } else if (this.match(types._let) || this.match(types._const) || this.match(types._var)) {
34288 return this.raise(this.state.start, "Only expressions, functions or classes are allowed as the `default` export.");
34289 } else {
34290 var res = this.parseMaybeAssign();
34291 this.semicolon();
34292 return res;
34293 }
34294 };
34295
34296 _proto.parseExportDeclaration = function parseExportDeclaration(node) {
34297 return this.parseStatement(true);
34298 };
34299
34300 _proto.isExportDefaultSpecifier = function isExportDefaultSpecifier() {
34301 if (this.match(types.name)) {
34302 return this.state.value !== "async";
34303 }
34304
34305 if (!this.match(types._default)) {
34306 return false;
34307 }
34308
34309 var lookahead = this.lookahead();
34310 return lookahead.type === types.comma || lookahead.type === types.name && lookahead.value === "from";
34311 };
34312
34313 _proto.parseExportSpecifiersMaybe = function parseExportSpecifiersMaybe(node) {
34314 if (this.eat(types.comma)) {
34315 node.specifiers = node.specifiers.concat(this.parseExportSpecifiers());
34316 }
34317 };
34318
34319 _proto.parseExportFrom = function parseExportFrom(node, expect) {
34320 if (this.eatContextual("from")) {
34321 node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected();
34322 this.checkExport(node);
34323 } else {
34324 if (expect) {
34325 this.unexpected();
34326 } else {
34327 node.source = null;
34328 }
34329 }
34330
34331 this.semicolon();
34332 };
34333
34334 _proto.shouldParseExportStar = function shouldParseExportStar() {
34335 return this.match(types.star);
34336 };
34337
34338 _proto.parseExportStar = function parseExportStar(node) {
34339 this.expect(types.star);
34340
34341 if (this.isContextual("as")) {
34342 this.parseExportNamespace(node);
34343 } else {
34344 this.parseExportFrom(node, true);
34345 this.finishNode(node, "ExportAllDeclaration");
34346 }
34347 };
34348
34349 _proto.parseExportNamespace = function parseExportNamespace(node) {
34350 this.expectPlugin("exportNamespaceFrom");
34351 var specifier = this.startNodeAt(this.state.lastTokStart, this.state.lastTokStartLoc);
34352 this.next();
34353 specifier.exported = this.parseIdentifier(true);
34354 node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
34355 this.parseExportSpecifiersMaybe(node);
34356 this.parseExportFrom(node, true);
34357 };
34358
34359 _proto.shouldParseExportDeclaration = function shouldParseExportDeclaration() {
34360 if (this.match(types.at)) {
34361 this.expectOnePlugin(["decorators", "decorators-legacy"]);
34362
34363 if (this.hasPlugin("decorators")) {
34364 if (this.getPluginOption("decorators", "decoratorsBeforeExport")) {
34365 this.unexpected(this.state.start, "Decorators must be placed *before* the 'export' keyword." + " You can set the 'decoratorsBeforeExport' option to false to use" + " the 'export @decorator class {}' syntax");
34366 } else {
34367 return true;
34368 }
34369 }
34370 }
34371
34372 return this.state.type.keyword === "var" || this.state.type.keyword === "const" || this.state.type.keyword === "let" || this.state.type.keyword === "function" || this.state.type.keyword === "class" || this.isContextual("async");
34373 };
34374
34375 _proto.checkExport = function checkExport(node, checkNames, isDefault) {
34376 if (checkNames) {
34377 if (isDefault) {
34378 this.checkDuplicateExports(node, "default");
34379 } else if (node.specifiers && node.specifiers.length) {
34380 for (var _i4 = 0, _node$specifiers2 = node.specifiers; _i4 < _node$specifiers2.length; _i4++) {
34381 var specifier = _node$specifiers2[_i4];
34382 this.checkDuplicateExports(specifier, specifier.exported.name);
34383 }
34384 } else if (node.declaration) {
34385 if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") {
34386 var id = node.declaration.id;
34387 if (!id) throw new Error("Assertion failure");
34388 this.checkDuplicateExports(node, id.name);
34389 } else if (node.declaration.type === "VariableDeclaration") {
34390 for (var _i6 = 0, _node$declaration$dec2 = node.declaration.declarations; _i6 < _node$declaration$dec2.length; _i6++) {
34391 var declaration = _node$declaration$dec2[_i6];
34392 this.checkDeclaration(declaration.id);
34393 }
34394 }
34395 }
34396 }
34397
34398 var currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
34399
34400 if (currentContextDecorators.length) {
34401 var isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression");
34402
34403 if (!node.declaration || !isClass) {
34404 throw this.raise(node.start, "You can only use decorators on an export when exporting a class");
34405 }
34406
34407 this.takeDecorators(node.declaration);
34408 }
34409 };
34410
34411 _proto.checkDeclaration = function checkDeclaration(node) {
34412 if (node.type === "ObjectPattern") {
34413 for (var _i8 = 0, _node$properties2 = node.properties; _i8 < _node$properties2.length; _i8++) {
34414 var prop = _node$properties2[_i8];
34415 this.checkDeclaration(prop);
34416 }
34417 } else if (node.type === "ArrayPattern") {
34418 for (var _i10 = 0, _node$elements2 = node.elements; _i10 < _node$elements2.length; _i10++) {
34419 var elem = _node$elements2[_i10];
34420
34421 if (elem) {
34422 this.checkDeclaration(elem);
34423 }
34424 }
34425 } else if (node.type === "ObjectProperty") {
34426 this.checkDeclaration(node.value);
34427 } else if (node.type === "RestElement") {
34428 this.checkDeclaration(node.argument);
34429 } else if (node.type === "Identifier") {
34430 this.checkDuplicateExports(node, node.name);
34431 }
34432 };
34433
34434 _proto.checkDuplicateExports = function checkDuplicateExports(node, name) {
34435 if (this.state.exportedIdentifiers.indexOf(name) > -1) {
34436 this.raiseDuplicateExportError(node, name);
34437 }
34438
34439 this.state.exportedIdentifiers.push(name);
34440 };
34441
34442 _proto.raiseDuplicateExportError = function raiseDuplicateExportError(node, name) {
34443 throw this.raise(node.start, name === "default" ? "Only one default export allowed per module." : "`" + name + "` has already been exported. Exported identifiers must be unique.");
34444 };
34445
34446 _proto.parseExportSpecifiers = function parseExportSpecifiers() {
34447 var nodes = [];
34448 var first = true;
34449 var needsFrom;
34450 this.expect(types.braceL);
34451
34452 while (!this.eat(types.braceR)) {
34453 if (first) {
34454 first = false;
34455 } else {
34456 this.expect(types.comma);
34457 if (this.eat(types.braceR)) break;
34458 }
34459
34460 var isDefault = this.match(types._default);
34461 if (isDefault && !needsFrom) needsFrom = true;
34462 var node = this.startNode();
34463 node.local = this.parseIdentifier(isDefault);
34464 node.exported = this.eatContextual("as") ? this.parseIdentifier(true) : node.local.__clone();
34465 nodes.push(this.finishNode(node, "ExportSpecifier"));
34466 }
34467
34468 if (needsFrom && !this.isContextual("from")) {
34469 this.unexpected();
34470 }
34471
34472 return nodes;
34473 };
34474
34475 _proto.parseImport = function parseImport(node) {
34476 if (this.match(types.string)) {
34477 node.specifiers = [];
34478 node.source = this.parseExprAtom();
34479 } else {
34480 node.specifiers = [];
34481 this.parseImportSpecifiers(node);
34482 this.expectContextual("from");
34483 node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected();
34484 }
34485
34486 this.semicolon();
34487 return this.finishNode(node, "ImportDeclaration");
34488 };
34489
34490 _proto.shouldParseDefaultImport = function shouldParseDefaultImport(node) {
34491 return this.match(types.name);
34492 };
34493
34494 _proto.parseImportSpecifierLocal = function parseImportSpecifierLocal(node, specifier, type, contextDescription) {
34495 specifier.local = this.parseIdentifier();
34496 this.checkLVal(specifier.local, true, undefined, contextDescription);
34497 node.specifiers.push(this.finishNode(specifier, type));
34498 };
34499
34500 _proto.parseImportSpecifiers = function parseImportSpecifiers(node) {
34501 var first = true;
34502
34503 if (this.shouldParseDefaultImport(node)) {
34504 this.parseImportSpecifierLocal(node, this.startNode(), "ImportDefaultSpecifier", "default import specifier");
34505 if (!this.eat(types.comma)) return;
34506 }
34507
34508 if (this.match(types.star)) {
34509 var specifier = this.startNode();
34510 this.next();
34511 this.expectContextual("as");
34512 this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier", "import namespace specifier");
34513 return;
34514 }
34515
34516 this.expect(types.braceL);
34517
34518 while (!this.eat(types.braceR)) {
34519 if (first) {
34520 first = false;
34521 } else {
34522 if (this.eat(types.colon)) {
34523 this.unexpected(null, "ES2015 named imports do not destructure. " + "Use another statement for destructuring after the import.");
34524 }
34525
34526 this.expect(types.comma);
34527 if (this.eat(types.braceR)) break;
34528 }
34529
34530 this.parseImportSpecifier(node);
34531 }
34532 };
34533
34534 _proto.parseImportSpecifier = function parseImportSpecifier(node) {
34535 var specifier = this.startNode();
34536 specifier.imported = this.parseIdentifier(true);
34537
34538 if (this.eatContextual("as")) {
34539 specifier.local = this.parseIdentifier();
34540 } else {
34541 this.checkReservedWord(specifier.imported.name, specifier.start, true, true);
34542 specifier.local = specifier.imported.__clone();
34543 }
34544
34545 this.checkLVal(specifier.local, true, undefined, "import specifier");
34546 node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
34547 };
34548
34549 return StatementParser;
34550}(ExpressionParser);
34551
34552var Parser = function (_StatementParser) {
34553 _inheritsLoose(Parser, _StatementParser);
34554
34555 function Parser(options, input) {
34556 var _this;
34557
34558 options = getOptions(options);
34559 _this = _StatementParser.call(this, options, input) || this;
34560 _this.options = options;
34561 _this.inModule = _this.options.sourceType === "module";
34562 _this.input = input;
34563 _this.plugins = pluginsMap(_this.options.plugins);
34564 _this.filename = options.sourceFilename;
34565 return _this;
34566 }
34567
34568 var _proto = Parser.prototype;
34569
34570 _proto.parse = function parse() {
34571 var file = this.startNode();
34572 var program = this.startNode();
34573 this.nextToken();
34574 return this.parseTopLevel(file, program);
34575 };
34576
34577 return Parser;
34578}(StatementParser);
34579
34580function pluginsMap(plugins) {
34581 var pluginMap = Object.create(null);
34582
34583 for (var _i2 = 0; _i2 < plugins.length; _i2++) {
34584 var plugin = plugins[_i2];
34585
34586 var _ref = Array.isArray(plugin) ? plugin : [plugin, {}],
34587 name = _ref[0],
34588 _ref$ = _ref[1],
34589 options = _ref$ === void 0 ? {} : _ref$;
34590
34591 if (!pluginMap[name]) pluginMap[name] = options || {};
34592 }
34593
34594 return pluginMap;
34595}
34596
34597function nonNull(x) {
34598 if (x == null) {
34599 throw new Error("Unexpected " + x + " value.");
34600 }
34601
34602 return x;
34603}
34604
34605function assert(x) {
34606 if (!x) {
34607 throw new Error("Assert fail");
34608 }
34609}
34610
34611function keywordTypeFromName(value) {
34612 switch (value) {
34613 case "any":
34614 return "TSAnyKeyword";
34615
34616 case "boolean":
34617 return "TSBooleanKeyword";
34618
34619 case "never":
34620 return "TSNeverKeyword";
34621
34622 case "number":
34623 return "TSNumberKeyword";
34624
34625 case "object":
34626 return "TSObjectKeyword";
34627
34628 case "string":
34629 return "TSStringKeyword";
34630
34631 case "symbol":
34632 return "TSSymbolKeyword";
34633
34634 case "undefined":
34635 return "TSUndefinedKeyword";
34636
34637 default:
34638 return undefined;
34639 }
34640}
34641
34642var typescript = (function (superClass) {
34643 return function (_superClass) {
34644 _inheritsLoose(_class, _superClass);
34645
34646 function _class() {
34647 return _superClass.apply(this, arguments) || this;
34648 }
34649
34650 var _proto = _class.prototype;
34651
34652 _proto.tsIsIdentifier = function tsIsIdentifier() {
34653 return this.match(types.name);
34654 };
34655
34656 _proto.tsNextTokenCanFollowModifier = function tsNextTokenCanFollowModifier() {
34657 this.next();
34658 return !this.hasPrecedingLineBreak() && !this.match(types.parenL) && !this.match(types.parenR) && !this.match(types.colon) && !this.match(types.eq) && !this.match(types.question);
34659 };
34660
34661 _proto.tsParseModifier = function tsParseModifier(allowedModifiers) {
34662 if (!this.match(types.name)) {
34663 return undefined;
34664 }
34665
34666 var modifier = this.state.value;
34667
34668 if (allowedModifiers.indexOf(modifier) !== -1 && this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
34669 return modifier;
34670 }
34671
34672 return undefined;
34673 };
34674
34675 _proto.tsIsListTerminator = function tsIsListTerminator(kind) {
34676 switch (kind) {
34677 case "EnumMembers":
34678 case "TypeMembers":
34679 return this.match(types.braceR);
34680
34681 case "HeritageClauseElement":
34682 return this.match(types.braceL);
34683
34684 case "TupleElementTypes":
34685 return this.match(types.bracketR);
34686
34687 case "TypeParametersOrArguments":
34688 return this.isRelational(">");
34689 }
34690
34691 throw new Error("Unreachable");
34692 };
34693
34694 _proto.tsParseList = function tsParseList(kind, parseElement) {
34695 var result = [];
34696
34697 while (!this.tsIsListTerminator(kind)) {
34698 result.push(parseElement());
34699 }
34700
34701 return result;
34702 };
34703
34704 _proto.tsParseDelimitedList = function tsParseDelimitedList(kind, parseElement) {
34705 return nonNull(this.tsParseDelimitedListWorker(kind, parseElement, true));
34706 };
34707
34708 _proto.tsTryParseDelimitedList = function tsTryParseDelimitedList(kind, parseElement) {
34709 return this.tsParseDelimitedListWorker(kind, parseElement, false);
34710 };
34711
34712 _proto.tsParseDelimitedListWorker = function tsParseDelimitedListWorker(kind, parseElement, expectSuccess) {
34713 var result = [];
34714
34715 while (true) {
34716 if (this.tsIsListTerminator(kind)) {
34717 break;
34718 }
34719
34720 var element = parseElement();
34721
34722 if (element == null) {
34723 return undefined;
34724 }
34725
34726 result.push(element);
34727
34728 if (this.eat(types.comma)) {
34729 continue;
34730 }
34731
34732 if (this.tsIsListTerminator(kind)) {
34733 break;
34734 }
34735
34736 if (expectSuccess) {
34737 this.expect(types.comma);
34738 }
34739
34740 return undefined;
34741 }
34742
34743 return result;
34744 };
34745
34746 _proto.tsParseBracketedList = function tsParseBracketedList(kind, parseElement, bracket, skipFirstToken) {
34747 if (!skipFirstToken) {
34748 if (bracket) {
34749 this.expect(types.bracketL);
34750 } else {
34751 this.expectRelational("<");
34752 }
34753 }
34754
34755 var result = this.tsParseDelimitedList(kind, parseElement);
34756
34757 if (bracket) {
34758 this.expect(types.bracketR);
34759 } else {
34760 this.expectRelational(">");
34761 }
34762
34763 return result;
34764 };
34765
34766 _proto.tsParseEntityName = function tsParseEntityName(allowReservedWords) {
34767 var entity = this.parseIdentifier();
34768
34769 while (this.eat(types.dot)) {
34770 var node = this.startNodeAtNode(entity);
34771 node.left = entity;
34772 node.right = this.parseIdentifier(allowReservedWords);
34773 entity = this.finishNode(node, "TSQualifiedName");
34774 }
34775
34776 return entity;
34777 };
34778
34779 _proto.tsParseTypeReference = function tsParseTypeReference() {
34780 var node = this.startNode();
34781 node.typeName = this.tsParseEntityName(false);
34782
34783 if (!this.hasPrecedingLineBreak() && this.isRelational("<")) {
34784 node.typeParameters = this.tsParseTypeArguments();
34785 }
34786
34787 return this.finishNode(node, "TSTypeReference");
34788 };
34789
34790 _proto.tsParseThisTypePredicate = function tsParseThisTypePredicate(lhs) {
34791 this.next();
34792 var node = this.startNode();
34793 node.parameterName = lhs;
34794 node.typeAnnotation = this.tsParseTypeAnnotation(false);
34795 return this.finishNode(node, "TSTypePredicate");
34796 };
34797
34798 _proto.tsParseThisTypeNode = function tsParseThisTypeNode() {
34799 var node = this.startNode();
34800 this.next();
34801 return this.finishNode(node, "TSThisType");
34802 };
34803
34804 _proto.tsParseTypeQuery = function tsParseTypeQuery() {
34805 var node = this.startNode();
34806 this.expect(types._typeof);
34807 node.exprName = this.tsParseEntityName(true);
34808 return this.finishNode(node, "TSTypeQuery");
34809 };
34810
34811 _proto.tsParseTypeParameter = function tsParseTypeParameter() {
34812 var node = this.startNode();
34813 node.name = this.parseIdentifierName(node.start);
34814 node.constraint = this.tsEatThenParseType(types._extends);
34815 node.default = this.tsEatThenParseType(types.eq);
34816 return this.finishNode(node, "TSTypeParameter");
34817 };
34818
34819 _proto.tsTryParseTypeParameters = function tsTryParseTypeParameters() {
34820 if (this.isRelational("<")) {
34821 return this.tsParseTypeParameters();
34822 }
34823 };
34824
34825 _proto.tsParseTypeParameters = function tsParseTypeParameters() {
34826 var node = this.startNode();
34827
34828 if (this.isRelational("<") || this.match(types.jsxTagStart)) {
34829 this.next();
34830 } else {
34831 this.unexpected();
34832 }
34833
34834 node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), false, true);
34835 return this.finishNode(node, "TSTypeParameterDeclaration");
34836 };
34837
34838 _proto.tsFillSignature = function tsFillSignature(returnToken, signature) {
34839 var returnTokenRequired = returnToken === types.arrow;
34840 signature.typeParameters = this.tsTryParseTypeParameters();
34841 this.expect(types.parenL);
34842 signature.parameters = this.tsParseBindingListForSignature();
34843
34844 if (returnTokenRequired) {
34845 signature.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
34846 } else if (this.match(returnToken)) {
34847 signature.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
34848 }
34849 };
34850
34851 _proto.tsParseBindingListForSignature = function tsParseBindingListForSignature() {
34852 var _this = this;
34853
34854 return this.parseBindingList(types.parenR).map(function (pattern) {
34855 if (pattern.type !== "Identifier" && pattern.type !== "RestElement") {
34856 throw _this.unexpected(pattern.start, "Name in a signature must be an Identifier.");
34857 }
34858
34859 return pattern;
34860 });
34861 };
34862
34863 _proto.tsParseTypeMemberSemicolon = function tsParseTypeMemberSemicolon() {
34864 if (!this.eat(types.comma)) {
34865 this.semicolon();
34866 }
34867 };
34868
34869 _proto.tsParseSignatureMember = function tsParseSignatureMember(kind) {
34870 var node = this.startNode();
34871
34872 if (kind === "TSConstructSignatureDeclaration") {
34873 this.expect(types._new);
34874 }
34875
34876 this.tsFillSignature(types.colon, node);
34877 this.tsParseTypeMemberSemicolon();
34878 return this.finishNode(node, kind);
34879 };
34880
34881 _proto.tsIsUnambiguouslyIndexSignature = function tsIsUnambiguouslyIndexSignature() {
34882 this.next();
34883 return this.eat(types.name) && this.match(types.colon);
34884 };
34885
34886 _proto.tsTryParseIndexSignature = function tsTryParseIndexSignature(node) {
34887 if (!(this.match(types.bracketL) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) {
34888 return undefined;
34889 }
34890
34891 this.expect(types.bracketL);
34892 var id = this.parseIdentifier();
34893 this.expect(types.colon);
34894 id.typeAnnotation = this.tsParseTypeAnnotation(false);
34895 this.expect(types.bracketR);
34896 node.parameters = [id];
34897 var type = this.tsTryParseTypeAnnotation();
34898 if (type) node.typeAnnotation = type;
34899 this.tsParseTypeMemberSemicolon();
34900 return this.finishNode(node, "TSIndexSignature");
34901 };
34902
34903 _proto.tsParsePropertyOrMethodSignature = function tsParsePropertyOrMethodSignature(node, readonly) {
34904 this.parsePropertyName(node);
34905 if (this.eat(types.question)) node.optional = true;
34906 var nodeAny = node;
34907
34908 if (!readonly && (this.match(types.parenL) || this.isRelational("<"))) {
34909 var method = nodeAny;
34910 this.tsFillSignature(types.colon, method);
34911 this.tsParseTypeMemberSemicolon();
34912 return this.finishNode(method, "TSMethodSignature");
34913 } else {
34914 var property = nodeAny;
34915 if (readonly) property.readonly = true;
34916 var type = this.tsTryParseTypeAnnotation();
34917 if (type) property.typeAnnotation = type;
34918 this.tsParseTypeMemberSemicolon();
34919 return this.finishNode(property, "TSPropertySignature");
34920 }
34921 };
34922
34923 _proto.tsParseTypeMember = function tsParseTypeMember() {
34924 if (this.match(types.parenL) || this.isRelational("<")) {
34925 return this.tsParseSignatureMember("TSCallSignatureDeclaration");
34926 }
34927
34928 if (this.match(types._new) && this.tsLookAhead(this.tsIsStartOfConstructSignature.bind(this))) {
34929 return this.tsParseSignatureMember("TSConstructSignatureDeclaration");
34930 }
34931
34932 var node = this.startNode();
34933 var readonly = !!this.tsParseModifier(["readonly"]);
34934 var idx = this.tsTryParseIndexSignature(node);
34935
34936 if (idx) {
34937 if (readonly) node.readonly = true;
34938 return idx;
34939 }
34940
34941 return this.tsParsePropertyOrMethodSignature(node, readonly);
34942 };
34943
34944 _proto.tsIsStartOfConstructSignature = function tsIsStartOfConstructSignature() {
34945 this.next();
34946 return this.match(types.parenL) || this.isRelational("<");
34947 };
34948
34949 _proto.tsParseTypeLiteral = function tsParseTypeLiteral() {
34950 var node = this.startNode();
34951 node.members = this.tsParseObjectTypeMembers();
34952 return this.finishNode(node, "TSTypeLiteral");
34953 };
34954
34955 _proto.tsParseObjectTypeMembers = function tsParseObjectTypeMembers() {
34956 this.expect(types.braceL);
34957 var members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this));
34958 this.expect(types.braceR);
34959 return members;
34960 };
34961
34962 _proto.tsIsStartOfMappedType = function tsIsStartOfMappedType() {
34963 this.next();
34964
34965 if (this.eat(types.plusMin)) {
34966 return this.isContextual("readonly");
34967 }
34968
34969 if (this.isContextual("readonly")) {
34970 this.next();
34971 }
34972
34973 if (!this.match(types.bracketL)) {
34974 return false;
34975 }
34976
34977 this.next();
34978
34979 if (!this.tsIsIdentifier()) {
34980 return false;
34981 }
34982
34983 this.next();
34984 return this.match(types._in);
34985 };
34986
34987 _proto.tsParseMappedTypeParameter = function tsParseMappedTypeParameter() {
34988 var node = this.startNode();
34989 node.name = this.parseIdentifierName(node.start);
34990 node.constraint = this.tsExpectThenParseType(types._in);
34991 return this.finishNode(node, "TSTypeParameter");
34992 };
34993
34994 _proto.tsParseMappedType = function tsParseMappedType() {
34995 var node = this.startNode();
34996 this.expect(types.braceL);
34997
34998 if (this.match(types.plusMin)) {
34999 node.readonly = this.state.value;
35000 this.next();
35001 this.expectContextual("readonly");
35002 } else if (this.eatContextual("readonly")) {
35003 node.readonly = true;
35004 }
35005
35006 this.expect(types.bracketL);
35007 node.typeParameter = this.tsParseMappedTypeParameter();
35008 this.expect(types.bracketR);
35009
35010 if (this.match(types.plusMin)) {
35011 node.optional = this.state.value;
35012 this.next();
35013 this.expect(types.question);
35014 } else if (this.eat(types.question)) {
35015 node.optional = true;
35016 }
35017
35018 node.typeAnnotation = this.tsTryParseType();
35019 this.semicolon();
35020 this.expect(types.braceR);
35021 return this.finishNode(node, "TSMappedType");
35022 };
35023
35024 _proto.tsParseTupleType = function tsParseTupleType() {
35025 var node = this.startNode();
35026 node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseType.bind(this), true, false);
35027 return this.finishNode(node, "TSTupleType");
35028 };
35029
35030 _proto.tsParseParenthesizedType = function tsParseParenthesizedType() {
35031 var node = this.startNode();
35032 this.expect(types.parenL);
35033 node.typeAnnotation = this.tsParseType();
35034 this.expect(types.parenR);
35035 return this.finishNode(node, "TSParenthesizedType");
35036 };
35037
35038 _proto.tsParseFunctionOrConstructorType = function tsParseFunctionOrConstructorType(type) {
35039 var node = this.startNode();
35040
35041 if (type === "TSConstructorType") {
35042 this.expect(types._new);
35043 }
35044
35045 this.tsFillSignature(types.arrow, node);
35046 return this.finishNode(node, type);
35047 };
35048
35049 _proto.tsParseLiteralTypeNode = function tsParseLiteralTypeNode() {
35050 var _this2 = this;
35051
35052 var node = this.startNode();
35053
35054 node.literal = function () {
35055 switch (_this2.state.type) {
35056 case types.num:
35057 return _this2.parseLiteral(_this2.state.value, "NumericLiteral");
35058
35059 case types.string:
35060 return _this2.parseLiteral(_this2.state.value, "StringLiteral");
35061
35062 case types._true:
35063 case types._false:
35064 return _this2.parseBooleanLiteral();
35065
35066 default:
35067 throw _this2.unexpected();
35068 }
35069 }();
35070
35071 return this.finishNode(node, "TSLiteralType");
35072 };
35073
35074 _proto.tsParseNonArrayType = function tsParseNonArrayType() {
35075 switch (this.state.type) {
35076 case types.name:
35077 case types._void:
35078 case types._null:
35079 {
35080 var type = this.match(types._void) ? "TSVoidKeyword" : this.match(types._null) ? "TSNullKeyword" : keywordTypeFromName(this.state.value);
35081
35082 if (type !== undefined && this.lookahead().type !== types.dot) {
35083 var node = this.startNode();
35084 this.next();
35085 return this.finishNode(node, type);
35086 }
35087
35088 return this.tsParseTypeReference();
35089 }
35090
35091 case types.string:
35092 case types.num:
35093 case types._true:
35094 case types._false:
35095 return this.tsParseLiteralTypeNode();
35096
35097 case types.plusMin:
35098 if (this.state.value === "-") {
35099 var _node = this.startNode();
35100
35101 this.next();
35102
35103 if (!this.match(types.num)) {
35104 throw this.unexpected();
35105 }
35106
35107 _node.literal = this.parseLiteral(-this.state.value, "NumericLiteral", _node.start, _node.loc.start);
35108 return this.finishNode(_node, "TSLiteralType");
35109 }
35110
35111 break;
35112
35113 case types._this:
35114 {
35115 var thisKeyword = this.tsParseThisTypeNode();
35116
35117 if (this.isContextual("is") && !this.hasPrecedingLineBreak()) {
35118 return this.tsParseThisTypePredicate(thisKeyword);
35119 } else {
35120 return thisKeyword;
35121 }
35122 }
35123
35124 case types._typeof:
35125 return this.tsParseTypeQuery();
35126
35127 case types.braceL:
35128 return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral();
35129
35130 case types.bracketL:
35131 return this.tsParseTupleType();
35132
35133 case types.parenL:
35134 return this.tsParseParenthesizedType();
35135 }
35136
35137 throw this.unexpected();
35138 };
35139
35140 _proto.tsParseArrayTypeOrHigher = function tsParseArrayTypeOrHigher() {
35141 var type = this.tsParseNonArrayType();
35142
35143 while (!this.hasPrecedingLineBreak() && this.eat(types.bracketL)) {
35144 if (this.match(types.bracketR)) {
35145 var node = this.startNodeAtNode(type);
35146 node.elementType = type;
35147 this.expect(types.bracketR);
35148 type = this.finishNode(node, "TSArrayType");
35149 } else {
35150 var _node2 = this.startNodeAtNode(type);
35151
35152 _node2.objectType = type;
35153 _node2.indexType = this.tsParseType();
35154 this.expect(types.bracketR);
35155 type = this.finishNode(_node2, "TSIndexedAccessType");
35156 }
35157 }
35158
35159 return type;
35160 };
35161
35162 _proto.tsParseTypeOperator = function tsParseTypeOperator(operator) {
35163 var node = this.startNode();
35164 this.expectContextual(operator);
35165 node.operator = operator;
35166 node.typeAnnotation = this.tsParseTypeOperatorOrHigher();
35167 return this.finishNode(node, "TSTypeOperator");
35168 };
35169
35170 _proto.tsParseInferType = function tsParseInferType() {
35171 var node = this.startNode();
35172 this.expectContextual("infer");
35173 var typeParameter = this.startNode();
35174 typeParameter.name = this.parseIdentifierName(typeParameter.start);
35175 node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
35176 return this.finishNode(node, "TSInferType");
35177 };
35178
35179 _proto.tsParseTypeOperatorOrHigher = function tsParseTypeOperatorOrHigher() {
35180 var _this3 = this;
35181
35182 var operator = ["keyof", "unique"].find(function (kw) {
35183 return _this3.isContextual(kw);
35184 });
35185 return operator ? this.tsParseTypeOperator(operator) : this.isContextual("infer") ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
35186 };
35187
35188 _proto.tsParseUnionOrIntersectionType = function tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
35189 this.eat(operator);
35190 var type = parseConstituentType();
35191
35192 if (this.match(operator)) {
35193 var types$$1 = [type];
35194
35195 while (this.eat(operator)) {
35196 types$$1.push(parseConstituentType());
35197 }
35198
35199 var node = this.startNodeAtNode(type);
35200 node.types = types$$1;
35201 type = this.finishNode(node, kind);
35202 }
35203
35204 return type;
35205 };
35206
35207 _proto.tsParseIntersectionTypeOrHigher = function tsParseIntersectionTypeOrHigher() {
35208 return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), types.bitwiseAND);
35209 };
35210
35211 _proto.tsParseUnionTypeOrHigher = function tsParseUnionTypeOrHigher() {
35212 return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), types.bitwiseOR);
35213 };
35214
35215 _proto.tsIsStartOfFunctionType = function tsIsStartOfFunctionType() {
35216 if (this.isRelational("<")) {
35217 return true;
35218 }
35219
35220 return this.match(types.parenL) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));
35221 };
35222
35223 _proto.tsSkipParameterStart = function tsSkipParameterStart() {
35224 if (this.match(types.name) || this.match(types._this)) {
35225 this.next();
35226 return true;
35227 }
35228
35229 return false;
35230 };
35231
35232 _proto.tsIsUnambiguouslyStartOfFunctionType = function tsIsUnambiguouslyStartOfFunctionType() {
35233 this.next();
35234
35235 if (this.match(types.parenR) || this.match(types.ellipsis)) {
35236 return true;
35237 }
35238
35239 if (this.tsSkipParameterStart()) {
35240 if (this.match(types.colon) || this.match(types.comma) || this.match(types.question) || this.match(types.eq)) {
35241 return true;
35242 }
35243
35244 if (this.match(types.parenR)) {
35245 this.next();
35246
35247 if (this.match(types.arrow)) {
35248 return true;
35249 }
35250 }
35251 }
35252
35253 return false;
35254 };
35255
35256 _proto.tsParseTypeOrTypePredicateAnnotation = function tsParseTypeOrTypePredicateAnnotation(returnToken) {
35257 var _this4 = this;
35258
35259 return this.tsInType(function () {
35260 var t = _this4.startNode();
35261
35262 _this4.expect(returnToken);
35263
35264 var typePredicateVariable = _this4.tsIsIdentifier() && _this4.tsTryParse(_this4.tsParseTypePredicatePrefix.bind(_this4));
35265
35266 if (!typePredicateVariable) {
35267 return _this4.tsParseTypeAnnotation(false, t);
35268 }
35269
35270 var type = _this4.tsParseTypeAnnotation(false);
35271
35272 var node = _this4.startNodeAtNode(typePredicateVariable);
35273
35274 node.parameterName = typePredicateVariable;
35275 node.typeAnnotation = type;
35276 t.typeAnnotation = _this4.finishNode(node, "TSTypePredicate");
35277 return _this4.finishNode(t, "TSTypeAnnotation");
35278 });
35279 };
35280
35281 _proto.tsTryParseTypeOrTypePredicateAnnotation = function tsTryParseTypeOrTypePredicateAnnotation() {
35282 return this.match(types.colon) ? this.tsParseTypeOrTypePredicateAnnotation(types.colon) : undefined;
35283 };
35284
35285 _proto.tsTryParseTypeAnnotation = function tsTryParseTypeAnnotation() {
35286 return this.match(types.colon) ? this.tsParseTypeAnnotation() : undefined;
35287 };
35288
35289 _proto.tsTryParseType = function tsTryParseType() {
35290 return this.tsEatThenParseType(types.colon);
35291 };
35292
35293 _proto.tsParseTypePredicatePrefix = function tsParseTypePredicatePrefix() {
35294 var id = this.parseIdentifier();
35295
35296 if (this.isContextual("is") && !this.hasPrecedingLineBreak()) {
35297 this.next();
35298 return id;
35299 }
35300 };
35301
35302 _proto.tsParseTypeAnnotation = function tsParseTypeAnnotation(eatColon, t) {
35303 var _this5 = this;
35304
35305 if (eatColon === void 0) {
35306 eatColon = true;
35307 }
35308
35309 if (t === void 0) {
35310 t = this.startNode();
35311 }
35312
35313 this.tsInType(function () {
35314 if (eatColon) _this5.expect(types.colon);
35315 t.typeAnnotation = _this5.tsParseType();
35316 });
35317 return this.finishNode(t, "TSTypeAnnotation");
35318 };
35319
35320 _proto.tsParseType = function tsParseType() {
35321 assert(this.state.inType);
35322 var type = this.tsParseNonConditionalType();
35323
35324 if (this.hasPrecedingLineBreak() || !this.eat(types._extends)) {
35325 return type;
35326 }
35327
35328 var node = this.startNodeAtNode(type);
35329 node.checkType = type;
35330 node.extendsType = this.tsParseNonConditionalType();
35331 this.expect(types.question);
35332 node.trueType = this.tsParseType();
35333 this.expect(types.colon);
35334 node.falseType = this.tsParseType();
35335 return this.finishNode(node, "TSConditionalType");
35336 };
35337
35338 _proto.tsParseNonConditionalType = function tsParseNonConditionalType() {
35339 if (this.tsIsStartOfFunctionType()) {
35340 return this.tsParseFunctionOrConstructorType("TSFunctionType");
35341 }
35342
35343 if (this.match(types._new)) {
35344 return this.tsParseFunctionOrConstructorType("TSConstructorType");
35345 }
35346
35347 return this.tsParseUnionTypeOrHigher();
35348 };
35349
35350 _proto.tsParseTypeAssertion = function tsParseTypeAssertion() {
35351 var _this6 = this;
35352
35353 var node = this.startNode();
35354 node.typeAnnotation = this.tsInType(function () {
35355 return _this6.tsParseType();
35356 });
35357 this.expectRelational(">");
35358 node.expression = this.parseMaybeUnary();
35359 return this.finishNode(node, "TSTypeAssertion");
35360 };
35361
35362 _proto.tsParseHeritageClause = function tsParseHeritageClause() {
35363 return this.tsParseDelimitedList("HeritageClauseElement", this.tsParseExpressionWithTypeArguments.bind(this));
35364 };
35365
35366 _proto.tsParseExpressionWithTypeArguments = function tsParseExpressionWithTypeArguments() {
35367 var node = this.startNode();
35368 node.expression = this.tsParseEntityName(false);
35369
35370 if (this.isRelational("<")) {
35371 node.typeParameters = this.tsParseTypeArguments();
35372 }
35373
35374 return this.finishNode(node, "TSExpressionWithTypeArguments");
35375 };
35376
35377 _proto.tsParseInterfaceDeclaration = function tsParseInterfaceDeclaration(node) {
35378 node.id = this.parseIdentifier();
35379 node.typeParameters = this.tsTryParseTypeParameters();
35380
35381 if (this.eat(types._extends)) {
35382 node.extends = this.tsParseHeritageClause();
35383 }
35384
35385 var body = this.startNode();
35386 body.body = this.tsParseObjectTypeMembers();
35387 node.body = this.finishNode(body, "TSInterfaceBody");
35388 return this.finishNode(node, "TSInterfaceDeclaration");
35389 };
35390
35391 _proto.tsParseTypeAliasDeclaration = function tsParseTypeAliasDeclaration(node) {
35392 node.id = this.parseIdentifier();
35393 node.typeParameters = this.tsTryParseTypeParameters();
35394 node.typeAnnotation = this.tsExpectThenParseType(types.eq);
35395 this.semicolon();
35396 return this.finishNode(node, "TSTypeAliasDeclaration");
35397 };
35398
35399 _proto.tsInNoContext = function tsInNoContext(cb) {
35400 var oldContext = this.state.context;
35401 this.state.context = [oldContext[0]];
35402
35403 try {
35404 return cb();
35405 } finally {
35406 this.state.context = oldContext;
35407 }
35408 };
35409
35410 _proto.tsInType = function tsInType(cb) {
35411 var oldInType = this.state.inType;
35412 this.state.inType = true;
35413
35414 try {
35415 return cb();
35416 } finally {
35417 this.state.inType = oldInType;
35418 }
35419 };
35420
35421 _proto.tsEatThenParseType = function tsEatThenParseType(token) {
35422 return !this.match(token) ? undefined : this.tsNextThenParseType();
35423 };
35424
35425 _proto.tsExpectThenParseType = function tsExpectThenParseType(token) {
35426 var _this7 = this;
35427
35428 return this.tsDoThenParseType(function () {
35429 return _this7.expect(token);
35430 });
35431 };
35432
35433 _proto.tsNextThenParseType = function tsNextThenParseType() {
35434 var _this8 = this;
35435
35436 return this.tsDoThenParseType(function () {
35437 return _this8.next();
35438 });
35439 };
35440
35441 _proto.tsDoThenParseType = function tsDoThenParseType(cb) {
35442 var _this9 = this;
35443
35444 return this.tsInType(function () {
35445 cb();
35446 return _this9.tsParseType();
35447 });
35448 };
35449
35450 _proto.tsParseEnumMember = function tsParseEnumMember() {
35451 var node = this.startNode();
35452 node.id = this.match(types.string) ? this.parseLiteral(this.state.value, "StringLiteral") : this.parseIdentifier(true);
35453
35454 if (this.eat(types.eq)) {
35455 node.initializer = this.parseMaybeAssign();
35456 }
35457
35458 return this.finishNode(node, "TSEnumMember");
35459 };
35460
35461 _proto.tsParseEnumDeclaration = function tsParseEnumDeclaration(node, isConst) {
35462 if (isConst) node.const = true;
35463 node.id = this.parseIdentifier();
35464 this.expect(types.braceL);
35465 node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
35466 this.expect(types.braceR);
35467 return this.finishNode(node, "TSEnumDeclaration");
35468 };
35469
35470 _proto.tsParseModuleBlock = function tsParseModuleBlock() {
35471 var node = this.startNode();
35472 this.expect(types.braceL);
35473 this.parseBlockOrModuleBlockBody(node.body = [], undefined, true, types.braceR);
35474 return this.finishNode(node, "TSModuleBlock");
35475 };
35476
35477 _proto.tsParseModuleOrNamespaceDeclaration = function tsParseModuleOrNamespaceDeclaration(node) {
35478 node.id = this.parseIdentifier();
35479
35480 if (this.eat(types.dot)) {
35481 var inner = this.startNode();
35482 this.tsParseModuleOrNamespaceDeclaration(inner);
35483 node.body = inner;
35484 } else {
35485 node.body = this.tsParseModuleBlock();
35486 }
35487
35488 return this.finishNode(node, "TSModuleDeclaration");
35489 };
35490
35491 _proto.tsParseAmbientExternalModuleDeclaration = function tsParseAmbientExternalModuleDeclaration(node) {
35492 if (this.isContextual("global")) {
35493 node.global = true;
35494 node.id = this.parseIdentifier();
35495 } else if (this.match(types.string)) {
35496 node.id = this.parseExprAtom();
35497 } else {
35498 this.unexpected();
35499 }
35500
35501 if (this.match(types.braceL)) {
35502 node.body = this.tsParseModuleBlock();
35503 } else {
35504 this.semicolon();
35505 }
35506
35507 return this.finishNode(node, "TSModuleDeclaration");
35508 };
35509
35510 _proto.tsParseImportEqualsDeclaration = function tsParseImportEqualsDeclaration(node, isExport) {
35511 node.isExport = isExport || false;
35512 node.id = this.parseIdentifier();
35513 this.expect(types.eq);
35514 node.moduleReference = this.tsParseModuleReference();
35515 this.semicolon();
35516 return this.finishNode(node, "TSImportEqualsDeclaration");
35517 };
35518
35519 _proto.tsIsExternalModuleReference = function tsIsExternalModuleReference() {
35520 return this.isContextual("require") && this.lookahead().type === types.parenL;
35521 };
35522
35523 _proto.tsParseModuleReference = function tsParseModuleReference() {
35524 return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(false);
35525 };
35526
35527 _proto.tsParseExternalModuleReference = function tsParseExternalModuleReference() {
35528 var node = this.startNode();
35529 this.expectContextual("require");
35530 this.expect(types.parenL);
35531
35532 if (!this.match(types.string)) {
35533 throw this.unexpected();
35534 }
35535
35536 node.expression = this.parseLiteral(this.state.value, "StringLiteral");
35537 this.expect(types.parenR);
35538 return this.finishNode(node, "TSExternalModuleReference");
35539 };
35540
35541 _proto.tsLookAhead = function tsLookAhead(f) {
35542 var state = this.state.clone();
35543 var res = f();
35544 this.state = state;
35545 return res;
35546 };
35547
35548 _proto.tsTryParseAndCatch = function tsTryParseAndCatch(f) {
35549 var state = this.state.clone();
35550
35551 try {
35552 return f();
35553 } catch (e) {
35554 if (e instanceof SyntaxError) {
35555 this.state = state;
35556 return undefined;
35557 }
35558
35559 throw e;
35560 }
35561 };
35562
35563 _proto.tsTryParse = function tsTryParse(f) {
35564 var state = this.state.clone();
35565 var result = f();
35566
35567 if (result !== undefined && result !== false) {
35568 return result;
35569 } else {
35570 this.state = state;
35571 return undefined;
35572 }
35573 };
35574
35575 _proto.nodeWithSamePosition = function nodeWithSamePosition(original, type) {
35576 var node = this.startNodeAtNode(original);
35577 node.type = type;
35578 node.end = original.end;
35579 node.loc.end = original.loc.end;
35580
35581 if (original.leadingComments) {
35582 node.leadingComments = original.leadingComments;
35583 }
35584
35585 if (original.trailingComments) {
35586 node.trailingComments = original.trailingComments;
35587 }
35588
35589 if (original.innerComments) node.innerComments = original.innerComments;
35590 return node;
35591 };
35592
35593 _proto.tsTryParseDeclare = function tsTryParseDeclare(nany) {
35594 switch (this.state.type) {
35595 case types._function:
35596 this.next();
35597 return this.parseFunction(nany, true);
35598
35599 case types._class:
35600 return this.parseClass(nany, true, false);
35601
35602 case types._const:
35603 if (this.match(types._const) && this.isLookaheadContextual("enum")) {
35604 this.expect(types._const);
35605 this.expectContextual("enum");
35606 return this.tsParseEnumDeclaration(nany, true);
35607 }
35608
35609 case types._var:
35610 case types._let:
35611 return this.parseVarStatement(nany, this.state.type);
35612
35613 case types.name:
35614 {
35615 var value = this.state.value;
35616
35617 if (value === "global") {
35618 return this.tsParseAmbientExternalModuleDeclaration(nany);
35619 } else {
35620 return this.tsParseDeclaration(nany, value, true);
35621 }
35622 }
35623 }
35624 };
35625
35626 _proto.tsTryParseExportDeclaration = function tsTryParseExportDeclaration() {
35627 return this.tsParseDeclaration(this.startNode(), this.state.value, true);
35628 };
35629
35630 _proto.tsParseExpressionStatement = function tsParseExpressionStatement(node, expr) {
35631 switch (expr.name) {
35632 case "declare":
35633 {
35634 var declaration = this.tsTryParseDeclare(node);
35635
35636 if (declaration) {
35637 declaration.declare = true;
35638 return declaration;
35639 }
35640
35641 break;
35642 }
35643
35644 case "global":
35645 if (this.match(types.braceL)) {
35646 var mod = node;
35647 mod.global = true;
35648 mod.id = expr;
35649 mod.body = this.tsParseModuleBlock();
35650 return this.finishNode(mod, "TSModuleDeclaration");
35651 }
35652
35653 break;
35654
35655 default:
35656 return this.tsParseDeclaration(node, expr.name, false);
35657 }
35658 };
35659
35660 _proto.tsParseDeclaration = function tsParseDeclaration(node, value, next) {
35661 switch (value) {
35662 case "abstract":
35663 if (next || this.match(types._class)) {
35664 var cls = node;
35665 cls.abstract = true;
35666 if (next) this.next();
35667 return this.parseClass(cls, true, false);
35668 }
35669
35670 break;
35671
35672 case "enum":
35673 if (next || this.match(types.name)) {
35674 if (next) this.next();
35675 return this.tsParseEnumDeclaration(node, false);
35676 }
35677
35678 break;
35679
35680 case "interface":
35681 if (next || this.match(types.name)) {
35682 if (next) this.next();
35683 return this.tsParseInterfaceDeclaration(node);
35684 }
35685
35686 break;
35687
35688 case "module":
35689 if (next) this.next();
35690
35691 if (this.match(types.string)) {
35692 return this.tsParseAmbientExternalModuleDeclaration(node);
35693 } else if (next || this.match(types.name)) {
35694 return this.tsParseModuleOrNamespaceDeclaration(node);
35695 }
35696
35697 break;
35698
35699 case "namespace":
35700 if (next || this.match(types.name)) {
35701 if (next) this.next();
35702 return this.tsParseModuleOrNamespaceDeclaration(node);
35703 }
35704
35705 break;
35706
35707 case "type":
35708 if (next || this.match(types.name)) {
35709 if (next) this.next();
35710 return this.tsParseTypeAliasDeclaration(node);
35711 }
35712
35713 break;
35714 }
35715 };
35716
35717 _proto.tsTryParseGenericAsyncArrowFunction = function tsTryParseGenericAsyncArrowFunction(startPos, startLoc) {
35718 var _this10 = this;
35719
35720 var res = this.tsTryParseAndCatch(function () {
35721 var node = _this10.startNodeAt(startPos, startLoc);
35722
35723 node.typeParameters = _this10.tsParseTypeParameters();
35724
35725 _superClass.prototype.parseFunctionParams.call(_this10, node);
35726
35727 node.returnType = _this10.tsTryParseTypeOrTypePredicateAnnotation();
35728
35729 _this10.expect(types.arrow);
35730
35731 return node;
35732 });
35733
35734 if (!res) {
35735 return undefined;
35736 }
35737
35738 res.id = null;
35739 res.generator = false;
35740 res.expression = true;
35741 res.async = true;
35742 this.parseFunctionBody(res, true);
35743 return this.finishNode(res, "ArrowFunctionExpression");
35744 };
35745
35746 _proto.tsParseTypeArguments = function tsParseTypeArguments() {
35747 var _this11 = this;
35748
35749 var node = this.startNode();
35750 node.params = this.tsInType(function () {
35751 return _this11.tsInNoContext(function () {
35752 _this11.expectRelational("<");
35753
35754 return _this11.tsParseDelimitedList("TypeParametersOrArguments", _this11.tsParseType.bind(_this11));
35755 });
35756 });
35757 this.state.exprAllowed = false;
35758 this.expectRelational(">");
35759 return this.finishNode(node, "TSTypeParameterInstantiation");
35760 };
35761
35762 _proto.tsIsDeclarationStart = function tsIsDeclarationStart() {
35763 if (this.match(types.name)) {
35764 switch (this.state.value) {
35765 case "abstract":
35766 case "declare":
35767 case "enum":
35768 case "interface":
35769 case "module":
35770 case "namespace":
35771 case "type":
35772 return true;
35773 }
35774 }
35775
35776 return false;
35777 };
35778
35779 _proto.isExportDefaultSpecifier = function isExportDefaultSpecifier() {
35780 if (this.tsIsDeclarationStart()) return false;
35781 return _superClass.prototype.isExportDefaultSpecifier.call(this);
35782 };
35783
35784 _proto.parseAssignableListItem = function parseAssignableListItem(allowModifiers, decorators) {
35785 var accessibility;
35786 var readonly = false;
35787
35788 if (allowModifiers) {
35789 accessibility = this.parseAccessModifier();
35790 readonly = !!this.tsParseModifier(["readonly"]);
35791 }
35792
35793 var left = this.parseMaybeDefault();
35794 this.parseAssignableListItemTypes(left);
35795 var elt = this.parseMaybeDefault(left.start, left.loc.start, left);
35796
35797 if (accessibility || readonly) {
35798 var pp = this.startNodeAtNode(elt);
35799
35800 if (decorators.length) {
35801 pp.decorators = decorators;
35802 }
35803
35804 if (accessibility) pp.accessibility = accessibility;
35805 if (readonly) pp.readonly = readonly;
35806
35807 if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
35808 throw this.raise(pp.start, "A parameter property may not be declared using a binding pattern.");
35809 }
35810
35811 pp.parameter = elt;
35812 return this.finishNode(pp, "TSParameterProperty");
35813 } else {
35814 if (decorators.length) {
35815 left.decorators = decorators;
35816 }
35817
35818 return elt;
35819 }
35820 };
35821
35822 _proto.parseFunctionBodyAndFinish = function parseFunctionBodyAndFinish(node, type, allowExpressionBody) {
35823 if (!allowExpressionBody && this.match(types.colon)) {
35824 node.returnType = this.tsParseTypeOrTypePredicateAnnotation(types.colon);
35825 }
35826
35827 var bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" ? "TSDeclareMethod" : undefined;
35828
35829 if (bodilessType && !this.match(types.braceL) && this.isLineTerminator()) {
35830 this.finishNode(node, bodilessType);
35831 return;
35832 }
35833
35834 _superClass.prototype.parseFunctionBodyAndFinish.call(this, node, type, allowExpressionBody);
35835 };
35836
35837 _proto.parseSubscript = function parseSubscript(base, startPos, startLoc, noCalls, state) {
35838 var _this12 = this;
35839
35840 if (!this.hasPrecedingLineBreak() && this.match(types.bang)) {
35841 this.state.exprAllowed = false;
35842 this.next();
35843 var nonNullExpression = this.startNodeAt(startPos, startLoc);
35844 nonNullExpression.expression = base;
35845 return this.finishNode(nonNullExpression, "TSNonNullExpression");
35846 }
35847
35848 var result = this.tsTryParseAndCatch(function () {
35849 if (_this12.isRelational("<")) {
35850 if (!noCalls && _this12.atPossibleAsync(base)) {
35851 var asyncArrowFn = _this12.tsTryParseGenericAsyncArrowFunction(startPos, startLoc);
35852
35853 if (asyncArrowFn) {
35854 return asyncArrowFn;
35855 }
35856 }
35857
35858 var node = _this12.startNodeAt(startPos, startLoc);
35859
35860 node.callee = base;
35861
35862 var typeArguments = _this12.tsParseTypeArguments();
35863
35864 if (typeArguments) {
35865 if (!noCalls && _this12.eat(types.parenL)) {
35866 node.arguments = _this12.parseCallExpressionArguments(types.parenR, false);
35867 node.typeParameters = typeArguments;
35868 return _this12.finishCallExpression(node);
35869 } else if (_this12.match(types.backQuote)) {
35870 return _this12.parseTaggedTemplateExpression(startPos, startLoc, base, state, typeArguments);
35871 }
35872 }
35873 }
35874
35875 _this12.unexpected();
35876 });
35877 if (result) return result;
35878 return _superClass.prototype.parseSubscript.call(this, base, startPos, startLoc, noCalls, state);
35879 };
35880
35881 _proto.parseNewArguments = function parseNewArguments(node) {
35882 var _this13 = this;
35883
35884 if (this.isRelational("<")) {
35885 var typeParameters = this.tsTryParseAndCatch(function () {
35886 var args = _this13.tsParseTypeArguments();
35887
35888 if (!_this13.match(types.parenL)) _this13.unexpected();
35889 return args;
35890 });
35891
35892 if (typeParameters) {
35893 node.typeParameters = typeParameters;
35894 }
35895 }
35896
35897 _superClass.prototype.parseNewArguments.call(this, node);
35898 };
35899
35900 _proto.parseExprOp = function parseExprOp(left, leftStartPos, leftStartLoc, minPrec, noIn) {
35901 if (nonNull(types._in.binop) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual("as")) {
35902 var node = this.startNodeAt(leftStartPos, leftStartLoc);
35903 node.expression = left;
35904 node.typeAnnotation = this.tsNextThenParseType();
35905 this.finishNode(node, "TSAsExpression");
35906 return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
35907 }
35908
35909 return _superClass.prototype.parseExprOp.call(this, left, leftStartPos, leftStartLoc, minPrec, noIn);
35910 };
35911
35912 _proto.checkReservedWord = function checkReservedWord(word, startLoc, checkKeywords, isBinding) {};
35913
35914 _proto.checkDuplicateExports = function checkDuplicateExports() {};
35915
35916 _proto.parseImport = function parseImport(node) {
35917 if (this.match(types.name) && this.lookahead().type === types.eq) {
35918 return this.tsParseImportEqualsDeclaration(node);
35919 }
35920
35921 return _superClass.prototype.parseImport.call(this, node);
35922 };
35923
35924 _proto.parseExport = function parseExport(node) {
35925 if (this.match(types._import)) {
35926 this.expect(types._import);
35927 return this.tsParseImportEqualsDeclaration(node, true);
35928 } else if (this.eat(types.eq)) {
35929 var assign = node;
35930 assign.expression = this.parseExpression();
35931 this.semicolon();
35932 return this.finishNode(assign, "TSExportAssignment");
35933 } else if (this.eatContextual("as")) {
35934 var decl = node;
35935 this.expectContextual("namespace");
35936 decl.id = this.parseIdentifier();
35937 this.semicolon();
35938 return this.finishNode(decl, "TSNamespaceExportDeclaration");
35939 } else {
35940 return _superClass.prototype.parseExport.call(this, node);
35941 }
35942 };
35943
35944 _proto.isAbstractClass = function isAbstractClass() {
35945 return this.isContextual("abstract") && this.lookahead().type === types._class;
35946 };
35947
35948 _proto.parseExportDefaultExpression = function parseExportDefaultExpression() {
35949 if (this.isAbstractClass()) {
35950 var cls = this.startNode();
35951 this.next();
35952 this.parseClass(cls, true, true);
35953 cls.abstract = true;
35954 return cls;
35955 }
35956
35957 if (this.state.value === "interface") {
35958 var result = this.tsParseDeclaration(this.startNode(), this.state.value, true);
35959 if (result) return result;
35960 }
35961
35962 return _superClass.prototype.parseExportDefaultExpression.call(this);
35963 };
35964
35965 _proto.parseStatementContent = function parseStatementContent(declaration, topLevel) {
35966 if (this.state.type === types._const) {
35967 var ahead = this.lookahead();
35968
35969 if (ahead.type === types.name && ahead.value === "enum") {
35970 var node = this.startNode();
35971 this.expect(types._const);
35972 this.expectContextual("enum");
35973 return this.tsParseEnumDeclaration(node, true);
35974 }
35975 }
35976
35977 return _superClass.prototype.parseStatementContent.call(this, declaration, topLevel);
35978 };
35979
35980 _proto.parseAccessModifier = function parseAccessModifier() {
35981 return this.tsParseModifier(["public", "protected", "private"]);
35982 };
35983
35984 _proto.parseClassMember = function parseClassMember(classBody, member, state) {
35985 var accessibility = this.parseAccessModifier();
35986 if (accessibility) member.accessibility = accessibility;
35987
35988 _superClass.prototype.parseClassMember.call(this, classBody, member, state);
35989 };
35990
35991 _proto.parseClassMemberWithIsStatic = function parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
35992 var methodOrProp = member;
35993 var prop = member;
35994 var propOrIdx = member;
35995 var abstract = false,
35996 readonly = false;
35997 var mod = this.tsParseModifier(["abstract", "readonly"]);
35998
35999 switch (mod) {
36000 case "readonly":
36001 readonly = true;
36002 abstract = !!this.tsParseModifier(["abstract"]);
36003 break;
36004
36005 case "abstract":
36006 abstract = true;
36007 readonly = !!this.tsParseModifier(["readonly"]);
36008 break;
36009 }
36010
36011 if (abstract) methodOrProp.abstract = true;
36012 if (readonly) propOrIdx.readonly = true;
36013
36014 if (!abstract && !isStatic && !methodOrProp.accessibility) {
36015 var idx = this.tsTryParseIndexSignature(member);
36016
36017 if (idx) {
36018 classBody.body.push(idx);
36019 return;
36020 }
36021 }
36022
36023 if (readonly) {
36024 methodOrProp.static = isStatic;
36025 this.parseClassPropertyName(prop);
36026 this.parsePostMemberNameModifiers(methodOrProp);
36027 this.pushClassProperty(classBody, prop);
36028 return;
36029 }
36030
36031 _superClass.prototype.parseClassMemberWithIsStatic.call(this, classBody, member, state, isStatic);
36032 };
36033
36034 _proto.parsePostMemberNameModifiers = function parsePostMemberNameModifiers(methodOrProp) {
36035 var optional = this.eat(types.question);
36036 if (optional) methodOrProp.optional = true;
36037 };
36038
36039 _proto.parseExpressionStatement = function parseExpressionStatement(node, expr) {
36040 var decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr) : undefined;
36041 return decl || _superClass.prototype.parseExpressionStatement.call(this, node, expr);
36042 };
36043
36044 _proto.shouldParseExportDeclaration = function shouldParseExportDeclaration() {
36045 if (this.tsIsDeclarationStart()) return true;
36046 return _superClass.prototype.shouldParseExportDeclaration.call(this);
36047 };
36048
36049 _proto.parseConditional = function parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos) {
36050 if (!refNeedsArrowPos || !this.match(types.question)) {
36051 return _superClass.prototype.parseConditional.call(this, expr, noIn, startPos, startLoc, refNeedsArrowPos);
36052 }
36053
36054 var state = this.state.clone();
36055
36056 try {
36057 return _superClass.prototype.parseConditional.call(this, expr, noIn, startPos, startLoc);
36058 } catch (err) {
36059 if (!(err instanceof SyntaxError)) {
36060 throw err;
36061 }
36062
36063 this.state = state;
36064 refNeedsArrowPos.start = err.pos || this.state.start;
36065 return expr;
36066 }
36067 };
36068
36069 _proto.parseParenItem = function parseParenItem(node, startPos, startLoc) {
36070 node = _superClass.prototype.parseParenItem.call(this, node, startPos, startLoc);
36071
36072 if (this.eat(types.question)) {
36073 node.optional = true;
36074 }
36075
36076 if (this.match(types.colon)) {
36077 var typeCastNode = this.startNodeAt(startPos, startLoc);
36078 typeCastNode.expression = node;
36079 typeCastNode.typeAnnotation = this.tsParseTypeAnnotation();
36080 return this.finishNode(typeCastNode, "TSTypeCastExpression");
36081 }
36082
36083 return node;
36084 };
36085
36086 _proto.parseExportDeclaration = function parseExportDeclaration(node) {
36087 var isDeclare = this.eatContextual("declare");
36088 var declaration;
36089
36090 if (this.match(types.name)) {
36091 declaration = this.tsTryParseExportDeclaration();
36092 }
36093
36094 if (!declaration) {
36095 declaration = _superClass.prototype.parseExportDeclaration.call(this, node);
36096 }
36097
36098 if (declaration && isDeclare) {
36099 declaration.declare = true;
36100 }
36101
36102 return declaration;
36103 };
36104
36105 _proto.parseClassId = function parseClassId(node, isStatement, optionalId) {
36106 if ((!isStatement || optionalId) && this.isContextual("implements")) {
36107 return;
36108 }
36109
36110 _superClass.prototype.parseClassId.apply(this, arguments);
36111
36112 var typeParameters = this.tsTryParseTypeParameters();
36113 if (typeParameters) node.typeParameters = typeParameters;
36114 };
36115
36116 _proto.parseClassProperty = function parseClassProperty(node) {
36117 if (!node.optional && this.eat(types.bang)) {
36118 node.definite = true;
36119 }
36120
36121 var type = this.tsTryParseTypeAnnotation();
36122 if (type) node.typeAnnotation = type;
36123 return _superClass.prototype.parseClassProperty.call(this, node);
36124 };
36125
36126 _proto.pushClassMethod = function pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor) {
36127 var typeParameters = this.tsTryParseTypeParameters();
36128 if (typeParameters) method.typeParameters = typeParameters;
36129
36130 _superClass.prototype.pushClassMethod.call(this, classBody, method, isGenerator, isAsync, isConstructor);
36131 };
36132
36133 _proto.pushClassPrivateMethod = function pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
36134 var typeParameters = this.tsTryParseTypeParameters();
36135 if (typeParameters) method.typeParameters = typeParameters;
36136
36137 _superClass.prototype.pushClassPrivateMethod.call(this, classBody, method, isGenerator, isAsync);
36138 };
36139
36140 _proto.parseClassSuper = function parseClassSuper(node) {
36141 _superClass.prototype.parseClassSuper.call(this, node);
36142
36143 if (node.superClass && this.isRelational("<")) {
36144 node.superTypeParameters = this.tsParseTypeArguments();
36145 }
36146
36147 if (this.eatContextual("implements")) {
36148 node.implements = this.tsParseHeritageClause();
36149 }
36150 };
36151
36152 _proto.parseObjPropValue = function parseObjPropValue(prop) {
36153 var _superClass$prototype;
36154
36155 if (this.isRelational("<")) {
36156 throw new Error("TODO");
36157 }
36158
36159 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
36160 args[_key - 1] = arguments[_key];
36161 }
36162
36163 (_superClass$prototype = _superClass.prototype.parseObjPropValue).call.apply(_superClass$prototype, [this, prop].concat(args));
36164 };
36165
36166 _proto.parseFunctionParams = function parseFunctionParams(node, allowModifiers) {
36167 var typeParameters = this.tsTryParseTypeParameters();
36168 if (typeParameters) node.typeParameters = typeParameters;
36169
36170 _superClass.prototype.parseFunctionParams.call(this, node, allowModifiers);
36171 };
36172
36173 _proto.parseVarHead = function parseVarHead(decl) {
36174 _superClass.prototype.parseVarHead.call(this, decl);
36175
36176 if (decl.id.type === "Identifier" && this.eat(types.bang)) {
36177 decl.definite = true;
36178 }
36179
36180 var type = this.tsTryParseTypeAnnotation();
36181
36182 if (type) {
36183 decl.id.typeAnnotation = type;
36184 this.finishNode(decl.id, decl.id.type);
36185 }
36186 };
36187
36188 _proto.parseAsyncArrowFromCallExpression = function parseAsyncArrowFromCallExpression(node, call) {
36189 if (this.match(types.colon)) {
36190 node.returnType = this.tsParseTypeAnnotation();
36191 }
36192
36193 return _superClass.prototype.parseAsyncArrowFromCallExpression.call(this, node, call);
36194 };
36195
36196 _proto.parseMaybeAssign = function parseMaybeAssign() {
36197 var jsxError;
36198
36199 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
36200 args[_key2] = arguments[_key2];
36201 }
36202
36203 if (this.match(types.jsxTagStart)) {
36204 var context = this.curContext();
36205 assert(context === types$1.j_oTag);
36206 assert(this.state.context[this.state.context.length - 2] === types$1.j_expr);
36207
36208 var _state = this.state.clone();
36209
36210 try {
36211 var _superClass$prototype2;
36212
36213 return (_superClass$prototype2 = _superClass.prototype.parseMaybeAssign).call.apply(_superClass$prototype2, [this].concat(args));
36214 } catch (err) {
36215 if (!(err instanceof SyntaxError)) {
36216 throw err;
36217 }
36218
36219 this.state = _state;
36220 assert(this.curContext() === types$1.j_oTag);
36221 this.state.context.pop();
36222 assert(this.curContext() === types$1.j_expr);
36223 this.state.context.pop();
36224 jsxError = err;
36225 }
36226 }
36227
36228 if (jsxError === undefined && !this.isRelational("<")) {
36229 var _superClass$prototype3;
36230
36231 return (_superClass$prototype3 = _superClass.prototype.parseMaybeAssign).call.apply(_superClass$prototype3, [this].concat(args));
36232 }
36233
36234 var arrowExpression;
36235 var typeParameters;
36236 var state = this.state.clone();
36237
36238 try {
36239 var _superClass$prototype4;
36240
36241 typeParameters = this.tsParseTypeParameters();
36242 arrowExpression = (_superClass$prototype4 = _superClass.prototype.parseMaybeAssign).call.apply(_superClass$prototype4, [this].concat(args));
36243
36244 if (arrowExpression.type !== "ArrowFunctionExpression") {
36245 this.unexpected();
36246 }
36247 } catch (err) {
36248 var _superClass$prototype5;
36249
36250 if (!(err instanceof SyntaxError)) {
36251 throw err;
36252 }
36253
36254 if (jsxError) {
36255 throw jsxError;
36256 }
36257
36258 assert(!this.hasPlugin("jsx"));
36259 this.state = state;
36260 return (_superClass$prototype5 = _superClass.prototype.parseMaybeAssign).call.apply(_superClass$prototype5, [this].concat(args));
36261 }
36262
36263 if (typeParameters && typeParameters.params.length !== 0) {
36264 this.resetStartLocationFromNode(arrowExpression, typeParameters.params[0]);
36265 }
36266
36267 arrowExpression.typeParameters = typeParameters;
36268 return arrowExpression;
36269 };
36270
36271 _proto.parseMaybeUnary = function parseMaybeUnary(refShorthandDefaultPos) {
36272 if (!this.hasPlugin("jsx") && this.eatRelational("<")) {
36273 return this.tsParseTypeAssertion();
36274 } else {
36275 return _superClass.prototype.parseMaybeUnary.call(this, refShorthandDefaultPos);
36276 }
36277 };
36278
36279 _proto.parseArrow = function parseArrow(node) {
36280 if (this.match(types.colon)) {
36281 var state = this.state.clone();
36282
36283 try {
36284 var returnType = this.tsParseTypeOrTypePredicateAnnotation(types.colon);
36285 if (this.canInsertSemicolon()) this.unexpected();
36286 if (!this.match(types.arrow)) this.unexpected();
36287 node.returnType = returnType;
36288 } catch (err) {
36289 if (err instanceof SyntaxError) {
36290 this.state = state;
36291 } else {
36292 throw err;
36293 }
36294 }
36295 }
36296
36297 return _superClass.prototype.parseArrow.call(this, node);
36298 };
36299
36300 _proto.parseAssignableListItemTypes = function parseAssignableListItemTypes(param) {
36301 if (this.eat(types.question)) {
36302 if (param.type !== "Identifier") {
36303 throw this.raise(param.start, "A binding pattern parameter cannot be optional in an implementation signature.");
36304 }
36305
36306 param.optional = true;
36307 }
36308
36309 var type = this.tsTryParseTypeAnnotation();
36310 if (type) param.typeAnnotation = type;
36311 return this.finishNode(param, param.type);
36312 };
36313
36314 _proto.toAssignable = function toAssignable(node, isBinding, contextDescription) {
36315 switch (node.type) {
36316 case "TSTypeCastExpression":
36317 return _superClass.prototype.toAssignable.call(this, this.typeCastToParameter(node), isBinding, contextDescription);
36318
36319 case "TSParameterProperty":
36320 return _superClass.prototype.toAssignable.call(this, node, isBinding, contextDescription);
36321
36322 case "TSAsExpression":
36323 case "TSNonNullExpression":
36324 case "TSTypeAssertion":
36325 node.expression = this.toAssignable(node.expression, isBinding, contextDescription);
36326 return node;
36327
36328 default:
36329 return _superClass.prototype.toAssignable.call(this, node, isBinding, contextDescription);
36330 }
36331 };
36332
36333 _proto.checkLVal = function checkLVal(expr, isBinding, checkClashes, contextDescription) {
36334 switch (expr.type) {
36335 case "TSTypeCastExpression":
36336 return;
36337
36338 case "TSParameterProperty":
36339 this.checkLVal(expr.parameter, isBinding, checkClashes, "parameter property");
36340 return;
36341
36342 case "TSAsExpression":
36343 case "TSNonNullExpression":
36344 case "TSTypeAssertion":
36345 this.checkLVal(expr.expression, isBinding, checkClashes, contextDescription);
36346 return;
36347
36348 default:
36349 _superClass.prototype.checkLVal.call(this, expr, isBinding, checkClashes, contextDescription);
36350
36351 return;
36352 }
36353 };
36354
36355 _proto.parseBindingAtom = function parseBindingAtom() {
36356 switch (this.state.type) {
36357 case types._this:
36358 return this.parseIdentifier(true);
36359
36360 default:
36361 return _superClass.prototype.parseBindingAtom.call(this);
36362 }
36363 };
36364
36365 _proto.isClassMethod = function isClassMethod() {
36366 return this.isRelational("<") || _superClass.prototype.isClassMethod.call(this);
36367 };
36368
36369 _proto.isClassProperty = function isClassProperty() {
36370 return this.match(types.bang) || this.match(types.colon) || _superClass.prototype.isClassProperty.call(this);
36371 };
36372
36373 _proto.parseMaybeDefault = function parseMaybeDefault() {
36374 var _superClass$prototype6;
36375
36376 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
36377 args[_key3] = arguments[_key3];
36378 }
36379
36380 var node = (_superClass$prototype6 = _superClass.prototype.parseMaybeDefault).call.apply(_superClass$prototype6, [this].concat(args));
36381
36382 if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
36383 this.raise(node.typeAnnotation.start, "Type annotations must come before default assignments, " + "e.g. instead of `age = 25: number` use `age: number = 25`");
36384 }
36385
36386 return node;
36387 };
36388
36389 _proto.readToken = function readToken(code) {
36390 if (this.state.inType && (code === 62 || code === 60)) {
36391 return this.finishOp(types.relational, 1);
36392 } else {
36393 return _superClass.prototype.readToken.call(this, code);
36394 }
36395 };
36396
36397 _proto.toAssignableList = function toAssignableList(exprList, isBinding, contextDescription) {
36398 for (var i = 0; i < exprList.length; i++) {
36399 var expr = exprList[i];
36400
36401 if (expr && expr.type === "TSTypeCastExpression") {
36402 exprList[i] = this.typeCastToParameter(expr);
36403 }
36404 }
36405
36406 return _superClass.prototype.toAssignableList.call(this, exprList, isBinding, contextDescription);
36407 };
36408
36409 _proto.typeCastToParameter = function typeCastToParameter(node) {
36410 node.expression.typeAnnotation = node.typeAnnotation;
36411 return this.finishNodeAt(node.expression, node.expression.type, node.typeAnnotation.end, node.typeAnnotation.loc.end);
36412 };
36413
36414 _proto.toReferencedList = function toReferencedList(exprList) {
36415 for (var i = 0; i < exprList.length; i++) {
36416 var expr = exprList[i];
36417
36418 if (expr && expr._exprListItem && expr.type === "TsTypeCastExpression") {
36419 this.raise(expr.start, "Did not expect a type annotation here.");
36420 }
36421 }
36422
36423 return exprList;
36424 };
36425
36426 _proto.shouldParseArrow = function shouldParseArrow() {
36427 return this.match(types.colon) || _superClass.prototype.shouldParseArrow.call(this);
36428 };
36429
36430 _proto.shouldParseAsyncArrow = function shouldParseAsyncArrow() {
36431 return this.match(types.colon) || _superClass.prototype.shouldParseAsyncArrow.call(this);
36432 };
36433
36434 _proto.canHaveLeadingDecorator = function canHaveLeadingDecorator() {
36435 return _superClass.prototype.canHaveLeadingDecorator.call(this) || this.isAbstractClass();
36436 };
36437
36438 _proto.jsxParseOpeningElementAfterName = function jsxParseOpeningElementAfterName(node) {
36439 var _this14 = this;
36440
36441 var typeArguments = this.tsTryParseAndCatch(function () {
36442 return _this14.tsParseTypeArguments();
36443 });
36444 if (typeArguments) node.typeParameters = typeArguments;
36445 return _superClass.prototype.jsxParseOpeningElementAfterName.call(this, node);
36446 };
36447
36448 return _class;
36449 }(superClass);
36450});
36451
36452function hasPlugin(plugins, name) {
36453 return plugins.some(function (plugin) {
36454 if (Array.isArray(plugin)) {
36455 return plugin[0] === name;
36456 } else {
36457 return plugin === name;
36458 }
36459 });
36460}
36461function getPluginOption(plugins, name, option) {
36462 var plugin = plugins.find(function (plugin) {
36463 if (Array.isArray(plugin)) {
36464 return plugin[0] === name;
36465 } else {
36466 return plugin === name;
36467 }
36468 });
36469
36470 if (plugin && Array.isArray(plugin)) {
36471 return plugin[1][option];
36472 }
36473
36474 return null;
36475}
36476var PIPELINE_PROPOSALS = ["minimal"];
36477function validatePlugins(plugins) {
36478 if (hasPlugin(plugins, "decorators")) {
36479 if (hasPlugin(plugins, "decorators-legacy")) {
36480 throw new Error("Cannot use the decorators and decorators-legacy plugin together");
36481 }
36482
36483 var decoratorsBeforeExport = getPluginOption(plugins, "decorators", "decoratorsBeforeExport");
36484
36485 if (decoratorsBeforeExport == null) {
36486 throw new Error("The 'decorators' plugin requires a" + " 'decoratorsBeforeExport' option, whose value must be a boolean.");
36487 } else if (typeof decoratorsBeforeExport !== "boolean") {
36488 throw new Error("'decoratorsBeforeExport' must be a boolean.");
36489 }
36490 }
36491
36492 if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) {
36493 throw new Error("Cannot combine flow and typescript plugins.");
36494 }
36495
36496 if (hasPlugin(plugins, "pipelineOperator") && !PIPELINE_PROPOSALS.includes(getPluginOption(plugins, "pipelineOperator", "proposal"))) {
36497 throw new Error("'pipelineOperator' requires 'proposal' option whose value should be one of: " + PIPELINE_PROPOSALS.join(", "));
36498 }
36499}
36500var mixinPluginNames = ["estree", "jsx", "flow", "typescript"];
36501var mixinPlugins = {
36502 estree: estree,
36503 jsx: jsx,
36504 flow: flow,
36505 typescript: typescript
36506};
36507
36508function parse(input, options) {
36509 if (options && options.sourceType === "unambiguous") {
36510 options = Object.assign({}, options);
36511
36512 try {
36513 options.sourceType = "module";
36514 var parser = getParser(options, input);
36515 var ast = parser.parse();
36516 if (!parser.sawUnambiguousESM) ast.program.sourceType = "script";
36517 return ast;
36518 } catch (moduleError) {
36519 try {
36520 options.sourceType = "script";
36521 return getParser(options, input).parse();
36522 } catch (scriptError) {}
36523
36524 throw moduleError;
36525 }
36526 } else {
36527 return getParser(options, input).parse();
36528 }
36529}
36530function parseExpression(input, options) {
36531 var parser = getParser(options, input);
36532
36533 if (parser.options.strictMode) {
36534 parser.state.strict = true;
36535 }
36536
36537 return parser.getExpression();
36538}
36539function getParser(options, input) {
36540 var cls = Parser;
36541
36542 if (options && options.plugins) {
36543 validatePlugins(options.plugins);
36544 cls = getParserClass(options.plugins);
36545 }
36546
36547 return new cls(options, input);
36548}
36549
36550var parserClassCache = {};
36551
36552function getParserClass(pluginsFromOptions) {
36553 var pluginList = mixinPluginNames.filter(function (name) {
36554 return hasPlugin(pluginsFromOptions, name);
36555 });
36556 var key = pluginList.join("/");
36557 var cls = parserClassCache[key];
36558
36559 if (!cls) {
36560 cls = Parser;
36561
36562 for (var _i2 = 0; _i2 < pluginList.length; _i2++) {
36563 var plugin = pluginList[_i2];
36564 cls = mixinPlugins[plugin](cls);
36565 }
36566
36567 parserClassCache[key] = cls;
36568 }
36569
36570 return cls;
36571}
36572
36573exports.parse = parse;
36574exports.parseExpression = parseExpression;
36575exports.tokTypes = types;
36576
36577
36578/***/ }),
36579/* 188 */
36580/***/ (function(module, exports, __webpack_require__) {
36581
36582"use strict";
36583/**
36584 * Copyright (c) Facebook, Inc. and its affiliates.
36585 *
36586 * This source code is licensed under the MIT license found in the
36587 * LICENSE file in the root directory of this source tree.
36588 *
36589 *
36590 * @format
36591 */
36592
36593
36594var GraphQLConsoleReporter =
36595/*#__PURE__*/
36596function () {
36597 function GraphQLConsoleReporter(options) {
36598 this._verbose = options.verbose;
36599 this._quiet = options.quiet;
36600 }
36601
36602 var _proto = GraphQLConsoleReporter.prototype;
36603
36604 _proto.reportMessage = function reportMessage(message) {
36605 if (!this._quiet) {
36606 process.stdout.write(message + '\n');
36607 }
36608 };
36609
36610 _proto.reportTime = function reportTime(name, ms) {
36611 /* $FlowFixMe(>=0.68.0 site=react_native_fb,react_native_oss) This comment
36612 * suppresses an error found when Flow v0.68 was deployed. To see the error
36613 * delete this comment and run Flow. */
36614 if (this._verbose && !this.quiet) {
36615 var time = ms === 0 ? __webpack_require__(24).gray(' <1ms') : ms < 1000 ? __webpack_require__(24).blue(leftPad(5, ms + 'ms')) : __webpack_require__(24).red(Math.floor(ms / 10) / 100 + 's');
36616 process.stdout.write(' ' + time + ' ' + __webpack_require__(24).gray(name) + '\n');
36617 }
36618 };
36619
36620 _proto.reportError = function reportError(caughtLocation, error) {
36621 if (!this._quiet) {
36622 process.stdout.write(__webpack_require__(24).red('ERROR:\n' + error.message + '\n'));
36623
36624 if (this._verbose) {
36625 var frames = error.stack.match(/^ {4}at .*$/gm);
36626
36627 if (frames) {
36628 process.stdout.write(__webpack_require__(24).gray('From: ' + caughtLocation + '\n' + frames.join('\n') + '\n'));
36629 }
36630 }
36631 }
36632 };
36633
36634 return GraphQLConsoleReporter;
36635}();
36636
36637function leftPad(len, str) {
36638 return new Array(len - str.length + 1).join(' ') + str;
36639}
36640
36641module.exports = GraphQLConsoleReporter;
36642
36643/***/ }),
36644/* 189 */
36645/***/ (function(module, exports, __webpack_require__) {
36646
36647"use strict";
36648/**
36649 * Copyright (c) Facebook, Inc. and its affiliates.
36650 *
36651 * This source code is licensed under the MIT license found in the
36652 * LICENSE file in the root directory of this source tree.
36653 *
36654 * strict-local
36655 * @format
36656 */
36657
36658
36659var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
36660
36661var parseGraphQL = __webpack_require__(7).instrument(__webpack_require__(0).parse, 'GraphQL.parse');
36662
36663var FIND_OPTIONS = {
36664 validateNames: true
36665};
36666
36667module.exports = function (tagFinder) {
36668 var memoizedTagFinder = __webpack_require__(190).memoizedFind.bind(null, tagFinder);
36669
36670 function parseFile(baseDir, file) {
36671 var result = parseFileWithSources(baseDir, file);
36672
36673 if (result) {
36674 return result.document;
36675 }
36676 } // Throws an error if parsing the file fails
36677
36678
36679 function parseFileWithSources(baseDir, file) {
36680 var text = __webpack_require__(13).readFileSync(__webpack_require__(6).join(baseDir, file.relPath), 'utf8');
36681
36682 !(text.indexOf('graphql') >= 0) ? true ? __webpack_require__(4)(false, 'RelaySourceModuleParser: Files should be filtered before passed to the ' + 'parser, got unfiltered file `%s`.', file.relPath) : undefined : void 0;
36683 var astDefinitions = [];
36684 var sources = [];
36685 memoizedTagFinder(text, baseDir, file, FIND_OPTIONS).forEach(function (template) {
36686 var source = new (__webpack_require__(0).Source)(template, file.relPath);
36687 var ast = parseGraphQL(source);
36688 !ast.definitions.length ? true ? __webpack_require__(4)(false, 'RelaySourceModuleParser: Expected GraphQL text to contain at least one ' + 'definition (fragment, mutation, query, subscription), got `%s`.', template) : undefined : void 0;
36689 sources.push(source.body);
36690 astDefinitions.push.apply(astDefinitions, (0, _toConsumableArray2["default"])(ast.definitions));
36691 });
36692 return {
36693 document: {
36694 kind: 'Document',
36695 definitions: astDefinitions
36696 },
36697 sources: sources
36698 };
36699 }
36700
36701 function getParser(baseDir) {
36702 return new (__webpack_require__(79))({
36703 baseDir: baseDir,
36704 parse: parseFile
36705 });
36706 }
36707
36708 function getFileFilter(baseDir) {
36709 return function (file) {
36710 var text = __webpack_require__(13).readFileSync(__webpack_require__(6).join(baseDir, file.relPath), 'utf8');
36711
36712 return text.indexOf('graphql') >= 0;
36713 };
36714 }
36715
36716 return {
36717 getParser: getParser,
36718 getFileFilter: getFileFilter,
36719 parseFile: parseFile,
36720 parseFileWithSources: parseFileWithSources
36721 };
36722};
36723
36724/***/ }),
36725/* 190 */
36726/***/ (function(module, exports, __webpack_require__) {
36727
36728"use strict";
36729/**
36730 * Copyright (c) Facebook, Inc. and its affiliates.
36731 *
36732 * This source code is licensed under the MIT license found in the
36733 * LICENSE file in the root directory of this source tree.
36734 *
36735 *
36736 * @format
36737 */
36738
36739
36740var cache = new (__webpack_require__(191))('RelayFindGraphQLTags', 'v1');
36741
36742function memoizedFind(tagFinder, text, baseDir, file, options) {
36743 !file.exists ? true ? invariant(false, 'RelayFindGraphQLTags: Called with non-existent file `%s`', file.relPath) : undefined : void 0;
36744 return cache.getOrCompute(file.hash + (options.validateNames ? '1' : '0'), find.bind(null, tagFinder, text, __webpack_require__(6).join(baseDir, file.relPath), options));
36745}
36746
36747function find(tagFinder, text, absPath, _ref) {
36748 var validateNames = _ref.validateNames;
36749 var tags = tagFinder(text, absPath);
36750
36751 if (validateNames) {
36752 var moduleName = __webpack_require__(192)(absPath);
36753
36754 tags.forEach(function (tag) {
36755 return validateTemplate(tag, moduleName, absPath);
36756 });
36757 }
36758
36759 return tags.map(function (tag) {
36760 return tag.template;
36761 });
36762}
36763
36764function validateTemplate(_ref2, moduleName, filePath) {
36765 var template = _ref2.template,
36766 keyName = _ref2.keyName,
36767 sourceLocationOffset = _ref2.sourceLocationOffset;
36768
36769 var ast = __webpack_require__(0).parse(new (__webpack_require__(0).Source)(template, filePath, sourceLocationOffset));
36770
36771 ast.definitions.forEach(function (def) {
36772 !def.name ? true ? invariant(false, 'RelayFindGraphQLTags: In module `%s`, a definition of kind `%s` requires a name.', moduleName, def.kind) : undefined : void 0;
36773 var definitionName = def.name.value;
36774
36775 if (def.kind === 'OperationDefinition') {
36776 var operationNameParts = definitionName.match(/^(.*)(Mutation|Query|Subscription)$/);
36777 !(operationNameParts && definitionName.startsWith(moduleName)) ? true ? invariant(false, 'RelayFindGraphQLTags: Operation names in graphql tags must be prefixed ' + 'with the module name and end in "Mutation", "Query", or ' + '"Subscription". Got `%s` in module `%s`.', definitionName, moduleName) : undefined : void 0;
36778 } else if (def.kind === 'FragmentDefinition') {
36779 if (keyName) {
36780 !(definitionName === moduleName + '_' + keyName) ? true ? invariant(false, 'RelayFindGraphQLTags: Container fragment names must be ' + '`<ModuleName>_<propName>`. Got `%s`, expected `%s`.', definitionName, moduleName + '_' + keyName) : undefined : void 0;
36781 } else {
36782 !definitionName.startsWith(moduleName) ? true ? invariant(false, 'RelayFindGraphQLTags: Fragment names in graphql tags must be prefixed ' + 'with the module name. Got `%s` in module `%s`.', definitionName, moduleName) : undefined : void 0;
36783 }
36784 }
36785 });
36786} // TODO: Not sure why this is defined here rather than imported, is it so that it doesn’t get stripped in prod?
36787
36788
36789function invariant(condition, msg) {
36790 if (!condition) {
36791 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
36792 args[_key - 2] = arguments[_key];
36793 }
36794
36795 throw new Error(__webpack_require__(29).format.apply(__webpack_require__(29), [msg].concat(args)));
36796 }
36797}
36798
36799module.exports = {
36800 find: find,
36801 // Exported for testing only.
36802 memoizedFind: memoizedFind
36803};
36804
36805/***/ }),
36806/* 191 */
36807/***/ (function(module, exports, __webpack_require__) {
36808
36809"use strict";
36810/**
36811 * Copyright (c) Facebook, Inc. and its affiliates.
36812 *
36813 * This source code is licensed under the MIT license found in the
36814 * LICENSE file in the root directory of this source tree.
36815 *
36816 * strict-local
36817 * @format
36818 */
36819
36820
36821var _defineProperty2 = __webpack_require__(5)(__webpack_require__(38));
36822
36823/**
36824 * A file backed cache. Values are JSON encoded on disk, so only JSON
36825 * serializable values should be used.
36826 */
36827var RelayCompilerCache =
36828/*#__PURE__*/
36829function () {
36830 /**
36831 * @param name Human readable identifier for the cache
36832 * @param cacheBreaker This should be changed in order to invalidate existing
36833 * caches.
36834 */
36835 function RelayCompilerCache(name, cacheBreaker) {
36836 (0, _defineProperty2["default"])(this, "_dir", null);
36837 this._name = name;
36838 this._cacheBreaker = cacheBreaker;
36839 }
36840
36841 var _proto = RelayCompilerCache.prototype;
36842
36843 _proto._getFile = function _getFile(key) {
36844 if (this._dir == null) {
36845 // Include username in the cache dir to avoid issues with directories being
36846 // owned by a different user.
36847 var username = __webpack_require__(78).userInfo().username;
36848
36849 var cacheID = __webpack_require__(35).createHash('md5').update(this._cacheBreaker).update(username).digest('hex');
36850
36851 var dir = __webpack_require__(6).join(__webpack_require__(78).tmpdir(), "".concat(this._name, "-").concat(cacheID));
36852
36853 if (!__webpack_require__(13).existsSync(dir)) {
36854 try {
36855 __webpack_require__(13).mkdirSync(dir);
36856 } catch (error) {
36857 if (error.code !== 'EEXIST') {
36858 throw error;
36859 }
36860 }
36861 }
36862
36863 this._dir = dir;
36864 }
36865
36866 return __webpack_require__(6).join(this._dir, key);
36867 };
36868
36869 _proto.getOrCompute = function getOrCompute(key, compute) {
36870 var _this = this;
36871
36872 return __webpack_require__(7).run('RelayCompilerCache.getOrCompute', function () {
36873 var cacheFile = _this._getFile(key);
36874
36875 if (__webpack_require__(13).existsSync(cacheFile)) {
36876 try {
36877 return JSON.parse(__webpack_require__(13).readFileSync(cacheFile, 'utf8'));
36878 } catch (_unused) {// ignore
36879 }
36880 }
36881
36882 var value = compute();
36883
36884 try {
36885 __webpack_require__(13).writeFileSync(cacheFile, JSON.stringify(value), 'utf8');
36886 } catch (_unused2) {// ignore
36887 }
36888
36889 return value;
36890 });
36891 };
36892
36893 return RelayCompilerCache;
36894}();
36895
36896module.exports = RelayCompilerCache;
36897
36898/***/ }),
36899/* 192 */
36900/***/ (function(module, exports, __webpack_require__) {
36901
36902"use strict";
36903/**
36904 * Copyright (c) Facebook, Inc. and its affiliates.
36905 *
36906 * This source code is licensed under the MIT license found in the
36907 * LICENSE file in the root directory of this source tree.
36908 *
36909 * strict
36910 * @format
36911 */
36912
36913
36914function getModuleName(filePath) {
36915 // index.js -> index
36916 // index.js.flow -> index.js
36917 var filename = __webpack_require__(6).basename(filePath, __webpack_require__(6).extname(filePath)); // index.js -> index (when extension has multiple segments)
36918
36919
36920 filename = filename.replace(/(?:\.\w+)+/, ''); // /path/to/button/index.js -> button
36921
36922 var moduleName = filename === 'index' ? __webpack_require__(6).basename(__webpack_require__(6).dirname(filePath)) : filename; // Example.ios -> Example
36923 // Example.product.android -> Example
36924
36925 moduleName = moduleName.replace(/(?:\.\w+)+/, ''); // foo-bar -> fooBar
36926 // Relay compatibility mode splits on _, so we can't use that here.
36927
36928 moduleName = moduleName.replace(/[^a-zA-Z0-9]+(\w?)/g, function (match, next) {
36929 return next.toUpperCase();
36930 });
36931 return moduleName;
36932}
36933
36934module.exports = getModuleName;
36935
36936/***/ }),
36937/* 193 */
36938/***/ (function(module, exports, __webpack_require__) {
36939
36940"use strict";
36941/**
36942 * Copyright (c) Facebook, Inc. and its affiliates.
36943 *
36944 * This source code is licensed under the MIT license found in the
36945 * LICENSE file in the root directory of this source tree.
36946 *
36947 * strict-local
36948 * @format
36949 */
36950
36951
36952function parseFile(baseDir, file) {
36953 var text = __webpack_require__(13).readFileSync(__webpack_require__(6).join(baseDir, file.relPath), 'utf8');
36954
36955 return __webpack_require__(0).parse(new (__webpack_require__(0).Source)(text, file.relPath), {
36956 experimentalFragmentVariables: true
36957 });
36958}
36959
36960function getParser(baseDir) {
36961 return new (__webpack_require__(79))({
36962 baseDir: baseDir,
36963 parse: parseFile
36964 });
36965}
36966
36967module.exports = {
36968 parseFile: parseFile,
36969 getParser: getParser
36970};
36971
36972/***/ }),
36973/* 194 */
36974/***/ (function(module, exports, __webpack_require__) {
36975
36976"use strict";
36977/**
36978 * Copyright (c) Facebook, Inc. and its affiliates.
36979 *
36980 * This source code is licensed under the MIT license found in the
36981 * LICENSE file in the root directory of this source tree.
36982 *
36983 *
36984 * @format
36985 */
36986
36987
36988var _asyncToGenerator = __webpack_require__(18);
36989
36990var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
36991
36992var CodegenRunner =
36993/*#__PURE__*/
36994function () {
36995 // parser => writers that are affected by it
36996 function CodegenRunner(options) {
36997 var _this = this;
36998
36999 this.parsers = {};
37000 this.parserConfigs = options.parserConfigs;
37001 this.writerConfigs = options.writerConfigs;
37002 this.onlyValidate = options.onlyValidate;
37003 this.onComplete = options.onComplete;
37004 this._reporter = options.reporter;
37005 this._sourceControl = options.sourceControl;
37006 this.parserWriters = {};
37007
37008 for (var _parser in options.parserConfigs) {
37009 this.parserWriters[_parser] = new Set();
37010 }
37011
37012 var _loop = function _loop(_writer) {
37013 var config = options.writerConfigs[_writer];
37014 config.baseParsers && config.baseParsers.forEach(function (parser) {
37015 return _this.parserWriters[parser].add(_writer);
37016 });
37017
37018 _this.parserWriters[config.parser].add(_writer);
37019 };
37020
37021 for (var _writer in options.writerConfigs) {
37022 _loop(_writer);
37023 }
37024 }
37025
37026 var _proto = CodegenRunner.prototype;
37027
37028 _proto.compileAll =
37029 /*#__PURE__*/
37030 function () {
37031 var _compileAll = _asyncToGenerator(function* () {
37032 // reset the parsers
37033 this.parsers = {};
37034
37035 for (var parserName in this.parserConfigs) {
37036 try {
37037 yield this.parseEverything(parserName);
37038 } catch (e) {
37039 this._reporter.reportError('CodegenRunner.compileAll', e);
37040
37041 return 'ERROR';
37042 }
37043 }
37044
37045 var hasChanges = false;
37046
37047 for (var writerName in this.writerConfigs) {
37048 var result = yield this.write(writerName);
37049
37050 if (result === 'ERROR') {
37051 return 'ERROR';
37052 }
37053
37054 if (result === 'HAS_CHANGES') {
37055 hasChanges = true;
37056 }
37057 }
37058
37059 return hasChanges ? 'HAS_CHANGES' : 'NO_CHANGES';
37060 });
37061
37062 return function compileAll() {
37063 return _compileAll.apply(this, arguments);
37064 };
37065 }();
37066
37067 _proto.compile =
37068 /*#__PURE__*/
37069 function () {
37070 var _compile = _asyncToGenerator(function* (writerName) {
37071 var _this2 = this;
37072
37073 var writerConfig = this.writerConfigs[writerName];
37074 var parsers = [writerConfig.parser];
37075
37076 if (writerConfig.baseParsers) {
37077 writerConfig.baseParsers.forEach(function (parser) {
37078 return parsers.push(parser);
37079 });
37080 } // Don't bother resetting the parsers
37081
37082
37083 yield __webpack_require__(7).asyncContext('CodegenRunner:parseEverything', function () {
37084 return Promise.all(parsers.map(function (parser) {
37085 return _this2.parseEverything(parser);
37086 }));
37087 });
37088 return yield this.write(writerName);
37089 });
37090
37091 return function compile(_x) {
37092 return _compile.apply(this, arguments);
37093 };
37094 }();
37095
37096 _proto.getDirtyWriters = function getDirtyWriters(filePaths) {
37097 var _this3 = this;
37098
37099 return __webpack_require__(7).asyncContext('CodegenRunner:getDirtyWriters',
37100 /*#__PURE__*/
37101 _asyncToGenerator(function* () {
37102 var dirtyWriters = new Set(); // Check if any files are in the output
37103
37104 for (var configName in _this3.writerConfigs) {
37105 var config = _this3.writerConfigs[configName];
37106 var _iteratorNormalCompletion = true;
37107 var _didIteratorError = false;
37108 var _iteratorError = undefined;
37109
37110 try {
37111 for (var _iterator = filePaths[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
37112 var _filePath = _step.value;
37113
37114 if (config.isGeneratedFile(_filePath)) {
37115 dirtyWriters.add(configName);
37116 }
37117 }
37118 } catch (err) {
37119 _didIteratorError = true;
37120 _iteratorError = err;
37121 } finally {
37122 try {
37123 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
37124 _iterator["return"]();
37125 }
37126 } finally {
37127 if (_didIteratorError) {
37128 throw _iteratorError;
37129 }
37130 }
37131 }
37132 } // Check for files in the input
37133
37134
37135 yield Promise.all(Object.keys(_this3.parserConfigs).map(function (parserConfigName) {
37136 return __webpack_require__(7).waitFor('Watchman:query',
37137 /*#__PURE__*/
37138 _asyncToGenerator(function* () {
37139 var client = new (__webpack_require__(30))();
37140 var config = _this3.parserConfigs[parserConfigName];
37141 var dirs = yield client.watchProject(config.baseDir);
37142 var relativeFilePaths = filePaths.map(function (filePath) {
37143 return __webpack_require__(6).relative(config.baseDir, filePath);
37144 });
37145 var query = {
37146 expression: ['allof', config.watchmanExpression, ['name', relativeFilePaths, 'wholename']],
37147 fields: ['exists'],
37148 relative_root: dirs.relativePath
37149 };
37150 var result = yield client.command('query', dirs.root, query);
37151 client.end();
37152
37153 if (result.files.length > 0) {
37154 _this3.parserWriters[parserConfigName].forEach(function (writerName) {
37155 return dirtyWriters.add(writerName);
37156 });
37157 }
37158 }));
37159 }));
37160 return dirtyWriters;
37161 }));
37162 };
37163
37164 _proto.parseEverything =
37165 /*#__PURE__*/
37166 function () {
37167 var _parseEverything = _asyncToGenerator(function* (parserName) {
37168 if (this.parsers[parserName]) {
37169 // no need to parse
37170 return;
37171 }
37172
37173 var parserConfig = this.parserConfigs[parserName];
37174 this.parsers[parserName] = parserConfig.getParser(parserConfig.baseDir);
37175 var filter = parserConfig.getFileFilter ? parserConfig.getFileFilter(parserConfig.baseDir) : anyFileFilter;
37176
37177 if (parserConfig.filepaths && parserConfig.watchmanExpression) {
37178 throw new Error('Provide either `watchmanExpression` or `filepaths` but not both.');
37179 }
37180
37181 var files;
37182
37183 if (parserConfig.watchmanExpression) {
37184 files = yield __webpack_require__(36).queryFiles(parserConfig.baseDir, parserConfig.watchmanExpression, filter);
37185 } else if (parserConfig.filepaths) {
37186 files = yield __webpack_require__(36).queryFilepaths(parserConfig.baseDir, parserConfig.filepaths, filter);
37187 } else {
37188 throw new Error('Either `watchmanExpression` or `filepaths` is required to query files');
37189 }
37190
37191 this.parseFileChanges(parserName, files);
37192 });
37193
37194 return function parseEverything(_x2) {
37195 return _parseEverything.apply(this, arguments);
37196 };
37197 }();
37198
37199 _proto.parseFileChanges = function parseFileChanges(parserName, files) {
37200 var _this4 = this;
37201
37202 return __webpack_require__(7).run('CodegenRunner.parseFileChanges', function () {
37203 var parser = _this4.parsers[parserName]; // this maybe should be await parser.parseFiles(files);
37204
37205 parser.parseFiles(files);
37206 });
37207 }; // We cannot do incremental writes right now.
37208 // When we can, this could be writeChanges(writerName, parserName, parsedDefinitions)
37209
37210
37211 _proto.write = function write(writerName) {
37212 var _this5 = this;
37213
37214 return __webpack_require__(7).asyncContext('CodegenRunner.write',
37215 /*#__PURE__*/
37216 _asyncToGenerator(function* () {
37217 try {
37218 _this5._reporter.reportMessage("\nWriting ".concat(writerName));
37219
37220 var _this5$writerConfigs$ = _this5.writerConfigs[writerName],
37221 writeFiles = _this5$writerConfigs$.writeFiles,
37222 _parser2 = _this5$writerConfigs$.parser,
37223 baseParsers = _this5$writerConfigs$.baseParsers,
37224 isGeneratedFile = _this5$writerConfigs$.isGeneratedFile;
37225
37226 var baseDocuments = __webpack_require__(25).Map();
37227
37228 if (baseParsers) {
37229 baseParsers.forEach(function (baseParserName) {
37230 baseDocuments = baseDocuments.merge(_this5.parsers[baseParserName].documents());
37231 });
37232 }
37233
37234 var _this5$parserConfigs$ = _this5.parserConfigs[_parser2],
37235 _baseDir = _this5$parserConfigs$.baseDir,
37236 generatedDirectoriesWatchmanExpression = _this5$parserConfigs$.generatedDirectoriesWatchmanExpression;
37237 var generatedDirectories = [];
37238
37239 if (generatedDirectoriesWatchmanExpression) {
37240 var relativePaths = yield __webpack_require__(36).queryDirectories(_baseDir, generatedDirectoriesWatchmanExpression);
37241 generatedDirectories = relativePaths.map(function (x) {
37242 return __webpack_require__(6).join(_baseDir, x);
37243 });
37244 } // always create a new writer: we have to write everything anyways
37245
37246
37247 var documents = _this5.parsers[_parser2].documents();
37248
37249 var schema = __webpack_require__(7).run('getSchema', function () {
37250 return _this5.parserConfigs[_parser2].getSchema();
37251 });
37252
37253 var outputDirectories = yield writeFiles({
37254 onlyValidate: _this5.onlyValidate,
37255 schema: schema,
37256 documents: documents,
37257 baseDocuments: baseDocuments,
37258 generatedDirectories: generatedDirectories,
37259 sourceControl: _this5._sourceControl,
37260 reporter: _this5._reporter
37261 });
37262 var _iteratorNormalCompletion2 = true;
37263 var _didIteratorError2 = false;
37264 var _iteratorError2 = undefined;
37265
37266 try {
37267 for (var _iterator2 = outputDirectories.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
37268 var dir = _step2.value;
37269 var all = (0, _toConsumableArray2["default"])(dir.changes.created).concat((0, _toConsumableArray2["default"])(dir.changes.updated), (0, _toConsumableArray2["default"])(dir.changes.deleted), (0, _toConsumableArray2["default"])(dir.changes.unchanged));
37270 var _iteratorNormalCompletion3 = true;
37271 var _didIteratorError3 = false;
37272 var _iteratorError3 = undefined;
37273
37274 try {
37275 for (var _iterator3 = all[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
37276 var filename = _step3.value;
37277
37278 var _filePath2 = dir.getPath(filename);
37279
37280 !isGeneratedFile(_filePath2) ? true ? __webpack_require__(4)(false, 'CodegenRunner: %s returned false for isGeneratedFile, ' + 'but was in generated directory', _filePath2) : undefined : void 0;
37281 }
37282 } catch (err) {
37283 _didIteratorError3 = true;
37284 _iteratorError3 = err;
37285 } finally {
37286 try {
37287 if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
37288 _iterator3["return"]();
37289 }
37290 } finally {
37291 if (_didIteratorError3) {
37292 throw _iteratorError3;
37293 }
37294 }
37295 }
37296 }
37297 } catch (err) {
37298 _didIteratorError2 = true;
37299 _iteratorError2 = err;
37300 } finally {
37301 try {
37302 if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
37303 _iterator2["return"]();
37304 }
37305 } finally {
37306 if (_didIteratorError2) {
37307 throw _iteratorError2;
37308 }
37309 }
37310 }
37311
37312 var onCompleteCallback = _this5.onComplete;
37313
37314 if (onCompleteCallback != null) {
37315 onCompleteCallback(Array.from(outputDirectories.values()));
37316 }
37317
37318 var combinedChanges = __webpack_require__(31).combineChanges(Array.from(outputDirectories.values()));
37319
37320 __webpack_require__(31).printChanges(combinedChanges, {
37321 onlyValidate: _this5.onlyValidate
37322 });
37323
37324 return __webpack_require__(31).hasChanges(combinedChanges) ? 'HAS_CHANGES' : 'NO_CHANGES';
37325 } catch (e) {
37326 _this5._reporter.reportError('CodegenRunner.write', e);
37327
37328 return 'ERROR';
37329 }
37330 }));
37331 };
37332
37333 _proto.watchAll =
37334 /*#__PURE__*/
37335 function () {
37336 var _watchAll = _asyncToGenerator(function* () {
37337 // get everything set up for watching
37338 yield this.compileAll();
37339
37340 for (var parserName in this.parserConfigs) {
37341 yield this.watch(parserName);
37342 }
37343 });
37344
37345 return function watchAll() {
37346 return _watchAll.apply(this, arguments);
37347 };
37348 }();
37349
37350 _proto.watch =
37351 /*#__PURE__*/
37352 function () {
37353 var _watch = _asyncToGenerator(function* (parserName) {
37354 var _this6 = this;
37355
37356 var parserConfig = this.parserConfigs[parserName];
37357
37358 if (!parserConfig.watchmanExpression) {
37359 throw new Error('`watchmanExpression` is required to watch files');
37360 } // watchCompile starts with a full set of files as the changes
37361 // But as we need to set everything up due to potential parser dependencies,
37362 // we should prevent the first watch callback from doing anything.
37363
37364
37365 var firstChange = true;
37366 yield __webpack_require__(36).watchCompile(parserConfig.baseDir, parserConfig.watchmanExpression, parserConfig.getFileFilter ? parserConfig.getFileFilter(parserConfig.baseDir) : anyFileFilter,
37367 /*#__PURE__*/
37368 function () {
37369 var _ref4 = _asyncToGenerator(function* (files) {
37370 !_this6.parsers[parserName] ? true ? __webpack_require__(4)(false, 'Trying to watch an uncompiled parser config: %s', parserName) : undefined : void 0;
37371
37372 if (firstChange) {
37373 firstChange = false;
37374 return;
37375 }
37376
37377 var dependentWriters = [];
37378
37379 _this6.parserWriters[parserName].forEach(function (writer) {
37380 return dependentWriters.push(writer);
37381 });
37382
37383 try {
37384 if (!_this6.parsers[parserName]) {
37385 // have to load the parser and make sure all of its dependents are set
37386 yield _this6.parseEverything(parserName);
37387 } else {
37388 _this6.parseFileChanges(parserName, files);
37389 }
37390
37391 yield Promise.all(dependentWriters.map(function (writer) {
37392 return _this6.write(writer);
37393 }));
37394 } catch (error) {
37395 _this6._reporter.reportError('CodegenRunner.watch', error);
37396 }
37397
37398 _this6._reporter.reportMessage("Watching for changes to ".concat(parserName, "..."));
37399 });
37400
37401 return function (_x4) {
37402 return _ref4.apply(this, arguments);
37403 };
37404 }());
37405
37406 this._reporter.reportMessage("Watching for changes to ".concat(parserName, "..."));
37407 });
37408
37409 return function watch(_x3) {
37410 return _watch.apply(this, arguments);
37411 };
37412 }();
37413
37414 return CodegenRunner;
37415}();
37416
37417function anyFileFilter(file) {
37418 return true;
37419}
37420
37421module.exports = CodegenRunner;
37422
37423/***/ }),
37424/* 195 */
37425/***/ (function(module, exports, __webpack_require__) {
37426
37427"use strict";
37428/**
37429 * Copyright (c) Facebook, Inc. and its affiliates.
37430 *
37431 * This source code is licensed under the MIT license found in the
37432 * LICENSE file in the root directory of this source tree.
37433 *
37434 *
37435 * @format
37436 */
37437
37438
37439var _asyncToGenerator = __webpack_require__(18);
37440
37441var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
37442
37443function compileAll(_ref) {
37444 var baseDir = _ref.baseDir,
37445 baseDocuments = _ref.baseDocuments,
37446 baseSchema = _ref.baseSchema,
37447 compilerTransforms = _ref.compilerTransforms,
37448 documents = _ref.documents,
37449 extraValidationRules = _ref.extraValidationRules,
37450 reporter = _ref.reporter,
37451 schemaExtensions = _ref.schemaExtensions,
37452 typeGenerator = _ref.typeGenerator;
37453
37454 // Can't convert to IR unless the schema already has Relay-local extensions
37455 var transformedSchema = __webpack_require__(50).transformASTSchema(baseSchema, schemaExtensions);
37456
37457 var extendedSchema = __webpack_require__(50).extendASTSchema(transformedSchema, (0, _toConsumableArray2["default"])(baseDocuments).concat((0, _toConsumableArray2["default"])(documents))); // Verify using local and global rules, can run global verifications here
37458 // because all files are processed together
37459
37460
37461 var validationRules = (0, _toConsumableArray2["default"])(__webpack_require__(80).LOCAL_RULES).concat((0, _toConsumableArray2["default"])(__webpack_require__(80).GLOBAL_RULES));
37462
37463 if (extraValidationRules) {
37464 validationRules = (0, _toConsumableArray2["default"])(validationRules).concat((0, _toConsumableArray2["default"])(extraValidationRules.LOCAL_RULES || []), (0, _toConsumableArray2["default"])(extraValidationRules.GLOBAL_RULES || []));
37465 }
37466
37467 var definitions = __webpack_require__(50).convertASTDocumentsWithBase(extendedSchema, baseDocuments, documents, validationRules, __webpack_require__(81).transform);
37468
37469 var compilerContext = new (__webpack_require__(51))(baseSchema, extendedSchema).addAll(definitions);
37470 var transformedTypeContext = compilerContext.applyTransforms(typeGenerator.transforms, reporter);
37471 var transformedQueryContext = compilerContext.applyTransforms((0, _toConsumableArray2["default"])(compilerTransforms.commonTransforms).concat((0, _toConsumableArray2["default"])(compilerTransforms.queryTransforms)), reporter);
37472
37473 var artifacts = __webpack_require__(198)(compilerContext, compilerTransforms, reporter);
37474
37475 return {
37476 artifacts: artifacts,
37477 definitions: definitions,
37478 transformedQueryContext: transformedQueryContext,
37479 transformedTypeContext: transformedTypeContext
37480 };
37481}
37482
37483function writeAll(_ref2) {
37484 var writerConfig = _ref2.config,
37485 onlyValidate = _ref2.onlyValidate,
37486 baseDocuments = _ref2.baseDocuments,
37487 documents = _ref2.documents,
37488 baseSchema = _ref2.schema,
37489 reporter = _ref2.reporter,
37490 sourceControl = _ref2.sourceControl;
37491 return __webpack_require__(7).asyncContext('RelayFileWriter.writeAll',
37492 /*#__PURE__*/
37493 _asyncToGenerator(function* () {
37494 var _compileAll = compileAll({
37495 baseDir: writerConfig.baseDir,
37496 baseDocuments: baseDocuments.valueSeq().toArray(),
37497 baseSchema: baseSchema,
37498 compilerTransforms: writerConfig.compilerTransforms,
37499 documents: documents.valueSeq().toArray(),
37500 extraValidationRules: writerConfig.validationRules,
37501 reporter: reporter,
37502 schemaExtensions: writerConfig.schemaExtensions,
37503 typeGenerator: writerConfig.typeGenerator
37504 }),
37505 artifactsWithBase = _compileAll.artifacts,
37506 definitions = _compileAll.definitions,
37507 transformedTypeContext = _compileAll.transformedTypeContext,
37508 transformedQueryContext = _compileAll.transformedQueryContext; // Build a context from all the documents
37509
37510
37511 var baseDefinitionNames = new Set();
37512 baseDocuments.forEach(function (doc) {
37513 doc.definitions.forEach(function (def) {
37514 if (__webpack_require__(3).isExecutableDefinitionAST(def) && def.name) {
37515 baseDefinitionNames.add(def.name.value);
37516 }
37517 });
37518 }); // remove nodes that are present in the base or that derive from nodes
37519 // in the base
37520
37521 var artifacts = artifactsWithBase.filter(function (node) {
37522 var sourceName = __webpack_require__(85).getReaderSourceDefinitionName(node);
37523
37524 return !baseDefinitionNames.has(sourceName);
37525 });
37526 var artifactMap = new Map(artifacts.map(function (artifact) {
37527 return [artifact.kind === 'Request' ? artifact.params.name : artifact.name, artifact];
37528 }));
37529 var existingFragmentNames = new Set(definitions.map(function (definition) {
37530 return definition.name;
37531 }));
37532 var definitionsMeta = new Map();
37533
37534 var getDefinitionMeta = function getDefinitionMeta(definitionName) {
37535 var artifact = __webpack_require__(22)(artifactMap.get(definitionName));
37536
37537 var sourceName = __webpack_require__(85).getReaderSourceDefinitionName(artifact);
37538
37539 var definitionMeta = definitionsMeta.get(sourceName);
37540 !definitionMeta ? true ? __webpack_require__(4)(false, 'RelayFileWriter: Could not determine source for definition: `%s`.', definitionName) : undefined : void 0;
37541 return definitionMeta;
37542 };
37543
37544 documents.forEach(function (doc, filePath) {
37545 doc.definitions.forEach(function (def) {
37546 if (def.name) {
37547 definitionsMeta.set(def.name.value, {
37548 dir: __webpack_require__(6).join(writerConfig.baseDir, __webpack_require__(6).dirname(filePath)),
37549 ast: def
37550 });
37551 }
37552 });
37553 }); // TODO(T22651734): improve this to correctly account for fragments that
37554 // have generated flow types.
37555
37556 baseDefinitionNames.forEach(function (baseDefinitionName) {
37557 existingFragmentNames["delete"](baseDefinitionName);
37558 });
37559 var allOutputDirectories = new Map();
37560
37561 var addCodegenDir = function addCodegenDir(dirPath) {
37562 var codegenDir = new (__webpack_require__(31))(dirPath, {
37563 onlyValidate: onlyValidate
37564 });
37565 allOutputDirectories.set(dirPath, codegenDir);
37566 return codegenDir;
37567 };
37568
37569 var _iteratorNormalCompletion = true;
37570 var _didIteratorError = false;
37571 var _iteratorError = undefined;
37572
37573 try {
37574 for (var _iterator = (writerConfig.generatedDirectories || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
37575 var existingDirectory = _step.value;
37576 addCodegenDir(existingDirectory);
37577 }
37578 } catch (err) {
37579 _didIteratorError = true;
37580 _iteratorError = err;
37581 } finally {
37582 try {
37583 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
37584 _iterator["return"]();
37585 }
37586 } finally {
37587 if (_didIteratorError) {
37588 throw _iteratorError;
37589 }
37590 }
37591 }
37592
37593 var configOutputDirectory;
37594
37595 if (writerConfig.outputDir) {
37596 configOutputDirectory = addCodegenDir(writerConfig.outputDir);
37597 }
37598
37599 var getGeneratedDirectory = function getGeneratedDirectory(definitionName) {
37600 if (configOutputDirectory) {
37601 return configOutputDirectory;
37602 }
37603
37604 var generatedPath = __webpack_require__(6).join(getDefinitionMeta(definitionName).dir, '__generated__');
37605
37606 var cachedDir = allOutputDirectories.get(generatedPath);
37607
37608 if (!cachedDir) {
37609 cachedDir = addCodegenDir(generatedPath);
37610 }
37611
37612 return cachedDir;
37613 };
37614
37615 var formatModule = __webpack_require__(7).instrument(writerConfig.formatModule, 'RelayFileWriter:formatModule');
37616
37617 var persistQuery = writerConfig.persistQuery ? __webpack_require__(7).instrumentWait(writerConfig.persistQuery, 'RelayFileWriter:persistQuery') : null;
37618
37619 try {
37620 yield Promise.all(artifacts.map(
37621 /*#__PURE__*/
37622 function () {
37623 var _ref3 = _asyncToGenerator(function* (node) {
37624 var nodeName = node.kind === 'Request' ? node.params.name : node.name;
37625
37626 if (baseDefinitionNames.has(nodeName)) {
37627 // don't add definitions that were part of base context
37628 return;
37629 }
37630
37631 var typeNode = transformedTypeContext.get(nodeName);
37632 var typeText = typeNode ? writerConfig.typeGenerator.generate(typeNode, {
37633 customScalars: writerConfig.customScalars,
37634 enumsHasteModule: writerConfig.enumsHasteModule,
37635 existingFragmentNames: existingFragmentNames,
37636 optionalInputFields: writerConfig.optionalInputFieldsForFlow,
37637 useHaste: writerConfig.useHaste,
37638 useSingleArtifactDirectory: !!writerConfig.outputDir,
37639 noFutureProofEnums: writerConfig.noFutureProofEnums
37640 }) : '';
37641
37642 var sourceHash = __webpack_require__(7).run('hashGraphQL', function () {
37643 return md5(__webpack_require__(0).print(getDefinitionMeta(nodeName).ast));
37644 });
37645
37646 yield __webpack_require__(200)(getGeneratedDirectory(nodeName), node, formatModule, typeText, persistQuery, writerConfig.platform, sourceHash, writerConfig.extension, writerConfig.printModuleDependency);
37647 });
37648
37649 return function (_x) {
37650 return _ref3.apply(this, arguments);
37651 };
37652 }()));
37653 var generateExtraFiles = writerConfig.generateExtraFiles;
37654
37655 if (generateExtraFiles) {
37656 __webpack_require__(7).run('RelayFileWriter:generateExtraFiles', function () {
37657 var configDirectory = writerConfig.outputDir;
37658 generateExtraFiles(function (dir) {
37659 var outputDirectory = dir || configDirectory;
37660 !outputDirectory ? true ? __webpack_require__(4)(false, 'RelayFileWriter: cannot generate extra files without specifying ' + 'an outputDir in the config or passing it in.') : undefined : void 0;
37661 var outputDir = allOutputDirectories.get(outputDirectory);
37662
37663 if (!outputDir) {
37664 outputDir = addCodegenDir(outputDirectory);
37665 }
37666
37667 return outputDir;
37668 }, transformedQueryContext, getGeneratedDirectory);
37669 });
37670 } // clean output directories
37671
37672
37673 if (writerConfig.experimental_noDeleteExtraFiles !== true) {
37674 allOutputDirectories.forEach(function (dir) {
37675 dir.deleteExtraFiles(writerConfig.experimental_extraFilesPatternToKeep);
37676 });
37677 }
37678
37679 if (sourceControl && !onlyValidate) {
37680 yield __webpack_require__(31).sourceControlAddRemove(sourceControl, Array.from(allOutputDirectories.values()));
37681 }
37682 } catch (error) {
37683 var details;
37684
37685 try {
37686 details = JSON.parse(error.message);
37687 } catch (_) {} // eslint-disable-line lint/no-unused-catch-bindings
37688
37689
37690 if (details && details.name === 'GraphQL2Exception' && details.message) {
37691 throw new Error('GraphQL error writing modules:\n' + details.message);
37692 }
37693
37694 throw new Error('Error writing modules:\n' + String(error.stack || error));
37695 }
37696
37697 return allOutputDirectories;
37698 }));
37699}
37700
37701function md5(x) {
37702 return __webpack_require__(35).createHash('md5').update(x, 'utf8').digest('hex');
37703}
37704
37705module.exports = {
37706 writeAll: writeAll
37707};
37708
37709/***/ }),
37710/* 196 */
37711/***/ (function(module, exports, __webpack_require__) {
37712
37713"use strict";
37714/**
37715 * Copyright (c) Facebook, Inc. and its affiliates.
37716 *
37717 * This source code is licensed under the MIT license found in the
37718 * LICENSE file in the root directory of this source tree.
37719 *
37720 * strict-local
37721 * @format
37722 */
37723
37724
37725/**
37726 * Find the definition of a field of the specified type using strict
37727 * resolution rules per the GraphQL spec.
37728 */
37729function getFieldDefinitionStrict(schema, parentType, fieldName, fieldAST) {
37730 var type = __webpack_require__(3).getRawType(parentType);
37731
37732 var isQueryType = type === schema.getQueryType();
37733
37734 var hasTypeName = type instanceof __webpack_require__(0).GraphQLObjectType || type instanceof __webpack_require__(0).GraphQLInterfaceType || type instanceof __webpack_require__(0).GraphQLUnionType;
37735
37736 var schemaFieldDef;
37737
37738 if (isQueryType && fieldName === __webpack_require__(0).SchemaMetaFieldDef.name) {
37739 schemaFieldDef = __webpack_require__(0).SchemaMetaFieldDef;
37740 } else if (isQueryType && fieldName === __webpack_require__(0).TypeMetaFieldDef.name) {
37741 schemaFieldDef = __webpack_require__(0).TypeMetaFieldDef;
37742 } else if (hasTypeName && fieldName === __webpack_require__(0).TypeNameMetaFieldDef.name) {
37743 schemaFieldDef = __webpack_require__(0).TypeNameMetaFieldDef;
37744 } else if (type instanceof __webpack_require__(0).GraphQLInterfaceType || type instanceof __webpack_require__(0).GraphQLObjectType) {
37745 schemaFieldDef = type.getFields()[fieldName];
37746 }
37747
37748 return schemaFieldDef;
37749}
37750/**
37751 * Find the definition of a field of the specified type, first trying
37752 * the standard spec-compliant resolution process and falling back
37753 * to legacy mode that supports fat interfaces.
37754 */
37755
37756
37757function getFieldDefinitionLegacy(schema, parentType, fieldName, fieldAST) {
37758 var schemaFieldDef = getFieldDefinitionStrict(schema, parentType, fieldName, fieldAST);
37759
37760 if (!schemaFieldDef) {
37761 var type = __webpack_require__(3).getRawType(parentType);
37762
37763 schemaFieldDef = getFieldDefinitionLegacyImpl(schema, type, fieldName, fieldAST);
37764 }
37765
37766 return schemaFieldDef || null;
37767}
37768/**
37769 * @private
37770 */
37771
37772
37773function getFieldDefinitionLegacyImpl(schema, type, fieldName, fieldAST) {
37774 if (__webpack_require__(0).isAbstractType(type) && fieldAST && fieldAST.directives && fieldAST.directives.some(function (directive) {
37775 return getName(directive) === 'fixme_fat_interface';
37776 })) {
37777 var possibleTypes = schema.getPossibleTypes(__webpack_require__(0).assertAbstractType(type));
37778 var schemaFieldDef;
37779
37780 var _loop = function _loop(ii) {
37781 var possibleField = possibleTypes[ii].getFields()[fieldName];
37782
37783 if (possibleField) {
37784 // Fat interface fields can have differing arguments. Try to return
37785 // a field with matching arguments, but still return a field if the
37786 // arguments do not match.
37787 schemaFieldDef = possibleField;
37788
37789 if (fieldAST && fieldAST.arguments) {
37790 var argumentsAllExist = fieldAST.arguments.every(function (argument) {
37791 return possibleField.args.find(function (argDef) {
37792 return argDef.name === getName(argument);
37793 });
37794 });
37795
37796 if (argumentsAllExist) {
37797 return "break";
37798 }
37799 }
37800 }
37801 };
37802
37803 for (var ii = 0; ii < possibleTypes.length; ii++) {
37804 var _ret = _loop(ii);
37805
37806 if (_ret === "break") break;
37807 }
37808
37809 return schemaFieldDef;
37810 }
37811}
37812/**
37813 * @private
37814 */
37815
37816
37817function getName(ast) {
37818 var name = ast.name ? ast.name.value : null;
37819
37820 if (typeof name !== 'string') {
37821 throw __webpack_require__(1).createCompilerError("Expected ast node to have a 'name'.", null, [ast]);
37822 }
37823
37824 return name;
37825}
37826
37827module.exports = {
37828 getFieldDefinitionLegacy: getFieldDefinitionLegacy,
37829 getFieldDefinitionStrict: getFieldDefinitionStrict
37830};
37831
37832/***/ }),
37833/* 197 */
37834/***/ (function(module, exports, __webpack_require__) {
37835
37836"use strict";
37837/**
37838 * Copyright (c) Facebook, Inc. and its affiliates.
37839 *
37840 * This source code is licensed under the MIT license found in the
37841 * LICENSE file in the root directory of this source tree.
37842 *
37843 *
37844 * @format
37845 */
37846
37847
37848var createUserError = function createUserError(format) {
37849 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
37850 args[_key - 1] = arguments[_key];
37851 }
37852
37853 var index = 0;
37854 var formatted = format.replace(/%s/g, function (match) {
37855 return args[index++];
37856 });
37857 return new Error(formatted);
37858};
37859
37860module.exports = {
37861 createUserError: createUserError
37862};
37863
37864/***/ }),
37865/* 198 */
37866/***/ (function(module, exports, __webpack_require__) {
37867
37868"use strict";
37869/**
37870 * Copyright (c) Facebook, Inc. and its affiliates.
37871 *
37872 * This source code is licensed under the MIT license found in the
37873 * LICENSE file in the root directory of this source tree.
37874 *
37875 *
37876 * @format
37877 */
37878
37879
37880var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
37881
37882/**
37883 * Transforms the provided compiler context
37884 *
37885 * compileRelayArtifacts generates artifacts for Relay's runtime as a result of
37886 * applying a series of transforms. Each kind of artifact is dependent on
37887 * transforms being applied in the following order:
37888 *
37889 * - Fragment Readers: commonTransforms, fragmentTransforms
37890 * - Operation Writers: commonTransforms, queryTransforms, codegenTransforms
37891 * - GraphQL Text: commonTransforms, queryTransforms, printTransforms
37892 *
37893 * The order of the transforms applied for each artifact below is important.
37894 * CompilerContext will memoize applying each transform, so while
37895 * `commonTransforms` appears in each artifacts' application, it will not result
37896 * in repeated work as long as the order remains consistent across each context.
37897 */
37898function compileRelayArtifacts(context, transforms, reporter) {
37899 return __webpack_require__(7).run('GraphQLCompiler.compile', function () {
37900 // The fragment is used for reading data from the normalized store.
37901 var fragmentContext = context.applyTransforms((0, _toConsumableArray2["default"])(transforms.commonTransforms).concat((0, _toConsumableArray2["default"])(transforms.fragmentTransforms)), reporter); // The unflattened query is used for printing, since flattening creates an
37902 // invalid query.
37903
37904 var printContext = context.applyTransforms((0, _toConsumableArray2["default"])(transforms.commonTransforms).concat((0, _toConsumableArray2["default"])(transforms.queryTransforms), (0, _toConsumableArray2["default"])(transforms.printTransforms)), reporter); // The flattened query is used for codegen in order to reduce the number of
37905 // duplicate fields that must be processed during response normalization.
37906
37907 var codeGenContext = context.applyTransforms((0, _toConsumableArray2["default"])(transforms.commonTransforms).concat((0, _toConsumableArray2["default"])(transforms.queryTransforms), (0, _toConsumableArray2["default"])(transforms.codegenTransforms)), reporter);
37908 var results = []; // Add everything from codeGenContext, these are the operations as well as
37909 // SplitOperations from @match.
37910
37911 var _iteratorNormalCompletion = true;
37912 var _didIteratorError = false;
37913 var _iteratorError = undefined;
37914
37915 try {
37916 for (var _iterator = codeGenContext.documents()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
37917 var node = _step.value;
37918
37919 if (node.kind === 'Root') {
37920 var fragNode = fragmentContext.getRoot(node.name);
37921 results.push(__webpack_require__(52).generate({
37922 kind: 'Request',
37923 fragment: {
37924 kind: 'Fragment',
37925 argumentDefinitions: fragNode.argumentDefinitions,
37926 directives: fragNode.directives,
37927 loc: {
37928 kind: 'Derived',
37929 source: node.loc
37930 },
37931 metadata: null,
37932 name: fragNode.name,
37933 selections: fragNode.selections,
37934 type: fragNode.type
37935 },
37936 id: null,
37937 loc: node.loc,
37938 metadata: node.metadata || {},
37939 name: fragNode.name,
37940 root: node,
37941 text: printOperation(printContext, fragNode.name)
37942 }));
37943 } else {
37944 results.push(__webpack_require__(52).generate(node));
37945 }
37946 } // Add all the Fragments from the fragmentContext for the reader ASTs.
37947
37948 } catch (err) {
37949 _didIteratorError = true;
37950 _iteratorError = err;
37951 } finally {
37952 try {
37953 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
37954 _iterator["return"]();
37955 }
37956 } finally {
37957 if (_didIteratorError) {
37958 throw _iteratorError;
37959 }
37960 }
37961 }
37962
37963 var _iteratorNormalCompletion2 = true;
37964 var _didIteratorError2 = false;
37965 var _iteratorError2 = undefined;
37966
37967 try {
37968 for (var _iterator2 = fragmentContext.documents()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
37969 var _node = _step2.value;
37970
37971 if (_node.kind === 'Fragment') {
37972 results.push(__webpack_require__(52).generate(_node));
37973 }
37974 }
37975 } catch (err) {
37976 _didIteratorError2 = true;
37977 _iteratorError2 = err;
37978 } finally {
37979 try {
37980 if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
37981 _iterator2["return"]();
37982 }
37983 } finally {
37984 if (_didIteratorError2) {
37985 throw _iteratorError2;
37986 }
37987 }
37988 }
37989
37990 return results;
37991 });
37992}
37993
37994function printOperation(printContext, name) {
37995 var printableRoot = printContext.getRoot(name);
37996 return __webpack_require__(199)(printableRoot, printContext).documents().map(__webpack_require__(49).print).join('\n');
37997}
37998
37999module.exports = compileRelayArtifacts;
38000
38001/***/ }),
38002/* 199 */
38003/***/ (function(module, exports, __webpack_require__) {
38004
38005"use strict";
38006/**
38007 * Copyright (c) Facebook, Inc. and its affiliates.
38008 *
38009 * This source code is licensed under the MIT license found in the
38010 * LICENSE file in the root directory of this source tree.
38011 *
38012 * strict-local
38013 * @format
38014 */
38015
38016
38017/**
38018 * Returns a GraphQLCompilerContext containing only the documents referenced
38019 * by and including the provided node.
38020 */
38021function filterContextForNode(node, context) {
38022 var queue = [node];
38023 var filteredContext = new (__webpack_require__(51))(context.serverSchema, context.clientSchema).add(node);
38024
38025 var visitFragmentSpread = function visitFragmentSpread(fragmentSpread) {
38026 var name = fragmentSpread.name;
38027
38028 if (!filteredContext.get(name)) {
38029 var fragment = context.getFragment(name);
38030 filteredContext = filteredContext.add(fragment);
38031 queue.push(fragment);
38032 }
38033 };
38034
38035 var visitorConfig = {
38036 FragmentSpread: function FragmentSpread(fragmentSpread) {
38037 visitFragmentSpread(fragmentSpread);
38038 }
38039 };
38040
38041 while (queue.length) {
38042 __webpack_require__(23).visit(queue.pop(), visitorConfig);
38043 }
38044
38045 return filteredContext;
38046}
38047
38048module.exports = filterContextForNode;
38049
38050/***/ }),
38051/* 200 */
38052/***/ (function(module, exports, __webpack_require__) {
38053
38054"use strict";
38055/**
38056 * Copyright (c) Facebook, Inc. and its affiliates.
38057 *
38058 * This source code is licensed under the MIT license found in the
38059 * LICENSE file in the root directory of this source tree.
38060 *
38061 * strict-local
38062 * @format
38063 */
38064
38065
38066var _asyncToGenerator = __webpack_require__(18);
38067
38068var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
38069
38070function printRequireModuleDependency(moduleName) {
38071 return "require('".concat(moduleName, "')");
38072}
38073
38074function getConcreteType(node) {
38075 switch (node.kind) {
38076 case __webpack_require__(14).RelayConcreteNode.FRAGMENT:
38077 return 'ReaderFragment';
38078
38079 case __webpack_require__(14).RelayConcreteNode.REQUEST:
38080 return 'ConcreteRequest';
38081
38082 case __webpack_require__(14).RelayConcreteNode.SPLIT_OPERATION:
38083 return 'NormalizationSplitOperation';
38084
38085 default:
38086 node;
38087 true ? true ? __webpack_require__(4)(false, 'Unexpected GeneratedNode kind: `%s`.', node.kind) : undefined : undefined;
38088 }
38089}
38090
38091function writeRelayGeneratedFile(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
38092 return _writeRelayGeneratedFile.apply(this, arguments);
38093}
38094
38095function _writeRelayGeneratedFile() {
38096 _writeRelayGeneratedFile = _asyncToGenerator(function* (codegenDir, _generatedNode, formatModule, typeText, _persistQuery, platform, sourceHash, extension) {
38097 var printModuleDependency = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : printRequireModuleDependency;
38098 var generatedNode = _generatedNode; // Copy to const so Flow can refine.
38099
38100 var persistQuery = _persistQuery;
38101 var moduleName = (generatedNode.kind === 'Request' ? generatedNode.params.name : generatedNode.name) + '.graphql';
38102 var platformName = platform != null && platform.length > 0 ? moduleName + '.' + platform : moduleName;
38103 var filename = platformName + '.' + extension;
38104 var typeName = getConcreteType(generatedNode);
38105 var devOnlyProperties = {};
38106 var docText;
38107
38108 if (generatedNode.kind === __webpack_require__(14).RelayConcreteNode.REQUEST) {
38109 docText = generatedNode.params.text;
38110 }
38111
38112 var hash = null;
38113
38114 if (generatedNode.kind === __webpack_require__(14).RelayConcreteNode.REQUEST) {
38115 var oldHash = __webpack_require__(7).run('RelayFileWriter:compareHash', function () {
38116 var oldContent = codegenDir.read(filename); // Hash the concrete node including the query text.
38117
38118 var hasher = __webpack_require__(35).createHash('md5');
38119
38120 hasher.update('cache-breaker-9');
38121 hasher.update(JSON.stringify(generatedNode));
38122 hasher.update(sourceHash);
38123
38124 if (typeText) {
38125 hasher.update(typeText);
38126 }
38127
38128 if (persistQuery) {
38129 hasher.update('persisted');
38130 }
38131
38132 hash = hasher.digest('hex');
38133 return extractHash(oldContent);
38134 });
38135
38136 if (hash === oldHash) {
38137 codegenDir.markUnchanged(filename);
38138 return null;
38139 }
38140
38141 if (codegenDir.onlyValidate) {
38142 codegenDir.markUpdated(filename);
38143 return null;
38144 }
38145
38146 if (persistQuery) {
38147 switch (generatedNode.kind) {
38148 case __webpack_require__(14).RelayConcreteNode.REQUEST:
38149 var _text = __webpack_require__(22)(generatedNode.params.text);
38150
38151 devOnlyProperties.params = {
38152 text: _text
38153 };
38154 generatedNode = (0, _objectSpread2["default"])({}, generatedNode, {
38155 params: (0, _objectSpread2["default"])({}, generatedNode.params, {
38156 text: null,
38157 id: yield persistQuery(_text, sourceHash)
38158 })
38159 });
38160 break;
38161
38162 case __webpack_require__(14).RelayConcreteNode.FRAGMENT:
38163 // Do not persist fragments.
38164 break;
38165
38166 default:
38167 generatedNode.kind;
38168 }
38169 }
38170 }
38171
38172 var devOnlyAssignments = __webpack_require__(201)('(node/*: any*/)', devOnlyProperties);
38173
38174 var moduleText = formatModule({
38175 moduleName: moduleName,
38176 documentType: typeName,
38177 kind: generatedNode.kind,
38178 docText: docText,
38179 typeText: typeText,
38180 hash: hash ? "@relayHash ".concat(hash) : null,
38181 concreteText: __webpack_require__(83).postProcess(__webpack_require__(202)(generatedNode), printModuleDependency),
38182 devOnlyAssignments: devOnlyAssignments,
38183 sourceHash: sourceHash
38184 });
38185 codegenDir.writeFile(filename, moduleText);
38186 return generatedNode;
38187 });
38188 return _writeRelayGeneratedFile.apply(this, arguments);
38189}
38190
38191function extractHash(text) {
38192 if (text == null || text.length === 0) {
38193 return null;
38194 }
38195
38196 if (/<<<<<|>>>>>/.test(text)) {
38197 // looks like a merge conflict
38198 return null;
38199 }
38200
38201 var match = text.match(/@relayHash (\w{32})\b/m);
38202 return match && match[1];
38203}
38204
38205module.exports = writeRelayGeneratedFile;
38206
38207/***/ }),
38208/* 201 */
38209/***/ (function(module, exports, __webpack_require__) {
38210
38211"use strict";
38212/**
38213 * Copyright (c) Facebook, Inc. and its affiliates.
38214 *
38215 * This source code is licensed under the MIT license found in the
38216 * LICENSE file in the root directory of this source tree.
38217 *
38218 *
38219 * @format
38220 */
38221
38222/**
38223 * Given a object of nested properties, return JavaScript text that would merge
38224 * in an object named `objectName` by a series of individual assignments.
38225 */
38226
38227function deepMergeAssignments(objectName, properties) {
38228 var assignments = [];
38229 collectAssignmentsInto(assignments, [], properties);
38230 var jsAssignments = assignments.map(function (_ref) {
38231 var path = _ref.path,
38232 value = _ref.value;
38233 return formatJSAssignment(objectName, path, value);
38234 });
38235 return jsAssignments.length === 0 ? '' : jsAssignments.join('\n');
38236} // Recursively collect assignments
38237
38238
38239function collectAssignmentsInto(assignments, parentPath, parentValue) {
38240 // Iterate over the entries in the array or object.
38241 forEach(parentValue, function (value, key) {
38242 // The "path" is the sequence of keys to arrive at this assignment.
38243 var path = parentPath.concat(key); // For each entry, either add an assignment or recurse.
38244
38245 if (typeof value === 'object' && value !== null) {
38246 collectAssignmentsInto(assignments, path, value);
38247 } else {
38248 assignments.push({
38249 path: path,
38250 value: value
38251 });
38252 }
38253 });
38254} // Print a path/value pair as a JS assignment expression.
38255
38256
38257function formatJSAssignment(objectName, path, value) {
38258 var assignmentPath = path.map(function (p) {
38259 return typeof p === 'string' ? ".".concat(p) : "[".concat(p, "]");
38260 }).join('');
38261 var jsValue = value === undefined ? 'undefined' : JSON.stringify(value);
38262 return "".concat(objectName).concat(assignmentPath, " = ").concat(jsValue, ";");
38263} // Utility for looping over entries in both Arrays and Objects.
38264
38265
38266function forEach(value, fn) {
38267 if (Array.isArray(value)) {
38268 for (var i = 0; i < value.length; i++) {
38269 fn(value[i], i);
38270 }
38271 } else {
38272 for (var k in value) {
38273 if (value.hasOwnProperty(k)) {
38274 fn(value[k], k);
38275 }
38276 }
38277 }
38278}
38279
38280module.exports = deepMergeAssignments;
38281
38282/***/ }),
38283/* 202 */
38284/***/ (function(module, exports, __webpack_require__) {
38285
38286"use strict";
38287/**
38288 * Copyright (c) Facebook, Inc. and its affiliates.
38289 *
38290 * This source code is licensed under the MIT license found in the
38291 * LICENSE file in the root directory of this source tree.
38292 *
38293 *
38294 * @format
38295 */
38296
38297/**
38298 * This function works similar to JSON.stringify except that for the case there
38299 * are multiple common subtrees, it generates a string for a IIFE that re-uses
38300 * the same objects for the duplicate subtrees.
38301 */
38302
38303function dedupeJSONStringify(jsonValue) {
38304 // Clone the object to convert references to the same object instance into
38305 // copies. This is needed for the WeakMap/Map to recognize them as duplicates.
38306 jsonValue = JSON.parse(JSON.stringify(jsonValue));
38307 var metadataForHash = new Map();
38308 var metadataForVal = new WeakMap();
38309 var varDefs = [];
38310 collectMetadata(jsonValue);
38311 collectDuplicates(jsonValue);
38312 var code = printJSCode(false, '', jsonValue);
38313 return varDefs.length === 0 ? code : "(function(){\nvar ".concat(varDefs.join(',\n'), ";\nreturn ").concat(code, ";\n})()"); // Collect common metadata for each object in the value tree, ensuring that
38314 // equivalent values have the *same reference* to the same metadata. Note that
38315 // the hashes generated are not exactly JSON, but still identify equivalent
38316 // values. Runs in linear time due to hashing in a bottom-up recursion.
38317
38318 function collectMetadata(value) {
38319 if (value == null || typeof value !== 'object') {
38320 return JSON.stringify(value);
38321 }
38322
38323 var hash;
38324
38325 if (Array.isArray(value)) {
38326 hash = '[';
38327
38328 for (var i = 0; i < value.length; i++) {
38329 hash += collectMetadata(value[i]) + ',';
38330 }
38331 } else {
38332 hash = '{';
38333
38334 for (var k in value) {
38335 if (value.hasOwnProperty(k) && value[k] !== undefined) {
38336 hash += k + ':' + collectMetadata(value[k]) + ',';
38337 }
38338 }
38339 }
38340
38341 var metadata = metadataForHash.get(hash);
38342
38343 if (!metadata) {
38344 metadata = {
38345 value: value,
38346 hash: hash,
38347 isDuplicate: false
38348 };
38349 metadataForHash.set(hash, metadata);
38350 }
38351
38352 metadataForVal.set(value, metadata);
38353 return hash;
38354 } // Using top-down recursion, linearly scan the JSON tree to determine which
38355 // values should be deduplicated.
38356
38357
38358 function collectDuplicates(value) {
38359 if (value == null || typeof value !== 'object') {
38360 return;
38361 }
38362
38363 var metadata = metadataForVal.get(value); // Only consider duplicates with hashes longer than 2 (excludes [] and {}).
38364
38365 if (metadata && metadata.value !== value && metadata.hash.length > 2) {
38366 metadata.isDuplicate = true;
38367 return;
38368 }
38369
38370 if (Array.isArray(value)) {
38371 for (var i = 0; i < value.length; i++) {
38372 collectDuplicates(value[i]);
38373 }
38374 } else {
38375 for (var k in value) {
38376 if (value.hasOwnProperty(k) && value[k] !== undefined) {
38377 collectDuplicates(value[k]);
38378 }
38379 }
38380 }
38381 } // Stringify JS, replacing duplicates with variable references.
38382
38383
38384 function printJSCode(isDupedVar, depth, value) {
38385 if (value == null || typeof value !== 'object') {
38386 return JSON.stringify(value);
38387 } // Only use variable references at depth beyond the top level.
38388
38389
38390 if (depth !== '') {
38391 var metadata = metadataForVal.get(value);
38392
38393 if (metadata && metadata.isDuplicate) {
38394 if (!metadata.varName) {
38395 var refCode = printJSCode(true, '', value);
38396 metadata.varName = 'v' + varDefs.length;
38397 varDefs.push(metadata.varName + ' = ' + refCode);
38398 }
38399
38400 return '(' + metadata.varName + '/*: any*/)';
38401 }
38402 }
38403
38404 var str;
38405 var isEmpty = true;
38406 var depth2 = depth + ' ';
38407
38408 if (Array.isArray(value)) {
38409 // Empty arrays can only have one inferred flow type and then conflict if
38410 // used in different places, this is unsound if we would write to them but
38411 // this whole module is based on the idea of a read only JSON tree.
38412 if (isDupedVar && value.length === 0) {
38413 return '([]/*: any*/)';
38414 }
38415
38416 str = '[';
38417
38418 for (var i = 0; i < value.length; i++) {
38419 str += (isEmpty ? '\n' : ',\n') + depth2 + printJSCode(isDupedVar, depth2, value[i]);
38420 isEmpty = false;
38421 }
38422
38423 str += isEmpty ? ']' : "\n".concat(depth, "]");
38424 } else {
38425 str = '{';
38426
38427 for (var k in value) {
38428 if (value.hasOwnProperty(k) && value[k] !== undefined) {
38429 str += (isEmpty ? '\n' : ',\n') + depth2 + JSON.stringify(k) + ': ' + printJSCode(isDupedVar, depth2, value[k]);
38430 isEmpty = false;
38431 }
38432 }
38433
38434 str += isEmpty ? '}' : "\n".concat(depth, "}");
38435 }
38436
38437 return str;
38438 }
38439}
38440
38441module.exports = dedupeJSONStringify;
38442
38443/***/ }),
38444/* 203 */
38445/***/ (function(module, exports, __webpack_require__) {
38446
38447"use strict";
38448/**
38449 * Copyright (c) Facebook, Inc. and its affiliates.
38450 *
38451 * This source code is licensed under the MIT license found in the
38452 * LICENSE file in the root directory of this source tree.
38453 *
38454 * strict-local
38455 * @format
38456 */
38457
38458
38459var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
38460
38461var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
38462
38463var ID = 'id';
38464var VIEWER_HANDLE = 'viewer';
38465var VIEWER_TYPE = 'Viewer';
38466/**
38467 * A transform that adds a "viewer" handle to all fields whose type is `Viewer`.
38468 */
38469
38470function relayViewerHandleTransform(context) {
38471 var viewerType = context.serverSchema.getType(VIEWER_TYPE);
38472
38473 if (viewerType == null || !(viewerType instanceof __webpack_require__(0).GraphQLObjectType) || viewerType.getFields()[ID] != null) {
38474 return context;
38475 }
38476
38477 return __webpack_require__(10).transform(context, {
38478 LinkedField: visitLinkedOrMatchField,
38479 MatchField: visitLinkedOrMatchField
38480 });
38481}
38482
38483function visitLinkedOrMatchField(field) {
38484 var transformedNode = this.traverse(field);
38485
38486 if (__webpack_require__(3).getRawType(field.type).name !== VIEWER_TYPE) {
38487 return transformedNode;
38488 }
38489
38490 var handles = transformedNode.handles;
38491 var viewerHandle = {
38492 name: VIEWER_HANDLE,
38493 key: __webpack_require__(14).DEFAULT_HANDLE_KEY,
38494 filters: null
38495 };
38496
38497 if (handles && !handles.find(function (handle) {
38498 return handle.name === VIEWER_HANDLE;
38499 })) {
38500 handles = (0, _toConsumableArray2["default"])(handles).concat([viewerHandle]);
38501 } else if (!handles) {
38502 handles = [viewerHandle];
38503 }
38504
38505 return handles !== transformedNode.handles ? (0, _objectSpread2["default"])({}, transformedNode, {
38506 handles: handles
38507 }) : transformedNode;
38508}
38509
38510module.exports = {
38511 transform: relayViewerHandleTransform
38512};
38513
38514/***/ }),
38515/* 204 */
38516/***/ (function(module, exports, __webpack_require__) {
38517
38518"use strict";
38519/**
38520 * Copyright (c) Facebook, Inc. and its affiliates.
38521 *
38522 * This source code is licensed under the MIT license found in the
38523 * LICENSE file in the root directory of this source tree.
38524 *
38525 *
38526 * @format
38527 */
38528
38529
38530var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
38531
38532function relayFieldHandleTransform(context) {
38533 return __webpack_require__(10).transform(context, {
38534 LinkedField: visitField,
38535 MatchField: visitField,
38536 ScalarField: visitField
38537 });
38538}
38539/**
38540 * @internal
38541 */
38542
38543
38544function visitField(field) {
38545 if (field.kind === 'LinkedField') {
38546 field = this.traverse(field);
38547 }
38548
38549 var handles = field.handles;
38550
38551 if (!handles || !handles.length) {
38552 return field;
38553 } // ensure exactly one handle
38554
38555
38556 !(handles.length === 1) ? true ? __webpack_require__(4)(false, 'RelayFieldHandleTransform: Expected fields to have at most one ' + '"handle" property, got `%s`.', handles.join(', ')) : undefined : void 0;
38557 var alias = field.alias || field.name;
38558 var handle = handles[0];
38559
38560 var name = __webpack_require__(14).getRelayHandleKey(handle.name, handle.key, field.name);
38561
38562 var filters = handle.filters;
38563 var args = filters ? field.args.filter(function (arg) {
38564 return filters.indexOf(arg.name) > -1;
38565 }) : [];
38566 return (0, _objectSpread2["default"])({}, field, {
38567 args: args,
38568 alias: alias,
38569 name: name,
38570 handles: null
38571 });
38572}
38573
38574module.exports = {
38575 transform: relayFieldHandleTransform
38576};
38577
38578/***/ }),
38579/* 205 */
38580/***/ (function(module, exports, __webpack_require__) {
38581
38582"use strict";
38583/**
38584 * Copyright (c) Facebook, Inc. and its affiliates.
38585 *
38586 * This source code is licensed under the MIT license found in the
38587 * LICENSE file in the root directory of this source tree.
38588 *
38589 *
38590 * @format
38591 */
38592
38593
38594var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
38595
38596var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
38597
38598/**
38599 * A tranform that converts a set of documents containing fragments/fragment
38600 * spreads *with* arguments to one where all arguments have been inlined. This
38601 * is effectively static currying of functions. Nodes are changed as follows:
38602 * - Fragment spreads with arguments are replaced with references to an inlined
38603 * version of the referenced fragment.
38604 * - Fragments with argument definitions are cloned once per unique set of
38605 * arguments, with the name changed to original name + hash and all nested
38606 * variable references changed to the value of that variable given its
38607 * arguments.
38608 * - Field & directive argument variables are replaced with the value of those
38609 * variables in context.
38610 * - All nodes are cloned with updated children.
38611 *
38612 * The transform also handles statically passing/failing Condition nodes:
38613 * - Literal Conditions with a passing value are elided and their selections
38614 * inlined in their parent.
38615 * - Literal Conditions with a failing value are removed.
38616 * - Nodes that would become empty as a result of the above are removed.
38617 *
38618 * Note that unreferenced fragments are not added to the output.
38619 */
38620function relayApplyFragmentArgumentTransform(context) {
38621 var fragments = new Map();
38622
38623 var nextContext = __webpack_require__(10).transform(context, {
38624 Root: function Root(node) {
38625 var scope = __webpack_require__(90).getRootScope(node.argumentDefinitions);
38626
38627 return transformNode(context, fragments, scope, node, [node]);
38628 },
38629 // Fragments are included below where referenced.
38630 // Unreferenced fragments are not included.
38631 Fragment: function Fragment() {
38632 return null;
38633 }
38634 });
38635
38636 return Array.from(fragments.values()).reduce(function (ctx, fragment) {
38637 return fragment ? ctx.add(fragment) : ctx;
38638 }, nextContext);
38639}
38640
38641function transformNode(context, fragments, scope, node, errorContext) {
38642 var selections = transformSelections(context, fragments, scope, node.selections, errorContext);
38643
38644 if (!selections) {
38645 return null;
38646 }
38647
38648 if (node.hasOwnProperty('directives')) {
38649 var directives = transformDirectives(scope, node.directives, errorContext); // $FlowIssue: this is a valid `Node`:
38650
38651 return (0, _objectSpread2["default"])({}, node, {
38652 directives: directives,
38653 selections: selections
38654 });
38655 }
38656
38657 return (0, _objectSpread2["default"])({}, node, {
38658 selections: selections
38659 });
38660}
38661
38662function transformFragmentSpread(context, fragments, scope, spread, errorContext) {
38663 var directives = transformDirectives(scope, spread.directives, errorContext);
38664 var appliedFragment = transformFragment(context, fragments, scope, spread, spread.args, (0, _toConsumableArray2["default"])(errorContext).concat([spread]));
38665
38666 if (!appliedFragment) {
38667 return null;
38668 }
38669
38670 var transformed = (0, _objectSpread2["default"])({}, spread, {
38671 kind: 'FragmentSpread',
38672 args: [],
38673 directives: directives,
38674 name: appliedFragment.name
38675 });
38676 return transformed;
38677}
38678
38679function transformField(context, fragments, scope, field, errorContext) {
38680 var args = transformArguments(scope, field.args, errorContext);
38681 var directives = transformDirectives(scope, field.directives, errorContext);
38682
38683 if (field.kind === 'LinkedField' || field.kind === 'MatchField') {
38684 var selections = transformSelections(context, fragments, scope, field.selections, errorContext);
38685
38686 if (!selections) {
38687 return null;
38688 } // $FlowFixMe(>=0.28.0)
38689
38690
38691 return (0, _objectSpread2["default"])({}, field, {
38692 args: args,
38693 directives: directives,
38694 selections: selections
38695 });
38696 } else {
38697 return (0, _objectSpread2["default"])({}, field, {
38698 args: args,
38699 directives: directives
38700 });
38701 }
38702}
38703
38704function transformCondition(context, fragments, scope, node, errorContext) {
38705 var condition = transformValue(scope, node.condition, errorContext);
38706
38707 if (!(condition.kind === 'Literal' || condition.kind === 'Variable')) {
38708 // This transform does whole-program optimization, errors in
38709 // a single document could break invariants and/or cause
38710 // additional spurious errors.
38711 throw __webpack_require__(1).createNonRecoverableUserError('A non-scalar value was applied to an @include or @skip directive, ' + 'the `if` argument value must be a ' + 'variable or a literal Boolean.', [condition.loc]);
38712 }
38713
38714 if (condition.kind === 'Literal' && condition.value !== node.passingValue) {
38715 // Dead code, no need to traverse further.
38716 return null;
38717 }
38718
38719 var selections = transformSelections(context, fragments, scope, node.selections, errorContext);
38720
38721 if (!selections) {
38722 return null;
38723 }
38724
38725 if (condition.kind === 'Literal' && condition.value === node.passingValue) {
38726 // Always passes, return inlined selections
38727 return selections;
38728 }
38729
38730 return [(0, _objectSpread2["default"])({}, node, {
38731 condition: condition,
38732 selections: selections
38733 })];
38734}
38735
38736function transformSelections(context, fragments, scope, selections, errorContext) {
38737 var nextSelections = null;
38738 selections.forEach(function (selection) {
38739 var nextSelection;
38740
38741 if (selection.kind === 'InlineFragment' || selection.kind === 'MatchBranch') {
38742 nextSelection = transformNode(context, fragments, scope, selection, errorContext);
38743 } else if (selection.kind === 'FragmentSpread') {
38744 nextSelection = transformFragmentSpread(context, fragments, scope, selection, errorContext);
38745 } else if (selection.kind === 'Condition') {
38746 var conditionSelections = transformCondition(context, fragments, scope, selection, errorContext);
38747
38748 if (conditionSelections) {
38749 var _nextSelections;
38750
38751 nextSelections = nextSelections || [];
38752
38753 (_nextSelections = nextSelections).push.apply(_nextSelections, (0, _toConsumableArray2["default"])(conditionSelections));
38754 }
38755 } else if (selection.kind === 'LinkedField' || selection.kind === 'ScalarField' || selection.kind === 'MatchField') {
38756 nextSelection = transformField(context, fragments, scope, selection, errorContext);
38757 } else if (selection.kind === 'Defer' || selection.kind === 'Stream') {
38758 throw __webpack_require__(1).createCompilerError('RelayApplyFragmentArgumentTransform: Expected to be applied before processing @defer/@stream.', [selection.loc]);
38759 } else {
38760 selection;
38761 throw __webpack_require__(1).createCompilerError("RelayApplyFragmentArgumentTransform: Unsupported kind '".concat(selection.kind, "'."), [selection.loc]);
38762 }
38763
38764 if (nextSelection) {
38765 nextSelections = nextSelections || [];
38766 nextSelections.push(nextSelection);
38767 }
38768 });
38769 return nextSelections;
38770}
38771
38772function transformDirectives(scope, directives, errorContext) {
38773 return directives.map(function (directive) {
38774 var args = transformArguments(scope, directive.args, errorContext);
38775 return (0, _objectSpread2["default"])({}, directive, {
38776 args: args
38777 });
38778 });
38779}
38780
38781function transformArguments(scope, args, errorContext) {
38782 return args.map(function (arg) {
38783 var value = transformValue(scope, arg.value, errorContext);
38784 return value === arg.value ? arg : (0, _objectSpread2["default"])({}, arg, {
38785 value: value
38786 });
38787 });
38788}
38789
38790function transformValue(scope, value, errorContext) {
38791 if (value.kind === 'Variable') {
38792 var scopeValue = scope[value.variableName];
38793
38794 if (scopeValue == null) {
38795 // This transform does whole-program optimization, errors in
38796 // a single document could break invariants and/or cause
38797 // additional spurious errors.
38798 throw __webpack_require__(1).createNonRecoverableUserError("Variable '$".concat(value.variableName, "' is not in scope."), [value.loc]);
38799 }
38800
38801 return scopeValue;
38802 } else if (value.kind === 'ListValue') {
38803 return (0, _objectSpread2["default"])({}, value, {
38804 items: value.items.map(function (item) {
38805 return transformValue(scope, item, errorContext);
38806 })
38807 });
38808 } else if (value.kind === 'ObjectValue') {
38809 return (0, _objectSpread2["default"])({}, value, {
38810 fields: value.fields.map(function (field) {
38811 return (0, _objectSpread2["default"])({}, field, {
38812 value: transformValue(scope, field.value, errorContext)
38813 });
38814 })
38815 });
38816 }
38817
38818 return value;
38819}
38820/**
38821 * Apply arguments to a fragment, creating a new fragment (with the given name)
38822 * with all values recursively applied.
38823 */
38824
38825
38826function transformFragment(context, fragments, parentScope, spread, args, errorContext) {
38827 var fragment = context.getFragment(spread.name);
38828 var argumentsHash = hashArguments(args, parentScope, errorContext);
38829 var fragmentName = argumentsHash ? "".concat(fragment.name, "_").concat(argumentsHash) : fragment.name;
38830 var appliedFragment = fragments.get(fragmentName);
38831
38832 if (appliedFragment) {
38833 return appliedFragment;
38834 }
38835
38836 var fragmentScope = __webpack_require__(90).getFragmentScope(fragment.argumentDefinitions, args, parentScope, spread);
38837
38838 if (fragments.get(fragmentName) === null) {
38839 // This transform does whole-program optimization, errors in
38840 // a single document could break invariants and/or cause
38841 // additional spurious errors.
38842 throw __webpack_require__(1).createNonRecoverableUserError("Found a circular reference from fragment '".concat(fragment.name, "'."), errorContext.map(function (node) {
38843 return node.loc;
38844 }));
38845 }
38846
38847 fragments.set(fragmentName, null); // to detect circular references
38848
38849 var transformedFragment = null;
38850 var selections = transformSelections(context, fragments, fragmentScope, fragment.selections, errorContext);
38851
38852 if (selections) {
38853 transformedFragment = (0, _objectSpread2["default"])({}, fragment, {
38854 selections: selections,
38855 name: fragmentName,
38856 argumentDefinitions: []
38857 });
38858 }
38859
38860 fragments.set(fragmentName, transformedFragment);
38861 return transformedFragment;
38862}
38863
38864function hashArguments(args, scope, errorContext) {
38865 if (!args.length) {
38866 return null;
38867 }
38868
38869 var sortedArgs = (0, _toConsumableArray2["default"])(args).sort(function (a, b) {
38870 return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
38871 });
38872 var printedArgs = JSON.stringify(sortedArgs.map(function (arg) {
38873 var value;
38874
38875 if (arg.value.kind === 'Variable') {
38876 value = scope[arg.value.variableName];
38877
38878 if (value == null) {
38879 // This transform does whole-program optimization, errors in
38880 // a single document could break invariants and/or cause
38881 // additional spurious errors.
38882 throw __webpack_require__(1).createNonRecoverableUserError("Variable '$".concat(arg.value.variableName, "' is not in scope."), [arg.value.loc]);
38883 }
38884 } else {
38885 value = arg.value;
38886 }
38887
38888 return {
38889 name: arg.name,
38890 value: __webpack_require__(206)(value)
38891 };
38892 }));
38893 return __webpack_require__(207)(printedArgs);
38894}
38895
38896module.exports = {
38897 transform: relayApplyFragmentArgumentTransform
38898};
38899
38900/***/ }),
38901/* 206 */
38902/***/ (function(module, exports, __webpack_require__) {
38903
38904"use strict";
38905/**
38906 * Copyright (c) Facebook, Inc. and its affiliates.
38907 *
38908 * This source code is licensed under the MIT license found in the
38909 * LICENSE file in the root directory of this source tree.
38910 *
38911 * strict
38912 * @format
38913 */
38914
38915
38916/**
38917 * Generates an identifier for an argument value. The identifier is based on the
38918 * structure/order of items and keys in the value.
38919 */
38920function getIdentifierForArgumentValue(value) {
38921 switch (value.kind) {
38922 case 'Variable':
38923 return {
38924 variable: value.variableName
38925 };
38926
38927 case 'Literal':
38928 return {
38929 value: value.value
38930 };
38931
38932 case 'ListValue':
38933 return {
38934 list: value.items.map(function (item) {
38935 return getIdentifierForArgumentValue(item);
38936 })
38937 };
38938
38939 case 'ObjectValue':
38940 return {
38941 object: value.fields.map(function (field) {
38942 return {
38943 name: field.name,
38944 value: getIdentifierForArgumentValue(field.value)
38945 };
38946 })
38947 };
38948
38949 default:
38950 true ? true ? __webpack_require__(4)(false, 'getIdentifierForArgumentValue(): Unsupported AST kind `%s`.', value.kind) : undefined : undefined;
38951 }
38952}
38953
38954module.exports = getIdentifierForArgumentValue;
38955
38956/***/ }),
38957/* 207 */
38958/***/ (function(module, exports, __webpack_require__) {
38959
38960"use strict";
38961/**
38962 * Copyright (c) Facebook, Inc. and its affiliates.
38963 *
38964 * This source code is licensed under the MIT license found in the
38965 * LICENSE file in the root directory of this source tree.
38966 *
38967 * Based on implementations by Gary Court and Austin Appleby, 2011, MIT.
38968 *
38969 * strict
38970 * @format
38971 */
38972
38973
38974var BASE62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
38975/**
38976 * @param {string} key A UTF-16 or ASCII string
38977 * @return {string} a base62 murmur hash
38978 */
38979
38980function murmurHash(str) {
38981 /* eslint-disable no-bitwise */
38982 var length = str.length;
38983 var rem = length & 3;
38984 var len = length ^ rem;
38985 var h = 0;
38986 var i = 0;
38987 var k;
38988
38989 while (i !== len) {
38990 var ch4 = str.charCodeAt(i + 3);
38991 k = str.charCodeAt(i) ^ str.charCodeAt(i + 1) << 8 ^ str.charCodeAt(i + 2) << 16 ^ (ch4 & 0xff) << 24 ^ (ch4 & 0xff00) >> 8;
38992 i += 4;
38993 k = k * 0x2d51 + (k & 0xffff) * 0xcc9e0000 >>> 0;
38994 k = k << 15 | k >>> 17;
38995 k = k * 0x3593 + (k & 0xffff) * 0x1b870000 >>> 0;
38996 h ^= k;
38997 h = h << 13 | h >>> 19;
38998 h = h * 5 + 0xe6546b64 >>> 0;
38999 }
39000
39001 k = 0;
39002
39003 switch (rem) {
39004 /* eslint-disable no-fallthrough */
39005 case 3:
39006 k ^= str.charCodeAt(len + 2) << 16;
39007
39008 case 2:
39009 k ^= str.charCodeAt(len + 1) << 8;
39010
39011 case 1:
39012 k ^= str.charCodeAt(len);
39013 k = k * 0x2d51 + (k & 0xffff) * 0xcc9e0000 >>> 0;
39014 k = k << 15 | k >>> 17;
39015 k = k * 0x3593 + (k & 0xffff) * 0x1b870000 >>> 0;
39016 h ^= k;
39017 }
39018
39019 h ^= length;
39020 h ^= h >>> 16;
39021 h = h * 0xca6b + (h & 0xffff) * 0x85eb0000 >>> 0;
39022 h ^= h >>> 13;
39023 h = h * 0xae35 + (h & 0xffff) * 0xc2b20000 >>> 0;
39024 h ^= h >>> 16;
39025 h >>>= 0;
39026
39027 if (!h) {
39028 return '0';
39029 }
39030
39031 var s = '';
39032
39033 while (h) {
39034 var d = h % 62;
39035 s = BASE62[d] + s;
39036 h = (h - d) / 62;
39037 }
39038
39039 return s;
39040}
39041
39042module.exports = murmurHash;
39043
39044/***/ }),
39045/* 208 */
39046/***/ (function(module, exports, __webpack_require__) {
39047
39048"use strict";
39049/**
39050 * Copyright (c) Facebook, Inc. and its affiliates.
39051 *
39052 * This source code is licensed under the MIT license found in the
39053 * LICENSE file in the root directory of this source tree.
39054 *
39055 * strict-local
39056 * @format
39057 */
39058
39059
39060/**
39061 * A transform that removes any selections that are not valid relative to the
39062 * server schema. The primary use case is for fields added via client
39063 * `extend type ...` definitions and for inline fragments / fragment spreads
39064 * whose types are added with client `type ...` type extensions.
39065 *
39066 * Given a base schema:
39067 *
39068 * ```
39069 * # Note: full schema definition elided for clarity
39070 * interface Viewer {
39071 * name: String
39072 * }
39073 * type User implements Viewer {
39074 * name: String
39075 * }
39076 * ```
39077 *
39078 * And a fragment:
39079 *
39080 * ```
39081 * fragment on Viewer {
39082 * name
39083 * ... on User {
39084 * clientField # (1)
39085 * }
39086 * ... on ClientType { # (2)
39087 * clientField
39088 * }
39089 * }
39090 * extend type User {
39091 * clientField: String
39092 * }
39093 * type ClientType implements Viewer {
39094 * name: String
39095 * clientField: String
39096 * }
39097 * ```
39098 *
39099 * This transform will output:
39100 *
39101 * ```
39102 * fragment on Viewer {
39103 * name
39104 * }
39105 * ```
39106 *
39107 * Note that (1) is removed because this field does not exist on the base `User`
39108 * type, and (2) is removed because the `ClientType` type does not exist in the
39109 * base schema.
39110 */
39111function skipClientFieldTransform(context) {
39112 return __webpack_require__(10).transform(context, {
39113 FragmentSpread: visitFragmentSpread,
39114 InlineFragment: visitInlineFragment,
39115 LinkedField: visitField,
39116 MatchField: visitField,
39117 ScalarField: visitField
39118 }, function (node) {
39119 return buildState(context, node);
39120 });
39121}
39122/**
39123 * @internal
39124 *
39125 * Build the initial state, returning null for fragments whose type is not
39126 * defined in the server schema.
39127 */
39128
39129
39130function buildState(context, node) {
39131 var schema = context.serverSchema;
39132
39133 switch (node.kind) {
39134 case 'Fragment':
39135 return schema.getType(node.type.name);
39136
39137 case 'Root':
39138 switch (node.operation) {
39139 case 'query':
39140 return schema.getQueryType();
39141
39142 case 'mutation':
39143 return schema.getMutationType();
39144
39145 case 'subscription':
39146 return schema.getSubscriptionType();
39147
39148 default:
39149 node.operation;
39150 }
39151
39152 break;
39153
39154 case 'SplitOperation':
39155 return schema.getType(node.type.name);
39156
39157 default:
39158 node;
39159 }
39160
39161 return null;
39162}
39163/**
39164 * @internal
39165 *
39166 * Skip fields that were added via `extend type ...`.
39167 */
39168
39169
39170function visitField(field, parentType) {
39171 if ( // Field is defined in the original parent type definition:
39172 __webpack_require__(3).canHaveSelections(parentType) && __webpack_require__(3).assertTypeWithFields(parentType).getFields()[field.name] || // Allow metadata fields and fields defined on classic "fat" interfaces
39173 field.name === __webpack_require__(0).SchemaMetaFieldDef.name || field.name === __webpack_require__(0).TypeMetaFieldDef.name || field.name === __webpack_require__(0).TypeNameMetaFieldDef.name || field.directives.some(function (_ref) {
39174 var name = _ref.name;
39175 return name === 'fixme_fat_interface';
39176 })) {
39177 var rawType = __webpack_require__(3).getRawType(field.type);
39178
39179 var type = this.getContext().serverSchema.getType(rawType.name);
39180 !type ? true ? __webpack_require__(4)(false, 'SkipClientFieldTransform: Expected type `%s` to be defined in ' + 'the server schema.', rawType.name) : undefined : void 0;
39181 return this.traverse(field, type);
39182 }
39183
39184 return null;
39185}
39186/**
39187 * @internal
39188 *
39189 * Skip fragment spreads where the referenced fragment is not defined in the
39190 * original schema.
39191 */
39192
39193
39194function visitFragmentSpread(spread, parentType) {
39195 var context = this.getContext();
39196 var fragment = context.getFragment(spread.name);
39197
39198 if (context.serverSchema.getType(fragment.type.name)) {
39199 return this.traverse(spread, parentType);
39200 }
39201
39202 return null;
39203}
39204/**
39205 * @internal
39206 *
39207 * Skip inline fragments where the type is not in the schema.
39208 */
39209
39210
39211function visitInlineFragment(fragment, parentType) {
39212 var schema = this.getContext().serverSchema;
39213 var type = schema.getType(fragment.typeCondition.name);
39214
39215 if (type) {
39216 return this.traverse(fragment, type);
39217 }
39218
39219 return null;
39220}
39221
39222module.exports = {
39223 transform: skipClientFieldTransform
39224};
39225
39226/***/ }),
39227/* 209 */
39228/***/ (function(module, exports, __webpack_require__) {
39229
39230"use strict";
39231/**
39232 * Copyright (c) Facebook, Inc. and its affiliates.
39233 *
39234 * This source code is licensed under the MIT license found in the
39235 * LICENSE file in the root directory of this source tree.
39236 *
39237 * strict-local
39238 * @format
39239 */
39240
39241
39242var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
39243
39244var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
39245
39246var FAIL = 'fail';
39247var PASS = 'pass';
39248var VARIABLE = 'variable';
39249/**
39250 * A tranform that removes unreachable IR nodes from all documents in a corpus.
39251 * The following nodes are removed:
39252 * - Any node with `@include(if: false)`
39253 * - Any node with `@skip(if: true)`
39254 * - Any node with empty `selections`
39255 */
39256
39257function skipUnreachableNodeTransform(context) {
39258 var fragments = new Map();
39259
39260 var nextContext = __webpack_require__(10).transform(context, {
39261 Root: function Root(node) {
39262 return transformNode(context, fragments, node);
39263 },
39264 // Fragments are included below where referenced.
39265 // Unreferenced fragments are not included.
39266 Fragment: function Fragment(id) {
39267 return null;
39268 }
39269 });
39270
39271 return Array.from(fragments.values()).reduce(function (ctx, fragment) {
39272 return fragment ? ctx.add(fragment) : ctx;
39273 }, nextContext);
39274}
39275
39276function transformNode(context, fragments, node) {
39277 var queue = (0, _toConsumableArray2["default"])(node.selections);
39278 var selections;
39279
39280 while (queue.length) {
39281 var selection = queue.shift();
39282 var nextSelection = void 0;
39283
39284 switch (selection.kind) {
39285 case 'Condition':
39286 var match = testCondition(selection);
39287
39288 if (match === PASS) {
39289 queue.unshift.apply(queue, (0, _toConsumableArray2["default"])(selection.selections));
39290 } else if (match === VARIABLE) {
39291 nextSelection = transformNode(context, fragments, selection);
39292 }
39293
39294 break;
39295
39296 case 'FragmentSpread':
39297 {
39298 // Skip fragment spreads if the referenced fragment is empty
39299 if (!fragments.has(selection.name)) {
39300 var fragment = context.getFragment(selection.name);
39301 var nextFragment = transformNode(context, fragments, fragment);
39302 fragments.set(selection.name, nextFragment);
39303 }
39304
39305 if (fragments.get(selection.name)) {
39306 nextSelection = selection;
39307 }
39308
39309 break;
39310 }
39311
39312 case 'MatchBranch':
39313 nextSelection = transformNode(context, fragments, selection);
39314 break;
39315
39316 case 'LinkedField':
39317 nextSelection = transformNode(context, fragments, selection);
39318 break;
39319
39320 case 'InlineFragment':
39321 // TODO combine with the LinkedField case when flow supports this
39322 nextSelection = transformNode(context, fragments, selection);
39323 break;
39324
39325 case 'Defer':
39326 nextSelection = transformNode(context, fragments, selection);
39327 break;
39328
39329 case 'Stream':
39330 nextSelection = transformNode(context, fragments, selection);
39331 break;
39332
39333 case 'ScalarField':
39334 nextSelection = selection;
39335 break;
39336
39337 case 'MatchField':
39338 nextSelection = transformNode(context, fragments, selection);
39339 break;
39340
39341 default:
39342 selection.kind;
39343 true ? true ? __webpack_require__(4)(false, 'SkipUnreachableNodeTransform: Unexpected selection kind `%s`.', selection.kind) : undefined : undefined;
39344 }
39345
39346 if (nextSelection) {
39347 selections = selections || [];
39348 selections.push(nextSelection);
39349 }
39350 }
39351
39352 if (selections) {
39353 return (0, _objectSpread2["default"])({}, node, {
39354 selections: selections
39355 });
39356 }
39357
39358 return null;
39359}
39360/**
39361 * Determines whether a condition statically passes/fails or is unknown
39362 * (variable).
39363 */
39364
39365
39366function testCondition(condition) {
39367 if (condition.condition.kind === 'Variable') {
39368 return VARIABLE;
39369 }
39370
39371 return condition.condition.value === condition.passingValue ? PASS : FAIL;
39372}
39373
39374module.exports = {
39375 transform: skipUnreachableNodeTransform
39376};
39377
39378/***/ }),
39379/* 210 */
39380/***/ (function(module, exports, __webpack_require__) {
39381
39382"use strict";
39383/**
39384 * Copyright (c) Facebook, Inc. and its affiliates.
39385 *
39386 * This source code is licensed under the MIT license found in the
39387 * LICENSE file in the root directory of this source tree.
39388 *
39389 * strict-local
39390 * @format
39391 */
39392
39393
39394var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
39395
39396var _toConsumableArray2 = __webpack_require__(5)(__webpack_require__(11));
39397
39398var ID = 'id';
39399var ID_TYPE = 'ID';
39400var NODE_TYPE = 'Node';
39401
39402/**
39403 * A transform that adds an `id` field on any type that has an id field but
39404 * where there is no unaliased `id` selection.
39405 */
39406function relayGenerateIDFieldTransform(context) {
39407 var idType = __webpack_require__(0).assertLeafType(context.serverSchema.getType(ID_TYPE));
39408
39409 var idField = {
39410 kind: 'ScalarField',
39411 alias: null,
39412 args: [],
39413 directives: [],
39414 handles: null,
39415 loc: {
39416 kind: 'Generated'
39417 },
39418 metadata: null,
39419 name: ID,
39420 type: idType
39421 };
39422 var state = {
39423 idField: idField
39424 };
39425 return __webpack_require__(10).transform(context, {
39426 LinkedField: visitLinkedOrMatchField,
39427 MatchField: visitLinkedOrMatchField
39428 }, function () {
39429 return state;
39430 });
39431}
39432
39433function visitLinkedOrMatchField(field, state) {
39434 var transformedNode = this.traverse(field, state); // If the field already has an unaliased `id` field, do nothing
39435
39436 if (__webpack_require__(91).hasUnaliasedSelection(field, ID)) {
39437 return transformedNode;
39438 }
39439
39440 var context = this.getContext();
39441 var schema = context.serverSchema;
39442
39443 var unmodifiedType = __webpack_require__(0).assertCompositeType(__webpack_require__(3).getRawType(field.type)); // If the field type has an `id` subfield add an `id` selection
39444
39445
39446 if (__webpack_require__(3).canHaveSelections(unmodifiedType) && __webpack_require__(3).hasID(schema, unmodifiedType)) {
39447 return (0, _objectSpread2["default"])({}, transformedNode, {
39448 selections: (0, _toConsumableArray2["default"])(transformedNode.selections).concat([state.idField])
39449 });
39450 } // If the field type is abstract, then generate a `... on Node { id }`
39451 // fragment if *any* concrete type implements Node. Then generate a
39452 // `... on PossibleType { id }` for every concrete type that does *not*
39453 // implement `Node`
39454
39455
39456 if (__webpack_require__(3).isAbstractType(unmodifiedType)) {
39457 var selections = (0, _toConsumableArray2["default"])(transformedNode.selections);
39458
39459 if (__webpack_require__(3).mayImplement(schema, unmodifiedType, NODE_TYPE)) {
39460 var nodeType = __webpack_require__(0).assertCompositeType(schema.getType(NODE_TYPE));
39461
39462 selections.push(buildIDFragment(nodeType, state.idField));
39463 }
39464
39465 var abstractType = __webpack_require__(0).assertAbstractType(unmodifiedType);
39466
39467 schema.getPossibleTypes(abstractType).forEach(function (possibleType) {
39468 if (!__webpack_require__(3).implementsInterface(possibleType, NODE_TYPE) && __webpack_require__(3).hasID(schema, possibleType)) {
39469 selections.push(buildIDFragment(possibleType, state.idField));
39470 }
39471 });
39472 return (0, _objectSpread2["default"])({}, transformedNode, {
39473 selections: selections
39474 });
39475 }
39476
39477 return transformedNode;
39478}
39479/**
39480 * @internal
39481 *
39482 * Returns IR for `... on FRAGMENT_TYPE { id }`
39483 */
39484
39485
39486function buildIDFragment(fragmentType, idField) {
39487 return {
39488 kind: 'InlineFragment',
39489 directives: [],
39490 loc: {
39491 kind: 'Generated'
39492 },
39493 metadata: null,
39494 typeCondition: fragmentType,
39495 selections: [idField]
39496 };
39497}
39498
39499module.exports = {
39500 transform: relayGenerateIDFieldTransform
39501};
39502
39503/***/ }),
39504/* 211 */
39505/***/ (function(module, exports, __webpack_require__) {
39506
39507"use strict";
39508/**
39509 * Copyright (c) Facebook, Inc. and its affiliates.
39510 *
39511 * This source code is licensed under the MIT license found in the
39512 * LICENSE file in the root directory of this source tree.
39513 *
39514 * strict-local
39515 * @format
39516 */
39517
39518
39519/**
39520 * This transform finds MatchBranch nodes and adds a SplitOperation root
39521 * node to the context for each of them.
39522 */
39523function relaySplitMatchTransform(context) {
39524 var splitOperations = new Map();
39525
39526 var transformedContext = __webpack_require__(10).transform(context, {
39527 MatchBranch: visitMatchBranch
39528 }, function () {
39529 return splitOperations;
39530 });
39531
39532 return transformedContext.addAll(Array.from(splitOperations.values()));
39533}
39534
39535function visitMatchBranch(node, state) {
39536 var transformedNode = this.traverse(node, state);
39537 var splitOperation = {
39538 kind: 'SplitOperation',
39539 name: __webpack_require__(74)(transformedNode.name),
39540 selections: transformedNode.selections,
39541 loc: {
39542 kind: 'Derived',
39543 source: node.loc
39544 },
39545 metadata: {
39546 derivedFrom: transformedNode.name
39547 },
39548 type: transformedNode.type
39549 };
39550 state.set(node.name, splitOperation);
39551 return transformedNode;
39552}
39553
39554module.exports = {
39555 transform: relaySplitMatchTransform
39556};
39557
39558/***/ }),
39559/* 212 */
39560/***/ (function(module, exports, __webpack_require__) {
39561
39562"use strict";
39563/**
39564 * Copyright (c) Facebook, Inc. and its affiliates.
39565 *
39566 * This source code is licensed under the MIT license found in the
39567 * LICENSE file in the root directory of this source tree.
39568 *
39569 * strict-local
39570 * @format
39571 */
39572
39573
39574var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
39575
39576/**
39577 * This transform finds usages of @defer and @stream, validates them, and
39578 * converts the using node to specialized IR nodes (Defer/Stream).
39579 */
39580function relayDeferStreamTransform(context) {
39581 return __webpack_require__(10).transform(context, {
39582 // TODO: type IRTransformer to allow changing result type
39583 FragmentSpread: visitFragmentSpread,
39584 // TODO: type IRTransformer to allow changing result type
39585 InlineFragment: visitInlineFragment,
39586 // TODO: type IRTransformer to allow changing result type
39587 LinkedField: visitLinkedField,
39588 ScalarField: visitScalarField
39589 }, function (sourceNode) {
39590 return {
39591 documentName: sourceNode.name
39592 };
39593 });
39594}
39595
39596function visitLinkedField(field, state) {
39597 var _ref, _ref2;
39598
39599 var transformedField = this.traverse(field, state);
39600 var streamDirective = transformedField.directives.find(function (directive) {
39601 return directive.name === 'stream';
39602 });
39603
39604 if (streamDirective == null) {
39605 return transformedField;
39606 }
39607
39608 var type = __webpack_require__(3).getNullableType(field.type);
39609
39610 if (!(type instanceof __webpack_require__(0).GraphQLList)) {
39611 throw __webpack_require__(1).createUserError("Invalid use of @stream on non-plural field '".concat(field.name, "'"), [streamDirective.loc]);
39612 }
39613
39614 transformedField = (0, _objectSpread2["default"])({}, transformedField, {
39615 directives: transformedField.directives.filter(function (directive) {
39616 return directive.name !== 'stream';
39617 })
39618 });
39619 var ifArg = streamDirective.args.find(function (arg) {
39620 return arg.name === 'if';
39621 });
39622
39623 if (isLiteralFalse(ifArg)) {
39624 // If a stream is statically known to be disabled, treat as if the node
39625 // was not streamed.
39626 return transformedField;
39627 }
39628
39629 var initialCount = streamDirective.args.find(function (arg) {
39630 return arg.name === 'initial_count';
39631 });
39632 var label = getLiteralStringArgument(streamDirective, 'label');
39633 var transformedLabel = transformLabel(state.documentName, 'stream', label);
39634 return {
39635 "if": (_ref = ifArg === null || ifArg === void 0 ? void 0 : ifArg.value) !== null && _ref !== void 0 ? _ref : null,
39636 initialCount: (_ref2 = initialCount === null || initialCount === void 0 ? void 0 : initialCount.value) !== null && _ref2 !== void 0 ? _ref2 : null,
39637 kind: 'Stream',
39638 label: transformedLabel,
39639 loc: {
39640 kind: 'Derived',
39641 source: streamDirective.loc
39642 },
39643 metadata: null,
39644 selections: [transformedField]
39645 };
39646}
39647
39648function visitScalarField(field, state) {
39649 var streamDirective = field.directives.find(function (directive) {
39650 return directive.name === 'stream';
39651 });
39652
39653 if (streamDirective != null) {
39654 throw __webpack_require__(1).createUserError("Invalid use of @stream on scalar field '".concat(field.name, "'"), [streamDirective.loc]);
39655 }
39656
39657 return this.traverse(field, state);
39658}
39659
39660function visitInlineFragment(fragment, state) {
39661 var _ref3;
39662
39663 var transformedFragment = this.traverse(fragment, state);
39664 var deferDirective = transformedFragment.directives.find(function (directive) {
39665 return directive.name === 'defer';
39666 });
39667
39668 if (deferDirective == null) {
39669 return transformedFragment;
39670 }
39671
39672 transformedFragment = (0, _objectSpread2["default"])({}, transformedFragment, {
39673 directives: transformedFragment.directives.filter(function (directive) {
39674 return directive.name !== 'defer';
39675 })
39676 });
39677 var ifArg = deferDirective.args.find(function (arg) {
39678 return arg.name === 'if';
39679 });
39680
39681 if (isLiteralFalse(ifArg)) {
39682 // If a defer is statically known to be disabled, treat as if the node
39683 // was not deferred.
39684 return transformedFragment;
39685 }
39686
39687 var label = getLiteralStringArgument(deferDirective, 'label');
39688 var transformedLabel = transformLabel(state.documentName, 'defer', label);
39689 return {
39690 "if": (_ref3 = ifArg === null || ifArg === void 0 ? void 0 : ifArg.value) !== null && _ref3 !== void 0 ? _ref3 : null,
39691 kind: 'Defer',
39692 label: transformedLabel,
39693 loc: {
39694 kind: 'Derived',
39695 source: deferDirective.loc
39696 },
39697 metadata: null,
39698 selections: [transformedFragment]
39699 };
39700}
39701
39702function visitFragmentSpread(spread, state) {
39703 var _ref4;
39704
39705 var transformedSpread = this.traverse(spread, state);
39706 var deferDirective = transformedSpread.directives.find(function (directive) {
39707 return directive.name === 'defer';
39708 });
39709
39710 if (deferDirective == null) {
39711 return transformedSpread;
39712 }
39713
39714 transformedSpread = (0, _objectSpread2["default"])({}, transformedSpread, {
39715 directives: transformedSpread.directives.filter(function (directive) {
39716 return directive.name !== 'defer';
39717 })
39718 });
39719 var ifArg = deferDirective.args.find(function (arg) {
39720 return arg.name === 'if';
39721 });
39722
39723 if (isLiteralFalse(ifArg)) {
39724 // If a defer is statically known to be disabled, treat as if the node
39725 // was not deferred.
39726 return transformedSpread;
39727 }
39728
39729 var label = getLiteralStringArgument(deferDirective, 'label');
39730 var transformedLabel = transformLabel(state.documentName, 'defer', label);
39731 return {
39732 "if": (_ref4 = ifArg === null || ifArg === void 0 ? void 0 : ifArg.value) !== null && _ref4 !== void 0 ? _ref4 : null,
39733 kind: 'Defer',
39734 label: transformedLabel,
39735 loc: {
39736 kind: 'Derived',
39737 source: deferDirective.loc
39738 },
39739 metadata: null,
39740 selections: [transformedSpread]
39741 };
39742}
39743
39744function getLiteralStringArgument(directive, argName) {
39745 // NOTE: can't use getLiteralArgumentValues here because other args
39746 // are allowed to be non-literals
39747 var arg = directive.args.find(function (_ref6) {
39748 var name = _ref6.name;
39749 return name === argName;
39750 });
39751 var value = arg != null && arg.value.kind === 'Literal' ? arg.value.value : null;
39752
39753 if (typeof value !== 'string') {
39754 var _ref5;
39755
39756 throw __webpack_require__(1).createUserError("Expected the '".concat(argName, "' value to @").concat(directive.name, " to be a string literal."), [(_ref5 = arg === null || arg === void 0 ? void 0 : arg.value.loc) !== null && _ref5 !== void 0 ? _ref5 : directive.loc]);
39757 }
39758
39759 return value;
39760}
39761
39762function transformLabel(parentName, directive, label) {
39763 return "".concat(parentName, "$").concat(directive, "$").concat(label);
39764}
39765
39766function isLiteralFalse(arg) {
39767 return arg != null && arg.value.kind === 'Literal' && arg.value.value === false;
39768}
39769
39770module.exports = {
39771 transform: relayDeferStreamTransform
39772};
39773
39774/***/ }),
39775/* 213 */
39776/***/ (function(module, exports, __webpack_require__) {
39777
39778"use strict";
39779/**
39780 * Copyright (c) Facebook, Inc. and its affiliates.
39781 *
39782 * This source code is licensed under the MIT license found in the
39783 * LICENSE file in the root directory of this source tree.
39784 *
39785 * strict-local
39786 * @format
39787 */
39788
39789
39790/**
39791 * A transform that inlines all fragments and removes them.
39792 */
39793function inlineFragmentsTransform(context) {
39794 return __webpack_require__(10).transform(context, {
39795 Fragment: visitFragment,
39796 FragmentSpread: visitFragmentSpread
39797 });
39798}
39799
39800function visitFragment(fragment) {
39801 return null;
39802}
39803
39804function visitFragmentSpread(fragmentSpread) {
39805 !(fragmentSpread.args.length === 0) ? true ? __webpack_require__(4)(false, 'InlineFragmentsTransform: Cannot flatten fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : undefined : void 0;
39806 var fragment = this.getContext().getFragment(fragmentSpread.name);
39807 var result = {
39808 kind: 'InlineFragment',
39809 directives: fragmentSpread.directives,
39810 loc: {
39811 kind: 'Derived',
39812 source: fragmentSpread.loc
39813 },
39814 metadata: fragmentSpread.metadata,
39815 selections: fragment.selections,
39816 typeCondition: fragment.type
39817 };
39818 return this.traverse(result);
39819}
39820
39821module.exports = {
39822 transform: inlineFragmentsTransform
39823};
39824
39825/***/ }),
39826/* 214 */
39827/***/ (function(module, exports, __webpack_require__) {
39828
39829"use strict";
39830/**
39831 * Copyright (c) Facebook, Inc. and its affiliates.
39832 *
39833 * This source code is licensed under the MIT license found in the
39834 * LICENSE file in the root directory of this source tree.
39835 *
39836 * strict-local
39837 * @format
39838 */
39839
39840
39841var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
39842
39843/**
39844 * A transform that removes field `handles`. Intended for use when e.g.
39845 * printing queries to send to a GraphQL server.
39846 */
39847function relaySkipHandleFieldTransform(context) {
39848 return __webpack_require__(10).transform(context, {
39849 LinkedField: visitField,
39850 MatchField: visitField,
39851 ScalarField: visitField
39852 });
39853}
39854
39855function visitField(field) {
39856 var transformedNode = this.traverse(field);
39857
39858 if (transformedNode.handles) {
39859 return (0, _objectSpread2["default"])({}, transformedNode, {
39860 handles: null
39861 });
39862 }
39863
39864 return transformedNode;
39865}
39866
39867module.exports = {
39868 transform: relaySkipHandleFieldTransform
39869};
39870
39871/***/ }),
39872/* 215 */
39873/***/ (function(module, exports, __webpack_require__) {
39874
39875"use strict";
39876/**
39877 * Copyright (c) Facebook, Inc. and its affiliates.
39878 *
39879 * This source code is licensed under the MIT license found in the
39880 * LICENSE file in the root directory of this source tree.
39881 *
39882 * strict-local
39883 * @format
39884 */
39885
39886
39887var _objectSpread2 = __webpack_require__(5)(__webpack_require__(9));
39888
39889/**
39890 * Refines the argument definitions for operations to remove unused arguments
39891 * due to statically pruned conditional branches (e.g. because of overriding
39892 * a variable used in `@include()` to be false) and checks that all variables
39893 * referenced in each operation are defined. Reports aggregated errors for all
39894 * operations.
39895 */
39896function stripUnusedVariablesTransform(context) {
39897 var contextWithUsedArguments = __webpack_require__(88)(context);
39898
39899 var nextContext = context;
39900
39901 var errors = __webpack_require__(1).eachWithErrors(context.documents(), function (node) {
39902 if (node.kind !== 'Root') {
39903 return;
39904 }
39905
39906 var nodeWithUsedArguments = contextWithUsedArguments.getRoot(node.name);
39907 var definedArguments = argumentDefinitionsToMap(node.argumentDefinitions);
39908 var usedArguments = argumentDefinitionsToMap(nodeWithUsedArguments.argumentDefinitions); // All used arguments must be defined
39909
39910 var undefinedVariables = [];
39911 var _iteratorNormalCompletion = true;
39912 var _didIteratorError = false;
39913 var _iteratorError = undefined;
39914
39915 try {
39916 for (var _iterator = usedArguments.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
39917 var argDef = _step.value;
39918
39919 if (!definedArguments.has(argDef.name)) {
39920 undefinedVariables.push(argDef);
39921 }
39922 }
39923 } catch (err) {
39924 _didIteratorError = true;
39925 _iteratorError = err;
39926 } finally {
39927 try {
39928 if (!_iteratorNormalCompletion && _iterator["return"] != null) {
39929 _iterator["return"]();
39930 }
39931 } finally {
39932 if (_didIteratorError) {
39933 throw _iteratorError;
39934 }
39935 }
39936 }
39937
39938 if (undefinedVariables.length !== 0) {
39939 throw __webpack_require__(1).createUserError("Operation '".concat(node.name, "' references undefined variable(s):\n").concat(undefinedVariables.map(function (argDef) {
39940 return "- $".concat(argDef.name, ": ").concat(String(argDef.type));
39941 }).join('\n'), "."), undefinedVariables.map(function (argDef) {
39942 return argDef.loc;
39943 }));
39944 } // Remove unused argument definitions
39945
39946
39947 nextContext = nextContext.replace((0, _objectSpread2["default"])({}, node, {
39948 argumentDefinitions: node.argumentDefinitions.filter(function (argDef) {
39949 return usedArguments.has(argDef.name);
39950 })
39951 }));
39952 });
39953
39954 if (errors != null && errors.length !== 0) {
39955 throw __webpack_require__(1).createCombinedError(errors);
39956 }
39957
39958 return nextContext;
39959}
39960
39961function argumentDefinitionsToMap(argDefs) {
39962 var map = new Map();
39963 var _iteratorNormalCompletion2 = true;
39964 var _didIteratorError2 = false;
39965 var _iteratorError2 = undefined;
39966
39967 try {
39968 for (var _iterator2 = argDefs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
39969 var argDef = _step2.value;
39970 map.set(argDef.name, argDef);
39971 }
39972 } catch (err) {
39973 _didIteratorError2 = true;
39974 _iteratorError2 = err;
39975 } finally {
39976 try {
39977 if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
39978 _iterator2["return"]();
39979 }
39980 } finally {
39981 if (_didIteratorError2) {
39982 throw _iteratorError2;
39983 }
39984 }
39985 }
39986
39987 return map;
39988}
39989
39990module.exports = {
39991 transform: stripUnusedVariablesTransform
39992};
39993
39994/***/ })
39995/******/ ]);
\No newline at end of file