twenty-frontend 0.3.4 → 0.3.5

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.
@@ -461,746 +461,345 @@ if (true) {
461
461
  } else {}
462
462
 
463
463
 
464
- /***/ }),
465
-
466
- /***/ 952:
467
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
468
-
469
-
470
- Object.defineProperty(exports, "__esModule", ({ value: true }));
471
- exports.ParamContext = void 0;
472
- const react_1 = __webpack_require__(294);
473
- exports.ParamContext = (0, react_1.createContext)({});
464
+ /***/ })
474
465
 
466
+ /******/ });
467
+ /************************************************************************/
468
+ /******/ // The module cache
469
+ /******/ var __webpack_module_cache__ = {};
470
+ /******/
471
+ /******/ // The require function
472
+ /******/ function __webpack_require__(moduleId) {
473
+ /******/ // Check if module is in cache
474
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
475
+ /******/ if (cachedModule !== undefined) {
476
+ /******/ return cachedModule.exports;
477
+ /******/ }
478
+ /******/ // Create a new module (and put it into the cache)
479
+ /******/ var module = __webpack_module_cache__[moduleId] = {
480
+ /******/ // no module.id needed
481
+ /******/ // no module.loaded needed
482
+ /******/ exports: {}
483
+ /******/ };
484
+ /******/
485
+ /******/ // Execute the module function
486
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
487
+ /******/
488
+ /******/ // Return the exports of the module
489
+ /******/ return module.exports;
490
+ /******/ }
491
+ /******/
492
+ /************************************************************************/
493
+ /******/ /* webpack/runtime/create fake namespace object */
494
+ /******/ (() => {
495
+ /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
496
+ /******/ var leafPrototypes;
497
+ /******/ // create a fake namespace object
498
+ /******/ // mode & 1: value is a module id, require it
499
+ /******/ // mode & 2: merge all properties of value into the ns
500
+ /******/ // mode & 4: return value when already ns object
501
+ /******/ // mode & 16: return value when it's Promise-like
502
+ /******/ // mode & 8|1: behave like require
503
+ /******/ __webpack_require__.t = function(value, mode) {
504
+ /******/ if(mode & 1) value = this(value);
505
+ /******/ if(mode & 8) return value;
506
+ /******/ if(typeof value === 'object' && value) {
507
+ /******/ if((mode & 4) && value.__esModule) return value;
508
+ /******/ if((mode & 16) && typeof value.then === 'function') return value;
509
+ /******/ }
510
+ /******/ var ns = Object.create(null);
511
+ /******/ __webpack_require__.r(ns);
512
+ /******/ var def = {};
513
+ /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
514
+ /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
515
+ /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
516
+ /******/ }
517
+ /******/ def['default'] = () => (value);
518
+ /******/ __webpack_require__.d(ns, def);
519
+ /******/ return ns;
520
+ /******/ };
521
+ /******/ })();
522
+ /******/
523
+ /******/ /* webpack/runtime/define property getters */
524
+ /******/ (() => {
525
+ /******/ // define getter functions for harmony exports
526
+ /******/ __webpack_require__.d = (exports, definition) => {
527
+ /******/ for(var key in definition) {
528
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
529
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
530
+ /******/ }
531
+ /******/ }
532
+ /******/ };
533
+ /******/ })();
534
+ /******/
535
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
536
+ /******/ (() => {
537
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
538
+ /******/ })();
539
+ /******/
540
+ /******/ /* webpack/runtime/make namespace object */
541
+ /******/ (() => {
542
+ /******/ // define __esModule on exports
543
+ /******/ __webpack_require__.r = (exports) => {
544
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
545
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
546
+ /******/ }
547
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
548
+ /******/ };
549
+ /******/ })();
550
+ /******/
551
+ /************************************************************************/
552
+ var __webpack_exports__ = {};
553
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
554
+ (() => {
475
555
 
476
- /***/ }),
556
+ // EXTERNAL MODULE: ./node_modules/react-dom/client.js
557
+ var client = __webpack_require__(745);
558
+ ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
559
+ /******************************************************************************
560
+ Copyright (c) Microsoft Corporation.
477
561
 
478
- /***/ 609:
479
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
562
+ Permission to use, copy, modify, and/or distribute this software for any
563
+ purpose with or without fee is hereby granted.
480
564
 
565
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
566
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
567
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
568
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
569
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
570
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
571
+ PERFORMANCE OF THIS SOFTWARE.
572
+ ***************************************************************************** */
573
+ /* global Reflect, Promise, SuppressedError, Symbol */
481
574
 
482
- var __importDefault = (this && this.__importDefault) || function (mod) {
483
- return (mod && mod.__esModule) ? mod : { "default": mod };
575
+ var extendStatics = function(d, b) {
576
+ extendStatics = Object.setPrototypeOf ||
577
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
578
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
579
+ return extendStatics(d, b);
484
580
  };
485
- Object.defineProperty(exports, "__esModule", ({ value: true }));
486
- exports.App = void 0;
487
- const react_1 = __importDefault(__webpack_require__(294));
488
- const client_1 = __webpack_require__(430);
489
- const Context_1 = __webpack_require__(952);
490
- function App({ children }) {
491
- const client = new client_1.ApolloClient({
492
- uri: "/graphql",
493
- cache: new client_1.InMemoryCache(),
494
- });
495
- const params = Object.fromEntries(location.hash
496
- .substring(1, location.hash.length)
497
- .split(",")
498
- .map(e => e.split("=")));
499
- return (react_1.default.createElement(Context_1.ParamContext.Provider, { value: params },
500
- react_1.default.createElement(client_1.ApolloProvider, { client: client }, children)));
581
+
582
+ function __extends(d, b) {
583
+ if (typeof b !== "function" && b !== null)
584
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
585
+ extendStatics(d, b);
586
+ function __() { this.constructor = d; }
587
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
501
588
  }
502
- exports.App = App;
503
589
 
590
+ var tslib_es6_assign = function() {
591
+ tslib_es6_assign = Object.assign || function __assign(t) {
592
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
593
+ s = arguments[i];
594
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
595
+ }
596
+ return t;
597
+ }
598
+ return tslib_es6_assign.apply(this, arguments);
599
+ }
504
600
 
505
- /***/ }),
601
+ function __rest(s, e) {
602
+ var t = {};
603
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
604
+ t[p] = s[p];
605
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
606
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
607
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
608
+ t[p[i]] = s[p[i]];
609
+ }
610
+ return t;
611
+ }
506
612
 
507
- /***/ 46:
508
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
613
+ function __decorate(decorators, target, key, desc) {
614
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
615
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
616
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
617
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
618
+ }
509
619
 
620
+ function __param(paramIndex, decorator) {
621
+ return function (target, key) { decorator(target, key, paramIndex); }
622
+ }
510
623
 
511
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
512
- if (k2 === undefined) k2 = k;
513
- var desc = Object.getOwnPropertyDescriptor(m, k);
514
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
515
- desc = { enumerable: true, get: function() { return m[k]; } };
516
- }
517
- Object.defineProperty(o, k2, desc);
518
- }) : (function(o, m, k, k2) {
519
- if (k2 === undefined) k2 = k;
520
- o[k2] = m[k];
521
- }));
522
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
523
- Object.defineProperty(o, "default", { enumerable: true, value: v });
524
- }) : function(o, v) {
525
- o["default"] = v;
526
- });
527
- var __importStar = (this && this.__importStar) || function (mod) {
528
- if (mod && mod.__esModule) return mod;
529
- var result = {};
530
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
531
- __setModuleDefault(result, mod);
532
- return result;
533
- };
534
- Object.defineProperty(exports, "__esModule", ({ value: true }));
535
- exports.NavBar = void 0;
536
- const react_1 = __importStar(__webpack_require__(294));
537
- const Context_1 = __webpack_require__(952);
538
- const ProjectSelect_1 = __webpack_require__(818);
539
- const BASE_CLASSNAMES = ["block", "w-3/4", "no-underline", "p-3", "mt-2"];
540
- const ACTIVE_CLASSNAMES = [
541
- ...BASE_CLASSNAMES,
542
- "rounded",
543
- "bg-secondary",
544
- "text-primary",
545
- ].join(" ");
546
- const INACTIVE_CLASSNAMES = [
547
- ...BASE_CLASSNAMES,
548
- "text-accent",
549
- "hover-bg-secondary",
550
- ].join(" ");
551
- const find = (path, bar) => {
552
- let item = null;
553
- Object.values(bar)
554
- .flat()
555
- .forEach(i => {
556
- if (i.href === path) {
557
- item = i;
558
- }
559
- });
560
- return item;
624
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
625
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
626
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
627
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
628
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
629
+ var _, done = false;
630
+ for (var i = decorators.length - 1; i >= 0; i--) {
631
+ var context = {};
632
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
633
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
634
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
635
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
636
+ if (kind === "accessor") {
637
+ if (result === void 0) continue;
638
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
639
+ if (_ = accept(result.get)) descriptor.get = _;
640
+ if (_ = accept(result.set)) descriptor.set = _;
641
+ if (_ = accept(result.init)) initializers.unshift(_);
642
+ }
643
+ else if (_ = accept(result)) {
644
+ if (kind === "field") initializers.unshift(_);
645
+ else descriptor[key] = _;
646
+ }
647
+ }
648
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
649
+ done = true;
561
650
  };
562
- function NavBar() {
563
- const params = (0, react_1.useContext)(Context_1.ParamContext);
564
- const bar = {
565
- Tasks: [
566
- { text: "All tasks", href: "/tasks/" },
567
- { text: "New task", href: "/tasks/new/" },
568
- ],
569
- Projects: [{ text: "All projects", href: "/projects" }],
570
- };
571
- const activeItem = find(location.pathname, bar);
572
- return (react_1.default.createElement(react_1.default.Fragment, null,
573
- ...Object.keys(bar).map(key => {
574
- const items = bar[key];
575
- return (react_1.default.createElement(react_1.default.Fragment, null,
576
- react_1.default.createElement("h3", null, key),
577
- react_1.default.createElement("ul", null, ...items.flatMap(item => {
578
- return (react_1.default.createElement("li", null,
579
- react_1.default.createElement("a", { className: activeItem == item
580
- ? ACTIVE_CLASSNAMES
581
- : INACTIVE_CLASSNAMES, href: item.href }, item.text)));
582
- }))));
583
- }),
584
- react_1.default.createElement("h3", null, "Filters"),
585
- react_1.default.createElement(ProjectSelect_1.ProjectSelect, { selected: params.projectId, onChange: project => {
586
- if (project) {
587
- location.hash = `projectId=${project.id}`;
588
- }
589
- else {
590
- location.hash = "";
591
- }
592
- location.reload();
593
- } })));
594
- }
595
- exports.NavBar = NavBar;
596
651
 
652
+ function __runInitializers(thisArg, initializers, value) {
653
+ var useValue = arguments.length > 2;
654
+ for (var i = 0; i < initializers.length; i++) {
655
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
656
+ }
657
+ return useValue ? value : void 0;
658
+ };
597
659
 
598
- /***/ }),
660
+ function __propKey(x) {
661
+ return typeof x === "symbol" ? x : "".concat(x);
662
+ };
599
663
 
600
- /***/ 818:
601
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
664
+ function __setFunctionName(f, name, prefix) {
665
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
666
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
667
+ };
602
668
 
669
+ function __metadata(metadataKey, metadataValue) {
670
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
671
+ }
603
672
 
604
- var __importDefault = (this && this.__importDefault) || function (mod) {
605
- return (mod && mod.__esModule) ? mod : { "default": mod };
606
- };
607
- Object.defineProperty(exports, "__esModule", ({ value: true }));
608
- exports.ProjectSelect = void 0;
609
- const react_1 = __importDefault(__webpack_require__(294));
610
- const useProjects_1 = __webpack_require__(547);
611
- const Select_1 = __webpack_require__(21);
612
- function ProjectSelect({ onChange, selected }) {
613
- const { data, loading } = (0, useProjects_1.useProjects)();
614
- const projects = data?.projects || [];
615
- const options = projects.map(project => ({
616
- label: (react_1.default.createElement("div", { className: "flex" },
617
- react_1.default.createElement("span", { style: { backgroundColor: project.color }, className: "flex w-2/8 rounded w-8 h-8 mr-3 cursor-pointer" }),
618
- react_1.default.createElement("span", { className: "flex align-items-center" }, project.name))),
619
- value: String(project.id),
620
- }));
621
- if (loading) {
622
- return null;
623
- }
624
- return (react_1.default.createElement(Select_1.Select, { onChange: (option) => {
625
- const project = projects.find(p => String(p.id) == option.value);
626
- onChange(project);
627
- }, options: options, selected: String(selected), placeholder: "Any project" }));
628
- 1;
673
+ function __awaiter(thisArg, _arguments, P, generator) {
674
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
675
+ return new (P || (P = Promise))(function (resolve, reject) {
676
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
677
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
678
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
679
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
680
+ });
629
681
  }
630
- exports.ProjectSelect = ProjectSelect;
631
-
632
-
633
- /***/ }),
634
-
635
- /***/ 65:
636
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
637
682
 
638
-
639
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
640
- if (k2 === undefined) k2 = k;
641
- var desc = Object.getOwnPropertyDescriptor(m, k);
642
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
643
- desc = { enumerable: true, get: function() { return m[k]; } };
644
- }
645
- Object.defineProperty(o, k2, desc);
646
- }) : (function(o, m, k, k2) {
647
- if (k2 === undefined) k2 = k;
648
- o[k2] = m[k];
649
- }));
650
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
651
- Object.defineProperty(o, "default", { enumerable: true, value: v });
652
- }) : function(o, v) {
653
- o["default"] = v;
654
- });
655
- var __importStar = (this && this.__importStar) || function (mod) {
656
- if (mod && mod.__esModule) return mod;
657
- var result = {};
658
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
659
- __setModuleDefault(result, mod);
660
- return result;
661
- };
662
- Object.defineProperty(exports, "__esModule", ({ value: true }));
663
- exports.Projects = void 0;
664
- const useSetRandomProjectColor_1 = __webpack_require__(565);
665
- const react_1 = __importStar(__webpack_require__(294));
666
- const NavBar_1 = __webpack_require__(46);
667
- const useProjects_1 = __webpack_require__(547);
668
- function Projects() {
669
- const { data, loading } = (0, useProjects_1.useProjects)();
670
- const setRandomProjectColor = (0, useSetRandomProjectColor_1.useSetRandomProjectColor)();
671
- const projects = data?.projects;
672
- (0, react_1.useEffect)(() => {
673
- document.title = "Projects";
674
- }, []);
675
- if (loading) {
676
- return;
677
- }
678
- return (react_1.default.createElement("div", { className: "flex" },
679
- react_1.default.createElement("div", { className: "w-1/4" },
680
- react_1.default.createElement(NavBar_1.NavBar, null)),
681
- react_1.default.createElement("div", { className: "w-3/4" },
682
- react_1.default.createElement("h1", { className: "bg-secondary text-primary p-3 rounded" }, "Projects"),
683
- react_1.default.createElement("ul", { className: "flex flex-wrap" }, projects.map((project, i) => {
684
- return (react_1.default.createElement("li", { className: "flex flex-row p-3 hover-bg-secondary w-full", key: i },
685
- react_1.default.createElement("div", { style: { backgroundColor: project.color }, className: "w-2/8 rounded w-12 h-12 mr-3 cursor-pointer", onClick: async () => {
686
- await setRandomProjectColor({
687
- variables: { projectId: project.id },
688
- });
689
- } }),
690
- react_1.default.createElement("a", { className: "w-6/8 no-underline text-accent block h-14", href: `/tasks/#projectId=${project.id}` },
691
- react_1.default.createElement("span", { className: "block w-full" }, project.name),
692
- react_1.default.createElement("span", { className: "block w-full text-smaller text-secondary" }, project.path))));
693
- })))));
683
+ function __generator(thisArg, body) {
684
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
685
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
686
+ function verb(n) { return function (v) { return step([n, v]); }; }
687
+ function step(op) {
688
+ if (f) throw new TypeError("Generator is already executing.");
689
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
690
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
691
+ if (y = 0, t) op = [op[0] & 2, t.value];
692
+ switch (op[0]) {
693
+ case 0: case 1: t = op; break;
694
+ case 4: _.label++; return { value: op[1], done: false };
695
+ case 5: _.label++; y = op[1]; op = [0]; continue;
696
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
697
+ default:
698
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
699
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
700
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
701
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
702
+ if (t[2]) _.ops.pop();
703
+ _.trys.pop(); continue;
704
+ }
705
+ op = body.call(thisArg, _);
706
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
707
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
708
+ }
694
709
  }
695
- exports.Projects = Projects;
696
-
697
-
698
- /***/ }),
699
-
700
- /***/ 21:
701
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
702
710
 
703
-
704
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
705
- if (k2 === undefined) k2 = k;
706
- var desc = Object.getOwnPropertyDescriptor(m, k);
707
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
711
+ var __createBinding = Object.create ? (function(o, m, k, k2) {
712
+ if (k2 === undefined) k2 = k;
713
+ var desc = Object.getOwnPropertyDescriptor(m, k);
714
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
708
715
  desc = { enumerable: true, get: function() { return m[k]; } };
709
- }
710
- Object.defineProperty(o, k2, desc);
716
+ }
717
+ Object.defineProperty(o, k2, desc);
711
718
  }) : (function(o, m, k, k2) {
712
- if (k2 === undefined) k2 = k;
713
- o[k2] = m[k];
714
- }));
715
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
716
- Object.defineProperty(o, "default", { enumerable: true, value: v });
717
- }) : function(o, v) {
718
- o["default"] = v;
719
+ if (k2 === undefined) k2 = k;
720
+ o[k2] = m[k];
719
721
  });
