@neutron.co.id/operasional-interfaces 1.1.0 → 1.1.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ComponentUtil } from "@neon.id/utils/client";
2
- import { defineComponent, openBlock, createElementBlock, createVNode, unref, createBlock, withCtx, createElementVNode, mergeProps, createCommentVNode, isRef } from "vue";
2
+ import { defineComponent, openBlock, createElementBlock, createVNode, unref, createBlock, withCtx, createElementVNode, mergeProps, createCommentVNode, isRef, onBeforeUnmount, onMounted, getCurrentInstance, inject, reactive, ref, watchEffect } from "vue";
3
3
  import { NeonButton } from "@neon.id/interfaces";
4
4
  import { models } from "@neutron.co.id/personalia-models";
5
5
  import { useCollection, NeonCollection, useSingle, NeonSingle } from "@neon.id/context";
@@ -199,9 +199,3543 @@ const _export_sfc = (sfc, props) => {
199
199
  };
200
200
  const StaffSingle = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-dbeb1998"]]);
201
201
  const TaskModel = models.TaskModel;
202
- const __default__$1 = defineComponent({ name: "TaskCollection" });
202
+ function devAssert(condition, message) {
203
+ const booleanCondition = Boolean(condition);
204
+ if (!booleanCondition) {
205
+ throw new Error(message);
206
+ }
207
+ }
208
+ function isObjectLike(value) {
209
+ return typeof value == "object" && value !== null;
210
+ }
211
+ function invariant(condition, message) {
212
+ const booleanCondition = Boolean(condition);
213
+ if (!booleanCondition) {
214
+ throw new Error(
215
+ message != null ? message : "Unexpected invariant triggered."
216
+ );
217
+ }
218
+ }
219
+ const LineRegExp = /\r\n|[\n\r]/g;
220
+ function getLocation(source, position) {
221
+ let lastLineStart = 0;
222
+ let line = 1;
223
+ for (const match of source.body.matchAll(LineRegExp)) {
224
+ typeof match.index === "number" || invariant(false);
225
+ if (match.index >= position) {
226
+ break;
227
+ }
228
+ lastLineStart = match.index + match[0].length;
229
+ line += 1;
230
+ }
231
+ return {
232
+ line,
233
+ column: position + 1 - lastLineStart
234
+ };
235
+ }
236
+ function printLocation(location) {
237
+ return printSourceLocation(
238
+ location.source,
239
+ getLocation(location.source, location.start)
240
+ );
241
+ }
242
+ function printSourceLocation(source, sourceLocation) {
243
+ const firstLineColumnOffset = source.locationOffset.column - 1;
244
+ const body = "".padStart(firstLineColumnOffset) + source.body;
245
+ const lineIndex = sourceLocation.line - 1;
246
+ const lineOffset = source.locationOffset.line - 1;
247
+ const lineNum = sourceLocation.line + lineOffset;
248
+ const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;
249
+ const columnNum = sourceLocation.column + columnOffset;
250
+ const locationStr = `${source.name}:${lineNum}:${columnNum}
251
+ `;
252
+ const lines = body.split(/\r\n|[\n\r]/g);
253
+ const locationLine = lines[lineIndex];
254
+ if (locationLine.length > 120) {
255
+ const subLineIndex = Math.floor(columnNum / 80);
256
+ const subLineColumnNum = columnNum % 80;
257
+ const subLines = [];
258
+ for (let i2 = 0; i2 < locationLine.length; i2 += 80) {
259
+ subLines.push(locationLine.slice(i2, i2 + 80));
260
+ }
261
+ return locationStr + printPrefixedLines([
262
+ [`${lineNum} |`, subLines[0]],
263
+ ...subLines.slice(1, subLineIndex + 1).map((subLine) => ["|", subLine]),
264
+ ["|", "^".padStart(subLineColumnNum)],
265
+ ["|", subLines[subLineIndex + 1]]
266
+ ]);
267
+ }
268
+ return locationStr + printPrefixedLines([
269
+ // Lines specified like this: ["prefix", "string"],
270
+ [`${lineNum - 1} |`, lines[lineIndex - 1]],
271
+ [`${lineNum} |`, locationLine],
272
+ ["|", "^".padStart(columnNum)],
273
+ [`${lineNum + 1} |`, lines[lineIndex + 1]]
274
+ ]);
275
+ }
276
+ function printPrefixedLines(lines) {
277
+ const existingLines = lines.filter(([_, line]) => line !== void 0);
278
+ const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));
279
+ return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join("\n");
280
+ }
281
+ function toNormalizedOptions(args) {
282
+ const firstArg = args[0];
283
+ if (firstArg == null || "kind" in firstArg || "length" in firstArg) {
284
+ return {
285
+ nodes: firstArg,
286
+ source: args[1],
287
+ positions: args[2],
288
+ path: args[3],
289
+ originalError: args[4],
290
+ extensions: args[5]
291
+ };
292
+ }
293
+ return firstArg;
294
+ }
295
+ class GraphQLError extends Error {
296
+ /**
297
+ * An array of `{ line, column }` locations within the source GraphQL document
298
+ * which correspond to this error.
299
+ *
300
+ * Errors during validation often contain multiple locations, for example to
301
+ * point out two things with the same name. Errors during execution include a
302
+ * single location, the field which produced the error.
303
+ *
304
+ * Enumerable, and appears in the result of JSON.stringify().
305
+ */
306
+ /**
307
+ * An array describing the JSON-path into the execution response which
308
+ * corresponds to this error. Only included for errors during execution.
309
+ *
310
+ * Enumerable, and appears in the result of JSON.stringify().
311
+ */
312
+ /**
313
+ * An array of GraphQL AST Nodes corresponding to this error.
314
+ */
315
+ /**
316
+ * The source GraphQL document for the first location of this error.
317
+ *
318
+ * Note that if this Error represents more than one node, the source may not
319
+ * represent nodes after the first node.
320
+ */
321
+ /**
322
+ * An array of character offsets within the source GraphQL document
323
+ * which correspond to this error.
324
+ */
325
+ /**
326
+ * The original error thrown from a field resolver during execution.
327
+ */
328
+ /**
329
+ * Extension fields to add to the formatted error.
330
+ */
331
+ /**
332
+ * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
333
+ */
334
+ constructor(message, ...rawArgs) {
335
+ var _this$nodes, _nodeLocations$, _ref;
336
+ const { nodes, source, positions, path, originalError, extensions } = toNormalizedOptions(rawArgs);
337
+ super(message);
338
+ this.name = "GraphQLError";
339
+ this.path = path !== null && path !== void 0 ? path : void 0;
340
+ this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0;
341
+ this.nodes = undefinedIfEmpty(
342
+ Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0
343
+ );
344
+ const nodeLocations = undefinedIfEmpty(
345
+ (_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map((node) => node.loc).filter((loc) => loc != null)
346
+ );
347
+ this.source = source !== null && source !== void 0 ? source : nodeLocations === null || nodeLocations === void 0 ? void 0 : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === void 0 ? void 0 : _nodeLocations$.source;
348
+ this.positions = positions !== null && positions !== void 0 ? positions : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => loc.start);
349
+ this.locations = positions && source ? positions.map((pos) => getLocation(source, pos)) : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => getLocation(loc.source, loc.start));
350
+ const originalExtensions = isObjectLike(
351
+ originalError === null || originalError === void 0 ? void 0 : originalError.extensions
352
+ ) ? originalError === null || originalError === void 0 ? void 0 : originalError.extensions : void 0;
353
+ this.extensions = (_ref = extensions !== null && extensions !== void 0 ? extensions : originalExtensions) !== null && _ref !== void 0 ? _ref : /* @__PURE__ */ Object.create(null);
354
+ Object.defineProperties(this, {
355
+ message: {
356
+ writable: true,
357
+ enumerable: true
358
+ },
359
+ name: {
360
+ enumerable: false
361
+ },
362
+ nodes: {
363
+ enumerable: false
364
+ },
365
+ source: {
366
+ enumerable: false
367
+ },
368
+ positions: {
369
+ enumerable: false
370
+ },
371
+ originalError: {
372
+ enumerable: false
373
+ }
374
+ });
375
+ if (originalError !== null && originalError !== void 0 && originalError.stack) {
376
+ Object.defineProperty(this, "stack", {
377
+ value: originalError.stack,
378
+ writable: true,
379
+ configurable: true
380
+ });
381
+ } else if (Error.captureStackTrace) {
382
+ Error.captureStackTrace(this, GraphQLError);
383
+ } else {
384
+ Object.defineProperty(this, "stack", {
385
+ value: Error().stack,
386
+ writable: true,
387
+ configurable: true
388
+ });
389
+ }
390
+ }
391
+ get [Symbol.toStringTag]() {
392
+ return "GraphQLError";
393
+ }
394
+ toString() {
395
+ let output = this.message;
396
+ if (this.nodes) {
397
+ for (const node of this.nodes) {
398
+ if (node.loc) {
399
+ output += "\n\n" + printLocation(node.loc);
400
+ }
401
+ }
402
+ } else if (this.source && this.locations) {
403
+ for (const location of this.locations) {
404
+ output += "\n\n" + printSourceLocation(this.source, location);
405
+ }
406
+ }
407
+ return output;
408
+ }
409
+ toJSON() {
410
+ const formattedError = {
411
+ message: this.message
412
+ };
413
+ if (this.locations != null) {
414
+ formattedError.locations = this.locations;
415
+ }
416
+ if (this.path != null) {
417
+ formattedError.path = this.path;
418
+ }
419
+ if (this.extensions != null && Object.keys(this.extensions).length > 0) {
420
+ formattedError.extensions = this.extensions;
421
+ }
422
+ return formattedError;
423
+ }
424
+ }
425
+ function undefinedIfEmpty(array) {
426
+ return array === void 0 || array.length === 0 ? void 0 : array;
427
+ }
428
+ function syntaxError(source, position, description) {
429
+ return new GraphQLError(`Syntax Error: ${description}`, {
430
+ source,
431
+ positions: [position]
432
+ });
433
+ }
434
+ class Location {
435
+ /**
436
+ * The character offset at which this Node begins.
437
+ */
438
+ /**
439
+ * The character offset at which this Node ends.
440
+ */
441
+ /**
442
+ * The Token at which this Node begins.
443
+ */
444
+ /**
445
+ * The Token at which this Node ends.
446
+ */
447
+ /**
448
+ * The Source document the AST represents.
449
+ */
450
+ constructor(startToken, endToken, source) {
451
+ this.start = startToken.start;
452
+ this.end = endToken.end;
453
+ this.startToken = startToken;
454
+ this.endToken = endToken;
455
+ this.source = source;
456
+ }
457
+ get [Symbol.toStringTag]() {
458
+ return "Location";
459
+ }
460
+ toJSON() {
461
+ return {
462
+ start: this.start,
463
+ end: this.end
464
+ };
465
+ }
466
+ }
467
+ class Token {
468
+ /**
469
+ * The kind of Token.
470
+ */
471
+ /**
472
+ * The character offset at which this Node begins.
473
+ */
474
+ /**
475
+ * The character offset at which this Node ends.
476
+ */
477
+ /**
478
+ * The 1-indexed line number on which this Token appears.
479
+ */
480
+ /**
481
+ * The 1-indexed column number at which this Token begins.
482
+ */
483
+ /**
484
+ * For non-punctuation tokens, represents the interpreted value of the token.
485
+ *
486
+ * Note: is undefined for punctuation tokens, but typed as string for
487
+ * convenience in the parser.
488
+ */
489
+ /**
490
+ * Tokens exist as nodes in a double-linked-list amongst all tokens
491
+ * including ignored tokens. <SOF> is always the first node and <EOF>
492
+ * the last.
493
+ */
494
+ constructor(kind, start2, end, line, column, value) {
495
+ this.kind = kind;
496
+ this.start = start2;
497
+ this.end = end;
498
+ this.line = line;
499
+ this.column = column;
500
+ this.value = value;
501
+ this.prev = null;
502
+ this.next = null;
503
+ }
504
+ get [Symbol.toStringTag]() {
505
+ return "Token";
506
+ }
507
+ toJSON() {
508
+ return {
509
+ kind: this.kind,
510
+ value: this.value,
511
+ line: this.line,
512
+ column: this.column
513
+ };
514
+ }
515
+ }
516
+ const QueryDocumentKeys = {
517
+ Name: [],
518
+ Document: ["definitions"],
519
+ OperationDefinition: [
520
+ "name",
521
+ "variableDefinitions",
522
+ "directives",
523
+ "selectionSet"
524
+ ],
525
+ VariableDefinition: ["variable", "type", "defaultValue", "directives"],
526
+ Variable: ["name"],
527
+ SelectionSet: ["selections"],
528
+ Field: ["alias", "name", "arguments", "directives", "selectionSet"],
529
+ Argument: ["name", "value"],
530
+ FragmentSpread: ["name", "directives"],
531
+ InlineFragment: ["typeCondition", "directives", "selectionSet"],
532
+ FragmentDefinition: [
533
+ "name",
534
+ // Note: fragment variable definitions are deprecated and will removed in v17.0.0
535
+ "variableDefinitions",
536
+ "typeCondition",
537
+ "directives",
538
+ "selectionSet"
539
+ ],
540
+ IntValue: [],
541
+ FloatValue: [],
542
+ StringValue: [],
543
+ BooleanValue: [],
544
+ NullValue: [],
545
+ EnumValue: [],
546
+ ListValue: ["values"],
547
+ ObjectValue: ["fields"],
548
+ ObjectField: ["name", "value"],
549
+ Directive: ["name", "arguments"],
550
+ NamedType: ["name"],
551
+ ListType: ["type"],
552
+ NonNullType: ["type"],
553
+ SchemaDefinition: ["description", "directives", "operationTypes"],
554
+ OperationTypeDefinition: ["type"],
555
+ ScalarTypeDefinition: ["description", "name", "directives"],
556
+ ObjectTypeDefinition: [
557
+ "description",
558
+ "name",
559
+ "interfaces",
560
+ "directives",
561
+ "fields"
562
+ ],
563
+ FieldDefinition: ["description", "name", "arguments", "type", "directives"],
564
+ InputValueDefinition: [
565
+ "description",
566
+ "name",
567
+ "type",
568
+ "defaultValue",
569
+ "directives"
570
+ ],
571
+ InterfaceTypeDefinition: [
572
+ "description",
573
+ "name",
574
+ "interfaces",
575
+ "directives",
576
+ "fields"
577
+ ],
578
+ UnionTypeDefinition: ["description", "name", "directives", "types"],
579
+ EnumTypeDefinition: ["description", "name", "directives", "values"],
580
+ EnumValueDefinition: ["description", "name", "directives"],
581
+ InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
582
+ DirectiveDefinition: ["description", "name", "arguments", "locations"],
583
+ SchemaExtension: ["directives", "operationTypes"],
584
+ ScalarTypeExtension: ["name", "directives"],
585
+ ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
586
+ InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
587
+ UnionTypeExtension: ["name", "directives", "types"],
588
+ EnumTypeExtension: ["name", "directives", "values"],
589
+ InputObjectTypeExtension: ["name", "directives", "fields"]
590
+ };
591
+ const kindValues = new Set(Object.keys(QueryDocumentKeys));
592
+ function isNode(maybeNode) {
593
+ const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
594
+ return typeof maybeKind === "string" && kindValues.has(maybeKind);
595
+ }
596
+ var OperationTypeNode;
597
+ (function(OperationTypeNode2) {
598
+ OperationTypeNode2["QUERY"] = "query";
599
+ OperationTypeNode2["MUTATION"] = "mutation";
600
+ OperationTypeNode2["SUBSCRIPTION"] = "subscription";
601
+ })(OperationTypeNode || (OperationTypeNode = {}));
602
+ var DirectiveLocation;
603
+ (function(DirectiveLocation2) {
604
+ DirectiveLocation2["QUERY"] = "QUERY";
605
+ DirectiveLocation2["MUTATION"] = "MUTATION";
606
+ DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION";
607
+ DirectiveLocation2["FIELD"] = "FIELD";
608
+ DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
609
+ DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
610
+ DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
611
+ DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
612
+ DirectiveLocation2["SCHEMA"] = "SCHEMA";
613
+ DirectiveLocation2["SCALAR"] = "SCALAR";
614
+ DirectiveLocation2["OBJECT"] = "OBJECT";
615
+ DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION";
616
+ DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
617
+ DirectiveLocation2["INTERFACE"] = "INTERFACE";
618
+ DirectiveLocation2["UNION"] = "UNION";
619
+ DirectiveLocation2["ENUM"] = "ENUM";
620
+ DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE";
621
+ DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT";
622
+ DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
623
+ })(DirectiveLocation || (DirectiveLocation = {}));
624
+ var Kind;
625
+ (function(Kind2) {
626
+ Kind2["NAME"] = "Name";
627
+ Kind2["DOCUMENT"] = "Document";
628
+ Kind2["OPERATION_DEFINITION"] = "OperationDefinition";
629
+ Kind2["VARIABLE_DEFINITION"] = "VariableDefinition";
630
+ Kind2["SELECTION_SET"] = "SelectionSet";
631
+ Kind2["FIELD"] = "Field";
632
+ Kind2["ARGUMENT"] = "Argument";
633
+ Kind2["FRAGMENT_SPREAD"] = "FragmentSpread";
634
+ Kind2["INLINE_FRAGMENT"] = "InlineFragment";
635
+ Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition";
636
+ Kind2["VARIABLE"] = "Variable";
637
+ Kind2["INT"] = "IntValue";
638
+ Kind2["FLOAT"] = "FloatValue";
639
+ Kind2["STRING"] = "StringValue";
640
+ Kind2["BOOLEAN"] = "BooleanValue";
641
+ Kind2["NULL"] = "NullValue";
642
+ Kind2["ENUM"] = "EnumValue";
643
+ Kind2["LIST"] = "ListValue";
644
+ Kind2["OBJECT"] = "ObjectValue";
645
+ Kind2["OBJECT_FIELD"] = "ObjectField";
646
+ Kind2["DIRECTIVE"] = "Directive";
647
+ Kind2["NAMED_TYPE"] = "NamedType";
648
+ Kind2["LIST_TYPE"] = "ListType";
649
+ Kind2["NON_NULL_TYPE"] = "NonNullType";
650
+ Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition";
651
+ Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
652
+ Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
653
+ Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
654
+ Kind2["FIELD_DEFINITION"] = "FieldDefinition";
655
+ Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
656
+ Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
657
+ Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
658
+ Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
659
+ Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
660
+ Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
661
+ Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
662
+ Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
663
+ Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
664
+ Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
665
+ Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
666
+ Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
667
+ Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
668
+ Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
669
+ })(Kind || (Kind = {}));
670
+ function isWhiteSpace(code) {
671
+ return code === 9 || code === 32;
672
+ }
673
+ function isDigit(code) {
674
+ return code >= 48 && code <= 57;
675
+ }
676
+ function isLetter(code) {
677
+ return code >= 97 && code <= 122 || // A-Z
678
+ code >= 65 && code <= 90;
679
+ }
680
+ function isNameStart(code) {
681
+ return isLetter(code) || code === 95;
682
+ }
683
+ function isNameContinue(code) {
684
+ return isLetter(code) || isDigit(code) || code === 95;
685
+ }
686
+ function dedentBlockStringLines(lines) {
687
+ var _firstNonEmptyLine2;
688
+ let commonIndent = Number.MAX_SAFE_INTEGER;
689
+ let firstNonEmptyLine = null;
690
+ let lastNonEmptyLine = -1;
691
+ for (let i2 = 0; i2 < lines.length; ++i2) {
692
+ var _firstNonEmptyLine;
693
+ const line = lines[i2];
694
+ const indent2 = leadingWhitespace(line);
695
+ if (indent2 === line.length) {
696
+ continue;
697
+ }
698
+ firstNonEmptyLine = (_firstNonEmptyLine = firstNonEmptyLine) !== null && _firstNonEmptyLine !== void 0 ? _firstNonEmptyLine : i2;
699
+ lastNonEmptyLine = i2;
700
+ if (i2 !== 0 && indent2 < commonIndent) {
701
+ commonIndent = indent2;
702
+ }
703
+ }
704
+ return lines.map((line, i2) => i2 === 0 ? line : line.slice(commonIndent)).slice(
705
+ (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && _firstNonEmptyLine2 !== void 0 ? _firstNonEmptyLine2 : 0,
706
+ lastNonEmptyLine + 1
707
+ );
708
+ }
709
+ function leadingWhitespace(str) {
710
+ let i2 = 0;
711
+ while (i2 < str.length && isWhiteSpace(str.charCodeAt(i2))) {
712
+ ++i2;
713
+ }
714
+ return i2;
715
+ }
716
+ function printBlockString(value, options) {
717
+ const escapedValue = value.replace(/"""/g, '\\"""');
718
+ const lines = escapedValue.split(/\r\n|[\n\r]/g);
719
+ const isSingleLine = lines.length === 1;
720
+ const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0)));
721
+ const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""');
722
+ const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes;
723
+ const hasTrailingSlash = value.endsWith("\\");
724
+ const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;
725
+ const printAsMultipleLines = !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability
726
+ (!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes);
727
+ let result = "";
728
+ const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));
729
+ if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) {
730
+ result += "\n";
731
+ }
732
+ result += escapedValue;
733
+ if (printAsMultipleLines || forceTrailingNewline) {
734
+ result += "\n";
735
+ }
736
+ return '"""' + result + '"""';
737
+ }
738
+ var TokenKind;
739
+ (function(TokenKind2) {
740
+ TokenKind2["SOF"] = "<SOF>";
741
+ TokenKind2["EOF"] = "<EOF>";
742
+ TokenKind2["BANG"] = "!";
743
+ TokenKind2["DOLLAR"] = "$";
744
+ TokenKind2["AMP"] = "&";
745
+ TokenKind2["PAREN_L"] = "(";
746
+ TokenKind2["PAREN_R"] = ")";
747
+ TokenKind2["SPREAD"] = "...";
748
+ TokenKind2["COLON"] = ":";
749
+ TokenKind2["EQUALS"] = "=";
750
+ TokenKind2["AT"] = "@";
751
+ TokenKind2["BRACKET_L"] = "[";
752
+ TokenKind2["BRACKET_R"] = "]";
753
+ TokenKind2["BRACE_L"] = "{";
754
+ TokenKind2["PIPE"] = "|";
755
+ TokenKind2["BRACE_R"] = "}";
756
+ TokenKind2["NAME"] = "Name";
757
+ TokenKind2["INT"] = "Int";
758
+ TokenKind2["FLOAT"] = "Float";
759
+ TokenKind2["STRING"] = "String";
760
+ TokenKind2["BLOCK_STRING"] = "BlockString";
761
+ TokenKind2["COMMENT"] = "Comment";
762
+ })(TokenKind || (TokenKind = {}));
763
+ class Lexer {
764
+ /**
765
+ * The previously focused non-ignored token.
766
+ */
767
+ /**
768
+ * The currently focused non-ignored token.
769
+ */
770
+ /**
771
+ * The (1-indexed) line containing the current token.
772
+ */
773
+ /**
774
+ * The character offset at which the current line begins.
775
+ */
776
+ constructor(source) {
777
+ const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);
778
+ this.source = source;
779
+ this.lastToken = startOfFileToken;
780
+ this.token = startOfFileToken;
781
+ this.line = 1;
782
+ this.lineStart = 0;
783
+ }
784
+ get [Symbol.toStringTag]() {
785
+ return "Lexer";
786
+ }
787
+ /**
788
+ * Advances the token stream to the next non-ignored token.
789
+ */
790
+ advance() {
791
+ this.lastToken = this.token;
792
+ const token = this.token = this.lookahead();
793
+ return token;
794
+ }
795
+ /**
796
+ * Looks ahead and returns the next non-ignored token, but does not change
797
+ * the state of Lexer.
798
+ */
799
+ lookahead() {
800
+ let token = this.token;
801
+ if (token.kind !== TokenKind.EOF) {
802
+ do {
803
+ if (token.next) {
804
+ token = token.next;
805
+ } else {
806
+ const nextToken = readNextToken(this, token.end);
807
+ token.next = nextToken;
808
+ nextToken.prev = token;
809
+ token = nextToken;
810
+ }
811
+ } while (token.kind === TokenKind.COMMENT);
812
+ }
813
+ return token;
814
+ }
815
+ }
816
+ function isPunctuatorTokenKind(kind) {
817
+ return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;
818
+ }
819
+ function isUnicodeScalarValue(code) {
820
+ return code >= 0 && code <= 55295 || code >= 57344 && code <= 1114111;
821
+ }
822
+ function isSupplementaryCodePoint(body, location) {
823
+ return isLeadingSurrogate(body.charCodeAt(location)) && isTrailingSurrogate(body.charCodeAt(location + 1));
824
+ }
825
+ function isLeadingSurrogate(code) {
826
+ return code >= 55296 && code <= 56319;
827
+ }
828
+ function isTrailingSurrogate(code) {
829
+ return code >= 56320 && code <= 57343;
830
+ }
831
+ function printCodePointAt(lexer, location) {
832
+ const code = lexer.source.body.codePointAt(location);
833
+ if (code === void 0) {
834
+ return TokenKind.EOF;
835
+ } else if (code >= 32 && code <= 126) {
836
+ const char = String.fromCodePoint(code);
837
+ return char === '"' ? `'"'` : `"${char}"`;
838
+ }
839
+ return "U+" + code.toString(16).toUpperCase().padStart(4, "0");
840
+ }
841
+ function createToken(lexer, kind, start2, end, value) {
842
+ const line = lexer.line;
843
+ const col = 1 + start2 - lexer.lineStart;
844
+ return new Token(kind, start2, end, line, col, value);
845
+ }
846
+ function readNextToken(lexer, start2) {
847
+ const body = lexer.source.body;
848
+ const bodyLength = body.length;
849
+ let position = start2;
850
+ while (position < bodyLength) {
851
+ const code = body.charCodeAt(position);
852
+ switch (code) {
853
+ case 65279:
854
+ case 9:
855
+ case 32:
856
+ case 44:
857
+ ++position;
858
+ continue;
859
+ case 10:
860
+ ++position;
861
+ ++lexer.line;
862
+ lexer.lineStart = position;
863
+ continue;
864
+ case 13:
865
+ if (body.charCodeAt(position + 1) === 10) {
866
+ position += 2;
867
+ } else {
868
+ ++position;
869
+ }
870
+ ++lexer.line;
871
+ lexer.lineStart = position;
872
+ continue;
873
+ case 35:
874
+ return readComment(lexer, position);
875
+ case 33:
876
+ return createToken(lexer, TokenKind.BANG, position, position + 1);
877
+ case 36:
878
+ return createToken(lexer, TokenKind.DOLLAR, position, position + 1);
879
+ case 38:
880
+ return createToken(lexer, TokenKind.AMP, position, position + 1);
881
+ case 40:
882
+ return createToken(lexer, TokenKind.PAREN_L, position, position + 1);
883
+ case 41:
884
+ return createToken(lexer, TokenKind.PAREN_R, position, position + 1);
885
+ case 46:
886
+ if (body.charCodeAt(position + 1) === 46 && body.charCodeAt(position + 2) === 46) {
887
+ return createToken(lexer, TokenKind.SPREAD, position, position + 3);
888
+ }
889
+ break;
890
+ case 58:
891
+ return createToken(lexer, TokenKind.COLON, position, position + 1);
892
+ case 61:
893
+ return createToken(lexer, TokenKind.EQUALS, position, position + 1);
894
+ case 64:
895
+ return createToken(lexer, TokenKind.AT, position, position + 1);
896
+ case 91:
897
+ return createToken(lexer, TokenKind.BRACKET_L, position, position + 1);
898
+ case 93:
899
+ return createToken(lexer, TokenKind.BRACKET_R, position, position + 1);
900
+ case 123:
901
+ return createToken(lexer, TokenKind.BRACE_L, position, position + 1);
902
+ case 124:
903
+ return createToken(lexer, TokenKind.PIPE, position, position + 1);
904
+ case 125:
905
+ return createToken(lexer, TokenKind.BRACE_R, position, position + 1);
906
+ case 34:
907
+ if (body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {
908
+ return readBlockString(lexer, position);
909
+ }
910
+ return readString(lexer, position);
911
+ }
912
+ if (isDigit(code) || code === 45) {
913
+ return readNumber(lexer, position, code);
914
+ }
915
+ if (isNameStart(code)) {
916
+ return readName(lexer, position);
917
+ }
918
+ throw syntaxError(
919
+ lexer.source,
920
+ position,
921
+ code === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) ? `Unexpected character: ${printCodePointAt(lexer, position)}.` : `Invalid character: ${printCodePointAt(lexer, position)}.`
922
+ );
923
+ }
924
+ return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength);
925
+ }
926
+ function readComment(lexer, start2) {
927
+ const body = lexer.source.body;
928
+ const bodyLength = body.length;
929
+ let position = start2 + 1;
930
+ while (position < bodyLength) {
931
+ const code = body.charCodeAt(position);
932
+ if (code === 10 || code === 13) {
933
+ break;
934
+ }
935
+ if (isUnicodeScalarValue(code)) {
936
+ ++position;
937
+ } else if (isSupplementaryCodePoint(body, position)) {
938
+ position += 2;
939
+ } else {
940
+ break;
941
+ }
942
+ }
943
+ return createToken(
944
+ lexer,
945
+ TokenKind.COMMENT,
946
+ start2,
947
+ position,
948
+ body.slice(start2 + 1, position)
949
+ );
950
+ }
951
+ function readNumber(lexer, start2, firstCode) {
952
+ const body = lexer.source.body;
953
+ let position = start2;
954
+ let code = firstCode;
955
+ let isFloat = false;
956
+ if (code === 45) {
957
+ code = body.charCodeAt(++position);
958
+ }
959
+ if (code === 48) {
960
+ code = body.charCodeAt(++position);
961
+ if (isDigit(code)) {
962
+ throw syntaxError(
963
+ lexer.source,
964
+ position,
965
+ `Invalid number, unexpected digit after 0: ${printCodePointAt(
966
+ lexer,
967
+ position
968
+ )}.`
969
+ );
970
+ }
971
+ } else {
972
+ position = readDigits(lexer, position, code);
973
+ code = body.charCodeAt(position);
974
+ }
975
+ if (code === 46) {
976
+ isFloat = true;
977
+ code = body.charCodeAt(++position);
978
+ position = readDigits(lexer, position, code);
979
+ code = body.charCodeAt(position);
980
+ }
981
+ if (code === 69 || code === 101) {
982
+ isFloat = true;
983
+ code = body.charCodeAt(++position);
984
+ if (code === 43 || code === 45) {
985
+ code = body.charCodeAt(++position);
986
+ }
987
+ position = readDigits(lexer, position, code);
988
+ code = body.charCodeAt(position);
989
+ }
990
+ if (code === 46 || isNameStart(code)) {
991
+ throw syntaxError(
992
+ lexer.source,
993
+ position,
994
+ `Invalid number, expected digit but got: ${printCodePointAt(
995
+ lexer,
996
+ position
997
+ )}.`
998
+ );
999
+ }
1000
+ return createToken(
1001
+ lexer,
1002
+ isFloat ? TokenKind.FLOAT : TokenKind.INT,
1003
+ start2,
1004
+ position,
1005
+ body.slice(start2, position)
1006
+ );
1007
+ }
1008
+ function readDigits(lexer, start2, firstCode) {
1009
+ if (!isDigit(firstCode)) {
1010
+ throw syntaxError(
1011
+ lexer.source,
1012
+ start2,
1013
+ `Invalid number, expected digit but got: ${printCodePointAt(
1014
+ lexer,
1015
+ start2
1016
+ )}.`
1017
+ );
1018
+ }
1019
+ const body = lexer.source.body;
1020
+ let position = start2 + 1;
1021
+ while (isDigit(body.charCodeAt(position))) {
1022
+ ++position;
1023
+ }
1024
+ return position;
1025
+ }
1026
+ function readString(lexer, start2) {
1027
+ const body = lexer.source.body;
1028
+ const bodyLength = body.length;
1029
+ let position = start2 + 1;
1030
+ let chunkStart = position;
1031
+ let value = "";
1032
+ while (position < bodyLength) {
1033
+ const code = body.charCodeAt(position);
1034
+ if (code === 34) {
1035
+ value += body.slice(chunkStart, position);
1036
+ return createToken(lexer, TokenKind.STRING, start2, position + 1, value);
1037
+ }
1038
+ if (code === 92) {
1039
+ value += body.slice(chunkStart, position);
1040
+ const escape = body.charCodeAt(position + 1) === 117 ? body.charCodeAt(position + 2) === 123 ? readEscapedUnicodeVariableWidth(lexer, position) : readEscapedUnicodeFixedWidth(lexer, position) : readEscapedCharacter(lexer, position);
1041
+ value += escape.value;
1042
+ position += escape.size;
1043
+ chunkStart = position;
1044
+ continue;
1045
+ }
1046
+ if (code === 10 || code === 13) {
1047
+ break;
1048
+ }
1049
+ if (isUnicodeScalarValue(code)) {
1050
+ ++position;
1051
+ } else if (isSupplementaryCodePoint(body, position)) {
1052
+ position += 2;
1053
+ } else {
1054
+ throw syntaxError(
1055
+ lexer.source,
1056
+ position,
1057
+ `Invalid character within String: ${printCodePointAt(
1058
+ lexer,
1059
+ position
1060
+ )}.`
1061
+ );
1062
+ }
1063
+ }
1064
+ throw syntaxError(lexer.source, position, "Unterminated string.");
1065
+ }
1066
+ function readEscapedUnicodeVariableWidth(lexer, position) {
1067
+ const body = lexer.source.body;
1068
+ let point = 0;
1069
+ let size = 3;
1070
+ while (size < 12) {
1071
+ const code = body.charCodeAt(position + size++);
1072
+ if (code === 125) {
1073
+ if (size < 5 || !isUnicodeScalarValue(point)) {
1074
+ break;
1075
+ }
1076
+ return {
1077
+ value: String.fromCodePoint(point),
1078
+ size
1079
+ };
1080
+ }
1081
+ point = point << 4 | readHexDigit(code);
1082
+ if (point < 0) {
1083
+ break;
1084
+ }
1085
+ }
1086
+ throw syntaxError(
1087
+ lexer.source,
1088
+ position,
1089
+ `Invalid Unicode escape sequence: "${body.slice(
1090
+ position,
1091
+ position + size
1092
+ )}".`
1093
+ );
1094
+ }
1095
+ function readEscapedUnicodeFixedWidth(lexer, position) {
1096
+ const body = lexer.source.body;
1097
+ const code = read16BitHexCode(body, position + 2);
1098
+ if (isUnicodeScalarValue(code)) {
1099
+ return {
1100
+ value: String.fromCodePoint(code),
1101
+ size: 6
1102
+ };
1103
+ }
1104
+ if (isLeadingSurrogate(code)) {
1105
+ if (body.charCodeAt(position + 6) === 92 && body.charCodeAt(position + 7) === 117) {
1106
+ const trailingCode = read16BitHexCode(body, position + 8);
1107
+ if (isTrailingSurrogate(trailingCode)) {
1108
+ return {
1109
+ value: String.fromCodePoint(code, trailingCode),
1110
+ size: 12
1111
+ };
1112
+ }
1113
+ }
1114
+ }
1115
+ throw syntaxError(
1116
+ lexer.source,
1117
+ position,
1118
+ `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`
1119
+ );
1120
+ }
1121
+ function read16BitHexCode(body, position) {
1122
+ return readHexDigit(body.charCodeAt(position)) << 12 | readHexDigit(body.charCodeAt(position + 1)) << 8 | readHexDigit(body.charCodeAt(position + 2)) << 4 | readHexDigit(body.charCodeAt(position + 3));
1123
+ }
1124
+ function readHexDigit(code) {
1125
+ return code >= 48 && code <= 57 ? code - 48 : code >= 65 && code <= 70 ? code - 55 : code >= 97 && code <= 102 ? code - 87 : -1;
1126
+ }
1127
+ function readEscapedCharacter(lexer, position) {
1128
+ const body = lexer.source.body;
1129
+ const code = body.charCodeAt(position + 1);
1130
+ switch (code) {
1131
+ case 34:
1132
+ return {
1133
+ value: '"',
1134
+ size: 2
1135
+ };
1136
+ case 92:
1137
+ return {
1138
+ value: "\\",
1139
+ size: 2
1140
+ };
1141
+ case 47:
1142
+ return {
1143
+ value: "/",
1144
+ size: 2
1145
+ };
1146
+ case 98:
1147
+ return {
1148
+ value: "\b",
1149
+ size: 2
1150
+ };
1151
+ case 102:
1152
+ return {
1153
+ value: "\f",
1154
+ size: 2
1155
+ };
1156
+ case 110:
1157
+ return {
1158
+ value: "\n",
1159
+ size: 2
1160
+ };
1161
+ case 114:
1162
+ return {
1163
+ value: "\r",
1164
+ size: 2
1165
+ };
1166
+ case 116:
1167
+ return {
1168
+ value: " ",
1169
+ size: 2
1170
+ };
1171
+ }
1172
+ throw syntaxError(
1173
+ lexer.source,
1174
+ position,
1175
+ `Invalid character escape sequence: "${body.slice(
1176
+ position,
1177
+ position + 2
1178
+ )}".`
1179
+ );
1180
+ }
1181
+ function readBlockString(lexer, start2) {
1182
+ const body = lexer.source.body;
1183
+ const bodyLength = body.length;
1184
+ let lineStart = lexer.lineStart;
1185
+ let position = start2 + 3;
1186
+ let chunkStart = position;
1187
+ let currentLine = "";
1188
+ const blockLines = [];
1189
+ while (position < bodyLength) {
1190
+ const code = body.charCodeAt(position);
1191
+ if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {
1192
+ currentLine += body.slice(chunkStart, position);
1193
+ blockLines.push(currentLine);
1194
+ const token = createToken(
1195
+ lexer,
1196
+ TokenKind.BLOCK_STRING,
1197
+ start2,
1198
+ position + 3,
1199
+ // Return a string of the lines joined with U+000A.
1200
+ dedentBlockStringLines(blockLines).join("\n")
1201
+ );
1202
+ lexer.line += blockLines.length - 1;
1203
+ lexer.lineStart = lineStart;
1204
+ return token;
1205
+ }
1206
+ if (code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) {
1207
+ currentLine += body.slice(chunkStart, position);
1208
+ chunkStart = position + 1;
1209
+ position += 4;
1210
+ continue;
1211
+ }
1212
+ if (code === 10 || code === 13) {
1213
+ currentLine += body.slice(chunkStart, position);
1214
+ blockLines.push(currentLine);
1215
+ if (code === 13 && body.charCodeAt(position + 1) === 10) {
1216
+ position += 2;
1217
+ } else {
1218
+ ++position;
1219
+ }
1220
+ currentLine = "";
1221
+ chunkStart = position;
1222
+ lineStart = position;
1223
+ continue;
1224
+ }
1225
+ if (isUnicodeScalarValue(code)) {
1226
+ ++position;
1227
+ } else if (isSupplementaryCodePoint(body, position)) {
1228
+ position += 2;
1229
+ } else {
1230
+ throw syntaxError(
1231
+ lexer.source,
1232
+ position,
1233
+ `Invalid character within String: ${printCodePointAt(
1234
+ lexer,
1235
+ position
1236
+ )}.`
1237
+ );
1238
+ }
1239
+ }
1240
+ throw syntaxError(lexer.source, position, "Unterminated string.");
1241
+ }
1242
+ function readName(lexer, start2) {
1243
+ const body = lexer.source.body;
1244
+ const bodyLength = body.length;
1245
+ let position = start2 + 1;
1246
+ while (position < bodyLength) {
1247
+ const code = body.charCodeAt(position);
1248
+ if (isNameContinue(code)) {
1249
+ ++position;
1250
+ } else {
1251
+ break;
1252
+ }
1253
+ }
1254
+ return createToken(
1255
+ lexer,
1256
+ TokenKind.NAME,
1257
+ start2,
1258
+ position,
1259
+ body.slice(start2, position)
1260
+ );
1261
+ }
1262
+ const MAX_ARRAY_LENGTH = 10;
1263
+ const MAX_RECURSIVE_DEPTH = 2;
1264
+ function inspect(value) {
1265
+ return formatValue(value, []);
1266
+ }
1267
+ function formatValue(value, seenValues) {
1268
+ switch (typeof value) {
1269
+ case "string":
1270
+ return JSON.stringify(value);
1271
+ case "function":
1272
+ return value.name ? `[function ${value.name}]` : "[function]";
1273
+ case "object":
1274
+ return formatObjectValue(value, seenValues);
1275
+ default:
1276
+ return String(value);
1277
+ }
1278
+ }
1279
+ function formatObjectValue(value, previouslySeenValues) {
1280
+ if (value === null) {
1281
+ return "null";
1282
+ }
1283
+ if (previouslySeenValues.includes(value)) {
1284
+ return "[Circular]";
1285
+ }
1286
+ const seenValues = [...previouslySeenValues, value];
1287
+ if (isJSONable(value)) {
1288
+ const jsonValue = value.toJSON();
1289
+ if (jsonValue !== value) {
1290
+ return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
1291
+ }
1292
+ } else if (Array.isArray(value)) {
1293
+ return formatArray(value, seenValues);
1294
+ }
1295
+ return formatObject(value, seenValues);
1296
+ }
1297
+ function isJSONable(value) {
1298
+ return typeof value.toJSON === "function";
1299
+ }
1300
+ function formatObject(object, seenValues) {
1301
+ const entries = Object.entries(object);
1302
+ if (entries.length === 0) {
1303
+ return "{}";
1304
+ }
1305
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
1306
+ return "[" + getObjectTag(object) + "]";
1307
+ }
1308
+ const properties = entries.map(
1309
+ ([key, value]) => key + ": " + formatValue(value, seenValues)
1310
+ );
1311
+ return "{ " + properties.join(", ") + " }";
1312
+ }
1313
+ function formatArray(array, seenValues) {
1314
+ if (array.length === 0) {
1315
+ return "[]";
1316
+ }
1317
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
1318
+ return "[Array]";
1319
+ }
1320
+ const len = Math.min(MAX_ARRAY_LENGTH, array.length);
1321
+ const remaining = array.length - len;
1322
+ const items = [];
1323
+ for (let i2 = 0; i2 < len; ++i2) {
1324
+ items.push(formatValue(array[i2], seenValues));
1325
+ }
1326
+ if (remaining === 1) {
1327
+ items.push("... 1 more item");
1328
+ } else if (remaining > 1) {
1329
+ items.push(`... ${remaining} more items`);
1330
+ }
1331
+ return "[" + items.join(", ") + "]";
1332
+ }
1333
+ function getObjectTag(object) {
1334
+ const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
1335
+ if (tag === "Object" && typeof object.constructor === "function") {
1336
+ const name = object.constructor.name;
1337
+ if (typeof name === "string" && name !== "") {
1338
+ return name;
1339
+ }
1340
+ }
1341
+ return tag;
1342
+ }
1343
+ const instanceOf = (
1344
+ /* c8 ignore next 6 */
1345
+ // FIXME: https://github.com/graphql/graphql-js/issues/2317
1346
+ // eslint-disable-next-line no-undef
1347
+ process.env.NODE_ENV === "production" ? function instanceOf2(value, constructor) {
1348
+ return value instanceof constructor;
1349
+ } : function instanceOf3(value, constructor) {
1350
+ if (value instanceof constructor) {
1351
+ return true;
1352
+ }
1353
+ if (typeof value === "object" && value !== null) {
1354
+ var _value$constructor;
1355
+ const className = constructor.prototype[Symbol.toStringTag];
1356
+ const valueClassName = (
1357
+ // We still need to support constructor's name to detect conflicts with older versions of this library.
1358
+ Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name
1359
+ );
1360
+ if (className === valueClassName) {
1361
+ const stringifiedValue = inspect(value);
1362
+ throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
1363
+
1364
+ Ensure that there is only one instance of "graphql" in the node_modules
1365
+ directory. If different versions of "graphql" are the dependencies of other
1366
+ relied on modules, use "resolutions" to ensure only one version is installed.
1367
+
1368
+ https://yarnpkg.com/en/docs/selective-version-resolutions
1369
+
1370
+ Duplicate "graphql" modules cannot be used at the same time since different
1371
+ versions may have different capabilities and behavior. The data from one
1372
+ version used in the function from another could produce confusing and
1373
+ spurious results.`);
1374
+ }
1375
+ }
1376
+ return false;
1377
+ }
1378
+ );
1379
+ class Source {
1380
+ constructor(body, name = "GraphQL request", locationOffset = {
1381
+ line: 1,
1382
+ column: 1
1383
+ }) {
1384
+ typeof body === "string" || devAssert(false, `Body must be a string. Received: ${inspect(body)}.`);
1385
+ this.body = body;
1386
+ this.name = name;
1387
+ this.locationOffset = locationOffset;
1388
+ this.locationOffset.line > 0 || devAssert(
1389
+ false,
1390
+ "line in locationOffset is 1-indexed and must be positive."
1391
+ );
1392
+ this.locationOffset.column > 0 || devAssert(
1393
+ false,
1394
+ "column in locationOffset is 1-indexed and must be positive."
1395
+ );
1396
+ }
1397
+ get [Symbol.toStringTag]() {
1398
+ return "Source";
1399
+ }
1400
+ }
1401
+ function isSource(source) {
1402
+ return instanceOf(source, Source);
1403
+ }
1404
+ function parse(source, options) {
1405
+ const parser = new Parser(source, options);
1406
+ return parser.parseDocument();
1407
+ }
1408
+ class Parser {
1409
+ constructor(source, options = {}) {
1410
+ const sourceObj = isSource(source) ? source : new Source(source);
1411
+ this._lexer = new Lexer(sourceObj);
1412
+ this._options = options;
1413
+ this._tokenCounter = 0;
1414
+ }
1415
+ /**
1416
+ * Converts a name lex token into a name parse node.
1417
+ */
1418
+ parseName() {
1419
+ const token = this.expectToken(TokenKind.NAME);
1420
+ return this.node(token, {
1421
+ kind: Kind.NAME,
1422
+ value: token.value
1423
+ });
1424
+ }
1425
+ // Implements the parsing rules in the Document section.
1426
+ /**
1427
+ * Document : Definition+
1428
+ */
1429
+ parseDocument() {
1430
+ return this.node(this._lexer.token, {
1431
+ kind: Kind.DOCUMENT,
1432
+ definitions: this.many(
1433
+ TokenKind.SOF,
1434
+ this.parseDefinition,
1435
+ TokenKind.EOF
1436
+ )
1437
+ });
1438
+ }
1439
+ /**
1440
+ * Definition :
1441
+ * - ExecutableDefinition
1442
+ * - TypeSystemDefinition
1443
+ * - TypeSystemExtension
1444
+ *
1445
+ * ExecutableDefinition :
1446
+ * - OperationDefinition
1447
+ * - FragmentDefinition
1448
+ *
1449
+ * TypeSystemDefinition :
1450
+ * - SchemaDefinition
1451
+ * - TypeDefinition
1452
+ * - DirectiveDefinition
1453
+ *
1454
+ * TypeDefinition :
1455
+ * - ScalarTypeDefinition
1456
+ * - ObjectTypeDefinition
1457
+ * - InterfaceTypeDefinition
1458
+ * - UnionTypeDefinition
1459
+ * - EnumTypeDefinition
1460
+ * - InputObjectTypeDefinition
1461
+ */
1462
+ parseDefinition() {
1463
+ if (this.peek(TokenKind.BRACE_L)) {
1464
+ return this.parseOperationDefinition();
1465
+ }
1466
+ const hasDescription = this.peekDescription();
1467
+ const keywordToken = hasDescription ? this._lexer.lookahead() : this._lexer.token;
1468
+ if (keywordToken.kind === TokenKind.NAME) {
1469
+ switch (keywordToken.value) {
1470
+ case "schema":
1471
+ return this.parseSchemaDefinition();
1472
+ case "scalar":
1473
+ return this.parseScalarTypeDefinition();
1474
+ case "type":
1475
+ return this.parseObjectTypeDefinition();
1476
+ case "interface":
1477
+ return this.parseInterfaceTypeDefinition();
1478
+ case "union":
1479
+ return this.parseUnionTypeDefinition();
1480
+ case "enum":
1481
+ return this.parseEnumTypeDefinition();
1482
+ case "input":
1483
+ return this.parseInputObjectTypeDefinition();
1484
+ case "directive":
1485
+ return this.parseDirectiveDefinition();
1486
+ }
1487
+ if (hasDescription) {
1488
+ throw syntaxError(
1489
+ this._lexer.source,
1490
+ this._lexer.token.start,
1491
+ "Unexpected description, descriptions are supported only on type definitions."
1492
+ );
1493
+ }
1494
+ switch (keywordToken.value) {
1495
+ case "query":
1496
+ case "mutation":
1497
+ case "subscription":
1498
+ return this.parseOperationDefinition();
1499
+ case "fragment":
1500
+ return this.parseFragmentDefinition();
1501
+ case "extend":
1502
+ return this.parseTypeSystemExtension();
1503
+ }
1504
+ }
1505
+ throw this.unexpected(keywordToken);
1506
+ }
1507
+ // Implements the parsing rules in the Operations section.
1508
+ /**
1509
+ * OperationDefinition :
1510
+ * - SelectionSet
1511
+ * - OperationType Name? VariableDefinitions? Directives? SelectionSet
1512
+ */
1513
+ parseOperationDefinition() {
1514
+ const start2 = this._lexer.token;
1515
+ if (this.peek(TokenKind.BRACE_L)) {
1516
+ return this.node(start2, {
1517
+ kind: Kind.OPERATION_DEFINITION,
1518
+ operation: OperationTypeNode.QUERY,
1519
+ name: void 0,
1520
+ variableDefinitions: [],
1521
+ directives: [],
1522
+ selectionSet: this.parseSelectionSet()
1523
+ });
1524
+ }
1525
+ const operation = this.parseOperationType();
1526
+ let name;
1527
+ if (this.peek(TokenKind.NAME)) {
1528
+ name = this.parseName();
1529
+ }
1530
+ return this.node(start2, {
1531
+ kind: Kind.OPERATION_DEFINITION,
1532
+ operation,
1533
+ name,
1534
+ variableDefinitions: this.parseVariableDefinitions(),
1535
+ directives: this.parseDirectives(false),
1536
+ selectionSet: this.parseSelectionSet()
1537
+ });
1538
+ }
1539
+ /**
1540
+ * OperationType : one of query mutation subscription
1541
+ */
1542
+ parseOperationType() {
1543
+ const operationToken = this.expectToken(TokenKind.NAME);
1544
+ switch (operationToken.value) {
1545
+ case "query":
1546
+ return OperationTypeNode.QUERY;
1547
+ case "mutation":
1548
+ return OperationTypeNode.MUTATION;
1549
+ case "subscription":
1550
+ return OperationTypeNode.SUBSCRIPTION;
1551
+ }
1552
+ throw this.unexpected(operationToken);
1553
+ }
1554
+ /**
1555
+ * VariableDefinitions : ( VariableDefinition+ )
1556
+ */
1557
+ parseVariableDefinitions() {
1558
+ return this.optionalMany(
1559
+ TokenKind.PAREN_L,
1560
+ this.parseVariableDefinition,
1561
+ TokenKind.PAREN_R
1562
+ );
1563
+ }
1564
+ /**
1565
+ * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
1566
+ */
1567
+ parseVariableDefinition() {
1568
+ return this.node(this._lexer.token, {
1569
+ kind: Kind.VARIABLE_DEFINITION,
1570
+ variable: this.parseVariable(),
1571
+ type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),
1572
+ defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseConstValueLiteral() : void 0,
1573
+ directives: this.parseConstDirectives()
1574
+ });
1575
+ }
1576
+ /**
1577
+ * Variable : $ Name
1578
+ */
1579
+ parseVariable() {
1580
+ const start2 = this._lexer.token;
1581
+ this.expectToken(TokenKind.DOLLAR);
1582
+ return this.node(start2, {
1583
+ kind: Kind.VARIABLE,
1584
+ name: this.parseName()
1585
+ });
1586
+ }
1587
+ /**
1588
+ * ```
1589
+ * SelectionSet : { Selection+ }
1590
+ * ```
1591
+ */
1592
+ parseSelectionSet() {
1593
+ return this.node(this._lexer.token, {
1594
+ kind: Kind.SELECTION_SET,
1595
+ selections: this.many(
1596
+ TokenKind.BRACE_L,
1597
+ this.parseSelection,
1598
+ TokenKind.BRACE_R
1599
+ )
1600
+ });
1601
+ }
1602
+ /**
1603
+ * Selection :
1604
+ * - Field
1605
+ * - FragmentSpread
1606
+ * - InlineFragment
1607
+ */
1608
+ parseSelection() {
1609
+ return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField();
1610
+ }
1611
+ /**
1612
+ * Field : Alias? Name Arguments? Directives? SelectionSet?
1613
+ *
1614
+ * Alias : Name :
1615
+ */
1616
+ parseField() {
1617
+ const start2 = this._lexer.token;
1618
+ const nameOrAlias = this.parseName();
1619
+ let alias;
1620
+ let name;
1621
+ if (this.expectOptionalToken(TokenKind.COLON)) {
1622
+ alias = nameOrAlias;
1623
+ name = this.parseName();
1624
+ } else {
1625
+ name = nameOrAlias;
1626
+ }
1627
+ return this.node(start2, {
1628
+ kind: Kind.FIELD,
1629
+ alias,
1630
+ name,
1631
+ arguments: this.parseArguments(false),
1632
+ directives: this.parseDirectives(false),
1633
+ selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : void 0
1634
+ });
1635
+ }
1636
+ /**
1637
+ * Arguments[Const] : ( Argument[?Const]+ )
1638
+ */
1639
+ parseArguments(isConst) {
1640
+ const item = isConst ? this.parseConstArgument : this.parseArgument;
1641
+ return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);
1642
+ }
1643
+ /**
1644
+ * Argument[Const] : Name : Value[?Const]
1645
+ */
1646
+ parseArgument(isConst = false) {
1647
+ const start2 = this._lexer.token;
1648
+ const name = this.parseName();
1649
+ this.expectToken(TokenKind.COLON);
1650
+ return this.node(start2, {
1651
+ kind: Kind.ARGUMENT,
1652
+ name,
1653
+ value: this.parseValueLiteral(isConst)
1654
+ });
1655
+ }
1656
+ parseConstArgument() {
1657
+ return this.parseArgument(true);
1658
+ }
1659
+ // Implements the parsing rules in the Fragments section.
1660
+ /**
1661
+ * Corresponds to both FragmentSpread and InlineFragment in the spec.
1662
+ *
1663
+ * FragmentSpread : ... FragmentName Directives?
1664
+ *
1665
+ * InlineFragment : ... TypeCondition? Directives? SelectionSet
1666
+ */
1667
+ parseFragment() {
1668
+ const start2 = this._lexer.token;
1669
+ this.expectToken(TokenKind.SPREAD);
1670
+ const hasTypeCondition = this.expectOptionalKeyword("on");
1671
+ if (!hasTypeCondition && this.peek(TokenKind.NAME)) {
1672
+ return this.node(start2, {
1673
+ kind: Kind.FRAGMENT_SPREAD,
1674
+ name: this.parseFragmentName(),
1675
+ directives: this.parseDirectives(false)
1676
+ });
1677
+ }
1678
+ return this.node(start2, {
1679
+ kind: Kind.INLINE_FRAGMENT,
1680
+ typeCondition: hasTypeCondition ? this.parseNamedType() : void 0,
1681
+ directives: this.parseDirectives(false),
1682
+ selectionSet: this.parseSelectionSet()
1683
+ });
1684
+ }
1685
+ /**
1686
+ * FragmentDefinition :
1687
+ * - fragment FragmentName on TypeCondition Directives? SelectionSet
1688
+ *
1689
+ * TypeCondition : NamedType
1690
+ */
1691
+ parseFragmentDefinition() {
1692
+ const start2 = this._lexer.token;
1693
+ this.expectKeyword("fragment");
1694
+ if (this._options.allowLegacyFragmentVariables === true) {
1695
+ return this.node(start2, {
1696
+ kind: Kind.FRAGMENT_DEFINITION,
1697
+ name: this.parseFragmentName(),
1698
+ variableDefinitions: this.parseVariableDefinitions(),
1699
+ typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
1700
+ directives: this.parseDirectives(false),
1701
+ selectionSet: this.parseSelectionSet()
1702
+ });
1703
+ }
1704
+ return this.node(start2, {
1705
+ kind: Kind.FRAGMENT_DEFINITION,
1706
+ name: this.parseFragmentName(),
1707
+ typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
1708
+ directives: this.parseDirectives(false),
1709
+ selectionSet: this.parseSelectionSet()
1710
+ });
1711
+ }
1712
+ /**
1713
+ * FragmentName : Name but not `on`
1714
+ */
1715
+ parseFragmentName() {
1716
+ if (this._lexer.token.value === "on") {
1717
+ throw this.unexpected();
1718
+ }
1719
+ return this.parseName();
1720
+ }
1721
+ // Implements the parsing rules in the Values section.
1722
+ /**
1723
+ * Value[Const] :
1724
+ * - [~Const] Variable
1725
+ * - IntValue
1726
+ * - FloatValue
1727
+ * - StringValue
1728
+ * - BooleanValue
1729
+ * - NullValue
1730
+ * - EnumValue
1731
+ * - ListValue[?Const]
1732
+ * - ObjectValue[?Const]
1733
+ *
1734
+ * BooleanValue : one of `true` `false`
1735
+ *
1736
+ * NullValue : `null`
1737
+ *
1738
+ * EnumValue : Name but not `true`, `false` or `null`
1739
+ */
1740
+ parseValueLiteral(isConst) {
1741
+ const token = this._lexer.token;
1742
+ switch (token.kind) {
1743
+ case TokenKind.BRACKET_L:
1744
+ return this.parseList(isConst);
1745
+ case TokenKind.BRACE_L:
1746
+ return this.parseObject(isConst);
1747
+ case TokenKind.INT:
1748
+ this.advanceLexer();
1749
+ return this.node(token, {
1750
+ kind: Kind.INT,
1751
+ value: token.value
1752
+ });
1753
+ case TokenKind.FLOAT:
1754
+ this.advanceLexer();
1755
+ return this.node(token, {
1756
+ kind: Kind.FLOAT,
1757
+ value: token.value
1758
+ });
1759
+ case TokenKind.STRING:
1760
+ case TokenKind.BLOCK_STRING:
1761
+ return this.parseStringLiteral();
1762
+ case TokenKind.NAME:
1763
+ this.advanceLexer();
1764
+ switch (token.value) {
1765
+ case "true":
1766
+ return this.node(token, {
1767
+ kind: Kind.BOOLEAN,
1768
+ value: true
1769
+ });
1770
+ case "false":
1771
+ return this.node(token, {
1772
+ kind: Kind.BOOLEAN,
1773
+ value: false
1774
+ });
1775
+ case "null":
1776
+ return this.node(token, {
1777
+ kind: Kind.NULL
1778
+ });
1779
+ default:
1780
+ return this.node(token, {
1781
+ kind: Kind.ENUM,
1782
+ value: token.value
1783
+ });
1784
+ }
1785
+ case TokenKind.DOLLAR:
1786
+ if (isConst) {
1787
+ this.expectToken(TokenKind.DOLLAR);
1788
+ if (this._lexer.token.kind === TokenKind.NAME) {
1789
+ const varName = this._lexer.token.value;
1790
+ throw syntaxError(
1791
+ this._lexer.source,
1792
+ token.start,
1793
+ `Unexpected variable "$${varName}" in constant value.`
1794
+ );
1795
+ } else {
1796
+ throw this.unexpected(token);
1797
+ }
1798
+ }
1799
+ return this.parseVariable();
1800
+ default:
1801
+ throw this.unexpected();
1802
+ }
1803
+ }
1804
+ parseConstValueLiteral() {
1805
+ return this.parseValueLiteral(true);
1806
+ }
1807
+ parseStringLiteral() {
1808
+ const token = this._lexer.token;
1809
+ this.advanceLexer();
1810
+ return this.node(token, {
1811
+ kind: Kind.STRING,
1812
+ value: token.value,
1813
+ block: token.kind === TokenKind.BLOCK_STRING
1814
+ });
1815
+ }
1816
+ /**
1817
+ * ListValue[Const] :
1818
+ * - [ ]
1819
+ * - [ Value[?Const]+ ]
1820
+ */
1821
+ parseList(isConst) {
1822
+ const item = () => this.parseValueLiteral(isConst);
1823
+ return this.node(this._lexer.token, {
1824
+ kind: Kind.LIST,
1825
+ values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R)
1826
+ });
1827
+ }
1828
+ /**
1829
+ * ```
1830
+ * ObjectValue[Const] :
1831
+ * - { }
1832
+ * - { ObjectField[?Const]+ }
1833
+ * ```
1834
+ */
1835
+ parseObject(isConst) {
1836
+ const item = () => this.parseObjectField(isConst);
1837
+ return this.node(this._lexer.token, {
1838
+ kind: Kind.OBJECT,
1839
+ fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R)
1840
+ });
1841
+ }
1842
+ /**
1843
+ * ObjectField[Const] : Name : Value[?Const]
1844
+ */
1845
+ parseObjectField(isConst) {
1846
+ const start2 = this._lexer.token;
1847
+ const name = this.parseName();
1848
+ this.expectToken(TokenKind.COLON);
1849
+ return this.node(start2, {
1850
+ kind: Kind.OBJECT_FIELD,
1851
+ name,
1852
+ value: this.parseValueLiteral(isConst)
1853
+ });
1854
+ }
1855
+ // Implements the parsing rules in the Directives section.
1856
+ /**
1857
+ * Directives[Const] : Directive[?Const]+
1858
+ */
1859
+ parseDirectives(isConst) {
1860
+ const directives = [];
1861
+ while (this.peek(TokenKind.AT)) {
1862
+ directives.push(this.parseDirective(isConst));
1863
+ }
1864
+ return directives;
1865
+ }
1866
+ parseConstDirectives() {
1867
+ return this.parseDirectives(true);
1868
+ }
1869
+ /**
1870
+ * ```
1871
+ * Directive[Const] : @ Name Arguments[?Const]?
1872
+ * ```
1873
+ */
1874
+ parseDirective(isConst) {
1875
+ const start2 = this._lexer.token;
1876
+ this.expectToken(TokenKind.AT);
1877
+ return this.node(start2, {
1878
+ kind: Kind.DIRECTIVE,
1879
+ name: this.parseName(),
1880
+ arguments: this.parseArguments(isConst)
1881
+ });
1882
+ }
1883
+ // Implements the parsing rules in the Types section.
1884
+ /**
1885
+ * Type :
1886
+ * - NamedType
1887
+ * - ListType
1888
+ * - NonNullType
1889
+ */
1890
+ parseTypeReference() {
1891
+ const start2 = this._lexer.token;
1892
+ let type;
1893
+ if (this.expectOptionalToken(TokenKind.BRACKET_L)) {
1894
+ const innerType = this.parseTypeReference();
1895
+ this.expectToken(TokenKind.BRACKET_R);
1896
+ type = this.node(start2, {
1897
+ kind: Kind.LIST_TYPE,
1898
+ type: innerType
1899
+ });
1900
+ } else {
1901
+ type = this.parseNamedType();
1902
+ }
1903
+ if (this.expectOptionalToken(TokenKind.BANG)) {
1904
+ return this.node(start2, {
1905
+ kind: Kind.NON_NULL_TYPE,
1906
+ type
1907
+ });
1908
+ }
1909
+ return type;
1910
+ }
1911
+ /**
1912
+ * NamedType : Name
1913
+ */
1914
+ parseNamedType() {
1915
+ return this.node(this._lexer.token, {
1916
+ kind: Kind.NAMED_TYPE,
1917
+ name: this.parseName()
1918
+ });
1919
+ }
1920
+ // Implements the parsing rules in the Type Definition section.
1921
+ peekDescription() {
1922
+ return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);
1923
+ }
1924
+ /**
1925
+ * Description : StringValue
1926
+ */
1927
+ parseDescription() {
1928
+ if (this.peekDescription()) {
1929
+ return this.parseStringLiteral();
1930
+ }
1931
+ }
1932
+ /**
1933
+ * ```
1934
+ * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
1935
+ * ```
1936
+ */
1937
+ parseSchemaDefinition() {
1938
+ const start2 = this._lexer.token;
1939
+ const description = this.parseDescription();
1940
+ this.expectKeyword("schema");
1941
+ const directives = this.parseConstDirectives();
1942
+ const operationTypes = this.many(
1943
+ TokenKind.BRACE_L,
1944
+ this.parseOperationTypeDefinition,
1945
+ TokenKind.BRACE_R
1946
+ );
1947
+ return this.node(start2, {
1948
+ kind: Kind.SCHEMA_DEFINITION,
1949
+ description,
1950
+ directives,
1951
+ operationTypes
1952
+ });
1953
+ }
1954
+ /**
1955
+ * OperationTypeDefinition : OperationType : NamedType
1956
+ */
1957
+ parseOperationTypeDefinition() {
1958
+ const start2 = this._lexer.token;
1959
+ const operation = this.parseOperationType();
1960
+ this.expectToken(TokenKind.COLON);
1961
+ const type = this.parseNamedType();
1962
+ return this.node(start2, {
1963
+ kind: Kind.OPERATION_TYPE_DEFINITION,
1964
+ operation,
1965
+ type
1966
+ });
1967
+ }
1968
+ /**
1969
+ * ScalarTypeDefinition : Description? scalar Name Directives[Const]?
1970
+ */
1971
+ parseScalarTypeDefinition() {
1972
+ const start2 = this._lexer.token;
1973
+ const description = this.parseDescription();
1974
+ this.expectKeyword("scalar");
1975
+ const name = this.parseName();
1976
+ const directives = this.parseConstDirectives();
1977
+ return this.node(start2, {
1978
+ kind: Kind.SCALAR_TYPE_DEFINITION,
1979
+ description,
1980
+ name,
1981
+ directives
1982
+ });
1983
+ }
1984
+ /**
1985
+ * ObjectTypeDefinition :
1986
+ * Description?
1987
+ * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
1988
+ */
1989
+ parseObjectTypeDefinition() {
1990
+ const start2 = this._lexer.token;
1991
+ const description = this.parseDescription();
1992
+ this.expectKeyword("type");
1993
+ const name = this.parseName();
1994
+ const interfaces = this.parseImplementsInterfaces();
1995
+ const directives = this.parseConstDirectives();
1996
+ const fields = this.parseFieldsDefinition();
1997
+ return this.node(start2, {
1998
+ kind: Kind.OBJECT_TYPE_DEFINITION,
1999
+ description,
2000
+ name,
2001
+ interfaces,
2002
+ directives,
2003
+ fields
2004
+ });
2005
+ }
2006
+ /**
2007
+ * ImplementsInterfaces :
2008
+ * - implements `&`? NamedType
2009
+ * - ImplementsInterfaces & NamedType
2010
+ */
2011
+ parseImplementsInterfaces() {
2012
+ return this.expectOptionalKeyword("implements") ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) : [];
2013
+ }
2014
+ /**
2015
+ * ```
2016
+ * FieldsDefinition : { FieldDefinition+ }
2017
+ * ```
2018
+ */
2019
+ parseFieldsDefinition() {
2020
+ return this.optionalMany(
2021
+ TokenKind.BRACE_L,
2022
+ this.parseFieldDefinition,
2023
+ TokenKind.BRACE_R
2024
+ );
2025
+ }
2026
+ /**
2027
+ * FieldDefinition :
2028
+ * - Description? Name ArgumentsDefinition? : Type Directives[Const]?
2029
+ */
2030
+ parseFieldDefinition() {
2031
+ const start2 = this._lexer.token;
2032
+ const description = this.parseDescription();
2033
+ const name = this.parseName();
2034
+ const args = this.parseArgumentDefs();
2035
+ this.expectToken(TokenKind.COLON);
2036
+ const type = this.parseTypeReference();
2037
+ const directives = this.parseConstDirectives();
2038
+ return this.node(start2, {
2039
+ kind: Kind.FIELD_DEFINITION,
2040
+ description,
2041
+ name,
2042
+ arguments: args,
2043
+ type,
2044
+ directives
2045
+ });
2046
+ }
2047
+ /**
2048
+ * ArgumentsDefinition : ( InputValueDefinition+ )
2049
+ */
2050
+ parseArgumentDefs() {
2051
+ return this.optionalMany(
2052
+ TokenKind.PAREN_L,
2053
+ this.parseInputValueDef,
2054
+ TokenKind.PAREN_R
2055
+ );
2056
+ }
2057
+ /**
2058
+ * InputValueDefinition :
2059
+ * - Description? Name : Type DefaultValue? Directives[Const]?
2060
+ */
2061
+ parseInputValueDef() {
2062
+ const start2 = this._lexer.token;
2063
+ const description = this.parseDescription();
2064
+ const name = this.parseName();
2065
+ this.expectToken(TokenKind.COLON);
2066
+ const type = this.parseTypeReference();
2067
+ let defaultValue;
2068
+ if (this.expectOptionalToken(TokenKind.EQUALS)) {
2069
+ defaultValue = this.parseConstValueLiteral();
2070
+ }
2071
+ const directives = this.parseConstDirectives();
2072
+ return this.node(start2, {
2073
+ kind: Kind.INPUT_VALUE_DEFINITION,
2074
+ description,
2075
+ name,
2076
+ type,
2077
+ defaultValue,
2078
+ directives
2079
+ });
2080
+ }
2081
+ /**
2082
+ * InterfaceTypeDefinition :
2083
+ * - Description? interface Name Directives[Const]? FieldsDefinition?
2084
+ */
2085
+ parseInterfaceTypeDefinition() {
2086
+ const start2 = this._lexer.token;
2087
+ const description = this.parseDescription();
2088
+ this.expectKeyword("interface");
2089
+ const name = this.parseName();
2090
+ const interfaces = this.parseImplementsInterfaces();
2091
+ const directives = this.parseConstDirectives();
2092
+ const fields = this.parseFieldsDefinition();
2093
+ return this.node(start2, {
2094
+ kind: Kind.INTERFACE_TYPE_DEFINITION,
2095
+ description,
2096
+ name,
2097
+ interfaces,
2098
+ directives,
2099
+ fields
2100
+ });
2101
+ }
2102
+ /**
2103
+ * UnionTypeDefinition :
2104
+ * - Description? union Name Directives[Const]? UnionMemberTypes?
2105
+ */
2106
+ parseUnionTypeDefinition() {
2107
+ const start2 = this._lexer.token;
2108
+ const description = this.parseDescription();
2109
+ this.expectKeyword("union");
2110
+ const name = this.parseName();
2111
+ const directives = this.parseConstDirectives();
2112
+ const types = this.parseUnionMemberTypes();
2113
+ return this.node(start2, {
2114
+ kind: Kind.UNION_TYPE_DEFINITION,
2115
+ description,
2116
+ name,
2117
+ directives,
2118
+ types
2119
+ });
2120
+ }
2121
+ /**
2122
+ * UnionMemberTypes :
2123
+ * - = `|`? NamedType
2124
+ * - UnionMemberTypes | NamedType
2125
+ */
2126
+ parseUnionMemberTypes() {
2127
+ return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : [];
2128
+ }
2129
+ /**
2130
+ * EnumTypeDefinition :
2131
+ * - Description? enum Name Directives[Const]? EnumValuesDefinition?
2132
+ */
2133
+ parseEnumTypeDefinition() {
2134
+ const start2 = this._lexer.token;
2135
+ const description = this.parseDescription();
2136
+ this.expectKeyword("enum");
2137
+ const name = this.parseName();
2138
+ const directives = this.parseConstDirectives();
2139
+ const values = this.parseEnumValuesDefinition();
2140
+ return this.node(start2, {
2141
+ kind: Kind.ENUM_TYPE_DEFINITION,
2142
+ description,
2143
+ name,
2144
+ directives,
2145
+ values
2146
+ });
2147
+ }
2148
+ /**
2149
+ * ```
2150
+ * EnumValuesDefinition : { EnumValueDefinition+ }
2151
+ * ```
2152
+ */
2153
+ parseEnumValuesDefinition() {
2154
+ return this.optionalMany(
2155
+ TokenKind.BRACE_L,
2156
+ this.parseEnumValueDefinition,
2157
+ TokenKind.BRACE_R
2158
+ );
2159
+ }
2160
+ /**
2161
+ * EnumValueDefinition : Description? EnumValue Directives[Const]?
2162
+ */
2163
+ parseEnumValueDefinition() {
2164
+ const start2 = this._lexer.token;
2165
+ const description = this.parseDescription();
2166
+ const name = this.parseEnumValueName();
2167
+ const directives = this.parseConstDirectives();
2168
+ return this.node(start2, {
2169
+ kind: Kind.ENUM_VALUE_DEFINITION,
2170
+ description,
2171
+ name,
2172
+ directives
2173
+ });
2174
+ }
2175
+ /**
2176
+ * EnumValue : Name but not `true`, `false` or `null`
2177
+ */
2178
+ parseEnumValueName() {
2179
+ if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") {
2180
+ throw syntaxError(
2181
+ this._lexer.source,
2182
+ this._lexer.token.start,
2183
+ `${getTokenDesc(
2184
+ this._lexer.token
2185
+ )} is reserved and cannot be used for an enum value.`
2186
+ );
2187
+ }
2188
+ return this.parseName();
2189
+ }
2190
+ /**
2191
+ * InputObjectTypeDefinition :
2192
+ * - Description? input Name Directives[Const]? InputFieldsDefinition?
2193
+ */
2194
+ parseInputObjectTypeDefinition() {
2195
+ const start2 = this._lexer.token;
2196
+ const description = this.parseDescription();
2197
+ this.expectKeyword("input");
2198
+ const name = this.parseName();
2199
+ const directives = this.parseConstDirectives();
2200
+ const fields = this.parseInputFieldsDefinition();
2201
+ return this.node(start2, {
2202
+ kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,
2203
+ description,
2204
+ name,
2205
+ directives,
2206
+ fields
2207
+ });
2208
+ }
2209
+ /**
2210
+ * ```
2211
+ * InputFieldsDefinition : { InputValueDefinition+ }
2212
+ * ```
2213
+ */
2214
+ parseInputFieldsDefinition() {
2215
+ return this.optionalMany(
2216
+ TokenKind.BRACE_L,
2217
+ this.parseInputValueDef,
2218
+ TokenKind.BRACE_R
2219
+ );
2220
+ }
2221
+ /**
2222
+ * TypeSystemExtension :
2223
+ * - SchemaExtension
2224
+ * - TypeExtension
2225
+ *
2226
+ * TypeExtension :
2227
+ * - ScalarTypeExtension
2228
+ * - ObjectTypeExtension
2229
+ * - InterfaceTypeExtension
2230
+ * - UnionTypeExtension
2231
+ * - EnumTypeExtension
2232
+ * - InputObjectTypeDefinition
2233
+ */
2234
+ parseTypeSystemExtension() {
2235
+ const keywordToken = this._lexer.lookahead();
2236
+ if (keywordToken.kind === TokenKind.NAME) {
2237
+ switch (keywordToken.value) {
2238
+ case "schema":
2239
+ return this.parseSchemaExtension();
2240
+ case "scalar":
2241
+ return this.parseScalarTypeExtension();
2242
+ case "type":
2243
+ return this.parseObjectTypeExtension();
2244
+ case "interface":
2245
+ return this.parseInterfaceTypeExtension();
2246
+ case "union":
2247
+ return this.parseUnionTypeExtension();
2248
+ case "enum":
2249
+ return this.parseEnumTypeExtension();
2250
+ case "input":
2251
+ return this.parseInputObjectTypeExtension();
2252
+ }
2253
+ }
2254
+ throw this.unexpected(keywordToken);
2255
+ }
2256
+ /**
2257
+ * ```
2258
+ * SchemaExtension :
2259
+ * - extend schema Directives[Const]? { OperationTypeDefinition+ }
2260
+ * - extend schema Directives[Const]
2261
+ * ```
2262
+ */
2263
+ parseSchemaExtension() {
2264
+ const start2 = this._lexer.token;
2265
+ this.expectKeyword("extend");
2266
+ this.expectKeyword("schema");
2267
+ const directives = this.parseConstDirectives();
2268
+ const operationTypes = this.optionalMany(
2269
+ TokenKind.BRACE_L,
2270
+ this.parseOperationTypeDefinition,
2271
+ TokenKind.BRACE_R
2272
+ );
2273
+ if (directives.length === 0 && operationTypes.length === 0) {
2274
+ throw this.unexpected();
2275
+ }
2276
+ return this.node(start2, {
2277
+ kind: Kind.SCHEMA_EXTENSION,
2278
+ directives,
2279
+ operationTypes
2280
+ });
2281
+ }
2282
+ /**
2283
+ * ScalarTypeExtension :
2284
+ * - extend scalar Name Directives[Const]
2285
+ */
2286
+ parseScalarTypeExtension() {
2287
+ const start2 = this._lexer.token;
2288
+ this.expectKeyword("extend");
2289
+ this.expectKeyword("scalar");
2290
+ const name = this.parseName();
2291
+ const directives = this.parseConstDirectives();
2292
+ if (directives.length === 0) {
2293
+ throw this.unexpected();
2294
+ }
2295
+ return this.node(start2, {
2296
+ kind: Kind.SCALAR_TYPE_EXTENSION,
2297
+ name,
2298
+ directives
2299
+ });
2300
+ }
2301
+ /**
2302
+ * ObjectTypeExtension :
2303
+ * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
2304
+ * - extend type Name ImplementsInterfaces? Directives[Const]
2305
+ * - extend type Name ImplementsInterfaces
2306
+ */
2307
+ parseObjectTypeExtension() {
2308
+ const start2 = this._lexer.token;
2309
+ this.expectKeyword("extend");
2310
+ this.expectKeyword("type");
2311
+ const name = this.parseName();
2312
+ const interfaces = this.parseImplementsInterfaces();
2313
+ const directives = this.parseConstDirectives();
2314
+ const fields = this.parseFieldsDefinition();
2315
+ if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {
2316
+ throw this.unexpected();
2317
+ }
2318
+ return this.node(start2, {
2319
+ kind: Kind.OBJECT_TYPE_EXTENSION,
2320
+ name,
2321
+ interfaces,
2322
+ directives,
2323
+ fields
2324
+ });
2325
+ }
2326
+ /**
2327
+ * InterfaceTypeExtension :
2328
+ * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
2329
+ * - extend interface Name ImplementsInterfaces? Directives[Const]
2330
+ * - extend interface Name ImplementsInterfaces
2331
+ */
2332
+ parseInterfaceTypeExtension() {
2333
+ const start2 = this._lexer.token;
2334
+ this.expectKeyword("extend");
2335
+ this.expectKeyword("interface");
2336
+ const name = this.parseName();
2337
+ const interfaces = this.parseImplementsInterfaces();
2338
+ const directives = this.parseConstDirectives();
2339
+ const fields = this.parseFieldsDefinition();
2340
+ if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {
2341
+ throw this.unexpected();
2342
+ }
2343
+ return this.node(start2, {
2344
+ kind: Kind.INTERFACE_TYPE_EXTENSION,
2345
+ name,
2346
+ interfaces,
2347
+ directives,
2348
+ fields
2349
+ });
2350
+ }
2351
+ /**
2352
+ * UnionTypeExtension :
2353
+ * - extend union Name Directives[Const]? UnionMemberTypes
2354
+ * - extend union Name Directives[Const]
2355
+ */
2356
+ parseUnionTypeExtension() {
2357
+ const start2 = this._lexer.token;
2358
+ this.expectKeyword("extend");
2359
+ this.expectKeyword("union");
2360
+ const name = this.parseName();
2361
+ const directives = this.parseConstDirectives();
2362
+ const types = this.parseUnionMemberTypes();
2363
+ if (directives.length === 0 && types.length === 0) {
2364
+ throw this.unexpected();
2365
+ }
2366
+ return this.node(start2, {
2367
+ kind: Kind.UNION_TYPE_EXTENSION,
2368
+ name,
2369
+ directives,
2370
+ types
2371
+ });
2372
+ }
2373
+ /**
2374
+ * EnumTypeExtension :
2375
+ * - extend enum Name Directives[Const]? EnumValuesDefinition
2376
+ * - extend enum Name Directives[Const]
2377
+ */
2378
+ parseEnumTypeExtension() {
2379
+ const start2 = this._lexer.token;
2380
+ this.expectKeyword("extend");
2381
+ this.expectKeyword("enum");
2382
+ const name = this.parseName();
2383
+ const directives = this.parseConstDirectives();
2384
+ const values = this.parseEnumValuesDefinition();
2385
+ if (directives.length === 0 && values.length === 0) {
2386
+ throw this.unexpected();
2387
+ }
2388
+ return this.node(start2, {
2389
+ kind: Kind.ENUM_TYPE_EXTENSION,
2390
+ name,
2391
+ directives,
2392
+ values
2393
+ });
2394
+ }
2395
+ /**
2396
+ * InputObjectTypeExtension :
2397
+ * - extend input Name Directives[Const]? InputFieldsDefinition
2398
+ * - extend input Name Directives[Const]
2399
+ */
2400
+ parseInputObjectTypeExtension() {
2401
+ const start2 = this._lexer.token;
2402
+ this.expectKeyword("extend");
2403
+ this.expectKeyword("input");
2404
+ const name = this.parseName();
2405
+ const directives = this.parseConstDirectives();
2406
+ const fields = this.parseInputFieldsDefinition();
2407
+ if (directives.length === 0 && fields.length === 0) {
2408
+ throw this.unexpected();
2409
+ }
2410
+ return this.node(start2, {
2411
+ kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,
2412
+ name,
2413
+ directives,
2414
+ fields
2415
+ });
2416
+ }
2417
+ /**
2418
+ * ```
2419
+ * DirectiveDefinition :
2420
+ * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
2421
+ * ```
2422
+ */
2423
+ parseDirectiveDefinition() {
2424
+ const start2 = this._lexer.token;
2425
+ const description = this.parseDescription();
2426
+ this.expectKeyword("directive");
2427
+ this.expectToken(TokenKind.AT);
2428
+ const name = this.parseName();
2429
+ const args = this.parseArgumentDefs();
2430
+ const repeatable = this.expectOptionalKeyword("repeatable");
2431
+ this.expectKeyword("on");
2432
+ const locations = this.parseDirectiveLocations();
2433
+ return this.node(start2, {
2434
+ kind: Kind.DIRECTIVE_DEFINITION,
2435
+ description,
2436
+ name,
2437
+ arguments: args,
2438
+ repeatable,
2439
+ locations
2440
+ });
2441
+ }
2442
+ /**
2443
+ * DirectiveLocations :
2444
+ * - `|`? DirectiveLocation
2445
+ * - DirectiveLocations | DirectiveLocation
2446
+ */
2447
+ parseDirectiveLocations() {
2448
+ return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);
2449
+ }
2450
+ /*
2451
+ * DirectiveLocation :
2452
+ * - ExecutableDirectiveLocation
2453
+ * - TypeSystemDirectiveLocation
2454
+ *
2455
+ * ExecutableDirectiveLocation : one of
2456
+ * `QUERY`
2457
+ * `MUTATION`
2458
+ * `SUBSCRIPTION`
2459
+ * `FIELD`
2460
+ * `FRAGMENT_DEFINITION`
2461
+ * `FRAGMENT_SPREAD`
2462
+ * `INLINE_FRAGMENT`
2463
+ *
2464
+ * TypeSystemDirectiveLocation : one of
2465
+ * `SCHEMA`
2466
+ * `SCALAR`
2467
+ * `OBJECT`
2468
+ * `FIELD_DEFINITION`
2469
+ * `ARGUMENT_DEFINITION`
2470
+ * `INTERFACE`
2471
+ * `UNION`
2472
+ * `ENUM`
2473
+ * `ENUM_VALUE`
2474
+ * `INPUT_OBJECT`
2475
+ * `INPUT_FIELD_DEFINITION`
2476
+ */
2477
+ parseDirectiveLocation() {
2478
+ const start2 = this._lexer.token;
2479
+ const name = this.parseName();
2480
+ if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) {
2481
+ return name;
2482
+ }
2483
+ throw this.unexpected(start2);
2484
+ }
2485
+ // Core parsing utility functions
2486
+ /**
2487
+ * Returns a node that, if configured to do so, sets a "loc" field as a
2488
+ * location object, used to identify the place in the source that created a
2489
+ * given parsed object.
2490
+ */
2491
+ node(startToken, node) {
2492
+ if (this._options.noLocation !== true) {
2493
+ node.loc = new Location(
2494
+ startToken,
2495
+ this._lexer.lastToken,
2496
+ this._lexer.source
2497
+ );
2498
+ }
2499
+ return node;
2500
+ }
2501
+ /**
2502
+ * Determines if the next token is of a given kind
2503
+ */
2504
+ peek(kind) {
2505
+ return this._lexer.token.kind === kind;
2506
+ }
2507
+ /**
2508
+ * If the next token is of the given kind, return that token after advancing the lexer.
2509
+ * Otherwise, do not change the parser state and throw an error.
2510
+ */
2511
+ expectToken(kind) {
2512
+ const token = this._lexer.token;
2513
+ if (token.kind === kind) {
2514
+ this.advanceLexer();
2515
+ return token;
2516
+ }
2517
+ throw syntaxError(
2518
+ this._lexer.source,
2519
+ token.start,
2520
+ `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`
2521
+ );
2522
+ }
2523
+ /**
2524
+ * If the next token is of the given kind, return "true" after advancing the lexer.
2525
+ * Otherwise, do not change the parser state and return "false".
2526
+ */
2527
+ expectOptionalToken(kind) {
2528
+ const token = this._lexer.token;
2529
+ if (token.kind === kind) {
2530
+ this.advanceLexer();
2531
+ return true;
2532
+ }
2533
+ return false;
2534
+ }
2535
+ /**
2536
+ * If the next token is a given keyword, advance the lexer.
2537
+ * Otherwise, do not change the parser state and throw an error.
2538
+ */
2539
+ expectKeyword(value) {
2540
+ const token = this._lexer.token;
2541
+ if (token.kind === TokenKind.NAME && token.value === value) {
2542
+ this.advanceLexer();
2543
+ } else {
2544
+ throw syntaxError(
2545
+ this._lexer.source,
2546
+ token.start,
2547
+ `Expected "${value}", found ${getTokenDesc(token)}.`
2548
+ );
2549
+ }
2550
+ }
2551
+ /**
2552
+ * If the next token is a given keyword, return "true" after advancing the lexer.
2553
+ * Otherwise, do not change the parser state and return "false".
2554
+ */
2555
+ expectOptionalKeyword(value) {
2556
+ const token = this._lexer.token;
2557
+ if (token.kind === TokenKind.NAME && token.value === value) {
2558
+ this.advanceLexer();
2559
+ return true;
2560
+ }
2561
+ return false;
2562
+ }
2563
+ /**
2564
+ * Helper function for creating an error when an unexpected lexed token is encountered.
2565
+ */
2566
+ unexpected(atToken) {
2567
+ const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;
2568
+ return syntaxError(
2569
+ this._lexer.source,
2570
+ token.start,
2571
+ `Unexpected ${getTokenDesc(token)}.`
2572
+ );
2573
+ }
2574
+ /**
2575
+ * Returns a possibly empty list of parse nodes, determined by the parseFn.
2576
+ * This list begins with a lex token of openKind and ends with a lex token of closeKind.
2577
+ * Advances the parser to the next lex token after the closing token.
2578
+ */
2579
+ any(openKind, parseFn, closeKind) {
2580
+ this.expectToken(openKind);
2581
+ const nodes = [];
2582
+ while (!this.expectOptionalToken(closeKind)) {
2583
+ nodes.push(parseFn.call(this));
2584
+ }
2585
+ return nodes;
2586
+ }
2587
+ /**
2588
+ * Returns a list of parse nodes, determined by the parseFn.
2589
+ * It can be empty only if open token is missing otherwise it will always return non-empty list
2590
+ * that begins with a lex token of openKind and ends with a lex token of closeKind.
2591
+ * Advances the parser to the next lex token after the closing token.
2592
+ */
2593
+ optionalMany(openKind, parseFn, closeKind) {
2594
+ if (this.expectOptionalToken(openKind)) {
2595
+ const nodes = [];
2596
+ do {
2597
+ nodes.push(parseFn.call(this));
2598
+ } while (!this.expectOptionalToken(closeKind));
2599
+ return nodes;
2600
+ }
2601
+ return [];
2602
+ }
2603
+ /**
2604
+ * Returns a non-empty list of parse nodes, determined by the parseFn.
2605
+ * This list begins with a lex token of openKind and ends with a lex token of closeKind.
2606
+ * Advances the parser to the next lex token after the closing token.
2607
+ */
2608
+ many(openKind, parseFn, closeKind) {
2609
+ this.expectToken(openKind);
2610
+ const nodes = [];
2611
+ do {
2612
+ nodes.push(parseFn.call(this));
2613
+ } while (!this.expectOptionalToken(closeKind));
2614
+ return nodes;
2615
+ }
2616
+ /**
2617
+ * Returns a non-empty list of parse nodes, determined by the parseFn.
2618
+ * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
2619
+ * Advances the parser to the next lex token after last item in the list.
2620
+ */
2621
+ delimitedMany(delimiterKind, parseFn) {
2622
+ this.expectOptionalToken(delimiterKind);
2623
+ const nodes = [];
2624
+ do {
2625
+ nodes.push(parseFn.call(this));
2626
+ } while (this.expectOptionalToken(delimiterKind));
2627
+ return nodes;
2628
+ }
2629
+ advanceLexer() {
2630
+ const { maxTokens } = this._options;
2631
+ const token = this._lexer.advance();
2632
+ if (maxTokens !== void 0 && token.kind !== TokenKind.EOF) {
2633
+ ++this._tokenCounter;
2634
+ if (this._tokenCounter > maxTokens) {
2635
+ throw syntaxError(
2636
+ this._lexer.source,
2637
+ token.start,
2638
+ `Document contains more that ${maxTokens} tokens. Parsing aborted.`
2639
+ );
2640
+ }
2641
+ }
2642
+ }
2643
+ }
2644
+ function getTokenDesc(token) {
2645
+ const value = token.value;
2646
+ return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : "");
2647
+ }
2648
+ function getTokenKindDesc(kind) {
2649
+ return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind;
2650
+ }
2651
+ function printString(str) {
2652
+ return `"${str.replace(escapedRegExp, escapedReplacer)}"`;
2653
+ }
2654
+ const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
2655
+ function escapedReplacer(str) {
2656
+ return escapeSequences[str.charCodeAt(0)];
2657
+ }
2658
+ const escapeSequences = [
2659
+ "\\u0000",
2660
+ "\\u0001",
2661
+ "\\u0002",
2662
+ "\\u0003",
2663
+ "\\u0004",
2664
+ "\\u0005",
2665
+ "\\u0006",
2666
+ "\\u0007",
2667
+ "\\b",
2668
+ "\\t",
2669
+ "\\n",
2670
+ "\\u000B",
2671
+ "\\f",
2672
+ "\\r",
2673
+ "\\u000E",
2674
+ "\\u000F",
2675
+ "\\u0010",
2676
+ "\\u0011",
2677
+ "\\u0012",
2678
+ "\\u0013",
2679
+ "\\u0014",
2680
+ "\\u0015",
2681
+ "\\u0016",
2682
+ "\\u0017",
2683
+ "\\u0018",
2684
+ "\\u0019",
2685
+ "\\u001A",
2686
+ "\\u001B",
2687
+ "\\u001C",
2688
+ "\\u001D",
2689
+ "\\u001E",
2690
+ "\\u001F",
2691
+ "",
2692
+ "",
2693
+ '\\"',
2694
+ "",
2695
+ "",
2696
+ "",
2697
+ "",
2698
+ "",
2699
+ "",
2700
+ "",
2701
+ "",
2702
+ "",
2703
+ "",
2704
+ "",
2705
+ "",
2706
+ "",
2707
+ // 2F
2708
+ "",
2709
+ "",
2710
+ "",
2711
+ "",
2712
+ "",
2713
+ "",
2714
+ "",
2715
+ "",
2716
+ "",
2717
+ "",
2718
+ "",
2719
+ "",
2720
+ "",
2721
+ "",
2722
+ "",
2723
+ "",
2724
+ // 3F
2725
+ "",
2726
+ "",
2727
+ "",
2728
+ "",
2729
+ "",
2730
+ "",
2731
+ "",
2732
+ "",
2733
+ "",
2734
+ "",
2735
+ "",
2736
+ "",
2737
+ "",
2738
+ "",
2739
+ "",
2740
+ "",
2741
+ // 4F
2742
+ "",
2743
+ "",
2744
+ "",
2745
+ "",
2746
+ "",
2747
+ "",
2748
+ "",
2749
+ "",
2750
+ "",
2751
+ "",
2752
+ "",
2753
+ "",
2754
+ "\\\\",
2755
+ "",
2756
+ "",
2757
+ "",
2758
+ // 5F
2759
+ "",
2760
+ "",
2761
+ "",
2762
+ "",
2763
+ "",
2764
+ "",
2765
+ "",
2766
+ "",
2767
+ "",
2768
+ "",
2769
+ "",
2770
+ "",
2771
+ "",
2772
+ "",
2773
+ "",
2774
+ "",
2775
+ // 6F
2776
+ "",
2777
+ "",
2778
+ "",
2779
+ "",
2780
+ "",
2781
+ "",
2782
+ "",
2783
+ "",
2784
+ "",
2785
+ "",
2786
+ "",
2787
+ "",
2788
+ "",
2789
+ "",
2790
+ "",
2791
+ "\\u007F",
2792
+ "\\u0080",
2793
+ "\\u0081",
2794
+ "\\u0082",
2795
+ "\\u0083",
2796
+ "\\u0084",
2797
+ "\\u0085",
2798
+ "\\u0086",
2799
+ "\\u0087",
2800
+ "\\u0088",
2801
+ "\\u0089",
2802
+ "\\u008A",
2803
+ "\\u008B",
2804
+ "\\u008C",
2805
+ "\\u008D",
2806
+ "\\u008E",
2807
+ "\\u008F",
2808
+ "\\u0090",
2809
+ "\\u0091",
2810
+ "\\u0092",
2811
+ "\\u0093",
2812
+ "\\u0094",
2813
+ "\\u0095",
2814
+ "\\u0096",
2815
+ "\\u0097",
2816
+ "\\u0098",
2817
+ "\\u0099",
2818
+ "\\u009A",
2819
+ "\\u009B",
2820
+ "\\u009C",
2821
+ "\\u009D",
2822
+ "\\u009E",
2823
+ "\\u009F"
2824
+ ];
2825
+ const BREAK = Object.freeze({});
2826
+ function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
2827
+ const enterLeaveMap = /* @__PURE__ */ new Map();
2828
+ for (const kind of Object.values(Kind)) {
2829
+ enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
2830
+ }
2831
+ let stack = void 0;
2832
+ let inArray = Array.isArray(root);
2833
+ let keys = [root];
2834
+ let index = -1;
2835
+ let edits = [];
2836
+ let node = root;
2837
+ let key = void 0;
2838
+ let parent = void 0;
2839
+ const path = [];
2840
+ const ancestors = [];
2841
+ do {
2842
+ index++;
2843
+ const isLeaving = index === keys.length;
2844
+ const isEdited = isLeaving && edits.length !== 0;
2845
+ if (isLeaving) {
2846
+ key = ancestors.length === 0 ? void 0 : path[path.length - 1];
2847
+ node = parent;
2848
+ parent = ancestors.pop();
2849
+ if (isEdited) {
2850
+ if (inArray) {
2851
+ node = node.slice();
2852
+ let editOffset = 0;
2853
+ for (const [editKey, editValue] of edits) {
2854
+ const arrayKey = editKey - editOffset;
2855
+ if (editValue === null) {
2856
+ node.splice(arrayKey, 1);
2857
+ editOffset++;
2858
+ } else {
2859
+ node[arrayKey] = editValue;
2860
+ }
2861
+ }
2862
+ } else {
2863
+ node = Object.defineProperties(
2864
+ {},
2865
+ Object.getOwnPropertyDescriptors(node)
2866
+ );
2867
+ for (const [editKey, editValue] of edits) {
2868
+ node[editKey] = editValue;
2869
+ }
2870
+ }
2871
+ }
2872
+ index = stack.index;
2873
+ keys = stack.keys;
2874
+ edits = stack.edits;
2875
+ inArray = stack.inArray;
2876
+ stack = stack.prev;
2877
+ } else if (parent) {
2878
+ key = inArray ? index : keys[index];
2879
+ node = parent[key];
2880
+ if (node === null || node === void 0) {
2881
+ continue;
2882
+ }
2883
+ path.push(key);
2884
+ }
2885
+ let result;
2886
+ if (!Array.isArray(node)) {
2887
+ var _enterLeaveMap$get, _enterLeaveMap$get2;
2888
+ isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);
2889
+ const visitFn = isLeaving ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get === void 0 ? void 0 : _enterLeaveMap$get.leave : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get2 === void 0 ? void 0 : _enterLeaveMap$get2.enter;
2890
+ result = visitFn === null || visitFn === void 0 ? void 0 : visitFn.call(visitor, node, key, parent, path, ancestors);
2891
+ if (result === BREAK) {
2892
+ break;
2893
+ }
2894
+ if (result === false) {
2895
+ if (!isLeaving) {
2896
+ path.pop();
2897
+ continue;
2898
+ }
2899
+ } else if (result !== void 0) {
2900
+ edits.push([key, result]);
2901
+ if (!isLeaving) {
2902
+ if (isNode(result)) {
2903
+ node = result;
2904
+ } else {
2905
+ path.pop();
2906
+ continue;
2907
+ }
2908
+ }
2909
+ }
2910
+ }
2911
+ if (result === void 0 && isEdited) {
2912
+ edits.push([key, node]);
2913
+ }
2914
+ if (isLeaving) {
2915
+ path.pop();
2916
+ } else {
2917
+ var _node$kind;
2918
+ stack = {
2919
+ inArray,
2920
+ index,
2921
+ keys,
2922
+ edits,
2923
+ prev: stack
2924
+ };
2925
+ inArray = Array.isArray(node);
2926
+ keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : [];
2927
+ index = -1;
2928
+ edits = [];
2929
+ if (parent) {
2930
+ ancestors.push(parent);
2931
+ }
2932
+ parent = node;
2933
+ }
2934
+ } while (stack !== void 0);
2935
+ if (edits.length !== 0) {
2936
+ return edits[edits.length - 1][1];
2937
+ }
2938
+ return root;
2939
+ }
2940
+ function getEnterLeaveForKind(visitor, kind) {
2941
+ const kindVisitor = visitor[kind];
2942
+ if (typeof kindVisitor === "object") {
2943
+ return kindVisitor;
2944
+ } else if (typeof kindVisitor === "function") {
2945
+ return {
2946
+ enter: kindVisitor,
2947
+ leave: void 0
2948
+ };
2949
+ }
2950
+ return {
2951
+ enter: visitor.enter,
2952
+ leave: visitor.leave
2953
+ };
2954
+ }
2955
+ function print(ast) {
2956
+ return visit(ast, printDocASTReducer);
2957
+ }
2958
+ const MAX_LINE_LENGTH = 80;
2959
+ const printDocASTReducer = {
2960
+ Name: {
2961
+ leave: (node) => node.value
2962
+ },
2963
+ Variable: {
2964
+ leave: (node) => "$" + node.name
2965
+ },
2966
+ // Document
2967
+ Document: {
2968
+ leave: (node) => join(node.definitions, "\n\n")
2969
+ },
2970
+ OperationDefinition: {
2971
+ leave(node) {
2972
+ const varDefs = wrap("(", join(node.variableDefinitions, ", "), ")");
2973
+ const prefix = join(
2974
+ [
2975
+ node.operation,
2976
+ join([node.name, varDefs]),
2977
+ join(node.directives, " ")
2978
+ ],
2979
+ " "
2980
+ );
2981
+ return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
2982
+ }
2983
+ },
2984
+ VariableDefinition: {
2985
+ leave: ({ variable, type, defaultValue, directives }) => variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " "))
2986
+ },
2987
+ SelectionSet: {
2988
+ leave: ({ selections }) => block(selections)
2989
+ },
2990
+ Field: {
2991
+ leave({ alias, name, arguments: args, directives, selectionSet }) {
2992
+ const prefix = wrap("", alias, ": ") + name;
2993
+ let argsLine = prefix + wrap("(", join(args, ", "), ")");
2994
+ if (argsLine.length > MAX_LINE_LENGTH) {
2995
+ argsLine = prefix + wrap("(\n", indent(join(args, "\n")), "\n)");
2996
+ }
2997
+ return join([argsLine, join(directives, " "), selectionSet], " ");
2998
+ }
2999
+ },
3000
+ Argument: {
3001
+ leave: ({ name, value }) => name + ": " + value
3002
+ },
3003
+ // Fragments
3004
+ FragmentSpread: {
3005
+ leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
3006
+ },
3007
+ InlineFragment: {
3008
+ leave: ({ typeCondition, directives, selectionSet }) => join(
3009
+ [
3010
+ "...",
3011
+ wrap("on ", typeCondition),
3012
+ join(directives, " "),
3013
+ selectionSet
3014
+ ],
3015
+ " "
3016
+ )
3017
+ },
3018
+ FragmentDefinition: {
3019
+ leave: ({ name, typeCondition, variableDefinitions, directives, selectionSet }) => (
3020
+ // or removed in the future.
3021
+ `fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
3022
+ )
3023
+ },
3024
+ // Value
3025
+ IntValue: {
3026
+ leave: ({ value }) => value
3027
+ },
3028
+ FloatValue: {
3029
+ leave: ({ value }) => value
3030
+ },
3031
+ StringValue: {
3032
+ leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value)
3033
+ },
3034
+ BooleanValue: {
3035
+ leave: ({ value }) => value ? "true" : "false"
3036
+ },
3037
+ NullValue: {
3038
+ leave: () => "null"
3039
+ },
3040
+ EnumValue: {
3041
+ leave: ({ value }) => value
3042
+ },
3043
+ ListValue: {
3044
+ leave: ({ values }) => "[" + join(values, ", ") + "]"
3045
+ },
3046
+ ObjectValue: {
3047
+ leave: ({ fields }) => "{" + join(fields, ", ") + "}"
3048
+ },
3049
+ ObjectField: {
3050
+ leave: ({ name, value }) => name + ": " + value
3051
+ },
3052
+ // Directive
3053
+ Directive: {
3054
+ leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")")
3055
+ },
3056
+ // Type
3057
+ NamedType: {
3058
+ leave: ({ name }) => name
3059
+ },
3060
+ ListType: {
3061
+ leave: ({ type }) => "[" + type + "]"
3062
+ },
3063
+ NonNullType: {
3064
+ leave: ({ type }) => type + "!"
3065
+ },
3066
+ // Type System Definitions
3067
+ SchemaDefinition: {
3068
+ leave: ({ description, directives, operationTypes }) => wrap("", description, "\n") + join(["schema", join(directives, " "), block(operationTypes)], " ")
3069
+ },
3070
+ OperationTypeDefinition: {
3071
+ leave: ({ operation, type }) => operation + ": " + type
3072
+ },
3073
+ ScalarTypeDefinition: {
3074
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join(["scalar", name, join(directives, " ")], " ")
3075
+ },
3076
+ ObjectTypeDefinition: {
3077
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
3078
+ [
3079
+ "type",
3080
+ name,
3081
+ wrap("implements ", join(interfaces, " & ")),
3082
+ join(directives, " "),
3083
+ block(fields)
3084
+ ],
3085
+ " "
3086
+ )
3087
+ },
3088
+ FieldDefinition: {
3089
+ leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, "\n") + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + ": " + type + wrap(" ", join(directives, " "))
3090
+ },
3091
+ InputValueDefinition: {
3092
+ leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, "\n") + join(
3093
+ [name + ": " + type, wrap("= ", defaultValue), join(directives, " ")],
3094
+ " "
3095
+ )
3096
+ },
3097
+ InterfaceTypeDefinition: {
3098
+ leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, "\n") + join(
3099
+ [
3100
+ "interface",
3101
+ name,
3102
+ wrap("implements ", join(interfaces, " & ")),
3103
+ join(directives, " "),
3104
+ block(fields)
3105
+ ],
3106
+ " "
3107
+ )
3108
+ },
3109
+ UnionTypeDefinition: {
3110
+ leave: ({ description, name, directives, types }) => wrap("", description, "\n") + join(
3111
+ ["union", name, join(directives, " "), wrap("= ", join(types, " | "))],
3112
+ " "
3113
+ )
3114
+ },
3115
+ EnumTypeDefinition: {
3116
+ leave: ({ description, name, directives, values }) => wrap("", description, "\n") + join(["enum", name, join(directives, " "), block(values)], " ")
3117
+ },
3118
+ EnumValueDefinition: {
3119
+ leave: ({ description, name, directives }) => wrap("", description, "\n") + join([name, join(directives, " ")], " ")
3120
+ },
3121
+ InputObjectTypeDefinition: {
3122
+ leave: ({ description, name, directives, fields }) => wrap("", description, "\n") + join(["input", name, join(directives, " "), block(fields)], " ")
3123
+ },
3124
+ DirectiveDefinition: {
3125
+ leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, "\n") + "directive @" + name + (hasMultilineItems(args) ? wrap("(\n", indent(join(args, "\n")), "\n)") : wrap("(", join(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ")
3126
+ },
3127
+ SchemaExtension: {
3128
+ leave: ({ directives, operationTypes }) => join(
3129
+ ["extend schema", join(directives, " "), block(operationTypes)],
3130
+ " "
3131
+ )
3132
+ },
3133
+ ScalarTypeExtension: {
3134
+ leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
3135
+ },
3136
+ ObjectTypeExtension: {
3137
+ leave: ({ name, interfaces, directives, fields }) => join(
3138
+ [
3139
+ "extend type",
3140
+ name,
3141
+ wrap("implements ", join(interfaces, " & ")),
3142
+ join(directives, " "),
3143
+ block(fields)
3144
+ ],
3145
+ " "
3146
+ )
3147
+ },
3148
+ InterfaceTypeExtension: {
3149
+ leave: ({ name, interfaces, directives, fields }) => join(
3150
+ [
3151
+ "extend interface",
3152
+ name,
3153
+ wrap("implements ", join(interfaces, " & ")),
3154
+ join(directives, " "),
3155
+ block(fields)
3156
+ ],
3157
+ " "
3158
+ )
3159
+ },
3160
+ UnionTypeExtension: {
3161
+ leave: ({ name, directives, types }) => join(
3162
+ [
3163
+ "extend union",
3164
+ name,
3165
+ join(directives, " "),
3166
+ wrap("= ", join(types, " | "))
3167
+ ],
3168
+ " "
3169
+ )
3170
+ },
3171
+ EnumTypeExtension: {
3172
+ leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
3173
+ },
3174
+ InputObjectTypeExtension: {
3175
+ leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
3176
+ }
3177
+ };
3178
+ function join(maybeArray, separator = "") {
3179
+ var _maybeArray$filter$jo;
3180
+ return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : "";
3181
+ }
3182
+ function block(array) {
3183
+ return wrap("{\n", indent(join(array, "\n")), "\n}");
3184
+ }
3185
+ function wrap(start2, maybeString, end = "") {
3186
+ return maybeString != null && maybeString !== "" ? start2 + maybeString + end : "";
3187
+ }
3188
+ function indent(str) {
3189
+ return wrap(" ", str.replace(/\n/g, "\n "));
3190
+ }
3191
+ function hasMultilineItems(maybeArray) {
3192
+ var _maybeArray$some;
3193
+ return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some((str) => str.includes("\n"))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false;
3194
+ }
3195
+ var e;
3196
+ !function(e2) {
3197
+ e2[e2.Pull = 0] = "Pull";
3198
+ e2[e2.Close = 1] = "Close";
3199
+ }(e || (e = {}));
3200
+ var r;
3201
+ !function(e2) {
3202
+ e2[e2.Start = 0] = "Start";
3203
+ e2[e2.Push = 1] = "Push";
3204
+ e2[e2.End = 0] = "End";
3205
+ }(r || (r = {}));
3206
+ var teardownPlaceholder = () => {
3207
+ };
3208
+ var t = teardownPlaceholder;
3209
+ function start(e2) {
3210
+ var t2 = [e2];
3211
+ t2.tag = r.Start;
3212
+ return t2;
3213
+ }
3214
+ function onEnd(t2) {
3215
+ return (l2) => (n) => {
3216
+ var a = false;
3217
+ l2((l3) => {
3218
+ if (a)
3219
+ ;
3220
+ else if (l3 === r.End) {
3221
+ a = true;
3222
+ n(r.End);
3223
+ t2();
3224
+ } else if (l3.tag === r.Start) {
3225
+ var i2 = l3[0];
3226
+ n(start((r2) => {
3227
+ if (r2 === e.Close) {
3228
+ a = true;
3229
+ i2(e.Close);
3230
+ t2();
3231
+ } else {
3232
+ i2(r2);
3233
+ }
3234
+ }));
3235
+ } else {
3236
+ n(l3);
3237
+ }
3238
+ });
3239
+ };
3240
+ }
3241
+ function take(l2) {
3242
+ return (n) => (a) => {
3243
+ var i2 = t;
3244
+ var s2 = false;
3245
+ var f2 = 0;
3246
+ n((t2) => {
3247
+ if (s2)
3248
+ ;
3249
+ else if (t2 === r.End) {
3250
+ s2 = true;
3251
+ a(r.End);
3252
+ } else if (t2.tag === r.Start) {
3253
+ if (l2 <= 0) {
3254
+ s2 = true;
3255
+ a(r.End);
3256
+ t2[0](e.Close);
3257
+ } else {
3258
+ i2 = t2[0];
3259
+ }
3260
+ } else if (f2++ < l2) {
3261
+ a(t2);
3262
+ if (!s2 && f2 >= l2) {
3263
+ s2 = true;
3264
+ a(r.End);
3265
+ i2(e.Close);
3266
+ }
3267
+ } else {
3268
+ a(t2);
3269
+ }
3270
+ });
3271
+ a(start((r2) => {
3272
+ if (r2 === e.Close && !s2) {
3273
+ s2 = true;
3274
+ i2(e.Close);
3275
+ } else if (r2 === e.Pull && !s2 && f2 < l2) {
3276
+ i2(e.Pull);
3277
+ }
3278
+ }));
3279
+ };
3280
+ }
3281
+ function subscribe(l2) {
3282
+ return (n) => {
3283
+ var a = t;
3284
+ var i2 = false;
3285
+ n((t2) => {
3286
+ if (t2 === r.End) {
3287
+ i2 = true;
3288
+ } else if (t2.tag === r.Start) {
3289
+ (a = t2[0])(e.Pull);
3290
+ } else if (!i2) {
3291
+ l2(t2[0]);
3292
+ a(e.Pull);
3293
+ }
3294
+ });
3295
+ return {
3296
+ unsubscribe() {
3297
+ if (!i2) {
3298
+ i2 = true;
3299
+ a(e.Close);
3300
+ }
3301
+ }
3302
+ };
3303
+ };
3304
+ }
3305
+ function toPromise(l2) {
3306
+ return new Promise((n) => {
3307
+ var a = t;
3308
+ var i2;
3309
+ l2((t2) => {
3310
+ if (t2 === r.End) {
3311
+ Promise.resolve(i2).then(n);
3312
+ } else if (t2.tag === r.Start) {
3313
+ (a = t2[0])(e.Pull);
3314
+ } else {
3315
+ i2 = t2[0];
3316
+ a(e.Pull);
3317
+ }
3318
+ });
3319
+ });
3320
+ }
3321
+ var phash = (r2, e2) => {
3322
+ var t2 = "number" == typeof e2 ? 0 | e2 : 5381;
3323
+ for (var a = 0, n = 0 | r2.length; a < n; a++) {
3324
+ t2 = (t2 << 5) + t2 + r2.charCodeAt(a);
3325
+ }
3326
+ return t2;
3327
+ };
3328
+ var o = /* @__PURE__ */ new Set();
3329
+ var i = /* @__PURE__ */ new WeakMap();
3330
+ var stringify = (r2) => {
3331
+ if (null === r2 || o.has(r2)) {
3332
+ return "null";
3333
+ } else if ("object" != typeof r2) {
3334
+ return JSON.stringify(r2) || "";
3335
+ } else if (r2.toJSON) {
3336
+ return stringify(r2.toJSON());
3337
+ } else if (Array.isArray(r2)) {
3338
+ var e2 = "[";
3339
+ for (var t2 of r2) {
3340
+ if ("[" !== e2) {
3341
+ e2 += ",";
3342
+ }
3343
+ e2 += (t2 = stringify(t2)).length > 0 ? t2 : "null";
3344
+ }
3345
+ return e2 += "]";
3346
+ }
3347
+ var a = Object.keys(r2).sort();
3348
+ if (!a.length && r2.constructor && r2.constructor !== Object) {
3349
+ var n = i.get(r2) || Math.random().toString(36).slice(2);
3350
+ i.set(r2, n);
3351
+ return `{"__key":"${n}"}`;
3352
+ }
3353
+ o.add(r2);
3354
+ var s2 = "{";
3355
+ for (var v2 of a) {
3356
+ var f2 = stringify(r2[v2]);
3357
+ if (f2) {
3358
+ if (s2.length > 1) {
3359
+ s2 += ",";
3360
+ }
3361
+ s2 += stringify(v2) + ":" + f2;
3362
+ }
3363
+ }
3364
+ o.delete(r2);
3365
+ return s2 += "}";
3366
+ };
3367
+ var stringifyVariables = (r2) => {
3368
+ o.clear();
3369
+ return stringify(r2);
3370
+ };
3371
+ var s = /("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g;
3372
+ var v = /(#[^\n\r]+)?(?:\n|\r\n?|$)+/g;
3373
+ var replaceOutsideStrings = (r2, e2) => e2 % 2 == 0 ? r2.replace(v, "\n") : r2;
3374
+ var sanitizeDocument = (r2) => r2.split(s).map(replaceOutsideStrings).join("").trim();
3375
+ var f = /* @__PURE__ */ new Map();
3376
+ var l = /* @__PURE__ */ new Map();
3377
+ var stringifyDocument = (r2) => {
3378
+ var e2;
3379
+ if ("string" == typeof r2) {
3380
+ e2 = sanitizeDocument(r2);
3381
+ } else if (r2.loc && l.get(r2.__key) === r2) {
3382
+ e2 = r2.loc.source.body;
3383
+ } else {
3384
+ e2 = f.get(r2) || sanitizeDocument(print(r2));
3385
+ f.set(r2, e2);
3386
+ }
3387
+ if ("string" != typeof r2 && !r2.loc) {
3388
+ r2.loc = {
3389
+ start: 0,
3390
+ end: e2.length,
3391
+ source: {
3392
+ body: e2,
3393
+ name: "gql",
3394
+ locationOffset: {
3395
+ line: 1,
3396
+ column: 1
3397
+ }
3398
+ }
3399
+ };
3400
+ }
3401
+ return e2;
3402
+ };
3403
+ var hashDocument = (r2) => {
3404
+ var e2 = phash(stringifyDocument(r2));
3405
+ if ("object" == typeof r2 && "definitions" in r2) {
3406
+ var t2 = getOperationName(r2);
3407
+ if (t2) {
3408
+ e2 = phash(`
3409
+ # ${t2}`, e2);
3410
+ }
3411
+ }
3412
+ return e2;
3413
+ };
3414
+ var keyDocument = (r2) => {
3415
+ var e2;
3416
+ var t2;
3417
+ if ("string" == typeof r2) {
3418
+ e2 = hashDocument(r2);
3419
+ t2 = l.get(e2) || parse(r2, {
3420
+ noLocation: true
3421
+ });
3422
+ } else {
3423
+ e2 = r2.__key || hashDocument(r2);
3424
+ t2 = l.get(e2) || r2;
3425
+ }
3426
+ if (!t2.loc) {
3427
+ stringifyDocument(t2);
3428
+ }
3429
+ t2.__key = e2;
3430
+ l.set(e2, t2);
3431
+ return t2;
3432
+ };
3433
+ var createRequest = (r2, e2) => {
3434
+ if (!e2) {
3435
+ e2 = {};
3436
+ }
3437
+ var t2 = keyDocument(r2);
3438
+ var a = stringifyVariables(e2);
3439
+ var n = t2.__key;
3440
+ if ("{}" !== a) {
3441
+ n = phash(a, n);
3442
+ }
3443
+ return {
3444
+ key: n,
3445
+ query: t2,
3446
+ variables: e2
3447
+ };
3448
+ };
3449
+ var getOperationName = (r2) => {
3450
+ for (var t2 of r2.definitions) {
3451
+ if (t2.kind === Kind.OPERATION_DEFINITION && t2.name) {
3452
+ return t2.name.value;
3453
+ }
3454
+ }
3455
+ };
3456
+ "undefined" != typeof TextDecoder ? new TextDecoder() : null;
3457
+ function useClient() {
3458
+ if ("production" !== process.env.NODE_ENV && !getCurrentInstance()) {
3459
+ throw new Error("use* functions may only be called during the `setup()` or other lifecycle hooks.");
3460
+ }
3461
+ var e2 = inject("$urql");
3462
+ if ("production" !== process.env.NODE_ENV && !e2) {
3463
+ throw new Error("No urql Client was provided. Did you forget to install the plugin or call `provideClient` in a parent?");
3464
+ }
3465
+ return e2;
3466
+ }
3467
+ function unwrapPossibleProxy(e2) {
3468
+ return e2 && isRef(e2) ? e2.value : e2;
3469
+ }
3470
+ var b = {
3471
+ flush: "pre"
3472
+ };
3473
+ function callUseQuery(e2, l2 = useClient(), t2 = []) {
3474
+ var n = reactive(e2);
3475
+ var o2 = ref();
3476
+ var v2 = ref(false);
3477
+ var f2 = ref(false);
3478
+ var y = ref();
3479
+ var d2 = ref();
3480
+ var h = ref();
3481
+ var x = isRef(e2.pause) ? e2.pause : ref(!!e2.pause);
3482
+ var w = ref(createRequest(n.query, unwrapPossibleProxy(n.variables)));
3483
+ var P = ref();
3484
+ t2.push(watchEffect(() => {
3485
+ var e3 = createRequest(n.query, unwrapPossibleProxy(n.variables));
3486
+ if (w.value.key !== e3.key) {
3487
+ w.value = e3;
3488
+ }
3489
+ }, b));
3490
+ t2.push(watchEffect(() => {
3491
+ P.value = !x.value ? l2.value.executeQuery(w.value, {
3492
+ requestPolicy: n.requestPolicy,
3493
+ ...n.context
3494
+ }) : void 0;
3495
+ }, b));
3496
+ var q = {
3497
+ data: o2,
3498
+ stale: v2,
3499
+ error: y,
3500
+ operation: d2,
3501
+ extensions: h,
3502
+ fetching: f2,
3503
+ isPaused: x,
3504
+ executeQuery(e3) {
3505
+ var u = P.value = l2.value.executeQuery(w.value, {
3506
+ requestPolicy: n.requestPolicy,
3507
+ ...n.context,
3508
+ ...e3
3509
+ });
3510
+ return {
3511
+ ...E,
3512
+ then(e4, r2) {
3513
+ var a;
3514
+ return new Promise((e5) => {
3515
+ var r3 = false;
3516
+ a = subscribe(() => {
3517
+ if (!q.fetching.value && !q.stale.value) {
3518
+ if (a) {
3519
+ a.unsubscribe();
3520
+ }
3521
+ r3 = true;
3522
+ e5(q);
3523
+ }
3524
+ })(u);
3525
+ if (r3) {
3526
+ a.unsubscribe();
3527
+ }
3528
+ }).then(e4, r2);
3529
+ }
3530
+ };
3531
+ },
3532
+ pause() {
3533
+ x.value = true;
3534
+ },
3535
+ resume() {
3536
+ x.value = false;
3537
+ }
3538
+ };
3539
+ t2.push(watchEffect((e3) => {
3540
+ if (P.value) {
3541
+ f2.value = true;
3542
+ v2.value = false;
3543
+ e3(subscribe((e4) => {
3544
+ o2.value = e4.data;
3545
+ v2.value = !!e4.stale;
3546
+ f2.value = false;
3547
+ y.value = e4.error;
3548
+ d2.value = e4.operation;
3549
+ h.value = e4.extensions;
3550
+ })(onEnd(() => {
3551
+ f2.value = false;
3552
+ v2.value = false;
3553
+ })(P.value)).unsubscribe);
3554
+ } else {
3555
+ f2.value = false;
3556
+ v2.value = false;
3557
+ }
3558
+ }, {
3559
+ flush: "sync"
3560
+ }));
3561
+ var E = {
3562
+ ...q,
3563
+ then(e3, u) {
3564
+ var r2;
3565
+ return new Promise((e4) => {
3566
+ if (!P.value) {
3567
+ return e4(q);
3568
+ }
3569
+ var u2 = false;
3570
+ r2 = subscribe(() => {
3571
+ if (!q.fetching.value && !q.stale.value) {
3572
+ if (r2) {
3573
+ r2.unsubscribe();
3574
+ }
3575
+ u2 = true;
3576
+ e4(q);
3577
+ }
3578
+ })(P.value);
3579
+ if (u2) {
3580
+ r2.unsubscribe();
3581
+ }
3582
+ }).then(e3, u);
3583
+ }
3584
+ };
3585
+ return E;
3586
+ }
3587
+ function callUseMutation(e2, r2 = useClient()) {
3588
+ var l2 = ref();
3589
+ var t2 = ref(false);
3590
+ var n = ref(false);
3591
+ var s2 = ref();
3592
+ var i2 = ref();
3593
+ var o2 = ref();
3594
+ return {
3595
+ data: l2,
3596
+ stale: t2,
3597
+ fetching: n,
3598
+ error: s2,
3599
+ operation: i2,
3600
+ extensions: o2,
3601
+ executeMutation(a, v2) {
3602
+ n.value = true;
3603
+ return toPromise(take(1)(r2.value.executeMutation(createRequest(e2, unwrapPossibleProxy(a)), v2 || {}))).then((e3) => {
3604
+ l2.value = e3.data;
3605
+ t2.value = !!e3.stale;
3606
+ n.value = false;
3607
+ s2.value = e3.error;
3608
+ i2.value = e3.operation;
3609
+ o2.value = e3.extensions;
3610
+ return e3;
3611
+ });
3612
+ }
3613
+ };
3614
+ }
3615
+ var d = {
3616
+ flush: "pre"
3617
+ };
3618
+ function callUseSubscription(e2, l2, t2 = useClient(), n = []) {
3619
+ var o2 = reactive(e2);
3620
+ var v2 = ref();
3621
+ var f2 = ref(false);
3622
+ var y = ref(false);
3623
+ var b2 = ref();
3624
+ var h = ref();
3625
+ var x = ref();
3626
+ var w = ref(l2);
3627
+ var P = isRef(e2.pause) ? e2.pause : ref(!!e2.pause);
3628
+ var q = ref(createRequest(o2.query, unwrapPossibleProxy(o2.variables)));
3629
+ var E = ref();
3630
+ n.push(watchEffect(() => {
3631
+ var e3 = createRequest(o2.query, unwrapPossibleProxy(o2.variables));
3632
+ if (q.value.key !== e3.key) {
3633
+ q.value = e3;
3634
+ }
3635
+ }, d));
3636
+ n.push(watchEffect(() => {
3637
+ E.value = !P.value ? t2.value.executeSubscription(q.value, {
3638
+ ...o2.context
3639
+ }) : void 0;
3640
+ }, d));
3641
+ n.push(watchEffect((e3) => {
3642
+ if (E.value) {
3643
+ y.value = true;
3644
+ e3(subscribe((e4) => {
3645
+ y.value = true;
3646
+ v2.value = void 0 !== e4.data ? "function" == typeof w.value ? w.value(v2.value, e4.data) : e4.data : e4.data, b2.value = e4.error;
3647
+ x.value = e4.extensions;
3648
+ f2.value = !!e4.stale;
3649
+ h.value = e4.operation;
3650
+ })(onEnd(() => {
3651
+ y.value = false;
3652
+ })(E.value)).unsubscribe);
3653
+ } else {
3654
+ y.value = false;
3655
+ }
3656
+ }, d));
3657
+ var m = {
3658
+ data: v2,
3659
+ stale: f2,
3660
+ error: b2,
3661
+ operation: h,
3662
+ extensions: x,
3663
+ fetching: y,
3664
+ isPaused: P,
3665
+ executeSubscription(e3) {
3666
+ E.value = t2.value.executeSubscription(q.value, {
3667
+ ...o2.context,
3668
+ ...e3
3669
+ });
3670
+ return m;
3671
+ },
3672
+ pause() {
3673
+ P.value = true;
3674
+ },
3675
+ resume() {
3676
+ P.value = false;
3677
+ }
3678
+ };
3679
+ return m;
3680
+ }
3681
+ function useClientHandle() {
3682
+ var e2 = useClient();
3683
+ var u = [];
3684
+ onBeforeUnmount(() => {
3685
+ var e3;
3686
+ while (e3 = u.shift()) {
3687
+ e3();
3688
+ }
3689
+ });
3690
+ var r2 = {
3691
+ client: e2.value,
3692
+ useQuery: (r3) => callUseQuery(r3, e2, u),
3693
+ useSubscription: (r3, a) => callUseSubscription(r3, a, e2, u),
3694
+ useMutation: (u2) => callUseMutation(u2, e2)
3695
+ };
3696
+ if ("production" !== process.env.NODE_ENV) {
3697
+ onMounted(() => {
3698
+ Object.assign(r2, {
3699
+ useQuery(r3) {
3700
+ if ("production" !== process.env.NODE_ENV && !getCurrentInstance()) {
3701
+ throw new Error("`handle.useQuery()` should only be called in the `setup()` or a lifecycle hook.");
3702
+ }
3703
+ return callUseQuery(r3, e2, u);
3704
+ },
3705
+ useSubscription(r3, a) {
3706
+ if ("production" !== process.env.NODE_ENV && !getCurrentInstance()) {
3707
+ throw new Error("`handle.useSubscription()` should only be called in the `setup()` or a lifecycle hook.");
3708
+ }
3709
+ return callUseSubscription(r3, a, e2, u);
3710
+ }
3711
+ });
3712
+ });
3713
+ }
3714
+ return r2;
3715
+ }
3716
+ const __default__$1 = defineComponent({ name: "TaskWorkButton" });
203
3717
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
204
3718
  ...__default__$1,
3719
+ setup(__props) {
3720
+ useClientHandle();
3721
+ const startTaskWork = () => {
3722
+ console.info("Start work");
3723
+ };
3724
+ return (_ctx, _cache) => {
3725
+ return openBlock(), createBlock(unref(NeonButton), {
3726
+ "is-rounded": true,
3727
+ size: "sm",
3728
+ color: "warning",
3729
+ "icon-left": "play",
3730
+ label: "Mulai",
3731
+ onClick: startTaskWork
3732
+ });
3733
+ };
3734
+ }
3735
+ });
3736
+ const __default__ = defineComponent({ name: "TaskCollection" });
3737
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3738
+ ...__default__,
205
3739
  setup(__props) {
206
3740
  useCollection();
207
3741
  return (_ctx, _cache) => {
@@ -215,7 +3749,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
215
3749
  };
216
3750
  }
217
3751
  });
