window.decidimBulletinBoard = /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/@apollo/client/cache/core/cache.js": /*!*********************************************************!*\ !*** ./node_modules/@apollo/client/cache/core/cache.js ***! \*********************************************************/ /*! namespace exports */ /*! export ApolloCache [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ApolloCache": () => /* binding */ ApolloCache /* harmony export */ }); /* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! optimism */ "./node_modules/optimism/lib/bundle.esm.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); ; var ApolloCache = (function () { function ApolloCache() { this.getFragmentDoc = (0,optimism__WEBPACK_IMPORTED_MODULE_0__.wrap)(_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentQueryDocument); } ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) { this.performTransaction(transaction, optimisticId); }; ApolloCache.prototype.transformDocument = function (document) { return document; }; ApolloCache.prototype.identify = function (object) { return; }; ApolloCache.prototype.gc = function () { return []; }; ApolloCache.prototype.modify = function (options) { return false; }; ApolloCache.prototype.transformForLink = function (document) { return document; }; ApolloCache.prototype.readQuery = function (options, optimistic) { if (optimistic === void 0) { optimistic = false; } return this.read({ rootId: options.id || 'ROOT_QUERY', query: options.query, variables: options.variables, optimistic: optimistic, }); }; ApolloCache.prototype.readFragment = function (options, optimistic) { if (optimistic === void 0) { optimistic = false; } return this.read({ query: this.getFragmentDoc(options.fragment, options.fragmentName), variables: options.variables, rootId: options.id, optimistic: optimistic, }); }; ApolloCache.prototype.writeQuery = function (options) { return this.write({ dataId: options.id || 'ROOT_QUERY', result: options.data, query: options.query, variables: options.variables, broadcast: options.broadcast, }); }; ApolloCache.prototype.writeFragment = function (options) { return this.write({ dataId: options.id, result: options.data, variables: options.variables, query: this.getFragmentDoc(options.fragment, options.fragmentName), broadcast: options.broadcast, }); }; return ApolloCache; }()); //# sourceMappingURL=cache.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/core/types/Cache.js": /*!***************************************************************!*\ !*** ./node_modules/@apollo/client/cache/core/types/Cache.js ***! \***************************************************************/ /*! namespace exports */ /*! export Cache [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Cache": () => /* binding */ Cache /* harmony export */ }); var Cache; (function (Cache) { })(Cache || (Cache = {})); //# sourceMappingURL=Cache.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/core/types/common.js": /*!****************************************************************!*\ !*** ./node_modules/@apollo/client/cache/core/types/common.js ***! \****************************************************************/ /*! namespace exports */ /*! export MissingFieldError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "MissingFieldError": () => /* binding */ MissingFieldError /* harmony export */ }); var MissingFieldError = (function () { function MissingFieldError(message, path, query, clientOnly, variables) { this.message = message; this.path = path; this.query = query; this.clientOnly = clientOnly; this.variables = variables; } return MissingFieldError; }()); //# sourceMappingURL=common.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/index.js": /*!****************************************************!*\ !*** ./node_modules/@apollo/client/cache/index.js ***! \****************************************************/ /*! namespace exports */ /*! export ApolloCache [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/core/cache.js .ApolloCache */ /*! export Cache [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/core/types/Cache.js .Cache */ /*! export InMemoryCache [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/inmemory/inMemoryCache.js .InMemoryCache */ /*! export MissingFieldError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/core/types/common.js .MissingFieldError */ /*! export cacheSlot [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/inmemory/reactiveVars.js .cacheSlot */ /*! export default [not provided] [no usage info] [missing usage info prevents renaming] */ /*! export defaultDataIdFromObject [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/inmemory/policies.js .defaultDataIdFromObject */ /*! export isReference [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .isReference */ /*! export makeReference [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .makeReference */ /*! export makeVar [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/inmemory/reactiveVars.js .makeVar */ /*! other exports [maybe provided (runtime-defined)] [no usage info] -> ./node_modules/@apollo/client/cache/inmemory/types.js */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.n, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ApolloCache": () => /* reexport safe */ _core_cache_js__WEBPACK_IMPORTED_MODULE_0__.ApolloCache, /* harmony export */ "Cache": () => /* reexport safe */ _core_types_Cache_js__WEBPACK_IMPORTED_MODULE_1__.Cache, /* harmony export */ "MissingFieldError": () => /* reexport safe */ _core_types_common_js__WEBPACK_IMPORTED_MODULE_2__.MissingFieldError, /* harmony export */ "isReference": () => /* reexport safe */ _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.isReference, /* harmony export */ "makeReference": () => /* reexport safe */ _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.makeReference, /* harmony export */ "InMemoryCache": () => /* reexport safe */ _inmemory_inMemoryCache_js__WEBPACK_IMPORTED_MODULE_4__.InMemoryCache, /* harmony export */ "makeVar": () => /* reexport safe */ _inmemory_reactiveVars_js__WEBPACK_IMPORTED_MODULE_5__.makeVar, /* harmony export */ "cacheSlot": () => /* reexport safe */ _inmemory_reactiveVars_js__WEBPACK_IMPORTED_MODULE_5__.cacheSlot, /* harmony export */ "defaultDataIdFromObject": () => /* reexport safe */ _inmemory_policies_js__WEBPACK_IMPORTED_MODULE_6__.defaultDataIdFromObject /* harmony export */ }); /* harmony import */ var _core_cache_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core/cache.js */ "./node_modules/@apollo/client/cache/core/cache.js"); /* harmony import */ var _core_types_Cache_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core/types/Cache.js */ "./node_modules/@apollo/client/cache/core/types/Cache.js"); /* harmony import */ var _core_types_common_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./core/types/common.js */ "./node_modules/@apollo/client/cache/core/types/common.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _inmemory_inMemoryCache_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./inmemory/inMemoryCache.js */ "./node_modules/@apollo/client/cache/inmemory/inMemoryCache.js"); /* harmony import */ var _inmemory_reactiveVars_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./inmemory/reactiveVars.js */ "./node_modules/@apollo/client/cache/inmemory/reactiveVars.js"); /* harmony import */ var _inmemory_policies_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./inmemory/policies.js */ "./node_modules/@apollo/client/cache/inmemory/policies.js"); /* harmony import */ var _inmemory_types_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./inmemory/types.js */ "./node_modules/@apollo/client/cache/inmemory/types.js"); /* harmony import */ var _inmemory_types_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_inmemory_types_js__WEBPACK_IMPORTED_MODULE_7__); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _inmemory_types_js__WEBPACK_IMPORTED_MODULE_7__) if(["default","ApolloCache","Cache","MissingFieldError","isReference","makeReference","InMemoryCache","makeVar","cacheSlot","defaultDataIdFromObject"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _inmemory_types_js__WEBPACK_IMPORTED_MODULE_7__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/entityStore.js": /*!*******************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/entityStore.js ***! \*******************************************************************/ /*! namespace exports */ /*! export EntityStore [provided] [no usage info] [missing usage info prevents renaming] */ /*! export supportsResultCaching [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "EntityStore": () => /* binding */ EntityStore, /* harmony export */ "supportsResultCaching": () => /* binding */ supportsResultCaching /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! optimism */ "./node_modules/optimism/lib/bundle.esm.js"); /* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "./node_modules/@wry/equality/lib/equality.esm.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers.js */ "./node_modules/@apollo/client/cache/inmemory/helpers.js"); ; var DELETE = Object.create(null); var delModifier = function () { return DELETE; }; var INVALIDATE = Object.create(null); var EntityStore = (function () { function EntityStore(policies, group) { var _this = this; this.policies = policies; this.group = group; this.data = Object.create(null); this.rootIds = Object.create(null); this.refs = Object.create(null); this.getFieldValue = function (objectOrReference, storeFieldName) { return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.maybeDeepFreeze)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(objectOrReference) ? _this.get(objectOrReference.__ref, storeFieldName) : objectOrReference && objectOrReference[storeFieldName]); }; this.canRead = function (objOrRef) { return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(objOrRef) ? _this.has(objOrRef.__ref) : typeof objOrRef === "object"; }; this.toReference = function (objOrIdOrRef, mergeIntoStore) { if (typeof objOrIdOrRef === "string") { return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.makeReference)(objOrIdOrRef); } if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(objOrIdOrRef)) { return objOrIdOrRef; } var id = _this.policies.identify(objOrIdOrRef)[0]; if (id) { var ref = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.makeReference)(id); if (mergeIntoStore) { _this.merge(id, objOrIdOrRef); } return ref; } }; } EntityStore.prototype.toObject = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, this.data); }; EntityStore.prototype.has = function (dataId) { return this.lookup(dataId, true) !== void 0; }; EntityStore.prototype.get = function (dataId, fieldName) { this.group.depend(dataId, fieldName); if (_helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(this.data, dataId)) { var storeObject = this.data[dataId]; if (storeObject && _helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(storeObject, fieldName)) { return storeObject[fieldName]; } } if (fieldName === "__typename" && _helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(this.policies.rootTypenamesById, dataId)) { return this.policies.rootTypenamesById[dataId]; } if (this instanceof Layer) { return this.parent.get(dataId, fieldName); } }; EntityStore.prototype.lookup = function (dataId, dependOnExistence) { if (dependOnExistence) this.group.depend(dataId, "__exists"); return _helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(this.data, dataId) ? this.data[dataId] : this instanceof Layer ? this.parent.lookup(dataId, dependOnExistence) : void 0; }; EntityStore.prototype.merge = function (dataId, incoming) { var _this = this; var existing = this.lookup(dataId); var merged = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.DeepMerger(storeObjectReconciler).merge(existing, incoming); this.data[dataId] = merged; if (merged !== existing) { delete this.refs[dataId]; if (this.group.caching) { var fieldsToDirty_1 = Object.create(null); if (!existing) fieldsToDirty_1.__exists = 1; Object.keys(incoming).forEach(function (storeFieldName) { if (!existing || existing[storeFieldName] !== merged[storeFieldName]) { fieldsToDirty_1[(0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName)] = 1; if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) { delete merged[storeFieldName]; } } }); Object.keys(fieldsToDirty_1).forEach(function (fieldName) { return _this.group.dirty(dataId, fieldName); }); } } }; EntityStore.prototype.modify = function (dataId, fields) { var _this = this; var storeObject = this.lookup(dataId); if (storeObject) { var changedFields_1 = Object.create(null); var needToMerge_1 = false; var allDeleted_1 = true; var sharedDetails_1 = { DELETE: DELETE, INVALIDATE: INVALIDATE, isReference: _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference, toReference: this.toReference, canRead: this.canRead, readField: function (fieldNameOrOptions, from) { return _this.policies.readField(typeof fieldNameOrOptions === "string" ? { fieldName: fieldNameOrOptions, from: from || (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.makeReference)(dataId), } : fieldNameOrOptions, { store: _this }); }, }; Object.keys(storeObject).forEach(function (storeFieldName) { var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName); var fieldValue = storeObject[storeFieldName]; if (fieldValue === void 0) return; var modify = typeof fields === "function" ? fields : fields[storeFieldName] || fields[fieldName]; if (modify) { var newValue = modify === delModifier ? DELETE : modify((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.maybeDeepFreeze)(fieldValue), (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) })); if (newValue === INVALIDATE) { _this.group.dirty(dataId, storeFieldName); } else { if (newValue === DELETE) newValue = void 0; if (newValue !== fieldValue) { changedFields_1[storeFieldName] = newValue; needToMerge_1 = true; fieldValue = newValue; } } } if (fieldValue !== void 0) { allDeleted_1 = false; } }); if (needToMerge_1) { this.merge(dataId, changedFields_1); if (allDeleted_1) { if (this instanceof Layer) { this.data[dataId] = void 0; } else { delete this.data[dataId]; } this.group.dirty(dataId, "__exists"); } return true; } } return false; }; EntityStore.prototype.delete = function (dataId, fieldName, args) { var _a; var storeObject = this.lookup(dataId); if (storeObject) { var typename = this.getFieldValue(storeObject, "__typename"); var storeFieldName = fieldName && args ? this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args }) : fieldName; return this.modify(dataId, storeFieldName ? (_a = {}, _a[storeFieldName] = delModifier, _a) : delModifier); } return false; }; EntityStore.prototype.evict = function (options) { var evicted = false; if (options.id) { if (_helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(this.data, options.id)) { evicted = this.delete(options.id, options.fieldName, options.args); } if (this instanceof Layer) { evicted = this.parent.evict(options) || evicted; } if (options.fieldName || evicted) { this.group.dirty(options.id, options.fieldName || "__exists"); } } return evicted; }; EntityStore.prototype.clear = function () { this.replace(null); }; EntityStore.prototype.replace = function (newData) { var _this = this; Object.keys(this.data).forEach(function (dataId) { if (!(newData && _helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(newData, dataId))) { _this.delete(dataId); } }); if (newData) { Object.keys(newData).forEach(function (dataId) { _this.merge(dataId, newData[dataId]); }); } }; EntityStore.prototype.retain = function (rootId) { return this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1; }; EntityStore.prototype.release = function (rootId) { if (this.rootIds[rootId] > 0) { var count = --this.rootIds[rootId]; if (!count) delete this.rootIds[rootId]; return count; } return 0; }; EntityStore.prototype.getRootIdSet = function (ids) { if (ids === void 0) { ids = new Set(); } Object.keys(this.rootIds).forEach(ids.add, ids); if (this instanceof Layer) { this.parent.getRootIdSet(ids); } else { Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids); } return ids; }; EntityStore.prototype.gc = function () { var _this = this; var ids = this.getRootIdSet(); var snapshot = this.toObject(); ids.forEach(function (id) { if (_helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(snapshot, id)) { Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids); delete snapshot[id]; } }); var idsToRemove = Object.keys(snapshot); if (idsToRemove.length) { var root_1 = this; while (root_1 instanceof Layer) root_1 = root_1.parent; idsToRemove.forEach(function (id) { return root_1.delete(id); }); } return idsToRemove; }; EntityStore.prototype.findChildRefIds = function (dataId) { if (!_helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(this.refs, dataId)) { var found_1 = this.refs[dataId] = Object.create(null); var workSet_1 = new Set([this.data[dataId]]); var canTraverse_1 = function (obj) { return obj !== null && typeof obj === 'object'; }; workSet_1.forEach(function (obj) { if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(obj)) { found_1[obj.__ref] = true; } else if (canTraverse_1(obj)) { Object.values(obj) .filter(canTraverse_1) .forEach(workSet_1.add, workSet_1); } }); } return this.refs[dataId]; }; EntityStore.prototype.makeCacheKey = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return this.group.keyMaker.lookupArray(args); }; return EntityStore; }()); var CacheGroup = (function () { function CacheGroup(caching) { this.caching = caching; this.d = null; this.keyMaker = new optimism__WEBPACK_IMPORTED_MODULE_0__.KeyTrie(_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.canUseWeakMap); this.d = caching ? (0,optimism__WEBPACK_IMPORTED_MODULE_0__.dep)() : null; } CacheGroup.prototype.depend = function (dataId, storeFieldName) { if (this.d) { this.d(makeDepKey(dataId, storeFieldName)); } }; CacheGroup.prototype.dirty = function (dataId, storeFieldName) { if (this.d) { this.d.dirty(makeDepKey(dataId, storeFieldName)); } }; return CacheGroup; }()); function makeDepKey(dataId, storeFieldName) { return (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName) + '#' + dataId; } (function (EntityStore) { var Root = (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__extends)(Root, _super); function Root(_a) { var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed; var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this; _this.storageTrie = new optimism__WEBPACK_IMPORTED_MODULE_0__.KeyTrie(_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.canUseWeakMap); _this.sharedLayerGroup = new CacheGroup(resultCaching); if (seed) _this.replace(seed); return _this; } Root.prototype.addLayer = function (layerId, replay) { return new Layer(layerId, this, replay, this.sharedLayerGroup); }; Root.prototype.removeLayer = function () { return this; }; Root.prototype.getStorage = function (idOrObj, storeFieldName) { return this.storageTrie.lookup(idOrObj, storeFieldName); }; return Root; }(EntityStore)); EntityStore.Root = Root; })(EntityStore || (EntityStore = {})); var Layer = (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__extends)(Layer, _super); function Layer(id, parent, replay, group) { var _this = _super.call(this, parent.policies, group) || this; _this.id = id; _this.parent = parent; _this.replay = replay; _this.group = group; replay(_this); return _this; } Layer.prototype.addLayer = function (layerId, replay) { return new Layer(layerId, this, replay, this.group); }; Layer.prototype.removeLayer = function (layerId) { var _this = this; var parent = this.parent.removeLayer(layerId); if (layerId === this.id) { if (this.group.caching) { Object.keys(this.data).forEach(function (dataId) { if (_this.data[dataId] !== parent.lookup(dataId)) { _this.delete(dataId); } }); } return parent; } if (parent === this.parent) return this; return parent.addLayer(this.id, this.replay); }; Layer.prototype.toObject = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, this.parent.toObject()), this.data); }; Layer.prototype.findChildRefIds = function (dataId) { var fromParent = this.parent.findChildRefIds(dataId); return _helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(this.data, dataId) ? (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent; }; Layer.prototype.getStorage = function (idOrObj, storeFieldName) { return this.parent.getStorage(idOrObj, storeFieldName); }; return Layer; }(EntityStore)); function storeObjectReconciler(existingObject, incomingObject, property) { var existingValue = existingObject[property]; var incomingValue = incomingObject[property]; return (0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(existingValue, incomingValue) ? existingValue : incomingValue; } function supportsResultCaching(store) { return !!(store instanceof EntityStore && store.group.caching); } //# sourceMappingURL=entityStore.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/fixPolyfills.js": /*!********************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/fixPolyfills.js ***! \********************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: */ /***/ (() => { //# sourceMappingURL=fixPolyfills.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/helpers.js": /*!***************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/helpers.js ***! \***************************************************************/ /*! namespace exports */ /*! export TypeOrFieldNameRegExp [provided] [no usage info] [missing usage info prevents renaming] */ /*! export fieldNameFromStoreName [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getTypenameFromStoreObject [provided] [no usage info] [missing usage info prevents renaming] */ /*! export hasOwn [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isFieldValueToBeMerged [provided] [no usage info] [missing usage info prevents renaming] */ /*! export makeProcessedFieldsMerger [provided] [no usage info] [missing usage info prevents renaming] */ /*! export selectionSetMatchesResult [provided] [no usage info] [missing usage info prevents renaming] */ /*! export storeValueIsStoreObject [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "hasOwn": () => /* binding */ hasOwn, /* harmony export */ "getTypenameFromStoreObject": () => /* binding */ getTypenameFromStoreObject, /* harmony export */ "TypeOrFieldNameRegExp": () => /* binding */ TypeOrFieldNameRegExp, /* harmony export */ "fieldNameFromStoreName": () => /* binding */ fieldNameFromStoreName, /* harmony export */ "selectionSetMatchesResult": () => /* binding */ selectionSetMatchesResult, /* harmony export */ "storeValueIsStoreObject": () => /* binding */ storeValueIsStoreObject, /* harmony export */ "isFieldValueToBeMerged": () => /* binding */ isFieldValueToBeMerged, /* harmony export */ "makeProcessedFieldsMerger": () => /* binding */ makeProcessedFieldsMerger /* harmony export */ }); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); ; var hasOwn = Object.prototype.hasOwnProperty; function getTypenameFromStoreObject(store, objectOrReference) { return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.isReference)(objectOrReference) ? store.get(objectOrReference.__ref, "__typename") : objectOrReference && objectOrReference.__typename; } var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i; function fieldNameFromStoreName(storeFieldName) { var match = storeFieldName.match(TypeOrFieldNameRegExp); return match ? match[0] : storeFieldName; } function selectionSetMatchesResult(selectionSet, result, variables) { if (result && typeof result === "object") { return Array.isArray(result) ? result.every(function (item) { return selectionSetMatchesResult(selectionSet, item, variables); }) : selectionSet.selections.every(function (field) { if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.isField)(field) && (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.shouldInclude)(field, variables)) { var key = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.resultKeyNameFromField)(field); return hasOwn.call(result, key) && (!field.selectionSet || selectionSetMatchesResult(field.selectionSet, result[key], variables)); } return true; }); } return false; } function storeValueIsStoreObject(value) { return value !== null && typeof value === "object" && !(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.isReference)(value) && !Array.isArray(value); } function isFieldValueToBeMerged(value) { var field = value && value.__field; return field && (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.isField)(field); } function makeProcessedFieldsMerger() { return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.DeepMerger(reconcileProcessedFields); } var reconcileProcessedFields = function (existingObject, incomingObject, property) { var existing = existingObject[property]; var incoming = incomingObject[property]; if (isFieldValueToBeMerged(existing)) { existing.__value = this.merge(existing.__value, isFieldValueToBeMerged(incoming) ? incoming.__value : incoming); return existing; } if (isFieldValueToBeMerged(incoming)) { incoming.__value = this.merge(existing, incoming.__value); return incoming; } return this.merge(existing, incoming); }; //# sourceMappingURL=helpers.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/inMemoryCache.js": /*!*********************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/inMemoryCache.js ***! \*********************************************************************/ /*! namespace exports */ /*! export InMemoryCache [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "InMemoryCache": () => /* binding */ InMemoryCache /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _fixPolyfills_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fixPolyfills.js */ "./node_modules/@apollo/client/cache/inmemory/fixPolyfills.js"); /* harmony import */ var _fixPolyfills_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_fixPolyfills_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! optimism */ "./node_modules/optimism/lib/bundle.esm.js"); /* harmony import */ var _core_cache_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/cache.js */ "./node_modules/@apollo/client/cache/core/cache.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _readFromStore_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./readFromStore.js */ "./node_modules/@apollo/client/cache/inmemory/readFromStore.js"); /* harmony import */ var _writeToStore_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./writeToStore.js */ "./node_modules/@apollo/client/cache/inmemory/writeToStore.js"); /* harmony import */ var _entityStore_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./entityStore.js */ "./node_modules/@apollo/client/cache/inmemory/entityStore.js"); /* harmony import */ var _reactiveVars_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./reactiveVars.js */ "./node_modules/@apollo/client/cache/inmemory/reactiveVars.js"); /* harmony import */ var _policies_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./policies.js */ "./node_modules/@apollo/client/cache/inmemory/policies.js"); /* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./helpers.js */ "./node_modules/@apollo/client/cache/inmemory/helpers.js"); ; var defaultConfig = { dataIdFromObject: _policies_js__WEBPACK_IMPORTED_MODULE_8__.defaultDataIdFromObject, addTypename: true, resultCaching: true, typePolicies: {}, }; var InMemoryCache = (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__extends)(InMemoryCache, _super); function InMemoryCache(config) { if (config === void 0) { config = {}; } var _this = _super.call(this) || this; _this.watches = new Set(); _this.typenameDocumentCache = new Map(); _this.makeVar = _reactiveVars_js__WEBPACK_IMPORTED_MODULE_7__.makeVar; _this.txCount = 0; _this.maybeBroadcastWatch = (0,optimism__WEBPACK_IMPORTED_MODULE_1__.wrap)(function (c, fromOptimisticTransaction) { return _this.broadcastWatch.call(_this, c, !!fromOptimisticTransaction); }, { makeCacheKey: function (c) { var store = c.optimistic ? _this.optimisticData : _this.data; if ((0,_entityStore_js__WEBPACK_IMPORTED_MODULE_6__.supportsResultCaching)(store)) { var optimistic = c.optimistic, rootId = c.rootId, variables = c.variables; return store.makeCacheKey(c.query, c.callback, JSON.stringify({ optimistic: optimistic, rootId: rootId, variables: variables })); } } }); _this.watchDep = (0,optimism__WEBPACK_IMPORTED_MODULE_1__.dep)(); _this.config = (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({}, defaultConfig), config); _this.addTypename = !!_this.config.addTypename; _this.policies = new _policies_js__WEBPACK_IMPORTED_MODULE_8__.Policies({ cache: _this, dataIdFromObject: _this.config.dataIdFromObject, possibleTypes: _this.config.possibleTypes, typePolicies: _this.config.typePolicies, }); _this.data = new _entityStore_js__WEBPACK_IMPORTED_MODULE_6__.EntityStore.Root({ policies: _this.policies, resultCaching: _this.config.resultCaching, }); _this.optimisticData = _this.data; _this.storeWriter = new _writeToStore_js__WEBPACK_IMPORTED_MODULE_5__.StoreWriter(_this, _this.storeReader = new _readFromStore_js__WEBPACK_IMPORTED_MODULE_4__.StoreReader({ cache: _this, addTypename: _this.addTypename, })); return _this; } InMemoryCache.prototype.restore = function (data) { if (data) this.data.replace(data); return this; }; InMemoryCache.prototype.extract = function (optimistic) { if (optimistic === void 0) { optimistic = false; } return (optimistic ? this.optimisticData : this.data).toObject(); }; InMemoryCache.prototype.read = function (options) { var store = options.optimistic ? this.optimisticData : this.data; if (typeof options.rootId === 'string' && !store.has(options.rootId)) { return null; } return this.storeReader.diffQueryAgainstStore({ store: store, query: options.query, variables: options.variables, rootId: options.rootId, config: this.config, returnPartialData: false, }).result || null; }; InMemoryCache.prototype.write = function (options) { try { ++this.txCount; return this.storeWriter.writeToStore({ store: this.data, query: options.query, result: options.result, dataId: options.dataId, variables: options.variables, }); } finally { if (!--this.txCount && options.broadcast !== false) { this.broadcastWatches(); } } }; InMemoryCache.prototype.modify = function (options) { if (_helpers_js__WEBPACK_IMPORTED_MODULE_9__.hasOwn.call(options, "id") && !options.id) { return false; } var store = options.optimistic ? this.optimisticData : this.data; try { ++this.txCount; return store.modify(options.id || "ROOT_QUERY", options.fields); } finally { if (!--this.txCount && options.broadcast !== false) { this.broadcastWatches(); } } }; InMemoryCache.prototype.diff = function (options) { return this.storeReader.diffQueryAgainstStore({ store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", query: options.query, variables: options.variables, returnPartialData: options.returnPartialData, config: this.config, }); }; InMemoryCache.prototype.watch = function (watch) { var _this = this; this.watches.add(watch); if (watch.immediate) { this.maybeBroadcastWatch(watch); } return function () { _this.watches.delete(watch); _this.watchDep.dirty(watch); _this.maybeBroadcastWatch.forget(watch); }; }; InMemoryCache.prototype.gc = function () { return this.optimisticData.gc(); }; InMemoryCache.prototype.retain = function (rootId, optimistic) { return (optimistic ? this.optimisticData : this.data).retain(rootId); }; InMemoryCache.prototype.release = function (rootId, optimistic) { return (optimistic ? this.optimisticData : this.data).release(rootId); }; InMemoryCache.prototype.identify = function (object) { return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.isReference)(object) ? object.__ref : this.policies.identify(object)[0]; }; InMemoryCache.prototype.evict = function (options) { if (!options.id) { if (_helpers_js__WEBPACK_IMPORTED_MODULE_9__.hasOwn.call(options, "id")) { return false; } options = (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({}, options), { id: "ROOT_QUERY" }); } try { ++this.txCount; return this.optimisticData.evict(options); } finally { if (!--this.txCount && options.broadcast !== false) { this.broadcastWatches(); } } }; InMemoryCache.prototype.reset = function () { this.data.clear(); this.optimisticData = this.data; this.broadcastWatches(); return Promise.resolve(); }; InMemoryCache.prototype.removeOptimistic = function (idToRemove) { var newOptimisticData = this.optimisticData.removeLayer(idToRemove); if (newOptimisticData !== this.optimisticData) { this.optimisticData = newOptimisticData; this.broadcastWatches(); } }; InMemoryCache.prototype.performTransaction = function (transaction, optimisticId) { var _this = this; var perform = function (layer) { var _a = _this, data = _a.data, optimisticData = _a.optimisticData; ++_this.txCount; if (layer) { _this.data = _this.optimisticData = layer; } try { transaction(_this); } finally { --_this.txCount; _this.data = data; _this.optimisticData = optimisticData; } }; var fromOptimisticTransaction = false; if (typeof optimisticId === 'string') { this.optimisticData = this.optimisticData.addLayer(optimisticId, perform); fromOptimisticTransaction = true; } else if (optimisticId === null) { perform(this.data); } else { perform(); } this.broadcastWatches(fromOptimisticTransaction); }; InMemoryCache.prototype.transformDocument = function (document) { if (this.addTypename) { var result = this.typenameDocumentCache.get(document); if (!result) { result = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.addTypenameToDocument)(document); this.typenameDocumentCache.set(document, result); this.typenameDocumentCache.set(result, result); } return result; } return document; }; InMemoryCache.prototype.broadcastWatches = function (fromOptimisticTransaction) { var _this = this; if (!this.txCount) { this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, fromOptimisticTransaction); }); } }; InMemoryCache.prototype.broadcastWatch = function (c, fromOptimisticTransaction) { this.watchDep.dirty(c); this.watchDep(c); var diff = this.diff({ query: c.query, variables: c.variables, optimistic: c.optimistic, }); if (c.optimistic && fromOptimisticTransaction) { diff.fromOptimisticTransaction = true; } c.callback(diff); }; return InMemoryCache; }(_core_cache_js__WEBPACK_IMPORTED_MODULE_2__.ApolloCache)); //# sourceMappingURL=inMemoryCache.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/policies.js": /*!****************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/policies.js ***! \****************************************************************/ /*! namespace exports */ /*! export Policies [provided] [no usage info] [missing usage info prevents renaming] */ /*! export defaultDataIdFromObject [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "defaultDataIdFromObject": () => /* binding */ defaultDataIdFromObject, /* harmony export */ "Policies": () => /* binding */ Policies /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! optimism */ "./node_modules/optimism/lib/bundle.esm.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers.js */ "./node_modules/@apollo/client/cache/inmemory/helpers.js"); /* harmony import */ var _reactiveVars_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./reactiveVars.js */ "./node_modules/@apollo/client/cache/inmemory/reactiveVars.js"); ; function argsFromFieldSpecifier(spec) { return spec.args !== void 0 ? spec.args : spec.field ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.argumentsObjectFromField)(spec.field, spec.variables) : null; } var defaultDataIdFromObject = function (_a, context) { var __typename = _a.__typename, id = _a.id, _id = _a._id; if (typeof __typename === "string") { if (context) { context.keyObject = id !== void 0 ? { id: id } : _id !== void 0 ? { _id: _id } : void 0; } if (id === void 0) id = _id; if (id !== void 0) { return __typename + ":" + ((typeof id === "number" || typeof id === "string") ? id : JSON.stringify(id)); } } }; var nullKeyFieldsFn = function () { return void 0; }; var simpleKeyArgsFn = function (_args, context) { return context.fieldName; }; var mergeTrueFn = function (existing, incoming, _a) { var mergeObjects = _a.mergeObjects; return mergeObjects(existing, incoming); }; var mergeFalseFn = function (_, incoming) { return incoming; }; var Policies = (function () { function Policies(config) { this.config = config; this.typePolicies = Object.create(null); this.supertypeMap = new Map(); this.fuzzySubtypes = new Map(); this.rootIdsByTypename = Object.create(null); this.rootTypenamesById = Object.create(null); this.usingPossibleTypes = false; this.config = (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({ dataIdFromObject: defaultDataIdFromObject }, config); this.cache = this.config.cache; this.setRootTypename("Query"); this.setRootTypename("Mutation"); this.setRootTypename("Subscription"); if (config.possibleTypes) { this.addPossibleTypes(config.possibleTypes); } if (config.typePolicies) { this.addTypePolicies(config.typePolicies); } } Policies.prototype.identify = function (object, selectionSet, fragmentMap) { var typename = selectionSet && fragmentMap ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getTypenameFromResult)(object, selectionSet, fragmentMap) : object.__typename; if (typename === this.rootTypenamesById.ROOT_QUERY) { return ["ROOT_QUERY"]; } var context = { typename: typename, selectionSet: selectionSet, fragmentMap: fragmentMap, }; var id; var policy = this.getTypePolicy(typename, false); var keyFn = policy && policy.keyFn || this.config.dataIdFromObject; while (keyFn) { var specifierOrId = keyFn(object, context); if (Array.isArray(specifierOrId)) { keyFn = keyFieldsFnFromSpecifier(specifierOrId); } else { id = specifierOrId; break; } } id = id && String(id); return context.keyObject ? [id, context.keyObject] : [id]; }; Policies.prototype.addTypePolicies = function (typePolicies) { var _this = this; Object.keys(typePolicies).forEach(function (typename) { var existing = _this.getTypePolicy(typename, true); var incoming = typePolicies[typename]; var keyFields = incoming.keyFields, fields = incoming.fields; if (incoming.queryType) _this.setRootTypename("Query", typename); if (incoming.mutationType) _this.setRootTypename("Mutation", typename); if (incoming.subscriptionType) _this.setRootTypename("Subscription", typename); existing.keyFn = keyFields === false ? nullKeyFieldsFn : Array.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) : typeof keyFields === "function" ? keyFields : existing.keyFn; if (fields) { Object.keys(fields).forEach(function (fieldName) { var existing = _this.getFieldPolicy(typename, fieldName, true); var incoming = fields[fieldName]; if (typeof incoming === "function") { existing.read = incoming; } else { var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge; existing.keyFn = keyArgs === false ? simpleKeyArgsFn : Array.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) : typeof keyArgs === "function" ? keyArgs : existing.keyFn; if (typeof read === "function") existing.read = read; existing.merge = typeof merge === "function" ? merge : merge === true ? mergeTrueFn : merge === false ? mergeFalseFn : existing.merge; } if (existing.read && existing.merge) { existing.keyFn = existing.keyFn || simpleKeyArgsFn; } }); } }); }; Policies.prototype.setRootTypename = function (which, typename) { if (typename === void 0) { typename = which; } var rootId = "ROOT_" + which.toUpperCase(); var old = this.rootTypenamesById[rootId]; if (typename !== old) { false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_1__.invariant)(!old || old === which, "Cannot change root " + which + " __typename more than once"); if (old) delete this.rootIdsByTypename[old]; this.rootIdsByTypename[typename] = rootId; this.rootTypenamesById[rootId] = typename; } }; Policies.prototype.addPossibleTypes = function (possibleTypes) { var _this = this; this.usingPossibleTypes = true; Object.keys(possibleTypes).forEach(function (supertype) { _this.getSupertypeSet(supertype, true); possibleTypes[supertype].forEach(function (subtype) { _this.getSupertypeSet(subtype, true).add(supertype); var match = subtype.match(_helpers_js__WEBPACK_IMPORTED_MODULE_3__.TypeOrFieldNameRegExp); if (!match || match[0] !== subtype) { _this.fuzzySubtypes.set(subtype, new RegExp(subtype)); } }); }); }; Policies.prototype.getTypePolicy = function (typename, createIfMissing) { if (typename) { return this.typePolicies[typename] || (createIfMissing && (this.typePolicies[typename] = Object.create(null))); } }; Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) { var typePolicy = this.getTypePolicy(typename, createIfMissing); if (typePolicy) { var fieldPolicies = typePolicy.fields || (createIfMissing && (typePolicy.fields = Object.create(null))); if (fieldPolicies) { return fieldPolicies[fieldName] || (createIfMissing && (fieldPolicies[fieldName] = Object.create(null))); } } }; Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) { var supertypeSet = this.supertypeMap.get(subtype); if (!supertypeSet && createIfMissing) { this.supertypeMap.set(subtype, supertypeSet = new Set()); } return supertypeSet; }; Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) { var _this = this; if (!fragment.typeCondition) return true; if (!typename) return false; var supertype = fragment.typeCondition.name.value; if (typename === supertype) return true; if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) { var typenameSupertypeSet = this.getSupertypeSet(typename, true); var workQueue_1 = [typenameSupertypeSet]; var maybeEnqueue_1 = function (subtype) { var supertypeSet = _this.getSupertypeSet(subtype, false); if (supertypeSet && supertypeSet.size && workQueue_1.indexOf(supertypeSet) < 0) { workQueue_1.push(supertypeSet); } }; var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size); var checkingFuzzySubtypes = false; for (var i = 0; i < workQueue_1.length; ++i) { var supertypeSet = workQueue_1[i]; if (supertypeSet.has(supertype)) { if (!typenameSupertypeSet.has(supertype)) { if (checkingFuzzySubtypes) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_1__.invariant.warn("Inferring subtype " + typename + " of supertype " + supertype); } typenameSupertypeSet.add(supertype); } return true; } supertypeSet.forEach(maybeEnqueue_1); if (needToCheckFuzzySubtypes && i === workQueue_1.length - 1 && (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.selectionSetMatchesResult)(fragment.selectionSet, result, variables)) { needToCheckFuzzySubtypes = false; checkingFuzzySubtypes = true; this.fuzzySubtypes.forEach(function (regExp, fuzzyString) { var match = typename.match(regExp); if (match && match[0] === typename) { maybeEnqueue_1(fuzzyString); } }); } } } return false; }; Policies.prototype.getStoreFieldName = function (fieldSpec) { var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName; var policy = this.getFieldPolicy(typename, fieldName, false); var storeFieldName; var keyFn = policy && policy.keyFn; if (keyFn && typename) { var context = { typename: typename, fieldName: fieldName, field: fieldSpec.field || null, variables: fieldSpec.variables, }; var args = argsFromFieldSpecifier(fieldSpec); while (keyFn) { var specifierOrString = keyFn(args, context); if (Array.isArray(specifierOrString)) { keyFn = keyArgsFnFromSpecifier(specifierOrString); } else { storeFieldName = specifierOrString || fieldName; break; } } } if (storeFieldName === void 0) { storeFieldName = fieldSpec.field ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.storeKeyNameFromField)(fieldSpec.field, fieldSpec.variables) : (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getStoreKeyName)(fieldName, argsFromFieldSpecifier(fieldSpec)); } return fieldName === (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName) ? storeFieldName : fieldName + ":" + storeFieldName; }; Policies.prototype.readField = function (options, context) { var objectOrReference = options.from; if (!objectOrReference) return; var nameOrField = options.field || options.fieldName; if (!nameOrField) return; if (options.typename === void 0) { var typename = context.store.getFieldValue(objectOrReference, "__typename"); if (typename) options.typename = typename; } var storeFieldName = this.getStoreFieldName(options); var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName); var existing = context.store.getFieldValue(objectOrReference, storeFieldName); var policy = this.getFieldPolicy(options.typename, fieldName, false); var read = policy && policy.read; if (read) { var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(objectOrReference) ? objectOrReference.__ref : objectOrReference, storeFieldName)); return _reactiveVars_js__WEBPACK_IMPORTED_MODULE_4__.cacheSlot.withValue(this.cache, read, [existing, readOptions]); } return existing; }; Policies.prototype.hasMergeFunction = function (typename, fieldName) { var policy = this.getFieldPolicy(typename, fieldName, false); return !!(policy && policy.merge); }; Policies.prototype.applyMerges = function (existing, incoming, context, storageKeys) { var _a; var _this = this; if ((0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.isFieldValueToBeMerged)(incoming)) { var field = incoming.__field; var fieldName = field.name.value; var merge = this.getFieldPolicy(incoming.__typename, fieldName, false).merge; incoming = merge(existing, incoming.__value, makeFieldFunctionOptions(this, void 0, { typename: incoming.__typename, fieldName: fieldName, field: field, variables: context.variables }, context, storageKeys ? (_a = context.store).getStorage.apply(_a, storageKeys) : Object.create(null))); } if (Array.isArray(incoming)) { return incoming.map(function (item) { return _this.applyMerges(void 0, item, context); }); } if ((0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.storeValueIsStoreObject)(incoming)) { var e_1 = existing; var i_1 = incoming; var firstStorageKey_1 = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(e_1) ? e_1.__ref : typeof e_1 === "object" && e_1; var newFields_1; Object.keys(i_1).forEach(function (storeFieldName) { var incomingValue = i_1[storeFieldName]; var appliedValue = _this.applyMerges(context.store.getFieldValue(e_1, storeFieldName), incomingValue, context, firstStorageKey_1 ? [firstStorageKey_1, storeFieldName] : void 0); if (appliedValue !== incomingValue) { newFields_1 = newFields_1 || Object.create(null); newFields_1[storeFieldName] = appliedValue; } }); if (newFields_1) { return (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, i_1), newFields_1); } } return incoming; }; return Policies; }()); function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) { var storeFieldName = policies.getStoreFieldName(fieldSpec); var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName); var variables = fieldSpec.variables || context.variables; var _a = context.store, getFieldValue = _a.getFieldValue, toReference = _a.toReference, canRead = _a.canRead; return { args: argsFromFieldSpecifier(fieldSpec), field: fieldSpec.field || null, fieldName: fieldName, storeFieldName: storeFieldName, variables: variables, isReference: _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference, toReference: toReference, storage: storage, cache: policies.cache, canRead: canRead, readField: function (fieldNameOrOptions, from) { var options = typeof fieldNameOrOptions === "string" ? { fieldName: fieldNameOrOptions, from: from, } : (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, fieldNameOrOptions); if (void 0 === options.from) { options.from = objectOrReference; } if (void 0 === options.variables) { options.variables = variables; } return policies.readField(options, context); }, mergeObjects: function (existing, incoming) { if (Array.isArray(existing) || Array.isArray(incoming)) { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__.InvariantError("Cannot automatically merge arrays"); } if (existing && typeof existing === "object" && incoming && typeof incoming === "object") { var eType = getFieldValue(existing, "__typename"); var iType = getFieldValue(incoming, "__typename"); var typesDiffer = eType && iType && eType !== iType; var applied = policies.applyMerges(typesDiffer ? void 0 : existing, incoming, context); if (typesDiffer || !(0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.storeValueIsStoreObject)(existing) || !(0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.storeValueIsStoreObject)(applied)) { return applied; } return (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, existing), applied); } return incoming; } }; } function keyArgsFnFromSpecifier(specifier) { return function (args, context) { return args ? context.fieldName + ":" + JSON.stringify(computeKeyObject(args, specifier)) : context.fieldName; }; } function keyFieldsFnFromSpecifier(specifier) { var trie = new optimism__WEBPACK_IMPORTED_MODULE_0__.KeyTrie(_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.canUseWeakMap); return function (object, context) { var aliasMap; if (context.selectionSet && context.fragmentMap) { var info = trie.lookupArray([ context.selectionSet, context.fragmentMap, ]); aliasMap = info.aliasMap || (info.aliasMap = makeAliasMap(context.selectionSet, context.fragmentMap)); } var keyObject = context.keyObject = computeKeyObject(object, specifier, aliasMap); return context.typename + ":" + JSON.stringify(keyObject); }; } function makeAliasMap(selectionSet, fragmentMap) { var map = Object.create(null); var workQueue = new Set([selectionSet]); workQueue.forEach(function (selectionSet) { selectionSet.selections.forEach(function (selection) { if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isField)(selection)) { if (selection.alias) { var responseKey = selection.alias.value; var storeKey = selection.name.value; if (storeKey !== responseKey) { var aliases = map.aliases || (map.aliases = Object.create(null)); aliases[storeKey] = responseKey; } } if (selection.selectionSet) { var subsets = map.subsets || (map.subsets = Object.create(null)); subsets[selection.name.value] = makeAliasMap(selection.selectionSet, fragmentMap); } } else { var fragment = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentFromSelection)(selection, fragmentMap); if (fragment) { workQueue.add(fragment.selectionSet); } } }); }); return map; } function computeKeyObject(response, specifier, aliasMap) { var keyObj = Object.create(null); var prevKey; specifier.forEach(function (s) { if (Array.isArray(s)) { if (typeof prevKey === "string") { var subsets = aliasMap && aliasMap.subsets; var subset = subsets && subsets[prevKey]; keyObj[prevKey] = computeKeyObject(response[prevKey], s, subset); } } else { var aliases = aliasMap && aliasMap.aliases; var responseName = aliases && aliases[s] || s; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_1__.invariant)(_helpers_js__WEBPACK_IMPORTED_MODULE_3__.hasOwn.call(response, responseName), "Missing field '" + responseName + "' while computing key fields"); keyObj[prevKey = s] = response[responseName]; } }); return keyObj; } //# sourceMappingURL=policies.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/reactiveVars.js": /*!********************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/reactiveVars.js ***! \********************************************************************/ /*! namespace exports */ /*! export cacheSlot [provided] [no usage info] [missing usage info prevents renaming] */ /*! export makeVar [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "cacheSlot": () => /* binding */ cacheSlot, /* harmony export */ "makeVar": () => /* binding */ makeVar /* harmony export */ }); /* harmony import */ var _wry_context__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wry/context */ "./node_modules/@wry/context/lib/context.esm.js"); /* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! optimism */ "./node_modules/optimism/lib/bundle.esm.js"); ; var varDep = (0,optimism__WEBPACK_IMPORTED_MODULE_1__.dep)(); var cacheSlot = new _wry_context__WEBPACK_IMPORTED_MODULE_0__.Slot(); function consumeAndIterate(set, callback) { var items = []; set.forEach(function (item) { return items.push(item); }); set.clear(); items.forEach(callback); } function makeVar(value) { var caches = new Set(); var listeners = new Set(); var rv = function (newValue) { if (arguments.length > 0) { if (value !== newValue) { value = newValue; varDep.dirty(rv); caches.forEach(broadcast); consumeAndIterate(listeners, function (listener) { return listener(value); }); } } else { var cache = cacheSlot.getValue(); if (cache) caches.add(cache); varDep(rv); } return value; }; rv.onNextChange = function (listener) { listeners.add(listener); return function () { listeners.delete(listener); }; }; return rv; } function broadcast(cache) { if (cache.broadcastWatches) { cache.broadcastWatches(); } } //# sourceMappingURL=reactiveVars.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/readFromStore.js": /*!*********************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/readFromStore.js ***! \*********************************************************************/ /*! namespace exports */ /*! export StoreReader [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "StoreReader": () => /* binding */ StoreReader /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! optimism */ "./node_modules/optimism/lib/bundle.esm.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _entityStore_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./entityStore.js */ "./node_modules/@apollo/client/cache/inmemory/entityStore.js"); /* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers.js */ "./node_modules/@apollo/client/cache/inmemory/helpers.js"); /* harmony import */ var _core_types_common_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../core/types/common.js */ "./node_modules/@apollo/client/cache/core/types/common.js"); ; ; function missingFromInvariant(err, context) { return new _core_types_common_js__WEBPACK_IMPORTED_MODULE_5__.MissingFieldError(err.message, context.path.slice(), context.query, context.clientOnly, context.variables); } var StoreReader = (function () { function StoreReader(config) { var _this = this; this.config = config; this.executeSelectionSet = (0,optimism__WEBPACK_IMPORTED_MODULE_0__.wrap)(function (options) { return _this.execSelectionSetImpl(options); }, { keyArgs: function (options) { return [ options.selectionSet, options.objectOrReference, options.context, ]; }, makeCacheKey: function (selectionSet, parent, context) { if ((0,_entityStore_js__WEBPACK_IMPORTED_MODULE_3__.supportsResultCaching)(context.store)) { return context.store.makeCacheKey(selectionSet, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(parent) ? parent.__ref : parent, context.varString); } } }); this.knownResults = new WeakMap(); this.executeSubSelectedArray = (0,optimism__WEBPACK_IMPORTED_MODULE_0__.wrap)(function (options) { return _this.execSubSelectedArrayImpl(options); }, { makeCacheKey: function (_a) { var field = _a.field, array = _a.array, context = _a.context; if ((0,_entityStore_js__WEBPACK_IMPORTED_MODULE_3__.supportsResultCaching)(context.store)) { return context.store.makeCacheKey(field, array, context.varString); } } }); this.config = (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({ addTypename: true }, config); } StoreReader.prototype.diffQueryAgainstStore = function (_a) { var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? 'ROOT_QUERY' : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c; var policies = this.config.cache.policies; variables = (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getDefaultValues)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getQueryDefinition)(query))), variables); var execResult = this.executeSelectionSet({ selectionSet: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getMainDefinition)(query).selectionSet, objectOrReference: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.makeReference)(rootId), context: { store: store, query: query, policies: policies, variables: variables, varString: JSON.stringify(variables), fragmentMap: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.createFragmentMap)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentDefinitions)(query)), path: [], clientOnly: false, }, }); var hasMissingFields = execResult.missing && execResult.missing.length > 0; if (hasMissingFields && !returnPartialData) { throw execResult.missing[0]; } return { result: execResult.result, missing: execResult.missing, complete: !hasMissingFields, }; }; StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) { if ((0,_entityStore_js__WEBPACK_IMPORTED_MODULE_3__.supportsResultCaching)(context.store) && this.knownResults.get(result) === selectionSet) { var latest = this.executeSelectionSet.peek(selectionSet, parent, context); if (latest && result === latest.result) { return true; } } return false; }; StoreReader.prototype.execSelectionSetImpl = function (_a) { var _this = this; var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, context = _a.context; if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(objectOrReference) && !context.policies.rootTypenamesById[objectOrReference.__ref] && !context.store.has(objectOrReference.__ref)) { return { result: {}, missing: [missingFromInvariant( false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object"), context)], }; } var variables = context.variables, policies = context.policies, store = context.store; var objectsToMerge = []; var finalResult = { result: null }; var typename = store.getFieldValue(objectOrReference, "__typename"); if (this.config.addTypename && typeof typename === "string" && !policies.rootIdsByTypename[typename]) { objectsToMerge.push({ __typename: typename }); } function getMissing() { return finalResult.missing || (finalResult.missing = []); } function handleMissing(result) { var _a; if (result.missing) (_a = getMissing()).push.apply(_a, result.missing); return result.result; } var workSet = new Set(selectionSet.selections); workSet.forEach(function (selection) { var _a; if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.shouldInclude)(selection, variables)) return; if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isField)(selection)) { var fieldValue = policies.readField({ fieldName: selection.name.value, field: selection, variables: context.variables, from: objectOrReference, }, context); var resultName = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.resultKeyNameFromField)(selection); context.path.push(resultName); var wasClientOnly = context.clientOnly; context.clientOnly = wasClientOnly || !!(selection.directives && selection.directives.some(function (d) { return d.name.value === "client"; })); if (fieldValue === void 0) { if (!_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.addTypenameToDocument.added(selection)) { getMissing().push(missingFromInvariant( false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__.InvariantError("Can't find field '" + selection.name.value + "' on " + ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(objectOrReference) ? objectOrReference.__ref + " object" : "object " + JSON.stringify(objectOrReference, null, 2))), context)); } } else if (Array.isArray(fieldValue)) { fieldValue = handleMissing(_this.executeSubSelectedArray({ field: selection, array: fieldValue, context: context, })); } else if (!selection.selectionSet) { if (true) { assertSelectionSetForIdValue(context.store, selection, fieldValue); (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.maybeDeepFreeze)(fieldValue); } } else if (fieldValue != null) { fieldValue = handleMissing(_this.executeSelectionSet({ selectionSet: selection.selectionSet, objectOrReference: fieldValue, context: context, })); } if (fieldValue !== void 0) { objectsToMerge.push((_a = {}, _a[resultName] = fieldValue, _a)); } context.clientOnly = wasClientOnly; (0,ts_invariant__WEBPACK_IMPORTED_MODULE_1__.invariant)(context.path.pop() === resultName); } else { var fragment = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentFromSelection)(selection, context.fragmentMap); if (fragment && policies.fragmentMatches(fragment, typename)) { fragment.selectionSet.selections.forEach(workSet.add, workSet); } } }); finalResult.result = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.mergeDeepArray)(objectsToMerge); if (true) { Object.freeze(finalResult.result); } this.knownResults.set(finalResult.result, selectionSet); return finalResult; }; StoreReader.prototype.execSubSelectedArrayImpl = function (_a) { var _this = this; var field = _a.field, array = _a.array, context = _a.context; var missing; function handleMissing(childResult, i) { if (childResult.missing) { missing = missing || []; missing.push.apply(missing, childResult.missing); } (0,ts_invariant__WEBPACK_IMPORTED_MODULE_1__.invariant)(context.path.pop() === i); return childResult.result; } if (field.selectionSet) { array = array.filter(context.store.canRead); } array = array.map(function (item, i) { if (item === null) { return null; } context.path.push(i); if (Array.isArray(item)) { return handleMissing(_this.executeSubSelectedArray({ field: field, array: item, context: context, }), i); } if (field.selectionSet) { return handleMissing(_this.executeSelectionSet({ selectionSet: field.selectionSet, objectOrReference: item, context: context, }), i); } if (true) { assertSelectionSetForIdValue(context.store, field, item); } (0,ts_invariant__WEBPACK_IMPORTED_MODULE_1__.invariant)(context.path.pop() === i); return item; }); if (true) { Object.freeze(array); } return { result: array, missing: missing }; }; return StoreReader; }()); function assertSelectionSetForIdValue(store, field, fieldValue) { if (!field.selectionSet) { var workSet_1 = new Set([fieldValue]); workSet_1.forEach(function (value) { if (value && typeof value === "object") { false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_1__.invariant)(!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(value), "Missing selection set for object of type " + (0,_helpers_js__WEBPACK_IMPORTED_MODULE_4__.getTypenameFromStoreObject)(store, value) + " returned for query field " + field.name.value); Object.values(value).forEach(workSet_1.add, workSet_1); } }); } } //# sourceMappingURL=readFromStore.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/types.js": /*!*************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/types.js ***! \*************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: */ /***/ (() => { //# sourceMappingURL=types.js.map /***/ }), /***/ "./node_modules/@apollo/client/cache/inmemory/writeToStore.js": /*!********************************************************************!*\ !*** ./node_modules/@apollo/client/cache/inmemory/writeToStore.js ***! \********************************************************************/ /*! namespace exports */ /*! export StoreWriter [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "StoreWriter": () => /* binding */ StoreWriter /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "./node_modules/@wry/equality/lib/equality.esm.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers.js */ "./node_modules/@apollo/client/cache/inmemory/helpers.js"); ; ; var StoreWriter = (function () { function StoreWriter(cache, reader) { this.cache = cache; this.reader = reader; } StoreWriter.prototype.writeToStore = function (_a) { var query = _a.query, result = _a.result, dataId = _a.dataId, store = _a.store, variables = _a.variables; var operationDefinition = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getOperationDefinition)(query); var merger = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.makeProcessedFieldsMerger)(); variables = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_4__.__assign)({}, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getDefaultValues)(operationDefinition)), variables); var ref = this.processSelectionSet({ result: result || Object.create(null), dataId: dataId, selectionSet: operationDefinition.selectionSet, context: { store: store, written: Object.create(null), merge: function (existing, incoming) { return merger.merge(existing, incoming); }, variables: variables, varString: JSON.stringify(variables), fragmentMap: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.createFragmentMap)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentDefinitions)(query)), }, }); if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(ref)) { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Could not identify object " + JSON.stringify(result)); } store.retain(ref.__ref); return ref; }; StoreWriter.prototype.processSelectionSet = function (_a) { var _this = this; var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, _b = _a.out, out = _b === void 0 ? { shouldApplyMerges: false, } : _b; var policies = this.cache.policies; var _c = policies.identify(result, selectionSet, context.fragmentMap), id = _c[0], keyObject = _c[1]; dataId = dataId || id; if ("string" === typeof dataId) { var sets = context.written[dataId] || (context.written[dataId] = []); var ref = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.makeReference)(dataId); if (sets.indexOf(selectionSet) >= 0) return ref; sets.push(selectionSet); if (this.reader && this.reader.isFresh(result, ref, selectionSet, context)) { return ref; } } var mergedFields = Object.create(null); if (keyObject) { mergedFields = context.merge(mergedFields, keyObject); } var typename = (dataId && policies.rootTypenamesById[dataId]) || (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getTypenameFromResult)(result, selectionSet, context.fragmentMap) || (dataId && context.store.get(dataId, "__typename")); if ("string" === typeof typename) { mergedFields.__typename = typename; } var workSet = new Set(selectionSet.selections); workSet.forEach(function (selection) { var _a; if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.shouldInclude)(selection, context.variables)) return; if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isField)(selection)) { var resultFieldKey = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.resultKeyNameFromField)(selection); var value = result[resultFieldKey]; if (typeof value !== 'undefined') { var storeFieldName = policies.getStoreFieldName({ typename: typename, fieldName: selection.name.value, field: selection, variables: context.variables, }); var incomingValue = _this.processFieldValue(value, selection, context, out); if (policies.hasMergeFunction(typename, selection.name.value)) { incomingValue = { __field: selection, __typename: typename, __value: incomingValue, }; out.shouldApplyMerges = true; } mergedFields = context.merge(mergedFields, (_a = {}, _a[storeFieldName] = incomingValue, _a)); } else if (policies.usingPossibleTypes && !(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.hasDirectives)(["defer", "client"], selection)) { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Missing field '" + resultFieldKey + "' in " + JSON.stringify(result, null, 2).substring(0, 100)); } } else { var fragment = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentFromSelection)(selection, context.fragmentMap); if (fragment && policies.fragmentMatches(fragment, typename, result, context.variables)) { fragment.selectionSet.selections.forEach(workSet.add, workSet); } } }); if ("string" === typeof dataId) { var entityRef_1 = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.makeReference)(dataId); if (out.shouldApplyMerges) { mergedFields = policies.applyMerges(entityRef_1, mergedFields, context); } if (true) { Object.keys(mergedFields).forEach(function (storeFieldName) { var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName); if (!policies.hasMergeFunction(typename, fieldName)) { warnAboutDataLoss(entityRef_1, mergedFields, storeFieldName, context.store); } }); } context.store.merge(dataId, mergedFields); return entityRef_1; } return mergedFields; }; StoreWriter.prototype.processFieldValue = function (value, field, context, out) { var _this = this; if (!field.selectionSet || value === null) { return false ? 0 : (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.cloneDeep)(value); } if (Array.isArray(value)) { return value.map(function (item) { return _this.processFieldValue(item, field, context, out); }); } return this.processSelectionSet({ result: value, selectionSet: field.selectionSet, context: context, out: out, }); }; return StoreWriter; }()); var warnings = new Set(); function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) { var getChild = function (objOrRef) { var child = store.getFieldValue(objOrRef, storeFieldName); return typeof child === "object" && child; }; var existing = getChild(existingRef); if (!existing) return; var incoming = getChild(incomingObj); if (!incoming) return; if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.isReference)(existing)) return; if ((0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(existing, incoming)) return; if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) { return; } var parentType = store.getFieldValue(existingRef, "__typename") || store.getFieldValue(incomingObj, "__typename"); var fieldName = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_3__.fieldNameFromStoreName)(storeFieldName); var typeDotName = parentType + "." + fieldName; if (warnings.has(typeDotName)) return; warnings.add(typeDotName); var childTypenames = []; if (!Array.isArray(existing) && !Array.isArray(incoming)) { [existing, incoming].forEach(function (child) { var typename = store.getFieldValue(child, "__typename"); if (typeof typename === "string" && !childTypenames.includes(typename)) { childTypenames.push(typename); } }); } false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Cache data may be lost when replacing the " + fieldName + " field of a " + parentType + " object.\n\nTo address this problem (which is not a bug in Apollo Client), " + (childTypenames.length ? "either ensure all objects of type " + childTypenames.join(" and ") + " have IDs, or " : "") + "define a custom merge function for the " + typeDotName + " field, so InMemoryCache can safely merge these objects:\n\n existing: " + JSON.stringify(existing).slice(0, 1000) + "\n incoming: " + JSON.stringify(incoming).slice(0, 1000) + "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"); } //# sourceMappingURL=writeToStore.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/ApolloClient.js": /*!**********************************************************!*\ !*** ./node_modules/@apollo/client/core/ApolloClient.js ***! \**********************************************************/ /*! namespace exports */ /*! export ApolloClient [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ApolloClient": () => /* binding */ ApolloClient /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _link_core_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../link/core/index.js */ "./node_modules/@apollo/client/link/core/index.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../version.js */ "./node_modules/@apollo/client/version.js"); /* harmony import */ var _link_http_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../link/http/index.js */ "./node_modules/@apollo/client/link/http/index.js"); /* harmony import */ var _QueryManager_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./QueryManager.js */ "./node_modules/@apollo/client/core/QueryManager.js"); /* harmony import */ var _LocalState_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./LocalState.js */ "./node_modules/@apollo/client/core/LocalState.js"); ; var hasSuggestedDevtools = false; var ApolloClient = (function () { function ApolloClient(options) { var _this = this; this.defaultOptions = {}; this.resetStoreCallbacks = []; this.clearStoreCallbacks = []; var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, connectToDevTools = options.connectToDevTools, _c = options.queryDeduplication, queryDeduplication = _c === void 0 ? true : _c, defaultOptions = options.defaultOptions, _d = options.assumeImmutableResults, assumeImmutableResults = _d === void 0 ? false : _d, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; var link = options.link; if (!link) { link = uri ? new _link_http_index_js__WEBPACK_IMPORTED_MODULE_3__.HttpLink({ uri: uri, credentials: credentials, headers: headers }) : _link_core_index_js__WEBPACK_IMPORTED_MODULE_1__.ApolloLink.empty(); } if (!cache) { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError("To initialize Apollo Client, you must specify a 'cache' property " + "in the options object. \n" + "For more information, please visit: https://go.apollo.dev/c/docs"); } this.link = link; this.cache = cache; this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; this.queryDeduplication = queryDeduplication; this.defaultOptions = defaultOptions || {}; this.typeDefs = typeDefs; if (ssrForceFetchDelay) { setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); } this.watchQuery = this.watchQuery.bind(this); this.query = this.query.bind(this); this.mutate = this.mutate.bind(this); this.resetStore = this.resetStore.bind(this); this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); var defaultConnectToDevTools = true && typeof window !== 'undefined' && !window.__APOLLO_CLIENT__; if (typeof connectToDevTools === 'undefined' ? defaultConnectToDevTools : connectToDevTools && typeof window !== 'undefined') { window.__APOLLO_CLIENT__ = this; } if (!hasSuggestedDevtools && "development" !== 'production') { hasSuggestedDevtools = true; if (typeof window !== 'undefined' && window.document && window.top === window.self) { if (typeof window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { if (window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf('Chrome') > -1) { console.debug('Download the Apollo DevTools ' + 'for a better development experience: ' + 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm'); } } } } this.version = _version_js__WEBPACK_IMPORTED_MODULE_6__.version; this.localState = new _LocalState_js__WEBPACK_IMPORTED_MODULE_5__.LocalState({ cache: cache, client: this, resolvers: resolvers, fragmentMatcher: fragmentMatcher, }); this.queryManager = new _QueryManager_js__WEBPACK_IMPORTED_MODULE_4__.QueryManager({ cache: this.cache, link: this.link, queryDeduplication: queryDeduplication, ssrMode: ssrMode, clientAwareness: { name: clientAwarenessName, version: clientAwarenessVersion, }, localState: this.localState, assumeImmutableResults: assumeImmutableResults, onBroadcast: function () { if (_this.devToolsHookCb) { _this.devToolsHookCb({ action: {}, state: { queries: _this.queryManager.getQueryStore(), mutations: _this.queryManager.mutationStore.getStore(), }, dataWithOptimisticResults: _this.cache.extract(true), }); } }, }); } ApolloClient.prototype.stop = function () { this.queryManager.stop(); }; ApolloClient.prototype.watchQuery = function (options) { if (this.defaultOptions.watchQuery) { options = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.compact)(this.defaultOptions.watchQuery, options); } if (this.disableNetworkFetches && (options.fetchPolicy === 'network-only' || options.fetchPolicy === 'cache-and-network')) { options = (0,tslib__WEBPACK_IMPORTED_MODULE_7__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_7__.__assign)({}, options), { fetchPolicy: 'cache-first' }); } return this.queryManager.watchQuery(options); }; ApolloClient.prototype.query = function (options) { if (this.defaultOptions.query) { options = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.compact)(this.defaultOptions.query, options); } false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + 'client.query can only return a single result. Please use client.watchQuery ' + 'to receive multiple results from the cache and the network, or consider ' + 'using a different fetchPolicy, such as cache-first or network-only.'); if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') { options = (0,tslib__WEBPACK_IMPORTED_MODULE_7__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_7__.__assign)({}, options), { fetchPolicy: 'cache-first' }); } return this.queryManager.query(options); }; ApolloClient.prototype.mutate = function (options) { if (this.defaultOptions.mutate) { options = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_2__.compact)(this.defaultOptions.mutate, options); } return this.queryManager.mutate(options); }; ApolloClient.prototype.subscribe = function (options) { return this.queryManager.startGraphQLSubscription(options); }; ApolloClient.prototype.readQuery = function (options, optimistic) { if (optimistic === void 0) { optimistic = false; } return this.cache.readQuery(options, optimistic); }; ApolloClient.prototype.readFragment = function (options, optimistic) { if (optimistic === void 0) { optimistic = false; } return this.cache.readFragment(options, optimistic); }; ApolloClient.prototype.writeQuery = function (options) { this.cache.writeQuery(options); this.queryManager.broadcastQueries(); }; ApolloClient.prototype.writeFragment = function (options) { this.cache.writeFragment(options); this.queryManager.broadcastQueries(); }; ApolloClient.prototype.__actionHookForDevTools = function (cb) { this.devToolsHookCb = cb; }; ApolloClient.prototype.__requestRaw = function (payload) { return (0,_link_core_index_js__WEBPACK_IMPORTED_MODULE_1__.execute)(this.link, payload); }; ApolloClient.prototype.resetStore = function () { var _this = this; return Promise.resolve() .then(function () { return _this.queryManager.clearStore(); }) .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) .then(function () { return _this.reFetchObservableQueries(); }); }; ApolloClient.prototype.clearStore = function () { var _this = this; return Promise.resolve() .then(function () { return _this.queryManager.clearStore(); }) .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); }; ApolloClient.prototype.onResetStore = function (cb) { var _this = this; this.resetStoreCallbacks.push(cb); return function () { _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); }; }; ApolloClient.prototype.onClearStore = function (cb) { var _this = this; this.clearStoreCallbacks.push(cb); return function () { _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); }; }; ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { return this.queryManager.reFetchObservableQueries(includeStandby); }; ApolloClient.prototype.extract = function (optimistic) { return this.cache.extract(optimistic); }; ApolloClient.prototype.restore = function (serializedState) { return this.cache.restore(serializedState); }; ApolloClient.prototype.addResolvers = function (resolvers) { this.localState.addResolvers(resolvers); }; ApolloClient.prototype.setResolvers = function (resolvers) { this.localState.setResolvers(resolvers); }; ApolloClient.prototype.getResolvers = function () { return this.localState.getResolvers(); }; ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { this.localState.setFragmentMatcher(fragmentMatcher); }; ApolloClient.prototype.setLink = function (newLink) { this.link = this.queryManager.link = newLink; }; return ApolloClient; }()); //# sourceMappingURL=ApolloClient.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/LocalState.js": /*!********************************************************!*\ !*** ./node_modules/@apollo/client/core/LocalState.js ***! \********************************************************/ /*! namespace exports */ /*! export LocalState [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "LocalState": () => /* binding */ LocalState /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! graphql */ "./node_modules/graphql/language/visitor.mjs"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _cache_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../cache/index.js */ "./node_modules/@apollo/client/cache/index.js"); ; var LocalState = (function () { function LocalState(_a) { var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; this.cache = cache; if (client) { this.client = client; } if (resolvers) { this.addResolvers(resolvers); } if (fragmentMatcher) { this.setFragmentMatcher(fragmentMatcher); } } LocalState.prototype.addResolvers = function (resolvers) { var _this = this; this.resolvers = this.resolvers || {}; if (Array.isArray(resolvers)) { resolvers.forEach(function (resolverGroup) { _this.resolvers = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.mergeDeep)(_this.resolvers, resolverGroup); }); } else { this.resolvers = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.mergeDeep)(this.resolvers, resolvers); } }; LocalState.prototype.setResolvers = function (resolvers) { this.resolvers = {}; this.addResolvers(resolvers); }; LocalState.prototype.getResolvers = function () { return this.resolvers || {}; }; LocalState.prototype.runResolvers = function (_a) { var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__awaiter)(this, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__generator)(this, function (_c) { if (document) { return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return ((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, remoteResult), { data: localResult.result })); })]; } return [2, remoteResult]; }); }); }; LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { this.fragmentMatcher = fragmentMatcher; }; LocalState.prototype.getFragmentMatcher = function () { return this.fragmentMatcher; }; LocalState.prototype.clientQuery = function (document) { if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.hasDirectives)(['client'], document)) { if (this.resolvers) { return document; } } return null; }; LocalState.prototype.serverQuery = function (document) { return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.removeClientSetsFromDocument)(document); }; LocalState.prototype.prepareContext = function (context) { var cache = this.cache; return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, context), { cache: cache, getCacheKey: function (obj) { return cache.identify(obj); } }); }; LocalState.prototype.addExportedVariables = function (document, variables, context) { if (variables === void 0) { variables = {}; } if (context === void 0) { context = {}; } return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__awaiter)(this, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__generator)(this, function (_a) { if (document) { return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return ((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, variables), data.exportedVariables)); })]; } return [2, (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, variables)]; }); }); }; LocalState.prototype.shouldForceResolvers = function (document) { var forceResolvers = false; (0,graphql__WEBPACK_IMPORTED_MODULE_4__.visit)(document, { Directive: { enter: function (node) { if (node.name.value === 'client' && node.arguments) { forceResolvers = node.arguments.some(function (arg) { return arg.name.value === 'always' && arg.value.kind === 'BooleanValue' && arg.value.value === true; }); if (forceResolvers) { return graphql__WEBPACK_IMPORTED_MODULE_4__.BREAK; } } }, }, }); return forceResolvers; }; LocalState.prototype.buildRootValueFromCache = function (document, variables) { return this.cache.diff({ query: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.buildQueryFromSelectionSet)(document), variables: variables, returnPartialData: true, optimistic: false, }).result; }; LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { if (context === void 0) { context = {}; } if (variables === void 0) { variables = {}; } if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__awaiter)(this, void 0, void 0, function () { var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext; return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__generator)(this, function (_b) { mainDefinition = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.getMainDefinition)(document); fragments = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentDefinitions)(document); fragmentMap = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.createFragmentMap)(fragments); definitionOperation = mainDefinition .operation; defaultOperationType = definitionOperation ? definitionOperation.charAt(0).toUpperCase() + definitionOperation.slice(1) : 'Query'; _a = this, cache = _a.cache, client = _a.client; execContext = { fragmentMap: fragmentMap, context: (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_3__.__assign)({}, context), { cache: cache, client: client }), variables: variables, fragmentMatcher: fragmentMatcher, defaultOperationType: defaultOperationType, exportedVariables: {}, onlyRunForcedResolvers: onlyRunForcedResolvers, }; return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { return ({ result: result, exportedVariables: execContext.exportedVariables, }); })]; }); }); }; LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) { return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__awaiter)(this, void 0, void 0, function () { var fragmentMap, context, variables, resultsToMerge, execute; var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__generator)(this, function (_a) { fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; resultsToMerge = [rootValue]; execute = function (selection) { return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__awaiter)(_this, void 0, void 0, function () { var fragment, typeCondition; return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__generator)(this, function (_a) { if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.shouldInclude)(selection, variables)) { return [2]; } if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.isField)(selection)) { return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) { var _a; if (typeof fieldResult !== 'undefined') { resultsToMerge.push((_a = {}, _a[(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.resultKeyNameFromField)(selection)] = fieldResult, _a)); } })]; } if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.isInlineFragment)(selection)) { fragment = selection; } else { fragment = fragmentMap[selection.name.value]; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragment, "No fragment named " + selection.name.value); } if (fragment && fragment.typeCondition) { typeCondition = fragment.typeCondition.name.value; if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) { resultsToMerge.push(fragmentResult); })]; } } return [2]; }); }); }; return [2, Promise.all(selectionSet.selections.map(execute)).then(function () { return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.mergeDeepArray)(resultsToMerge); })]; }); }); }; LocalState.prototype.resolveField = function (field, rootValue, execContext) { return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__awaiter)(this, void 0, void 0, function () { var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__generator)(this, function (_a) { variables = execContext.variables; fieldName = field.name.value; aliasedFieldName = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.resultKeyNameFromField)(field); aliasUsed = fieldName !== aliasedFieldName; defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; resultPromise = Promise.resolve(defaultResult); if (!execContext.onlyRunForcedResolvers || this.shouldForceResolvers(field)) { resolverType = rootValue.__typename || execContext.defaultOperationType; resolverMap = this.resolvers && this.resolvers[resolverType]; if (resolverMap) { resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; if (resolve) { resultPromise = Promise.resolve(_cache_index_js__WEBPACK_IMPORTED_MODULE_2__.cacheSlot.withValue(this.cache, resolve, [ rootValue, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.argumentsObjectFromField)(field, variables), execContext.context, { field: field, fragmentMap: execContext.fragmentMap }, ])); } } } return [2, resultPromise.then(function (result) { if (result === void 0) { result = defaultResult; } if (field.directives) { field.directives.forEach(function (directive) { if (directive.name.value === 'export' && directive.arguments) { directive.arguments.forEach(function (arg) { if (arg.name.value === 'as' && arg.value.kind === 'StringValue') { execContext.exportedVariables[arg.value.value] = result; } }); } }); } if (!field.selectionSet) { return result; } if (result == null) { return result; } if (Array.isArray(result)) { return _this.resolveSubSelectedArray(field, result, execContext); } if (field.selectionSet) { return _this.resolveSelectionSet(field.selectionSet, result, execContext); } })]; }); }); }; LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) { var _this = this; return Promise.all(result.map(function (item) { if (item === null) { return null; } if (Array.isArray(item)) { return _this.resolveSubSelectedArray(field, item, execContext); } if (field.selectionSet) { return _this.resolveSelectionSet(field.selectionSet, item, execContext); } })); }; return LocalState; }()); //# sourceMappingURL=LocalState.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/MutationStore.js": /*!***********************************************************!*\ !*** ./node_modules/@apollo/client/core/MutationStore.js ***! \***********************************************************/ /*! namespace exports */ /*! export MutationStore [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "MutationStore": () => /* binding */ MutationStore /* harmony export */ }); var MutationStore = (function () { function MutationStore() { this.store = {}; } MutationStore.prototype.getStore = function () { return this.store; }; MutationStore.prototype.get = function (mutationId) { return this.store[mutationId]; }; MutationStore.prototype.initMutation = function (mutationId, mutation, variables) { this.store[mutationId] = { mutation: mutation, variables: variables || {}, loading: true, error: null, }; }; MutationStore.prototype.markMutationError = function (mutationId, error) { var mutation = this.store[mutationId]; if (mutation) { mutation.loading = false; mutation.error = error; } }; MutationStore.prototype.markMutationResult = function (mutationId) { var mutation = this.store[mutationId]; if (mutation) { mutation.loading = false; mutation.error = null; } }; MutationStore.prototype.reset = function () { this.store = {}; }; return MutationStore; }()); //# sourceMappingURL=MutationStore.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/ObservableQuery.js": /*!*************************************************************!*\ !*** ./node_modules/@apollo/client/core/ObservableQuery.js ***! \*************************************************************/ /*! namespace exports */ /*! export ObservableQuery [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ObservableQuery": () => /* binding */ ObservableQuery /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "./node_modules/@wry/equality/lib/equality.esm.js"); /* harmony import */ var _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./networkStatus.js */ "./node_modules/@apollo/client/core/networkStatus.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _Reobserver_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Reobserver.js */ "./node_modules/@apollo/client/core/Reobserver.js"); ; var warnedAboutUpdateQuery = false; var ObservableQuery = (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__extends)(ObservableQuery, _super); function ObservableQuery(_a) { var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options; var _this = _super.call(this, function (observer) { return _this.onSubscribe(observer); }) || this; _this.observers = new Set(); _this.subscriptions = new Set(); _this.observer = { next: function (result) { if (_this.lastError || _this.isDifferentFromLastResult(result)) { _this.updateLastResult(result); (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.iterateObserversSafely)(_this.observers, 'next', result); } }, error: function (error) { _this.updateLastResult((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, _this.lastResult), { error: error, errors: error.graphQLErrors, networkStatus: _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.error, loading: false })); (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.iterateObserversSafely)(_this.observers, 'error', _this.lastError = error); }, }; _this.isTornDown = false; _this.options = options; _this.queryId = queryManager.generateQueryId(); var opDef = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.getOperationDefinition)(options.query); _this.queryName = opDef && opDef.name && opDef.name.value; _this.queryManager = queryManager; _this.queryInfo = queryInfo; return _this; } Object.defineProperty(ObservableQuery.prototype, "variables", { get: function () { return this.options.variables; }, enumerable: false, configurable: true }); ObservableQuery.prototype.result = function () { var _this = this; return new Promise(function (resolve, reject) { var observer = { next: function (result) { resolve(result); _this.observers.delete(observer); if (!_this.observers.size) { _this.queryManager.removeQuery(_this.queryId); } setTimeout(function () { subscription.unsubscribe(); }, 0); }, error: reject, }; var subscription = _this.subscribe(observer); }); }; ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) { if (saveAsLastResult === void 0) { saveAsLastResult = true; } var lastResult = this.lastResult; var networkStatus = this.queryInfo.networkStatus || (lastResult && lastResult.networkStatus) || _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.ready; var result = (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, lastResult), { loading: (0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.isNetworkRequestInFlight)(networkStatus), networkStatus: networkStatus }); if (this.isTornDown) { return result; } var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? 'cache-first' : _a; if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') { delete result.partial; } else if (!result.data || !this.queryManager.transform(this.options.query).hasForcedResolvers) { var diff = this.queryInfo.getDiff(); result.data = (diff.complete || this.options.returnPartialData) ? diff.result : void 0; if (diff.complete) { if (result.networkStatus === _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.loading && (fetchPolicy === 'cache-first' || fetchPolicy === 'cache-only')) { result.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.ready; result.loading = false; } delete result.partial; } else { result.partial = true; } } if (saveAsLastResult) { this.updateLastResult(result); } return result; }; ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) { return !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(this.lastResultSnapshot, newResult); }; ObservableQuery.prototype.getLastResult = function () { return this.lastResult; }; ObservableQuery.prototype.getLastError = function () { return this.lastError; }; ObservableQuery.prototype.resetLastResults = function () { delete this.lastResult; delete this.lastResultSnapshot; delete this.lastError; this.isTornDown = false; }; ObservableQuery.prototype.resetQueryStoreErrors = function () { this.queryManager.resetErrors(this.queryId); }; ObservableQuery.prototype.refetch = function (variables) { var reobserveOptions = { pollInterval: 0, }; var fetchPolicy = this.options.fetchPolicy; if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'cache-and-network') { reobserveOptions.fetchPolicy = 'network-only'; reobserveOptions.nextFetchPolicy = fetchPolicy || "cache-first"; } if (variables && !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(this.options.variables, variables)) { reobserveOptions.variables = this.options.variables = (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, this.options.variables), variables); } return this.newReobserver(false).reobserve(reobserveOptions, _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.refetch); }; ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { var _this = this; var combinedOptions = (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, (fetchMoreOptions.query ? fetchMoreOptions : (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, this.options), fetchMoreOptions), { variables: (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: "no-cache" }); var qid = this.queryManager.generateQueryId(); if (combinedOptions.notifyOnNetworkStatusChange) { this.queryInfo.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.fetchMore; this.observe(); } return this.queryManager.fetchQuery(qid, combinedOptions, _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.fetchMore).then(function (fetchMoreResult) { var data = fetchMoreResult.data; var updateQuery = fetchMoreOptions.updateQuery; if (updateQuery) { if ( true && !warnedAboutUpdateQuery) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("The updateQuery callback for fetchMore is deprecated, and will be removed\nin the next major version of Apollo Client.\n\nPlease convert updateQuery functions to field policies with appropriate\nread and merge functions, or use/adapt a helper function (such as\nconcatPagination, offsetLimitPagination, or relayStylePagination) from\n@apollo/client/utilities.\n\nThe field policy system handles pagination more effectively than a\nhand-written updateQuery function, and you only need to define the policy\nonce, rather than every time you call fetchMore."); warnedAboutUpdateQuery = true; } _this.updateQuery(function (previous) { return updateQuery(previous, { fetchMoreResult: data, variables: combinedOptions.variables, }); }); } else { _this.queryManager.cache.writeQuery({ query: combinedOptions.query, variables: combinedOptions.variables, data: data, }); } return fetchMoreResult; }).finally(function () { _this.queryManager.stopQuery(qid); _this.reobserve(); }); }; ObservableQuery.prototype.subscribeToMore = function (options) { var _this = this; var subscription = this.queryManager .startGraphQLSubscription({ query: options.document, variables: options.variables, context: options.context, }) .subscribe({ next: function (subscriptionData) { var updateQuery = options.updateQuery; if (updateQuery) { _this.updateQuery(function (previous, _a) { var variables = _a.variables; return updateQuery(previous, { subscriptionData: subscriptionData, variables: variables, }); }); } }, error: function (err) { if (options.onError) { options.onError(err); return; } false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.error('Unhandled GraphQL subscription error', err); }, }); this.subscriptions.add(subscription); return function () { if (_this.subscriptions.delete(subscription)) { subscription.unsubscribe(); } }; }; ObservableQuery.prototype.setOptions = function (newOptions) { return this.reobserve(newOptions); }; ObservableQuery.prototype.setVariables = function (variables) { if ((0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(this.variables, variables)) { return this.observers.size ? this.result() : Promise.resolve(); } this.options.variables = variables; if (!this.observers.size) { return Promise.resolve(); } var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? 'cache-first' : _a; var reobserveOptions = { fetchPolicy: fetchPolicy, variables: variables, }; if (fetchPolicy !== 'cache-first' && fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') { reobserveOptions.fetchPolicy = 'cache-and-network'; reobserveOptions.nextFetchPolicy = fetchPolicy; } return this.reobserve(reobserveOptions, _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.setVariables); }; ObservableQuery.prototype.updateQuery = function (mapFn) { var _a; var queryManager = this.queryManager; var result = queryManager.cache.diff({ query: this.options.query, variables: this.variables, previousResult: (_a = this.lastResult) === null || _a === void 0 ? void 0 : _a.data, returnPartialData: true, optimistic: false, }).result; var newResult = mapFn(result, { variables: this.variables, }); if (newResult) { queryManager.cache.writeQuery({ query: this.options.query, data: newResult, variables: this.variables, }); queryManager.broadcastQueries(); } }; ObservableQuery.prototype.startPolling = function (pollInterval) { this.getReobserver().updateOptions({ pollInterval: pollInterval }); }; ObservableQuery.prototype.stopPolling = function () { if (this.reobserver) { this.reobserver.updateOptions({ pollInterval: 0 }); } }; ObservableQuery.prototype.updateLastResult = function (newResult) { var previousResult = this.lastResult; this.lastResult = newResult; this.lastResultSnapshot = this.queryManager.assumeImmutableResults ? newResult : (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.cloneDeep)(newResult); if (!(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.isNonEmptyArray)(newResult.errors)) { delete this.lastError; } return previousResult; }; ObservableQuery.prototype.onSubscribe = function (observer) { var _this = this; if (observer === this.observer) { return function () { }; } try { var subObserver = observer._subscription._observer; if (subObserver && !subObserver.error) { subObserver.error = defaultSubscriptionObserverErrorCallback; } } catch (_a) { } var first = !this.observers.size; this.observers.add(observer); if (this.lastError) { observer.error && observer.error(this.lastError); } else if (this.lastResult) { observer.next && observer.next(this.lastResult); } if (first) { this.reobserve().catch(function (_) { }); } return function () { if (_this.observers.delete(observer) && !_this.observers.size) { _this.tearDownQuery(); } }; }; ObservableQuery.prototype.getReobserver = function () { return this.reobserver || (this.reobserver = this.newReobserver(true)); }; ObservableQuery.prototype.newReobserver = function (shareOptions) { var _this = this; var _a = this, queryManager = _a.queryManager, queryId = _a.queryId; queryManager.setObservableQuery(this); return new _Reobserver_js__WEBPACK_IMPORTED_MODULE_4__.Reobserver(this.observer, shareOptions ? this.options : (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__assign)({}, this.options), function (currentOptions, newNetworkStatus) { queryManager.setObservableQuery(_this); return queryManager.fetchQueryObservable(queryId, currentOptions, newNetworkStatus); }, !queryManager.ssrMode && (function () { return !(0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.isNetworkRequestInFlight)(_this.queryInfo.networkStatus); })); }; ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) { this.isTornDown = false; return this.getReobserver().reobserve(newOptions, newNetworkStatus); }; ObservableQuery.prototype.observe = function () { this.observer.next(this.getCurrentResult(false)); }; ObservableQuery.prototype.hasObservers = function () { return this.observers.size > 0; }; ObservableQuery.prototype.tearDownQuery = function () { var queryManager = this.queryManager; if (this.reobserver) { this.reobserver.stop(); delete this.reobserver; } this.isTornDown = true; this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); this.subscriptions.clear(); queryManager.stopQuery(this.queryId); this.observers.clear(); }; return ObservableQuery; }(_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.Observable)); function defaultSubscriptionObserverErrorCallback(error) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.error('Unhandled error', error.message, error.stack); } //# sourceMappingURL=ObservableQuery.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/QueryInfo.js": /*!*******************************************************!*\ !*** ./node_modules/@apollo/client/core/QueryInfo.js ***! \*******************************************************/ /*! namespace exports */ /*! export QueryInfo [provided] [no usage info] [missing usage info prevents renaming] */ /*! export shouldWriteResult [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "QueryInfo": () => /* binding */ QueryInfo, /* harmony export */ "shouldWriteResult": () => /* binding */ shouldWriteResult /* harmony export */ }); /* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wry/equality */ "./node_modules/@wry/equality/lib/equality.esm.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./networkStatus.js */ "./node_modules/@apollo/client/core/networkStatus.js"); ; var destructiveMethodCounts = new (_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.canUseWeakMap ? WeakMap : Map)(); function wrapDestructiveCacheMethod(cache, methodName) { var original = cache[methodName]; if (typeof original === "function") { cache[methodName] = function () { destructiveMethodCounts.set(cache, (destructiveMethodCounts.get(cache) + 1) % 1e15); return original.apply(this, arguments); }; } } var QueryInfo = (function () { function QueryInfo(cache) { this.cache = cache; this.listeners = new Set(); this.document = null; this.lastRequestId = 1; this.subscriptions = new Set(); this.dirty = false; this.diff = null; this.observableQuery = null; if (!destructiveMethodCounts.has(cache)) { destructiveMethodCounts.set(cache, 0); wrapDestructiveCacheMethod(cache, "evict"); wrapDestructiveCacheMethod(cache, "modify"); wrapDestructiveCacheMethod(cache, "reset"); } } QueryInfo.prototype.init = function (query) { var networkStatus = query.networkStatus || _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.loading; if (this.variables && this.networkStatus !== _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.loading && !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(this.variables, query.variables)) { networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.setVariables; } if (!(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(query.variables, this.variables)) { this.diff = null; } Object.assign(this, { document: query.document, variables: query.variables, networkError: null, graphQLErrors: this.graphQLErrors || [], networkStatus: networkStatus, }); if (query.observableQuery) { this.setObservableQuery(query.observableQuery); } if (query.lastRequestId) { this.lastRequestId = query.lastRequestId; } return this; }; QueryInfo.prototype.getDiff = function (variables) { if (variables === void 0) { variables = this.variables; } if (this.diff && (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(variables, this.variables)) { return this.diff; } this.updateWatch(this.variables = variables); return this.diff = this.cache.diff({ query: this.document, variables: variables, returnPartialData: true, optimistic: true, }); }; QueryInfo.prototype.setDiff = function (diff) { var _this = this; var oldDiff = this.diff; this.diff = diff; if (!this.dirty && (diff && diff.result) !== (oldDiff && oldDiff.result)) { this.dirty = true; if (!this.notifyTimeout) { this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0); } } }; QueryInfo.prototype.setObservableQuery = function (oq) { var _this = this; if (oq === this.observableQuery) return; if (this.oqListener) { this.listeners.delete(this.oqListener); } this.observableQuery = oq; if (oq) { oq["queryInfo"] = this; this.listeners.add(this.oqListener = function () { if (_this.getDiff().fromOptimisticTransaction) { oq["observe"](); } else { oq.reobserve(); } }); } else { delete this.oqListener; } }; QueryInfo.prototype.notify = function () { var _this = this; if (this.notifyTimeout) { clearTimeout(this.notifyTimeout); this.notifyTimeout = void 0; } if (this.shouldNotify()) { this.listeners.forEach(function (listener) { return listener(_this); }); } this.dirty = false; }; QueryInfo.prototype.shouldNotify = function () { if (!this.dirty || !this.listeners.size) { return false; } if ((0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.isNetworkRequestInFlight)(this.networkStatus) && this.observableQuery) { var fetchPolicy = this.observableQuery.options.fetchPolicy; if (fetchPolicy !== "cache-only" && fetchPolicy !== "cache-and-network") { return false; } } return true; }; QueryInfo.prototype.stop = function () { this.cancel(); delete this.cancel; var oq = this.observableQuery; if (oq) oq.stopPolling(); }; QueryInfo.prototype.cancel = function () { }; QueryInfo.prototype.updateWatch = function (variables) { var _this = this; if (variables === void 0) { variables = this.variables; } var oq = this.observableQuery; if (oq && oq.options.fetchPolicy === "no-cache") { return; } if (!this.lastWatch || this.lastWatch.query !== this.document || !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(variables, this.lastWatch.variables)) { this.cancel(); this.cancel = this.cache.watch(this.lastWatch = { query: this.document, variables: variables, optimistic: true, callback: function (diff) { return _this.setDiff(diff); }, }); } }; QueryInfo.prototype.shouldWrite = function (result, variables) { var lastWrite = this.lastWrite; return !(lastWrite && lastWrite.dmCount === destructiveMethodCounts.get(this.cache) && (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(variables, lastWrite.variables) && (0,_wry_equality__WEBPACK_IMPORTED_MODULE_0__.equal)(result.data, lastWrite.result.data)); }; QueryInfo.prototype.markResult = function (result, options, allowCacheWrite) { var _this = this; this.graphQLErrors = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.isNonEmptyArray)(result.errors) ? result.errors : []; if (options.fetchPolicy === 'no-cache') { this.diff = { result: result.data, complete: true }; } else if (allowCacheWrite) { if (shouldWriteResult(result, options.errorPolicy)) { this.cache.performTransaction(function (cache) { if (_this.shouldWrite(result, options.variables)) { cache.writeQuery({ query: _this.document, data: result.data, variables: options.variables, }); _this.lastWrite = { result: result, variables: options.variables, dmCount: destructiveMethodCounts.get(_this.cache), }; } else { if (_this.diff && _this.diff.complete) { result.data = _this.diff.result; return; } } var diff = cache.diff({ query: _this.document, variables: options.variables, returnPartialData: true, optimistic: true, }); _this.updateWatch(options.variables); _this.diff = diff; if (diff.complete) { result.data = diff.result; } }); } else { this.lastWrite = void 0; } } }; QueryInfo.prototype.markReady = function () { this.networkError = null; return this.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.ready; }; QueryInfo.prototype.markError = function (error) { this.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus.error; this.lastWrite = void 0; if (error.graphQLErrors) { this.graphQLErrors = error.graphQLErrors; } if (error.networkError) { this.networkError = error.networkError; } return error; }; return QueryInfo; }()); function shouldWriteResult(result, errorPolicy) { if (errorPolicy === void 0) { errorPolicy = "none"; } var ignoreErrors = errorPolicy === "ignore" || errorPolicy === "all"; var writeWithErrors = !(0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.graphQLResultHasError)(result); if (!writeWithErrors && ignoreErrors && result.data) { writeWithErrors = true; } return writeWithErrors; } //# sourceMappingURL=QueryInfo.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/QueryManager.js": /*!**********************************************************!*\ !*** ./node_modules/@apollo/client/core/QueryManager.js ***! \**********************************************************/ /*! namespace exports */ /*! export QueryManager [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "QueryManager": () => /* binding */ QueryManager /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wry/equality */ "./node_modules/@wry/equality/lib/equality.esm.js"); /* harmony import */ var _link_core_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../link/core/index.js */ "./node_modules/@apollo/client/link/core/index.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _errors_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../errors/index.js */ "./node_modules/@apollo/client/errors/index.js"); /* harmony import */ var _MutationStore_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./MutationStore.js */ "./node_modules/@apollo/client/core/MutationStore.js"); /* harmony import */ var _ObservableQuery_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ObservableQuery.js */ "./node_modules/@apollo/client/core/ObservableQuery.js"); /* harmony import */ var _networkStatus_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./networkStatus.js */ "./node_modules/@apollo/client/core/networkStatus.js"); /* harmony import */ var _LocalState_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./LocalState.js */ "./node_modules/@apollo/client/core/LocalState.js"); /* harmony import */ var _QueryInfo_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./QueryInfo.js */ "./node_modules/@apollo/client/core/QueryInfo.js"); ; var hasOwnProperty = Object.prototype.hasOwnProperty; var QueryManager = (function () { function QueryManager(_a) { var cache = _a.cache, link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, _c = _a.onBroadcast, onBroadcast = _c === void 0 ? function () { return undefined; } : _c, _d = _a.ssrMode, ssrMode = _d === void 0 ? false : _d, _e = _a.clientAwareness, clientAwareness = _e === void 0 ? {} : _e, localState = _a.localState, assumeImmutableResults = _a.assumeImmutableResults; this.mutationStore = new _MutationStore_js__WEBPACK_IMPORTED_MODULE_5__.MutationStore(); this.clientAwareness = {}; this.queries = new Map(); this.fetchCancelFns = new Map(); this.transformCache = new (_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.canUseWeakMap ? WeakMap : Map)(); this.queryIdCounter = 1; this.requestIdCounter = 1; this.mutationIdCounter = 1; this.inFlightLinkObservables = new Map(); this.cache = cache; this.link = link; this.queryDeduplication = queryDeduplication; this.onBroadcast = onBroadcast; this.clientAwareness = clientAwareness; this.localState = localState || new _LocalState_js__WEBPACK_IMPORTED_MODULE_8__.LocalState({ cache: cache }); this.ssrMode = ssrMode; this.assumeImmutableResults = !!assumeImmutableResults; } QueryManager.prototype.stop = function () { var _this = this; this.queries.forEach(function (_info, queryId) { _this.stopQueryNoBroadcast(queryId); }); this.cancelPendingFetches( false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError('QueryManager stopped while query was in flight')); }; QueryManager.prototype.cancelPendingFetches = function (error) { this.fetchCancelFns.forEach(function (cancel) { return cancel(error); }); this.fetchCancelFns.clear(); }; QueryManager.prototype.mutate = function (_a) { var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueriesByName = _a.updateQueries, _b = _a.refetchQueries, refetchQueries = _b === void 0 ? [] : _b, _c = _a.awaitRefetchQueries, awaitRefetchQueries = _c === void 0 ? false : _c, updateWithProxyFn = _a.update, _d = _a.errorPolicy, errorPolicy = _d === void 0 ? 'none' : _d, fetchPolicy = _a.fetchPolicy, _e = _a.context, context = _e === void 0 ? {} : _e; return (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__awaiter)(this, void 0, void 0, function () { var mutationId, generateUpdateQueriesInfo, optimistic_1, self; var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__generator)(this, function (_f) { switch (_f.label) { case 0: false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); mutationId = this.generateMutationId(); mutation = this.transform(mutation).document; variables = this.getVariables(mutation, variables); if (!this.transform(mutation).hasClientExports) return [3, 2]; return [4, this.localState.addExportedVariables(mutation, variables, context)]; case 1: variables = _f.sent(); _f.label = 2; case 2: generateUpdateQueriesInfo = function () { var ret = {}; if (updateQueriesByName) { _this.queries.forEach(function (_a, queryId) { var observableQuery = _a.observableQuery; if (observableQuery) { var queryName = observableQuery.queryName; if (queryName && hasOwnProperty.call(updateQueriesByName, queryName)) { ret[queryId] = { updater: updateQueriesByName[queryName], queryInfo: _this.queries.get(queryId), }; } } }); } return ret; }; this.mutationStore.initMutation(mutationId, mutation, variables); if (optimisticResponse) { optimistic_1 = typeof optimisticResponse === 'function' ? optimisticResponse(variables) : optimisticResponse; this.cache.recordOptimisticTransaction(function (cache) { try { markMutationResult({ mutationId: mutationId, result: { data: optimistic_1 }, document: mutation, variables: variables, errorPolicy: errorPolicy, queryUpdatersById: generateUpdateQueriesInfo(), update: updateWithProxyFn, }, cache); } catch (error) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.error(error); } }, mutationId); } this.broadcastQueries(); self = this; return [2, new Promise(function (resolve, reject) { var storeResult; var error; self.getObservableFromLink(mutation, (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({}, context), { optimisticResponse: optimisticResponse }), variables, false).subscribe({ next: function (result) { if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.graphQLResultHasError)(result) && errorPolicy === 'none') { error = new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError({ graphQLErrors: result.errors, }); return; } self.mutationStore.markMutationResult(mutationId); if (fetchPolicy !== 'no-cache') { try { markMutationResult({ mutationId: mutationId, result: result, document: mutation, variables: variables, errorPolicy: errorPolicy, queryUpdatersById: generateUpdateQueriesInfo(), update: updateWithProxyFn, }, self.cache); } catch (e) { error = new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError({ networkError: e, }); return; } } storeResult = result; }, error: function (err) { self.mutationStore.markMutationError(mutationId, err); if (optimisticResponse) { self.cache.removeOptimistic(mutationId); } self.broadcastQueries(); reject(new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError({ networkError: err, })); }, complete: function () { if (error) { self.mutationStore.markMutationError(mutationId, error); } if (optimisticResponse) { self.cache.removeOptimistic(mutationId); } self.broadcastQueries(); if (error) { reject(error); return; } if (typeof refetchQueries === 'function') { refetchQueries = refetchQueries(storeResult); } var refetchQueryPromises = []; if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.isNonEmptyArray)(refetchQueries)) { refetchQueries.forEach(function (refetchQuery) { if (typeof refetchQuery === 'string') { self.queries.forEach(function (_a) { var observableQuery = _a.observableQuery; if (observableQuery && observableQuery.queryName === refetchQuery) { refetchQueryPromises.push(observableQuery.refetch()); } }); } else { var queryOptions = { query: refetchQuery.query, variables: refetchQuery.variables, fetchPolicy: 'network-only', }; if (refetchQuery.context) { queryOptions.context = refetchQuery.context; } refetchQueryPromises.push(self.query(queryOptions)); } }); } Promise.all(awaitRefetchQueries ? refetchQueryPromises : []).then(function () { if (errorPolicy === 'ignore' && storeResult && (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.graphQLResultHasError)(storeResult)) { delete storeResult.errors; } resolve(storeResult); }, reject); }, }); })]; } }); }); }; QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) { return this.fetchQueryObservable(queryId, options, networkStatus).promise; }; QueryManager.prototype.getQueryStore = function () { var store = Object.create(null); this.queries.forEach(function (info, queryId) { store[queryId] = { variables: info.variables, networkStatus: info.networkStatus, networkError: info.networkError, graphQLErrors: info.graphQLErrors, }; }); return store; }; QueryManager.prototype.resetErrors = function (queryId) { var queryInfo = this.queries.get(queryId); if (queryInfo) { queryInfo.networkError = undefined; queryInfo.graphQLErrors = []; } }; QueryManager.prototype.transform = function (document) { var transformCache = this.transformCache; if (!transformCache.has(document)) { var transformed = this.cache.transformDocument(document); var forLink = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.removeConnectionDirectiveFromDocument)(this.cache.transformForLink(transformed)); var clientQuery = this.localState.clientQuery(transformed); var serverQuery = forLink && this.localState.serverQuery(forLink); var cacheEntry_1 = { document: transformed, hasClientExports: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.hasClientExports)(transformed), hasForcedResolvers: this.localState.shouldForceResolvers(transformed), clientQuery: clientQuery, serverQuery: serverQuery, defaultVars: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.getDefaultValues)((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.getOperationDefinition)(transformed)), }; var add = function (doc) { if (doc && !transformCache.has(doc)) { transformCache.set(doc, cacheEntry_1); } }; add(document); add(transformed); add(clientQuery); add(serverQuery); } return transformCache.get(document); }; QueryManager.prototype.getVariables = function (document, variables) { return (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({}, this.transform(document).defaultVars), variables); }; QueryManager.prototype.watchQuery = function (options) { options = (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({}, options), { variables: this.getVariables(options.query, options.variables) }); if (typeof options.notifyOnNetworkStatusChange === 'undefined') { options.notifyOnNetworkStatusChange = false; } var queryInfo = new _QueryInfo_js__WEBPACK_IMPORTED_MODULE_9__.QueryInfo(this.cache); var observable = new _ObservableQuery_js__WEBPACK_IMPORTED_MODULE_6__.ObservableQuery({ queryManager: this, queryInfo: queryInfo, options: options, }); this.queries.set(observable.queryId, queryInfo); queryInfo.init({ document: options.query, observableQuery: observable, variables: options.variables, }); return observable; }; QueryManager.prototype.query = function (options) { var _this = this; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.query, 'query option is required. You must specify your GraphQL document ' + 'in the query option.'); false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); var queryId = this.generateQueryId(); return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); }); }; QueryManager.prototype.generateQueryId = function () { return String(this.queryIdCounter++); }; QueryManager.prototype.generateRequestId = function () { return this.requestIdCounter++; }; QueryManager.prototype.generateMutationId = function () { return String(this.mutationIdCounter++); }; QueryManager.prototype.stopQueryInStore = function (queryId) { this.stopQueryInStoreNoBroadcast(queryId); this.broadcastQueries(); }; QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { var queryInfo = this.queries.get(queryId); if (queryInfo) queryInfo.stop(); }; QueryManager.prototype.clearStore = function () { this.cancelPendingFetches( false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError('Store reset while query was in flight (not completed in link chain)')); this.queries.forEach(function (queryInfo) { if (queryInfo.observableQuery) { queryInfo.networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_7__.NetworkStatus.loading; } else { queryInfo.stop(); } }); this.mutationStore.reset(); return this.cache.reset(); }; QueryManager.prototype.resetStore = function () { var _this = this; return this.clearStore().then(function () { return _this.reFetchObservableQueries(); }); }; QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { var _this = this; if (includeStandby === void 0) { includeStandby = false; } var observableQueryPromises = []; this.queries.forEach(function (_a, queryId) { var observableQuery = _a.observableQuery; if (observableQuery && observableQuery.hasObservers()) { var fetchPolicy = observableQuery.options.fetchPolicy; observableQuery.resetLastResults(); if (fetchPolicy !== 'cache-only' && (includeStandby || fetchPolicy !== 'standby')) { observableQueryPromises.push(observableQuery.refetch()); } _this.getQuery(queryId).setDiff(null); } }); this.broadcastQueries(); return Promise.all(observableQueryPromises); }; QueryManager.prototype.setObservableQuery = function (observableQuery) { this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery); }; QueryManager.prototype.startGraphQLSubscription = function (_a) { var _this = this; var query = _a.query, fetchPolicy = _a.fetchPolicy, errorPolicy = _a.errorPolicy, variables = _a.variables, _b = _a.context, context = _b === void 0 ? {} : _b; query = this.transform(query).document; variables = this.getVariables(query, variables); var makeObservable = function (variables) { return _this.getObservableFromLink(query, context, variables, false).map(function (result) { if (fetchPolicy !== 'no-cache') { if ((0,_QueryInfo_js__WEBPACK_IMPORTED_MODULE_9__.shouldWriteResult)(result, errorPolicy)) { _this.cache.write({ query: query, result: result.data, dataId: 'ROOT_SUBSCRIPTION', variables: variables, }); } _this.broadcastQueries(); } if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.graphQLResultHasError)(result)) { throw new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError({ graphQLErrors: result.errors, }); } return result; }); }; if (this.transform(query).hasClientExports) { var observablePromise_1 = this.localState.addExportedVariables(query, variables, context).then(makeObservable); return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.Observable(function (observer) { var sub = null; observablePromise_1.then(function (observable) { return sub = observable.subscribe(observer); }, observer.error); return function () { return sub && sub.unsubscribe(); }; }); } return makeObservable(variables); }; QueryManager.prototype.stopQuery = function (queryId) { this.stopQueryNoBroadcast(queryId); this.broadcastQueries(); }; QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { this.stopQueryInStoreNoBroadcast(queryId); this.removeQuery(queryId); }; QueryManager.prototype.removeQuery = function (queryId) { this.fetchCancelFns.delete(queryId); this.getQuery(queryId).subscriptions.forEach(function (x) { return x.unsubscribe(); }); this.queries.delete(queryId); }; QueryManager.prototype.broadcastQueries = function () { this.onBroadcast(); this.queries.forEach(function (info) { return info.notify(); }); }; QueryManager.prototype.getLocalState = function () { return this.localState; }; QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) { var _this = this; var _a; if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; } var observable; var serverQuery = this.transform(query).serverQuery; if (serverQuery) { var _b = this, inFlightLinkObservables_1 = _b.inFlightLinkObservables, link = _b.link; var operation = { query: serverQuery, variables: variables, operationName: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.getOperationName)(serverQuery) || void 0, context: this.prepareContext((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({}, context), { forceFetch: !deduplication })), }; context = operation.context; if (deduplication) { var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map(); inFlightLinkObservables_1.set(serverQuery, byVariables_1); var varJson_1 = JSON.stringify(variables); observable = byVariables_1.get(varJson_1); if (!observable) { var concast = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.Concast([ (0,_link_core_index_js__WEBPACK_IMPORTED_MODULE_2__.execute)(link, operation) ]); byVariables_1.set(varJson_1, observable = concast); concast.cleanup(function () { if (byVariables_1.delete(varJson_1) && byVariables_1.size < 1) { inFlightLinkObservables_1.delete(serverQuery); } }); } } else { observable = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.Concast([ (0,_link_core_index_js__WEBPACK_IMPORTED_MODULE_2__.execute)(link, operation) ]); } } else { observable = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.Concast([ _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.Observable.of({ data: {} }) ]); context = this.prepareContext(context); } var clientQuery = this.transform(query).clientQuery; if (clientQuery) { observable = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.asyncMap)(observable, function (result) { return _this.localState.runResolvers({ document: clientQuery, remoteResult: result, context: context, variables: variables, }); }); } return observable; }; QueryManager.prototype.getResultsFromLink = function (queryInfo, allowCacheWrite, options) { var lastRequestId = queryInfo.lastRequestId; return (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.asyncMap)(this.getObservableFromLink(queryInfo.document, options.context, options.variables), function (result) { var hasErrors = (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.isNonEmptyArray)(result.errors); if (lastRequestId >= queryInfo.lastRequestId) { if (hasErrors && options.errorPolicy === "none") { throw queryInfo.markError(new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError({ graphQLErrors: result.errors, })); } queryInfo.markResult(result, options, allowCacheWrite); queryInfo.markReady(); } var aqr = { data: result.data, loading: false, networkStatus: queryInfo.networkStatus || _networkStatus_js__WEBPACK_IMPORTED_MODULE_7__.NetworkStatus.ready, }; if (hasErrors && options.errorPolicy !== "ignore") { aqr.errors = result.errors; } return aqr; }, function (networkError) { var error = (0,_errors_index_js__WEBPACK_IMPORTED_MODULE_4__.isApolloError)(networkError) ? networkError : new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError({ networkError: networkError }); if (lastRequestId >= queryInfo.lastRequestId) { queryInfo.markError(error); } throw error; }); }; QueryManager.prototype.fetchQueryObservable = function (queryId, options, networkStatus) { var _this = this; if (networkStatus === void 0) { networkStatus = _networkStatus_js__WEBPACK_IMPORTED_MODULE_7__.NetworkStatus.loading; } var query = this.transform(options.query).document; var variables = this.getVariables(query, options.variables); var queryInfo = this.getQuery(queryId); var oldNetworkStatus = queryInfo.networkStatus; var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e; var mightUseNetwork = fetchPolicy === "cache-first" || fetchPolicy === "cache-and-network" || fetchPolicy === "network-only" || fetchPolicy === "no-cache"; if (mightUseNetwork && notifyOnNetworkStatusChange && typeof oldNetworkStatus === "number" && oldNetworkStatus !== networkStatus && (0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_7__.isNetworkRequestInFlight)(networkStatus)) { if (fetchPolicy !== "cache-first") { fetchPolicy = "cache-and-network"; } returnPartialData = true; } var normalized = Object.assign({}, options, { query: query, variables: variables, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, returnPartialData: returnPartialData, notifyOnNetworkStatusChange: notifyOnNetworkStatusChange, context: context, }); var fromVariables = function (variables) { normalized.variables = variables; return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus); }; this.fetchCancelFns.set(queryId, function (reason) { Promise.resolve().then(function () { return concast.cancel(reason); }); }); var concast = new _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.Concast(this.transform(normalized.query).hasClientExports ? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables) : fromVariables(normalized.variables)); concast.cleanup(function () { _this.fetchCancelFns.delete(queryId); var nextFetchPolicy = options.nextFetchPolicy; if (nextFetchPolicy) { options.nextFetchPolicy = void 0; options.fetchPolicy = typeof nextFetchPolicy === "function" ? nextFetchPolicy.call(options, options.fetchPolicy || "cache-first") : nextFetchPolicy; } }); return concast; }; QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, options, networkStatus) { var _this = this; var query = options.query, variables = options.variables, fetchPolicy = options.fetchPolicy, errorPolicy = options.errorPolicy, returnPartialData = options.returnPartialData, context = options.context; queryInfo.init({ document: query, variables: variables, lastRequestId: this.generateRequestId(), networkStatus: networkStatus, }); var readCache = function () { return queryInfo.getDiff(variables); }; var resultsFromCache = function (diff, networkStatus) { if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || _networkStatus_js__WEBPACK_IMPORTED_MODULE_7__.NetworkStatus.loading; } var data = diff.result; if ( true && (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.isNonEmptyArray)(diff.missing) && !(0,_wry_equality__WEBPACK_IMPORTED_MODULE_1__.equal)(data, {}) && !returnPartialData) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Missing cache result fields: " + diff.missing.map(function (m) { return m.path.join('.'); }).join(', '), diff.missing); } var fromData = function (data) { return _utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.Observable.of((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({ data: data, loading: (0,_networkStatus_js__WEBPACK_IMPORTED_MODULE_7__.isNetworkRequestInFlight)(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); }; if (_this.transform(query).hasForcedResolvers) { return _this.localState.runResolvers({ document: query, remoteResult: { data: data }, context: context, variables: variables, onlyRunForcedResolvers: true, }).then(function (resolved) { return fromData(resolved.data); }); } return fromData(data); }; var resultsFromLink = function (allowCacheWrite) { return _this.getResultsFromLink(queryInfo, allowCacheWrite, { variables: variables, context: context, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, }); }; switch (fetchPolicy) { default: case "cache-first": { var diff = readCache(); if (diff.complete) { return [ resultsFromCache(diff, queryInfo.markReady()), ]; } if (returnPartialData) { return [ resultsFromCache(diff), resultsFromLink(true), ]; } return [ resultsFromLink(true), ]; } case "cache-and-network": { var diff = readCache(); if (diff.complete || returnPartialData) { return [ resultsFromCache(diff), resultsFromLink(true), ]; } return [ resultsFromLink(true), ]; } case "cache-only": return [ resultsFromCache(readCache(), queryInfo.markReady()), ]; case "network-only": return [resultsFromLink(true)]; case "no-cache": return [resultsFromLink(false)]; case "standby": return []; } }; QueryManager.prototype.getQuery = function (queryId) { if (queryId && !this.queries.has(queryId)) { this.queries.set(queryId, new _QueryInfo_js__WEBPACK_IMPORTED_MODULE_9__.QueryInfo(this.cache)); } return this.queries.get(queryId); }; QueryManager.prototype.prepareContext = function (context) { if (context === void 0) { context = {}; } var newContext = this.localState.prepareContext(context); return (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({}, newContext), { clientAwareness: this.clientAwareness }); }; return QueryManager; }()); function markMutationResult(mutation, cache) { if ((0,_QueryInfo_js__WEBPACK_IMPORTED_MODULE_9__.shouldWriteResult)(mutation.result, mutation.errorPolicy)) { var cacheWrites_1 = [{ result: mutation.result.data, dataId: 'ROOT_MUTATION', query: mutation.document, variables: mutation.variables, }]; var queryUpdatersById_1 = mutation.queryUpdatersById; if (queryUpdatersById_1) { Object.keys(queryUpdatersById_1).forEach(function (id) { var _a = queryUpdatersById_1[id], updater = _a.updater, _b = _a.queryInfo, document = _b.document, variables = _b.variables; var _c = cache.diff({ query: document, variables: variables, returnPartialData: true, optimistic: false, }), currentQueryResult = _c.result, complete = _c.complete; if (complete && currentQueryResult) { var nextQueryResult = updater(currentQueryResult, { mutationResult: mutation.result, queryName: (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_3__.getOperationName)(document) || undefined, queryVariables: variables, }); if (nextQueryResult) { cacheWrites_1.push({ result: nextQueryResult, dataId: 'ROOT_QUERY', query: document, variables: variables, }); } } }); } cache.performTransaction(function (c) { cacheWrites_1.forEach(function (write) { return c.write(write); }); var update = mutation.update; if (update) { update(c, mutation.result); } }, null); } } //# sourceMappingURL=QueryManager.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/Reobserver.js": /*!********************************************************!*\ !*** ./node_modules/@apollo/client/core/Reobserver.js ***! \********************************************************/ /*! namespace exports */ /*! export Reobserver [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Reobserver": () => /* binding */ Reobserver /* harmony export */ }); /* harmony import */ var _networkStatus_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./networkStatus.js */ "./node_modules/@apollo/client/core/networkStatus.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); ; var Reobserver = (function () { function Reobserver(observer, options, fetch, shouldFetch) { this.observer = observer; this.options = options; this.fetch = fetch; this.shouldFetch = shouldFetch; } Reobserver.prototype.reobserve = function (newOptions, newNetworkStatus) { if (newOptions) { this.updateOptions(newOptions); } else { this.updatePolling(); } var concast = this.fetch(this.options, newNetworkStatus); if (this.concast) { this.concast.removeObserver(this.observer, true); } concast.addObserver(this.observer); return (this.concast = concast).promise; }; Reobserver.prototype.updateOptions = function (newOptions) { Object.assign(this.options, (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.compact)(newOptions)); this.updatePolling(); return this; }; Reobserver.prototype.stop = function () { if (this.concast) { this.concast.removeObserver(this.observer); delete this.concast; } if (this.pollingInfo) { clearTimeout(this.pollingInfo.timeout); this.options.pollInterval = 0; this.updatePolling(); } }; Reobserver.prototype.updatePolling = function () { var _this = this; var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval; if (!pollInterval) { if (pollingInfo) { clearTimeout(pollingInfo.timeout); delete this.pollingInfo; } return; } if (pollingInfo && pollingInfo.interval === pollInterval) { return; } false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_2__.invariant)(pollInterval, 'Attempted to start a polling query without a polling interval.'); if (this.shouldFetch === false) { return; } var info = pollingInfo || (this.pollingInfo = {}); info.interval = pollInterval; var maybeFetch = function () { if (_this.pollingInfo) { if (_this.shouldFetch && _this.shouldFetch()) { _this.reobserve({ fetchPolicy: "network-only", nextFetchPolicy: _this.options.fetchPolicy || "cache-first", }, _networkStatus_js__WEBPACK_IMPORTED_MODULE_0__.NetworkStatus.poll).then(poll, poll); } else { poll(); } } ; }; var poll = function () { var info = _this.pollingInfo; if (info) { clearTimeout(info.timeout); info.timeout = setTimeout(maybeFetch, info.interval); } }; poll(); }; return Reobserver; }()); //# sourceMappingURL=Reobserver.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/index.js": /*!***************************************************!*\ !*** ./node_modules/@apollo/client/core/index.js ***! \***************************************************/ /*! namespace exports */ /*! export ApolloCache [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/core/cache.js .ApolloCache */ /*! export ApolloClient [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/core/ApolloClient.js .ApolloClient */ /*! export ApolloError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/errors/index.js .ApolloError */ /*! export ApolloLink [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export Cache [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/core/types/Cache.js .Cache */ /*! export HttpLink [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export InMemoryCache [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/inmemory/inMemoryCache.js .InMemoryCache */ /*! export MissingFieldError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/core/types/common.js .MissingFieldError */ /*! export NetworkStatus [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/core/networkStatus.js .NetworkStatus */ /*! export Observable [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/zen-observable/index.js .default */ /*! export ObservableQuery [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/core/ObservableQuery.js .ObservableQuery */ /*! export checkFetcher [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export concat [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export createHttpLink [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export createSignalIfSupported [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export default [not provided] [no usage info] [missing usage info prevents renaming] */ /*! export defaultDataIdFromObject [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/inmemory/policies.js .defaultDataIdFromObject */ /*! export disableExperimentalFragmentVariables [provided] [no usage info] [missing usage info prevents renaming] */ /*! export disableFragmentWarnings [provided] [no usage info] [missing usage info prevents renaming] */ /*! export empty [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export enableExperimentalFragmentVariables [provided] [no usage info] [missing usage info prevents renaming] */ /*! export execute [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export fallbackHttpConfig [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export from [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export fromError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/fromError.js .fromError */ /*! export fromPromise [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/fromPromise.js .fromPromise */ /*! export gql [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/graphql-tag/src/index.js .default */ /*! export isApolloError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/errors/index.js .isApolloError */ /*! export isReference [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .isReference */ /*! export makeReference [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .makeReference */ /*! export makeVar [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/cache/inmemory/reactiveVars.js .makeVar */ /*! export parseAndCheckHttpResponse [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export resetCaches [provided] [no usage info] [missing usage info prevents renaming] */ /*! export rewriteURIForGET [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export selectHttpOptionsAndBody [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export selectURI [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export serializeFetchParameter [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export split [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export throwServerError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/throwServerError.js .throwServerError */ /*! export toPromise [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/toPromise.js .toPromise */ /*! other exports [maybe provided (runtime-defined)] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.n, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ApolloClient": () => /* reexport safe */ _ApolloClient_js__WEBPACK_IMPORTED_MODULE_0__.ApolloClient, /* harmony export */ "ObservableQuery": () => /* reexport safe */ _ObservableQuery_js__WEBPACK_IMPORTED_MODULE_1__.ObservableQuery, /* harmony export */ "NetworkStatus": () => /* reexport safe */ _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__.NetworkStatus, /* harmony export */ "isApolloError": () => /* reexport safe */ _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.isApolloError, /* harmony export */ "ApolloError": () => /* reexport safe */ _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.ApolloError, /* harmony export */ "Cache": () => /* reexport safe */ _cache_index_js__WEBPACK_IMPORTED_MODULE_5__.Cache, /* harmony export */ "ApolloCache": () => /* reexport safe */ _cache_index_js__WEBPACK_IMPORTED_MODULE_5__.ApolloCache, /* harmony export */ "InMemoryCache": () => /* reexport safe */ _cache_index_js__WEBPACK_IMPORTED_MODULE_5__.InMemoryCache, /* harmony export */ "MissingFieldError": () => /* reexport safe */ _cache_index_js__WEBPACK_IMPORTED_MODULE_5__.MissingFieldError, /* harmony export */ "defaultDataIdFromObject": () => /* reexport safe */ _cache_index_js__WEBPACK_IMPORTED_MODULE_5__.defaultDataIdFromObject, /* harmony export */ "makeVar": () => /* reexport safe */ _cache_index_js__WEBPACK_IMPORTED_MODULE_5__.makeVar, /* harmony export */ "HttpLink": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.HttpLink, /* harmony export */ "checkFetcher": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.checkFetcher, /* harmony export */ "createHttpLink": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.createHttpLink, /* harmony export */ "createSignalIfSupported": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.createSignalIfSupported, /* harmony export */ "fallbackHttpConfig": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.fallbackHttpConfig, /* harmony export */ "parseAndCheckHttpResponse": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.parseAndCheckHttpResponse, /* harmony export */ "rewriteURIForGET": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.rewriteURIForGET, /* harmony export */ "selectHttpOptionsAndBody": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.selectHttpOptionsAndBody, /* harmony export */ "selectURI": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.selectURI, /* harmony export */ "serializeFetchParameter": () => /* reexport safe */ _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__.serializeFetchParameter, /* harmony export */ "fromError": () => /* reexport safe */ _link_utils_index_js__WEBPACK_IMPORTED_MODULE_9__.fromError, /* harmony export */ "toPromise": () => /* reexport safe */ _link_utils_index_js__WEBPACK_IMPORTED_MODULE_9__.toPromise, /* harmony export */ "fromPromise": () => /* reexport safe */ _link_utils_index_js__WEBPACK_IMPORTED_MODULE_9__.fromPromise, /* harmony export */ "throwServerError": () => /* reexport safe */ _link_utils_index_js__WEBPACK_IMPORTED_MODULE_9__.throwServerError, /* harmony export */ "Observable": () => /* reexport safe */ _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.Observable, /* harmony export */ "isReference": () => /* reexport safe */ _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.isReference, /* harmony export */ "makeReference": () => /* reexport safe */ _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__.makeReference, /* harmony export */ "resetCaches": () => /* binding */ resetCaches, /* harmony export */ "disableFragmentWarnings": () => /* binding */ disableFragmentWarnings, /* harmony export */ "enableExperimentalFragmentVariables": () => /* binding */ enableExperimentalFragmentVariables, /* harmony export */ "disableExperimentalFragmentVariables": () => /* binding */ disableExperimentalFragmentVariables, /* harmony export */ "gql": () => /* reexport default from dynamic */ graphql_tag__WEBPACK_IMPORTED_MODULE_11___default.a /* harmony export */ }); /* harmony import */ var _ApolloClient_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ApolloClient.js */ "./node_modules/@apollo/client/core/ApolloClient.js"); /* harmony import */ var _ObservableQuery_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ObservableQuery.js */ "./node_modules/@apollo/client/core/ObservableQuery.js"); /* harmony import */ var _networkStatus_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./networkStatus.js */ "./node_modules/@apollo/client/core/networkStatus.js"); /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types.js */ "./node_modules/@apollo/client/core/types.js"); /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_types_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _types_js__WEBPACK_IMPORTED_MODULE_3__) if(["default","ApolloClient","ObservableQuery","NetworkStatus","isApolloError","ApolloError","Cache","ApolloCache","InMemoryCache","MissingFieldError","defaultDataIdFromObject","makeVar","fromError","toPromise","fromPromise","throwServerError","Observable","isReference","makeReference","resetCaches","disableFragmentWarnings","enableExperimentalFragmentVariables","disableExperimentalFragmentVariables","gql"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _types_js__WEBPACK_IMPORTED_MODULE_3__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); /* harmony import */ var _errors_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../errors/index.js */ "./node_modules/@apollo/client/errors/index.js"); /* harmony import */ var _cache_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../cache/index.js */ "./node_modules/@apollo/client/cache/index.js"); /* harmony import */ var _cache_inmemory_types_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../cache/inmemory/types.js */ "./node_modules/@apollo/client/cache/inmemory/types.js"); /* harmony import */ var _cache_inmemory_types_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_cache_inmemory_types_js__WEBPACK_IMPORTED_MODULE_6__); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _cache_inmemory_types_js__WEBPACK_IMPORTED_MODULE_6__) if(["default","ApolloClient","ObservableQuery","NetworkStatus","isApolloError","ApolloError","Cache","ApolloCache","InMemoryCache","MissingFieldError","defaultDataIdFromObject","makeVar","fromError","toPromise","fromPromise","throwServerError","Observable","isReference","makeReference","resetCaches","disableFragmentWarnings","enableExperimentalFragmentVariables","disableExperimentalFragmentVariables","gql"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _cache_inmemory_types_js__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); /* harmony import */ var _link_core_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../link/core/index.js */ "./node_modules/@apollo/client/link/core/index.js"); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _link_core_index_js__WEBPACK_IMPORTED_MODULE_7__) if(["default","ApolloClient","ObservableQuery","NetworkStatus","isApolloError","ApolloError","Cache","ApolloCache","InMemoryCache","MissingFieldError","defaultDataIdFromObject","makeVar","fromError","toPromise","fromPromise","throwServerError","Observable","isReference","makeReference","resetCaches","disableFragmentWarnings","enableExperimentalFragmentVariables","disableExperimentalFragmentVariables","gql"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _link_core_index_js__WEBPACK_IMPORTED_MODULE_7__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); /* harmony import */ var _link_http_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../link/http/index.js */ "./node_modules/@apollo/client/link/http/index.js"); /* harmony import */ var _link_utils_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../link/utils/index.js */ "./node_modules/@apollo/client/link/utils/index.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! graphql-tag */ "./node_modules/graphql-tag/src/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(graphql_tag__WEBPACK_IMPORTED_MODULE_11__); var resetCaches = (graphql_tag__WEBPACK_IMPORTED_MODULE_11___default().resetCaches), disableFragmentWarnings = (graphql_tag__WEBPACK_IMPORTED_MODULE_11___default().disableFragmentWarnings), enableExperimentalFragmentVariables = (graphql_tag__WEBPACK_IMPORTED_MODULE_11___default().enableExperimentalFragmentVariables), disableExperimentalFragmentVariables = (graphql_tag__WEBPACK_IMPORTED_MODULE_11___default().disableExperimentalFragmentVariables); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/networkStatus.js": /*!***********************************************************!*\ !*** ./node_modules/@apollo/client/core/networkStatus.js ***! \***********************************************************/ /*! namespace exports */ /*! export NetworkStatus [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isNetworkRequestInFlight [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "NetworkStatus": () => /* binding */ NetworkStatus, /* harmony export */ "isNetworkRequestInFlight": () => /* binding */ isNetworkRequestInFlight /* harmony export */ }); var NetworkStatus; (function (NetworkStatus) { NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; NetworkStatus[NetworkStatus["error"] = 8] = "error"; })(NetworkStatus || (NetworkStatus = {})); function isNetworkRequestInFlight(networkStatus) { return networkStatus ? networkStatus < 7 : false; } //# sourceMappingURL=networkStatus.js.map /***/ }), /***/ "./node_modules/@apollo/client/core/types.js": /*!***************************************************!*\ !*** ./node_modules/@apollo/client/core/types.js ***! \***************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: */ /***/ (() => { //# sourceMappingURL=types.js.map /***/ }), /***/ "./node_modules/@apollo/client/errors/index.js": /*!*****************************************************!*\ !*** ./node_modules/@apollo/client/errors/index.js ***! \*****************************************************/ /*! namespace exports */ /*! export ApolloError [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isApolloError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "isApolloError": () => /* binding */ isApolloError, /* harmony export */ "ApolloError": () => /* binding */ ApolloError /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); ; function isApolloError(err) { return err.hasOwnProperty('graphQLErrors'); } var generateErrorMessage = function (err) { var message = ''; if ((0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.isNonEmptyArray)(err.graphQLErrors)) { err.graphQLErrors.forEach(function (graphQLError) { var errorMessage = graphQLError ? graphQLError.message : 'Error message not found.'; message += errorMessage + "\n"; }); } if (err.networkError) { message += err.networkError.message + "\n"; } message = message.replace(/\n$/, ''); return message; }; var ApolloError = (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__extends)(ApolloError, _super); function ApolloError(_a) { var graphQLErrors = _a.graphQLErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; var _this = _super.call(this, errorMessage) || this; _this.graphQLErrors = graphQLErrors || []; _this.networkError = networkError || null; _this.message = errorMessage || generateErrorMessage(_this); _this.extraInfo = extraInfo; _this.__proto__ = ApolloError.prototype; return _this; } return ApolloError; }(Error)); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/core/ApolloLink.js": /*!*************************************************************!*\ !*** ./node_modules/@apollo/client/link/core/ApolloLink.js ***! \*************************************************************/ /*! namespace exports */ /*! export ApolloLink [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ApolloLink": () => /* binding */ ApolloLink /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/index.js */ "./node_modules/@apollo/client/link/utils/index.js"); ; function passthrough(op, forward) { return (forward ? forward(op) : _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of()); } function toLink(handler) { return typeof handler === 'function' ? new ApolloLink(handler) : handler; } function isTerminating(link) { return link.request.length <= 1; } var LinkError = (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__extends)(LinkError, _super); function LinkError(message, link) { var _this = _super.call(this, message) || this; _this.link = link; return _this; } return LinkError; }(Error)); var ApolloLink = (function () { function ApolloLink(request) { if (request) this.request = request; } ApolloLink.empty = function () { return new ApolloLink(function () { return _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); }); }; ApolloLink.from = function (links) { if (links.length === 0) return ApolloLink.empty(); return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); }; ApolloLink.split = function (test, left, right) { var leftLink = toLink(left); var rightLink = toLink(right || new ApolloLink(passthrough)); if (isTerminating(leftLink) && isTerminating(rightLink)) { return new ApolloLink(function (operation) { return test(operation) ? leftLink.request(operation) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of() : rightLink.request(operation) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); }); } else { return new ApolloLink(function (operation, forward) { return test(operation) ? leftLink.request(operation, forward) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of() : rightLink.request(operation, forward) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); }); } }; ApolloLink.execute = function (link, operation) { return (link.request((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__.createOperation)(operation.context, (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__.transformOperation)((0,_utils_index_js__WEBPACK_IMPORTED_MODULE_2__.validateOperation)(operation)))) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of()); }; ApolloLink.concat = function (first, second) { var firstLink = toLink(first); if (isTerminating(firstLink)) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink)); return firstLink; } var nextLink = toLink(second); if (isTerminating(nextLink)) { return new ApolloLink(function (operation) { return firstLink.request(operation, function (op) { return nextLink.request(op) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); }) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); }); } else { return new ApolloLink(function (operation, forward) { return (firstLink.request(operation, function (op) { return nextLink.request(op, forward) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of(); }) || _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable.of()); }); } }; ApolloLink.prototype.split = function (test, left, right) { return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough))); }; ApolloLink.prototype.concat = function (next) { return ApolloLink.concat(this, next); }; ApolloLink.prototype.request = function (operation, forward) { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError('request is not implemented'); }; ApolloLink.prototype.onError = function (reason) { throw reason; }; ApolloLink.prototype.setOnError = function (fn) { this.onError = fn; return this; }; return ApolloLink; }()); //# sourceMappingURL=ApolloLink.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/core/concat.js": /*!*********************************************************!*\ !*** ./node_modules/@apollo/client/link/core/concat.js ***! \*********************************************************/ /*! namespace exports */ /*! export concat [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "concat": () => /* binding */ concat /* harmony export */ }); /* harmony import */ var _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ApolloLink.js */ "./node_modules/@apollo/client/link/core/ApolloLink.js"); ; var concat = _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__.ApolloLink.concat; //# sourceMappingURL=concat.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/core/empty.js": /*!********************************************************!*\ !*** ./node_modules/@apollo/client/link/core/empty.js ***! \********************************************************/ /*! namespace exports */ /*! export empty [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "empty": () => /* binding */ empty /* harmony export */ }); /* harmony import */ var _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ApolloLink.js */ "./node_modules/@apollo/client/link/core/ApolloLink.js"); ; var empty = _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__.ApolloLink.empty; //# sourceMappingURL=empty.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/core/execute.js": /*!**********************************************************!*\ !*** ./node_modules/@apollo/client/link/core/execute.js ***! \**********************************************************/ /*! namespace exports */ /*! export execute [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "execute": () => /* binding */ execute /* harmony export */ }); /* harmony import */ var _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ApolloLink.js */ "./node_modules/@apollo/client/link/core/ApolloLink.js"); ; var execute = _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__.ApolloLink.execute; //# sourceMappingURL=execute.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/core/from.js": /*!*******************************************************!*\ !*** ./node_modules/@apollo/client/link/core/from.js ***! \*******************************************************/ /*! namespace exports */ /*! export from [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "from": () => /* binding */ from /* harmony export */ }); /* harmony import */ var _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ApolloLink.js */ "./node_modules/@apollo/client/link/core/ApolloLink.js"); ; var from = _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__.ApolloLink.from; //# sourceMappingURL=from.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/core/index.js": /*!********************************************************!*\ !*** ./node_modules/@apollo/client/link/core/index.js ***! \********************************************************/ /*! namespace exports */ /*! export ApolloLink [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/core/ApolloLink.js .ApolloLink */ /*! export concat [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/core/concat.js .concat */ /*! export default [not provided] [no usage info] [missing usage info prevents renaming] */ /*! export empty [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/core/empty.js .empty */ /*! export execute [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/core/execute.js .execute */ /*! export from [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/core/from.js .from */ /*! export split [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/core/split.js .split */ /*! other exports [maybe provided (runtime-defined)] [no usage info] -> ./node_modules/@apollo/client/link/core/types.js */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.n, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "empty": () => /* reexport safe */ _empty_js__WEBPACK_IMPORTED_MODULE_0__.empty, /* harmony export */ "from": () => /* reexport safe */ _from_js__WEBPACK_IMPORTED_MODULE_1__.from, /* harmony export */ "split": () => /* reexport safe */ _split_js__WEBPACK_IMPORTED_MODULE_2__.split, /* harmony export */ "concat": () => /* reexport safe */ _concat_js__WEBPACK_IMPORTED_MODULE_3__.concat, /* harmony export */ "execute": () => /* reexport safe */ _execute_js__WEBPACK_IMPORTED_MODULE_4__.execute, /* harmony export */ "ApolloLink": () => /* reexport safe */ _ApolloLink_js__WEBPACK_IMPORTED_MODULE_5__.ApolloLink /* harmony export */ }); /* harmony import */ var _empty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./empty.js */ "./node_modules/@apollo/client/link/core/empty.js"); /* harmony import */ var _from_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./from.js */ "./node_modules/@apollo/client/link/core/from.js"); /* harmony import */ var _split_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./split.js */ "./node_modules/@apollo/client/link/core/split.js"); /* harmony import */ var _concat_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./concat.js */ "./node_modules/@apollo/client/link/core/concat.js"); /* harmony import */ var _execute_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./execute.js */ "./node_modules/@apollo/client/link/core/execute.js"); /* harmony import */ var _ApolloLink_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ApolloLink.js */ "./node_modules/@apollo/client/link/core/ApolloLink.js"); /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./types.js */ "./node_modules/@apollo/client/link/core/types.js"); /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_types_js__WEBPACK_IMPORTED_MODULE_6__); /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _types_js__WEBPACK_IMPORTED_MODULE_6__) if(["default","empty","from","split","concat","execute","ApolloLink"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _types_js__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__] /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/core/split.js": /*!********************************************************!*\ !*** ./node_modules/@apollo/client/link/core/split.js ***! \********************************************************/ /*! namespace exports */ /*! export split [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "split": () => /* binding */ split /* harmony export */ }); /* harmony import */ var _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ApolloLink.js */ "./node_modules/@apollo/client/link/core/ApolloLink.js"); ; var split = _ApolloLink_js__WEBPACK_IMPORTED_MODULE_0__.ApolloLink.split; //# sourceMappingURL=split.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/core/types.js": /*!********************************************************!*\ !*** ./node_modules/@apollo/client/link/core/types.js ***! \********************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: */ /***/ (() => { ; //# sourceMappingURL=types.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/HttpLink.js": /*!***********************************************************!*\ !*** ./node_modules/@apollo/client/link/http/HttpLink.js ***! \***********************************************************/ /*! namespace exports */ /*! export HttpLink [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "HttpLink": () => /* binding */ HttpLink /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _core_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/index.js */ "./node_modules/@apollo/client/link/core/index.js"); /* harmony import */ var _createHttpLink_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createHttpLink.js */ "./node_modules/@apollo/client/link/http/createHttpLink.js"); ; var HttpLink = (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__extends)(HttpLink, _super); function HttpLink(options) { if (options === void 0) { options = {}; } var _this = _super.call(this, (0,_createHttpLink_js__WEBPACK_IMPORTED_MODULE_1__.createHttpLink)(options).request) || this; _this.options = options; return _this; } return HttpLink; }(_core_index_js__WEBPACK_IMPORTED_MODULE_0__.ApolloLink)); //# sourceMappingURL=HttpLink.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/checkFetcher.js": /*!***************************************************************!*\ !*** ./node_modules/@apollo/client/link/http/checkFetcher.js ***! \***************************************************************/ /*! namespace exports */ /*! export checkFetcher [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "checkFetcher": () => /* binding */ checkFetcher /* harmony export */ }); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); ; var checkFetcher = function (fetcher) { if (!fetcher && typeof fetch === 'undefined') { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n "); } }; //# sourceMappingURL=checkFetcher.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/createHttpLink.js": /*!*****************************************************************!*\ !*** ./node_modules/@apollo/client/link/http/createHttpLink.js ***! \*****************************************************************/ /*! namespace exports */ /*! export createHttpLink [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "createHttpLink": () => /* binding */ createHttpLink /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _core_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/index.js */ "./node_modules/@apollo/client/link/core/index.js"); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); /* harmony import */ var _serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./serializeFetchParameter.js */ "./node_modules/@apollo/client/link/http/serializeFetchParameter.js"); /* harmony import */ var _selectURI_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectURI.js */ "./node_modules/@apollo/client/link/http/selectURI.js"); /* harmony import */ var _parseAndCheckHttpResponse_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./parseAndCheckHttpResponse.js */ "./node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js"); /* harmony import */ var _checkFetcher_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./checkFetcher.js */ "./node_modules/@apollo/client/link/http/checkFetcher.js"); /* harmony import */ var _selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./selectHttpOptionsAndBody.js */ "./node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js"); /* harmony import */ var _createSignalIfSupported_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./createSignalIfSupported.js */ "./node_modules/@apollo/client/link/http/createSignalIfSupported.js"); /* harmony import */ var _rewriteURIForGET_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./rewriteURIForGET.js */ "./node_modules/@apollo/client/link/http/rewriteURIForGET.js"); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/index.js */ "./node_modules/@apollo/client/link/utils/index.js"); ; var createHttpLink = function (linkOptions) { if (linkOptions === void 0) { linkOptions = {}; } var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, fetcher = linkOptions.fetch, includeExtensions = linkOptions.includeExtensions, useGETForQueries = linkOptions.useGETForQueries, requestOptions = (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__rest)(linkOptions, ["uri", "fetch", "includeExtensions", "useGETForQueries"]); (0,_checkFetcher_js__WEBPACK_IMPORTED_MODULE_5__.checkFetcher)(fetcher); if (!fetcher) { fetcher = fetch; } var linkConfig = { http: { includeExtensions: includeExtensions }, options: requestOptions.fetchOptions, credentials: requestOptions.credentials, headers: requestOptions.headers, }; return new _core_index_js__WEBPACK_IMPORTED_MODULE_0__.ApolloLink(function (operation) { var chosenURI = (0,_selectURI_js__WEBPACK_IMPORTED_MODULE_3__.selectURI)(operation, uri); var context = operation.getContext(); var clientAwarenessHeaders = {}; if (context.clientAwareness) { var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; if (name_1) { clientAwarenessHeaders['apollographql-client-name'] = name_1; } if (version) { clientAwarenessHeaders['apollographql-client-version'] = version; } } var contextHeaders = (0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_10__.__assign)({}, clientAwarenessHeaders), context.headers); var contextConfig = { http: context.http, options: context.fetchOptions, credentials: context.credentials, headers: contextHeaders, }; var _b = (0,_selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_6__.selectHttpOptionsAndBody)(operation, _selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_6__.fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body; var controller; if (!options.signal) { var _c = (0,_createSignalIfSupported_js__WEBPACK_IMPORTED_MODULE_7__.createSignalIfSupported)(), _controller = _c.controller, signal = _c.signal; controller = _controller; if (controller) options.signal = signal; } var definitionIsMutation = function (d) { return d.kind === 'OperationDefinition' && d.operation === 'mutation'; }; if (useGETForQueries && !operation.query.definitions.some(definitionIsMutation)) { options.method = 'GET'; } if (options.method === 'GET') { var _d = (0,_rewriteURIForGET_js__WEBPACK_IMPORTED_MODULE_8__.rewriteURIForGET)(chosenURI, body), newURI = _d.newURI, parseError = _d.parseError; if (parseError) { return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_9__.fromError)(parseError); } chosenURI = newURI; } else { try { options.body = (0,_serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_2__.serializeFetchParameter)(body, 'Payload'); } catch (parseError) { return (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_9__.fromError)(parseError); } } return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_1__.Observable(function (observer) { fetcher(chosenURI, options) .then(function (response) { operation.setContext({ response: response }); return response; }) .then((0,_parseAndCheckHttpResponse_js__WEBPACK_IMPORTED_MODULE_4__.parseAndCheckHttpResponse)(operation)) .then(function (result) { observer.next(result); observer.complete(); return result; }) .catch(function (err) { if (err.name === 'AbortError') return; if (err.result && err.result.errors && err.result.data) { observer.next(err.result); } observer.error(err); }); return function () { if (controller) controller.abort(); }; }); }); }; //# sourceMappingURL=createHttpLink.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/createSignalIfSupported.js": /*!**************************************************************************!*\ !*** ./node_modules/@apollo/client/link/http/createSignalIfSupported.js ***! \**************************************************************************/ /*! namespace exports */ /*! export createSignalIfSupported [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "createSignalIfSupported": () => /* binding */ createSignalIfSupported /* harmony export */ }); var createSignalIfSupported = function () { if (typeof AbortController === 'undefined') return { controller: false, signal: false }; var controller = new AbortController(); var signal = controller.signal; return { controller: controller, signal: signal }; }; //# sourceMappingURL=createSignalIfSupported.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/index.js": /*!********************************************************!*\ !*** ./node_modules/@apollo/client/link/http/index.js ***! \********************************************************/ /*! namespace exports */ /*! export HttpLink [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/HttpLink.js .HttpLink */ /*! export checkFetcher [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/checkFetcher.js .checkFetcher */ /*! export createHttpLink [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/createHttpLink.js .createHttpLink */ /*! export createSignalIfSupported [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/createSignalIfSupported.js .createSignalIfSupported */ /*! export fallbackHttpConfig [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js .fallbackHttpConfig */ /*! export parseAndCheckHttpResponse [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js .parseAndCheckHttpResponse */ /*! export rewriteURIForGET [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/rewriteURIForGET.js .rewriteURIForGET */ /*! export selectHttpOptionsAndBody [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js .selectHttpOptionsAndBody */ /*! export selectURI [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/selectURI.js .selectURI */ /*! export serializeFetchParameter [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/http/serializeFetchParameter.js .serializeFetchParameter */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "parseAndCheckHttpResponse": () => /* reexport safe */ _parseAndCheckHttpResponse_js__WEBPACK_IMPORTED_MODULE_0__.parseAndCheckHttpResponse, /* harmony export */ "serializeFetchParameter": () => /* reexport safe */ _serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_1__.serializeFetchParameter, /* harmony export */ "fallbackHttpConfig": () => /* reexport safe */ _selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_2__.fallbackHttpConfig, /* harmony export */ "selectHttpOptionsAndBody": () => /* reexport safe */ _selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_2__.selectHttpOptionsAndBody, /* harmony export */ "checkFetcher": () => /* reexport safe */ _checkFetcher_js__WEBPACK_IMPORTED_MODULE_3__.checkFetcher, /* harmony export */ "createSignalIfSupported": () => /* reexport safe */ _createSignalIfSupported_js__WEBPACK_IMPORTED_MODULE_4__.createSignalIfSupported, /* harmony export */ "selectURI": () => /* reexport safe */ _selectURI_js__WEBPACK_IMPORTED_MODULE_5__.selectURI, /* harmony export */ "createHttpLink": () => /* reexport safe */ _createHttpLink_js__WEBPACK_IMPORTED_MODULE_6__.createHttpLink, /* harmony export */ "HttpLink": () => /* reexport safe */ _HttpLink_js__WEBPACK_IMPORTED_MODULE_7__.HttpLink, /* harmony export */ "rewriteURIForGET": () => /* reexport safe */ _rewriteURIForGET_js__WEBPACK_IMPORTED_MODULE_8__.rewriteURIForGET /* harmony export */ }); /* harmony import */ var _parseAndCheckHttpResponse_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parseAndCheckHttpResponse.js */ "./node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js"); /* harmony import */ var _serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./serializeFetchParameter.js */ "./node_modules/@apollo/client/link/http/serializeFetchParameter.js"); /* harmony import */ var _selectHttpOptionsAndBody_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectHttpOptionsAndBody.js */ "./node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js"); /* harmony import */ var _checkFetcher_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./checkFetcher.js */ "./node_modules/@apollo/client/link/http/checkFetcher.js"); /* harmony import */ var _createSignalIfSupported_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./createSignalIfSupported.js */ "./node_modules/@apollo/client/link/http/createSignalIfSupported.js"); /* harmony import */ var _selectURI_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./selectURI.js */ "./node_modules/@apollo/client/link/http/selectURI.js"); /* harmony import */ var _createHttpLink_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./createHttpLink.js */ "./node_modules/@apollo/client/link/http/createHttpLink.js"); /* harmony import */ var _HttpLink_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./HttpLink.js */ "./node_modules/@apollo/client/link/http/HttpLink.js"); /* harmony import */ var _rewriteURIForGET_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./rewriteURIForGET.js */ "./node_modules/@apollo/client/link/http/rewriteURIForGET.js"); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js": /*!****************************************************************************!*\ !*** ./node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js ***! \****************************************************************************/ /*! namespace exports */ /*! export parseAndCheckHttpResponse [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "parseAndCheckHttpResponse": () => /* binding */ parseAndCheckHttpResponse /* harmony export */ }); /* harmony import */ var _utils_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/index.js */ "./node_modules/@apollo/client/link/utils/index.js"); ; var hasOwnProperty = Object.prototype.hasOwnProperty; function parseAndCheckHttpResponse(operations) { return function (response) { return response .text() .then(function (bodyText) { try { return JSON.parse(bodyText); } catch (err) { var parseError = err; parseError.name = 'ServerParseError'; parseError.response = response; parseError.statusCode = response.status; parseError.bodyText = bodyText; throw parseError; } }) .then(function (result) { if (response.status >= 300) { (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__.throwServerError)(response, result, "Response not successful: Received status code " + response.status); } if (!Array.isArray(result) && !hasOwnProperty.call(result, 'data') && !hasOwnProperty.call(result, 'errors')) { (0,_utils_index_js__WEBPACK_IMPORTED_MODULE_0__.throwServerError)(response, result, "Server response was missing for query '" + (Array.isArray(operations) ? operations.map(function (op) { return op.operationName; }) : operations.operationName) + "'."); } return result; }); }; } //# sourceMappingURL=parseAndCheckHttpResponse.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/rewriteURIForGET.js": /*!*******************************************************************!*\ !*** ./node_modules/@apollo/client/link/http/rewriteURIForGET.js ***! \*******************************************************************/ /*! namespace exports */ /*! export rewriteURIForGET [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "rewriteURIForGET": () => /* binding */ rewriteURIForGET /* harmony export */ }); /* harmony import */ var _serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./serializeFetchParameter.js */ "./node_modules/@apollo/client/link/http/serializeFetchParameter.js"); ; function rewriteURIForGET(chosenURI, body) { var queryParams = []; var addQueryParam = function (key, value) { queryParams.push(key + "=" + encodeURIComponent(value)); }; if ('query' in body) { addQueryParam('query', body.query); } if (body.operationName) { addQueryParam('operationName', body.operationName); } if (body.variables) { var serializedVariables = void 0; try { serializedVariables = (0,_serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_0__.serializeFetchParameter)(body.variables, 'Variables map'); } catch (parseError) { return { parseError: parseError }; } addQueryParam('variables', serializedVariables); } if (body.extensions) { var serializedExtensions = void 0; try { serializedExtensions = (0,_serializeFetchParameter_js__WEBPACK_IMPORTED_MODULE_0__.serializeFetchParameter)(body.extensions, 'Extensions map'); } catch (parseError) { return { parseError: parseError }; } addQueryParam('extensions', serializedExtensions); } var fragment = '', preFragment = chosenURI; var fragmentStart = chosenURI.indexOf('#'); if (fragmentStart !== -1) { fragment = chosenURI.substr(fragmentStart); preFragment = chosenURI.substr(0, fragmentStart); } var queryParamsPrefix = preFragment.indexOf('?') === -1 ? '?' : '&'; var newURI = preFragment + queryParamsPrefix + queryParams.join('&') + fragment; return { newURI: newURI }; } //# sourceMappingURL=rewriteURIForGET.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js": /*!***************************************************************************!*\ !*** ./node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js ***! \***************************************************************************/ /*! namespace exports */ /*! export fallbackHttpConfig [provided] [no usage info] [missing usage info prevents renaming] */ /*! export selectHttpOptionsAndBody [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "fallbackHttpConfig": () => /* binding */ fallbackHttpConfig, /* harmony export */ "selectHttpOptionsAndBody": () => /* binding */ selectHttpOptionsAndBody /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphql */ "./node_modules/graphql/language/printer.mjs"); ; var defaultHttpOptions = { includeQuery: true, includeExtensions: false, }; var defaultHeaders = { accept: '*/*', 'content-type': 'application/json', }; var defaultOptions = { method: 'POST', }; var fallbackHttpConfig = { http: defaultHttpOptions, headers: defaultHeaders, options: defaultOptions, }; var selectHttpOptionsAndBody = function (operation, fallbackConfig) { var configs = []; for (var _i = 2; _i < arguments.length; _i++) { configs[_i - 2] = arguments[_i]; } var options = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, fallbackConfig.options), { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials }); var http = fallbackConfig.http || {}; configs.forEach(function (config) { options = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, options), config.options), { headers: (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, options.headers), config.headers) }); if (config.credentials) options.credentials = config.credentials; http = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, http), config.http); }); var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query; var body = { operationName: operationName, variables: variables }; if (http.includeExtensions) body.extensions = extensions; if (http.includeQuery) body.query = (0,graphql__WEBPACK_IMPORTED_MODULE_1__.print)(query); return { options: options, body: body, }; }; //# sourceMappingURL=selectHttpOptionsAndBody.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/selectURI.js": /*!************************************************************!*\ !*** ./node_modules/@apollo/client/link/http/selectURI.js ***! \************************************************************/ /*! namespace exports */ /*! export selectURI [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "selectURI": () => /* binding */ selectURI /* harmony export */ }); var selectURI = function (operation, fallbackURI) { var context = operation.getContext(); var contextURI = context.uri; if (contextURI) { return contextURI; } else if (typeof fallbackURI === 'function') { return fallbackURI(operation); } else { return fallbackURI || '/graphql'; } }; //# sourceMappingURL=selectURI.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/http/serializeFetchParameter.js": /*!**************************************************************************!*\ !*** ./node_modules/@apollo/client/link/http/serializeFetchParameter.js ***! \**************************************************************************/ /*! namespace exports */ /*! export serializeFetchParameter [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "serializeFetchParameter": () => /* binding */ serializeFetchParameter /* harmony export */ }); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); ; var serializeFetchParameter = function (p, label) { var serialized; try { serialized = JSON.stringify(p); } catch (e) { var parseError = false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Network request failed. " + label + " is not serializable: " + e.message); parseError.parseError = e; throw parseError; } return serialized; }; //# sourceMappingURL=serializeFetchParameter.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/utils/createOperation.js": /*!*******************************************************************!*\ !*** ./node_modules/@apollo/client/link/utils/createOperation.js ***! \*******************************************************************/ /*! namespace exports */ /*! export createOperation [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "createOperation": () => /* binding */ createOperation /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); ; function createOperation(starting, operation) { var context = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, starting); var setContext = function (next) { if (typeof next === 'function') { context = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, context), next(context)); } else { context = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, context), next); } }; var getContext = function () { return ((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, context)); }; Object.defineProperty(operation, 'setContext', { enumerable: false, value: setContext, }); Object.defineProperty(operation, 'getContext', { enumerable: false, value: getContext, }); return operation; } //# sourceMappingURL=createOperation.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/utils/fromError.js": /*!*************************************************************!*\ !*** ./node_modules/@apollo/client/link/utils/fromError.js ***! \*************************************************************/ /*! namespace exports */ /*! export fromError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "fromError": () => /* binding */ fromError /* harmony export */ }); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); ; function fromError(errorValue) { return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.Observable(function (observer) { observer.error(errorValue); }); } //# sourceMappingURL=fromError.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/utils/fromPromise.js": /*!***************************************************************!*\ !*** ./node_modules/@apollo/client/link/utils/fromPromise.js ***! \***************************************************************/ /*! namespace exports */ /*! export fromPromise [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "fromPromise": () => /* binding */ fromPromise /* harmony export */ }); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); ; function fromPromise(promise) { return new _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.Observable(function (observer) { promise .then(function (value) { observer.next(value); observer.complete(); }) .catch(observer.error.bind(observer)); }); } //# sourceMappingURL=fromPromise.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/utils/index.js": /*!*********************************************************!*\ !*** ./node_modules/@apollo/client/link/utils/index.js ***! \*********************************************************/ /*! namespace exports */ /*! export createOperation [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/createOperation.js .createOperation */ /*! export fromError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/fromError.js .fromError */ /*! export fromPromise [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/fromPromise.js .fromPromise */ /*! export throwServerError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/throwServerError.js .throwServerError */ /*! export toPromise [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/toPromise.js .toPromise */ /*! export transformOperation [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/transformOperation.js .transformOperation */ /*! export validateOperation [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/link/utils/validateOperation.js .validateOperation */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "fromError": () => /* reexport safe */ _fromError_js__WEBPACK_IMPORTED_MODULE_0__.fromError, /* harmony export */ "toPromise": () => /* reexport safe */ _toPromise_js__WEBPACK_IMPORTED_MODULE_1__.toPromise, /* harmony export */ "fromPromise": () => /* reexport safe */ _fromPromise_js__WEBPACK_IMPORTED_MODULE_2__.fromPromise, /* harmony export */ "throwServerError": () => /* reexport safe */ _throwServerError_js__WEBPACK_IMPORTED_MODULE_3__.throwServerError, /* harmony export */ "validateOperation": () => /* reexport safe */ _validateOperation_js__WEBPACK_IMPORTED_MODULE_4__.validateOperation, /* harmony export */ "createOperation": () => /* reexport safe */ _createOperation_js__WEBPACK_IMPORTED_MODULE_5__.createOperation, /* harmony export */ "transformOperation": () => /* reexport safe */ _transformOperation_js__WEBPACK_IMPORTED_MODULE_6__.transformOperation /* harmony export */ }); /* harmony import */ var _fromError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fromError.js */ "./node_modules/@apollo/client/link/utils/fromError.js"); /* harmony import */ var _toPromise_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPromise.js */ "./node_modules/@apollo/client/link/utils/toPromise.js"); /* harmony import */ var _fromPromise_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fromPromise.js */ "./node_modules/@apollo/client/link/utils/fromPromise.js"); /* harmony import */ var _throwServerError_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./throwServerError.js */ "./node_modules/@apollo/client/link/utils/throwServerError.js"); /* harmony import */ var _validateOperation_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validateOperation.js */ "./node_modules/@apollo/client/link/utils/validateOperation.js"); /* harmony import */ var _createOperation_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./createOperation.js */ "./node_modules/@apollo/client/link/utils/createOperation.js"); /* harmony import */ var _transformOperation_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transformOperation.js */ "./node_modules/@apollo/client/link/utils/transformOperation.js"); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/utils/throwServerError.js": /*!********************************************************************!*\ !*** ./node_modules/@apollo/client/link/utils/throwServerError.js ***! \********************************************************************/ /*! namespace exports */ /*! export throwServerError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "throwServerError": () => /* binding */ throwServerError /* harmony export */ }); var throwServerError = function (response, result, message) { var error = new Error(message); error.name = 'ServerError'; error.response = response; error.statusCode = response.status; error.result = result; throw error; }; //# sourceMappingURL=throwServerError.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/utils/toPromise.js": /*!*************************************************************!*\ !*** ./node_modules/@apollo/client/link/utils/toPromise.js ***! \*************************************************************/ /*! namespace exports */ /*! export toPromise [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "toPromise": () => /* binding */ toPromise /* harmony export */ }); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); ; function toPromise(observable) { var completed = false; return new Promise(function (resolve, reject) { observable.subscribe({ next: function (data) { if (completed) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.warn("Promise Wrapper does not support multiple results from Observable"); } else { completed = true; resolve(data); } }, error: reject, }); }); } //# sourceMappingURL=toPromise.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/utils/transformOperation.js": /*!**********************************************************************!*\ !*** ./node_modules/@apollo/client/link/utils/transformOperation.js ***! \**********************************************************************/ /*! namespace exports */ /*! export transformOperation [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "transformOperation": () => /* binding */ transformOperation /* harmony export */ }); /* harmony import */ var _utilities_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utilities/index.js */ "./node_modules/@apollo/client/utilities/index.js"); ; function transformOperation(operation) { var transformedOperation = { variables: operation.variables || {}, extensions: operation.extensions || {}, operationName: operation.operationName, query: operation.query, }; if (!transformedOperation.operationName) { transformedOperation.operationName = typeof transformedOperation.query !== 'string' ? (0,_utilities_index_js__WEBPACK_IMPORTED_MODULE_0__.getOperationName)(transformedOperation.query) || undefined : ''; } return transformedOperation; } //# sourceMappingURL=transformOperation.js.map /***/ }), /***/ "./node_modules/@apollo/client/link/utils/validateOperation.js": /*!*********************************************************************!*\ !*** ./node_modules/@apollo/client/link/utils/validateOperation.js ***! \*********************************************************************/ /*! namespace exports */ /*! export validateOperation [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "validateOperation": () => /* binding */ validateOperation /* harmony export */ }); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); ; function validateOperation(operation) { var OPERATION_FIELDS = [ 'query', 'operationName', 'variables', 'extensions', 'context', ]; for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { var key = _a[_i]; if (OPERATION_FIELDS.indexOf(key) < 0) { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError("illegal argument: " + key); } } return operation; } //# sourceMappingURL=validateOperation.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/arrays.js": /*!****************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/arrays.js ***! \****************************************************************/ /*! namespace exports */ /*! export isNonEmptyArray [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "isNonEmptyArray": () => /* binding */ isNonEmptyArray /* harmony export */ }); function isNonEmptyArray(value) { return Array.isArray(value) && value.length > 0; } //# sourceMappingURL=arrays.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/canUse.js": /*!****************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/canUse.js ***! \****************************************************************/ /*! namespace exports */ /*! export canUseWeakMap [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "canUseWeakMap": () => /* binding */ canUseWeakMap /* harmony export */ }); var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); //# sourceMappingURL=canUse.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/cloneDeep.js": /*!*******************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/cloneDeep.js ***! \*******************************************************************/ /*! namespace exports */ /*! export cloneDeep [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "cloneDeep": () => /* binding */ cloneDeep /* harmony export */ }); var toString = Object.prototype.toString; function cloneDeep(value) { return cloneDeepHelper(value); } function cloneDeepHelper(val, seen) { switch (toString.call(val)) { case "[object Array]": { seen = seen || new Map; if (seen.has(val)) return seen.get(val); var copy_1 = val.slice(0); seen.set(val, copy_1); copy_1.forEach(function (child, i) { copy_1[i] = cloneDeepHelper(child, seen); }); return copy_1; } case "[object Object]": { seen = seen || new Map; if (seen.has(val)) return seen.get(val); var copy_2 = Object.create(Object.getPrototypeOf(val)); seen.set(val, copy_2); Object.keys(val).forEach(function (key) { copy_2[key] = cloneDeepHelper(val[key], seen); }); return copy_2; } default: return val; } } //# sourceMappingURL=cloneDeep.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/compact.js": /*!*****************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/compact.js ***! \*****************************************************************/ /*! namespace exports */ /*! export compact [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "compact": () => /* binding */ compact /* harmony export */ }); function compact() { var objects = []; for (var _i = 0; _i < arguments.length; _i++) { objects[_i] = arguments[_i]; } var result = Object.create(null); objects.forEach(function (obj) { if (!obj) return; Object.keys(obj).forEach(function (key) { var value = obj[key]; if (value !== void 0) { result[key] = value; } }); }); return result; } //# sourceMappingURL=compact.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/environment.js": /*!*********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/environment.js ***! \*********************************************************************/ /*! namespace exports */ /*! export getEnv [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isDevelopment [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isEnv [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isTest [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "getEnv": () => /* binding */ getEnv, /* harmony export */ "isEnv": () => /* binding */ isEnv, /* harmony export */ "isDevelopment": () => /* binding */ isDevelopment, /* harmony export */ "isTest": () => /* binding */ isTest /* harmony export */ }); function getEnv() { if (typeof process !== 'undefined' && "development") { return "development"; } return 'development'; } function isEnv(env) { return getEnv() === env; } function isDevelopment() { return isEnv('development') === true; } function isTest() { return isEnv('test') === true; } //# sourceMappingURL=environment.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/errorHandling.js": /*!***********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/errorHandling.js ***! \***********************************************************************/ /*! namespace exports */ /*! export graphQLResultHasError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "graphQLResultHasError": () => /* binding */ graphQLResultHasError /* harmony export */ }); function graphQLResultHasError(result) { return (result.errors && result.errors.length > 0) || false; } //# sourceMappingURL=errorHandling.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/filterInPlace.js": /*!***********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/filterInPlace.js ***! \***********************************************************************/ /*! namespace exports */ /*! export filterInPlace [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "filterInPlace": () => /* binding */ filterInPlace /* harmony export */ }); function filterInPlace(array, test, context) { var target = 0; array.forEach(function (elem, i) { if (test.call(this, elem, i, array)) { array[target++] = elem; } }, context); array.length = target; return array; } //# sourceMappingURL=filterInPlace.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js": /*!*************************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js ***! \*************************************************************************/ /*! namespace exports */ /*! export maybeDeepFreeze [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "maybeDeepFreeze": () => /* binding */ maybeDeepFreeze /* harmony export */ }); /* harmony import */ var _environment_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./environment.js */ "./node_modules/@apollo/client/utilities/common/environment.js"); ; function isObject(value) { return value !== null && typeof value === "object"; } function deepFreeze(value) { var workSet = new Set([value]); workSet.forEach(function (obj) { if (isObject(obj)) { if (!Object.isFrozen(obj)) Object.freeze(obj); Object.getOwnPropertyNames(obj).forEach(function (name) { if (isObject(obj[name])) workSet.add(obj[name]); }); } }); return value; } function maybeDeepFreeze(obj) { if ( true && ((0,_environment_js__WEBPACK_IMPORTED_MODULE_0__.isDevelopment)() || (0,_environment_js__WEBPACK_IMPORTED_MODULE_0__.isTest)())) { deepFreeze(obj); } return obj; } //# sourceMappingURL=maybeDeepFreeze.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/common/mergeDeep.js": /*!*******************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/common/mergeDeep.js ***! \*******************************************************************/ /*! namespace exports */ /*! export DeepMerger [provided] [no usage info] [missing usage info prevents renaming] */ /*! export mergeDeep [provided] [no usage info] [missing usage info prevents renaming] */ /*! export mergeDeepArray [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "mergeDeep": () => /* binding */ mergeDeep, /* harmony export */ "mergeDeepArray": () => /* binding */ mergeDeepArray, /* harmony export */ "DeepMerger": () => /* binding */ DeepMerger /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); ; var hasOwnProperty = Object.prototype.hasOwnProperty; function mergeDeep() { var sources = []; for (var _i = 0; _i < arguments.length; _i++) { sources[_i] = arguments[_i]; } return mergeDeepArray(sources); } function mergeDeepArray(sources) { var target = sources[0] || {}; var count = sources.length; if (count > 1) { var merger = new DeepMerger(); for (var i = 1; i < count; ++i) { target = merger.merge(target, sources[i]); } } return target; } function isObject(obj) { return obj !== null && typeof obj === 'object'; } var defaultReconciler = function (target, source, property) { return this.merge(target[property], source[property]); }; var DeepMerger = (function () { function DeepMerger(reconciler) { if (reconciler === void 0) { reconciler = defaultReconciler; } this.reconciler = reconciler; this.isObject = isObject; this.pastCopies = new Set(); } DeepMerger.prototype.merge = function (target, source) { var _this = this; var context = []; for (var _i = 2; _i < arguments.length; _i++) { context[_i - 2] = arguments[_i]; } if (isObject(source) && isObject(target)) { Object.keys(source).forEach(function (sourceKey) { if (hasOwnProperty.call(target, sourceKey)) { var targetValue = target[sourceKey]; if (source[sourceKey] !== targetValue) { var result = _this.reconciler.apply(_this, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArrays)([target, source, sourceKey], context)); if (result !== targetValue) { target = _this.shallowCopyForMerge(target); target[sourceKey] = result; } } } else { target = _this.shallowCopyForMerge(target); target[sourceKey] = source[sourceKey]; } }); return target; } return source; }; DeepMerger.prototype.shallowCopyForMerge = function (value) { if (isObject(value) && !this.pastCopies.has(value)) { if (Array.isArray(value)) { value = value.slice(0); } else { value = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({ __proto__: Object.getPrototypeOf(value) }, value); } this.pastCopies.add(value); } return value; }; return DeepMerger; }()); //# sourceMappingURL=mergeDeep.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/graphql/directives.js": /*!*********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/graphql/directives.js ***! \*********************************************************************/ /*! namespace exports */ /*! export getDirectiveNames [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getInclusionDirectives [provided] [no usage info] [missing usage info prevents renaming] */ /*! export hasClientExports [provided] [no usage info] [missing usage info prevents renaming] */ /*! export hasDirectives [provided] [no usage info] [missing usage info prevents renaming] */ /*! export shouldInclude [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "shouldInclude": () => /* binding */ shouldInclude, /* harmony export */ "getDirectiveNames": () => /* binding */ getDirectiveNames, /* harmony export */ "hasDirectives": () => /* binding */ hasDirectives, /* harmony export */ "hasClientExports": () => /* binding */ hasClientExports, /* harmony export */ "getInclusionDirectives": () => /* binding */ getInclusionDirectives /* harmony export */ }); /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphql */ "./node_modules/graphql/language/visitor.mjs"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); ; function shouldInclude(_a, variables) { var directives = _a.directives; if (!directives || !directives.length) { return true; } return getInclusionDirectives(directives).every(function (_a) { var directive = _a.directive, ifArgument = _a.ifArgument; var evaledValue = false; if (ifArgument.value.kind === 'Variable') { evaledValue = variables && variables[ifArgument.value.name.value]; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); } else { evaledValue = ifArgument.value.value; } return directive.name.value === 'skip' ? !evaledValue : evaledValue; }); } function getDirectiveNames(root) { var names = []; (0,graphql__WEBPACK_IMPORTED_MODULE_1__.visit)(root, { Directive: function (node) { names.push(node.name.value); }, }); return names; } function hasDirectives(names, root) { return getDirectiveNames(root).some(function (name) { return names.indexOf(name) > -1; }); } function hasClientExports(document) { return (document && hasDirectives(['client'], document) && hasDirectives(['export'], document)); } function isInclusionDirective(_a) { var value = _a.name.value; return value === 'skip' || value === 'include'; } function getInclusionDirectives(directives) { var result = []; if (directives && directives.length) { directives.forEach(function (directive) { if (!isInclusionDirective(directive)) return; var directiveArguments = directive.arguments; var directiveName = directive.name.value; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); var ifArgument = directiveArguments[0]; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); var ifValue = ifArgument.value; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); result.push({ directive: directive, ifArgument: ifArgument }); }); } return result; } //# sourceMappingURL=directives.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/graphql/fragments.js": /*!********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/graphql/fragments.js ***! \********************************************************************/ /*! namespace exports */ /*! export createFragmentMap [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getFragmentFromSelection [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getFragmentQueryDocument [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "getFragmentQueryDocument": () => /* binding */ getFragmentQueryDocument, /* harmony export */ "createFragmentMap": () => /* binding */ createFragmentMap, /* harmony export */ "getFragmentFromSelection": () => /* binding */ getFragmentFromSelection /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); ; function getFragmentQueryDocument(document, fragmentName) { var actualFragmentName = fragmentName; var fragments = []; document.definitions.forEach(function (definition) { if (definition.kind === 'OperationDefinition') { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); } if (definition.kind === 'FragmentDefinition') { fragments.push(definition); } }); if (typeof actualFragmentName === 'undefined') { false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); actualFragmentName = fragments[0].name.value; } var query = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, document), { definitions: (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__spreadArrays)([ { kind: 'OperationDefinition', operation: 'query', selectionSet: { kind: 'SelectionSet', selections: [ { kind: 'FragmentSpread', name: { kind: 'Name', value: actualFragmentName, }, }, ], }, } ], document.definitions) }); return query; } function createFragmentMap(fragments) { if (fragments === void 0) { fragments = []; } var symTable = {}; fragments.forEach(function (fragment) { symTable[fragment.name.value] = fragment; }); return symTable; } function getFragmentFromSelection(selection, fragmentMap) { switch (selection.kind) { case 'InlineFragment': return selection; case 'FragmentSpread': { var fragment = fragmentMap && fragmentMap[selection.name.value]; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragment, "No fragment named " + selection.name.value + "."); return fragment; } default: return null; } } //# sourceMappingURL=fragments.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/graphql/getFromAST.js": /*!*********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/graphql/getFromAST.js ***! \*********************************************************************/ /*! namespace exports */ /*! export checkDocument [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getDefaultValues [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getFragmentDefinition [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getFragmentDefinitions [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getMainDefinition [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getOperationDefinition [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getOperationName [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getQueryDefinition [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "checkDocument": () => /* binding */ checkDocument, /* harmony export */ "getOperationDefinition": () => /* binding */ getOperationDefinition, /* harmony export */ "getOperationName": () => /* binding */ getOperationName, /* harmony export */ "getFragmentDefinitions": () => /* binding */ getFragmentDefinitions, /* harmony export */ "getQueryDefinition": () => /* binding */ getQueryDefinition, /* harmony export */ "getFragmentDefinition": () => /* binding */ getFragmentDefinition, /* harmony export */ "getMainDefinition": () => /* binding */ getMainDefinition, /* harmony export */ "getDefaultValues": () => /* binding */ getDefaultValues /* harmony export */ }); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _storeUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./storeUtils.js */ "./node_modules/@apollo/client/utilities/graphql/storeUtils.js"); ; function checkDocument(doc) { false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); var operations = doc.definitions .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) .map(function (definition) { if (definition.kind !== 'OperationDefinition') { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); } return definition; }); false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); return doc; } function getOperationDefinition(doc) { checkDocument(doc); return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; } function getOperationName(doc) { return (doc.definitions .filter(function (definition) { return definition.kind === 'OperationDefinition' && definition.name; }) .map(function (x) { return x.name.value; })[0] || null); } function getFragmentDefinitions(doc) { return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); } function getQueryDefinition(doc) { var queryDef = getOperationDefinition(doc); false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); return queryDef; } function getFragmentDefinition(doc) { false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); var fragmentDef = doc.definitions[0]; false ? 0 : (0,ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant)(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); return fragmentDef; } function getMainDefinition(queryDoc) { checkDocument(queryDoc); var fragmentDefinition; for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { var definition = _a[_i]; if (definition.kind === 'OperationDefinition') { var operation = definition.operation; if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { return definition; } } if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { fragmentDefinition = definition; } } if (fragmentDefinition) { return fragmentDefinition; } throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_0__.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); } function getDefaultValues(definition) { var defaultValues = Object.create(null); var defs = definition && definition.variableDefinitions; if (defs && defs.length) { defs.forEach(function (def) { if (def.defaultValue) { (0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_1__.valueToObjectRepresentation)(defaultValues, def.variable.name, def.defaultValue); } }); } return defaultValues; } //# sourceMappingURL=getFromAST.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/graphql/storeUtils.js": /*!*********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/graphql/storeUtils.js ***! \*********************************************************************/ /*! namespace exports */ /*! export argumentsObjectFromField [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getStoreKeyName [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getTypenameFromResult [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isField [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isInlineFragment [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isReference [provided] [no usage info] [missing usage info prevents renaming] */ /*! export makeReference [provided] [no usage info] [missing usage info prevents renaming] */ /*! export resultKeyNameFromField [provided] [no usage info] [missing usage info prevents renaming] */ /*! export storeKeyNameFromField [provided] [no usage info] [missing usage info prevents renaming] */ /*! export valueToObjectRepresentation [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "makeReference": () => /* binding */ makeReference, /* harmony export */ "isReference": () => /* binding */ isReference, /* harmony export */ "valueToObjectRepresentation": () => /* binding */ valueToObjectRepresentation, /* harmony export */ "storeKeyNameFromField": () => /* binding */ storeKeyNameFromField, /* harmony export */ "getStoreKeyName": () => /* binding */ getStoreKeyName, /* harmony export */ "argumentsObjectFromField": () => /* binding */ argumentsObjectFromField, /* harmony export */ "resultKeyNameFromField": () => /* binding */ resultKeyNameFromField, /* harmony export */ "getTypenameFromResult": () => /* binding */ getTypenameFromResult, /* harmony export */ "isField": () => /* binding */ isField, /* harmony export */ "isInlineFragment": () => /* binding */ isInlineFragment /* harmony export */ }); /* harmony import */ var fast_json_stable_stringify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-json-stable-stringify */ "./node_modules/fast-json-stable-stringify/index.js"); /* harmony import */ var fast_json_stable_stringify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fast_json_stable_stringify__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _fragments_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fragments.js */ "./node_modules/@apollo/client/utilities/graphql/fragments.js"); ; function makeReference(id) { return { __ref: String(id) }; } function isReference(obj) { return Boolean(obj && typeof obj === 'object' && typeof obj.__ref === 'string'); } function isStringValue(value) { return value.kind === 'StringValue'; } function isBooleanValue(value) { return value.kind === 'BooleanValue'; } function isIntValue(value) { return value.kind === 'IntValue'; } function isFloatValue(value) { return value.kind === 'FloatValue'; } function isVariable(value) { return value.kind === 'Variable'; } function isObjectValue(value) { return value.kind === 'ObjectValue'; } function isListValue(value) { return value.kind === 'ListValue'; } function isEnumValue(value) { return value.kind === 'EnumValue'; } function isNullValue(value) { return value.kind === 'NullValue'; } function valueToObjectRepresentation(argObj, name, value, variables) { if (isIntValue(value) || isFloatValue(value)) { argObj[name.value] = Number(value.value); } else if (isBooleanValue(value) || isStringValue(value)) { argObj[name.value] = value.value; } else if (isObjectValue(value)) { var nestedArgObj_1 = {}; value.fields.map(function (obj) { return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); }); argObj[name.value] = nestedArgObj_1; } else if (isVariable(value)) { var variableValue = (variables || {})[value.name.value]; argObj[name.value] = variableValue; } else if (isListValue(value)) { argObj[name.value] = value.values.map(function (listValue) { var nestedArgArrayObj = {}; valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); return nestedArgArrayObj[name.value]; }); } else if (isEnumValue(value)) { argObj[name.value] = value.value; } else if (isNullValue(value)) { argObj[name.value] = null; } else { throw false ? 0 : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); } } function storeKeyNameFromField(field, variables) { var directivesObj = null; if (field.directives) { directivesObj = {}; field.directives.forEach(function (directive) { directivesObj[directive.name.value] = {}; if (directive.arguments) { directive.arguments.forEach(function (_a) { var name = _a.name, value = _a.value; return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); }); } }); } var argObj = null; if (field.arguments && field.arguments.length) { argObj = {}; field.arguments.forEach(function (_a) { var name = _a.name, value = _a.value; return valueToObjectRepresentation(argObj, name, value, variables); }); } return getStoreKeyName(field.name.value, argObj, directivesObj); } var KNOWN_DIRECTIVES = [ 'connection', 'include', 'skip', 'client', 'rest', 'export', ]; function getStoreKeyName(fieldName, args, directives) { if (args && directives && directives['connection'] && directives['connection']['key']) { if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; filterKeys.sort(); var filteredArgs_1 = {}; filterKeys.forEach(function (key) { filteredArgs_1[key] = args[key]; }); return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; } else { return directives['connection']['key']; } } var completeFieldName = fieldName; if (args) { var stringifiedArgs = fast_json_stable_stringify__WEBPACK_IMPORTED_MODULE_0___default()(args); completeFieldName += "(" + stringifiedArgs + ")"; } if (directives) { Object.keys(directives).forEach(function (key) { if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; if (directives[key] && Object.keys(directives[key]).length) { completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; } else { completeFieldName += "@" + key; } }); } return completeFieldName; } function argumentsObjectFromField(field, variables) { if (field.arguments && field.arguments.length) { var argObj_1 = {}; field.arguments.forEach(function (_a) { var name = _a.name, value = _a.value; return valueToObjectRepresentation(argObj_1, name, value, variables); }); return argObj_1; } return null; } function resultKeyNameFromField(field) { return field.alias ? field.alias.value : field.name.value; } function getTypenameFromResult(result, selectionSet, fragmentMap) { if (typeof result.__typename === 'string') { return result.__typename; } for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) { var selection = _a[_i]; if (isField(selection)) { if (selection.name.value === '__typename') { return result[resultKeyNameFromField(selection)]; } } else { var typename = getTypenameFromResult(result, (0,_fragments_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentFromSelection)(selection, fragmentMap).selectionSet, fragmentMap); if (typeof typename === 'string') { return typename; } } } } function isField(selection) { return selection.kind === 'Field'; } function isInlineFragment(selection) { return selection.kind === 'InlineFragment'; } //# sourceMappingURL=storeUtils.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/graphql/transform.js": /*!********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/graphql/transform.js ***! \********************************************************************/ /*! namespace exports */ /*! export addTypenameToDocument [provided] [no usage info] [missing usage info prevents renaming] */ /*! export buildQueryFromSelectionSet [provided] [no usage info] [missing usage info prevents renaming] */ /*! export removeArgumentsFromDocument [provided] [no usage info] [missing usage info prevents renaming] */ /*! export removeClientSetsFromDocument [provided] [no usage info] [missing usage info prevents renaming] */ /*! export removeConnectionDirectiveFromDocument [provided] [no usage info] [missing usage info prevents renaming] */ /*! export removeDirectivesFromDocument [provided] [no usage info] [missing usage info prevents renaming] */ /*! export removeFragmentSpreadFromDocument [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "removeDirectivesFromDocument": () => /* binding */ removeDirectivesFromDocument, /* harmony export */ "addTypenameToDocument": () => /* binding */ addTypenameToDocument, /* harmony export */ "removeConnectionDirectiveFromDocument": () => /* binding */ removeConnectionDirectiveFromDocument, /* harmony export */ "removeArgumentsFromDocument": () => /* binding */ removeArgumentsFromDocument, /* harmony export */ "removeFragmentSpreadFromDocument": () => /* binding */ removeFragmentSpreadFromDocument, /* harmony export */ "buildQueryFromSelectionSet": () => /* binding */ buildQueryFromSelectionSet, /* harmony export */ "removeClientSetsFromDocument": () => /* binding */ removeClientSetsFromDocument /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! graphql */ "./node_modules/graphql/language/visitor.mjs"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var _getFromAST_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getFromAST.js */ "./node_modules/@apollo/client/utilities/graphql/getFromAST.js"); /* harmony import */ var _common_filterInPlace_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/filterInPlace.js */ "./node_modules/@apollo/client/utilities/common/filterInPlace.js"); /* harmony import */ var _storeUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./storeUtils.js */ "./node_modules/@apollo/client/utilities/graphql/storeUtils.js"); /* harmony import */ var _fragments_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fragments.js */ "./node_modules/@apollo/client/utilities/graphql/fragments.js"); ; var TYPENAME_FIELD = { kind: 'Field', name: { kind: 'Name', value: '__typename', }, }; function isEmpty(op, fragments) { return op.selectionSet.selections.every(function (selection) { return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); }); } function nullIfDocIsEmpty(doc) { return isEmpty((0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.getOperationDefinition)(doc) || (0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentDefinition)(doc), (0,_fragments_js__WEBPACK_IMPORTED_MODULE_4__.createFragmentMap)((0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentDefinitions)(doc))) ? null : doc; } function getDirectiveMatcher(directives) { return function directiveMatcher(directive) { return directives.some(function (dir) { return (dir.name && dir.name === directive.name.value) || (dir.test && dir.test(directive)); }); }; } function removeDirectivesFromDocument(directives, doc) { var variablesInUse = Object.create(null); var variablesToRemove = []; var fragmentSpreadsInUse = Object.create(null); var fragmentSpreadsToRemove = []; var modifiedDoc = nullIfDocIsEmpty((0,graphql__WEBPACK_IMPORTED_MODULE_5__.visit)(doc, { Variable: { enter: function (node, _key, parent) { if (parent.kind !== 'VariableDefinition') { variablesInUse[node.name.value] = true; } }, }, Field: { enter: function (node) { if (directives && node.directives) { var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { if (node.arguments) { node.arguments.forEach(function (arg) { if (arg.value.kind === 'Variable') { variablesToRemove.push({ name: arg.value.name.value, }); } }); } if (node.selectionSet) { getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { fragmentSpreadsToRemove.push({ name: frag.name.value, }); }); } return null; } } }, }, FragmentSpread: { enter: function (node) { fragmentSpreadsInUse[node.name.value] = true; }, }, Directive: { enter: function (node) { if (getDirectiveMatcher(directives)(node)) { return null; } }, }, })); if (modifiedDoc && (0,_common_filterInPlace_js__WEBPACK_IMPORTED_MODULE_2__.filterInPlace)(variablesToRemove, function (v) { return !!v.name && !variablesInUse[v.name]; }).length) { modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); } if (modifiedDoc && (0,_common_filterInPlace_js__WEBPACK_IMPORTED_MODULE_2__.filterInPlace)(fragmentSpreadsToRemove, function (fs) { return !!fs.name && !fragmentSpreadsInUse[fs.name]; }) .length) { modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); } return modifiedDoc; } function addTypenameToDocument(doc) { return (0,graphql__WEBPACK_IMPORTED_MODULE_5__.visit)((0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.checkDocument)(doc), { SelectionSet: { enter: function (node, _key, parent) { if (parent && parent.kind === 'OperationDefinition') { return; } var selections = node.selections; if (!selections) { return; } var skip = selections.some(function (selection) { return ((0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isField)(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0)); }); if (skip) { return; } var field = parent; if ((0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isField)(field) && field.directives && field.directives.some(function (d) { return d.name.value === 'export'; })) { return; } return (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, node), { selections: (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__spreadArrays)(selections, [TYPENAME_FIELD]) }); }, }, }); } addTypenameToDocument.added = function (field) { return field === TYPENAME_FIELD; }; var connectionRemoveConfig = { test: function (directive) { var willRemove = directive.name.value === 'connection'; if (willRemove) { if (!directive.arguments || !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_0__.invariant.warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); } } return willRemove; }, }; function removeConnectionDirectiveFromDocument(doc) { return removeDirectivesFromDocument([connectionRemoveConfig], (0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.checkDocument)(doc)); } function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { if (nestedCheck === void 0) { nestedCheck = true; } return (!!selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { return hasDirectivesInSelection(directives, selection, nestedCheck); })); } function hasDirectivesInSelection(directives, selection, nestedCheck) { if (nestedCheck === void 0) { nestedCheck = true; } if (!(0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isField)(selection)) { return true; } if (!selection.directives) { return false; } return (selection.directives.some(getDirectiveMatcher(directives)) || (nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); } function getArgumentMatcher(config) { return function argumentMatcher(argument) { return config.some(function (aConfig) { return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || (aConfig.test && aConfig.test(argument))); }); }; } function removeArgumentsFromDocument(config, doc) { var argMatcher = getArgumentMatcher(config); return nullIfDocIsEmpty((0,graphql__WEBPACK_IMPORTED_MODULE_5__.visit)(doc, { OperationDefinition: { enter: function (node) { return (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, node), { variableDefinitions: node.variableDefinitions ? node.variableDefinitions.filter(function (varDef) { return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); }) : [] }); }, }, Field: { enter: function (node) { var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); if (shouldRemoveField) { var argMatchCount_1 = 0; if (node.arguments) { node.arguments.forEach(function (arg) { if (argMatcher(arg)) { argMatchCount_1 += 1; } }); } if (argMatchCount_1 === 1) { return null; } } }, }, Argument: { enter: function (node) { if (argMatcher(node)) { return null; } }, }, })); } function removeFragmentSpreadFromDocument(config, doc) { function enter(node) { if (config.some(function (def) { return def.name === node.name.value; })) { return null; } } return nullIfDocIsEmpty((0,graphql__WEBPACK_IMPORTED_MODULE_5__.visit)(doc, { FragmentSpread: { enter: enter }, FragmentDefinition: { enter: enter }, })); } function getAllFragmentSpreadsFromSelectionSet(selectionSet) { var allFragments = []; selectionSet.selections.forEach(function (selection) { if (((0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isField)(selection) || (0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isInlineFragment)(selection)) && selection.selectionSet) { getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); } else if (selection.kind === 'FragmentSpread') { allFragments.push(selection); } }); return allFragments; } function buildQueryFromSelectionSet(document) { var definition = (0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.getMainDefinition)(document); var definitionOperation = definition.operation; if (definitionOperation === 'query') { return document; } var modifiedDoc = (0,graphql__WEBPACK_IMPORTED_MODULE_5__.visit)(document, { OperationDefinition: { enter: function (node) { return (0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_6__.__assign)({}, node), { operation: 'query' }); }, }, }); return modifiedDoc; } function removeClientSetsFromDocument(document) { (0,_getFromAST_js__WEBPACK_IMPORTED_MODULE_1__.checkDocument)(document); var modifiedDoc = removeDirectivesFromDocument([ { test: function (directive) { return directive.name.value === 'client'; }, remove: true, }, ], document); if (modifiedDoc) { modifiedDoc = (0,graphql__WEBPACK_IMPORTED_MODULE_5__.visit)(modifiedDoc, { FragmentDefinition: { enter: function (node) { if (node.selectionSet) { var isTypenameOnly = node.selectionSet.selections.every(function (selection) { return (0,_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isField)(selection) && selection.name.value === '__typename'; }); if (isTypenameOnly) { return null; } } }, }, }); } return modifiedDoc; } //# sourceMappingURL=transform.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/index.js": /*!********************************************************!*\ !*** ./node_modules/@apollo/client/utilities/index.js ***! \********************************************************/ /*! namespace exports */ /*! export Concast [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/observables/Concast.js .Concast */ /*! export DeepMerger [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/mergeDeep.js .DeepMerger */ /*! export Observable [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/zen-observable/index.js .default */ /*! export addTypenameToDocument [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/transform.js .addTypenameToDocument */ /*! export argumentsObjectFromField [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .argumentsObjectFromField */ /*! export asyncMap [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/observables/asyncMap.js .asyncMap */ /*! export buildQueryFromSelectionSet [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/transform.js .buildQueryFromSelectionSet */ /*! export canUseWeakMap [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/canUse.js .canUseWeakMap */ /*! export checkDocument [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/getFromAST.js .checkDocument */ /*! export cloneDeep [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/cloneDeep.js .cloneDeep */ /*! export compact [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/compact.js .compact */ /*! export concatPagination [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/policies/pagination.js .concatPagination */ /*! export createFragmentMap [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/fragments.js .createFragmentMap */ /*! export getDefaultValues [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/getFromAST.js .getDefaultValues */ /*! export getDirectiveNames [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/directives.js .getDirectiveNames */ /*! export getFragmentDefinition [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/getFromAST.js .getFragmentDefinition */ /*! export getFragmentDefinitions [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/getFromAST.js .getFragmentDefinitions */ /*! export getFragmentFromSelection [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/fragments.js .getFragmentFromSelection */ /*! export getFragmentQueryDocument [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/fragments.js .getFragmentQueryDocument */ /*! export getInclusionDirectives [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/directives.js .getInclusionDirectives */ /*! export getMainDefinition [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/getFromAST.js .getMainDefinition */ /*! export getOperationDefinition [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/getFromAST.js .getOperationDefinition */ /*! export getOperationName [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/getFromAST.js .getOperationName */ /*! export getQueryDefinition [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/getFromAST.js .getQueryDefinition */ /*! export getStoreKeyName [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .getStoreKeyName */ /*! export getTypenameFromResult [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .getTypenameFromResult */ /*! export graphQLResultHasError [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/errorHandling.js .graphQLResultHasError */ /*! export hasClientExports [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/directives.js .hasClientExports */ /*! export hasDirectives [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/directives.js .hasDirectives */ /*! export isField [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .isField */ /*! export isInlineFragment [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .isInlineFragment */ /*! export isNonEmptyArray [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/arrays.js .isNonEmptyArray */ /*! export isReference [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .isReference */ /*! export iterateObserversSafely [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/observables/iteration.js .iterateObserversSafely */ /*! export makeReference [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .makeReference */ /*! export maybeDeepFreeze [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js .maybeDeepFreeze */ /*! export mergeDeep [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/mergeDeep.js .mergeDeep */ /*! export mergeDeepArray [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/common/mergeDeep.js .mergeDeepArray */ /*! export offsetLimitPagination [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/policies/pagination.js .offsetLimitPagination */ /*! export relayStylePagination [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/policies/pagination.js .relayStylePagination */ /*! export removeArgumentsFromDocument [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/transform.js .removeArgumentsFromDocument */ /*! export removeClientSetsFromDocument [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/transform.js .removeClientSetsFromDocument */ /*! export removeConnectionDirectiveFromDocument [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/transform.js .removeConnectionDirectiveFromDocument */ /*! export removeDirectivesFromDocument [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/transform.js .removeDirectivesFromDocument */ /*! export removeFragmentSpreadFromDocument [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/transform.js .removeFragmentSpreadFromDocument */ /*! export resultKeyNameFromField [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .resultKeyNameFromField */ /*! export shouldInclude [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/directives.js .shouldInclude */ /*! export storeKeyNameFromField [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .storeKeyNameFromField */ /*! export valueToObjectRepresentation [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@apollo/client/utilities/graphql/storeUtils.js .valueToObjectRepresentation */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "shouldInclude": () => /* reexport safe */ _graphql_directives_js__WEBPACK_IMPORTED_MODULE_0__.shouldInclude, /* harmony export */ "hasDirectives": () => /* reexport safe */ _graphql_directives_js__WEBPACK_IMPORTED_MODULE_0__.hasDirectives, /* harmony export */ "hasClientExports": () => /* reexport safe */ _graphql_directives_js__WEBPACK_IMPORTED_MODULE_0__.hasClientExports, /* harmony export */ "getDirectiveNames": () => /* reexport safe */ _graphql_directives_js__WEBPACK_IMPORTED_MODULE_0__.getDirectiveNames, /* harmony export */ "getInclusionDirectives": () => /* reexport safe */ _graphql_directives_js__WEBPACK_IMPORTED_MODULE_0__.getInclusionDirectives, /* harmony export */ "createFragmentMap": () => /* reexport safe */ _graphql_fragments_js__WEBPACK_IMPORTED_MODULE_1__.createFragmentMap, /* harmony export */ "getFragmentQueryDocument": () => /* reexport safe */ _graphql_fragments_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentQueryDocument, /* harmony export */ "getFragmentFromSelection": () => /* reexport safe */ _graphql_fragments_js__WEBPACK_IMPORTED_MODULE_1__.getFragmentFromSelection, /* harmony export */ "checkDocument": () => /* reexport safe */ _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__.checkDocument, /* harmony export */ "getOperationDefinition": () => /* reexport safe */ _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__.getOperationDefinition, /* harmony export */ "getOperationName": () => /* reexport safe */ _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__.getOperationName, /* harmony export */ "getFragmentDefinitions": () => /* reexport safe */ _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentDefinitions, /* harmony export */ "getQueryDefinition": () => /* reexport safe */ _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__.getQueryDefinition, /* harmony export */ "getFragmentDefinition": () => /* reexport safe */ _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__.getFragmentDefinition, /* harmony export */ "getMainDefinition": () => /* reexport safe */ _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__.getMainDefinition, /* harmony export */ "getDefaultValues": () => /* reexport safe */ _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__.getDefaultValues, /* harmony export */ "makeReference": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.makeReference, /* harmony export */ "isReference": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isReference, /* harmony export */ "isField": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isField, /* harmony export */ "isInlineFragment": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.isInlineFragment, /* harmony export */ "valueToObjectRepresentation": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.valueToObjectRepresentation, /* harmony export */ "storeKeyNameFromField": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.storeKeyNameFromField, /* harmony export */ "argumentsObjectFromField": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.argumentsObjectFromField, /* harmony export */ "resultKeyNameFromField": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.resultKeyNameFromField, /* harmony export */ "getStoreKeyName": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.getStoreKeyName, /* harmony export */ "getTypenameFromResult": () => /* reexport safe */ _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__.getTypenameFromResult, /* harmony export */ "addTypenameToDocument": () => /* reexport safe */ _graphql_transform_js__WEBPACK_IMPORTED_MODULE_4__.addTypenameToDocument, /* harmony export */ "buildQueryFromSelectionSet": () => /* reexport safe */ _graphql_transform_js__WEBPACK_IMPORTED_MODULE_4__.buildQueryFromSelectionSet, /* harmony export */ "removeDirectivesFromDocument": () => /* reexport safe */ _graphql_transform_js__WEBPACK_IMPORTED_MODULE_4__.removeDirectivesFromDocument, /* harmony export */ "removeConnectionDirectiveFromDocument": () => /* reexport safe */ _graphql_transform_js__WEBPACK_IMPORTED_MODULE_4__.removeConnectionDirectiveFromDocument, /* harmony export */ "removeArgumentsFromDocument": () => /* reexport safe */ _graphql_transform_js__WEBPACK_IMPORTED_MODULE_4__.removeArgumentsFromDocument, /* harmony export */ "removeFragmentSpreadFromDocument": () => /* reexport safe */ _graphql_transform_js__WEBPACK_IMPORTED_MODULE_4__.removeFragmentSpreadFromDocument, /* harmony export */ "removeClientSetsFromDocument": () => /* reexport safe */ _graphql_transform_js__WEBPACK_IMPORTED_MODULE_4__.removeClientSetsFromDocument, /* harmony export */ "concatPagination": () => /* reexport safe */ _policies_pagination_js__WEBPACK_IMPORTED_MODULE_5__.concatPagination, /* harmony export */ "offsetLimitPagination": () => /* reexport safe */ _policies_pagination_js__WEBPACK_IMPORTED_MODULE_5__.offsetLimitPagination, /* harmony export */ "relayStylePagination": () => /* reexport safe */ _policies_pagination_js__WEBPACK_IMPORTED_MODULE_5__.relayStylePagination, /* harmony export */ "Observable": () => /* reexport safe */ _observables_Observable_js__WEBPACK_IMPORTED_MODULE_6__.Observable, /* harmony export */ "DeepMerger": () => /* reexport safe */ _common_mergeDeep_js__WEBPACK_IMPORTED_MODULE_7__.DeepMerger, /* harmony export */ "mergeDeep": () => /* reexport safe */ _common_mergeDeep_js__WEBPACK_IMPORTED_MODULE_7__.mergeDeep, /* harmony export */ "mergeDeepArray": () => /* reexport safe */ _common_mergeDeep_js__WEBPACK_IMPORTED_MODULE_7__.mergeDeepArray, /* harmony export */ "cloneDeep": () => /* reexport safe */ _common_cloneDeep_js__WEBPACK_IMPORTED_MODULE_8__.cloneDeep, /* harmony export */ "maybeDeepFreeze": () => /* reexport safe */ _common_maybeDeepFreeze_js__WEBPACK_IMPORTED_MODULE_9__.maybeDeepFreeze, /* harmony export */ "iterateObserversSafely": () => /* reexport safe */ _observables_iteration_js__WEBPACK_IMPORTED_MODULE_10__.iterateObserversSafely, /* harmony export */ "asyncMap": () => /* reexport safe */ _observables_asyncMap_js__WEBPACK_IMPORTED_MODULE_11__.asyncMap, /* harmony export */ "Concast": () => /* reexport safe */ _observables_Concast_js__WEBPACK_IMPORTED_MODULE_12__.Concast, /* harmony export */ "isNonEmptyArray": () => /* reexport safe */ _common_arrays_js__WEBPACK_IMPORTED_MODULE_13__.isNonEmptyArray, /* harmony export */ "graphQLResultHasError": () => /* reexport safe */ _common_errorHandling_js__WEBPACK_IMPORTED_MODULE_14__.graphQLResultHasError, /* harmony export */ "canUseWeakMap": () => /* reexport safe */ _common_canUse_js__WEBPACK_IMPORTED_MODULE_15__.canUseWeakMap, /* harmony export */ "compact": () => /* reexport safe */ _common_compact_js__WEBPACK_IMPORTED_MODULE_16__.compact /* harmony export */ }); /* harmony import */ var _graphql_directives_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./graphql/directives.js */ "./node_modules/@apollo/client/utilities/graphql/directives.js"); /* harmony import */ var _graphql_fragments_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./graphql/fragments.js */ "./node_modules/@apollo/client/utilities/graphql/fragments.js"); /* harmony import */ var _graphql_getFromAST_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./graphql/getFromAST.js */ "./node_modules/@apollo/client/utilities/graphql/getFromAST.js"); /* harmony import */ var _graphql_storeUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./graphql/storeUtils.js */ "./node_modules/@apollo/client/utilities/graphql/storeUtils.js"); /* harmony import */ var _graphql_transform_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./graphql/transform.js */ "./node_modules/@apollo/client/utilities/graphql/transform.js"); /* harmony import */ var _policies_pagination_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./policies/pagination.js */ "./node_modules/@apollo/client/utilities/policies/pagination.js"); /* harmony import */ var _observables_Observable_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./observables/Observable.js */ "./node_modules/@apollo/client/utilities/observables/Observable.js"); /* harmony import */ var _common_mergeDeep_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/mergeDeep.js */ "./node_modules/@apollo/client/utilities/common/mergeDeep.js"); /* harmony import */ var _common_cloneDeep_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./common/cloneDeep.js */ "./node_modules/@apollo/client/utilities/common/cloneDeep.js"); /* harmony import */ var _common_maybeDeepFreeze_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./common/maybeDeepFreeze.js */ "./node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js"); /* harmony import */ var _observables_iteration_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./observables/iteration.js */ "./node_modules/@apollo/client/utilities/observables/iteration.js"); /* harmony import */ var _observables_asyncMap_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./observables/asyncMap.js */ "./node_modules/@apollo/client/utilities/observables/asyncMap.js"); /* harmony import */ var _observables_Concast_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./observables/Concast.js */ "./node_modules/@apollo/client/utilities/observables/Concast.js"); /* harmony import */ var _common_arrays_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./common/arrays.js */ "./node_modules/@apollo/client/utilities/common/arrays.js"); /* harmony import */ var _common_errorHandling_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./common/errorHandling.js */ "./node_modules/@apollo/client/utilities/common/errorHandling.js"); /* harmony import */ var _common_canUse_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./common/canUse.js */ "./node_modules/@apollo/client/utilities/common/canUse.js"); /* harmony import */ var _common_compact_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./common/compact.js */ "./node_modules/@apollo/client/utilities/common/compact.js"); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/observables/Concast.js": /*!**********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/observables/Concast.js ***! \**********************************************************************/ /*! namespace exports */ /*! export Concast [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Concast": () => /* binding */ Concast /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _Observable_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Observable.js */ "./node_modules/@apollo/client/utilities/observables/Observable.js"); /* harmony import */ var _iteration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iteration.js */ "./node_modules/@apollo/client/utilities/observables/iteration.js"); ; function isPromiseLike(value) { return value && typeof value.then === "function"; } var Concast = (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__extends)(Concast, _super); function Concast(sources) { var _this = _super.call(this, function (observer) { _this.addObserver(observer); return function () { return _this.removeObserver(observer); }; }) || this; _this.observers = new Set(); _this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); _this.handlers = { next: function (result) { if (_this.sub !== null) { _this.latest = ["next", result]; (0,_iteration_js__WEBPACK_IMPORTED_MODULE_1__.iterateObserversSafely)(_this.observers, "next", result); } }, error: function (error) { if (_this.sub !== null) { if (_this.sub) _this.sub.unsubscribe(); _this.sub = null; _this.latest = ["error", error]; _this.reject(error); (0,_iteration_js__WEBPACK_IMPORTED_MODULE_1__.iterateObserversSafely)(_this.observers, "error", error); } }, complete: function () { if (_this.sub !== null) { var value = _this.sources.shift(); if (!value) { _this.sub = null; if (_this.latest && _this.latest[0] === "next") { _this.resolve(_this.latest[1]); } else { _this.resolve(); } (0,_iteration_js__WEBPACK_IMPORTED_MODULE_1__.iterateObserversSafely)(_this.observers, "complete"); } else if (isPromiseLike(value)) { value.then(function (obs) { return _this.sub = obs.subscribe(_this.handlers); }); } else { _this.sub = value.subscribe(_this.handlers); } } }, }; _this.cancel = function (reason) { _this.reject(reason); _this.sources = []; _this.handlers.complete(); }; _this.promise.catch(function (_) { }); if (isPromiseLike(sources)) { sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error); } else { _this.start(sources); } return _this; } Concast.prototype.start = function (sources) { if (this.sub !== void 0) return; this.sources = Array.from(sources); this.handlers.complete(); }; Concast.prototype.addObserver = function (observer) { if (!this.observers.has(observer)) { if (this.latest) { var nextOrError = this.latest[0]; var method = observer[nextOrError]; if (method) { method.call(observer, this.latest[1]); } if (this.sub === null && nextOrError === "next" && observer.complete) { observer.complete(); } } this.observers.add(observer); } }; Concast.prototype.removeObserver = function (observer, quietly) { if (this.observers.delete(observer) && this.observers.size < 1) { if (quietly) return; if (this.sub) { this.sub.unsubscribe(); this.reject(new Error("Observable cancelled prematurely")); } this.sub = null; } }; Concast.prototype.cleanup = function (callback) { var _this = this; var called = false; var once = function () { if (!called) { called = true; _this.observers.delete(observer); callback(); } }; var observer = { next: once, error: once, complete: once, }; this.addObserver(observer); }; return Concast; }(_Observable_js__WEBPACK_IMPORTED_MODULE_0__.Observable)); if (typeof Symbol === "function" && Symbol.species) { Object.defineProperty(Concast, Symbol.species, { value: _Observable_js__WEBPACK_IMPORTED_MODULE_0__.Observable, }); } //# sourceMappingURL=Concast.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/observables/Observable.js": /*!*************************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/observables/Observable.js ***! \*************************************************************************/ /*! namespace exports */ /*! export Observable [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/zen-observable/index.js .default */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Observable": () => /* reexport default from dynamic */ zen_observable__WEBPACK_IMPORTED_MODULE_0___default.a /* harmony export */ }); /* harmony import */ var zen_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zen-observable */ "./node_modules/zen-observable/index.js"); /* harmony import */ var zen_observable__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(zen_observable__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var symbol_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! symbol-observable */ "./node_modules/symbol-observable/es/index.js"); ; (zen_observable__WEBPACK_IMPORTED_MODULE_0___default().prototype["@@observable"]) = function () { return this; }; //# sourceMappingURL=Observable.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/observables/asyncMap.js": /*!***********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/observables/asyncMap.js ***! \***********************************************************************/ /*! namespace exports */ /*! export asyncMap [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "asyncMap": () => /* binding */ asyncMap /* harmony export */ }); /* harmony import */ var _Observable_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Observable.js */ "./node_modules/@apollo/client/utilities/observables/Observable.js"); ; function asyncMap(observable, mapFn, catchFn) { return new _Observable_js__WEBPACK_IMPORTED_MODULE_0__.Observable(function (observer) { var next = observer.next, error = observer.error, complete = observer.complete; var activeCallbackCount = 0; var completed = false; function makeCallback(examiner, delegate) { if (examiner) { return function (arg) { ++activeCallbackCount; new Promise(function (resolve) { return resolve(examiner(arg)); }).then(function (result) { --activeCallbackCount; next && next.call(observer, result); if (completed) { handler.complete(); } }, function (e) { --activeCallbackCount; error && error.call(observer, e); }); }; } else { return function (arg) { return delegate && delegate.call(observer, arg); }; } } var handler = { next: makeCallback(mapFn, next), error: makeCallback(catchFn, error), complete: function () { completed = true; if (!activeCallbackCount) { complete && complete.call(observer); } }, }; var sub = observable.subscribe(handler); return function () { return sub.unsubscribe(); }; }); } //# sourceMappingURL=asyncMap.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/observables/iteration.js": /*!************************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/observables/iteration.js ***! \************************************************************************/ /*! namespace exports */ /*! export iterateObserversSafely [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "iterateObserversSafely": () => /* binding */ iterateObserversSafely /* harmony export */ }); function iterateObserversSafely(observers, method, argument) { var observersWithMethod = []; observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); observersWithMethod.forEach(function (obs) { return obs[method](argument); }); } //# sourceMappingURL=iteration.js.map /***/ }), /***/ "./node_modules/@apollo/client/utilities/policies/pagination.js": /*!**********************************************************************!*\ !*** ./node_modules/@apollo/client/utilities/policies/pagination.js ***! \**********************************************************************/ /*! namespace exports */ /*! export concatPagination [provided] [no usage info] [missing usage info prevents renaming] */ /*! export offsetLimitPagination [provided] [no usage info] [missing usage info prevents renaming] */ /*! export relayStylePagination [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "concatPagination": () => /* binding */ concatPagination, /* harmony export */ "offsetLimitPagination": () => /* binding */ offsetLimitPagination, /* harmony export */ "relayStylePagination": () => /* binding */ relayStylePagination /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _common_mergeDeep_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/mergeDeep.js */ "./node_modules/@apollo/client/utilities/common/mergeDeep.js"); ; function concatPagination(keyArgs) { if (keyArgs === void 0) { keyArgs = false; } return { keyArgs: keyArgs, merge: function (existing, incoming) { return existing ? (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__spreadArrays)(existing, incoming) : incoming; }, }; } function offsetLimitPagination(keyArgs) { if (keyArgs === void 0) { keyArgs = false; } return { keyArgs: keyArgs, merge: function (existing, incoming, _a) { var args = _a.args; var merged = existing ? existing.slice(0) : []; if (args) { var _b = args.offset, offset = _b === void 0 ? 0 : _b; for (var i = 0; i < incoming.length; ++i) { merged[offset + i] = incoming[i]; } } else { merged.push.apply(merged, incoming); } return merged; }, }; } function relayStylePagination(keyArgs) { if (keyArgs === void 0) { keyArgs = false; } return { keyArgs: keyArgs, read: function (existing, _a) { var canRead = _a.canRead, readField = _a.readField; if (!existing) return; var edges = []; var startCursor = ""; var endCursor = ""; existing.edges.forEach(function (edge) { if (canRead(readField("node", edge))) { edges.push(edge); if (edge.cursor) { startCursor = startCursor || edge.cursor; endCursor = edge.cursor; } } }); return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, getExtras(existing)), { edges: edges, pageInfo: (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, existing.pageInfo), { startCursor: startCursor, endCursor: endCursor }) }); }, merge: function (existing, incoming, _a) { if (existing === void 0) { existing = makeEmptyData(); } var args = _a.args, isReference = _a.isReference, readField = _a.readField; var incomingEdges = incoming.edges ? incoming.edges.map(function (edge) { if (isReference(edge = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, edge))) { edge.cursor = readField("cursor", edge); } return edge; }) : []; if (incoming.pageInfo) { var pageInfo_1 = incoming.pageInfo; var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor; var firstEdge = incomingEdges[0]; var lastEdge = incomingEdges[incomingEdges.length - 1]; if (firstEdge && startCursor) { firstEdge.cursor = startCursor; } if (lastEdge && endCursor) { lastEdge.cursor = endCursor; } var firstCursor = firstEdge && firstEdge.cursor; if (firstCursor && !startCursor) { incoming = (0,_common_mergeDeep_js__WEBPACK_IMPORTED_MODULE_0__.mergeDeep)(incoming, { pageInfo: { startCursor: firstCursor, }, }); } var lastCursor = lastEdge && lastEdge.cursor; if (lastCursor && !endCursor) { incoming = (0,_common_mergeDeep_js__WEBPACK_IMPORTED_MODULE_0__.mergeDeep)(incoming, { pageInfo: { endCursor: lastCursor, }, }); } } var prefix = existing.edges; var suffix = []; if (args && args.after) { var index = prefix.findIndex(function (edge) { return edge.cursor === args.after; }); if (index >= 0) { prefix = prefix.slice(0, index + 1); } } else if (args && args.before) { var index = prefix.findIndex(function (edge) { return edge.cursor === args.before; }); suffix = index < 0 ? prefix : prefix.slice(index); prefix = []; } else if (incoming.edges) { prefix = []; } var edges = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__spreadArrays)(prefix, incomingEdges, suffix); var pageInfo = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, incoming.pageInfo), existing.pageInfo); if (incoming.pageInfo) { var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor; if (!prefix.length) { if (void 0 !== hasPreviousPage) pageInfo.hasPreviousPage = hasPreviousPage; if (void 0 !== startCursor) pageInfo.startCursor = startCursor; } if (!suffix.length) { if (void 0 !== hasNextPage) pageInfo.hasNextPage = hasNextPage; if (void 0 !== endCursor) pageInfo.endCursor = endCursor; } } return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_1__.__assign)({}, getExtras(existing)), getExtras(incoming)), { edges: edges, pageInfo: pageInfo }); }, }; } var getExtras = function (obj) { return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__rest)(obj, notExtras); }; var notExtras = ["edges", "pageInfo"]; function makeEmptyData() { return { edges: [], pageInfo: { hasPreviousPage: false, hasNextPage: true, startCursor: "", endCursor: "", }, }; } //# sourceMappingURL=pagination.js.map /***/ }), /***/ "./node_modules/@apollo/client/version.js": /*!************************************************!*\ !*** ./node_modules/@apollo/client/version.js ***! \************************************************/ /*! namespace exports */ /*! export version [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "version": () => /* binding */ version /* harmony export */ }); var version = 'local'; //# sourceMappingURL=version.js.map /***/ }), /***/ "./node_modules/@wry/context/lib/context.esm.js": /*!******************************************************!*\ !*** ./node_modules/@wry/context/lib/context.esm.js ***! \******************************************************/ /*! namespace exports */ /*! export Slot [provided] [no usage info] [missing usage info prevents renaming] */ /*! export asyncFromGen [provided] [no usage info] [missing usage info prevents renaming] */ /*! export bind [provided] [no usage info] [missing usage info prevents renaming] */ /*! export noContext [provided] [no usage info] [missing usage info prevents renaming] */ /*! export setTimeout [provided] [no usage info] [missing usage info prevents renaming] */ /*! export wrapYieldingFiberMethods [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Slot": () => /* binding */ Slot, /* harmony export */ "asyncFromGen": () => /* binding */ asyncFromGen, /* harmony export */ "bind": () => /* binding */ bind, /* harmony export */ "noContext": () => /* binding */ noContext, /* harmony export */ "setTimeout": () => /* binding */ setTimeoutWithContext, /* harmony export */ "wrapYieldingFiberMethods": () => /* binding */ wrapYieldingFiberMethods /* harmony export */ }); // This currentContext variable will only be used if the makeSlotClass // function is called, which happens only if this is the first copy of the // @wry/context package to be imported. var currentContext = null; // This unique internal object is used to denote the absence of a value // for a given Slot, and is never exposed to outside code. var MISSING_VALUE = {}; var idCounter = 1; // Although we can't do anything about the cost of duplicated code from // accidentally bundling multiple copies of the @wry/context package, we can // avoid creating the Slot class more than once using makeSlotClass. var makeSlotClass = function () { return /** @class */ (function () { function Slot() { // If you have a Slot object, you can find out its slot.id, but you cannot // guess the slot.id of a Slot you don't have access to, thanks to the // randomized suffix. this.id = [ "slot", idCounter++, Date.now(), Math.random().toString(36).slice(2), ].join(":"); } Slot.prototype.hasValue = function () { for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { // We use the Slot object iself as a key to its value, which means the // value cannot be obtained without a reference to the Slot object. if (this.id in context_1.slots) { var value = context_1.slots[this.id]; if (value === MISSING_VALUE) break; if (context_1 !== currentContext) { // Cache the value in currentContext.slots so the next lookup will // be faster. This caching is safe because the tree of contexts and // the values of the slots are logically immutable. currentContext.slots[this.id] = value; } return true; } } if (currentContext) { // If a value was not found for this Slot, it's never going to be found // no matter how many times we look it up, so we might as well cache // the absence of the value, too. currentContext.slots[this.id] = MISSING_VALUE; } return false; }; Slot.prototype.getValue = function () { if (this.hasValue()) { return currentContext.slots[this.id]; } }; Slot.prototype.withValue = function (value, callback, // Given the prevalence of arrow functions, specifying arguments is likely // to be much more common than specifying `this`, hence this ordering: args, thisArg) { var _a; var slots = (_a = { __proto__: null }, _a[this.id] = value, _a); var parent = currentContext; currentContext = { parent: parent, slots: slots }; try { // Function.prototype.apply allows the arguments array argument to be // omitted or undefined, so args! is fine here. return callback.apply(thisArg, args); } finally { currentContext = parent; } }; // Capture the current context and wrap a callback function so that it // reestablishes the captured context when called. Slot.bind = function (callback) { var context = currentContext; return function () { var saved = currentContext; try { currentContext = context; return callback.apply(this, arguments); } finally { currentContext = saved; } }; }; // Immediately run a callback function without any captured context. Slot.noContext = function (callback, // Given the prevalence of arrow functions, specifying arguments is likely // to be much more common than specifying `this`, hence this ordering: args, thisArg) { if (currentContext) { var saved = currentContext; try { currentContext = null; // Function.prototype.apply allows the arguments array argument to be // omitted or undefined, so args! is fine here. return callback.apply(thisArg, args); } finally { currentContext = saved; } } else { return callback.apply(thisArg, args); } }; return Slot; }()); }; // We store a single global implementation of the Slot class as a permanent // non-enumerable symbol property of the Array constructor. This obfuscation // does nothing to prevent access to the Slot class, but at least it ensures // the implementation (i.e. currentContext) cannot be tampered with, and all // copies of the @wry/context package (hopefully just one) will share the // same Slot implementation. Since the first copy of the @wry/context package // to be imported wins, this technique imposes a very high cost for any // future breaking changes to the Slot class. var globalKey = "@wry/context:Slot"; var host = Array; var Slot = host[globalKey] || function () { var Slot = makeSlotClass(); try { Object.defineProperty(host, globalKey, { value: host[globalKey] = Slot, enumerable: false, writable: false, configurable: false, }); } finally { return Slot; } }(); var bind = Slot.bind, noContext = Slot.noContext; function setTimeoutWithContext(callback, delay) { return setTimeout(bind(callback), delay); } // Turn any generator function into an async function (using yield instead // of await), with context automatically preserved across yields. function asyncFromGen(genFn) { return function () { var gen = genFn.apply(this, arguments); var boundNext = bind(gen.next); var boundThrow = bind(gen.throw); return new Promise(function (resolve, reject) { function invoke(method, argument) { try { var result = method.call(gen, argument); } catch (error) { return reject(error); } var next = result.done ? resolve : invokeNext; if (isPromiseLike(result.value)) { result.value.then(next, result.done ? reject : invokeThrow); } else { next(result.value); } } var invokeNext = function (value) { return invoke(boundNext, value); }; var invokeThrow = function (error) { return invoke(boundThrow, error); }; invokeNext(); }); }; } function isPromiseLike(value) { return value && typeof value.then === "function"; } // If you use the fibers npm package to implement coroutines in Node.js, // you should call this function at least once to ensure context management // remains coherent across any yields. var wrappedFibers = []; function wrapYieldingFiberMethods(Fiber) { // There can be only one implementation of Fiber per process, so this array // should never grow longer than one element. if (wrappedFibers.indexOf(Fiber) < 0) { var wrap = function (obj, method) { var fn = obj[method]; obj[method] = function () { return noContext(fn, arguments, this); }; }; // These methods can yield, according to // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 wrap(Fiber, "yield"); wrap(Fiber.prototype, "run"); wrap(Fiber.prototype, "throwInto"); wrappedFibers.push(Fiber); } return Fiber; } //# sourceMappingURL=context.esm.js.map /***/ }), /***/ "./node_modules/@wry/equality/lib/equality.esm.js": /*!********************************************************!*\ !*** ./node_modules/@wry/equality/lib/equality.esm.js ***! \********************************************************/ /*! namespace exports */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! export equal [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__.r, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__, /* harmony export */ "equal": () => /* binding */ equal /* harmony export */ }); var _a = Object.prototype, toString = _a.toString, hasOwnProperty = _a.hasOwnProperty; var fnToStr = Function.prototype.toString; var previousComparisons = new Map(); /** * Performs a deep equality check on two JavaScript values, tolerating cycles. */ function equal(a, b) { try { return check(a, b); } finally { previousComparisons.clear(); } } function check(a, b) { // If the two values are strictly equal, our job is easy. if (a === b) { return true; } // Object.prototype.toString returns a representation of the runtime type of // the given value that is considerably more precise than typeof. var aTag = toString.call(a); var bTag = toString.call(b); // If the runtime types of a and b are different, they could maybe be equal // under some interpretation of equality, but for simplicity and performance // we just return false instead. if (aTag !== bTag) { return false; } switch (aTag) { case '[object Array]': // Arrays are a lot like other objects, but we can cheaply compare their // lengths as a short-cut before comparing their elements. if (a.length !== b.length) return false; // Fall through to object case... case '[object Object]': { if (previouslyCompared(a, b)) return true; var aKeys = Object.keys(a); var bKeys = Object.keys(b); // If `a` and `b` have a different number of enumerable keys, they // must be different. var keyCount = aKeys.length; if (keyCount !== bKeys.length) return false; // Now make sure they have the same keys. for (var k = 0; k < keyCount; ++k) { if (!hasOwnProperty.call(b, aKeys[k])) { return false; } } // Finally, check deep equality of all child properties. for (var k = 0; k < keyCount; ++k) { var key = aKeys[k]; if (!check(a[key], b[key])) { return false; } } return true; } case '[object Error]': return a.name === b.name && a.message === b.message; case '[object Number]': // Handle NaN, which is !== itself. if (a !== a) return b !== b; // Fall through to shared +a === +b case... case '[object Boolean]': case '[object Date]': return +a === +b; case '[object RegExp]': case '[object String]': return a == "" + b; case '[object Map]': case '[object Set]': { if (a.size !== b.size) return false; if (previouslyCompared(a, b)) return true; var aIterator = a.entries(); var isMap = aTag === '[object Map]'; while (true) { var info = aIterator.next(); if (info.done) break; // If a instanceof Set, aValue === aKey. var _a = info.value, aKey = _a[0], aValue = _a[1]; // So this works the same way for both Set and Map. if (!b.has(aKey)) { return false; } // However, we care about deep equality of values only when dealing // with Map structures. if (isMap && !check(aValue, b.get(aKey))) { return false; } } return true; } case '[object Function]': { var aCode = fnToStr.call(a); if (aCode !== fnToStr.call(b)) { return false; } // We consider non-native functions equal if they have the same code // (native functions require === because their code is censored). // Note that this behavior is not entirely sound, since !== function // objects with the same code can behave differently depending on // their closure scope. However, any function can behave differently // depending on the values of its input arguments (including this) // and its calling context (including its closure scope), even // though the function object is === to itself; and it is entirely // possible for functions that are not === to behave exactly the // same under all conceivable circumstances. Because none of these // factors are statically decidable in JavaScript, JS function // equality is not well-defined. This ambiguity allows us to // consider the best possible heuristic among various imperfect // options, and equating non-native functions that have the same // code has enormous practical benefits, such as when comparing // functions that are repeatedly passed as fresh function // expressions within objects that are otherwise deeply equal. Since // any function created from the same syntactic expression (in the // same code location) will always stringify to the same code // according to fnToStr.call, we can reasonably expect these // repeatedly passed function expressions to have the same code, and // thus behave "the same" (with all the caveats mentioned above), // even though the runtime function objects are !== to one another. return !endsWith(aCode, nativeCodeSuffix); } } // Otherwise the values are not equal. return false; } var nativeCodeSuffix = "{ [native code] }"; function endsWith(full, suffix) { var fromIndex = full.length - suffix.length; return fromIndex >= 0 && full.indexOf(suffix, fromIndex) === fromIndex; } function previouslyCompared(a, b) { // Though cyclic references can make an object graph appear infinite from the // perspective of a depth-first traversal, the graph still contains a finite // number of distinct object references. We use the previousComparisons cache // to avoid comparing the same pair of object references more than once, which // guarantees termination (even if we end up comparing every object in one // graph to every object in the other graph, which is extremely unlikely), // while still allowing weird isomorphic structures (like rings with different // lengths) a chance to pass the equality test. var bSet = previousComparisons.get(a); if (bSet) { // Return true here because we can be sure false will be returned somewhere // else if the objects are not equivalent. if (bSet.has(b)) return true; } else { previousComparisons.set(a, bSet = new Set); } bSet.add(b); return false; } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (equal); //# sourceMappingURL=equality.esm.js.map /***/ }), /***/ "./node_modules/fast-json-stable-stringify/index.js": /*!**********************************************************!*\ !*** ./node_modules/fast-json-stable-stringify/index.js ***! \**********************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module */ /*! CommonJS bailout: module.exports is used directly at 3:0-14 */ /***/ ((module) => { "use strict"; module.exports = function (data, opts) { if (!opts) opts = {}; if (typeof opts === 'function') opts = { cmp: opts }; var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; var cmp = opts.cmp && (function (f) { return function (node) { return function (a, b) { var aobj = { key: a, value: node[a] }; var bobj = { key: b, value: node[b] }; return f(aobj, bobj); }; }; })(opts.cmp); var seen = []; return (function stringify (node) { if (node && node.toJSON && typeof node.toJSON === 'function') { node = node.toJSON(); } if (node === undefined) return; if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; if (typeof node !== 'object') return JSON.stringify(node); var i, out; if (Array.isArray(node)) { out = '['; for (i = 0; i < node.length; i++) { if (i) out += ','; out += stringify(node[i]) || 'null'; } return out + ']'; } if (node === null) return 'null'; if (seen.indexOf(node) !== -1) { if (cycles) return JSON.stringify('__cycle__'); throw new TypeError('Converting circular structure to JSON'); } var seenIndex = seen.push(node) - 1; var keys = Object.keys(node).sort(cmp && cmp(node)); out = ''; for (i = 0; i < keys.length; i++) { var key = keys[i]; var value = stringify(node[key]); if (!value) continue; if (out) out += ','; out += JSON.stringify(key) + ':' + value; } seen.splice(seenIndex, 1); return '{' + out + '}'; })(data); }; /***/ }), /***/ "./src/client/operations/get_election_log_entries.gql": /*!************************************************************!*\ !*** ./src/client/operations/get_election_log_entries.gql ***! \************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module */ /*! CommonJS bailout: module.exports is used directly at 119:4-18 */ /***/ ((module) => { var doc = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetElectionLogEntries"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"electionUniqueId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},"directives":[]},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}},"directives":[]}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"election"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"uniqueId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"electionUniqueId"}}}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"logEntries"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"},"arguments":[],"directives":[]},{"kind":"Field","name":{"kind":"Name","value":"messageId"},"arguments":[],"directives":[]},{"kind":"Field","name":{"kind":"Name","value":"signedData"},"arguments":[],"directives":[]}]}}]}}]}}],"loc":{"start":0,"end":202}}; doc.loc.source = {"body":"query GetElectionLogEntries($electionUniqueId: String!, $after: String) {\n election(uniqueId: $electionUniqueId) {\n logEntries(after: $after) {\n id\n messageId\n signedData\n }\n }\n}\n","name":"GraphQL request","locationOffset":{"line":1,"column":1}}; var names = {}; function unique(defs) { return defs.filter( function(def) { if (def.kind !== 'FragmentDefinition') return true; var name = def.name.value if (names[name]) { return false; } else { names[name] = true; return true; } } ) } // Collect any fragment/type references from a node, adding them to the refs Set function collectFragmentReferences(node, refs) { if (node.kind === "FragmentSpread") { refs.add(node.name.value); } else if (node.kind === "VariableDefinition") { var type = node.type; if (type.kind === "NamedType") { refs.add(type.name.value); } } if (node.selectionSet) { node.selectionSet.selections.forEach(function(selection) { collectFragmentReferences(selection, refs); }); } if (node.variableDefinitions) { node.variableDefinitions.forEach(function(def) { collectFragmentReferences(def, refs); }); } if (node.definitions) { node.definitions.forEach(function(def) { collectFragmentReferences(def, refs); }); } } var definitionRefs = {}; (function extractReferences() { doc.definitions.forEach(function(def) { if (def.name) { var refs = new Set(); collectFragmentReferences(def, refs); definitionRefs[def.name.value] = refs; } }); })(); function findOperation(doc, name) { for (var i = 0; i < doc.definitions.length; i++) { var element = doc.definitions[i]; if (element.name && element.name.value == name) { return element; } } } function oneQuery(doc, operationName) { // Copy the DocumentNode, but clear out the definitions var newDoc = { kind: doc.kind, definitions: [findOperation(doc, operationName)] }; if (doc.hasOwnProperty("loc")) { newDoc.loc = doc.loc; } // Now, for the operation we're running, find any fragments referenced by // it or the fragments it references var opRefs = definitionRefs[operationName] || new Set(); var allRefs = new Set(); var newRefs = new Set(); // IE 11 doesn't support "new Set(iterable)", so we add the members of opRefs to newRefs one by one opRefs.forEach(function(refName) { newRefs.add(refName); }); while (newRefs.size > 0) { var prevRefs = newRefs; newRefs = new Set(); prevRefs.forEach(function(refName) { if (!allRefs.has(refName)) { allRefs.add(refName); var childRefs = definitionRefs[refName] || new Set(); childRefs.forEach(function(childRef) { newRefs.add(childRef); }); } }); } allRefs.forEach(function(refName) { var op = findOperation(doc, refName); if (op) { newDoc.definitions.push(op); } }); return newDoc; } module.exports = doc; module.exports.GetElectionLogEntries = oneQuery(doc, "GetElectionLogEntries"); /***/ }), /***/ "./src/client/operations/get_log_entry.gql": /*!*************************************************!*\ !*** ./src/client/operations/get_log_entry.gql ***! \*************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module */ /*! CommonJS bailout: module.exports is used directly at 119:4-18 */ /***/ ((module) => { var doc = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLogEntry"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"electionUniqueId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},"directives":[]},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"contentHash"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},"directives":[]}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"logEntry"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"electionUniqueId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"electionUniqueId"}}},{"kind":"Argument","name":{"kind":"Name","value":"contentHash"},"value":{"kind":"Variable","name":{"kind":"Name","value":"contentHash"}}}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"},"arguments":[],"directives":[]},{"kind":"Field","name":{"kind":"Name","value":"signedData"},"arguments":[],"directives":[]},{"kind":"Field","name":{"kind":"Name","value":"contentHash"},"arguments":[],"directives":[]}]}}]}}],"loc":{"start":0,"end":199}}; doc.loc.source = {"body":"query GetLogEntry($electionUniqueId: String!, $contentHash: String!) {\n logEntry(electionUniqueId: $electionUniqueId, contentHash: $contentHash) {\n messageId\n signedData\n contentHash\n }\n}\n","name":"GraphQL request","locationOffset":{"line":1,"column":1}}; var names = {}; function unique(defs) { return defs.filter( function(def) { if (def.kind !== 'FragmentDefinition') return true; var name = def.name.value if (names[name]) { return false; } else { names[name] = true; return true; } } ) } // Collect any fragment/type references from a node, adding them to the refs Set function collectFragmentReferences(node, refs) { if (node.kind === "FragmentSpread") { refs.add(node.name.value); } else if (node.kind === "VariableDefinition") { var type = node.type; if (type.kind === "NamedType") { refs.add(type.name.value); } } if (node.selectionSet) { node.selectionSet.selections.forEach(function(selection) { collectFragmentReferences(selection, refs); }); } if (node.variableDefinitions) { node.variableDefinitions.forEach(function(def) { collectFragmentReferences(def, refs); }); } if (node.definitions) { node.definitions.forEach(function(def) { collectFragmentReferences(def, refs); }); } } var definitionRefs = {}; (function extractReferences() { doc.definitions.forEach(function(def) { if (def.name) { var refs = new Set(); collectFragmentReferences(def, refs); definitionRefs[def.name.value] = refs; } }); })(); function findOperation(doc, name) { for (var i = 0; i < doc.definitions.length; i++) { var element = doc.definitions[i]; if (element.name && element.name.value == name) { return element; } } } function oneQuery(doc, operationName) { // Copy the DocumentNode, but clear out the definitions var newDoc = { kind: doc.kind, definitions: [findOperation(doc, operationName)] }; if (doc.hasOwnProperty("loc")) { newDoc.loc = doc.loc; } // Now, for the operation we're running, find any fragments referenced by // it or the fragments it references var opRefs = definitionRefs[operationName] || new Set(); var allRefs = new Set(); var newRefs = new Set(); // IE 11 doesn't support "new Set(iterable)", so we add the members of opRefs to newRefs one by one opRefs.forEach(function(refName) { newRefs.add(refName); }); while (newRefs.size > 0) { var prevRefs = newRefs; newRefs = new Set(); prevRefs.forEach(function(refName) { if (!allRefs.has(refName)) { allRefs.add(refName); var childRefs = definitionRefs[refName] || new Set(); childRefs.forEach(function(childRef) { newRefs.add(childRef); }); } }); } allRefs.forEach(function(refName) { var op = findOperation(doc, refName); if (op) { newDoc.definitions.push(op); } }); return newDoc; } module.exports = doc; module.exports.GetLogEntry = oneQuery(doc, "GetLogEntry"); /***/ }), /***/ "./src/client/operations/process_key_ceremony_step.gql": /*!*************************************************************!*\ !*** ./src/client/operations/process_key_ceremony_step.gql ***! \*************************************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module */ /*! CommonJS bailout: module.exports is used directly at 119:4-18 */ /***/ ((module) => { var doc = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ProcessKeyCeremonyStep"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"messageId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},"directives":[]},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"signedData"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},"directives":[]}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"processKeyCeremonyStep"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"messageId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"messageId"}}},{"kind":"Argument","name":{"kind":"Name","value":"signedData"},"value":{"kind":"Variable","name":{"kind":"Name","value":"signedData"}}}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pendingMessage"},"arguments":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signedData"},"arguments":[],"directives":[]}]}},{"kind":"Field","name":{"kind":"Name","value":"error"},"arguments":[],"directives":[]}]}}]}}],"loc":{"start":0,"end":212}}; doc.loc.source = {"body":"mutation ProcessKeyCeremonyStep($messageId: String!, $signedData: String!) {\n processKeyCeremonyStep(messageId: $messageId, signedData: $signedData) {\n pendingMessage {\n signedData\n }\n error\n }\n}\n","name":"GraphQL request","locationOffset":{"line":1,"column":1}}; var names = {}; function unique(defs) { return defs.filter( function(def) { if (def.kind !== 'FragmentDefinition') return true; var name = def.name.value if (names[name]) { return false; } else { names[name] = true; return true; } } ) } // Collect any fragment/type references from a node, adding them to the refs Set function collectFragmentReferences(node, refs) { if (node.kind === "FragmentSpread") { refs.add(node.name.value); } else if (node.kind === "VariableDefinition") { var type = node.type; if (type.kind === "NamedType") { refs.add(type.name.value); } } if (node.selectionSet) { node.selectionSet.selections.forEach(function(selection) { collectFragmentReferences(selection, refs); }); } if (node.variableDefinitions) { node.variableDefinitions.forEach(function(def) { collectFragmentReferences(def, refs); }); } if (node.definitions) { node.definitions.forEach(function(def) { collectFragmentReferences(def, refs); }); } } var definitionRefs = {}; (function extractReferences() { doc.definitions.forEach(function(def) { if (def.name) { var refs = new Set(); collectFragmentReferences(def, refs); definitionRefs[def.name.value] = refs; } }); })(); function findOperation(doc, name) { for (var i = 0; i < doc.definitions.length; i++) { var element = doc.definitions[i]; if (element.name && element.name.value == name) { return element; } } } function oneQuery(doc, operationName) { // Copy the DocumentNode, but clear out the definitions var newDoc = { kind: doc.kind, definitions: [findOperation(doc, operationName)] }; if (doc.hasOwnProperty("loc")) { newDoc.loc = doc.loc; } // Now, for the operation we're running, find any fragments referenced by // it or the fragments it references var opRefs = definitionRefs[operationName] || new Set(); var allRefs = new Set(); var newRefs = new Set(); // IE 11 doesn't support "new Set(iterable)", so we add the members of opRefs to newRefs one by one opRefs.forEach(function(refName) { newRefs.add(refName); }); while (newRefs.size > 0) { var prevRefs = newRefs; newRefs = new Set(); prevRefs.forEach(function(refName) { if (!allRefs.has(refName)) { allRefs.add(refName); var childRefs = definitionRefs[refName] || new Set(); childRefs.forEach(function(childRef) { newRefs.add(childRef); }); } }); } allRefs.forEach(function(refName) { var op = findOperation(doc, refName); if (op) { newDoc.definitions.push(op); } }); return newDoc; } module.exports = doc; module.exports.ProcessKeyCeremonyStep = oneQuery(doc, "ProcessKeyCeremonyStep"); /***/ }), /***/ "./node_modules/graphql-tag/src/index.js": /*!***********************************************!*\ !*** ./node_modules/graphql-tag/src/index.js ***! \***********************************************/ /*! unknown exports (runtime-defined) */ /*! runtime requirements: module, __webpack_require__ */ /*! CommonJS bailout: module.exports is used directly at 180:0-14 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var parser = __webpack_require__(/*! graphql/language/parser */ "./node_modules/graphql/language/parser.js"); var parse = parser.parse; // Strip insignificant whitespace // Note that this could do a lot more, such as reorder fields etc. function normalize(string) { return string.replace(/[\s,]+/g, ' ').trim(); } // A map docString -> graphql document var docCache = {}; // A map fragmentName -> [normalized source] var fragmentSourceMap = {}; function cacheKeyFromLoc(loc) { return normalize(loc.source.body.substring(loc.start, loc.end)); } // For testing. function resetCaches() { docCache = {}; fragmentSourceMap = {}; } // Take a unstripped parsed document (query/mutation or even fragment), and // check all fragment definitions, checking for name->source uniqueness. // We also want to make sure only unique fragments exist in the document. var printFragmentWarnings = true; function processFragments(ast) { var astFragmentMap = {}; var definitions = []; for (var i = 0; i < ast.definitions.length; i++) { var fragmentDefinition = ast.definitions[i]; if (fragmentDefinition.kind === 'FragmentDefinition') { var fragmentName = fragmentDefinition.name.value; var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); // We know something about this fragment if (fragmentSourceMap.hasOwnProperty(fragmentName) && !fragmentSourceMap[fragmentName][sourceKey]) { // this is a problem because the app developer is trying to register another fragment with // the same name as one previously registered. So, we tell them about it. if (printFragmentWarnings) { console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); } fragmentSourceMap[fragmentName][sourceKey] = true; } else if (!fragmentSourceMap.hasOwnProperty(fragmentName)) { fragmentSourceMap[fragmentName] = {}; fragmentSourceMap[fragmentName][sourceKey] = true; } if (!astFragmentMap[sourceKey]) { astFragmentMap[sourceKey] = true; definitions.push(fragmentDefinition); } } else { definitions.push(fragmentDefinition); } } ast.definitions = definitions; return ast; } function disableFragmentWarnings() { printFragmentWarnings = false; } function stripLoc(doc, removeLocAtThisLevel) { var docType = Object.prototype.toString.call(doc); if (docType === '[object Array]') { return doc.map(function (d) { return stripLoc(d, removeLocAtThisLevel); }); } if (docType !== '[object Object]') { throw new Error('Unexpected input.'); } // We don't want to remove the root loc field so we can use it // for fragment substitution (see below) if (removeLocAtThisLevel && doc.loc) { delete doc.loc; } // https://github.com/apollographql/graphql-tag/issues/40 if (doc.loc) { delete doc.loc.startToken; delete doc.loc.endToken; } var keys = Object.keys(doc); var key; var value; var valueType; for (key in keys) { if (keys.hasOwnProperty(key)) { value = doc[keys[key]]; valueType = Object.prototype.toString.call(value); if (valueType === '[object Object]' || valueType === '[object Array]') { doc[keys[key]] = stripLoc(value, true); } } } return doc; } var experimentalFragmentVariables = false; function parseDocument(doc) { var cacheKey = normalize(doc); if (docCache[cacheKey]) { return docCache[cacheKey]; } var parsed = parse(doc, { experimentalFragmentVariables: experimentalFragmentVariables }); if (!parsed || parsed.kind !== 'Document') { throw new Error('Not a valid GraphQL document.'); } // check that all "new" fragments inside the documents are consistent with // existing fragments of the same name parsed = processFragments(parsed); parsed = stripLoc(parsed, false); docCache[cacheKey] = parsed; return parsed; } function enableExperimentalFragmentVariables() { experimentalFragmentVariables = true; } function disableExperimentalFragmentVariables() { experimentalFragmentVariables = false; } // XXX This should eventually disallow arbitrary string interpolation, like Relay does function gql(/* arguments */) { var args = Array.prototype.slice.call(arguments); var literals = args[0]; // We always get literals[0] and then matching post literals for each arg given var result = (typeof(literals) === "string") ? literals : literals[0]; for (var i = 1; i < args.length; i++) { if (args[i] && args[i].kind && args[i].kind === 'Document') { result += args[i].loc.source.body; } else { result += args[i]; } result += literals[i]; } return parseDocument(result); } // Support typescript, which isn't as nice as Babel about default exports gql.default = gql; gql.resetCaches = resetCaches; gql.disableFragmentWarnings = disableFragmentWarnings; gql.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables; gql.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables; module.exports = gql; /***/ }), /***/ "./node_modules/graphql/error/GraphQLError.js": /*!****************************************************!*\ !*** ./node_modules/graphql/error/GraphQLError.js ***! \****************************************************/ /*! flagged exports */ /*! export GraphQLError [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export printError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.printError = printError; exports.GraphQLError = void 0; var _isObjectLike = _interopRequireDefault(__webpack_require__(/*! ../jsutils/isObjectLike.js */ "./node_modules/graphql/jsutils/isObjectLike.js")); var _symbols = __webpack_require__(/*! ../polyfills/symbols.js */ "./node_modules/graphql/polyfills/symbols.js"); var _location = __webpack_require__(/*! ../language/location.js */ "./node_modules/graphql/language/location.js"); var _printLocation = __webpack_require__(/*! ../language/printLocation.js */ "./node_modules/graphql/language/printLocation.js"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * A GraphQLError describes an Error found during the parse, validate, or * execute phases of performing a GraphQL operation. In addition to a message * and stack trace, it also includes information about the locations in a * GraphQL document and/or execution result that correspond to the Error. */ var GraphQLError = /*#__PURE__*/function (_Error) { _inherits(GraphQLError, _Error); var _super = _createSuper(GraphQLError); /** * A message describing the Error for debugging purposes. * * Enumerable, and appears in the result of JSON.stringify(). * * Note: should be treated as readonly, despite invariant usage. */ /** * An array of { line, column } locations within the source GraphQL document * which correspond to this error. * * Errors during validation often contain multiple locations, for example to * point out two things with the same name. Errors during execution include a * single location, the field which produced the error. * * Enumerable, and appears in the result of JSON.stringify(). */ /** * An array describing the JSON-path into the execution response which * corresponds to this error. Only included for errors during execution. * * Enumerable, and appears in the result of JSON.stringify(). */ /** * An array of GraphQL AST Nodes corresponding to this error. */ /** * The source GraphQL document for the first location of this error. * * Note that if this Error represents more than one node, the source may not * represent nodes after the first node. */ /** * An array of character offsets within the source GraphQL document * which correspond to this error. */ /** * The original error thrown from a field resolver during execution. */ /** * Extension fields to add to the formatted error. */ function GraphQLError(message, nodes, source, positions, path, originalError, extensions) { var _locations2, _source2, _positions2, _extensions2; var _this; _classCallCheck(this, GraphQLError); _this = _super.call(this, message); // Compute list of blame nodes. var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions. var _source = source; if (!_source && _nodes) { var _nodes$0$loc; _source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source; } var _positions = positions; if (!_positions && _nodes) { _positions = _nodes.reduce(function (list, node) { if (node.loc) { list.push(node.loc.start); } return list; }, []); } if (_positions && _positions.length === 0) { _positions = undefined; } var _locations; if (positions && source) { _locations = positions.map(function (pos) { return (0, _location.getLocation)(source, pos); }); } else if (_nodes) { _locations = _nodes.reduce(function (list, node) { if (node.loc) { list.push((0, _location.getLocation)(node.loc.source, node.loc.start)); } return list; }, []); } var _extensions = extensions; if (_extensions == null && originalError != null) { var originalExtensions = originalError.extensions; if ((0, _isObjectLike.default)(originalExtensions)) { _extensions = originalExtensions; } } Object.defineProperties(_assertThisInitialized(_this), { name: { value: 'GraphQLError' }, message: { value: message, // By being enumerable, JSON.stringify will include `message` in the // resulting output. This ensures that the simplest possible GraphQL // service adheres to the spec. enumerable: true, writable: true }, locations: { // Coercing falsy values to undefined ensures they will not be included // in JSON.stringify() when not provided. value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined, // By being enumerable, JSON.stringify will include `locations` in the // resulting output. This ensures that the simplest possible GraphQL // service adheres to the spec. enumerable: _locations != null }, path: { // Coercing falsy values to undefined ensures they will not be included // in JSON.stringify() when not provided. value: path !== null && path !== void 0 ? path : undefined, // By being enumerable, JSON.stringify will include `path` in the // resulting output. This ensures that the simplest possible GraphQL // service adheres to the spec. enumerable: path != null }, nodes: { value: _nodes !== null && _nodes !== void 0 ? _nodes : undefined }, source: { value: (_source2 = _source) !== null && _source2 !== void 0 ? _source2 : undefined }, positions: { value: (_positions2 = _positions) !== null && _positions2 !== void 0 ? _positions2 : undefined }, originalError: { value: originalError }, extensions: { // Coercing falsy values to undefined ensures they will not be included // in JSON.stringify() when not provided. value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined, // By being enumerable, JSON.stringify will include `path` in the // resulting output. This ensures that the simplest possible GraphQL // service adheres to the spec. enumerable: _extensions != null } }); // Include (non-enumerable) stack trace. if (originalError === null || originalError === void 0 ? void 0 : originalError.stack) { Object.defineProperty(_assertThisInitialized(_this), 'stack', { value: originalError.stack, writable: true, configurable: true }); return _possibleConstructorReturn(_this); } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') if (Error.captureStackTrace) { Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError); } else { Object.defineProperty(_assertThisInitialized(_this), 'stack', { value: Error().stack, writable: true, configurable: true }); } return _this; } _createClass(GraphQLError, [{ key: "toString", value: function toString() { return printError(this); } // FIXME: workaround to not break chai comparisons, should be remove in v16 // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet }, { key: _symbols.SYMBOL_TO_STRING_TAG, get: function get() { return 'Object'; } }]); return GraphQLError; }( /*#__PURE__*/_wrapNativeSuper(Error)); /** * Prints a GraphQLError to a string, representing useful location information * about the error's position in the source. */ exports.GraphQLError = GraphQLError; function printError(error) { var output = error.message; if (error.nodes) { for (var _i2 = 0, _error$nodes2 = error.nodes; _i2 < _error$nodes2.length; _i2++) { var node = _error$nodes2[_i2]; if (node.loc) { output += '\n\n' + (0, _printLocation.printLocation)(node.loc); } } } else if (error.source && error.locations) { for (var _i4 = 0, _error$locations2 = error.locations; _i4 < _error$locations2.length; _i4++) { var location = _error$locations2[_i4]; output += '\n\n' + (0, _printLocation.printSourceLocation)(error.source, location); } } return output; } /***/ }), /***/ "./node_modules/graphql/error/syntaxError.js": /*!***************************************************!*\ !*** ./node_modules/graphql/error/syntaxError.js ***! \***************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export syntaxError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.syntaxError = syntaxError; var _GraphQLError = __webpack_require__(/*! ./GraphQLError.js */ "./node_modules/graphql/error/GraphQLError.js"); /** * Produces a GraphQLError representing a syntax error, containing useful * descriptive information about the syntax error's position in the source. */ function syntaxError(source, position, description) { return new _GraphQLError.GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]); } /***/ }), /***/ "./node_modules/graphql/jsutils/defineInspect.js": /*!*******************************************************!*\ !*** ./node_modules/graphql/jsutils/defineInspect.js ***! \*******************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.default = defineInspect; var _invariant = _interopRequireDefault(__webpack_require__(/*! ./invariant.js */ "./node_modules/graphql/jsutils/invariant.js")); var _nodejsCustomInspectSymbol = _interopRequireDefault(__webpack_require__(/*! ./nodejsCustomInspectSymbol.js */ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON` */ function defineInspect(classObject) { var fn = classObject.prototype.toJSON; typeof fn === 'function' || (0, _invariant.default)(0); classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317') if (_nodejsCustomInspectSymbol.default) { classObject.prototype[_nodejsCustomInspectSymbol.default] = fn; } } /***/ }), /***/ "./node_modules/graphql/jsutils/defineInspect.mjs": /*!********************************************************!*\ !*** ./node_modules/graphql/jsutils/defineInspect.mjs ***! \********************************************************/ /*! namespace exports */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => /* binding */ defineInspect /* harmony export */ }); /* harmony import */ var _invariant_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./invariant.mjs */ "./node_modules/graphql/jsutils/invariant.mjs"); /* harmony import */ var _nodejsCustomInspectSymbol_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodejsCustomInspectSymbol.mjs */ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs"); ; /** * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON` */ function defineInspect(classObject) { var fn = classObject.prototype.toJSON; typeof fn === 'function' || (0,_invariant_mjs__WEBPACK_IMPORTED_MODULE_0__.default)(0); classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317') if (_nodejsCustomInspectSymbol_mjs__WEBPACK_IMPORTED_MODULE_1__.default) { classObject.prototype[_nodejsCustomInspectSymbol_mjs__WEBPACK_IMPORTED_MODULE_1__.default] = fn; } } /***/ }), /***/ "./node_modules/graphql/jsutils/devAssert.js": /*!***************************************************!*\ !*** ./node_modules/graphql/jsutils/devAssert.js ***! \***************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.default = devAssert; function devAssert(condition, message) { var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') if (!booleanCondition) { throw new Error(message); } } /***/ }), /***/ "./node_modules/graphql/jsutils/inspect.js": /*!*************************************************!*\ !*** ./node_modules/graphql/jsutils/inspect.js ***! \*************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.default = inspect; var _nodejsCustomInspectSymbol = _interopRequireDefault(__webpack_require__(/*! ./nodejsCustomInspectSymbol.js */ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var MAX_ARRAY_LENGTH = 10; var MAX_RECURSIVE_DEPTH = 2; /** * Used to print values in error messages. */ function inspect(value) { return formatValue(value, []); } function formatValue(value, seenValues) { switch (_typeof(value)) { case 'string': return JSON.stringify(value); case 'function': return value.name ? "[function ".concat(value.name, "]") : '[function]'; case 'object': if (value === null) { return 'null'; } return formatObjectValue(value, seenValues); default: return String(value); } } function formatObjectValue(value, previouslySeenValues) { if (previouslySeenValues.indexOf(value) !== -1) { return '[Circular]'; } var seenValues = [].concat(previouslySeenValues, [value]); var customInspectFn = getCustomFn(value); if (customInspectFn !== undefined) { var customValue = customInspectFn.call(value); // check for infinite recursion if (customValue !== value) { return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); } } else if (Array.isArray(value)) { return formatArray(value, seenValues); } return formatObject(value, seenValues); } function formatObject(object, seenValues) { var keys = Object.keys(object); if (keys.length === 0) { return '{}'; } if (seenValues.length > MAX_RECURSIVE_DEPTH) { return '[' + getObjectTag(object) + ']'; } var properties = keys.map(function (key) { var value = formatValue(object[key], seenValues); return key + ': ' + value; }); return '{ ' + properties.join(', ') + ' }'; } function formatArray(array, seenValues) { if (array.length === 0) { return '[]'; } if (seenValues.length > MAX_RECURSIVE_DEPTH) { return '[Array]'; } var len = Math.min(MAX_ARRAY_LENGTH, array.length); var remaining = array.length - len; var items = []; for (var i = 0; i < len; ++i) { items.push(formatValue(array[i], seenValues)); } if (remaining === 1) { items.push('... 1 more item'); } else if (remaining > 1) { items.push("... ".concat(remaining, " more items")); } return '[' + items.join(', ') + ']'; } function getCustomFn(object) { var customInspectFn = object[String(_nodejsCustomInspectSymbol.default)]; if (typeof customInspectFn === 'function') { return customInspectFn; } if (typeof object.inspect === 'function') { return object.inspect; } } function getObjectTag(object) { var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); if (tag === 'Object' && typeof object.constructor === 'function') { var name = object.constructor.name; if (typeof name === 'string' && name !== '') { return name; } } return tag; } /***/ }), /***/ "./node_modules/graphql/jsutils/inspect.mjs": /*!**************************************************!*\ !*** ./node_modules/graphql/jsutils/inspect.mjs ***! \**************************************************/ /*! namespace exports */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => /* binding */ inspect /* harmony export */ }); /* harmony import */ var _nodejsCustomInspectSymbol_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nodejsCustomInspectSymbol.mjs */ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs"); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /* eslint-disable flowtype/no-weak-types */ var MAX_ARRAY_LENGTH = 10; var MAX_RECURSIVE_DEPTH = 2; /** * Used to print values in error messages. */ function inspect(value) { return formatValue(value, []); } function formatValue(value, seenValues) { switch (_typeof(value)) { case 'string': return JSON.stringify(value); case 'function': return value.name ? "[function ".concat(value.name, "]") : '[function]'; case 'object': if (value === null) { return 'null'; } return formatObjectValue(value, seenValues); default: return String(value); } } function formatObjectValue(value, previouslySeenValues) { if (previouslySeenValues.indexOf(value) !== -1) { return '[Circular]'; } var seenValues = [].concat(previouslySeenValues, [value]); var customInspectFn = getCustomFn(value); if (customInspectFn !== undefined) { var customValue = customInspectFn.call(value); // check for infinite recursion if (customValue !== value) { return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); } } else if (Array.isArray(value)) { return formatArray(value, seenValues); } return formatObject(value, seenValues); } function formatObject(object, seenValues) { var keys = Object.keys(object); if (keys.length === 0) { return '{}'; } if (seenValues.length > MAX_RECURSIVE_DEPTH) { return '[' + getObjectTag(object) + ']'; } var properties = keys.map(function (key) { var value = formatValue(object[key], seenValues); return key + ': ' + value; }); return '{ ' + properties.join(', ') + ' }'; } function formatArray(array, seenValues) { if (array.length === 0) { return '[]'; } if (seenValues.length > MAX_RECURSIVE_DEPTH) { return '[Array]'; } var len = Math.min(MAX_ARRAY_LENGTH, array.length); var remaining = array.length - len; var items = []; for (var i = 0; i < len; ++i) { items.push(formatValue(array[i], seenValues)); } if (remaining === 1) { items.push('... 1 more item'); } else if (remaining > 1) { items.push("... ".concat(remaining, " more items")); } return '[' + items.join(', ') + ']'; } function getCustomFn(object) { var customInspectFn = object[String(_nodejsCustomInspectSymbol_mjs__WEBPACK_IMPORTED_MODULE_0__.default)]; if (typeof customInspectFn === 'function') { return customInspectFn; } if (typeof object.inspect === 'function') { return object.inspect; } } function getObjectTag(object) { var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); if (tag === 'Object' && typeof object.constructor === 'function') { var name = object.constructor.name; if (typeof name === 'string' && name !== '') { return name; } } return tag; } /***/ }), /***/ "./node_modules/graphql/jsutils/instanceOf.js": /*!****************************************************!*\ !*** ./node_modules/graphql/jsutils/instanceOf.js ***! \****************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.default = void 0; /** * A replacement for instanceof which includes an error warning when multi-realm * constructors are detected. */ // See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production // See: https://webpack.js.org/guides/production/ var _default = false ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') // eslint-disable-next-line no-shadow 0 : // eslint-disable-next-line no-shadow function instanceOf(value, constructor) { if (value instanceof constructor) { return true; } if (value) { var valueClass = value.constructor; var className = constructor.name; if (className && valueClass && valueClass.name === className) { throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.")); } } return false; }; exports.default = _default; /***/ }), /***/ "./node_modules/graphql/jsutils/invariant.js": /*!***************************************************!*\ !*** ./node_modules/graphql/jsutils/invariant.js ***! \***************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.default = invariant; function invariant(condition, message) { var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') if (!booleanCondition) { throw new Error(message != null ? message : 'Unexpected invariant triggered.'); } } /***/ }), /***/ "./node_modules/graphql/jsutils/invariant.mjs": /*!****************************************************!*\ !*** ./node_modules/graphql/jsutils/invariant.mjs ***! \****************************************************/ /*! namespace exports */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => /* binding */ invariant /* harmony export */ }); function invariant(condition, message) { var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') if (!booleanCondition) { throw new Error(message != null ? message : 'Unexpected invariant triggered.'); } } /***/ }), /***/ "./node_modules/graphql/jsutils/isObjectLike.js": /*!******************************************************!*\ !*** ./node_modules/graphql/jsutils/isObjectLike.js ***! \******************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.default = isObjectLike; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /** * Return true if `value` is object-like. A value is object-like if it's not * `null` and has a `typeof` result of "object". */ function isObjectLike(value) { return _typeof(value) == 'object' && value !== null; } /***/ }), /***/ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js": /*!*******************************************************************!*\ !*** ./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js ***! \*******************************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.default = void 0; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; var _default = nodejsCustomInspectSymbol; exports.default = _default; /***/ }), /***/ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs": /*!********************************************************************!*\ !*** ./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs ***! \********************************************************************/ /*! namespace exports */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__.r, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ /* harmony export */ }); // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (nodejsCustomInspectSymbol); /***/ }), /***/ "./node_modules/graphql/language/ast.js": /*!**********************************************!*\ !*** ./node_modules/graphql/language/ast.js ***! \**********************************************/ /*! flagged exports */ /*! export Location [provided] [no usage info] [missing usage info prevents renaming] */ /*! export Token [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isNode [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isNode = isNode; exports.Token = exports.Location = void 0; var _defineInspect = _interopRequireDefault(__webpack_require__(/*! ../jsutils/defineInspect.js */ "./node_modules/graphql/jsutils/defineInspect.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Contains a range of UTF-8 character offsets and token references that * identify the region of the source from which the AST derived. */ var Location = /*#__PURE__*/function () { /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The Token at which this Node begins. */ /** * The Token at which this Node ends. */ /** * The Source document the AST represents. */ function Location(startToken, endToken, source) { this.start = startToken.start; this.end = endToken.end; this.startToken = startToken; this.endToken = endToken; this.source = source; } var _proto = Location.prototype; _proto.toJSON = function toJSON() { return { start: this.start, end: this.end }; }; return Location; }(); // Print a simplified form when appearing in `inspect` and `util.inspect`. exports.Location = Location; (0, _defineInspect.default)(Location); /** * Represents a range of characters represented by a lexical token * within a Source. */ var Token = /*#__PURE__*/function () { /** * The kind of Token. */ /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The 1-indexed line number on which this Token appears. */ /** * The 1-indexed column number at which this Token begins. */ /** * For non-punctuation tokens, represents the interpreted value of the token. */ /** * Tokens exist as nodes in a double-linked-list amongst all tokens * including ignored tokens. is always the first node and * the last. */ function Token(kind, start, end, line, column, prev, value) { this.kind = kind; this.start = start; this.end = end; this.line = line; this.column = column; this.value = value; this.prev = prev; this.next = null; } var _proto2 = Token.prototype; _proto2.toJSON = function toJSON() { return { kind: this.kind, value: this.value, line: this.line, column: this.column }; }; return Token; }(); // Print a simplified form when appearing in `inspect` and `util.inspect`. exports.Token = Token; (0, _defineInspect.default)(Token); /** * @internal */ function isNode(maybeNode) { return maybeNode != null && typeof maybeNode.kind === 'string'; } /** * The list of all possible AST node types. */ /***/ }), /***/ "./node_modules/graphql/language/ast.mjs": /*!***********************************************!*\ !*** ./node_modules/graphql/language/ast.mjs ***! \***********************************************/ /*! namespace exports */ /*! export Location [provided] [no usage info] [missing usage info prevents renaming] */ /*! export Token [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isNode [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Location": () => /* binding */ Location, /* harmony export */ "Token": () => /* binding */ Token, /* harmony export */ "isNode": () => /* binding */ isNode /* harmony export */ }); /* harmony import */ var _jsutils_defineInspect_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../jsutils/defineInspect.mjs */ "./node_modules/graphql/jsutils/defineInspect.mjs"); ; /** * Contains a range of UTF-8 character offsets and token references that * identify the region of the source from which the AST derived. */ var Location = /*#__PURE__*/function () { /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The Token at which this Node begins. */ /** * The Token at which this Node ends. */ /** * The Source document the AST represents. */ function Location(startToken, endToken, source) { this.start = startToken.start; this.end = endToken.end; this.startToken = startToken; this.endToken = endToken; this.source = source; } var _proto = Location.prototype; _proto.toJSON = function toJSON() { return { start: this.start, end: this.end }; }; return Location; }(); // Print a simplified form when appearing in `inspect` and `util.inspect`. (0,_jsutils_defineInspect_mjs__WEBPACK_IMPORTED_MODULE_0__.default)(Location); /** * Represents a range of characters represented by a lexical token * within a Source. */ var Token = /*#__PURE__*/function () { /** * The kind of Token. */ /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The 1-indexed line number on which this Token appears. */ /** * The 1-indexed column number at which this Token begins. */ /** * For non-punctuation tokens, represents the interpreted value of the token. */ /** * Tokens exist as nodes in a double-linked-list amongst all tokens * including ignored tokens. is always the first node and * the last. */ function Token(kind, start, end, line, column, prev, value) { this.kind = kind; this.start = start; this.end = end; this.line = line; this.column = column; this.value = value; this.prev = prev; this.next = null; } var _proto2 = Token.prototype; _proto2.toJSON = function toJSON() { return { kind: this.kind, value: this.value, line: this.line, column: this.column }; }; return Token; }(); // Print a simplified form when appearing in `inspect` and `util.inspect`. (0,_jsutils_defineInspect_mjs__WEBPACK_IMPORTED_MODULE_0__.default)(Token); /** * @internal */ function isNode(maybeNode) { return maybeNode != null && typeof maybeNode.kind === 'string'; } /** * The list of all possible AST node types. */ /***/ }), /***/ "./node_modules/graphql/language/blockString.js": /*!******************************************************!*\ !*** ./node_modules/graphql/language/blockString.js ***! \******************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export dedentBlockStringValue [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getBlockStringIndentation [provided] [no usage info] [missing usage info prevents renaming] */ /*! export printBlockString [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.dedentBlockStringValue = dedentBlockStringValue; exports.getBlockStringIndentation = getBlockStringIndentation; exports.printBlockString = printBlockString; /** * Produces the value of a block string from its parsed raw value, similar to * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. * * This implements the GraphQL spec's BlockStringValue() static algorithm. * * @internal */ function dedentBlockStringValue(rawString) { // Expand a block string's raw value into independent lines. var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. var commonIndent = getBlockStringIndentation(rawString); if (commonIndent !== 0) { for (var i = 1; i < lines.length; i++) { lines[i] = lines[i].slice(commonIndent); } } // Remove leading and trailing blank lines. var startLine = 0; while (startLine < lines.length && isBlank(lines[startLine])) { ++startLine; } var endLine = lines.length; while (endLine > startLine && isBlank(lines[endLine - 1])) { --endLine; } // Return a string of the lines joined with U+000A. return lines.slice(startLine, endLine).join('\n'); } function isBlank(str) { for (var i = 0; i < str.length; ++i) { if (str[i] !== ' ' && str[i] !== '\t') { return false; } } return true; } /** * @internal */ function getBlockStringIndentation(value) { var _commonIndent; var isFirstLine = true; var isEmptyLine = true; var indent = 0; var commonIndent = null; for (var i = 0; i < value.length; ++i) { switch (value.charCodeAt(i)) { case 13: // \r if (value.charCodeAt(i + 1) === 10) { ++i; // skip \r\n as one symbol } // falls through case 10: // \n isFirstLine = false; isEmptyLine = true; indent = 0; break; case 9: // \t case 32: // ++indent; break; default: if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) { commonIndent = indent; } isEmptyLine = false; } } return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0; } /** * Print a block string in the indented block form by adding a leading and * trailing blank line. However, if a block string starts with whitespace and is * a single-line, adding a leading blank line would strip that whitespace. * * @internal */ function printBlockString(value) { var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var isSingleLine = value.indexOf('\n') === -1; var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; var hasTrailingQuote = value[value.length - 1] === '"'; var hasTrailingSlash = value[value.length - 1] === '\\'; var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines; var result = ''; // Format a multi-line block quote to account for leading space. if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { result += '\n' + indentation; } result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; if (printAsMultipleLines) { result += '\n'; } return '"""' + result.replace(/"""/g, '\\"""') + '"""'; } /***/ }), /***/ "./node_modules/graphql/language/blockString.mjs": /*!*******************************************************!*\ !*** ./node_modules/graphql/language/blockString.mjs ***! \*******************************************************/ /*! namespace exports */ /*! export dedentBlockStringValue [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getBlockStringIndentation [provided] [no usage info] [missing usage info prevents renaming] */ /*! export printBlockString [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "dedentBlockStringValue": () => /* binding */ dedentBlockStringValue, /* harmony export */ "getBlockStringIndentation": () => /* binding */ getBlockStringIndentation, /* harmony export */ "printBlockString": () => /* binding */ printBlockString /* harmony export */ }); /** * Produces the value of a block string from its parsed raw value, similar to * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. * * This implements the GraphQL spec's BlockStringValue() static algorithm. * * @internal */ function dedentBlockStringValue(rawString) { // Expand a block string's raw value into independent lines. var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. var commonIndent = getBlockStringIndentation(rawString); if (commonIndent !== 0) { for (var i = 1; i < lines.length; i++) { lines[i] = lines[i].slice(commonIndent); } } // Remove leading and trailing blank lines. var startLine = 0; while (startLine < lines.length && isBlank(lines[startLine])) { ++startLine; } var endLine = lines.length; while (endLine > startLine && isBlank(lines[endLine - 1])) { --endLine; } // Return a string of the lines joined with U+000A. return lines.slice(startLine, endLine).join('\n'); } function isBlank(str) { for (var i = 0; i < str.length; ++i) { if (str[i] !== ' ' && str[i] !== '\t') { return false; } } return true; } /** * @internal */ function getBlockStringIndentation(value) { var _commonIndent; var isFirstLine = true; var isEmptyLine = true; var indent = 0; var commonIndent = null; for (var i = 0; i < value.length; ++i) { switch (value.charCodeAt(i)) { case 13: // \r if (value.charCodeAt(i + 1) === 10) { ++i; // skip \r\n as one symbol } // falls through case 10: // \n isFirstLine = false; isEmptyLine = true; indent = 0; break; case 9: // \t case 32: // ++indent; break; default: if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) { commonIndent = indent; } isEmptyLine = false; } } return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0; } /** * Print a block string in the indented block form by adding a leading and * trailing blank line. However, if a block string starts with whitespace and is * a single-line, adding a leading blank line would strip that whitespace. * * @internal */ function printBlockString(value) { var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var isSingleLine = value.indexOf('\n') === -1; var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; var hasTrailingQuote = value[value.length - 1] === '"'; var hasTrailingSlash = value[value.length - 1] === '\\'; var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines; var result = ''; // Format a multi-line block quote to account for leading space. if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { result += '\n' + indentation; } result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; if (printAsMultipleLines) { result += '\n'; } return '"""' + result.replace(/"""/g, '\\"""') + '"""'; } /***/ }), /***/ "./node_modules/graphql/language/directiveLocation.js": /*!************************************************************!*\ !*** ./node_modules/graphql/language/directiveLocation.js ***! \************************************************************/ /*! flagged exports */ /*! export DirectiveLocation [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DirectiveLocation = void 0; /** * The set of allowed directive location values. */ var DirectiveLocation = Object.freeze({ // Request Definitions QUERY: 'QUERY', MUTATION: 'MUTATION', SUBSCRIPTION: 'SUBSCRIPTION', FIELD: 'FIELD', FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION', FRAGMENT_SPREAD: 'FRAGMENT_SPREAD', INLINE_FRAGMENT: 'INLINE_FRAGMENT', VARIABLE_DEFINITION: 'VARIABLE_DEFINITION', // Type System Definitions SCHEMA: 'SCHEMA', SCALAR: 'SCALAR', OBJECT: 'OBJECT', FIELD_DEFINITION: 'FIELD_DEFINITION', ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION', INTERFACE: 'INTERFACE', UNION: 'UNION', ENUM: 'ENUM', ENUM_VALUE: 'ENUM_VALUE', INPUT_OBJECT: 'INPUT_OBJECT', INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION' }); /** * The enum type representing the directive location values. */ exports.DirectiveLocation = DirectiveLocation; /***/ }), /***/ "./node_modules/graphql/language/kinds.js": /*!************************************************!*\ !*** ./node_modules/graphql/language/kinds.js ***! \************************************************/ /*! flagged exports */ /*! export Kind [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Kind = void 0; /** * The set of allowed kind values for AST nodes. */ var Kind = Object.freeze({ // Name NAME: 'Name', // Document DOCUMENT: 'Document', OPERATION_DEFINITION: 'OperationDefinition', VARIABLE_DEFINITION: 'VariableDefinition', SELECTION_SET: 'SelectionSet', FIELD: 'Field', ARGUMENT: 'Argument', // Fragments FRAGMENT_SPREAD: 'FragmentSpread', INLINE_FRAGMENT: 'InlineFragment', FRAGMENT_DEFINITION: 'FragmentDefinition', // Values VARIABLE: 'Variable', INT: 'IntValue', FLOAT: 'FloatValue', STRING: 'StringValue', BOOLEAN: 'BooleanValue', NULL: 'NullValue', ENUM: 'EnumValue', LIST: 'ListValue', OBJECT: 'ObjectValue', OBJECT_FIELD: 'ObjectField', // Directives DIRECTIVE: 'Directive', // Types NAMED_TYPE: 'NamedType', LIST_TYPE: 'ListType', NON_NULL_TYPE: 'NonNullType', // Type System Definitions SCHEMA_DEFINITION: 'SchemaDefinition', OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', // Type Definitions SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', FIELD_DEFINITION: 'FieldDefinition', INPUT_VALUE_DEFINITION: 'InputValueDefinition', INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', UNION_TYPE_DEFINITION: 'UnionTypeDefinition', ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', ENUM_VALUE_DEFINITION: 'EnumValueDefinition', INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', // Directive Definitions DIRECTIVE_DEFINITION: 'DirectiveDefinition', // Type System Extensions SCHEMA_EXTENSION: 'SchemaExtension', // Type Extensions SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', UNION_TYPE_EXTENSION: 'UnionTypeExtension', ENUM_TYPE_EXTENSION: 'EnumTypeExtension', INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension' }); /** * The enum type representing the possible kind values of AST nodes. */ exports.Kind = Kind; /***/ }), /***/ "./node_modules/graphql/language/lexer.js": /*!************************************************!*\ !*** ./node_modules/graphql/language/lexer.js ***! \************************************************/ /*! flagged exports */ /*! export Lexer [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isPunctuatorTokenKind [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isPunctuatorTokenKind = isPunctuatorTokenKind; exports.Lexer = void 0; var _syntaxError = __webpack_require__(/*! ../error/syntaxError.js */ "./node_modules/graphql/error/syntaxError.js"); var _ast = __webpack_require__(/*! ./ast.js */ "./node_modules/graphql/language/ast.js"); var _tokenKind = __webpack_require__(/*! ./tokenKind.js */ "./node_modules/graphql/language/tokenKind.js"); var _blockString = __webpack_require__(/*! ./blockString.js */ "./node_modules/graphql/language/blockString.js"); /** * Given a Source object, creates a Lexer for that source. * A Lexer is a stateful stream generator in that every time * it is advanced, it returns the next token in the Source. Assuming the * source lexes, the final Token emitted by the lexer will be of kind * EOF, after which the lexer will repeatedly return the same EOF token * whenever called. */ var Lexer = /*#__PURE__*/function () { /** * The previously focused non-ignored token. */ /** * The currently focused non-ignored token. */ /** * The (1-indexed) line containing the current token. */ /** * The character offset at which the current line begins. */ function Lexer(source) { var startOfFileToken = new _ast.Token(_tokenKind.TokenKind.SOF, 0, 0, 0, 0, null); this.source = source; this.lastToken = startOfFileToken; this.token = startOfFileToken; this.line = 1; this.lineStart = 0; } /** * Advances the token stream to the next non-ignored token. */ var _proto = Lexer.prototype; _proto.advance = function advance() { this.lastToken = this.token; var token = this.token = this.lookahead(); return token; } /** * Looks ahead and returns the next non-ignored token, but does not change * the state of Lexer. */ ; _proto.lookahead = function lookahead() { var token = this.token; if (token.kind !== _tokenKind.TokenKind.EOF) { do { var _token$next; // Note: next is only mutable during parsing, so we cast to allow this. token = (_token$next = token.next) !== null && _token$next !== void 0 ? _token$next : token.next = readToken(this, token); } while (token.kind === _tokenKind.TokenKind.COMMENT); } return token; }; return Lexer; }(); /** * @internal */ exports.Lexer = Lexer; function isPunctuatorTokenKind(kind) { return kind === _tokenKind.TokenKind.BANG || kind === _tokenKind.TokenKind.DOLLAR || kind === _tokenKind.TokenKind.AMP || kind === _tokenKind.TokenKind.PAREN_L || kind === _tokenKind.TokenKind.PAREN_R || kind === _tokenKind.TokenKind.SPREAD || kind === _tokenKind.TokenKind.COLON || kind === _tokenKind.TokenKind.EQUALS || kind === _tokenKind.TokenKind.AT || kind === _tokenKind.TokenKind.BRACKET_L || kind === _tokenKind.TokenKind.BRACKET_R || kind === _tokenKind.TokenKind.BRACE_L || kind === _tokenKind.TokenKind.PIPE || kind === _tokenKind.TokenKind.BRACE_R; } function printCharCode(code) { return (// NaN/undefined represents access beyond the end of the file. isNaN(code) ? _tokenKind.TokenKind.EOF : // Trust JSON for ASCII. code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form. "\"\\u".concat(('00' + code.toString(16).toUpperCase()).slice(-4), "\"") ); } /** * Gets the next token from the source starting at the given position. * * This skips over whitespace until it finds the next lexable token, then lexes * punctuators immediately or calls the appropriate helper function for more * complicated tokens. */ function readToken(lexer, prev) { var source = lexer.source; var body = source.body; var bodyLength = body.length; var pos = prev.end; while (pos < bodyLength) { var code = body.charCodeAt(pos); var _line = lexer.line; var _col = 1 + pos - lexer.lineStart; // SourceCharacter switch (code) { case 0xfeff: // case 9: // \t case 32: // case 44: // , ++pos; continue; case 10: // \n ++pos; ++lexer.line; lexer.lineStart = pos; continue; case 13: // \r if (body.charCodeAt(pos + 1) === 10) { pos += 2; } else { ++pos; } ++lexer.line; lexer.lineStart = pos; continue; case 33: // ! return new _ast.Token(_tokenKind.TokenKind.BANG, pos, pos + 1, _line, _col, prev); case 35: // # return readComment(source, pos, _line, _col, prev); case 36: // $ return new _ast.Token(_tokenKind.TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev); case 38: // & return new _ast.Token(_tokenKind.TokenKind.AMP, pos, pos + 1, _line, _col, prev); case 40: // ( return new _ast.Token(_tokenKind.TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev); case 41: // ) return new _ast.Token(_tokenKind.TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev); case 46: // . if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) { return new _ast.Token(_tokenKind.TokenKind.SPREAD, pos, pos + 3, _line, _col, prev); } break; case 58: // : return new _ast.Token(_tokenKind.TokenKind.COLON, pos, pos + 1, _line, _col, prev); case 61: // = return new _ast.Token(_tokenKind.TokenKind.EQUALS, pos, pos + 1, _line, _col, prev); case 64: // @ return new _ast.Token(_tokenKind.TokenKind.AT, pos, pos + 1, _line, _col, prev); case 91: // [ return new _ast.Token(_tokenKind.TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev); case 93: // ] return new _ast.Token(_tokenKind.TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev); case 123: // { return new _ast.Token(_tokenKind.TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev); case 124: // | return new _ast.Token(_tokenKind.TokenKind.PIPE, pos, pos + 1, _line, _col, prev); case 125: // } return new _ast.Token(_tokenKind.TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev); case 34: // " if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) { return readBlockString(source, pos, _line, _col, prev, lexer); } return readString(source, pos, _line, _col, prev); case 45: // - case 48: // 0 case 49: // 1 case 50: // 2 case 51: // 3 case 52: // 4 case 53: // 5 case 54: // 6 case 55: // 7 case 56: // 8 case 57: // 9 return readNumber(source, pos, code, _line, _col, prev); case 65: // A case 66: // B case 67: // C case 68: // D case 69: // E case 70: // F case 71: // G case 72: // H case 73: // I case 74: // J case 75: // K case 76: // L case 77: // M case 78: // N case 79: // O case 80: // P case 81: // Q case 82: // R case 83: // S case 84: // T case 85: // U case 86: // V case 87: // W case 88: // X case 89: // Y case 90: // Z case 95: // _ case 97: // a case 98: // b case 99: // c case 100: // d case 101: // e case 102: // f case 103: // g case 104: // h case 105: // i case 106: // j case 107: // k case 108: // l case 109: // m case 110: // n case 111: // o case 112: // p case 113: // q case 114: // r case 115: // s case 116: // t case 117: // u case 118: // v case 119: // w case 120: // x case 121: // y case 122: // z return readName(source, pos, _line, _col, prev); } throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code)); } var line = lexer.line; var col = 1 + pos - lexer.lineStart; return new _ast.Token(_tokenKind.TokenKind.EOF, bodyLength, bodyLength, line, col, prev); } /** * Report a message that an unexpected character was encountered. */ function unexpectedCharacterMessage(code) { if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { return "Cannot contain the invalid character ".concat(printCharCode(code), "."); } if (code === 39) { // ' return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; } return "Cannot parse the unexpected character ".concat(printCharCode(code), "."); } /** * Reads a comment token from the source file. * * #[\u0009\u0020-\uFFFF]* */ function readComment(source, start, line, col, prev) { var body = source.body; var code; var position = start; do { code = body.charCodeAt(++position); } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator code > 0x001f || code === 0x0009)); return new _ast.Token(_tokenKind.TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position)); } /** * Reads a number token from the source file, either a float * or an int depending on whether a decimal point appears. * * Int: -?(0|[1-9][0-9]*) * Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? */ function readNumber(source, start, firstCode, line, col, prev) { var body = source.body; var code = firstCode; var position = start; var isFloat = false; if (code === 45) { // - code = body.charCodeAt(++position); } if (code === 48) { // 0 code = body.charCodeAt(++position); if (code >= 48 && code <= 57) { throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, unexpected digit after 0: ".concat(printCharCode(code), ".")); } } else { position = readDigits(source, position, code); code = body.charCodeAt(position); } if (code === 46) { // . isFloat = true; code = body.charCodeAt(++position); position = readDigits(source, position, code); code = body.charCodeAt(position); } if (code === 69 || code === 101) { // E e isFloat = true; code = body.charCodeAt(++position); if (code === 43 || code === 45) { // + - code = body.charCodeAt(++position); } position = readDigits(source, position, code); code = body.charCodeAt(position); } // Numbers cannot be followed by . or NameStart if (code === 46 || isNameStart(code)) { throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); } return new _ast.Token(isFloat ? _tokenKind.TokenKind.FLOAT : _tokenKind.TokenKind.INT, start, position, line, col, prev, body.slice(start, position)); } /** * Returns the new position in the source after reading digits. */ function readDigits(source, start, firstCode) { var body = source.body; var position = start; var code = firstCode; if (code >= 48 && code <= 57) { // 0 - 9 do { code = body.charCodeAt(++position); } while (code >= 48 && code <= 57); // 0 - 9 return position; } throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); } /** * Reads a string token from the source file. * * "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" */ function readString(source, start, line, col, prev) { var body = source.body; var position = start + 1; var chunkStart = position; var code = 0; var value = ''; while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator code !== 0x000a && code !== 0x000d) { // Closing Quote (") if (code === 34) { value += body.slice(chunkStart, position); return new _ast.Token(_tokenKind.TokenKind.STRING, start, position + 1, line, col, prev, value); } // SourceCharacter if (code < 0x0020 && code !== 0x0009) { throw (0, _syntaxError.syntaxError)(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); } ++position; if (code === 92) { // \ value += body.slice(chunkStart, position - 1); code = body.charCodeAt(position); switch (code) { case 34: value += '"'; break; case 47: value += '/'; break; case 92: value += '\\'; break; case 98: value += '\b'; break; case 102: value += '\f'; break; case 110: value += '\n'; break; case 114: value += '\r'; break; case 116: value += '\t'; break; case 117: { // uXXXX var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); if (charCode < 0) { var invalidSequence = body.slice(position + 1, position + 5); throw (0, _syntaxError.syntaxError)(source, position, "Invalid character escape sequence: \\u".concat(invalidSequence, ".")); } value += String.fromCharCode(charCode); position += 4; break; } default: throw (0, _syntaxError.syntaxError)(source, position, "Invalid character escape sequence: \\".concat(String.fromCharCode(code), ".")); } ++position; chunkStart = position; } } throw (0, _syntaxError.syntaxError)(source, position, 'Unterminated string.'); } /** * Reads a block string token from the source file. * * """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" */ function readBlockString(source, start, line, col, prev, lexer) { var body = source.body; var position = start + 3; var chunkStart = position; var code = 0; var rawValue = ''; while (position < body.length && !isNaN(code = body.charCodeAt(position))) { // Closing Triple-Quote (""") if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { rawValue += body.slice(chunkStart, position); return new _ast.Token(_tokenKind.TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, (0, _blockString.dedentBlockStringValue)(rawValue)); } // SourceCharacter if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { throw (0, _syntaxError.syntaxError)(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); } if (code === 10) { // new line ++position; ++lexer.line; lexer.lineStart = position; } else if (code === 13) { // carriage return if (body.charCodeAt(position + 1) === 10) { position += 2; } else { ++position; } ++lexer.line; lexer.lineStart = position; } else if ( // Escape Triple-Quote (\""") code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) { rawValue += body.slice(chunkStart, position) + '"""'; position += 4; chunkStart = position; } else { ++position; } } throw (0, _syntaxError.syntaxError)(source, position, 'Unterminated string.'); } /** * Converts four hexadecimal chars to the integer that the * string represents. For example, uniCharCode('0','0','0','f') * will return 15, and uniCharCode('0','0','f','f') returns 255. * * Returns a negative number on error, if a char was invalid. * * This is implemented by noting that char2hex() returns -1 on error, * which means the result of ORing the char2hex() will also be negative. */ function uniCharCode(a, b, c, d) { return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d); } /** * Converts a hex character to its integer value. * '0' becomes 0, '9' becomes 9 * 'A' becomes 10, 'F' becomes 15 * 'a' becomes 10, 'f' becomes 15 * * Returns -1 on error. */ function char2hex(a) { return a >= 48 && a <= 57 ? a - 48 // 0-9 : a >= 65 && a <= 70 ? a - 55 // A-F : a >= 97 && a <= 102 ? a - 87 // a-f : -1; } /** * Reads an alphanumeric + underscore name from the source. * * [_A-Za-z][_0-9A-Za-z]* */ function readName(source, start, line, col, prev) { var body = source.body; var bodyLength = body.length; var position = start + 1; var code = 0; while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _ code >= 48 && code <= 57 || // 0-9 code >= 65 && code <= 90 || // A-Z code >= 97 && code <= 122) // a-z ) { ++position; } return new _ast.Token(_tokenKind.TokenKind.NAME, start, position, line, col, prev, body.slice(start, position)); } // _ A-Z a-z function isNameStart(code) { return code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122; } /***/ }), /***/ "./node_modules/graphql/language/location.js": /*!***************************************************!*\ !*** ./node_modules/graphql/language/location.js ***! \***************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getLocation [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getLocation = getLocation; /** * Represents a location in a Source. */ /** * Takes a Source and a UTF-8 character offset, and returns the corresponding * line and column as a SourceLocation. */ function getLocation(source, position) { var lineRegexp = /\r\n|[\n\r]/g; var line = 1; var column = position + 1; var match; while ((match = lineRegexp.exec(source.body)) && match.index < position) { line += 1; column = position + 1 - (match.index + match[0].length); } return { line: line, column: column }; } /***/ }), /***/ "./node_modules/graphql/language/parser.js": /*!*************************************************!*\ !*** ./node_modules/graphql/language/parser.js ***! \*************************************************/ /*! flagged exports */ /*! export Parser [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export parse [provided] [no usage info] [missing usage info prevents renaming] */ /*! export parseType [provided] [no usage info] [missing usage info prevents renaming] */ /*! export parseValue [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.parse = parse; exports.parseValue = parseValue; exports.parseType = parseType; exports.Parser = void 0; var _syntaxError = __webpack_require__(/*! ../error/syntaxError.js */ "./node_modules/graphql/error/syntaxError.js"); var _kinds = __webpack_require__(/*! ./kinds.js */ "./node_modules/graphql/language/kinds.js"); var _ast = __webpack_require__(/*! ./ast.js */ "./node_modules/graphql/language/ast.js"); var _tokenKind = __webpack_require__(/*! ./tokenKind.js */ "./node_modules/graphql/language/tokenKind.js"); var _source = __webpack_require__(/*! ./source.js */ "./node_modules/graphql/language/source.js"); var _directiveLocation = __webpack_require__(/*! ./directiveLocation.js */ "./node_modules/graphql/language/directiveLocation.js"); var _lexer = __webpack_require__(/*! ./lexer.js */ "./node_modules/graphql/language/lexer.js"); /** * Given a GraphQL source, parses it into a Document. * Throws GraphQLError if a syntax error is encountered. */ function parse(source, options) { var parser = new Parser(source, options); return parser.parseDocument(); } /** * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for * that value. * Throws GraphQLError if a syntax error is encountered. * * This is useful within tools that operate upon GraphQL Values directly and * in isolation of complete GraphQL documents. * * Consider providing the results to the utility function: valueFromAST(). */ function parseValue(source, options) { var parser = new Parser(source, options); parser.expectToken(_tokenKind.TokenKind.SOF); var value = parser.parseValueLiteral(false); parser.expectToken(_tokenKind.TokenKind.EOF); return value; } /** * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for * that type. * Throws GraphQLError if a syntax error is encountered. * * This is useful within tools that operate upon GraphQL Types directly and * in isolation of complete GraphQL documents. * * Consider providing the results to the utility function: typeFromAST(). */ function parseType(source, options) { var parser = new Parser(source, options); parser.expectToken(_tokenKind.TokenKind.SOF); var type = parser.parseTypeReference(); parser.expectToken(_tokenKind.TokenKind.EOF); return type; } /** * This class is exported only to assist people in implementing their own parsers * without duplicating too much code and should be used only as last resort for cases * such as experimental syntax or if certain features could not be contributed upstream. * * It is still part of the internal API and is versioned, so any changes to it are never * considered breaking changes. If you still need to support multiple versions of the * library, please use the `versionInfo` variable for version detection. * * @internal */ var Parser = /*#__PURE__*/function () { function Parser(source, options) { var sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source); this._lexer = new _lexer.Lexer(sourceObj); this._options = options; } /** * Converts a name lex token into a name parse node. */ var _proto = Parser.prototype; _proto.parseName = function parseName() { var token = this.expectToken(_tokenKind.TokenKind.NAME); return { kind: _kinds.Kind.NAME, value: token.value, loc: this.loc(token) }; } // Implements the parsing rules in the Document section. /** * Document : Definition+ */ ; _proto.parseDocument = function parseDocument() { var start = this._lexer.token; return { kind: _kinds.Kind.DOCUMENT, definitions: this.many(_tokenKind.TokenKind.SOF, this.parseDefinition, _tokenKind.TokenKind.EOF), loc: this.loc(start) }; } /** * Definition : * - ExecutableDefinition * - TypeSystemDefinition * - TypeSystemExtension * * ExecutableDefinition : * - OperationDefinition * - FragmentDefinition */ ; _proto.parseDefinition = function parseDefinition() { if (this.peek(_tokenKind.TokenKind.NAME)) { switch (this._lexer.token.value) { case 'query': case 'mutation': case 'subscription': return this.parseOperationDefinition(); case 'fragment': return this.parseFragmentDefinition(); case 'schema': case 'scalar': case 'type': case 'interface': case 'union': case 'enum': case 'input': case 'directive': return this.parseTypeSystemDefinition(); case 'extend': return this.parseTypeSystemExtension(); } } else if (this.peek(_tokenKind.TokenKind.BRACE_L)) { return this.parseOperationDefinition(); } else if (this.peekDescription()) { return this.parseTypeSystemDefinition(); } throw this.unexpected(); } // Implements the parsing rules in the Operations section. /** * OperationDefinition : * - SelectionSet * - OperationType Name? VariableDefinitions? Directives? SelectionSet */ ; _proto.parseOperationDefinition = function parseOperationDefinition() { var start = this._lexer.token; if (this.peek(_tokenKind.TokenKind.BRACE_L)) { return { kind: _kinds.Kind.OPERATION_DEFINITION, operation: 'query', name: undefined, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet(), loc: this.loc(start) }; } var operation = this.parseOperationType(); var name; if (this.peek(_tokenKind.TokenKind.NAME)) { name = this.parseName(); } return { kind: _kinds.Kind.OPERATION_DEFINITION, operation: operation, name: name, variableDefinitions: this.parseVariableDefinitions(), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet(), loc: this.loc(start) }; } /** * OperationType : one of query mutation subscription */ ; _proto.parseOperationType = function parseOperationType() { var operationToken = this.expectToken(_tokenKind.TokenKind.NAME); switch (operationToken.value) { case 'query': return 'query'; case 'mutation': return 'mutation'; case 'subscription': return 'subscription'; } throw this.unexpected(operationToken); } /** * VariableDefinitions : ( VariableDefinition+ ) */ ; _proto.parseVariableDefinitions = function parseVariableDefinitions() { return this.optionalMany(_tokenKind.TokenKind.PAREN_L, this.parseVariableDefinition, _tokenKind.TokenKind.PAREN_R); } /** * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? */ ; _proto.parseVariableDefinition = function parseVariableDefinition() { var start = this._lexer.token; return { kind: _kinds.Kind.VARIABLE_DEFINITION, variable: this.parseVariable(), type: (this.expectToken(_tokenKind.TokenKind.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) ? this.parseValueLiteral(true) : undefined, directives: this.parseDirectives(true), loc: this.loc(start) }; } /** * Variable : $ Name */ ; _proto.parseVariable = function parseVariable() { var start = this._lexer.token; this.expectToken(_tokenKind.TokenKind.DOLLAR); return { kind: _kinds.Kind.VARIABLE, name: this.parseName(), loc: this.loc(start) }; } /** * SelectionSet : { Selection+ } */ ; _proto.parseSelectionSet = function parseSelectionSet() { var start = this._lexer.token; return { kind: _kinds.Kind.SELECTION_SET, selections: this.many(_tokenKind.TokenKind.BRACE_L, this.parseSelection, _tokenKind.TokenKind.BRACE_R), loc: this.loc(start) }; } /** * Selection : * - Field * - FragmentSpread * - InlineFragment */ ; _proto.parseSelection = function parseSelection() { return this.peek(_tokenKind.TokenKind.SPREAD) ? this.parseFragment() : this.parseField(); } /** * Field : Alias? Name Arguments? Directives? SelectionSet? * * Alias : Name : */ ; _proto.parseField = function parseField() { var start = this._lexer.token; var nameOrAlias = this.parseName(); var alias; var name; if (this.expectOptionalToken(_tokenKind.TokenKind.COLON)) { alias = nameOrAlias; name = this.parseName(); } else { name = nameOrAlias; } return { kind: _kinds.Kind.FIELD, alias: alias, name: name, arguments: this.parseArguments(false), directives: this.parseDirectives(false), selectionSet: this.peek(_tokenKind.TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined, loc: this.loc(start) }; } /** * Arguments[Const] : ( Argument[?Const]+ ) */ ; _proto.parseArguments = function parseArguments(isConst) { var item = isConst ? this.parseConstArgument : this.parseArgument; return this.optionalMany(_tokenKind.TokenKind.PAREN_L, item, _tokenKind.TokenKind.PAREN_R); } /** * Argument[Const] : Name : Value[?Const] */ ; _proto.parseArgument = function parseArgument() { var start = this._lexer.token; var name = this.parseName(); this.expectToken(_tokenKind.TokenKind.COLON); return { kind: _kinds.Kind.ARGUMENT, name: name, value: this.parseValueLiteral(false), loc: this.loc(start) }; }; _proto.parseConstArgument = function parseConstArgument() { var start = this._lexer.token; return { kind: _kinds.Kind.ARGUMENT, name: this.parseName(), value: (this.expectToken(_tokenKind.TokenKind.COLON), this.parseValueLiteral(true)), loc: this.loc(start) }; } // Implements the parsing rules in the Fragments section. /** * Corresponds to both FragmentSpread and InlineFragment in the spec. * * FragmentSpread : ... FragmentName Directives? * * InlineFragment : ... TypeCondition? Directives? SelectionSet */ ; _proto.parseFragment = function parseFragment() { var start = this._lexer.token; this.expectToken(_tokenKind.TokenKind.SPREAD); var hasTypeCondition = this.expectOptionalKeyword('on'); if (!hasTypeCondition && this.peek(_tokenKind.TokenKind.NAME)) { return { kind: _kinds.Kind.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(false), loc: this.loc(start) }; } return { kind: _kinds.Kind.INLINE_FRAGMENT, typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet(), loc: this.loc(start) }; } /** * FragmentDefinition : * - fragment FragmentName on TypeCondition Directives? SelectionSet * * TypeCondition : NamedType */ ; _proto.parseFragmentDefinition = function parseFragmentDefinition() { var _this$_options; var start = this._lexer.token; this.expectKeyword('fragment'); // Experimental support for defining variables within fragments changes // the grammar of FragmentDefinition: // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet if (((_this$_options = this._options) === null || _this$_options === void 0 ? void 0 : _this$_options.experimentalFragmentVariables) === true) { return { kind: _kinds.Kind.FRAGMENT_DEFINITION, name: this.parseFragmentName(), variableDefinitions: this.parseVariableDefinitions(), typeCondition: (this.expectKeyword('on'), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet(), loc: this.loc(start) }; } return { kind: _kinds.Kind.FRAGMENT_DEFINITION, name: this.parseFragmentName(), typeCondition: (this.expectKeyword('on'), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet(), loc: this.loc(start) }; } /** * FragmentName : Name but not `on` */ ; _proto.parseFragmentName = function parseFragmentName() { if (this._lexer.token.value === 'on') { throw this.unexpected(); } return this.parseName(); } // Implements the parsing rules in the Values section. /** * Value[Const] : * - [~Const] Variable * - IntValue * - FloatValue * - StringValue * - BooleanValue * - NullValue * - EnumValue * - ListValue[?Const] * - ObjectValue[?Const] * * BooleanValue : one of `true` `false` * * NullValue : `null` * * EnumValue : Name but not `true`, `false` or `null` */ ; _proto.parseValueLiteral = function parseValueLiteral(isConst) { var token = this._lexer.token; switch (token.kind) { case _tokenKind.TokenKind.BRACKET_L: return this.parseList(isConst); case _tokenKind.TokenKind.BRACE_L: return this.parseObject(isConst); case _tokenKind.TokenKind.INT: this._lexer.advance(); return { kind: _kinds.Kind.INT, value: token.value, loc: this.loc(token) }; case _tokenKind.TokenKind.FLOAT: this._lexer.advance(); return { kind: _kinds.Kind.FLOAT, value: token.value, loc: this.loc(token) }; case _tokenKind.TokenKind.STRING: case _tokenKind.TokenKind.BLOCK_STRING: return this.parseStringLiteral(); case _tokenKind.TokenKind.NAME: this._lexer.advance(); switch (token.value) { case 'true': return { kind: _kinds.Kind.BOOLEAN, value: true, loc: this.loc(token) }; case 'false': return { kind: _kinds.Kind.BOOLEAN, value: false, loc: this.loc(token) }; case 'null': return { kind: _kinds.Kind.NULL, loc: this.loc(token) }; default: return { kind: _kinds.Kind.ENUM, value: token.value, loc: this.loc(token) }; } case _tokenKind.TokenKind.DOLLAR: if (!isConst) { return this.parseVariable(); } break; } throw this.unexpected(); }; _proto.parseStringLiteral = function parseStringLiteral() { var token = this._lexer.token; this._lexer.advance(); return { kind: _kinds.Kind.STRING, value: token.value, block: token.kind === _tokenKind.TokenKind.BLOCK_STRING, loc: this.loc(token) }; } /** * ListValue[Const] : * - [ ] * - [ Value[?Const]+ ] */ ; _proto.parseList = function parseList(isConst) { var _this = this; var start = this._lexer.token; var item = function item() { return _this.parseValueLiteral(isConst); }; return { kind: _kinds.Kind.LIST, values: this.any(_tokenKind.TokenKind.BRACKET_L, item, _tokenKind.TokenKind.BRACKET_R), loc: this.loc(start) }; } /** * ObjectValue[Const] : * - { } * - { ObjectField[?Const]+ } */ ; _proto.parseObject = function parseObject(isConst) { var _this2 = this; var start = this._lexer.token; var item = function item() { return _this2.parseObjectField(isConst); }; return { kind: _kinds.Kind.OBJECT, fields: this.any(_tokenKind.TokenKind.BRACE_L, item, _tokenKind.TokenKind.BRACE_R), loc: this.loc(start) }; } /** * ObjectField[Const] : Name : Value[?Const] */ ; _proto.parseObjectField = function parseObjectField(isConst) { var start = this._lexer.token; var name = this.parseName(); this.expectToken(_tokenKind.TokenKind.COLON); return { kind: _kinds.Kind.OBJECT_FIELD, name: name, value: this.parseValueLiteral(isConst), loc: this.loc(start) }; } // Implements the parsing rules in the Directives section. /** * Directives[Const] : Directive[?Const]+ */ ; _proto.parseDirectives = function parseDirectives(isConst) { var directives = []; while (this.peek(_tokenKind.TokenKind.AT)) { directives.push(this.parseDirective(isConst)); } return directives; } /** * Directive[Const] : @ Name Arguments[?Const]? */ ; _proto.parseDirective = function parseDirective(isConst) { var start = this._lexer.token; this.expectToken(_tokenKind.TokenKind.AT); return { kind: _kinds.Kind.DIRECTIVE, name: this.parseName(), arguments: this.parseArguments(isConst), loc: this.loc(start) }; } // Implements the parsing rules in the Types section. /** * Type : * - NamedType * - ListType * - NonNullType */ ; _proto.parseTypeReference = function parseTypeReference() { var start = this._lexer.token; var type; if (this.expectOptionalToken(_tokenKind.TokenKind.BRACKET_L)) { type = this.parseTypeReference(); this.expectToken(_tokenKind.TokenKind.BRACKET_R); type = { kind: _kinds.Kind.LIST_TYPE, type: type, loc: this.loc(start) }; } else { type = this.parseNamedType(); } if (this.expectOptionalToken(_tokenKind.TokenKind.BANG)) { return { kind: _kinds.Kind.NON_NULL_TYPE, type: type, loc: this.loc(start) }; } return type; } /** * NamedType : Name */ ; _proto.parseNamedType = function parseNamedType() { var start = this._lexer.token; return { kind: _kinds.Kind.NAMED_TYPE, name: this.parseName(), loc: this.loc(start) }; } // Implements the parsing rules in the Type Definition section. /** * TypeSystemDefinition : * - SchemaDefinition * - TypeDefinition * - DirectiveDefinition * * TypeDefinition : * - ScalarTypeDefinition * - ObjectTypeDefinition * - InterfaceTypeDefinition * - UnionTypeDefinition * - EnumTypeDefinition * - InputObjectTypeDefinition */ ; _proto.parseTypeSystemDefinition = function parseTypeSystemDefinition() { // Many definitions begin with a description and require a lookahead. var keywordToken = this.peekDescription() ? this._lexer.lookahead() : this._lexer.token; if (keywordToken.kind === _tokenKind.TokenKind.NAME) { switch (keywordToken.value) { case 'schema': return this.parseSchemaDefinition(); case 'scalar': return this.parseScalarTypeDefinition(); case 'type': return this.parseObjectTypeDefinition(); case 'interface': return this.parseInterfaceTypeDefinition(); case 'union': return this.parseUnionTypeDefinition(); case 'enum': return this.parseEnumTypeDefinition(); case 'input': return this.parseInputObjectTypeDefinition(); case 'directive': return this.parseDirectiveDefinition(); } } throw this.unexpected(keywordToken); }; _proto.peekDescription = function peekDescription() { return this.peek(_tokenKind.TokenKind.STRING) || this.peek(_tokenKind.TokenKind.BLOCK_STRING); } /** * Description : StringValue */ ; _proto.parseDescription = function parseDescription() { if (this.peekDescription()) { return this.parseStringLiteral(); } } /** * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } */ ; _proto.parseSchemaDefinition = function parseSchemaDefinition() { var start = this._lexer.token; var description = this.parseDescription(); this.expectKeyword('schema'); var directives = this.parseDirectives(true); var operationTypes = this.many(_tokenKind.TokenKind.BRACE_L, this.parseOperationTypeDefinition, _tokenKind.TokenKind.BRACE_R); return { kind: _kinds.Kind.SCHEMA_DEFINITION, description: description, directives: directives, operationTypes: operationTypes, loc: this.loc(start) }; } /** * OperationTypeDefinition : OperationType : NamedType */ ; _proto.parseOperationTypeDefinition = function parseOperationTypeDefinition() { var start = this._lexer.token; var operation = this.parseOperationType(); this.expectToken(_tokenKind.TokenKind.COLON); var type = this.parseNamedType(); return { kind: _kinds.Kind.OPERATION_TYPE_DEFINITION, operation: operation, type: type, loc: this.loc(start) }; } /** * ScalarTypeDefinition : Description? scalar Name Directives[Const]? */ ; _proto.parseScalarTypeDefinition = function parseScalarTypeDefinition() { var start = this._lexer.token; var description = this.parseDescription(); this.expectKeyword('scalar'); var name = this.parseName(); var directives = this.parseDirectives(true); return { kind: _kinds.Kind.SCALAR_TYPE_DEFINITION, description: description, name: name, directives: directives, loc: this.loc(start) }; } /** * ObjectTypeDefinition : * Description? * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? */ ; _proto.parseObjectTypeDefinition = function parseObjectTypeDefinition() { var start = this._lexer.token; var description = this.parseDescription(); this.expectKeyword('type'); var name = this.parseName(); var interfaces = this.parseImplementsInterfaces(); var directives = this.parseDirectives(true); var fields = this.parseFieldsDefinition(); return { kind: _kinds.Kind.OBJECT_TYPE_DEFINITION, description: description, name: name, interfaces: interfaces, directives: directives, fields: fields, loc: this.loc(start) }; } /** * ImplementsInterfaces : * - implements `&`? NamedType * - ImplementsInterfaces & NamedType */ ; _proto.parseImplementsInterfaces = function parseImplementsInterfaces() { var _this$_options2; if (!this.expectOptionalKeyword('implements')) { return []; } if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) { var types = []; // Optional leading ampersand this.expectOptionalToken(_tokenKind.TokenKind.AMP); do { types.push(this.parseNamedType()); } while (this.expectOptionalToken(_tokenKind.TokenKind.AMP) || this.peek(_tokenKind.TokenKind.NAME)); return types; } return this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType); } /** * FieldsDefinition : { FieldDefinition+ } */ ; _proto.parseFieldsDefinition = function parseFieldsDefinition() { var _this$_options3; // Legacy support for the SDL? if (((_this$_options3 = this._options) === null || _this$_options3 === void 0 ? void 0 : _this$_options3.allowLegacySDLEmptyFields) === true && this.peek(_tokenKind.TokenKind.BRACE_L) && this._lexer.lookahead().kind === _tokenKind.TokenKind.BRACE_R) { this._lexer.advance(); this._lexer.advance(); return []; } return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseFieldDefinition, _tokenKind.TokenKind.BRACE_R); } /** * FieldDefinition : * - Description? Name ArgumentsDefinition? : Type Directives[Const]? */ ; _proto.parseFieldDefinition = function parseFieldDefinition() { var start = this._lexer.token; var description = this.parseDescription(); var name = this.parseName(); var args = this.parseArgumentDefs(); this.expectToken(_tokenKind.TokenKind.COLON); var type = this.parseTypeReference(); var directives = this.parseDirectives(true); return { kind: _kinds.Kind.FIELD_DEFINITION, description: description, name: name, arguments: args, type: type, directives: directives, loc: this.loc(start) }; } /** * ArgumentsDefinition : ( InputValueDefinition+ ) */ ; _proto.parseArgumentDefs = function parseArgumentDefs() { return this.optionalMany(_tokenKind.TokenKind.PAREN_L, this.parseInputValueDef, _tokenKind.TokenKind.PAREN_R); } /** * InputValueDefinition : * - Description? Name : Type DefaultValue? Directives[Const]? */ ; _proto.parseInputValueDef = function parseInputValueDef() { var start = this._lexer.token; var description = this.parseDescription(); var name = this.parseName(); this.expectToken(_tokenKind.TokenKind.COLON); var type = this.parseTypeReference(); var defaultValue; if (this.expectOptionalToken(_tokenKind.TokenKind.EQUALS)) { defaultValue = this.parseValueLiteral(true); } var directives = this.parseDirectives(true); return { kind: _kinds.Kind.INPUT_VALUE_DEFINITION, description: description, name: name, type: type, defaultValue: defaultValue, directives: directives, loc: this.loc(start) }; } /** * InterfaceTypeDefinition : * - Description? interface Name Directives[Const]? FieldsDefinition? */ ; _proto.parseInterfaceTypeDefinition = function parseInterfaceTypeDefinition() { var start = this._lexer.token; var description = this.parseDescription(); this.expectKeyword('interface'); var name = this.parseName(); var interfaces = this.parseImplementsInterfaces(); var directives = this.parseDirectives(true); var fields = this.parseFieldsDefinition(); return { kind: _kinds.Kind.INTERFACE_TYPE_DEFINITION, description: description, name: name, interfaces: interfaces, directives: directives, fields: fields, loc: this.loc(start) }; } /** * UnionTypeDefinition : * - Description? union Name Directives[Const]? UnionMemberTypes? */ ; _proto.parseUnionTypeDefinition = function parseUnionTypeDefinition() { var start = this._lexer.token; var description = this.parseDescription(); this.expectKeyword('union'); var name = this.parseName(); var directives = this.parseDirectives(true); var types = this.parseUnionMemberTypes(); return { kind: _kinds.Kind.UNION_TYPE_DEFINITION, description: description, name: name, directives: directives, types: types, loc: this.loc(start) }; } /** * UnionMemberTypes : * - = `|`? NamedType * - UnionMemberTypes | NamedType */ ; _proto.parseUnionMemberTypes = function parseUnionMemberTypes() { return this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) ? this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseNamedType) : []; } /** * EnumTypeDefinition : * - Description? enum Name Directives[Const]? EnumValuesDefinition? */ ; _proto.parseEnumTypeDefinition = function parseEnumTypeDefinition() { var start = this._lexer.token; var description = this.parseDescription(); this.expectKeyword('enum'); var name = this.parseName(); var directives = this.parseDirectives(true); var values = this.parseEnumValuesDefinition(); return { kind: _kinds.Kind.ENUM_TYPE_DEFINITION, description: description, name: name, directives: directives, values: values, loc: this.loc(start) }; } /** * EnumValuesDefinition : { EnumValueDefinition+ } */ ; _proto.parseEnumValuesDefinition = function parseEnumValuesDefinition() { return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseEnumValueDefinition, _tokenKind.TokenKind.BRACE_R); } /** * EnumValueDefinition : Description? EnumValue Directives[Const]? * * EnumValue : Name */ ; _proto.parseEnumValueDefinition = function parseEnumValueDefinition() { var start = this._lexer.token; var description = this.parseDescription(); var name = this.parseName(); var directives = this.parseDirectives(true); return { kind: _kinds.Kind.ENUM_VALUE_DEFINITION, description: description, name: name, directives: directives, loc: this.loc(start) }; } /** * InputObjectTypeDefinition : * - Description? input Name Directives[Const]? InputFieldsDefinition? */ ; _proto.parseInputObjectTypeDefinition = function parseInputObjectTypeDefinition() { var start = this._lexer.token; var description = this.parseDescription(); this.expectKeyword('input'); var name = this.parseName(); var directives = this.parseDirectives(true); var fields = this.parseInputFieldsDefinition(); return { kind: _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, description: description, name: name, directives: directives, fields: fields, loc: this.loc(start) }; } /** * InputFieldsDefinition : { InputValueDefinition+ } */ ; _proto.parseInputFieldsDefinition = function parseInputFieldsDefinition() { return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseInputValueDef, _tokenKind.TokenKind.BRACE_R); } /** * TypeSystemExtension : * - SchemaExtension * - TypeExtension * * TypeExtension : * - ScalarTypeExtension * - ObjectTypeExtension * - InterfaceTypeExtension * - UnionTypeExtension * - EnumTypeExtension * - InputObjectTypeDefinition */ ; _proto.parseTypeSystemExtension = function parseTypeSystemExtension() { var keywordToken = this._lexer.lookahead(); if (keywordToken.kind === _tokenKind.TokenKind.NAME) { switch (keywordToken.value) { case 'schema': return this.parseSchemaExtension(); case 'scalar': return this.parseScalarTypeExtension(); case 'type': return this.parseObjectTypeExtension(); case 'interface': return this.parseInterfaceTypeExtension(); case 'union': return this.parseUnionTypeExtension(); case 'enum': return this.parseEnumTypeExtension(); case 'input': return this.parseInputObjectTypeExtension(); } } throw this.unexpected(keywordToken); } /** * SchemaExtension : * - extend schema Directives[Const]? { OperationTypeDefinition+ } * - extend schema Directives[Const] */ ; _proto.parseSchemaExtension = function parseSchemaExtension() { var start = this._lexer.token; this.expectKeyword('extend'); this.expectKeyword('schema'); var directives = this.parseDirectives(true); var operationTypes = this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseOperationTypeDefinition, _tokenKind.TokenKind.BRACE_R); if (directives.length === 0 && operationTypes.length === 0) { throw this.unexpected(); } return { kind: _kinds.Kind.SCHEMA_EXTENSION, directives: directives, operationTypes: operationTypes, loc: this.loc(start) }; } /** * ScalarTypeExtension : * - extend scalar Name Directives[Const] */ ; _proto.parseScalarTypeExtension = function parseScalarTypeExtension() { var start = this._lexer.token; this.expectKeyword('extend'); this.expectKeyword('scalar'); var name = this.parseName(); var directives = this.parseDirectives(true); if (directives.length === 0) { throw this.unexpected(); } return { kind: _kinds.Kind.SCALAR_TYPE_EXTENSION, name: name, directives: directives, loc: this.loc(start) }; } /** * ObjectTypeExtension : * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition * - extend type Name ImplementsInterfaces? Directives[Const] * - extend type Name ImplementsInterfaces */ ; _proto.parseObjectTypeExtension = function parseObjectTypeExtension() { var start = this._lexer.token; this.expectKeyword('extend'); this.expectKeyword('type'); var name = this.parseName(); var interfaces = this.parseImplementsInterfaces(); var directives = this.parseDirectives(true); var fields = this.parseFieldsDefinition(); if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { throw this.unexpected(); } return { kind: _kinds.Kind.OBJECT_TYPE_EXTENSION, name: name, interfaces: interfaces, directives: directives, fields: fields, loc: this.loc(start) }; } /** * InterfaceTypeExtension : * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition * - extend interface Name ImplementsInterfaces? Directives[Const] * - extend interface Name ImplementsInterfaces */ ; _proto.parseInterfaceTypeExtension = function parseInterfaceTypeExtension() { var start = this._lexer.token; this.expectKeyword('extend'); this.expectKeyword('interface'); var name = this.parseName(); var interfaces = this.parseImplementsInterfaces(); var directives = this.parseDirectives(true); var fields = this.parseFieldsDefinition(); if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { throw this.unexpected(); } return { kind: _kinds.Kind.INTERFACE_TYPE_EXTENSION, name: name, interfaces: interfaces, directives: directives, fields: fields, loc: this.loc(start) }; } /** * UnionTypeExtension : * - extend union Name Directives[Const]? UnionMemberTypes * - extend union Name Directives[Const] */ ; _proto.parseUnionTypeExtension = function parseUnionTypeExtension() { var start = this._lexer.token; this.expectKeyword('extend'); this.expectKeyword('union'); var name = this.parseName(); var directives = this.parseDirectives(true); var types = this.parseUnionMemberTypes(); if (directives.length === 0 && types.length === 0) { throw this.unexpected(); } return { kind: _kinds.Kind.UNION_TYPE_EXTENSION, name: name, directives: directives, types: types, loc: this.loc(start) }; } /** * EnumTypeExtension : * - extend enum Name Directives[Const]? EnumValuesDefinition * - extend enum Name Directives[Const] */ ; _proto.parseEnumTypeExtension = function parseEnumTypeExtension() { var start = this._lexer.token; this.expectKeyword('extend'); this.expectKeyword('enum'); var name = this.parseName(); var directives = this.parseDirectives(true); var values = this.parseEnumValuesDefinition(); if (directives.length === 0 && values.length === 0) { throw this.unexpected(); } return { kind: _kinds.Kind.ENUM_TYPE_EXTENSION, name: name, directives: directives, values: values, loc: this.loc(start) }; } /** * InputObjectTypeExtension : * - extend input Name Directives[Const]? InputFieldsDefinition * - extend input Name Directives[Const] */ ; _proto.parseInputObjectTypeExtension = function parseInputObjectTypeExtension() { var start = this._lexer.token; this.expectKeyword('extend'); this.expectKeyword('input'); var name = this.parseName(); var directives = this.parseDirectives(true); var fields = this.parseInputFieldsDefinition(); if (directives.length === 0 && fields.length === 0) { throw this.unexpected(); } return { kind: _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION, name: name, directives: directives, fields: fields, loc: this.loc(start) }; } /** * DirectiveDefinition : * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations */ ; _proto.parseDirectiveDefinition = function parseDirectiveDefinition() { var start = this._lexer.token; var description = this.parseDescription(); this.expectKeyword('directive'); this.expectToken(_tokenKind.TokenKind.AT); var name = this.parseName(); var args = this.parseArgumentDefs(); var repeatable = this.expectOptionalKeyword('repeatable'); this.expectKeyword('on'); var locations = this.parseDirectiveLocations(); return { kind: _kinds.Kind.DIRECTIVE_DEFINITION, description: description, name: name, arguments: args, repeatable: repeatable, locations: locations, loc: this.loc(start) }; } /** * DirectiveLocations : * - `|`? DirectiveLocation * - DirectiveLocations | DirectiveLocation */ ; _proto.parseDirectiveLocations = function parseDirectiveLocations() { return this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseDirectiveLocation); } /* * DirectiveLocation : * - ExecutableDirectiveLocation * - TypeSystemDirectiveLocation * * ExecutableDirectiveLocation : one of * `QUERY` * `MUTATION` * `SUBSCRIPTION` * `FIELD` * `FRAGMENT_DEFINITION` * `FRAGMENT_SPREAD` * `INLINE_FRAGMENT` * * TypeSystemDirectiveLocation : one of * `SCHEMA` * `SCALAR` * `OBJECT` * `FIELD_DEFINITION` * `ARGUMENT_DEFINITION` * `INTERFACE` * `UNION` * `ENUM` * `ENUM_VALUE` * `INPUT_OBJECT` * `INPUT_FIELD_DEFINITION` */ ; _proto.parseDirectiveLocation = function parseDirectiveLocation() { var start = this._lexer.token; var name = this.parseName(); if (_directiveLocation.DirectiveLocation[name.value] !== undefined) { return name; } throw this.unexpected(start); } // Core parsing utility functions /** * Returns a location object, used to identify the place in the source that created a given parsed object. */ ; _proto.loc = function loc(startToken) { var _this$_options4; if (((_this$_options4 = this._options) === null || _this$_options4 === void 0 ? void 0 : _this$_options4.noLocation) !== true) { return new _ast.Location(startToken, this._lexer.lastToken, this._lexer.source); } } /** * Determines if the next token is of a given kind */ ; _proto.peek = function peek(kind) { return this._lexer.token.kind === kind; } /** * If the next token is of the given kind, return that token after advancing the lexer. * Otherwise, do not change the parser state and throw an error. */ ; _proto.expectToken = function expectToken(kind) { var token = this._lexer.token; if (token.kind === kind) { this._lexer.advance(); return token; } throw (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Expected ".concat(getTokenKindDesc(kind), ", found ").concat(getTokenDesc(token), ".")); } /** * If the next token is of the given kind, return that token after advancing the lexer. * Otherwise, do not change the parser state and return undefined. */ ; _proto.expectOptionalToken = function expectOptionalToken(kind) { var token = this._lexer.token; if (token.kind === kind) { this._lexer.advance(); return token; } return undefined; } /** * If the next token is a given keyword, advance the lexer. * Otherwise, do not change the parser state and throw an error. */ ; _proto.expectKeyword = function expectKeyword(value) { var token = this._lexer.token; if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { this._lexer.advance(); } else { throw (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Expected \"".concat(value, "\", found ").concat(getTokenDesc(token), ".")); } } /** * If the next token is a given keyword, return "true" after advancing the lexer. * Otherwise, do not change the parser state and return "false". */ ; _proto.expectOptionalKeyword = function expectOptionalKeyword(value) { var token = this._lexer.token; if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { this._lexer.advance(); return true; } return false; } /** * Helper function for creating an error when an unexpected lexed token is encountered. */ ; _proto.unexpected = function unexpected(atToken) { var token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; return (0, _syntaxError.syntaxError)(this._lexer.source, token.start, "Unexpected ".concat(getTokenDesc(token), ".")); } /** * Returns a possibly empty list of parse nodes, determined by the parseFn. * This list begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ ; _proto.any = function any(openKind, parseFn, closeKind) { this.expectToken(openKind); var nodes = []; while (!this.expectOptionalToken(closeKind)) { nodes.push(parseFn.call(this)); } return nodes; } /** * Returns a list of parse nodes, determined by the parseFn. * It can be empty only if open token is missing otherwise it will always return non-empty list * that begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ ; _proto.optionalMany = function optionalMany(openKind, parseFn, closeKind) { if (this.expectOptionalToken(openKind)) { var nodes = []; do { nodes.push(parseFn.call(this)); } while (!this.expectOptionalToken(closeKind)); return nodes; } return []; } /** * Returns a non-empty list of parse nodes, determined by the parseFn. * This list begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ ; _proto.many = function many(openKind, parseFn, closeKind) { this.expectToken(openKind); var nodes = []; do { nodes.push(parseFn.call(this)); } while (!this.expectOptionalToken(closeKind)); return nodes; } /** * Returns a non-empty list of parse nodes, determined by the parseFn. * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. * Advances the parser to the next lex token after last item in the list. */ ; _proto.delimitedMany = function delimitedMany(delimiterKind, parseFn) { this.expectOptionalToken(delimiterKind); var nodes = []; do { nodes.push(parseFn.call(this)); } while (this.expectOptionalToken(delimiterKind)); return nodes; }; return Parser; }(); /** * A helper function to describe a token as a string for debugging. */ exports.Parser = Parser; function getTokenDesc(token) { var value = token.value; return getTokenKindDesc(token.kind) + (value != null ? " \"".concat(value, "\"") : ''); } /** * A helper function to describe a token kind as a string for debugging. */ function getTokenKindDesc(kind) { return (0, _lexer.isPunctuatorTokenKind)(kind) ? "\"".concat(kind, "\"") : kind; } /***/ }), /***/ "./node_modules/graphql/language/printLocation.js": /*!********************************************************!*\ !*** ./node_modules/graphql/language/printLocation.js ***! \********************************************************/ /*! flagged exports */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export printLocation [provided] [no usage info] [missing usage info prevents renaming] */ /*! export printSourceLocation [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.printLocation = printLocation; exports.printSourceLocation = printSourceLocation; var _location = __webpack_require__(/*! ./location.js */ "./node_modules/graphql/language/location.js"); /** * Render a helpful description of the location in the GraphQL Source document. */ function printLocation(location) { return printSourceLocation(location.source, (0, _location.getLocation)(location.source, location.start)); } /** * Render a helpful description of the location in the GraphQL Source document. */ function printSourceLocation(source, sourceLocation) { var firstLineColumnOffset = source.locationOffset.column - 1; var body = whitespace(firstLineColumnOffset) + source.body; var lineIndex = sourceLocation.line - 1; var lineOffset = source.locationOffset.line - 1; var lineNum = sourceLocation.line + lineOffset; var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; var columnNum = sourceLocation.column + columnOffset; var locationStr = "".concat(source.name, ":").concat(lineNum, ":").concat(columnNum, "\n"); var lines = body.split(/\r\n|[\n\r]/g); var locationLine = lines[lineIndex]; // Special case for minified documents if (locationLine.length > 120) { var subLineIndex = Math.floor(columnNum / 80); var subLineColumnNum = columnNum % 80; var subLines = []; for (var i = 0; i < locationLine.length; i += 80) { subLines.push(locationLine.slice(i, i + 80)); } return locationStr + printPrefixedLines([["".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) { return ['', subLine]; }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]])); } return locationStr + printPrefixedLines([// Lines specified like this: ["prefix", "string"], ["".concat(lineNum - 1), lines[lineIndex - 1]], ["".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1), lines[lineIndex + 1]]]); } function printPrefixedLines(lines) { var existingLines = lines.filter(function (_ref) { var _ = _ref[0], line = _ref[1]; return line !== undefined; }); var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) { var prefix = _ref2[0]; return prefix.length; })); return existingLines.map(function (_ref3) { var prefix = _ref3[0], line = _ref3[1]; return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |'); }).join('\n'); } function whitespace(len) { return Array(len + 1).join(' '); } function leftPad(len, str) { return whitespace(len - str.length) + str; } /***/ }), /***/ "./node_modules/graphql/language/printer.mjs": /*!***************************************************!*\ !*** ./node_modules/graphql/language/printer.mjs ***! \***************************************************/ /*! namespace exports */ /*! export print [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "print": () => /* binding */ print /* harmony export */ }); /* harmony import */ var _visitor_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./visitor.mjs */ "./node_modules/graphql/language/visitor.mjs"); /* harmony import */ var _blockString_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./blockString.mjs */ "./node_modules/graphql/language/blockString.mjs"); ; /** * Converts an AST into a string, using one set of reasonable * formatting rules. */ function print(ast) { return (0,_visitor_mjs__WEBPACK_IMPORTED_MODULE_0__.visit)(ast, { leave: printDocASTReducer }); } var MAX_LINE_LENGTH = 80; // TODO: provide better type coverage in future var printDocASTReducer = { Name: function Name(node) { return node.value; }, Variable: function Variable(node) { return '$' + node.name; }, // Document Document: function Document(node) { return join(node.definitions, '\n\n') + '\n'; }, OperationDefinition: function OperationDefinition(node) { var op = node.operation; var name = node.name; var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); var directives = join(node.directives, ' '); var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use // the query short form. return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' '); }, VariableDefinition: function VariableDefinition(_ref) { var variable = _ref.variable, type = _ref.type, defaultValue = _ref.defaultValue, directives = _ref.directives; return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' ')); }, SelectionSet: function SelectionSet(_ref2) { var selections = _ref2.selections; return block(selections); }, Field: function Field(_ref3) { var alias = _ref3.alias, name = _ref3.name, args = _ref3.arguments, directives = _ref3.directives, selectionSet = _ref3.selectionSet; var prefix = wrap('', alias, ': ') + name; var argsLine = prefix + wrap('(', join(args, ', '), ')'); if (argsLine.length > MAX_LINE_LENGTH) { argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); } return join([argsLine, join(directives, ' '), selectionSet], ' '); }, Argument: function Argument(_ref4) { var name = _ref4.name, value = _ref4.value; return name + ': ' + value; }, // Fragments FragmentSpread: function FragmentSpread(_ref5) { var name = _ref5.name, directives = _ref5.directives; return '...' + name + wrap(' ', join(directives, ' ')); }, InlineFragment: function InlineFragment(_ref6) { var typeCondition = _ref6.typeCondition, directives = _ref6.directives, selectionSet = _ref6.selectionSet; return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' '); }, FragmentDefinition: function FragmentDefinition(_ref7) { var name = _ref7.name, typeCondition = _ref7.typeCondition, variableDefinitions = _ref7.variableDefinitions, directives = _ref7.directives, selectionSet = _ref7.selectionSet; return (// Note: fragment variable definitions are experimental and may be changed // or removed in the future. "fragment ".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), " ") + "on ".concat(typeCondition, " ").concat(wrap('', join(directives, ' '), ' ')) + selectionSet ); }, // Value IntValue: function IntValue(_ref8) { var value = _ref8.value; return value; }, FloatValue: function FloatValue(_ref9) { var value = _ref9.value; return value; }, StringValue: function StringValue(_ref10, key) { var value = _ref10.value, isBlockString = _ref10.block; return isBlockString ? (0,_blockString_mjs__WEBPACK_IMPORTED_MODULE_1__.printBlockString)(value, key === 'description' ? '' : ' ') : JSON.stringify(value); }, BooleanValue: function BooleanValue(_ref11) { var value = _ref11.value; return value ? 'true' : 'false'; }, NullValue: function NullValue() { return 'null'; }, EnumValue: function EnumValue(_ref12) { var value = _ref12.value; return value; }, ListValue: function ListValue(_ref13) { var values = _ref13.values; return '[' + join(values, ', ') + ']'; }, ObjectValue: function ObjectValue(_ref14) { var fields = _ref14.fields; return '{' + join(fields, ', ') + '}'; }, ObjectField: function ObjectField(_ref15) { var name = _ref15.name, value = _ref15.value; return name + ': ' + value; }, // Directive Directive: function Directive(_ref16) { var name = _ref16.name, args = _ref16.arguments; return '@' + name + wrap('(', join(args, ', '), ')'); }, // Type NamedType: function NamedType(_ref17) { var name = _ref17.name; return name; }, ListType: function ListType(_ref18) { var type = _ref18.type; return '[' + type + ']'; }, NonNullType: function NonNullType(_ref19) { var type = _ref19.type; return type + '!'; }, // Type System Definitions SchemaDefinition: addDescription(function (_ref20) { var directives = _ref20.directives, operationTypes = _ref20.operationTypes; return join(['schema', join(directives, ' '), block(operationTypes)], ' '); }), OperationTypeDefinition: function OperationTypeDefinition(_ref21) { var operation = _ref21.operation, type = _ref21.type; return operation + ': ' + type; }, ScalarTypeDefinition: addDescription(function (_ref22) { var name = _ref22.name, directives = _ref22.directives; return join(['scalar', name, join(directives, ' ')], ' '); }), ObjectTypeDefinition: addDescription(function (_ref23) { var name = _ref23.name, interfaces = _ref23.interfaces, directives = _ref23.directives, fields = _ref23.fields; return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); }), FieldDefinition: addDescription(function (_ref24) { var name = _ref24.name, args = _ref24.arguments, type = _ref24.type, directives = _ref24.directives; return name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' ')); }), InputValueDefinition: addDescription(function (_ref25) { var name = _ref25.name, type = _ref25.type, defaultValue = _ref25.defaultValue, directives = _ref25.directives; return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '); }), InterfaceTypeDefinition: addDescription(function (_ref26) { var name = _ref26.name, interfaces = _ref26.interfaces, directives = _ref26.directives, fields = _ref26.fields; return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); }), UnionTypeDefinition: addDescription(function (_ref27) { var name = _ref27.name, directives = _ref27.directives, types = _ref27.types; return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); }), EnumTypeDefinition: addDescription(function (_ref28) { var name = _ref28.name, directives = _ref28.directives, values = _ref28.values; return join(['enum', name, join(directives, ' '), block(values)], ' '); }), EnumValueDefinition: addDescription(function (_ref29) { var name = _ref29.name, directives = _ref29.directives; return join([name, join(directives, ' ')], ' '); }), InputObjectTypeDefinition: addDescription(function (_ref30) { var name = _ref30.name, directives = _ref30.directives, fields = _ref30.fields; return join(['input', name, join(directives, ' '), block(fields)], ' '); }), DirectiveDefinition: addDescription(function (_ref31) { var name = _ref31.name, args = _ref31.arguments, repeatable = _ref31.repeatable, locations = _ref31.locations; return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | '); }), SchemaExtension: function SchemaExtension(_ref32) { var directives = _ref32.directives, operationTypes = _ref32.operationTypes; return join(['extend schema', join(directives, ' '), block(operationTypes)], ' '); }, ScalarTypeExtension: function ScalarTypeExtension(_ref33) { var name = _ref33.name, directives = _ref33.directives; return join(['extend scalar', name, join(directives, ' ')], ' '); }, ObjectTypeExtension: function ObjectTypeExtension(_ref34) { var name = _ref34.name, interfaces = _ref34.interfaces, directives = _ref34.directives, fields = _ref34.fields; return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); }, InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) { var name = _ref35.name, interfaces = _ref35.interfaces, directives = _ref35.directives, fields = _ref35.fields; return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); }, UnionTypeExtension: function UnionTypeExtension(_ref36) { var name = _ref36.name, directives = _ref36.directives, types = _ref36.types; return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); }, EnumTypeExtension: function EnumTypeExtension(_ref37) { var name = _ref37.name, directives = _ref37.directives, values = _ref37.values; return join(['extend enum', name, join(directives, ' '), block(values)], ' '); }, InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) { var name = _ref38.name, directives = _ref38.directives, fields = _ref38.fields; return join(['extend input', name, join(directives, ' '), block(fields)], ' '); } }; function addDescription(cb) { return function (node) { return join([node.description, cb(node)], '\n'); }; } /** * Given maybeArray, print an empty string if it is null or empty, otherwise * print all items together separated by separator if provided */ function join(maybeArray) { var _maybeArray$filter$jo; var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) { return x; }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : ''; } /** * Given array, print each item on its own line, wrapped in an * indented "{ }" block. */ function block(array) { return wrap('{\n', indent(join(array, '\n')), '\n}'); } /** * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. */ function wrap(start, maybeString) { var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; return maybeString != null && maybeString !== '' ? start + maybeString + end : ''; } function indent(str) { return wrap(' ', str.replace(/\n/g, '\n ')); } function isMultiline(str) { return str.indexOf('\n') !== -1; } function hasMultilineItems(maybeArray) { return maybeArray != null && maybeArray.some(isMultiline); } /***/ }), /***/ "./node_modules/graphql/language/source.js": /*!*************************************************!*\ !*** ./node_modules/graphql/language/source.js ***! \*************************************************/ /*! flagged exports */ /*! export Source [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! export isSource [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isSource = isSource; exports.Source = void 0; var _symbols = __webpack_require__(/*! ../polyfills/symbols.js */ "./node_modules/graphql/polyfills/symbols.js"); var _inspect = _interopRequireDefault(__webpack_require__(/*! ../jsutils/inspect.js */ "./node_modules/graphql/jsutils/inspect.js")); var _devAssert = _interopRequireDefault(__webpack_require__(/*! ../jsutils/devAssert.js */ "./node_modules/graphql/jsutils/devAssert.js")); var _instanceOf = _interopRequireDefault(__webpack_require__(/*! ../jsutils/instanceOf.js */ "./node_modules/graphql/jsutils/instanceOf.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /** * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are * optional, but they are useful for clients who store GraphQL documents in source files. * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. * The `line` and `column` properties in `locationOffset` are 1-indexed. */ var Source = /*#__PURE__*/function () { function Source(body) { var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GraphQL request'; var locationOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { line: 1, column: 1 }; typeof body === 'string' || (0, _devAssert.default)(0, "Body must be a string. Received: ".concat((0, _inspect.default)(body), ".")); this.body = body; this.name = name; this.locationOffset = locationOffset; this.locationOffset.line > 0 || (0, _devAssert.default)(0, 'line in locationOffset is 1-indexed and must be positive.'); this.locationOffset.column > 0 || (0, _devAssert.default)(0, 'column in locationOffset is 1-indexed and must be positive.'); } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet _createClass(Source, [{ key: _symbols.SYMBOL_TO_STRING_TAG, get: function get() { return 'Source'; } }]); return Source; }(); /** * Test if the given value is a Source object. * * @internal */ exports.Source = Source; // eslint-disable-next-line no-redeclare function isSource(source) { return (0, _instanceOf.default)(source, Source); } /***/ }), /***/ "./node_modules/graphql/language/tokenKind.js": /*!****************************************************!*\ !*** ./node_modules/graphql/language/tokenKind.js ***! \****************************************************/ /*! flagged exports */ /*! export TokenKind [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.TokenKind = void 0; /** * An exported enum describing the different kinds of tokens that the * lexer emits. */ var TokenKind = Object.freeze({ SOF: '', EOF: '', BANG: '!', DOLLAR: '$', AMP: '&', PAREN_L: '(', PAREN_R: ')', SPREAD: '...', COLON: ':', EQUALS: '=', AT: '@', BRACKET_L: '[', BRACKET_R: ']', BRACE_L: '{', PIPE: '|', BRACE_R: '}', NAME: 'Name', INT: 'Int', FLOAT: 'Float', STRING: 'String', BLOCK_STRING: 'BlockString', COMMENT: 'Comment' }); /** * The enum type representing the token kinds values. */ exports.TokenKind = TokenKind; /***/ }), /***/ "./node_modules/graphql/language/visitor.mjs": /*!***************************************************!*\ !*** ./node_modules/graphql/language/visitor.mjs ***! \***************************************************/ /*! namespace exports */ /*! export BREAK [provided] [no usage info] [missing usage info prevents renaming] */ /*! export QueryDocumentKeys [provided] [no usage info] [missing usage info prevents renaming] */ /*! export getVisitFn [provided] [no usage info] [missing usage info prevents renaming] */ /*! export visit [provided] [no usage info] [missing usage info prevents renaming] */ /*! export visitInParallel [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "QueryDocumentKeys": () => /* binding */ QueryDocumentKeys, /* harmony export */ "BREAK": () => /* binding */ BREAK, /* harmony export */ "visit": () => /* binding */ visit, /* harmony export */ "visitInParallel": () => /* binding */ visitInParallel, /* harmony export */ "getVisitFn": () => /* binding */ getVisitFn /* harmony export */ }); /* harmony import */ var _jsutils_inspect_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../jsutils/inspect.mjs */ "./node_modules/graphql/jsutils/inspect.mjs"); /* harmony import */ var _ast_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ast.mjs */ "./node_modules/graphql/language/ast.mjs"); ; /** * A visitor is provided to visit, it contains the collection of * relevant functions to be called during the visitor's traversal. */ var QueryDocumentKeys = { Name: [], Document: ['definitions'], OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'], VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], Variable: ['name'], SelectionSet: ['selections'], Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], Argument: ['name', 'value'], FragmentSpread: ['name', 'directives'], InlineFragment: ['typeCondition', 'directives', 'selectionSet'], FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed // or removed in the future. 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'], IntValue: [], FloatValue: [], StringValue: [], BooleanValue: [], NullValue: [], EnumValue: [], ListValue: ['values'], ObjectValue: ['fields'], ObjectField: ['name', 'value'], Directive: ['name', 'arguments'], NamedType: ['name'], ListType: ['type'], NonNullType: ['type'], SchemaDefinition: ['description', 'directives', 'operationTypes'], OperationTypeDefinition: ['type'], ScalarTypeDefinition: ['description', 'name', 'directives'], ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'], InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], UnionTypeDefinition: ['description', 'name', 'directives', 'types'], EnumTypeDefinition: ['description', 'name', 'directives', 'values'], EnumValueDefinition: ['description', 'name', 'directives'], InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], SchemaExtension: ['directives', 'operationTypes'], ScalarTypeExtension: ['name', 'directives'], ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], UnionTypeExtension: ['name', 'directives', 'types'], EnumTypeExtension: ['name', 'directives', 'values'], InputObjectTypeExtension: ['name', 'directives', 'fields'] }; var BREAK = Object.freeze({}); /** * visit() will walk through an AST using a depth-first traversal, calling * the visitor's enter function at each node in the traversal, and calling the * leave function after visiting that node and all of its child nodes. * * By returning different values from the enter and leave functions, the * behavior of the visitor can be altered, including skipping over a sub-tree of * the AST (by returning false), editing the AST by returning a value or null * to remove the value, or to stop the whole traversal by returning BREAK. * * When using visit() to edit an AST, the original AST will not be modified, and * a new version of the AST with the changes applied will be returned from the * visit function. * * const editedAST = visit(ast, { * enter(node, key, parent, path, ancestors) { * // @return * // undefined: no action * // false: skip visiting this node * // visitor.BREAK: stop visiting altogether * // null: delete this node * // any value: replace this node with the returned value * }, * leave(node, key, parent, path, ancestors) { * // @return * // undefined: no action * // false: no action * // visitor.BREAK: stop visiting altogether * // null: delete this node * // any value: replace this node with the returned value * } * }); * * Alternatively to providing enter() and leave() functions, a visitor can * instead provide functions named the same as the kinds of AST nodes, or * enter/leave visitors at a named key, leading to four permutations of the * visitor API: * * 1) Named visitors triggered when entering a node of a specific kind. * * visit(ast, { * Kind(node) { * // enter the "Kind" node * } * }) * * 2) Named visitors that trigger upon entering and leaving a node of * a specific kind. * * visit(ast, { * Kind: { * enter(node) { * // enter the "Kind" node * } * leave(node) { * // leave the "Kind" node * } * } * }) * * 3) Generic visitors that trigger upon entering and leaving any node. * * visit(ast, { * enter(node) { * // enter any node * }, * leave(node) { * // leave any node * } * }) * * 4) Parallel visitors for entering and leaving nodes of a specific kind. * * visit(ast, { * enter: { * Kind(node) { * // enter the "Kind" node * } * }, * leave: { * Kind(node) { * // leave the "Kind" node * } * } * }) */ function visit(root, visitor) { var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys; /* eslint-disable no-undef-init */ var stack = undefined; var inArray = Array.isArray(root); var keys = [root]; var index = -1; var edits = []; var node = undefined; var key = undefined; var parent = undefined; var path = []; var ancestors = []; var newRoot = root; /* eslint-enable no-undef-init */ do { index++; var isLeaving = index === keys.length; var isEdited = isLeaving && edits.length !== 0; if (isLeaving) { key = ancestors.length === 0 ? undefined : path[path.length - 1]; node = parent; parent = ancestors.pop(); if (isEdited) { if (inArray) { node = node.slice(); } else { var clone = {}; for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) { var k = _Object$keys2[_i2]; clone[k] = node[k]; } node = clone; } var editOffset = 0; for (var ii = 0; ii < edits.length; ii++) { var editKey = edits[ii][0]; var editValue = edits[ii][1]; if (inArray) { editKey -= editOffset; } if (inArray && editValue === null) { node.splice(editKey, 1); editOffset++; } else { node[editKey] = editValue; } } } index = stack.index; keys = stack.keys; edits = stack.edits; inArray = stack.inArray; stack = stack.prev; } else { key = parent ? inArray ? index : keys[index] : undefined; node = parent ? parent[key] : newRoot; if (node === null || node === undefined) { continue; } if (parent) { path.push(key); } } var result = void 0; if (!Array.isArray(node)) { if (!(0,_ast_mjs__WEBPACK_IMPORTED_MODULE_0__.isNode)(node)) { throw new Error("Invalid AST Node: ".concat((0,_jsutils_inspect_mjs__WEBPACK_IMPORTED_MODULE_1__.default)(node), ".")); } var visitFn = getVisitFn(visitor, node.kind, isLeaving); if (visitFn) { result = visitFn.call(visitor, node, key, parent, path, ancestors); if (result === BREAK) { break; } if (result === false) { if (!isLeaving) { path.pop(); continue; } } else if (result !== undefined) { edits.push([key, result]); if (!isLeaving) { if ((0,_ast_mjs__WEBPACK_IMPORTED_MODULE_0__.isNode)(result)) { node = result; } else { path.pop(); continue; } } } } } if (result === undefined && isEdited) { edits.push([key, node]); } if (isLeaving) { path.pop(); } else { var _visitorKeys$node$kin; stack = { inArray: inArray, index: index, keys: keys, edits: edits, prev: stack }; inArray = Array.isArray(node); keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : []; index = -1; edits = []; if (parent) { ancestors.push(parent); } parent = node; } } while (stack !== undefined); if (edits.length !== 0) { newRoot = edits[edits.length - 1][1]; } return newRoot; } /** * Creates a new visitor instance which delegates to many visitors to run in * parallel. Each visitor will be visited for each node before moving on. * * If a prior visitor edits a node, no following visitors will see that node. */ function visitInParallel(visitors) { var skipping = new Array(visitors.length); return { enter: function enter(node) { for (var i = 0; i < visitors.length; i++) { if (skipping[i] == null) { var fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ false); if (fn) { var result = fn.apply(visitors[i], arguments); if (result === false) { skipping[i] = node; } else if (result === BREAK) { skipping[i] = BREAK; } else if (result !== undefined) { return result; } } } } }, leave: function leave(node) { for (var i = 0; i < visitors.length; i++) { if (skipping[i] == null) { var fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ true); if (fn) { var result = fn.apply(visitors[i], arguments); if (result === BREAK) { skipping[i] = BREAK; } else if (result !== undefined && result !== false) { return result; } } } else if (skipping[i] === node) { skipping[i] = null; } } } }; } /** * Given a visitor instance, if it is leaving or not, and a node kind, return * the function the visitor runtime should call. */ function getVisitFn(visitor, kind, isLeaving) { var kindVisitor = visitor[kind]; if (kindVisitor) { if (!isLeaving && typeof kindVisitor === 'function') { // { Kind() {} } return kindVisitor; } var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter; if (typeof kindSpecificVisitor === 'function') { // { Kind: { enter() {}, leave() {} } } return kindSpecificVisitor; } } else { var specificVisitor = isLeaving ? visitor.leave : visitor.enter; if (specificVisitor) { if (typeof specificVisitor === 'function') { // { enter() {}, leave() {} } return specificVisitor; } var specificKindVisitor = specificVisitor[kind]; if (typeof specificKindVisitor === 'function') { // { enter: { Kind() {} }, leave: { Kind() {} } } return specificKindVisitor; } } } } /***/ }), /***/ "./node_modules/graphql/polyfills/symbols.js": /*!***************************************************!*\ !*** ./node_modules/graphql/polyfills/symbols.js ***! \***************************************************/ /*! flagged exports */ /*! export SYMBOL_ASYNC_ITERATOR [provided] [no usage info] [missing usage info prevents renaming] */ /*! export SYMBOL_ITERATOR [provided] [no usage info] [missing usage info prevents renaming] */ /*! export SYMBOL_TO_STRING_TAG [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SYMBOL_TO_STRING_TAG = exports.SYMBOL_ASYNC_ITERATOR = exports.SYMBOL_ITERATOR = void 0; // In ES2015 (or a polyfilled) environment, this will be Symbol.iterator // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') var SYMBOL_ITERATOR = typeof Symbol === 'function' && Symbol.iterator != null ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') exports.SYMBOL_ITERATOR = SYMBOL_ITERATOR; var SYMBOL_ASYNC_ITERATOR = typeof Symbol === 'function' && Symbol.asyncIterator != null ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') exports.SYMBOL_ASYNC_ITERATOR = SYMBOL_ASYNC_ITERATOR; var SYMBOL_TO_STRING_TAG = typeof Symbol === 'function' && Symbol.toStringTag != null ? Symbol.toStringTag : '@@toStringTag'; exports.SYMBOL_TO_STRING_TAG = SYMBOL_TO_STRING_TAG; /***/ }), /***/ "./node_modules/optimism/lib/bundle.esm.js": /*!*************************************************!*\ !*** ./node_modules/optimism/lib/bundle.esm.js ***! \*************************************************/ /*! namespace exports */ /*! export KeyTrie [provided] [no usage info] [missing usage info prevents renaming] */ /*! export asyncFromGen [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@wry/context/lib/context.esm.js .asyncFromGen */ /*! export bindContext [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@wry/context/lib/context.esm.js .bind */ /*! export defaultMakeCacheKey [provided] [no usage info] [missing usage info prevents renaming] */ /*! export dep [provided] [no usage info] [missing usage info prevents renaming] */ /*! export noContext [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@wry/context/lib/context.esm.js .noContext */ /*! export setTimeout [provided] [no usage info] [missing usage info prevents renaming] -> ./node_modules/@wry/context/lib/context.esm.js .setTimeout */ /*! export wrap [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "asyncFromGen": () => /* reexport safe */ _wry_context__WEBPACK_IMPORTED_MODULE_0__.asyncFromGen, /* harmony export */ "bindContext": () => /* reexport safe */ _wry_context__WEBPACK_IMPORTED_MODULE_0__.bind, /* harmony export */ "noContext": () => /* reexport safe */ _wry_context__WEBPACK_IMPORTED_MODULE_0__.noContext, /* harmony export */ "setTimeout": () => /* reexport safe */ _wry_context__WEBPACK_IMPORTED_MODULE_0__.setTimeout, /* harmony export */ "KeyTrie": () => /* binding */ KeyTrie, /* harmony export */ "defaultMakeCacheKey": () => /* binding */ defaultMakeCacheKey, /* harmony export */ "dep": () => /* binding */ dep, /* harmony export */ "wrap": () => /* binding */ wrap /* harmony export */ }); /* harmony import */ var _wry_context__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wry/context */ "./node_modules/@wry/context/lib/context.esm.js"); ; function defaultDispose() { } var Cache = /** @class */ (function () { function Cache(max, dispose) { if (max === void 0) { max = Infinity; } if (dispose === void 0) { dispose = defaultDispose; } this.max = max; this.dispose = dispose; this.map = new Map(); this.newest = null; this.oldest = null; } Cache.prototype.has = function (key) { return this.map.has(key); }; Cache.prototype.get = function (key) { var entry = this.getEntry(key); return entry && entry.value; }; Cache.prototype.getEntry = function (key) { var entry = this.map.get(key); if (entry && entry !== this.newest) { var older = entry.older, newer = entry.newer; if (newer) { newer.older = older; } if (older) { older.newer = newer; } entry.older = this.newest; entry.older.newer = entry; entry.newer = null; this.newest = entry; if (entry === this.oldest) { this.oldest = newer; } } return entry; }; Cache.prototype.set = function (key, value) { var entry = this.getEntry(key); if (entry) { return entry.value = value; } entry = { key: key, value: value, newer: null, older: this.newest }; if (this.newest) { this.newest.newer = entry; } this.newest = entry; this.oldest = this.oldest || entry; this.map.set(key, entry); return entry.value; }; Cache.prototype.clean = function () { while (this.oldest && this.map.size > this.max) { this.delete(this.oldest.key); } }; Cache.prototype.delete = function (key) { var entry = this.map.get(key); if (entry) { if (entry === this.newest) { this.newest = entry.older; } if (entry === this.oldest) { this.oldest = entry.newer; } if (entry.newer) { entry.newer.older = entry.older; } if (entry.older) { entry.older.newer = entry.newer; } this.map.delete(key); this.dispose(entry.value, key); return true; } return false; }; return Cache; }()); var parentEntrySlot = new _wry_context__WEBPACK_IMPORTED_MODULE_0__.Slot(); function maybeUnsubscribe(entryOrDep) { var unsubscribe = entryOrDep.unsubscribe; if (typeof unsubscribe === "function") { entryOrDep.unsubscribe = void 0; unsubscribe(); } } var emptySetPool = []; var POOL_TARGET_SIZE = 100; // Since this package might be used browsers, we should avoid using the // Node built-in assert module. function assert(condition, optionalMessage) { if (!condition) { throw new Error(optionalMessage || "assertion failure"); } } function valueIs(a, b) { var len = a.length; return ( // Unknown values are not equal to each other. len > 0 && // Both values must be ordinary (or both exceptional) to be equal. len === b.length && // The underlying value or exception must be the same. a[len - 1] === b[len - 1]); } function valueGet(value) { switch (value.length) { case 0: throw new Error("unknown value"); case 1: return value[0]; case 2: throw value[1]; } } function valueCopy(value) { return value.slice(0); } var Entry = /** @class */ (function () { function Entry(fn, args) { this.fn = fn; this.args = args; this.parents = new Set(); this.childValues = new Map(); // When this Entry has children that are dirty, this property becomes // a Set containing other Entry objects, borrowed from emptySetPool. // When the set becomes empty, it gets recycled back to emptySetPool. this.dirtyChildren = null; this.dirty = true; this.recomputing = false; this.value = []; this.deps = null; ++Entry.count; } Entry.prototype.peek = function () { if (this.value.length === 1 && !mightBeDirty(this)) { return this.value[0]; } }; // This is the most important method of the Entry API, because it // determines whether the cached this.value can be returned immediately, // or must be recomputed. The overall performance of the caching system // depends on the truth of the following observations: (1) this.dirty is // usually false, (2) this.dirtyChildren is usually null/empty, and thus // (3) valueGet(this.value) is usually returned without recomputation. Entry.prototype.recompute = function () { assert(!this.recomputing, "already recomputing"); rememberParent(this); return mightBeDirty(this) ? reallyRecompute(this) : valueGet(this.value); }; Entry.prototype.setDirty = function () { if (this.dirty) return; this.dirty = true; this.value.length = 0; reportDirty(this); forgetChildren(this); // We can go ahead and unsubscribe here, since any further dirty // notifications we receive will be redundant, and unsubscribing may // free up some resources, e.g. file watchers. maybeUnsubscribe(this); }; Entry.prototype.dispose = function () { var _this = this; forgetChildren(this); maybeUnsubscribe(this); // Because this entry has been kicked out of the cache (in index.js), // we've lost the ability to find out if/when this entry becomes dirty, // whether that happens through a subscription, because of a direct call // to entry.setDirty(), or because one of its children becomes dirty. // Because of this loss of future information, we have to assume the // worst (that this entry might have become dirty very soon), so we must // immediately mark this entry's parents as dirty. Normally we could // just call entry.setDirty() rather than calling parent.setDirty() for // each parent, but that would leave this entry in parent.childValues // and parent.dirtyChildren, which would prevent the child from being // truly forgotten. this.parents.forEach(function (parent) { parent.setDirty(); forgetChild(parent, _this); }); }; Entry.prototype.dependOn = function (dep) { dep.add(this); if (!this.deps) { this.deps = emptySetPool.pop() || new Set(); } this.deps.add(dep); }; Entry.prototype.forgetDeps = function () { var _this = this; if (this.deps) { this.deps.forEach(function (dep) { return dep.delete(_this); }); this.deps.clear(); emptySetPool.push(this.deps); this.deps = null; } }; Entry.count = 0; return Entry; }()); function rememberParent(child) { var parent = parentEntrySlot.getValue(); if (parent) { child.parents.add(parent); if (!parent.childValues.has(child)) { parent.childValues.set(child, []); } if (mightBeDirty(child)) { reportDirtyChild(parent, child); } else { reportCleanChild(parent, child); } return parent; } } function reallyRecompute(entry) { forgetChildren(entry); // Set entry as the parent entry while calling recomputeNewValue(entry). parentEntrySlot.withValue(entry, recomputeNewValue, [entry]); if (maybeSubscribe(entry)) { // If we successfully recomputed entry.value and did not fail to // (re)subscribe, then this Entry is no longer explicitly dirty. setClean(entry); } return valueGet(entry.value); } function recomputeNewValue(entry) { entry.recomputing = true; // Set entry.value as unknown. entry.value.length = 0; try { // If entry.fn succeeds, entry.value will become a normal Value. entry.value[0] = entry.fn.apply(null, entry.args); } catch (e) { // If entry.fn throws, entry.value will become exceptional. entry.value[1] = e; } // Either way, this line is always reached. entry.recomputing = false; } function mightBeDirty(entry) { return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size); } function setClean(entry) { entry.dirty = false; if (mightBeDirty(entry)) { // This Entry may still have dirty children, in which case we can't // let our parents know we're clean just yet. return; } reportClean(entry); } function reportDirty(child) { child.parents.forEach(function (parent) { return reportDirtyChild(parent, child); }); } function reportClean(child) { child.parents.forEach(function (parent) { return reportCleanChild(parent, child); }); } // Let a parent Entry know that one of its children may be dirty. function reportDirtyChild(parent, child) { // Must have called rememberParent(child) before calling // reportDirtyChild(parent, child). assert(parent.childValues.has(child)); assert(mightBeDirty(child)); if (!parent.dirtyChildren) { parent.dirtyChildren = emptySetPool.pop() || new Set; } else if (parent.dirtyChildren.has(child)) { // If we already know this child is dirty, then we must have already // informed our own parents that we are dirty, so we can terminate // the recursion early. return; } parent.dirtyChildren.add(child); reportDirty(parent); } // Let a parent Entry know that one of its children is no longer dirty. function reportCleanChild(parent, child) { // Must have called rememberChild(child) before calling // reportCleanChild(parent, child). assert(parent.childValues.has(child)); assert(!mightBeDirty(child)); var childValue = parent.childValues.get(child); if (childValue.length === 0) { parent.childValues.set(child, valueCopy(child.value)); } else if (!valueIs(childValue, child.value)) { parent.setDirty(); } removeDirtyChild(parent, child); if (mightBeDirty(parent)) { return; } reportClean(parent); } function removeDirtyChild(parent, child) { var dc = parent.dirtyChildren; if (dc) { dc.delete(child); if (dc.size === 0) { if (emptySetPool.length < POOL_TARGET_SIZE) { emptySetPool.push(dc); } parent.dirtyChildren = null; } } } // Removes all children from this entry and returns an array of the // removed children. function forgetChildren(parent) { if (parent.childValues.size > 0) { parent.childValues.forEach(function (_value, child) { forgetChild(parent, child); }); } // Remove this parent Entry from any sets to which it was added by the // addToSet method. parent.forgetDeps(); // After we forget all our children, this.dirtyChildren must be empty // and therefore must have been reset to null. assert(parent.dirtyChildren === null); } function forgetChild(parent, child) { child.parents.delete(parent); parent.childValues.delete(child); removeDirtyChild(parent, child); } function maybeSubscribe(entry) { if (typeof entry.subscribe === "function") { try { maybeUnsubscribe(entry); // Prevent double subscriptions. entry.unsubscribe = entry.subscribe.apply(null, entry.args); } catch (e) { // If this Entry has a subscribe function and it threw an exception // (or an unsubscribe function it previously returned now throws), // return false to indicate that we were not able to subscribe (or // unsubscribe), and this Entry should remain dirty. entry.setDirty(); return false; } } // Returning true indicates either that there was no entry.subscribe // function or that it succeeded. return true; } // A trie data structure that holds object keys weakly, yet can also hold // non-object keys, unlike the native `WeakMap`. // If no makeData function is supplied, the looked-up data will be an empty, // no-prototype Object. var defaultMakeData = function () { return Object.create(null); }; // Useful for processing arguments objects as well as arrays. var _a = Array.prototype, forEach = _a.forEach, slice = _a.slice; var KeyTrie = /** @class */ (function () { function KeyTrie(weakness, makeData) { if (makeData === void 0) { makeData = defaultMakeData; } this.weakness = weakness; this.makeData = makeData; } KeyTrie.prototype.lookup = function () { var array = []; for (var _i = 0; _i < arguments.length; _i++) { array[_i] = arguments[_i]; } return this.lookupArray(array); }; KeyTrie.prototype.lookupArray = function (array) { var node = this; forEach.call(array, function (key) { return node = node.getChildTrie(key); }); return node.data || (node.data = this.makeData(slice.call(array))); }; KeyTrie.prototype.getChildTrie = function (key) { var map = this.weakness && isObjRef(key) ? this.weak || (this.weak = new WeakMap()) : this.strong || (this.strong = new Map()); var child = map.get(key); if (!child) map.set(key, child = new KeyTrie(this.weakness, this.makeData)); return child; }; return KeyTrie; }()); function isObjRef(value) { switch (typeof value) { case "object": if (value === null) break; // Fall through to return true... case "function": return true; } return false; } function dep(options) { var depsByKey = new Map(); var subscribe = options && options.subscribe; function depend(key) { var parent = parentEntrySlot.getValue(); if (parent) { var dep_1 = depsByKey.get(key); if (!dep_1) { depsByKey.set(key, dep_1 = new Set); } parent.dependOn(dep_1); if (typeof subscribe === "function") { maybeUnsubscribe(dep_1); dep_1.unsubscribe = subscribe(key); } } } depend.dirty = function dirty(key) { var dep = depsByKey.get(key); if (dep) { dep.forEach(function (entry) { return entry.setDirty(); }); depsByKey.delete(key); maybeUnsubscribe(dep); } }; return depend; } // The defaultMakeCacheKey function is remarkably powerful, because it gives // a unique object for any shallow-identical list of arguments. If you need // to implement a custom makeCacheKey function, you may find it helpful to // delegate the final work to defaultMakeCacheKey, which is why we export it // here. However, you may want to avoid defaultMakeCacheKey if your runtime // does not support WeakMap, or you have the ability to return a string key. // In those cases, just write your own custom makeCacheKey functions. var keyTrie = new KeyTrie(typeof WeakMap === "function"); function defaultMakeCacheKey() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return keyTrie.lookupArray(args); } var caches = new Set(); function wrap(originalFunction, options) { if (options === void 0) { options = Object.create(null); } var cache = new Cache(options.max || Math.pow(2, 16), function (entry) { return entry.dispose(); }); var keyArgs = options.keyArgs || (function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return args; }); var makeCacheKey = options.makeCacheKey || defaultMakeCacheKey; function optimistic() { var key = makeCacheKey.apply(null, keyArgs.apply(null, arguments)); if (key === void 0) { return originalFunction.apply(null, arguments); } var args = Array.prototype.slice.call(arguments); var entry = cache.get(key); if (entry) { entry.args = args; } else { entry = new Entry(originalFunction, args); cache.set(key, entry); entry.subscribe = options.subscribe; } var value = entry.recompute(); // Move this entry to the front of the least-recently used queue, // since we just finished computing its value. cache.set(key, entry); caches.add(cache); // Clean up any excess entries in the cache, but only if there is no // active parent entry, meaning we're not in the middle of a larger // computation that might be flummoxed by the cleaning. if (!parentEntrySlot.hasValue()) { caches.forEach(function (cache) { return cache.clean(); }); caches.clear(); } return value; } function lookup() { var key = makeCacheKey.apply(null, arguments); if (key !== void 0) { return cache.get(key); } } optimistic.dirty = function () { var entry = lookup.apply(null, arguments); if (entry) { entry.setDirty(); } }; optimistic.peek = function () { var entry = lookup.apply(null, arguments); if (entry) { return entry.peek(); } }; optimistic.forget = function () { var key = makeCacheKey.apply(null, arguments); return key !== void 0 && cache.delete(key); }; return optimistic; } //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/Observable.js": /*!********************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/Observable.js ***! \********************************************************/ /*! namespace exports */ /*! export Observable [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Observable": () => /* binding */ Observable /* harmony export */ }); /* harmony import */ var _util_canReportError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/canReportError */ "./node_modules/rxjs/_esm5/internal/util/canReportError.js"); /* harmony import */ var _util_toSubscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/toSubscriber */ "./node_modules/rxjs/_esm5/internal/util/toSubscriber.js"); /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./symbol/observable */ "./node_modules/rxjs/_esm5/internal/symbol/observable.js"); /* harmony import */ var _util_pipe__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util/pipe */ "./node_modules/rxjs/_esm5/internal/util/pipe.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./config */ "./node_modules/rxjs/_esm5/internal/config.js"); /** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */ ; var Observable = /*@__PURE__*/ (function () { function Observable(subscribe) { this._isScalar = false; if (subscribe) { this._subscribe = subscribe; } } Observable.prototype.lift = function (operator) { var observable = new Observable(); observable.source = this; observable.operator = operator; return observable; }; Observable.prototype.subscribe = function (observerOrNext, error, complete) { var operator = this.operator; var sink = (0,_util_toSubscriber__WEBPACK_IMPORTED_MODULE_0__.toSubscriber)(observerOrNext, error, complete); if (operator) { sink.add(operator.call(sink, this.source)); } else { sink.add(this.source || (_config__WEBPACK_IMPORTED_MODULE_1__.config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ? this._subscribe(sink) : this._trySubscribe(sink)); } if (_config__WEBPACK_IMPORTED_MODULE_1__.config.useDeprecatedSynchronousErrorHandling) { if (sink.syncErrorThrowable) { sink.syncErrorThrowable = false; if (sink.syncErrorThrown) { throw sink.syncErrorValue; } } } return sink; }; Observable.prototype._trySubscribe = function (sink) { try { return this._subscribe(sink); } catch (err) { if (_config__WEBPACK_IMPORTED_MODULE_1__.config.useDeprecatedSynchronousErrorHandling) { sink.syncErrorThrown = true; sink.syncErrorValue = err; } if ((0,_util_canReportError__WEBPACK_IMPORTED_MODULE_2__.canReportError)(sink)) { sink.error(err); } else { console.warn(err); } } }; Observable.prototype.forEach = function (next, promiseCtor) { var _this = this; promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor(function (resolve, reject) { var subscription; subscription = _this.subscribe(function (value) { try { next(value); } catch (err) { reject(err); if (subscription) { subscription.unsubscribe(); } } }, reject, resolve); }); }; Observable.prototype._subscribe = function (subscriber) { var source = this.source; return source && source.subscribe(subscriber); }; Observable.prototype[_symbol_observable__WEBPACK_IMPORTED_MODULE_3__.observable] = function () { return this; }; Observable.prototype.pipe = function () { var operations = []; for (var _i = 0; _i < arguments.length; _i++) { operations[_i] = arguments[_i]; } if (operations.length === 0) { return this; } return (0,_util_pipe__WEBPACK_IMPORTED_MODULE_4__.pipeFromArray)(operations)(this); }; Observable.prototype.toPromise = function (promiseCtor) { var _this = this; promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor(function (resolve, reject) { var value; _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); }); }); }; Observable.create = function (subscribe) { return new Observable(subscribe); }; return Observable; }()); function getPromiseCtor(promiseCtor) { if (!promiseCtor) { promiseCtor = _config__WEBPACK_IMPORTED_MODULE_1__.config.Promise || Promise; } if (!promiseCtor) { throw new Error('no Promise impl found'); } return promiseCtor; } //# sourceMappingURL=Observable.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/Observer.js": /*!******************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/Observer.js ***! \******************************************************/ /*! namespace exports */ /*! export empty [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "empty": () => /* binding */ empty /* harmony export */ }); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ "./node_modules/rxjs/_esm5/internal/config.js"); /* harmony import */ var _util_hostReportError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/hostReportError */ "./node_modules/rxjs/_esm5/internal/util/hostReportError.js"); /** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */ ; var empty = { closed: true, next: function (value) { }, error: function (err) { if (_config__WEBPACK_IMPORTED_MODULE_0__.config.useDeprecatedSynchronousErrorHandling) { throw err; } else { (0,_util_hostReportError__WEBPACK_IMPORTED_MODULE_1__.hostReportError)(err); } }, complete: function () { } }; //# sourceMappingURL=Observer.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/Subject.js": /*!*****************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/Subject.js ***! \*****************************************************/ /*! namespace exports */ /*! export AnonymousSubject [provided] [no usage info] [missing usage info prevents renaming] */ /*! export Subject [provided] [no usage info] [missing usage info prevents renaming] */ /*! export SubjectSubscriber [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "SubjectSubscriber": () => /* binding */ SubjectSubscriber, /* harmony export */ "Subject": () => /* binding */ Subject, /* harmony export */ "AnonymousSubject": () => /* binding */ AnonymousSubject /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js"); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js"); /* harmony import */ var _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js"); /* harmony import */ var _SubjectSubscription__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./SubjectSubscription */ "./node_modules/rxjs/_esm5/internal/SubjectSubscription.js"); /* harmony import */ var _internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../internal/symbol/rxSubscriber */ "./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js"); /** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */ ; var SubjectSubscriber = /*@__PURE__*/ (function (_super) { tslib__WEBPACK_IMPORTED_MODULE_0__.__extends(SubjectSubscriber, _super); function SubjectSubscriber(destination) { var _this = _super.call(this, destination) || this; _this.destination = destination; return _this; } return SubjectSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__.Subscriber)); var Subject = /*@__PURE__*/ (function (_super) { tslib__WEBPACK_IMPORTED_MODULE_0__.__extends(Subject, _super); function Subject() { var _this = _super.call(this) || this; _this.observers = []; _this.closed = false; _this.isStopped = false; _this.hasError = false; _this.thrownError = null; return _this; } Subject.prototype[_internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_2__.rxSubscriber] = function () { return new SubjectSubscriber(this); }; Subject.prototype.lift = function (operator) { var subject = new AnonymousSubject(this, this); subject.operator = operator; return subject; }; Subject.prototype.next = function (value) { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__.ObjectUnsubscribedError(); } if (!this.isStopped) { var observers = this.observers; var len = observers.length; var copy = observers.slice(); for (var i = 0; i < len; i++) { copy[i].next(value); } } }; Subject.prototype.error = function (err) { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__.ObjectUnsubscribedError(); } this.hasError = true; this.thrownError = err; this.isStopped = true; var observers = this.observers; var len = observers.length; var copy = observers.slice(); for (var i = 0; i < len; i++) { copy[i].error(err); } this.observers.length = 0; }; Subject.prototype.complete = function () { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__.ObjectUnsubscribedError(); } this.isStopped = true; var observers = this.observers; var len = observers.length; var copy = observers.slice(); for (var i = 0; i < len; i++) { copy[i].complete(); } this.observers.length = 0; }; Subject.prototype.unsubscribe = function () { this.isStopped = true; this.closed = true; this.observers = null; }; Subject.prototype._trySubscribe = function (subscriber) { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__.ObjectUnsubscribedError(); } else { return _super.prototype._trySubscribe.call(this, subscriber); } }; Subject.prototype._subscribe = function (subscriber) { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__.ObjectUnsubscribedError(); } else if (this.hasError) { subscriber.error(this.thrownError); return _Subscription__WEBPACK_IMPORTED_MODULE_4__.Subscription.EMPTY; } else if (this.isStopped) { subscriber.complete(); return _Subscription__WEBPACK_IMPORTED_MODULE_4__.Subscription.EMPTY; } else { this.observers.push(subscriber); return new _SubjectSubscription__WEBPACK_IMPORTED_MODULE_5__.SubjectSubscription(this, subscriber); } }; Subject.prototype.asObservable = function () { var observable = new _Observable__WEBPACK_IMPORTED_MODULE_6__.Observable(); observable.source = this; return observable; }; Subject.create = function (destination, source) { return new AnonymousSubject(destination, source); }; return Subject; }(_Observable__WEBPACK_IMPORTED_MODULE_6__.Observable)); var AnonymousSubject = /*@__PURE__*/ (function (_super) { tslib__WEBPACK_IMPORTED_MODULE_0__.__extends(AnonymousSubject, _super); function AnonymousSubject(destination, source) { var _this = _super.call(this) || this; _this.destination = destination; _this.source = source; return _this; } AnonymousSubject.prototype.next = function (value) { var destination = this.destination; if (destination && destination.next) { destination.next(value); } }; AnonymousSubject.prototype.error = function (err) { var destination = this.destination; if (destination && destination.error) { this.destination.error(err); } }; AnonymousSubject.prototype.complete = function () { var destination = this.destination; if (destination && destination.complete) { this.destination.complete(); } }; AnonymousSubject.prototype._subscribe = function (subscriber) { var source = this.source; if (source) { return this.source.subscribe(subscriber); } else { return _Subscription__WEBPACK_IMPORTED_MODULE_4__.Subscription.EMPTY; } }; return AnonymousSubject; }(Subject)); //# sourceMappingURL=Subject.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/SubjectSubscription.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/SubjectSubscription.js ***! \*****************************************************************/ /*! namespace exports */ /*! export SubjectSubscription [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "SubjectSubscription": () => /* binding */ SubjectSubscription /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js"); /** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */ ; var SubjectSubscription = /*@__PURE__*/ (function (_super) { tslib__WEBPACK_IMPORTED_MODULE_0__.__extends(SubjectSubscription, _super); function SubjectSubscription(subject, subscriber) { var _this = _super.call(this) || this; _this.subject = subject; _this.subscriber = subscriber; _this.closed = false; return _this; } SubjectSubscription.prototype.unsubscribe = function () { if (this.closed) { return; } this.closed = true; var subject = this.subject; var observers = subject.observers; this.subject = null; if (!observers || observers.length === 0 || subject.isStopped || subject.closed) { return; } var subscriberIndex = observers.indexOf(this.subscriber); if (subscriberIndex !== -1) { observers.splice(subscriberIndex, 1); } }; return SubjectSubscription; }(_Subscription__WEBPACK_IMPORTED_MODULE_1__.Subscription)); //# sourceMappingURL=SubjectSubscription.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/Subscriber.js": /*!********************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/Subscriber.js ***! \********************************************************/ /*! namespace exports */ /*! export SafeSubscriber [provided] [no usage info] [missing usage info prevents renaming] */ /*! export Subscriber [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Subscriber": () => /* binding */ Subscriber, /* harmony export */ "SafeSubscriber": () => /* binding */ SafeSubscriber /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util/isFunction */ "./node_modules/rxjs/_esm5/internal/util/isFunction.js"); /* harmony import */ var _Observer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Observer */ "./node_modules/rxjs/_esm5/internal/Observer.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js"); /* harmony import */ var _internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../internal/symbol/rxSubscriber */ "./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./config */ "./node_modules/rxjs/_esm5/internal/config.js"); /* harmony import */ var _util_hostReportError__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util/hostReportError */ "./node_modules/rxjs/_esm5/internal/util/hostReportError.js"); /** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */ ; var Subscriber = /*@__PURE__*/ (function (_super) { tslib__WEBPACK_IMPORTED_MODULE_0__.__extends(Subscriber, _super); function Subscriber(destinationOrNext, error, complete) { var _this = _super.call(this) || this; _this.syncErrorValue = null; _this.syncErrorThrown = false; _this.syncErrorThrowable = false; _this.isStopped = false; switch (arguments.length) { case 0: _this.destination = _Observer__WEBPACK_IMPORTED_MODULE_1__.empty; break; case 1: if (!destinationOrNext) { _this.destination = _Observer__WEBPACK_IMPORTED_MODULE_1__.empty; break; } if (typeof destinationOrNext === 'object') { if (destinationOrNext instanceof Subscriber) { _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable; _this.destination = destinationOrNext; destinationOrNext.add(_this); } else { _this.syncErrorThrowable = true; _this.destination = new SafeSubscriber(_this, destinationOrNext); } break; } default: _this.syncErrorThrowable = true; _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete); break; } return _this; } Subscriber.prototype[_internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_2__.rxSubscriber] = function () { return this; }; Subscriber.create = function (next, error, complete) { var subscriber = new Subscriber(next, error, complete); subscriber.syncErrorThrowable = false; return subscriber; }; Subscriber.prototype.next = function (value) { if (!this.isStopped) { this._next(value); } }; Subscriber.prototype.error = function (err) { if (!this.isStopped) { this.isStopped = true; this._error(err); } }; Subscriber.prototype.complete = function () { if (!this.isStopped) { this.isStopped = true; this._complete(); } }; Subscriber.prototype.unsubscribe = function () { if (this.closed) { return; } this.isStopped = true; _super.prototype.unsubscribe.call(this); }; Subscriber.prototype._next = function (value) { this.destination.next(value); }; Subscriber.prototype._error = function (err) { this.destination.error(err); this.unsubscribe(); }; Subscriber.prototype._complete = function () { this.destination.complete(); this.unsubscribe(); }; Subscriber.prototype._unsubscribeAndRecycle = function () { var _parentOrParents = this._parentOrParents; this._parentOrParents = null; this.unsubscribe(); this.closed = false; this.isStopped = false; this._parentOrParents = _parentOrParents; return this; }; return Subscriber; }(_Subscription__WEBPACK_IMPORTED_MODULE_3__.Subscription)); var SafeSubscriber = /*@__PURE__*/ (function (_super) { tslib__WEBPACK_IMPORTED_MODULE_0__.__extends(SafeSubscriber, _super); function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { var _this = _super.call(this) || this; _this._parentSubscriber = _parentSubscriber; var next; var context = _this; if ((0,_util_isFunction__WEBPACK_IMPORTED_MODULE_4__.isFunction)(observerOrNext)) { next = observerOrNext; } else if (observerOrNext) { next = observerOrNext.next; error = observerOrNext.error; complete = observerOrNext.complete; if (observerOrNext !== _Observer__WEBPACK_IMPORTED_MODULE_1__.empty) { context = Object.create(observerOrNext); if ((0,_util_isFunction__WEBPACK_IMPORTED_MODULE_4__.isFunction)(context.unsubscribe)) { _this.add(context.unsubscribe.bind(context)); } context.unsubscribe = _this.unsubscribe.bind(_this); } } _this._context = context; _this._next = next; _this._error = error; _this._complete = complete; return _this; } SafeSubscriber.prototype.next = function (value) { if (!this.isStopped && this._next) { var _parentSubscriber = this._parentSubscriber; if (!_config__WEBPACK_IMPORTED_MODULE_5__.config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._next, value); } else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { this.unsubscribe(); } } }; SafeSubscriber.prototype.error = function (err) { if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; var useDeprecatedSynchronousErrorHandling = _config__WEBPACK_IMPORTED_MODULE_5__.config.useDeprecatedSynchronousErrorHandling; if (this._error) { if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._error, err); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, this._error, err); this.unsubscribe(); } } else if (!_parentSubscriber.syncErrorThrowable) { this.unsubscribe(); if (useDeprecatedSynchronousErrorHandling) { throw err; } (0,_util_hostReportError__WEBPACK_IMPORTED_MODULE_6__.hostReportError)(err); } else { if (useDeprecatedSynchronousErrorHandling) { _parentSubscriber.syncErrorValue = err; _parentSubscriber.syncErrorThrown = true; } else { (0,_util_hostReportError__WEBPACK_IMPORTED_MODULE_6__.hostReportError)(err); } this.unsubscribe(); } } }; SafeSubscriber.prototype.complete = function () { var _this = this; if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; if (this._complete) { var wrappedComplete = function () { return _this._complete.call(_this._context); }; if (!_config__WEBPACK_IMPORTED_MODULE_5__.config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(wrappedComplete); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, wrappedComplete); this.unsubscribe(); } } else { this.unsubscribe(); } } }; SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) { try { fn.call(this._context, value); } catch (err) { this.unsubscribe(); if (_config__WEBPACK_IMPORTED_MODULE_5__.config.useDeprecatedSynchronousErrorHandling) { throw err; } else { (0,_util_hostReportError__WEBPACK_IMPORTED_MODULE_6__.hostReportError)(err); } } }; SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { if (!_config__WEBPACK_IMPORTED_MODULE_5__.config.useDeprecatedSynchronousErrorHandling) { throw new Error('bad call'); } try { fn.call(this._context, value); } catch (err) { if (_config__WEBPACK_IMPORTED_MODULE_5__.config.useDeprecatedSynchronousErrorHandling) { parent.syncErrorValue = err; parent.syncErrorThrown = true; return true; } else { (0,_util_hostReportError__WEBPACK_IMPORTED_MODULE_6__.hostReportError)(err); return true; } } return false; }; SafeSubscriber.prototype._unsubscribe = function () { var _parentSubscriber = this._parentSubscriber; this._context = null; this._parentSubscriber = null; _parentSubscriber.unsubscribe(); }; return SafeSubscriber; }(Subscriber)); //# sourceMappingURL=Subscriber.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/Subscription.js": /*!**********************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/Subscription.js ***! \**********************************************************/ /*! namespace exports */ /*! export Subscription [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Subscription": () => /* binding */ Subscription /* harmony export */ }); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js"); /* harmony import */ var _util_isObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util/isObject */ "./node_modules/rxjs/_esm5/internal/util/isObject.js"); /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/isFunction */ "./node_modules/rxjs/_esm5/internal/util/isFunction.js"); /* harmony import */ var _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/UnsubscriptionError */ "./node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js"); /** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */ ; var Subscription = /*@__PURE__*/ (function () { function Subscription(unsubscribe) { this.closed = false; this._parentOrParents = null; this._subscriptions = null; if (unsubscribe) { this._ctorUnsubscribe = true; this._unsubscribe = unsubscribe; } } Subscription.prototype.unsubscribe = function () { var errors; if (this.closed) { return; } var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions; this.closed = true; this._parentOrParents = null; this._subscriptions = null; if (_parentOrParents instanceof Subscription) { _parentOrParents.remove(this); } else if (_parentOrParents !== null) { for (var index = 0; index < _parentOrParents.length; ++index) { var parent_1 = _parentOrParents[index]; parent_1.remove(this); } } if ((0,_util_isFunction__WEBPACK_IMPORTED_MODULE_0__.isFunction)(_unsubscribe)) { if (_ctorUnsubscribe) { this._unsubscribe = undefined; } try { _unsubscribe.call(this); } catch (e) { errors = e instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_1__.UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e]; } } if ((0,_util_isArray__WEBPACK_IMPORTED_MODULE_2__.isArray)(_subscriptions)) { var index = -1; var len = _subscriptions.length; while (++index < len) { var sub = _subscriptions[index]; if ((0,_util_isObject__WEBPACK_IMPORTED_MODULE_3__.isObject)(sub)) { try { sub.unsubscribe(); } catch (e) { errors = errors || []; if (e instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_1__.UnsubscriptionError) { errors = errors.concat(flattenUnsubscriptionErrors(e.errors)); } else { errors.push(e); } } } } } if (errors) { throw new _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_1__.UnsubscriptionError(errors); } }; Subscription.prototype.add = function (teardown) { var subscription = teardown; if (!teardown) { return Subscription.EMPTY; } switch (typeof teardown) { case 'function': subscription = new Subscription(teardown); case 'object': if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') { return subscription; } else if (this.closed) { subscription.unsubscribe(); return subscription; } else if (!(subscription instanceof Subscription)) { var tmp = subscription; subscription = new Subscription(); subscription._subscriptions = [tmp]; } break; default: { throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); } } var _parentOrParents = subscription._parentOrParents; if (_parentOrParents === null) { subscription._parentOrParents = this; } else if (_parentOrParents instanceof Subscription) { if (_parentOrParents === this) { return subscription; } subscription._parentOrParents = [_parentOrParents, this]; } else if (_parentOrParents.indexOf(this) === -1) { _parentOrParents.push(this); } else { return subscription; } var subscriptions = this._subscriptions; if (subscriptions === null) { this._subscriptions = [subscription]; } else { subscriptions.push(subscription); } return subscription; }; Subscription.prototype.remove = function (subscription) { var subscriptions = this._subscriptions; if (subscriptions) { var subscriptionIndex = subscriptions.indexOf(subscription); if (subscriptionIndex !== -1) { subscriptions.splice(subscriptionIndex, 1); } } }; Subscription.EMPTY = (function (empty) { empty.closed = true; return empty; }(new Subscription())); return Subscription; }()); function flattenUnsubscriptionErrors(errors) { return errors.reduce(function (errs, err) { return errs.concat((err instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_1__.UnsubscriptionError) ? err.errors : err); }, []); } //# sourceMappingURL=Subscription.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/config.js": /*!****************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/config.js ***! \****************************************************/ /*! namespace exports */ /*! export config [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "config": () => /* binding */ config /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var _enable_super_gross_mode_that_will_cause_bad_things = false; var config = { Promise: undefined, set useDeprecatedSynchronousErrorHandling(value) { if (value) { var error = /*@__PURE__*/ new Error(); /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack); } else if (_enable_super_gross_mode_that_will_cause_bad_things) { /*@__PURE__*/ console.log('RxJS: Back to a better error behavior. Thank you. <3'); } _enable_super_gross_mode_that_will_cause_bad_things = value; }, get useDeprecatedSynchronousErrorHandling() { return _enable_super_gross_mode_that_will_cause_bad_things; }, }; //# sourceMappingURL=config.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/symbol/observable.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/symbol/observable.js ***! \***************************************************************/ /*! namespace exports */ /*! export observable [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "observable": () => /* binding */ observable /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })(); //# sourceMappingURL=observable.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js ***! \*****************************************************************/ /*! namespace exports */ /*! export $$rxSubscriber [provided] [no usage info] [missing usage info prevents renaming] */ /*! export rxSubscriber [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "rxSubscriber": () => /* binding */ rxSubscriber, /* harmony export */ "$$rxSubscriber": () => /* binding */ $$rxSubscriber /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var rxSubscriber = /*@__PURE__*/ (function () { return typeof Symbol === 'function' ? /*@__PURE__*/ Symbol('rxSubscriber') : '@@rxSubscriber_' + /*@__PURE__*/ Math.random(); })(); var $$rxSubscriber = rxSubscriber; //# sourceMappingURL=rxSubscriber.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js": /*!**************************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js ***! \**************************************************************************/ /*! namespace exports */ /*! export ObjectUnsubscribedError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ObjectUnsubscribedError": () => /* binding */ ObjectUnsubscribedError /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () { function ObjectUnsubscribedErrorImpl() { Error.call(this); this.message = 'object unsubscribed'; this.name = 'ObjectUnsubscribedError'; return this; } ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype); return ObjectUnsubscribedErrorImpl; })(); var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl; //# sourceMappingURL=ObjectUnsubscribedError.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js ***! \**********************************************************************/ /*! namespace exports */ /*! export UnsubscriptionError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "UnsubscriptionError": () => /* binding */ UnsubscriptionError /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var UnsubscriptionErrorImpl = /*@__PURE__*/ (function () { function UnsubscriptionErrorImpl(errors) { Error.call(this); this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : ''; this.name = 'UnsubscriptionError'; this.errors = errors; return this; } UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype); return UnsubscriptionErrorImpl; })(); var UnsubscriptionError = UnsubscriptionErrorImpl; //# sourceMappingURL=UnsubscriptionError.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/canReportError.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/canReportError.js ***! \*****************************************************************/ /*! namespace exports */ /*! export canReportError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "canReportError": () => /* binding */ canReportError /* harmony export */ }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js"); /** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */ ; function canReportError(observer) { while (observer) { var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped; if (closed_1 || isStopped) { return false; } else if (destination && destination instanceof _Subscriber__WEBPACK_IMPORTED_MODULE_0__.Subscriber) { observer = destination; } else { observer = null; } } return true; } //# sourceMappingURL=canReportError.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/hostReportError.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/hostReportError.js ***! \******************************************************************/ /*! namespace exports */ /*! export hostReportError [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "hostReportError": () => /* binding */ hostReportError /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ function hostReportError(err) { setTimeout(function () { throw err; }, 0); } //# sourceMappingURL=hostReportError.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/identity.js": /*!***********************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/identity.js ***! \***********************************************************/ /*! namespace exports */ /*! export identity [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "identity": () => /* binding */ identity /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ function identity(x) { return x; } //# sourceMappingURL=identity.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/isArray.js": /*!**********************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/isArray.js ***! \**********************************************************/ /*! namespace exports */ /*! export isArray [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "isArray": () => /* binding */ isArray /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })(); //# sourceMappingURL=isArray.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/isFunction.js": /*!*************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/isFunction.js ***! \*************************************************************/ /*! namespace exports */ /*! export isFunction [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "isFunction": () => /* binding */ isFunction /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ function isFunction(x) { return typeof x === 'function'; } //# sourceMappingURL=isFunction.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/isObject.js": /*!***********************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/isObject.js ***! \***********************************************************/ /*! namespace exports */ /*! export isObject [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "isObject": () => /* binding */ isObject /* harmony export */ }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ function isObject(x) { return x !== null && typeof x === 'object'; } //# sourceMappingURL=isObject.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/pipe.js": /*!*******************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/pipe.js ***! \*******************************************************/ /*! namespace exports */ /*! export pipe [provided] [no usage info] [missing usage info prevents renaming] */ /*! export pipeFromArray [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "pipe": () => /* binding */ pipe, /* harmony export */ "pipeFromArray": () => /* binding */ pipeFromArray /* harmony export */ }); /* harmony import */ var _identity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./identity */ "./node_modules/rxjs/_esm5/internal/util/identity.js"); /** PURE_IMPORTS_START _identity PURE_IMPORTS_END */ ; function pipe() { var fns = []; for (var _i = 0; _i < arguments.length; _i++) { fns[_i] = arguments[_i]; } return pipeFromArray(fns); } function pipeFromArray(fns) { if (fns.length === 0) { return _identity__WEBPACK_IMPORTED_MODULE_0__.identity; } if (fns.length === 1) { return fns[0]; } return function piped(input) { return fns.reduce(function (prev, fn) { return fn(prev); }, input); }; } //# sourceMappingURL=pipe.js.map /***/ }), /***/ "./node_modules/rxjs/_esm5/internal/util/toSubscriber.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm5/internal/util/toSubscriber.js ***! \***************************************************************/ /*! namespace exports */ /*! export toSubscriber [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "toSubscriber": () => /* binding */ toSubscriber /* harmony export */ }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js"); /* harmony import */ var _symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../symbol/rxSubscriber */ "./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js"); /* harmony import */ var _Observer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Observer */ "./node_modules/rxjs/_esm5/internal/Observer.js"); /** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */ ; function toSubscriber(nextOrObserver, error, complete) { if (nextOrObserver) { if (nextOrObserver instanceof _Subscriber__WEBPACK_IMPORTED_MODULE_0__.Subscriber) { return nextOrObserver; } if (nextOrObserver[_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__.rxSubscriber]) { return nextOrObserver[_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__.rxSubscriber](); } } if (!nextOrObserver && !error && !complete) { return new _Subscriber__WEBPACK_IMPORTED_MODULE_0__.Subscriber(_Observer__WEBPACK_IMPORTED_MODULE_2__.empty); } return new _Subscriber__WEBPACK_IMPORTED_MODULE_0__.Subscriber(nextOrObserver, error, complete); } //# sourceMappingURL=toSubscriber.js.map /***/ }), /***/ "./node_modules/symbol-observable/es/index.js": /*!****************************************************!*\ !*** ./node_modules/symbol-observable/es/index.js ***! \****************************************************/ /*! namespace exports */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, module.loaded, module.id, module, __webpack_require__.hmd, __webpack_exports__, __webpack_require__.r, __webpack_require__.g, __webpack_require__.d, __webpack_require__.* */ /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__ /* harmony export */ }); /* harmony import */ var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ponyfill.js */ "./node_modules/symbol-observable/es/ponyfill.js"); /* module decorator */ module = __webpack_require__.hmd(module); /* global window */ ; var root; if (typeof self !== 'undefined') { root = self; } else if (typeof window !== 'undefined') { root = window; } else if (typeof __webpack_require__.g !== 'undefined') { root = __webpack_require__.g; } else if (true) { root = module; } else {} var result = (0,_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__.default)(root); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (result); /***/ }), /***/ "./node_modules/symbol-observable/es/ponyfill.js": /*!*******************************************************!*\ !*** ./node_modules/symbol-observable/es/ponyfill.js ***! \*******************************************************/ /*! namespace exports */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => /* binding */ symbolObservablePonyfill /* harmony export */ }); function symbolObservablePonyfill(root) { var result; var Symbol = root.Symbol; if (typeof Symbol === 'function') { if (Symbol.observable) { result = Symbol.observable; } else { // This just needs to be something that won't trample other user's Symbol.for use // It also will guide people to the source of their issues, if this is problematic. // META: It's a resource locator! result = Symbol.for('https://github.com/benlesh/symbol-observable'); try { Symbol.observable = result; } catch (err) { // Do nothing. In some environments, users have frozen `Symbol` for security reasons, // if it is frozen assigning to it will throw. In this case, we don't care, because // they will need to use the returned value from the ponyfill. } } } else { result = '@@observable'; } return result; }; /***/ }), /***/ "./node_modules/ts-invariant/lib/invariant.esm.js": /*!********************************************************!*\ !*** ./node_modules/ts-invariant/lib/invariant.esm.js ***! \********************************************************/ /*! namespace exports */ /*! export InvariantError [provided] [no usage info] [missing usage info prevents renaming] */ /*! export default [provided] [no usage info] [missing usage info prevents renaming] */ /*! export invariant [provided] [no usage info] [missing usage info prevents renaming] */ /*! export process [provided] [no usage info] [missing usage info prevents renaming] */ /*! export setVerbosity [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.r, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__, /* harmony export */ "InvariantError": () => /* binding */ InvariantError, /* harmony export */ "invariant": () => /* binding */ invariant, /* harmony export */ "process": () => /* binding */ processStub, /* harmony export */ "setVerbosity": () => /* binding */ setVerbosity /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); ; var genericMessage = "Invariant Violation"; var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) { obj.__proto__ = proto; return obj; } : _a; var InvariantError = /** @class */ (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(InvariantError, _super); function InvariantError(message) { if (message === void 0) { message = genericMessage; } var _this = _super.call(this, typeof message === "number" ? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" : message) || this; _this.framesToPop = 1; _this.name = genericMessage; setPrototypeOf(_this, InvariantError.prototype); return _this; } return InvariantError; }(Error)); function invariant(condition, message) { if (!condition) { throw new InvariantError(message); } } var verbosityLevels = ["log", "warn", "error", "silent"]; var verbosityLevel = verbosityLevels.indexOf("log"); function wrapConsoleMethod(method) { return function () { if (verbosityLevels.indexOf(method) >= verbosityLevel) { return console[method].apply(console, arguments); } }; } (function (invariant) { invariant.log = wrapConsoleMethod("log"); invariant.warn = wrapConsoleMethod("warn"); invariant.error = wrapConsoleMethod("error"); })(invariant || (invariant = {})); function setVerbosity(level) { var old = verbosityLevels[verbosityLevel]; verbosityLevel = Math.max(0, verbosityLevels.indexOf(level)); return old; } // Code that uses ts-invariant with rollup-plugin-invariant may want to // import this process stub to avoid errors evaluating process.env.NODE_ENV. // However, because most ESM-to-CJS compilers will rewrite the process import // as tsInvariant.process, which prevents proper replacement by minifiers, we // also attempt to define the stub globally when it is not already defined. var processStub = { env: {} }; if (typeof process === "object") { processStub = process; } else try { // Using Function to evaluate this assignment in global scope also escapes // the strict mode of the current module, thereby allowing the assignment. // Inspired by https://github.com/facebook/regenerator/pull/369. Function("stub", "process = stub")(processStub); } catch (atLeastWeTried) { // The assignment can fail if a Content Security Policy heavy-handedly // forbids Function usage. In those environments, developers should take // extra care to replace process.env.NODE_ENV in their production builds, // or define an appropriate global.process polyfill. } var invariant$1 = invariant; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (invariant$1); //# sourceMappingURL=invariant.esm.js.map /***/ }), /***/ "./node_modules/tslib/tslib.es6.js": /*!*****************************************!*\ !*** ./node_modules/tslib/tslib.es6.js ***! \*****************************************/ /*! namespace exports */ /*! export __assign [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __asyncDelegator [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __asyncGenerator [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __asyncValues [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __await [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __awaiter [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __classPrivateFieldGet [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __classPrivateFieldSet [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __createBinding [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __decorate [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __exportStar [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __extends [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __generator [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __importDefault [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __importStar [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __makeTemplateObject [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __metadata [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __param [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __read [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __rest [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __spread [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __spreadArrays [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __values [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "__extends": () => /* binding */ __extends, /* harmony export */ "__assign": () => /* binding */ __assign, /* harmony export */ "__rest": () => /* binding */ __rest, /* harmony export */ "__decorate": () => /* binding */ __decorate, /* harmony export */ "__param": () => /* binding */ __param, /* harmony export */ "__metadata": () => /* binding */ __metadata, /* harmony export */ "__awaiter": () => /* binding */ __awaiter, /* harmony export */ "__generator": () => /* binding */ __generator, /* harmony export */ "__createBinding": () => /* binding */ __createBinding, /* harmony export */ "__exportStar": () => /* binding */ __exportStar, /* harmony export */ "__values": () => /* binding */ __values, /* harmony export */ "__read": () => /* binding */ __read, /* harmony export */ "__spread": () => /* binding */ __spread, /* harmony export */ "__spreadArrays": () => /* binding */ __spreadArrays, /* harmony export */ "__await": () => /* binding */ __await, /* harmony export */ "__asyncGenerator": () => /* binding */ __asyncGenerator, /* harmony export */ "__asyncDelegator": () => /* binding */ __asyncDelegator, /* harmony export */ "__asyncValues": () => /* binding */ __asyncValues, /* harmony export */ "__makeTemplateObject": () => /* binding */ __makeTemplateObject, /* harmony export */ "__importStar": () => /* binding */ __importStar, /* harmony export */ "__importDefault": () => /* binding */ __importDefault, /* harmony export */ "__classPrivateFieldGet": () => /* binding */ __classPrivateFieldGet, /* harmony export */ "__classPrivateFieldSet": () => /* binding */ __classPrivateFieldSet /* harmony export */ }); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __createBinding(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; } function __exportStar(m, exports) { for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; 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); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /***/ }), /***/ "./node_modules/zen-observable/index.js": /*!**********************************************!*\ !*** ./node_modules/zen-observable/index.js ***! \**********************************************/ /*! dynamic exports */ /*! export __esModule [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! export default [maybe provided (runtime-defined)] [no usage info] [provision prevents renaming (no use info)] */ /*! other exports [maybe provided (runtime-defined)] [no usage info] */ /*! runtime requirements: module, __webpack_require__ */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { module.exports = __webpack_require__(/*! ./lib/Observable.js */ "./node_modules/zen-observable/lib/Observable.js").Observable; /***/ }), /***/ "./node_modules/zen-observable/lib/Observable.js": /*!*******************************************************!*\ !*** ./node_modules/zen-observable/lib/Observable.js ***! \*******************************************************/ /*! flagged exports */ /*! export Observable [provided] [no usage info] [missing usage info prevents renaming] */ /*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__ */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Observable = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } // === Symbol Support === var hasSymbols = function () { return typeof Symbol === 'function'; }; var hasSymbol = function (name) { return hasSymbols() && Boolean(Symbol[name]); }; var getSymbol = function (name) { return hasSymbol(name) ? Symbol[name] : '@@' + name; }; if (hasSymbols() && !hasSymbol('observable')) { Symbol.observable = Symbol('observable'); } var SymbolIterator = getSymbol('iterator'); var SymbolObservable = getSymbol('observable'); var SymbolSpecies = getSymbol('species'); // === Abstract Operations === function getMethod(obj, key) { var value = obj[key]; if (value == null) return undefined; if (typeof value !== 'function') throw new TypeError(value + ' is not a function'); return value; } function getSpecies(obj) { var ctor = obj.constructor; if (ctor !== undefined) { ctor = ctor[SymbolSpecies]; if (ctor === null) { ctor = undefined; } } return ctor !== undefined ? ctor : Observable; } function isObservable(x) { return x instanceof Observable; // SPEC: Brand check } function hostReportError(e) { if (hostReportError.log) { hostReportError.log(e); } else { setTimeout(function () { throw e; }); } } function enqueue(fn) { Promise.resolve().then(function () { try { fn(); } catch (e) { hostReportError(e); } }); } function cleanupSubscription(subscription) { var cleanup = subscription._cleanup; if (cleanup === undefined) return; subscription._cleanup = undefined; if (!cleanup) { return; } try { if (typeof cleanup === 'function') { cleanup(); } else { var unsubscribe = getMethod(cleanup, 'unsubscribe'); if (unsubscribe) { unsubscribe.call(cleanup); } } } catch (e) { hostReportError(e); } } function closeSubscription(subscription) { subscription._observer = undefined; subscription._queue = undefined; subscription._state = 'closed'; } function flushSubscription(subscription) { var queue = subscription._queue; if (!queue) { return; } subscription._queue = undefined; subscription._state = 'ready'; for (var i = 0; i < queue.length; ++i) { notifySubscription(subscription, queue[i].type, queue[i].value); if (subscription._state === 'closed') break; } } function notifySubscription(subscription, type, value) { subscription._state = 'running'; var observer = subscription._observer; try { var m = getMethod(observer, type); switch (type) { case 'next': if (m) m.call(observer, value); break; case 'error': closeSubscription(subscription); if (m) m.call(observer, value);else throw value; break; case 'complete': closeSubscription(subscription); if (m) m.call(observer); break; } } catch (e) { hostReportError(e); } if (subscription._state === 'closed') cleanupSubscription(subscription);else if (subscription._state === 'running') subscription._state = 'ready'; } function onNotify(subscription, type, value) { if (subscription._state === 'closed') return; if (subscription._state === 'buffering') { subscription._queue.push({ type: type, value: value }); return; } if (subscription._state !== 'ready') { subscription._state = 'buffering'; subscription._queue = [{ type: type, value: value }]; enqueue(function () { return flushSubscription(subscription); }); return; } notifySubscription(subscription, type, value); } var Subscription = /*#__PURE__*/ function () { function Subscription(observer, subscriber) { _classCallCheck(this, Subscription); // ASSERT: observer is an object // ASSERT: subscriber is callable this._cleanup = undefined; this._observer = observer; this._queue = undefined; this._state = 'initializing'; var subscriptionObserver = new SubscriptionObserver(this); try { this._cleanup = subscriber.call(undefined, subscriptionObserver); } catch (e) { subscriptionObserver.error(e); } if (this._state === 'initializing') this._state = 'ready'; } _createClass(Subscription, [{ key: "unsubscribe", value: function unsubscribe() { if (this._state !== 'closed') { closeSubscription(this); cleanupSubscription(this); } } }, { key: "closed", get: function () { return this._state === 'closed'; } }]); return Subscription; }(); var SubscriptionObserver = /*#__PURE__*/ function () { function SubscriptionObserver(subscription) { _classCallCheck(this, SubscriptionObserver); this._subscription = subscription; } _createClass(SubscriptionObserver, [{ key: "next", value: function next(value) { onNotify(this._subscription, 'next', value); } }, { key: "error", value: function error(value) { onNotify(this._subscription, 'error', value); } }, { key: "complete", value: function complete() { onNotify(this._subscription, 'complete'); } }, { key: "closed", get: function () { return this._subscription._state === 'closed'; } }]); return SubscriptionObserver; }(); var Observable = /*#__PURE__*/ function () { function Observable(subscriber) { _classCallCheck(this, Observable); if (!(this instanceof Observable)) throw new TypeError('Observable cannot be called as a function'); if (typeof subscriber !== 'function') throw new TypeError('Observable initializer must be a function'); this._subscriber = subscriber; } _createClass(Observable, [{ key: "subscribe", value: function subscribe(observer) { if (typeof observer !== 'object' || observer === null) { observer = { next: observer, error: arguments[1], complete: arguments[2] }; } return new Subscription(observer, this._subscriber); } }, { key: "forEach", value: function forEach(fn) { var _this = this; return new Promise(function (resolve, reject) { if (typeof fn !== 'function') { reject(new TypeError(fn + ' is not a function')); return; } function done() { subscription.unsubscribe(); resolve(); } var subscription = _this.subscribe({ next: function (value) { try { fn(value, done); } catch (e) { reject(e); subscription.unsubscribe(); } }, error: reject, complete: resolve }); }); } }, { key: "map", value: function map(fn) { var _this2 = this; if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); var C = getSpecies(this); return new C(function (observer) { return _this2.subscribe({ next: function (value) { try { value = fn(value); } catch (e) { return observer.error(e); } observer.next(value); }, error: function (e) { observer.error(e); }, complete: function () { observer.complete(); } }); }); } }, { key: "filter", value: function filter(fn) { var _this3 = this; if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); var C = getSpecies(this); return new C(function (observer) { return _this3.subscribe({ next: function (value) { try { if (!fn(value)) return; } catch (e) { return observer.error(e); } observer.next(value); }, error: function (e) { observer.error(e); }, complete: function () { observer.complete(); } }); }); } }, { key: "reduce", value: function reduce(fn) { var _this4 = this; if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); var C = getSpecies(this); var hasSeed = arguments.length > 1; var hasValue = false; var seed = arguments[1]; var acc = seed; return new C(function (observer) { return _this4.subscribe({ next: function (value) { var first = !hasValue; hasValue = true; if (!first || hasSeed) { try { acc = fn(acc, value); } catch (e) { return observer.error(e); } } else { acc = value; } }, error: function (e) { observer.error(e); }, complete: function () { if (!hasValue && !hasSeed) return observer.error(new TypeError('Cannot reduce an empty sequence')); observer.next(acc); observer.complete(); } }); }); } }, { key: "concat", value: function concat() { var _this5 = this; for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) { sources[_key] = arguments[_key]; } var C = getSpecies(this); return new C(function (observer) { var subscription; var index = 0; function startNext(next) { subscription = next.subscribe({ next: function (v) { observer.next(v); }, error: function (e) { observer.error(e); }, complete: function () { if (index === sources.length) { subscription = undefined; observer.complete(); } else { startNext(C.from(sources[index++])); } } }); } startNext(_this5); return function () { if (subscription) { subscription.unsubscribe(); subscription = undefined; } }; }); } }, { key: "flatMap", value: function flatMap(fn) { var _this6 = this; if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); var C = getSpecies(this); return new C(function (observer) { var subscriptions = []; var outer = _this6.subscribe({ next: function (value) { if (fn) { try { value = fn(value); } catch (e) { return observer.error(e); } } var inner = C.from(value).subscribe({ next: function (value) { observer.next(value); }, error: function (e) { observer.error(e); }, complete: function () { var i = subscriptions.indexOf(inner); if (i >= 0) subscriptions.splice(i, 1); completeIfDone(); } }); subscriptions.push(inner); }, error: function (e) { observer.error(e); }, complete: function () { completeIfDone(); } }); function completeIfDone() { if (outer.closed && subscriptions.length === 0) observer.complete(); } return function () { subscriptions.forEach(function (s) { return s.unsubscribe(); }); outer.unsubscribe(); }; }); } }, { key: SymbolObservable, value: function () { return this; } }], [{ key: "from", value: function from(x) { var C = typeof this === 'function' ? this : Observable; if (x == null) throw new TypeError(x + ' is not an object'); var method = getMethod(x, SymbolObservable); if (method) { var observable = method.call(x); if (Object(observable) !== observable) throw new TypeError(observable + ' is not an object'); if (isObservable(observable) && observable.constructor === C) return observable; return new C(function (observer) { return observable.subscribe(observer); }); } if (hasSymbol('iterator')) { method = getMethod(x, SymbolIterator); if (method) { return new C(function (observer) { enqueue(function () { if (observer.closed) return; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = method.call(x)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var _item = _step.value; observer.next(_item); if (observer.closed) return; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } observer.complete(); }); }); } } if (Array.isArray(x)) { return new C(function (observer) { enqueue(function () { if (observer.closed) return; for (var i = 0; i < x.length; ++i) { observer.next(x[i]); if (observer.closed) return; } observer.complete(); }); }); } throw new TypeError(x + ' is not observable'); } }, { key: "of", value: function of() { for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { items[_key2] = arguments[_key2]; } var C = typeof this === 'function' ? this : Observable; return new C(function (observer) { enqueue(function () { if (observer.closed) return; for (var i = 0; i < items.length; ++i) { observer.next(items[i]); if (observer.closed) return; } observer.complete(); }); }); } }, { key: SymbolSpecies, get: function () { return this; } }]); return Observable; }(); exports.Observable = Observable; if (hasSymbols()) { Object.defineProperty(Observable, Symbol('extensions'), { value: { symbol: SymbolObservable, hostReportError: hostReportError }, configurable: true }); } /***/ }), /***/ "./src/client/client.js": /*!******************************!*\ !*** ./src/client/client.js ***! \******************************/ /*! namespace exports */ /*! export Client [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Client": () => /* binding */ Client /* harmony export */ }); /* harmony import */ var _graphql_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./graphql-client */ "./src/client/graphql-client.js"); ; /** * This is a facade over the API client specific implementation. */ class Client { /** * Initializes the API client using the same params. * * @constructor * @param {Object} params - An object that include the same params as the API client. */ constructor(params) { this.apiClient = new _graphql_client__WEBPACK_IMPORTED_MODULE_0__.GraphQLClient(params); } /** * Query a log entry for the given election unique id and the given content hash. * * @param {Object} params - An object that include the following options. * - {String} electionUniqueId - The election's unique id. * - {String} contentHash - The log entry content hash. * @returns {Promise>} - A log entry. * @throws Will throw an error if the request is rejected. */ getLogEntry({ electionUniqueId, contentHash }) { return this.apiClient.getLogEntry({ electionUniqueId, contentHash }); } /** * Query all log entries for the given election id. * * @param {Object} params - An object that include the following options. * - {String} electionUniqueId - The election's unique id. * - {String} after - The last log entry id received, to avoid including those entries again. * @returns {Promise>} - A collection of log entries. * @throws Will throw an error if the request is rejected. */ getElectionLogEntries(params) { return this.apiClient.getElectionLogEntries(params); } /** * Process a key ceremony step sending a signed message. * * @param {Object} params - An object that include the following options. * - {String} signedData - The signed data to be processed. * @returns {Promise} - A pending message created. * @throws Will throw an error if the request is rejected or the data contains an error. */ processKeyCeremonyStep({ messageId, signedData }) { return this.apiClient.processKeyCeremonyStep({ messageId, signedData }); } } /***/ }), /***/ "./src/client/graphql-client.js": /*!**************************************!*\ !*** ./src/client/graphql-client.js ***! \**************************************/ /*! namespace exports */ /*! export GraphQLClient [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "GraphQLClient": () => /* binding */ GraphQLClient /* harmony export */ }); /* harmony import */ var _apollo_client_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @apollo/client/core */ "./node_modules/@apollo/client/core/index.js"); /* harmony import */ var _operations_get_election_log_entries__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./operations/get_election_log_entries */ "./src/client/operations/get_election_log_entries.gql"); /* harmony import */ var _operations_get_election_log_entries__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_operations_get_election_log_entries__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _operations_process_key_ceremony_step__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./operations/process_key_ceremony_step */ "./src/client/operations/process_key_ceremony_step.gql"); /* harmony import */ var _operations_process_key_ceremony_step__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_operations_process_key_ceremony_step__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _operations_get_log_entry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./operations/get_log_entry */ "./src/client/operations/get_log_entry.gql"); /* harmony import */ var _operations_get_log_entry__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_operations_get_log_entry__WEBPACK_IMPORTED_MODULE_3__); ; /** * This is the Bulletin Board API client that will use Apollo's client to * interact with our GraphQL schema using both http and websocket connections. */ class GraphQLClient { /** * Initializes the class given the correct params. Since we need to handle * both http and websocket connections we need to create two links and use either * of them depending on the GraphQL operation. * * @constructor * @param {Object} params - An object that include the following options. * - {String} apiEndpointUrl - The http endpoint used to perform queries and mutations. * - {Object?} headers - An optional object of headers to be included on http requests. */ constructor({ apiEndpointUrl, headers }) { const httpLink = new _apollo_client_core__WEBPACK_IMPORTED_MODULE_0__.HttpLink({ uri: apiEndpointUrl, headers, }); this.apolloClient = new _apollo_client_core__WEBPACK_IMPORTED_MODULE_0__.ApolloClient({ link: httpLink, cache: new _apollo_client_core__WEBPACK_IMPORTED_MODULE_0__.InMemoryCache(), }); } /** * Query a log entry for the given election unique id and the given content hash. * * @param {Object} params - An object that include the following options. * - {String} electionUniqueId - The election's unique id. * - {String} contentHash - The log entry content hash. * @returns {Promise>} - A log entry. * @throws Will throw an error if the request is rejected. */ async getLogEntry({ electionUniqueId, contentHash }) { const result = await this.apolloClient.query({ query: (_operations_get_log_entry__WEBPACK_IMPORTED_MODULE_3___default()), variables: { electionUniqueId, contentHash, }, }); return result.data.logEntry; } /** * Query all log entries for the given election unique id. * * @param {Object} params - An object that include the following options. * - {String} electionUniqueId - The election's unique id. * - {String} after - The last log entry id received, to avoid including those entries again. * @returns {Promise>} - A collection of log entries. * @throws Will throw an error if the request is rejected. */ async getElectionLogEntries({ electionUniqueId, after }) { const result = await this.apolloClient.query({ query: (_operations_get_election_log_entries__WEBPACK_IMPORTED_MODULE_1___default()), variables: { electionUniqueId, after, }, fetchPolicy: "no-cache", }); return result.data.election.logEntries; } /** * Process a key ceremony step sending a signed message. * * @param {Object} params - An object that include the following options. * - {String} signedData - The signed data to be processed. * @returns {Promise} - A pending message created. * @throws Will throw an error if the request is rejected or the data contains an error. */ async processKeyCeremonyStep({ messageId, signedData }) { const result = await this.apolloClient.mutate({ mutation: (_operations_process_key_ceremony_step__WEBPACK_IMPORTED_MODULE_2___default()), variables: { signedData, messageId, }, }); if (result.data.processKeyCeremonyStep.error) { throw new Error(result.data.processKeyCeremonyStep.error); } return result.data.processKeyCeremonyStep.pendingMessage; } } /***/ }), /***/ "./src/client/message-identifier.js": /*!******************************************!*\ !*** ./src/client/message-identifier.js ***! \******************************************/ /*! namespace exports */ /*! export AUTHORITY_TYPE [provided] [no usage info] [missing usage info prevents renaming] */ /*! export BULLETIN_BOARD_TYPE [provided] [no usage info] [missing usage info prevents renaming] */ /*! export MessageIdentifier [provided] [no usage info] [missing usage info prevents renaming] */ /*! export TRUSTEE_TYPE [provided] [no usage info] [missing usage info prevents renaming] */ /*! export VALID_TYPES [provided] [no usage info] [missing usage info prevents renaming] */ /*! export VOTER_TYPE [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "AUTHORITY_TYPE": () => /* binding */ AUTHORITY_TYPE, /* harmony export */ "BULLETIN_BOARD_TYPE": () => /* binding */ BULLETIN_BOARD_TYPE, /* harmony export */ "VOTER_TYPE": () => /* binding */ VOTER_TYPE, /* harmony export */ "TRUSTEE_TYPE": () => /* binding */ TRUSTEE_TYPE, /* harmony export */ "VALID_TYPES": () => /* binding */ VALID_TYPES, /* harmony export */ "MessageIdentifier": () => /* binding */ MessageIdentifier /* harmony export */ }); const AUTHORITY_TYPE = "a"; const BULLETIN_BOARD_TYPE = "b"; const VOTER_TYPE = "v"; const TRUSTEE_TYPE = "t"; const VALID_TYPES = [ AUTHORITY_TYPE, BULLETIN_BOARD_TYPE, VOTER_TYPE, TRUSTEE_TYPE, ]; /** * This is a class that handles message id strings. */ class MessageIdentifier { /** * Parses a message id string into a JS object. * * @param {String} messageId - A string with a message id. * @returns {Object} - An object with the message id values. */ static parse(messageId) { const [elements, author] = messageId.split("+"); const [authority, electionId, type, subtype] = elements.split(".", 4); const [authorType, authorId] = author.split(".", 2); const dotSubtype = subtype ? `.${subtype}` : ""; if (!VALID_TYPES.includes(authorType)) { throw new Error("Invalid message identifier format"); } return { electionId: `${authority}.${electionId}`, type, subtype, typeSubtype: `${type}${dotSubtype}`, author: { type: authorType, id: authorId, }, }; } static format(electionId, typeSubtype, authorType, authorId) { return `${electionId}.${typeSubtype}+${authorType}.${authorId}`; } } /***/ }), /***/ "./src/index.js": /*!**********************!*\ !*** ./src/index.js ***! \**********************/ /*! namespace exports */ /*! export Client [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] -> ./src/client/client.js .Client */ /*! export KeyCeremony [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] -> ./src/key-ceremony/key-ceremony.js .KeyCeremony */ /*! export MessageIdentifier [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] -> ./src/client/message-identifier.js .MessageIdentifier */ /*! export Voter [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] -> ./src/voter/voter.js .Voter */ /*! other exports [not provided] [maybe used in main (runtime-defined)] */ /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Client": () => /* reexport safe */ _client_client__WEBPACK_IMPORTED_MODULE_0__.Client, /* harmony export */ "KeyCeremony": () => /* reexport safe */ _key_ceremony_key_ceremony__WEBPACK_IMPORTED_MODULE_1__.KeyCeremony, /* harmony export */ "MessageIdentifier": () => /* reexport safe */ _client_message_identifier__WEBPACK_IMPORTED_MODULE_2__.MessageIdentifier, /* harmony export */ "Voter": () => /* reexport safe */ _voter_voter__WEBPACK_IMPORTED_MODULE_3__.Voter /* harmony export */ }); /* harmony import */ var _client_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./client/client */ "./src/client/client.js"); /* harmony import */ var _key_ceremony_key_ceremony__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./key-ceremony/key-ceremony */ "./src/key-ceremony/key-ceremony.js"); /* harmony import */ var _client_message_identifier__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./client/message-identifier */ "./src/client/message-identifier.js"); /* harmony import */ var _voter_voter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./voter/voter */ "./src/voter/voter.js"); ; /***/ }), /***/ "./src/key-ceremony/key-ceremony.js": /*!******************************************!*\ !*** ./src/key-ceremony/key-ceremony.js ***! \******************************************/ /*! namespace exports */ /*! export KeyCeremony [provided] [no usage info] [missing usage info prevents renaming] */ /*! export MESSAGE_PROCESSED [provided] [no usage info] [missing usage info prevents renaming] */ /*! export MESSAGE_RECEIVED [provided] [no usage info] [missing usage info prevents renaming] */ /*! export WAIT_TIME_MS [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "WAIT_TIME_MS": () => /* binding */ WAIT_TIME_MS, /* harmony export */ "MESSAGE_RECEIVED": () => /* binding */ MESSAGE_RECEIVED, /* harmony export */ "MESSAGE_PROCESSED": () => /* binding */ MESSAGE_PROCESSED, /* harmony export */ "KeyCeremony": () => /* binding */ KeyCeremony /* harmony export */ }); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/internal/Subject.js"); /* harmony import */ var _trustee_trustee__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../trustee/trustee */ "./src/trustee/trustee.js"); /* harmony import */ var _client_message_identifier__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../client/message-identifier */ "./src/client/message-identifier.js"); ; const WAIT_TIME_MS = 1_000; // 1s const MESSAGE_RECEIVED = "[Message] Received"; const MESSAGE_PROCESSED = "[Message] Processed"; /** * Handles all the key ceremony steps for a specific election and trustee. */ class KeyCeremony { /** * Initializes the class with the given params. * * @constructor * @param {Object} params - An object that contains the initialization params. * - {Client} bulletinBoardClient - An instance of the Bulletin Board Client * - {Object} electionContext - An object that contains some necessary attributes * of the election to perform the key ceremony. * - {Object?} options - An optional object with some options to configure the key ceremony. */ constructor({ bulletinBoardClient, electionContext, options }) { this.bulletinBoardClient = bulletinBoardClient; this.electionContext = electionContext; this.currentTrustee = null; this.options = options || { bulletinBoardWaitTime: WAIT_TIME_MS }; this.pollingIntervalId = null; this.electionLogEntries = []; this.response = null; this.events = new rxjs__WEBPACK_IMPORTED_MODULE_2__.Subject(); } /** * Performs some operations to setup the key ceremony. Initializes the trustee * object based on the given election context and subscribe to log entries updates. * * @returns {Promise} */ async setup() { const { currentTrusteeContext } = this.electionContext; this.currentTrustee = new _trustee_trustee__WEBPACK_IMPORTED_MODULE_0__.Trustee(currentTrusteeContext); await this.getLogEntries(); this.nextLogEntryIndexToProcess = 0; } /** * Retrieves all the new log entries for the elections and adds them to the list with all the entries. */ async getLogEntries() { const { id: electionUniqueId } = this.electionContext; const lastLogEntry = this.electionLogEntries[ this.electionLogEntries.length - 1 ]; const after = (lastLogEntry && lastLogEntry.id) || null; this.bulletinBoardClient .getElectionLogEntries({ electionUniqueId, after, }) .then((logEntries) => { if (logEntries.length) { this.electionLogEntries = [...this.electionLogEntries, ...logEntries]; } }); } /** * Checks if a restore state operation is needed before starting processing new messages. * * @returns {Promise} */ restoreNeeded() { const lastMessage = this.lastMessageSent(); return ( lastMessage && this.currentTrustee.checkRestoreNeeded(lastMessage.messageId) ); } /** * Get the last message sent to the election log by this trustee. * * @returns {string} */ lastMessageSent() { for (let i = this.electionLogEntries.length - 1; i >= 0; i--) { const logEntry = this.electionLogEntries[i]; const messageIdentifier = _client_message_identifier__WEBPACK_IMPORTED_MODULE_1__.MessageIdentifier.parse(logEntry.messageId); if ( messageIdentifier.author.type === _client_message_identifier__WEBPACK_IMPORTED_MODULE_1__.TRUSTEE_TYPE && messageIdentifier.author.id === this.currentTrustee.id ) { return logEntry; } } } /** * Returns the state of the wrapper to be able to perform future restores. * * @returns {string} */ backup() { return this.currentTrustee.backup(); } /** * Restores the state of the wrapper to continue from a state backup. * * @param {string} wrapperState - As string with the wrapper state retrieved from the backup method. * @returns {boolean} */ restore(wrapperState) { if (!this.restoreNeeded()) { return false; } const lastMessage = this.lastMessageSent(); return this.currentTrustee.restore( wrapperState, lastMessage && lastMessage.messageId ); } /** * Starts or continues with the key ceremony. * * @param {string} wrapperState - As string with the wrapper state retrieved from the backup method. * @returns {Promise} */ async run() { if (this.restoreNeeded()) { throw new Error("You need to restore the wrapper state to continue"); } if (!this.pollingIntervalId) { this.pollingIntervalId = setInterval(() => { this.getLogEntries(); }, this.options.bulletinBoardWaitTime); } if (this.response) { await this.sendMessageToBulletinBoard(this.response); } return this.waitForNextLogEntryResult().then( async ({ message, done, save }) => { this.response = message; if (done) { clearInterval(this.pollingIntervalId); } else if (!save) { return this.run(); } } ); } /** * Creates a interval that will check periodically if there are new log entries * to process. The interval is done when a new log entry is processed and it has * a result. * * @private * @returns {Promise} */ waitForNextLogEntryResult() { return new Promise((resolve) => { const intervalId = setInterval(async () => { let result; if (this.electionLogEntries.length > this.nextLogEntryIndexToProcess) { result = await this.processNextLogEntry(); } if (result) { clearInterval(intervalId); resolve(result); } }, this.options.bulletinBoardWaitTime); }); } /** * Uses the `Trustee` object to process the next log entry and outputs the result. * * @private * @returns {Promise} */ async processNextLogEntry() { const message = this.electionLogEntries[this.nextLogEntryIndexToProcess]; this.events.next({ type: MESSAGE_RECEIVED, message, }); const result = await this.currentTrustee.processLogEntry(message); this.events.next({ type: MESSAGE_PROCESSED, message, result, }); this.nextLogEntryIndexToProcess += 1; return result; } /** * Sign a message using the `Trustee` identification keys and send it to the Bulletin Board. * * @private * @param {Object} message - An object containing some data to be sent to the Bulletin Board. * @returns {Promise} * @throws An exception is raised if there is a problem with the client. */ async sendMessageToBulletinBoard(message) { if ( this.electionLogEntries.find( (logEntry) => logEntry.messageId === message.message_id ) ) { return; } const signedData = await this.currentTrustee.sign({ iat: Math.floor(new Date() / 1000), ...message, }); return this.bulletinBoardClient.processKeyCeremonyStep({ messageId: message.message_id, signedData, }); } } /***/ }), /***/ "./src/trustee/jwt_parser.js": /*!***********************************!*\ !*** ./src/trustee/jwt_parser.js ***! \***********************************/ /*! namespace exports */ /*! export JWTParser [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "JWTParser": () => /* binding */ JWTParser /* harmony export */ }); /** * Verify and parses JWT tokens. */ class JWTParser { /** * Parses the given token only if it can be verified. * * @param {String} token - A JWT token. * @returns {Promise} - The payload included in the token. * @throws An error is thrown if the payload is not a valid JSON or the token * cannot be verified. */ async parse(token) { const verified = await this.verify(token); if (verified) { const base64Url = token.split(".")[1]; const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); const jsonPayload = decodeURIComponent( atob(base64) .split("") .map(function (c) { return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2); }) .join("") ); return JSON.parse(jsonPayload); } throw new Error(`${token} is not valid.`); } /** * Verifies the token signature. * * @todo Needs real implementation. * @param {String} token - A JWT token. * @returns {Promise} - Whether the signature is valid or not. */ verify(token) { return Promise.resolve(true); } } /***/ }), /***/ "./src/trustee/trustee.js": /*!********************************!*\ !*** ./src/trustee/trustee.js ***! \********************************/ /*! namespace exports */ /*! export Trustee [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Trustee": () => /* binding */ Trustee /* harmony export */ }); /* harmony import */ var _trustee_wrapper_dummy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./trustee_wrapper_dummy */ "./src/trustee/trustee_wrapper_dummy.js"); /* harmony import */ var _jwt_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jwt_parser */ "./src/trustee/jwt_parser.js"); ; /** * This is a facade class that will use the correspondig `TrusteeWrapper` to process * the log entries. */ class Trustee { /** * Initializes the class with the given params. * * @constructor * @param {Object} params - An object that contains the initialization params. * - {String} id - The trustee identifier. * - {Object} identificationKeys - A object that contains both the public and private key for * the corresponding trustee. */ constructor({ id, identificationKeys }) { this.id = id; this.wrapper = new _trustee_wrapper_dummy__WEBPACK_IMPORTED_MODULE_0__.TrusteeWrapper({ trusteeId: id }); this.parser = new _jwt_parser__WEBPACK_IMPORTED_MODULE_1__.JWTParser(); this.identificationKeys = identificationKeys; } /** * After parsing the `signedData` it processes the message using the wrapper. * * @param {Object} logEntry - The log entry to be processed. * @returns {Promise} - The result of the processing if any. */ async processLogEntry({ messageId, signedData }) { const payload = await this.parser.parse(signedData); return this.wrapper.processMessage(messageId, payload); } /** * Delegates the sign process to the `identificationKeys`. It signs the * message using the private key. * * @params {Object} message - The message to be signed. * @returns {Promise} - The signed message. */ sign(message) { return this.identificationKeys.sign(message); } /** * Returns the state of the wrapper to be able to perform future restores. * * @returns {string} */ backup() { return this.wrapper.backup(); } /** * Checks if the wrapper considers that a restore is needed based on the last messageId sent by the trustee. * * @params {Object} messageId - The message_id of the last message sent by the trustee. * @returns {boolean} - The answer from the wrapper. */ checkRestoreNeeded(messageId) { return this.wrapper.checkRestoreNeeded(messageId); } /** * Restore the wrapper from the given state string. It uses the last messageId sent to check that the state is valid. * * @params {string} wrapperState - The state of the wrapper to recover. * @params {Object} messageId - The message_id of the last message sent by the trustee. * @returns {boolean} - The result of the restore operation. */ restore(wrapperState, messageId) { return this.wrapper.restore(wrapperState, messageId); } } /***/ }), /***/ "./src/trustee/trustee_wrapper_dummy.js": /*!**********************************************!*\ !*** ./src/trustee/trustee_wrapper_dummy.js ***! \**********************************************/ /*! namespace exports */ /*! export CREATE_ELECTION [provided] [no usage info] [missing usage info prevents renaming] */ /*! export KEY_CEREMONY_JOINT_ELECTION_KEY [provided] [no usage info] [missing usage info prevents renaming] */ /*! export KEY_CEREMONY_STEP_1 [provided] [no usage info] [missing usage info prevents renaming] */ /*! export TrusteeWrapper [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "CREATE_ELECTION": () => /* binding */ CREATE_ELECTION, /* harmony export */ "KEY_CEREMONY_STEP_1": () => /* binding */ KEY_CEREMONY_STEP_1, /* harmony export */ "KEY_CEREMONY_JOINT_ELECTION_KEY": () => /* binding */ KEY_CEREMONY_JOINT_ELECTION_KEY, /* harmony export */ "TrusteeWrapper": () => /* binding */ TrusteeWrapper /* harmony export */ }); /* harmony import */ var _client_message_identifier__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../client/message-identifier */ "./src/client/message-identifier.js"); ; const CREATE_ELECTION = "create_election"; const KEY_CEREMONY_STEP_1 = "key_ceremony.step_1"; const KEY_CEREMONY_JOINT_ELECTION_KEY = "key_ceremony.joint_election_key"; /** * This is just a dummy implementation of a possible `TrusteeWrapper`. * It is based on the dummy voting schema that we are using in the Bulletin Board. */ class TrusteeWrapper { constructor({ trusteeId }) { this.trusteeId = trusteeId; this.electionId = null; this.status = CREATE_ELECTION; this.electionTrusteesCount = 0; this.processedMessages = []; } backup() { return JSON.stringify(this); } checkRestoreNeeded(messageId) { return messageId && this.status === CREATE_ELECTION; } restore(state, messageId) { if (!this.checkRestoreNeeded(messageId)) { return false; } const result = JSON.parse(state); if ( result.trusteeId !== this.trusteeId || (messageId && result.status === CREATE_ELECTION) ) { return false; } try { Object.assign(this, result); } catch (error) { return false; } return true; } processMessage(messageId, message) { const messageIdentifier = _client_message_identifier__WEBPACK_IMPORTED_MODULE_0__.MessageIdentifier.parse(messageId); switch (this.status) { case CREATE_ELECTION: { if (messageIdentifier.type === CREATE_ELECTION) { this.status = KEY_CEREMONY_STEP_1; this.electionId = messageIdentifier.electionId; this.processedMessages = []; this.electionTrusteesCount = message.trustees.length; return { done: false, save: true, message: { message_id: _client_message_identifier__WEBPACK_IMPORTED_MODULE_0__.MessageIdentifier.format( this.electionId, KEY_CEREMONY_STEP_1, _client_message_identifier__WEBPACK_IMPORTED_MODULE_0__.TRUSTEE_TYPE, this.trusteeId ), content: JSON.stringify({ election_public_key: 7, owner_id: this.trusteeId, }), }, }; } break; } case KEY_CEREMONY_STEP_1: { if (messageIdentifier.typeSubtype === KEY_CEREMONY_STEP_1) { this.processedMessages = [...this.processedMessages, message]; if (this.processedMessages.length === this.electionTrusteesCount) { this.status = KEY_CEREMONY_JOINT_ELECTION_KEY; return { done: false, save: false, message: null, }; } } break; } case KEY_CEREMONY_JOINT_ELECTION_KEY: { if (messageIdentifier.typeSubtype === KEY_CEREMONY_JOINT_ELECTION_KEY) { return { done: true, save: false, message: null, }; } break; } } } } /***/ }), /***/ "./src/voter/voter.js": /*!****************************!*\ !*** ./src/voter/voter.js ***! \****************************/ /*! namespace exports */ /*! export Voter [provided] [no usage info] [missing usage info prevents renaming] */ /*! export WAIT_TIME_MS [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "WAIT_TIME_MS": () => /* binding */ WAIT_TIME_MS, /* harmony export */ "Voter": () => /* binding */ Voter /* harmony export */ }); /* harmony import */ var _voter_wrapper_dummy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./voter_wrapper_dummy */ "./src/voter/voter_wrapper_dummy.js"); ; const WAIT_TIME_MS = 1_000; // 1s /** * This is a facade class that will use the correspondig `VoterWrapper` to encrypt * the vote. */ class Voter { /** * Initializes the class with the given params. * * @constructor * @param {Object} params - An object that contains the initialization params. * - {String} id - The voter identifier. */ constructor({ id, bulletinBoardClient, electionContext, options }) { this.id = id; this.wrapper = new _voter_wrapper_dummy__WEBPACK_IMPORTED_MODULE_0__.VoterWrapper({ voterId: id }); this.bulletinBoardClient = bulletinBoardClient; this.electionContext = electionContext; this.options = options || { bulletinBoardWaitTime: WAIT_TIME_MS }; } /** * Encrypts the data using the wrapper. * * @param {Object} data - The data to be. * @returns {Object} - The data encrypted. */ async encrypt(data) { return this.wrapper.encrypt(data); } async verifyVote(voteHash) { const { id: electionUniqueId } = this.electionContext; return new Promise((resolve) => { const intervalId = setInterval(() => { this.bulletinBoardClient .getLogEntry({ electionUniqueId, contentHash: voteHash, }) .then((logEntry) => { if (logEntry) { clearInterval(intervalId); resolve(); } }); }, this.options.bulletinBoardWaitTime); }); } } /***/ }), /***/ "./src/voter/voter_wrapper_dummy.js": /*!******************************************!*\ !*** ./src/voter/voter_wrapper_dummy.js ***! \******************************************/ /*! namespace exports */ /*! export VoterWrapper [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "VoterWrapper": () => /* binding */ VoterWrapper /* harmony export */ }); /** * This is just a dummy implementation of a possible `VoterWrapper`. * It is based on the dummy voting schema that we are using in the Bulletin Board. */ class VoterWrapper { constructor({ voterId }) { this.voterId = voterId; } encrypt(data) { return JSON.stringify(data); } } /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(__webpack_module_cache__[moduleId]) { /******/ return __webpack_module_cache__[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ id: moduleId, /******/ loaded: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => module['default'] : /******/ () => module; /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/global */ /******/ (() => { /******/ __webpack_require__.g = (function() { /******/ if (typeof globalThis === 'object') return globalThis; /******/ try { /******/ return this || new Function('return this')(); /******/ } catch (e) { /******/ if (typeof window === 'object') return window; /******/ } /******/ })(); /******/ })(); /******/ /******/ /* webpack/runtime/harmony module decorator */ /******/ (() => { /******/ __webpack_require__.hmd = (module) => { /******/ module = Object.create(module); /******/ if (!module.children) module.children = []; /******/ Object.defineProperty(module, 'exports', { /******/ enumerable: true, /******/ set: () => { /******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); /******/ } /******/ }); /******/ return module; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ /******/ // module exports must be returned from runtime so entry inlining is disabled /******/ // startup /******/ // Load entry module and return exports /******/ return __webpack_require__("./src/index.js"); /******/ })() ; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9kZWNpZGltQnVsbGV0aW5Cb2FyZC8uL25vZGVfbW9kdWxlcy9AYXBvbGxvL2NsaWVudC9jYWNoZS9jb3JlL2NhY2hlLmpzIiwid2VicGFjazovL2RlY2lkaW1CdWxsZXRpbkJvYXJkLy4vbm9kZV9tb2R1bGVzL0BhcG9sbG8vY2xpZW50L2NhY2hlL2NvcmUvdHlwZXMvQ2FjaGUuanMiLCJ3ZWJwYWNrOi8vZGVjaWRpbUJ1bGxldGluQm9hcmQvLi9ub2RlX21vZHVsZXMvQGFwb2xsby9jbGllbnQvY2FjaGUvY29yZS90eXBlcy9jb21tb24uanMiLCJ3ZWJwYWNrOi8vZGVjaWRpbUJ1bGxldGluQm9hcmQvLi9ub2RlX21vZHVsZXMvQGFwb2xsby9jbGllbnQvY2FjaGUvaW5kZXguanMiLCJ3ZWJwYWNrOi8vZGVjaWRpbUJ1bGxldGluQm9hcmQvLi9ub2RlX21vZHVsZXMvQGFwb2xsby9jbGllbn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5cGVvZiBvYmpPcklkT3JSZWYgPT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbWFrZVJlZmVyZW5jZShvYmpPcklkT3JSZWYpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGlzUmVmZXJlbmNlKG9iak9ySWRPclJlZikpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gb2JqT3JJZE9yUmVmO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIGlkID0gX3RoaXMucG9saWNpZXMuaWRlbnRpZnkob2JqT3JJZE9yUmVmKVswXTtcbiAgICAgICAgICAgIGlmIChpZCkge1xuICAgICAgICAgICAgICAgIHZhciByZWYgPSBtYWtlUmVmZXJlbmNlKGlkKTtcbiAgICAgICAgICAgICAgICBpZiAobWVyZ2VJbnRvU3RvcmUpIHtcbiAgICAgICAgICAgICAgICAgICAgX3RoaXMubWVyZ2UoaWQsIG9iak9ySWRPclJlZik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiByZWY7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfVxuICAgIEVudGl0eVN0b3JlLnByb3RvdHlwZS50b09iamVjdCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmV0dXJuIF9fYXNzaWduKHt9LCB0aGlzLmRhdGEpO1xuICAgIH07XG4gICAgRW50aXR5U3RvcmUucHJvdG90eXBlLmhhcyA9IGZ1bmN0aW9uIChkYXRhSWQpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMubG9va3VwKGRhdGFJZCwgdHJ1ZSkgIT09IHZvaWQgMDtcbiAgICB9O1xuICAgIEVudGl0eVN0b3JlLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoZGF0YUlkLCBmaWVsZE5hbWUpIHtcbiAgICAgICAgdGhpcy5ncm91cC5kZXBlbmQoZGF0YUlkLCBmaWVsZE5hbWUpO1xuICAgICAgICBpZiAoaGFzT3du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CAmJiAhKF90aGlzIGluc3RhbmNlb2YgTGF5ZXIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIG1lcmdlZFtzdG9yZUZpZWxkTmFtZV07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhmaWVsZHNUb0RpcnR5XzEpLmZvckVhY2goZnVuY3Rpb24gKGZpZWxkTmFtZSkgeyByZXR1cm4gX3RoaXMuZ3JvdXAuZGlydHkoZGF0YUlkLCBmaWVsZE5hbWUpOyB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH07XG4gICAgRW50aXR5U3RvcmUucHJvdG90eXBlLm1vZGlmeSA9IGZ1bmN0aW9uIChkYXRhSWQsIGZpZWxkcykge1xuICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xuICAgICAgICB2YXIgc3RvcmVPYmplY3QgPSB0aGlzLmxvb2t1cChkYXRhSWQpO1xuICAgICAgICBpZiAoc3RvcmVPYmplY3QpIHtcbiAgICAgICAgICAgIHZhciBjaGFuZ2VkRmllbGRzXzEgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICAgICAgICAgICAgdmFyIG5lZWRUb01lcmdlXzEgPSBmYWxzZTtcbiAgICAgICAgICAgIHZhciBhbGxEZWxldGVkXzEgPSB0cnVlO1xuICAgICAgICAgICAgdmFyIHNoYXJlZERldGFpbHNfMSA9IHtcbiAgICAgICAgICAgICAgICBERUxFVEU6IERFTEVURSxcbiAgICAgICAgICAgICAgICBJTlZBTElEQVRFOiBJTlZBTElEQVRFLFxuICAgICAgICAgICAgICAgIGlzUmVmZXJlbmNlOiBpc1JlZmVyZW5jZSxcbiAgICAgICAgICAgICAgICB0b1JlZmVyZW5jZTogdGhpcy50b1JlZmVyZW5jZSxcbiAgICAgICAgICAgICAgICBjYW5SZWFkOiB0aGlzLmNhblJlYWQsXG4gICAgICAgICAgICAgICAgcmVhZEZpZWxkOiBmdW5jdGlvbiAoZmllbGROYW1lT3JPcHRpb25zLCBmcm9tKSB7IHJldHVybiBfdGhpcy5wb2xpY2llcy5yZWFkRmllbGQodHlwZW9mIGZpZWxkTmFtZU9yT3B0aW9ucyA9PT0gXCJzdHJpbmdcIiA/IHtcbiAgICAgICAgICAgICAgICAgICAgZmllbGROYW1lOiBmaWVsZE5hbWVPck9wdGlvbnMsXG4gICAgICAgICAgICAgICAgICAgIGZyb206IGZyb20gfHwgbWFrZVJlZmVyZW5jZShkYXRhSWQpLFxuICAgICAgICAgICAgICAgIH0gOiBmaWVsZE5hbWVPck9wdGlvbnMsIHsgc3RvcmU6IF90aGlzIH0pOyB9LFxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIE9iamVjdC5rZXlzKHN0b3JlT2JqZWN0KS5mb3JFYWNoKGZ1bmN0aW9uIChzdG9yZUZpZWxkTmFtZSkge1xuICAgICAgICAgICAgICAgIHZhciBmaWVsZE5hbWUgPSBmaWVsZE5hbWVGcm9tU3RvcmVOYW1lKHN0b3JlRmllbGROYW1lKTtcbiAgICAgICAgICAgICAgICB2YXIgZmllbGRWYWx1ZSA9IHN0b3JlT2JqZWN0W3N0b3JlRmllbGROYW1lXTtcbiAgICAgICAgICAgICAgICBpZiAoZmllbGRWYWx1ZSA9PT0gdm9pZCAwKVxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgdmFyIG1vZGlmeSA9IHR5cGVvZiBmaWVsZHMgPT09IFwiZnVuY3Rpb25cIlxuICAgICAgICAgICAgICAgICAgICA/IGZpZWxkc1xuICAgICAgICAgICAgICAgICAgICA6IGZpZWxkc1tzdG9yZUZpZWxkTmFtZV0gfHwgZmllbGRzW2ZpZWxkTmFtZV07XG4gICAgICAgICAgICAgICAgaWYgKG1vZGlmeSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgbmV3VmFsdWUgPSBtb2RpZnkgPT09IGRlbE1vZGlmaWVyID8gREVMRVRFIDpcbiAgICAgICAgICAgICAgICAgICAgICAgIG1vZGlmeShtYXliZURlZXBGcmVlemUoZmllbGRWYWx1ZSksIF9fYXNzaWduKF9fYXNzaWduKHt9LCBzaGFyZWREZXRhaWxzXzEpLCB7IGZpZWxkTmFtZTogZmllbGROYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JlRmllbGROYW1lOiBzdG9yZUZpZWxkTmFtZSwgc3RvcmFnZTogX3RoaXMuZ2V0U3RvcmFnZShkYXRhSWQsIHN0b3JlRmllbGROYW1lKSB9KSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuZXdWYWx1ZSA9PT0gSU5WQUxJREFURSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgX3RoaXMuZ3JvdXAuZGlydHkoZGF0YUlkLCBzdG9yZUZpZWxkTmFtZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobmV3VmFsdWUgPT09IERFTEVURSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdWYWx1ZSA9IHZvaWQgMDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuZXdWYWx1ZSAhPT0gZmllbGRWYWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWRGaWVsZHNfMVtzdG9yZUZpZWxkTmFtZV0gPSBuZXdWYWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkVG9NZXJnZV8xID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZFZhbHVlID0gbmV3VmFsdWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGZpZWxkVmFsdWUgIT09IHZvaWQgMCkge1xuICAgICAgICAgICAgICAgICAgICBhbGxEZWxldGVkXzEgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChuZWVkVG9NZXJnZV8xKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5tZXJnZShkYXRhSWQsIGNoYW5nZWRGaWVsZHNfMSk7XG4gICAgICAgICAgICAgICAgaWYgKGFsbERlbGV0ZWRfMSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcyBpbnN0YW5jZW9mIExheWVyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRhdGFbZGF0YUlkXSA9IHZvaWQgMDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzLmRhdGFbZGF0YUlkXTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0aGlzLmdyb3VwLmRpcnR5KGRhdGFJZCwgXCJfX2V4aXN0c1wiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH07XG4gICAgRW50aXR5U3RvcmUucHJvdG90eXBlLmRlbGV0ZSA9IGZ1bmN0aW9uIChkYXRhSWQsIGZpZWxkTmFtZSwgYXJncykge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIHZhciBzdG9yZU9iamVjdCA9IHRoaXMubG9va3VwKGRhdGFJZCk7XG4gICAgICAgIGlmIChzdG9yZU9iamVjdCkge1xuICAgICAgICAgICAgdmFyIHR5cGVuYW1lID0gdGhpcy5nZXRGaWVsZFZhbHVlKHN0b3JlT2JqZWN0LCBcIl9fdHlwZW5hbWVcIik7XG4gICAgICAgICAgICB2YXIgc3RvcmVGaWVsZE5hbWUgPSBmaWVsZE5hbWUgJiYgYXJnc1xuICAgICAgICAgICAgICAgID8gdGhpcy5wb2xpY2llcy5nZXRTdG9yZUZpZWxkTmFtZSh7IHR5cGVuYW1lOiB0eXBlbmFtZSwgZmllbGROYW1lOiBmaWVsZE5hbWUsIGFyZ3M6IGFyZ3MgfSlcbiAgICAgICAgICAgICAgICA6IGZpZWxkTmFtZTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLm1vZGlmeShkYXRhSWQsIHN0b3JlRmllbGROYW1lID8gKF9hID0ge30sXG4gICAgICAgICAgICAgICAgX2Fbc3RvcmVGaWVsZE5hbWVdID0gZGVsTW9kaWZpZXIsXG4gICAgICAgICAgICAgICAgX2EpIDogZGVsTW9kaWZpZXIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9O1xuICAgIEVudGl0eVN0b3JlLnByb3RvdHlwZS5ldmljdCA9IGZ1bmN0aW9uIChvcHRpb25zKSB7XG4gICAgICAgIHZhciBldmljdGVkID0gZmFsc2U7XG4gICAgICAgIGlmIChvcHRpb25zLmlkKSB7XG4gICAgICAgICAgICBpZiAoaGFzT3duLmNhbGwodGhpcy5kYXRhLCBvcHRpb25zLmlkKSkge1xuICAgICAgICAgICAgICAgIGV2aWN0ZWQgPSB0aGlzLmRlbGV0ZShvcHRpb25zLmlkLCBvcHRpb25zLmZpZWxkTmFtZSwgb3B0aW9ucy5hcmdzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0aGlzIGluc3RhbmNlb2YgTGF5ZXIpIHtcbiAgICAgICAgICAgICAgICBldmljdGVkID0gdGhpcy5wYXJlbnQuZXZpY3Qob3B0aW9ucykgfHwgZXZpY3RlZDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChvcHRpb25zLmZpZWxkTmFtZSB8fCBldmljdGVkKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5ncm91cC5k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cbiAgICAgICAgaWYgKHRoaXMucm9vdElkc1tyb290SWRdID4gMCkge1xuICAgICAgICAgICAgdmFyIGNvdW50ID0gLS10aGlzLnJvb3RJZHNbcm9vdElkXTtcbiAgICAgICAgICAgIGlmICghY291bnQpXG4gICAgICAgICAgICAgICAgZGVsZXRlIHRoaXMucm9vdElkc1tyb290SWRdO1xuICAgICAgICAgICAgcmV0dXJuIGNvdW50O1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAwO1xuICAgIH07XG4gICAgRW50aXR5U3RvcmUucHJvdG90eXBlLmdldFJvb3RJZFNldCA9IGZ1bmN0aW9uIChpZHMpIHtcbiAgICAgICAgaWYgKGlkcyA9PT0gdm9pZCAwKSB7IGlkcyA9IG5ldyBTZXQoKTsgfVxuICAgICAgICBPYmplY3Qua2V5cyh0aGlzLnJvb3RJZHMpLmZvckVhY2goaWRzLmFkZCwgaWRzKTtcbiAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBMYXllcikge1xuICAgICAgICAgICAgdGhpcy5wYXJlbnQuZ2V0Um9vdElkU2V0KGlkcyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBPYmplY3Qua2V5cyh0aGlzLnBvbGljaWVzLnJvb3RUeXBlbmFtZXNCeUlkKS5mb3JFYWNoKGlkcy5hZGQsIGlkcyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGlkcztcbiAgICB9O1xuICAgIEVudGl0eVN0b3JlLnByb3RvdHlwZS5nYyA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdmFyIF90aGlzID0gdGhpcztcbiAgICAgICAgdmFyIGlkcyA9IHRoaXMuZ2V0Um9vdElkU2V0KCk7XG4gICAgICAgIHZhciBzbmFwc2hvdCA9IHRoaXMudG9PYmplY3QoKTtcbiAgICAgICAgaWRzLmZvckVhY2goZnVuY3Rpb24gKGlkKSB7XG4gICAgICAgICAgICBpZiAoaGFzT3duLmNhbGwoc25hcHNob3QsIGlkKSkge1xuICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKF90aGlzLmZpbmRDaGlsZFJlZklkcyhpZCkpLmZvckVhY2goaWRzLmFkZCwgaWRzKTtcbiAgICAgICAgICAgICAgICBkZWxldGUgc25hcHNob3RbaWRdO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgdmFyIGlkc1RvUmVtb3ZlID0gT2JqZWN0LmtleXMoc25hcHNob3QpO1xuICAgICAgICBpZiAoaWRzVG9SZW1vdmUubGVuZ3RoKSB7XG4gICAgICAgICAgICB2YXIgcm9vdF8xID0gdGhpcztcbiAgICAgICAgICAgIHdoaWxlIChyb290XzEgaW5zdGFuY2VvZiBMYXllcilcbiAgICAgICAgICAgICAgICByb290XzEgPSByb290XzEucGFyZW50O1xuICAgICAgICAgICAgaWRzVG9SZW1vdmUuZm9yRWFjaChmdW5jdGlvbiAoaWQpIHsgcmV0dXJuIHJvb3RfMS5kZWxldGUoaWQpOyB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gaWRzVG9SZW1vdmU7XG4gICAgfTtcbiAgICBFbnRpdHlTdG9yZS5wcm90b3R5cGUuZmluZENoaWxkUmVmSWRzID0gZnVuY3Rpb24gKGRhdGFJZCkge1xuICAgICAgICBpZiAoIWhhc093bi5jYWxsKHRoaXMucmVmcywgZGF0YUlkKSkge1xuICAgICAgICAgICAgdmFyIGZvdW5kXzEgPSB0aGlzLnJlZnNbZGF0YUlkXSA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgICAgICAgICB2YXIgd29ya1NldF8xID0gbmV3IFNldChbdGhpcy5kYXRhW2RhdGFJZF1dKTtcbiAgICAgICAgICAgIHZhciBjYW5UcmF2ZXJzZV8xID0gZnVuY3Rpb24gKG9iaikgeyByZXR1cm4gb2JqICE9PSBudWxsICYmIHR5cGVvZiBvYmogPT09ICdvYmplY3QnOyB9O1xuICAgICAgICAgICAgd29ya1NldF8xLmZvckVhY2goZnVuY3Rpb24gKG9iaikge1xuICAgICAgICAgICAgICAgIGlmIChpc1JlZmVyZW5jZShvYmopKSB7XG4gICAgICAgICAgICAgICAgICAgIGZvdW5kXzFbb2JqLl9fcmVmXSA9IHRydWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKGNhblRyYXZlcnNlXzEob2JqKSkge1xuICAgICAgICAgICAgICAgICAgICBPYmplY3QudmFsdWVzKG9iailcbiAgICAgICAgICAgICAgICAgICAgICAgIC5maWx0ZXIoY2FuVHJhdmVyc2VfMSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5mb3JFYWNoKHdvcmtTZXRfMS5hZGQsIHdvcmtTZXRfMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMucmVmc1tkYXRhSWRdO1xuICAgIH07XG4gICAgRW50aXR5U3RvcmUucHJvdG90eXBlLm1ha2VDYWNoZUtleSA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdmFyIGFyZ3MgPSBbXTtcbiAgICAgICAgZm9yICh2YXIgX2kgPSAwOyBfaSA8IGFyZ3VtZW50cy5sZW5ndGg7IF9pKyspIHtcbiAgICAgICAgICAgIGFyZ3NbX2ldID0gYXJndW1lbnRzW19pXTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcy5ncm91cC5rZXlNYWtlci5sb29rdXBBcnJheShhcmdzKTtcbiAgICB9O1xuICAgIHJldHVybiBFbnRpdHlTdG9yZTtcbn0oKSk7XG5leHBvcnQgeyBFbnRpdHlTdG9yZSB9O1xudmFyIENhY2hlR3JvdXAgPSAoZnVuY3Rpb24gKCkge1xuICAgIGZ1bmN0aW9uIENhY2hlR3JvdXAoY2FjaGluZykge1xuICAgICAgICB0aGlzLmNhY2hpbmcgPSBjYWNoaW5nO1xuICAgICAgICB0aGlzLmQgPSBudWxsO1xuICAgICAgICB0aGlzLmt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XG4gICAgICAgICAgICB2YXIgX3RoaXMgPSBfc3VwZXIuY2FsbCh0aGlzLCBwb2xpY2llcywgbmV3IENhY2hlR3JvdXAocmVzdWx0Q2FjaGluZykpIHx8IHRoaXM7XG4gICAgICAgICAgICBfdGhpcy5zdG9yYWdlVHJpZSA9IG5ldyBLZXlUcmllKGNhblVzZVdlYWtNYXApO1xuICAgICAgICAgICAgX3RoaXMuc2hhcmVkTGF5ZXJHcm91cCA9IG5ldyBDYWNoZUdyb3VwKHJlc3VsdENhY2hpbmcpO1xuICAgICAgICAgICAgaWYgKHNlZWQpXG4gICAgICAgICAgICAgICAgX3RoaXMucmVwbGFjZShzZWVkKTtcbiAgICAgICAgICAgIHJldHVybiBfdGhpcztcbiAgICAgICAgfVxuICAgICAgICBSb290LnByb3RvdHlwZS5hZGRMYXllciA9IGZ1bmN0aW9uIChsYXllcklkLCByZXBsYXkpIHtcbiAgICAgICAgICAgIHJldHVybiBuZXcgTGF5ZXIobGF5ZXJJZCwgdGhpcywgcmVwbGF5LCB0aGlzLnNoYXJlZExheWVyR3JvdXApO1xuICAgICAgICB9O1xuICAgICAgICBSb290LnByb3RvdHlwZS5yZW1vdmVMYXllciA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9O1xuICAgICAgICBSb290LnByb3RvdHlwZS5nZXRTdG9yYWdlID0gZnVuY3Rpb24gKGlkT3JPYmosIHN0b3JlRmllbGROYW1lKSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zdG9yYWdlVHJpZS5sb29rdXAoaWRPck9iaiwgc3RvcmVGaWVsZE5hbWUpO1xuICAgICAgICB9O1xuICAgICAgICByZXR1cm4gUm9vdDtcbiAgICB9KEVudGl0eVN0b3JlKSk7XG4gICAgRW50aXR5U3RvcmUuUm9vdCA9IFJvb3Q7XG59KShFbnRpdHlTdG9yZSB8fCAoRW50aXR5U3RvcmUgPSB7fSkpO1xudmFyIExheWVyID0gKGZ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dG9yZSh7XG4gICAgICAgICAgICAgICAgc3RvcmU6IHRoaXMuZGF0YSxcbiAgICAgICAgICAgICAgICBxdWVyeTogb3B0aW9ucy5xdWVyeSxcbiAgICAgICAgICAgICAgICByZXN1bHQ6IG9wdGlvbnMucmVzdWx0LFxuICAgICAgICAgICAgICAgIGRhdGFJZDogb3B0aW9ucy5kYXRhSWQsXG4gICAgICAgICAgICAgICAgdmFyaWFibGVzOiBvcHRpb25zLnZhcmlhYmxlcyxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGZpbmFsbHkge1xuICAgICAgICAgICAgaWYgKCEtLXRoaXMudHhDb3VudCAmJiBvcHRpb25zLmJyb2FkY2FzdCAhPT0gZmFsc2UpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmJyb2FkY2FzdFdhdGNoZXMoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH07XG4gICAgSW5NZW1vcnlDYWNoZS5wcm90b3R5cGUubW9kaWZ5ID0gZnVuY3Rpb24gKG9wdGlvbnMpIHtcbiAgICAgICAgaWYgKGhhc093bi5jYWxsKG9wdGlvbnMsIFwiaWRcIikgJiYgIW9wdGlvbnMuaWQpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgc3RvcmUgPSBvcHRpb25zLm9wdGltaXN0aWNcbiAgICAgICAgICAgID8gdGhpcy5vcHRpbWlzdGljRGF0YVxuICAgICAgICAgICAgOiB0aGlzLmRhdGE7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICArK3RoaXMudHhDb3VudDtcbiAgICAgICAgICAgIHJldHVybiBzdG9yZS5tb2RpZnkob3B0aW9ucy5pZCB8fCBcIlJPT1RfUVVFUllcIiwgb3B0aW9ucy5maWVsZHMpO1xuICAgICAgICB9XG4gICAgICAgIGZpbmFsbHkge1xuICAgICAgICAgICAgaWYgKCEtLXRoaXMudHhDb3VudCAmJiBvcHRpb25z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WNEYXRhO1xuICAgICAgICAgICAgdGhpcy5icm9hZGNhc3RXYXRjaGVzKCk7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIEluTWVtb3J5Q2FjaGUucHJvdG90eXBlLnBlcmZvcm1UcmFuc2FjdGlvbiA9IGZ1bmN0aW9uICh0cmFuc2FjdGlvbiwgb3B0aW1pc3RpY0lkKSB7XG4gICAgICAgIHZhciBfdGhpcyA9IHRoaXM7XG4gICAgICAgIHZhciBwZXJmb3JtID0gZnVuY3Rpb24gKGxheWVyKSB7XG4gICAgICAgICAgICB2YXIgX2EgPSBfdGhpcywgZGF0YSA9IF9hLmRhdGEsIG9wdGltaXN0aWNEYXRhID0gX2Eub3B0aW1pc3RpY0RhdGE7XG4gICAgICAgICAgICArK190aGlzLnR4Q291bnQ7XG4gICAgICAgICAgICBpZiAobGF5ZXIpIHtcbiAgICAgICAgICAgICAgICBfdGhpcy5kYXRhID0gX3RoaXMub3B0aW1pc3RpY0RhdGEgPSBsYXllcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgdHJhbnNhY3Rpb24oX3RoaXMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZmluYWxseSB7XG4gICAgICAgICAgICAgICAgLS1fdGhpcy50eENvdW50O1xuICAgICAgICAgICAgICAgIF90aGlzLmRhdGEgPSBkYXRhO1xuICAgICAgICAgICAgICAgIF90aGlzLm9wdGltaXN0aWNEYXRhID0gb3B0aW1pc3RpY0RhdGE7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIHZhciBmcm9tT3B0aW1pc3RpY1RyYW5zYWN0aW9uID0gZmFsc2U7XG4gICAgICAgIGlmICh0eXBlb2Ygb3B0aW1pc3RpY0lkID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgdGhpcy5vcHRpbWlzdGljRGF0YSA9IHRoaXMub3B0aW1pc3RpY0RhdGEuYWRkTGF5ZXIob3B0aW1pc3Rp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kZyb21TcGVjaWZpZXIoc3BlY2lmaWVyT3JJZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZCA9IHNwZWNpZmllck9ySWQ7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWQgPSBpZCAmJiBTdHJpbmcoaWQpO1xuICAgICAgICByZXR1cm4gY29udGV4dC5rZXlPYmplY3QgPyBbaWQsIGNvbnRleHQua2V5T2JqZWN0XSA6IFtpZF07XG4gICAgfTtcbiAgICBQb2xpY2llcy5wcm90b3R5cGUuYWRkVHlwZVBvbGljaWVzID0gZnVuY3Rpb24gKHR5cGVQb2xpY2llcykge1xuICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xuICAgICAgICBPYmplY3Qua2V5cyh0eXBlUG9saWNpZXMpLmZvckVhY2goZnVuY3Rpb24gKHR5cGVuYW1lKSB7XG4gICAgICAgICAgICB2YXIgZXhpc3RpbmcgPSBfdGhpcy5nZXRUeXBlUG9saWN5KHR5cGVuYW1lLCB0cnVlKTtcbiAgICAgICAgICAgIHZhciBpbmNvbWluZyA9IHR5cGVQb2xpY2llc1t0eXBlbmFtZV07XG4gICAgICAgICAgICB2YXIga2V5RmllbGRzID0gaW5jb21pbmcua2V5RmllbGRzLCBmaWVsZHMgPSBpbmNvbWluZy5maWVsZHM7XG4gICAgICAgICAgICBpZiAoaW5jb21pbmcucXVlcnlUeXBlKVxuICAgICAgICAgICAgICAgIF90aGlzLnNldFJvb3RUeXBlbmFtZShcIlF1ZXJ5XCIsIHR5cGVuYW1lKTtcbiAgICAgICAgICAgIGlmIChpbmNvbWluZy5tdXRhdGlvblR5cGUpXG4gICAgICAgICAgICAgICAgX3RoaXMuc2V0Um9vdFR5cGVuYW1lKFwiTXV0YXRpb25cIiwgdHlwZW5hbWUpO1xuICAgICAgICAgICAgaWYgKGluY29taW5nLnN1YnNjcmlwdGlvblR5cGUpXG4gICAgICAgICAgICAgICAgX3RoaXMuc2V0Um9vdFR5cGVuYW1lKFwiU3Vic2NyaXB0aW9uXCIsIHR5cGVuYW1lKTtcbiAgICAgICAgICAgIGV4aXN0aW5nLmtleUZuID1cbiAgICAgICAgICAgICAgICBrZXlGaWVsZHMgPT09IGZhbHNlID8gbnVsbEtleUZpZWxkc0ZuIDpcbiAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShrZXlGaWVsZHMpID8ga2V5RmllbGRzRm5Gcm9tU3BlY2lmaWVyKGtleUZpZWxkcykgOlxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZW9mIGtleUZpZWxkcyA9PT0gXCJmdW5jdGlvblwiID8ga2V5RmllbGRzIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleGlzdGluZy5rZXlGbjtcbiAgICAgICAgICAgIGlmIChmaWVsZHMpIHtcbiAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhmaWVsZHMpLmZvckVhY2goZnVuY3Rpb24gKGZpZWxkTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgZXhpc3RpbmcgPSBfdGhpcy5nZXRGaWVsZFBvbGljeSh0eXBlbmFtZSwgZmllbGROYW1lLCB0cnVlKTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGluY29taW5nID0gZmllbGRzW2ZpZWxkTmFtZV07XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgaW5jb21pbmcgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgZXhpc3RpbmcucmVhZCA9IGluY29taW5nO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGtleUFyZ3MgPSBpbmNvbWluZy5rZXlBcmdzLCByZWFkID0gaW5jb21pbmcucmVhZCwgbWVyZ2UgPSBpbmNvbWluZy5tZXJnZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4aXN0aW5nLmtleUZuID1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlBcmdzID09PSBmYWxzZSA/IHNpbXBsZUtleUFyZ3NGbiA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkoa2V5QXJncykgPyBrZXlBcmdzRm5Gcm9tU3BlY2lmaWVyKGtleUFyZ3MpIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVvZiBrZXlBcmdzID09PSBcImZ1bmN0aW9uXCIgPyBrZXlBcmdzIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleGlzdGluZy5rZXlGbjtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcmVhZCA9PT0gXCJmdW5jdGlvblwiKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4aXN0aW5nLnJlYWQgPSByZWFkO1xuICAgICAgICAgICAgICAgICAgICAgICAgZXhpc3RpbmcubWVyZ2UgPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVvZiBtZXJnZSA9PT0gXCJmdW5jdGlvblwiID8gbWVyZ2UgOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXJnZSA9PT0gdHJ1ZSA/IG1lcmdlVHJ1ZUZuIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lcmdlID09PSBmYWxzZSA/IG1lcmdlRmFsc2VGbiA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhpc3RpbmcubWVyZ2U7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKGV4aXN0aW5nLnJlYWQgJiYgZXhpc3RpbmcubWVyZ2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4aXN0aW5nLmtleUZuID0gZXhpc3Rpbm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1xuICAgICAgICAgICAgICAgICAgICB3b3JrUXVldWVfMS5wdXNoKHN1cGVydHlwZVNldCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHZhciBuZWVkVG9DaGVja0Z1enp5U3VidHlwZXMgPSAhIShyZXN1bHQgJiYgdGhpcy5mdXp6eVN1YnR5cGVzLnNpemUpO1xuICAgICAgICAgICAgdmFyIGNoZWNraW5nRnV6enlTdWJ0eXBlcyA9IGZhbHNlO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCB3b3JrUXVldWVfMS5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgICAgIHZhciBzdXBlcnR5cGVTZXQgPSB3b3JrUXVldWVfMVtpXTtcbiAgICAgICAgICAgICAgICBpZiAoc3VwZXJ0eXBlU2V0LmhhcyhzdXBlcnR5cGUpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghdHlwZW5hbWVTdXBlcnR5cGVTZXQuaGFzKHN1cGVydHlwZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGVja2luZ0Z1enp5U3VidHlwZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzLmVudi5OT0RFX0VOViA9PT0gXCJwcm9kdWN0aW9uXCIgfHwgaW52YXJpYW50Lndhcm4oXCJJbmZlcnJpbmcgc3VidHlwZSBcIiArIHR5cGVuYW1lICsgXCIgb2Ygc3VwZXJ0eXBlIFwiICsgc3VwZXJ0eXBlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVuYW1lU3VwZXJ0eXBlU2V0LmFkZChzdXBlcnR5cGUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzdXBlcnR5cGVTZXQuZm9yRWFjaChtYXliZUVucXVldWVfMSk7XG4gICAgICAgICAgICAgICAgaWYgKG5lZWRUb0NoZWNrRnV6enlTdWJ0eXBlcyAmJlxuICAgICAgICAgICAgICAgICAgICBpID09PSB3b3JrUXVldWVfMS5sZW5ndGggLSAxICYmXG4gICAgICAgICAgICAgICAgICAgIHNlbGVjdGlvblNldE1hdGNoZXNSZXN1bHQoZnJhZ21lbnQuc2VsZWN0aW9uU2V0LCByZXN1bHQsIHZhcmlhYmxlcykpIHtcbiAgICAgICAgICAgICAgICAgICAgbmVlZFRvQ2hlY2tGdXp6eVN1YnR5cGVzID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIGNoZWNraW5nRnV6enlTdWJ0eXBlcyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZnV6enlTdWJ0eXBlcy5mb3JFYWNoKGZ1bmN0aW9uIChyZWdFeHAsIGZ1enp5U3RyaW5nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgbWF0Y2ggPSB0eXBlbmFtZS5tYXRjaChyZWdFeHApO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoICYmIG1hdGNoWzBdID09PSB0eXBlbmFtZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heWJlRW5xdWV1ZV8xKGZ1enp5U3RyaW5nKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9O1xuICAgIFBvbGljaWVzLnByb3RvdHlwZS5nZXRTdG9yZUZpZWxkTmFtZSA9IGZ1bmN0aW9uIChmaWVsZFNwZWMpIHtcbiAgICAgICAgdmFyIHR5cGVuYW1lID0gZmllbGRTcGVjLnR5cGVuYW1lLCBmaWVsZE5hbWUgPSBmaWVsZFNwZWMuZmllbGROYW1lO1xuICAgICAgICB2YXIgcG9saWN5ID0gdGhpcy5nZXRGaWVsZFBvbGljeSh0eXBlbmFtZSwgZmllbGROYW1lLCBmYWxzZSk7XG4gICAgICAgIHZhciBzdG9yZUZpZWxkTmFtZTtcbiAgICAgICAgdmFyIGtleUZuID0gcG9saWN5ICYmIHBvbGljeS5rZXlGbjtcbiAgICAgICAgaWYgKGtleUZuICYmIHR5cGVuYW1lKSB7XG4gICAgICAgICAgICB2YXIgY29udGV4dCA9IHtcbiAgICAgICAgICAgICAgICB0eXBlbmFtZTogdHlwZW5hbWUsXG4gICAgICAgICAgICAgICAgZmllbGROYW1lOiBmaWVsZE5hbWUsXG4gICAgICAgICAgICAgICAgZmllbGQ6IGZpZWxkU3BlYy5maWVsZCB8fCBudWxsLFxuICAgICAgICAgICAgICAgIHZhcmlhYmxlczogZmllbGRTcGVjLnZhcmlhYmxlcyxcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICB2YXIgYXJncyA9IGFyZ3NGcm9tRmllbGRTcGVjaWZpZXIoZmllbGRTcGVjKTtcbiAgICAgICAgICAgIHdoaWxlIChrZXlGbikge1xuICAgICAgICAgICAgICAgIHZhciBzcGVjaWZpZXJPclN0cmluZyA9IGtleUZuKGFyZ3MsIGNvbnRleHQpO1xuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KHNwZWNpZmllck9yU3RyaW5nKSkge1xuICAgICAgICAgICAgICAgICAgICBrZXlGbiA9IGtleUFyZ3NGbkZyb21TcGVjaWZpZXIoc3BlY2lmaWVyT3JTdHJpbmcpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc3RvcmVGaWVsZE5hbWUgPSBzcGVjaWZpZXJPclN0cmluZyB8fCBmaWVsZE5hbWU7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB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iAgICAgICAgYXJnczogYXJnc0Zyb21GaWVsZFNwZWNpZmllcihmaWVsZFNwZWMpLFxuICAgICAgICBmaWVsZDogZmllbGRTcGVjLmZpZWxkIHx8IG51bGwsXG4gICAgICAgIGZpZWxkTmFtZTogZmllbGROYW1lLFxuICAgICAgICBzdG9yZUZpZWxkTmFtZTogc3RvcmVGaWVsZE5hbWUsXG4gICAgICAgIHZhcmlhYmxlczogdmFyaWFibGVzLFxuICAgICAgICBpc1JlZmVyZW5jZTogaXNSZWZlcmVuY2UsXG4gICAgICAgIHRvUmVmZXJlbmNlOiB0b1JlZmVyZW5jZSxcbiAgICAgICAgc3RvcmFnZTogc3RvcmFnZSxcbiAgICAgICAgY2FjaGU6IHBvbGljaWVzLmNhY2hlLFxuICAgICAgICBjYW5SZWFkOiBjYW5SZWFkLFxuICAgICAgICByZWFkRmllbGQ6IGZ1bmN0aW9uIChmaWVsZE5hbWVPck9wdGlvbnMsIGZyb20pIHtcbiAgICAgICAgICAgIHZhciBvcHRpb25zID0gdHlwZW9mIGZpZWxkTmFtZU9yT3B0aW9ucyA9PT0gXCJzdHJpbmdcIiA/IHtcbiAgICAgICAgICAgICAgICBmaWVsZE5hbWU6IGZpZWxkTmFtZU9yT3B0aW9ucyxcbiAgICAgICAgICAgICAgICBmcm9tOiBmcm9tLFxuICAgICAgICAgICAgfSA6IF9fYXNzaWduKHt9LCBmaWVsZE5hbWVPck9wdGlvbnMpO1xuICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gb3B0aW9ucy5mcm9tKSB7XG4gICAgICAgICAgICAgICAgb3B0aW9ucy5mcm9tID0gb2JqZWN0T3JSZWZlcmVuY2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodm9pZCAwID09PSBvcHRpb25zLnZhcmlhYmxlcykge1xuICAgICAgICAgICAgICAgIG9wdGlvbnMudmFyaWFibGVzID0gdmFyaWFibGVzO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHBvbGljaWVzLnJlYWRGaWVsZChvcHRpb25zLCBjb250ZXh0KTtcbiAgICAgICAgfSxcbiAgICAgICAgbWVyZ2VPYmplY3RzOiBmdW5jdGlvbiAoZXhpc3RpbmcsIGluY29taW5nKSB7XG4gICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShleGlzdGluZykgfHwgQXJyYXkuaXNBcnJheShpbmNvbWluZykpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBwcm9jZXNzLmVudi5OT0RFX0VOViA9PT0gXCJwcm9kdWN0aW9uXCIgPyBuZXcgSW52YXJpYW50RXJyb3IoMikgOiBuZXcgSW52YXJpYW50RXJyb3IoXCJDYW5ub3QgYXV0b21hdGljYWxseSBtZXJnZSBhcnJheXNcIik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXhpc3RpbmcgJiYgdHlwZW9mIGV4aXN0aW5nID09PSBcIm9iamVjdFwiICYmXG4gICAgICAgICAgICAgICAgaW5jb21pbmcgJiYgdHlwZW9mIGluY29taW5nID09PSBcIm9iamVjdFwiKSB7XG4gICAgICAgICAgICAgICAgdmFyIGVUeXBlID0gZ2V0RmllbGRWYWx1ZShleGlzdGluZywgXCJfX3R5cGVuYW1lXCIpO1xuICAgICAgICAgICAgICAgIHZhciBpVHlwZSA9IGdldEZpZWxkVmFsdWUoaW5jb21pbmcsIFwiX190eXBlbmFtZVwiKTtcbiAgICAgICAgICAgICAgICB2YXIgdHlwZXNEaWZmZXIgPSBlVHlwZSAmJiBpVHlwZSAmJiBlVHlwZSAhPT0gaVR5cGU7XG4gICAgICAgICAgICAgICAgdmFyIGFwcGxpZWQgPSBwb2xpY2llcy5hcHBseU1lcmdlcyh0eXBlc0RpZmZlciA/IHZvaWQgMCA6IGV4aXN0aW5nLCBpbmNvbWluZywgY29udGV4dCk7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGVzRGlmZmVyIHx8XG4gICAgICAgICAgICAgICAgICAgICFzdG9yZVZhbHVlSXNTdG9yZU9iamVjdChleGlzdGluZykgfHxcbiAgICAgICAgICAgICAgICAgICAgIXN0b3JlVmFsdWVJc1N0b3JlT2JqZWN0KGFwcGxpZWQpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBhcHBsaWVkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gX19hc3NpZ24oX19hc3NpZ24oe30sIGV4aXN0aW5nKSwgYXBwbGllZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gaW5jb21pbmc7XG4gICAgICAgIH1cbiAgICB9O1xufVxuZnVuY3Rpb24ga2V5QXJnc0ZuRnJvbVNwZWNpZmllcihzcGVjaWZpZXIpIHtcbiAgICByZXR1cm4gZnVuY3Rpb24gKGFyZ3MsIGNvbnRleHQpIHtcbiAgICAgICAgcmV0dXJuIGFyZ3MgPyBjb250ZXh0LmZpZWxkTmFtZSArIFwiOlwiICsgSlNPTi5zdHJpbmdpZnkoY29tcHV0ZUtleU9iamVjdChhcmdzLCBzcGVjaWZpZXIpKSA6IGNvbnRleHQuZmllbGROYW1lO1xuICAgIH07XG59XG5mdW5jdGlvbiBrZXlGaWVsZHNGbkZyb21TcGVjaWZpZXIoc3BlY2lmaWVyKSB7XG4gICAgdmFyIHRyaWUgPSBuZXcgS2V5VHJpZShjYW5Vc2VXZWFrTWFwKTtcbiAgICByZXR1cm4gZnVuY3Rpb24gKG9iamVjdCwgY29udGV4dCkge1xuICAgICAgICB2YXIgYWxpYXNNYXA7XG4gICAgICAgIGlmIChjb250ZXh0LnNlbGVjdGlvblNldCAmJiBjb250ZXh0LmZyYWdtZW50TWFwKSB7XG4gICAgICAgICAgICB2YXIgaW5mbyA9IHRyaWUubG9va3VwQXJyYXkoW1xuICAgICAgICAgICAgICAgIGNvbnRleHQuc2VsZWN0aW9uU2V0LFxuICAgICAgICAgICAgICAgIGNvbnRleHQuZnJhZ21lbnRNYXAsXG4gICAgICAgICAgICBdKTtcbiAgICAgICAgICAgIGFsaWFzTWFwID0gaW5mby5hbGlhc01hcCB8fCAoaW5mby5hbGlhc01hcCA9IG1ha2VBbGlhc01hcChjb250ZXh0LnNlbGVjdGlvblNldCwgY29udGV4dC5mcmFnbWVudE1hcCkpO1xuICAgICAgICB9XG4gICAgICAgIHZhciBrZXlPYmplY3QgPSBjb250ZXh0LmtleU9iamVjdCA9XG4gICAgICAgICAgICBjb21wdXRlS2V5T2JqZWN0KG9iamVjdCwgc3BlY2lmaWVyLCBhbGlhc01hcCk7XG4gICAgICAgIHJldHVybiBjb250ZXh0LnR5cGVuYW1lICsgXCI6XCIgKyBKU09OLnN0cmluZ2lmeShrZXlPYmplY3QpO1xuICAgIH07XG59XG5mdW5jdGlvbiBtYWtlQWxpYXNNYXAoc2VsZWN0aW9uU2V0LCBmcmFnbWVudE1hcCkge1xuICAgIHZhciBtYXAgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICAgIHZhciB3b3JrUXVldWUgPSBuZXcgU2V0KFtzZWxlY3Rpb25TZXRdKTtcbiAgICB3b3JrUXVldWUuZm9yRWFjaChmdW5jdGlvbiAoc2VsZWN0aW9uU2V0KSB7XG4gICAgICAgIHNlbGVjdGlvblNldC5zZWxlY3Rpb25zLmZvckVhY2goZnVuY3Rpb24gKHNlbGVjdGlvbikge1xuICAgICAgICAgICAgaWYgKGlzRmllbGQoc2VsZWN0aW9uKSkge1xuICAgICAgICAgICAgICAgIGlmIChzZWxlY3Rpb24uYWxpYXMpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3BvbnNlS2V5ID0gc2VsZWN0aW9uLmFsaWFzLnZhbHVlO1xuICAgICAgICAgICAgICAgICAgICB2YXIgc3RvcmVLZXkgPSBzZWxlY3Rpb24ubmFtZS52YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHN0b3JlS2V5ICE9PSByZXNwb25zZUtleSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGFsaWFzZXMgPSBtYXAuYWxpYXNlcyB8fCAobWFwLmFsaWFzZXMgPSBPYmplY3QuY3JlYXRlKG51bGwpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFsaWFzZXNbc3RvcmVLZXldID0gcmVzcG9uc2VLZXk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHNlbGVjdGlvbi5zZWxlY3Rpb25TZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHN1YnNldHMgPSBtYXAuc3Vic2V0cyB8fCAobWFwLnN1YnNldHMgPSBPYmplY3QuY3JlYXRlKG51bGwpKTtcbiAgICAgICAgICAgICAgICAgICAgc3Vic2V0c1tzZWxlY3Rpb24ubmFtZS52YWx1ZV0gPVxuICAgICAgICAgICAgICAgICAgICAgICAgbWFrZUFsaWFzTWFwKHNlbGVjdGlvbi5zZWxlY3Rpb25TZXQsIGZyYWdtZW50TWFwKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YXIgZnJhZ21lbnQgPSBnZXRGcmFnbWVudEZyb21TZWxlY3Rpb24oc2VsZWN0aW9uLCBmcmFnbWVudE1hcCk7XG4gICAgICAgICAgICAgICAgaWYgKGZyYWdtZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIHdvcmtRdWV1ZS5hZGQoZnJhZ21lbnQuc2VsZWN0aW9uU2V0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH0pO1xuICAgIHJldHVybiBtYXA7XG59XG5mdW5jdGlvbiBjb21wdXRlS2V5T2JqZWN0KHJlc3BvbnNlLCBzcGVjaWZpZXIsIGFsaWFzTWFwKSB7XG4gICAgdmFyIGtleU9iaiA9IE9iamVjdC5jcmVhdGUobnVsbCk7XG4gICAgdmFyIHByZXZLZXk7XG4gICAgc3BlY2lmaWVyLmZvckVh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SxcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5jb250ZXh0LFxuICAgICAgICAgICAgICAgIF07XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbWFrZUNhY2hlS2V5OiBmdW5jdGlvbiAoc2VsZWN0aW9uU2V0LCBwYXJlbnQsIGNvbnRleHQpIHtcbiAgICAgICAgICAgICAgICBpZiAoc3VwcG9ydHNSZXN1bHRDYWNoaW5nKGNvbnRleHQuc3RvcmUpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjb250ZXh0LnN0b3JlLm1ha2VDYWNoZUtleShzZWxlY3Rpb25TZXQsIGlzUmVmZXJlbmNlKHBhcmVudCkgPyBwYXJlbnQuX19yZWYgOiBwYXJlbnQsIGNvbnRleHQudmFyU3RyaW5nKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLmtub3duUmVzdWx0cyA9IG5ldyBXZWFrTWFwKCk7XG4gICAgICAgIHRoaXMuZXhlY3V0ZVN1YlNlbGVjdGVkQXJyYXkgPSB3cmFwKGZ1bmN0aW9uIChvcHRpb25zKSB7XG4gICAgICAgICAgICByZXR1cm4gX3RoaXMuZXhlY1N1YlNlbGVjdGVkQXJyYXlJbXBsKG9wdGlvbnMpO1xuICAgICAgICB9LCB7XG4gICAgICAgICAgICBtYWtlQ2FjaGVLZXk6IGZ1bmN0aW9uIChfYSkge1xuICAgICAgICAgICAgICAgIHZhciBmaWVsZCA9IF9hLmZpZWxkLCBhcnJheSA9IF9hLmFycmF5LCBjb250ZXh0ID0gX2EuY29udGV4dDtcbiAgICAgICAgICAgICAgICBpZiAoc3VwcG9ydHNSZXN1bHRDYWNoaW5nKGNvbnRleHQuc3RvcmUpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjb250ZXh0LnN0b3JlLm1ha2VDYWNoZUtleShmaWVsZCwgYXJyYXksIGNvbnRleHQudmFyU3RyaW5nKTtcb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NpZXMsXG4gICAgICAgICAgICAgICAgdmFyaWFibGVzOiB2YXJpYWJsZXMsXG4gICAgICAgICAgICAgICAgdmFyU3RyaW5nOiBKU09OLnN0cmluZ2lmeSh2YXJpYWJsZXMpLFxuICAgICAgICAgICAgICAgIGZyYWdtZW50TWFwOiBjcmVhdGVGcmFnbWVudE1hcChnZXRGcmFnbWVudERlZmluaXRpb25zKHF1ZXJ5KSksXG4gICAgICAgICAgICAgICAgcGF0aDogW10sXG4gICAgICAgICAgICAgICAgY2xpZW50T25seTogZmFsc2UsXG4gICAgICAgICAgICB9LFxuICAgICAgICB9KTtcbiAgICAgICAgdmFyIGhhc01pc3NpbmdGaWVsZHMgPSBleGVjUmVzdWx0Lm1pc3NpbmcgJiYgZXhlY1Jlc3VsdC5taXNzaW5nLmxlbmd0aCA+IDA7XG4gICAgICAgIGlmIChoYXNNaXNzaW5nRmllbGRzICYmICFyZXR1cm5QYXJ0aWFsRGF0YSkge1xuICAgICAgICAgICAgdGhyb3cgZXhlY1Jlc3VsdC5taXNzaW5nWzBdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICByZXN1bHQ6IGV4ZWNSZXN1bHQucmVzdWx0LFxuICAgICAgICAgICAgbWlzc2luZzogZXhlY1Jlc3VsdC5taXNzaW5nLFxuICAgICAgICAgICAgY29tcGxldGU6ICFoYXNNaXNzaW5nRmllbGRzLFxuICAgICAgICB9O1xuICAgIH07XG4gICAgU3RvcmVSZWFkZXIucHJvdG90eXBlLmlzRnJlc2ggPSBmdW5jdGlvbiAocmVzdWx0LCBwYXJlbnQsIHNlbGVjdGlvblNldCwgY29udGV4dCkge1xuICAgICAgICBpZiAoc3VwcG9ydHNSZXN1bHRDYWNoaW5nKGNvbnRleHQuc3RvcmUpICYmXG4gICAgICAgICAgICB0aGlzLmtub3duUmVzdWx0cy5nZXQocmVzdWx0KSA9PT0gc2VsZWN0aW9uU2V0KSB7XG4gICAgICAgICAgICB2YXIgbGF0ZX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ICsgXCIgb2JqZWN0XCIpLCBjb250ZXh0KV0sXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIHZhciB2YXJpYWJsZXMgPSBjb250ZXh0LnZhcmlhYmxlcywgcG9saWNpZXMgPSBjb250ZXh0LnBvbGljaWVzLCBzdG9yZSA9IGNvbnRleHQuc3RvcmU7XG4gICAgICAgIHZhciBvYmplY3RzVG9NZXJnZSA9IFtdO1xuICAgICAgICB2YXIgZmluYWxSZXN1bHQgPSB7IHJlc3VsdDogbnVsbCB9O1xuICAgICAgICB2YXIgdHlwZW5hbWUgPSBzdG9yZS5nZXRGaWVsZFZhbHVlKG9iamVjdE9yUmVmZXJlbmNlLCBcIl9fdHlwZW5hbWVcIik7XG4gICAgICAgIGlmICh0aGlzLmNvbmZpZy5hZGRUeXBlbmFtZSAmJlxuICAgICAgICAgICAgdHlwZW9mIHR5cGVuYW1lID09PSBcInN0cmluZ1wiICYmXG4gICAgICAgICAgICAhcG9saWNpZXMucm9vdElkc0J5VHlwZW5hbWVbdHlwZW5hbWVdKSB7XG4gICAgICAgICAgICBvYmplY3RzVG9NZXJnZS5wdXNoKHsgX190eXBlbmFtZTogdHlwZW5hbWUgfSk7XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gZ2V0TWlzc2luZygpIHtcbiAgICAgICAgICAgIHJldHVybiBmaW5hbFJlc3VsdC5taXNzaW5nIHx8IChmaW5hbFJlc3VsdC5taXNzaW5nID0gW10pO1xuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIGhhbmRsZU1pc3NpbmcocmVzdWx0KSB7XG4gICAgICAgICAgICB2YXIgX2E7XG4gICAgICAgICAgICBpZiAocmVzdWx0Lm1pc3NpbmcpXG4gICAgICAgICAgICAgICAgKF9hID0gZ2V0TWlzc2luZygpKS5wdXNoLmFwcGx5KF9hLCByZXN1bHQubWlzc2luZyk7XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0LnJlc3VsdDtcbiAgICAgICAgfVxuICAgICAgICB2YXIgd29ya1NldCA9IG5ldyBTZXQoc2VsZWN0aW9uU2V0LnNlbGVjdGlvbnMpO1xuICAgICAgICB3b3JrU2V0LmZvckVhY2goZnVuY3Rpb24gKHNlbGVjdGlvbikge1xuICAgICAgICAgICAgdmFyIF9hO1xuICAgICAgICAgICAgaWYgKCFzaG91bGRJbmNsdWRlKHNlbGVjdGlvbiwgdmFyaWFibGVzKSlcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICBpZiAoaXNGaWVsZChzZWxlY3Rpb24pKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZpZWxkVmFsdWUgPSBwb2xpY2llcy5yZWFkRmllbGQoe1xuICAgICAgICAgICAgICAgICAgICBmaWVsZE5hbWU6IHNlbGVjdGlvbi5uYW1lLnZhbHVlLFxuICAgICAgICAgICAgICAgICAgICBmaWVsZDogc2VsZWN0aW9uLFxuICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IGNvbnRleHQudmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICBmcm9tOiBvYmplY3RPclJlZmVyZW5jZSxcbiAgICAgICAgICAgICAgICB9LCBjb250ZXh0KTtcbiAgICAgICAgICAgICAgICB2YXIgcmVzdWx0TmFtZSA9IHJlc3VsdEtleU5hbWVGcm9tRmllbGQoc2VsZWN0aW9uKTtcbiAgICAgICAgICAgICAgICBjb250ZXh0LnBhdGgucHVzaChyZXN1bHROYW1lKTtcbiAgICAgICAgICAgICAgICB2YXIgd2FzQ2xpZW50T25seSA9IGNvbnRleHQuY2xpZW50T25seTtcbiAgICAgICAgICAgICAgICBjb250ZXh0LmNsaWVudE9ubHkgPSB3YXNDbGllbnRPbmx5IHx8ICEhKHNlbGVjdGlvbi5kaXJlY3RpdmVzICYmXG4gICAgICAgICAgICAgICAgICAgIHNlbGVjdGlvbi5kaXJlY3RpdmVzLnNvbWUoZnVuY3Rpb24gKGQpIHsgcmV0dXJuIGQubmFtZS52YWx1ZSA9PT0gXCJjbGllbnRcIjsgfSkpO1xuICAgICAgICAgICAgICAgIGlmIChmaWVsZFZhbHVlID09PSB2b2lkIDApIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFhZGRUeXBlbmFtZVRvRG9jdW1lbnQuYWRkZWQoc2VsZWN0aW9uKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TWlzc2luZygpLnB1c2gobWlzc2luZ0Zyb21JbnZhcmlhbnQocHJvY2Vzcy5lbnYuTk9ERV9FTlYgPT09IFwicHJvZHVjdGlvblwiID8gbmV3IEludmFyaWFudEVycm9yKDUpIDogbmV3IEludmFyaWFudEVycm9yKFwiQ2FuJ3QgZmluZCBmaWVsZCAnXCIgKyBzZWxlY3Rpb24ubmFtZS52YWx1ZSArIFwiJyBvbiBcIiArIChpc1JlZmVyZW5jZShvYmplY3RPclJlZmVyZW5jZSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IG9iamVjdE9yUmVmZXJlbmNlLl9fcmVmICsgXCIgb2JqZWN0XCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IFwib2JqZWN0IFwiICsgSlNPTi5zdHJpbmdpZnkob2JqZWN0T3JSZWZlcmVuY2UsIG51bGwsIDIpKSksIGNvbnRleHQpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmIChBcnJheS5pc0FycmF5KGZpZWxkVmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpZWxkVmFsdWUgPSBoYW5kbGVNaXNzaW5nKF90aGlzLmV4ZWN1dGVTdWJTZWxlY3RlZEFycmF5KHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkOiBzZWxlY3Rpb24sXG4gICAgICAgICAgICAgICAgICAgICAgICBhcnJheTogZmllbGRWYWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IGNvbnRleHQsXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAoIXNlbGVjdGlvbi5zZWxlY3Rpb25TZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSAncHJvZHVjdGlvbicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFzc2VydFNlbGVjdGlvblNldEZvcklkVmFsdWUoY29udGV4dC5zdG9yZSwgc2VsZWN0aW9uLCBmaWVsZFZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1heWJlRGVlcEZyZWV6ZShmaWVsZFZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmIChmaWVsZFZhbHVlICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgZmllbGRWYWx1ZSA9IGhhbmRsZU1pc3NpbmcoX3RoaXMuZXhlY3V0ZVNlbGVjdGlvblNldCh7XG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxlY3Rpb25TZXQ6IHNlbGVjdGlvbi5zZWxlY3Rpb25TZXQsXG4gICAgICAgICAgICAgICAgICAgICAgICBvYmplY3RPclJlZmVyZW5jZTogZmllbGRWYWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IGNvbnRleHQsXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGZpZWxkVmFsdWUgIT09IHZvaWQgMCkge1xuICAgICAgICAgICAgICAgICAgICBvYmplY3RzVG9NZXJnZS5wdXNoKChfYSA9IHt9LCBfYVtyZXN1bHROYW1lXSA9IGZpZWxkVmFsdWUsIF9hKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnRleHQuY2xpZW50T25seSA9IHdhc0NsaW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BfYS5jb250ZXh0O1xuICAgICAgICB2YXIgbWlzc2luZztcbiAgICAgICAgZnVuY3Rpb24gaGFuZGxlTWlzc2luZyhjaGlsZFJlc3VsdCwgaSkge1xuICAgICAgICAgICAgaWYgKGNoaWxkUmVzdWx0Lm1pc3NpbmcpIHtcbiAgICAgICAgICAgICAgICBtaXNzaW5nID0gbWlzc2luZyB8fCBbXTtcbiAgICAgICAgICAgICAgICBtaXNzaW5nLnB1c2guYXBwbHkobWlzc2luZywgY2hpbGRSZXN1bHQubWlzc2luZyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpbnZhcmlhbnQoY29udGV4dC5wYXRoLnBvcCgpID09PSBpKTtcbiAgICAgICAgICAgIHJldHVybiBjaGlsZFJlc3VsdC5yZXN1bHQ7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGZpZWxkLnNlbGVjdGlvblNldCkge1xuICAgICAgICAgICAgYXJyYXkgPSBhcnJheS5maWx0ZXIoY29udGV4dC5zdG9yZS5jYW5SZWFkKTtcbiAgICAgICAgfVxuICAgICAgICBhcnJheSA9IGFycmF5Lm1hcChmdW5jdGlvbiAoaXRlbSwgaSkge1xuICAgICAgICAgICAgaWYgKGl0ZW0gPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnRleHQucGF0aC5wdXNoKGkpO1xuICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoaXRlbSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlTWlzc2luZyhfdGhpcy5leGVjdXRlU3ViU2VsZWN0ZWRBcnJheSh7XG4gICAgICAgICAgICAgICAgICAgIGZpZWxkOiBmaWVsZCxcbiAgICAgICAgICAgICAgICAgICAgYXJyYXk6IGl0ZW0sXG4gICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IGNvbnRleHQsXG4gICAgICAgICAgICAgICAgfSksIGkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGZpZWxkLnNlbGVjdGlvblNldCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBoYW5kbGVNaXNzaW5nKF90aGlzLmV4ZWN1dGVTZWxlY3Rpb25TZXQoe1xuICAgICAgICAgICAgICAgICAgICBzZWxlY3Rpb25TZXQ6IGZpZWxkLnNlbGVjdGlvblNldCxcbiAgICAgICAgICAgICAgICAgICAgb2JqZWN0T3JSZWZlcmVuY2U6IGl0ZW0sXG4gICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IGNvbnRleHQsXG4gICAgICAgICAgICAgICAgfSksIGkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSAncHJvZHVjdGlvbicpIHtcbiAgICAgICAgICAgICAgICBhc3NlcnRTZWxlY3Rpb25TZXRGb3JJZFZhbHVlKGNvbnRleHQuc3RvcmUsIGZpZWxkLCBpdGVtKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGludmFyaWFudChjb250ZXh0LnBhdGgucG9wKCkgPT09IGkpO1xuICAgICAgICAgICAgcmV0dXJuIGl0ZW07XG4gICAgICAgIH0pO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09ICdwcm9kdWN0aW9uJykge1xuICAgICAgICAgICAgT2JqZWN0LmZyZWV6ZShhcnJheSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHsgcmVzdWx0OiBhcnJheSwgbWlzc2luZzogbWlzc2luZyB9O1xuICAgIH07XG4gICAgcmV0dXJuIFN0b3JlUmVhZGVyO1xufSgpKTtcbmV4cG9ydCB7IFN0b3JlUmVhZGVyIH07XG5mdW5jdGlvbiBhc3NlcnRTZWxlY3Rpb25TZXRGb3JJZFZhbHVlKHN0b3JlLCBmaWVsZCwgZmllbGRWYWx1ZSkge1xuICAgIGlmICghZmllbGQuc2VsZWN0aW9uU2V0KSB7X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SksIHZhcmlhYmxlcyk7XG4gICAgICAgIHZhciByZWYgPSB0aGlzLnByb2Nlc3NTZWxlY3Rpb25TZXQoe1xuICAgICAgICAgICAgcmVzdWx0OiByZXN1bHQgfHwgT2JqZWN0LmNyZWF0ZShudWxsKSxcbiAgICAgICAgICAgIGRhdGFJZDogZGF0YUlkLFxuICAgICAgICAgICAgc2VsZWN0aW9uU2V0OiBvcGVyYXRpb25EZWZpbml0aW9uLnNlbGVjdGlvblNldCxcbiAgICAgICAgICAgIGNvbnRleHQ6IHtcbiAgICAgICAgICAgICAgICBzdG9yZTogc3RvcmUsXG4gICAgICAgICAgICAgICAgd3JpdHRlbjogT2JqZWN0LmNyZWF0ZShudWxsKSxcbiAgICAgICAgICAgICAgICBtZXJnZTogZnVuY3Rpb24gKGV4aXN0aW5nLCBpbmNvbWluZykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWVyZ2VyLm1lcmdlKGV4aXN0aW5nLCBpbmNvbWluZyk7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IHZhcmlhYmxlcyxcbiAgICAgICAgICAgICAgICB2YXJTdHJpbmc6IEpTT04uc3RyaW5naWZ5KHZhcmlhYmxlcyksXG4gICAgICAgICAgICAgICAgZnJhZ21lbnRNYXA6IGNyZWF0ZUZyYWdtZW50TWFwKGdldEZyYWdtZW50RGVmaW5pdGlvbnMocXVlcnkpKSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgIH0pO1xuICAgICAgICBpZiAoIWlzUmVmZXJlbmNlKHJlZikpIHtcbiAgICAgICAgICAgIHRocm93IHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSBcInByb2R1Y3Rpb25cIiA/IG5ldyBJbnZhcmlhbnRFcnJvcig3KSA6IG5ldyBJbnZhcmlhbnRFcnJvcihcIkNvdWxkIG5vdCBpZGVudGlmeSBvYmplY3QgXCIgKyBKU09OLnN0cmluZ2lmeShyZXN1bHQpKTtcbiAgICA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ldHVybjtcbiAgICAgICAgICAgIGlmIChpc0ZpZWxkKHNlbGVjdGlvbikpIHtcbiAgICAgICAgICAgICAgICB2YXIgcmVzdWx0RmllbGRLZXkgPSByZXN1bHRLZXlOYW1lRnJvbUZpZWxkKHNlbGVjdGlvbik7XG4gICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gcmVzdWx0W3Jlc3VsdEZpZWxkS2V5XTtcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICAgICAgICB2YXIgc3RvcmVGaWVsZE5hbWUgPSBwb2xpY2llcy5nZXRTdG9yZUZpZWxkTmFtZSh7XG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlbmFtZTogdHlwZW5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWVsZE5hbWU6IHNlbGVjdGlvbi5uYW1lLnZhbHVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgZmllbGQ6IHNlbGVjdGlvbixcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogY29udGV4dC52YXJpYWJsZXMsXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB2YXIgaW5jb21pbmdWYWx1ZSA9IF90aGlzLnByb2Nlc3NGaWVsZFZhbHVlKHZhbHVlLCBzZWxlY3Rpb24sIGNvbnRleHQsIG91dCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChwb2xpY2llcy5oYXNNZXJnZUZ1bmN0aW9uKHR5cGVuYW1lLCBzZWxlY3Rpb24ubmFtZS52YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGluY29taW5nVmFsdWUgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgX19maWVsZDogc2VsZWN0aW9uLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fdHlwZW5hbWU6IHR5cGVuYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fdmFsdWU6IGluY29taW5nVmFsdWUsXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICAgICAgb3V0LnNob3VsZEFwcGx5TWVyZ2VzID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBtZXJnZWRGaWVsZHMgPSBjb250ZXh0Lm1lcmdlKG1lcmdlZEZpZWxkcywgKF9hID0ge30sXG4gICAgICAgICAgICAgICAgICAgICAgICBfYVtzdG9yZUZpZWxkTmFtZV0gPSBpbmNvbWluZ1ZhbHVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgX2EpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAocG9saWNpZXMudXNpbmdQb3NzaWJsZVR5cGVzICYmXG4gICAgICAgICAgICAgICAgICAgICFoYXNEaXJlY3RpdmVzKFtcImRlZmVyXCIsIFwiY2xpZW50XCJdLCBzZWxlY3Rpb24pKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSBcInByb2R1Y3Rpb25cIiA/IG5ldyBJbnZhcmlhbnRFcnJvcig4KSA6IG5ldyBJbnZhcmlhbnRFcnJvcihcIk1pc3NpbmcgZmllbGQgJ1wiICsgcmVzdWx0RmllbGRLZXkgKyBcIicgaW4gXCIgKyBKU09OLnN0cmluZ2lmeShyZXN1bHQsIG51bGwsIDIpLnN1YnN0cmluZygwLCAxMDApKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YXIgZnJhZ21lbnQgPSBnZXRGcmFnbWVudEZyb21TZWxlY3Rpb24oc2VsZWN0aW9uLCBjb250ZXh0LmZyYWdtZW50TWFwKTtcbiAgICAgICAgICAgICAgICBpZiAoZnJhZ21lbnQgJiZcbiAgICAgICAgICAgICAgICAg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Y29udGV4dC5zdG9yZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnRleHQuc3RvcmUubWVyZ2UoZGF0YUlkLCBtZXJnZWRGaWVsZHMpO1xuICAgICAgICAgICAgcmV0dXJuIGVudGl0eVJlZl8xO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXJnZWRGaWVsZHM7XG4gICAgfTtcbiAgICBTdG9yZVdyaXRlci5wcm90b3R5cGUucHJvY2Vzc0ZpZWxkVmFsdWUgPSBmdW5jdGlvbiAodmFsdWUsIGZpZWxkLCBjb250ZXh0LCBvdXQpIHtcbiAgICAgICAgdmFyIF90aGlzID0gdGhpcztcbiAgICAgICAgaWYgKCFmaWVsZC5zZWxlY3Rpb25TZXQgfHwgdmFsdWUgPT09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiBwcm9jZXNzLmVudi5OT0RFX0VOViA9PT0gJ3Byb2R1Y3Rpb24nID8gdmFsdWUgOiBjbG9uZURlZXAodmFsdWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChBcnJheS5pc0FycmF5KHZhbHVlKSkge1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlLm1hcChmdW5jdGlvbiAoaXRlbSkgeyByZXR1cm4gX3RoaXMucHJvY2Vzc0ZpZWxkVmFsdWUoaXRlbSwgZmllbGQsIGNvbnRleHQsIG91dCk7IH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzLnByb2Nlc3NTZWxlY3Rpb25TZXQoe1xuICAgICAgICAgICAgcmVzdWx0OiB2YWx1ZSxcbiAgICAgICAgICAgIHNlbGVjdGlvblNldDogZmllbGQuc2VsZWN0aW9uU2V0LFxuICAgICAgICAgICAgY29udGV4dDogY29udGV4dCxcbiAgICAgICAgICAgIG91dDogb3V0LFxuICAgICAgICB9KTtcbiAgICB9O1xuICAgIHJldHVybiBTdG9yZVdya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09PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93Lm5hdmlnYXRvciAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Lm5hdmlnYXRvci51c2VyQWdlbnQgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoJ0Nocm9tZScpID4gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZGVidWcoJ0Rvd25sb2FkIHRoZSBBcG9sbG8gRGV2VG9vbHMgJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZvciBhIGJldHRlciBkZXZlbG9wbWVudCBleHBlcmllbmNlOiAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9jaHJvbWUuZ29vZ2xlLmNvbS93ZWJzdG9yZS9kZXRhaWwvYXBvbGxvLWNsaWVudC1kZXZlbG9wZXItdC9qZGtrbmtrYmViYmFwaWxnb2VjY2NpZ2xrZmJtYm5mbScpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHRoaXMudmVyc2lvbiA9IHZlcnNpb247XG4gICAgICAgIHRoaXMubG9jYWxTdGF0ZSA9IG5ldyBMb2NhbFN0YXRlKHtcbiAgICAgICAgICAgIGNhY2hlOiBjYWNoZSxcbiAgICAgICAgICAgIGNsaWVudDogdGhpcyxcbiAgICAgICAgICAgIHJlc29sdmVyczogcmVzb2x2ZXJzLFxuICAgICAgICAgICAgZnJhZ21lbnRNYXRjaGVyOiBmcmFnbWVudE1hdGNoZXIsXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLnF1ZXJ5TWFuYWdlciA9IG5ldyBRdWVyeU1hbmFnZXIoe1xuICAgICAgICAgICAgY2FjaGU6IHRoaXMuY2FjaGUsXG4gICAgICAgICAgICBsaW5rOiB0aGlzLmxpbmssXG4gICAgICAgICAgICBxdWVyeURlZHVwbGljYXRpb246IHF1ZXJ5RGVkdXBsaWNhdGlvbixcbiAgICAgICAgICAgIHNzck1vZGU6IHNzck1vZGUsXG4gICAgICAgICAgICBjbGllbnRBd2FyZW5lc3M6IHtcbiAgICAgICAgICAgICAgICBuYW1lOiBjbGllbnRBd2FyZW5lc3NOYW1lLFxuICAgICAgICAgICAgICAgIHZlcnNpb246IGNsaWVudEF3YXJlbmVzc1ZlcnNpb24sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbG9jYWxTdGF0ZTogdGhpcy5sb2NhbFN0YXRlLFxuICAgICAgICAgICAgYXNzdW1lSW1tdXRhYmxlUmVzdWx0czogYXNzdW1lSW1tdXRhYmxlUmVzdWx0cyxcbiAgICAgICAgICAgIG9uQnJvYWRjYXN0OiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgaWYgKF90aGlzLmRldlRvb2xzSG9va0NiKSB7XG4gICAgICAgICAgICAgICAgICAgIF90aGlzLmRldlRvb2xzSG9va0NiKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjoge30sXG4gICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZToge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1ZXJpZXM6IF90aGlzLnF1ZXJ5TWFuYWdlci5nZXRRdWVyeVN0b3JlKCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbXV0YXRpb25zOiBfdGhpcy5xdWVyeU1hbmFnZXIubXV0YXRpb25TdG9yZS5nZXRTdG9yZSgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFXaXRoT3B0aW1pc3RpY1Jlc3VsdHM6IF90aGlzLmNhY2hlLmV4dHJhY3QodHJ1ZSksXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAg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vY3VtZW50LCB2YXJpYWJsZXMpIHx8IHt9LCB0aGlzLnByZXBhcmVDb250ZXh0KGNvbnRleHQpLCB2YXJpYWJsZXMpLnRoZW4oZnVuY3Rpb24gKGRhdGEpIHsgcmV0dXJuIChfX2Fzc2lnbihfX2Fzc2lnbih7fSwgdmFyaWFibGVzKSwgZGF0YS5leHBvcnRlZFZhcmlhYmxlcykpOyB9KV07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBbMiwgX19hc3NpZ24oe30sIHZhcmlhYmxlcyldO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH07XG4gICAgTG9jYWxTdGF0ZS5wcm90b3R5cGUuc2hvdWxkRm9yY2VSZXNvbHZlcnMgPSBmdW5jdGlvbiAoZG9jdW1lbnQpIHtcbiAgICAgICAgdmFyIGZvcmNlUmVzb2x2ZXJzID0gZmFsc2U7XG4gICAgICAgIHZpc2l0KGRvY3VtZW50LCB7XG4gICAgICAgICAgICBEaXJlY3RpdmU6IHtcbiAgICAgICAgICAgICAgICBlbnRlcjogZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG5vZGUubmFtZS52YWx1ZSA9PT0gJ2NsaWVudCcgJiYgbm9kZS5hcmd1bWVudHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvcmNlUmVzb2x2ZXJzID0gbm9kZS5hcmd1bWVudHMuc29tZShmdW5jdGlvbiAoYXJnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFyZy5uYW1lLnZhbHVlID09PSAnYWx3YXlzJyAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmcudmFsdWUua2luZCA9PT0gJ0Jvb2xlYW5WYWx1ZScgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnLnZhbHVlLnZhbHVlID09PSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICA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hdGNoZXIgPSBmdW5jdGlvbiAoKSB7IHJldHVybiB0cnVlOyB9OyB9XG4gICAgICAgIGlmIChvbmx5UnVuRm9yY2VkUmVzb2x2ZXJzID09PSB2b2lkIDApIHsgb25seVJ1bkZvcmNlZFJlc29sdmVycyA9IGZhbHNlOyB9XG4gICAgICAgIHJldHVybiBfX2F3YWl0ZXIodGhpcywgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBtYWluRGVmaW5pdGlvbiwgZnJhZ21lbnRzLCBmcmFnbWVudE1hcCwgZGVmaW5pdGlvbk9wZXJhdGlvbiwgZGVmYXVsdE9wZXJhdGlvblR5cGUsIF9hLCBjYWNoZSwgY2xpZW50LCBleGVjQ29udGV4dDtcbiAgICAgICAgICAgIHJldHVybiBfX2dlbmVyYXRvcih0aGlzLCBmdW5jdGlvbiAoX2IpIHtcbiAgICAgICAgICAgICAgICBtYWluRGVmaW5pdGlvbiA9IGdldE1haW5EZWZpbml0aW9uKGRvY3VtZW50KTtcbiAgICAgICAgICAgICAgICBmcmFnbWVudHMgPSBnZXRGcmFnbWVudERlZmluaXRpb25zKGRvY3VtZW50KTtcbiAgICAgICAgICAgICAgICBmcmFnbWVudE1hcCA9IGNyZWF0ZUZyYWdtZW50TWFwKGZyYWdtZW50cyk7XG4gICAgICAgICAgICAgICAgZGVmaW5pdGlvbk9wZXJhdGlvbiA9IG1haW5EZWZpbml0aW9uXG4gICAgICAgICAgICAgICAgICAgIC5vcGVyYXRpb247XG4gICAgICAgICAgICAgICAgZGVmYXVsdE9wZXJhdGlvblR5cGUgPSBkZWZpbml0aW9uT3BlcmF0aW9uXG4gICAgICAgICAgICAgICAgICAgID8gZGVmaW5pdGlvbk9wZXJhdGlvbi5jaGFyQXQoMCkudG9VcHBlckNhc2UoKSArXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWZpbml0aW9uT3BlcmF0aW9uLnNsaWNlKDEpXG4gICAgICAgICAgICAgICAgICAgIDogJ1F1ZXJ5JztcbiAgICAgICAgICAgICAgICBfYSA9IHRoaXMsIGNhY2hlID0gX2EuY2FjaGUsIGNsaWVudCA9IF9hLmNsaWVudDtcbiAgICAgICAgICAgICAgICBleGVjQ29udGV4dCA9IHtcbiAgICAgICAgICAgICAgICAgICAgZnJhZ21lbnRNYXA6IGZyYWdtZW50TWFwLFxuICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiBfX2Fzc2lnbihfX2Fzc2lnbih7fSwgY29udGV4dCksIHsgY2FjaGU6IGNhY2hlLFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50OiBjbGllbnQgfSksXG4gICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogdmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICBmcmFnbWVudE1hdGNoZXI6IGZyYWdtZW50TWF0Y2hlcixcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdE9wZXJhdGlvblR5cGU6IGRlZmF1bHRPcGVyYXRpb25UeXBlLFxuICAgICAgICAgICAgICAgICAgICBleHBvcnRlZFZhcmlhYmxlczoge30sXG4gICAgICAgICAgICAgICAgICAgIG9ubHlSdW5Gb3JjZWRSZXNvbHZlcnM6IG9ubHlSdW5Gb3JjZWRSZXNvbHZlcnMsXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICByZXR1cm4gWzIsIHRoaXMucmVzb2x2ZVNlbGVjdGlvblNldChtYWluRGVmaW5pdGlvbi5zZWxlY3Rpb25TZXQsIHJvb3RWYWx1ZSwgZXhlY0NvbnRleHQpLnRoZW4oZnVuY3Rpb24gKHJlc3VsdCkgeyByZXR1cm4gKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdDogcmVzdWx0LFxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0ZWRWYXJpYWJsZXM6IGV4ZWNDb250ZXh0LmV4cG9ydGVkVmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICB9KTsg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ICAgcmV0dXJuIFsyXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0ZpZWxkKHNlbGVjdGlvbikpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWzIsIHRoaXMucmVzb2x2ZUZpZWxkKHNlbGVjdGlvbiwgcm9vdFZhbHVlLCBleGVjQ29udGV4dCkudGhlbihmdW5jdGlvbiAoZmllbGRSZXN1bHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBfYTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZmllbGRSZXN1bHQgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0c1RvTWVyZ2UucHVzaCgoX2EgPSB7fSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2FbcmVzdWx0S2V5TmFtZUZyb21GaWVsZChzZWxlY3Rpb24pXSA9IGZpZWxkUmVzdWx0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfYSkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KV07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNJbmxpbmVGcmFnbWVudChzZWxlY3Rpb24pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJhZ21lbnQgPSBzZWxlY3Rpb247XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFnbWVudCA9IGZyYWdtZW50TWFwW3NlbGVjdGlvbi5uYW1lLnZhbHVlXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzLmVudi5OT0RFX0VOViA9PT0gXCJwcm9kdWN0aW9uXCIgPyBpbnZhcmlhbnQoZnJhZ21lbnQsIDExKSA6IGludmFyaWFudChmcmFnbWVudCwgXCJObyBmcmFnbWVudCBuYW1lZCBcIiArIHNlbGVjdGlvbi5uYW1lLnZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmcmFnbWVudCAmJiBmcmFnbWVudC50eXBlQ29uZGl0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZUNvbmRpdGlvbiA9IGZyYWdtZW50LnR5cGVDb25kaXRpb24ubmFtZS52YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXhlY0NvbnRleHQuZnJhZ21lbnRNYXRjaGVyKHJvb3RWYWx1ZSwgdHlwZUNvbmRpdGlvbiwgY29udGV4dCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsyLCB0aGlzLnJlc29sdmVTZWxlY3Rpb25TZXQoZnJhZ21lbnQuc2VsZWN0aW9uU2V0LCByb290VmFsdWUsIGV4ZWNDb250ZXh0KS50aGVuKGZ1bmN0aW9uIChmcmFnbWVudFJlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHNUb01lcmdlLnB1c2goZnJhZ21lbnRSZXN1bHQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSldO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbMl07XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH0pOyB9O1xuICAgICAgICAgICAgICAgIHJldHVybiB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2FsaWFzZWRGaWVsZE5hbWVdIHx8IHJvb3RWYWx1ZVtmaWVsZE5hbWVdO1xuICAgICAgICAgICAgICAgIHJlc3VsdFByb21pc2UgPSBQcm9taXNlLnJlc29sdmUoZGVmYXVsdFJlc3VsdCk7XG4gICAgICAgICAgICAgICAgaWYgKCFleGVjQ29udGV4dC5vbmx5UnVuRm9yY2VkUmVzb2x2ZXJzIHx8XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2hvdWxkRm9yY2VSZXNvbHZlcnMoZmllbGQpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmVyVHlwZSA9IHJvb3RWYWx1ZS5fX3R5cGVuYW1lIHx8IGV4ZWNDb250ZXh0LmRlZmF1bHRPcGVyYXRpb25UeXBlO1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlck1hcCA9IHRoaXMucmVzb2x2ZXJzICYmIHRoaXMucmVzb2x2ZXJzW3Jlc29sdmVyVHlwZV07XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNvbHZlck1hcCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSA9IHJlc29sdmVyTWFwW2FsaWFzVXNlZCA/IGZpZWxkTmFtZSA6IGFsaWFzZWRGaWVsZE5hbWVdO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlc29sdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRQcm9taXNlID0gUHJvbWlzZS5yZXNvbHZlKGNhY2hlU2xvdC53aXRoVmFsdWUodGhpcy5jYWNoZSwgcmVzb2x2ZSwgW1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByb290VmFsdWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3VtZW50c09iamVjdEZyb21GaWVsZChmaWVsZCwgdmFyaWFibGVzKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY0NvbnRleHQuY29udGV4dCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyBmaWVsZDogZmllbGQsIGZyYWdtZW50TWFwOiBleGVjQ29udGV4dC5mcmFnbWVudE1hcCB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gWzIsIHJlc3VsdFByb21pc2UudGhlbihmdW5jdGlvbiAocmVzdWx0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0ID09PSB2b2lkIDApIHsgcmVzdWx0ID0gZGVmYXVsdFJlc3VsdDsgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZpZWxkLmRpcmVjdGl2ZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZC5kaXJlY3RpdmVzLmZvckVhY2goZnVuY3Rpb24gKGRpcmVjdGl2ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlyZWN0aXZlLm5hbWUudmFsdWUgPT09ICdleHBvcnQnICYmIGRpcmVjdGl2ZS5hcmd1bWVudHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpcmVjdGl2ZS5hcmd1bWVudHMuZm9yRWFjaChmdW5jdGlvbiAoYXJnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFyZy5uYW1lLnZhbHVlID09PSAnYXMnICYmIGFyZy52YWx1ZS5raW5kID09PSAnU3RyaW5nVmFsdWUnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4ZWNDb250ZXh0LmV4cG9ydGVkVmFyaWFibGVzW2FyZy52YWx1ZS52YWx1ZV0gPSByZXN1bHQ7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZmllbGQuc2VsZWN0aW9uU2V0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHQgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShyZXN1bHQpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF90aGlzLnJlc29sdmVTdWJTZWxlY3RlZEFycmF5KGZpZWxkLCByZXN1bHQsIGV4ZWNDb250ZXh0KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmaWVsZC5zZWxlY3Rpb25TZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3RoaXMucmVzb2x2ZVNlbGVjdGlvblNldChmaWVsZC5zZWxlY3Rpb25TZXQsIHJlc3VsdCwgZXhlY0NvbnRleHQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KV07XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgfTtcbiAgICBMb2NhbFN0YXRlLnByb3RvdHlwZS5yZXNvbHZlU3ViU2VsZWN0ZWRBcnJheSA9IGZ1bmN0aW9uIChmaWVsZCwgcmVzdWx0LCBleGVjQ29udGV4dCkge1xuICAgICAg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XRpb25JZF07XG4gICAgfTtcbiAgICBNdXRhdGlvblN0b3JlLnByb3RvdHlwZS5pbml0TXV0YXRpb24gPSBmdW5jdGlvbiAobXV0YXRpb25JZCwgbXV0YXRpb24sIHZhcmlhYmxlcykge1xuICAgICAgICB0aGlzLnN0b3JlW211dGF0aW9uSWRdID0ge1xuICAgICAgICAgICAgbXV0YXRpb246IG11dGF0aW9uLFxuICAgICAgICAgICAgdmFyaWFibGVzOiB2YXJpYWJsZXMgfHwge30sXG4gICAgICAgICAgICBsb2FkaW5nOiB0cnVlLFxuICAgICAgICAgICAgZXJyb3I6IG51bGwsXG4gICAgICAgIH07XG4gICAgfTtcbiAgICBNdXRhdGlvblN0b3JlLnByb3RvdHlwZS5tYXJrTXV0YXRpb25FcnJvciA9IGZ1bmN0aW9uIChtdXRhdGlvbklkLCBlcnJvcikge1xuICAgICAgICB2YXIgbXV0YXRpb24gPSB0aGlzLnN0b3JlW211dGF0aW9uSWRdO1xuICAgICAgICBpZiAobXV0YXRpb24pIHtcbiAgICAgICAgICAgIG11dGF0aW9uLmxvYWRpbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIG11dGF0aW9uLmVycm9yID0gZXJyb3I7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIE11dGF0aW9uU3RvcmUucHJvdG90eXBlLm1hcmtNdXRhdGlvblJlc3VsdCA9IGZ1bmN0aW9uIChtdXRhdGlvbklkKSB7XG4gICAgICAgIHZhciBtdXRhdGlvbiA9IHRoaXMuc3RvcmVbbXV0YXRpb25JZF07XG4gICAgICAgIGlmIChtdXRhdGlvbikge1xuICAgICAgICAgICAgbXV0YXRpb24ubG9hZGluZyA9IGZhbHNlO1xuICAgICAgICAgICAgbXV0YXRpb24uZXJyb3IgPSBudWxsO1xuICAgICAgICB9XG4gICAgfTtcbiAgICBNdXRhdGlvblN0b3JlLnByb3RvdHlwZS5yZXNldCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdGhpcy5zdG9yZSA9IHt9O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mF0aW9uLCBvciByZWxheVN0eWxlUGFnaW5hdGlvbikgZnJvbVxcbkBhcG9sbG8vY2xpZW50L3V0aWxpdGllcy5cXG5cXG5UaGUgZmllbGQgcG9saWN5IHN5c3RlbSBoYW5kbGVzIHBhZ2luYXRpb24gbW9yZSBlZmZlY3RpdmVseSB0aGFuIGFcXG5oYW5kLXdyaXR0ZW4gdXBkYXRlUXVlcnkgZnVuY3Rpb24sIGFuZCB5b3Ugb25seSBuZWVkIHRvIGRlZmluZSB0aGUgcG9saWN5XFxub25jZSwgcmF0aGVyIHRoYW4gZXZlcnkgdGltZSB5b3UgY2FsbCBmZXRjaE1vcmUuXCIpO1xuICAgICAgICAgICAgICAgICAgICB3YXJuZWRBYm91dFVwZGF0ZVF1ZXJ5ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgX3RoaXMudXBkYXRlUXVlcnkoZnVuY3Rpb24gKHByZXZpb3VzKSB7IHJldHVybiB1cGRhdGVRdWVyeShwcmV2aW91cywge1xuICAgICAgICAgICAgICAgICAgICBmZXRjaE1vcmVSZXN1bHQ6IGRhdGEsXG4gICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogY29tYmluZWRPcHRpb25zLnZhcmlhYmxlcyxcbiAgICAgICAgICAgICAgICB9KTsgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBfdGhpcy5xdWVyeU1hbmFnZXIuY2FjaGUud3JpdGVRdWVyeSh7XG4gICAgICAgICAgICAgICAgICAgIHF1ZXJ5OiBjb21iaW5lZE9wdGlvbnMucXVlcnksXG4gICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogY29tYmluZWRPcHRpb25zLnZhcmlhYmxlcyxcbiAgICAgICAgICAgICAgICAgICAgZGF0YTogZGF0YSxcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBmZXRjaE1vcmVSZXN1bHQ7XG4gICAgICAgIH0pLmZpbmFsbHkoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgX3RoaXMucXVlcnlNYW5hZ2VyLnN0b3BRdWVyeShxaWQpO1xuICAgICAgICAgICAgX3RoaXMucmVvYnNlcnZlKCk7XG4gICAgICAgIH0pO1xuICAgIH07XG4gICAgT2JzZXJ2YWJsZVF1ZXJ5LnByb3RvdHlwZS5zdWJzY3JpYmVUb01vcmUgPSBmdW5jdGlvbiAob3B0aW9ucykge1xuICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xuICAgICAgICB2YXIgc3Vic2NyaXB0aW9uID0gdGhpcy5xdWVyeU1hbmFnZXJcbiAgICAgICAgICAgIC5zdGFydEdyYXBoUUxTdWJzY3JpcHRpb24oe1xuICAgICAgICAgICAgcXVlcnk6IG9wdGlvbnMuZG9jdW1lbnQsXG4gICAgICAgICAgICB2YXJpYWJsZXM6IG9wdGlvbnMudmFyaWFibGVzLFxuICAgICAgICAgICAgY29udGV4dDogb3B0aW9ucy5jb250ZXh0LFxuICAgICAgICB9KVxuICAgICAgICAgICAgLnN1YnNjcmliZSh7XG4gICAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAoc3Vic2NyaXB0aW9uRGF0YSkge1xuICAgICAgICAgICAgICAgIHZhciB1cGRhdGVRdWVyeSA9IG9wdGlvbnMudXBkYXRlUXVlcnk7XG4gICAgICAgICAgICAgICAgaWYgKHVwZGF0ZVF1ZXJ5KSB7XG4gICAgICAgICAgICAgICAgICAgIF90aGlzLnVwZGF0ZVF1ZXJ5KGZ1bmN0aW9uIChwcmV2aW91cywgX2EpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2YXJpYWJsZXMgPSBfYS52YXJpYWJsZXM7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXBkYXRlUXVlcnkocHJldmlvdXMsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJzY3JpcHRpb25EYXRhOiBzdWJzY3JpcHRpb25EYXRhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogdmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBlcnJvcjogZnVuY3Rpb24gKGVycikge1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLm9uRXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5vbkVycm9yKGVycik7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcHJvY2Vzcy5lbnYuTk9ERV9FTlYgPT09IFwicHJvZHVjdGlvblwiIHx8IGludmFyaWFudC5lcnJvcignVW5oYW5kbGVkIEdyYXBoUUwgc3Vic2NyaXB0aW9uIGVycm9yJywgZXJyKTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgIH0pO1xuICAgICAgICB0aGlzLnN1YnNjcmlwdGlvbnMuYWRkKHN1YnNjcmlwdGlvbik7XG4gICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBpZiAoX3RoaXMuc3Vic2NyaXB0aW9ucy5kZWxldGUoc3Vic2NyaXB0aW9uKSkge1xuICAgICAgICAgICAgICAgIHN1YnNjcmlwdGlvbi51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgIH07XG4gICAgT2JzZXJ2YWJsZVF1ZXJ5LnByb3RvdHlwZS5zZXRPcHRpb25zID0gZnVuY3Rpb24gKG5ld09wdGlvbnMpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMucmVvYnNlcnZlKG5ld09wdGlvbnMpO1xuICAgIH07XG4gICAgT2JzZXJ2YWJsZVF1ZXJ5LnByb3RvdHlwZS5zZXRWYXJpYWJsZXMgPS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cnlJbmZvLnByb3RvdHlwZS5tYXJrUmVzdWx0ID0gZnVuY3Rpb24gKHJlc3VsdCwgb3B0aW9ucywgYWxsb3dDYWNoZVdyaXRlKSB7XG4gICAgICAgIHZhciBfdGhpcyA9IHRoaXM7XG4gICAgICAgIHRoaXMuZ3JhcGhRTEVycm9ycyA9IGlzTm9uRW1wdHlBcnJheShyZXN1bHQuZXJyb3JzKSA/IHJlc3VsdC5lcnJvcnMgOiBbXTtcbiAgICAgICAgaWYgKG9wdGlvbnMuZmV0Y2hQb2xpY3kgPT09ICduby1jYWNoZScpIHtcbiAgICAgICAgICAgIHRoaXMuZGlmZiA9IHsgcmVzdWx0OiByZXN1bHQuZGF0YSwgY29tcGxldGU6IHRydWUgfTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChhbGxvd0NhY2hlV3JpdGUpIHtcbiAgICAgICAgICAgIGlmIChzaG91bGRXcml0ZVJlc3VsdChyZXN1bHQsIG9wdGlvbnMuZXJyb3JQb2xpY3kpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5jYWNoZS5wZXJmb3JtVHJhbnNhY3Rpb24oZnVuY3Rpb24gKGNhY2hlKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChfdGhpcy5zaG91bGRXcml0ZShyZXN1bHQsIG9wdGlvbnMudmFyaWFibGVzKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FjaGUud3JpdGVRdWVyeSh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVlcnk6IF90aGlzLmRvY3VtZW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHJlc3VsdC5kYXRhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogb3B0aW9ucy52YXJpYWJsZXMsXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIF90aGlzLmxhc3RXcml0ZSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQ6IHJlc3VsdCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IG9wdGlvbnMudmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRtQ291bnQ6IGRlc3RydWN0aXZlTWV0aG9kQ291bnRzLmdldChfdGhpcy5jYWNoZSksXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF90aGlzLmRpZmYgJiYgX3RoaXMuZGlmZi5jb21wbGV0ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5kYXRhID0gX3RoaXMuZGlmZi5yZXN1bHQ7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHZhciBkaWZmID0gY2FjaGUuZGlmZih7XG4gICAgICAgICAgICAgICAgICAgICAgICBxdWVyeTogX3RoaXMuZG9jdW1lbnQsXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IG9wdGlvbnMudmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuUGFydGlhbERhdGE6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgICAgICBvcHRpbWlzdGljOiB0cnVlLFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgX3RoaXMudXBkYXRlV2F0Y2gob3B0aW9ucy52YXJpYWJsZXMpO1xuICAgICAgICAgICAgICAgICAgICBfdGhpcy5kaWZmID0gZGlmZjtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRpZmYuY29tcGxldGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5kYXR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W1lbnQgaW4gdGhlIG11dGF0aW9uIG9wdGlvbi4nKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSBcInByb2R1Y3Rpb25cIiA/IGludmFyaWFudCghZmV0Y2hQb2xpY3kgfHwgZmV0Y2hQb2xpY3kgPT09ICduby1jYWNoZScsIDE0KSA6IGludmFyaWFudCghZmV0Y2hQb2xpY3kgfHwgZmV0Y2hQb2xpY3kgPT09ICduby1jYWNoZScsIFwiTXV0YXRpb25zIG9ubHkgc3VwcG9ydCBhICduby1jYWNoZScgZmV0Y2hQb2xpY3kuIElmIHlvdSBkb24ndCB3YW50IHRvIGRpc2FibGUgdGhlIGNhY2hlLCByZW1vdmUgeW91ciBmZXRjaFBvbGljeSBzZXR0aW5nIHRvIHByb2NlZWQgd2l0aCB0aGUgZGVmYXVsdCBtdXRhdGlvbiBiZWhhdmlvci5cIik7XG4gICAgICAgICAgICAgICAgICAgICAgICBtdXRhdGlvbklkID0gdGhpcy5nZW5lcmF0ZU11dGF0aW9uSWQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIG11dGF0aW9uID0gdGhpcy50cmFuc2Zvcm0obXV0YXRpb24pLmRvY3VtZW50O1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyaWFibGVzID0gdGhpcy5nZXRWYXJpYWJsZXMobXV0YXRpb24sIHZhcmlhYmxlcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMudHJhbnNmb3JtKG11dGF0aW9uKS5oYXNDbGllbnRFeHBvcnRzKSByZXR1cm4gWzMsIDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFs0LCB0aGlzLmxvY2FsU3RhdGUuYWRkRXhwb3J0ZWRWYXJpYWJsZXMobXV0YXRpb24sIHZhcmlhYmxlcywgY29udGV4dCldO1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXMgPSBfZi5zZW50KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBfZi5sYWJlbCA9IDI7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgICAgIGdlbmVyYXRlVXBkYXRlUXVlcmllc0luZm8gPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJldCA9IHt9O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1cGRhdGVRdWVyaWVzQnlOYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF90aGlzLnF1ZXJpZXMuZm9yRWFjaChmdW5jdGlvbiAoX2EsIHF1ZXJ5SWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvYnNlcnZhYmxlUXVlcnkgPSBfYS5vYnNlcnZhYmxlUXVlcnk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob2JzZXJ2YWJsZVF1ZXJ5KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHF1ZXJ5TmFtZSA9IG9ic2VydmFibGVRdWVyeS5xdWVyeU5hbWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHF1ZXJ5TmFtZSAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNPd25Qcm9wZXJ0eS5jYWxsKHVwZGF0ZVF1ZXJpZXNCeU5hbWUsIHF1ZXJ5TmFtZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0W3F1ZXJ5SWRdID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlcjogdXBkYXRlUXVlcmllc0J5TmFtZVtxdWVyeU5hbWVdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVlcnlJbmZvOiBfdGhpcy5xdWVyaWVzLmdldChxdWVyeUlkKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmV0O1xuICAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubXV0YXRpb25TdG9yZS5pbml0TXV0YXRpb24obXV0YXRpb25JZCwgbXV0YXRpb24sIHZhcmlhYmxlcyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3B0aW1pc3RpY1Jlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW1pc3RpY18xID0gdHlwZW9mIG9wdGltaXN0aWNSZXNwb25zZSA9PT0gJ2Z1bmN0aW9uJ1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IG9wdGltaXN0aWNSZXNwb25zZSh2YXJpYWJsZXMpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogb3B0aW1pc3RpY1Jlc3BvbnNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FjaGUucmVjb3JkT3B0aW1pc3RpY1RyYW5zYWN0aW9uKGZ1bmN0aW9uIChjYWNoZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFya011dGF0aW9uUmVzdWx0KHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtdXRhdGlvbklkOiBtdXRhdGlvbklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdDogeyBkYXRhOiBvcHRpbWlzdGljXzEgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudDogbXV0YXRpb24sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyaWFibGVzOiB2YXJpYWJsZXMsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JQb2xpY3k6IGVycm9yUG9saWN5LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1ZXJ5VXBkYXRlcnNCeUlkOiBnZW5lcmF0ZVVwZGF0ZVF1ZXJpZXNJbmZvKCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlOiB1cGRhdGVXaXRoUHJveHlGbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGNhY2hlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSBcInByb2R1Y3Rpb25cIiB8fCBpbnZhcmlhbnQuZXJyb3IoZXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbXV0YXRpb25JZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJyb2FkY2FzdFF1ZXJpZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYgPSB0aGlzO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsyLCBuZXcgUHJvbWlzZShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzdG9yZVJlc3VsdDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVycm9yO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmdldE9ic2VydmFibGVGcm9tTGluayhtdXRhdGlvbiwgX19hc3NpZ24oX19hc3NpZ24oe30sIGNvbnRleHQpLCB7IG9wdGltaXN0aWNSZXNwb25zZTogb3B0aW1pc3RpY1Jlc3BvbnNlIH0pLCB2YXJpYWJsZXMsIGZhbHNlKS5zdWJzY3JpYmUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogZnVuY3Rpb24gKHJlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChncmFwaFFMUmVzdWx0SGFzRXJyb3IocmVzdWx0KSAmJiBlcnJvclBvbGljeSA9PT0gJ25vbmUnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yID0gbmV3IEFwb2xsb0Vycm9yKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyYXBoUUxFcnJvcnM6IHJlc3VsdC5lcnJvcnMsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYubXV0YXRpb25TdG9yZS5tYXJrTXV0YXRpb25SZXN1bHQobXV0YXRpb25JZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZldGNoUG9saWN5ICE9PSAnbm8tY2FjaGUnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJrTXV0YXRpb25SZXN1bHQoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG11dGF0aW9uSWQ6IG11dGF0aW9uSWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0OiByZXN1bHQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQ6IG11dGF0aW9uLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogdmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yUG9saWN5OiBlcnJvclBvbGljeSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWVyeVVwZGF0ZXJzQnlJZDogZ2VuZXJhdGVVcGRhdGVRdWVyaWVzSW5mbygpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZTogdXBkYXRlV2l0aFByb3h5Rm4sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBzZWxmLmNhY2hlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IgPSBuZXcgQXBvbGxvRXJyb3Ioe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldHdvcmtFcnJvcjogZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JlUmVzdWx0ID0gcmVzdWx0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5tdXRhdGlvblN0b3JlLm1hcmtNdXRhdGlvbkVycm9yKG11dGF0aW9uSWQsIGVycik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGltaXN0aWNSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmNhY2hlLnJlbW92ZU9wdGltaXN0aWMobXV0YXRpb25JZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYnJvYWRjYXN0UXVlcmllcygpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdChuZXcgQXBvbGxvRXJyb3Ioe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXR3b3JrRXJyb3I6IGVycixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcGxldGU6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5tdXRhdGlvblN0b3JlLm1hcmtNdXRhdGlvbkVycm9yKG11dGF0aW9uSWQsIGVycm9yKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGltaXN0aWNSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmNhY2hlLnJlbW92ZU9wdGltaXN0aWMobXV0YXRpb25JZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYnJvYWRjYXN0UXVlcmllcygpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWplY3QoZXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcmVmZXRjaFF1ZXJpZXMgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXRjaFF1ZXJpZXMgPSByZWZldGNoUXVlcmllcyhzdG9yZVJlc3VsdCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZWZldGNoUXVlcnlQcm9taXNlcyA9IFtdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc05vbkVtcHR5QXJyYXkocmVmZXRjaFF1ZXJpZXMpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZmV0Y2hRdWVyaWVzLmZvckVhY2goZnVuY3Rpb24gKHJlZmV0Y2hRdWVyeSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiByZWZldGNoUXVlcnkgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5xdWVyaWVzLmZvckVhY2goZnVuY3Rpb24gKF9hKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvYnNlcnZhYmxlUXVlcnkgPSBfYS5vYnNlcnZhYmxlUXVlcnk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvYnNlcnZhYmxlUXVlcnkgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9ic2VydmFibGVRdWVyeS5xdWVyeU5hbWUgPT09IHJlZmV0Y2hRdWVyeSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXRjaFF1ZXJ5UHJvbWlzZXMucHVzaChvYnNlcnZhYmxlUXVlcnkucmVmZXRjaCgpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHF1ZXJ5T3B0aW9ucyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVlcnk6IHJlZmV0Y2hRdWVyeS5xdWVyeSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyaWFibGVzOiByZWZldGNoUXVlcnkudmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZXRjaFBvbGljeTogJ25ldHdvcmstb25seScsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVmZXRjaFF1ZXJ5LmNvbnRleHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVlcnlPcHRpb25zLmNvbnRleHQgPSByZWZldGNoUXVlcnkuY29udGV4dDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXRjaFF1ZXJ5UHJvbWlzZXMucHVzaChzZWxmLnF1ZXJ5KHF1ZXJ5T3B0aW9ucykpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUHJvbWlzZS5hbGwoYXdhaXRSZWZldGNoUXVlcmllcyA/IHJlZmV0Y2hRdWVyeVByb21pc2VzIDogW10pLnRoZW4oZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyb3JQb2xpY3kgPT09ICdpZ25vcmUnICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yZVJlc3VsdCAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3JhcGhRTFJlc3VsdEhhc0Vycm9yKHN0b3JlUmVzdWx0KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHN0b3JlUmVzdWx0LmVycm9ycztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKHN0b3JlUmVzdWx0KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByZWplY3QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSldO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB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Jlc3VsdChyZXN1bHQsIGVycm9yUG9saWN5KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgX3RoaXMuY2FjaGUud3JpdGUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1ZXJ5OiBxdWVyeSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQ6IHJlc3VsdC5kYXRhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFJZDogJ1JPT1RfU1VCU0NSSVBUSU9OJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IHZhcmlhYmxlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIF90aGlzLmJyb2FkY2FzdFF1ZXJpZXMoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGdyYXBoUUxSZXN1bHRIYXNFcnJvcihyZXN1bHQpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcG9sbG9FcnJvcih7XG4gICAgICAgICAgICAgICAgICAgICAgICBncmFwaFFMRXJyb3JzOiByZXN1bHQuZXJyb3JzLFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgICAgICBpZiAodGhpcy50cmFuc2Zvcm0ocXVlcnkpLmhhc0NsaWVudEV4cG9ydHMpIHtcbiAgICAgICAgICAgIHZhciBvYnNlcnZhYmxlUHJvbWlzZV8xID0gdGhpcy5sb2NhbFN0YXRlLmFkZEV4cG9ydGVkVmFyaWFibGVzKHF1ZXJ5LCB2YXJpYWJsZXMsIGNvbnRleHQpLnRoZW4obWFrZU9ic2VydmFibGUpO1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBPYnNlcnZhYmxlKGZ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1xuICAgICAgICAgICAgdmFyIF9iID0gdGhpcywgaW5GbGlnaHRMaW5rT2JzZXJ2YWJsZXNfMSA9IF9iLmluRmxpZ2h0TGlua09ic2VydmFibGVzLCBsaW5rID0gX2IubGluaztcbiAgICAgICAgICAgIHZhciBvcGVyYXRpb24gPSB7XG4gICAgICAgICAgICAgICAgcXVlcnk6IHNlcnZlclF1ZXJ5LFxuICAgICAgICAgICAgICAgIHZhcmlhYmxlczogdmFyaWFibGVzLFxuICAgICAgICAgICAgICAgIG9wZXJhdGlvbk5hbWU6IGdldE9wZXJhdGlvbk5hbWUoc2VydmVyUXVlcnkpIHx8IHZvaWQgMCxcbiAgICAgICAgICAgICAgICBjb250ZXh0OiB0aGlzLnByZXBhcmVDb250ZXh0KF9fYXNzaWduKF9fYXNzaWduKHt9LCBjb250ZXh0KSwgeyBmb3JjZUZldGNoOiAhZGVkdXBsaWNhdGlvbiB9KSksXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgY29udGV4dCA9IG9wZXJhdGlvbi5jb250ZXh0O1xuICAgICAgICAgICAgaWYgKGRlZHVwbGljYXRpb24pIHtcbiAgICAgICAgICAgICAgICB2YXIgYnlWYXJpYWJsZXNfMSA9IGluRmxpZ2h0TGlua09ic2VydmFibGVzXzEuZ2V0KHNlcnZlclF1ZXJ5KSB8fCBuZXcgTWFwKCk7XG4gICAgICAgICAgICAgICAgaW5GbGlnaHRMaW5rT2JzZXJ2YWJsZXNfMS5zZXQoc2VydmVyUXVlcnksIGJ5VmFyaWFibGVzXzEpO1xuICAgICAgICAgICAgICAgIHZhciB2YXJKc29uXzEgPSBKU09OLnN0cmluZ2lmeSh2YXJpYWJsZXMpO1xuICAgICAgICAgICAgICAgIG9ic2VydmFibGUgPSBieVZhcmlhYmxlc18xLmdldCh2YXJKc29uXzEpO1xuICAgICAgICAgICAgICAgIGlmICghb2JzZXJ2YWJsZSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgY29uY2FzdCA9IG5ldyBDb25jYXN0KFtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4ZWN1dGUobGluaywgb3BlcmF0aW9uKVxuICAgICAgICAgICAgICAgICAgICBdKTtcbiAgICAgICAgICAgICAgICAgICAgYnlWYXJpYWJsZXNfMS5zZXQodmFySnNvbl8xLCBvYnNlcnZhYmxlID0gY29uY2FzdCk7XG4gICAgICAgICAgICAgICAgICAgIGNvbmNhc3QuY2xlYW51cChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYnlWYXJpYWJsZXNfMS5kZWxldGUodmFySnNvbl8xKSAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5VmFyaWFibGVzXzEuc2l6ZSA8IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbkZsaWdodExpbmtPYnNlcnZhYmxlc18xLmRlbGV0ZShzZXJ2ZXJRdWVyeSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIG9ic2VydmFibGUgPSBuZXcgQ29uY2FzdChbXG4gICAgICAgICAgICAgICAgICAgIGV4ZWN1dGUobGluaywgb3BlcmF0aW9uKVxuICAgICAgICAgICAgICAgIF0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgb2JzZXJ2YWJsZSA9IG5ldyBDb25jYXN0KFtcbiAgICAgICAgICAgICAgICBPYnNlcnZhYmxlLm9mKHsgZGF0YToge30gfSlcbiAgICAgICAgICAgIF0pO1xuICAgICAgICAgICAgY29udGV4dCA9IHRoaXMucHJlcGFyZUNvbnRleHQoY29udGV4dCk7XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGNsaWVudFF1ZXJ5ID0gdGhpcy50cmFuc2Zvcm0ocXVlcnkpLmNsaW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FzRXJyb3JzICYmIG9wdGlvbnMuZXJyb3JQb2xpY3kgPT09IFwibm9uZVwiKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IHF1ZXJ5SW5mby5tYXJrRXJyb3IobmV3IEFwb2xsb0Vycm9yKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGdyYXBoUUxFcnJvcnM6IHJlc3VsdC5lcnJvcnMsXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcXVlcnlJbmZvLm1hcmtSZXN1bHQocmVzdWx0LCBvcHRpb25zLCBhbGxvd0NhY2hlV3JpdGUpO1xuICAgICAgICAgICAgICAgIHF1ZXJ5SW5mby5tYXJrUmVhZHkoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBhcXIgPSB7XG4gICAgICAgICAgICAgICAgZGF0YTogcmVzdWx0LmRhdGEsXG4gICAgICAgICAgICAgICAgbG9hZGluZzogZmFsc2UsXG4gICAgICAgICAgICAgICAgbmV0d29ya1N0YXR1czogcXVlcnlJbmZvLm5ldHdvcmtTdGF0dXMgfHwgTmV0d29ya1N0YXR1cy5yZWFkeSxcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoaGFzRXJyb3JzICYmIG9wdGlvbnMuZXJyb3JQb2xpY3kgIT09IFwiaWdub3JlXCIpIHtcbiAgICAgICAgICAgICAgICBhcXIuZXJyb3JzID0gcmVzdWx0LmVycm9ycztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhcXI7XG4gICAgICAgIH0sIGZ1bmN0aW9uIChuZXR3b3JrRXJyb3IpIHtcbiAgICAgICAgICAgIHZhciBlcnJvciA9IGlzQXBvbGxvRXJyb3IobmV0d29ya0Vycm9yKVxuICAgICAgICAgICAgICAgID8gbmV0d29ya0Vycm9yXG4gICAgICAgICAgICAgICAgOiBuZXcgQXBvbGxvRXJyb3IoeyBuZXR3b3JrRXJyb3I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C5kYXRhKTsgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZnJvbURhdGEoZGF0YSk7XG4gICAgICAgIH07XG4gICAgICAgIHZhciByZXN1bHRzRnJvbUxpbmsgPSBmdW5jdGlvbiAoYWxsb3dDYWNoZVdyaXRlKSB7XG4gICAgICAgICAgICByZXR1cm4gX3RoaXMuZ2V0UmVzdWx0c0Zyb21MaW5rKHF1ZXJ5SW5mbywgYWxsb3dDYWNoZVdyaXRlLCB7XG4gICAgICAgICAgICAgICAgdmFyaWFibGVzOiB2YXJpYWJsZXMsXG4gICAgICAgICAgICAgICAgY29udGV4dDogY29udGV4dCxcbiAgICAgICAgICAgICAgICBmZXRjaFBvbGljeTogZmV0Y2hQb2xpY3ksXG4gICAgICAgICAgICAgICAgZXJyb3JQb2xpY3k6IGVycm9yUG9saWN5LFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH07XG4gICAgICAgIHN3aXRjaCAoZmV0Y2hQb2xpY3kpIHtcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICBjYXNlIFwiY2FjaGUtZmlyc3RcIjoge1xuICAgICAgICAgICAgICAgIHZhciBkaWZmID0gcmVhZENhY2hlKCk7XG4gICAgICAgICAgICAgICAgaWYgKGRpZmYuY29tcGxldGUpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHNGcm9tQ2FjaGUoZGlmZiwgcXVlcnlJbmZvLm1hcmtSZWFkeSgpKSxcbiAgICAgICAgICAgICAgICAgICAgXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHJldHVyblBhcnRpYWxEYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBbXG4gICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRzRnJvbUNhY2hlKGRpZmYpLFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0c0Zyb21MaW5rKHRydWUpLFxuICAgICAgICAgICAgICAgICAgICBdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gW1xuICAgICAgICAgICAgICAgICAgICByZXN1bHRzRnJvbUxpbmsodHJ1ZSksXG4gICAgICAgICAgICAgICAgXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhc2UgXCJjYWNoZS1hbmQtbmV0d29ya1wiOiB7XG4gICAgICAgICAgICAgICAgdmFyIGRpZmYgPSByZWFkQ2FjaGUoKTtcbiAgICAgICAgICAgICAgICBpZiAoZGlmZi5jb21wbGV0ZSB8fCByZXR1cm5QYXJ0aWFsRGF0YSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gW1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0c0Zyb21DYWNoZShkaWZmKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHNGcm9tTGluayh0cnVlKSxcbiAgICAgICAgICAgICAgICAgICAgXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIFtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0c0Zyb21MaW5rKHRydWUpLFxuICAgICAgICAgICAgICAgIF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlIFwiY2FjaGUtb25seVwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBbXG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdHNGcm9tQ2FjaGUocmVhZENhY2hlKCksIHF1ZXJ5SW5mby5tYXJrUmVhZHkoKSksXG4gICAgICAgICAgICAgICAgXTtcbiAgICAgICAgICAgIGNhc2UgXCJuZXR3b3JrLW9ubHlcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gW3Jlc3VsdHNGcm9tTGluayh0cnVlKV07XG4gICAgICAgICAgICBjYXNlIFwibm8tY2FjaGVcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gW3Jlc3VsdHN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XzEgPSBbe1xuICAgICAgICAgICAgICAgIHJlc3VsdDogbXV0YXRpb24ucmVzdWx0LmRhdGEsXG4gICAgICAgICAgICAgICAgZGF0YUlkOiAnUk9PVF9NVVRBVElPTicsXG4gICAgICAgICAgICAgICAgcXVlcnk6IG11dGF0aW9uLmRvY3VtZW50LFxuICAgICAgICAgICAgICAgIHZhcmlhYmxlczogbXV0YXRpb24udmFyaWFibGVzLFxuICAgICAgICAgICAgfV07XG4gICAgICAgIHZhciBxdWVyeVVwZGF0ZXJzQnlJZF8xID0gbXV0YXRpb24ucXVlcnlVcGRhdGVyc0J5SWQ7XG4gICAgICAgIGlmIChxdWVyeVVwZGF0ZXJzQnlJZF8xKSB7XG4gICAgICAgICAgICBPYmplY3Qua2V5cyhxdWVyeVVwZGF0ZXJzQnlJZF8xKS5mb3JFYWNoKGZ1bmN0aW9uIChpZCkge1xuICAgICAgICAgICAgICAgIHZhciBfYSA9IHF1ZXJ5VXBkYXRlcnNCeUlkXzFbaWRdLCB1cGRhdGVyID0gX2EudXBkYXRlciwgX2IgPSBfYS5xdWVyeUluZm8sIGRvY3VtZW50ID0gX2IuZG9jdW1lbnQsIHZhcmlhYmxlcyA9IF9iLnZhcmlhYmxlcztcbiAgICAgICAgICAgICAgICB2YXIgX2MgPSBjYWNoZS5kaWZmKHtcbiAgICAgICAgICAgICAgICAgICAgcXVlcnk6IGRvY3VtZW50LFxuICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IHZhcmlhYmxlcyxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuUGFydGlhbERhdGE6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgIG9wdGltaXN0aWM6IGZhbHNlLFxuICAgICAgICAgICAgICAgIH0pLCBjdXJyZW50UXVlcnlSZXN1bHQgPSBfYy5yZXN1bHQsIGNvbXBsZXRlID0gX2MuY29tcGxldGU7XG4gICAgICAgICAgICAgICAgaWYgKGNvbXBsZXRlICYmIGN1cnJlbnRRdWVyeVJlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgbmV4dFF1ZXJ5UmVzdWx0ID0gdXBkYXRlcihjdXJyZW50UXVlcnlSZXN1bHQsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG11dGF0aW9uUmVzdWx0OiBtdXRhdGlvbi5yZXN1bHQsXG4gICAgICAgICAgICAgICAgICAgICAgICBxdWVyeU5hbWU6IGdldE9wZXJhdGlvbk5hbWUoZG9jdW1lbnQpIHx8IHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHF1ZXJ5VmFyaWFibGVzOiB2YXJpYWJsZXMsXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAobmV4dFF1ZXJ5UmVzdWx0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYWNoZVdyaXRlc18xLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdDogbmV4dFF1ZXJ5UmVzdWx0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFJZDogJ1JPT1RfUVVFUlknLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1ZXJ5OiBkb2N1bWVudCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IHZhcmlhYmxlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY2FjaGUucGVyZm9ybVRyYW5zYWN0aW9uKGZ1bmN0aW9uIChjKSB7XG4gICAgICAgICAgICBjYWNoZVdyaXRlc18xLmZvckVhY2goZnVuY3Rpb24gKHdyaXRlKSB7IHJldHVybiBjLndyaXRlKHdyaXRlKTsgfSk7XG4gICAgICAgICAgICB2YXIgdXBkYXRlID0gbXV0YXRpb24udXBkYXRlO1xuICAgICAgICAgICAgaWY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RoaXM7XG4gICAgICAgIHZhciBfYSA9IHRoaXMsIHBvbGxpbmdJbmZvID0gX2EucG9sbGluZ0luZm8sIHBvbGxJbnRlcnZhbCA9IF9hLm9wdGlvbnMucG9sbEludGVydmFsO1xuICAgICAgICBpZiAoIXBvbGxJbnRlcnZhbCkge1xuICAgICAgICAgICAgaWYgKHBvbGxpbmdJbmZvKSB7XG4gICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHBvbGxpbmdJbmZvLnRpbWVvdXQpO1xuICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzLnBvbGxpbmdJbmZvO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwb2xsaW5nSW5mbyAmJlxuICAgICAgICAgICAgcG9sbGluZ0luZm8uaW50ZXJ2YWwgPT09IHBvbGxJbnRlcnZhbCkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSBcInByb2R1Y3Rpb25cIiA/IGludmFyaWFudChwb2xsSW50ZXJ2YWwsIDIwKSA6IGludmFyaWFudChwb2xsSW50ZXJ2YWwsICdBdHRlbXB0ZWQgdG8gc3RhcnQgYSBwb2xsaW5nIHF1ZXJ5IHdpdGhvdXQgYSBwb2xsaW5nIGludGVydmFsLicpO1xuICAgICAgICBpZiAodGhpcy5zaG91bGRGZXRjaCA9PT0gZmFsc2UpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB2YXIgaW5mbyA9IHBvbGxpbmdJbmZvIHx8ICh0aGlzLnBvbGxpbmdJbmZvID0ge30pO1xuICAgICAgICBpbmZvLmludGVydmFsID0gcG9sbEludGVydmFsO1xuICAgICAgICB2YXIgbWF5YmVGZXRjaCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGlmIChfdGhpcy5wb2xsaW5nSW5mbykge1xuICAgICAgICAgICAgICAgIGlmIChfdGhpcy5zaG91bGRGZXRjaCAmJiBfdGhpcy5zaG91bGRGZXRjaCgpKSB7XG4gICAgICAgICAgICAgICAgICAgIF90aGlzLnJlb2JzZXJ2ZSh7XG4gICAgICAgICAgICAgICAgICAgICAgICBmZXRjaFBvbGljeTogXCJuZXR3b3JrLW9ubHlcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRGZXRjaFBvbGljeTogX3RoaXMub3B0aW9ucy5mZXRjaFBvbGljeSB8fCBcImNhY2hlLWZpcnN0XCIsXG4gICAgICAgICAgICAgICAgICAgIH0sIE5ldHdvcmtTdGF0dXMucG9sbCkudGhlbihwb2xsLCBwb2xsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHBvbGwoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICA7XG4gICAgICAgIH07XG4gICAgICAgIHZhciBwb2xsID0gZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIGluZm8gPSBfdGhpcy5wb2xsaW5nSW5mbztcbiAgICAgICAgICAgIGlmIChpbmZvKSB7XG4gICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KGluZm8udGltZW91dCk7XG4gICAgICAgICAgICAgICAgaW5mby50aW1lb3V0ID0gc2V0VGltZW91dChtYXliZUZldGNoLCBpbmZvLmludGVydmFsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgcG9sbCgpO1xuICAgIH07XG4gICAgcmV0dXJuIFJlb2JzZXJ2ZXI7XG59KCkpO1xuZXhwb3J0IHsgUmVvYnNlcnZlciB9O1xuLy8jIHNvdXJjZU1hcHBpbmdVUkw9UmVvYnNlcnZlci5qcy5tYXAiLCJleHBvcnQgeyBBcG9sbG9DbGllbnQsIH0gZnJvbSBcIi4vQXBvbGxvQ2xpZW50LmpzXCI7XG5leHBvcnQge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09wZXJhdGlvbkRlZmluaXRpb24nICYmIGQub3BlcmF0aW9uID09PSAnbXV0YXRpb24nO1xuICAgICAgICB9O1xuICAgICAgICBpZiAodXNlR0VURm9yUXVlcmllcyAmJlxuICAgICAgICAgICAgIW9wZXJhdGlvbi5xdWVyeS5kZWZpbml0aW9ucy5zb21lKGRlZmluaXRpb25Jc011dGF0aW9uKSkge1xuICAgICAgICAgICAgb3B0aW9ucy5tZXRob2QgPSAnR0VUJztcbiAgICAgICAgfVxuICAgICAgICBpZiAob3B0aW9ucy5tZXRob2QgPT09ICdHRVQnKSB7XG4gICAgICAgICAgICB2YXIgX2QgPSByZXdyaXRlVVJJRm9yR0VUKGNob3NlblVSSSwgYm9keSksIG5ld1VSSSA9IF9kLm5ld1VSSSwgcGFyc2VFcnJvciA9IF9kLnBhcnNlRXJyb3I7XG4gICAgICAgICAgICBpZiAocGFyc2VFcnJvcikge1xuICAgICAgICAgICAgICAgIHJldHVybiBmcm9tRXJyb3IocGFyc2VFcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjaG9zZW5VUkkgPSBuZXdVUkk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIG9wdGlvbnMuYm9keSA9IHNlcmlhbGl6ZUZldGNoUGFyYW1ldGVyKGJvZHksICdQYXlsb2FkJyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAocGFyc2VFcnJvcikge1xuICAgICAgICAgICAgICAgIHJldHVybiBmcm9tRXJyb3IocGFyc2VFcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG5ldyBPYnNlcnZhYmxlKGZ1bmN0aW9uIChvYnNlcnZlcikge1xuICAgICAgICAgICAgZmV0Y2hlcihjaG9zZW5VUkksIG9wdGlvbnMpXG4gICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24gKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgb3BlcmF0aW9uLnNldENvbnRleHQoeyByZXNwb25zZTogcmVzcG9uc2UgfSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAudGhlbihwYXJzZUFuZENoZWNrSHR0cFJlc3BvbnNlKG9wZXJhdGlvbikpXG4gICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24gKHJlc3VsdCkge1xuICAgICAgICAgICAgICAgIG9ic2VydmVyLm5leHQocmVzdWx0KTtcbiAgICAgICAgICAgICAgICBvYnNlcnZlci5jb21wbGV0ZSgpO1xuICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5jYXRjaChmdW5jdGlvbiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgaWYgKGVyci5uYW1lID09PSAnQWJvcnRFcnJvcicpXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICBpZiAoZXJyLnJlc3VsdCAmJiBlcnIucmVzdWx0LmVycm9ycyAmJiBlcnIucmVzdWx0LmRhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgb2JzZXJ2ZXIubmV4dChlcnIucmVzdWx0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgb2JzZXJ2ZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICBpZiAoY29udHJvbGxlcilcbiAgICAgICAgICAgICAgICAgICAgY29udHJvbGxlci5hYm9ydCgpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSk7XG4gICAgfSk7XG59O1xuLy8jIHNvdXJjZU1hcHBpbmdVUkw9Y3JlYXRlSHR0cExpbmsuanMubWFwIiwiZXhwb3J0IHZhciBjcmVhd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gICAgICAgIHJldHVybiBjb3B5XzE7XG4gICAgICAgIH1cbiAgICAgICAgY2FzZSBcIltvYmplY3QgT2JqZWN0XVwiOiB7XG4gICAgICAgICAgICBzZWVuID0gc2VlbiB8fCBuZXcgTWFwO1xuICAgICAgICAgICAgaWYgKHNlZW4uaGFzKHZhbCkpXG4gICAgICAgICAgICAgICAgcmV0dXJuIHNlZW4uZ2V0KHZhbCk7XG4gICAgICAgICAgICB2YXIgY29weV8yID0gT2JqZWN0LmNyZWF0ZShPYmplY3QuZ2V0UHJvdG90eXBlT2YodmFsKSk7XG4gICAgICAgICAgICBzZWVuLnNldCh2YWwsIGNvcHlfMik7XG4gICAgICAgICAgICBPYmplY3Qua2V5cyh2YWwpLmZvckVhY2goZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIGNvcHlfMltrZXldID0gY2xvbmVEZWVwSGVscGVyKHZhbFtrZXldLCBzZWVuKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcmV0dXJuIGNvcHlfMjtcbiAgICAgICAgfVxuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgcmV0dXJuIHZhbDtcbiAgICB9XG59XG4vLyMgc291cmNlTWFwcGluZ1VSTD1jbG9uZURlZXAuanMubWFwIiwiZXhwb3J0IGZ1bmN0aW9uIGNvbXBhY3QoKSB7XG4gICAgdmFyIG9iamVjdHMgPSBbXTtcbiAgICBmb3IgKHZhciBfaSA9IDA7IF9pIDwgYXJndW1lbnRzLmxlbmd0aDsgX2krKykge1xuICAgICAgICBvYmplY3RzW19pXSA9IGFyZ3VtZW50c1tfaV07XG4gICAgfVxuICAgIHZhciByZXN1bHQgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICAgIG9iamVjdHMuZm9yRWFjaChmdW5jdGlvbiAob2JqKSB7XG4gICAgICAgIGlmICghb2JqKVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICBPYmplY3Qua2V5cyhvYmopLmZvckVhY2goZnVuY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V5cyhzb3VyY2UpLmZvckVhY2goZnVuY3Rpb24gKHNvdXJjZUtleSkge1xuICAgICAgICAgICAgICAgIGlmIChoYXNPd25Qcm9wZXJ0eS5jYWxsKHRhcmdldCwgc291cmNlS2V5KSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdGFyZ2V0VmFsdWUgPSB0YXJnZXRbc291cmNlS2V5XTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNvdXJjZVtzb3VyY2VLZXldICE9PSB0YXJnZXRWYWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IF90aGlzLnJlY29uY2lsZXIuYXBwbHkoX3RoaXMsIF9fc3ByZWFkQXJyYXlzKFt0YXJnZXQsIHNvdXJjZSwgc291cmNlS2V5XSwgY29udGV4dCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlc3VsdCAhPT0gdGFyZ2V0VmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQgPSBfdGhpcy5zaGFsbG93Q29weUZvck1lcmdlKHRhcmdldCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0W3NvdXJjZUtleV0gPSByZXN1bHQ7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRhcmdldCA9IF90aGlzLnNoYWxsb3dDb3B5Rm9yTWVyZ2UodGFyZ2V0KTtcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0W3NvdXJjZUtleV0gPSBzb3VyY2Vbc291cmNlS2V5XTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHJldHVybiB0YXJnZXQ7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHNvdXJjZTtcbiAgICB9O1xuICAgIER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lvbicsXG4gICAgICAgICAgICAgICAgb3BlcmF0aW9uOiAncXVlcnknLFxuICAgICAgICAgICAgICAgIHNlbGVjdGlvblNldDoge1xuICAgICAgICAgICAgICAgICAgICBraW5kOiAnU2VsZWN0aW9uU2V0JyxcbiAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uczogW1xuICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6ICdGcmFnbWVudFNwcmVhZCcsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZToge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBraW5kOiAnTmFtZScsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBhY3R1YWxGcmFnbWVudE5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIF0sXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH1cbiAgICAgICAgXSwgZG9jdW1lbnQuZGVmaW5pdGlvbnMpIH0pO1xuICAgIHJldHVybiBxdWVyeTtcbn1cbmV4cG9ydCBmdW5jdGlvbiBjcmVhdGVGcmFnbWVudE1hcChmcmFnbWVudHMpIHtcbiAgICBpZiAoZnJhZ21lbnRzID09PSB2b2lkIDApIHsgZnJhZ21lbnRzID0gW107IH1cbiAgICB2YXIgc3ltVGFibGUgPSB7fTtcbiAgICBmcmFnbWVudHMuZm9yRWFjaChmdW5jdGlvbiAoZnJhZ21lbnQpIHtcbiAgICAgICAgc3ltVGFibGVbZnJhZ21lbnQubmFtZS52YWx1ZV0gPSBmcmFnbWVudDtcbiAgICB9KTtcbiAgICByZXR1cm4gc3ltVGFibGU7XG59XG5leHBvcnQgZnVuY3Rpb24gZ2V0RnJhZ21lbnRGcm9tU2VsZWN0aW9uKHNlbGVjdGlvbiwgZnJhZ21lbnRNYXApIHtc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iZSBhIGZyYWdtZW50IGRlZmluaXRpb24uJyk7XG4gICAgcmV0dXJuIGZyYWdtZW50RGVmO1xufVxuZXhwb3J0IGZ1bmN0aW9uIGdldE1haW5EZWZpbml0aW9uKHF1ZXJ5RG9jKSB7XG4gICAgY2hlY2tEb2N1bWVudChxdWVyeURvYyk7XG4gICAgdmFyIGZyYWdtZW50RGVmaW5pdGlvbjtcbiAgICBmb3IgKHZhciBfaSA9IDAsIF9hID0gcXVlcnlEb2MuZGVmaW5pdGlvbnM7IF9pIDwgX2EubGVuZ3RoOyBfaSsrKSB7XG4gICAgICAgIHZhciBkZWZpbml0aW9uID0gX2FbX2ldO1xuICAgICAgICBpZiAoZGVmaW5pdGlvbi5raW5kID09PSAnT3BlcmF0aW9uRGVmaW5pdGlvbicpIHtcbiAgICAgICAgICAgIHZhciBvcGVyYXRpb24gPSBkZWZpbml0aW9uLm9wZXJhdGlvbjtcbiAgICAgICAgICAgIGlmIChvcGVyYXRpb24gPT09ICdxdWVyeScgfHxcbiAgICAgICAgICAgICAgICBvcGVyYXRpb24gPT09ICdtdXRhdGlvbicgfHxcbiAgICAgICAgICAgICAgICBvcGVyYXRpb24gPT09ICdzdWJzY3JpcHRpb24nKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRlZmluaXRpb247XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGRlZmluaXRpb24ua2luZCA9PT0gJ0ZyYWdtZW50RGVmaW5pdGlvbicgJiYgIWZyYWdtZW50RGVmaW5pdGlvbikge1xuICAgICAgICAgICAgZnJhZ21lbnREZWZpbml0aW9uID0gZGVmaW5pdGlvbjtcbiAgICAgICAgfVxuICAgIH1cbiAgICBpZiAoZnJhZ21lbnREZWZpbml0aW9uKSB7XG4gICAgICAgIHJldHVybiBmcmFnbWVudERlZmluaXRpb247XG4gICAgfVxuICAgIHRocm93IHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSBcInByb2R1Y3Rpb25cIiA/IG5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N0aXZlc1snY29ubmVjdGlvbiddWydrZXknXSArIFwiKFwiICsgSlNPTi5zdHJpbmdpZnkoZmlsdGVyZWRBcmdzXzEpICsgXCIpXCI7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gZGlyZWN0aXZlc1snY29ubmVjdGlvbiddWydrZXknXTtcbiAgICAgICAgfVxuICAgIH1cbiAgICB2YXIgY29tcGxldGVGaWVsZE5hbWUgPSBmaWVsZE5hbWU7XG4gICAgaWYgKGFyZ3MpIHtcbiAgICAgICAgdmFyIHN0cmluZ2lmaWVkQXJncyA9IHN0cmluZ2lmeShhcmdzKTtcbiAgICAgICAgY29tcGxldGVGaWVsZE5hbWUgKz0gXCIoXCIgKyBzdHJpbmdpZmllZEFyZ3MgKyBcIilcIjtcbiAgICB9XG4gICAgaWYgKGRpcmVjdGl2ZXMpIHtcbiAgICAgICAgT2JqZWN0LmtleXMoZGlyZWN0aXZlcykuZm9yRWFjaChmdW5jdGlvbiAoa2V5KSB7XG4gICAgICAgICAgICBpZiAoS05PV05fRElSRUNUSVZFUy5pbmRleE9mKGtleSkgIT09IC0xKVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIGlmIChkaXJlY3RpdmVzW2tleV0gJiYgT2JqZWN0LmtleXMoZGlyZWN0aXZlc1trZXldKS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICBjb21wbGV0ZUZpZWxkTmFtZSArPSBcIkBcIiArIGtleSArIFwiKFwiICsgSlNPTi5zdHJpbmdpZnkoZGlyZWN0aXZlc1trZXldKSArIFwiKVwiO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgY29tcGxldGVGaWVsZE5hbWUgKz0gXCJAXCIgKyBrZXk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICByZXR1cm4gY29tcGxldGVGaWVsZE5hbWU7XG59XG5leHBvcnQ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sZDoge1xuICAgICAgICAgICAgZW50ZXI6IGZ1bmN0aW9uIChub2RlKSB7XG4gICAgICAgICAgICAgICAgaWYgKGRpcmVjdGl2ZXMgJiYgbm9kZS5kaXJlY3RpdmVzKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBzaG91bGRSZW1vdmVGaWVsZCA9IGRpcmVjdGl2ZXMuc29tZShmdW5jdGlvbiAoZGlyZWN0aXZlKSB7IHJldHVybiBkaXJlY3RpdmUucmVtb3ZlOyB9KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNob3VsZFJlbW92ZUZpZWxkICYmXG4gICAgICAgICAgICAgICAgICAgICAgICBub2RlLmRpcmVjdGl2ZXMgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUuZGlyZWN0aXZlcy5zb21lKGdldERpcmVjdGl2ZU1hdGNoZXIoZGlyZWN0aXZlcykpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobm9kZS5hcmd1bWVudHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlLmFyZ3VtZW50cy5mb3JFYWNoKGZ1bmN0aW9uIChhcmcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFyZy52YWx1ZS5raW5kID09PSAnVmFyaWFibGUnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXNUb1JlbW92ZS5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBhcmcudmFsdWUubmFtZS52YWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobm9kZS5zZWxlY3Rpb25TZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRBbGxGcmFnbWVudFNwcmVhZHNGcm9tU2VsZWN0aW9uU2V0KG5vZGUuc2VsZWN0aW9uU2V0KS5mb3JFYWNoKGZ1bmN0aW9uIChmcmFnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYWdtZW50U3ByZWFkc1RvUmVtb3ZlLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZnJhZy5uYW1lLnZhbHVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgICAgRnJhZ21lbnRTcHJlYWQ6IHtcbiAgICAgICAgICAgIGVudGVyOiBmdW5jdGlvbiAobm9kZSkge1xuICAgICAgICAgICAgICAgIGZyYWdtZW50U3ByZWFkc0luVXNlW25vZGUubmFtZS52YWx1ZV0gPSB0cnVlO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgICAgRGlyZWN0aXZlOiB7XG4gICAgICAgICAgICBlbnRlcjogZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgICAgICAgICBpZiAoZ2V0RGlyZWN0aXZlTWF0Y2hlcihkaXJlY3RpdmVzKShub2RlKSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgIH0pKTtcbiAgICBpZiAobW9kaWZpZWREb2MgJiZcbiAgICAgICAgZmlsdGVySW5QbGFjZSh2YXJpYWJsZXNUb1JlbW92ZSwgZnVuY3Rpb24gKHYpIHsgcmV0dXJuICEhdi5uYW1lICYmICF2YXJpYWJsZXNJblVzZVt2Lm5hbWVdOyB9KS5sZW5ndGgpIHtcbiAgICAgICAgbW9kaWZpZWREb2MgPSByZW1vdmVBcmd1bWVudHNGcm9tRG9jdW1lbnQodmFyaWFibGVzVG9SZW1vdmUsIG1vZGlmaWVkRG9jKTtcbiAgICB9XG4gICAgaWYgKG1vZGlmaWVkRG9jICYmXG4gICAgICAgIGZpbHRlckluUGxhY2UoZnJhZ21lbnRTcHJlYWRzVG9SZW1vdmUsIGZ1bmN0aW9uIChmcykgeyByZXR1cm4gISFmcy5uYW1lICYmICFmcmFnbWVudFNwcmVhZHNJblVzZVtmcy5uYW1lXTsgfSlcbiAgICAgICAgICAgIC5sZW5ndGgpIHtcbiAgICAgICAgbW9kaWZpZWREb2MgPSByZW1vdmVGcmFnbWVudFNwcmVhZEZyb21Eb2N1bWVudChmcmFnbWVudFNwcmVhZHNUb1JlbW92ZSwgbW9kaWZpZWREb2MpO1xuICAgIH1cbiAgICByZXR1cm4gbW9kaWZpZWREb2M7XG59XG5leHBvcnQgZnVuY3Rpb24gYWRkVHlwZW5hbWVUb0RvY3VtZW50KGRvYykge1xuICAgIHJldHVybiB2aXNpdChjaGVja0RvY3VtZW50KGRvYyksIHtcbiAgICAgICAgU2VsZWN0aW9uU2V0OiB7XG4gICAgICAgICAgICBlbnRlcjogZnVuY3Rpb24gKG5vZGUsIF9rZXksIHBhcmVudCkge1xuICAgICAgICAgICAgICAgIGlmIChwYXJlbnQgJiZcbiAgICAgICAgICAgICAgICAgICAgcGFyZW50LmtpbmQgPT09ICdPcGVyYXRpb25EZWZpbml0aW9uJykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHZhciBzZWxlY3Rpb25zID0gbm9kZS5zZWxlY3Rpb25zO1xuICAgICAgICAgICAgICAgIGlmICghc2VsZWN0aW9ucykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHZhciBza2lwID0gc2VsZWN0aW9ucy5zb21lKGZ1bmN0aW9uIChzZWxlY3Rpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChpc0ZpZWxkKHNlbGVjdGlvbikgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgIChzZWxlY3Rpb24ubmFtZS52YWx1ZSA9PT0gJ19fdHlwZW5hbWUnIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uLm5hbWUudmFsdWUubGFzdEluZGV4T2YoJ19fJywgMCkgPT09IDApKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBpZiAoc2tpcCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHZhciBmaWVsZCA9IHBhcmVudDtcbiAgICAgICAgICAgICAgICBpZiAoaXNGaWVsZChmaWVsZCkgJiZcbiAgICAgICAgICAgICAgICAgICAgZmllbGQuZGlyZWN0aXZlcyAmJlxuICAgICAgICAgICAgICAgICAgICBmaWVsZC5kaXJlY3RpdmVzLnNvbWUoZnVuY3Rpb24gKGQpIHsgcmV0dXJuIGQubmFtZS52YWx1ZSA9PT0gJ2V4cG9ydCc7IH0pKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9fYXNzaWduKF9fYXNzaWduKHt9LCBub2RlKSwgeyBzZWxlY3Rpb25zOiBfX3NwcmVhZEFycmF5cyhzZWxlY3Rpb25zLCBbVFlQRU5BTUVfRklFTERdKSB9KTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgfSk7XG59XG5hZGRUeXBlbmFtZVRvRG9jdW1lbnQuYWRkZWQgPSBmdW5jdGlvbiAoZmllbG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ZykgeyByZXR1cm4gYXJnLm5hbWUgPT09IHZhckRlZi52YXJpYWJsZS5uYW1lLnZhbHVlOyB9KTtcbiAgICAgICAgICAgICAgICAgICAgfSkgOiBbXSB9KTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIEZpZWxkOiB7XG4gICAgICAgICAgICBlbnRlcjogZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgICAgICAgICB2YXIgc2hvdWxkUmVtb3ZlRmllbGQgPSBjb25maWcuc29tZShmdW5jdGlvbiAoYXJnQ29uZmlnKSB7IHJldHVybiBhcmdDb25maWcucmVtb3ZlOyB9KTtcbiAgICAgICAgICAgICAgICBpZiAoc2hvdWxkUmVtb3ZlRmllbGQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGFyZ01hdGNoQ291bnRfMSA9IDA7XG4gICAgICAgICAgICAgICAgICAgIGlmIChub2RlLmFyZ3VtZW50cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5hcmd1bWVudHMuZm9yRWFjaChmdW5jdGlvbiAoYXJnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFyZ01hdGNoZXIoYXJnKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdNYXRjaENvdW50XzEgKz0gMTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoYXJnTWF0Y2hDb3VudF8xID09PSAxKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIEFyZ3VtZW50OiB7XG4gICAgICAgICAgICBlbnRlcjogZnVuY3Rpb24gKG5vZGUpIHtcbiA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pcmVjdGl2ZXNGcm9tRG9jdW1lbnQoW1xuICAgICAgICB7XG4gICAgICAgICAgICB0ZXN0OiBmdW5jdGlvbiAoZGlyZWN0aXZlKSB7IHJldHVybiBkaXJlY3RpdmUubmFtZS52YWx1ZSA9PT0gJ2NsaWVudCc7IH0sXG4gICAgICAgICAgICByZW1vdmU6IHRydWUsXG4gICAgICAgIH0sXG4gICAgXSwgZG9jdW1lbnQpO1xuICAgIGlmIChtb2RpZmllZERvYykge1xuICAgICAgICBtb2RpZmllZERvYyA9IHZpc2l0KG1vZGlmaWVkRG9jLCB7XG4gICAgICAgICAgICBGcmFnbWVudERlZmluaXRpb246IHtcbiAgICAgICAgICAgICAgICBlbnRlcjogZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG5vZGUuc2VsZWN0aW9uU2V0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgaXNUeXBlbmFtZU9ubHkgPSBub2RlLnNlbGVjdGlvblNldC5zZWxlY3Rpb25zLmV2ZXJ5KGZ1bmN0aW9uIChzZWxlY3Rpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNGaWVsZChzZWxlY3Rpb24pICYmIHNlbGVjdGlvbi5uYW1lLnZhbHVlID09PSAnX190eXBlbmFtZSc7XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc1R5cGVuYW1lT25seSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgIH0pO1xuICAgIH1cbiAgICByZXR1cm4gbW9kaWZpZWREb2M7XG59XG4vLyMgc291cmNlTWFwcGluZ1VSTD10cmFuc2Zvcm0uanMubWFwIiwiZXhwb3J0IH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lzLnN1YiAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBfdGhpcy5sYXRlc3QgPSBbXCJuZXh0XCIsIHJlc3VsdF07XG4gICAgICAgICAgICAgICAgICAgIGl0ZXJhdGVPYnNlcnZlcnNTYWZlbHkoX3RoaXMub2JzZXJ2ZXJzLCBcIm5leHRcIiwgcmVzdWx0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uIChlcnJvcikge1xuICAgICAgICAgICAgICAgIGlmIChfdGhpcy5zdWIgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKF90aGlzLnN1YilcbiAgICAgICAgICAgICAgICAgICAgICAgIF90aGlzLnN1Yi51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICAgICAgICBfdGhpcy5zdWIgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICBfdGhpcy5sYXRlc3QgPSBbXCJlcnJvclwiLCBlcnJvcl07XG4gICAgICAgICAgICAgICAgICAgIF90aGlzLnJlamVjdChlcnJvcik7XG4gICAgICAgICAgICAgICAgICAgIGl0ZXJhdGVPYnNlcnZlcnNTYWZlbHkoX3RoaXMub2JzZXJ2ZXJzLCBcImVycm9yXCIsIGVycm9yKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29tcGxldGU6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICBpZiAoX3RoaXMuc3ViICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciB2YWx1ZSA9IF90aGlzLnNvdXJjZXMuc2hpZnQoKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgX3RoaXMuc3ViID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfdGhpcy5sYXRlc3QgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdGhpcy5sYXRlc3RbMF0gPT09IFwibmV4dFwiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgX3RoaXMucmVzb2x2ZShfdGhpcy5sYXRlc3RbMV0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgX3RoaXMucmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaXRlcmF0ZU9ic2VydmVyc1NhZmVseShfdGhpcy5vYnNlcnZlcnMsIFwiY29tcGxldGVcIik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoaXNQcm9taXNlTGlrZSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlLnRoZW4oZnVuY3Rpb24gKG9icykgeyByZXR1cm4gX3RoaXMuc3ViID0gb2JzLnN1YnNjcmliZShfdGhpcy5oYW5kbGVycyk7IH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgX3RoaXMuc3ViID0gdmFsdWUuc3Vic2NyaWJlKF90aGlzLmhhbmRsZXJzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgIH07XG4gICAgICAgIF90aGlzLmNhbmNlbCA9IGZ1bmN0aW9uIChyZWFzb24pIHtcbiAgICAgICAgICAgIF90aGlzLnJlamVjdChyZWFzb24pO1xuICAgICAgICAgICAgX3RoaXMuc291cmNlcyA9IFtdO1xuICAgICAgICAgICAgX3RoaXMuaGFuZGxlcnMuY29tcGxldGUoKTtcbiAgICAgICAgfTtcbiAgICAgICAgX3RoaXMucHJvbWlzZS5jYXRjaChmdW5jdGlvbiAoXykgeyB9KTtcbiAgICAgICAgaWYgKGlzUHJvbWlzZUxpa2Uoc291cmNlcykpIHtcbiAgICAgICAgICAgIHNvdXJjZXMudGhlbihmdW5jdGlvbiAoaXRlcmFibGUpIHsgcmV0dXJuIF90aGlzLnN0YXJ0KGl0ZXJhYmxlKTsgfSwgX3RoaXMuaGFuZGxlcnMuZXJyb3IpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgX3RoaXMuc3RhcnQoc291cmNlcyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIF90aGlzO1xuICAgIH1cbiAgICBDb25jYXN0LnByb3RvdHlwZS5zdGFydCA9IGZ1bmN0aW9uIChzb3VyY2VzKSB7XG4gICAgICAgIGlmICh0aGlzLnN1YiAhPT0gdm9pZCAwKVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB0aGlzLnNvdXJjZXMgPSBBcnJheS5mcm9tKHNvdXJjZXMpO1xuICAgICAgICB0aGlzLmhhbmRsZXJzLmNvbXBsZXRlKCk7XG4gICAgfTtcbiAgICBDb25jYXN0LnByb3RvdHlwZS5hZGRPYnNlcnZlciA9IGZ1bmN0aW9uIChvYnNlcnZlcikge1xuICAgICAgICBpZiAoIXRoaXMub2JzZXJ2ZXJzLmhhcyhvYnNlcnZlcikpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLmxhdGVzdCkge1xuICAgICAgICAgICAgICAgIHZhciBuZXh0T3JFcnJvciA9IHRoaXMubGF0ZXN0WzBdO1xuICAgICAgICAgICAgICAgIHZhciBtZXRob2QgPSBvYnNlcnZlcltuZXh0T3JFcnJvcl07XG4gICAgICAgICAgICAgICAgaWYgKG1ldGhvZCkge1xuICAgICAgICAgICAgICAgICAgICBtZXRob2QuY2FsbChvYnNlcnZlciwgdGhpcy5sYXRlc3RbMV0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5zdWIgPT09IG51bGwgJiZcbiAgICAgICAgICAgICAgICAgICAgbmV4dE9yRXJyb3IgPT09IFwibmV4dFwiICYmXG4gICAgICAgICAgICAgICAgICAgIG9ic2VydmVyLmNvbXBsZXRlKSB7XG4gICAgICAgICAgICAgICAgICAgIG9ic2VydmVyLmNvbXBsZXRlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5vYnNlcnZlcnMuYWRkKG9ic2VydmVyKTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgQ29uY2FzdC5wcm90b3R5cGUucmVtb3ZlT2JzZXJ2ZXIgPSBmdW5jdGlvbiAob2JzZXJ2ZXIsIHF1aWV0bHkpIHtcbiAgICAgICAgaWYgKHRoaXMub2JzZXJ2ZXJzLmRlbGV0ZShvYnNlcnZlcikgJiZcbiAgICAgICAgICAgIHRoaXMub2JzZXJ2ZXJzLnNpemUgPCAxKSB7XG4gICAgICAgICAgICBpZiAocXVpZXRseSlcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICBpZiAodGhpcy5zdWIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnN1Yi51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICAgIHRoaXMucmVqZWN0KG5ldyBFcnJvcihcIk9ic2VydmFibGUgY2FuY2VsbGVkIHByZW1hdHVyZWx5XCIpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuc3ViID0gbnVsbDtcbiAgICAgICAgfVxuICAgIH07XG4gICAgQ29uY2FzdC5wcm90b3R5cGUuY2xlYW51cCA9IGZ1bmN0aW9uIChjYWxsYmFjaykge1xuICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xuICAgICAgICB2YXIgY2FsbGVkID0gZmFsc2U7XG4gICAgICAgIHZhciBvbmNlID0gZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgaWYgKCFjYWxsZWQpIHtcbiAgICAgICAgICAgICAg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WFwRm4sIGNhdGNoRm4pIHtcbiAgICByZXR1cm4gbmV3IE9ic2VydmFibGUoZnVuY3Rpb24gKG9ic2VydmVyKSB7XG4gICAgICAgIHZhciBuZXh0ID0gb2JzZXJ2ZXIubmV4dCwgZXJyb3IgPSBvYnNlcnZlci5lcnJvciwgY29tcGxldGUgPSBvYnNlcnZlci5jb21wbGV0ZTtcbiAgICAgICAgdmFyIGFjdGl2ZUNhbGxiYWNrQ291bnQgPSAwO1xuICAgICAgICB2YXIgY29tcGxldGVkID0gZmFsc2U7XG4gICAgICAgIGZ1bmN0aW9uIG1ha2VDYWxsYmFjayhleGFtaW5lciwgZGVsZWdhdGUpIHtcbiAgICAgICAgICAgIGlmIChleGFtaW5lcikge1xuICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYXJnKSB7XG4gICAgICAgICAgICAgICAgICAgICsrYWN0aXZlQ2FsbGJhY2tDb3VudDtcbiAgICAgICAgICAgICAgICAgICAgbmV3IFByb21pc2UoZnVuY3Rpb24gKHJlc29sdmUpIHsgcmV0dXJuIHJlc29sdmUoZXhhbWluZXIoYXJnKSk7IH0pLnRoZW4oZnVuY3Rpb24gKHJlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLS1hY3RpdmVDYWxsYmFja0NvdW50O1xuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dCAmJiBuZXh0LmNhbGwob2JzZXJ2ZXIsIHJlc3VsdCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29tcGxldGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlci5jb21wbGV0ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLS1hY3RpdmVDYWxsYmFja0NvdW50O1xuICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IgJiYgZXJyb3IuY2FsbChvYnNlcnZlciwgZSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGFyZykgeyByZXR1cm4gZGVsZWdhdGUgJiYgZGVsZWdhdGUuY2FsbChvYnNlcnZlciwgYXJnKTsgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB2YXIgaGFuZGxlciA9IHtcbiAgICAgICAgICAgIG5leHQ6IG1ha2VDYWxsYmFjayhtYXBGbiwgbmV4dCksXG4gICAgICAgICAgICBlcnJvcjogbWFrZUNhbGxiYWNrKGNhdGNoRm4sIGVycm9yKSxcbiAgICAgICAgICAgIGNvbXBsZXRlOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgY29tcGxldGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBpZiAoIWFjdGl2ZUNhbGxiYWNrQ291bnQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29tcGxldGUgJiYgY29tcGxldGUuY2FsbChvYnNlcnZlcik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgfTtcbiAgICAgICAgdmFyIHN1YiA9IG9ic2VydmFibGUuc3Vic2NyaWJlKGhhbmRsZXIpO1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgeyByZXR1cm4gc3ViLnVuc3Vic2NyaWJlKCk7IH07XG4gICAgfSk7XG59XG4vLyMgc291cmNlTWFwcGluZ1VSTD1hc3luY01hcC5qcy5tYXAiLCJleHBvcnQgZnVuY3Rpb24gaXRlcmF0ZU9ic2VydmVyc1NhZmVseShvYnNlcnZlcnMsIG1ldGhvZCwgYXJndW1lbnQpIHtcbiAgICB2YXIgb2JzZXJ2ZXJzV2l0aE1ldGhvZCA9IFtdO1xuICAgIG9ic2VydmVycy5mb3JFYWNoKGZ1bmN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ICAgICAgICAgICB2YXIgYXJncyA9IF9hLmFyZ3M7XG4gICAgICAgICAgICB2YXIgbWVyZ2VkID0gZXhpc3RpbmcgPyBleGlzdGluZy5zbGljZSgwKSA6IFtdO1xuICAgICAgICAgICAgaWYgKGFyZ3MpIHtcbiAgICAgICAgICAgICAgICB2YXIgX2IgPSBhcmdzLm9mZnNldCwgb2Zmc2V0ID0gX2IgPT09IHZvaWQgMCA/IDAgOiBfYjtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGluY29taW5nLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICAgICAgICAgIG1lcmdlZFtvZmZzZXQgKyBpXSA9IGluY29taW5nW2ldO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIG1lcmdlZC5wdXNoLmFwcGx5KG1lcmdlZCwgaW5jb21pbmcpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIG1lcmdlZDtcbiAgICAgICAgfSxcbiAgICB9O1xufVxuZXhwb3J0IGZ1bmN0aW9uIHJlbGF5U3R5bGVQYWdpbmF0aW9uKGtleUFyZ3MpIHtcbiAgICBpZiAoa2V5QXJncyA9PT0gdm9pZCAwKSB7IGtleUFyZ3MgPSBmYWxzZTsgfVxuICAgIHJldHVybiB7XG4gICAgICAgIGtleUFyZ3M6IGtleUFyZ3MsXG4gICAgICAgIHJlYWQ6IGZ1bmN0aW9uIChleGlzdGluZywgX2EpIHtcbiAgICAgICAgICAgIHZhciBjYW5SZWFkID0gX2EuY2FuUmVhZCwgcmVhZEZpZWxkID0gX2EucmVhZEZpZWxkO1xuICAgICAgICAgICAgaWYgKCFleGlzdGluZylcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB2YXIgZWRnZXMgPSBbXTtcbiAgICAgICAgICAgIHZhciBzdGFydEN1cnNvciA9IFwiXCI7XG4gICAgICAg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dmFyIGluY29taW5nRWRnZXMgPSBpbmNvbWluZy5lZGdlcyA/IGluY29taW5nLmVkZ2VzLm1hcChmdW5jdGlvbiAoZWRnZSkge1xuICAgICAgICAgICAgICAgIGlmIChpc1JlZmVyZW5jZShlZGdlID0gX19hc3NpZ24oe30sIGVkZ2UpKSkge1xuICAgICAgICAgICAgICAgICAgICBlZGdlLmN1cnNvciA9IHJlYWRGaWVsZChcImN1cnNvclwiLCBlZGdlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIGVkZ2U7XG4gICAgICAgICAgICB9KSA6IFtdO1xuICAgICAgICAgICAgaWYgKGluY29taW5nLnBhZ2VJbmZvKSB7XG4gICAgICAgICAgICAgICAgdmFyIHBhZ2VJbmZvXzEgPSBpbmNvbWluZy5wYWdlSW5mbztcbiAgICAgICAgICAgICAgICB2YXIgc3RhcnRDdXJzb3IgPSBwYWdlSW5mb18xLnN0YXJ0Q3Vyc29yLCBlbmRDdXJzb3IgPSBwYWdlSW5mb18xLmVuZEN1cnNvcjtcbiAgICAgICAgICAgICAgICB2YXIgZmlyc3RFZGdlID0gaW5jb21pbmdFZGdlc1swXTtcbiAgICAgICAgICAgICAgICB2YXIgbGFzdEVkZ2UgPSBpbmNvbWluZ0VkZ2VzW2luY29taW5nRWRnZXMubGVuZ3RoIC0gMV07XG4gICAgICAgICAgICAgICAgaWYgKGZpcnN0RWRnZSAmJiBzdGFydEN1cnNvcikge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdEVkZ2UuY3Vyc29yID0gc3RhcnRDdXJzb3I7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChsYXN0RWRnZSAmJiBlbmRDdXJzb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgbGFzdEVkZ2UuY3Vyc29yID0gZW5kQ3Vyc29yO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YXIgZmlyc3RDdXJzb3IgPSBmaXJzdEVkZ2UgJiYgZmlyc3RFZGdlLmN1cnNvcjtcbiAgICAgICAgICAgICAgICBpZiAoZmlyc3RDdXJzb3IgJiYgIXN0YXJ0Q3Vyc29yKSB7XG4gICAgICAgICAgICAgICAgICAgIGluY29taW5nID0gbWVyZ2VEZWVwKGluY29taW5nLCB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlSW5mbzoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0Q3Vyc29yOiBmaXJzdEN1cnNvcixcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YXIgbGFzdEN1cnNvciA9IGxhc3RFZGdlICYmIGxhc3RFZGdlLmN1cnNvcjtcbiAgICAgICAgICAgICAgICBpZiAobGFzdEN1cnNvciAmJiAhZW5kQ3Vyc29yKSB7XG4gICAgICAgICAgICAgICAgICAgIGluY29taW5nID0gbWVyZ2VEZWVwKGluY29taW5nLCB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlSW5mbzoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZEN1cnNvcjogbGFzdEN1cnNvcixcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBwcmVmaXggPSBleGlzdGluZy5lZGdlcztcbiAgICAgICAgICAgIHZhciBzdWZmaXggPSBbXTtcbiAgICAgICAgICAgIGlmIChhcmdzICYmIGFyZ3MuYWZ0ZXIpIHtcbiAgICAgICAgICAgICAgICB2YXIgaW5kZXggPSBwcmVmaXguZmluZEluZGV4KGZ1bmN0aW9uIChlZGdlKSB7IHJldHVybiBlZGdlLmN1cnNvciA9PT0gYXJncy5hZnRlcjsgfSk7XG4gICAgICAgICAgICAgICAgaWYgKGluZGV4ID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcHJlZml4ID0gcHJlZml4LnNsaWNlKDAsIGluZGV4ICsgMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoYXJncyAmJiBhcmdzLmJlZm9yZSkge1xuICAgICAgICAgICAgICAgIHZhciBpbmRleCA9IHByZWZpeC5maW5kSW5kZXgoZnVuY3Rpb24gKGVkZ2UpIHsgcmV0dXJuIGVkZ2UuY3Vyc29yID09PSBhcmdzLmJlZm9yZTsgfSk7XG4gICAgICAgICAgICAgICAgc3VmZml4ID0gaW5kZXggPCAwID8gcHJlZml4IDogcHJlZml4LnNsaWNlKGluZGV4KTtcbiAgICAgICAgICAgICAgICBwcmVmaXggPSBbXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKGluY29taW5nLmVkZ2VzKSB7XG4gICAgICAgICAgICAgICAgcHJlZml4ID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgZWRnZXMgPSBfX3NwcmVhZEFycmF5cyhwcmVmaXgsIGluY29taW5nRWRnZXMsIHN1ZmZpeCk7XG4gICAgICAgICAgICB2YXIgcGFnZUluZm8gPSBfX2Fzc2lnbihfX2Fzc2lnbih7fSwgaW5jb21pbmcucGFnZUluZm8pLCBleGlzdGluZy5wYWdlSW5mbyk7XG4gICAgICAgICAgICBpZiAoaW5jb21pbmcucGFnZUluZm8pIHtcbiAgICAgICAgICAgICAgICB2YXIgX2IgPSBpbmNvbWluZy5wYWdlSW5mbywgaGFzUHJldmlvdXNQYWdlID0gX2IuaGFzUHJldmlvdXNQYWdlLCBoYXNOZXh0UGFnZSA9IF9iLmhhc05leHRQYWdlLCBzdGFydEN1cnNvciA9IF9iLnN0YXJ0Q3Vyc29yLCBlbmRDdXJzb3IgPSBfYi5lbmRDdXJzb3I7XG4gICAgICAgICAgICAgICAgaWYgKCFwcmVmaXgubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGhhc1ByZXZpb3VzUGFnZSlcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VJbmZvLmhhc1ByZXZpb3VzUGFnZSA9IGhhc1ByZXZpb3VzUGFnZTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gc3RhcnRDdXJzb3IpXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlSW5mby5zdGFydEN1cnNvciA9IHN0YXJ0Q3Vyc29yO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIXN1ZmZpeC5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gaGFzTmV4dFBhZ2UpXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlSW5mby5oYXNOZXh0UGFnZSA9IGhhc05leHRQYWdlO1xuICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBlbmRDdXJzb3IpXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlSW5mby5lbmRDdXJzb3IgPSBlbmRDdXJzb3I7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIF9fYXNzaWduKF9fYXNzaWduKF9fYXNzaWduKHt9LCBnZXRFeHRyYXMoZXhpc3RpbmcpKSwgZ2V0RXh0cmFzKGluY29taW5nKSksIHsgZWRnZXM6IGVkZ2VzLFxuICAgICAgICAgICAgICAgIHBhZ2VJbmZvOiBwYWdlSW5mbyB9KTtcbiAgICAgICAgfSxcbiAgICB9O1xufVxudmFyIGdldEV4dHJhcyA9IGZ1bmN0aW9uIChvYmopIHsgcmV0dXJuIF9fcmVzdChvYmosIG5vdEV4dHJhcyk7IH07XG52YXIgbm90RXh0cmFzID0gW1wiZWRnZXNcIiwgXCJwYWdlSW5mb1wiXTtcbmZ1bmN0aW9uIG1ha2VFbXB0eURhd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FzIGEga2V5IHRvIGl0cyB2YWx1ZSwgd2hpY2ggbWVhbnMgdGhlXHJcbiAgICAgICAgICAgIC8vIHZhbHVlIGNhbm5vdCBiZSBvYnRhaW5lZCB3aXRob3V0IGEgcmVmZXJlbmNlIHRvIHRoZSBTbG90IG9iamVjdC5cclxuICAgICAgICAgICAgaWYgKHRoaXMuaWQgaW4gY29udGV4dF8xLnNsb3RzKSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSBjb250ZXh0XzEuc2xvdHNbdGhpcy5pZF07XHJcbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT09IE1JU1NJTkdfVkFMVUUpXHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBpZiAoY29udGV4dF8xICE9PSBjdXJyZW50Q29udGV4dCkge1xyXG4gICAgICAgICAgICAgICAgICAgIC8vIENhY2hlIHRoZSB2YWx1ZSBpbiBjdXJyZW50Q29udGV4dC5zbG90cyBzbyB0aGUgbmV4dCBsb29rdXAgd2lsbFxyXG4gICAgICAgICAgICAgICAgICAgIC8vIGJlIGZhc3Rlci4gVGhpcyBjYWNoaW5nIGlzIHNhZmUgYmVjYXVzZSB0aGUgdHJlZSBvZiBjb250ZXh0cyBhbmRcclxuICAgICAgICAgICAgICAgICAgICAvLyB0aGUgdmFsdWVzIG9mIHRoZSBzbG90cyBhcmUgbG9naWNhbGx5IGltbXV0YWJsZS5cclxuICAgICAgICAgICAgICAgICAgICBjdXJyZW50Q29udGV4dC5zbG90c1t0aGlzLmlkXSA9IHZhbHVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKGN1cnJlbnRDb250ZXh0KSB7XHJcbiAgICAgICAgICAgIC8vIElmIGEgdmFsdWUgd2FzIG5vdCBmb3VuZCBmb3IgdGhpcyBTbG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2EpO1xyXG4gICAgICAgIHZhciBwYXJlbnQgPSBjdXJyZW50Q29udGV4dDtcclxuICAgICAgICBjdXJyZW50Q29udGV4dCA9IHsgcGFyZW50OiBwYXJlbnQsIHNsb3RzOiBzbG90cyB9O1xyXG4gICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgIC8vIEZ1bmN0aW9uLnByb3RvdHlwZS5hcHBseSBhbGxvd3MgdGhlIGFyZ3VtZW50cyBhcnJheSBhcmd1bWVudCB0byBiZVxyXG4gICAgICAgICAgICAvLyBvbWl0dGVkIG9yIHVuZGVmaW5lZCwgc28gYXJncyEgaXMgZmluZSBoZXJlLlxyXG4gICAgICAgICAgICByZXR1cm4gY2FsbGJhY2suYXBwbHkodGhpc0FyZywgYXJncyk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGZpbmFsbHkge1xyXG4gICAgICAgICAgICBjdXJyZW50Q29udGV4dCA9IHBhcmVudDtcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG4gICAgLy8gQ2FwdHVyZSB0aGUgY3VycmVudCBjb250ZXh0IGFuZCB3cmFwIGEgY2FsbGJhY2sgZnVuY3Rpb24gc28gdGhhdCBpdFxyXG4gICAgLy8gcmVlc3RhYmxpc2hlcyB0aGUgY2FwdHVyZWQgY29udGV4dCB3aGVuIGNhbGxlZC5cclxuICAgIFNsb3QuYmluZCA9IGZ1bmN0aW9uIChjYWxsYmFjaykge1xyXG4gICAgICAgIHZhciBjb250ZXh0ID0gY3VycmVudENvbnRleHQ7XHJcbiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgdmFyIHNhdmVkID0gY3VycmVudENvbnRleHQ7XHJcbiAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICBjdXJyZW50Q29udGV4dCA9IGNvbnRleHQ7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gY2FsbGJhY2suYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgIC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gICAgICAgdmFyIGJvdW5kTmV4dCA9IGJpbmQoZ2VuLm5leHQpO1xyXG4gICAgICAgIHZhciBib3VuZFRocm93ID0gYmluZChnZW4udGhyb3cpO1xyXG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7XHJcbiAgICAgICAgICAgIGZ1bmN0aW9uIGludm9rZShtZXRob2QsIGFyZ3VtZW50KSB7XHJcbiAgICAgICAgICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBtZXRob2QuY2FsbChnZW4sIGFyZ3VtZW50KTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGNhdGNoIChlcnJvcikge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiByZWplY3QoZXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgdmFyIG5leHQgPSByZXN1bHQuZG9uZSA/IHJlc29sdmUgOiBpbnZva2VOZXh0O1xyXG4gICAgICAgICAgICAgICAgaWYgKGlzUHJvbWlzZUxpa2UocmVzdWx0LnZhbHVlKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdC52YWx1ZS50aGVuKG5leHQsIHJlc3VsdC5kb25lID8gcmVqZWN0IDogaW52b2tlVGhyb3cpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgbmV4dChyZXN1bHQudmFsdWUpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHZhciBpbnZva2VOZXh0ID0gZnVuY3Rpb24gKHZhbHVlKSB7IHJldHVybiBpbnZva2UoYm91bmROZXh0LCB2YWx1ZSk7IH07XHJcbiAgICAgICAgICAgIHZhciBpbnZva2VUaHJvdyA9IGZ1bmN0aW9uIChlcnJvc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clxuICAgIHN3aXRjaCAoYVRhZykge1xyXG4gICAgICAgIGNhc2UgJ1tvYmplY3QgQXJyYXldJzpcclxuICAgICAgICAgICAgLy8gQXJyYXlzIGFyZSBhIGxvdCBsaWtlIG90aGVyIG9iamVjdHMsIGJ1dCB3ZSBjYW4gY2hlYXBseSBjb21wYXJlIHRoZWlyXHJcbiAgICAgICAgICAgIC8vIGxlbmd0aHMgYXMgYSBzaG9ydC1jdXQgYmVmb3JlIGNvbXBhcmluZyB0aGVpciBlbGVtZW50cy5cclxuICAgICAgICAgICAgaWYgKGEubGVuZ3RoICE9PSBiLmxlbmd0aClcclxuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAvLyBGYWxsIHRocm91Z2ggdG8gb2JqZWN0IGNhc2UuLi5cclxuICAgICAgICBjYXNlICdbb2JqZWN0IE9iamVjdF0nOiB7XHJcbiAgICAgICAgICAgIGlmIChwcmV2aW91c2x5Q29tcGFyZWQoYSwgYikpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgdmFyIGFLZXlzID0gT2JqZWN0LmtleXMoYSk7XHJcbiAgICAgICAgICAgIHZhciBiS2V5cyA9IE9iamVjdC5rZXlzKGIpO1xyXG4gICAgICAgICAgICAvLyBJZiBgYWAgYW5kIGBiYCBoYXZlIGEgZGlmZmVyZW50IG51bWJlciBvZiBlbnVtZXJhYmxlIGtleXMsIHRoZXlcclxuICAgICAgICAgICAgLy8gbXVzdCBiZSBkaWZmZXJlbnQuXHJcbiAgICAgICAgICAgIHZhciBrZXlDb3VudCA9IGFLZXlzLmxlbmd0aDtcclxuICAgICAgICAgICAgaWYgKGtleUNvdW50ICE9PSBiS2V5cy5sZW5ndGgpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIC8vIE5vdyBtYWtlIHN1cmUgdGhleSBoYXZlIHRoZSBzYW1lIGtleXMuXHJcbiAgICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwga2V5Q291bnQ7ICsraykge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFoYXNPd25Qcm9wZXJ0eS5jYWxsKGIsIGFLZXlzW2tdKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvLyBGaW5hbGx5LCBjaGVjayBkZWVwIGVxdWFsaXR5IG9mIGFsbCBjaGlsZCBwcm9wZXJ0aWVzLlxyXG4gICAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IGtleUNvdW50OyArK2spIHtcclxuICAgICAgICAgICAgICAgIHZhciBrZXkgPSBhS2V5c1trXTtcclxuICAgICAgICAgICAgICAgIGlmICghY2hlY2soYVtrZXldLCBiW2tleV0pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH1cclxuICAgICAgICBjYXNlICdbb2JqZWN0IEVycm9yXSc6XHJcbiAgICAgICAgICAgIHJldHVybiBhLm5hbWUgPT09IGIubmFtZSAmJiBhLm1lc3NhZ2UgPT09IGIubWVzc2FnZTtcclxuICAgICAgICBjYXNlICdbb2JqZWN0IE51bWJlcl0nOlxyXG4gICAgICAgICAgICAvLyBIYW5kbGUgTmFOLCB3aGljaCBpcyAhPT0gaXRzZWxmLlxyXG4gICAgICAgICAgICBpZiAoYSAhPT0gYSlcclxuICAgICAgICAgICAgICAgIHJldHVybiBiICE9PSBiO1xyXG4gICAgICAgIC8vIEZhbGwgdGhyb3VnaCB0byBzaGFyZWQgK2EgPT09ICtiIGNhc2UuLi5cclxuICAgICAgICBjYXNlICdbb2JqZWN0IEJvb2xlYW5dJzpcclxuICAgICAgICBjYXNlICdbb2JqZWN0IERhdGVdJzpcclxuICAgICAgICAgICAgcmV0dXJuICthID09PSArYjtcclxuICAgICAgICBjYXNlICdbb2JqZWN0IFJlZ0V4cF0nOlxyXG4gICAgICAgIGNhc2UgJ1tvYmplY3QgU3RyaW5nXSc6XHJcbiAgICAgICAgICAgIHJldHVybiBhID09IFwiXCIgKyBiO1xyXG4gICAgICAgIGNhc2UgJ1tvYmplY3QgTWFwXSc6XHJcbiAgICAgICAgY2FzZSAnW29iamVjdCBTZXRdJzoge1xyXG4gICAgICAgICAgICBpZiAoYS5zaXplICE9PSBiLnNpemUpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgICAgIGlmIChwcmV2aW91c2x5Q29tcGFyZWQoYSwgYikpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgdmFyIGFJdGVyYXRvciA9IGEuZW50cmllcygpO1xyXG4gICAgICAgICAgICB2YXIgaXNNYXAgPSBhVGFnID09PSAnW29iamVjdCBNYXBdJztcclxuICAgICAgICAgICAgd2hpbGUgKHRydWUpIHtcclxuICAgICAgICAgICAgICAgIHZhciBpbmZvID0gYUl0ZXJhdG9yLm5leHQoKTtcclxuICAgICAgICAgICAgICAgIGlmIChpbmZvLmRvbmUpXHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAvLyBJZiBhIGluc3RhbmNlb2YgU2V0LCBhVmFsdWUgPT09IGFLZXkuXHJcbiAgICAgICAgICAgICAgICB2YXIgX2EgPSBpbmZvLnZhbHVlLCBhS2V5ID0gX2FbMF0sIGFWYWx1ZSA9IF9hWzFdO1xyXG4gICAgICAgICAgICAgICAgLy8gU28gdGhpcyB3b3JrcyB0aGUgc2FtZSB3YXkgZm9yIGJvdGggU2V0IGFuZCBNYXAuXHJcbiAgICAgICAgICAgICAgICBpZiAoIWIuaGFzKGFLZXkpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgc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yA9ICh0eXBlb2Ygb3B0cy5jeWNsZXMgPT09ICdib29sZWFuJykgPyBvcHRzLmN5Y2xlcyA6IGZhbHNlO1xuXG4gICAgdmFyIGNtcCA9IG9wdHMuY21wICYmIChmdW5jdGlvbiAoZikge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYSwgYikge1xuICAgICAgICAgICAgICAgIHZhciBhb2JqID0geyBrZXk6IGEsIHZhbHVlOiBub2RlW2FdIH07XG4gICAgICAgICAgICAgICAgdmFyIGJvYmogPSB7IGtleTogYiwgdmFsdWU6IG5vZGVbYl0gfTtcbiAgICAgICAgICAgICAgICByZXR1cm4gZihhb2JqLCBib2JqKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgIH07XG4gICAgfSkob3B0cy5jbXApO1xuXG4gICAgdmFyIHNlZW4gPSBbXTtcbiAgICByZXR1cm4gKGZ1bmN0aW9uIHN0cmluZ2lmeSAobm9kZSkge1xuICAgICAgICBpZiAobm9kZSAmJiBub2RlLnRvSlNPTiAmJiB0eXBlb2Ygbm9kZS50b0pTT04gPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIG5vZGUgPSBub2RlLnRvSlNPTigpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKG5vZGUgPT09IHVuZGVmaW5lZCkgcmV0dXJuO1xuICAgICAgICBpZiAodHlwZW9mIG5vZGUgPT0gJ251bWJlcicpIHJldHVybiBpc0Zpbml0ZShub2RlKSA/ICcnICsgbm9kZSA6ICdudWxsJztcbiAgICAgICAgaWYgKHR5cGVvZiBub2RlICE9PSAnb2JqZWN0JykgcmV0dXJuIEpTT04uc3RyaW5naWZ5KG5vZGUpO1xuXG4gICAgICAgIHZhciBpLCBvdXQ7XG4gICAgICAgIGlmIChBcnJheS5pc0FycmF5KG5vZGUpKSB7XG4gICAgICAgICAgICBvdXQgPSAnWyc7XG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbm9kZS5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgIGlmIChpKSBvdXQgKz0gJywnO1xuICAgICAgICAgICAgICAgIG91dCArPSBzdHJpbmdpZnkobm9kZVtpXSkgfHwgJ251bGwnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIG91dCArICddJztcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChub2RlID09PSBudWxsKSByZXR1cm4gJ251bGwnO1xuXG4gICAgICAgIGlmIChzZWVuLmluZGV4T2Yobm9kZSkgIT09IC0xKSB7XG4gICAgICAgICAgICBpZiAoY3ljbGVzKSByZXR1cm4gSlNPTi5zdHJpbmdpZnkoJ19fY3ljbGVfXycpO1xuICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ29udmVydGluZyBjaXJjdWxhciBzdHJ1Y3R1cmUgdG8gSlNPTicpO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHNlZW5JbmRleCA9IHNlZW4ucHVzaChub2RlKSAtIDE7XG4gICAgICAgIHZhciBrZXlzID0gT2JqZWN0LmtleXMobm9kZSkuc29ydChjbXAgJiYgY21wKG5vZGUpKTtcbiAgICAgICAgb3V0ID0gJyc7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBrZXlzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICB2YXIga2V5ID0ga2V5c1tpXTtcbiAgICAgICAgICAgIHZhciB2YWx1ZSA9IHN0cmluZ2lmeShub2RlW2tleV0pO1xuXG4gICAgICAgICAgICBpZiAoIXZhbHVlKSBjb250aW51ZTtcbiAgICAgICAgICAgIGlmIChvdXQpIG91dCArPSAnLCc7XG4gICAgICAgICAgICBvdXQgKz0gSlNPTi5zdHJpbmdpZnkoa2V5KSArICc6JyArIHZhbHVlO1xuICAgICAgICB9XG4gICAgICAgIHNlZW4uc3BsaWNlKHNlZW5JbmRleCwgMSk7XG4gICAgICAgIHJldHVybiAneycgKy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XG4gICAgICAgICAgaWYgKGRlZi5raW5kICE9PSAnRnJhZ21lbnREZWZpbml0aW9uJykgcmV0dXJuIHRydWU7XG4gICAgICAgICAgdmFyIG5hbWUgPSBkZWYubmFtZS52YWx1ZVxuICAgICAgICAgIGlmIChuYW1lc1tuYW1lXSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBuYW1lc1tuYW1lXSA9IHRydWU7XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIClcbiAgICB9XG4gIFxuXG4gICAgLy8gQ29sbGVjdCBhbnkgZnJhZ21lbnQvdHlwZSByZWZlcmVuY2VzIGZyb20gYSBub2RlLCBhZGRpbmcgdGhlbSB0byB0aGUgcmVmcyBTZXRcbiAgICBmdW5jdGlvbiBjb2xsZWN0RnJhZ21lbnRSZWZlcmVuY2VzKG5vZGUsIHJlZnMpIHtcbiAgICAgIGlmIChub2RlLmtpbmQgPT09IFwiRnJhZ21lbnRTcHJlYWRcIikge1xuICAgICAgICByZWZzLmFkZChub2RlLm5hbWUudmFsdWUpO1xuICAgICAgfSBlbHNlIGlmIChub2RlLmtpbmQgPT09IFwiVmFyaWFibGVEZWZpbml0aW9uXCIpIHtcbiAgICAgICAgdmFyIHR5cGUgPSBub2RlLnR5cGU7XG4gICAgICAgIGlmICh0eXBlLmtpbmQgPT09IFwiTmFtZWRUeXBlXCIpIHtcbiAgICAgICAgICByZWZzLmFkZCh0eXBlLm5hbWUudmFsdWUpO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChub2RlLnNlbGVjdGlvblNldCkge1xuICAgICAgICBub2RlLnNlbGVjdGlvblNldC5zZWxlY3Rpb25zLmZvckVhY2goZnVuY3Rpb24oc2VsZWN0aW9uKSB7XG4gICAgICAgICAgY29sbGVjdEZyYWdtZW50UmVmZXJlbmNlcyhzZWxlY3Rpb24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gIHBvcyArPSAyO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICsrcG9zO1xuICAgICAgICB9XG5cbiAgICAgICAgKytsZXhlci5saW5lO1xuICAgICAgICBsZXhlci5saW5lU3RhcnQgPSBwb3M7XG4gICAgICAgIGNvbnRpbnVlO1xuXG4gICAgICBjYXNlIDMzOlxuICAgICAgICAvLyAgIVxuICAgICAgICByZXR1cm4gbmV3IF9hc3QuVG9rZW4oX3Rva2VuS2luZC5Ub2tlbktpbmQuQkFORywgcG9zLCBwb3MgKyAxLCBfbGluZSwgX2NvbCwgcHJldik7XG5cbiAgICAgIGNhc2UgMzU6XG4gICAgICAgIC8vICAjXG4gICAgICAgIHJldHVybiByZWFkQ29tbWVudChzb3VyY2UsIHBvcywgX2xpbmUsIF9jb2wsIHByZXYpO1xuXG4gICAgICBjYXNlIDM2OlxuICAgICAgICAvLyAgJFxuICAgICAgICByZXR1cm4gbmV3IF9hc3QuVG9rZW4oX3Rva2VuS2luZC5Ub2tlbktpbmQuRE9MTEFSLCBwb3MsIHBvcyArIDEsIF9saW5lLCBfY29sLCBwcmV2KTtcblxuICAgICAgY2FzZSAzODpcbiAgICAgICAgLy8gICZcbiAgICAgICAgcmV0dXJuIG5ldyBfYXN0LlRva2VuKF90b2tlbktpbmQuVG9rZW5LaW5kLkFNUCwgcG9zLCBwb3MgKyAxLCBfbGluZSwgX2NvbCwgcHJldik7XG5cbiAgICAgIGNhc2UgNDA6XG4gICAgICAgIC8vICAoXG4gICAgICAgIHJldHVybiBuZXcgX2FzdC5Ub2tlbihfdG9rZW5LaW5kLlRva2VuS2luZC5QQVJFTl9MLCBwb3MsIHBvcyArIDEsIF9saW5lLCBfY29sLCBwcmV2KTtcblxuICAgICAgY2FzZSA0MTpcbiAgICAgICAgLy8gIClcbiAgICAgICAgcmV0dXJuIG5ldyBfYXN0LlRva2VuKF90b2tlbktpbmQuVG9rZW5LaW5kLlBBUkVOX1IsIHBvcywgcG9zICsgMSwgX2xpbmUs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DRcblxuICAgICAgY2FzZSA1MzogLy8gIDVcblxuICAgICAgY2FzZSA1NDogLy8gIDZcblxuICAgICAgY2FzZSA1NTogLy8gIDdcblxuICAgICAgY2FzZSA1NjogLy8gIDhcblxuICAgICAgY2FzZSA1NzpcbiAgICAgICAgLy8gIDlcbiAgICAgICAgcmV0dXJuIHJlYWROdW1iZXIoc291cmNlLCBwb3MsIGNvZGUsIF9saW5lLCBfY29sLCBwcmV2KTtcblxuICAgICAgY2FzZSA2NTogLy8gIEFcblxuICAgICAgY2FzZSA2NjogLy8gIEJcblxuICAgICAgY2FzZSA2NzogLy8gIENcblxuICAgICAgY2FzZSA2ODogLy8gIERcblxuICAgICAgY2FzZSA2OTogLy8gIEVcblxuICAgICAgY2FzZSA3MDogLy8gIEZcblxuICAgICAgY2FzZSA3MTogLy8gIEdcblxuICAgICAgY2FzZSA3MjogLy8gIEhcblxuICAgICAgY2FzZSA3MzogLy8gIElcblxuICAgICAgY2FzZSA3NDogLy8gIEpcblxuICAgICAgY2FzZSA3NTogLy8gIEtcblxuICAgICAgY2FzZSA3NjogLy8gIExcblxuICAgICAgY2FzZSA3NzogLy8gIE1cblxuICAgICAgY2FzZSA3ODogLy8gIE5cblxuICAgICAgY2FzZSA3OTogLy8gIE9cblxuICAgICAgY2FzZSA4MDogLy8gIFBcblxuICAgICAgY2FzZSA4MTogLy8gIFFcblxuICAgICAgY2FzZSA4MjogLy8gIFJcblxuICAgICAgY2FzZSA4MzogLy8gIFNcblxuICAgICAgY2FzZSA4NDogLy8gIFRcblxuICAgICAgY2FzZSA4NTogLy8gIFVcblxuICAgICAgY2FzZSA4NjogLy8gIFZcblxuICAgICAgY2FzZSA4NzogLy8gIFdcblxuICAgICAgY2FzZSA4ODogLy8gIFhcblxuICAgICAgY2FzZSA4OTogLy8gIFlcblxuICAgICAgY2FzZSA5MDogLy8gIFpcblxuICAgICAgY2FzZSA5NTogLy8gIF9cblxuICAgICAgY2FzZSA5NzogLy8gIGFcblxuICAgICAg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0YXJ0LCBwb3NpdGlvbiArIDEsIGxpbmUsIGNvbCwgcHJldiwgdmFsdWUpO1xuICAgIH0gLy8gU291cmNlQ2hhcmFjdGVyXG5cblxuICAgIGlmIChjb2RlIDwgMHgwMDIwICYmIGNvZGUgIT09IDB4MDAwOSkge1xuICAgICAgdGhyb3cgKDAsIF9zeW50YXhFcnJvci5zeW50YXhFcnJvcikoc291cmNlLCBwb3NpdGlvbiwgXCJJbnZhbGlkIGNoYXJhY3RlciB3aXRoaW4gU3RyaW5nOiBcIi5jb25jYXQocHJpbnRDaGFyQ29kZShjb2RlKSwgXCIuXCIpKTtcbiAgICB9XG5cbiAgICArK3Bvc2l0aW9uO1xuXG4gICAgaWYgKGNvZGUgPT09IDkyKSB7XG4gICAgICAvLyBcXFxuICAgICAgdmFsdWUgKz0gYm9keS5zbGljZShjaHVua1N0YXJ0LCBwb3NpdGlvbiAtIDEpO1xuICAgICAgY29kZSA9IGJvZHkuY2hhckNvZGVBdChwb3NpdGlvbik7XG5cbiAgICAgIHN3aXRjaCAoY29kZSkge1xuICAgICAgICBjYXNlIDM0OlxuICAgICAgICAgIHZhbHVlICs9ICdcIic7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSA0NzpcbiAgICAgICAgICB2YWx1ZSArPSAnLyc7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSA5MjpcbiAgICAgICAgICB2YWx1ZSArPSAnXFxcXCc7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSA5ODpcbiAgICAgICAgICB2YWx1ZSArPSAnXFxiJztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEwMjpcbiAgICAgICAgICB2YWx1ZSArPSAnXFxmJztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExMDpcbiAgICAgICAgICB2YWx1ZSArPSAnXFxuJztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExNDpcbiAgICAgICAgICB2YWx1ZSArPSAnXFxyJztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExNjpcbiAgICAgICAgICB2YWx1ZSArPSAnXFx0JztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExNzpcbiAgICAgICAgICB7XG4gICAgICAgICAgICAvLyB1WFhYWFxuICAgICAgICAgICAgdmFyIGNoYXJDb2RlID0gdW5pQ2hhckNvZGUoYm9keS5jaGFyQ29kZUF0KHBvc2l0aW9uICsgMSksIGJvZHkuY2hhckNvZGVBdChwb3NpdGlvbiArIDIpLCBib2R5LmNoYXJDb2RlQXQocG9zaXRpb24gKyAzKSwgYm9keS5jaGFyQ29kZUF0KHBvc2l0aW9uICsgNCkpO1xuXG4gICAgICAgICAgICBpZiAoY2hhckNvZGUgPCAwKSB7XG4gICAgICAgICAgICAgIHZhciBpbnZhbGlkU2VxdWVuY2UgPSBib2R5LnNsaWNlKHBvc2l0aW9uICsgMSwgcG9zaXRpb24gKyA1KTtcbiAgICAgICAgICAgICAgdGhyb3cgKDAsIF9zeW50YXhFcnJvci5zeW50YXhFcnJvcikoc291cmNlLCBwb3NpdGlvbiwgXCJJbnZhbGlkIGNoYXJhY3RlciBlc2NhcGUgc2VxdWVuY2U6IFxcXFx1XCIuY29uY2F0KGludmFsaWRTZXF1ZW5jZSwgXCIuXCIpKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShjaGFyQ29kZSk7XG4gICAgICAgICAgICBwb3NpdGlvbiArPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgdGhyb3cgKDAsIF9zeW50YXhFcnJvci5zeW50YXhFcnJvcikoc291cmNlLCBwb3NpdGlvbiwgXCJJbnZhbGlkIGNoYXJhY3RlciBlc2NhcGUgc2VxdWVuY2U6IFxcXFxcIi5j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iB0b2tlbi52YWx1ZSxcbiAgICAgICAgICBsb2M6IHRoaXMubG9jKHRva2VuKVxuICAgICAgICB9O1xuXG4gICAgICBjYXNlIF90b2tlbktpbmQuVG9rZW5LaW5kLlNUUklORzpcbiAgICAgIGNhc2UgX3Rva2VuS2luZC5Ub2tlbktpbmQuQkxPQ0tfU1RSSU5HOlxuICAgICAgICByZXR1cm4gdGhpcy5wYXJzZVN0cmluZ0xpdGVyYWwoKTtcblxuICAgICAgY2FzZSBfdG9rZW5LaW5kLlRva2VuS2luZC5OQU1FOlxuICAgICAgICB0aGlzLl9sZXhlci5hZHZhbmNlKCk7XG5cbiAgICAgICAgc3dpdGNoICh0b2tlbi52YWx1ZSkge1xuICAgICAgICAgIGNhc2UgJ3RydWUnOlxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAga2luZDogX2tpbmRzLktpbmQuQk9PTEVBTixcbiAgICAgICAgICAgICAgdmFsdWU6IHRydWUsXG4gICAgICAgICAgICAgIGxvYzogdGhpcy5sb2ModG9rZW4pXG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgY2FzZSAnZmFsc2UnOlxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAga2luZDogX2tpbmRzLktpbmQuQk9PTEVBTixcbiAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLFxuICAgICAgICAgICAgICBsb2M6IHRoaXMubG9jKHRva2VuKVxuICAgICAgICAgICAgfTtcblxuICAgICAgICAgIGNhc2UgJ251bGwnOlxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAga2luZDogX2tpbmRzLktpbmQuTlVMTCxcbiAgICAgICAgICAgICAgbG9jOiB0aGlzLmxvYyh0b2tlbilcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAga2luZDogX2tpbmRzLktpbmQuRU5VTSxcbiAgICAgICAgICA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zZSB7XG4gICAgICAgICAgdmFyIGNsb25lID0ge307XG5cbiAgICAgICAgICBmb3IgKHZhciBfaTIgPSAwLCBfT2JqZWN0JGtleXMyID0gT2JqZWN0LmtleXMobm9kZSk7IF9pMiA8IF9PYmplY3Qka2V5czIubGVuZ3RoOyBfaTIrKykge1xuICAgICAgICAgICAgdmFyIGsgPSBfT2JqZWN0JGtleXMyW19pMl07XG4gICAgICAgICAgICBjbG9uZVtrXSA9IG5vZGVba107XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgbm9kZSA9IGNsb25lO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGVkaXRPZmZzZXQgPSAwO1xuXG4gICAgICAgIGZvciAodmFyIGlpID0gMDsgaWkgPCBlZGl0cy5sZW5ndGg7IGlpKyspIHtcbiAgICAgICAgICB2YXIgZWRpdEtleSA9IGVkaXRzW2lpXVswXTtcbiAgICAgICAgICB2YXIgZWRpdFZhbHVlID0gZWRpdHNbaWldWzFdO1xuXG4gICAgICAgICAgaWYgKGluQXJyYXkpIHtcbiAgICAgICAgICAgIGVkaXRLZXkgLT0gZWRpdE9mZnNldDtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoaW5BcnJheSAmJiBlZGl0VmFsdWUgPT09IG51bGwpIHtcbiAgICAgICAgICAgIG5vZGUuc3BsaWNlKGVkaXRLZXksIDEpO1xuICAgICAgICAgICAgZWRpdE9mZnNldCsrO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBub2RlW2VkaXRLZXldID0gZWRpdFZhbHVlO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpbmRleCA9IHN0YWNrLmluZGV4O1xuICAgICAga2V5cyA9IHN0YWNrLmtleXM7XG4gICAgICBlZGl0cyA9IHN0YWNrLmVkaXRzO1xuICAgICAgaW5BcnJheSA9IHN0YWNrLmluQXJyYXk7XG4gICAgICBzdGFjayA9IHN0YWNrLnByZXY7XG4gICAgfSBlbHNlIHtcbiAgICAgIGtleSA9IHBhcmVudCA/IGluQXJyYXkgPyBpbmRleCA6IGtleXNbaW5kZXhdIDogdW5kZWZpbmVkO1xuICAgICAgbm9kZSA9IHBhcmVudCA/IHBhcmVudFtrZXldIDogbmV3Um9vdDtcblxuICAgICAgaWYgKG5vZGUgPT09IG51bGwgfHwgbm9kZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGNvbnRpbnVlO1xuICAgICAgfVxuXG4gICAgICBpZiAocGFyZW50KSB7XG4gICAgICAgIHBhdGgucHVzaChrZXkpO1xuICAgICAgfVxuICAgIH1cblxuICAgIHZhciByZXN1bHQgPSB2b2lkIDA7XG5cbiAgICBpZiAoIUFycmF5LmlzQXJyYXkobm9kZSkpIHtcbiAgICAgIGlmICghaXNOb2RlKG5vZGUpKSB7XG4gICAgICAgIHRocm93IG5ldyBFcnJvcihcIkludmFsaWQgQVNUIE5vZGU6IFwiLmNvbmNhdChpbnNwZWN0KG5vZGUpLCBcIi5cIikpO1xuICAgICAgfVxuXG4gICAgICB2YXIgdmlzaXRGbiA9IGdldFZpc2l0Rm4odmlzaXRvciwgbm9kZS5raW5kLCBpc0xlYXZpbmcpO1xuXG4gICAgICBpZiAodmlzaXRGbikge1xuICAgICAgICByZXN1bHQgPSB2aXNpdEZuLmNhbGwodmlzaXRvciwgbm9kZSwga2V5LCBwYXJlbnQsIHBhdGgsIGFuY2VzdG9ycyk7XG5cbiAgICAgICAgaWYgKHJlc3VsdCA9PT0gQlJFQUspIHtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZXN1bHQgPT09IGZhbHNlKSB7XG4gICAgICAgICAgaWYgKCFpc0xlYXZpbmcpIHtcbiAgICAgICAgICAgIHBhdGgucG9wKCk7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAocmVzdWx0ICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICBlZGl0cy5wdXNoKFtrZXksIHJlc3VsdF0pO1xuXG4gICAgICAgICAgaWYgKCFpc0xlYXZpbmcpIHtcbiAgICAgICAgICAgIGlmIChpc05vZGUocmVzdWx0KSkge1xuICAgICAgICAgICAgICBub2RlID0gcmVzdWx0O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcGF0aC5wb3AoKTtcbiAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgaWYgKHJlc3VsdCA9PT0gdW5kZWZpbmVkICYmIGlzRWRpdGVkKSB7XG4gICAgICBlZGl0cy5wdXNoKFtrZXksIG5vZGVdKTtcbiAgICB9XG5cbiAgICBpZiAoaXNMZWF2aW5nKSB7XG4gICAgICBwYXRoLnBvcCgpO1xuICAgIH0gZWxzZSB7XG4gICAgICB2YXIgX3Zpc2l0b3JLZXlzJG5vZGUka2luO1xuXG4gICAgICBzdGFjayA9IHtcbiAgICAgICAgaW5BcnJheTogaW5BcnJheSxcbiAgICAgICAgaW5kZXg6IGluZGV4LFxuICAgICAgICBrZXlzOiBrZXlzLFxuICAgICAgICBlZGl0czogZWRpdHMsXG4gICAgICAgIHByZXY6IHN0YWNrXG4gICAgICB9O1xuICAgICAgaW5BcnJheSA9IEFycmF5LmlzQXJyYXkobm9kZSk7XG4gICAgICBrZXlzID0gaW5BcnJheSA/IG5vZGUgOiAoX3Zpc2l0b3JLZXlzJG5vZGUka2luID0gdmlzaXRvcktleXNbbm9kZS5raW5kXSkgIT09IG51bGwgJiYgX3Zpc2l0b3JLZXlzJG5vZGUka2luICE9PSB2b2lkIDAgPyBfdmlzaXRvcktleXMkbm9kZSRraW4gOiBbXTtcbiAgICAgIGluZGV4ID0gLTE7XG4gICAgICBlZGl0cyA9IFtdO1xuXG4gICAgICBpZiAocGFyZW50KSB7XG4gICAgICAgIGFuY2VzdG9ycy5wdXNoK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bHkodmlzaXRvcnNbaV0sIGFyZ3VtZW50cyk7XG5cbiAgICAgICAgICAgIGlmIChyZXN1bHQgPT09IGZhbHNlKSB7XG4gICAgICAgICAgICAgIHNraXBwaW5nW2ldID0gbm9kZTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAocmVzdWx0ID09PSBCUkVBSykge1xuICAgICAgICAgICAgICBza2lwcGluZ1tpXSA9IEJSRUFLO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChyZXN1bHQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgbGVhdmU6IGZ1bmN0aW9uIGxlYXZlKG5vZGUpIHtcbiAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgdmlzaXRvcnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgaWYgKHNraXBwaW5nW2ldID09IG51bGwpIHtcbiAgICAgICAgICB2YXIgZm4gPSBnZXRWaXNpdEZuKHZpc2l0b3JzW2ldLCBub2RlLmtpbmQsXG4gICAgICAgICAgLyogaXNMZWF2aW5nICovXG4gICAgICAgICAgdHJ1ZSk7XG5cbiAgICAgICAgICBpZiAoZm4pIHtcbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBmbi5hcHBseSh2aXNpdG9yc1tpXSwgYXJndW1lbnRzKTtcblxuICAgICAgICAgICAgaWYgKHJlc3VsdCA9PT0gQlJFQUspIHtcbiAgICAgICAgICAgICAgc2tpcHBpbmdbaV0gPSBCUkVBSztcbiAgICAgICAgICAgIH0gZWxzZSBpZiAocmVzdWx0ICE9PSB1bmRlZmluZWQgJiYgcmVzdWx0ICE9PSBmYWxzZSkge1xuICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChza2lwcGluZ1tpXSA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AgICBpZiAobmV3ZXIpIHtcclxuICAgICAgICAgICAgICAgIG5ld2VyLm9sZGVyID0gb2xkZXI7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKG9sZGVyKSB7XHJcbiAgICAgICAgICAgICAgICBvbGRlci5uZXdlciA9IG5ld2VyO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVudHJ5Lm9sZGVyID0gdGhpcy5uZXdlc3Q7XHJcbiAgICAgICAgICAgIGVudHJ5Lm9sZGVyLm5ld2VyID0gZW50cnk7XHJcbiAgICAgICAgICAgIGVudHJ5Lm5ld2VyID0gbnVsbDtcclxuICAgICAgICAgICAgdGhpcy5uZXdlc3QgPSBlbnRyeTtcclxuICAgICAgICAgICAgaWYgKGVudHJ5ID09PSB0aGlzLm9sZGVzdCkge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5vbGRlc3QgPSBuZXdlcjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gZW50cnk7XHJcbiAgICB9O1xyXG4gICAgQ2FjaGUucHJvdG90eXBlLnNldCA9IGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7XHJcbiAgICAgICAgdmFyIGVudHJ5ID0gdGhpcy5nZXRFbnRyeShrZXkpO1xyXG4gICAgICAgIGlmIChlbnRyeSkge1xyXG4gICAgICAgICAgICByZXR1cm4gZW50cnkudmFsdWUgPSB2YWx1ZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZW50cnkgPSB7XHJcbiAgICAgICAgICAgIGtleToga2V5LFxyXG4gICAgICAgICAgICB2YWx1ZTogdmFsdWUsXHJcbiAgICAgICAgICAgIG5ld2VyOiBudWxsLFxyXG4gICAgICAgICAgICBvbGRlcjogdGhpcy5uZXdlc3RcclxuICAgICAgICB9O1xyXG4gICAgICAgIGlmICh0aGlzLm5ld2VzdCkge1xyXG4gICAgICAgICAgICB0aGlzLm5ld2VzdC5uZXdlciA9IGVudHJ5O1xyXG4gICAgICAgIH1cclxuICAgICAgICB0aGlzLm5ld2VzdCA9IGVudHJ5O1xyXG4gICAgICAgIHRoaXMub2xkZXN0ID0gdGhpcy5vbGRlc3QgfHwgZW50cnk7XHJcbiAgICAgICAgdGhpcy5tYXAuc2V0KGtleSwgZW50cnkpO1xyXG4gICAgICAgIHJldHVybiBlbnRyeS52YWx1ZTtcclxuICAgIH07XHJcbiAgICBDYWNoZS5wcm90b3R5cGUuY2xlYW4gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgd2hpbGUgKHRoaXMub2xkZXN0ICYmIHRoaXMubWFwLnNpemUgPiB0aGlzLm1heCkge1xyXG4gICAgICAgICAgICB0aGlzLmRlbGV0ZSh0aGlzLm9sZGVzdC5rZXkpO1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcbiAgICBDYWNoZS5wcm90b3R5cGUuZGVsZXRlID0gZnVuY3Rpb24gKGtleSkge1xyXG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMubWFwLmdldChrZXkpO1xyXG4gICAgICAgIGlmIChlbnRyeSkge1xyXG4gICAgICAgICAgICBpZiAoZW50cnkgPT09IHRoaXMubmV3ZXN0KSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLm5ld2VzdCA9IGVudHJ5Lm9sZGVyO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChlbnRyeSA9PT0gdGhpcy5vbGRlc3QpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMub2xkZXN0ID0gZW50cnkubmV3ZXI7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGVudHJ5Lm5ld2VyKSB7XHJcbiAgICAgICAgICAgICAgICBlbnRyeS5uZXdlci5vbGRlciA9IGVudHJ5Lm9sZGVyO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChlbnRyeS5vbGRlcikge1xyXG4gICAgICAgICAgICAgICAgZW50cnkub2xkZXIubmV3ZXIgPS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YWtuZXNzLCB0aGlzLm1ha2VEYXRhKSk7XHJcbiAgICAgICAgcmV0dXJuIGNoaWxkO1xyXG4gICAgfTtcclxuICAgIHJldHVybiBLZXlUcmllO1xyXG59KCkpO1xyXG5mdW5jdGlvbiBpc09ialJlZih2YWx1ZSkge1xyXG4gICAgc3dpdGNoICh0eXBlb2YgdmFsdWUpIHtcclxuICAgICAgICBjYXNlIFwib2JqZWN0XCI6XHJcbiAgICAgICAgICAgIGlmICh2YWx1ZSA9PT0gbnVsbClcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgIC8vIEZhbGwgdGhyb3VnaCB0byByZXR1cm4gdHJ1ZS4uLlxyXG4gICAgICAgIGNhc2UgXCJmdW5jdGlvblwiOlxyXG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgIH1cclxuICAgIHJldHVybiBmYWxzZTtcclxufVxuXG5mdW5jdGlvbiBkZXAob3B0aW9ucykge1xyXG4gICAgdmFyIGRlcHNCeUtleSA9IG5ldyBNYXAoKTtcclxuICAgIHZhciBzdWJzY3JpYmUgPSBvcHRpb25zICYmIG9wdGlvbnMuc3Vic2NyaWJlO1xyXG4gICAgZnVuY3Rpb24gZGVwZW5kKGtleSkge1xyXG4gICAgICAgIHZhciBwYXJlbnQgPSBwYXJlbnRFbnRyeVNsb3QuZ2V0VmFsdWUoKTtcclxuICAgICAgICBpZiAocGFyZW50KSB7XHJcbiAgICAgICAgICAgIHZhciBkZXBfMSA9IGRlcHNCeUtleS5nZXQoa2V5KTtcclxuICAgICAgICAgICAgaWYgKCFkZXBfMSkge1xyXG4gICAgICAgICAgICAgICAgZGVwc0J5S2V5LnNldChrZXksIGRlcF8xID0gbmV3IFNldCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcGFyZW50LmRlcGVuZE9uKGRlcF8xKTtcclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBzdWJzY3JpYmUgPT09IFwiZnVuY3Rpb25cIikge1xy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luay5hZGQodGhpcy5zb3VyY2UgfHwgKGNvbmZpZy51c2VEZXByZWNhdGVkU3luY2hyb25vdXNFcnJvckhhbmRsaW5nICYmICFzaW5rLnN5bmNFcnJvclRocm93YWJsZSkgP1xuICAgICAgICAgICAgICAgIHRoaXMuX3N1YnNjcmliZShzaW5rKSA6XG4gICAgICAgICAgICAgICAgdGhpcy5fdHJ5U3Vic2NyaWJlKHNpbmspKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoY29uZmlnLnVzZURlcHJlY2F0ZWRTeW5jaHJvbm91c0Vycm9ySGFuZGxpbmcpIHtcbiAgICAgICAgICAgIGlmIChzaW5rLnN5bmNFcnJvclRocm93YWJsZSkge1xuICAgICAgICAgICAgICAgIHNpbmsuc3luY0Vycm9yVGhyb3dhYmxlID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgaWYgKHNpbmsuc3luY0Vycm9yVGhyb3duKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IHNpbmsuc3luY0Vycm9yVmFsdWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBzaW5rO1xuICAgIH07XG4gICAgT2JzZXJ2YWJsZS5wcm90b3R5cGUuX3RyeVN1YnNjcmliZSA9IGZ1bmN0aW9uIChzaW5rKSB7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5fc3Vic2NyaWJlKHNpbmspO1xuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgIGlmIChjb25maWcudXNlRGVwcmVjYXRlZFN5bmNocm9ub3VzRXJyb3JIYW5kbGluZykge1xuICAgICAgICAgICAgICAgIHNpbmsuc3luY0Vycm9yVGhyb3duID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBzaW5rLnN5bmNFcnJvclZhbHVlID0gZXJyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNhblJlcG9ydEVycm9yKHNpbmspKSB7XG4gICAgICAgICAgICAgICAgc2luay5lcnJvcihlcnIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGVycik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuICAgIE9ic2VydmFibGUucHJvdG90eXBlLmZvckVhY2ggPSBmdW5jdGlvbiAobmV4dCwgcHJvbWlzZUN0b3IpIHtcbiAgICAgICAgdmFyIF90aGlzID0gdGhpcztcbiAgICAgICAgcHJvbWlzZUN0b3IgPSBnZXRQcm9taXNlQ3Rvcihwcm9taXNlQ3Rvcik7XG4gICAgICAgIHJldHVybiBuZXcgcHJvbWlzZUN0b3IoZnVuY3Rpb24gKHJlc29sdmUsIHJlamVjdCkge1xuICAgICAgICAgICAgdmFyIHN1YnNjcmlwdGlvbjtcbiAgICAgICAgICAgIHN1YnNjcmlwdGlvbiA9IF90aGlzLnN1YnNjcmliZShmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBuZXh0KHZhbHVlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgICAgICByZWplY3QoZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHN1YnNjcmlwdGlvbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgc3Vic2NyaXB0aW9uLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LCByZWplY3QsIHJlc29sdmUpO1xuICAgICAgICB9KTtcbiAgICB9O1xuICAgIE9ic2VydmFibGUucHJvdG90eXBlLl9zdWJzY3JpYmUgPSBmdW5jdGlvbiAoc3Vic2NyaWJlcikge1xuICAgICAgICB2YXIgc291cmNlID0gdGhpcy5zb3Vy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gbmV3IEFub255bW91c1N1YmplY3QodGhpcywgdGhpcyk7XG4gICAgICAgIHN1YmplY3Qub3BlcmF0b3IgPSBvcGVyYXRvcjtcbiAgICAgICAgcmV0dXJuIHN1YmplY3Q7XG4gICAgfTtcbiAgICBTdWJqZWN0LnByb3RvdHlwZS5uZXh0ID0gZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgIGlmICh0aGlzLmNsb3NlZCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IE9iamVjdFVuc3Vic2NyaWJlZEVycm9yKCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCF0aGlzLmlzU3RvcHBlZCkge1xuICAgICAgICAgICAgdmFyIG9ic2VydmVycyA9IHRoaXMub2JzZXJ2ZXJzO1xuICAgICAgICAgICAgdmFyIGxlbiA9IG9ic2VydmVycy5sZW5ndGg7XG4gICAgICAgICAgICB2YXIgY29weSA9IG9ic2VydmVycy5zbGljZSgpO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykge1xuICAgICAgICAgICAgICAgIGNvcHlbaV0ubmV4dCh2YWx1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuICAgIFN1YmplY3QucHJvdG90eXBlLmVycm9yID0gZnVuY3Rpb24gKGVycikge1xuICAgICAgICBpZiAodGhpcy5jbG9zZWQpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBPYmplY3RVbnN1YnNjcmliZWRFcnJvcigpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuaGFzRXJyb3IgPSB0cnVlO1xuICAgICAgICB0aGlzLnRocm93bkVycm9yID0gZXJyO1xuICAgICAgICB0aGlzLmlzU3RvcHBlZCA9IHRydWU7XG4gICAgICAgIHZhciBvYnNlcnZlcnMgPSB0aGlzLm9ic2VydmVycztcbiAgICAgICAgdmFyIGxlbiA9IG9ic2VydmVycy5sZW5ndGg7XG4gICAgICAgIHZhciBjb3B5ID0gb2JzZX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NyaWJlZEVycm9yKCk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gX3N1cGVyLnByb3RvdHlwZS5fdHJ5U3Vic2NyaWJlLmNhbGwodGhpcywgc3Vic2NyaWJlcik7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIFN1YmplY3QucHJvdG90eXBlLl9zdWJzY3JpYmUgPSBmdW5jdGlvbiAoc3Vic2NyaWJlcikge1xuICAgICAgICBpZiAodGhpcy5jbG9zZWQpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBPYmplY3RVbnN1YnNjcmliZWRFcnJvcigpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKHRoaXMuaGFzRXJyb3IpIHtcbiAgICAgICAgICAgIHN1YnNjcmliZXIuZXJyb3IodGhpcy50aHJvd25FcnJvcik7XG4gICAgICAgICAgICByZXR1cm4gU3Vic2NyaXB0aW9uLkVNUFRZO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKHRoaXMuaXNTdG9wcGVkKSB7XG4gICAgICAgICAgICBzdWJzY3JpYmVyLmNvbXBsZXRlKCk7XG4gICAgICAgICAgICByZXR1cm4gU3Vic2NyaXB0aW9uLkVNUFRZO1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5vYnNlcnZlcnMucHVzaChzdWJzY3JpYmVyKTtcbiAgICAgICAgICAgIHJldHVybiBuZXcgU3ViamVjdFN1YnNjcmlwdGlvbih0aGlzLCBzdWJzY3JpYmVyKTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgU3ViamVjdC5wcm90b3R5cGUuYXNPYnNlcnZhYmxlID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgb2JzZXJ2YWJsZSA9IG5ldyBPYnNlcnZhYmxlKCk7XG4gICAgICAgIG9ic2VydmFibGUuc291cmNlID0gdGhpcztcbiAgICAgICAgcmV0dXJuIG9ic2VydmFibGU7XG4gIC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l8xLl9fZXh0ZW5kcyhTdWJzY3JpYmVyLCBfc3VwZXIpO1xuICAgIGZ1bmN0aW9uIFN1YnNjcmliZXIoZGVzdGluYXRpb25Pck5leHQsIGVycm9yLCBjb21wbGV0ZSkge1xuICAgICAgICB2YXIgX3RoaXMgPSBfc3VwZXIuY2FsbCh0aGlzKSB8fCB0aGlzO1xuICAgICAgICBfdGhpcy5zeW5jRXJyb3JWYWx1ZSA9IG51bGw7XG4gICAgICAgIF90aGlzLnN5bmNFcnJvclRocm93biA9IGZhbHNlO1xuICAgICAgICBfdGhpcy5zeW5jRXJyb3JUaHJvd2FibGUgPSBmYWxzZTtcbiAgICAgICAgX3RoaXMuaXNTdG9wcGVkID0gZmFsc2U7XG4gICAgICAgIHN3aXRjaCAoYXJndW1lbnRzLmxlbmd0aCkge1xuICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIF90aGlzLmRlc3RpbmF0aW9uID0gZW1wdHlPYnNlcnZlcjtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICBpZiAoIWRlc3RpbmF0aW9uT3JOZXh0KSB7XG4gICAgICAgICAgICAgICAgICAgIF90aGlzLmRlc3RpbmF0aW9uID0gZW1wdHlPYnNlcnZlcjtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZGVzdGluYXRpb25Pck5leHQgPT09ICdvYmplY3QnKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChkZXN0aW5hdGlvbk9yTmV4dCBpbnN0YW5jZW9mIFN1YnNjcmliZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIF90aGlzLnN5bmNFcnJvclRocm93YWJsZSA9IGRlc3RpbmF0aW9uT3JOZXh0LnN5bmNFcnJvclRocm93YWJsZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIF90aGlzLmRlc3RpbmF0aW9uID0gZGVzdGluYXRpb25Pck5leHQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBkZXN0aW5hdGlvbk9yTmV4dC5hZGQoX3RoaXMpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgX3RoaXMuc3luY0Vycm9yVGhyb3dhYmxlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIF90aGlzLmRlc3RpbmF0aW9uID0gbmV3IFNhZmVTdWJzY3JpYmVyKF90aGlzLCBkZXN0aW5hdGlvbk9yTmV4dCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBfdGhpcy5zeW5jRXJyb3JUaHJvd2FibGUgPSB0cnVlO1xuICAgICAgICAgICAgICAgIF90aGlzLmRlc3RpbmF0aW9uID0gbmV3IFNhZmVTdWJzY3JpYmVyKF90aGlzLCBkZXN0aW5hdGlvbk9yTmV4dCwgZXJyb3IsIGNvbXBsZXRlKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gX3RoaXM7XG4gICAgfVxuICAgIFN1YnNjcmliZXIucHJvdG90eXBlW3J4U3Vic2NyaWJlclN5bWJvbF0gPSBmdW5jdGlvbiAoKSB7IHJldHVybiB0aGlzOyB9O1xuICAgIFN1YnNjcmliZXIuY3JlYXRlID0gZnVuY3Rpb24gKG5leHQsIGVycm9yLCBjb21wbGV0ZSkge1xuICAgICAgICB2YXIgc3Vic2NyaWJlciA9IG5ldyBTdWJzY3JpYmVyKG5leHQsIGVycm9yLCBjb21wbGV0ZSk7XG4gICAgICAgIHN1YnNjcmliZXIuc3luY0Vycm9yVGhyb3dhYmxlID0gZmFsc2U7XG4gICAgICAgIHJldH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VwZXIuY2FsbCh0aGlzKSB8fCB0aGlzO1xuICAgICAgICBfdGhpcy5fcGFyZW50U3Vic2NyaWJlciA9IF9wYXJlbnRTdWJzY3JpYmVyO1xuICAgICAgICB2YXIgbmV4dDtcbiAgICAgICAgdmFyIGNvbnRleHQgPSBfdGhpcztcbiAgICAgICAgaWYgKGlzRnVuY3Rpb24ob2JzZXJ2ZXJPck5leHQpKSB7XG4gICAgICAgICAgICBuZXh0ID0gb2JzZXJ2ZXJPck5leHQ7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAob2JzZXJ2ZXJPck5leHQpIHtcbiAgICAgICAgICAgIG5leHQgPSBvYnNlcnZlck9yTmV4dC5uZXh0O1xuICAgICAgICAgICAgZXJyb3IgPSBvYnNlcnZlck9yTmV4dC5lcnJvcjtcbiAgICAgICAgICAgIGNvbXBsZXRlID0gb2JzZXJ2ZXJPck5leHQuY29tcGxldGU7XG4gICAgICAgICAgICBpZiAob2JzZXJ2ZXJPck5leHQgIT09IGVtcHR5T2JzZXJ2ZXIpIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0ID0gT2JqZWN0LmNyZWF0ZShvYnNlcnZlck9yTmV4dCk7XG4gICAgICAgICAgICAgICAgaWYgKGlzRnVuY3Rpb24oY29udGV4dC51bnN1YnNjcmliZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgX3RoaXMuYWRkKGNvbnRleHQudW5zdWJzY3JpYmUuYmluZChjb250ZXh0KSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnRleHQudW5zdWJzY3JpYmUgPSBfdGhpcy51bnN1YnNjcmliZS5iaW5kKF90aGlzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBfdGhpcy5fY29udGV4dCA9IGNvbnRleHQ7XG4gICAgICAgIF90aGlzLl9uZXh0ID0gbmV4dDtcbiAgICAgICAgX3RoaXMuX2Vycm9yID0gZXJyb3I7XG4gICAgICAgIF90aGlzL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gICAgICAgICAgICBpZiAoIXVzZURlcHJlY2F0ZWRTeW5jaHJvbm91c0Vycm9ySGFuZGxpbmcgfHwgIV9wYXJlbnRTdWJzY3JpYmVyLnN5bmNFcnJvclRocm93YWJsZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9fdHJ5T3JVbnN1Yih0aGlzLl9lcnJvciwgZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fX3RyeU9yU2V0RXJyb3IoX3BhcmVudFN1YnNjcmliZXIsIHRoaXMuX2Vycm9yLCBlcnIpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoIV9wYXJlbnRTdWJzY3JpYmVyLnN5bmNFcnJvclRocm93YWJsZSkge1xuICAgICAgICAgICAgICAgIHRoaXMudW5zdWJzY3JpYmUoKTtcbiAgICAgICAgICAgICAgICBpZiAodXNlRGVwcmVjYXRlZFN5bmNocm9ub3VzRXJyb3JIYW5kbGluZykge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnI7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGhvc3RSZXBvcnRFcnJvcihlcnIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHVzZURlcHJlY2F0ZWRTeW5jaHJvbm91c0Vycm9ySGFuZGxpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgX3BhcmVudFN1YnNjcmliZXIuc3luY0Vycm9yVmFsdWUgPSBlcnI7XG4gICAgICAgICAgICAgICAgICAgIF9wYXJlbnRTdWJzY3JpYmVyLnN5bmNFcnJvclRocm93biA9IHRydWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBob3N0UmVwb3J0RXJyb3IoZXJyKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcbiAgICBTYWZlU3Vic2NyaWJlci5wcm90b3R5cGUuY29tcGxldGUgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHZhciBfdGhpcyA9IHRoaXM7XG4gICAgICAgIGlmICghdGhpcy5pc1N0b3BwZWQpIHtcbiAgICAgICAgICAgIHZhciBfcGFyZW50U3Vic2NyaWJlciA9IHRoaXMuX3BhcmVudFN1YnNjcmliZXI7XG4gICAgICAgICAgICBpZiAodGhpcy5fY29tcGxldGUpIHtcbiAgICAgICAgICAgICAgICB2YXIgd3JhcHBlZENvbXBsZXRlID0gZnVuY3Rpb24gKCkgeyByZXR1cm4gX3RoaXMuX2NvbXBsZXRlLmNhbGwoX3RoaXMuX2NvbnRleHQpOyB9O1xuICAgICAgICAgICAgICAgIGlmICghY29uZmlnLnVzZURlcHJlY2F0ZWRTeW5jaHJvbm91c0Vycm9ySGFuZGxpbmcgfHwgIV9wYXJlbnRTdWJzY3JpYmVyLnN5bmNFcnJvclRocm93YWJsZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9fdHJ5T3JVbnN1Yih3cmFwcGVkQ29tcGxldGUpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9fdHJ5T3JTZXRFcnJvcihfcGFyZW50U3Vic2NyaWJlciwgd3JhcHBlZENvbXBsZXRlKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMudW5zdWJzY3JpYmUoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH07XG4gICAgU2FmZVN1YnNjcmliZXIucHJvdG90eXBlLl9fdHJ5T3JVbnN1YiA9IGZ1bmN0aW9uIChmbiwgdmFsdWUpIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGZuLmNhbGwodGhpcy5fY29udGV4dCwgdmFsdWUpO1xuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgIHRoaXMudW5zdWJzY3JpYmUoKTtcbiAgICAgICAgICAgIGlmIChjb25maWcudXNlRGVwcmVjYXRlZFN5bmNocm9ub3VzRXJyb3JIYW5kbGluZykge1xuICAgICAgICAgICAgICAgIHRocm93IGVycjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGhvc3RSZXBvcnRFcnJvcihlcnIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcbiAgICBTYWZlU3Vic2NyaWJlci5wcm90b3R5cGUuX190cnlPclNldEVycm9yID0gZnVuY3Rpb24gKHBhcmVudCwgZm4sIHZhbHVlKSB7XG4gICAgICAgIGlmICghY29uZmlnLnVzZURlcHJlY2F0ZWRTeW5jaHJvbm91c0Vycm9ySGFuZGxpbmcpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignYmFkIGNhbGwnKTtcbiAgICAgICAgfVxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgZm4uY2FsbCh0aGlzLl9jb250ZXh0LCB2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgaWYgKGNvbmZpZy51c2VEZXByZWNhdGVkU3luY2hyb25vdXNFcnJvckhhbmRsaW5nKSB7X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gbnVsbDtcbiAgICAgICAgdGhpcy5fc3Vic2NyaXB0aW9ucyA9IG51bGw7XG4gICAgICAgIGlmIChfcGFyZW50T3JQYXJlbnRzIGluc3RhbmNlb2YgU3Vic2NyaXB0aW9uKSB7XG4gICAgICAgICAgICBfcGFyZW50T3JQYXJlbnRzLnJlbW92ZSh0aGlzKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChfcGFyZW50T3JQYXJlbnRzICE9PSBudWxsKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpbmRleCA9IDA7IGluZGV4IDwgX3BhcmVudE9yUGFyZW50cy5sZW5ndGg7ICsraW5kZXgpIHtcbiAgICAgICAgICAgICAgICB2YXIgcGFyZW50XzEgPSBfcGFyZW50T3JQYXJlbnRzW2luZGV4XTtcbiAgICAgICAgICAgICAgICBwYXJlbnRfMS5yZW1vdmUodGhpcyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGlzRnVuY3Rpb24oX3Vuc3Vic2NyaWJlKSkge1xuICAgICAgICAgICAgaWYgKF9jdG9yVW5zdWJzY3JpYmUpIHtcbiAgICAgICAgICAgICAgICB0aGlzLl91bnN1YnNjcmliZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgX3Vuc3Vic2NyaWJlLmNhbGwodGhpcyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIGVycm9ycyA9IGUgaW5zdGFuY2VvZiBVbnN1YnNjcmlwdGlvbkVycm9yID8gZmxhdHRlblVuc3Vic2NyaXB0aW9uRXJyb3JzKGUuZXJyb3JzKSA6IFtlXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoaXNBcnJheShfc3Vic2NyaXB0aW9ucykpIHtcbiAgICAgICAgICAgIHZhciBpbmRleCA9IC0xO1xuICAgICAgICAgICAgdmFyIGxlbiA9IF9zdWJzY3JpcHRpb25zLmxlbmd0aDtcbiAgICAgICAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuKSB7XG4gICAgICAgICAgICAgICAgdmFyIHN1YiA9IF9zdWJzY3JpcHRpb25zW2luZGV4XTtcbiAgICAgICAgICAgICAgICBpZiAoaXNPYmplY3Qoc3ViKSkge1xuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc3ViLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9ycyA9IGVycm9ycyB8fCBbXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgVW5zdWJzY3JpcHRpb25FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9ycyA9IGVycm9ycy5jb25jYXQoZmxhdHRlblVuc3Vic2NyaXB0aW9uRXJyb3JzKGUuZXJyb3JzKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcnMucHVzaChlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoZXJyb3JzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgVW5zdWJzY3JpcHRpb25FcnJvcihlcnJvcnMpO1xuICAgICAgICB9XG4gICAgfTtcbiAgICBTdWJzY3JpcHRpb24ucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uICh0ZWFyZG93bikge1xuICAgICAgICB2YXIgc3Vic2NyaXB0aW9uID0gdGVhcmRvd247XG4gICAgICAgIGlmICghdGVhcmRvd24pIHtcbiAgICAgICAgICAgIHJldHVybiBTdWJzY3JpcHRpb24uRU1QVFk7XG4gICAgICAgIH1cbiAgICAgICAgc3dpdGNoICh0eXBlb2YgdGVhcmRvd24pIHtcbiAgICAgICAgICAgIGNhc2UgJ2Z1bmN0aW9uJzpcbiAgICAgICAgICAgICAgICBzdWJzY3JpcHRpb24gPSBuZXcgU3Vic2NyaXB0aW9uKHRlYXJkb3duKTtcbiAgICAgICAgICAgIGNhc2UgJ29iamVjdCc6XG4gICAgICAgICAgICAgICAgaWYgKHN1YnNjcmlwdGlvbiA9PT0gdGhpcyB8fCBzdWJzY3JpcHRpb24uY2xvc2VkIHx8IHR5cGVvZiBzdWJzY3JpcHRpb24udW5zdWJzY3JpYmUgIT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN1YnNjcmlwdGlvbjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAodGhpcy5jbG9zZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgc3Vic2NyaXB0aW9uLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzdWJzY3JpcHRpb247XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKCEoc3Vic2NyaXB0aW9uIGluc3RhbmNlb2YgU3Vic2NyaXB0aW9uKSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdG1wID0gc3Vic2NyaXB0aW9uO1xuICAgICAgICAgICAgICAgICAgICBzdWJzY3JpcHRpb24gPSBuZXcgU3Vic2NyaXB0aW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIHN1YnNjcmlwdGlvbi5fc3Vic2NyaXB0aW9ucyA9IFt0bXBdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6IHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3VucmVjb2duaXplZCB0ZWFyZG93biAnICsgdGVhcmRvd24gKyAnIGFkZGVkIHRvIFN1YnNjcmlwdGlvbi4nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB2YXIgX3BhcmVudE9yUGFyZW50cyA9IHN1YnNjcmlwdGlvbi5fcGFyZW50T3JQYXJlbnRzO1xuICAgICAgICBpZiAoX3BhcmVudE9yUGFyZW50cyA9PT0gbnVsbCkge1xuICAgICAgICAgICAgc3Vic2NyaXB0aW9uLl9wYXJlbnRPclBhcmVudHMgPSB0aGlzO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKF9wYXJlbnRPclBhcmVudHMgaW5zdGFuY2VvZiBTdWJzY3JpcHRpb24pIHtcbiAgICAgICAgICAgIGlmIChfcGFyZW50T3JQYXJlbnRzID09PSB0aGlzKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHN1YnNjcmlwdGlvbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHN1YnNjcmlwdGlvbi5fcGFyZW50T3JQYXJlbnRzID0gW19wYXJlbnRPclBhcmVudHMsIHRoaXNdO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKF9wYXJlbnRPclBhcmVudHMuaW5kZXhPZih0aGlzKSA9PT0gLTEpIHtcbiAgICAgICAgICAgIF9wYXJlbnRPclBhcmVudHMucHVzaCh0aGlzKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBzdWJzY3JpcHRpb247XG4gICAgICAgIH1cbiAgICAgICAgdmFyIHN1YnNjcmlwdGlvbnMgPSB0aGlzLl9zdWJzY3JpcHRpb25zO1xuICAgICAgICBpZiAoc3Vic2NyaXB0aW9ucyA9PT0gbnVsbCkge1xuICAgICAgICAgICAgdGhpcy5fc3Vic2NyaXB0aW9ucyA9IFtzdWJzY3JpcHRpb25dO1x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xyXG4gICAgZXh0ZW5kU3RhdGljcyhkLCBiKTtcclxuICAgIGZ1bmN0aW9uIF9fKCkgeyB0aGlzLmNvbnN0cnVjdG9yID0gZDsgfVxyXG4gICAgZC5wcm90b3R5cGUgPSBiID09PSBudWxsID8gT2JqZWN0LmNyZWF0ZShiKSA6IChfXy5wcm90b3R5cGUgPSBiLnByb3RvdHlwZSwgbmV3IF9fKCkpO1xyXG59XHJcblxyXG5leHBvcnQgdmFyIF9fYXNzaWduID0gZnVuY3Rpb24oKSB7XHJcbiAgICBfX2Fzc2lnbiA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gX19hc3NpZ24odCkge1xyXG4gICAgICAgIGZvciAodmFyIHMsIGkgPSAxLCBuID0gYXJndW1lbnRzLmxlbmd0aDsgaSA8IG47IGkrKykge1xyXG4gICAgICAgICAgICBzID0gYXJndW1lbnRzW2ldO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkpIHRbcF0gPSBzW3BdO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gdDtcclxuICAgIH1cclxuICAgIHJldHVybiBfX2Fzc2lnbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19yZXN0KHMsIGUpIHtcclxuICAgIHZhciB0ID0ge307XHJcbiAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkgJiYgZS5pbmRleE9mKHApIDwgMClcclxuICAgICAgICB0W3BdID0gc1twXTtcclxuICAgIGlmIChzICE9IG51bGwgJiYgdHlwZW9mIE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMgPT09IFwiZnVuY3Rpb25cIilcclxuICAgICAgICBmb3IgKHZhciBpID0gMCwgcCA9IE9iamVjdC5nZ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lzLnN1YnNjcmliZSh7XG4gICAgICAgICAgbmV4dDogZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICBmbih2YWx1ZSwgZG9uZSk7XG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgIHJlamVjdChlKTtcbiAgICAgICAgICAgICAgc3Vic2NyaXB0aW9uLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSxcbiAgICAgICAgICBlcnJvcjogcmVqZWN0LFxuICAgICAgICAgIGNvbXBsZXRlOiByZXNvbHZlXG4gICAgICAgIH0pO1xuICAgICAgfSk7XG4gICAgfVxuICB9LCB7XG4gICAga2V5OiBcIm1hcFwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiBtYXAoZm4pIHtcbiAgICAgIHZhciBfdGhpczIgPSB0aGlzO1xuXG4gICAgICBpZiAodHlwZW9mIGZuICE9PSAnZnVuY3Rpb24nKSB0aHJvdyBuZXcgVHlwZUVycm9yKGZuICsgJyBpcyBub3QgYSBmdW5jdGlvbicpO1xuICAgICAgdmFyIEMgPSBnZXRTcGVjaWVzKHRoaXMpO1xuICAgICAgcmV0dXJuIG5ldyBDKGZ1bmN0aW9uIChvYnNlcnZlcikge1xuICAgICAgICByZXR1cm4gX3RoaXMyLnN1YnNjcmliZSh7XG4gICAgICAgICAgbmV4dDogZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICB2YWx1ZSA9IGZuKHZhbHVlKTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIG9ic2VydmVyLmVycm9yKGUpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvYnNlcnZlci5uZXh0KHZhbHVlKTtcbiAgICAgICAgICB9LFxuICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgb2JzZXJ2ZXIuZXJyb3IoZSk7XG4gICAgICAgICAgfSxcbiAgICAgICAgICBjb21wbGV0ZTogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgb2JzZXJ2ZXIuY29tcGxldGUoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgfSk7XG4gICAgfVxuICB9LCB7XG4gICAga2V5OiBcImZpbHRlclwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiBmaWx0ZXIoZm4pIHtcbiAgICAgIHZhciBfdGhpczMgPSB0aGlzO1xuXG4gICAgICBpZiAodHlwZW9mIGZuICE9PSAnZnVuY3Rpb24nKSB0aHJvdyBuZXcgVHlwZUVycm9yKGZuICsgJyBpcyBub3QgYSBmdW5jdGlvbicpO1xuICAgICAgdmFyIEMgPSBnZXRTcGVjaWVzKHRoaXMpO1xuICAgICAgcmV0dXJuIG5ldyBDKGZ1bmN0aW9uIChvYnNlcnZlcikge1xuICAgICAgICByZXR1cm4gX3RoaXMzLnN1YnNjcmliZSh7XG4gICAgICAgICAgbmV4dDogZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICBpZiAoIWZuKHZhbHVlKSkgcmV0dXJuO1xuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICByZXR1cm4gb2JzZXJ2ZXIuZXJyb3IoZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG9ic2VydmVyLm5leHQodmFsdWUpO1xuICAgICAgICAgIH0sXG4gICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uIChlKSB7XG4gICAgICAgICAgICBvYnNlcnZlci5lcnJvcihlKTtcbiAgICAgICAgICB9LFxuICAgICAgICAgIGNvbXBsZXRlOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBvYnNlcnZlci5jb21wbGV0ZSgpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICB9KTtcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwicmVkdWNlXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uIHJlZHVjZShmbikge1xuICAgICAgdmFyIF90aGlzNCA9IHRoaXM7XG5cbiAgICAgIGlmICh0eXBlb2YgZm4gIT09ICdmdW5jdGlvbicpIHRocm93IG5ldyBUeXBlRXJyb3IoZm4gKyAnIGlzIG5vdCBhIGZ1bmN0aW9uJyk7XG4gICAgICB2YXIgQyA9IGdldFNwZWNpZXModGhpcyk7XG4gICAgICB2YXIgaGFzU2VlZCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxO1xuICAgICAgdmFyIGhhc1ZhbHVlID0gZmFsc2U7XG4gICAgICB2YXIgc2VlZCA9IGFyZ3VtZW50c1sxXTtcbiAgICAgIHZhciBhY2MgPSBzZWVkO1xuICAgICAgcmV0dXJuIG5ldyBDKGZ1bmN0aW9uIChvYnNlcnZlcikge1xuICAgICAgICByZXR1cm4gX3RoaXM0LnN1YnNjcmliZSh7XG4gICAgICAgICAgbmV4dDogZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICB2YXIgZmlyc3QgPSAhaGFzVmFsdWU7XG4gICAgICAgICAgICBoYXNWYWx1ZSA9IHRydWU7XG5cbiAgICAgICAgICAgIGlmICghZmlyc3QgfHwgaGFzU2VlZCkge1xuICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGFjYyA9IGZuKGFjYywgdmFsdWUpO1xuICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG9ic2VydmVyLmVycm9yKGUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBhY2MgPSB2YWx1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9LFxuICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgb2JzZXJ2ZX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BlcnJvcjogZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgICAgb2JzZXJ2ZXIuZXJyb3IoZSk7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgY29tcGxldGU6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgaWYgKGluZGV4ID09PSBzb3VyY2VzLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHN1YnNjcmlwdGlvbiA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICBvYnNlcnZlci5jb21wbGV0ZSgpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHN0YXJ0TmV4dChDLmZyb20oc291cmNlc1tpbmRleCsrXSkpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICBzdGFydE5leHQoX3RoaXM1KTtcbiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICBpZiAoc3Vic2NyaXB0aW9uKSB7XG4gICAgICAgICAgICBzdWJzY3JpcHRpb24udW5zdWJzY3JpYmUoKTtcbiAgICAgICAgICAgIHN1YnNjcmlwdGlvbiA9IHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICB9KTtcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwiZmxhdE1hcFwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiBmbGF0TWFwKGZuKSB7XG4gICAgICB2YXIgX3RoaXM2ID0gdGhpcztcblxuICAgICAgaWYgKHR5cGVvZiBmbiAhPT0gJ2Z1bmN0aW9uJykgdGhyb3cgbmV3IFR5cGVFcnJvcihmbiArICcgaXMgbm90IGEgZnVuY3Rpb24nKTtcbiAgICAgIHZhciBDID0gZ2V0U3BlY2llcyh0aGlzKTtcbiAgICAgIHJldHVybiBuZXcgQyhmdW5jdGlvbiAob2JzZXJ2ZXIpIHtcbiAgICAgICAgdmFyIHN1YnNjcmlwdGlvbnMgPSBbXTtcblxuICAgICAgICB2YXIgb3V0ZXIgPSBfdGhpczYuc3Vic2NyaWJlKHtcbiAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgICAgIGlmIChmbikge1xuICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHZhbHVlID0gZm4odmFsdWUpO1xuICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG9ic2VydmVyLmVycm9yKGUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBpbm5lciA9IEMuZnJvbSh2YWx1ZSkuc3Vic2NyaWJlKHtcbiAgICAgICAgICAgICAgbmV4dDogZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgb2JzZXJ2ZXIubmV4dCh2YWx1ZSk7XG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgICAgIG9ic2VydmVyLmVycm9yKGUpO1xuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBjb21wbGV0ZTogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIHZhciBpID0gc3Vic2NyaXB0aW9ucy5pbmRleE9mKGlubmVyKTtcbiAgICAgICAgICAgICAgICBpZiAoaSA+PSAwKSBzdWJzY3JpcHRpb25zLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgICAgICBjb21wbGV0ZUlmRG9uZSgpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHN1YnNjcmlwdGlvbnMucHVzaChpbm5lcik7XG4gICAgICAgICAgfSxcbiAgICAgICAgICBlcnJvcjogZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgIG9ic2VydmVyLmVycm9yKGUpO1xuICAg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0KCkpLmRvbmUpOyBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgICAgdmFyIF9pdGVtID0gX3N0ZXAudmFsdWU7XG4gICAgICAgICAgICAgICAgICBvYnNlcnZlci5uZXh0KF9pdGVtKTtcbiAgICAgICAgICAgICAgICAgIGlmIChvYnNlcnZlci5jbG9zZWQpIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IGVycjtcbiAgICAgICAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgaWYgKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvci5yZXR1cm4gIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBfaXRlcmF0b3IucmV0dXJuKCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgICAgICAgIGlmIChfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBvYnNlcnZlci5jb21wbGV0ZSgpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKEFycmF5LmlzQXJyYXkoeCkpIHtcbiAgICAgICAgcmV0dXJuIG5ldyBDKGZ1bmN0aW9uIChvYnNlcnZlcikge1xuICAgICAgICAgIGVucXVldWUoZnVuY3Rpb24gKCkge1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c2FnZS50cnVzdGVlcy5sZW5ndGg7XG4gICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGRvbmU6IGZhbHNlLFxuICAgICAgICAgICAgc2F2ZTogdHJ1ZSxcbiAgICAgICAgICAgIG1lc3NhZ2U6IHtcbiAgICAgICAgICAgICAgbWVzc2FnZV9pZDogTWVzc2FnZUlkZW50aWZpZXIuZm9ybWF0KFxuICAgICAgICAgICAgICAgIHRoaXMuZWxlY3Rpb25JZCxcbiAgICAgICAgICAgICAgICBLRVlfQ0VSRU1PTllfU1RFUF8xLFxuICAgICAgICAgICAgICAgIFRSVVNURUVfVFlQRSxcbiAgICAgICAgICAgICAgICB0aGlzLnRydXN0ZWVJZFxuICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICBjb250ZW50OiBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgICAgICAgICAgZWxlY3Rpb25fcHVibGljX2tleTogNyxcbiAgICAgICAgICAgICAgICBvd25lcl9pZDogdGhpcy50cnVzdGVlSWQsXG4gICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIGJyZWFrO1xuICAgICAgfVxuICAgICAgY2FzZSBLRVlfQ0VSRU1PTllfU1RFUF8xOiB7XG4gICAgICAgIGlmIChtZXNzYWdlSWRlbnRpZmllci50eXBlU3VidHlwZSA9PT0gS0VZX0NFUkVNT05ZX1NURVBfMSkge1xuICAgICAgICAgIHRoaXMucHJvY2Vzc2VkTWVzc2FnZXMgPSBbLi4udGhpcy5wcm9jZXNzZWRNZXNzYWdlcywgbWVzc2FnZV07XG4gICAgICAgICAgaWYgKHRoaXMucHJvY2Vzc2VkTWVzc2FnZXMubGVuZ3RoID09PSB0aGlzLmVsZWN0aW9uVHJ1c3RlZXNDb3VudCkge1xuICAgICAgICAgICAgdGhpcy5zdGF0dXMgPSBLRVlfQ0VSRU1PTllfSk9JTlRfRUxFQ1RJT05fS0VZO1xuICA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