720
- var __importStar = (this && this.__importStar) || function (mod) {
721
- if (mod && mod.__esModule) return mod;
722
- var result = {};
723
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
724
- __setModuleDefault(result, mod);
725
- return result;
726
- };
727
- Object.defineProperty(exports, "__esModule", ({ value: true }));
728
- exports.Select = void 0;
729
- const react_1 = __importStar(__webpack_require__(294));
730
- const LI_CLASSNAME = [
731
- "flex",
732
- "align-items-center",
733
- "w-3/4",
734
- "hover-bg-secondary",
735
- "p-3",
736
- "mt-2",
737
- "cursor-pointer",
738
- ].join(" ");
739
- const ACTIVE_CLASSNAME = [
740
- LI_CLASSNAME,
741
- "rounded",
742
- "border",
743
- "border-solid",
744
- "border-secondary",
745
- "text-primary",
746
- "bg-secondary"
747
- ].join(" ");
748
- const Select = ({ onChange, options, selected, placeholder }) => {
749
- const selectOptions = [{ label: placeholder, value: "" }, ...options];
750
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
751
- const [option, setOption] = (0, react_1.useState)(options.find(o => o.value === selected) || selectOptions[0]);
752
- const onClick = (option) => {
753
- if (isOpen) {
754
- setOption(option);
755
- setIsOpen(false);
756
- onChange(option);
757
- }
758
- else {
759
- setIsOpen(true);
760
- }
761
- };
762
- const getClassName = (o1, o2) => {
763
- if (o1.value === o2.value) {
764
- return ACTIVE_CLASSNAME;
765
- }
766
- else {
767
- return (!isOpen && o1.value !== o2.value) ? "hidden" : LI_CLASSNAME;
768
- }
769
- };
770
- (0, react_1.useEffect)(() => {
771
- const onDocumentClick = () => {
772
- if (isOpen) {
773
- setIsOpen(false);
774
- }
775
- };
776
- document.body.addEventListener('click', onDocumentClick);
777
- return () => document.body.removeEventListener('click', onDocumentClick);
778
- }, [isOpen]);
779
- return (react_1.default.createElement("ul", null, selectOptions.map((o, i) => (react_1.default.createElement("li", { key: i, "data-value": o.value, onClick: (e) => [e.stopPropagation(), onClick(o)], className: getClassName(o, option) }, o.label)))));
780
- };
781
- exports.Select = Select;
782
-
783
722
 
784
- /***/ }),
785
-
786
- /***/ 565:
787
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
723
+ function __exportStar(m, o) {
724
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
725
+ }
788
726
 
727
+ function __values(o) {
728
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
729
+ if (m) return m.call(o);
730
+ if (o && typeof o.length === "number") return {
731
+ next: function () {
732
+ if (o && i >= o.length) o = void 0;
733
+ return { value: o && o[i++], done: !o };
734
+ }
735
+ };
736
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
737
+ }
789
738
 
790
- Object.defineProperty(exports, "__esModule", ({ value: true }));
791
- exports.useSetRandomProjectColor = void 0;
792
- const client_1 = __webpack_require__(430);
793
- const GQL = (0, client_1.gql) `
794
- mutation SetRandomProjectColor($projectId: Int!) {
795
- setRandomProjectColor(projectId: $projectId) {
796
- project {
797
- id
798
- color
739
+ function __read(o, n) {
740
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
741
+ if (!m) return o;
742
+ var i = m.call(o), r, ar = [], e;
743
+ try {
744
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
745
+ }
746
+ catch (error) { e = { error: error }; }
747
+ finally {
748
+ try {
749
+ if (r && !r.done && (m = i["return"])) m.call(i);
799
750
  }
800
- errors
801
- }
751
+ finally { if (e) throw e.error; }
802
752
  }
803
- `;
804
- function useSetRandomProjectColor() {
805
- const [setRandomProjectColor] = (0, client_1.useMutation)(GQL);
806
- return ({ variables }) => {
807
- return setRandomProjectColor({
808
- variables,
809
- update(cache, { data }) {
810
- const project = data.project;
811
- modify(cache, project);
812
- },
813
- });
814
- };
753
+ return ar;
815
754
  }
816
- exports.useSetRandomProjectColor = useSetRandomProjectColor;
817
- const modify = (cache, project) => {
818
- cache.modify({
819
- id: cache.identify(project),
820
- fields: {
821
- projects(existingProjects = []) {
822
- cache.writeFragment({
823
- id: cache.identify(project),
824
- data: { project },
825
- fragment: (0, client_1.gql) `
826
- fragment P on Project {
827
- color
828
- }
829
- `,
830
- });
831
- return [...existingProjects, project];
832
- },
833
- },
834
- });
835
- };
836
-
837
-
838
- /***/ }),
839
755
 
840
- /***/ 547:
841
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
756
+ /** @deprecated */
757
+ function __spread() {
758
+ for (var ar = [], i = 0; i < arguments.length; i++)
759
+ ar = ar.concat(__read(arguments[i]));
760
+ return ar;
761
+ }
842
762
 
763
+ /** @deprecated */
764
+ function __spreadArrays() {
765
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
766
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
767
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
768
+ r[k] = a[j];
769
+ return r;
770
+ }
843
771
 
844
- Object.defineProperty(exports, "__esModule", ({ value: true }));
845
- exports.useProjects = void 0;
846
- const client_1 = __webpack_require__(430);
847
- const GQL = (0, client_1.gql) `
848
- query Query {
849
- projects {
850
- id
851
- name
852
- path
853
- color
854
- }
772
+ function tslib_es6_spreadArray(to, from, pack) {
773
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
774
+ if (ar || !(i in from)) {
775
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
776
+ ar[i] = from[i];
777
+ }
855
778
  }
856
- `;
857
- function useProjects() {
858
- return (0, client_1.useQuery)(GQL);
779
+ return to.concat(ar || Array.prototype.slice.call(from));
859
780
  }
860
- exports.useProjects = useProjects;
861
-
862
781
 
863
- /***/ }),
782
+ function __await(v) {
783
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
784
+ }
864
785
 
865
- /***/ 677:
866
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
786
+ function __asyncGenerator(thisArg, _arguments, generator) {
787
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
788
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
789
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
790
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
791
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
792
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
793
+ function fulfill(value) { resume("next", value); }
794
+ function reject(value) { resume("throw", value); }
795
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
796
+ }
867
797
 
868
-
869
- var __importDefault = (this && this.__importDefault) || function (mod) {
870
- return (mod && mod.__esModule) ? mod : { "default": mod };
871
- };
872
- Object.defineProperty(exports, "__esModule", ({ value: true }));
873
- const react_1 = __importDefault(__webpack_require__(294));
874
- const client_1 = __importDefault(__webpack_require__(745));
875
- const App_1 = __webpack_require__(609);
876
- const Projects_1 = __webpack_require__(65);
877
- (function () {
878
- const root = document.querySelector(".react-root");
879
- client_1.default.createRoot(root).render(react_1.default.createElement(App_1.App, null,
880
- react_1.default.createElement(Projects_1.Projects, null)));
881
- })();
882
-
883
-
884
- /***/ }),
885
-
886
- /***/ 430:
887
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
888
-
889
- // ESM COMPAT FLAG
890
- __webpack_require__.r(__webpack_exports__);
891
-
892
- // EXPORTS
893
- __webpack_require__.d(__webpack_exports__, {
894
- ApolloCache: () => (/* reexport */ ApolloCache),
895
- ApolloClient: () => (/* reexport */ ApolloClient),
896
- ApolloConsumer: () => (/* reexport */ ApolloConsumer),
897
- ApolloError: () => (/* reexport */ ApolloError),
898
- ApolloLink: () => (/* reexport */ ApolloLink),
899
- ApolloProvider: () => (/* reexport */ ApolloProvider),
900
- Cache: () => (/* reexport */ Cache),
901
- DocumentTransform: () => (/* reexport */ DocumentTransform),
902
- DocumentType: () => (/* reexport */ DocumentType),
903
- HttpLink: () => (/* reexport */ HttpLink),
904
- InMemoryCache: () => (/* reexport */ InMemoryCache),
905
- MissingFieldError: () => (/* reexport */ MissingFieldError),
906
- NetworkStatus: () => (/* reexport */ NetworkStatus),
907
- Observable: () => (/* reexport */ Observable),
908
- ObservableQuery: () => (/* reexport */ ObservableQuery),
909
- checkFetcher: () => (/* reexport */ checkFetcher),
910
- concat: () => (/* reexport */ concat),
911
- createHttpLink: () => (/* reexport */ createHttpLink),
912
- createSignalIfSupported: () => (/* reexport */ createSignalIfSupported),
913
- defaultDataIdFromObject: () => (/* reexport */ defaultDataIdFromObject),
914
- defaultPrinter: () => (/* reexport */ defaultPrinter),
915
- disableExperimentalFragmentVariables: () => (/* reexport */ disableExperimentalFragmentVariables),
916
- disableFragmentWarnings: () => (/* reexport */ disableFragmentWarnings),
917
- empty: () => (/* reexport */ empty),
918
- enableExperimentalFragmentVariables: () => (/* reexport */ enableExperimentalFragmentVariables),
919
- execute: () => (/* reexport */ execute),
920
- fallbackHttpConfig: () => (/* reexport */ fallbackHttpConfig),
921
- from: () => (/* reexport */ from),
922
- fromError: () => (/* reexport */ fromError),
923
- fromPromise: () => (/* reexport */ fromPromise),
924
- getApolloContext: () => (/* reexport */ getApolloContext),
925
- gql: () => (/* reexport */ gql),
926
- isApolloError: () => (/* reexport */ isApolloError),
927
- isNetworkRequestSettled: () => (/* reexport */ isNetworkRequestSettled),
928
- isReference: () => (/* reexport */ isReference),
929
- makeReference: () => (/* reexport */ makeReference),
930
- makeVar: () => (/* reexport */ makeVar),
931
- mergeOptions: () => (/* reexport */ mergeOptions),
932
- operationName: () => (/* reexport */ operationName),
933
- parseAndCheckHttpResponse: () => (/* reexport */ parseAndCheckHttpResponse),
934
- parser: () => (/* reexport */ parser),
935
- resetApolloContext: () => (/* reexport */ resetApolloContext),
936
- resetCaches: () => (/* reexport */ resetCaches),
937
- rewriteURIForGET: () => (/* reexport */ rewriteURIForGET),
938
- selectHttpOptionsAndBody: () => (/* reexport */ selectHttpOptionsAndBody),
939
- selectHttpOptionsAndBodyInternal: () => (/* reexport */ selectHttpOptionsAndBodyInternal),
940
- selectURI: () => (/* reexport */ selectURI),
941
- serializeFetchParameter: () => (/* reexport */ serializeFetchParameter),
942
- setLogVerbosity: () => (/* reexport */ setVerbosity),
943
- skipToken: () => (/* reexport */ skipToken),
944
- split: () => (/* reexport */ split),
945
- throwServerError: () => (/* reexport */ throwServerError),
946
- toPromise: () => (/* reexport */ toPromise),
947
- useApolloClient: () => (/* reexport */ useApolloClient),
948
- useBackgroundQuery: () => (/* reexport */ useBackgroundQuery),
949
- useFragment: () => (/* reexport */ useFragment),
950
- useLazyQuery: () => (/* reexport */ useLazyQuery),
951
- useMutation: () => (/* reexport */ useMutation),
952
- useQuery: () => (/* reexport */ useQuery),
953
- useReactiveVar: () => (/* reexport */ useReactiveVar),
954
- useReadQuery: () => (/* reexport */ useReadQuery),
955
- useSubscription: () => (/* reexport */ useSubscription),
956
- useSuspenseQuery: () => (/* reexport */ useSuspenseQuery)
957
- });
958
-
959
- ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
960
- /******************************************************************************
961
- Copyright (c) Microsoft Corporation.
962
-
963
- Permission to use, copy, modify, and/or distribute this software for any
964
- purpose with or without fee is hereby granted.
965
-
966
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
967
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
968
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
969
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
970
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
971
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
972
- PERFORMANCE OF THIS SOFTWARE.
973
- ***************************************************************************** */
974
- /* global Reflect, Promise, SuppressedError, Symbol */
975
-
976
- var extendStatics = function(d, b) {
977
- extendStatics = Object.setPrototypeOf ||
978
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
979
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
980
- return extendStatics(d, b);
981
- };
982
-
983
- function __extends(d, b) {
984
- if (typeof b !== "function" && b !== null)
985
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
986
- extendStatics(d, b);
987
- function __() { this.constructor = d; }
988
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
989
- }
990
-
991
- var tslib_es6_assign = function() {
992
- tslib_es6_assign = Object.assign || function __assign(t) {
993
- for (var s, i = 1, n = arguments.length; i < n; i++) {
994
- s = arguments[i];
995
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
996
- }
997
- return t;
998
- }
999
- return tslib_es6_assign.apply(this, arguments);
1000
- }
1001
-
1002
- function __rest(s, e) {
1003
- var t = {};
1004
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1005
- t[p] = s[p];
1006
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
1007
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1008
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1009
- t[p[i]] = s[p[i]];
1010
- }
1011
- return t;
1012
- }
1013
-
1014
- function __decorate(decorators, target, key, desc) {
1015
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1016
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1017
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1018
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1019
- }
1020
-
1021
- function __param(paramIndex, decorator) {
1022
- return function (target, key) { decorator(target, key, paramIndex); }
1023
- }
1024
-
1025
- function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
1026
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
1027
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
1028
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
1029
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
1030
- var _, done = false;
1031
- for (var i = decorators.length - 1; i >= 0; i--) {
1032
- var context = {};
1033
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
1034
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
1035
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
1036
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
1037
- if (kind === "accessor") {
1038
- if (result === void 0) continue;
1039
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
1040
- if (_ = accept(result.get)) descriptor.get = _;
1041
- if (_ = accept(result.set)) descriptor.set = _;
1042
- if (_ = accept(result.init)) initializers.unshift(_);
1043
- }
1044
- else if (_ = accept(result)) {
1045
- if (kind === "field") initializers.unshift(_);
1046
- else descriptor[key] = _;
1047
- }
1048
- }
1049
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
1050
- done = true;
1051
- };
1052
-
1053
- function __runInitializers(thisArg, initializers, value) {
1054
- var useValue = arguments.length > 2;
1055
- for (var i = 0; i < initializers.length; i++) {
1056
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
1057
- }
1058
- return useValue ? value : void 0;
1059
- };
1060
-
1061
- function __propKey(x) {
1062
- return typeof x === "symbol" ? x : "".concat(x);
1063
- };
1064
-
1065
- function __setFunctionName(f, name, prefix) {
1066
- if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
1067
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
1068
- };
1069
-
1070
- function __metadata(metadataKey, metadataValue) {
1071
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
1072
- }
1073
-
1074
- function __awaiter(thisArg, _arguments, P, generator) {
1075
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1076
- return new (P || (P = Promise))(function (resolve, reject) {
1077
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1078
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1079
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1080
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1081
- });
1082
- }
1083
-
1084
- function __generator(thisArg, body) {
1085
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1086
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1087
- function verb(n) { return function (v) { return step([n, v]); }; }
1088
- function step(op) {
1089
- if (f) throw new TypeError("Generator is already executing.");
1090
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
1091
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1092
- if (y = 0, t) op = [op[0] & 2, t.value];
1093
- switch (op[0]) {
1094
- case 0: case 1: t = op; break;
1095
- case 4: _.label++; return { value: op[1], done: false };
1096
- case 5: _.label++; y = op[1]; op = [0]; continue;
1097
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
1098
- default:
1099
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1100
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1101
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1102
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1103
- if (t[2]) _.ops.pop();
1104
- _.trys.pop(); continue;
1105
- }
1106
- op = body.call(thisArg, _);
1107
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1108
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1109
- }
1110
- }
1111
-
1112
- var __createBinding = Object.create ? (function(o, m, k, k2) {
1113
- if (k2 === undefined) k2 = k;
1114
- var desc = Object.getOwnPropertyDescriptor(m, k);
1115
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1116
- desc = { enumerable: true, get: function() { return m[k]; } };
1117
- }
1118
- Object.defineProperty(o, k2, desc);
1119
- }) : (function(o, m, k, k2) {
1120
- if (k2 === undefined) k2 = k;
1121
- o[k2] = m[k];
1122
- });
1123
-
1124
- function __exportStar(m, o) {
1125
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
1126
- }
1127
-
1128
- function __values(o) {
1129
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1130
- if (m) return m.call(o);
1131
- if (o && typeof o.length === "number") return {
1132
- next: function () {
1133
- if (o && i >= o.length) o = void 0;
1134
- return { value: o && o[i++], done: !o };
1135
- }
1136
- };
1137
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1138
- }
1139
-
1140
- function __read(o, n) {
1141
- var m = typeof Symbol === "function" && o[Symbol.iterator];
1142
- if (!m) return o;
1143
- var i = m.call(o), r, ar = [], e;
1144
- try {
1145
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1146
- }
1147
- catch (error) { e = { error: error }; }
1148
- finally {
1149
- try {
1150
- if (r && !r.done && (m = i["return"])) m.call(i);
1151
- }
1152
- finally { if (e) throw e.error; }
1153
- }
1154
- return ar;
1155
- }
1156
-
1157
- /** @deprecated */
1158
- function __spread() {
1159
- for (var ar = [], i = 0; i < arguments.length; i++)
1160
- ar = ar.concat(__read(arguments[i]));
1161
- return ar;
1162
- }
1163
-
1164
- /** @deprecated */
1165
- function __spreadArrays() {
1166
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1167
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
1168
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
1169
- r[k] = a[j];
1170
- return r;
1171
- }
1172
-
1173
- function __spreadArray(to, from, pack) {
1174
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1175
- if (ar || !(i in from)) {
1176
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1177
- ar[i] = from[i];
1178
- }
1179
- }
1180
- return to.concat(ar || Array.prototype.slice.call(from));
1181
- }
1182
-
1183
- function __await(v) {
1184
- return this instanceof __await ? (this.v = v, this) : new __await(v);
1185
- }
1186
-
1187
- function __asyncGenerator(thisArg, _arguments, generator) {
1188
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1189
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
1190
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
1191
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
1192
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
1193
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
1194
- function fulfill(value) { resume("next", value); }
1195
- function reject(value) { resume("throw", value); }
1196
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
1197
- }
1198
-
1199
- function __asyncDelegator(o) {
1200
- var i, p;
1201
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
1202
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
1203
- }
798
+ function __asyncDelegator(o) {
799
+ var i, p;
800
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
801
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
802
+ }
1204
803
 