218
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3752
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
219
3753
  __name: "TaskSingle",
220
3754
  setup(__props) {
221
3755
  const {
@@ -443,25 +3977,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
443
3977
  };
444
3978
  }
445
3979
  });
446
- const TaskPlanningModel = models.TaskModel;
447
- const __default__ = defineComponent({ name: "TaskPlanningCollection" });
448
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
449
- ...__default__,
450
- setup(__props) {
451
- useCollection();
452
- return (_ctx, _cache) => {
453
- return openBlock(), createBlock(unref(NeonCollection), { class: "neu-pekerjaan-task-planning-collection" }, {
454
- default: withCtx(() => [
455
- createVNode(unref(OfficeCollectionTable))
456
- ]),
457
- _: 1
458
- /* STABLE */
459
- });
460
- };
461
- }
462
- });
463
3980
  const _sfc_main = /* @__PURE__ */ defineComponent({
464
- __name: "TaskPlanningSingle",
3981
+ __name: "TaskWork",
465
3982
  setup(__props) {
466
3983
  const {
467
3984
  fields,
@@ -481,7 +3998,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
481
3998
  values.value.estimatedEndDate = date == null ? void 0 : date.end.toISOString();
482
3999
  }
483
4000
  return (_ctx, _cache) => {
484
- return openBlock(), createBlock(unref(NeonSingle), { class: "neu-pekerjaan-task-planning-single" }, {
4001
+ return openBlock(), createBlock(unref(NeonSingle), { class: "neu-task-single" }, {
485
4002
  default: withCtx(() => [
486
4003
  createVNode(unref(OfficeTabs), { "use-url": unref(isMain) }, {
487
4004
  default: withCtx(() => [
@@ -501,12 +4018,52 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
501
4018
  onSubmit: unref(saveOne)
502
4019
  }, {
503
4020
  default: withCtx(() => [
504
- createVNode(unref(NeonFields), { md: "grid-cols-4" }, {
4021
+ createVNode(unref(NeonFields), {
4022
+ md: "grid gap-4",
4023
+ title: "Pekerjaan"
4024
+ }, {
4025
+ default: withCtx(() => [
4026
+ createVNode(unref(NeonField), mergeProps({
4027
+ modelValue: unref(values).priority,
4028
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(values).priority = $event)
4029
+ }, unref(fields).priority), null, 16, ["modelValue"])
4030
+ ]),
4031
+ _: 1
4032
+ /* STABLE */
4033
+ }),
4034
+ createVNode(unref(NeonFields), { md: "grid gap-4 sm:grid-cols-2" }, {
4035
+ default: withCtx(() => [
4036
+ createVNode(unref(NeonField), mergeProps({
4037
+ modelValue: unref(values).estimatedRealizedAssignmentStart,
4038
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(values).estimatedRealizedAssignmentStart = $event)
4039
+ }, unref(fields).estimatedRealizedAssignmentStart, { "is-disabled": "" }), null, 16, ["modelValue"]),
4040
+ createVNode(unref(NeonField), mergeProps({
4041
+ modelValue: unref(values).estimatedRealizedAssignmentEnd,
4042
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(values).estimatedRealizedAssignmentEnd = $event)
4043
+ }, unref(fields).estimatedRealizedAssignmentEnd, { "is-disabled": "" }), null, 16, ["modelValue"])
4044
+ ]),
4045
+ _: 1
4046
+ /* STABLE */
4047
+ }),
4048
+ createVNode(unref(NeonFields), { md: "grid gap-4" }, {
4049
+ default: withCtx(() => [
4050
+ createVNode(unref(NeonField), mergeProps({
4051
+ modelValue: unref(values).resultAssignment,
4052
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(values).resultAssignment = $event)
4053
+ }, unref(fields).resultAssignment), null, 16, ["modelValue"])
4054
+ ]),
4055
+ _: 1
4056
+ /* STABLE */
4057
+ }),
4058
+ createVNode(unref(NeonFields), {
4059
+ md: "grid-cols-4",
4060
+ title: "Perencanaan"
4061
+ }, {
505
4062
  default: withCtx(() => [
506
4063
  createVNode(unref(NeonField), mergeProps({
507
4064
  modelValue: unref(values).taskName,
508
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(values).taskName = $event)
509
- }, unref(fields).taskName), null, 16, ["modelValue"])
4065
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(values).taskName = $event)
4066
+ }, unref(fields).taskName, { "is-disabled": "" }), null, 16, ["modelValue"])
510
4067
  ]),
511
4068
  _: 1
512
4069
  /* STABLE */
@@ -515,8 +4072,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
515
4072
  default: withCtx(() => [
516
4073
  createVNode(unref(NeonField), mergeProps({
517
4074
  modelValue: unref(values).internalServiceDescription,
518
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(values).internalServiceDescription = $event)
519
- }, unref(fields).internalServiceDescription), null, 16, ["modelValue"])
4075
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(values).internalServiceDescription = $event)
4076
+ }, unref(fields).internalServiceDescription, { "is-disabled": "" }), null, 16, ["modelValue"])
520
4077
  ]),
521
4078
  _: 1
522
4079
  /* STABLE */
@@ -525,28 +4082,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
525
4082
  default: withCtx(() => [
526
4083
  createVNode(unref(NeonField), mergeProps({
527
4084
  modelValue: unref(values).externalServiceDescription,
528
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(values).externalServiceDescription = $event)
529
- }, unref(fields).externalServiceDescription), null, 16, ["modelValue"])
4085
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => unref(values).externalServiceDescription = $event)
4086
+ }, unref(fields).externalServiceDescription, { "is-disabled": "" }), null, 16, ["modelValue"])
530
4087
  ]),
531
4088
  _: 1
532
4089
  /* STABLE */
533
4090
  }),
534
4091
  createVNode(unref(OfficeRelation), {
535
4092
  modelValue: unref(values),
536
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(values) ? values.value = $event : null),
537
- field: unref(fields).branches
4093
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(values) ? values.value = $event : null),
4094
+ field: unref(fields).branches,
4095
+ "is-disabled": ""
538
4096
  }, null, 8, ["modelValue", "field"]),
539
4097
  createVNode(unref(NeonFields), { md: "grid gap-4 sm:grid-cols-2" }, {
540
4098
  default: withCtx(() => [
541
4099
  createVNode(unref(OfficeRelation), {
542
4100
  modelValue: unref(values),
543
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(values) ? values.value = $event : null),
544
- field: unref(fields).giveAssignments
4101
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(values) ? values.value = $event : null),
4102
+ field: unref(fields).giveAssignments,
4103
+ "is-disabled": ""
545
4104
  }, null, 8, ["modelValue", "field"]),
546
4105
  createVNode(unref(OfficeRelation), {
547
4106
  modelValue: unref(values),
548
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(values) ? values.value = $event : null),
549
- field: unref(fields).supervisingAssignments
4107
+ "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(values) ? values.value = $event : null),
4108
+ field: unref(fields).supervisingAssignments,
4109
+ "is-disabled": ""
550
4110
  }, null, 8, ["modelValue", "field"])
551
4111
  ]),