1205
804
  function __asyncValues(o) {
1206
805
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
@@ -1313,7 +912,7 @@ function __disposeResources(env) {
1313
912
  __read,
1314
913
  __spread,
1315
914
  __spreadArrays,
1316
- __spreadArray,
915
+ __spreadArray: tslib_es6_spreadArray,
1317
916
  __await,
1318
917
  __asyncGenerator,
1319
918
  __asyncDelegator,
@@ -2188,7 +1787,7 @@ function getFragmentQueryDocument(document, fragmentName) {
2188
1787
  }
2189
1788
  // Generate a query document with an operation that simply spreads the
2190
1789
  // fragment inside of it.
2191
- var query = tslib_es6_assign(tslib_es6_assign({}, document), { definitions: __spreadArray([
1790
+ var query = tslib_es6_assign(tslib_es6_assign({}, document), { definitions: tslib_es6_spreadArray([
2192
1791
  {
2193
1792
  kind: "OperationDefinition",
2194
1793
  // OperationTypeNode is an enum
@@ -3814,7 +3413,7 @@ function isApolloError(err) {
3814
3413
  // If the error message has already been set through the
3815
3414
  // constructor or otherwise, this function is a nop.
3816
3415
  var generateErrorMessage = function (err) {
3817
- var errors = __spreadArray(__spreadArray(__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true);
3416
+ var errors = tslib_es6_spreadArray(tslib_es6_spreadArray(tslib_es6_spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true);
3818
3417
  if (err.networkError)
3819
3418
  errors.push(err.networkError);
3820
3419
  return (errors
@@ -3904,7 +3503,7 @@ var DeepMerger = /** @class */ (function () {
3904
3503
  if (mergeDeep_hasOwnProperty.call(target, sourceKey)) {
3905
3504
  var targetValue = target[sourceKey];
3906
3505
  if (source[sourceKey] !== targetValue) {
3907
- var result = _this.reconciler.apply(_this, __spreadArray([target,
3506
+ var result = _this.reconciler.apply(_this, tslib_es6_spreadArray([target,
3908
3507
  source,
3909
3508
  sourceKey], context, false));
3910
3509
  // A well-implemented reconciler may return targetValue to indicate
@@ -5490,7 +5089,7 @@ var addTypenameToDocument = Object.assign(function (doc) {
5490
5089
  return;
5491
5090
  }
5492
5091
  // Create and return a new SelectionSet with a __typename Field.
5493
- return tslib_es6_assign(tslib_es6_assign({}, node), { selections: __spreadArray(__spreadArray([], selections, true), [TYPENAME_FIELD], false) });
5092
+ return tslib_es6_assign(tslib_es6_assign({}, node), { selections: tslib_es6_spreadArray(tslib_es6_spreadArray([], selections, true), [TYPENAME_FIELD], false) });
5494
5093
  },
5495
5094
  },
5496
5095
  });
@@ -7760,11 +7359,69 @@ function isTypeExtensionNode(node) {
7760
7359
  );
7761
7360
  }
7762
7361
 
7763
- ;// CONCATENATED MODULE: ./node_modules/@wry/caches/lib/strong.js
7764
- function defaultDispose() { }
7765
- class StrongCache {
7766
- constructor(max = Infinity, dispose = defaultDispose) {
7767
- this.max = max;
7362
+ ;// CONCATENATED MODULE: ./node_modules/optimism/node_modules/@wry/trie/lib/index.js
7363
+ // A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds
7364
+ // object keys weakly, yet can also hold non-object keys, unlike the
7365
+ // native `WeakMap`.
7366
+ // If no makeData function is supplied, the looked-up data will be an empty,
7367
+ // null-prototype Object.
7368
+ const lib_defaultMakeData = () => Object.create(null);
7369
+ // Useful for processing arguments objects as well as arrays.
7370
+ const { forEach: lib_forEach, slice: lib_slice } = Array.prototype;
7371
+ const { hasOwnProperty: _wry_trie_lib_hasOwnProperty } = Object.prototype;
7372
+ class lib_Trie {
7373
+ constructor(weakness = true, makeData = lib_defaultMakeData) {
7374
+ this.weakness = weakness;
7375
+ this.makeData = makeData;
7376
+ }
7377
+ lookup(...array) {
7378
+ return this.lookupArray(array);
7379
+ }
7380
+ lookupArray(array) {
7381
+ let node = this;
7382
+ lib_forEach.call(array, key => node = node.getChildTrie(key));
7383
+ return _wry_trie_lib_hasOwnProperty.call(node, "data")
7384
+ ? node.data
7385
+ : node.data = this.makeData(lib_slice.call(array));
7386
+ }
7387
+ peek(...array) {
7388
+ return this.peekArray(array);
7389
+ }
7390
+ peekArray(array) {
7391
+ let node = this;
7392
+ for (let i = 0, len = array.length; node && i < len; ++i) {
7393
+ const map = this.weakness && lib_isObjRef(array[i]) ? node.weak : node.strong;
7394
+ node = map && map.get(array[i]);
7395
+ }
7396
+ return node && node.data;
7397
+ }
7398
+ getChildTrie(key) {
7399
+ const map = this.weakness && lib_isObjRef(key)
7400
+ ? this.weak || (this.weak = new WeakMap())
7401
+ : this.strong || (this.strong = new Map());
7402
+ let child = map.get(key);
7403
+ if (!child)
7404
+ map.set(key, child = new lib_Trie(this.weakness, this.makeData));
7405
+ return child;
7406
+ }
7407
+ }
7408
+ function lib_isObjRef(value) {
7409
+ switch (typeof value) {
7410
+ case "object":
7411
+ if (value === null)
7412
+ break;
7413
+ // Fall through to return true...
7414
+ case "function":
7415
+ return true;
7416
+ }
7417
+ return false;
7418
+ }
7419
+ //# sourceMappingURL=index.js.map
7420
+ ;// CONCATENATED MODULE: ./node_modules/@wry/caches/lib/strong.js
7421
+ function defaultDispose() { }
7422
+ class StrongCache {
7423
+ constructor(max = Infinity, dispose = defaultDispose) {
7424
+ this.max = max;
7768
7425
  this.dispose = dispose;
7769
7426
  this.map = new Map();
7770
7427
  this.newest = null;
@@ -8470,7 +8127,7 @@ function dep(options) {
8470
8127
  // In those cases, just write your own custom makeCacheKey functions.
8471
8128
  let defaultKeyTrie;
8472
8129
  function defaultMakeCacheKey(...args) {
8473
- const trie = defaultKeyTrie || (defaultKeyTrie = new Trie(typeof WeakMap === "function"));
8130
+ const trie = defaultKeyTrie || (defaultKeyTrie = new lib_Trie(typeof WeakMap === "function"));
8474
8131
  return trie.lookupArray(args);
8475
8132
  }
8476
8133
  // If you're paranoid about memory leaks, or you want to avoid using WeakMap
@@ -11006,11 +10663,6 @@ var ApolloClient = /** @class */ (function () {
11006
10663
  }());
11007
10664
 
11008
10665
  //# sourceMappingURL=ApolloClient.js.map
11009
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/cache/core/types/Cache.js
11010
- var Cache;
11011
- (function (Cache) {
11012
- })(Cache || (Cache = {}));
11013
- //# sourceMappingURL=Cache.js.map
11014
10666
  ;// CONCATENATED MODULE: ./node_modules/@apollo/client/cache/core/cache.js
11015
10667
 
11016
10668
 
@@ -14065,91 +13717,76 @@ var InMemoryCache = /** @class */ (function (_super) {
14065
13717
  }(ApolloCache));
14066
13718
 
14067
13719
  //# sourceMappingURL=inMemoryCache.js.map
14068
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/core/empty.js
14069
-
14070
- var empty = ApolloLink.empty;
14071
- //# sourceMappingURL=empty.js.map
14072
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/core/from.js
14073
-
14074
- var from = ApolloLink.from;
14075
- //# sourceMappingURL=from.js.map
14076
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/core/split.js
14077
-
14078
- var split = ApolloLink.split;
14079
- //# sourceMappingURL=split.js.map
14080
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/core/concat.js
14081
-
14082
- var concat = ApolloLink.concat;
14083
- //# sourceMappingURL=concat.js.map
14084
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/core/index.js
14085
-
14086
-
14087
-
14088
-
14089
-
13720
+ // EXTERNAL MODULE: ./node_modules/react/index.js
13721
+ var react = __webpack_require__(294);
13722
+ var react_namespaceObject = /*#__PURE__*/__webpack_require__.t(react, 2);
13723
+ ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/context/ApolloContext.js
14090
13724
 
14091
13725
 
14092
13726
 
14093
- //# sourceMappingURL=index.js.map
14094
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/http/createSignalIfSupported.js
13727
+ // To make sure Apollo Client doesn't create more than one React context
13728
+ // (which can lead to problems like having an Apollo Client instance added
13729
+ // in one context, then attempting to retrieve it from another different
13730
+ // context), a single Apollo context is created and tracked in global state.
13731
+ var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
13732
+ function getApolloContext() {
13733
+ invariantWrappers_invariant( true, 45);
13734
+ var context = react.createContext[contextKey];
13735
+ if (!context) {
13736
+ Object.defineProperty(react.createContext, contextKey, {
13737
+ value: (context = react.createContext({})),
13738
+ enumerable: false,
13739
+ writable: false,
13740
+ configurable: true,
13741
+ });
13742
+ context.displayName = "ApolloContext";
13743
+ }
13744
+ return context;
13745
+ }
14095
13746
  /**
14096
- * @deprecated
14097
- * This is not used internally any more and will be removed in
14098
- * the next major version of Apollo Client.
13747
+ * @deprecated This function has no "resetting" effect since Apollo Client 3.4.12,
13748
+ * and will be removed in the next major version of Apollo Client.
13749
+ * If you want to get the Apollo Context, use `getApolloContext` instead.
14099
13750
  */
14100
- var createSignalIfSupported = function () {
14101
- if (typeof AbortController === "undefined")
14102
- return { controller: false, signal: false };
14103
- var controller = new AbortController();
14104
- var signal = controller.signal;
14105
- return { controller: controller, signal: signal };
14106
- };
14107
- //# sourceMappingURL=createSignalIfSupported.js.map
14108
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/http/index.js
14109
-
14110
-
14111
-
13751
+ var resetApolloContext = (/* unused pure expression or super */ null && (getApolloContext));
13752
+ //# sourceMappingURL=ApolloContext.js.map
13753
+ ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/context/ApolloProvider.js
14112
13754
 
14113
13755
 
14114
13756
 
14115
13757
 
13758
+ var ApolloProvider = function (_a) {
13759
+ var client = _a.client, children = _a.children;
13760
+ var ApolloContext = getApolloContext();
13761
+ var parentContext = react.useContext(ApolloContext);
13762
+ var context = react.useMemo(function () {
13763
+ return tslib_es6_assign(tslib_es6_assign({}, parentContext), { client: client || parentContext.client });
13764
+ }, [parentContext, client]);
13765
+ invariantWrappers_invariant(context.client, 46);
13766
+ return (react.createElement(ApolloContext.Provider, { value: context }, children));
13767
+ };
13768
+ //# sourceMappingURL=ApolloProvider.js.map
13769
+ ;// CONCATENATED MODULE: ./src/js/Context.ts
14116
13770
 
13771
+ const ParamContext = (0,react.createContext)({});
14117
13772
 
13773
+ ;// CONCATENATED MODULE: ./src/js/components/App.tsx
13774
+ /* provided dependency */ var React = __webpack_require__(294);
14118
13775
 
14119
- //# sourceMappingURL=index.js.map
14120
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/utils/toPromise.js
14121
13776
 
14122
- function toPromise(observable) {
14123
- var completed = false;
14124
- return new Promise(function (resolve, reject) {
14125
- observable.subscribe({
14126
- next: function (data) {
14127
- if (completed) {
14128
- globalThis.__DEV__ !== false && invariantWrappers_invariant.warn(42);
14129
- }
14130
- else {
14131
- completed = true;
14132
- resolve(data);
14133
- }
14134
- },
14135
- error: reject,
14136
- });
13777
+ function App({ children }) {
13778
+ const client = new ApolloClient({
13779
+ uri: "/graphql",
13780
+ cache: new InMemoryCache(),
14137
13781
  });
13782
+ const params = Object.fromEntries(location.hash
13783
+ .substring(1, location.hash.length)
13784
+ .split(",")
13785
+ .map(e => e.split("=")));
13786
+ return (React.createElement(ParamContext.Provider, { value: params },
13787
+ React.createElement(ApolloProvider, { client: client }, children)));
14138
13788
  }
14139
- //# sourceMappingURL=toPromise.js.map
14140
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/link/utils/fromPromise.js
14141
13789
 
14142
- function fromPromise(promise) {
14143
- return new Observable(function (observer) {
14144
- promise
14145
- .then(function (value) {
14146
- observer.next(value);
14147
- observer.complete();
14148
- })
14149
- .catch(observer.error.bind(observer));
14150
- });
14151
- }
14152
- //# sourceMappingURL=fromPromise.js.map
14153
13790
  ;// CONCATENATED MODULE: ./node_modules/graphql/jsutils/isObjectLike.mjs
14154
13791
  /**
14155
13792
  * Return true if `value` is object-like. A value is object-like if it's not
@@ -17268,114 +16905,278 @@ var extras = {
17268
16905
  gql["default"] = gql;
17269
16906
  /* harmony default export */ const graphql_tag_lib = ((/* unused pure expression or super */ null && (gql)));
17270
16907
  //# sourceMappingURL=index.js.map
17271
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/core/index.js
17272
- /* Core */
17273
-
17274
-
17275
-
17276
-
17277
-
17278
-
16908
+ ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/parser/index.js
17279
16909
 
17280
- /* Link */
16910
+ var DocumentType;
16911
+ (function (DocumentType) {
16912
+ DocumentType[DocumentType["Query"] = 0] = "Query";
16913
+ DocumentType[DocumentType["Mutation"] = 1] = "Mutation";
16914
+ DocumentType[DocumentType["Subscription"] = 2] = "Subscription";
16915
+ })(DocumentType || (DocumentType = {}));
16916
+ var cache = new Map();
16917
+ function operationName(type) {
16918
+ var name;
16919
+ switch (type) {
16920
+ case DocumentType.Query:
16921
+ name = "Query";
16922
+ break;
16923
+ case DocumentType.Mutation:
16924
+ name = "Mutation";
16925
+ break;
16926
+ case DocumentType.Subscription:
16927
+ name = "Subscription";
16928
+ break;
16929
+ }
16930
+ return name;
16931
+ }
16932
+ // This parser is mostly used to safety check incoming documents.
16933
+ function parser(document) {
16934
+ var cached = cache.get(document);
16935
+ if (cached)
16936
+ return cached;
16937
+ var variables, type, name;
16938
+ invariantWrappers_invariant(!!document && !!document.kind, 59, document);
16939
+ var fragments = [];
16940
+ var queries = [];
16941
+ var mutations = [];
16942
+ var subscriptions = [];
16943
+ for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {
16944
+ var x = _a[_i];
16945
+ if (x.kind === "FragmentDefinition") {
16946
+ fragments.push(x);
16947
+ continue;
16948
+ }
16949
+ if (x.kind === "OperationDefinition") {
16950
+ switch (x.operation) {
16951
+ case "query":
16952
+ queries.push(x);
16953
+ break;
16954
+ case "mutation":
16955
+ mutations.push(x);
16956
+ break;
16957
+ case "subscription":
16958
+ subscriptions.push(x);
16959
+ break;
16960
+ }
16961
+ }
16962
+ }
16963
+ invariantWrappers_invariant(!fragments.length ||
16964
+ queries.length ||
16965
+ mutations.length ||
16966
+ subscriptions.length, 60);
16967
+ invariantWrappers_invariant(
16968
+ queries.length + mutations.length + subscriptions.length <= 1,
16969
+ 61,
16970
+ document,
16971
+ queries.length,
16972
+ subscriptions.length,
16973
+ mutations.length
16974
+ );
16975
+ type = queries.length ? DocumentType.Query : DocumentType.Mutation;
16976
+ if (!queries.length && !mutations.length)
16977
+ type = DocumentType.Subscription;
16978
+ var definitions = queries.length ? queries
16979
+ : mutations.length ? mutations
16980
+ : subscriptions;
16981
+ invariantWrappers_invariant(definitions.length === 1, 62, document, definitions.length);
16982
+ var definition = definitions[0];
16983
+ variables = definition.variableDefinitions || [];
16984
+ if (definition.name && definition.name.kind === "Name") {
16985
+ name = definition.name.value;
16986
+ }
16987
+ else {
16988
+ name = "data"; // fallback to using data if no name
16989
+ }
16990
+ var payload = { name: name, type: type, variables: variables };
16991
+ cache.set(document, payload);
16992
+ return payload;
16993
+ }
16994
+ function verifyDocumentType(document, type) {
16995
+ var operation = parser(document);
16996
+ var requiredOperationName = operationName(type);
16997
+ var usedOperationName = operationName(operation.type);
16998
+ invariantWrappers_invariant(
16999
+ operation.type === type,
17000
+ 63,
17001
+ requiredOperationName,
17002
+ requiredOperationName,
17003
+ usedOperationName
17004
+ );
17005
+ }
17006
+ //# sourceMappingURL=index.js.map
17007
+ ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useApolloClient.js
17281
17008
 
17282
17009
 
17283
17010
 
17011
+ function useApolloClient(override) {
17012
+ var context = react.useContext(getApolloContext());
17013
+ var client = override || context.client;
17014
+ invariantWrappers_invariant(!!client, 49);
17015
+ return client;
17016
+ }
17017
+ //# sourceMappingURL=useApolloClient.js.map
17018
+ ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useMutation.js
17284
17019
 
17285
- /* Supporting */
17286
- // The verbosity of invariant.{log,warn,error} can be controlled globally
17287
- // (for anyone using the same ts-invariant package) by passing "log",
17288
- // "warn", "error", or "silent" to setVerbosity ("log" is the default).
17289
- // Note that all invariant.* logging is hidden in production.
17290
17020
 
17291
17021
 
17292
- setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent");
17293
- // Note that importing `gql` by itself, then destructuring
17294
- // additional properties separately before exporting, is intentional.
17295
- // Due to the way the `graphql-tag` library is setup, certain bundlers
17296
- // can't find the properties added to the exported `gql` function without
17297
- // additional guidance (e.g. Rollup - see
17298
- // https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).
17299
- // Instead of having people that are using bundlers with `@apollo/client` add
17300
- // extra bundler config to help `graphql-tag` exports be found (which would be
17301
- // awkward since they aren't importing `graphql-tag` themselves), this
17302
- // workaround of pulling the extra properties off the `gql` function,
17303
- // then re-exporting them separately, helps keeps bundlers happy without any
17304
- // additional config changes.
17305
17022
 
17306
- //# sourceMappingURL=index.js.map
17307
- // EXTERNAL MODULE: ./node_modules/react/index.js
17308
- var react = __webpack_require__(294);
17309
- var react_namespaceObject = /*#__PURE__*/__webpack_require__.t(react, 2);
17310
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/context/ApolloContext.js
17311
17023
 
17312
17024
 
17313
17025
 
17314
- // To make sure Apollo Client doesn't create more than one React context
17315
- // (which can lead to problems like having an Apollo Client instance added
17316
- // in one context, then attempting to retrieve it from another different
17317
- // context), a single Apollo context is created and tracked in global state.
17318
- var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
17319
- function getApolloContext() {
17320
- invariantWrappers_invariant( true, 45);
17321
- var context = react.createContext[contextKey];
17322
- if (!context) {
17323
- Object.defineProperty(react.createContext, contextKey, {
17324
- value: (context = react.createContext({})),
17325
- enumerable: false,
17326
- writable: false,
17327
- configurable: true,
17328
- });
17329
- context.displayName = "ApolloContext";
17330
- }
17331
- return context;
17332
- }
17333
- /**
17334
- * @deprecated This function has no "resetting" effect since Apollo Client 3.4.12,
17335
- * and will be removed in the next major version of Apollo Client.
17336
- * If you want to get the Apollo Context, use `getApolloContext` instead.
17337
- */
17338
- var resetApolloContext = getApolloContext;
17339
- //# sourceMappingURL=ApolloContext.js.map
17340
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/context/ApolloProvider.js
17341
-
17342
-
17343
-
17344
-
17345
- var ApolloProvider = function (_a) {
17346
- var client = _a.client, children = _a.children;
17347
- var ApolloContext = getApolloContext();
17348
- var parentContext = react.useContext(ApolloContext);
17349
- var context = react.useMemo(function () {
17350
- return tslib_es6_assign(tslib_es6_assign({}, parentContext), { client: client || parentContext.client });
17351
- }, [parentContext, client]);
17352
- invariantWrappers_invariant(context.client, 46);
17353
- return (react.createElement(ApolloContext.Provider, { value: context }, children));
17354
- };
17355
- //# sourceMappingURL=ApolloProvider.js.map
17356
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/context/ApolloConsumer.js
17357
-
17358
-
17026
+ function useMutation(mutation, options) {
17027
+ var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);
17028
+ verifyDocumentType(mutation, DocumentType.Mutation);
17029
+ var _a = react.useState({
17030
+ called: false,
17031
+ loading: false,
17032
+ client: client,
17033
+ }), result = _a[0], setResult = _a[1];
17034
+ var ref = react.useRef({
17035
+ result: result,
17036
+ mutationId: 0,
17037
+ isMounted: true,
17038
+ client: client,
17039
+ mutation: mutation,
17040
+ options: options,
17041
+ });
17042
+ // TODO: Trying to assign these in a useEffect or useLayoutEffect breaks
17043
+ // higher-order components.
17044
+ {
17045
+ Object.assign(ref.current, { client: client, options: options, mutation: mutation });
17046
+ }
17047
+ var execute = react.useCallback(function (executeOptions) {
17048
+ if (executeOptions === void 0) { executeOptions = {}; }
17049
+ var _a = ref.current, options = _a.options, mutation = _a.mutation;
17050
+ var baseOptions = tslib_es6_assign(tslib_es6_assign({}, options), { mutation: mutation });
17051
+ var client = executeOptions.client || ref.current.client;
17052
+ if (!ref.current.result.loading &&
17053
+ !baseOptions.ignoreResults &&
17054
+ ref.current.isMounted) {
17055
+ setResult((ref.current.result = {
17056
+ loading: true,
17057
+ error: void 0,
17058
+ data: void 0,
17059
+ called: true,
17060
+ client: client,
17061
+ }));
17062
+ }
17063
+ var mutationId = ++ref.current.mutationId;
17064
+ var clientOptions = mergeOptions(baseOptions, executeOptions);
17065
+ return client
17066
+ .mutate(clientOptions)
17067
+ .then(function (response) {
17068
+ var _a, _b;
17069
+ var data = response.data, errors = response.errors;
17070
+ var error = errors && errors.length > 0 ?
17071
+ new ApolloError({ graphQLErrors: errors })
17072
+ : void 0;
17073
+ var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);
17074
+ if (error && onError) {
17075
+ onError(error, clientOptions);
17076
+ }
17077
+ if (mutationId === ref.current.mutationId &&
17078
+ !clientOptions.ignoreResults) {
17079
+ var result_1 = {
17080
+ called: true,
17081
+ loading: false,
17082
+ data: data,
17083
+ error: error,
17084
+ client: client,
17085
+ };
17086
+ if (ref.current.isMounted && !equal(ref.current.result, result_1)) {
17087
+ setResult((ref.current.result = result_1));
17088
+ }
17089
+ }
17090
+ var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted);
17091
+ if (!error) {
17092
+ onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions);
17093
+ }
17094
+ return response;
17095
+ })
17096
+ .catch(function (error) {
17097
+ var _a;
17098
+ if (mutationId === ref.current.mutationId && ref.current.isMounted) {
17099
+ var result_2 = {
17100
+ loading: false,
17101
+ error: error,
17102
+ data: void 0,
17103
+ called: true,
17104
+ client: client,
17105
+ };
17106
+ if (!equal(ref.current.result, result_2)) {
17107
+ setResult((ref.current.result = result_2));
17108
+ }
17109
+ }
17110
+ var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);
17111
+ if (onError) {
17112
+ onError(error, clientOptions);
17113
+ // TODO(brian): why are we returning this here???
17114
+ return { data: void 0, errors: error };
17115
+ }
17116
+ throw error;
17117
+ });
17118
+ }, []);
17119
+ var reset = react.useCallback(function () {
17120
+ if (ref.current.isMounted) {
17121
+ var result_3 = { called: false, loading: false, client: client };
17122
+ Object.assign(ref.current, { mutationId: 0, result: result_3 });
17123
+ setResult(result_3);
17124
+ }
17125
+ }, []);
17126
+ react.useEffect(function () {
17127
+ ref.current.isMounted = true;
17128
+ return function () {
17129
+ ref.current.isMounted = false;
17130
+ };
17131
+ }, []);
17132
+ return [execute, tslib_es6_assign({ reset: reset }, result)];
17133
+ }
17134
+ //# sourceMappingURL=useMutation.js.map
17135
+ ;// CONCATENATED MODULE: ./src/js/hooks/mutations/useSetRandomProjectColor.tsx
17359
17136
 
17360
- var ApolloConsumer = function (props) {
17361
- var ApolloContext = getApolloContext();
17362
- return (react.createElement(ApolloContext.Consumer, null, function (context) {
17363
- invariantWrappers_invariant(context && context.client, 44);
17364
- return props.children(context.client);
17365
- }));
17137
+ const GQL = gql `
17138
+ mutation SetRandomProjectColor($projectId: Int!) {
17139
+ setRandomProjectColor(projectId: $projectId) {
17140
+ project {
17141
+ id
17142
+ color
17143
+ }
17144
+ errors
17145
+ }
17146
+ }
17147
+ `;
17148
+ function useSetRandomProjectColor() {
17149
+ const [setRandomProjectColor] = useMutation(GQL);
17150
+ return ({ variables }) => {
17151
+ return setRandomProjectColor({
17152
+ variables,
17153
+ update(cache, { data }) {
17154
+ const project = data.project;
17155
+ modify(cache, project);
17156
+ },
17157
+ });
17158
+ };
17159
+ }
17160
+ const modify = (cache, project) => {
17161
+ cache.modify({
17162
+ id: cache.identify(project),
17163
+ fields: {
17164
+ projects(existingProjects = []) {
17165
+ cache.writeFragment({
17166
+ id: cache.identify(project),
17167
+ data: { project },
17168
+ fragment: gql `
17169
+ fragment P on Project {
17170
+ color
17171
+ }
17172
+ `,
17173
+ });
17174
+ return [...existingProjects, project];
17175
+ },
17176
+ },
17177
+ });
17366
17178
  };
17367
- //# sourceMappingURL=ApolloConsumer.js.map
17368
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useApolloClient.js
17369
-
17370
-
17371
17179
 
17372
- function useApolloClient(override) {
17373
- var context = react.useContext(getApolloContext());
17374
- var client = override || context.client;
17375
- invariantWrappers_invariant(!!client, 49);
17376
- return client;
17377
- }
17378
- //# sourceMappingURL=useApolloClient.js.map
17379
17180
  ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useSyncExternalStore.js
17380
17181
 
17381
17182
 
@@ -17480,129 +17281,30 @@ function checkIfSnapshotChanged(_a) {
17480
17281
  }
17481
17282
  }
17482
17283
  //# sourceMappingURL=useSyncExternalStore.js.map
17483
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/parser/index.js
17284
+ ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useQuery.js
17484
17285
 
17485
- var DocumentType;
17486
- (function (DocumentType) {
17487
- DocumentType[DocumentType["Query"] = 0] = "Query";
17488
- DocumentType[DocumentType["Mutation"] = 1] = "Mutation";
17489
- DocumentType[DocumentType["Subscription"] = 2] = "Subscription";
17490
- })(DocumentType || (DocumentType = {}));
17491
- var cache = new Map();
17492
- function operationName(type) {
17493
- var name;
17494
- switch (type) {
17495
- case DocumentType.Query:
17496
- name = "Query";
17497
- break;
17498
- case DocumentType.Mutation:
17499
- name = "Mutation";
17500
- break;
17501
- case DocumentType.Subscription:
17502
- name = "Subscription";
17503
- break;
17504
- }
17505
- return name;
17286
+
17287
+
17288
+
17289
+
17290
+
17291
+
17292
+
17293
+
17294
+
17295
+
17296
+
17297
+ var useQuery_hasOwnProperty = Object.prototype.hasOwnProperty;
17298
+ function useQuery(query, options) {
17299
+ if (options === void 0) { options = Object.create(null); }
17300
+ return useInternalState(useApolloClient(options.client), query).useQuery(options);
17506
17301
  }
17507
- // This parser is mostly used to safety check incoming documents.
17508
- function parser(document) {
17509
- var cached = cache.get(document);
17510
- if (cached)
17511
- return cached;
17512
- var variables, type, name;
17513
- invariantWrappers_invariant(!!document && !!document.kind, 59, document);
17514
- var fragments = [];
17515
- var queries = [];
17516
- var mutations = [];
17517
- var subscriptions = [];
17518
- for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {
17519
- var x = _a[_i];
17520
- if (x.kind === "FragmentDefinition") {
17521
- fragments.push(x);
17522
- continue;
17523
- }
17524
- if (x.kind === "OperationDefinition") {
17525
- switch (x.operation) {
17526
- case "query":
17527
- queries.push(x);
17528
- break;
17529
- case "mutation":
17530
- mutations.push(x);
17531
- break;
17532
- case "subscription":
17533
- subscriptions.push(x);
17534
- break;
17535
- }
17536
- }
17537
- }
17538
- invariantWrappers_invariant(!fragments.length ||
17539
- queries.length ||
17540
- mutations.length ||
17541
- subscriptions.length, 60);
17542
- invariantWrappers_invariant(
17543
- queries.length + mutations.length + subscriptions.length <= 1,
17544
- 61,
17545
- document,
17546
- queries.length,
17547
- subscriptions.length,
17548
- mutations.length
17549
- );
17550
- type = queries.length ? DocumentType.Query : DocumentType.Mutation;
17551
- if (!queries.length && !mutations.length)
17552
- type = DocumentType.Subscription;
17553
- var definitions = queries.length ? queries
17554
- : mutations.length ? mutations
17555
- : subscriptions;
17556
- invariantWrappers_invariant(definitions.length === 1, 62, document, definitions.length);
17557
- var definition = definitions[0];
17558
- variables = definition.variableDefinitions || [];
17559
- if (definition.name && definition.name.kind === "Name") {
17560
- name = definition.name.value;
17561
- }
17562
- else {
17563
- name = "data"; // fallback to using data if no name
17564
- }
17565
- var payload = { name: name, type: type, variables: variables };
17566
- cache.set(document, payload);
17567
- return payload;
17568
- }
17569
- function verifyDocumentType(document, type) {
17570
- var operation = parser(document);
17571
- var requiredOperationName = operationName(type);
17572
- var usedOperationName = operationName(operation.type);
17573
- invariantWrappers_invariant(
17574
- operation.type === type,
17575
- 63,
17576
- requiredOperationName,
17577
- requiredOperationName,
17578
- usedOperationName
17579
- );
17580
- }
17581
- //# sourceMappingURL=index.js.map
17582
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useQuery.js
17583
-
17584
-
17585
-
17586
-
17587
-
17588
-
17589
-
17590
-
17591
-
17592
-
17593
-
17594
-
17595
- var useQuery_hasOwnProperty = Object.prototype.hasOwnProperty;
17596
- function useQuery(query, options) {
17597
- if (options === void 0) { options = Object.create(null); }
17598
- return useInternalState(useApolloClient(options.client), query).useQuery(options);
17599
- }
17600
- function useInternalState(client, query) {
17601
- var stateRef = react.useRef();
17602
- if (!stateRef.current ||
17603
- client !== stateRef.current.client ||
17604
- query !== stateRef.current.query) {
17605
- stateRef.current = new InternalState(client, query, stateRef.current);
17302
+ function useInternalState(client, query) {
17303
+ var stateRef = react.useRef();
17304
+ if (!stateRef.current ||
17305
+ client !== stateRef.current.client ||
17306
+ query !== stateRef.current.query) {
17307
+ stateRef.current = new InternalState(client, query, stateRef.current);
17606
17308
  }
17607
17309
  var state = stateRef.current;
17608
17310
  // By default, InternalState.prototype.forceUpdate is an empty function, but
@@ -17835,1290 +17537,395 @@ var InternalState = /** @class */ (function () {
17835
17537
  InternalState.prototype.getObsQueryOptions = function () {
17836
17538
  var toMerge = [];
17837
17539
  var globalDefaults = this.client.defaultOptions.watchQuery;
17838
- if (globalDefaults)
17839
- toMerge.push(globalDefaults);
17840
- if (this.queryHookOptions.defaultOptions) {
17841
- toMerge.push(this.queryHookOptions.defaultOptions);
17842
- }
17843
- // We use compact rather than mergeOptions for this part of the merge,
17844
- // because we want watchQueryOptions.variables (if defined) to replace
17845
- // this.observable.options.variables whole. This replacement allows
17846
- // removing variables by removing them from the variables input to
17847
- // useQuery. If the variables were always merged together (rather than
17848
- // replaced), there would be no way to remove existing variables.
17849
- // However, the variables from options.defaultOptions and globalDefaults
17850
- // (if provided) should be merged, to ensure individual defaulted
17851
- // variables always have values, if not otherwise defined in
17852
- // observable.options or watchQueryOptions.
17853
- toMerge.push(compact(this.observable && this.observable.options, this.watchQueryOptions));
17854
- return toMerge.reduce(mergeOptions);
17855
- };
17856
- // A function to massage options before passing them to ObservableQuery.
17857
- InternalState.prototype.createWatchQueryOptions = function (_a) {
17858
- var _b;
17859
- if (_a === void 0) { _a = {}; }
17860
- var skip = _a.skip, ssr = _a.ssr, onCompleted = _a.onCompleted, onError = _a.onError, defaultOptions = _a.defaultOptions,
17861
- // The above options are useQuery-specific, so this ...otherOptions spread
17862
- // makes otherOptions almost a WatchQueryOptions object, except for the
17863
- // query property that we add below.
17864
- otherOptions = __rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]);
17865
- // This Object.assign is safe because otherOptions is a fresh ...rest object
17866
- // that did not exist until just now, so modifications are still allowed.
17867
- var watchQueryOptions = Object.assign(otherOptions, { query: this.query });
17868
- if (this.renderPromises &&
17869
- (watchQueryOptions.fetchPolicy === "network-only" ||
17870
- watchQueryOptions.fetchPolicy === "cache-and-network")) {
17871
- // this behavior was added to react-apollo without explanation in this PR
17872
- // https://github.com/apollographql/react-apollo/pull/1579
17873
- watchQueryOptions.fetchPolicy = "cache-first";
17874
- }
17875
- if (!watchQueryOptions.variables) {
17876
- watchQueryOptions.variables = {};
17877
- }
17878
- if (skip) {
17879
- var _c = watchQueryOptions.fetchPolicy, fetchPolicy = _c === void 0 ? this.getDefaultFetchPolicy() : _c, _d = watchQueryOptions.initialFetchPolicy, initialFetchPolicy = _d === void 0 ? fetchPolicy : _d;
17880
- // When skipping, we set watchQueryOptions.fetchPolicy initially to
17881
- // "standby", but we also need/want to preserve the initial non-standby
17882
- // fetchPolicy that would have been used if not skipping.
17883
- Object.assign(watchQueryOptions, {
17884
- initialFetchPolicy: initialFetchPolicy,
17885
- fetchPolicy: "standby",
17886
- });
17887
- }
17888
- else if (!watchQueryOptions.fetchPolicy) {
17889
- watchQueryOptions.fetchPolicy =
17890
- ((_b = this.observable) === null || _b === void 0 ? void 0 : _b.options.initialFetchPolicy) ||
17891
- this.getDefaultFetchPolicy();
17892
- }
17893
- return watchQueryOptions;
17894
- };
17895
- InternalState.prototype.getDefaultFetchPolicy = function () {
17896
- var _a, _b;
17897
- return (((_a = this.queryHookOptions.defaultOptions) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||
17898
- ((_b = this.client.defaultOptions.watchQuery) === null || _b === void 0 ? void 0 : _b.fetchPolicy) ||
17899
- "cache-first");
17900
- };
17901
- // Defining these methods as no-ops on the prototype allows us to call
17902
- // state.onCompleted and/or state.onError without worrying about whether a
17903
- // callback was provided.
17904
- InternalState.prototype.onCompleted = function (data) { };
17905
- InternalState.prototype.onError = function (error) { };
17906
- InternalState.prototype.useObservableQuery = function () {
17907
- // See if there is an existing observable that was used to fetch the same
17908
- // data and if so, use it instead since it will contain the proper queryId
17909
- // to fetch the result set. This is used during SSR.
17910
- var obsQuery = (this.observable =
17911
- (this.renderPromises &&
17912
- this.renderPromises.getSSRObservable(this.watchQueryOptions)) ||
17913
- this.observable || // Reuse this.observable if possible (and not SSR)
17914
- this.client.watchQuery(this.getObsQueryOptions()));
17915
- this.obsQueryFields = react.useMemo(function () { return ({
17916
- refetch: obsQuery.refetch.bind(obsQuery),
17917
- reobserve: obsQuery.reobserve.bind(obsQuery),
17918
- fetchMore: obsQuery.fetchMore.bind(obsQuery),
17919
- updateQuery: obsQuery.updateQuery.bind(obsQuery),
17920
- startPolling: obsQuery.startPolling.bind(obsQuery),
17921
- stopPolling: obsQuery.stopPolling.bind(obsQuery),
17922
- subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery),
17923
- }); }, [obsQuery]);
17924
- var ssrAllowed = !(this.queryHookOptions.ssr === false || this.queryHookOptions.skip);
17925
- if (this.renderPromises && ssrAllowed) {
17926
- this.renderPromises.registerSSRObservable(obsQuery);
17927
- if (obsQuery.getCurrentResult().loading) {
17928
- // TODO: This is a legacy API which could probably be cleaned up
17929
- this.renderPromises.addObservableQueryPromise(obsQuery);
17930
- }
17931
- }
17932
- return obsQuery;
17933
- };
17934
- InternalState.prototype.setResult = function (nextResult) {
17935
- var previousResult = this.result;
17936
- if (previousResult && previousResult.data) {
17937
- this.previousData = previousResult.data;
17938
- }
17939
- this.result = nextResult;
17940
- // Calling state.setResult always triggers an update, though some call sites
17941
- // perform additional equality checks before committing to an update.
17942
- this.forceUpdate();
17943
- this.handleErrorOrCompleted(nextResult, previousResult);
17944
- };
17945
- InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) {
17946
- var _this = this;
17947
- if (!result.loading) {
17948
- var error_1 = this.toApolloError(result);
17949
- // wait a tick in case we are in the middle of rendering a component
17950
- Promise.resolve()
17951
- .then(function () {
17952
- if (error_1) {
17953
- _this.onError(error_1);
17954
- }
17955
- else if (result.data &&
17956
- (previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus &&
17957
- result.networkStatus === NetworkStatus.ready) {
17958
- _this.onCompleted(result.data);
17959
- }
17960
- })
17961
- .catch(function (error) {
17962
- globalThis.__DEV__ !== false && invariantWrappers_invariant.warn(error);
17963
- });
17964
- }
17965
- };
17966
- InternalState.prototype.toApolloError = function (result) {
17967
- return isNonEmptyArray(result.errors) ?
17968
- new ApolloError({ graphQLErrors: result.errors })
17969
- : result.error;
17970
- };
17971
- InternalState.prototype.getCurrentResult = function () {
17972
- // Using this.result as a cache ensures getCurrentResult continues returning
17973
- // the same (===) result object, unless state.setResult has been called, or
17974
- // we're doing server rendering and therefore override the result below.
17975
- if (!this.result) {
17976
- this.handleErrorOrCompleted((this.result = this.observable.getCurrentResult()));
17977
- }
17978
- return this.result;
17979
- };
17980
- InternalState.prototype.toQueryResult = function (result) {
17981
- var queryResult = this.toQueryResultCache.get(result);
17982
- if (queryResult)
17983
- return queryResult;
17984
- var data = result.data, partial = result.partial, resultWithoutPartial = __rest(result, ["data", "partial"]);
17985
- this.toQueryResultCache.set(result, (queryResult = tslib_es6_assign(tslib_es6_assign(tslib_es6_assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData })));
17986
- if (!queryResult.error && isNonEmptyArray(result.errors)) {
17987
- // Until a set naming convention for networkError and graphQLErrors is
17988
- // decided upon, we map errors (graphQLErrors) to the error options.
17989
- // TODO: Is it possible for both result.error and result.errors to be
17990
- // defined here?
17991
- queryResult.error = new ApolloError({ graphQLErrors: result.errors });
17992
- }
17993
- return queryResult;
17994
- };
17995
- InternalState.prototype.unsafeHandlePartialRefetch = function (result) {
17996
- // WARNING: SIDE-EFFECTS IN THE RENDER FUNCTION
17997
- //
17998
- // TODO: This code should be removed when the partialRefetch option is
17999
- // removed. I was unable to get this hook to behave reasonably in certain
18000
- // edge cases when this block was put in an effect.
18001
- if (result.partial &&
18002
- this.queryHookOptions.partialRefetch &&
18003
- !result.loading &&
18004
- (!result.data || Object.keys(result.data).length === 0) &&
18005
- this.observable.options.fetchPolicy !== "cache-only") {
18006
- Object.assign(result, {
18007
- loading: true,
18008
- networkStatus: NetworkStatus.refetch,
18009
- });
18010
- this.observable.refetch();
18011
- }
18012
- };
18013
- return InternalState;
18014
- }());
18015
- //# sourceMappingURL=useQuery.js.map
18016
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useLazyQuery.js
18017
-
18018
-
18019
-
18020
-
18021
-
18022
- // The following methods, when called will execute the query, regardless of
18023
- // whether the useLazyQuery execute function was called before.
18024
- var EAGER_METHODS = [
18025
- "refetch",
18026
- "reobserve",
18027
- "fetchMore",
18028
- "updateQuery",
18029
- "startPolling",
18030
- "subscribeToMore",
18031
- ];
18032
- function useLazyQuery(query, options) {
18033
- var _a;
18034
- var execOptionsRef = react.useRef();
18035
- var optionsRef = react.useRef();
18036
- var queryRef = react.useRef();
18037
- var merged = mergeOptions(options, execOptionsRef.current || {});
18038
- var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query;
18039
- // Use refs to track options and the used query to ensure the `execute`
18040
- // function remains referentially stable between renders.
18041
- optionsRef.current = merged;
18042
- queryRef.current = document;
18043
- var internalState = useInternalState(useApolloClient(options && options.client), document);
18044
- var useQueryResult = internalState.useQuery(tslib_es6_assign(tslib_es6_assign({}, merged), { skip: !execOptionsRef.current }));
18045
- var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy ||
18046
- internalState.getDefaultFetchPolicy();
18047
- var result = Object.assign(useQueryResult, {
18048
- called: !!execOptionsRef.current,
18049
- });
18050
- // We use useMemo here to make sure the eager methods have a stable identity.
18051
- var eagerMethods = react.useMemo(function () {
18052
- var eagerMethods = {};
18053
- var _loop_1 = function (key) {
18054
- var method = result[key];
18055
- eagerMethods[key] = function () {
18056
- if (!execOptionsRef.current) {
18057
- execOptionsRef.current = Object.create(null);
18058
- // Only the first time populating execOptionsRef.current matters here.
18059
- internalState.forceUpdateState();
18060
- }
18061
- // @ts-expect-error this is just too generic to type
18062
- return method.apply(this, arguments);
18063
- };
18064
- };
18065
- for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) {
18066
- var key = EAGER_METHODS_1[_i];
18067
- _loop_1(key);
18068
- }
18069
- return eagerMethods;
18070
- }, []);
18071
- Object.assign(result, eagerMethods);
18072
- var execute = react.useCallback(function (executeOptions) {
18073
- execOptionsRef.current =
18074
- executeOptions ? tslib_es6_assign(tslib_es6_assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
18075
- fetchPolicy: initialFetchPolicy,
18076
- };
18077
- var options = mergeOptions(optionsRef.current, tslib_es6_assign({ query: queryRef.current }, execOptionsRef.current));
18078
- var promise = internalState
18079
- .executeQuery(tslib_es6_assign(tslib_es6_assign({}, options), { skip: false }))
18080
- .then(function (queryResult) { return Object.assign(queryResult, eagerMethods); });
18081
- // Because the return value of `useLazyQuery` is usually floated, we need
18082
- // to catch the promise to prevent unhandled rejections.
18083
- promise.catch(function () { });
18084
- return promise;
18085
- }, []);
18086
- return [execute, result];
18087
- }
18088
- //# sourceMappingURL=useLazyQuery.js.map
18089
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useMutation.js
18090
-
18091
-
18092
-
18093
-
18094
-
18095
-
18096
-
18097
- function useMutation(mutation, options) {
18098
- var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);
18099
- verifyDocumentType(mutation, DocumentType.Mutation);
18100
- var _a = react.useState({
18101
- called: false,
18102
- loading: false,
18103
- client: client,
18104
- }), result = _a[0], setResult = _a[1];
18105
- var ref = react.useRef({
18106
- result: result,
18107
- mutationId: 0,
18108
- isMounted: true,
18109
- client: client,
18110
- mutation: mutation,
18111
- options: options,
18112
- });
18113
- // TODO: Trying to assign these in a useEffect or useLayoutEffect breaks
18114
- // higher-order components.
18115
- {
18116
- Object.assign(ref.current, { client: client, options: options, mutation: mutation });
18117
- }
18118
- var execute = react.useCallback(function (executeOptions) {
18119
- if (executeOptions === void 0) { executeOptions = {}; }
18120
- var _a = ref.current, options = _a.options, mutation = _a.mutation;
18121
- var baseOptions = tslib_es6_assign(tslib_es6_assign({}, options), { mutation: mutation });
18122
- var client = executeOptions.client || ref.current.client;
18123
- if (!ref.current.result.loading &&
18124
- !baseOptions.ignoreResults &&
18125
- ref.current.isMounted) {
18126
- setResult((ref.current.result = {
18127
- loading: true,
18128
- error: void 0,
18129
- data: void 0,
18130
- called: true,
18131
- client: client,
18132
- }));
18133
- }
18134
- var mutationId = ++ref.current.mutationId;
18135
- var clientOptions = mergeOptions(baseOptions, executeOptions);
18136
- return client
18137
- .mutate(clientOptions)
18138
- .then(function (response) {
18139
- var _a, _b;
18140
- var data = response.data, errors = response.errors;
18141
- var error = errors && errors.length > 0 ?
18142
- new ApolloError({ graphQLErrors: errors })
18143
- : void 0;
18144
- var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);
18145
- if (error && onError) {
18146
- onError(error, clientOptions);
18147
- }
18148
- if (mutationId === ref.current.mutationId &&
18149
- !clientOptions.ignoreResults) {
18150
- var result_1 = {
18151
- called: true,
18152
- loading: false,
18153
- data: data,
18154
- error: error,
18155
- client: client,
18156
- };
18157
- if (ref.current.isMounted && !equal(ref.current.result, result_1)) {
18158
- setResult((ref.current.result = result_1));
18159
- }
18160
- }
18161
- var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted);
18162
- if (!error) {
18163
- onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions);
18164
- }
18165
- return response;
18166
- })
18167
- .catch(function (error) {
18168
- var _a;
18169
- if (mutationId === ref.current.mutationId && ref.current.isMounted) {
18170
- var result_2 = {
18171
- loading: false,
18172
- error: error,
18173
- data: void 0,
18174
- called: true,
18175
- client: client,
18176
- };
18177
- if (!equal(ref.current.result, result_2)) {
18178
- setResult((ref.current.result = result_2));
18179
- }
18180
- }
18181
- var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);
18182
- if (onError) {
18183
- onError(error, clientOptions);
18184
- // TODO(brian): why are we returning this here???
18185
- return { data: void 0, errors: error };
18186
- }
18187
- throw error;
18188
- });
18189
- }, []);
18190
- var reset = react.useCallback(function () {
18191
- if (ref.current.isMounted) {
18192
- var result_3 = { called: false, loading: false, client: client };
18193
- Object.assign(ref.current, { mutationId: 0, result: result_3 });
18194
- setResult(result_3);
18195
- }
18196
- }, []);
18197
- react.useEffect(function () {
18198
- ref.current.isMounted = true;
18199
- return function () {
18200
- ref.current.isMounted = false;
18201
- };
18202
- }, []);
18203
- return [execute, tslib_es6_assign({ reset: reset }, result)];
18204
- }
18205
- //# sourceMappingURL=useMutation.js.map
18206
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useSubscription.js
18207
-
18208
-
18209
-
18210
-
18211
-
18212
- function useSubscription(subscription, options) {
18213
- var hasIssuedDeprecationWarningRef = react.useRef(false);
18214
- var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);
18215
- verifyDocumentType(subscription, DocumentType.Subscription);
18216
- var _a = react.useState({
18217
- loading: !(options === null || options === void 0 ? void 0 : options.skip),
18218
- error: void 0,
18219
- data: void 0,
18220
- variables: options === null || options === void 0 ? void 0 : options.variables,
18221
- }), result = _a[0], setResult = _a[1];
18222
- if (!hasIssuedDeprecationWarningRef.current) {
18223
- hasIssuedDeprecationWarningRef.current = true;
18224
- if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
18225
- globalThis.__DEV__ !== false && invariantWrappers_invariant.warn(options.onData ? 52 : 53);
18226
- }
18227
- if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
18228
- globalThis.__DEV__ !== false && invariantWrappers_invariant.warn(options.onComplete ? 54 : 55);
18229
- }
18230
- }
18231
- var _b = react.useState(function () {
18232
- if (options === null || options === void 0 ? void 0 : options.skip) {
18233
- return null;
18234
- }
18235
- return client.subscribe({
18236
- query: subscription,
18237
- variables: options === null || options === void 0 ? void 0 : options.variables,
18238
- fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
18239
- context: options === null || options === void 0 ? void 0 : options.context,
18240
- });
18241
- }), observable = _b[0], setObservable = _b[1];
18242
- var canResetObservableRef = react.useRef(false);
18243
- react.useEffect(function () {
18244
- return function () {
18245
- canResetObservableRef.current = true;
18246
- };
18247
- }, []);
18248
- var ref = react.useRef({ client: client, subscription: subscription, options: options });
18249
- react.useEffect(function () {
18250
- var _a, _b, _c, _d;
18251
- var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe;
18252
- if (typeof shouldResubscribe === "function") {
18253
- shouldResubscribe = !!shouldResubscribe(options);
18254
- }
18255
- if (options === null || options === void 0 ? void 0 : options.skip) {
18256
- if (!(options === null || options === void 0 ? void 0 : options.skip) !== !((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.skip) ||
18257
- canResetObservableRef.current) {
18258
- setResult({
18259
- loading: false,
18260
- data: void 0,
18261
- error: void 0,
18262
- variables: options === null || options === void 0 ? void 0 : options.variables,
18263
- });
18264
- setObservable(null);
18265
- canResetObservableRef.current = false;
18266
- }
18267
- }
18268
- else if ((shouldResubscribe !== false &&
18269
- (client !== ref.current.client ||
18270
- subscription !== ref.current.subscription ||
18271
- (options === null || options === void 0 ? void 0 : options.fetchPolicy) !== ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.fetchPolicy) ||
18272
- !(options === null || options === void 0 ? void 0 : options.skip) !== !((_c = ref.current.options) === null || _c === void 0 ? void 0 : _c.skip) ||
18273
- !equal(options === null || options === void 0 ? void 0 : options.variables, (_d = ref.current.options) === null || _d === void 0 ? void 0 : _d.variables))) ||
18274
- canResetObservableRef.current) {
18275
- setResult({
18276
- loading: true,
18277
- data: void 0,
18278
- error: void 0,
18279
- variables: options === null || options === void 0 ? void 0 : options.variables,
18280
- });
18281
- setObservable(client.subscribe({
18282
- query: subscription,
18283
- variables: options === null || options === void 0 ? void 0 : options.variables,
18284
- fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
18285
- context: options === null || options === void 0 ? void 0 : options.context,
18286
- }));
18287
- canResetObservableRef.current = false;
18288
- }
18289
- Object.assign(ref.current, { client: client, subscription: subscription, options: options });
18290
- }, [client, subscription, options, canResetObservableRef.current]);
18291
- react.useEffect(function () {
18292
- if (!observable) {
18293
- return;
18294
- }
18295
- var subscriptionStopped = false;
18296
- var subscription = observable.subscribe({
18297
- next: function (fetchResult) {
18298
- var _a, _b;
18299
- if (subscriptionStopped) {
18300
- return;
18301
- }
18302
- var result = {
18303
- loading: false,
18304
- // TODO: fetchResult.data can be null but SubscriptionResult.data
18305
- // expects TData | undefined only
18306
- data: fetchResult.data,
18307
- error: void 0,
18308
- variables: options === null || options === void 0 ? void 0 : options.variables,
18309
- };
18310
- setResult(result);
18311
- if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onData) {
18312
- ref.current.options.onData({
18313
- client: client,
18314
- data: result,
18315
- });
18316
- }
18317
- else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionData) {
18318
- ref.current.options.onSubscriptionData({
18319
- client: client,
18320
- subscriptionData: result,
18321
- });
18322
- }
18323
- },
18324
- error: function (error) {
18325
- var _a, _b;
18326
- if (!subscriptionStopped) {
18327
- setResult({
18328
- loading: false,
18329
- data: void 0,
18330
- error: error,
18331
- variables: options === null || options === void 0 ? void 0 : options.variables,
18332
- });
18333
- (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
18334
- }
18335
- },
18336
- complete: function () {
18337
- var _a, _b;
18338
- if (!subscriptionStopped) {
18339
- if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {
18340
- ref.current.options.onComplete();
18341
- }
18342
- else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {
18343
- ref.current.options.onSubscriptionComplete();
18344
- }
18345
- }
18346
- },
18347
- });
18348
- return function () {
18349
- // immediately stop receiving subscription values, but do not unsubscribe
18350
- // until after a short delay in case another useSubscription hook is
18351
- // reusing the same underlying observable and is about to subscribe
18352
- subscriptionStopped = true;
18353
- setTimeout(function () {
18354
- subscription.unsubscribe();
18355
- });
18356
- };
18357
- }, [observable]);
18358
- return result;
18359
- }
18360
- //# sourceMappingURL=useSubscription.js.map
18361
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useReactiveVar.js
18362
-
18363
-
18364
- function useReactiveVar(rv) {
18365
- return useSyncExternalStore(react.useCallback(function (update) {
18366
- // By reusing the same onNext function in the nested call to
18367
- // rv.onNextChange(onNext), we can keep using the initial clean-up function
18368
- // returned by rv.onNextChange(function onNext(v){...}), without having to
18369
- // register the new clean-up function (returned by the nested
18370
- // rv.onNextChange(onNext)) with yet another callback.
18371
- return rv.onNextChange(function onNext() {
18372
- update();
18373
- rv.onNextChange(onNext);
18374
- });
18375
- }, [rv]), rv, rv);
18376
- }
18377
- //# sourceMappingURL=useReactiveVar.js.map
18378
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js
18379
-
18380
-
18381
- function useDeepMemo(memoFn, deps) {
18382
- var ref = react.useRef();
18383
- if (!ref.current || !equal(ref.current.deps, deps)) {
18384
- ref.current = { value: memoFn(), deps: deps };
18385
- }
18386
- return ref.current.value;
18387
- }
18388
- //# sourceMappingURL=useDeepMemo.js.map
18389
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/internal/useLazyRef.js
18390
-
18391
- var INIT = {};
18392
- function useLazyRef(getInitialValue) {
18393
- var ref = react.useRef(INIT);
18394
- if (ref.current === INIT) {
18395
- ref.current = getInitialValue();
18396
- }
18397
- return ref;
18398
- }
18399
- //# sourceMappingURL=useLazyRef.js.map
18400
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useFragment.js
18401
-
18402
-
18403
-
18404
-
18405
-
18406
-
18407
-
18408
- function useFragment(options) {
18409
- var cache = useApolloClient().cache;
18410
- var diffOptions = useDeepMemo(function () {
18411
- var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = __rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
18412
- return tslib_es6_assign(tslib_es6_assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
18413
- }, [options]);
18414
- var resultRef = useLazyRef(function () {
18415
- return diffToResult(cache.diff(diffOptions));
18416
- });
18417
- // Used for both getSnapshot and getServerSnapshot
18418
- var getSnapshot = react.useCallback(function () { return resultRef.current; }, []);
18419
- return useSyncExternalStore(react.useCallback(function (forceUpdate) {
18420
- var lastTimeout = 0;
18421
- var unsubscribe = cache.watch(tslib_es6_assign(tslib_es6_assign({}, diffOptions), { immediate: true, callback: function (diff) {
18422
- if (!equal(diff.result, resultRef.current.data)) {
18423
- resultRef.current = diffToResult(diff);
18424
- // If we get another update before we've re-rendered, bail out of
18425
- // the update and try again. This ensures that the relative timing
18426
- // between useQuery and useFragment stays roughly the same as
18427
- // fixed in https://github.com/apollographql/apollo-client/pull/11083
18428
- clearTimeout(lastTimeout);
18429
- lastTimeout = setTimeout(forceUpdate);
18430
- }
18431
- } }));
18432
- return function () {
18433
- unsubscribe();
18434
- clearTimeout(lastTimeout);
18435
- };
18436
- }, [cache, diffOptions]), getSnapshot, getSnapshot);
18437
- }
18438
- function diffToResult(diff) {
18439
- var result = {
18440
- data: diff.result,
18441
- complete: !!diff.complete,
18442
- };
18443
- if (diff.missing) {
18444
- result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; }));
18445
- }
18446
- return result;
18447
- }
18448
- //# sourceMappingURL=useFragment.js.map
18449
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/utilities/promises/decoration.js
18450
- function createFulfilledPromise(value) {
18451
- var promise = Promise.resolve(value);
18452
- promise.status = "fulfilled";
18453
- promise.value = value;
18454
- return promise;
18455
- }
18456
- function createRejectedPromise(reason) {
18457
- var promise = Promise.reject(reason);
18458
- // prevent potential edge cases leaking unhandled error rejections
18459
- promise.catch(function () { });
18460
- promise.status = "rejected";
18461
- promise.reason = reason;
18462
- return promise;
18463
- }
18464
- function isStatefulPromise(promise) {
18465
- return "status" in promise;
18466
- }
18467
- function wrapPromiseWithState(promise) {
18468
- if (isStatefulPromise(promise)) {
18469
- return promise;
18470
- }
18471
- var pendingPromise = promise;
18472
- pendingPromise.status = "pending";
18473
- pendingPromise.then(function (value) {
18474
- if (pendingPromise.status === "pending") {
18475
- var fulfilledPromise = pendingPromise;
18476
- fulfilledPromise.status = "fulfilled";
18477
- fulfilledPromise.value = value;
18478
- }
18479
- }, function (reason) {
18480
- if (pendingPromise.status === "pending") {
18481
- var rejectedPromise = pendingPromise;
18482
- rejectedPromise.status = "rejected";
18483
- rejectedPromise.reason = reason;
18484
- }
18485
- });
18486
- return promise;
18487
- }
18488
- //# sourceMappingURL=decoration.js.map
18489
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/internal/__use.js
18490
-
18491
-
18492
- // Prevent webpack from complaining about our feature detection of the
18493
- // use property of the React namespace, which is expected not
18494
- // to exist when using current stable versions, and that's fine.
18495
- var useKey = "use";
18496
- var _use_realHook = react_namespaceObject[useKey];
18497
- // This is named with two underscores to allow this hook to evade typical rules of
18498
- // hooks (i.e. it can be used conditionally)
18499
- var __use = _use_realHook ||
18500
- function __use(promise) {
18501
- var statefulPromise = wrapPromiseWithState(promise);
18502
- switch (statefulPromise.status) {
18503
- case "pending":
18504
- throw statefulPromise;
18505
- case "rejected":
18506
- throw statefulPromise.reason;
18507
- case "fulfilled":
18508
- return statefulPromise.value;
17540
+ if (globalDefaults)
17541
+ toMerge.push(globalDefaults);
17542
+ if (this.queryHookOptions.defaultOptions) {
17543
+ toMerge.push(this.queryHookOptions.defaultOptions);
18509
17544
  }
17545
+ // We use compact rather than mergeOptions for this part of the merge,
17546
+ // because we want watchQueryOptions.variables (if defined) to replace
17547
+ // this.observable.options.variables whole. This replacement allows
17548
+ // removing variables by removing them from the variables input to
17549
+ // useQuery. If the variables were always merged together (rather than
17550
+ // replaced), there would be no way to remove existing variables.
17551
+ // However, the variables from options.defaultOptions and globalDefaults
17552
+ // (if provided) should be merged, to ensure individual defaulted
17553
+ // variables always have values, if not otherwise defined in
17554
+ // observable.options or watchQueryOptions.
17555
+ toMerge.push(compact(this.observable && this.observable.options, this.watchQueryOptions));
17556
+ return toMerge.reduce(mergeOptions);
18510
17557
  };
18511
- //# sourceMappingURL=__use.js.map
18512
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/cache/QueryReference.js
18513
-
18514
-
18515
-
18516
-
18517
- var QUERY_REFERENCE_SYMBOL = Symbol();
18518
- function wrapQueryRef(internalQueryRef) {
18519
- var _a;
18520
- return _a = {}, _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef, _a;
18521
- }
18522
- function unwrapQueryRef(queryRef) {
18523
- return queryRef[QUERY_REFERENCE_SYMBOL];
18524
- }
18525
- var OBSERVED_CHANGED_OPTIONS = [
18526
- "canonizeResults",
18527
- "context",
18528
- "errorPolicy",
18529
- "fetchPolicy",
18530
- "refetchWritePolicy",
18531
- "returnPartialData",
18532
- ];
18533
- var InternalQueryReference = /** @class */ (function () {
18534
- function InternalQueryReference(observable, options) {
18535
- var _this = this;
18536
- this.listeners = new Set();
18537
- this.status = "loading";
18538
- this.references = 0;
18539
- this.handleNext = this.handleNext.bind(this);
18540
- this.handleError = this.handleError.bind(this);
18541
- this.dispose = this.dispose.bind(this);
18542
- this.observable = observable;
18543
- // Don't save this result as last result to prevent delivery of last result
18544
- // when first subscribing
18545
- this.result = observable.getCurrentResult(false);
18546
- this.key = options.key;
18547
- if (options.onDispose) {
18548
- this.onDispose = options.onDispose;
18549
- }
18550
- if (isNetworkRequestSettled(this.result.networkStatus) ||
18551
- (this.result.data &&
18552
- (!this.result.partial || this.watchQueryOptions.returnPartialData))) {
18553
- this.promise = createFulfilledPromise(this.result);
18554
- this.status = "idle";
17558
+ // A function to massage options before passing them to ObservableQuery.
17559
+ InternalState.prototype.createWatchQueryOptions = function (_a) {
17560
+ var _b;
17561
+ if (_a === void 0) { _a = {}; }
17562
+ var skip = _a.skip, ssr = _a.ssr, onCompleted = _a.onCompleted, onError = _a.onError, defaultOptions = _a.defaultOptions,
17563
+ // The above options are useQuery-specific, so this ...otherOptions spread
17564
+ // makes otherOptions almost a WatchQueryOptions object, except for the
17565
+ // query property that we add below.
17566
+ otherOptions = __rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]);
17567
+ // This Object.assign is safe because otherOptions is a fresh ...rest object
17568
+ // that did not exist until just now, so modifications are still allowed.
17569
+ var watchQueryOptions = Object.assign(otherOptions, { query: this.query });
17570
+ if (this.renderPromises &&
17571
+ (watchQueryOptions.fetchPolicy === "network-only" ||
17572
+ watchQueryOptions.fetchPolicy === "cache-and-network")) {
17573
+ // this behavior was added to react-apollo without explanation in this PR
17574
+ // https://github.com/apollographql/react-apollo/pull/1579
17575
+ watchQueryOptions.fetchPolicy = "cache-first";
18555
17576
  }
18556
- else {
18557
- this.promise = new Promise(function (resolve, reject) {
18558
- _this.resolve = resolve;
18559
- _this.reject = reject;
18560
- });
17577
+ if (!watchQueryOptions.variables) {
17578
+ watchQueryOptions.variables = {};
18561
17579
  }
18562
- this.subscription = observable
18563
- .filter(function (_a) {
18564
- var data = _a.data;
18565
- return !equal(data, {});
18566
- })
18567
- .subscribe({
18568
- next: this.handleNext,
18569
- error: this.handleError,
18570
- });
18571
- // Start a timer that will automatically dispose of the query if the
18572
- // suspended resource does not use this queryRef in the given time. This
18573
- // helps prevent memory leaks when a component has unmounted before the
18574
- // query has finished loading.
18575
- var startDisposeTimer = function () {
18576
- var _a;
18577
- if (!_this.references) {
18578
- _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
18579
- }
18580
- };
18581
- // We wait until the request has settled to ensure we don't dispose of the
18582
- // query ref before the request finishes, otherwise we would leave the
18583
- // promise in a pending state rendering the suspense boundary indefinitely.
18584
- this.promise.then(startDisposeTimer, startDisposeTimer);
18585
- }
18586
- Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
18587
- get: function () {
18588
- return this.observable.options;
18589
- },
18590
- enumerable: false,
18591
- configurable: true
18592
- });
18593
- InternalQueryReference.prototype.retain = function () {
18594
- var _this = this;
18595
- this.references++;
18596
- clearTimeout(this.autoDisposeTimeoutId);
18597
- var disposed = false;
18598
- return function () {
18599
- if (disposed) {
18600
- return;
18601
- }
18602
- disposed = true;
18603
- _this.references--;
18604
- // Wait before fully disposing in case the app is running in strict mode.
18605
- setTimeout(function () {
18606
- if (!_this.references) {
18607
- _this.dispose();
18608
- }
17580
+ if (skip) {
17581
+ var _c = watchQueryOptions.fetchPolicy, fetchPolicy = _c === void 0 ? this.getDefaultFetchPolicy() : _c, _d = watchQueryOptions.initialFetchPolicy, initialFetchPolicy = _d === void 0 ? fetchPolicy : _d;
17582
+ // When skipping, we set watchQueryOptions.fetchPolicy initially to
17583
+ // "standby", but we also need/want to preserve the initial non-standby
17584
+ // fetchPolicy that would have been used if not skipping.
17585
+ Object.assign(watchQueryOptions, {
17586
+ initialFetchPolicy: initialFetchPolicy,
17587
+ fetchPolicy: "standby",
18609
17588
  });
18610
- };
17589
+ }
17590
+ else if (!watchQueryOptions.fetchPolicy) {
17591
+ watchQueryOptions.fetchPolicy =
17592
+ ((_b = this.observable) === null || _b === void 0 ? void 0 : _b.options.initialFetchPolicy) ||
17593
+ this.getDefaultFetchPolicy();
17594
+ }
17595
+ return watchQueryOptions;
18611
17596
  };
18612
- InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {
18613
- var _this = this;
18614
- return OBSERVED_CHANGED_OPTIONS.some(function (option) {
18615
- return !equal(_this.watchQueryOptions[option], watchQueryOptions[option]);
18616
- });
17597
+ InternalState.prototype.getDefaultFetchPolicy = function () {
17598
+ var _a, _b;
17599
+ return (((_a = this.queryHookOptions.defaultOptions) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||
17600
+ ((_b = this.client.defaultOptions.watchQuery) === null || _b === void 0 ? void 0 : _b.fetchPolicy) ||
17601
+ "cache-first");
18617
17602
  };
18618
- InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {
18619
- var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;
18620
- // "standby" is used when `skip` is set to `true`. Detect when we've
18621
- // enabled the query (i.e. `skip` is `false`) to execute a network request.
18622
- if (currentFetchPolicy === "standby" &&
18623
- currentFetchPolicy !== watchQueryOptions.fetchPolicy) {
18624
- this.initiateFetch(this.observable.reobserve(watchQueryOptions));
18625
- }
18626
- else {
18627
- this.observable.silentSetOptions(watchQueryOptions);
18628
- if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {
18629
- this.result = tslib_es6_assign(tslib_es6_assign({}, this.result), this.observable.getCurrentResult());
18630
- this.promise = createFulfilledPromise(this.result);
17603
+ // Defining these methods as no-ops on the prototype allows us to call
17604
+ // state.onCompleted and/or state.onError without worrying about whether a
17605
+ // callback was provided.
17606
+ InternalState.prototype.onCompleted = function (data) { };
17607
+ InternalState.prototype.onError = function (error) { };
17608
+ InternalState.prototype.useObservableQuery = function () {
17609
+ // See if there is an existing observable that was used to fetch the same
17610
+ // data and if so, use it instead since it will contain the proper queryId
17611
+ // to fetch the result set. This is used during SSR.
17612
+ var obsQuery = (this.observable =
17613
+ (this.renderPromises &&
17614
+ this.renderPromises.getSSRObservable(this.watchQueryOptions)) ||
17615
+ this.observable || // Reuse this.observable if possible (and not SSR)
17616
+ this.client.watchQuery(this.getObsQueryOptions()));
17617
+ this.obsQueryFields = react.useMemo(function () { return ({
17618
+ refetch: obsQuery.refetch.bind(obsQuery),
17619
+ reobserve: obsQuery.reobserve.bind(obsQuery),
17620
+ fetchMore: obsQuery.fetchMore.bind(obsQuery),
17621
+ updateQuery: obsQuery.updateQuery.bind(obsQuery),
17622
+ startPolling: obsQuery.startPolling.bind(obsQuery),
17623
+ stopPolling: obsQuery.stopPolling.bind(obsQuery),
17624
+ subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery),
17625
+ }); }, [obsQuery]);
17626
+ var ssrAllowed = !(this.queryHookOptions.ssr === false || this.queryHookOptions.skip);
17627
+ if (this.renderPromises && ssrAllowed) {
17628
+ this.renderPromises.registerSSRObservable(obsQuery);
17629
+ if (obsQuery.getCurrentResult().loading) {
17630
+ // TODO: This is a legacy API which could probably be cleaned up
17631
+ this.renderPromises.addObservableQueryPromise(obsQuery);
18631
17632
  }
18632
17633
  }
18633
- return this.promise;
17634
+ return obsQuery;
17635
+ };
17636
+ InternalState.prototype.setResult = function (nextResult) {
17637
+ var previousResult = this.result;
17638
+ if (previousResult && previousResult.data) {
17639
+ this.previousData = previousResult.data;
17640
+ }
17641
+ this.result = nextResult;
17642
+ // Calling state.setResult always triggers an update, though some call sites
17643
+ // perform additional equality checks before committing to an update.
17644
+ this.forceUpdate();
17645
+ this.handleErrorOrCompleted(nextResult, previousResult);
18634
17646
  };
18635
- InternalQueryReference.prototype.listen = function (listener) {
17647
+ InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) {
18636
17648
  var _this = this;
18637
- this.listeners.add(listener);
18638
- return function () {
18639
- _this.listeners.delete(listener);
18640
- };
17649
+ if (!result.loading) {
17650
+ var error_1 = this.toApolloError(result);
17651
+ // wait a tick in case we are in the middle of rendering a component
17652
+ Promise.resolve()
17653
+ .then(function () {
17654
+ if (error_1) {
17655
+ _this.onError(error_1);
17656
+ }
17657
+ else if (result.data &&
17658
+ (previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus &&
17659
+ result.networkStatus === NetworkStatus.ready) {
17660
+ _this.onCompleted(result.data);
17661
+ }
17662
+ })
17663
+ .catch(function (error) {
17664
+ globalThis.__DEV__ !== false && invariantWrappers_invariant.warn(error);
17665
+ });
17666
+ }
18641
17667
  };
18642
- InternalQueryReference.prototype.refetch = function (variables) {
18643
- return this.initiateFetch(this.observable.refetch(variables));
17668
+ InternalState.prototype.toApolloError = function (result) {
17669
+ return isNonEmptyArray(result.errors) ?
17670
+ new ApolloError({ graphQLErrors: result.errors })
17671
+ : result.error;
18644
17672
  };
18645
- InternalQueryReference.prototype.fetchMore = function (options) {
18646
- return this.initiateFetch(this.observable.fetchMore(options));
17673
+ InternalState.prototype.getCurrentResult = function () {
17674
+ // Using this.result as a cache ensures getCurrentResult continues returning
17675
+ // the same (===) result object, unless state.setResult has been called, or
17676
+ // we're doing server rendering and therefore override the result below.
17677
+ if (!this.result) {
17678
+ this.handleErrorOrCompleted((this.result = this.observable.getCurrentResult()));
17679
+ }
17680
+ return this.result;
18647
17681
  };
18648
- InternalQueryReference.prototype.dispose = function () {
18649
- this.subscription.unsubscribe();
18650
- this.onDispose();
17682
+ InternalState.prototype.toQueryResult = function (result) {
17683
+ var queryResult = this.toQueryResultCache.get(result);
17684
+ if (queryResult)
17685
+ return queryResult;
17686
+ var data = result.data, partial = result.partial, resultWithoutPartial = __rest(result, ["data", "partial"]);
17687
+ this.toQueryResultCache.set(result, (queryResult = tslib_es6_assign(tslib_es6_assign(tslib_es6_assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData })));
17688
+ if (!queryResult.error && isNonEmptyArray(result.errors)) {
17689
+ // Until a set naming convention for networkError and graphQLErrors is
17690
+ // decided upon, we map errors (graphQLErrors) to the error options.
17691
+ // TODO: Is it possible for both result.error and result.errors to be
17692
+ // defined here?
17693
+ queryResult.error = new ApolloError({ graphQLErrors: result.errors });
17694
+ }
17695
+ return queryResult;
18651
17696
  };
18652
- InternalQueryReference.prototype.onDispose = function () {
18653
- // noop. overridable by options
17697
+ InternalState.prototype.unsafeHandlePartialRefetch = function (result) {
17698
+ // WARNING: SIDE-EFFECTS IN THE RENDER FUNCTION
17699
+ //
17700
+ // TODO: This code should be removed when the partialRefetch option is
17701
+ // removed. I was unable to get this hook to behave reasonably in certain
17702
+ // edge cases when this block was put in an effect.
17703
+ if (result.partial &&
17704
+ this.queryHookOptions.partialRefetch &&
17705
+ !result.loading &&
17706
+ (!result.data || Object.keys(result.data).length === 0) &&
17707
+ this.observable.options.fetchPolicy !== "cache-only") {
17708
+ Object.assign(result, {
17709
+ loading: true,
17710
+ networkStatus: NetworkStatus.refetch,
17711
+ });
17712
+ this.observable.refetch();
17713
+ }
18654
17714
  };
18655
- InternalQueryReference.prototype.handleNext = function (result) {
18656
- var _a;
18657
- switch (this.status) {
18658
- case "loading": {
18659
- // Maintain the last successful `data` value if the next result does not
18660
- // have one.
18661
- if (result.data === void 0) {
18662
- result.data = this.result.data;
18663
- }
18664
- this.status = "idle";
18665
- this.result = result;
18666
- (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);
18667
- break;
18668
- }
18669
- case "idle": {
18670
- // This occurs when switching to a result that is fully cached when this
18671
- // class is instantiated. ObservableQuery will run reobserve when
18672
- // subscribing, which delivers a result from the cache.
18673
- if (result.data === this.result.data) {
18674
- return;
18675
- }
18676
- // Maintain the last successful `data` value if the next result does not
18677
- // have one.
18678
- if (result.data === void 0) {
18679
- result.data = this.result.data;
18680
- }
18681
- this.result = result;
18682
- this.promise = createFulfilledPromise(result);
18683
- this.deliver(this.promise);
18684
- break;
18685
- }
17715
+ return InternalState;
17716
+ }());
17717
+ //# sourceMappingURL=useQuery.js.map
17718
+ ;// CONCATENATED MODULE: ./src/js/hooks/queries/useProjects.ts
17719
+
17720
+ const useProjects_GQL = gql `
17721
+ query Query {
17722
+ projects {
17723
+ id
17724
+ name
17725
+ path
17726
+ color
17727
+ }
17728
+ }
17729
+ `;
17730
+ function useProjects() {
17731
+ return useQuery(useProjects_GQL);
17732
+ }
17733
+
17734
+ ;// CONCATENATED MODULE: ./src/js/components/Select.tsx
17735
+ /* provided dependency */ var Select_React = __webpack_require__(294);
17736
+
17737
+ const LI_CLASSNAME = [
17738
+ "flex",
17739
+ "align-items-center",
17740
+ "w-3/4",
17741
+ "hover-bg-secondary",
17742
+ "p-3",
17743
+ "mt-2",
17744
+ "cursor-pointer",
17745
+ ].join(" ");
17746
+ const ACTIVE_CLASSNAME = [
17747
+ LI_CLASSNAME,
17748
+ "rounded",
17749
+ "border",
17750
+ "border-solid",
17751
+ "border-secondary",
17752
+ "text-primary",
17753
+ "bg-secondary"
17754
+ ].join(" ");
17755
+ const Select = ({ onChange, options, selected, placeholder }) => {
17756
+ const selectOptions = [{ label: placeholder, value: "" }, ...options];
17757
+ const [isOpen, setIsOpen] = (0,react.useState)(false);
17758
+ const [option, setOption] = (0,react.useState)(options.find(o => o.value === selected) || selectOptions[0]);
17759
+ const onClick = (option) => {
17760
+ if (isOpen) {
17761
+ setOption(option);
17762
+ setIsOpen(false);
17763
+ onChange(option);
17764
+ }
17765
+ else {
17766
+ setIsOpen(true);
18686
17767
  }
18687
17768
  };
18688
- InternalQueryReference.prototype.handleError = function (error) {
18689
- var _a;
18690
- this.subscription.unsubscribe();
18691
- this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError);
18692
- switch (this.status) {
18693
- case "loading": {
18694
- this.status = "idle";
18695
- (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);
18696
- break;
18697
- }
18698
- case "idle": {
18699
- this.promise = createRejectedPromise(error);
18700
- this.deliver(this.promise);
18701
- }
17769
+ const getClassName = (o1, o2) => {
17770
+ if (o1.value === o2.value) {
17771
+ return ACTIVE_CLASSNAME;
17772
+ }
17773
+ else {
17774
+ return (!isOpen && o1.value !== o2.value) ? "hidden" : LI_CLASSNAME;
18702
17775
  }
18703
17776
  };
18704
- InternalQueryReference.prototype.deliver = function (promise) {
18705
- this.listeners.forEach(function (listener) { return listener(promise); });
18706
- };
18707
- InternalQueryReference.prototype.initiateFetch = function (returnedPromise) {
18708
- var _this = this;
18709
- this.status = "loading";
18710
- this.promise = new Promise(function (resolve, reject) {
18711
- _this.resolve = resolve;
18712
- _this.reject = reject;
18713
- });
18714
- this.promise.catch(function () { });
18715
- // If the data returned from the fetch is deeply equal to the data already
18716
- // in the cache, `handleNext` will not be triggered leaving the promise we
18717
- // created in a pending state forever. To avoid this situtation, we attempt
18718
- // to resolve the promise if `handleNext` hasn't been run to ensure the
18719
- // promise is resolved correctly.
18720
- returnedPromise
18721
- .then(function (result) {
18722
- var _a;
18723
- if (_this.status === "loading") {
18724
- _this.status = "idle";
18725
- _this.result = result;
18726
- (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result);
17777
+ (0,react.useEffect)(() => {
17778
+ const onDocumentClick = () => {
17779
+ if (isOpen) {
17780
+ setIsOpen(false);
18727
17781
  }
18728
- })
18729
- .catch(function () { });
18730
- return returnedPromise;
18731
- };
18732
- return InternalQueryReference;
18733
- }());
18734
-
18735
- //# sourceMappingURL=QueryReference.js.map
18736
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/cache/SuspenseCache.js
18737
-
18738
-
17782
+ };
17783
+ document.body.addEventListener('click', onDocumentClick);
17784
+ return () => document.body.removeEventListener('click', onDocumentClick);
17785
+ }, [isOpen]);
17786
+ return (Select_React.createElement("ul", null, selectOptions.map((o, i) => (Select_React.createElement("li", { key: i, "data-value": o.value, onClick: (e) => [e.stopPropagation(), onClick(o)], className: getClassName(o, option) }, o.label)))));
17787
+ };
18739
17788
 
18740
- var SuspenseCache = /** @class */ (function () {
18741
- function SuspenseCache(options) {
18742
- if (options === void 0) { options = Object.create(null); }
18743
- this.queryRefs = new Trie(canUseWeakMap);
18744
- this.options = options;
18745
- }
18746
- SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {
18747
- var ref = this.queryRefs.lookupArray(cacheKey);
18748
- if (!ref.current) {
18749
- ref.current = new InternalQueryReference(createObservable(), {
18750
- key: cacheKey,
18751
- autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,
18752
- onDispose: function () {
18753
- delete ref.current;
18754
- },
18755
- });
18756
- }
18757
- return ref.current;
18758
- };
18759
- return SuspenseCache;
18760
- }());
17789
+ ;// CONCATENATED MODULE: ./src/js/components/ProjectSelect.tsx
17790
+ /* provided dependency */ var ProjectSelect_React = __webpack_require__(294);
18761
17791
 
18762
- //# sourceMappingURL=SuspenseCache.js.map
18763
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/cache/getSuspenseCache.js
18764
17792
 
18765
- var suspenseCacheSymbol = Symbol.for("apollo.suspenseCache");
18766
- function getSuspenseCache(client) {
18767
- var _a;
18768
- if (!client[suspenseCacheSymbol]) {
18769
- client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);
17793
+ function ProjectSelect({ onChange, selected }) {
17794
+ const { data, loading } = useProjects();
17795
+ const projects = (data === null || data === void 0 ? void 0 : data.projects) || [];
17796
+ const options = projects.map(project => ({
17797
+ label: (ProjectSelect_React.createElement("div", { className: "flex" },
17798
+ ProjectSelect_React.createElement("span", { style: { backgroundColor: project.color }, className: "flex w-2/8 rounded w-8 h-8 mr-3 cursor-pointer" }),
17799
+ ProjectSelect_React.createElement("span", { className: "flex align-items-center" }, project.name))),
17800
+ value: String(project.id),
17801
+ }));
17802
+ if (loading) {
17803
+ return null;
18770
17804
  }
18771
- return client[suspenseCacheSymbol];
17805
+ return (ProjectSelect_React.createElement(Select, { onChange: (option) => {
17806
+ const project = projects.find(p => String(p.id) == option.value);
17807
+ onChange(project);
17808
+ }, options: options, selected: String(selected), placeholder: "Any project" }));
17809
+ 1;
18772
17810
  }
18773
- //# sourceMappingURL=getSuspenseCache.js.map
18774
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/constants.js
18775
- var skipToken = Symbol.for("apollo.skipToken");
18776
- //# sourceMappingURL=constants.js.map
18777
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useSuspenseQuery.js
18778
17811
 
17812
+ ;// CONCATENATED MODULE: ./src/js/components/NavBar.tsx
17813
+ /* provided dependency */ var NavBar_React = __webpack_require__(294);
18779
17814
 
18780
17815
 
18781
17816
 
18782
-
18783
-
18784
-
18785
-
18786
-
18787
-
18788
-
18789
- function useSuspenseQuery(query, options) {
18790
- if (options === void 0) { options = Object.create(null); }
18791
- var client = useApolloClient(options.client);
18792
- var suspenseCache = getSuspenseCache(client);
18793
- var watchQueryOptions = useWatchQueryOptions({
18794
- client: client,
18795
- query: query,
18796
- options: options,
18797
- });
18798
- var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;
18799
- var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
18800
- var cacheKey = __spreadArray([
18801
- query,
18802
- canonicalStringify(variables)
18803
- ], [].concat(queryKey), true);
18804
- var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
18805
- return client.watchQuery(watchQueryOptions);
18806
- });
18807
- var _b = react.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
18808
- var promise = promiseCache.get(queryRef.key);
18809
- if (queryRef.didChangeOptions(watchQueryOptions)) {
18810
- promise = queryRef.applyOptions(watchQueryOptions);
18811
- promiseCache.set(queryRef.key, promise);
18812
- }
18813
- if (!promise) {
18814
- promise = queryRef.promise;
18815
- promiseCache.set(queryRef.key, promise);
18816
- }
18817
- react.useEffect(function () {
18818
- var dispose = queryRef.retain();
18819
- var removeListener = queryRef.listen(function (promise) {
18820
- setPromiseCache(function (promiseCache) {
18821
- return new Map(promiseCache).set(queryRef.key, promise);
18822
- });
18823
- });
18824
- return function () {
18825
- removeListener();
18826
- dispose();
18827
- };
18828
- }, [queryRef]);
18829
- var skipResult = react.useMemo(function () {
18830
- var error = toApolloError(queryRef.result);
18831
- return {
18832
- loading: false,
18833
- data: queryRef.result.data,
18834
- networkStatus: error ? NetworkStatus.error : NetworkStatus.ready,
18835
- error: error,
18836
- };
18837
- }, [queryRef.result]);
18838
- var result = fetchPolicy === "standby" ? skipResult : __use(promise);
18839
- var fetchMore = react.useCallback((function (options) {
18840
- var promise = queryRef.fetchMore(options);
18841
- setPromiseCache(function (previousPromiseCache) {
18842
- return new Map(previousPromiseCache).set(queryRef.key, queryRef.promise);
18843
- });
18844
- return promise;
18845
- }), [queryRef]);
18846
- var refetch = react.useCallback(function (variables) {
18847
- var promise = queryRef.refetch(variables);
18848
- setPromiseCache(function (previousPromiseCache) {
18849
- return new Map(previousPromiseCache).set(queryRef.key, queryRef.promise);
18850
- });
18851
- return promise;
18852
- }, [queryRef]);
18853
- var subscribeToMore = react.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);
18854
- return react.useMemo(function () {
18855
- return {
18856
- client: client,
18857
- data: result.data,
18858
- error: toApolloError(result),
18859
- networkStatus: result.networkStatus,
18860
- fetchMore: fetchMore,
18861
- refetch: refetch,
18862
- subscribeToMore: subscribeToMore,
18863
- };
18864
- }, [client, fetchMore, refetch, result, subscribeToMore]);
18865
- }
18866
- function validateOptions(options) {
18867
- var query = options.query, fetchPolicy = options.fetchPolicy, returnPartialData = options.returnPartialData;
18868
- verifyDocumentType(query, DocumentType.Query);
18869
- validateFetchPolicy(fetchPolicy);
18870
- validatePartialDataReturn(fetchPolicy, returnPartialData);
18871
- }
18872
- function validateFetchPolicy(fetchPolicy) {
18873
- if (fetchPolicy === void 0) { fetchPolicy = "cache-first"; }
18874
- var supportedFetchPolicies = [
18875
- "cache-first",
18876
- "network-only",
18877
- "no-cache",
18878
- "cache-and-network",
18879
- ];
18880
- invariantWrappers_invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy);
18881
- }
18882
- function validatePartialDataReturn(fetchPolicy, returnPartialData) {
18883
- if (fetchPolicy === "no-cache" && returnPartialData) {
18884
- globalThis.__DEV__ !== false && invariantWrappers_invariant.warn(57);
18885
- }
18886
- }
18887
- function toApolloError(result) {
18888
- return isNonEmptyArray(result.errors) ?
18889
- new ApolloError({ graphQLErrors: result.errors })
18890
- : result.error;
18891
- }
18892
- function useWatchQueryOptions(_a) {
18893
- var client = _a.client, query = _a.query, options = _a.options;
18894
- return useDeepMemo(function () {
18895
- var _a;
18896
- if (options === skipToken) {
18897
- return { query: query, fetchPolicy: "standby" };
18898
- }
18899
- var fetchPolicy = options.fetchPolicy ||
18900
- ((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||
18901
- "cache-first";
18902
- var watchQueryOptions = tslib_es6_assign(tslib_es6_assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 });
18903
- if (globalThis.__DEV__ !== false) {
18904
- validateOptions(watchQueryOptions);
18905
- }
18906
- // Assign the updated fetch policy after our validation since `standby` is
18907
- // not a supported fetch policy on its own without the use of `skip`.
18908
- if (options.skip) {
18909
- watchQueryOptions.fetchPolicy = "standby";
17817
+ const BASE_CLASSNAMES = ["block", "w-3/4", "no-underline", "p-3", "mt-2"];
17818
+ const ACTIVE_CLASSNAMES = [
17819
+ ...BASE_CLASSNAMES,
17820
+ "rounded",
17821
+ "bg-secondary",
17822
+ "text-primary",
17823
+ ].join(" ");
17824
+ const INACTIVE_CLASSNAMES = [
17825
+ ...BASE_CLASSNAMES,
17826
+ "text-accent",
17827
+ "hover-bg-secondary",
17828
+ ].join(" ");
17829
+ const find = (path, bar) => {
17830
+ let item = null;
17831
+ Object.values(bar)
17832
+ .flat()
17833
+ .forEach(i => {
17834
+ if (i.href === path) {
17835
+ item = i;
18910
17836
  }
18911
- return watchQueryOptions;
18912
- }, [client, options, query]);
18913
- }
18914
- //# sourceMappingURL=useSuspenseQuery.js.map
18915
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useBackgroundQuery.js
18916
-
18917
-
18918
-
18919
-
18920
-
18921
-
18922
-
18923
- function useBackgroundQuery(query, options) {
18924
- if (options === void 0) { options = Object.create(null); }
18925
- var client = useApolloClient(options.client);
18926
- var suspenseCache = getSuspenseCache(client);
18927
- var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
18928
- var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;
18929
- var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
18930
- // This ref tracks the first time query execution is enabled to determine
18931
- // whether to return a query ref or `undefined`. When initialized
18932
- // in a skipped state (either via `skip: true` or `skipToken`) we return
18933
- // `undefined` for the `queryRef` until the query has been enabled. Once
18934
- // enabled, a query ref is always returned regardless of whether the query is
18935
- // skipped again later.
18936
- var didFetchResult = react.useRef(fetchPolicy !== "standby");
18937
- didFetchResult.current || (didFetchResult.current = fetchPolicy !== "standby");
18938
- var cacheKey = __spreadArray([
18939
- query,
18940
- canonicalStringify(variables)
18941
- ], [].concat(queryKey), true);
18942
- var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
18943
- return client.watchQuery(watchQueryOptions);
18944
17837
  });
18945
- var _b = react.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
18946
- if (queryRef.didChangeOptions(watchQueryOptions)) {
18947
- var promise = queryRef.applyOptions(watchQueryOptions);
18948
- promiseCache.set(queryRef.key, promise);
18949
- }
18950
- react.useEffect(function () { return queryRef.retain(); }, [queryRef]);
18951
- var fetchMore = react.useCallback(function (options) {
18952
- var promise = queryRef.fetchMore(options);
18953
- setPromiseCache(function (promiseCache) {
18954
- return new Map(promiseCache).set(queryRef.key, queryRef.promise);
18955
- });
18956
- return promise;
18957
- }, [queryRef]);
18958
- var refetch = react.useCallback(function (variables) {
18959
- var promise = queryRef.refetch(variables);
18960
- setPromiseCache(function (promiseCache) {
18961
- return new Map(promiseCache).set(queryRef.key, queryRef.promise);
18962
- });
18963
- return promise;
18964
- }, [queryRef]);
18965
- queryRef.promiseCache = promiseCache;
18966
- var wrappedQueryRef = react.useMemo(function () { return wrapQueryRef(queryRef); }, [queryRef]);
18967
- return [
18968
- didFetchResult.current ? wrappedQueryRef : void 0,
18969
- { fetchMore: fetchMore, refetch: refetch },
18970
- ];
17838
+ return item;
17839
+ };
17840
+ function NavBar() {
17841
+ const params = (0,react.useContext)(ParamContext);
17842
+ const bar = {
17843
+ Tasks: [
17844
+ { text: "All tasks", href: "/tasks/" },
17845
+ { text: "New task", href: "/tasks/new/" },
17846
+ ],
17847
+ Projects: [{ text: "All projects", href: "/projects" }],
17848
+ };
17849
+ const activeItem = find(location.pathname, bar);
17850
+ return (NavBar_React.createElement(NavBar_React.Fragment, null,
17851
+ ...Object.keys(bar).map(key => {
17852
+ const items = bar[key];
17853
+ return (NavBar_React.createElement(NavBar_React.Fragment, null,
17854
+ NavBar_React.createElement("h3", null, key),
17855
+ NavBar_React.createElement("ul", null, ...items.flatMap(item => {
17856
+ return (NavBar_React.createElement("li", null,
17857
+ NavBar_React.createElement("a", { className: activeItem == item
17858
+ ? ACTIVE_CLASSNAMES
17859
+ : INACTIVE_CLASSNAMES, href: item.href }, item.text)));
17860
+ }))));
17861
+ }),
17862
+ NavBar_React.createElement("h3", null, "Filters"),
17863
+ NavBar_React.createElement(ProjectSelect, { selected: params.projectId, onChange: project => {
17864
+ if (project) {
17865
+ location.hash = `projectId=${project.id}`;
17866
+ }
17867
+ else {
17868
+ location.hash = "";
17869
+ }
17870
+ location.reload();
17871
+ } })));
18971
17872
  }
18972
- //# sourceMappingURL=useBackgroundQuery.js.map
18973
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/useReadQuery.js
18974
-
18975
17873
 
17874
+ ;// CONCATENATED MODULE: ./src/js/components/Projects.tsx
17875
+ /* provided dependency */ var Projects_React = __webpack_require__(294);
17876
+ var Projects_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
17877
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17878
+ return new (P || (P = Promise))(function (resolve, reject) {
17879
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17880
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17881
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17882
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
17883
+ });
17884
+ };
18976
17885
 
18977
17886
 
18978
17887
 
18979
17888
 
18980
- function useReadQuery(queryRef) {
18981
- var internalQueryRef = unwrapQueryRef(queryRef);
18982
- invariantWrappers_invariant(internalQueryRef.promiseCache, 51);
18983
- var promiseCache = internalQueryRef.promiseCache, key = internalQueryRef.key;
18984
- if (!promiseCache.has(key)) {
18985
- promiseCache.set(key, internalQueryRef.promise);
17889
+ function Projects() {
17890
+ const { data, loading } = useProjects();
17891
+ const setRandomProjectColor = useSetRandomProjectColor();
17892
+ const projects = data === null || data === void 0 ? void 0 : data.projects;
17893
+ (0,react.useEffect)(() => {
17894
+ document.title = "Projects";
17895
+ }, []);
17896
+ if (loading) {
17897
+ return;
18986
17898
  }
18987
- var promise = useSyncExternalStore(react.useCallback(function (forceUpdate) {
18988
- return internalQueryRef.listen(function (promise) {
18989
- internalQueryRef.promiseCache.set(internalQueryRef.key, promise);
18990
- forceUpdate();
18991
- });
18992
- }, [internalQueryRef]), function () { return promiseCache.get(key); }, function () { return promiseCache.get(key); });
18993
- var result = __use(promise);
18994
- return react.useMemo(function () {
18995
- return {
18996
- data: result.data,
18997
- networkStatus: result.networkStatus,
18998
- error: toApolloError(result),
18999
- };
19000
- }, [result]);
17899
+ return (Projects_React.createElement("div", { className: "flex" },
17900
+ Projects_React.createElement("div", { className: "w-1/4" },
17901
+ Projects_React.createElement(NavBar, null)),
17902
+ Projects_React.createElement("div", { className: "w-3/4" },
17903
+ Projects_React.createElement("h1", { className: "bg-secondary text-primary p-3 rounded" }, "Projects"),
17904
+ Projects_React.createElement("ul", { className: "flex flex-wrap" }, projects.map((project, i) => {
17905
+ return (Projects_React.createElement("li", { className: "flex flex-row p-3 hover-bg-secondary w-full", key: i },
17906
+ Projects_React.createElement("div", { style: { backgroundColor: project.color }, className: "w-2/8 rounded w-12 h-12 mr-3 cursor-pointer", onClick: () => Projects_awaiter(this, void 0, void 0, function* () {
17907
+ yield setRandomProjectColor({
17908
+ variables: { projectId: project.id },
17909
+ });
17910
+ }) }),
17911
+ Projects_React.createElement("a", { className: "w-6/8 no-underline text-accent block h-14", href: `/tasks/#projectId=${project.id}` },
17912
+ Projects_React.createElement("span", { className: "block w-full" }, project.name),
17913
+ Projects_React.createElement("span", { className: "block w-full text-smaller text-secondary" }, project.path))));
17914
+ })))));
19001
17915
  }
19002
- //# sourceMappingURL=useReadQuery.js.map
19003
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/hooks/index.js
19004
-
19005
-
19006
-
19007
-
19008
-
19009
-
19010
-
19011
-
19012
-
19013
-
19014
-
19015
-
19016
- //# sourceMappingURL=index.js.map
19017
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/react/index.js
19018
-
19019
17916
 
17917
+ ;// CONCATENATED MODULE: ./src/js/main/projects.tsx
17918
+ /* provided dependency */ var projects_React = __webpack_require__(294);
19020
17919
 
19021
17920
 
19022
17921
 
19023
- //# sourceMappingURL=index.js.map
19024
- ;// CONCATENATED MODULE: ./node_modules/@apollo/client/index.js
19025
-
19026
-
19027
- //# sourceMappingURL=index.js.map
17922
+ (function () {
17923
+ const root = document.querySelector(".react-root");
17924
+ client.createRoot(root).render(projects_React.createElement(App, null,
17925
+ projects_React.createElement(Projects, null)));
17926
+ })();
19028
17927
 
19029
- /***/ })
17928
+ })();
19030
17929
 
19031
- /******/ });
19032
- /************************************************************************/
19033
- /******/ // The module cache
19034
- /******/ var __webpack_module_cache__ = {};
19035
- /******/
19036
- /******/ // The require function
19037
- /******/ function __webpack_require__(moduleId) {
19038
- /******/ // Check if module is in cache
19039
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
19040
- /******/ if (cachedModule !== undefined) {
19041
- /******/ return cachedModule.exports;
19042
- /******/ }
19043
- /******/ // Create a new module (and put it into the cache)
19044
- /******/ var module = __webpack_module_cache__[moduleId] = {
19045
- /******/ // no module.id needed
19046
- /******/ // no module.loaded needed
19047
- /******/ exports: {}
19048
- /******/ };
19049
- /******/
19050
- /******/ // Execute the module function
19051
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
19052
- /******/
19053
- /******/ // Return the exports of the module
19054
- /******/ return module.exports;
19055
- /******/ }
19056
- /******/
19057
- /************************************************************************/
19058
- /******/ /* webpack/runtime/create fake namespace object */
19059
- /******/ (() => {
19060
- /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
19061
- /******/ var leafPrototypes;
19062
- /******/ // create a fake namespace object
19063
- /******/ // mode & 1: value is a module id, require it
19064
- /******/ // mode & 2: merge all properties of value into the ns
19065
- /******/ // mode & 4: return value when already ns object
19066
- /******/ // mode & 16: return value when it's Promise-like
19067
- /******/ // mode & 8|1: behave like require
19068
- /******/ __webpack_require__.t = function(value, mode) {
19069
- /******/ if(mode & 1) value = this(value);
19070
- /******/ if(mode & 8) return value;
19071
- /******/ if(typeof value === 'object' && value) {
19072
- /******/ if((mode & 4) && value.__esModule) return value;
19073
- /******/ if((mode & 16) && typeof value.then === 'function') return value;
19074
- /******/ }
19075
- /******/ var ns = Object.create(null);
19076
- /******/ __webpack_require__.r(ns);
19077
- /******/ var def = {};
19078
- /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
19079
- /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
19080
- /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
19081
- /******/ }
19082
- /******/ def['default'] = () => (value);
19083
- /******/ __webpack_require__.d(ns, def);
19084
- /******/ return ns;
19085
- /******/ };
19086
- /******/ })();
19087
- /******/
19088
- /******/ /* webpack/runtime/define property getters */
19089
- /******/ (() => {
19090
- /******/ // define getter functions for harmony exports
19091
- /******/ __webpack_require__.d = (exports, definition) => {
19092
- /******/ for(var key in definition) {
19093
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
19094
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
19095
- /******/ }
19096
- /******/ }
19097
- /******/ };
19098
- /******/ })();
19099
- /******/
19100
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
19101
- /******/ (() => {
19102
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
19103
- /******/ })();
19104
- /******/
19105
- /******/ /* webpack/runtime/make namespace object */
19106
- /******/ (() => {
19107
- /******/ // define __esModule on exports
19108
- /******/ __webpack_require__.r = (exports) => {
19109
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
19110
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
19111
- /******/ }
19112
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
19113
- /******/ };
19114
- /******/ })();
19115
- /******/
19116
- /************************************************************************/
19117
- /******/
19118
- /******/ // startup
19119
- /******/ // Load entry module and return exports
19120
- /******/ // This entry module is referenced by other modules so it can't be inlined
19121
- /******/ var __webpack_exports__ = __webpack_require__(677);
19122
- /******/
19123
17930
  /******/ })()
19124
17931
  ;