552
4112
  _: 1
@@ -556,47 +4116,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
556
4116
  default: withCtx(() => [
557
4117
  createVNode(unref(OfficeRelation), {
558
4118
  modelValue: unref(values),
559
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(values) ? values.value = $event : null),
560
- field: unref(fields).doingAssignments
4119
+ "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => isRef(values) ? values.value = $event : null),
4120
+ field: unref(fields).doingAssignments,
4121
+ "is-disabled": ""
561
4122
  }, null, 8, ["modelValue", "field"]),
562
4123
  createVNode(unref(OfficeRelation), {
563
4124
  modelValue: unref(values),
564
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(values) ? values.value = $event : null),
4125
+ "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(values) ? values.value = $event : null),
565
4126
  field: unref(fields).helpAssignments
566
4127
  }, null, 8, ["modelValue", "field"])
567
4128
  ]),
568
4129
  _: 1
569
4130
  /* STABLE */
570
4131
  }),
571
- createVNode(unref(NeonFields), { md: "grid gap-4" }, {
572
- default: withCtx(() => [
573
- createCommentVNode(' <NeonInputDateRange\n :model-value="{\n start: new Date(values.estimatedStartDate || Date.now()),\n end: new Date(values.estimatedEndDate || Date.now()),\n }"\n min-date="values.estimatedStartDate"\n max-date="values.estimatedEndDate"\n locale="id"\n title="Estimasi"\n @update:model-value="onChangeDateUpdate"\n /> '),
574
- createVNode(unref(NeonField), {
575
- "model-value": {
576
- start: new Date(unref(values).estimatedStartDate || ""),
577
- end: new Date(unref(values).estimatedEndDate || "")
578
- },
579
- name: "Est. Mulai - Selesai",
580
- note: "Tanggal tugas dimulai dan selesai",
581
- input: "date-range",
582
- type: "date-range",
583
- "is-alone": "",
584
- "onUpdate:modelValue": onChangeDateUpdate
585
- }, null, 8, ["model-value"])
586
- ]),
587
- _: 1
588
- /* STABLE */
589
- }),
590
4132
  createVNode(unref(NeonFields), { md: "grid gap-4 sm:grid-cols-2" }, {
591
4133
  default: withCtx(() => [
592
4134
  createVNode(unref(NeonField), mergeProps({
593
4135
  modelValue: unref(values).estimatedHourDoingAssignment,
594
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => unref(values).estimatedHourDoingAssignment = $event)
595
- }, unref(fields).estimatedHourDoingAssignment), null, 16, ["modelValue"]),
4136
+ "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => unref(values).estimatedHourDoingAssignment = $event)
4137
+ }, unref(fields).estimatedHourDoingAssignment, { "is-disabled": "" }), null, 16, ["modelValue"]),
596
4138
  createVNode(unref(NeonField), mergeProps({
597
4139
  modelValue: unref(values).estimatedHourCommunicationAssignment,
598
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => unref(values).estimatedHourCommunicationAssignment = $event)
599
- }, unref(fields).estimatedHourCommunicationAssignment), null, 16, ["modelValue"])
4140
+ "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => unref(values).estimatedHourCommunicationAssignment = $event)
4141
+ }, unref(fields).estimatedHourCommunicationAssignment, { "is-disabled": "" }), null, 16, ["modelValue"])
600
4142
  ]),
601
4143
  _: 1
602
4144
  /* STABLE */
@@ -605,56 +4147,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
605
4147
  default: withCtx(() => [
606
4148
  createVNode(unref(NeonField), mergeProps({
607
4149
  modelValue: unref(values).estimatedHourCognitiveAssignment,
608
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => unref(values).estimatedHourCognitiveAssignment = $event)
609
- }, unref(fields).estimatedHourCognitiveAssignment), null, 16, ["modelValue"]),
4150
+ "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => unref(values).estimatedHourCognitiveAssignment = $event)
4151
+ }, unref(fields).estimatedHourCognitiveAssignment, { "is-disabled": "" }), null, 16, ["modelValue"]),
610
4152
  createVNode(unref(NeonField), mergeProps({
611
4153
  modelValue: unref(values).estimatedHourCreativeAssignment,
612
- "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => unref(values).estimatedHourCreativeAssignment = $event)
613
- }, unref(fields).estimatedHourCreativeAssignment), null, 16, ["modelValue"])
614
- ]),
615
- _: 1
616
- /* STABLE */
617
- }),
618
- createVNode(unref(NeonFields), { md: "grid gap-4" }, {
619
- default: withCtx(() => [
620
- createVNode(unref(NeonField), mergeProps({
621
- modelValue: unref(values).estimatedHourByDay,
622
- "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => unref(values).estimatedHourByDay = $event)
623
- }, unref(fields).estimatedHourByDay, { "is-disabled": "" }), null, 16, ["modelValue"])
624
- ]),
625
- _: 1
626
- /* STABLE */
627
- }),
628
- createVNode(unref(NeonFields), { md: "grid gap-4" }, {
629
- default: withCtx(() => [
630
- createVNode(unref(NeonField), mergeProps({
631
- modelValue: unref(values).priority,
632
- "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => unref(values).priority = $event)
633
- }, unref(fields).priority), null, 16, ["modelValue"])
4154
+ "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(values).estimatedHourCreativeAssignment = $event)
4155
+ }, unref(fields).estimatedHourCreativeAssignment, { "is-disabled": "" }), null, 16, ["modelValue"])
634
4156
  ]),
635
4157
  _: 1
636
4158
  /* STABLE */
637
4159
  }),
638
4160
  createVNode(unref(NeonFields), { md: "grid gap-4" }, {
639
4161
  default: withCtx(() => [
640
- createVNode(unref(NeonField), mergeProps({
641
- modelValue: unref(values).status,
642
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => unref(values).status = $event)
643
- }, unref(fields).status, { "is-disabled": "" }), null, 16, ["modelValue"])
644
- ]),
645
- _: 1
646
- /* STABLE */
647
- }),
648
- createVNode(unref(NeonFields), { md: "grid gap-4 sm:grid-cols-2" }, {
649
- default: withCtx(() => [
650
- createVNode(unref(NeonField), mergeProps({
651
- modelValue: unref(values).estimatedRealizedAssignmentStart,
652
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(values).estimatedRealizedAssignmentStart = $event)
653
- }, unref(fields).estimatedRealizedAssignmentStart), null, 16, ["modelValue"]),
654
- createVNode(unref(NeonField), mergeProps({
655
- modelValue: unref(values).estimatedRealizedAssignmentEnd,
656
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => unref(values).estimatedRealizedAssignmentEnd = $event)
657
- }, unref(fields).estimatedRealizedAssignmentEnd), null, 16, ["modelValue"])
4162
+ createCommentVNode(' <NeonInputDateRange\n :model-value="{\n start: new Date(values.estimatedStartDate || Date.now()),\n end: new Date(values.estimatedEndDate || Date.now()),\n }"\n min-date="values.estimatedStartDate"\n max-date="values.estimatedEndDate"\n locale="id"\n title="Estimasi"\n @update:model-value="onChangeDateUpdate"\n /> '),
4163
+ createVNode(unref(NeonField), {
4164
+ "model-value": {
4165
+ start: new Date(unref(values).estimatedStartDate || ""),
4166
+ end: new Date(unref(values).estimatedEndDate || "")
4167
+ },
4168
+ name: "Est. Mulai - Selesai",
4169
+ note: "Tanggal tugas dimulai dan selesai",
4170
+ input: "date-range",
4171
+ type: "date-range",
4172
+ "is-alone": "",
4173
+ "is-disabled": "",
4174
+ "onUpdate:modelValue": onChangeDateUpdate
4175
+ }, null, 8, ["model-value"])
658
4176
  ]),
659
4177
  _: 1
660
4178
  /* STABLE */
@@ -662,9 +4180,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
662
4180
  createVNode(unref(NeonFields), { md: "grid gap-4" }, {
663
4181
  default: withCtx(() => [
664
4182
  createVNode(unref(NeonField), mergeProps({
665
- modelValue: unref(values).resultAssignment,
666
- "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => unref(values).resultAssignment = $event)
667
- }, unref(fields).resultAssignment), null, 16, ["modelValue"])
4183
+ modelValue: unref(values).estimatedHourByDay,
4184
+ "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => unref(values).estimatedHourByDay = $event)
4185
+ }, unref(fields).estimatedHourByDay, { "is-disabled": "" }), null, 16, ["modelValue"])
668
4186
  ]),
669
4187
  _: 1
670
4188
  /* STABLE */
@@ -693,12 +4211,11 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
693
4211
  StaffCollection: _sfc_main$5,
694
4212
  StaffModel,
695
4213
  StaffSingle,
696
- TaskCollection: _sfc_main$3,
4214
+ TaskCollection: _sfc_main$2,
697
4215
  TaskModel,
698
- TaskPlanningCollection: _sfc_main$1,
699
- TaskPlanningModel,
700
- TaskPlanningSingle: _sfc_main,
701
- TaskSingle: _sfc_main$2,
4216
+ TaskSingle: _sfc_main$1,
4217
+ TaskWork: _sfc_main,
4218
+ TaskWorkButton: _sfc_main$3,
702
4219
  XxxButton: _sfc_main$6
703
4220
  }, Symbol.toStringTag, { value: "Module" }));
704
4221
  function registerComponents(app) {
@@ -720,11 +4237,10 @@ export {
720
4237
  _sfc_main$5 as StaffCollection,
721
4238
  StaffModel,
722
4239
  StaffSingle,
723
- _sfc_main$3 as TaskCollection,
4240
+ _sfc_main$2 as TaskCollection,
724
4241
  TaskModel,
725
- _sfc_main$1 as TaskPlanningCollection,
726
- TaskPlanningModel,
727
- _sfc_main as TaskPlanningSingle,
728
- _sfc_main$2 as TaskSingle,
4242
+ _sfc_main$1 as TaskSingle,
4243
+ _sfc_main as TaskWork,
4244
+ _sfc_main$3 as TaskWorkButton,
729
4245
  _sfc_main$6 as XxxButton
730
4246
  };