} userOptions\n */\n function configure(userOptions) {\n if (userOptions.useBR) {\n deprecated(\"10.3.0\", \"'useBR' will be removed entirely in v11.0\");\n deprecated(\"10.3.0\", \"Please see https://github.com/highlightjs/highlight.js/issues/2559\");\n }\n options = inherit$1(options, userOptions);\n }\n\n /**\n * Highlights to all blocks on a page\n *\n * @type {Function & {called?: boolean}}\n */\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n if (initHighlighting.called) return;\n initHighlighting.called = true;\n\n deprecated(\"10.6.0\", \"initHighlighting() is deprecated. Use highlightAll() instead.\");\n\n const blocks = document.querySelectorAll('pre code');\n blocks.forEach(highlightElement);\n };\n\n // Higlights all when DOMContentLoaded fires\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() is deprecated. Use highlightAll() instead.\");\n wantsHighlight = true;\n }\n\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll('pre code');\n blocks.forEach(highlightElement);\n }\n\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n if (wantsHighlight) highlightAll();\n }\n\n // make sure we are in the browser environment\n if (typeof window !== 'undefined' && window.addEventListener) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) { throw error$1; } else { error(error$1); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n\n if (lang.aliases) {\n registerAliases(lang.aliases, { languageName });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n intended usage: When one language truly requires another\n\n Unlike `getLanguage`, this will throw when the requested language\n is not available.\n\n @param {string} name - name of the language to fetch/require\n @returns {Language | never}\n */\n function requireLanguage(name) {\n deprecated(\"10.4.0\", \"requireLanguage will be removed entirely in v11.\");\n deprecated(\"10.4.0\", \"Please see https://github.com/highlightjs/highlight.js/pull/2844\");\n\n const lang = getLanguage(name);\n if (lang) { return lang; }\n\n const err = new Error('The \\'{}\\' language is required, but not loaded.'.replace('{}', name));\n throw err;\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, { languageName }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = (data) => {\n plugin[\"before:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = (data) => {\n plugin[\"after:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function(plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n Note: fixMarkup is deprecated and will be removed entirely in v11\n\n @param {string} arg\n @returns {string}\n */\n function deprecateFixMarkup(arg) {\n deprecated(\"10.2.0\", \"fixMarkup will be removed entirely in v11.0\");\n deprecated(\"10.2.0\", \"Please see https://github.com/highlightjs/highlight.js/issues/2534\");\n\n return fixMarkup(arg);\n }\n\n /**\n *\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n fixMarkup: deprecateFixMarkup,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n requireLanguage,\n autoDetection,\n inherit: inherit$1,\n addPlugin,\n // plugins for frameworks\n vuePlugin: BuildVuePlugin(hljs).VuePlugin\n });\n\n hljs.debugMode = function() { SAFE_MODE = false; };\n hljs.safeMode = function() { SAFE_MODE = true; };\n hljs.versionString = version;\n\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreezeEs6(MODES[key]);\n }\n }\n\n // merge all the modes/regexs into our main object\n Object.assign(hljs, MODES);\n\n // built-in plugins, likely to be moved out of core in the future\n hljs.addPlugin(brPlugin); // slated to be removed in v11\n hljs.addPlugin(mergeHTMLPlugin);\n hljs.addPlugin(tabReplacePlugin);\n return hljs;\n};\n\n// export an \"instance\" of the highlighter\nvar highlight = HLJS({});\n\nmodule.exports = highlight;\n","'use strict';\nvar global = require('./_global');\nvar each = require('./_array-methods')(0);\nvar redefine = require('./_redefine');\nvar meta = require('./_meta');\nvar assign = require('./_object-assign');\nvar weak = require('./_collection-weak');\nvar isObject = require('./_is-object');\nvar validate = require('./_validate-collection');\nvar NATIVE_WEAK_MAP = require('./_validate-collection');\nvar IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;\nvar WEAK_MAP = 'WeakMap';\nvar getWeak = meta.getWeak;\nvar isExtensible = Object.isExtensible;\nvar uncaughtFrozenStore = weak.ufstore;\nvar InternalMap;\n\nvar wrapper = function (get) {\n return function WeakMap() {\n return get(this, arguments.length > 0 ? arguments[0] : undefined);\n };\n};\n\nvar methods = {\n // 23.3.3.3 WeakMap.prototype.get(key)\n get: function get(key) {\n if (isObject(key)) {\n var data = getWeak(key);\n if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);\n return data ? data[this._i] : undefined;\n }\n },\n // 23.3.3.5 WeakMap.prototype.set(key, value)\n set: function set(key, value) {\n return weak.def(validate(this, WEAK_MAP), key, value);\n }\n};\n\n// 23.3 WeakMap Objects\nvar $WeakMap = module.exports = require('./_collection')(WEAK_MAP, wrapper, methods, weak, true, true);\n\n// IE11 WeakMap frozen keys fix\nif (NATIVE_WEAK_MAP && IS_IE11) {\n InternalMap = weak.getConstructor(wrapper, WEAK_MAP);\n assign(InternalMap.prototype, methods);\n meta.NEED = true;\n each(['delete', 'has', 'get', 'set'], function (key) {\n var proto = $WeakMap.prototype;\n var method = proto[key];\n redefine(proto, key, function (a, b) {\n // store frozen objects on internal weakmap shim\n if (isObject(a) && !isExtensible(a)) {\n if (!this._f) this._f = new InternalMap();\n var result = this._f[key](a, b);\n return key == 'set' ? this : result;\n // store all the rest on native weakmap\n } return method.call(this, a, b);\n });\n });\n}\n","//! moment.js locale configuration\n//! locale : Thai [th]\n//! author : Kridsada Thanabulpong : https://github.com/sirn\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var th = moment.defineLocale('th', {\n months: 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split(\n '_'\n ),\n monthsShort:\n 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split(\n '_'\n ),\n monthsParseExact: true,\n weekdays: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'),\n weekdaysShort: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference\n weekdaysMin: 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'H:mm',\n LTS: 'H:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY เวลา H:mm',\n LLLL: 'วันddddที่ D MMMM YYYY เวลา H:mm',\n },\n meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/,\n isPM: function (input) {\n return input === 'หลังเที่ยง';\n },\n meridiem: function (hour, minute, isLower) {\n if (hour < 12) {\n return 'ก่อนเที่ยง';\n } else {\n return 'หลังเที่ยง';\n }\n },\n calendar: {\n sameDay: '[วันนี้ เวลา] LT',\n nextDay: '[พรุ่งนี้ เวลา] LT',\n nextWeek: 'dddd[หน้า เวลา] LT',\n lastDay: '[เมื่อวานนี้ เวลา] LT',\n lastWeek: '[วัน]dddd[ที่แล้ว เวลา] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: 'อีก %s',\n past: '%sที่แล้ว',\n s: 'ไม่กี่วินาที',\n ss: '%d วินาที',\n m: '1 นาที',\n mm: '%d นาที',\n h: '1 ชั่วโมง',\n hh: '%d ชั่วโมง',\n d: '1 วัน',\n dd: '%d วัน',\n w: '1 สัปดาห์',\n ww: '%d สัปดาห์',\n M: '1 เดือน',\n MM: '%d เดือน',\n y: '1 ปี',\n yy: '%d ปี',\n },\n });\n\n return th;\n\n})));\n","// 7.2.2 IsArray(argument)\nvar cof = require('./_cof');\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n","module.exports = function (it, Constructor, name, forbiddenField) {\n if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {\n throw TypeError(name + ': incorrect invocation!');\n } return it;\n};\n","var pIE = require('./_object-pie');\nvar createDesc = require('./_property-desc');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar has = require('./_has');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n","var asciiToArray = require('./_asciiToArray'),\n hasUnicode = require('./_hasUnicode'),\n unicodeToArray = require('./_unicodeToArray');\n\n/**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n}\n\nmodule.exports = stringToArray;\n","/**\n * vue-class-component v7.2.6\n * (c) 2015-present Evan You\n * @license MIT\n */\nimport Vue from 'vue';\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\n// The rational behind the verbose Reflect-feature check below is the fact that there are polyfills\n// which add an implementation for Reflect.defineMetadata but not for Reflect.getOwnMetadataKeys.\n// Without this check consumers will encounter hard to track down runtime errors.\nfunction reflectionIsSupported() {\n return typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys;\n}\nfunction copyReflectionMetadata(to, from) {\n forwardMetadata(to, from);\n Object.getOwnPropertyNames(from.prototype).forEach(function (key) {\n forwardMetadata(to.prototype, from.prototype, key);\n });\n Object.getOwnPropertyNames(from).forEach(function (key) {\n forwardMetadata(to, from, key);\n });\n}\n\nfunction forwardMetadata(to, from, propertyKey) {\n var metaKeys = propertyKey ? Reflect.getOwnMetadataKeys(from, propertyKey) : Reflect.getOwnMetadataKeys(from);\n metaKeys.forEach(function (metaKey) {\n var metadata = propertyKey ? Reflect.getOwnMetadata(metaKey, from, propertyKey) : Reflect.getOwnMetadata(metaKey, from);\n\n if (propertyKey) {\n Reflect.defineMetadata(metaKey, metadata, to, propertyKey);\n } else {\n Reflect.defineMetadata(metaKey, metadata, to);\n }\n });\n}\n\nvar fakeArray = {\n __proto__: []\n};\nvar hasProto = fakeArray instanceof Array;\nfunction createDecorator(factory) {\n return function (target, key, index) {\n var Ctor = typeof target === 'function' ? target : target.constructor;\n\n if (!Ctor.__decorators__) {\n Ctor.__decorators__ = [];\n }\n\n if (typeof index !== 'number') {\n index = undefined;\n }\n\n Ctor.__decorators__.push(function (options) {\n return factory(options, key, index);\n });\n };\n}\nfunction mixins() {\n for (var _len = arguments.length, Ctors = new Array(_len), _key = 0; _key < _len; _key++) {\n Ctors[_key] = arguments[_key];\n }\n\n return Vue.extend({\n mixins: Ctors\n });\n}\nfunction isPrimitive(value) {\n var type = _typeof(value);\n\n return value == null || type !== 'object' && type !== 'function';\n}\nfunction warn(message) {\n if (typeof console !== 'undefined') {\n console.warn('[vue-class-component] ' + message);\n }\n}\n\nfunction collectDataFromConstructor(vm, Component) {\n // override _init to prevent to init as Vue instance\n var originalInit = Component.prototype._init;\n\n Component.prototype._init = function () {\n var _this = this;\n\n // proxy to actual vm\n var keys = Object.getOwnPropertyNames(vm); // 2.2.0 compat (props are no longer exposed as self properties)\n\n if (vm.$options.props) {\n for (var key in vm.$options.props) {\n if (!vm.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n }\n\n keys.forEach(function (key) {\n Object.defineProperty(_this, key, {\n get: function get() {\n return vm[key];\n },\n set: function set(value) {\n vm[key] = value;\n },\n configurable: true\n });\n });\n }; // should be acquired class property values\n\n\n var data = new Component(); // restore original _init to avoid memory leak (#209)\n\n Component.prototype._init = originalInit; // create plain data object\n\n var plainData = {};\n Object.keys(data).forEach(function (key) {\n if (data[key] !== undefined) {\n plainData[key] = data[key];\n }\n });\n\n if (process.env.NODE_ENV !== 'production') {\n if (!(Component.prototype instanceof Vue) && Object.keys(plainData).length > 0) {\n warn('Component class must inherit Vue or its descendant class ' + 'when class property is used.');\n }\n }\n\n return plainData;\n}\n\nvar $internalHooks = ['data', 'beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeDestroy', 'destroyed', 'beforeUpdate', 'updated', 'activated', 'deactivated', 'render', 'errorCaptured', 'serverPrefetch' // 2.6\n];\nfunction componentFactory(Component) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n options.name = options.name || Component._componentTag || Component.name; // prototype props.\n\n var proto = Component.prototype;\n Object.getOwnPropertyNames(proto).forEach(function (key) {\n if (key === 'constructor') {\n return;\n } // hooks\n\n\n if ($internalHooks.indexOf(key) > -1) {\n options[key] = proto[key];\n return;\n }\n\n var descriptor = Object.getOwnPropertyDescriptor(proto, key);\n\n if (descriptor.value !== void 0) {\n // methods\n if (typeof descriptor.value === 'function') {\n (options.methods || (options.methods = {}))[key] = descriptor.value;\n } else {\n // typescript decorated data\n (options.mixins || (options.mixins = [])).push({\n data: function data() {\n return _defineProperty({}, key, descriptor.value);\n }\n });\n }\n } else if (descriptor.get || descriptor.set) {\n // computed properties\n (options.computed || (options.computed = {}))[key] = {\n get: descriptor.get,\n set: descriptor.set\n };\n }\n });\n (options.mixins || (options.mixins = [])).push({\n data: function data() {\n return collectDataFromConstructor(this, Component);\n }\n }); // decorate options\n\n var decorators = Component.__decorators__;\n\n if (decorators) {\n decorators.forEach(function (fn) {\n return fn(options);\n });\n delete Component.__decorators__;\n } // find super\n\n\n var superProto = Object.getPrototypeOf(Component.prototype);\n var Super = superProto instanceof Vue ? superProto.constructor : Vue;\n var Extended = Super.extend(options);\n forwardStaticMembers(Extended, Component, Super);\n\n if (reflectionIsSupported()) {\n copyReflectionMetadata(Extended, Component);\n }\n\n return Extended;\n}\nvar reservedPropertyNames = [// Unique id\n'cid', // Super Vue constructor\n'super', // Component options that will be used by the component\n'options', 'superOptions', 'extendOptions', 'sealedOptions', // Private assets\n'component', 'directive', 'filter'];\nvar shouldIgnore = {\n prototype: true,\n arguments: true,\n callee: true,\n caller: true\n};\n\nfunction forwardStaticMembers(Extended, Original, Super) {\n // We have to use getOwnPropertyNames since Babel registers methods as non-enumerable\n Object.getOwnPropertyNames(Original).forEach(function (key) {\n // Skip the properties that should not be overwritten\n if (shouldIgnore[key]) {\n return;\n } // Some browsers does not allow reconfigure built-in properties\n\n\n var extendedDescriptor = Object.getOwnPropertyDescriptor(Extended, key);\n\n if (extendedDescriptor && !extendedDescriptor.configurable) {\n return;\n }\n\n var descriptor = Object.getOwnPropertyDescriptor(Original, key); // If the user agent does not support `__proto__` or its family (IE <= 10),\n // the sub class properties may be inherited properties from the super class in TypeScript.\n // We need to exclude such properties to prevent to overwrite\n // the component options object which stored on the extended constructor (See #192).\n // If the value is a referenced value (object or function),\n // we can check equality of them and exclude it if they have the same reference.\n // If it is a primitive value, it will be forwarded for safety.\n\n if (!hasProto) {\n // Only `cid` is explicitly exluded from property forwarding\n // because we cannot detect whether it is a inherited property or not\n // on the no `__proto__` environment even though the property is reserved.\n if (key === 'cid') {\n return;\n }\n\n var superDescriptor = Object.getOwnPropertyDescriptor(Super, key);\n\n if (!isPrimitive(descriptor.value) && superDescriptor && superDescriptor.value === descriptor.value) {\n return;\n }\n } // Warn if the users manually declare reserved properties\n\n\n if (process.env.NODE_ENV !== 'production' && reservedPropertyNames.indexOf(key) >= 0) {\n warn(\"Static property name '\".concat(key, \"' declared on class '\").concat(Original.name, \"' \") + 'conflicts with reserved property name of Vue internal. ' + 'It may cause unexpected behavior of the component. Consider renaming the property.');\n }\n\n Object.defineProperty(Extended, key, descriptor);\n });\n}\n\nfunction Component(options) {\n if (typeof options === 'function') {\n return componentFactory(options);\n }\n\n return function (Component) {\n return componentFactory(Component, options);\n };\n}\n\nComponent.registerHooks = function registerHooks(keys) {\n $internalHooks.push.apply($internalHooks, _toConsumableArray(keys));\n};\n\nexport default Component;\nexport { createDecorator, mixins };\n","/** vue-property-decorator verson 8.5.1 MIT LICENSE copyright 2020 kaorun343 */\n/// \n'use strict';\nimport Vue from 'vue';\nimport Component, { createDecorator, mixins } from 'vue-class-component';\nexport { Component, Vue, mixins as Mixins };\n/** Used for keying reactive provide/inject properties */\nvar reactiveInjectKey = '__reactiveInject__';\n/**\n * decorator of an inject\n * @param from key\n * @return PropertyDecorator\n */\nexport function Inject(options) {\n return createDecorator(function (componentOptions, key) {\n if (typeof componentOptions.inject === 'undefined') {\n componentOptions.inject = {};\n }\n if (!Array.isArray(componentOptions.inject)) {\n componentOptions.inject[key] = options || key;\n }\n });\n}\n/**\n * decorator of a reactive inject\n * @param from key\n * @return PropertyDecorator\n */\nexport function InjectReactive(options) {\n return createDecorator(function (componentOptions, key) {\n if (typeof componentOptions.inject === 'undefined') {\n componentOptions.inject = {};\n }\n if (!Array.isArray(componentOptions.inject)) {\n var fromKey_1 = !!options ? options.from || options : key;\n var defaultVal_1 = (!!options && options.default) || undefined;\n if (!componentOptions.computed)\n componentOptions.computed = {};\n componentOptions.computed[key] = function () {\n var obj = this[reactiveInjectKey];\n return obj ? obj[fromKey_1] : defaultVal_1;\n };\n componentOptions.inject[reactiveInjectKey] = reactiveInjectKey;\n }\n });\n}\nfunction produceProvide(original) {\n var provide = function () {\n var _this = this;\n var rv = typeof original === 'function' ? original.call(this) : original;\n rv = Object.create(rv || null);\n // set reactive services (propagates previous services if necessary)\n rv[reactiveInjectKey] = this[reactiveInjectKey] || {};\n for (var i in provide.managed) {\n rv[provide.managed[i]] = this[i];\n }\n var _loop_1 = function (i) {\n rv[provide.managedReactive[i]] = this_1[i]; // Duplicates the behavior of `@Provide`\n Object.defineProperty(rv[reactiveInjectKey], provide.managedReactive[i], {\n enumerable: true,\n get: function () { return _this[i]; },\n });\n };\n var this_1 = this;\n for (var i in provide.managedReactive) {\n _loop_1(i);\n }\n return rv;\n };\n provide.managed = {};\n provide.managedReactive = {};\n return provide;\n}\nfunction needToProduceProvide(original) {\n return (typeof original !== 'function' ||\n (!original.managed && !original.managedReactive));\n}\n/**\n * decorator of a provide\n * @param key key\n * @return PropertyDecorator | void\n */\nexport function Provide(key) {\n return createDecorator(function (componentOptions, k) {\n var provide = componentOptions.provide;\n if (needToProduceProvide(provide)) {\n provide = componentOptions.provide = produceProvide(provide);\n }\n provide.managed[k] = key || k;\n });\n}\n/**\n * decorator of a reactive provide\n * @param key key\n * @return PropertyDecorator | void\n */\nexport function ProvideReactive(key) {\n return createDecorator(function (componentOptions, k) {\n var provide = componentOptions.provide;\n // inject parent reactive services (if any)\n if (!Array.isArray(componentOptions.inject)) {\n componentOptions.inject = componentOptions.inject || {};\n componentOptions.inject[reactiveInjectKey] = {\n from: reactiveInjectKey,\n default: {},\n };\n }\n if (needToProduceProvide(provide)) {\n provide = componentOptions.provide = produceProvide(provide);\n }\n provide.managedReactive[k] = key || k;\n });\n}\n/** @see {@link https://github.com/vuejs/vue-class-component/blob/master/src/reflect.ts} */\nvar reflectMetadataIsSupported = typeof Reflect !== 'undefined' && typeof Reflect.getMetadata !== 'undefined';\nfunction applyMetadata(options, target, key) {\n if (reflectMetadataIsSupported) {\n if (!Array.isArray(options) &&\n typeof options !== 'function' &&\n typeof options.type === 'undefined') {\n var type = Reflect.getMetadata('design:type', target, key);\n if (type !== Object) {\n options.type = type;\n }\n }\n }\n}\n/**\n * decorator of model\n * @param event event name\n * @param options options\n * @return PropertyDecorator\n */\nexport function Model(event, options) {\n if (options === void 0) { options = {}; }\n return function (target, key) {\n applyMetadata(options, target, key);\n createDecorator(function (componentOptions, k) {\n ;\n (componentOptions.props || (componentOptions.props = {}))[k] = options;\n componentOptions.model = { prop: k, event: event || k };\n })(target, key);\n };\n}\n/**\n * decorator of a prop\n * @param options the options for the prop\n * @return PropertyDecorator | void\n */\nexport function Prop(options) {\n if (options === void 0) { options = {}; }\n return function (target, key) {\n applyMetadata(options, target, key);\n createDecorator(function (componentOptions, k) {\n ;\n (componentOptions.props || (componentOptions.props = {}))[k] = options;\n })(target, key);\n };\n}\n/**\n * decorator of a synced prop\n * @param propName the name to interface with from outside, must be different from decorated property\n * @param options the options for the synced prop\n * @return PropertyDecorator | void\n */\nexport function PropSync(propName, options) {\n if (options === void 0) { options = {}; }\n // @ts-ignore\n return function (target, key) {\n applyMetadata(options, target, key);\n createDecorator(function (componentOptions, k) {\n ;\n (componentOptions.props || (componentOptions.props = {}))[propName] = options;\n (componentOptions.computed || (componentOptions.computed = {}))[k] = {\n get: function () {\n return this[propName];\n },\n set: function (value) {\n // @ts-ignore\n this.$emit(\"update:\" + propName, value);\n },\n };\n })(target, key);\n };\n}\n/**\n * decorator of a watch function\n * @param path the path or the expression to observe\n * @param WatchOption\n * @return MethodDecorator\n */\nexport function Watch(path, options) {\n if (options === void 0) { options = {}; }\n var _a = options.deep, deep = _a === void 0 ? false : _a, _b = options.immediate, immediate = _b === void 0 ? false : _b;\n return createDecorator(function (componentOptions, handler) {\n if (typeof componentOptions.watch !== 'object') {\n componentOptions.watch = Object.create(null);\n }\n var watch = componentOptions.watch;\n if (typeof watch[path] === 'object' && !Array.isArray(watch[path])) {\n watch[path] = [watch[path]];\n }\n else if (typeof watch[path] === 'undefined') {\n watch[path] = [];\n }\n watch[path].push({ handler: handler, deep: deep, immediate: immediate });\n });\n}\n// Code copied from Vue/src/shared/util.js\nvar hyphenateRE = /\\B([A-Z])/g;\nvar hyphenate = function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); };\n/**\n * decorator of an event-emitter function\n * @param event The name of the event\n * @return MethodDecorator\n */\nexport function Emit(event) {\n return function (_target, propertyKey, descriptor) {\n var key = hyphenate(propertyKey);\n var original = descriptor.value;\n descriptor.value = function emitter() {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var emit = function (returnValue) {\n var emitName = event || key;\n if (returnValue === undefined) {\n if (args.length === 0) {\n _this.$emit(emitName);\n }\n else if (args.length === 1) {\n _this.$emit(emitName, args[0]);\n }\n else {\n _this.$emit.apply(_this, [emitName].concat(args));\n }\n }\n else {\n if (args.length === 0) {\n _this.$emit(emitName, returnValue);\n }\n else if (args.length === 1) {\n _this.$emit(emitName, returnValue, args[0]);\n }\n else {\n _this.$emit.apply(_this, [emitName, returnValue].concat(args));\n }\n }\n };\n var returnValue = original.apply(this, args);\n if (isPromise(returnValue)) {\n returnValue.then(emit);\n }\n else {\n emit(returnValue);\n }\n return returnValue;\n };\n };\n}\n/**\n * decorator of a ref prop\n * @param refKey the ref key defined in template\n */\nexport function Ref(refKey) {\n return createDecorator(function (options, key) {\n options.computed = options.computed || {};\n options.computed[key] = {\n cache: false,\n get: function () {\n return this.$refs[refKey || key];\n },\n };\n });\n}\nfunction isPromise(obj) {\n return obj instanceof Promise || (obj && typeof obj.then === 'function');\n}\n","import Vue from 'vue';\nvar VueComponentFactory = /** @class */ (function () {\n function VueComponentFactory() {\n }\n VueComponentFactory.getComponentType = function (parent, component) {\n if (typeof component === 'string') {\n var componentInstance = this.searchForComponentInstance(parent, component);\n if (!componentInstance) {\n console.error(\"Could not find component with name of \" + component + \". Is it in Vue.components?\");\n return null;\n }\n return Vue.extend(componentInstance);\n }\n else {\n // assume a type\n return component;\n }\n };\n VueComponentFactory.createAndMountComponent = function (params, componentType, parent) {\n var details = {\n data: {\n params: Object.freeze(params),\n },\n parent: parent,\n };\n if (parent.componentDependencies) {\n parent.componentDependencies.forEach(function (dependency) {\n return details[dependency] = parent[dependency];\n });\n }\n var component = new componentType(details);\n component.$mount();\n return component;\n };\n VueComponentFactory.searchForComponentInstance = function (parent, component, maxDepth) {\n if (maxDepth === void 0) { maxDepth = 10; }\n var componentInstance = null;\n var currentParent = parent.$parent;\n var depth = 0;\n while (!componentInstance &&\n currentParent &&\n currentParent.$options &&\n (++depth < maxDepth)) {\n componentInstance = currentParent.$options.components[component];\n currentParent = currentParent.$parent;\n }\n if (!componentInstance) {\n console.error(\"Could not find component with name of \" + component + \". Is it in Vue.components?\");\n return null;\n }\n return componentInstance;\n };\n return VueComponentFactory;\n}());\nexport { VueComponentFactory };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { BaseComponentWrapper, Bean } from 'ag-grid-community';\nimport { VueComponentFactory } from './VueComponentFactory';\nvar VueFrameworkComponentWrapper = /** @class */ (function (_super) {\n __extends(VueFrameworkComponentWrapper, _super);\n function VueFrameworkComponentWrapper(parent) {\n var _this = _super.call(this) || this;\n _this.parent = parent;\n return _this;\n }\n VueFrameworkComponentWrapper.prototype.createWrapper = function (component) {\n var that = this;\n var DynamicComponent = /** @class */ (function (_super) {\n __extends(DynamicComponent, _super);\n function DynamicComponent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DynamicComponent.prototype.init = function (params) {\n _super.prototype.init.call(this, params);\n };\n DynamicComponent.prototype.hasMethod = function (name) {\n return wrapper.getFrameworkComponentInstance()[name] != null;\n };\n DynamicComponent.prototype.callMethod = function (name, args) {\n var componentInstance = this.getFrameworkComponentInstance();\n var frameworkComponentInstance = wrapper.getFrameworkComponentInstance();\n return frameworkComponentInstance[name].apply(componentInstance, args);\n };\n DynamicComponent.prototype.addMethod = function (name, callback) {\n wrapper[name] = callback;\n };\n DynamicComponent.prototype.overrideProcessing = function (methodName) {\n return that.parent.autoParamsRefresh && methodName === 'refresh';\n };\n DynamicComponent.prototype.processMethod = function (methodName, args) {\n if (methodName === 'refresh') {\n this.getFrameworkComponentInstance().params = args[0];\n }\n if (this.hasMethod(methodName)) {\n return this.callMethod(methodName, args);\n }\n return methodName === 'refresh';\n };\n DynamicComponent.prototype.createComponent = function (params) {\n return that.createComponent(component, params);\n };\n return DynamicComponent;\n }(VueComponent));\n var wrapper = new DynamicComponent();\n return wrapper;\n };\n VueFrameworkComponentWrapper.prototype.createComponent = function (component, params) {\n var componentType = VueComponentFactory.getComponentType(this.parent, component);\n if (!componentType) {\n return;\n }\n return VueComponentFactory.createAndMountComponent(params, componentType, this.parent);\n };\n VueFrameworkComponentWrapper.prototype.createMethodProxy = function (wrapper, methodName, mandatory) {\n return function () {\n if (wrapper.overrideProcessing(methodName)) {\n return wrapper.processMethod(methodName, arguments);\n }\n if (wrapper.hasMethod(methodName)) {\n return wrapper.callMethod(methodName, arguments);\n }\n if (mandatory) {\n console.warn('ag-Grid: Framework component is missing the method ' + methodName + '()');\n }\n return null;\n };\n };\n VueFrameworkComponentWrapper.prototype.destroy = function () {\n this.parent = null;\n };\n VueFrameworkComponentWrapper = __decorate([\n Bean('frameworkComponentWrapper')\n ], VueFrameworkComponentWrapper);\n return VueFrameworkComponentWrapper;\n}(BaseComponentWrapper));\nexport { VueFrameworkComponentWrapper };\nvar VueComponent = /** @class */ (function () {\n function VueComponent() {\n }\n VueComponent.prototype.getGui = function () {\n return this.component.$el;\n };\n VueComponent.prototype.destroy = function () {\n this.component.$destroy();\n };\n VueComponent.prototype.getFrameworkComponentInstance = function () {\n return this.component;\n };\n VueComponent.prototype.init = function (params) {\n this.component = this.createComponent(params);\n };\n return VueComponent;\n}());\n","import { ComponentUtil } from 'ag-grid-community';\nexport var getAgGridProperties = function () {\n var props = {\n gridOptions: {\n default: function () {\n return {};\n },\n },\n rowDataModel: undefined,\n };\n var watch = {\n rowDataModel: function (currentValue, previousValue) {\n this.processChanges('rowData', currentValue, previousValue);\n },\n };\n ComponentUtil.ALL_PROPERTIES.forEach(function (propertyName) {\n props[propertyName] = {};\n watch[propertyName] = function (currentValue, previousValue) {\n this.processChanges(propertyName, currentValue, previousValue);\n };\n });\n var model = {\n prop: 'rowDataModel',\n event: 'data-model-changed',\n };\n return [props, watch, model];\n};\n","import { ColDefUtil } from 'ag-grid-community';\nvar AgGridColumn = /** @class */ (function () {\n function AgGridColumn() {\n }\n AgGridColumn.hasChildColumns = function (slots) {\n return slots && slots.default && slots.default.length > 0;\n };\n AgGridColumn.mapChildColumnDefs = function (slots) {\n return slots.default.map(function (column) {\n return AgGridColumn.toColDef(column);\n });\n };\n AgGridColumn.toColDef = function (column) {\n var colDef = AgGridColumn.createColDefFromGridColumn(column);\n if (column.children && column.children.length > 0) {\n colDef.children = AgGridColumn.getChildColDefs(column.children);\n }\n return colDef;\n };\n AgGridColumn.getChildColDefs = function (columnChildren) {\n return columnChildren.map(function (column) {\n return AgGridColumn.createColDefFromGridColumn(column);\n });\n };\n AgGridColumn.createColDefFromGridColumn = function (column) {\n var colDef = {};\n AgGridColumn.assign(colDef, column.data.attrs);\n delete colDef.children;\n // booleans passed down just as is are here as property=\"\"\n // convert boolean props to a boolean here\n ColDefUtil.BOOLEAN_PROPERTIES.forEach(function (property) {\n var colDefAsAny = colDef;\n if (colDefAsAny[property] === '') {\n colDefAsAny[property] = true;\n }\n });\n return colDef;\n };\n AgGridColumn.assign = function (colDef, from) {\n // effectively Object.assign - here for IE compatibility\n return [from].reduce(function (r, o) {\n Object.keys(o).forEach(function (k) {\n r[k] = o[k];\n });\n return r;\n }, colDef);\n };\n return AgGridColumn;\n}());\nexport { AgGridColumn };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n 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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, Prop, Vue } from 'vue-property-decorator';\nimport { Bean, ComponentUtil, Grid } from 'ag-grid-community';\nimport { VueFrameworkComponentWrapper } from './VueFrameworkComponentWrapper';\nimport { getAgGridProperties } from './Utils';\nimport { AgGridColumn } from './AgGridColumn';\nvar _a = getAgGridProperties(), props = _a[0], watch = _a[1], model = _a[2];\nvar AgGridVue = /** @class */ (function (_super) {\n __extends(AgGridVue, _super);\n function AgGridVue() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.gridCreated = false;\n _this.isDestroyed = false;\n _this.gridReadyFired = false;\n _this.emitRowModel = null;\n return _this;\n }\n AgGridVue_1 = AgGridVue;\n AgGridVue.kebabProperty = function (property) {\n return property.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n };\n // noinspection JSUnusedGlobalSymbols, JSMethodCanBeStatic\n AgGridVue.prototype.render = function (h) {\n return h('div');\n };\n AgGridVue.prototype.globalEventListener = function (eventType, event) {\n if (this.isDestroyed) {\n return;\n }\n if (eventType === 'gridReady') {\n this.gridReadyFired = true;\n }\n this.updateModelIfUsed(eventType);\n // only emit if someone is listening\n // we allow both kebab and camelCase event listeners, so check for both\n var kebabName = AgGridVue_1.kebabProperty(eventType);\n if (this.$listeners[kebabName]) {\n this.$emit(kebabName, event);\n }\n else if (this.$listeners[eventType]) {\n this.$emit(eventType, event);\n }\n };\n AgGridVue.prototype.processChanges = function (propertyName, currentValue, previousValue) {\n if (this.gridCreated) {\n if (this.skipChange(propertyName, currentValue, previousValue)) {\n return;\n }\n var changes = {};\n changes[propertyName] = {\n currentValue: currentValue,\n previousValue: previousValue,\n };\n ComponentUtil.processOnChange(changes, this.gridOptions, this.gridOptions.api, this.gridOptions.columnApi);\n }\n };\n // noinspection JSUnusedGlobalSymbols\n AgGridVue.prototype.mounted = function () {\n var _this = this;\n // we debounce the model update to prevent a flood of updates in the event there are many individual\n // cell/row updates\n this.emitRowModel = this.debounce(function () {\n _this.$emit('data-model-changed', Object.freeze(_this.getRowData()));\n }, 20);\n var frameworkComponentWrapper = new VueFrameworkComponentWrapper(this);\n var gridOptions = ComponentUtil.copyAttributesToGridOptions(this.gridOptions, this);\n this.checkForBindingConflicts();\n gridOptions.rowData = this.getRowDataBasedOnBindings();\n if (AgGridColumn.hasChildColumns(this.$slots)) {\n gridOptions.columnDefs = AgGridColumn.mapChildColumnDefs(this.$slots);\n }\n var gridParams = {\n globalEventListener: this.globalEventListener.bind(this),\n providedBeanInstances: {\n frameworkComponentWrapper: frameworkComponentWrapper,\n },\n modules: this.modules,\n };\n new Grid(this.$el, gridOptions, gridParams);\n this.gridCreated = true;\n };\n // noinspection JSUnusedGlobalSymbols\n AgGridVue.prototype.destroyed = function () {\n if (this.gridCreated) {\n if (this.gridOptions.api) {\n this.gridOptions.api.destroy();\n }\n this.isDestroyed = true;\n }\n };\n AgGridVue.prototype.checkForBindingConflicts = function () {\n var thisAsAny = this;\n if ((thisAsAny.rowData || this.gridOptions.rowData) &&\n thisAsAny.rowDataModel) {\n console.warn('ag-grid: Using both rowData and rowDataModel. rowData will be ignored.');\n }\n };\n AgGridVue.prototype.getRowData = function () {\n var rowData = [];\n this.gridOptions.api.forEachNode(function (rowNode) {\n rowData.push(rowNode.data);\n });\n return rowData;\n };\n AgGridVue.prototype.updateModelIfUsed = function (eventType) {\n if (this.gridReadyFired &&\n this.$listeners['data-model-changed'] &&\n AgGridVue_1.ROW_DATA_EVENTS.indexOf(eventType) !== -1) {\n if (this.emitRowModel) {\n this.emitRowModel();\n }\n }\n };\n AgGridVue.prototype.getRowDataBasedOnBindings = function () {\n var thisAsAny = this;\n var rowDataModel = thisAsAny.rowDataModel;\n return rowDataModel ? rowDataModel :\n thisAsAny.rowData ? thisAsAny.rowData : thisAsAny.gridOptions.rowData;\n };\n /*\n * Prevents an infinite loop when using v-model for the rowData\n */\n AgGridVue.prototype.skipChange = function (propertyName, currentValue, previousValue) {\n if (this.gridReadyFired &&\n propertyName === 'rowData' &&\n this.$listeners['data-model-changed']) {\n if (currentValue === previousValue) {\n return true;\n }\n if (currentValue && previousValue) {\n var currentRowData = currentValue;\n var previousRowData = previousValue;\n if (currentRowData.length === previousRowData.length) {\n for (var i = 0; i < currentRowData.length; i++) {\n if (currentRowData[i] !== previousRowData[i]) {\n return false;\n }\n }\n return true;\n }\n }\n }\n return false;\n };\n AgGridVue.prototype.debounce = function (func, delay) {\n var timeout;\n return function () {\n var later = function () {\n func();\n };\n window.clearTimeout(timeout);\n timeout = window.setTimeout(later, delay);\n };\n };\n var AgGridVue_1;\n AgGridVue.ROW_DATA_EVENTS = ['rowDataChanged', 'rowDataUpdated', 'cellValueChanged', 'rowValueChanged'];\n __decorate([\n Prop(Boolean)\n ], AgGridVue.prototype, \"autoParamsRefresh\", void 0);\n __decorate([\n Prop({ default: function () { return []; } })\n ], AgGridVue.prototype, \"componentDependencies\", void 0);\n __decorate([\n Prop({ default: function () { return []; } })\n ], AgGridVue.prototype, \"modules\", void 0);\n AgGridVue = AgGridVue_1 = __decorate([\n Bean('agGridVue'),\n Component({\n props: props,\n watch: watch,\n model: model,\n })\n ], AgGridVue);\n return AgGridVue;\n}(Vue));\nexport { AgGridVue };\n","var $export = require('./_export');\nvar $task = require('./_task');\n$export($export.G + $export.B, {\n setImmediate: $task.set,\n clearImmediate: $task.clear\n});\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('apexcharts/dist/apexcharts.min')) :\n typeof define === 'function' && define.amd ? define(['apexcharts/dist/apexcharts.min'], factory) :\n (global.VueApexCharts = factory(global.ApexCharts));\n}(this, (function (ApexCharts) { 'use strict';\n\n ApexCharts = ApexCharts && ApexCharts.hasOwnProperty('default') ? ApexCharts['default'] : ApexCharts;\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n }\n\n var ApexChartsComponent = {\n props: {\n options: {\n type: Object\n },\n type: {\n type: String\n },\n series: {\n type: Array,\n required: true,\n default: function _default() {\n return [];\n }\n },\n width: {\n default: \"100%\"\n },\n height: {\n default: \"auto\"\n }\n },\n data: function data() {\n return {\n chart: null\n };\n },\n beforeMount: function beforeMount() {\n window.ApexCharts = ApexCharts;\n },\n mounted: function mounted() {\n this.init();\n },\n created: function created() {\n var _this = this;\n\n this.$watch(\"options\", function (options) {\n if (!_this.chart && options) {\n _this.init();\n } else {\n _this.chart.updateOptions(_this.options);\n }\n });\n this.$watch(\"series\", function (series) {\n if (!_this.chart && series) {\n _this.init();\n } else {\n _this.chart.updateSeries(_this.series);\n }\n });\n var watched = [\"type\", \"width\", \"height\"];\n watched.forEach(function (prop) {\n _this.$watch(prop, function () {\n _this.refresh();\n });\n });\n },\n beforeDestroy: function beforeDestroy() {\n if (!this.chart) {\n return;\n }\n\n this.destroy();\n },\n render: function render(createElement) {\n return createElement(\"div\");\n },\n methods: {\n init: function init() {\n var _this2 = this;\n\n var newOptions = {\n chart: {\n type: this.type || this.options.chart.type || \"line\",\n height: this.height,\n width: this.width,\n events: {}\n },\n series: this.series\n };\n Object.keys(this.$listeners).forEach(function (evt) {\n newOptions.chart.events[evt] = _this2.$listeners[evt];\n });\n var config = this.extend(this.options, newOptions);\n this.chart = new ApexCharts(this.$el, config);\n return this.chart.render();\n },\n isObject: function isObject(item) {\n return item && _typeof(item) === \"object\" && !Array.isArray(item) && item != null;\n },\n extend: function extend(target, source) {\n var _this3 = this;\n\n if (typeof Object.assign !== \"function\") {\n (function () {\n Object.assign = function (target) {\n // We must check against these specific cases.\n if (target === undefined || target === null) {\n throw new TypeError(\"Cannot convert undefined or null to object\");\n }\n\n var output = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var _source = arguments[index];\n\n if (_source !== undefined && _source !== null) {\n for (var nextKey in _source) {\n if (_source.hasOwnProperty(nextKey)) {\n output[nextKey] = _source[nextKey];\n }\n }\n }\n }\n\n return output;\n };\n })();\n }\n\n var output = Object.assign({}, target);\n\n if (this.isObject(target) && this.isObject(source)) {\n Object.keys(source).forEach(function (key) {\n if (_this3.isObject(source[key])) {\n if (!(key in target)) {\n Object.assign(output, _defineProperty({}, key, source[key]));\n } else {\n output[key] = _this3.extend(target[key], source[key]);\n }\n } else {\n Object.assign(output, _defineProperty({}, key, source[key]));\n }\n });\n }\n\n return output;\n },\n refresh: function refresh() {\n this.destroy();\n return this.init();\n },\n destroy: function destroy() {\n this.chart.destroy();\n },\n updateSeries: function updateSeries(newSeries, animate) {\n return this.chart.updateSeries(newSeries, animate);\n },\n updateOptions: function updateOptions(newOptions, redrawPaths, animate, updateSyncedCharts) {\n return this.chart.updateOptions(newOptions, redrawPaths, animate, updateSyncedCharts);\n },\n toggleSeries: function toggleSeries(seriesName) {\n return this.chart.toggleSeries(seriesName);\n },\n showSeries: function showSeries(seriesName) {\n this.chart.showSeries(seriesName);\n },\n hideSeries: function hideSeries(seriesName) {\n this.chart.hideSeries(seriesName);\n },\n appendSeries: function appendSeries(newSeries, animate) {\n return this.chart.appendSeries(newSeries, animate);\n },\n resetSeries: function resetSeries() {\n this.chart.resetSeries();\n },\n zoomX: function zoomX(min, max) {\n this.chart.zoomX(min, max);\n },\n toggleDataPointSelection: function toggleDataPointSelection(seriesIndex, dataPointIndex) {\n this.chart.toggleDataPointSelection(seriesIndex, dataPointIndex);\n },\n appendData: function appendData(newData) {\n return this.chart.appendData(newData);\n },\n addText: function addText(options) {\n this.chart.addText(options);\n },\n addImage: function addImage(options) {\n this.chart.addImage(options);\n },\n addShape: function addShape(options) {\n this.chart.addShape(options);\n },\n dataURI: function dataURI(options) {\n return this.chart.dataURI(options);\n },\n setLocale: function setLocale(localeName) {\n return this.chart.setLocale(localeName);\n },\n addXaxisAnnotation: function addXaxisAnnotation(options, pushToMemory) {\n this.chart.addXaxisAnnotation(options, pushToMemory);\n },\n addYaxisAnnotation: function addYaxisAnnotation(options, pushToMemory) {\n this.chart.addYaxisAnnotation(options, pushToMemory);\n },\n addPointAnnotation: function addPointAnnotation(options, pushToMemory) {\n this.chart.addPointAnnotation(options, pushToMemory);\n },\n removeAnnotation: function removeAnnotation(id, options) {\n this.chart.removeAnnotation(id, options);\n },\n clearAnnotations: function clearAnnotations() {\n this.chart.clearAnnotations();\n }\n }\n };\n\n var VueApexCharts = ApexChartsComponent;\n window.ApexCharts = ApexCharts;\n\n VueApexCharts.install = function (Vue) {\n //adding a global method or property\n Vue.ApexCharts = ApexCharts;\n window.ApexCharts = ApexCharts; // add the instance method\n\n Object.defineProperty(Vue.prototype, '$apexcharts', {\n get: function get() {\n return ApexCharts;\n }\n });\n };\n\n return VueApexCharts;\n\n})));\n","//! moment.js locale configuration\n//! locale : Serbian Cyrillic [sr-cyrl]\n//! author : Milan Janačković : https://github.com/milan-j\n//! author : Stefan Crnjaković : https://github.com/crnjakovic\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var translator = {\n words: {\n //Different grammatical cases\n ss: ['секунда', 'секунде', 'секунди'],\n m: ['један минут', 'једног минута'],\n mm: ['минут', 'минута', 'минута'],\n h: ['један сат', 'једног сата'],\n hh: ['сат', 'сата', 'сати'],\n d: ['један дан', 'једног дана'],\n dd: ['дан', 'дана', 'дана'],\n M: ['један месец', 'једног месеца'],\n MM: ['месец', 'месеца', 'месеци'],\n y: ['једну годину', 'једне године'],\n yy: ['годину', 'године', 'година'],\n },\n correctGrammaticalCase: function (number, wordKey) {\n if (\n number % 10 >= 1 &&\n number % 10 <= 4 &&\n (number % 100 < 10 || number % 100 >= 20)\n ) {\n return number % 10 === 1 ? wordKey[0] : wordKey[1];\n }\n return wordKey[2];\n },\n translate: function (number, withoutSuffix, key, isFuture) {\n var wordKey = translator.words[key],\n word;\n\n if (key.length === 1) {\n // Nominativ\n if (key === 'y' && withoutSuffix) return 'једна година';\n return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];\n }\n\n word = translator.correctGrammaticalCase(number, wordKey);\n // Nominativ\n if (key === 'yy' && withoutSuffix && word === 'годину') {\n return number + ' година';\n }\n\n return number + ' ' + word;\n },\n };\n\n var srCyrl = moment.defineLocale('sr-cyrl', {\n months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split(\n '_'\n ),\n monthsShort:\n 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'),\n monthsParseExact: true,\n weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'),\n weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'),\n weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'H:mm',\n LTS: 'H:mm:ss',\n L: 'D. M. YYYY.',\n LL: 'D. MMMM YYYY.',\n LLL: 'D. MMMM YYYY. H:mm',\n LLLL: 'dddd, D. MMMM YYYY. H:mm',\n },\n calendar: {\n sameDay: '[данас у] LT',\n nextDay: '[сутра у] LT',\n nextWeek: function () {\n switch (this.day()) {\n case 0:\n return '[у] [недељу] [у] LT';\n case 3:\n return '[у] [среду] [у] LT';\n case 6:\n return '[у] [суботу] [у] LT';\n case 1:\n case 2:\n case 4:\n case 5:\n return '[у] dddd [у] LT';\n }\n },\n lastDay: '[јуче у] LT',\n lastWeek: function () {\n var lastWeekDays = [\n '[прошле] [недеље] [у] LT',\n '[прошлог] [понедељка] [у] LT',\n '[прошлог] [уторка] [у] LT',\n '[прошле] [среде] [у] LT',\n '[прошлог] [четвртка] [у] LT',\n '[прошлог] [петка] [у] LT',\n '[прошле] [суботе] [у] LT',\n ];\n return lastWeekDays[this.day()];\n },\n sameElse: 'L',\n },\n relativeTime: {\n future: 'за %s',\n past: 'пре %s',\n s: 'неколико секунди',\n ss: translator.translate,\n m: translator.translate,\n mm: translator.translate,\n h: translator.translate,\n hh: translator.translate,\n d: translator.translate,\n dd: translator.translate,\n M: translator.translate,\n MM: translator.translate,\n y: translator.translate,\n yy: translator.translate,\n },\n dayOfMonthOrdinalParse: /\\d{1,2}\\./,\n ordinal: '%d.',\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 7, // The week that contains Jan 1st is the first week of the year.\n },\n });\n\n return srCyrl;\n\n})));\n","'use strict';\n// B.2.3.12 String.prototype.strike()\nrequire('./_string-html')('strike', function (createHTML) {\n return function strike() {\n return createHTML(this, 'strike', '', '');\n };\n});\n","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n","var $export = require('./_export');\n\n$export($export.P, 'String', {\n // 21.1.3.13 String.prototype.repeat(count)\n repeat: require('./_string-repeat')\n});\n","require('./_typed-array')('Int16', 2, function (init) {\n return function Int16Array(data, byteOffset, length) {\n return init(this, data, byteOffset, length);\n };\n});\n","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n","// 19.1.2.11 Object.isExtensible(O)\nvar isObject = require('./_is-object');\n\nrequire('./_object-sap')('isExtensible', function ($isExtensible) {\n return function isExtensible(it) {\n return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;\n };\n});\n","//! moment.js locale configuration\n//! locale : Occitan, lengadocian dialecte [oc-lnc]\n//! author : Quentin PAGÈS : https://github.com/Quenty31\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var ocLnc = moment.defineLocale('oc-lnc', {\n months: {\n standalone:\n 'genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre'.split(\n '_'\n ),\n format: \"de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre\".split(\n '_'\n ),\n isFormat: /D[oD]?(\\s)+MMMM/,\n },\n monthsShort:\n 'gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.'.split(\n '_'\n ),\n monthsParseExact: true,\n weekdays: 'dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte'.split(\n '_'\n ),\n weekdaysShort: 'dg._dl._dm._dc._dj._dv._ds.'.split('_'),\n weekdaysMin: 'dg_dl_dm_dc_dj_dv_ds'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'H:mm',\n LTS: 'H:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM [de] YYYY',\n ll: 'D MMM YYYY',\n LLL: 'D MMMM [de] YYYY [a] H:mm',\n lll: 'D MMM YYYY, H:mm',\n LLLL: 'dddd D MMMM [de] YYYY [a] H:mm',\n llll: 'ddd D MMM YYYY, H:mm',\n },\n calendar: {\n sameDay: '[uèi a] LT',\n nextDay: '[deman a] LT',\n nextWeek: 'dddd [a] LT',\n lastDay: '[ièr a] LT',\n lastWeek: 'dddd [passat a] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: \"d'aquí %s\",\n past: 'fa %s',\n s: 'unas segondas',\n ss: '%d segondas',\n m: 'una minuta',\n mm: '%d minutas',\n h: 'una ora',\n hh: '%d oras',\n d: 'un jorn',\n dd: '%d jorns',\n M: 'un mes',\n MM: '%d meses',\n y: 'un an',\n yy: '%d ans',\n },\n dayOfMonthOrdinalParse: /\\d{1,2}(r|n|t|è|a)/,\n ordinal: function (number, period) {\n var output =\n number === 1\n ? 'r'\n : number === 2\n ? 'n'\n : number === 3\n ? 'r'\n : number === 4\n ? 't'\n : 'è';\n if (period === 'w' || period === 'W') {\n output = 'a';\n }\n return number + output;\n },\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 4,\n },\n });\n\n return ocLnc;\n\n})));\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","var $export = require('./_export');\nvar $parseInt = require('./_parse-int');\n// 18.2.5 parseInt(string, radix)\n$export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt });\n","var ctx = require('./_ctx');\nvar invoke = require('./_invoke');\nvar html = require('./_html');\nvar cel = require('./_dom-create');\nvar global = require('./_global');\nvar process = global.process;\nvar setTask = global.setImmediate;\nvar clearTask = global.clearImmediate;\nvar MessageChannel = global.MessageChannel;\nvar Dispatch = global.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\nvar run = function () {\n var id = +this;\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\nvar listener = function (event) {\n run.call(event.data);\n};\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!setTask || !clearTask) {\n setTask = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n invoke(typeof fn == 'function' ? fn : Function(fn), args);\n };\n defer(counter);\n return counter;\n };\n clearTask = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (require('./_cof')(process) == 'process') {\n defer = function (id) {\n process.nextTick(ctx(run, id, 1));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(ctx(run, id, 1));\n };\n // Browsers with MessageChannel, includes WebWorkers\n } else if (MessageChannel) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = ctx(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {\n defer = function (id) {\n global.postMessage(id + '', '*');\n };\n global.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in cel('script')) {\n defer = function (id) {\n html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run.call(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(ctx(run, id, 1), 0);\n };\n }\n}\nmodule.exports = {\n set: setTask,\n clear: clearTask\n};\n","// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)\nvar $export = require('./_export');\n\n$export($export.S, 'Array', { isArray: require('./_is-array') });\n","//! moment.js locale configuration\n//! locale : Maltese (Malta) [mt]\n//! author : Alessandro Maruccia : https://github.com/alesma\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var mt = moment.defineLocale('mt', {\n months: 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split(\n '_'\n ),\n monthsShort: 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'),\n weekdays:\n 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split(\n '_'\n ),\n weekdaysShort: 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'),\n weekdaysMin: 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.split('_'),\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY HH:mm',\n LLLL: 'dddd, D MMMM YYYY HH:mm',\n },\n calendar: {\n sameDay: '[Illum fil-]LT',\n nextDay: '[Għada fil-]LT',\n nextWeek: 'dddd [fil-]LT',\n lastDay: '[Il-bieraħ fil-]LT',\n lastWeek: 'dddd [li għadda] [fil-]LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: 'f’ %s',\n past: '%s ilu',\n s: 'ftit sekondi',\n ss: '%d sekondi',\n m: 'minuta',\n mm: '%d minuti',\n h: 'siegħa',\n hh: '%d siegħat',\n d: 'ġurnata',\n dd: '%d ġranet',\n M: 'xahar',\n MM: '%d xhur',\n y: 'sena',\n yy: '%d sni',\n },\n dayOfMonthOrdinalParse: /\\d{1,2}º/,\n ordinal: '%dº',\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 4, // The week that contains Jan 4th is the first week of the year.\n },\n });\n\n return mt;\n\n})));\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var $export = require('./_export');\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f });\n","'use strict';\nvar ctx = require('./_ctx');\nvar $export = require('./_export');\nvar toObject = require('./_to-object');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar toLength = require('./_to-length');\nvar createProperty = require('./_create-property');\nvar getIterFn = require('./core.get-iterator-method');\n\n$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', {\n // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)\n from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var aLen = arguments.length;\n var mapfn = aLen > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var index = 0;\n var iterFn = getIterFn(O);\n var length, result, step, iterator;\n if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);\n // if object isn't iterable or it's array with default iterator - use simple case\n if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {\n for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {\n createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);\n }\n } else {\n length = toLength(O.length);\n for (result = new C(length); length > index; index++) {\n createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);\n }\n }\n result.length = index;\n return result;\n }\n});\n","//! moment.js locale configuration\n//! locale : Arabic (Libya) [ar-ly]\n//! author : Ali Hmer: https://github.com/kikoanis\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var symbolMap = {\n 1: '1',\n 2: '2',\n 3: '3',\n 4: '4',\n 5: '5',\n 6: '6',\n 7: '7',\n 8: '8',\n 9: '9',\n 0: '0',\n },\n pluralForm = function (n) {\n return n === 0\n ? 0\n : n === 1\n ? 1\n : n === 2\n ? 2\n : n % 100 >= 3 && n % 100 <= 10\n ? 3\n : n % 100 >= 11\n ? 4\n : 5;\n },\n plurals = {\n s: [\n 'أقل من ثانية',\n 'ثانية واحدة',\n ['ثانيتان', 'ثانيتين'],\n '%d ثوان',\n '%d ثانية',\n '%d ثانية',\n ],\n m: [\n 'أقل من دقيقة',\n 'دقيقة واحدة',\n ['دقيقتان', 'دقيقتين'],\n '%d دقائق',\n '%d دقيقة',\n '%d دقيقة',\n ],\n h: [\n 'أقل من ساعة',\n 'ساعة واحدة',\n ['ساعتان', 'ساعتين'],\n '%d ساعات',\n '%d ساعة',\n '%d ساعة',\n ],\n d: [\n 'أقل من يوم',\n 'يوم واحد',\n ['يومان', 'يومين'],\n '%d أيام',\n '%d يومًا',\n '%d يوم',\n ],\n M: [\n 'أقل من شهر',\n 'شهر واحد',\n ['شهران', 'شهرين'],\n '%d أشهر',\n '%d شهرا',\n '%d شهر',\n ],\n y: [\n 'أقل من عام',\n 'عام واحد',\n ['عامان', 'عامين'],\n '%d أعوام',\n '%d عامًا',\n '%d عام',\n ],\n },\n pluralize = function (u) {\n return function (number, withoutSuffix, string, isFuture) {\n var f = pluralForm(number),\n str = plurals[u][pluralForm(number)];\n if (f === 2) {\n str = str[withoutSuffix ? 0 : 1];\n }\n return str.replace(/%d/i, number);\n };\n },\n months = [\n 'يناير',\n 'فبراير',\n 'مارس',\n 'أبريل',\n 'مايو',\n 'يونيو',\n 'يوليو',\n 'أغسطس',\n 'سبتمبر',\n 'أكتوبر',\n 'نوفمبر',\n 'ديسمبر',\n ];\n\n var arLy = moment.defineLocale('ar-ly', {\n months: months,\n monthsShort: months,\n weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),\n weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),\n weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'D/\\u200FM/\\u200FYYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY HH:mm',\n LLLL: 'dddd D MMMM YYYY HH:mm',\n },\n meridiemParse: /ص|م/,\n isPM: function (input) {\n return 'م' === input;\n },\n meridiem: function (hour, minute, isLower) {\n if (hour < 12) {\n return 'ص';\n } else {\n return 'م';\n }\n },\n calendar: {\n sameDay: '[اليوم عند الساعة] LT',\n nextDay: '[غدًا عند الساعة] LT',\n nextWeek: 'dddd [عند الساعة] LT',\n lastDay: '[أمس عند الساعة] LT',\n lastWeek: 'dddd [عند الساعة] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: 'بعد %s',\n past: 'منذ %s',\n s: pluralize('s'),\n ss: pluralize('s'),\n m: pluralize('m'),\n mm: pluralize('m'),\n h: pluralize('h'),\n hh: pluralize('h'),\n d: pluralize('d'),\n dd: pluralize('d'),\n M: pluralize('M'),\n MM: pluralize('M'),\n y: pluralize('y'),\n yy: pluralize('y'),\n },\n preparse: function (string) {\n return string.replace(/،/g, ',');\n },\n postformat: function (string) {\n return string\n .replace(/\\d/g, function (match) {\n return symbolMap[match];\n })\n .replace(/,/g, '،');\n },\n week: {\n dow: 6, // Saturday is the first day of the week.\n doy: 12, // The week that contains Jan 12th is the first week of the year.\n },\n });\n\n return arLy;\n\n})));\n","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","// https://rwaldron.github.io/proposal-math-extensions/\nvar $export = require('./_export');\n\n$export($export.S, 'Math', { RAD_PER_DEG: 180 / Math.PI });\n","// https://rwaldron.github.io/proposal-math-extensions/\nvar $export = require('./_export');\nvar scale = require('./_math-scale');\nvar fround = require('./_math-fround');\n\n$export($export.S, 'Math', {\n fscale: function fscale(x, inLow, inHigh, outLow, outHigh) {\n return fround(scale(x, inLow, inHigh, outLow, outHigh));\n }\n});\n","// call something on iterator step with safe closing on error\nvar anObject = require('./_an-object');\nmodule.exports = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) anObject(ret.call(iterator));\n throw e;\n }\n};\n","//! moment.js locale configuration\n//! locale : Belarusian [be]\n//! author : Dmitry Demidov : https://github.com/demidov91\n//! author: Praleska: http://praleska.pro/\n//! Author : Menelion Elensúle : https://github.com/Oire\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n function plural(word, num) {\n var forms = word.split('_');\n return num % 10 === 1 && num % 100 !== 11\n ? forms[0]\n : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)\n ? forms[1]\n : forms[2];\n }\n function relativeTimeWithPlural(number, withoutSuffix, key) {\n var format = {\n ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд',\n mm: withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін',\n hh: withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін',\n dd: 'дзень_дні_дзён',\n MM: 'месяц_месяцы_месяцаў',\n yy: 'год_гады_гадоў',\n };\n if (key === 'm') {\n return withoutSuffix ? 'хвіліна' : 'хвіліну';\n } else if (key === 'h') {\n return withoutSuffix ? 'гадзіна' : 'гадзіну';\n } else {\n return number + ' ' + plural(format[key], +number);\n }\n }\n\n var be = moment.defineLocale('be', {\n months: {\n format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split(\n '_'\n ),\n standalone:\n 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split(\n '_'\n ),\n },\n monthsShort:\n 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'),\n weekdays: {\n format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split(\n '_'\n ),\n standalone:\n 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split(\n '_'\n ),\n isFormat: /\\[ ?[Ууў] ?(?:мінулую|наступную)? ?\\] ?dddd/,\n },\n weekdaysShort: 'нд_пн_ат_ср_чц_пт_сб'.split('_'),\n weekdaysMin: 'нд_пн_ат_ср_чц_пт_сб'.split('_'),\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'DD.MM.YYYY',\n LL: 'D MMMM YYYY г.',\n LLL: 'D MMMM YYYY г., HH:mm',\n LLLL: 'dddd, D MMMM YYYY г., HH:mm',\n },\n calendar: {\n sameDay: '[Сёння ў] LT',\n nextDay: '[Заўтра ў] LT',\n lastDay: '[Учора ў] LT',\n nextWeek: function () {\n return '[У] dddd [ў] LT';\n },\n lastWeek: function () {\n switch (this.day()) {\n case 0:\n case 3:\n case 5:\n case 6:\n return '[У мінулую] dddd [ў] LT';\n case 1:\n case 2:\n case 4:\n return '[У мінулы] dddd [ў] LT';\n }\n },\n sameElse: 'L',\n },\n relativeTime: {\n future: 'праз %s',\n past: '%s таму',\n s: 'некалькі секунд',\n m: relativeTimeWithPlural,\n mm: relativeTimeWithPlural,\n h: relativeTimeWithPlural,\n hh: relativeTimeWithPlural,\n d: 'дзень',\n dd: relativeTimeWithPlural,\n M: 'месяц',\n MM: relativeTimeWithPlural,\n y: 'год',\n yy: relativeTimeWithPlural,\n },\n meridiemParse: /ночы|раніцы|дня|вечара/,\n isPM: function (input) {\n return /^(дня|вечара)$/.test(input);\n },\n meridiem: function (hour, minute, isLower) {\n if (hour < 4) {\n return 'ночы';\n } else if (hour < 12) {\n return 'раніцы';\n } else if (hour < 17) {\n return 'дня';\n } else {\n return 'вечара';\n }\n },\n dayOfMonthOrdinalParse: /\\d{1,2}-(і|ы|га)/,\n ordinal: function (number, period) {\n switch (period) {\n case 'M':\n case 'd':\n case 'DDD':\n case 'w':\n case 'W':\n return (number % 10 === 2 || number % 10 === 3) &&\n number % 100 !== 12 &&\n number % 100 !== 13\n ? number + '-і'\n : number + '-ы';\n case 'D':\n return number + '-га';\n default:\n return number;\n }\n },\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 7, // The week that contains Jan 7th is the first week of the year.\n },\n });\n\n return be;\n\n})));\n","//! moment.js locale configuration\n//! locale : Georgian [ka]\n//! author : Irakli Janiashvili : https://github.com/IrakliJani\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var ka = moment.defineLocale('ka', {\n months: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split(\n '_'\n ),\n monthsShort: 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'),\n weekdays: {\n standalone:\n 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split(\n '_'\n ),\n format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split(\n '_'\n ),\n isFormat: /(წინა|შემდეგ)/,\n },\n weekdaysShort: 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'),\n weekdaysMin: 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'),\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY HH:mm',\n LLLL: 'dddd, D MMMM YYYY HH:mm',\n },\n calendar: {\n sameDay: '[დღეს] LT[-ზე]',\n nextDay: '[ხვალ] LT[-ზე]',\n lastDay: '[გუშინ] LT[-ზე]',\n nextWeek: '[შემდეგ] dddd LT[-ზე]',\n lastWeek: '[წინა] dddd LT-ზე',\n sameElse: 'L',\n },\n relativeTime: {\n future: function (s) {\n return s.replace(\n /(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,\n function ($0, $1, $2) {\n return $2 === 'ი' ? $1 + 'ში' : $1 + $2 + 'ში';\n }\n );\n },\n past: function (s) {\n if (/(წამი|წუთი|საათი|დღე|თვე)/.test(s)) {\n return s.replace(/(ი|ე)$/, 'ის წინ');\n }\n if (/წელი/.test(s)) {\n return s.replace(/წელი$/, 'წლის წინ');\n }\n return s;\n },\n s: 'რამდენიმე წამი',\n ss: '%d წამი',\n m: 'წუთი',\n mm: '%d წუთი',\n h: 'საათი',\n hh: '%d საათი',\n d: 'დღე',\n dd: '%d დღე',\n M: 'თვე',\n MM: '%d თვე',\n y: 'წელი',\n yy: '%d წელი',\n },\n dayOfMonthOrdinalParse: /0|1-ლი|მე-\\d{1,2}|\\d{1,2}-ე/,\n ordinal: function (number) {\n if (number === 0) {\n return number;\n }\n if (number === 1) {\n return number + '-ლი';\n }\n if (\n number < 20 ||\n (number <= 100 && number % 20 === 0) ||\n number % 100 === 0\n ) {\n return 'მე-' + number;\n }\n return number + '-ე';\n },\n week: {\n dow: 1,\n doy: 7,\n },\n });\n\n return ka;\n\n})));\n","'use strict';\n// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)\nvar $export = require('./_export');\nvar $find = require('./_array-methods')(6);\nvar KEY = 'findIndex';\nvar forced = true;\n// Shouldn't skip holes\nif (KEY in []) Array(1)[KEY](function () { forced = false; });\n$export($export.P + $export.F * forced, 'Array', {\n findIndex: function findIndex(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\nrequire('./_add-to-unscopables')(KEY);\n","'use strict';\nvar $defineProperty = require('./_object-dp');\nvar createDesc = require('./_property-desc');\n\nmodule.exports = function (object, index, value) {\n if (index in object) $defineProperty.f(object, index, createDesc(0, value));\n else object[index] = value;\n};\n","'use strict';\nrequire('./es6.regexp.exec');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar fails = require('./_fails');\nvar defined = require('./_defined');\nvar wks = require('./_wks');\nvar regexpExec = require('./_regexp-exec');\n\nvar SPECIES = wks('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$') !== '7';\n});\n\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () {\n // Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length === 2 && result[0] === 'a' && result[1] === 'b';\n})();\n\nmodule.exports = function (KEY, length, exec) {\n var SYMBOL = wks(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n re.exec = function () { execCalled = true; return null; };\n if (KEY === 'split') {\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES] = function () { return re; };\n }\n re[SYMBOL]('');\n return !execCalled;\n }) : undefined;\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var fns = exec(\n defined,\n SYMBOL,\n ''[KEY],\n function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }\n );\n var strfn = fns[0];\n var rxfn = fns[1];\n\n redefine(String.prototype, KEY, strfn);\n hide(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return rxfn.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return rxfn.call(string, this); }\n );\n }\n};\n","'use strict';\nvar isObject = require('./_is-object');\nvar getPrototypeOf = require('./_object-gpo');\nvar HAS_INSTANCE = require('./_wks')('hasInstance');\nvar FunctionProto = Function.prototype;\n// 19.2.3.6 Function.prototype[@@hasInstance](V)\nif (!(HAS_INSTANCE in FunctionProto)) require('./_object-dp').f(FunctionProto, HAS_INSTANCE, { value: function (O) {\n if (typeof this != 'function' || !isObject(O)) return false;\n if (!isObject(this.prototype)) return O instanceof this;\n // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:\n while (O = getPrototypeOf(O)) if (this.prototype === O) return true;\n return false;\n} });\n","// 26.1.10 Reflect.isExtensible(target)\nvar $export = require('./_export');\nvar anObject = require('./_an-object');\nvar $isExtensible = Object.isExtensible;\n\n$export($export.S, 'Reflect', {\n isExtensible: function isExtensible(target) {\n anObject(target);\n return $isExtensible ? $isExtensible(target) : true;\n }\n});\n","//! moment.js locale configuration\n//! locale : Korean [ko]\n//! author : Kyungwook, Park : https://github.com/kyungw00k\n//! author : Jeeeyul Lee \n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var ko = moment.defineLocale('ko', {\n months: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),\n monthsShort: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split(\n '_'\n ),\n weekdays: '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'),\n weekdaysShort: '일_월_화_수_목_금_토'.split('_'),\n weekdaysMin: '일_월_화_수_목_금_토'.split('_'),\n longDateFormat: {\n LT: 'A h:mm',\n LTS: 'A h:mm:ss',\n L: 'YYYY.MM.DD.',\n LL: 'YYYY년 MMMM D일',\n LLL: 'YYYY년 MMMM D일 A h:mm',\n LLLL: 'YYYY년 MMMM D일 dddd A h:mm',\n l: 'YYYY.MM.DD.',\n ll: 'YYYY년 MMMM D일',\n lll: 'YYYY년 MMMM D일 A h:mm',\n llll: 'YYYY년 MMMM D일 dddd A h:mm',\n },\n calendar: {\n sameDay: '오늘 LT',\n nextDay: '내일 LT',\n nextWeek: 'dddd LT',\n lastDay: '어제 LT',\n lastWeek: '지난주 dddd LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: '%s 후',\n past: '%s 전',\n s: '몇 초',\n ss: '%d초',\n m: '1분',\n mm: '%d분',\n h: '한 시간',\n hh: '%d시간',\n d: '하루',\n dd: '%d일',\n M: '한 달',\n MM: '%d달',\n y: '일 년',\n yy: '%d년',\n },\n dayOfMonthOrdinalParse: /\\d{1,2}(일|월|주)/,\n ordinal: function (number, period) {\n switch (period) {\n case 'd':\n case 'D':\n case 'DDD':\n return number + '일';\n case 'M':\n return number + '월';\n case 'w':\n case 'W':\n return number + '주';\n default:\n return number;\n }\n },\n meridiemParse: /오전|오후/,\n isPM: function (token) {\n return token === '오후';\n },\n meridiem: function (hour, minute, isUpper) {\n return hour < 12 ? '오전' : '오후';\n },\n });\n\n return ko;\n\n})));\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])\nvar $export = require('./_export');\nvar create = require('./_object-create');\nvar aFunction = require('./_a-function');\nvar anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar fails = require('./_fails');\nvar bind = require('./_bind');\nvar rConstruct = (require('./_global').Reflect || {}).construct;\n\n// MS Edge supports only 2 arguments and argumentsList argument is optional\n// FF Nightly sets third argument as `new.target`, but does not create `this` from it\nvar NEW_TARGET_BUG = fails(function () {\n function F() { /* empty */ }\n return !(rConstruct(function () { /* empty */ }, [], F) instanceof F);\n});\nvar ARGS_BUG = !fails(function () {\n rConstruct(function () { /* empty */ });\n});\n\n$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {\n construct: function construct(Target, args /* , newTarget */) {\n aFunction(Target);\n anObject(args);\n var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);\n if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget);\n if (Target == newTarget) {\n // w/o altered newTarget, optimization for 0-4 arguments\n switch (args.length) {\n case 0: return new Target();\n case 1: return new Target(args[0]);\n case 2: return new Target(args[0], args[1]);\n case 3: return new Target(args[0], args[1], args[2]);\n case 4: return new Target(args[0], args[1], args[2], args[3]);\n }\n // w/o altered newTarget, lot of arguments case\n var $args = [null];\n $args.push.apply($args, args);\n return new (bind.apply(Target, $args))();\n }\n // with altered newTarget, not support built-in constructors\n var proto = newTarget.prototype;\n var instance = create(isObject(proto) ? proto : Object.prototype);\n var result = Function.apply.call(Target, instance, args);\n return isObject(result) ? result : instance;\n }\n});\n","'use strict';\n// https://github.com/sebmarkbage/ecmascript-string-left-right-trim\nrequire('./_string-trim')('trimLeft', function ($trim) {\n return function trimLeft() {\n return $trim(this, 1);\n };\n}, 'trimStart');\n","'use strict';\nvar $export = require('./_export');\nvar html = require('./_html');\nvar cof = require('./_cof');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nvar toLength = require('./_to-length');\nvar arraySlice = [].slice;\n\n// fallback for not array-like ES3 strings and DOM objects\n$export($export.P + $export.F * require('./_fails')(function () {\n if (html) arraySlice.call(html);\n}), 'Array', {\n slice: function slice(begin, end) {\n var len = toLength(this.length);\n var klass = cof(this);\n end = end === undefined ? len : end;\n if (klass == 'Array') return arraySlice.call(this, begin, end);\n var start = toAbsoluteIndex(begin, len);\n var upTo = toAbsoluteIndex(end, len);\n var size = toLength(upTo - start);\n var cloned = new Array(size);\n var i = 0;\n for (; i < size; i++) cloned[i] = klass == 'String'\n ? this.charAt(start + i)\n : this[start + i];\n return cloned;\n }\n});\n","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","//! moment.js locale configuration\n//! locale : Kurdish [ku]\n//! author : Shahram Mebashar : https://github.com/ShahramMebashar\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var symbolMap = {\n 1: '١',\n 2: '٢',\n 3: '٣',\n 4: '٤',\n 5: '٥',\n 6: '٦',\n 7: '٧',\n 8: '٨',\n 9: '٩',\n 0: '٠',\n },\n numberMap = {\n '١': '1',\n '٢': '2',\n '٣': '3',\n '٤': '4',\n '٥': '5',\n '٦': '6',\n '٧': '7',\n '٨': '8',\n '٩': '9',\n '٠': '0',\n },\n months = [\n 'کانونی دووەم',\n 'شوبات',\n 'ئازار',\n 'نیسان',\n 'ئایار',\n 'حوزەیران',\n 'تەمموز',\n 'ئاب',\n 'ئەیلوول',\n 'تشرینی یەكەم',\n 'تشرینی دووەم',\n 'كانونی یەکەم',\n ];\n\n var ku = moment.defineLocale('ku', {\n months: months,\n monthsShort: months,\n weekdays:\n 'یهكشهممه_دووشهممه_سێشهممه_چوارشهممه_پێنجشهممه_ههینی_شهممه'.split(\n '_'\n ),\n weekdaysShort:\n 'یهكشهم_دووشهم_سێشهم_چوارشهم_پێنجشهم_ههینی_شهممه'.split('_'),\n weekdaysMin: 'ی_د_س_چ_پ_ه_ش'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY HH:mm',\n LLLL: 'dddd, D MMMM YYYY HH:mm',\n },\n meridiemParse: /ئێواره|بهیانی/,\n isPM: function (input) {\n return /ئێواره/.test(input);\n },\n meridiem: function (hour, minute, isLower) {\n if (hour < 12) {\n return 'بهیانی';\n } else {\n return 'ئێواره';\n }\n },\n calendar: {\n sameDay: '[ئهمرۆ كاتژمێر] LT',\n nextDay: '[بهیانی كاتژمێر] LT',\n nextWeek: 'dddd [كاتژمێر] LT',\n lastDay: '[دوێنێ كاتژمێر] LT',\n lastWeek: 'dddd [كاتژمێر] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: 'له %s',\n past: '%s',\n s: 'چهند چركهیهك',\n ss: 'چركه %d',\n m: 'یهك خولهك',\n mm: '%d خولهك',\n h: 'یهك كاتژمێر',\n hh: '%d كاتژمێر',\n d: 'یهك ڕۆژ',\n dd: '%d ڕۆژ',\n M: 'یهك مانگ',\n MM: '%d مانگ',\n y: 'یهك ساڵ',\n yy: '%d ساڵ',\n },\n preparse: function (string) {\n return string\n .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {\n return numberMap[match];\n })\n .replace(/،/g, ',');\n },\n postformat: function (string) {\n return string\n .replace(/\\d/g, function (match) {\n return symbolMap[match];\n })\n .replace(/,/g, '،');\n },\n week: {\n dow: 6, // Saturday is the first day of the week.\n doy: 12, // The week that contains Jan 12th is the first week of the year.\n },\n });\n\n return ku;\n\n})));\n","'use strict';\n// B.2.3.14 String.prototype.sup()\nrequire('./_string-html')('sup', function (createHTML) {\n return function sup() {\n return createHTML(this, 'sup', '', '');\n };\n});\n","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n","'use strict';\nvar LIBRARY = require('./_library');\nvar global = require('./_global');\nvar ctx = require('./_ctx');\nvar classof = require('./_classof');\nvar $export = require('./_export');\nvar isObject = require('./_is-object');\nvar aFunction = require('./_a-function');\nvar anInstance = require('./_an-instance');\nvar forOf = require('./_for-of');\nvar speciesConstructor = require('./_species-constructor');\nvar task = require('./_task').set;\nvar microtask = require('./_microtask')();\nvar newPromiseCapabilityModule = require('./_new-promise-capability');\nvar perform = require('./_perform');\nvar userAgent = require('./_user-agent');\nvar promiseResolve = require('./_promise-resolve');\nvar PROMISE = 'Promise';\nvar TypeError = global.TypeError;\nvar process = global.process;\nvar versions = process && process.versions;\nvar v8 = versions && versions.v8 || '';\nvar $Promise = global[PROMISE];\nvar isNode = classof(process) == 'process';\nvar empty = function () { /* empty */ };\nvar Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;\nvar newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;\n\nvar USE_NATIVE = !!function () {\n try {\n // correct subclassing with @@species support\n var promise = $Promise.resolve(1);\n var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) {\n exec(empty, empty);\n };\n // unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n return (isNode || typeof PromiseRejectionEvent == 'function')\n && promise.then(empty) instanceof FakePromise\n // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // we can't detect it synchronously, so just check versions\n && v8.indexOf('6.6') !== 0\n && userAgent.indexOf('Chrome/66') === -1;\n } catch (e) { /* empty */ }\n}();\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n};\nvar notify = function (promise, isReject) {\n if (promise._n) return;\n promise._n = true;\n var chain = promise._c;\n microtask(function () {\n var value = promise._v;\n var ok = promise._s == 1;\n var i = 0;\n var run = function (reaction) {\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (promise._h == 2) onHandleUnhandled(promise);\n promise._h = 1;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // may throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (e) {\n if (domain && !exited) domain.exit();\n reject(e);\n }\n };\n while (chain.length > i) run(chain[i++]); // variable length - can't use forEach\n promise._c = [];\n promise._n = false;\n if (isReject && !promise._h) onUnhandled(promise);\n });\n};\nvar onUnhandled = function (promise) {\n task.call(global, function () {\n var value = promise._v;\n var unhandled = isUnhandled(promise);\n var result, handler, console;\n if (unhandled) {\n result = perform(function () {\n if (isNode) {\n process.emit('unhandledRejection', value, promise);\n } else if (handler = global.onunhandledrejection) {\n handler({ promise: promise, reason: value });\n } else if ((console = global.console) && console.error) {\n console.error('Unhandled promise rejection', value);\n }\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n promise._h = isNode || isUnhandled(promise) ? 2 : 1;\n } promise._a = undefined;\n if (unhandled && result.e) throw result.v;\n });\n};\nvar isUnhandled = function (promise) {\n return promise._h !== 1 && (promise._a || promise._c).length === 0;\n};\nvar onHandleUnhandled = function (promise) {\n task.call(global, function () {\n var handler;\n if (isNode) {\n process.emit('rejectionHandled', promise);\n } else if (handler = global.onrejectionhandled) {\n handler({ promise: promise, reason: promise._v });\n }\n });\n};\nvar $reject = function (value) {\n var promise = this;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n promise._v = value;\n promise._s = 2;\n if (!promise._a) promise._a = promise._c.slice();\n notify(promise, true);\n};\nvar $resolve = function (value) {\n var promise = this;\n var then;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n try {\n if (promise === value) throw TypeError(\"Promise can't be resolved itself\");\n if (then = isThenable(value)) {\n microtask(function () {\n var wrapper = { _w: promise, _d: false }; // wrap\n try {\n then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));\n } catch (e) {\n $reject.call(wrapper, e);\n }\n });\n } else {\n promise._v = value;\n promise._s = 1;\n notify(promise, false);\n }\n } catch (e) {\n $reject.call({ _w: promise, _d: false }, e); // wrap\n }\n};\n\n// constructor polyfill\nif (!USE_NATIVE) {\n // 25.4.3.1 Promise(executor)\n $Promise = function Promise(executor) {\n anInstance(this, $Promise, PROMISE, '_h');\n aFunction(executor);\n Internal.call(this);\n try {\n executor(ctx($resolve, this, 1), ctx($reject, this, 1));\n } catch (err) {\n $reject.call(this, err);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n this._c = []; // <- awaiting reactions\n this._a = undefined; // <- checked in isUnhandled reactions\n this._s = 0; // <- state\n this._d = false; // <- done\n this._v = undefined; // <- value\n this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled\n this._n = false; // <- notify\n };\n Internal.prototype = require('./_redefine-all')($Promise.prototype, {\n // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)\n then: function then(onFulfilled, onRejected) {\n var reaction = newPromiseCapability(speciesConstructor(this, $Promise));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = isNode ? process.domain : undefined;\n this._c.push(reaction);\n if (this._a) this._a.push(reaction);\n if (this._s) notify(this, false);\n return reaction.promise;\n },\n // 25.4.5.1 Promise.prototype.catch(onRejected)\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n this.promise = promise;\n this.resolve = ctx($resolve, promise, 1);\n this.reject = ctx($reject, promise, 1);\n };\n newPromiseCapabilityModule.f = newPromiseCapability = function (C) {\n return C === $Promise || C === Wrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });\nrequire('./_set-to-string-tag')($Promise, PROMISE);\nrequire('./_set-species')(PROMISE);\nWrapper = require('./_core')[PROMISE];\n\n// statics\n$export($export.S + $export.F * !USE_NATIVE, PROMISE, {\n // 25.4.4.5 Promise.reject(r)\n reject: function reject(r) {\n var capability = newPromiseCapability(this);\n var $$reject = capability.reject;\n $$reject(r);\n return capability.promise;\n }\n});\n$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {\n // 25.4.4.6 Promise.resolve(x)\n resolve: function resolve(x) {\n return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);\n }\n});\n$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {\n $Promise.all(iter)['catch'](empty);\n})), PROMISE, {\n // 25.4.4.1 Promise.all(iterable)\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var values = [];\n var index = 0;\n var remaining = 1;\n forOf(iterable, false, function (promise) {\n var $index = index++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n C.resolve(promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[$index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.e) reject(result.v);\n return capability.promise;\n },\n // 25.4.4.4 Promise.race(iterable)\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var reject = capability.reject;\n var result = perform(function () {\n forOf(iterable, false, function (promise) {\n C.resolve(promise).then(capability.resolve, reject);\n });\n });\n if (result.e) reject(result.v);\n return capability.promise;\n }\n});\n","//! moment.js locale configuration\n//! locale : Bosnian [bs]\n//! author : Nedim Cholich : https://github.com/frontyard\n//! author : Rasid Redzic : https://github.com/rasidre\n//! based on (hr) translation by Bojan Marković\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n function processRelativeTime(number, withoutSuffix, key, isFuture) {\n switch (key) {\n case 'm':\n return withoutSuffix\n ? 'jedna minuta'\n : isFuture\n ? 'jednu minutu'\n : 'jedne minute';\n }\n }\n\n function translate(number, withoutSuffix, key) {\n var result = number + ' ';\n switch (key) {\n case 'ss':\n if (number === 1) {\n result += 'sekunda';\n } else if (number === 2 || number === 3 || number === 4) {\n result += 'sekunde';\n } else {\n result += 'sekundi';\n }\n return result;\n case 'mm':\n if (number === 1) {\n result += 'minuta';\n } else if (number === 2 || number === 3 || number === 4) {\n result += 'minute';\n } else {\n result += 'minuta';\n }\n return result;\n case 'h':\n return withoutSuffix ? 'jedan sat' : 'jedan sat';\n case 'hh':\n if (number === 1) {\n result += 'sat';\n } else if (number === 2 || number === 3 || number === 4) {\n result += 'sata';\n } else {\n result += 'sati';\n }\n return result;\n case 'dd':\n if (number === 1) {\n result += 'dan';\n } else {\n result += 'dana';\n }\n return result;\n case 'MM':\n if (number === 1) {\n result += 'mjesec';\n } else if (number === 2 || number === 3 || number === 4) {\n result += 'mjeseca';\n } else {\n result += 'mjeseci';\n }\n return result;\n case 'yy':\n if (number === 1) {\n result += 'godina';\n } else if (number === 2 || number === 3 || number === 4) {\n result += 'godine';\n } else {\n result += 'godina';\n }\n return result;\n }\n }\n\n var bs = moment.defineLocale('bs', {\n months: 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split(\n '_'\n ),\n monthsShort:\n 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split(\n '_'\n ),\n monthsParseExact: true,\n weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(\n '_'\n ),\n weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),\n weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'H:mm',\n LTS: 'H:mm:ss',\n L: 'DD.MM.YYYY',\n LL: 'D. MMMM YYYY',\n LLL: 'D. MMMM YYYY H:mm',\n LLLL: 'dddd, D. MMMM YYYY H:mm',\n },\n calendar: {\n sameDay: '[danas u] LT',\n nextDay: '[sutra u] LT',\n nextWeek: function () {\n switch (this.day()) {\n case 0:\n return '[u] [nedjelju] [u] LT';\n case 3:\n return '[u] [srijedu] [u] LT';\n case 6:\n return '[u] [subotu] [u] LT';\n case 1:\n case 2:\n case 4:\n case 5:\n return '[u] dddd [u] LT';\n }\n },\n lastDay: '[jučer u] LT',\n lastWeek: function () {\n switch (this.day()) {\n case 0:\n case 3:\n return '[prošlu] dddd [u] LT';\n case 6:\n return '[prošle] [subote] [u] LT';\n case 1:\n case 2:\n case 4:\n case 5:\n return '[prošli] dddd [u] LT';\n }\n },\n sameElse: 'L',\n },\n relativeTime: {\n future: 'za %s',\n past: 'prije %s',\n s: 'par sekundi',\n ss: translate,\n m: processRelativeTime,\n mm: translate,\n h: translate,\n hh: translate,\n d: 'dan',\n dd: translate,\n M: 'mjesec',\n MM: translate,\n y: 'godinu',\n yy: translate,\n },\n dayOfMonthOrdinalParse: /\\d{1,2}\\./,\n ordinal: '%d.',\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 7, // The week that contains Jan 7th is the first week of the year.\n },\n });\n\n return bs;\n\n})));\n","// 20.2.2.12 Math.cosh(x)\nvar $export = require('./_export');\nvar exp = Math.exp;\n\n$export($export.S, 'Math', {\n cosh: function cosh(x) {\n return (exp(x = +x) + exp(-x)) / 2;\n }\n});\n","// 19.1.2.7 Object.getOwnPropertyNames(O)\nrequire('./_object-sap')('getOwnPropertyNames', function () {\n return require('./_object-gopn-ext').f;\n});\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","exports.f = Object.getOwnPropertySymbols;\n","var $export = require('./_export');\n$export($export.G + $export.W + $export.F * !require('./_typed').ABV, {\n DataView: require('./_typed-buffer').DataView\n});\n","//! moment.js locale configuration\n//! locale : Lithuanian [lt]\n//! author : Mindaugas Mozūras : https://github.com/mmozuras\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var units = {\n ss: 'sekundė_sekundžių_sekundes',\n m: 'minutė_minutės_minutę',\n mm: 'minutės_minučių_minutes',\n h: 'valanda_valandos_valandą',\n hh: 'valandos_valandų_valandas',\n d: 'diena_dienos_dieną',\n dd: 'dienos_dienų_dienas',\n M: 'mėnuo_mėnesio_mėnesį',\n MM: 'mėnesiai_mėnesių_mėnesius',\n y: 'metai_metų_metus',\n yy: 'metai_metų_metus',\n };\n function translateSeconds(number, withoutSuffix, key, isFuture) {\n if (withoutSuffix) {\n return 'kelios sekundės';\n } else {\n return isFuture ? 'kelių sekundžių' : 'kelias sekundes';\n }\n }\n function translateSingular(number, withoutSuffix, key, isFuture) {\n return withoutSuffix\n ? forms(key)[0]\n : isFuture\n ? forms(key)[1]\n : forms(key)[2];\n }\n function special(number) {\n return number % 10 === 0 || (number > 10 && number < 20);\n }\n function forms(key) {\n return units[key].split('_');\n }\n function translate(number, withoutSuffix, key, isFuture) {\n var result = number + ' ';\n if (number === 1) {\n return (\n result + translateSingular(number, withoutSuffix, key[0], isFuture)\n );\n } else if (withoutSuffix) {\n return result + (special(number) ? forms(key)[1] : forms(key)[0]);\n } else {\n if (isFuture) {\n return result + forms(key)[1];\n } else {\n return result + (special(number) ? forms(key)[1] : forms(key)[2]);\n }\n }\n }\n var lt = moment.defineLocale('lt', {\n months: {\n format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split(\n '_'\n ),\n standalone:\n 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split(\n '_'\n ),\n isFormat: /D[oD]?(\\[[^\\[\\]]*\\]|\\s)+MMMM?|MMMM?(\\[[^\\[\\]]*\\]|\\s)+D[oD]?/,\n },\n monthsShort: 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'),\n weekdays: {\n format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split(\n '_'\n ),\n standalone:\n 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split(\n '_'\n ),\n isFormat: /dddd HH:mm/,\n },\n weekdaysShort: 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'),\n weekdaysMin: 'S_P_A_T_K_Pn_Š'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'YYYY-MM-DD',\n LL: 'YYYY [m.] MMMM D [d.]',\n LLL: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',\n LLLL: 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]',\n l: 'YYYY-MM-DD',\n ll: 'YYYY [m.] MMMM D [d.]',\n lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',\n llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]',\n },\n calendar: {\n sameDay: '[Šiandien] LT',\n nextDay: '[Rytoj] LT',\n nextWeek: 'dddd LT',\n lastDay: '[Vakar] LT',\n lastWeek: '[Praėjusį] dddd LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: 'po %s',\n past: 'prieš %s',\n s: translateSeconds,\n ss: translate,\n m: translateSingular,\n mm: translate,\n h: translateSingular,\n hh: translate,\n d: translateSingular,\n dd: translate,\n M: translateSingular,\n MM: translate,\n y: translateSingular,\n yy: translate,\n },\n dayOfMonthOrdinalParse: /\\d{1,2}-oji/,\n ordinal: function (number) {\n return number + '-oji';\n },\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 4, // The week that contains Jan 4th is the first week of the year.\n },\n });\n\n return lt;\n\n})));\n","// https://rwaldron.github.io/proposal-math-extensions/\nvar $export = require('./_export');\nvar RAD_PER_DEG = 180 / Math.PI;\n\n$export($export.S, 'Math', {\n degrees: function degrees(radians) {\n return radians * RAD_PER_DEG;\n }\n});\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent(\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier /* server only */,\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options =\n typeof scriptExports === 'function' ? scriptExports.options : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) {\n // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () {\n injectStyles.call(\n this,\n (options.functional ? this.parent : this).$root.$options.shadowRoot\n )\n }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection(h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing ? [].concat(existing, hook) : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","/*\n * vue-croppa v1.3.8\n * https://github.com/zhanziyang/vue-croppa\n * \n * Copyright (c) 2018 zhanziyang\n * Released under the ISC license\n */\n \n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.Croppa = factory());\n}(this, (function () { 'use strict';\n\nvar commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n\n\n\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar canvasExifOrientation = createCommonjsModule(function (module, exports) {\n(function (root, factory) {\n if (typeof undefined === 'function' && undefined.amd) {\n undefined([], factory);\n } else {\n module.exports = factory();\n }\n}(commonjsGlobal, function () {\n 'use strict';\n\n function drawImage(img, orientation, x, y, width, height) {\n if (!/^[1-8]$/.test(orientation)) throw new Error('orientation should be [1-8]');\n\n if (x == null) x = 0;\n if (y == null) y = 0;\n if (width == null) width = img.width;\n if (height == null) height = img.height;\n\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n canvas.width = width;\n canvas.height = height;\n\n ctx.save();\n switch (+orientation) {\n // 1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.\n case 1:\n break;\n\n // 2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.\n case 2:\n ctx.translate(width, 0);\n ctx.scale(-1, 1);\n break;\n\n // 3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.\n case 3:\n ctx.translate(width, height);\n ctx.rotate(180 / 180 * Math.PI);\n break;\n\n // 4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.\n case 4:\n ctx.translate(0, height);\n ctx.scale(1, -1);\n break;\n\n // 5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.\n case 5:\n canvas.width = height;\n canvas.height = width;\n ctx.rotate(90 / 180 * Math.PI);\n ctx.scale(1, -1);\n break;\n\n // 6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.\n case 6:\n canvas.width = height;\n canvas.height = width;\n ctx.rotate(90 / 180 * Math.PI);\n ctx.translate(0, -height);\n break;\n\n // 7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.\n case 7:\n canvas.width = height;\n canvas.height = width;\n ctx.rotate(270 / 180 * Math.PI);\n ctx.translate(-width, height);\n ctx.scale(1, -1);\n break;\n\n // 8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.\n case 8:\n canvas.width = height;\n canvas.height = width;\n ctx.translate(0, width);\n ctx.rotate(270 / 180 * Math.PI);\n break;\n }\n\n ctx.drawImage(img, x, y, width, height);\n ctx.restore();\n\n return canvas;\n }\n\n return {\n drawImage: drawImage\n };\n}));\n});\n\nvar u = {\n onePointCoord: function onePointCoord(point, vm) {\n var canvas = vm.canvas,\n quality = vm.quality;\n\n var rect = canvas.getBoundingClientRect();\n var clientX = point.clientX;\n var clientY = point.clientY;\n return {\n x: (clientX - rect.left) * quality,\n y: (clientY - rect.top) * quality\n };\n },\n getPointerCoords: function getPointerCoords(evt, vm) {\n var pointer = void 0;\n if (evt.touches && evt.touches[0]) {\n pointer = evt.touches[0];\n } else if (evt.changedTouches && evt.changedTouches[0]) {\n pointer = evt.changedTouches[0];\n } else {\n pointer = evt;\n }\n return this.onePointCoord(pointer, vm);\n },\n getPinchDistance: function getPinchDistance(evt, vm) {\n var pointer1 = evt.touches[0];\n var pointer2 = evt.touches[1];\n var coord1 = this.onePointCoord(pointer1, vm);\n var coord2 = this.onePointCoord(pointer2, vm);\n\n return Math.sqrt(Math.pow(coord1.x - coord2.x, 2) + Math.pow(coord1.y - coord2.y, 2));\n },\n getPinchCenterCoord: function getPinchCenterCoord(evt, vm) {\n var pointer1 = evt.touches[0];\n var pointer2 = evt.touches[1];\n var coord1 = this.onePointCoord(pointer1, vm);\n var coord2 = this.onePointCoord(pointer2, vm);\n\n return {\n x: (coord1.x + coord2.x) / 2,\n y: (coord1.y + coord2.y) / 2\n };\n },\n imageLoaded: function imageLoaded(img) {\n return img.complete && img.naturalWidth !== 0;\n },\n rAFPolyfill: function rAFPolyfill() {\n // rAF polyfill\n if (typeof document == 'undefined' || typeof window == 'undefined') return;\n var lastTime = 0;\n var vendors = ['webkit', 'moz'];\n for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {\n window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];\n window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || // Webkit中此取消方法的名字变了\n window[vendors[x] + 'CancelRequestAnimationFrame'];\n }\n\n if (!window.requestAnimationFrame) {\n window.requestAnimationFrame = function (callback) {\n var currTime = new Date().getTime();\n var timeToCall = Math.max(0, 16.7 - (currTime - lastTime));\n var id = window.setTimeout(function () {\n var arg = currTime + timeToCall;\n callback(arg);\n }, timeToCall);\n lastTime = currTime + timeToCall;\n return id;\n };\n }\n if (!window.cancelAnimationFrame) {\n window.cancelAnimationFrame = function (id) {\n clearTimeout(id);\n };\n }\n\n Array.isArray = function (arg) {\n return Object.prototype.toString.call(arg) === '[object Array]';\n };\n },\n toBlobPolyfill: function toBlobPolyfill() {\n if (typeof document == 'undefined' || typeof window == 'undefined' || !HTMLCanvasElement) return;\n var binStr, len, arr;\n if (!HTMLCanvasElement.prototype.toBlob) {\n Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', {\n value: function value(callback, type, quality) {\n binStr = atob(this.toDataURL(type, quality).split(',')[1]);\n len = binStr.length;\n arr = new Uint8Array(len);\n\n for (var i = 0; i < len; i++) {\n arr[i] = binStr.charCodeAt(i);\n }\n\n callback(new Blob([arr], { type: type || 'image/png' }));\n }\n });\n }\n },\n eventHasFile: function eventHasFile(evt) {\n var dt = evt.dataTransfer || evt.originalEvent.dataTransfer;\n if (dt.types) {\n for (var i = 0, len = dt.types.length; i < len; i++) {\n if (dt.types[i] == 'Files') {\n return true;\n }\n }\n }\n\n return false;\n },\n getFileOrientation: function getFileOrientation(arrayBuffer) {\n var view = new DataView(arrayBuffer);\n if (view.getUint16(0, false) != 0xFFD8) return -2;\n var length = view.byteLength;\n var offset = 2;\n while (offset < length) {\n var marker = view.getUint16(offset, false);\n offset += 2;\n if (marker == 0xFFE1) {\n if (view.getUint32(offset += 2, false) != 0x45786966) return -1;\n var little = view.getUint16(offset += 6, false) == 0x4949;\n offset += view.getUint32(offset + 4, little);\n var tags = view.getUint16(offset, little);\n offset += 2;\n for (var i = 0; i < tags; i++) {\n if (view.getUint16(offset + i * 12, little) == 0x0112) {\n return view.getUint16(offset + i * 12 + 8, little);\n }\n }\n } else if ((marker & 0xFF00) != 0xFF00) break;else offset += view.getUint16(offset, false);\n }\n return -1;\n },\n parseDataUrl: function parseDataUrl(url) {\n var reg = /^data:([^;]+)?(;base64)?,(.*)/gmi;\n return reg.exec(url)[3];\n },\n base64ToArrayBuffer: function base64ToArrayBuffer(base64) {\n var binaryString = atob(base64);\n var len = binaryString.length;\n var bytes = new Uint8Array(len);\n for (var i = 0; i < len; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes.buffer;\n },\n getRotatedImage: function getRotatedImage(img, orientation) {\n var _canvas = canvasExifOrientation.drawImage(img, orientation);\n var _img = new Image();\n _img.src = _canvas.toDataURL();\n return _img;\n },\n flipX: function flipX(ori) {\n if (ori % 2 == 0) {\n return ori - 1;\n }\n\n return ori + 1;\n },\n flipY: function flipY(ori) {\n var map = {\n 1: 4,\n 4: 1,\n 2: 3,\n 3: 2,\n 5: 8,\n 8: 5,\n 6: 7,\n 7: 6\n };\n\n return map[ori];\n },\n rotate90: function rotate90(ori) {\n var map = {\n 1: 6,\n 2: 7,\n 3: 8,\n 4: 5,\n 5: 2,\n 6: 3,\n 7: 4,\n 8: 1\n };\n\n return map[ori];\n },\n numberValid: function numberValid(n) {\n return typeof n === 'number' && !isNaN(n);\n }\n};\n\nNumber.isInteger = Number.isInteger || function (value) {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n};\n\nvar initialImageType = String;\nif (typeof window !== 'undefined' && window.Image) {\n initialImageType = [String, Image];\n}\n\nvar props = {\n value: Object,\n width: {\n type: Number,\n default: 200,\n validator: function validator(val) {\n return val > 0;\n }\n },\n height: {\n type: Number,\n default: 200,\n validator: function validator(val) {\n return val > 0;\n }\n },\n placeholder: {\n type: String,\n default: 'Choose an image'\n },\n placeholderColor: {\n default: '#606060'\n },\n placeholderFontSize: {\n type: Number,\n default: 0,\n validator: function validator(val) {\n return val >= 0;\n }\n },\n canvasColor: {\n default: 'transparent'\n },\n quality: {\n type: Number,\n default: 2,\n validator: function validator(val) {\n return val > 0;\n }\n },\n zoomSpeed: {\n default: 3,\n type: Number,\n validator: function validator(val) {\n return val > 0;\n }\n },\n accept: String,\n fileSizeLimit: {\n type: Number,\n default: 0,\n validator: function validator(val) {\n return val >= 0;\n }\n },\n disabled: Boolean,\n disableDragAndDrop: Boolean,\n disableClickToChoose: Boolean,\n disableDragToMove: Boolean,\n disableScrollToZoom: Boolean,\n disablePinchToZoom: Boolean,\n disableRotation: Boolean,\n reverseScrollToZoom: Boolean,\n preventWhiteSpace: Boolean,\n showRemoveButton: {\n type: Boolean,\n default: true\n },\n removeButtonColor: {\n type: String,\n default: 'red'\n },\n removeButtonSize: {\n type: Number\n },\n initialImage: initialImageType,\n initialSize: {\n type: String,\n default: 'cover',\n validator: function validator(val) {\n return val === 'cover' || val === 'contain' || val === 'natural';\n }\n },\n initialPosition: {\n type: String,\n default: 'center',\n validator: function validator(val) {\n var valids = ['center', 'top', 'bottom', 'left', 'right'];\n return val.split(' ').every(function (word) {\n return valids.indexOf(word) >= 0;\n }) || /^-?\\d+% -?\\d+%$/.test(val);\n }\n },\n inputAttrs: Object,\n showLoading: Boolean,\n loadingSize: {\n type: Number,\n default: 20\n },\n loadingColor: {\n type: String,\n default: '#606060'\n },\n replaceDrop: Boolean,\n passive: Boolean,\n imageBorderRadius: {\n type: [Number, String],\n default: 0\n },\n autoSizing: Boolean,\n videoEnabled: Boolean\n};\n\nvar events = {\n INIT_EVENT: 'init',\n FILE_CHOOSE_EVENT: 'file-choose',\n FILE_SIZE_EXCEED_EVENT: 'file-size-exceed',\n FILE_TYPE_MISMATCH_EVENT: 'file-type-mismatch',\n NEW_IMAGE_EVENT: 'new-image',\n NEW_IMAGE_DRAWN_EVENT: 'new-image-drawn',\n IMAGE_REMOVE_EVENT: 'image-remove',\n MOVE_EVENT: 'move',\n ZOOM_EVENT: 'zoom',\n DRAW_EVENT: 'draw',\n INITIAL_IMAGE_LOADED_EVENT: 'initial-image-loaded',\n LOADING_START_EVENT: 'loading-start',\n LOADING_END_EVENT: 'loading-end'\n};\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n};\n\nvar PCT_PER_ZOOM = 1 / 100000; // The amount of zooming everytime it happens, in percentage of image width.\nvar MIN_MS_PER_CLICK = 500; // If touch duration is shorter than the value, then it is considered as a click.\nvar CLICK_MOVE_THRESHOLD = 100; // If touch move distance is greater than this value, then it will by no mean be considered as a click.\nvar MIN_WIDTH = 10; // The minimal width the user can zoom to.\nvar DEFAULT_PLACEHOLDER_TAKEUP = 2 / 3; // Placeholder text by default takes up this amount of times of canvas width.\nvar PINCH_ACCELERATION = 1; // The amount of times by which the pinching is more sensitive than the scolling\n\nvar syncData = ['imgData', 'img', 'imgSet', 'originalImage', 'naturalHeight', 'naturalWidth', 'orientation', 'scaleRatio'];\n// const DEBUG = false\n\nvar component = { render: function render() {\n var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { ref: \"wrapper\", class: 'croppa-container ' + (_vm.img ? 'croppa--has-target' : '') + ' ' + (_vm.passive ? 'croppa--passive' : '') + ' ' + (_vm.disabled ? 'croppa--disabled' : '') + ' ' + (_vm.disableClickToChoose ? 'croppa--disabled-cc' : '') + ' ' + (_vm.disableDragToMove && _vm.disableScrollToZoom ? 'croppa--disabled-mz' : '') + ' ' + (_vm.fileDraggedOver ? 'croppa--dropzone' : ''), on: { \"dragenter\": function dragenter($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handleDragEnter($event);\n }, \"dragleave\": function dragleave($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handleDragLeave($event);\n }, \"dragover\": function dragover($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handleDragOver($event);\n }, \"drop\": function drop($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handleDrop($event);\n } } }, [_c('input', _vm._b({ ref: \"fileInput\", staticStyle: { \"height\": \"1px\", \"width\": \"1px\", \"overflow\": \"hidden\", \"margin-left\": \"-99999px\", \"position\": \"absolute\" }, attrs: { \"type\": \"file\", \"accept\": _vm.accept, \"disabled\": _vm.disabled }, on: { \"change\": _vm._handleInputChange } }, 'input', _vm.inputAttrs, false)), _vm._v(\" \"), _c('div', { staticClass: \"slots\", staticStyle: { \"width\": \"0\", \"height\": \"0\", \"visibility\": \"hidden\" } }, [_vm._t(\"initial\"), _vm._v(\" \"), _vm._t(\"placeholder\")], 2), _vm._v(\" \"), _c('canvas', { ref: \"canvas\", on: { \"click\": function click($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handleClick($event);\n }, \"dblclick\": function dblclick($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handleDblClick($event);\n }, \"touchstart\": function touchstart($event) {\n $event.stopPropagation();return _vm._handlePointerStart($event);\n }, \"mousedown\": function mousedown($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerStart($event);\n }, \"pointerstart\": function pointerstart($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerStart($event);\n }, \"touchend\": function touchend($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerEnd($event);\n }, \"touchcancel\": function touchcancel($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerEnd($event);\n }, \"mouseup\": function mouseup($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerEnd($event);\n }, \"pointerend\": function pointerend($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerEnd($event);\n }, \"pointercancel\": function pointercancel($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerEnd($event);\n }, \"touchmove\": function touchmove($event) {\n $event.stopPropagation();return _vm._handlePointerMove($event);\n }, \"mousemove\": function mousemove($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerMove($event);\n }, \"pointermove\": function pointermove($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerMove($event);\n }, \"pointerleave\": function pointerleave($event) {\n $event.stopPropagation();$event.preventDefault();return _vm._handlePointerLeave($event);\n }, \"DOMMouseScroll\": function DOMMouseScroll($event) {\n $event.stopPropagation();return _vm._handleWheel($event);\n }, \"wheel\": function wheel($event) {\n $event.stopPropagation();return _vm._handleWheel($event);\n }, \"mousewheel\": function mousewheel($event) {\n $event.stopPropagation();return _vm._handleWheel($event);\n } } }), _vm._v(\" \"), _vm.showRemoveButton && _vm.img && !_vm.passive ? _c('svg', { staticClass: \"icon icon-remove\", style: 'top: -' + _vm.height / 40 + 'px; right: -' + _vm.width / 40 + 'px', attrs: { \"viewBox\": \"0 0 1024 1024\", \"version\": \"1.1\", \"xmlns\": \"http://www.w3.org/2000/svg\", \"xmlns:xlink\": \"http://www.w3.org/1999/xlink\", \"width\": _vm.removeButtonSize || _vm.width / 10, \"height\": _vm.removeButtonSize || _vm.width / 10 }, on: { \"click\": _vm.remove } }, [_c('path', { attrs: { \"d\": \"M511.921231 0C229.179077 0 0 229.257846 0 512 0 794.702769 229.179077 1024 511.921231 1024 794.781538 1024 1024 794.702769 1024 512 1024 229.257846 794.781538 0 511.921231 0ZM732.041846 650.633846 650.515692 732.081231C650.515692 732.081231 521.491692 593.683692 511.881846 593.683692 502.429538 593.683692 373.366154 732.081231 373.366154 732.081231L291.761231 650.633846C291.761231 650.633846 430.316308 523.500308 430.316308 512.196923 430.316308 500.696615 291.761231 373.523692 291.761231 373.523692L373.366154 291.918769C373.366154 291.918769 503.453538 430.395077 511.881846 430.395077 520.349538 430.395077 650.515692 291.918769 650.515692 291.918769L732.041846 373.523692C732.041846 373.523692 593.447385 502.547692 593.447385 512.196923 593.447385 521.412923 732.041846 650.633846 732.041846 650.633846Z\", \"fill\": _vm.removeButtonColor } })]) : _vm._e(), _vm._v(\" \"), _vm.showLoading && _vm.loading ? _c('div', { staticClass: \"sk-fading-circle\", style: _vm.loadingStyle }, _vm._l(12, function (i) {\n return _c('div', { key: i, class: 'sk-circle' + i + ' sk-circle' }, [_c('div', { staticClass: \"sk-circle-indicator\", style: { backgroundColor: _vm.loadingColor } })]);\n })) : _vm._e(), _vm._v(\" \"), _vm._t(\"default\")], 2);\n }, staticRenderFns: [],\n model: {\n prop: 'value',\n event: events.INIT_EVENT\n },\n\n props: props,\n\n data: function data() {\n return {\n canvas: null,\n ctx: null,\n originalImage: null,\n img: null,\n video: null,\n dragging: false,\n lastMovingCoord: null,\n imgData: {\n width: 0,\n height: 0,\n startX: 0,\n startY: 0\n },\n fileDraggedOver: false,\n tabStart: 0,\n scrolling: false,\n pinching: false,\n rotating: false,\n pinchDistance: 0,\n supportTouch: false,\n pointerMoved: false,\n pointerStartCoord: null,\n naturalWidth: 0,\n naturalHeight: 0,\n scaleRatio: null,\n orientation: 1,\n userMetadata: null,\n imageSet: false,\n currentPointerCoord: null,\n currentIsInitial: false,\n loading: false,\n realWidth: 0, // only for when autoSizing is on\n realHeight: 0, // only for when autoSizing is on\n chosenFile: null,\n useAutoSizing: false\n };\n },\n\n\n computed: {\n outputWidth: function outputWidth() {\n var w = this.useAutoSizing ? this.realWidth : this.width;\n return w * this.quality;\n },\n outputHeight: function outputHeight() {\n var h = this.useAutoSizing ? this.realHeight : this.height;\n return h * this.quality;\n },\n computedPlaceholderFontSize: function computedPlaceholderFontSize() {\n return this.placeholderFontSize * this.quality;\n },\n aspectRatio: function aspectRatio() {\n return this.naturalWidth / this.naturalHeight;\n },\n loadingStyle: function loadingStyle() {\n return {\n width: this.loadingSize + 'px',\n height: this.loadingSize + 'px',\n right: '15px',\n bottom: '10px'\n };\n }\n },\n\n mounted: function mounted() {\n var _this = this;\n\n this._initialize();\n u.rAFPolyfill();\n u.toBlobPolyfill();\n\n var supports = this.supportDetection();\n if (!supports.basic) {\n console.warn('Your browser does not support vue-croppa functionality.');\n }\n\n if (this.passive) {\n this.$watch('value._data', function (data) {\n var set$$1 = false;\n if (!data) return;\n for (var key in data) {\n if (syncData.indexOf(key) >= 0) {\n var val = data[key];\n if (val !== _this[key]) {\n _this.$set(_this, key, val);\n set$$1 = true;\n }\n }\n }\n if (set$$1) {\n if (!_this.img) {\n _this.remove();\n } else {\n _this.$nextTick(function () {\n _this._draw();\n });\n }\n }\n }, {\n deep: true\n });\n }\n\n this.useAutoSizing = !!(this.autoSizing && this.$refs.wrapper && getComputedStyle);\n if (this.useAutoSizing) {\n this._autoSizingInit();\n }\n },\n beforeDestroy: function beforeDestroy() {\n if (this.useAutoSizing) {\n this._autoSizingRemove();\n }\n },\n\n\n watch: {\n outputWidth: function outputWidth() {\n this.onDimensionChange();\n },\n outputHeight: function outputHeight() {\n this.onDimensionChange();\n },\n canvasColor: function canvasColor() {\n if (!this.img) {\n this._setPlaceholders();\n } else {\n this._draw();\n }\n },\n imageBorderRadius: function imageBorderRadius() {\n if (this.img) {\n this._draw();\n }\n },\n placeholder: function placeholder() {\n if (!this.img) {\n this._setPlaceholders();\n }\n },\n placeholderColor: function placeholderColor() {\n if (!this.img) {\n this._setPlaceholders();\n }\n },\n computedPlaceholderFontSize: function computedPlaceholderFontSize() {\n if (!this.img) {\n this._setPlaceholders();\n }\n },\n preventWhiteSpace: function preventWhiteSpace(val) {\n if (val) {\n this.imageSet = false;\n }\n this._placeImage();\n },\n scaleRatio: function scaleRatio(val, oldVal) {\n if (this.passive) return;\n if (!this.img) return;\n if (!u.numberValid(val)) return;\n\n var x = 1;\n if (u.numberValid(oldVal) && oldVal !== 0) {\n x = val / oldVal;\n }\n var pos = this.currentPointerCoord || {\n x: this.imgData.startX + this.imgData.width / 2,\n y: this.imgData.startY + this.imgData.height / 2\n };\n this.imgData.width = this.naturalWidth * val;\n this.imgData.height = this.naturalHeight * val;\n\n if (!this.userMetadata && this.imageSet && !this.rotating) {\n var offsetX = (x - 1) * (pos.x - this.imgData.startX);\n var offsetY = (x - 1) * (pos.y - this.imgData.startY);\n this.imgData.startX = this.imgData.startX - offsetX;\n this.imgData.startY = this.imgData.startY - offsetY;\n }\n\n if (this.preventWhiteSpace) {\n this._preventZoomingToWhiteSpace();\n this._preventMovingToWhiteSpace();\n }\n },\n\n 'imgData.width': function imgDataWidth(val, oldVal) {\n // if (this.passive) return\n if (!u.numberValid(val)) return;\n this.scaleRatio = val / this.naturalWidth;\n if (this.hasImage()) {\n if (Math.abs(val - oldVal) > val * (1 / 100000)) {\n this.emitEvent(events.ZOOM_EVENT);\n this._draw();\n }\n }\n },\n 'imgData.height': function imgDataHeight(val) {\n // if (this.passive) return\n if (!u.numberValid(val)) return;\n this.scaleRatio = val / this.naturalHeight;\n },\n 'imgData.startX': function imgDataStartX(val) {\n // if (this.passive) return\n if (this.hasImage()) {\n this.$nextTick(this._draw);\n }\n },\n 'imgData.startY': function imgDataStartY(val) {\n // if (this.passive) return\n if (this.hasImage()) {\n this.$nextTick(this._draw);\n }\n },\n loading: function loading(val) {\n if (this.passive) return;\n if (val) {\n this.emitEvent(events.LOADING_START_EVENT);\n } else {\n this.emitEvent(events.LOADING_END_EVENT);\n }\n },\n autoSizing: function autoSizing(val) {\n this.useAutoSizing = !!(this.autoSizing && this.$refs.wrapper && getComputedStyle);\n if (val) {\n this._autoSizingInit();\n } else {\n this._autoSizingRemove();\n }\n }\n },\n\n methods: {\n emitEvent: function emitEvent() {\n // console.log(args[0])\n this.$emit.apply(this, arguments);\n },\n getCanvas: function getCanvas() {\n return this.canvas;\n },\n getContext: function getContext() {\n return this.ctx;\n },\n getChosenFile: function getChosenFile() {\n return this.chosenFile || this.$refs.fileInput.files[0];\n },\n move: function move(offset) {\n if (!offset || this.passive) return;\n var oldX = this.imgData.startX;\n var oldY = this.imgData.startY;\n this.imgData.startX += offset.x;\n this.imgData.startY += offset.y;\n if (this.preventWhiteSpace) {\n this._preventMovingToWhiteSpace();\n }\n if (this.imgData.startX !== oldX || this.imgData.startY !== oldY) {\n this.emitEvent(events.MOVE_EVENT);\n this._draw();\n }\n },\n moveUpwards: function moveUpwards() {\n var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n\n this.move({ x: 0, y: -amount });\n },\n moveDownwards: function moveDownwards() {\n var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n\n this.move({ x: 0, y: amount });\n },\n moveLeftwards: function moveLeftwards() {\n var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n\n this.move({ x: -amount, y: 0 });\n },\n moveRightwards: function moveRightwards() {\n var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n\n this.move({ x: amount, y: 0 });\n },\n zoom: function zoom() {\n var zoomIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n var acceleration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n\n if (this.passive) return;\n var realSpeed = this.zoomSpeed * acceleration;\n var speed = this.outputWidth * PCT_PER_ZOOM * realSpeed;\n var x = 1;\n if (zoomIn) {\n x = 1 + speed;\n } else if (this.imgData.width > MIN_WIDTH) {\n x = 1 - speed;\n }\n\n this.scaleRatio *= x;\n },\n zoomIn: function zoomIn() {\n this.zoom(true);\n },\n zoomOut: function zoomOut() {\n this.zoom(false);\n },\n rotate: function rotate() {\n var step = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n\n if (this.disableRotation || this.disabled || this.passive) return;\n step = parseInt(step);\n if (isNaN(step) || step > 3 || step < -3) {\n console.warn('Invalid argument for rotate() method. It should one of the integers from -3 to 3.');\n step = 1;\n }\n this._rotateByStep(step);\n },\n flipX: function flipX() {\n if (this.disableRotation || this.disabled || this.passive) return;\n this._setOrientation(2);\n },\n flipY: function flipY() {\n if (this.disableRotation || this.disabled || this.passive) return;\n this._setOrientation(4);\n },\n refresh: function refresh() {\n this.$nextTick(this._initialize);\n },\n hasImage: function hasImage() {\n return !!this.imageSet;\n },\n applyMetadata: function applyMetadata(metadata) {\n if (!metadata || this.passive) return;\n this.userMetadata = metadata;\n var ori = metadata.orientation || this.orientation || 1;\n this._setOrientation(ori, true);\n },\n generateDataUrl: function generateDataUrl(type, compressionRate) {\n if (!this.hasImage()) return '';\n return this.canvas.toDataURL(type, compressionRate);\n },\n generateBlob: function generateBlob(callback, mimeType, qualityArgument) {\n if (!this.hasImage()) {\n callback(null);\n return;\n }\n this.canvas.toBlob(callback, mimeType, qualityArgument);\n },\n promisedBlob: function promisedBlob() {\n var _this2 = this;\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (typeof Promise == 'undefined') {\n console.warn('No Promise support. Please add Promise polyfill if you want to use this method.');\n return;\n }\n return new Promise(function (resolve, reject) {\n try {\n _this2.generateBlob.apply(_this2, [function (blob) {\n resolve(blob);\n }].concat(args));\n } catch (err) {\n reject(err);\n }\n });\n },\n getMetadata: function getMetadata() {\n if (!this.hasImage()) return {};\n var _imgData = this.imgData,\n startX = _imgData.startX,\n startY = _imgData.startY;\n\n\n return {\n startX: startX,\n startY: startY,\n scale: this.scaleRatio,\n orientation: this.orientation\n };\n },\n supportDetection: function supportDetection() {\n if (typeof window === 'undefined') return;\n var div = document.createElement('div');\n return {\n 'basic': window.requestAnimationFrame && window.File && window.FileReader && window.FileList && window.Blob,\n 'dnd': 'ondragstart' in div && 'ondrop' in div\n };\n },\n chooseFile: function chooseFile() {\n if (this.passive) return;\n this.$refs.fileInput.click();\n },\n remove: function remove() {\n if (!this.imageSet) return;\n this._setPlaceholders();\n\n var hadImage = this.img != null;\n this.originalImage = null;\n this.img = null;\n this.$refs.fileInput.value = '';\n this.imgData = {\n width: 0,\n height: 0,\n startX: 0,\n startY: 0\n };\n this.orientation = 1;\n this.scaleRatio = null;\n this.userMetadata = null;\n this.imageSet = false;\n this.chosenFile = null;\n if (this.video) {\n this.video.pause();\n this.video = null;\n }\n\n if (hadImage) {\n this.emitEvent(events.IMAGE_REMOVE_EVENT);\n }\n },\n addClipPlugin: function addClipPlugin(plugin) {\n if (!this.clipPlugins) {\n this.clipPlugins = [];\n }\n if (typeof plugin === 'function' && this.clipPlugins.indexOf(plugin) < 0) {\n this.clipPlugins.push(plugin);\n } else {\n throw Error('Clip plugins should be functions');\n }\n },\n emitNativeEvent: function emitNativeEvent(evt) {\n this.emitEvent(evt.type, evt);\n },\n _setContainerSize: function _setContainerSize() {\n if (this.useAutoSizing) {\n this.realWidth = +getComputedStyle(this.$refs.wrapper).width.slice(0, -2);\n this.realHeight = +getComputedStyle(this.$refs.wrapper).height.slice(0, -2);\n }\n },\n _autoSizingInit: function _autoSizingInit() {\n this._setContainerSize();\n window.addEventListener('resize', this._setContainerSize);\n },\n _autoSizingRemove: function _autoSizingRemove() {\n this._setContainerSize();\n window.removeEventListener('resize', this._setContainerSize);\n },\n _initialize: function _initialize() {\n this.canvas = this.$refs.canvas;\n this._setSize();\n this.canvas.style.backgroundColor = !this.canvasColor || this.canvasColor == 'default' ? 'transparent' : typeof this.canvasColor === 'string' ? this.canvasColor : '';\n this.ctx = this.canvas.getContext('2d');\n this.ctx.imageSmoothingEnabled = true;\n this.ctx.imageSmoothingQuality = \"high\";\n this.ctx.webkitImageSmoothingEnabled = true;\n this.ctx.msImageSmoothingEnabled = true;\n this.ctx.imageSmoothingEnabled = true;\n this.originalImage = null;\n this.img = null;\n this.$refs.fileInput.value = '';\n this.imageSet = false;\n this.chosenFile = null;\n this._setInitial();\n if (!this.passive) {\n this.emitEvent(events.INIT_EVENT, this);\n }\n },\n _setSize: function _setSize() {\n this.canvas.width = this.outputWidth;\n this.canvas.height = this.outputHeight;\n this.canvas.style.width = (this.useAutoSizing ? this.realWidth : this.width) + 'px';\n this.canvas.style.height = (this.useAutoSizing ? this.realHeight : this.height) + 'px';\n },\n _rotateByStep: function _rotateByStep(step) {\n var orientation = 1;\n switch (step) {\n case 1:\n orientation = 6;\n break;\n case 2:\n orientation = 3;\n break;\n case 3:\n orientation = 8;\n break;\n case -1:\n orientation = 8;\n break;\n case -2:\n orientation = 3;\n break;\n case -3:\n orientation = 6;\n break;\n }\n this._setOrientation(orientation);\n },\n _setImagePlaceholder: function _setImagePlaceholder() {\n var _this3 = this;\n\n var img = void 0;\n if (this.$slots.placeholder && this.$slots.placeholder[0]) {\n var vNode = this.$slots.placeholder[0];\n var tag = vNode.tag,\n elm = vNode.elm;\n\n if (tag == 'img' && elm) {\n img = elm;\n }\n }\n\n if (!img) return;\n\n var onLoad = function onLoad() {\n _this3.ctx.drawImage(img, 0, 0, _this3.outputWidth, _this3.outputHeight);\n };\n\n if (u.imageLoaded(img)) {\n onLoad();\n } else {\n img.onload = onLoad;\n }\n },\n _setTextPlaceholder: function _setTextPlaceholder() {\n var ctx = this.ctx;\n ctx.textBaseline = 'middle';\n ctx.textAlign = 'center';\n var defaultFontSize = this.outputWidth * DEFAULT_PLACEHOLDER_TAKEUP / this.placeholder.length;\n var fontSize = !this.computedPlaceholderFontSize || this.computedPlaceholderFontSize == 0 ? defaultFontSize : this.computedPlaceholderFontSize;\n ctx.font = fontSize + 'px sans-serif';\n ctx.fillStyle = !this.placeholderColor || this.placeholderColor == 'default' ? '#606060' : this.placeholderColor;\n ctx.fillText(this.placeholder, this.outputWidth / 2, this.outputHeight / 2);\n },\n _setPlaceholders: function _setPlaceholders() {\n this._paintBackground();\n this._setImagePlaceholder();\n this._setTextPlaceholder();\n },\n _setInitial: function _setInitial() {\n var _this4 = this;\n\n var src = void 0,\n img = void 0;\n if (this.$slots.initial && this.$slots.initial[0]) {\n var vNode = this.$slots.initial[0];\n var tag = vNode.tag,\n elm = vNode.elm;\n\n if (tag == 'img' && elm) {\n img = elm;\n }\n }\n if (this.initialImage && typeof this.initialImage === 'string') {\n src = this.initialImage;\n img = new Image();\n if (!/^data:/.test(src) && !/^blob:/.test(src)) {\n img.setAttribute('crossOrigin', 'anonymous');\n }\n img.src = src;\n } else if (_typeof(this.initialImage) === 'object' && this.initialImage instanceof Image) {\n img = this.initialImage;\n }\n if (!src && !img) {\n this._setPlaceholders();\n return;\n }\n this.currentIsInitial = true;\n if (u.imageLoaded(img)) {\n // this.emitEvent(events.INITIAL_IMAGE_LOADED_EVENT)\n this._onload(img, +img.dataset['exifOrientation'], true);\n } else {\n this.loading = true;\n img.onload = function () {\n // this.emitEvent(events.INITIAL_IMAGE_LOADED_EVENT)\n _this4._onload(img, +img.dataset['exifOrientation'], true);\n };\n\n img.onerror = function () {\n _this4._setPlaceholders();\n };\n }\n },\n _onload: function _onload(img) {\n var orientation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var initial = arguments[2];\n\n if (this.imageSet) {\n this.remove();\n }\n this.originalImage = img;\n this.img = img;\n\n if (isNaN(orientation)) {\n orientation = 1;\n }\n\n this._setOrientation(orientation);\n\n if (initial) {\n this.emitEvent(events.INITIAL_IMAGE_LOADED_EVENT);\n }\n },\n _onVideoLoad: function _onVideoLoad(video, initial) {\n var _this5 = this;\n\n this.video = video;\n var canvas = document.createElement('canvas');\n var videoWidth = video.videoWidth,\n videoHeight = video.videoHeight;\n\n canvas.width = videoWidth;\n canvas.height = videoHeight;\n var ctx = canvas.getContext('2d');\n this.loading = false;\n var drawFrame = function drawFrame(initial) {\n if (!_this5.video) return;\n ctx.drawImage(_this5.video, 0, 0, videoWidth, videoHeight);\n var frame = new Image();\n frame.src = canvas.toDataURL();\n frame.onload = function () {\n _this5.img = frame;\n // this._placeImage()\n if (initial) {\n _this5._placeImage();\n } else {\n _this5._draw();\n }\n };\n };\n drawFrame(true);\n var keepDrawing = function keepDrawing() {\n _this5.$nextTick(function () {\n drawFrame();\n if (!_this5.video || _this5.video.ended || _this5.video.paused) return;\n requestAnimationFrame(keepDrawing);\n });\n };\n this.video.addEventListener('play', function () {\n requestAnimationFrame(keepDrawing);\n });\n },\n _handleClick: function _handleClick(evt) {\n this.emitNativeEvent(evt);\n if (!this.hasImage() && !this.disableClickToChoose && !this.disabled && !this.supportTouch && !this.passive) {\n this.chooseFile();\n }\n },\n _handleDblClick: function _handleDblClick(evt) {\n this.emitNativeEvent(evt);\n if (this.videoEnabled && this.video) {\n if (this.video.paused || this.video.ended) {\n this.video.play();\n } else {\n this.video.pause();\n }\n return;\n }\n },\n _handleInputChange: function _handleInputChange() {\n var input = this.$refs.fileInput;\n if (!input.files.length || this.passive) return;\n\n var file = input.files[0];\n this._onNewFileIn(file);\n },\n _onNewFileIn: function _onNewFileIn(file) {\n var _this6 = this;\n\n this.currentIsInitial = false;\n this.loading = true;\n this.emitEvent(events.FILE_CHOOSE_EVENT, file);\n this.chosenFile = file;\n if (!this._fileSizeIsValid(file)) {\n this.loading = false;\n this.emitEvent(events.FILE_SIZE_EXCEED_EVENT, file);\n return false;\n }\n if (!this._fileTypeIsValid(file)) {\n this.loading = false;\n this.emitEvent(events.FILE_TYPE_MISMATCH_EVENT, file);\n var type = file.type || file.name.toLowerCase().split('.').pop();\n return false;\n }\n\n if (typeof window !== 'undefined' && typeof window.FileReader !== 'undefined') {\n var fr = new FileReader();\n fr.onload = function (e) {\n var fileData = e.target.result;\n var base64 = u.parseDataUrl(fileData);\n var isVideo = /^video/.test(file.type);\n if (isVideo) {\n var video = document.createElement('video');\n video.src = fileData;\n fileData = null;\n if (video.readyState >= video.HAVE_FUTURE_DATA) {\n _this6._onVideoLoad(video);\n } else {\n video.addEventListener('canplay', function () {\n console.log('can play event');\n _this6._onVideoLoad(video);\n }, false);\n }\n } else {\n var orientation = 1;\n try {\n orientation = u.getFileOrientation(u.base64ToArrayBuffer(base64));\n } catch (err) {}\n if (orientation < 1) orientation = 1;\n var img = new Image();\n img.src = fileData;\n fileData = null;\n img.onload = function () {\n _this6._onload(img, orientation);\n _this6.emitEvent(events.NEW_IMAGE_EVENT);\n };\n }\n };\n fr.readAsDataURL(file);\n }\n },\n _fileSizeIsValid: function _fileSizeIsValid(file) {\n if (!file) return false;\n if (!this.fileSizeLimit || this.fileSizeLimit == 0) return true;\n\n return file.size < this.fileSizeLimit;\n },\n _fileTypeIsValid: function _fileTypeIsValid(file) {\n var acceptableMimeType = this.videoEnabled && /^video/.test(file.type) && document.createElement('video').canPlayType(file.type) || /^image/.test(file.type);\n if (!acceptableMimeType) return false;\n if (!this.accept) return true;\n var accept = this.accept;\n var baseMimetype = accept.replace(/\\/.*$/, '');\n var types = accept.split(',');\n for (var i = 0, len = types.length; i < len; i++) {\n var type = types[i];\n var t = type.trim();\n if (t.charAt(0) == '.') {\n if (file.name.toLowerCase().split('.').pop() === t.toLowerCase().slice(1)) return true;\n } else if (/\\/\\*$/.test(t)) {\n var fileBaseType = file.type.replace(/\\/.*$/, '');\n if (fileBaseType === baseMimetype) {\n return true;\n }\n } else if (file.type === type) {\n return true;\n }\n }\n\n return false;\n },\n _placeImage: function _placeImage(applyMetadata) {\n if (!this.img) return;\n var imgData = this.imgData;\n\n this.naturalWidth = this.img.naturalWidth;\n this.naturalHeight = this.img.naturalHeight;\n\n imgData.startX = u.numberValid(imgData.startX) ? imgData.startX : 0;\n imgData.startY = u.numberValid(imgData.startY) ? imgData.startY : 0;\n\n if (this.preventWhiteSpace) {\n this._aspectFill();\n } else if (!this.imageSet) {\n if (this.initialSize == 'contain') {\n this._aspectFit();\n } else if (this.initialSize == 'natural') {\n this._naturalSize();\n } else {\n this._aspectFill();\n }\n } else {\n this.imgData.width = this.naturalWidth * this.scaleRatio;\n this.imgData.height = this.naturalHeight * this.scaleRatio;\n }\n\n if (!this.imageSet) {\n if (/top/.test(this.initialPosition)) {\n imgData.startY = 0;\n } else if (/bottom/.test(this.initialPosition)) {\n imgData.startY = this.outputHeight - imgData.height;\n }\n\n if (/left/.test(this.initialPosition)) {\n imgData.startX = 0;\n } else if (/right/.test(this.initialPosition)) {\n imgData.startX = this.outputWidth - imgData.width;\n }\n\n if (/^-?\\d+% -?\\d+%$/.test(this.initialPosition)) {\n var result = /^(-?\\d+)% (-?\\d+)%$/.exec(this.initialPosition);\n var x = +result[1] / 100;\n var y = +result[2] / 100;\n imgData.startX = x * (this.outputWidth - imgData.width);\n imgData.startY = y * (this.outputHeight - imgData.height);\n }\n }\n\n applyMetadata && this._applyMetadata();\n\n if (applyMetadata && this.preventWhiteSpace) {\n this.zoom(false, 0);\n } else {\n this.move({ x: 0, y: 0 });\n this._draw();\n }\n },\n _aspectFill: function _aspectFill() {\n var imgWidth = this.naturalWidth;\n var imgHeight = this.naturalHeight;\n var canvasRatio = this.outputWidth / this.outputHeight;\n var scaleRatio = void 0;\n\n if (this.aspectRatio > canvasRatio) {\n scaleRatio = imgHeight / this.outputHeight;\n this.imgData.width = imgWidth / scaleRatio;\n this.imgData.height = this.outputHeight;\n this.imgData.startX = -(this.imgData.width - this.outputWidth) / 2;\n this.imgData.startY = 0;\n } else {\n scaleRatio = imgWidth / this.outputWidth;\n this.imgData.height = imgHeight / scaleRatio;\n this.imgData.width = this.outputWidth;\n this.imgData.startY = -(this.imgData.height - this.outputHeight) / 2;\n this.imgData.startX = 0;\n }\n },\n _aspectFit: function _aspectFit() {\n var imgWidth = this.naturalWidth;\n var imgHeight = this.naturalHeight;\n var canvasRatio = this.outputWidth / this.outputHeight;\n var scaleRatio = void 0;\n if (this.aspectRatio > canvasRatio) {\n scaleRatio = imgWidth / this.outputWidth;\n this.imgData.height = imgHeight / scaleRatio;\n this.imgData.width = this.outputWidth;\n this.imgData.startY = -(this.imgData.height - this.outputHeight) / 2;\n this.imgData.startX = 0;\n } else {\n scaleRatio = imgHeight / this.outputHeight;\n this.imgData.width = imgWidth / scaleRatio;\n this.imgData.height = this.outputHeight;\n this.imgData.startX = -(this.imgData.width - this.outputWidth) / 2;\n this.imgData.startY = 0;\n }\n },\n _naturalSize: function _naturalSize() {\n var imgWidth = this.naturalWidth;\n var imgHeight = this.naturalHeight;\n this.imgData.width = imgWidth;\n this.imgData.height = imgHeight;\n this.imgData.startX = -(this.imgData.width - this.outputWidth) / 2;\n this.imgData.startY = -(this.imgData.height - this.outputHeight) / 2;\n },\n _handlePointerStart: function _handlePointerStart(evt) {\n this.emitNativeEvent(evt);\n if (this.passive) return;\n this.supportTouch = true;\n this.pointerMoved = false;\n var pointerCoord = u.getPointerCoords(evt, this);\n this.pointerStartCoord = pointerCoord;\n\n if (this.disabled) return;\n // simulate click with touch on mobile devices\n if (!this.hasImage() && !this.disableClickToChoose) {\n this.tabStart = new Date().valueOf();\n return;\n }\n // ignore mouse right click and middle click\n if (evt.which && evt.which > 1) return;\n\n if (!evt.touches || evt.touches.length === 1) {\n this.dragging = true;\n this.pinching = false;\n var coord = u.getPointerCoords(evt, this);\n this.lastMovingCoord = coord;\n }\n\n if (evt.touches && evt.touches.length === 2 && !this.disablePinchToZoom) {\n this.dragging = false;\n this.pinching = true;\n this.pinchDistance = u.getPinchDistance(evt, this);\n }\n\n var cancelEvents = ['mouseup', 'touchend', 'touchcancel', 'pointerend', 'pointercancel'];\n for (var i = 0, len = cancelEvents.length; i < len; i++) {\n var e = cancelEvents[i];\n document.addEventListener(e, this._handlePointerEnd);\n }\n },\n _handlePointerEnd: function _handlePointerEnd(evt) {\n this.emitNativeEvent(evt);\n if (this.passive) return;\n var pointerMoveDistance = 0;\n if (this.pointerStartCoord) {\n var pointerCoord = u.getPointerCoords(evt, this);\n pointerMoveDistance = Math.sqrt(Math.pow(pointerCoord.x - this.pointerStartCoord.x, 2) + Math.pow(pointerCoord.y - this.pointerStartCoord.y, 2)) || 0;\n }\n if (this.disabled) return;\n if (!this.hasImage() && !this.disableClickToChoose) {\n var tabEnd = new Date().valueOf();\n if (pointerMoveDistance < CLICK_MOVE_THRESHOLD && tabEnd - this.tabStart < MIN_MS_PER_CLICK && this.supportTouch) {\n this.chooseFile();\n }\n this.tabStart = 0;\n return;\n }\n\n this.dragging = false;\n this.pinching = false;\n this.pinchDistance = 0;\n this.lastMovingCoord = null;\n this.pointerMoved = false;\n this.pointerStartCoord = null;\n },\n _handlePointerMove: function _handlePointerMove(evt) {\n this.emitNativeEvent(evt);\n if (this.passive) return;\n this.pointerMoved = true;\n if (!this.hasImage()) return;\n var coord = u.getPointerCoords(evt, this);\n this.currentPointerCoord = coord;\n\n if (this.disabled || this.disableDragToMove) return;\n\n evt.preventDefault();\n if (!evt.touches || evt.touches.length === 1) {\n if (!this.dragging) return;\n if (this.lastMovingCoord) {\n this.move({\n x: coord.x - this.lastMovingCoord.x,\n y: coord.y - this.lastMovingCoord.y\n });\n }\n this.lastMovingCoord = coord;\n }\n\n if (evt.touches && evt.touches.length === 2 && !this.disablePinchToZoom) {\n if (!this.pinching) return;\n var distance = u.getPinchDistance(evt, this);\n var delta = distance - this.pinchDistance;\n this.zoom(delta > 0, PINCH_ACCELERATION);\n this.pinchDistance = distance;\n }\n },\n _handlePointerLeave: function _handlePointerLeave(evt) {\n this.emitNativeEvent(evt);\n if (this.passive) return;\n this.currentPointerCoord = null;\n },\n _handleWheel: function _handleWheel(evt) {\n var _this7 = this;\n\n this.emitNativeEvent(evt);\n if (this.passive) return;\n if (this.disabled || this.disableScrollToZoom || !this.hasImage()) return;\n evt.preventDefault();\n this.scrolling = true;\n if (evt.wheelDelta < 0 || evt.deltaY > 0 || evt.detail > 0) {\n this.zoom(this.reverseScrollToZoom);\n } else if (evt.wheelDelta > 0 || evt.deltaY < 0 || evt.detail < 0) {\n this.zoom(!this.reverseScrollToZoom);\n }\n this.$nextTick(function () {\n _this7.scrolling = false;\n });\n },\n _handleDragEnter: function _handleDragEnter(evt) {\n this.emitNativeEvent(evt);\n if (this.passive) return;\n if (this.disabled || this.disableDragAndDrop || !u.eventHasFile(evt)) return;\n if (this.hasImage() && !this.replaceDrop) return;\n this.fileDraggedOver = true;\n },\n _handleDragLeave: function _handleDragLeave(evt) {\n this.emitNativeEvent(evt);\n if (this.passive) return;\n if (!this.fileDraggedOver || !u.eventHasFile(evt)) return;\n this.fileDraggedOver = false;\n },\n _handleDragOver: function _handleDragOver(evt) {\n this.emitNativeEvent(evt);\n },\n _handleDrop: function _handleDrop(evt) {\n this.emitNativeEvent(evt);\n if (this.passive) return;\n if (!this.fileDraggedOver || !u.eventHasFile(evt)) return;\n if (this.hasImage() && !this.replaceDrop) {\n return;\n }\n this.fileDraggedOver = false;\n\n var file = void 0;\n var dt = evt.dataTransfer;\n if (!dt) return;\n if (dt.items) {\n for (var i = 0, len = dt.items.length; i < len; i++) {\n var item = dt.items[i];\n if (item.kind == 'file') {\n file = item.getAsFile();\n break;\n }\n }\n } else {\n file = dt.files[0];\n }\n\n if (file) {\n this._onNewFileIn(file);\n }\n },\n _preventMovingToWhiteSpace: function _preventMovingToWhiteSpace() {\n if (this.imgData.startX > 0) {\n this.imgData.startX = 0;\n }\n if (this.imgData.startY > 0) {\n this.imgData.startY = 0;\n }\n if (this.outputWidth - this.imgData.startX > this.imgData.width) {\n this.imgData.startX = -(this.imgData.width - this.outputWidth);\n }\n if (this.outputHeight - this.imgData.startY > this.imgData.height) {\n this.imgData.startY = -(this.imgData.height - this.outputHeight);\n }\n },\n _preventZoomingToWhiteSpace: function _preventZoomingToWhiteSpace() {\n if (this.imgData.width < this.outputWidth) {\n this.scaleRatio = this.outputWidth / this.naturalWidth;\n }\n\n if (this.imgData.height < this.outputHeight) {\n this.scaleRatio = this.outputHeight / this.naturalHeight;\n }\n },\n _setOrientation: function _setOrientation() {\n var _this8 = this;\n\n var orientation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;\n var applyMetadata = arguments[1];\n\n var useOriginal = applyMetadata;\n if (orientation > 1 || useOriginal) {\n if (!this.img) return;\n this.rotating = true;\n // u.getRotatedImageData(useOriginal ? this.originalImage : this.img, orientation)\n var _img = u.getRotatedImage(useOriginal ? this.originalImage : this.img, orientation);\n _img.onload = function () {\n _this8.img = _img;\n _this8._placeImage(applyMetadata);\n };\n } else {\n this._placeImage(applyMetadata);\n }\n\n if (orientation == 2) {\n // flip x\n this.orientation = u.flipX(this.orientation);\n } else if (orientation == 4) {\n // flip y\n this.orientation = u.flipY(this.orientation);\n } else if (orientation == 6) {\n // 90 deg\n this.orientation = u.rotate90(this.orientation);\n } else if (orientation == 3) {\n // 180 deg\n this.orientation = u.rotate90(u.rotate90(this.orientation));\n } else if (orientation == 8) {\n // 270 deg\n this.orientation = u.rotate90(u.rotate90(u.rotate90(this.orientation)));\n } else {\n this.orientation = orientation;\n }\n\n if (useOriginal) {\n this.orientation = orientation;\n }\n },\n _paintBackground: function _paintBackground() {\n var backgroundColor = !this.canvasColor || this.canvasColor == 'default' ? 'transparent' : this.canvasColor;\n this.ctx.fillStyle = backgroundColor;\n this.ctx.clearRect(0, 0, this.outputWidth, this.outputHeight);\n this.ctx.fillRect(0, 0, this.outputWidth, this.outputHeight);\n },\n _draw: function _draw() {\n var _this9 = this;\n\n this.$nextTick(function () {\n if (typeof window !== 'undefined' && window.requestAnimationFrame) {\n requestAnimationFrame(_this9._drawFrame);\n } else {\n _this9._drawFrame();\n }\n });\n },\n _drawFrame: function _drawFrame() {\n if (!this.img) return;\n this.loading = false;\n var ctx = this.ctx;\n var _imgData2 = this.imgData,\n startX = _imgData2.startX,\n startY = _imgData2.startY,\n width = _imgData2.width,\n height = _imgData2.height;\n\n\n this._paintBackground();\n ctx.drawImage(this.img, startX, startY, width, height);\n\n if (this.preventWhiteSpace) {\n this._clip(this._createContainerClipPath);\n // this._clip(this._createImageClipPath)\n }\n\n this.emitEvent(events.DRAW_EVENT, ctx);\n if (!this.imageSet) {\n this.imageSet = true;\n this.emitEvent(events.NEW_IMAGE_DRAWN_EVENT);\n }\n this.rotating = false;\n },\n _clipPathFactory: function _clipPathFactory(x, y, width, height) {\n var ctx = this.ctx;\n var radius = typeof this.imageBorderRadius === 'number' ? this.imageBorderRadius : !isNaN(Number(this.imageBorderRadius)) ? Number(this.imageBorderRadius) : 0;\n ctx.beginPath();\n ctx.moveTo(x + radius, y);\n ctx.lineTo(x + width - radius, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + radius);\n ctx.lineTo(x + width, y + height - radius);\n ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\n ctx.lineTo(x + radius, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - radius);\n ctx.lineTo(x, y + radius);\n ctx.quadraticCurveTo(x, y, x + radius, y);\n ctx.closePath();\n },\n _createContainerClipPath: function _createContainerClipPath() {\n var _this10 = this;\n\n this._clipPathFactory(0, 0, this.outputWidth, this.outputHeight);\n if (this.clipPlugins && this.clipPlugins.length) {\n this.clipPlugins.forEach(function (func) {\n func(_this10.ctx, 0, 0, _this10.outputWidth, _this10.outputHeight);\n });\n }\n },\n\n\n // _createImageClipPath () {\n // let { startX, startY, width, height } = this.imgData\n // let w = width\n // let h = height\n // let x = startX\n // let y = startY\n // if (w < h) {\n // h = this.outputHeight * (width / this.outputWidth)\n // }\n // if (h < w) {\n // w = this.outputWidth * (height / this.outputHeight)\n // x = startX + (width - this.outputWidth) / 2\n // }\n // this._clipPathFactory(x, startY, w, h)\n // },\n\n _clip: function _clip(createPath) {\n var ctx = this.ctx;\n ctx.save();\n ctx.fillStyle = '#fff';\n ctx.globalCompositeOperation = 'destination-in';\n createPath();\n ctx.fill();\n ctx.restore();\n },\n _applyMetadata: function _applyMetadata() {\n var _this11 = this;\n\n if (!this.userMetadata) return;\n var _userMetadata = this.userMetadata,\n startX = _userMetadata.startX,\n startY = _userMetadata.startY,\n scale = _userMetadata.scale;\n\n\n if (u.numberValid(startX)) {\n this.imgData.startX = startX;\n }\n\n if (u.numberValid(startY)) {\n this.imgData.startY = startY;\n }\n\n if (u.numberValid(scale)) {\n this.scaleRatio = scale;\n }\n\n this.$nextTick(function () {\n _this11.userMetadata = null;\n });\n },\n onDimensionChange: function onDimensionChange() {\n if (!this.img) {\n this._initialize();\n } else {\n if (this.preventWhiteSpace) {\n this.imageSet = false;\n }\n this._setSize();\n this._placeImage();\n }\n }\n }\n};\n\n/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nvar objectAssign = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\nvar defaultOptions = {\n componentName: 'croppa'\n};\n\nvar VueCroppa = {\n install: function install(Vue, options) {\n options = objectAssign({}, defaultOptions, options);\n var version = Number(Vue.version.split('.')[0]);\n if (version < 2) {\n throw new Error('vue-croppa supports vue version 2.0 and above. You are using Vue@' + version + '. Please upgrade to the latest version of Vue.');\n }\n var componentName = options.componentName || 'croppa';\n\n // registration\n Vue.component(componentName, component);\n },\n\n component: component\n};\n\nreturn VueCroppa;\n\n})));\n","'use strict';\n\nvar isRegExp = require('./_is-regexp');\nvar anObject = require('./_an-object');\nvar speciesConstructor = require('./_species-constructor');\nvar advanceStringIndex = require('./_advance-string-index');\nvar toLength = require('./_to-length');\nvar callRegExpExec = require('./_regexp-exec-abstract');\nvar regexpExec = require('./_regexp-exec');\nvar fails = require('./_fails');\nvar $min = Math.min;\nvar $push = [].push;\nvar $SPLIT = 'split';\nvar LENGTH = 'length';\nvar LAST_INDEX = 'lastIndex';\nvar MAX_UINT32 = 0xffffffff;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !fails(function () { RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\nrequire('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||\n 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||\n 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||\n '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||\n '.'[$SPLIT](/()()/)[LENGTH] > 1 ||\n ''[$SPLIT](/.?/)[LENGTH]\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(this);\n if (separator === undefined && limit === 0) return [];\n // If `separator` is not a regex, use native split\n if (!isRegExp(separator)) return $split.call(string, separator, limit);\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy[LAST_INDEX];\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));\n lastLength = match[0][LENGTH];\n lastLastIndex = lastIndex;\n if (output[LENGTH] >= splitLimit) break;\n }\n if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop\n }\n if (lastLastIndex === string[LENGTH]) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;\n };\n // Chakra, V8\n } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);\n };\n } else {\n internalSplit = $split;\n }\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = defined(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var C = speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n});\n","'use strict';\n// https://tc39.github.io/proposal-setmap-offrom/\nvar $export = require('./_export');\nvar aFunction = require('./_a-function');\nvar ctx = require('./_ctx');\nvar forOf = require('./_for-of');\n\nmodule.exports = function (COLLECTION) {\n $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {\n var mapFn = arguments[1];\n var mapping, A, n, cb;\n aFunction(this);\n mapping = mapFn !== undefined;\n if (mapping) aFunction(mapFn);\n if (source == undefined) return new this();\n A = [];\n if (mapping) {\n n = 0;\n cb = ctx(mapFn, arguments[2], 2);\n forOf(source, false, function (nextItem) {\n A.push(cb(nextItem, n++));\n });\n } else {\n forOf(source, false, A.push, A);\n }\n return new this(A);\n } });\n};\n","//! moment.js locale configuration\n//! locale : Vietnamese [vi]\n//! author : Bang Nguyen : https://github.com/bangnk\n//! author : Chien Kira : https://github.com/chienkira\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var vi = moment.defineLocale('vi', {\n months: 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split(\n '_'\n ),\n monthsShort:\n 'Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12'.split(\n '_'\n ),\n monthsParseExact: true,\n weekdays: 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split(\n '_'\n ),\n weekdaysShort: 'CN_T2_T3_T4_T5_T6_T7'.split('_'),\n weekdaysMin: 'CN_T2_T3_T4_T5_T6_T7'.split('_'),\n weekdaysParseExact: true,\n meridiemParse: /sa|ch/i,\n isPM: function (input) {\n return /^ch$/i.test(input);\n },\n meridiem: function (hours, minutes, isLower) {\n if (hours < 12) {\n return isLower ? 'sa' : 'SA';\n } else {\n return isLower ? 'ch' : 'CH';\n }\n },\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM [năm] YYYY',\n LLL: 'D MMMM [năm] YYYY HH:mm',\n LLLL: 'dddd, D MMMM [năm] YYYY HH:mm',\n l: 'DD/M/YYYY',\n ll: 'D MMM YYYY',\n lll: 'D MMM YYYY HH:mm',\n llll: 'ddd, D MMM YYYY HH:mm',\n },\n calendar: {\n sameDay: '[Hôm nay lúc] LT',\n nextDay: '[Ngày mai lúc] LT',\n nextWeek: 'dddd [tuần tới lúc] LT',\n lastDay: '[Hôm qua lúc] LT',\n lastWeek: 'dddd [tuần trước lúc] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: '%s tới',\n past: '%s trước',\n s: 'vài giây',\n ss: '%d giây',\n m: 'một phút',\n mm: '%d phút',\n h: 'một giờ',\n hh: '%d giờ',\n d: 'một ngày',\n dd: '%d ngày',\n w: 'một tuần',\n ww: '%d tuần',\n M: 'một tháng',\n MM: '%d tháng',\n y: 'một năm',\n yy: '%d năm',\n },\n dayOfMonthOrdinalParse: /\\d{1,2}/,\n ordinal: function (number) {\n return number;\n },\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 4, // The week that contains Jan 4th is the first week of the year.\n },\n });\n\n return vi;\n\n})));\n","//! moment.js locale configuration\n//! locale : Montenegrin [me]\n//! author : Miodrag Nikač : https://github.com/miodragnikac\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var translator = {\n words: {\n //Different grammatical cases\n ss: ['sekund', 'sekunda', 'sekundi'],\n m: ['jedan minut', 'jednog minuta'],\n mm: ['minut', 'minuta', 'minuta'],\n h: ['jedan sat', 'jednog sata'],\n hh: ['sat', 'sata', 'sati'],\n dd: ['dan', 'dana', 'dana'],\n MM: ['mjesec', 'mjeseca', 'mjeseci'],\n yy: ['godina', 'godine', 'godina'],\n },\n correctGrammaticalCase: function (number, wordKey) {\n return number === 1\n ? wordKey[0]\n : number >= 2 && number <= 4\n ? wordKey[1]\n : wordKey[2];\n },\n translate: function (number, withoutSuffix, key) {\n var wordKey = translator.words[key];\n if (key.length === 1) {\n return withoutSuffix ? wordKey[0] : wordKey[1];\n } else {\n return (\n number +\n ' ' +\n translator.correctGrammaticalCase(number, wordKey)\n );\n }\n },\n };\n\n var me = moment.defineLocale('me', {\n months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(\n '_'\n ),\n monthsShort:\n 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),\n monthsParseExact: true,\n weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(\n '_'\n ),\n weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),\n weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'H:mm',\n LTS: 'H:mm:ss',\n L: 'DD.MM.YYYY',\n LL: 'D. MMMM YYYY',\n LLL: 'D. MMMM YYYY H:mm',\n LLLL: 'dddd, D. MMMM YYYY H:mm',\n },\n calendar: {\n sameDay: '[danas u] LT',\n nextDay: '[sjutra u] LT',\n\n nextWeek: function () {\n switch (this.day()) {\n case 0:\n return '[u] [nedjelju] [u] LT';\n case 3:\n return '[u] [srijedu] [u] LT';\n case 6:\n return '[u] [subotu] [u] LT';\n case 1:\n case 2:\n case 4:\n case 5:\n return '[u] dddd [u] LT';\n }\n },\n lastDay: '[juče u] LT',\n lastWeek: function () {\n var lastWeekDays = [\n '[prošle] [nedjelje] [u] LT',\n '[prošlog] [ponedjeljka] [u] LT',\n '[prošlog] [utorka] [u] LT',\n '[prošle] [srijede] [u] LT',\n '[prošlog] [četvrtka] [u] LT',\n '[prošlog] [petka] [u] LT',\n '[prošle] [subote] [u] LT',\n ];\n return lastWeekDays[this.day()];\n },\n sameElse: 'L',\n },\n relativeTime: {\n future: 'za %s',\n past: 'prije %s',\n s: 'nekoliko sekundi',\n ss: translator.translate,\n m: translator.translate,\n mm: translator.translate,\n h: translator.translate,\n hh: translator.translate,\n d: 'dan',\n dd: translator.translate,\n M: 'mjesec',\n MM: translator.translate,\n y: 'godinu',\n yy: translator.translate,\n },\n dayOfMonthOrdinalParse: /\\d{1,2}\\./,\n ordinal: '%d.',\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 7, // The week that contains Jan 7th is the first week of the year.\n },\n });\n\n return me;\n\n})));\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar $toString = require('./_function-to-string');\nvar TO_STRING = 'toString';\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","/*!\n * Vue.js v2.7.16\n * (c) 2014-2023 Evan You\n * Released under the MIT License.\n */\nvar emptyObject = Object.freeze({});\nvar isArray = Array.isArray;\n// These helpers produce better VM code in JS engines due to their\n// explicitness and function inlining.\nfunction isUndef(v) {\n return v === undefined || v === null;\n}\nfunction isDef(v) {\n return v !== undefined && v !== null;\n}\nfunction isTrue(v) {\n return v === true;\n}\nfunction isFalse(v) {\n return v === false;\n}\n/**\n * Check if value is primitive.\n */\nfunction isPrimitive(value) {\n return (typeof value === 'string' ||\n typeof value === 'number' ||\n // $flow-disable-line\n typeof value === 'symbol' ||\n typeof value === 'boolean');\n}\nfunction isFunction(value) {\n return typeof value === 'function';\n}\n/**\n * Quick object check - this is primarily used to tell\n * objects from primitive values when we know the value\n * is a JSON-compliant type.\n */\nfunction isObject(obj) {\n return obj !== null && typeof obj === 'object';\n}\n/**\n * Get the raw type string of a value, e.g., [object Object].\n */\nvar _toString = Object.prototype.toString;\nfunction toRawType(value) {\n return _toString.call(value).slice(8, -1);\n}\n/**\n * Strict object type check. Only returns true\n * for plain JavaScript objects.\n */\nfunction isPlainObject(obj) {\n return _toString.call(obj) === '[object Object]';\n}\nfunction isRegExp(v) {\n return _toString.call(v) === '[object RegExp]';\n}\n/**\n * Check if val is a valid array index.\n */\nfunction isValidArrayIndex(val) {\n var n = parseFloat(String(val));\n return n >= 0 && Math.floor(n) === n && isFinite(val);\n}\nfunction isPromise(val) {\n return (isDef(val) &&\n typeof val.then === 'function' &&\n typeof val.catch === 'function');\n}\n/**\n * Convert a value to a string that is actually rendered.\n */\nfunction toString(val) {\n return val == null\n ? ''\n : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)\n ? JSON.stringify(val, replacer, 2)\n : String(val);\n}\nfunction replacer(_key, val) {\n // avoid circular deps from v3\n if (val && val.__v_isRef) {\n return val.value;\n }\n return val;\n}\n/**\n * Convert an input value to a number for persistence.\n * If the conversion fails, return original string.\n */\nfunction toNumber(val) {\n var n = parseFloat(val);\n return isNaN(n) ? val : n;\n}\n/**\n * Make a map and return a function for checking if a key\n * is in that map.\n */\nfunction makeMap(str, expectsLowerCase) {\n var map = Object.create(null);\n var list = str.split(',');\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; };\n}\n/**\n * Check if a tag is a built-in tag.\n */\nvar isBuiltInTag = makeMap('slot,component', true);\n/**\n * Check if an attribute is a reserved attribute.\n */\nvar isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');\n/**\n * Remove an item from an array.\n */\nfunction remove$2(arr, item) {\n var len = arr.length;\n if (len) {\n // fast path for the only / last item\n if (item === arr[len - 1]) {\n arr.length = len - 1;\n return;\n }\n var index = arr.indexOf(item);\n if (index > -1) {\n return arr.splice(index, 1);\n }\n }\n}\n/**\n * Check whether an object has the property.\n */\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nfunction hasOwn(obj, key) {\n return hasOwnProperty.call(obj, key);\n}\n/**\n * Create a cached version of a pure function.\n */\nfunction cached(fn) {\n var cache = Object.create(null);\n return function cachedFn(str) {\n var hit = cache[str];\n return hit || (cache[str] = fn(str));\n };\n}\n/**\n * Camelize a hyphen-delimited string.\n */\nvar camelizeRE = /-(\\w)/g;\nvar camelize = cached(function (str) {\n return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });\n});\n/**\n * Capitalize a string.\n */\nvar capitalize = cached(function (str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n});\n/**\n * Hyphenate a camelCase string.\n */\nvar hyphenateRE = /\\B([A-Z])/g;\nvar hyphenate = cached(function (str) {\n return str.replace(hyphenateRE, '-$1').toLowerCase();\n});\n/**\n * Simple bind polyfill for environments that do not support it,\n * e.g., PhantomJS 1.x. Technically, we don't need this anymore\n * since native bind is now performant enough in most browsers.\n * But removing it would mean breaking code that was able to run in\n * PhantomJS 1.x, so this must be kept for backward compatibility.\n */\n/* istanbul ignore next */\nfunction polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx);\n }\n boundFn._length = fn.length;\n return boundFn;\n}\nfunction nativeBind(fn, ctx) {\n return fn.bind(ctx);\n}\n// @ts-expect-error bind cannot be `undefined`\nvar bind = Function.prototype.bind ? nativeBind : polyfillBind;\n/**\n * Convert an Array-like object to a real Array.\n */\nfunction toArray(list, start) {\n start = start || 0;\n var i = list.length - start;\n var ret = new Array(i);\n while (i--) {\n ret[i] = list[i + start];\n }\n return ret;\n}\n/**\n * Mix properties into target object.\n */\nfunction extend(to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to;\n}\n/**\n * Merge an Array of Objects into a single Object.\n */\nfunction toObject(arr) {\n var res = {};\n for (var i = 0; i < arr.length; i++) {\n if (arr[i]) {\n extend(res, arr[i]);\n }\n }\n return res;\n}\n/* eslint-disable no-unused-vars */\n/**\n * Perform no operation.\n * Stubbing args to make Flow happy without leaving useless transpiled code\n * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).\n */\nfunction noop(a, b, c) { }\n/**\n * Always return false.\n */\nvar no = function (a, b, c) { return false; };\n/* eslint-enable no-unused-vars */\n/**\n * Return the same value.\n */\nvar identity = function (_) { return _; };\n/**\n * Check if two values are loosely equal - that is,\n * if they are plain objects, do they have the same shape?\n */\nfunction looseEqual(a, b) {\n if (a === b)\n return true;\n var isObjectA = isObject(a);\n var isObjectB = isObject(b);\n if (isObjectA && isObjectB) {\n try {\n var isArrayA = Array.isArray(a);\n var isArrayB = Array.isArray(b);\n if (isArrayA && isArrayB) {\n return (a.length === b.length &&\n a.every(function (e, i) {\n return looseEqual(e, b[i]);\n }));\n }\n else if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n else if (!isArrayA && !isArrayB) {\n var keysA = Object.keys(a);\n var keysB = Object.keys(b);\n return (keysA.length === keysB.length &&\n keysA.every(function (key) {\n return looseEqual(a[key], b[key]);\n }));\n }\n else {\n /* istanbul ignore next */\n return false;\n }\n }\n catch (e) {\n /* istanbul ignore next */\n return false;\n }\n }\n else if (!isObjectA && !isObjectB) {\n return String(a) === String(b);\n }\n else {\n return false;\n }\n}\n/**\n * Return the first index at which a loosely equal value can be\n * found in the array (if value is a plain object, the array must\n * contain an object of the same shape), or -1 if it is not present.\n */\nfunction looseIndexOf(arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i], val))\n return i;\n }\n return -1;\n}\n/**\n * Ensure a function is called only once.\n */\nfunction once(fn) {\n var called = false;\n return function () {\n if (!called) {\n called = true;\n fn.apply(this, arguments);\n }\n };\n}\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill\nfunction hasChanged(x, y) {\n if (x === y) {\n return x === 0 && 1 / x !== 1 / y;\n }\n else {\n return x === x || y === y;\n }\n}\n\nvar SSR_ATTR = 'data-server-rendered';\nvar ASSET_TYPES = ['component', 'directive', 'filter'];\nvar LIFECYCLE_HOOKS = [\n 'beforeCreate',\n 'created',\n 'beforeMount',\n 'mounted',\n 'beforeUpdate',\n 'updated',\n 'beforeDestroy',\n 'destroyed',\n 'activated',\n 'deactivated',\n 'errorCaptured',\n 'serverPrefetch',\n 'renderTracked',\n 'renderTriggered'\n];\n\nvar config = {\n /**\n * Option merge strategies (used in core/util/options)\n */\n // $flow-disable-line\n optionMergeStrategies: Object.create(null),\n /**\n * Whether to suppress warnings.\n */\n silent: false,\n /**\n * Show production mode tip message on boot?\n */\n productionTip: process.env.NODE_ENV !== 'production',\n /**\n * Whether to enable devtools\n */\n devtools: process.env.NODE_ENV !== 'production',\n /**\n * Whether to record perf\n */\n performance: false,\n /**\n * Error handler for watcher errors\n */\n errorHandler: null,\n /**\n * Warn handler for watcher warns\n */\n warnHandler: null,\n /**\n * Ignore certain custom elements\n */\n ignoredElements: [],\n /**\n * Custom user key aliases for v-on\n */\n // $flow-disable-line\n keyCodes: Object.create(null),\n /**\n * Check if a tag is reserved so that it cannot be registered as a\n * component. This is platform-dependent and may be overwritten.\n */\n isReservedTag: no,\n /**\n * Check if an attribute is reserved so that it cannot be used as a component\n * prop. This is platform-dependent and may be overwritten.\n */\n isReservedAttr: no,\n /**\n * Check if a tag is an unknown element.\n * Platform-dependent.\n */\n isUnknownElement: no,\n /**\n * Get the namespace of an element\n */\n getTagNamespace: noop,\n /**\n * Parse the real tag name for the specific platform.\n */\n parsePlatformTagName: identity,\n /**\n * Check if an attribute must be bound using property, e.g. value\n * Platform-dependent.\n */\n mustUseProp: no,\n /**\n * Perform updates asynchronously. Intended to be used by Vue Test Utils\n * This will significantly reduce performance if set to false.\n */\n async: true,\n /**\n * Exposed for legacy reasons\n */\n _lifecycleHooks: LIFECYCLE_HOOKS\n};\n\n/**\n * unicode letters used for parsing html tags, component names and property paths.\n * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname\n * skipping \\u10000-\\uEFFFF due to it freezing up PhantomJS\n */\nvar unicodeRegExp = /a-zA-Z\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD/;\n/**\n * Check if a string starts with $ or _\n */\nfunction isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5f;\n}\n/**\n * Define a property.\n */\nfunction def(obj, key, val, enumerable) {\n Object.defineProperty(obj, key, {\n value: val,\n enumerable: !!enumerable,\n writable: true,\n configurable: true\n });\n}\n/**\n * Parse simple path.\n */\nvar bailRE = new RegExp(\"[^\".concat(unicodeRegExp.source, \".$_\\\\d]\"));\nfunction parsePath(path) {\n if (bailRE.test(path)) {\n return;\n }\n var segments = path.split('.');\n return function (obj) {\n for (var i = 0; i < segments.length; i++) {\n if (!obj)\n return;\n obj = obj[segments[i]];\n }\n return obj;\n };\n}\n\n// can we use __proto__?\nvar hasProto = '__proto__' in {};\n// Browser environment sniffing\nvar inBrowser = typeof window !== 'undefined';\nvar UA = inBrowser && window.navigator.userAgent.toLowerCase();\nvar isIE = UA && /msie|trident/.test(UA);\nvar isIE9 = UA && UA.indexOf('msie 9.0') > 0;\nvar isEdge = UA && UA.indexOf('edge/') > 0;\nUA && UA.indexOf('android') > 0;\nvar isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);\nUA && /chrome\\/\\d+/.test(UA) && !isEdge;\nUA && /phantomjs/.test(UA);\nvar isFF = UA && UA.match(/firefox\\/(\\d+)/);\n// Firefox has a \"watch\" function on Object.prototype...\n// @ts-expect-error firebox support\nvar nativeWatch = {}.watch;\nvar supportsPassive = false;\nif (inBrowser) {\n try {\n var opts = {};\n Object.defineProperty(opts, 'passive', {\n get: function () {\n /* istanbul ignore next */\n supportsPassive = true;\n }\n }); // https://github.com/facebook/flow/issues/285\n window.addEventListener('test-passive', null, opts);\n }\n catch (e) { }\n}\n// this needs to be lazy-evaled because vue may be required before\n// vue-server-renderer can set VUE_ENV\nvar _isServer;\nvar isServerRendering = function () {\n if (_isServer === undefined) {\n /* istanbul ignore if */\n if (!inBrowser && typeof global !== 'undefined') {\n // detect presence of vue-server-renderer and avoid\n // Webpack shimming the process\n _isServer =\n global['process'] && global['process'].env.VUE_ENV === 'server';\n }\n else {\n _isServer = false;\n }\n }\n return _isServer;\n};\n// detect devtools\nvar devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;\n/* istanbul ignore next */\nfunction isNative(Ctor) {\n return typeof Ctor === 'function' && /native code/.test(Ctor.toString());\n}\nvar hasSymbol = typeof Symbol !== 'undefined' &&\n isNative(Symbol) &&\n typeof Reflect !== 'undefined' &&\n isNative(Reflect.ownKeys);\nvar _Set; // $flow-disable-line\n/* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {\n // use native Set when available.\n _Set = Set;\n}\nelse {\n // a non-standard Set polyfill that only works with primitive keys.\n _Set = /** @class */ (function () {\n function Set() {\n this.set = Object.create(null);\n }\n Set.prototype.has = function (key) {\n return this.set[key] === true;\n };\n Set.prototype.add = function (key) {\n this.set[key] = true;\n };\n Set.prototype.clear = function () {\n this.set = Object.create(null);\n };\n return Set;\n }());\n}\n\nvar currentInstance = null;\n/**\n * This is exposed for compatibility with v3 (e.g. some functions in VueUse\n * relies on it). Do not use this internally, just use `currentInstance`.\n *\n * @internal this function needs manual type declaration because it relies\n * on previously manually authored types from Vue 2\n */\nfunction getCurrentInstance() {\n return currentInstance && { proxy: currentInstance };\n}\n/**\n * @internal\n */\nfunction setCurrentInstance(vm) {\n if (vm === void 0) { vm = null; }\n if (!vm)\n currentInstance && currentInstance._scope.off();\n currentInstance = vm;\n vm && vm._scope.on();\n}\n\n/**\n * @internal\n */\nvar VNode = /** @class */ (function () {\n function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {\n this.tag = tag;\n this.data = data;\n this.children = children;\n this.text = text;\n this.elm = elm;\n this.ns = undefined;\n this.context = context;\n this.fnContext = undefined;\n this.fnOptions = undefined;\n this.fnScopeId = undefined;\n this.key = data && data.key;\n this.componentOptions = componentOptions;\n this.componentInstance = undefined;\n this.parent = undefined;\n this.raw = false;\n this.isStatic = false;\n this.isRootInsert = true;\n this.isComment = false;\n this.isCloned = false;\n this.isOnce = false;\n this.asyncFactory = asyncFactory;\n this.asyncMeta = undefined;\n this.isAsyncPlaceholder = false;\n }\n Object.defineProperty(VNode.prototype, \"child\", {\n // DEPRECATED: alias for componentInstance for backwards compat.\n /* istanbul ignore next */\n get: function () {\n return this.componentInstance;\n },\n enumerable: false,\n configurable: true\n });\n return VNode;\n}());\nvar createEmptyVNode = function (text) {\n if (text === void 0) { text = ''; }\n var node = new VNode();\n node.text = text;\n node.isComment = true;\n return node;\n};\nfunction createTextVNode(val) {\n return new VNode(undefined, undefined, undefined, String(val));\n}\n// optimized shallow clone\n// used for static nodes and slot nodes because they may be reused across\n// multiple renders, cloning them avoids errors when DOM manipulations rely\n// on their elm reference.\nfunction cloneVNode(vnode) {\n var cloned = new VNode(vnode.tag, vnode.data, \n // #7975\n // clone children array to avoid mutating original in case of cloning\n // a child.\n vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);\n cloned.ns = vnode.ns;\n cloned.isStatic = vnode.isStatic;\n cloned.key = vnode.key;\n cloned.isComment = vnode.isComment;\n cloned.fnContext = vnode.fnContext;\n cloned.fnOptions = vnode.fnOptions;\n cloned.fnScopeId = vnode.fnScopeId;\n cloned.asyncMeta = vnode.asyncMeta;\n cloned.isCloned = true;\n return cloned;\n}\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\nvar uid$2 = 0;\nvar pendingCleanupDeps = [];\nvar cleanupDeps = function () {\n for (var i = 0; i < pendingCleanupDeps.length; i++) {\n var dep = pendingCleanupDeps[i];\n dep.subs = dep.subs.filter(function (s) { return s; });\n dep._pending = false;\n }\n pendingCleanupDeps.length = 0;\n};\n/**\n * A dep is an observable that can have multiple\n * directives subscribing to it.\n * @internal\n */\nvar Dep = /** @class */ (function () {\n function Dep() {\n // pending subs cleanup\n this._pending = false;\n this.id = uid$2++;\n this.subs = [];\n }\n Dep.prototype.addSub = function (sub) {\n this.subs.push(sub);\n };\n Dep.prototype.removeSub = function (sub) {\n // #12696 deps with massive amount of subscribers are extremely slow to\n // clean up in Chromium\n // to workaround this, we unset the sub for now, and clear them on\n // next scheduler flush.\n this.subs[this.subs.indexOf(sub)] = null;\n if (!this._pending) {\n this._pending = true;\n pendingCleanupDeps.push(this);\n }\n };\n Dep.prototype.depend = function (info) {\n if (Dep.target) {\n Dep.target.addDep(this);\n if (process.env.NODE_ENV !== 'production' && info && Dep.target.onTrack) {\n Dep.target.onTrack(__assign({ effect: Dep.target }, info));\n }\n }\n };\n Dep.prototype.notify = function (info) {\n // stabilize the subscriber list first\n var subs = this.subs.filter(function (s) { return s; });\n if (process.env.NODE_ENV !== 'production' && !config.async) {\n // subs aren't sorted in scheduler if not running async\n // we need to sort them now to make sure they fire in correct\n // order\n subs.sort(function (a, b) { return a.id - b.id; });\n }\n for (var i = 0, l = subs.length; i < l; i++) {\n var sub = subs[i];\n if (process.env.NODE_ENV !== 'production' && info) {\n sub.onTrigger &&\n sub.onTrigger(__assign({ effect: subs[i] }, info));\n }\n sub.update();\n }\n };\n return Dep;\n}());\n// The current target watcher being evaluated.\n// This is globally unique because only one watcher\n// can be evaluated at a time.\nDep.target = null;\nvar targetStack = [];\nfunction pushTarget(target) {\n targetStack.push(target);\n Dep.target = target;\n}\nfunction popTarget() {\n targetStack.pop();\n Dep.target = targetStack[targetStack.length - 1];\n}\n\n/*\n * not type checking this file because flow doesn't play well with\n * dynamically accessing methods on Array prototype\n */\nvar arrayProto = Array.prototype;\nvar arrayMethods = Object.create(arrayProto);\nvar methodsToPatch = [\n 'push',\n 'pop',\n 'shift',\n 'unshift',\n 'splice',\n 'sort',\n 'reverse'\n];\n/**\n * Intercept mutating methods and emit events\n */\nmethodsToPatch.forEach(function (method) {\n // cache original method\n var original = arrayProto[method];\n def(arrayMethods, method, function mutator() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var result = original.apply(this, args);\n var ob = this.__ob__;\n var inserted;\n switch (method) {\n case 'push':\n case 'unshift':\n inserted = args;\n break;\n case 'splice':\n inserted = args.slice(2);\n break;\n }\n if (inserted)\n ob.observeArray(inserted);\n // notify change\n if (process.env.NODE_ENV !== 'production') {\n ob.dep.notify({\n type: \"array mutation\" /* TriggerOpTypes.ARRAY_MUTATION */,\n target: this,\n key: method\n });\n }\n else {\n ob.dep.notify();\n }\n return result;\n });\n});\n\nvar arrayKeys = Object.getOwnPropertyNames(arrayMethods);\nvar NO_INITIAL_VALUE = {};\n/**\n * In some cases we may want to disable observation inside a component's\n * update computation.\n */\nvar shouldObserve = true;\nfunction toggleObserving(value) {\n shouldObserve = value;\n}\n// ssr mock dep\nvar mockDep = {\n notify: noop,\n depend: noop,\n addSub: noop,\n removeSub: noop\n};\n/**\n * Observer class that is attached to each observed\n * object. Once attached, the observer converts the target\n * object's property keys into getter/setters that\n * collect dependencies and dispatch updates.\n */\nvar Observer = /** @class */ (function () {\n function Observer(value, shallow, mock) {\n if (shallow === void 0) { shallow = false; }\n if (mock === void 0) { mock = false; }\n this.value = value;\n this.shallow = shallow;\n this.mock = mock;\n // this.value = value\n this.dep = mock ? mockDep : new Dep();\n this.vmCount = 0;\n def(value, '__ob__', this);\n if (isArray(value)) {\n if (!mock) {\n if (hasProto) {\n value.__proto__ = arrayMethods;\n /* eslint-enable no-proto */\n }\n else {\n for (var i = 0, l = arrayKeys.length; i < l; i++) {\n var key = arrayKeys[i];\n def(value, key, arrayMethods[key]);\n }\n }\n }\n if (!shallow) {\n this.observeArray(value);\n }\n }\n else {\n /**\n * Walk through all properties and convert them into\n * getter/setters. This method should only be called when\n * value type is Object.\n */\n var keys = Object.keys(value);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);\n }\n }\n }\n /**\n * Observe a list of Array items.\n */\n Observer.prototype.observeArray = function (value) {\n for (var i = 0, l = value.length; i < l; i++) {\n observe(value[i], false, this.mock);\n }\n };\n return Observer;\n}());\n// helpers\n/**\n * Attempt to create an observer instance for a value,\n * returns the new observer if successfully observed,\n * or the existing observer if the value already has one.\n */\nfunction observe(value, shallow, ssrMockReactivity) {\n if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n return value.__ob__;\n }\n if (shouldObserve &&\n (ssrMockReactivity || !isServerRendering()) &&\n (isArray(value) || isPlainObject(value)) &&\n Object.isExtensible(value) &&\n !value.__v_skip /* ReactiveFlags.SKIP */ &&\n !isRef(value) &&\n !(value instanceof VNode)) {\n return new Observer(value, shallow, ssrMockReactivity);\n }\n}\n/**\n * Define a reactive property on an Object.\n */\nfunction defineReactive(obj, key, val, customSetter, shallow, mock, observeEvenIfShallow) {\n if (observeEvenIfShallow === void 0) { observeEvenIfShallow = false; }\n var dep = new Dep();\n var property = Object.getOwnPropertyDescriptor(obj, key);\n if (property && property.configurable === false) {\n return;\n }\n // cater for pre-defined getter/setters\n var getter = property && property.get;\n var setter = property && property.set;\n if ((!getter || setter) &&\n (val === NO_INITIAL_VALUE || arguments.length === 2)) {\n val = obj[key];\n }\n var childOb = shallow ? val && val.__ob__ : observe(val, false, mock);\n Object.defineProperty(obj, key, {\n enumerable: true,\n configurable: true,\n get: function reactiveGetter() {\n var value = getter ? getter.call(obj) : val;\n if (Dep.target) {\n if (process.env.NODE_ENV !== 'production') {\n dep.depend({\n target: obj,\n type: \"get\" /* TrackOpTypes.GET */,\n key: key\n });\n }\n else {\n dep.depend();\n }\n if (childOb) {\n childOb.dep.depend();\n if (isArray(value)) {\n dependArray(value);\n }\n }\n }\n return isRef(value) && !shallow ? value.value : value;\n },\n set: function reactiveSetter(newVal) {\n var value = getter ? getter.call(obj) : val;\n if (!hasChanged(value, newVal)) {\n return;\n }\n if (process.env.NODE_ENV !== 'production' && customSetter) {\n customSetter();\n }\n if (setter) {\n setter.call(obj, newVal);\n }\n else if (getter) {\n // #7981: for accessor properties without setter\n return;\n }\n else if (!shallow && isRef(value) && !isRef(newVal)) {\n value.value = newVal;\n return;\n }\n else {\n val = newVal;\n }\n childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock);\n if (process.env.NODE_ENV !== 'production') {\n dep.notify({\n type: \"set\" /* TriggerOpTypes.SET */,\n target: obj,\n key: key,\n newValue: newVal,\n oldValue: value\n });\n }\n else {\n dep.notify();\n }\n }\n });\n return dep;\n}\nfunction set(target, key, val) {\n if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {\n warn(\"Cannot set reactive property on undefined, null, or primitive value: \".concat(target));\n }\n if (isReadonly(target)) {\n process.env.NODE_ENV !== 'production' && warn(\"Set operation on key \\\"\".concat(key, \"\\\" failed: target is readonly.\"));\n return;\n }\n var ob = target.__ob__;\n if (isArray(target) && isValidArrayIndex(key)) {\n target.length = Math.max(target.length, key);\n target.splice(key, 1, val);\n // when mocking for SSR, array methods are not hijacked\n if (ob && !ob.shallow && ob.mock) {\n observe(val, false, true);\n }\n return val;\n }\n if (key in target && !(key in Object.prototype)) {\n target[key] = val;\n return val;\n }\n if (target._isVue || (ob && ob.vmCount)) {\n process.env.NODE_ENV !== 'production' &&\n warn('Avoid adding reactive properties to a Vue instance or its root $data ' +\n 'at runtime - declare it upfront in the data option.');\n return val;\n }\n if (!ob) {\n target[key] = val;\n return val;\n }\n defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);\n if (process.env.NODE_ENV !== 'production') {\n ob.dep.notify({\n type: \"add\" /* TriggerOpTypes.ADD */,\n target: target,\n key: key,\n newValue: val,\n oldValue: undefined\n });\n }\n else {\n ob.dep.notify();\n }\n return val;\n}\nfunction del(target, key) {\n if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {\n warn(\"Cannot delete reactive property on undefined, null, or primitive value: \".concat(target));\n }\n if (isArray(target) && isValidArrayIndex(key)) {\n target.splice(key, 1);\n return;\n }\n var ob = target.__ob__;\n if (target._isVue || (ob && ob.vmCount)) {\n process.env.NODE_ENV !== 'production' &&\n warn('Avoid deleting properties on a Vue instance or its root $data ' +\n '- just set it to null.');\n return;\n }\n if (isReadonly(target)) {\n process.env.NODE_ENV !== 'production' &&\n warn(\"Delete operation on key \\\"\".concat(key, \"\\\" failed: target is readonly.\"));\n return;\n }\n if (!hasOwn(target, key)) {\n return;\n }\n delete target[key];\n if (!ob) {\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n ob.dep.notify({\n type: \"delete\" /* TriggerOpTypes.DELETE */,\n target: target,\n key: key\n });\n }\n else {\n ob.dep.notify();\n }\n}\n/**\n * Collect dependencies on array elements when the array is touched, since\n * we cannot intercept array element access like property getters.\n */\nfunction dependArray(value) {\n for (var e = void 0, i = 0, l = value.length; i < l; i++) {\n e = value[i];\n if (e && e.__ob__) {\n e.__ob__.dep.depend();\n }\n if (isArray(e)) {\n dependArray(e);\n }\n }\n}\n\nfunction reactive(target) {\n makeReactive(target, false);\n return target;\n}\n/**\n * Return a shallowly-reactive copy of the original object, where only the root\n * level properties are reactive. It also does not auto-unwrap refs (even at the\n * root level).\n */\nfunction shallowReactive(target) {\n makeReactive(target, true);\n def(target, \"__v_isShallow\" /* ReactiveFlags.IS_SHALLOW */, true);\n return target;\n}\nfunction makeReactive(target, shallow) {\n // if trying to observe a readonly proxy, return the readonly version.\n if (!isReadonly(target)) {\n if (process.env.NODE_ENV !== 'production') {\n if (isArray(target)) {\n warn(\"Avoid using Array as root value for \".concat(shallow ? \"shallowReactive()\" : \"reactive()\", \" as it cannot be tracked in watch() or watchEffect(). Use \").concat(shallow ? \"shallowRef()\" : \"ref()\", \" instead. This is a Vue-2-only limitation.\"));\n }\n var existingOb = target && target.__ob__;\n if (existingOb && existingOb.shallow !== shallow) {\n warn(\"Target is already a \".concat(existingOb.shallow ? \"\" : \"non-\", \"shallow reactive object, and cannot be converted to \").concat(shallow ? \"\" : \"non-\", \"shallow.\"));\n }\n }\n var ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);\n if (process.env.NODE_ENV !== 'production' && !ob) {\n if (target == null || isPrimitive(target)) {\n warn(\"value cannot be made reactive: \".concat(String(target)));\n }\n if (isCollectionType(target)) {\n warn(\"Vue 2 does not support reactive collection types such as Map or Set.\");\n }\n }\n }\n}\nfunction isReactive(value) {\n if (isReadonly(value)) {\n return isReactive(value[\"__v_raw\" /* ReactiveFlags.RAW */]);\n }\n return !!(value && value.__ob__);\n}\nfunction isShallow(value) {\n return !!(value && value.__v_isShallow);\n}\nfunction isReadonly(value) {\n return !!(value && value.__v_isReadonly);\n}\nfunction isProxy(value) {\n return isReactive(value) || isReadonly(value);\n}\nfunction toRaw(observed) {\n var raw = observed && observed[\"__v_raw\" /* ReactiveFlags.RAW */];\n return raw ? toRaw(raw) : observed;\n}\nfunction markRaw(value) {\n // non-extensible objects won't be observed anyway\n if (Object.isExtensible(value)) {\n def(value, \"__v_skip\" /* ReactiveFlags.SKIP */, true);\n }\n return value;\n}\n/**\n * @internal\n */\nfunction isCollectionType(value) {\n var type = toRawType(value);\n return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');\n}\n\n/**\n * @internal\n */\nvar RefFlag = \"__v_isRef\";\nfunction isRef(r) {\n return !!(r && r.__v_isRef === true);\n}\nfunction ref$1(value) {\n return createRef(value, false);\n}\nfunction shallowRef(value) {\n return createRef(value, true);\n}\nfunction createRef(rawValue, shallow) {\n if (isRef(rawValue)) {\n return rawValue;\n }\n var ref = {};\n def(ref, RefFlag, true);\n def(ref, \"__v_isShallow\" /* ReactiveFlags.IS_SHALLOW */, shallow);\n def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));\n return ref;\n}\nfunction triggerRef(ref) {\n if (process.env.NODE_ENV !== 'production' && !ref.dep) {\n warn(\"received object is not a triggerable ref.\");\n }\n if (process.env.NODE_ENV !== 'production') {\n ref.dep &&\n ref.dep.notify({\n type: \"set\" /* TriggerOpTypes.SET */,\n target: ref,\n key: 'value'\n });\n }\n else {\n ref.dep && ref.dep.notify();\n }\n}\nfunction unref(ref) {\n return isRef(ref) ? ref.value : ref;\n}\nfunction proxyRefs(objectWithRefs) {\n if (isReactive(objectWithRefs)) {\n return objectWithRefs;\n }\n var proxy = {};\n var keys = Object.keys(objectWithRefs);\n for (var i = 0; i < keys.length; i++) {\n proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);\n }\n return proxy;\n}\nfunction proxyWithRefUnwrap(target, source, key) {\n Object.defineProperty(target, key, {\n enumerable: true,\n configurable: true,\n get: function () {\n var val = source[key];\n if (isRef(val)) {\n return val.value;\n }\n else {\n var ob = val && val.__ob__;\n if (ob)\n ob.dep.depend();\n return val;\n }\n },\n set: function (value) {\n var oldValue = source[key];\n if (isRef(oldValue) && !isRef(value)) {\n oldValue.value = value;\n }\n else {\n source[key] = value;\n }\n }\n });\n}\nfunction customRef(factory) {\n var dep = new Dep();\n var _a = factory(function () {\n if (process.env.NODE_ENV !== 'production') {\n dep.depend({\n target: ref,\n type: \"get\" /* TrackOpTypes.GET */,\n key: 'value'\n });\n }\n else {\n dep.depend();\n }\n }, function () {\n if (process.env.NODE_ENV !== 'production') {\n dep.notify({\n target: ref,\n type: \"set\" /* TriggerOpTypes.SET */,\n key: 'value'\n });\n }\n else {\n dep.notify();\n }\n }), get = _a.get, set = _a.set;\n var ref = {\n get value() {\n return get();\n },\n set value(newVal) {\n set(newVal);\n }\n };\n def(ref, RefFlag, true);\n return ref;\n}\nfunction toRefs(object) {\n if (process.env.NODE_ENV !== 'production' && !isReactive(object)) {\n warn(\"toRefs() expects a reactive object but received a plain one.\");\n }\n var ret = isArray(object) ? new Array(object.length) : {};\n for (var key in object) {\n ret[key] = toRef(object, key);\n }\n return ret;\n}\nfunction toRef(object, key, defaultValue) {\n var val = object[key];\n if (isRef(val)) {\n return val;\n }\n var ref = {\n get value() {\n var val = object[key];\n return val === undefined ? defaultValue : val;\n },\n set value(newVal) {\n object[key] = newVal;\n }\n };\n def(ref, RefFlag, true);\n return ref;\n}\n\nvar rawToReadonlyFlag = \"__v_rawToReadonly\";\nvar rawToShallowReadonlyFlag = \"__v_rawToShallowReadonly\";\nfunction readonly(target) {\n return createReadonly(target, false);\n}\nfunction createReadonly(target, shallow) {\n if (!isPlainObject(target)) {\n if (process.env.NODE_ENV !== 'production') {\n if (isArray(target)) {\n warn(\"Vue 2 does not support readonly arrays.\");\n }\n else if (isCollectionType(target)) {\n warn(\"Vue 2 does not support readonly collection types such as Map or Set.\");\n }\n else {\n warn(\"value cannot be made readonly: \".concat(typeof target));\n }\n }\n return target;\n }\n if (process.env.NODE_ENV !== 'production' && !Object.isExtensible(target)) {\n warn(\"Vue 2 does not support creating readonly proxy for non-extensible object.\");\n }\n // already a readonly object\n if (isReadonly(target)) {\n return target;\n }\n // already has a readonly proxy\n var existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;\n var existingProxy = target[existingFlag];\n if (existingProxy) {\n return existingProxy;\n }\n var proxy = Object.create(Object.getPrototypeOf(target));\n def(target, existingFlag, proxy);\n def(proxy, \"__v_isReadonly\" /* ReactiveFlags.IS_READONLY */, true);\n def(proxy, \"__v_raw\" /* ReactiveFlags.RAW */, target);\n if (isRef(target)) {\n def(proxy, RefFlag, true);\n }\n if (shallow || isShallow(target)) {\n def(proxy, \"__v_isShallow\" /* ReactiveFlags.IS_SHALLOW */, true);\n }\n var keys = Object.keys(target);\n for (var i = 0; i < keys.length; i++) {\n defineReadonlyProperty(proxy, target, keys[i], shallow);\n }\n return proxy;\n}\nfunction defineReadonlyProperty(proxy, target, key, shallow) {\n Object.defineProperty(proxy, key, {\n enumerable: true,\n configurable: true,\n get: function () {\n var val = target[key];\n return shallow || !isPlainObject(val) ? val : readonly(val);\n },\n set: function () {\n process.env.NODE_ENV !== 'production' &&\n warn(\"Set operation on key \\\"\".concat(key, \"\\\" failed: target is readonly.\"));\n }\n });\n}\n/**\n * Returns a reactive-copy of the original object, where only the root level\n * properties are readonly, and does NOT unwrap refs nor recursively convert\n * returned properties.\n * This is used for creating the props proxy object for stateful components.\n */\nfunction shallowReadonly(target) {\n return createReadonly(target, true);\n}\n\nfunction computed(getterOrOptions, debugOptions) {\n var getter;\n var setter;\n var onlyGetter = isFunction(getterOrOptions);\n if (onlyGetter) {\n getter = getterOrOptions;\n setter = process.env.NODE_ENV !== 'production'\n ? function () {\n warn('Write operation failed: computed value is readonly');\n }\n : noop;\n }\n else {\n getter = getterOrOptions.get;\n setter = getterOrOptions.set;\n }\n var watcher = isServerRendering()\n ? null\n : new Watcher(currentInstance, getter, noop, { lazy: true });\n if (process.env.NODE_ENV !== 'production' && watcher && debugOptions) {\n watcher.onTrack = debugOptions.onTrack;\n watcher.onTrigger = debugOptions.onTrigger;\n }\n var ref = {\n // some libs rely on the presence effect for checking computed refs\n // from normal refs, but the implementation doesn't matter\n effect: watcher,\n get value() {\n if (watcher) {\n if (watcher.dirty) {\n watcher.evaluate();\n }\n if (Dep.target) {\n if (process.env.NODE_ENV !== 'production' && Dep.target.onTrack) {\n Dep.target.onTrack({\n effect: Dep.target,\n target: ref,\n type: \"get\" /* TrackOpTypes.GET */,\n key: 'value'\n });\n }\n watcher.depend();\n }\n return watcher.value;\n }\n else {\n return getter();\n }\n },\n set value(newVal) {\n setter(newVal);\n }\n };\n def(ref, RefFlag, true);\n def(ref, \"__v_isReadonly\" /* ReactiveFlags.IS_READONLY */, onlyGetter);\n return ref;\n}\n\nvar WATCHER = \"watcher\";\nvar WATCHER_CB = \"\".concat(WATCHER, \" callback\");\nvar WATCHER_GETTER = \"\".concat(WATCHER, \" getter\");\nvar WATCHER_CLEANUP = \"\".concat(WATCHER, \" cleanup\");\n// Simple effect.\nfunction watchEffect(effect, options) {\n return doWatch(effect, null, options);\n}\nfunction watchPostEffect(effect, options) {\n return doWatch(effect, null, (process.env.NODE_ENV !== 'production'\n ? __assign(__assign({}, options), { flush: 'post' }) : { flush: 'post' }));\n}\nfunction watchSyncEffect(effect, options) {\n return doWatch(effect, null, (process.env.NODE_ENV !== 'production'\n ? __assign(__assign({}, options), { flush: 'sync' }) : { flush: 'sync' }));\n}\n// initial value for watchers to trigger on undefined initial values\nvar INITIAL_WATCHER_VALUE = {};\n// implementation\nfunction watch(source, cb, options) {\n if (process.env.NODE_ENV !== 'production' && typeof cb !== 'function') {\n warn(\"`watch(fn, options?)` signature has been moved to a separate API. \" +\n \"Use `watchEffect(fn, options?)` instead. `watch` now only \" +\n \"supports `watch(source, cb, options?) signature.\");\n }\n return doWatch(source, cb, options);\n}\nfunction doWatch(source, cb, _a) {\n var _b = _a === void 0 ? emptyObject : _a, immediate = _b.immediate, deep = _b.deep, _c = _b.flush, flush = _c === void 0 ? 'pre' : _c, onTrack = _b.onTrack, onTrigger = _b.onTrigger;\n if (process.env.NODE_ENV !== 'production' && !cb) {\n if (immediate !== undefined) {\n warn(\"watch() \\\"immediate\\\" option is only respected when using the \" +\n \"watch(source, callback, options?) signature.\");\n }\n if (deep !== undefined) {\n warn(\"watch() \\\"deep\\\" option is only respected when using the \" +\n \"watch(source, callback, options?) signature.\");\n }\n }\n var warnInvalidSource = function (s) {\n warn(\"Invalid watch source: \".concat(s, \". A watch source can only be a getter/effect \") +\n \"function, a ref, a reactive object, or an array of these types.\");\n };\n var instance = currentInstance;\n var call = function (fn, type, args) {\n if (args === void 0) { args = null; }\n var res = invokeWithErrorHandling(fn, null, args, instance, type);\n if (deep && res && res.__ob__)\n res.__ob__.dep.depend();\n return res;\n };\n var getter;\n var forceTrigger = false;\n var isMultiSource = false;\n if (isRef(source)) {\n getter = function () { return source.value; };\n forceTrigger = isShallow(source);\n }\n else if (isReactive(source)) {\n getter = function () {\n source.__ob__.dep.depend();\n return source;\n };\n deep = true;\n }\n else if (isArray(source)) {\n isMultiSource = true;\n forceTrigger = source.some(function (s) { return isReactive(s) || isShallow(s); });\n getter = function () {\n return source.map(function (s) {\n if (isRef(s)) {\n return s.value;\n }\n else if (isReactive(s)) {\n s.__ob__.dep.depend();\n return traverse(s);\n }\n else if (isFunction(s)) {\n return call(s, WATCHER_GETTER);\n }\n else {\n process.env.NODE_ENV !== 'production' && warnInvalidSource(s);\n }\n });\n };\n }\n else if (isFunction(source)) {\n if (cb) {\n // getter with cb\n getter = function () { return call(source, WATCHER_GETTER); };\n }\n else {\n // no cb -> simple effect\n getter = function () {\n if (instance && instance._isDestroyed) {\n return;\n }\n if (cleanup) {\n cleanup();\n }\n return call(source, WATCHER, [onCleanup]);\n };\n }\n }\n else {\n getter = noop;\n process.env.NODE_ENV !== 'production' && warnInvalidSource(source);\n }\n if (cb && deep) {\n var baseGetter_1 = getter;\n getter = function () { return traverse(baseGetter_1()); };\n }\n var cleanup;\n var onCleanup = function (fn) {\n cleanup = watcher.onStop = function () {\n call(fn, WATCHER_CLEANUP);\n };\n };\n // in SSR there is no need to setup an actual effect, and it should be noop\n // unless it's eager\n if (isServerRendering()) {\n // we will also not call the invalidate callback (+ runner is not set up)\n onCleanup = noop;\n if (!cb) {\n getter();\n }\n else if (immediate) {\n call(cb, WATCHER_CB, [\n getter(),\n isMultiSource ? [] : undefined,\n onCleanup\n ]);\n }\n return noop;\n }\n var watcher = new Watcher(currentInstance, getter, noop, {\n lazy: true\n });\n watcher.noRecurse = !cb;\n var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;\n // overwrite default run\n watcher.run = function () {\n if (!watcher.active) {\n return;\n }\n if (cb) {\n // watch(source, cb)\n var newValue = watcher.get();\n if (deep ||\n forceTrigger ||\n (isMultiSource\n ? newValue.some(function (v, i) {\n return hasChanged(v, oldValue[i]);\n })\n : hasChanged(newValue, oldValue))) {\n // cleanup before running cb again\n if (cleanup) {\n cleanup();\n }\n call(cb, WATCHER_CB, [\n newValue,\n // pass undefined as the old value when it's changed for the first time\n oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,\n onCleanup\n ]);\n oldValue = newValue;\n }\n }\n else {\n // watchEffect\n watcher.get();\n }\n };\n if (flush === 'sync') {\n watcher.update = watcher.run;\n }\n else if (flush === 'post') {\n watcher.post = true;\n watcher.update = function () { return queueWatcher(watcher); };\n }\n else {\n // pre\n watcher.update = function () {\n if (instance && instance === currentInstance && !instance._isMounted) {\n // pre-watcher triggered before\n var buffer = instance._preWatchers || (instance._preWatchers = []);\n if (buffer.indexOf(watcher) < 0)\n buffer.push(watcher);\n }\n else {\n queueWatcher(watcher);\n }\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n watcher.onTrack = onTrack;\n watcher.onTrigger = onTrigger;\n }\n // initial run\n if (cb) {\n if (immediate) {\n watcher.run();\n }\n else {\n oldValue = watcher.get();\n }\n }\n else if (flush === 'post' && instance) {\n instance.$once('hook:mounted', function () { return watcher.get(); });\n }\n else {\n watcher.get();\n }\n return function () {\n watcher.teardown();\n };\n}\n\nvar activeEffectScope;\nvar EffectScope = /** @class */ (function () {\n function EffectScope(detached) {\n if (detached === void 0) { detached = false; }\n this.detached = detached;\n /**\n * @internal\n */\n this.active = true;\n /**\n * @internal\n */\n this.effects = [];\n /**\n * @internal\n */\n this.cleanups = [];\n this.parent = activeEffectScope;\n if (!detached && activeEffectScope) {\n this.index =\n (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;\n }\n }\n EffectScope.prototype.run = function (fn) {\n if (this.active) {\n var currentEffectScope = activeEffectScope;\n try {\n activeEffectScope = this;\n return fn();\n }\n finally {\n activeEffectScope = currentEffectScope;\n }\n }\n else if (process.env.NODE_ENV !== 'production') {\n warn(\"cannot run an inactive effect scope.\");\n }\n };\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n EffectScope.prototype.on = function () {\n activeEffectScope = this;\n };\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n EffectScope.prototype.off = function () {\n activeEffectScope = this.parent;\n };\n EffectScope.prototype.stop = function (fromParent) {\n if (this.active) {\n var i = void 0, l = void 0;\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].teardown();\n }\n for (i = 0, l = this.cleanups.length; i < l; i++) {\n this.cleanups[i]();\n }\n if (this.scopes) {\n for (i = 0, l = this.scopes.length; i < l; i++) {\n this.scopes[i].stop(true);\n }\n }\n // nested scope, dereference from parent to avoid memory leaks\n if (!this.detached && this.parent && !fromParent) {\n // optimized O(1) removal\n var last = this.parent.scopes.pop();\n if (last && last !== this) {\n this.parent.scopes[this.index] = last;\n last.index = this.index;\n }\n }\n this.parent = undefined;\n this.active = false;\n }\n };\n return EffectScope;\n}());\nfunction effectScope(detached) {\n return new EffectScope(detached);\n}\n/**\n * @internal\n */\nfunction recordEffectScope(effect, scope) {\n if (scope === void 0) { scope = activeEffectScope; }\n if (scope && scope.active) {\n scope.effects.push(effect);\n }\n}\nfunction getCurrentScope() {\n return activeEffectScope;\n}\nfunction onScopeDispose(fn) {\n if (activeEffectScope) {\n activeEffectScope.cleanups.push(fn);\n }\n else if (process.env.NODE_ENV !== 'production') {\n warn(\"onScopeDispose() is called when there is no active effect scope\" +\n \" to be associated with.\");\n }\n}\n\nfunction provide(key, value) {\n if (!currentInstance) {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"provide() can only be used inside setup().\");\n }\n }\n else {\n // TS doesn't allow symbol as index type\n resolveProvided(currentInstance)[key] = value;\n }\n}\nfunction resolveProvided(vm) {\n // by default an instance inherits its parent's provides object\n // but when it needs to provide values of its own, it creates its\n // own provides object using parent provides object as prototype.\n // this way in `inject` we can simply look up injections from direct\n // parent and let the prototype chain do the work.\n var existing = vm._provided;\n var parentProvides = vm.$parent && vm.$parent._provided;\n if (parentProvides === existing) {\n return (vm._provided = Object.create(parentProvides));\n }\n else {\n return existing;\n }\n}\nfunction inject(key, defaultValue, treatDefaultAsFactory) {\n if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }\n // fallback to `currentRenderingInstance` so that this can be called in\n // a functional component\n var instance = currentInstance;\n if (instance) {\n // #2400\n // to support `app.use` plugins,\n // fallback to appContext's `provides` if the instance is at root\n var provides = instance.$parent && instance.$parent._provided;\n if (provides && key in provides) {\n // TS doesn't allow symbol as index type\n return provides[key];\n }\n else if (arguments.length > 1) {\n return treatDefaultAsFactory && isFunction(defaultValue)\n ? defaultValue.call(instance)\n : defaultValue;\n }\n else if (process.env.NODE_ENV !== 'production') {\n warn(\"injection \\\"\".concat(String(key), \"\\\" not found.\"));\n }\n }\n else if (process.env.NODE_ENV !== 'production') {\n warn(\"inject() can only be used inside setup() or functional components.\");\n }\n}\n\nvar normalizeEvent = cached(function (name) {\n var passive = name.charAt(0) === '&';\n name = passive ? name.slice(1) : name;\n var once = name.charAt(0) === '~'; // Prefixed last, checked first\n name = once ? name.slice(1) : name;\n var capture = name.charAt(0) === '!';\n name = capture ? name.slice(1) : name;\n return {\n name: name,\n once: once,\n capture: capture,\n passive: passive\n };\n});\nfunction createFnInvoker(fns, vm) {\n function invoker() {\n var fns = invoker.fns;\n if (isArray(fns)) {\n var cloned = fns.slice();\n for (var i = 0; i < cloned.length; i++) {\n invokeWithErrorHandling(cloned[i], null, arguments, vm, \"v-on handler\");\n }\n }\n else {\n // return handler return value for single handlers\n return invokeWithErrorHandling(fns, null, arguments, vm, \"v-on handler\");\n }\n }\n invoker.fns = fns;\n return invoker;\n}\nfunction updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {\n var name, cur, old, event;\n for (name in on) {\n cur = on[name];\n old = oldOn[name];\n event = normalizeEvent(name);\n if (isUndef(cur)) {\n process.env.NODE_ENV !== 'production' &&\n warn(\"Invalid handler for event \\\"\".concat(event.name, \"\\\": got \") + String(cur), vm);\n }\n else if (isUndef(old)) {\n if (isUndef(cur.fns)) {\n cur = on[name] = createFnInvoker(cur, vm);\n }\n if (isTrue(event.once)) {\n cur = on[name] = createOnceHandler(event.name, cur, event.capture);\n }\n add(event.name, cur, event.capture, event.passive, event.params);\n }\n else if (cur !== old) {\n old.fns = cur;\n on[name] = old;\n }\n }\n for (name in oldOn) {\n if (isUndef(on[name])) {\n event = normalizeEvent(name);\n remove(event.name, oldOn[name], event.capture);\n }\n }\n}\n\nfunction mergeVNodeHook(def, hookKey, hook) {\n if (def instanceof VNode) {\n def = def.data.hook || (def.data.hook = {});\n }\n var invoker;\n var oldHook = def[hookKey];\n function wrappedHook() {\n hook.apply(this, arguments);\n // important: remove merged hook to ensure it's called only once\n // and prevent memory leak\n remove$2(invoker.fns, wrappedHook);\n }\n if (isUndef(oldHook)) {\n // no existing hook\n invoker = createFnInvoker([wrappedHook]);\n }\n else {\n /* istanbul ignore if */\n if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {\n // already a merged invoker\n invoker = oldHook;\n invoker.fns.push(wrappedHook);\n }\n else {\n // existing plain hook\n invoker = createFnInvoker([oldHook, wrappedHook]);\n }\n }\n invoker.merged = true;\n def[hookKey] = invoker;\n}\n\nfunction extractPropsFromVNodeData(data, Ctor, tag) {\n // we are only extracting raw values here.\n // validation and default values are handled in the child\n // component itself.\n var propOptions = Ctor.options.props;\n if (isUndef(propOptions)) {\n return;\n }\n var res = {};\n var attrs = data.attrs, props = data.props;\n if (isDef(attrs) || isDef(props)) {\n for (var key in propOptions) {\n var altKey = hyphenate(key);\n if (process.env.NODE_ENV !== 'production') {\n var keyInLowerCase = key.toLowerCase();\n if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {\n tip(\"Prop \\\"\".concat(keyInLowerCase, \"\\\" is passed to component \") +\n \"\".concat(formatComponentName(\n // @ts-expect-error tag is string\n tag || Ctor), \", but the declared prop name is\") +\n \" \\\"\".concat(key, \"\\\". \") +\n \"Note that HTML attributes are case-insensitive and camelCased \" +\n \"props need to use their kebab-case equivalents when using in-DOM \" +\n \"templates. You should probably use \\\"\".concat(altKey, \"\\\" instead of \\\"\").concat(key, \"\\\".\"));\n }\n }\n checkProp(res, props, key, altKey, true) ||\n checkProp(res, attrs, key, altKey, false);\n }\n }\n return res;\n}\nfunction checkProp(res, hash, key, altKey, preserve) {\n if (isDef(hash)) {\n if (hasOwn(hash, key)) {\n res[key] = hash[key];\n if (!preserve) {\n delete hash[key];\n }\n return true;\n }\n else if (hasOwn(hash, altKey)) {\n res[key] = hash[altKey];\n if (!preserve) {\n delete hash[altKey];\n }\n return true;\n }\n }\n return false;\n}\n\n// The template compiler attempts to minimize the need for normalization by\n// statically analyzing the template at compile time.\n//\n// For plain HTML markup, normalization can be completely skipped because the\n// generated render function is guaranteed to return Array. There are\n// two cases where extra normalization is needed:\n// 1. When the children contains components - because a functional component\n// may return an Array instead of a single root. In this case, just a simple\n// normalization is needed - if any child is an Array, we flatten the whole\n// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep\n// because functional components already normalize their own children.\nfunction simpleNormalizeChildren(children) {\n for (var i = 0; i < children.length; i++) {\n if (isArray(children[i])) {\n return Array.prototype.concat.apply([], children);\n }\n }\n return children;\n}\n// 2. When the children contains constructs that always generated nested Arrays,\n// e.g. , , v-for, or when the children is provided by user\n// with hand-written render functions / JSX. In such cases a full normalization\n// is needed to cater to all possible types of children values.\nfunction normalizeChildren(children) {\n return isPrimitive(children)\n ? [createTextVNode(children)]\n : isArray(children)\n ? normalizeArrayChildren(children)\n : undefined;\n}\nfunction isTextNode(node) {\n return isDef(node) && isDef(node.text) && isFalse(node.isComment);\n}\nfunction normalizeArrayChildren(children, nestedIndex) {\n var res = [];\n var i, c, lastIndex, last;\n for (i = 0; i < children.length; i++) {\n c = children[i];\n if (isUndef(c) || typeof c === 'boolean')\n continue;\n lastIndex = res.length - 1;\n last = res[lastIndex];\n // nested\n if (isArray(c)) {\n if (c.length > 0) {\n c = normalizeArrayChildren(c, \"\".concat(nestedIndex || '', \"_\").concat(i));\n // merge adjacent text nodes\n if (isTextNode(c[0]) && isTextNode(last)) {\n res[lastIndex] = createTextVNode(last.text + c[0].text);\n c.shift();\n }\n res.push.apply(res, c);\n }\n }\n else if (isPrimitive(c)) {\n if (isTextNode(last)) {\n // merge adjacent text nodes\n // this is necessary for SSR hydration because text nodes are\n // essentially merged when rendered to HTML strings\n res[lastIndex] = createTextVNode(last.text + c);\n }\n else if (c !== '') {\n // convert primitive to vnode\n res.push(createTextVNode(c));\n }\n }\n else {\n if (isTextNode(c) && isTextNode(last)) {\n // merge adjacent text nodes\n res[lastIndex] = createTextVNode(last.text + c.text);\n }\n else {\n // default key for nested array children (likely generated by v-for)\n if (isTrue(children._isVList) &&\n isDef(c.tag) &&\n isUndef(c.key) &&\n isDef(nestedIndex)) {\n c.key = \"__vlist\".concat(nestedIndex, \"_\").concat(i, \"__\");\n }\n res.push(c);\n }\n }\n }\n return res;\n}\n\n/**\n * Runtime helper for rendering v-for lists.\n */\nfunction renderList(val, render) {\n var ret = null, i, l, keys, key;\n if (isArray(val) || typeof val === 'string') {\n ret = new Array(val.length);\n for (i = 0, l = val.length; i < l; i++) {\n ret[i] = render(val[i], i);\n }\n }\n else if (typeof val === 'number') {\n ret = new Array(val);\n for (i = 0; i < val; i++) {\n ret[i] = render(i + 1, i);\n }\n }\n else if (isObject(val)) {\n if (hasSymbol && val[Symbol.iterator]) {\n ret = [];\n var iterator = val[Symbol.iterator]();\n var result = iterator.next();\n while (!result.done) {\n ret.push(render(result.value, ret.length));\n result = iterator.next();\n }\n }\n else {\n keys = Object.keys(val);\n ret = new Array(keys.length);\n for (i = 0, l = keys.length; i < l; i++) {\n key = keys[i];\n ret[i] = render(val[key], key, i);\n }\n }\n }\n if (!isDef(ret)) {\n ret = [];\n }\n ret._isVList = true;\n return ret;\n}\n\n/**\n * Runtime helper for rendering \n */\nfunction renderSlot(name, fallbackRender, props, bindObject) {\n var scopedSlotFn = this.$scopedSlots[name];\n var nodes;\n if (scopedSlotFn) {\n // scoped slot\n props = props || {};\n if (bindObject) {\n if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {\n warn('slot v-bind without argument expects an Object', this);\n }\n props = extend(extend({}, bindObject), props);\n }\n nodes =\n scopedSlotFn(props) ||\n (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);\n }\n else {\n nodes =\n this.$slots[name] ||\n (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);\n }\n var target = props && props.slot;\n if (target) {\n return this.$createElement('template', { slot: target }, nodes);\n }\n else {\n return nodes;\n }\n}\n\n/**\n * Runtime helper for resolving filters\n */\nfunction resolveFilter(id) {\n return resolveAsset(this.$options, 'filters', id, true) || identity;\n}\n\nfunction isKeyNotMatch(expect, actual) {\n if (isArray(expect)) {\n return expect.indexOf(actual) === -1;\n }\n else {\n return expect !== actual;\n }\n}\n/**\n * Runtime helper for checking keyCodes from config.\n * exposed as Vue.prototype._k\n * passing in eventKeyName as last argument separately for backwards compat\n */\nfunction checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {\n var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;\n if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {\n return isKeyNotMatch(builtInKeyName, eventKeyName);\n }\n else if (mappedKeyCode) {\n return isKeyNotMatch(mappedKeyCode, eventKeyCode);\n }\n else if (eventKeyName) {\n return hyphenate(eventKeyName) !== key;\n }\n return eventKeyCode === undefined;\n}\n\n/**\n * Runtime helper for merging v-bind=\"object\" into a VNode's data.\n */\nfunction bindObjectProps(data, tag, value, asProp, isSync) {\n if (value) {\n if (!isObject(value)) {\n process.env.NODE_ENV !== 'production' &&\n warn('v-bind without argument expects an Object or Array value', this);\n }\n else {\n if (isArray(value)) {\n value = toObject(value);\n }\n var hash = void 0;\n var _loop_1 = function (key) {\n if (key === 'class' || key === 'style' || isReservedAttribute(key)) {\n hash = data;\n }\n else {\n var type = data.attrs && data.attrs.type;\n hash =\n asProp || config.mustUseProp(tag, type, key)\n ? data.domProps || (data.domProps = {})\n : data.attrs || (data.attrs = {});\n }\n var camelizedKey = camelize(key);\n var hyphenatedKey = hyphenate(key);\n if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {\n hash[key] = value[key];\n if (isSync) {\n var on = data.on || (data.on = {});\n on[\"update:\".concat(key)] = function ($event) {\n value[key] = $event;\n };\n }\n }\n };\n for (var key in value) {\n _loop_1(key);\n }\n }\n }\n return data;\n}\n\n/**\n * Runtime helper for rendering static trees.\n */\nfunction renderStatic(index, isInFor) {\n var cached = this._staticTrees || (this._staticTrees = []);\n var tree = cached[index];\n // if has already-rendered static tree and not inside v-for,\n // we can reuse the same tree.\n if (tree && !isInFor) {\n return tree;\n }\n // otherwise, render a fresh tree.\n tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates\n );\n markStatic(tree, \"__static__\".concat(index), false);\n return tree;\n}\n/**\n * Runtime helper for v-once.\n * Effectively it means marking the node as static with a unique key.\n */\nfunction markOnce(tree, index, key) {\n markStatic(tree, \"__once__\".concat(index).concat(key ? \"_\".concat(key) : \"\"), true);\n return tree;\n}\nfunction markStatic(tree, key, isOnce) {\n if (isArray(tree)) {\n for (var i = 0; i < tree.length; i++) {\n if (tree[i] && typeof tree[i] !== 'string') {\n markStaticNode(tree[i], \"\".concat(key, \"_\").concat(i), isOnce);\n }\n }\n }\n else {\n markStaticNode(tree, key, isOnce);\n }\n}\nfunction markStaticNode(node, key, isOnce) {\n node.isStatic = true;\n node.key = key;\n node.isOnce = isOnce;\n}\n\nfunction bindObjectListeners(data, value) {\n if (value) {\n if (!isPlainObject(value)) {\n process.env.NODE_ENV !== 'production' && warn('v-on without argument expects an Object value', this);\n }\n else {\n var on = (data.on = data.on ? extend({}, data.on) : {});\n for (var key in value) {\n var existing = on[key];\n var ours = value[key];\n on[key] = existing ? [].concat(existing, ours) : ours;\n }\n }\n }\n return data;\n}\n\nfunction resolveScopedSlots(fns, res, \n// the following are added in 2.6\nhasDynamicKeys, contentHashKey) {\n res = res || { $stable: !hasDynamicKeys };\n for (var i = 0; i < fns.length; i++) {\n var slot = fns[i];\n if (isArray(slot)) {\n resolveScopedSlots(slot, res, hasDynamicKeys);\n }\n else if (slot) {\n // marker for reverse proxying v-slot without scope on this.$slots\n // @ts-expect-error\n if (slot.proxy) {\n // @ts-expect-error\n slot.fn.proxy = true;\n }\n res[slot.key] = slot.fn;\n }\n }\n if (contentHashKey) {\n res.$key = contentHashKey;\n }\n return res;\n}\n\n// helper to process dynamic keys for dynamic arguments in v-bind and v-on.\nfunction bindDynamicKeys(baseObj, values) {\n for (var i = 0; i < values.length; i += 2) {\n var key = values[i];\n if (typeof key === 'string' && key) {\n baseObj[values[i]] = values[i + 1];\n }\n else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {\n // null is a special value for explicitly removing a binding\n warn(\"Invalid value for dynamic directive argument (expected string or null): \".concat(key), this);\n }\n }\n return baseObj;\n}\n// helper to dynamically append modifier runtime markers to event names.\n// ensure only append when value is already string, otherwise it will be cast\n// to string and cause the type check to miss.\nfunction prependModifier(value, symbol) {\n return typeof value === 'string' ? symbol + value : value;\n}\n\nfunction installRenderHelpers(target) {\n target._o = markOnce;\n target._n = toNumber;\n target._s = toString;\n target._l = renderList;\n target._t = renderSlot;\n target._q = looseEqual;\n target._i = looseIndexOf;\n target._m = renderStatic;\n target._f = resolveFilter;\n target._k = checkKeyCodes;\n target._b = bindObjectProps;\n target._v = createTextVNode;\n target._e = createEmptyVNode;\n target._u = resolveScopedSlots;\n target._g = bindObjectListeners;\n target._d = bindDynamicKeys;\n target._p = prependModifier;\n}\n\n/**\n * Runtime helper for resolving raw children VNodes into a slot object.\n */\nfunction resolveSlots(children, context) {\n if (!children || !children.length) {\n return {};\n }\n var slots = {};\n for (var i = 0, l = children.length; i < l; i++) {\n var child = children[i];\n var data = child.data;\n // remove slot attribute if the node is resolved as a Vue slot node\n if (data && data.attrs && data.attrs.slot) {\n delete data.attrs.slot;\n }\n // named slots should only be respected if the vnode was rendered in the\n // same context.\n if ((child.context === context || child.fnContext === context) &&\n data &&\n data.slot != null) {\n var name_1 = data.slot;\n var slot = slots[name_1] || (slots[name_1] = []);\n if (child.tag === 'template') {\n slot.push.apply(slot, child.children || []);\n }\n else {\n slot.push(child);\n }\n }\n else {\n (slots.default || (slots.default = [])).push(child);\n }\n }\n // ignore slots that contains only whitespace\n for (var name_2 in slots) {\n if (slots[name_2].every(isWhitespace)) {\n delete slots[name_2];\n }\n }\n return slots;\n}\nfunction isWhitespace(node) {\n return (node.isComment && !node.asyncFactory) || node.text === ' ';\n}\n\nfunction isAsyncPlaceholder(node) {\n // @ts-expect-error not really boolean type\n return node.isComment && node.asyncFactory;\n}\n\nfunction normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {\n var res;\n var hasNormalSlots = Object.keys(normalSlots).length > 0;\n var isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;\n var key = scopedSlots && scopedSlots.$key;\n if (!scopedSlots) {\n res = {};\n }\n else if (scopedSlots._normalized) {\n // fast path 1: child component re-render only, parent did not change\n return scopedSlots._normalized;\n }\n else if (isStable &&\n prevScopedSlots &&\n prevScopedSlots !== emptyObject &&\n key === prevScopedSlots.$key &&\n !hasNormalSlots &&\n !prevScopedSlots.$hasNormal) {\n // fast path 2: stable scoped slots w/ no normal slots to proxy,\n // only need to normalize once\n return prevScopedSlots;\n }\n else {\n res = {};\n for (var key_1 in scopedSlots) {\n if (scopedSlots[key_1] && key_1[0] !== '$') {\n res[key_1] = normalizeScopedSlot(ownerVm, normalSlots, key_1, scopedSlots[key_1]);\n }\n }\n }\n // expose normal slots on scopedSlots\n for (var key_2 in normalSlots) {\n if (!(key_2 in res)) {\n res[key_2] = proxyNormalSlot(normalSlots, key_2);\n }\n }\n // avoriaz seems to mock a non-extensible $scopedSlots object\n // and when that is passed down this would cause an error\n if (scopedSlots && Object.isExtensible(scopedSlots)) {\n scopedSlots._normalized = res;\n }\n def(res, '$stable', isStable);\n def(res, '$key', key);\n def(res, '$hasNormal', hasNormalSlots);\n return res;\n}\nfunction normalizeScopedSlot(vm, normalSlots, key, fn) {\n var normalized = function () {\n var cur = currentInstance;\n setCurrentInstance(vm);\n var res = arguments.length ? fn.apply(null, arguments) : fn({});\n res =\n res && typeof res === 'object' && !isArray(res)\n ? [res] // single vnode\n : normalizeChildren(res);\n var vnode = res && res[0];\n setCurrentInstance(cur);\n return res &&\n (!vnode ||\n (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391\n ? undefined\n : res;\n };\n // this is a slot using the new v-slot syntax without scope. although it is\n // compiled as a scoped slot, render fn users would expect it to be present\n // on this.$slots because the usage is semantically a normal slot.\n if (fn.proxy) {\n Object.defineProperty(normalSlots, key, {\n get: normalized,\n enumerable: true,\n configurable: true\n });\n }\n return normalized;\n}\nfunction proxyNormalSlot(slots, key) {\n return function () { return slots[key]; };\n}\n\nfunction initSetup(vm) {\n var options = vm.$options;\n var setup = options.setup;\n if (setup) {\n var ctx = (vm._setupContext = createSetupContext(vm));\n setCurrentInstance(vm);\n pushTarget();\n var setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, \"setup\");\n popTarget();\n setCurrentInstance();\n if (isFunction(setupResult)) {\n // render function\n // @ts-ignore\n options.render = setupResult;\n }\n else if (isObject(setupResult)) {\n // bindings\n if (process.env.NODE_ENV !== 'production' && setupResult instanceof VNode) {\n warn(\"setup() should not return VNodes directly - \" +\n \"return a render function instead.\");\n }\n vm._setupState = setupResult;\n // __sfc indicates compiled bindings from \\r\\n\\r\\n\",\".silentbox-item {\\n cursor: pointer;\\n text-decoration: underline;\\n}\\n\\n/*# sourceMappingURL=item.vue.map */\"]}, media: undefined });\n\n };\n /* scoped */\n var __vue_scope_id__ = undefined;\n /* module identifier */\n var __vue_module_identifier__ = undefined;\n /* functional template */\n var __vue_is_functional_template__ = false;\n /* style inject SSR */\n \n\n \n var item = normalizeComponent_1(\n { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },\n __vue_inject_styles__,\n __vue_script__,\n __vue_scope_id__,\n __vue_is_functional_template__,\n __vue_module_identifier__,\n browser,\n undefined\n );\n\n//\n\nvar script$1 = {\n name: 'SilentboxOverlay',\n mixins: [ VideoUrlDecoderMixin ],\n data: function data() {\n return {\n video: false\n }\n },\n computed: {\n /**\n * Get the right embed URL.\n */\n getEmbedUrl: function getEmbedUrl() {\n return this.handleUrl(this.$parent.embedUrl);\n },\n /**\n * Get autoplay state.\n */\n getAutoplayState: function getAutoplayState() {\n if (this.$parent.autoplay !== undefined && this.$parent.autoplay !== false) {\n return \"autoplay\";\n }\n return \"\";\n },\n /**\n * Check whether overlay is visible or not.\n */\n isVisible: function isVisible() {\n if (this.$parent.overlayVisibility !== undefined && this.$parent.overlayVisibility !== false) {\n return true;\n }\n\n return false;\n }\n },\n watch: {\n isVisible: function (value) {\n if (document !== undefined) {\n this.bodyScrolling();\n }\n }\n },\n methods: {\n bodyScrolling: function bodyScrolling() {\n var body = document.body;\n\n // add class only if overlay should be visible\n if (this.isVisible && ! body.classList.contains('silentbox-is-opened')) {\n return body.classList.add('silentbox-is-opened');\n }\n\n // remove class only if overlay should be hidden\n if (! this.isVisible && body.classList.contains('silentbox-is-opened')) {\n return body.classList.remove('silentbox-is-opened')\n }\n },\n /**\n * Move to next item.\n */\n moveToNextItem: function moveToNextItem() {\n this.$parent.nextItem();\n },\n /**\n * Move to previous item.\n */\n moveToPreviousItem: function moveToPreviousItem()\n {\n this.$parent.prevItem();\n },\n /**\n * Hide silentbox overlay.\n */\n closeSilentboxOverlay: function closeSilentboxOverlay() {\n this.$parent.$emit('closeSilentboxOverlay');\n },\n /**\n * Search for known video services URLs and return their players if recognized.\n * Unrecognized URLs are handled as images.\n * \n * @param {string} url\n * @return {string}\n */\n handleUrl: function handleUrl(url) {\n if (url.includes('youtube.com') || url.includes('youtu.be')) {\n this.video = true;\n return this.getYoutubeVideo(url);\n } else if (url.includes(\"vimeo\")) {\n this.video = true;\n return this.getVimeoVideo(url);\n } else {\n // Given url is not a video URL thus return it as it is.\n this.video = false;\n return url;\n }\n },\n /**\n * Get embed URL for youtube.com\n * \n * @param {string} url \n * @return {string} \n */\n getYoutubeVideo: function getYoutubeVideo(url) {\n var videoUrl = \"\";\n var videoId = this.getYoutubeVideoId(url);\n\n if (videoId) {\n videoUrl = 'https://www.youtube.com/embed/' + videoId + '?rel=0';\n\n if (this.$parent.autoplay) {\n videoUrl += '&autoplay=1';\n }\n if (this.$parent.showControls) {\n videoUrl += '&controls=0';\n }\n }\n\n return videoUrl;\n },\n /**\n * Get embed URL for vimeo.com\n * \n * @param {string} url \n * @return {string} \n */\n getVimeoVideo: function getVimeoVideo(url) { \n var videoUrl = \"\";\n var vimoId = /(vimeo(pro)?\\.com)\\/(?:[^\\d]+)?(\\d+)\\??(.*)?$/.exec(url)[3];\n\n if (vimoId !== undefined) {\n videoUrl = 'https://player.vimeo.com/video/'+ vimoId + '?api=1';\n if (this.$parent.autoplay) {\n videoUrl += '&autoplay=1';\n }\n }\n\n return videoUrl;\n },\n }\n};\n\n/* script */\nvar __vue_script__$1 = script$1;\n\n/* template */\nvar __vue_render__$1 = function() {\n var _vm = this;\n var _h = _vm.$createElement;\n var _c = _vm._self._c || _h;\n return _vm.isVisible\n ? _c(\"div\", { attrs: { id: \"silentbox-overlay\" } }, [\n _c(\"div\", {\n attrs: { id: \"silentbox-overlay__background\" },\n on: {\n click: function($event) {\n $event.stopPropagation();\n return _vm.closeSilentboxOverlay($event)\n }\n }\n }),\n _vm._v(\" \"),\n _c(\n \"div\",\n {\n attrs: { id: \"silentbox-overlay__content\" },\n on: {\n click: function($event) {\n $event.stopPropagation();\n return _vm.closeSilentboxOverlay($event)\n }\n }\n },\n [\n _c(\"div\", { attrs: { id: \"silentbox-overlay__embed\" } }, [\n _c(\"div\", { attrs: { id: \"silentbox-overlay__container\" } }, [\n _vm.video\n ? _c(\"iframe\", {\n attrs: {\n width: \"100%\",\n height: \"100%\",\n src: _vm.getEmbedUrl,\n frameborder: \"0\",\n allow: _vm.getAutoplayState,\n allowfullscreen: \"\"\n }\n })\n : _vm._e(),\n _vm._v(\" \"),\n !_vm.video\n ? _c(\"img\", {\n attrs: {\n width: \"auto\",\n height: \"auto\",\n src: _vm.getEmbedUrl\n }\n })\n : _vm._e()\n ]),\n _vm._v(\" \"),\n this.$parent.description\n ? _c(\"p\", { attrs: { id: \"silentbox-overlay__description\" } }, [\n _vm._v(_vm._s(this.$parent.description))\n ])\n : _vm._e()\n ])\n ]\n ),\n _vm._v(\" \"),\n _c(\n \"div\",\n {\n attrs: {\n id: \"silentbox-overlay__close-button\",\n role: \"button\",\n tabindex: \"3\"\n },\n on: {\n click: function($event) {\n $event.stopPropagation();\n return _vm.closeSilentboxOverlay($event)\n },\n keyup: function($event) {\n if (\n !$event.type.indexOf(\"key\") &&\n _vm._k($event.keyCode, \"enter\", 13, $event.key, \"Enter\")\n ) {\n return null\n }\n return _vm.closeSilentboxOverlay($event)\n }\n }\n },\n [_c(\"div\", { staticClass: \"icon\" })]\n ),\n _vm._v(\" \"),\n this.$parent.items.total > 0\n ? _c(\"div\", { attrs: { id: \"silentbox-overlay__arrow-buttons\" } }, [\n _c(\"div\", {\n staticClass: \"arrow arrow-previous\",\n attrs: { role: \"button\", tabindex: \"2\" },\n on: {\n click: _vm.moveToPreviousItem,\n keyup: function($event) {\n if (\n !$event.type.indexOf(\"key\") &&\n _vm._k($event.keyCode, \"enter\", 13, $event.key, \"Enter\")\n ) {\n return null\n }\n return _vm.moveToPreviousItem($event)\n }\n }\n }),\n _vm._v(\" \"),\n _c(\"div\", {\n staticClass: \"arrow arrow-next\",\n attrs: { role: \"button\", tabindex: \"1\" },\n on: {\n click: _vm.moveToNextItem,\n keyup: function($event) {\n if (\n !$event.type.indexOf(\"key\") &&\n _vm._k($event.keyCode, \"enter\", 13, $event.key, \"Enter\")\n ) {\n return null\n }\n return _vm.moveToNextItem($event)\n }\n }\n })\n ])\n : _vm._e()\n ])\n : _vm._e()\n};\nvar __vue_staticRenderFns__$1 = [];\n__vue_render__$1._withStripped = true;\n\n /* style */\n var __vue_inject_styles__$1 = function (inject) {\n if (!inject) { return }\n inject(\"data-v-030dd6b5_0\", { source: \".silentbox-is-opened {\\n overflow: hidden;\\n}\\n#silentbox-overlay {\\n display: block;\\n height: 100vh;\\n left: 0;\\n position: fixed;\\n top: 0;\\n width: 100vw;\\n z-index: 999;\\n}\\n#silentbox-overlay__background {\\n background: rgba(0, 0, 0, 0.75);\\n backdrop-filter: blur(20px);\\n cursor: default;\\n display: block;\\n height: 100%;\\n left: 0;\\n position: absolute;\\n top: 0;\\n width: 100%;\\n}\\n#silentbox-overlay__content {\\n cursor: default;\\n display: block;\\n height: 100%;\\n position: relative;\\n width: 100%;\\n}\\n#silentbox-overlay__embed {\\n bottom: 0;\\n cursor: default;\\n display: block;\\n height: 80%;\\n left: 0;\\n margin: auto;\\n position: absolute;\\n right: 0;\\n top: -2.5rem;\\n width: 75%;\\n}\\n#silentbox-overlay__embed img,\\n#silentbox-overlay__embed iframe {\\n background-color: #000;\\n bottom: 0;\\n box-shadow: 0 0 1.5rem rgba(0, 0, 0, 0.45);\\n cursor: default;\\n display: block;\\n left: 0;\\n margin: auto;\\n max-height: 100%;\\n max-width: 100%;\\n position: absolute;\\n right: 0;\\n top: 0;\\n}\\n#silentbox-overlay__container {\\n cursor: default;\\n height: 100%;\\n margin: 0 0 1.5rem 0;\\n position: relative;\\n text-align: center;\\n width: 100%;\\n}\\n#silentbox-overlay__description {\\n display: block;\\n padding-top: 1rem;\\n text-align: center;\\n color: #fff;\\n}\\n#silentbox-overlay__close-button {\\n background: rgba(0, 0, 0, 0);\\n border: none;\\n color: #fff;\\n cursor: pointer;\\n height: 2.5rem;\\n position: absolute;\\n right: 0;\\n top: 0;\\n transition: background-color 250ms ease-out;\\n width: 2.5rem;\\n}\\n#silentbox-overlay__close-button:hover, #silentbox-overlay__close-button:focus {\\n background-color: rgba(0, 0, 0, 0.5);\\n outline: none;\\n}\\n#silentbox-overlay__close-button .icon {\\n color: #fff;\\n cursor: pointer;\\n height: 1rem;\\n left: 0.7rem;\\n margin: 50% 50% 0 0;\\n position: absolute;\\n right: 0px;\\n top: -0.5rem;\\n transition: 250ms ease;\\n width: 1rem;\\n}\\n#silentbox-overlay__close-button .icon:before, #silentbox-overlay__close-button .icon:after {\\n background: #fff;\\n content: \\\"\\\";\\n height: 2px;\\n left: 5%;\\n position: absolute;\\n top: 50%;\\n transition: 250ms ease;\\n width: 100%;\\n}\\n#silentbox-overlay__close-button .icon:before {\\n transform: rotate(-45deg);\\n}\\n#silentbox-overlay__close-button .icon:after {\\n transform: rotate(45deg);\\n}\\n#silentbox-overlay__close-button .icon:hover:before, #silentbox-overlay__close-button .icon:hover:after, #silentbox-overlay__close-button .icon:focus:before, #silentbox-overlay__close-button .icon:focus:after {\\n background: #58e8d2;\\n left: 25%;\\n width: 50%;\\n}\\n#silentbox-overlay__arrow-buttons .arrow {\\n border-left: 2px solid #fff;\\n border-top: 2px solid #fff;\\n cursor: pointer;\\n height: 1.5rem;\\n position: absolute;\\n width: 1.5rem;\\n}\\n#silentbox-overlay__arrow-buttons .arrow:hover, #silentbox-overlay__arrow-buttons .arrow:focus {\\n outline: none;\\n border-color: #58e8d2;\\n}\\n#silentbox-overlay__arrow-buttons .arrow-previous {\\n left: 2rem;\\n top: 50%;\\n transform: rotate(-45deg);\\n}\\n#silentbox-overlay__arrow-buttons .arrow-previous:hover, #silentbox-overlay__arrow-buttons .arrow-previous:focus {\\n animation-duration: 1s;\\n animation-iteration-count: infinite;\\n animation-name: pulsingPrevious;\\n}\\n#silentbox-overlay__arrow-buttons .arrow-next {\\n right: 2rem;\\n top: 50%;\\n transform: rotate(135deg);\\n}\\n#silentbox-overlay__arrow-buttons .arrow-next:hover, #silentbox-overlay__arrow-buttons .arrow-next:focus {\\n animation-duration: 1s;\\n animation-iteration-count: infinite;\\n animation-name: pulsingNext;\\n}\\n@keyframes pulsingNext {\\n0% {\\n animation-timing-function: ease-in;\\n right: 2rem;\\n}\\n25% {\\n animation-timing-function: ease-in;\\n right: 1.75rem;\\n}\\n75% {\\n animation-timing-function: ease-in;\\n right: 2.25rem;\\n}\\n100% {\\n animation-timing-function: ease-in;\\n right: 2rem;\\n}\\n}\\n@keyframes pulsingPrevious {\\n0% {\\n animation-timing-function: ease-in;\\n left: 2rem;\\n}\\n25% {\\n animation-timing-function: ease-in;\\n left: 1.75rem;\\n}\\n75% {\\n animation-timing-function: ease-in;\\n left: 2.25rem;\\n}\\n100% {\\n animation-timing-function: ease-in;\\n left: 2rem;\\n}\\n}\\n\\n/*# sourceMappingURL=overlay.vue.map */\", map: {\"version\":3,\"sources\":[\"/mnt/c/Projects/Silencesys/Silentbox/src/Silentbox/components/overlay.vue\",\"overlay.vue\"],\"names\":[],\"mappings\":\"AAqLA;EACA,gBAAA;ACpLA;ADuLA;EACA,cAAA;EACA,aAAA;EACA,OAAA;EACA,eAAA;EACA,MAAA;EACA,YAAA;EACA,YAAA;ACpLA;AD+JA;EAwBA,+BAAA;EACA,2BAAA;EACA,eAAA;EACA,cAAA;EACA,YAAA;EACA,OAAA;EACA,kBAAA;EACA,MAAA;EACA,WAAA;ACpLA;ADoJA;EAoCA,eAAA;EACA,cAAA;EACA,YAAA;EACA,kBAAA;EACA,WAAA;ACrLA;AD6IA;EA4CA,SAAA;EACA,eAAA;EACA,cAAA;EACA,WAAA;EACA,OAAA;EACA,YAAA;EACA,kBAAA;EACA,QAAA;EACA,YAAA;EACA,UAAA;ACtLA;ADwLA;;EAEA,sBAjDA;EAkDA,SAAA;EACA,0CAAA;EACA,eAAA;EACA,cAAA;EACA,OAAA;EACA,YAAA;EACA,gBAAA;EACA,eAAA;EACA,kBAAA;EACA,QAAA;EACA,MAAA;ACtLA;ADkHA;EAyEA,eAAA;EACA,YAAA;EACA,oBAAA;EACA,kBAAA;EACA,kBAAA;EACA,WAAA;ACxLA;AD0GA;EAkFA,cAAA;EACA,iBAAA;EACA,kBAAA;EACA,WA/EA;AC1GA;ADoGA;EAyFA,4BAAA;EACA,YAAA;EACA,WArFA;EAsFA,eAAA;EACA,cAAA;EACA,kBAAA;EACA,QAAA;EACA,MAAA;EACA,2CAAA;EACA,aAAA;AC1LA;AD2LA;EAEA,oCAAA;EACA,aAAA;AC1LA;AD6LA;EACA,WApGA;EAqGA,eAAA;EACA,YAAA;EACA,YAAA;EACA,mBAAA;EACA,kBAAA;EACA,UAAA;EACA,YAAA;EACA,sBAAA;EACA,WAAA;AC3LA;AD4LA;EAEA,gBAhHA;EAiHA,WAAA;EACA,WAAA;EACA,QAAA;EACA,kBAAA;EACA,QAAA;EACA,sBAAA;EACA,WAAA;AC3LA;AD6LA;EACA,yBAAA;AC3LA;AD6LA;EACA,wBAAA;AC3LA;AD+LA;EAEA,mBAlIA;EAmIA,SAAA;EACA,UAAA;AC9LA;ADqMA;EACA,2BAAA;EACA,0BAAA;EACA,eAAA;EACA,cAAA;EACA,kBAAA;EACA,aAAA;ACnMA;ADoMA;EAEA,aAAA;EACA,qBArJA;AC9CA;ADsMA;EACA,UAAA;EACA,QAAA;EACA,yBAAA;ACpMA;ADqMA;EAEA,sBAAA;EACA,mCAAA;EACA,+BAAA;ACpMA;ADuMA;EACA,WAAA;EACA,QAAA;EACA,yBAAA;ACrMA;ADsMA;EAEA,sBAAA;EACA,mCAAA;EACA,2BAAA;ACrMA;AD4MA;AACA;IACA,kCAAA;IACA,WAAA;ACzME;AD2MF;IACA,kCAAA;IACA,cAAA;ACzME;AD2MF;IACA,kCAAA;IACA,cAAA;ACzME;AD2MF;IACA,kCAAA;IACA,WAAA;ACzME;AACF;AD2MA;AACA;IACA,kCAAA;IACA,UAAA;ACzME;AD2MF;IACA,kCAAA;IACA,aAAA;ACzME;AD2MF;IACA,kCAAA;IACA,aAAA;ACzME;AD2MF;IACA,kCAAA;IACA,UAAA;ACzME;AACF;;AAEA,sCAAsC\",\"file\":\"overlay.vue\",\"sourcesContent\":[\"\\r\\n \\r\\n
\\r\\n\\r\\n
\\r\\n
\\r\\n
\\r\\n
\\r\\n
![]()
\\r\\n
\\r\\n
{{ this.$parent.description }}
\\r\\n
\\r\\n
\\r\\n\\r\\n
\\r\\n\\r\\n
\\r\\n
\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\",\".silentbox-is-opened {\\n overflow: hidden;\\n}\\n\\n#silentbox-overlay {\\n display: block;\\n height: 100vh;\\n left: 0;\\n position: fixed;\\n top: 0;\\n width: 100vw;\\n z-index: 999;\\n}\\n#silentbox-overlay__background {\\n background: rgba(0, 0, 0, 0.75);\\n backdrop-filter: blur(20px);\\n cursor: default;\\n display: block;\\n height: 100%;\\n left: 0;\\n position: absolute;\\n top: 0;\\n width: 100%;\\n}\\n#silentbox-overlay__content {\\n cursor: default;\\n display: block;\\n height: 100%;\\n position: relative;\\n width: 100%;\\n}\\n#silentbox-overlay__embed {\\n bottom: 0;\\n cursor: default;\\n display: block;\\n height: 80%;\\n left: 0;\\n margin: auto;\\n position: absolute;\\n right: 0;\\n top: -2.5rem;\\n width: 75%;\\n}\\n#silentbox-overlay__embed img,\\n#silentbox-overlay__embed iframe {\\n background-color: #000;\\n bottom: 0;\\n box-shadow: 0 0 1.5rem rgba(0, 0, 0, 0.45);\\n cursor: default;\\n display: block;\\n left: 0;\\n margin: auto;\\n max-height: 100%;\\n max-width: 100%;\\n position: absolute;\\n right: 0;\\n top: 0;\\n}\\n#silentbox-overlay__container {\\n cursor: default;\\n height: 100%;\\n margin: 0 0 1.5rem 0;\\n position: relative;\\n text-align: center;\\n width: 100%;\\n}\\n#silentbox-overlay__description {\\n display: block;\\n padding-top: 1rem;\\n text-align: center;\\n color: #fff;\\n}\\n#silentbox-overlay__close-button {\\n background: rgba(0, 0, 0, 0);\\n border: none;\\n color: #fff;\\n cursor: pointer;\\n height: 2.5rem;\\n position: absolute;\\n right: 0;\\n top: 0;\\n transition: background-color 250ms ease-out;\\n width: 2.5rem;\\n}\\n#silentbox-overlay__close-button:hover, #silentbox-overlay__close-button:focus {\\n background-color: rgba(0, 0, 0, 0.5);\\n outline: none;\\n}\\n#silentbox-overlay__close-button .icon {\\n color: #fff;\\n cursor: pointer;\\n height: 1rem;\\n left: 0.7rem;\\n margin: 50% 50% 0 0;\\n position: absolute;\\n right: 0px;\\n top: -0.5rem;\\n transition: 250ms ease;\\n width: 1rem;\\n}\\n#silentbox-overlay__close-button .icon:before, #silentbox-overlay__close-button .icon:after {\\n background: #fff;\\n content: \\\"\\\";\\n height: 2px;\\n left: 5%;\\n position: absolute;\\n top: 50%;\\n transition: 250ms ease;\\n width: 100%;\\n}\\n#silentbox-overlay__close-button .icon:before {\\n transform: rotate(-45deg);\\n}\\n#silentbox-overlay__close-button .icon:after {\\n transform: rotate(45deg);\\n}\\n#silentbox-overlay__close-button .icon:hover:before, #silentbox-overlay__close-button .icon:hover:after, #silentbox-overlay__close-button .icon:focus:before, #silentbox-overlay__close-button .icon:focus:after {\\n background: #58e8d2;\\n left: 25%;\\n width: 50%;\\n}\\n#silentbox-overlay__arrow-buttons .arrow {\\n border-left: 2px solid #fff;\\n border-top: 2px solid #fff;\\n cursor: pointer;\\n height: 1.5rem;\\n position: absolute;\\n width: 1.5rem;\\n}\\n#silentbox-overlay__arrow-buttons .arrow:hover, #silentbox-overlay__arrow-buttons .arrow:focus {\\n outline: none;\\n border-color: #58e8d2;\\n}\\n#silentbox-overlay__arrow-buttons .arrow-previous {\\n left: 2rem;\\n top: 50%;\\n transform: rotate(-45deg);\\n}\\n#silentbox-overlay__arrow-buttons .arrow-previous:hover, #silentbox-overlay__arrow-buttons .arrow-previous:focus {\\n animation-duration: 1s;\\n animation-iteration-count: infinite;\\n animation-name: pulsingPrevious;\\n}\\n#silentbox-overlay__arrow-buttons .arrow-next {\\n right: 2rem;\\n top: 50%;\\n transform: rotate(135deg);\\n}\\n#silentbox-overlay__arrow-buttons .arrow-next:hover, #silentbox-overlay__arrow-buttons .arrow-next:focus {\\n animation-duration: 1s;\\n animation-iteration-count: infinite;\\n animation-name: pulsingNext;\\n}\\n\\n@keyframes pulsingNext {\\n 0% {\\n animation-timing-function: ease-in;\\n right: 2rem;\\n }\\n 25% {\\n animation-timing-function: ease-in;\\n right: 1.75rem;\\n }\\n 75% {\\n animation-timing-function: ease-in;\\n right: 2.25rem;\\n }\\n 100% {\\n animation-timing-function: ease-in;\\n right: 2rem;\\n }\\n}\\n@keyframes pulsingPrevious {\\n 0% {\\n animation-timing-function: ease-in;\\n left: 2rem;\\n }\\n 25% {\\n animation-timing-function: ease-in;\\n left: 1.75rem;\\n }\\n 75% {\\n animation-timing-function: ease-in;\\n left: 2.25rem;\\n }\\n 100% {\\n animation-timing-function: ease-in;\\n left: 2rem;\\n }\\n}\\n\\n/*# sourceMappingURL=overlay.vue.map */\"]}, media: undefined });\n\n };\n /* scoped */\n var __vue_scope_id__$1 = undefined;\n /* module identifier */\n var __vue_module_identifier__$1 = undefined;\n /* functional template */\n var __vue_is_functional_template__$1 = false;\n /* style inject SSR */\n \n\n \n var overlay = normalizeComponent_1(\n { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },\n __vue_inject_styles__$1,\n __vue_script__$1,\n __vue_scope_id__$1,\n __vue_is_functional_template__$1,\n __vue_module_identifier__$1,\n browser,\n undefined\n );\n\n//\n\nvar script$2 = {\n name: 'SilentboxSingle',\n mixins: [ ItemMixin ],\n props: {\n // Media source, it could be an image or a youtube video.\n 'src': {\n type: String,\n required: true\n },\n // Should be video autoplayed.\n 'autoplay': {\n type: Boolean,\n default: function default$1() {\n return false;\n }\n },\n // Short description below image.\n 'description': String,\n 'thumbnailWidth': {\n type: String,\n default: '200px'\n },\n 'thumbnailHeight': {\n type: String,\n default: '150px'\n },\n // Hide player controls\n 'hideControls': {\n type: Boolean,\n default: function default$2() {\n return false;\n }\n }\n },\n data: function data() {\n return {\n overlayVisibility: false,\n embedUrl: undefined,\n items: {\n total: 0,\n position: 0\n }\n }\n },\n methods: {\n /**\n * Hide the Silenbotx overlay.\n * \n * @return {void}\n */\n closeSilentBoxOverlay: function closeSilentBoxOverlay() {\n this.overlayVisibility = false;\n },\n /**\n * Open Silentbox with given media.\n * \n * @return {void}\n */\n openSilentBoxOverlay: function openSilentBoxOverlay() {\n if (this.src !== null) {\n this.embedUrl = this.src;\n }\n this.overlayVisibility = true;\n }\n },\n components: {\n SilentboxOverlay: overlay,\n SilentboxItem: item\n },\n mounted: function mounted() {\n var this$1 = this;\n\n this.$on('closeSilentboxOverlay', function () {\n this$1.overlayVisibility = false;\n });\n\n window.addEventListener('keyup', function (event) {\n if (event.which == 27) {\n this$1.overlayVisibility = false;\n }\n });\n }\n};\n\n/* script */\nvar __vue_script__$2 = script$2;\n\n/* template */\nvar __vue_render__$2 = function() {\n var _vm = this;\n var _h = _vm.$createElement;\n var _c = _vm._self._c || _h;\n return _c(\n \"span\",\n {\n staticClass: \"silentbox-single\",\n attrs: { src: _vm.src },\n on: { click: _vm.openSilentBoxOverlay }\n },\n [\n _vm._t(\"default\", [\n _c(\"img\", {\n attrs: {\n src: _vm.getThumnail(_vm.src),\n width: _vm.thumbnailWidth,\n height: _vm.thumbnailHeight\n }\n })\n ]),\n _vm._v(\" \"),\n _c(\"silentbox-overlay\")\n ],\n 2\n )\n};\nvar __vue_staticRenderFns__$2 = [];\n__vue_render__$2._withStripped = true;\n\n /* style */\n var __vue_inject_styles__$2 = function (inject) {\n if (!inject) { return }\n inject(\"data-v-1add3286_0\", { source: \".silentbox-single {\\n cursor: pointer;\\n text-decoration: underline;\\n}\\n\\n/*# sourceMappingURL=single.vue.map */\", map: {\"version\":3,\"sources\":[\"/mnt/c/Projects/Silencesys/Silentbox/src/Silentbox/components/single.vue\",\"single.vue\"],\"names\":[],\"mappings\":\"AAkGA;EACA,eAAA;EACA,0BAAA;ACjGA;;AAEA,qCAAqC\",\"file\":\"single.vue\",\"sourcesContent\":[\"\\r\\n \\r\\n \\r\\n
\\r\\n \\r\\n \\r\\n \\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\",\".silentbox-single {\\n cursor: pointer;\\n text-decoration: underline;\\n}\\n\\n/*# sourceMappingURL=single.vue.map */\"]}, media: undefined });\n\n };\n /* scoped */\n var __vue_scope_id__$2 = undefined;\n /* module identifier */\n var __vue_module_identifier__$2 = undefined;\n /* functional template */\n var __vue_is_functional_template__$2 = false;\n /* style inject SSR */\n \n\n \n var single = normalizeComponent_1(\n { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },\n __vue_inject_styles__$2,\n __vue_script__$2,\n __vue_scope_id__$2,\n __vue_is_functional_template__$2,\n __vue_module_identifier__$2,\n browser,\n undefined\n );\n\n//\n\nvar script$3 = {\n name: 'SilentboxGroup',\n data: function data() {\n return {\n overlayVisibility: false,\n embedUrl: '',\n items: {\n total: 0,\n position: 0,\n list: []\n },\n autoplay: false,\n description: ''\n }\n },\n watch: {\n /**\n * Update total number of items when object changes.\n *\n * @param {Object} current\n * @param {Object} old\n * @return {void}\n */\n 'items.list': function (current, old) {\n this.updateTotal(current);\n }\n },\n methods: {\n /**\n * Update count of total items in group.\n *\n * @param {object} items\n * @return {void}\n */\n updateTotal: function updateTotal(items) {\n this.items.total = this.items.list.length;\n },\n /**\n * Move to next item in a group.\n *\n * @return {void}\n */\n nextItem: function nextItem() {\n if (this.items.position !== (this.items.total - 1)) {\n this.items.position++;\n } else {\n this.items.position = 0;\n }\n\n this.embedUrl = this.items.list[this.items.position].src;\n\n this.autoplay = (this.items.list[this.items.position].autoplay !== undefined)\n ? this.items.list[this.items.position].autoplay : false;\n\n this.description = (this.items.list[this.items.position].desc !== undefined)\n ? this.items.list[this.items.position].desc : false;\n },\n /**\n * Move to previous item in a group.\n *\n * @return {void}\n */\n prevItem: function prevItem() {\n if (this.items.position !== 0) {\n this.items.position--;\n } else {\n this.items.position = this.items.total - 1;\n }\n\n this.embedUrl = this.items.list[this.items.position].src;\n\n this.autoplay = (this.items.list[this.items.position].autoplay !== undefined)\n ? this.items.list[this.items.position] : false;\n\n this.description = (this.items.list[this.items.position].desc !== undefined)\n ? this.items.list[this.items.position].desc : false;\n },\n /**\n * Set item that shuld be displayed.\n *\n * @return {void}\n */\n setOpened: function setOpened(item) {\n this.embedUrl = item.url;\n this.items.position = item.position;\n this.overlayVisibility = true;\n this.autoplay = item.autoplay;\n this.description = item.description;\n }\n },\n components: {\n 'silentbox-overlay': overlay\n },\n mounted: function mounted() {\n var this$1 = this;\n\n // Hide overlay when user click outside or on close button.\n this.$on('closeSilentboxOverlay', function () {\n this$1.overlayVisibility = false;\n });\n\n // Set first opened item when overlay opens.\n this.$on('openSilentboxOverlay', function (item) {\n this$1.setOpened(item);\n });\n\n // Update total number of available items in group.\n this.updateTotal(this.items);\n\n // Listen to key events.\n window.addEventListener('keyup', function (event) {\n // Escape: 27\n if (event.which === 27) {\n this$1.overlayVisibility = false;\n }\n // Right arrow: 39\n if (event.which === 39) {\n this$1.nextItem();\n }\n // Left arrow: 37\n if (event.which === 37) {\n this$1.prevItem();\n }\n });\n }\n};\n\n/* script */\nvar __vue_script__$3 = script$3;\n\n/* template */\nvar __vue_render__$3 = function() {\n var _vm = this;\n var _h = _vm.$createElement;\n var _c = _vm._self._c || _h;\n return _c(\n \"section\",\n { attrs: { id: \"silentbox-group\" } },\n [_vm._t(\"default\"), _vm._v(\" \"), _c(\"silentbox-overlay\")],\n 2\n )\n};\nvar __vue_staticRenderFns__$3 = [];\n__vue_render__$3._withStripped = true;\n\n /* style */\n var __vue_inject_styles__$3 = undefined;\n /* scoped */\n var __vue_scope_id__$3 = undefined;\n /* module identifier */\n var __vue_module_identifier__$3 = undefined;\n /* functional template */\n var __vue_is_functional_template__$3 = false;\n /* style inject */\n \n /* style inject SSR */\n \n\n \n var group = normalizeComponent_1(\n { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },\n __vue_inject_styles__$3,\n __vue_script__$3,\n __vue_scope_id__$3,\n __vue_is_functional_template__$3,\n __vue_module_identifier__$3,\n undefined,\n undefined\n );\n\nvar VueSilentbox = {};\r\n\r\nVueSilentbox.install = function(Vue, options) {\r\n Vue.mixin({\r\n components: {\r\n 'silentbox-single': single,\r\n 'silentbox-group': group,\r\n 'silentbox-item': item\r\n }\r\n });\r\n};\n\nexport default VueSilentbox;\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","import '@firebase/firestore';\n//# sourceMappingURL=index.esm.js.map\n","'use strict';\nvar $export = require('./_export');\nvar createProperty = require('./_create-property');\n\n// WebKit Array.of isn't generic\n$export($export.S + $export.F * require('./_fails')(function () {\n function F() { /* empty */ }\n return !(Array.of.call(F) instanceof F);\n}), 'Array', {\n // 22.1.2.3 Array.of( ...items)\n of: function of(/* ...args */) {\n var index = 0;\n var aLen = arguments.length;\n var result = new (typeof this == 'function' ? this : Array)(aLen);\n while (aLen > index) createProperty(result, index, arguments[index++]);\n result.length = aLen;\n return result;\n }\n});\n","//! moment.js locale configuration\n//! locale : Cambodian [km]\n//! author : Kruy Vanna : https://github.com/kruyvanna\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var symbolMap = {\n 1: '១',\n 2: '២',\n 3: '៣',\n 4: '៤',\n 5: '៥',\n 6: '៦',\n 7: '៧',\n 8: '៨',\n 9: '៩',\n 0: '០',\n },\n numberMap = {\n '១': '1',\n '២': '2',\n '៣': '3',\n '៤': '4',\n '៥': '5',\n '៦': '6',\n '៧': '7',\n '៨': '8',\n '៩': '9',\n '០': '0',\n };\n\n var km = moment.defineLocale('km', {\n months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(\n '_'\n ),\n monthsShort:\n 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(\n '_'\n ),\n weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),\n weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),\n weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY HH:mm',\n LLLL: 'dddd, D MMMM YYYY HH:mm',\n },\n meridiemParse: /ព្រឹក|ល្ងាច/,\n isPM: function (input) {\n return input === 'ល្ងាច';\n },\n meridiem: function (hour, minute, isLower) {\n if (hour < 12) {\n return 'ព្រឹក';\n } else {\n return 'ល្ងាច';\n }\n },\n calendar: {\n sameDay: '[ថ្ងៃនេះ ម៉ោង] LT',\n nextDay: '[ស្អែក ម៉ោង] LT',\n nextWeek: 'dddd [ម៉ោង] LT',\n lastDay: '[ម្សិលមិញ ម៉ោង] LT',\n lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: '%sទៀត',\n past: '%sមុន',\n s: 'ប៉ុន្មានវិនាទី',\n ss: '%d វិនាទី',\n m: 'មួយនាទី',\n mm: '%d នាទី',\n h: 'មួយម៉ោង',\n hh: '%d ម៉ោង',\n d: 'មួយថ្ងៃ',\n dd: '%d ថ្ងៃ',\n M: 'មួយខែ',\n MM: '%d ខែ',\n y: 'មួយឆ្នាំ',\n yy: '%d ឆ្នាំ',\n },\n dayOfMonthOrdinalParse: /ទី\\d{1,2}/,\n ordinal: 'ទី%d',\n preparse: function (string) {\n return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) {\n return numberMap[match];\n });\n },\n postformat: function (string) {\n return string.replace(/\\d/g, function (match) {\n return symbolMap[match];\n });\n },\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 4, // The week that contains Jan 4th is the first week of the year.\n },\n });\n\n return km;\n\n})));\n","var isObject = require('./_is-object');\nvar isArray = require('./_is-array');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (original) {\n var C;\n if (isArray(original)) {\n C = original.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? Array : C;\n};\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: !0\n});\n\nvar t = require(\"tslib\"), e = require(\"@firebase/app\"), n = require(\"@firebase/logger\"), r = require(\"@firebase/util\"), i = require(\"@firebase/webchannel-wrapper\"), o = require(\"@firebase/component\");\n\nfunction s(t) {\n return t && \"object\" == typeof t && \"default\" in t ? t : {\n default: t\n };\n}\n\nvar u = s(e), a = {\n // Causes are copied from:\n // https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h\n /** Not an error; returned on success. */\n OK: \"ok\",\n /** The operation was cancelled (typically by the caller). */\n CANCELLED: \"cancelled\",\n /** Unknown error or an error from a different error domain. */\n UNKNOWN: \"unknown\",\n /**\n * Client specified an invalid argument. Note that this differs from\n * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are\n * problematic regardless of the state of the system (e.g., a malformed file\n * name).\n */\n INVALID_ARGUMENT: \"invalid-argument\",\n /**\n * Deadline expired before operation could complete. For operations that\n * change the state of the system, this error may be returned even if the\n * operation has completed successfully. For example, a successful response\n * from a server could have been delayed long enough for the deadline to\n * expire.\n */\n DEADLINE_EXCEEDED: \"deadline-exceeded\",\n /** Some requested entity (e.g., file or directory) was not found. */\n NOT_FOUND: \"not-found\",\n /**\n * Some entity that we attempted to create (e.g., file or directory) already\n * exists.\n */\n ALREADY_EXISTS: \"already-exists\",\n /**\n * The caller does not have permission to execute the specified operation.\n * PERMISSION_DENIED must not be used for rejections caused by exhausting\n * some resource (use RESOURCE_EXHAUSTED instead for those errors).\n * PERMISSION_DENIED must not be used if the caller can not be identified\n * (use UNAUTHENTICATED instead for those errors).\n */\n PERMISSION_DENIED: \"permission-denied\",\n /**\n * The request does not have valid authentication credentials for the\n * operation.\n */\n UNAUTHENTICATED: \"unauthenticated\",\n /**\n * Some resource has been exhausted, perhaps a per-user quota, or perhaps the\n * entire file system is out of space.\n */\n RESOURCE_EXHAUSTED: \"resource-exhausted\",\n /**\n * Operation was rejected because the system is not in a state required for\n * the operation's execution. For example, directory to be deleted may be\n * non-empty, an rmdir operation is applied to a non-directory, etc.\n *\n * A litmus test that may help a service implementor in deciding\n * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:\n * (a) Use UNAVAILABLE if the client can retry just the failing call.\n * (b) Use ABORTED if the client should retry at a higher-level\n * (e.g., restarting a read-modify-write sequence).\n * (c) Use FAILED_PRECONDITION if the client should not retry until\n * the system state has been explicitly fixed. E.g., if an \"rmdir\"\n * fails because the directory is non-empty, FAILED_PRECONDITION\n * should be returned since the client should not retry unless\n * they have first fixed up the directory by deleting files from it.\n * (d) Use FAILED_PRECONDITION if the client performs conditional\n * REST Get/Update/Delete on a resource and the resource on the\n * server does not match the condition. E.g., conflicting\n * read-modify-write on the same resource.\n */\n FAILED_PRECONDITION: \"failed-precondition\",\n /**\n * The operation was aborted, typically due to a concurrency issue like\n * sequencer check failures, transaction aborts, etc.\n *\n * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,\n * and UNAVAILABLE.\n */\n ABORTED: \"aborted\",\n /**\n * Operation was attempted past the valid range. E.g., seeking or reading\n * past end of file.\n *\n * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed\n * if the system state changes. For example, a 32-bit file system will\n * generate INVALID_ARGUMENT if asked to read at an offset that is not in the\n * range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from\n * an offset past the current file size.\n *\n * There is a fair bit of overlap between FAILED_PRECONDITION and\n * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error)\n * when it applies so that callers who are iterating through a space can\n * easily look for an OUT_OF_RANGE error to detect when they are done.\n */\n OUT_OF_RANGE: \"out-of-range\",\n /** Operation is not implemented or not supported/enabled in this service. */\n UNIMPLEMENTED: \"unimplemented\",\n /**\n * Internal errors. Means some invariants expected by underlying System has\n * been broken. If you see one of these errors, Something is very broken.\n */\n INTERNAL: \"internal\",\n /**\n * The service is currently unavailable. This is a most likely a transient\n * condition and may be corrected by retrying with a backoff.\n *\n * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,\n * and UNAVAILABLE.\n */\n UNAVAILABLE: \"unavailable\",\n /** Unrecoverable data loss or corruption. */\n DATA_LOSS: \"data-loss\"\n}, c = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, n) || this).code = t, r.message = n, r.name = \"FirebaseError\", \n // HACK: We write a toString property directly because Error is not a real\n // class and so inheritance does not work correctly. We could alternatively\n // do the same \"back-door inheritance\" trick that FirebaseError does.\n r.toString = function() {\n return r.name + \": [code=\" + r.code + \"]: \" + r.message;\n }, r;\n }\n return t.__extends(n, e), n;\n}(Error), h = new n.Logger(\"@firebase/firestore\");\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Converts a Base64 encoded string to a binary string. */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Helper methods are needed because variables can't be exported as read/write\nfunction f() {\n return h.logLevel;\n}\n\n/**\n * Sets the verbosity of Cloud Firestore logs (debug, error, or silent).\n *\n * @param logLevel\n * The verbosity you set for activity and error logging. Can be any of\n * the following values:\n *\n * \n * - `debug` for the most verbose logging level, primarily for\n * debugging.
\n * - `error` to log errors only.
\n * `silent` to turn off logging.
\n *
\n */ function l(e) {\n for (var r = [], i = 1; i < arguments.length; i++) r[i - 1] = arguments[i];\n if (h.logLevel <= n.LogLevel.DEBUG) {\n var o = r.map(v);\n h.debug.apply(h, t.__spreadArrays([ \"Firestore (7.24.0): \" + e ], o));\n }\n}\n\nfunction p(e) {\n for (var r = [], i = 1; i < arguments.length; i++) r[i - 1] = arguments[i];\n if (h.logLevel <= n.LogLevel.ERROR) {\n var o = r.map(v);\n h.error.apply(h, t.__spreadArrays([ \"Firestore (7.24.0): \" + e ], o));\n }\n}\n\nfunction d(e) {\n for (var r = [], i = 1; i < arguments.length; i++) r[i - 1] = arguments[i];\n if (h.logLevel <= n.LogLevel.WARN) {\n var o = r.map(v);\n h.warn.apply(h, t.__spreadArrays([ \"Firestore (7.24.0): \" + e ], o));\n }\n}\n\n/**\n * Converts an additional log parameter to a string representation.\n */ function v(t) {\n if (\"string\" == typeof t) return t;\n try {\n return e = t, JSON.stringify(e);\n } catch (e) {\n // Converting to JSON failed, just log the object directly\n return t;\n }\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /** Formats an object as a JSON string, suitable for logging. */ var e;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Unconditionally fails, throwing an Error with the given message.\n * Messages are stripped in production builds.\n *\n * Returns `never` and can be used in expressions:\n * @example\n * let futureVar = fail('not implemented yet');\n */ function y(t) {\n void 0 === t && (t = \"Unexpected state\");\n // Log the failure in addition to throw an exception, just in case the\n // exception is swallowed.\n var e = \"FIRESTORE (7.24.0) INTERNAL ASSERTION FAILED: \" + t;\n // NOTE: We don't use FirestoreError here because these are internal failures\n // that cannot be handled by the user. (Also it would create a circular\n // dependency between the error and assert modules which doesn't work.)\n throw p(e), new Error(e)\n /**\n * Fails if the given assertion condition is false, throwing an Error with the\n * given message if it did.\n *\n * Messages are stripped in production builds.\n */;\n}\n\nfunction g(t, e) {\n t || y();\n}\n\n/**\n * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an\n * instance of `T` before casting.\n */ function m(t, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ne) {\n return t;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ function w(t) {\n var e = 0;\n for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;\n return e;\n}\n\nfunction _(t, e) {\n for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);\n}\n\nfunction b(t) {\n for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;\n return !0;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Path represents an ordered sequence of string segments.\n */ var I = /** @class */ function() {\n function t(t, e, n) {\n void 0 === e ? e = 0 : e > t.length && y(), void 0 === n ? n = t.length - e : n > t.length - e && y(), \n this.segments = t, this.offset = e, this.t = n;\n }\n return Object.defineProperty(t.prototype, \"length\", {\n get: function() {\n return this.t;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function(e) {\n return 0 === t.i(this, e);\n }, t.prototype.child = function(e) {\n var n = this.segments.slice(this.offset, this.limit());\n return e instanceof t ? e.forEach((function(t) {\n n.push(t);\n })) : n.push(e), this.o(n);\n }, \n /** The index of one past the last segment of the path. */ t.prototype.limit = function() {\n return this.offset + this.length;\n }, t.prototype.u = function(t) {\n return t = void 0 === t ? 1 : t, this.o(this.segments, this.offset + t, this.length - t);\n }, t.prototype.h = function() {\n return this.o(this.segments, this.offset, this.length - 1);\n }, t.prototype.l = function() {\n return this.segments[this.offset];\n }, t.prototype._ = function() {\n return this.get(this.length - 1);\n }, t.prototype.get = function(t) {\n return this.segments[this.offset + t];\n }, t.prototype.m = function() {\n return 0 === this.length;\n }, t.prototype.T = function(t) {\n if (t.length < this.length) return !1;\n for (var e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1;\n return !0;\n }, t.prototype.I = function(t) {\n if (this.length + 1 !== t.length) return !1;\n for (var e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1;\n return !0;\n }, t.prototype.forEach = function(t) {\n for (var e = this.offset, n = this.limit(); e < n; e++) t(this.segments[e]);\n }, t.prototype.A = function() {\n return this.segments.slice(this.offset, this.limit());\n }, t.i = function(t, e) {\n for (var n = Math.min(t.length, e.length), r = 0; r < n; r++) {\n var i = t.get(r), o = e.get(r);\n if (i < o) return -1;\n if (i > o) return 1;\n }\n return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;\n }, t;\n}(), E = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.prototype.o = function(t, e, r) {\n return new n(t, e, r);\n }, n.prototype.R = function() {\n // NOTE: The client is ignorant of any path segments containing escape\n // sequences (e.g. __id123__) and just passes them through raw (they exist\n // for legacy reasons and should not be used frequently).\n return this.A().join(\"/\");\n }, n.prototype.toString = function() {\n return this.R();\n }, \n /**\n * Creates a resource path from the given slash-delimited string. If multiple\n * arguments are provided, all components are combined. Leading and trailing\n * slashes from all components are ignored.\n */\n n.g = function() {\n for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];\n // NOTE: The client is ignorant of any path segments containing escape\n // sequences (e.g. __id123__) and just passes them through raw (they exist\n // for legacy reasons and should not be used frequently).\n for (var r = [], i = 0, o = t; i < o.length; i++) {\n var s = o[i];\n if (s.indexOf(\"//\") >= 0) throw new c(a.INVALID_ARGUMENT, \"Invalid segment (\" + s + \"). Paths must not contain // in them.\");\n // Strip leading and traling slashed.\n r.push.apply(r, s.split(\"/\").filter((function(t) {\n return t.length > 0;\n })));\n }\n return new n(r);\n }, n.P = function() {\n return new n([]);\n }, n;\n}(I), T = /^[_a-zA-Z][_a-zA-Z0-9]*$/, N = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.prototype.o = function(t, e, r) {\n return new n(t, e, r);\n }, \n /**\n * Returns true if the string could be used as a segment in a field path\n * without escaping.\n */\n n.V = function(t) {\n return T.test(t);\n }, n.prototype.R = function() {\n return this.A().map((function(t) {\n return t = t.replace(\"\\\\\", \"\\\\\\\\\").replace(\"`\", \"\\\\`\"), n.V(t) || (t = \"`\" + t + \"`\"), \n t;\n })).join(\".\");\n }, n.prototype.toString = function() {\n return this.R();\n }, \n /**\n * Returns true if this field references the key of a document.\n */\n n.prototype.p = function() {\n return 1 === this.length && \"__name__\" === this.get(0);\n }, \n /**\n * The field designating the key of a document.\n */\n n.v = function() {\n return new n([ \"__name__\" ]);\n }, \n /**\n * Parses a field string from the given server-formatted string.\n *\n * - Splitting the empty string is not allowed (for now at least).\n * - Empty segments within the string (e.g. if there are two consecutive\n * separators) are not allowed.\n *\n * TODO(b/37244157): we should make this more strict. Right now, it allows\n * non-identifier path components, even if they aren't escaped.\n */\n n.S = function(t) {\n for (var e = [], r = \"\", i = 0, o = function() {\n if (0 === r.length) throw new c(a.INVALID_ARGUMENT, \"Invalid field path (\" + t + \"). Paths must not be empty, begin with '.', end with '.', or contain '..'\");\n e.push(r), r = \"\";\n }, s = !1; i < t.length; ) {\n var u = t[i];\n if (\"\\\\\" === u) {\n if (i + 1 === t.length) throw new c(a.INVALID_ARGUMENT, \"Path has trailing escape character: \" + t);\n var h = t[i + 1];\n if (\"\\\\\" !== h && \".\" !== h && \"`\" !== h) throw new c(a.INVALID_ARGUMENT, \"Path has invalid escape sequence: \" + t);\n r += h, i += 2;\n } else \"`\" === u ? (s = !s, i++) : \".\" !== u || s ? (r += u, i++) : (o(), i++);\n }\n if (o(), s) throw new c(a.INVALID_ARGUMENT, \"Unterminated ` in path: \" + t);\n return new n(e);\n }, n.P = function() {\n return new n([]);\n }, n;\n}(I), A = /** @class */ function() {\n function t(t) {\n this.path = t;\n }\n return t.D = function(e) {\n return new t(E.g(e));\n }, t.C = function(e) {\n return new t(E.g(e).u(5));\n }, \n /** Returns true if the document is in the specified collectionId. */ t.prototype.N = function(t) {\n return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;\n }, t.prototype.isEqual = function(t) {\n return null !== t && 0 === E.i(this.path, t.path);\n }, t.prototype.toString = function() {\n return this.path.toString();\n }, t.i = function(t, e) {\n return E.i(t.path, e.path);\n }, t.F = function(t) {\n return t.length % 2 == 0;\n }, \n /**\n * Creates and returns a new document key with the given segments.\n *\n * @param segments The segments of the path to the document\n * @return A new instance of DocumentKey\n */\n t.$ = function(e) {\n return new t(new E(e.slice()));\n }, t;\n}();\n\n/**\n * A slash-separated path for navigating resources (documents and collections)\n * within Firestore.\n */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Validates that no arguments were passed in the invocation of functionName.\n *\n * Forward the magic \"arguments\" variable as second parameter on which the\n * parameter validation is performed:\n * validateNoArgs('myFunction', arguments);\n */\nfunction S(t, e) {\n if (0 !== e.length) throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() does not support arguments, but was called with \" + W(e.length, \"argument\") + \".\");\n}\n\n/**\n * Validates the invocation of functionName has the exact number of arguments.\n *\n * Forward the magic \"arguments\" variable as second parameter on which the\n * parameter validation is performed:\n * validateExactNumberOfArgs('myFunction', arguments, 2);\n */ function D(t, e, n) {\n if (e.length !== n) throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires \" + W(n, \"argument\") + \", but was called with \" + W(e.length, \"argument\") + \".\");\n}\n\n/**\n * Validates the invocation of functionName has at least the provided number of\n * arguments (but can have many more).\n *\n * Forward the magic \"arguments\" variable as second parameter on which the\n * parameter validation is performed:\n * validateAtLeastNumberOfArgs('myFunction', arguments, 2);\n */ function x(t, e, n) {\n if (e.length < n) throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires at least \" + W(n, \"argument\") + \", but was called with \" + W(e.length, \"argument\") + \".\");\n}\n\n/**\n * Validates the invocation of functionName has number of arguments between\n * the values provided.\n *\n * Forward the magic \"arguments\" variable as second parameter on which the\n * parameter validation is performed:\n * validateBetweenNumberOfArgs('myFunction', arguments, 2, 3);\n */ function L(t, e, n, r) {\n if (e.length < n || e.length > r) throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires between \" + n + \" and \" + r + \" arguments, but was called with \" + W(e.length, \"argument\") + \".\");\n}\n\n/**\n * Validates the provided argument is an array and has as least the expected\n * number of elements.\n */\n/**\n * Validates the provided positional argument has the native JavaScript type\n * using typeof checks.\n */ function k(t, e, n, r) {\n C(t, e, B(n) + \" argument\", r);\n}\n\n/**\n * Validates the provided argument has the native JavaScript type using\n * typeof checks or is undefined.\n */ function R(t, e, n, r) {\n void 0 !== r && k(t, e, n, r);\n}\n\n/**\n * Validates the provided named option has the native JavaScript type using\n * typeof checks.\n */ function O(t, e, n, r) {\n C(t, e, n + \" option\", r);\n}\n\n/**\n * Validates the provided named option has the native JavaScript type using\n * typeof checks or is undefined.\n */ function P(t, e, n, r) {\n void 0 !== r && O(t, e, n, r);\n}\n\n/**\n * Validates that two boolean options are not set at the same time.\n */\n/**\n * Validates that the provided named option equals one of the expected values.\n */\n/**\n * Validates that the provided named option equals one of the expected values or\n * is undefined.\n */\nfunction V(t, e, n, r, i) {\n void 0 !== r && function(t, e, n, r, i) {\n for (var o = [], s = 0, u = i; s < u.length; s++) {\n var h = u[s];\n if (h === r) return;\n o.push(M(h));\n }\n var f = M(r);\n throw new c(a.INVALID_ARGUMENT, \"Invalid value \" + f + \" provided to function \" + t + '() for option \"' + n + '\". Acceptable values: ' + o.join(\", \"));\n }(t, 0, n, r, i);\n}\n\n/**\n * Validates that the provided argument is a valid enum.\n *\n * @param functionName Function making the validation call.\n * @param enums Array containing all possible values for the enum.\n * @param position Position of the argument in `functionName`.\n * @param argument Argument to validate.\n * @return The value as T if the argument can be converted.\n */ function U(t, e, n, r) {\n if (!e.some((function(t) {\n return t === r;\n }))) throw new c(a.INVALID_ARGUMENT, \"Invalid value \" + M(r) + \" provided to function \" + t + \"() for its \" + B(n) + \" argument. Acceptable values: \" + e.join(\", \"));\n return r;\n}\n\n/** Helper to validate the type of a provided input. */ function C(t, e, n, r) {\n if (!(\"object\" === e ? F(r) : \"non-empty string\" === e ? \"string\" == typeof r && \"\" !== r : typeof r === e)) {\n var i = M(r);\n throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires its \" + n + \" to be of type \" + e + \", but it was: \" + i);\n }\n}\n\n/**\n * Returns true if it's a non-null object without a custom prototype\n * (i.e. excludes Array, Date, etc.).\n */ function F(t) {\n return \"object\" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));\n}\n\n/** Returns a string describing the type / value of the provided input. */ function M(t) {\n if (void 0 === t) return \"undefined\";\n if (null === t) return \"null\";\n if (\"string\" == typeof t) return t.length > 20 && (t = t.substring(0, 20) + \"...\"), \n JSON.stringify(t);\n if (\"number\" == typeof t || \"boolean\" == typeof t) return \"\" + t;\n if (\"object\" == typeof t) {\n if (t instanceof Array) return \"an array\";\n var e = \n /** Hacky method to try to get the constructor name for an object. */\n function(t) {\n if (t.constructor) {\n var e = /function\\s+([^\\s(]+)\\s*\\(/.exec(t.constructor.toString());\n if (e && e.length > 1) return e[1];\n }\n return null;\n }(t);\n return e ? \"a custom \" + e + \" object\" : \"an object\";\n }\n return \"function\" == typeof t ? \"a function\" : y();\n}\n\nfunction q(t, e, n) {\n if (void 0 === n) throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires a valid \" + B(e) + \" argument, but it was undefined.\");\n}\n\n/**\n * Validates the provided positional argument is an object, and its keys and\n * values match the expected keys and types provided in optionTypes.\n */ function j(t, e, n) {\n _(e, (function(e, r) {\n if (n.indexOf(e) < 0) throw new c(a.INVALID_ARGUMENT, \"Unknown option '\" + e + \"' passed to function \" + t + \"(). Available options: \" + n.join(\", \"));\n }));\n}\n\n/**\n * Helper method to throw an error that the provided argument did not pass\n * an instanceof check.\n */ function G(t, e, n, r) {\n var i = M(r);\n return new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires its \" + B(n) + \" argument to be a \" + e + \", but it was: \" + i);\n}\n\nfunction z(t, e, n) {\n if (n <= 0) throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires its \" + B(e) + \" argument to be a positive number, but it was: \" + n + \".\");\n}\n\n/** Converts a number to its english word representation */ function B(t) {\n switch (t) {\n case 1:\n return \"first\";\n\n case 2:\n return \"second\";\n\n case 3:\n return \"third\";\n\n default:\n return t + \"th\";\n }\n}\n\n/**\n * Formats the given word as plural conditionally given the preceding number.\n */ function W(t, e) {\n return t + \" \" + e + (1 === t ? \"\" : \"s\");\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Generates `nBytes` of random bytes.\n *\n * If `nBytes < 0` , an error will be thrown.\n */ function K(t) {\n // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.\n var e = \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n \"undefined\" != typeof self && (self.crypto || self.msCrypto), n = new Uint8Array(t);\n if (e && \"function\" == typeof e.getRandomValues) e.getRandomValues(n); else \n // Falls back to Math.random\n for (var r = 0; r < t; r++) n[r] = Math.floor(256 * Math.random());\n return n;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ var Q = /** @class */ function() {\n function t() {}\n return t.k = function() {\n for (\n // Alphanumeric characters\n var t = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\", e = Math.floor(256 / t.length) * t.length, n = \"\"\n // The largest byte value that is a multiple of `char.length`.\n ; n.length < 20; ) for (var r = K(40), i = 0; i < r.length; ++i) \n // Only accept values that are [0, maxMultiple), this ensures they can\n // be evenly mapped to indices of `chars` via a modulo operation.\n n.length < 20 && r[i] < e && (n += t.charAt(r[i] % t.length));\n return n;\n }, t;\n}();\n\nfunction H(t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n}\n\n/** Helper to compare arrays using isEqual(). */ function Y(t, e, n) {\n return t.length === e.length && t.every((function(t, r) {\n return n(t, e[r]);\n }));\n}\n\n/**\n * Returns the immediate lexicographically-following string. This is useful to\n * construct an inclusive range for indexeddb iterators.\n */ function $(t) {\n // Return the input string, with an additional NUL byte appended.\n return t + \"\\0\";\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Immutable class that represents a \"proto\" byte string.\n *\n * Proto byte strings can either be Base64-encoded strings or Uint8Arrays when\n * sent on the wire. This class abstracts away this differentiation by holding\n * the proto byte string in a common class that must be converted into a string\n * before being sent as a proto.\n */ var X = /** @class */ function() {\n function t(t) {\n this.M = t;\n }\n return t.fromBase64String = function(e) {\n return new t(atob(e));\n }, t.fromUint8Array = function(e) {\n return new t(\n /**\n * Helper function to convert an Uint8array to a binary string.\n */\n function(t) {\n for (var e = \"\", n = 0; n < t.length; ++n) e += String.fromCharCode(t[n]);\n return e;\n }(e));\n }, t.prototype.toBase64 = function() {\n return t = this.M, btoa(t);\n /** Converts a binary string to a Base64 encoded string. */ var t;\n /** True if and only if the Base64 conversion functions are available. */ }, \n t.prototype.toUint8Array = function() {\n return function(t) {\n for (var e = new Uint8Array(t.length), n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);\n return e;\n }(this.M);\n }, t.prototype.O = function() {\n return 2 * this.M.length;\n }, t.prototype.L = function(t) {\n return H(this.M, t.M);\n }, t.prototype.isEqual = function(t) {\n return this.M === t.M;\n }, t;\n}();\n\nX.B = new X(\"\");\n\nvar J = /** @class */ function() {\n function t(t) {\n this.q = t;\n }\n /**\n * Creates a new `Bytes` object from the given Base64 string, converting it to\n * bytes.\n *\n * @param base64 The Base64 string used to create the `Bytes` object.\n */ return t.fromBase64String = function(e) {\n try {\n return new t(X.fromBase64String(e));\n } catch (e) {\n throw new c(a.INVALID_ARGUMENT, \"Failed to construct Bytes from Base64 string: \" + e);\n }\n }, \n /**\n * Creates a new `Bytes` object from the given Uint8Array.\n *\n * @param array The Uint8Array used to create the `Bytes` object.\n */\n t.fromUint8Array = function(e) {\n return new t(X.fromUint8Array(e));\n }, \n /**\n * Returns the underlying bytes as a Base64-encoded string.\n *\n * @return The Base64-encoded string created from the `Bytes` object.\n */\n t.prototype.toBase64 = function() {\n return this.q.toBase64();\n }, \n /**\n * Returns the underlying bytes in a new `Uint8Array`.\n *\n * @return The Uint8Array created from the `Bytes` object.\n */\n t.prototype.toUint8Array = function() {\n return this.q.toUint8Array();\n }, \n /**\n * Returns a string representation of the `Bytes` object.\n *\n * @return A string representation of the `Bytes` object.\n */\n t.prototype.toString = function() {\n return \"Bytes(base64: \" + this.toBase64() + \")\";\n }, \n /**\n * Returns true if this `Bytes` object is equal to the provided one.\n *\n * @param other The `Bytes` object to compare against.\n * @return true if this `Bytes` object is equal to the provided one.\n */\n t.prototype.isEqual = function(t) {\n return this.q.isEqual(t.q);\n }, t;\n}();\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Helper function to assert Uint8Array is available at runtime. */ function Z() {\n if (\"undefined\" == typeof Uint8Array) throw new c(a.UNIMPLEMENTED, \"Uint8Arrays are not available in this environment.\");\n}\n\n/** Helper function to assert Base64 functions are available at runtime. */ function tt() {\n if (\"undefined\" == typeof atob) throw new c(a.UNIMPLEMENTED, \"Blobs are unavailable in Firestore in this environment.\");\n}\n\n/**\n * Immutable class holding a blob (binary data).\n *\n * This class is directly exposed in the public API. It extends the Bytes class\n * of the firestore-exp API to support `instanceof Bytes` checks during user\n * data conversion.\n *\n * Note that while you can't hide the constructor in JavaScript code, we are\n * using the hack above to make sure no-one outside this module can call it.\n */ var et = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.fromBase64String = function(t) {\n D(\"Blob.fromBase64String\", arguments, 1), k(\"Blob.fromBase64String\", \"string\", 1, t), \n tt();\n try {\n return new n(X.fromBase64String(t));\n } catch (t) {\n throw new c(a.INVALID_ARGUMENT, \"Failed to construct Blob from Base64 string: \" + t);\n }\n }, n.fromUint8Array = function(t) {\n if (D(\"Blob.fromUint8Array\", arguments, 1), Z(), !(t instanceof Uint8Array)) throw G(\"Blob.fromUint8Array\", \"Uint8Array\", 1, t);\n return new n(X.fromUint8Array(t));\n }, n.prototype.toBase64 = function() {\n return D(\"Blob.toBase64\", arguments, 0), tt(), e.prototype.toBase64.call(this);\n }, n.prototype.toUint8Array = function() {\n return D(\"Blob.toUint8Array\", arguments, 0), Z(), e.prototype.toUint8Array.call(this);\n }, n.prototype.toString = function() {\n return \"Blob(base64: \" + this.toBase64() + \")\";\n }, n;\n}(J), nt = \n/**\n * Constructs a DatabaseInfo using the provided host, databaseId and\n * persistenceKey.\n *\n * @param databaseId The database to use.\n * @param persistenceKey A unique identifier for this Firestore's local\n * storage (used in conjunction with the databaseId).\n * @param host The Firestore backend host to connect to.\n * @param ssl Whether to use SSL when connecting.\n * @param forceLongPolling Whether to use the forceLongPolling option\n * when using WebChannel as the network transport.\n * @param autoDetectLongPolling Whether to use the detectBufferingProxy\n * option when using WebChannel as the network transport.\n */\nfunction(t, e, n, r, i, o) {\n this.U = t, this.persistenceKey = e, this.host = n, this.ssl = r, this.forceLongPolling = i, \n this.W = o;\n}, rt = /** @class */ function() {\n function t(t, e) {\n this.projectId = t, this.database = e || \"(default)\";\n }\n return Object.defineProperty(t.prototype, \"j\", {\n get: function() {\n return \"(default)\" === this.database;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function(e) {\n return e instanceof t && e.projectId === this.projectId && e.database === this.database;\n }, t.prototype.L = function(t) {\n return H(this.projectId, t.projectId) || H(this.database, t.database);\n }, t;\n}(), it = /** @class */ function() {\n function t(t, e) {\n this.K = t, this.G = e, \n /**\n * The inner map for a key -> value pair. Due to the possibility of\n * collisions we keep a list of entries that we do a linear search through\n * to find an actual match. Note that collisions should be rare, so we still\n * expect near constant time lookups in practice.\n */\n this.H = {}\n /** Get a value for this key, or undefined if it does not exist. */;\n }\n return t.prototype.get = function(t) {\n var e = this.K(t), n = this.H[e];\n if (void 0 !== n) for (var r = 0, i = n; r < i.length; r++) {\n var o = i[r], s = o[0], u = o[1];\n if (this.G(s, t)) return u;\n }\n }, t.prototype.has = function(t) {\n return void 0 !== this.get(t);\n }, \n /** Put this key and value in the map. */ t.prototype.set = function(t, e) {\n var n = this.K(t), r = this.H[n];\n if (void 0 !== r) {\n for (var i = 0; i < r.length; i++) if (this.G(r[i][0], t)) return void (r[i] = [ t, e ]);\n r.push([ t, e ]);\n } else this.H[n] = [ [ t, e ] ];\n }, \n /**\n * Remove this key from the map. Returns a boolean if anything was deleted.\n */\n t.prototype.delete = function(t) {\n var e = this.K(t), n = this.H[e];\n if (void 0 === n) return !1;\n for (var r = 0; r < n.length; r++) if (this.G(n[r][0], t)) return 1 === n.length ? delete this.H[e] : n.splice(r, 1), \n !0;\n return !1;\n }, t.prototype.forEach = function(t) {\n _(this.H, (function(e, n) {\n for (var r = 0, i = n; r < i.length; r++) {\n var o = i[r], s = o[0], u = o[1];\n t(s, u);\n }\n }));\n }, t.prototype.m = function() {\n return b(this.H);\n }, t;\n}(), ot = /** @class */ function() {\n /**\n * Creates a new timestamp.\n *\n * @param seconds The number of seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n * @param nanoseconds The non-negative fractions of a second at nanosecond\n * resolution. Negative second values with fractions must still have\n * non-negative nanoseconds values that count forward in time. Must be\n * from 0 to 999,999,999 inclusive.\n */\n function t(t, e) {\n if (this.seconds = t, this.nanoseconds = e, e < 0) throw new c(a.INVALID_ARGUMENT, \"Timestamp nanoseconds out of range: \" + e);\n if (e >= 1e9) throw new c(a.INVALID_ARGUMENT, \"Timestamp nanoseconds out of range: \" + e);\n if (t < -62135596800) throw new c(a.INVALID_ARGUMENT, \"Timestamp seconds out of range: \" + t);\n // This will break in the year 10,000.\n if (t >= 253402300800) throw new c(a.INVALID_ARGUMENT, \"Timestamp seconds out of range: \" + t);\n }\n /**\n * Creates a new timestamp with the current date, with millisecond precision.\n *\n * @return a new timestamp representing the current date.\n */ return t.now = function() {\n return t.fromMillis(Date.now());\n }, \n /**\n * Creates a new timestamp from the given date.\n *\n * @param date The date to initialize the `Timestamp` from.\n * @return A new `Timestamp` representing the same point in time as the given\n * date.\n */\n t.fromDate = function(e) {\n return t.fromMillis(e.getTime());\n }, \n /**\n * Creates a new timestamp from the given number of milliseconds.\n *\n * @param milliseconds Number of milliseconds since Unix epoch\n * 1970-01-01T00:00:00Z.\n * @return A new `Timestamp` representing the same point in time as the given\n * number of milliseconds.\n */\n t.fromMillis = function(e) {\n var n = Math.floor(e / 1e3);\n return new t(n, 1e6 * (e - 1e3 * n));\n }, \n /**\n * Converts a `Timestamp` to a JavaScript `Date` object. This conversion causes\n * a loss of precision since `Date` objects only support millisecond precision.\n *\n * @return JavaScript `Date` object representing the same point in time as\n * this `Timestamp`, with millisecond precision.\n */\n t.prototype.toDate = function() {\n return new Date(this.toMillis());\n }, \n /**\n * Converts a `Timestamp` to a numeric timestamp (in milliseconds since\n * epoch). This operation causes a loss of precision.\n *\n * @return The point in time corresponding to this timestamp, represented as\n * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.\n */\n t.prototype.toMillis = function() {\n return 1e3 * this.seconds + this.nanoseconds / 1e6;\n }, t.prototype.Y = function(t) {\n return this.seconds === t.seconds ? H(this.nanoseconds, t.nanoseconds) : H(this.seconds, t.seconds);\n }, \n /**\n * Returns true if this `Timestamp` is equal to the provided one.\n *\n * @param other The `Timestamp` to compare against.\n * @return true if this `Timestamp` is equal to the provided one.\n */\n t.prototype.isEqual = function(t) {\n return t.seconds === this.seconds && t.nanoseconds === this.nanoseconds;\n }, t.prototype.toString = function() {\n return \"Timestamp(seconds=\" + this.seconds + \", nanoseconds=\" + this.nanoseconds + \")\";\n }, t.prototype.toJSON = function() {\n return {\n seconds: this.seconds,\n nanoseconds: this.nanoseconds\n };\n }, \n /**\n * Converts this object to a primitive string, which allows Timestamp objects to be compared\n * using the `>`, `<=`, `>=` and `>` operators.\n */\n t.prototype.valueOf = function() {\n // This method returns a string of the form . where is\n // translated to have a non-negative value and both and are left-padded\n // with zeroes to be a consistent length. Strings with this format then have a lexiographical\n // ordering that matches the expected ordering. The translation is done to avoid\n // having a leading negative sign (i.e. a leading '-' character) in its string representation,\n // which would affect its lexiographical ordering.\n var t = this.seconds - -62135596800;\n // Note: Up to 12 decimal digits are required to represent all valid 'seconds' values.\n return String(t).padStart(12, \"0\") + \".\" + String(this.nanoseconds).padStart(9, \"0\");\n }, t;\n}(), st = /** @class */ function() {\n function t(t) {\n this.timestamp = t;\n }\n return t.J = function(e) {\n return new t(e);\n }, t.min = function() {\n return new t(new ot(0, 0));\n }, t.prototype.L = function(t) {\n return this.timestamp.Y(t.timestamp);\n }, t.prototype.isEqual = function(t) {\n return this.timestamp.isEqual(t.timestamp);\n }, \n /** Returns a number representation of the version for use in spec tests. */ t.prototype.X = function() {\n // Convert to microseconds.\n return 1e6 * this.timestamp.seconds + this.timestamp.nanoseconds / 1e3;\n }, t.prototype.toString = function() {\n return \"SnapshotVersion(\" + this.timestamp.toString() + \")\";\n }, t.prototype.Z = function() {\n return this.timestamp;\n }, t;\n}();\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Returns whether a variable is either undefined or null.\n */\nfunction ut(t) {\n return null == t;\n}\n\n/** Returns whether the value represents -0. */ function at(t) {\n // Detect if the value is -0.0. Based on polyfill from\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n return 0 === t && 1 / t == -1 / 0;\n}\n\n/**\n * Returns whether a value is an integer and in the safe integer range\n * @param value The value to test for being an integer and in the safe range\n */ function ct(t) {\n return \"number\" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Visible for testing\nvar ht = function(t, e, n, r, i, o, s) {\n void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), \n void 0 === i && (i = null), void 0 === o && (o = null), void 0 === s && (s = null), \n this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i, \n this.startAt = o, this.endAt = s, this.tt = null;\n};\n\n/**\n * Initializes a Target with a path and optional additional query constraints.\n * Path must currently be empty if this is a collection group query.\n *\n * NOTE: you should always construct `Target` from `Query.toTarget` instead of\n * using this factory method, because `Query` provides an implicit `orderBy`\n * property.\n */ function ft(t, e, n, r, i, o, s) {\n return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), \n void 0 === i && (i = null), void 0 === o && (o = null), void 0 === s && (s = null), \n new ht(t, e, n, r, i, o, s);\n}\n\nfunction lt(t) {\n var e = m(t);\n if (null === e.tt) {\n var n = e.path.R();\n null !== e.collectionGroup && (n += \"|cg:\" + e.collectionGroup), n += \"|f:\", n += e.filters.map((function(t) {\n return function(t) {\n // TODO(b/29183165): Technically, this won't be unique if two values have\n // the same description, such as the int 3 and the string \"3\". So we should\n // add the types in here somehow, too.\n return t.field.R() + t.op.toString() + re(t.value);\n }(t);\n })).join(\",\"), n += \"|ob:\", n += e.orderBy.map((function(t) {\n return (e = t).field.R() + e.dir;\n var e;\n })).join(\",\"), ut(e.limit) || (n += \"|l:\", n += e.limit), e.startAt && (n += \"|lb:\", \n n += ar(e.startAt)), e.endAt && (n += \"|ub:\", n += ar(e.endAt)), e.tt = n;\n }\n return e.tt;\n}\n\nfunction pt(t, e) {\n if (t.limit !== e.limit) return !1;\n if (t.orderBy.length !== e.orderBy.length) return !1;\n for (var n = 0; n < t.orderBy.length; n++) if (!pr(t.orderBy[n], e.orderBy[n])) return !1;\n if (t.filters.length !== e.filters.length) return !1;\n for (var r = 0; r < t.filters.length; r++) if (i = t.filters[r], o = e.filters[r], \n i.op !== o.op || !i.field.isEqual(o.field) || !Zt(i.value, o.value)) return !1;\n var i, o;\n return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!hr(t.startAt, e.startAt) && hr(t.endAt, e.endAt);\n}\n\nfunction dt(t) {\n return A.F(t.path) && null === t.collectionGroup && 0 === t.filters.length;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An immutable set of metadata that the local store tracks for each target.\n */ var vt, yt, gt = /** @class */ function() {\n function t(\n /** The target being listened to. */\n t, \n /**\n * The target ID to which the target corresponds; Assigned by the\n * LocalStore for user listens and by the SyncEngine for limbo watches.\n */\n e, \n /** The purpose of the target. */\n n, \n /**\n * The sequence number of the last transaction during which this target data\n * was modified.\n */\n r, \n /** The latest snapshot version seen for this target. */\n i\n /**\n * The maximum snapshot version at which the associated view\n * contained no limbo documents.\n */ , o\n /**\n * An opaque, server-assigned token that allows watching a target to be\n * resumed after disconnecting without retransmitting all the data that\n * matches the target. The resume token essentially identifies a point in\n * time from which the server should resume sending results.\n */ , s) {\n void 0 === i && (i = st.min()), void 0 === o && (o = st.min()), void 0 === s && (s = X.B), \n this.target = t, this.targetId = e, this.et = n, this.sequenceNumber = r, this.nt = i, \n this.lastLimboFreeSnapshotVersion = o, this.resumeToken = s;\n }\n /** Creates a new target data instance with an updated sequence number. */ return t.prototype.st = function(e) {\n return new t(this.target, this.targetId, this.et, e, this.nt, this.lastLimboFreeSnapshotVersion, this.resumeToken);\n }, \n /**\n * Creates a new target data instance with an updated resume token and\n * snapshot version.\n */\n t.prototype.it = function(e, n) {\n return new t(this.target, this.targetId, this.et, this.sequenceNumber, n, this.lastLimboFreeSnapshotVersion, e);\n }, \n /**\n * Creates a new target data instance with an updated last limbo free\n * snapshot version number.\n */\n t.prototype.rt = function(e) {\n return new t(this.target, this.targetId, this.et, this.sequenceNumber, this.nt, e, this.resumeToken);\n }, t;\n}(), mt = \n// TODO(b/33078163): just use simplest form of existence filter for now\nfunction(t) {\n this.count = t;\n};\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Determines whether an error code represents a permanent error when received\n * in response to a non-write operation.\n *\n * See isPermanentWriteError for classifying write errors.\n */\nfunction wt(t) {\n switch (t) {\n case a.OK:\n return y();\n\n case a.CANCELLED:\n case a.UNKNOWN:\n case a.DEADLINE_EXCEEDED:\n case a.RESOURCE_EXHAUSTED:\n case a.INTERNAL:\n case a.UNAVAILABLE:\n // Unauthenticated means something went wrong with our token and we need\n // to retry with new credentials which will happen automatically.\n case a.UNAUTHENTICATED:\n return !1;\n\n case a.INVALID_ARGUMENT:\n case a.NOT_FOUND:\n case a.ALREADY_EXISTS:\n case a.PERMISSION_DENIED:\n case a.FAILED_PRECONDITION:\n // Aborted might be retried in some scenarios, but that is dependant on\n // the context and should handled individually by the calling code.\n // See https://cloud.google.com/apis/design/errors.\n case a.ABORTED:\n case a.OUT_OF_RANGE:\n case a.UNIMPLEMENTED:\n case a.DATA_LOSS:\n return !0;\n\n default:\n return y();\n }\n}\n\n/**\n * Determines whether an error code represents a permanent error when received\n * in response to a write operation.\n *\n * Write operations must be handled specially because as of b/119437764, ABORTED\n * errors on the write stream should be retried too (even though ABORTED errors\n * are not generally retryable).\n *\n * Note that during the initial handshake on the write stream an ABORTED error\n * signals that we should discard our stream token (i.e. it is permanent). This\n * means a handshake error should be classified with isPermanentError, above.\n */\n/**\n * Maps an error Code from GRPC status code number, like 0, 1, or 14. These\n * are not the same as HTTP status codes.\n *\n * @returns The Code equivalent to the given GRPC status code. Fails if there\n * is no match.\n */ function _t(t) {\n if (void 0 === t) \n // This shouldn't normally happen, but in certain error cases (like trying\n // to send invalid proto messages) we may get an error with no GRPC code.\n return p(\"GRPC error has no .code\"), a.UNKNOWN;\n switch (t) {\n case vt.OK:\n return a.OK;\n\n case vt.CANCELLED:\n return a.CANCELLED;\n\n case vt.UNKNOWN:\n return a.UNKNOWN;\n\n case vt.DEADLINE_EXCEEDED:\n return a.DEADLINE_EXCEEDED;\n\n case vt.RESOURCE_EXHAUSTED:\n return a.RESOURCE_EXHAUSTED;\n\n case vt.INTERNAL:\n return a.INTERNAL;\n\n case vt.UNAVAILABLE:\n return a.UNAVAILABLE;\n\n case vt.UNAUTHENTICATED:\n return a.UNAUTHENTICATED;\n\n case vt.INVALID_ARGUMENT:\n return a.INVALID_ARGUMENT;\n\n case vt.NOT_FOUND:\n return a.NOT_FOUND;\n\n case vt.ALREADY_EXISTS:\n return a.ALREADY_EXISTS;\n\n case vt.PERMISSION_DENIED:\n return a.PERMISSION_DENIED;\n\n case vt.FAILED_PRECONDITION:\n return a.FAILED_PRECONDITION;\n\n case vt.ABORTED:\n return a.ABORTED;\n\n case vt.OUT_OF_RANGE:\n return a.OUT_OF_RANGE;\n\n case vt.UNIMPLEMENTED:\n return a.UNIMPLEMENTED;\n\n case vt.DATA_LOSS:\n return a.DATA_LOSS;\n\n default:\n return y();\n }\n}\n\n/**\n * Converts an HTTP response's error status to the equivalent error code.\n *\n * @param status An HTTP error response status (\"FAILED_PRECONDITION\",\n * \"UNKNOWN\", etc.)\n * @returns The equivalent Code. Non-matching responses are mapped to\n * Code.UNKNOWN.\n */ (yt = vt || (vt = {}))[yt.OK = 0] = \"OK\", yt[yt.CANCELLED = 1] = \"CANCELLED\", \nyt[yt.UNKNOWN = 2] = \"UNKNOWN\", yt[yt.INVALID_ARGUMENT = 3] = \"INVALID_ARGUMENT\", \nyt[yt.DEADLINE_EXCEEDED = 4] = \"DEADLINE_EXCEEDED\", yt[yt.NOT_FOUND = 5] = \"NOT_FOUND\", \nyt[yt.ALREADY_EXISTS = 6] = \"ALREADY_EXISTS\", yt[yt.PERMISSION_DENIED = 7] = \"PERMISSION_DENIED\", \nyt[yt.UNAUTHENTICATED = 16] = \"UNAUTHENTICATED\", yt[yt.RESOURCE_EXHAUSTED = 8] = \"RESOURCE_EXHAUSTED\", \nyt[yt.FAILED_PRECONDITION = 9] = \"FAILED_PRECONDITION\", yt[yt.ABORTED = 10] = \"ABORTED\", \nyt[yt.OUT_OF_RANGE = 11] = \"OUT_OF_RANGE\", yt[yt.UNIMPLEMENTED = 12] = \"UNIMPLEMENTED\", \nyt[yt.INTERNAL = 13] = \"INTERNAL\", yt[yt.UNAVAILABLE = 14] = \"UNAVAILABLE\", yt[yt.DATA_LOSS = 15] = \"DATA_LOSS\";\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// An immutable sorted map implementation, based on a Left-leaning Red-Black\n// tree.\nvar bt = /** @class */ function() {\n function t(t, e) {\n this.i = t, this.root = e || Et.EMPTY;\n }\n // Returns a copy of the map, with the specified key/value added or replaced.\n return t.prototype.ot = function(e, n) {\n return new t(this.i, this.root.ot(e, n, this.i).copy(null, null, Et.at, null, null));\n }, \n // Returns a copy of the map, with the specified key removed.\n t.prototype.remove = function(e) {\n return new t(this.i, this.root.remove(e, this.i).copy(null, null, Et.at, null, null));\n }, \n // Returns the value of the node with the given key, or null.\n t.prototype.get = function(t) {\n for (var e = this.root; !e.m(); ) {\n var n = this.i(t, e.key);\n if (0 === n) return e.value;\n n < 0 ? e = e.left : n > 0 && (e = e.right);\n }\n return null;\n }, \n // Returns the index of the element in this sorted map, or -1 if it doesn't\n // exist.\n t.prototype.indexOf = function(t) {\n for (\n // Number of nodes that were pruned when descending right\n var e = 0, n = this.root; !n.m(); ) {\n var r = this.i(t, n.key);\n if (0 === r) return e + n.left.size;\n r < 0 ? n = n.left : (\n // Count all nodes left of the node plus the node itself\n e += n.left.size + 1, n = n.right);\n }\n // Node not found\n return -1;\n }, t.prototype.m = function() {\n return this.root.m();\n }, Object.defineProperty(t.prototype, \"size\", {\n // Returns the total number of nodes in the map.\n get: function() {\n return this.root.size;\n },\n enumerable: !1,\n configurable: !0\n }), \n // Returns the minimum key in the map.\n t.prototype.ct = function() {\n return this.root.ct();\n }, \n // Returns the maximum key in the map.\n t.prototype.ut = function() {\n return this.root.ut();\n }, \n // Traverses the map in key order and calls the specified action function\n // for each key/value pair. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n t.prototype.ht = function(t) {\n return this.root.ht(t);\n }, t.prototype.forEach = function(t) {\n this.ht((function(e, n) {\n return t(e, n), !1;\n }));\n }, t.prototype.toString = function() {\n var t = [];\n return this.ht((function(e, n) {\n return t.push(e + \":\" + n), !1;\n })), \"{\" + t.join(\", \") + \"}\";\n }, \n // Traverses the map in reverse key order and calls the specified action\n // function for each key/value pair. If action returns true, traversal is\n // aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n t.prototype.lt = function(t) {\n return this.root.lt(t);\n }, \n // Returns an iterator over the SortedMap.\n t.prototype._t = function() {\n return new It(this.root, null, this.i, !1);\n }, t.prototype.ft = function(t) {\n return new It(this.root, t, this.i, !1);\n }, t.prototype.dt = function() {\n return new It(this.root, null, this.i, !0);\n }, t.prototype.wt = function(t) {\n return new It(this.root, t, this.i, !0);\n }, t;\n}(), It = /** @class */ function() {\n function t(t, e, n, r) {\n this.Tt = r, this.Et = [];\n for (var i = 1; !t.m(); ) if (i = e ? n(t.key, e) : 1, \n // flip the comparison if we're going in reverse\n r && (i *= -1), i < 0) \n // This node is less than our start key. ignore it\n t = this.Tt ? t.left : t.right; else {\n if (0 === i) {\n // This node is exactly equal to our start key. Push it on the stack,\n // but stop iterating;\n this.Et.push(t);\n break;\n }\n // This node is greater than our start key, add it to the stack and move\n // to the next one\n this.Et.push(t), t = this.Tt ? t.right : t.left;\n }\n }\n return t.prototype.It = function() {\n var t = this.Et.pop(), e = {\n key: t.key,\n value: t.value\n };\n if (this.Tt) for (t = t.left; !t.m(); ) this.Et.push(t), t = t.right; else for (t = t.right; !t.m(); ) this.Et.push(t), \n t = t.left;\n return e;\n }, t.prototype.At = function() {\n return this.Et.length > 0;\n }, t.prototype.Rt = function() {\n if (0 === this.Et.length) return null;\n var t = this.Et[this.Et.length - 1];\n return {\n key: t.key,\n value: t.value\n };\n }, t;\n}(), Et = /** @class */ function() {\n function t(e, n, r, i, o) {\n this.key = e, this.value = n, this.color = null != r ? r : t.RED, this.left = null != i ? i : t.EMPTY, \n this.right = null != o ? o : t.EMPTY, this.size = this.left.size + 1 + this.right.size;\n }\n // Returns a copy of the current node, optionally replacing pieces of it.\n return t.prototype.copy = function(e, n, r, i, o) {\n return new t(null != e ? e : this.key, null != n ? n : this.value, null != r ? r : this.color, null != i ? i : this.left, null != o ? o : this.right);\n }, t.prototype.m = function() {\n return !1;\n }, \n // Traverses the tree in key order and calls the specified action function\n // for each node. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n t.prototype.ht = function(t) {\n return this.left.ht(t) || t(this.key, this.value) || this.right.ht(t);\n }, \n // Traverses the tree in reverse key order and calls the specified action\n // function for each node. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n t.prototype.lt = function(t) {\n return this.right.lt(t) || t(this.key, this.value) || this.left.lt(t);\n }, \n // Returns the minimum node in the tree.\n t.prototype.min = function() {\n return this.left.m() ? this : this.left.min();\n }, \n // Returns the maximum key in the tree.\n t.prototype.ct = function() {\n return this.min().key;\n }, \n // Returns the maximum key in the tree.\n t.prototype.ut = function() {\n return this.right.m() ? this.key : this.right.ut();\n }, \n // Returns new tree, with the key/value added.\n t.prototype.ot = function(t, e, n) {\n var r = this, i = n(t, r.key);\n return (r = i < 0 ? r.copy(null, null, null, r.left.ot(t, e, n), null) : 0 === i ? r.copy(null, e, null, null, null) : r.copy(null, null, null, null, r.right.ot(t, e, n))).gt();\n }, t.prototype.Pt = function() {\n if (this.left.m()) return t.EMPTY;\n var e = this;\n return e.left.yt() || e.left.left.yt() || (e = e.Vt()), (e = e.copy(null, null, null, e.left.Pt(), null)).gt();\n }, \n // Returns new tree, with the specified item removed.\n t.prototype.remove = function(e, n) {\n var r, i = this;\n if (n(e, i.key) < 0) i.left.m() || i.left.yt() || i.left.left.yt() || (i = i.Vt()), \n i = i.copy(null, null, null, i.left.remove(e, n), null); else {\n if (i.left.yt() && (i = i.bt()), i.right.m() || i.right.yt() || i.right.left.yt() || (i = i.vt()), \n 0 === n(e, i.key)) {\n if (i.right.m()) return t.EMPTY;\n r = i.right.min(), i = i.copy(r.key, r.value, null, null, i.right.Pt());\n }\n i = i.copy(null, null, null, null, i.right.remove(e, n));\n }\n return i.gt();\n }, t.prototype.yt = function() {\n return this.color;\n }, \n // Returns new tree after performing any needed rotations.\n t.prototype.gt = function() {\n var t = this;\n return t.right.yt() && !t.left.yt() && (t = t.St()), t.left.yt() && t.left.left.yt() && (t = t.bt()), \n t.left.yt() && t.right.yt() && (t = t.Dt()), t;\n }, t.prototype.Vt = function() {\n var t = this.Dt();\n return t.right.left.yt() && (t = (t = (t = t.copy(null, null, null, null, t.right.bt())).St()).Dt()), \n t;\n }, t.prototype.vt = function() {\n var t = this.Dt();\n return t.left.left.yt() && (t = (t = t.bt()).Dt()), t;\n }, t.prototype.St = function() {\n var e = this.copy(null, null, t.RED, null, this.right.left);\n return this.right.copy(null, null, this.color, e, null);\n }, t.prototype.bt = function() {\n var e = this.copy(null, null, t.RED, this.left.right, null);\n return this.left.copy(null, null, this.color, null, e);\n }, t.prototype.Dt = function() {\n var t = this.left.copy(null, null, !this.left.color, null, null), e = this.right.copy(null, null, !this.right.color, null, null);\n return this.copy(null, null, !this.color, t, e);\n }, \n // For testing.\n t.prototype.Ct = function() {\n var t = this.Nt();\n return Math.pow(2, t) <= this.size + 1;\n }, \n // In a balanced RB tree, the black-depth (number of black nodes) from root to\n // leaves is equal on both sides. This function verifies that or asserts.\n t.prototype.Nt = function() {\n if (this.yt() && this.left.yt()) throw y();\n if (this.right.yt()) throw y();\n var t = this.left.Nt();\n if (t !== this.right.Nt()) throw y();\n return t + (this.yt() ? 0 : 1);\n }, t;\n}();\n\n// end SortedMap\n// An iterator over an LLRBNode.\n// end LLRBNode\n// Empty node is shared between all LLRB trees.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nEt.EMPTY = null, Et.RED = !0, Et.at = !1, \n// end LLRBEmptyNode\nEt.EMPTY = new (/** @class */ function() {\n function t() {\n this.size = 0;\n }\n return Object.defineProperty(t.prototype, \"key\", {\n get: function() {\n throw y();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"value\", {\n get: function() {\n throw y();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"color\", {\n get: function() {\n throw y();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"left\", {\n get: function() {\n throw y();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"right\", {\n get: function() {\n throw y();\n },\n enumerable: !1,\n configurable: !0\n }), \n // Returns a copy of the current node.\n t.prototype.copy = function(t, e, n, r, i) {\n return this;\n }, \n // Returns a copy of the tree, with the specified key/value added.\n t.prototype.ot = function(t, e, n) {\n return new Et(t, e);\n }, \n // Returns a copy of the tree, with the specified key removed.\n t.prototype.remove = function(t, e) {\n return this;\n }, t.prototype.m = function() {\n return !0;\n }, t.prototype.ht = function(t) {\n return !1;\n }, t.prototype.lt = function(t) {\n return !1;\n }, t.prototype.ct = function() {\n return null;\n }, t.prototype.ut = function() {\n return null;\n }, t.prototype.yt = function() {\n return !1;\n }, \n // For testing.\n t.prototype.Ct = function() {\n return !0;\n }, t.prototype.Nt = function() {\n return 0;\n }, t;\n}());\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * SortedSet is an immutable (copy-on-write) collection that holds elements\n * in order specified by the provided comparator.\n *\n * NOTE: if provided comparator returns 0 for two elements, we consider them to\n * be equal!\n */\nvar Tt = /** @class */ function() {\n function t(t) {\n this.i = t, this.data = new bt(this.i);\n }\n return t.prototype.has = function(t) {\n return null !== this.data.get(t);\n }, t.prototype.first = function() {\n return this.data.ct();\n }, t.prototype.last = function() {\n return this.data.ut();\n }, Object.defineProperty(t.prototype, \"size\", {\n get: function() {\n return this.data.size;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.indexOf = function(t) {\n return this.data.indexOf(t);\n }, \n /** Iterates elements in order defined by \"comparator\" */ t.prototype.forEach = function(t) {\n this.data.ht((function(e, n) {\n return t(e), !1;\n }));\n }, \n /** Iterates over `elem`s such that: range[0] <= elem < range[1]. */ t.prototype.Ft = function(t, e) {\n for (var n = this.data.ft(t[0]); n.At(); ) {\n var r = n.It();\n if (this.i(r.key, t[1]) >= 0) return;\n e(r.key);\n }\n }, \n /**\n * Iterates over `elem`s such that: start <= elem until false is returned.\n */\n t.prototype.xt = function(t, e) {\n var n;\n for (n = void 0 !== e ? this.data.ft(e) : this.data._t(); n.At(); ) if (!t(n.It().key)) return;\n }, \n /** Finds the least element greater than or equal to `elem`. */ t.prototype.$t = function(t) {\n var e = this.data.ft(t);\n return e.At() ? e.It().key : null;\n }, t.prototype._t = function() {\n return new Nt(this.data._t());\n }, t.prototype.ft = function(t) {\n return new Nt(this.data.ft(t));\n }, \n /** Inserts or updates an element */ t.prototype.add = function(t) {\n return this.copy(this.data.remove(t).ot(t, !0));\n }, \n /** Deletes an element */ t.prototype.delete = function(t) {\n return this.has(t) ? this.copy(this.data.remove(t)) : this;\n }, t.prototype.m = function() {\n return this.data.m();\n }, t.prototype.kt = function(t) {\n var e = this;\n // Make sure `result` always refers to the larger one of the two sets.\n return e.size < t.size && (e = t, t = this), t.forEach((function(t) {\n e = e.add(t);\n })), e;\n }, t.prototype.isEqual = function(e) {\n if (!(e instanceof t)) return !1;\n if (this.size !== e.size) return !1;\n for (var n = this.data._t(), r = e.data._t(); n.At(); ) {\n var i = n.It().key, o = r.It().key;\n if (0 !== this.i(i, o)) return !1;\n }\n return !0;\n }, t.prototype.A = function() {\n var t = [];\n return this.forEach((function(e) {\n t.push(e);\n })), t;\n }, t.prototype.toString = function() {\n var t = [];\n return this.forEach((function(e) {\n return t.push(e);\n })), \"SortedSet(\" + t.toString() + \")\";\n }, t.prototype.copy = function(e) {\n var n = new t(this.i);\n return n.data = e, n;\n }, t;\n}(), Nt = /** @class */ function() {\n function t(t) {\n this.Mt = t;\n }\n return t.prototype.It = function() {\n return this.Mt.It().key;\n }, t.prototype.At = function() {\n return this.Mt.At();\n }, t;\n}(), At = new bt(A.i);\n\nfunction St() {\n return At;\n}\n\nfunction Dt() {\n return St();\n}\n\nvar xt = new bt(A.i);\n\nfunction Lt() {\n return xt;\n}\n\nvar kt = new bt(A.i), Rt = new Tt(A.i);\n\nfunction Ot() {\n for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];\n for (var n = Rt, r = 0, i = t; r < i.length; r++) {\n var o = i[r];\n n = n.add(o);\n }\n return n;\n}\n\nvar Pt = new Tt(H);\n\nfunction Vt() {\n return Pt;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * DocumentSet is an immutable (copy-on-write) collection that holds documents\n * in order specified by the provided comparator. We always add a document key\n * comparator on top of what is provided to guarantee document equality based on\n * the key.\n */ var Ut = /** @class */ function() {\n /** The default ordering is by key if the comparator is omitted */\n function t(t) {\n // We are adding document key comparator to the end as it's the only\n // guaranteed unique property of a document.\n this.i = t ? function(e, n) {\n return t(e, n) || A.i(e.key, n.key);\n } : function(t, e) {\n return A.i(t.key, e.key);\n }, this.Ot = Lt(), this.Lt = new bt(this.i)\n /**\n * Returns an empty copy of the existing DocumentSet, using the same\n * comparator.\n */;\n }\n return t.Bt = function(e) {\n return new t(e.i);\n }, t.prototype.has = function(t) {\n return null != this.Ot.get(t);\n }, t.prototype.get = function(t) {\n return this.Ot.get(t);\n }, t.prototype.first = function() {\n return this.Lt.ct();\n }, t.prototype.last = function() {\n return this.Lt.ut();\n }, t.prototype.m = function() {\n return this.Lt.m();\n }, \n /**\n * Returns the index of the provided key in the document set, or -1 if the\n * document key is not present in the set;\n */\n t.prototype.indexOf = function(t) {\n var e = this.Ot.get(t);\n return e ? this.Lt.indexOf(e) : -1;\n }, Object.defineProperty(t.prototype, \"size\", {\n get: function() {\n return this.Lt.size;\n },\n enumerable: !1,\n configurable: !0\n }), \n /** Iterates documents in order defined by \"comparator\" */ t.prototype.forEach = function(t) {\n this.Lt.ht((function(e, n) {\n return t(e), !1;\n }));\n }, \n /** Inserts or updates a document with the same key */ t.prototype.add = function(t) {\n // First remove the element if we have it.\n var e = this.delete(t.key);\n return e.copy(e.Ot.ot(t.key, t), e.Lt.ot(t, null));\n }, \n /** Deletes a document with a given key */ t.prototype.delete = function(t) {\n var e = this.get(t);\n return e ? this.copy(this.Ot.remove(t), this.Lt.remove(e)) : this;\n }, t.prototype.isEqual = function(e) {\n if (!(e instanceof t)) return !1;\n if (this.size !== e.size) return !1;\n for (var n = this.Lt._t(), r = e.Lt._t(); n.At(); ) {\n var i = n.It().key, o = r.It().key;\n if (!i.isEqual(o)) return !1;\n }\n return !0;\n }, t.prototype.toString = function() {\n var t = [];\n return this.forEach((function(e) {\n t.push(e.toString());\n })), 0 === t.length ? \"DocumentSet ()\" : \"DocumentSet (\\n \" + t.join(\" \\n\") + \"\\n)\";\n }, t.prototype.copy = function(e, n) {\n var r = new t;\n return r.i = this.i, r.Ot = e, r.Lt = n, r;\n }, t;\n}(), Ct = /** @class */ function() {\n function t() {\n this.qt = new bt(A.i);\n }\n return t.prototype.track = function(t) {\n var e = t.doc.key, n = this.qt.get(e);\n n ? \n // Merge the new change with the existing change.\n 0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.qt = this.qt.ot(e, t) : 3 /* Metadata */ === t.type && 1 /* Removed */ !== n.type ? this.qt = this.qt.ot(e, {\n type: n.type,\n doc: t.doc\n }) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.qt = this.qt.ot(e, {\n type: 2 /* Modified */ ,\n doc: t.doc\n }) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.qt = this.qt.ot(e, {\n type: 0 /* Added */ ,\n doc: t.doc\n }) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.qt = this.qt.remove(e) : 1 /* Removed */ === t.type && 2 /* Modified */ === n.type ? this.qt = this.qt.ot(e, {\n type: 1 /* Removed */ ,\n doc: n.doc\n }) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.qt = this.qt.ot(e, {\n type: 2 /* Modified */ ,\n doc: t.doc\n }) : \n // This includes these cases, which don't make sense:\n // Added->Added\n // Removed->Removed\n // Modified->Added\n // Removed->Modified\n // Metadata->Added\n // Removed->Metadata\n y() : this.qt = this.qt.ot(e, t);\n }, t.prototype.Ut = function() {\n var t = [];\n return this.qt.ht((function(e, n) {\n t.push(n);\n })), t;\n }, t;\n}(), Ft = /** @class */ function() {\n function t(t, e, n, r, i, o, s, u) {\n this.query = t, this.docs = e, this.Qt = n, this.docChanges = r, this.Wt = i, this.fromCache = o, \n this.jt = s, this.Kt = u\n /** Returns a view snapshot as if all documents in the snapshot were added. */;\n }\n return t.Gt = function(e, n, r, i) {\n var o = [];\n return n.forEach((function(t) {\n o.push({\n type: 0 /* Added */ ,\n doc: t\n });\n })), new t(e, n, Ut.Bt(n), o, r, i, \n /* syncStateChanged= */ !0, \n /* excludesMetadataChanges= */ !1);\n }, Object.defineProperty(t.prototype, \"hasPendingWrites\", {\n get: function() {\n return !this.Wt.m();\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function(t) {\n if (!(this.fromCache === t.fromCache && this.jt === t.jt && this.Wt.isEqual(t.Wt) && Qn(this.query, t.query) && this.docs.isEqual(t.docs) && this.Qt.isEqual(t.Qt))) return !1;\n var e = this.docChanges, n = t.docChanges;\n if (e.length !== n.length) return !1;\n for (var r = 0; r < e.length; r++) if (e[r].type !== n[r].type || !e[r].doc.isEqual(n[r].doc)) return !1;\n return !0;\n }, t;\n}(), Mt = /** @class */ function() {\n function t(\n /**\n * The snapshot version this event brings us up to, or MIN if not set.\n */\n t, \n /**\n * A map from target to changes to the target. See TargetChange.\n */\n e, \n /**\n * A set of targets that is known to be inconsistent. Listens for these\n * targets should be re-established without resume tokens.\n */\n n, \n /**\n * A set of which documents have changed or been deleted, along with the\n * doc's new values (if not deleted).\n */\n r, \n /**\n * A set of which document updates are due only to limbo resolution targets.\n */\n i) {\n this.nt = t, this.zt = e, this.Ht = n, this.Yt = r, this.Jt = i;\n }\n /**\n * HACK: Views require RemoteEvents in order to determine whether the view is\n * CURRENT, but secondary tabs don't receive remote events. So this method is\n * used to create a synthesized RemoteEvent that can be used to apply a\n * CURRENT status change to a View, for queries executed in a different tab.\n */\n // PORTING NOTE: Multi-tab only\n return t.Xt = function(e, n) {\n var r = new Map;\n return r.set(e, qt.Zt(e, n)), new t(st.min(), r, Vt(), St(), Ot());\n }, t;\n}(), qt = /** @class */ function() {\n function t(\n /**\n * An opaque, server-assigned token that allows watching a query to be resumed\n * after disconnecting without retransmitting all the data that matches the\n * query. The resume token essentially identifies a point in time from which\n * the server should resume sending results.\n */\n t, \n /**\n * The \"current\" (synced) status of this target. Note that \"current\"\n * has special meaning in the RPC protocol that implies that a target is\n * both up-to-date and consistent with the rest of the watch stream.\n */\n e, \n /**\n * The set of documents that were newly assigned to this target as part of\n * this remote event.\n */\n n, \n /**\n * The set of documents that were already assigned to this target but received\n * an update during this remote event.\n */\n r, \n /**\n * The set of documents that were removed from this target as part of this\n * remote event.\n */\n i) {\n this.resumeToken = t, this.te = e, this.ee = n, this.ne = r, this.se = i\n /**\n * This method is used to create a synthesized TargetChanges that can be used to\n * apply a CURRENT status change to a View (for queries executed in a different\n * tab) or for new queries (to raise snapshots with correct CURRENT status).\n */;\n }\n return t.Zt = function(e, n) {\n return new t(X.B, n, Ot(), Ot(), Ot());\n }, t;\n}(), jt = function(\n/** The new document applies to all of these targets. */\nt, \n/** The new document is removed from all of these targets. */\ne, \n/** The key of the document for this change. */\nn, \n/**\n * The new document or NoDocument if it was deleted. Is null if the\n * document went out of view without the server sending a new document.\n */\nr) {\n this.ie = t, this.removedTargetIds = e, this.key = n, this.re = r;\n}, Gt = function(t, e) {\n this.targetId = t, this.oe = e;\n}, zt = function(\n/** What kind of change occurred to the watch target. */\nt, \n/** The target IDs that were added/removed/set. */\ne, \n/**\n * An opaque, server-assigned token that allows watching a target to be\n * resumed after disconnecting without retransmitting all the data that\n * matches the target. The resume token essentially identifies a point in\n * time from which the server should resume sending results.\n */\nn\n/** An RPC error indicating why the watch failed. */ , r) {\n void 0 === n && (n = X.B), void 0 === r && (r = null), this.state = t, this.targetIds = e, \n this.resumeToken = n, this.cause = r;\n}, Bt = /** @class */ function() {\n function t() {\n /**\n * The number of pending responses (adds or removes) that we are waiting on.\n * We only consider targets active that have no pending responses.\n */\n this.ae = 0, \n /**\n * Keeps track of the document changes since the last raised snapshot.\n *\n * These changes are continuously updated as we receive document updates and\n * always reflect the current set of changes against the last issued snapshot.\n */\n this.ce = Qt(), \n /** See public getters for explanations of these fields. */\n this.ue = X.B, this.he = !1, \n /**\n * Whether this target state should be included in the next snapshot. We\n * initialize to true so that newly-added targets are included in the next\n * RemoteEvent.\n */\n this.le = !0;\n }\n return Object.defineProperty(t.prototype, \"te\", {\n /**\n * Whether this target has been marked 'current'.\n *\n * 'Current' has special meaning in the RPC protocol: It implies that the\n * Watch backend has sent us all changes up to the point at which the target\n * was added and that the target is consistent with the rest of the watch\n * stream.\n */\n get: function() {\n return this.he;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"resumeToken\", {\n /** The last resume token sent to us for this target. */ get: function() {\n return this.ue;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"_e\", {\n /** Whether this target has pending target adds or target removes. */ get: function() {\n return 0 !== this.ae;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"fe\", {\n /** Whether we have modified any state that should trigger a snapshot. */ get: function() {\n return this.le;\n },\n enumerable: !1,\n configurable: !0\n }), \n /**\n * Applies the resume token to the TargetChange, but only when it has a new\n * value. Empty resumeTokens are discarded.\n */\n t.prototype.de = function(t) {\n t.O() > 0 && (this.le = !0, this.ue = t);\n }, \n /**\n * Creates a target change from the current set of changes.\n *\n * To reset the document changes after raising this snapshot, call\n * `clearPendingChanges()`.\n */\n t.prototype.we = function() {\n var t = Ot(), e = Ot(), n = Ot();\n return this.ce.forEach((function(r, i) {\n switch (i) {\n case 0 /* Added */ :\n t = t.add(r);\n break;\n\n case 2 /* Modified */ :\n e = e.add(r);\n break;\n\n case 1 /* Removed */ :\n n = n.add(r);\n break;\n\n default:\n y();\n }\n })), new qt(this.ue, this.he, t, e, n);\n }, \n /**\n * Resets the document changes and sets `hasPendingChanges` to false.\n */\n t.prototype.me = function() {\n this.le = !1, this.ce = Qt();\n }, t.prototype.Te = function(t, e) {\n this.le = !0, this.ce = this.ce.ot(t, e);\n }, t.prototype.Ee = function(t) {\n this.le = !0, this.ce = this.ce.remove(t);\n }, t.prototype.Ie = function() {\n this.ae += 1;\n }, t.prototype.Ae = function() {\n this.ae -= 1;\n }, t.prototype.Re = function() {\n this.le = !0, this.he = !0;\n }, t;\n}(), Wt = /** @class */ function() {\n function t(t) {\n this.ge = t, \n /** The internal state of all tracked targets. */\n this.Pe = new Map, \n /** Keeps track of the documents to update since the last raised snapshot. */\n this.ye = St(), \n /** A mapping of document keys to their set of target IDs. */\n this.Ve = Kt(), \n /**\n * A list of targets with existence filter mismatches. These targets are\n * known to be inconsistent and their listens needs to be re-established by\n * RemoteStore.\n */\n this.pe = new Tt(H)\n /**\n * Processes and adds the DocumentWatchChange to the current set of changes.\n */;\n }\n return t.prototype.be = function(t) {\n for (var e = 0, n = t.ie; e < n.length; e++) {\n var r = n[e];\n t.re instanceof kn ? this.ve(r, t.re) : t.re instanceof Rn && this.Se(r, t.key, t.re);\n }\n for (var i = 0, o = t.removedTargetIds; i < o.length; i++) {\n var s = o[i];\n this.Se(s, t.key, t.re);\n }\n }, \n /** Processes and adds the WatchTargetChange to the current set of changes. */ t.prototype.De = function(t) {\n var e = this;\n this.Ce(t, (function(n) {\n var r = e.Ne(n);\n switch (t.state) {\n case 0 /* NoChange */ :\n e.Fe(n) && r.de(t.resumeToken);\n break;\n\n case 1 /* Added */ :\n // We need to decrement the number of pending acks needed from watch\n // for this targetId.\n r.Ae(), r._e || \n // We have a freshly added target, so we need to reset any state\n // that we had previously. This can happen e.g. when remove and add\n // back a target for existence filter mismatches.\n r.me(), r.de(t.resumeToken);\n break;\n\n case 2 /* Removed */ :\n // We need to keep track of removed targets to we can post-filter and\n // remove any target changes.\n // We need to decrement the number of pending acks needed from watch\n // for this targetId.\n r.Ae(), r._e || e.removeTarget(n);\n break;\n\n case 3 /* Current */ :\n e.Fe(n) && (r.Re(), r.de(t.resumeToken));\n break;\n\n case 4 /* Reset */ :\n e.Fe(n) && (\n // Reset the target and synthesizes removes for all existing\n // documents. The backend will re-add any documents that still\n // match the target before it sends the next global snapshot.\n e.xe(n), r.de(t.resumeToken));\n break;\n\n default:\n y();\n }\n }));\n }, \n /**\n * Iterates over all targetIds that the watch change applies to: either the\n * targetIds explicitly listed in the change or the targetIds of all currently\n * active targets.\n */\n t.prototype.Ce = function(t, e) {\n var n = this;\n t.targetIds.length > 0 ? t.targetIds.forEach(e) : this.Pe.forEach((function(t, r) {\n n.Fe(r) && e(r);\n }));\n }, \n /**\n * Handles existence filters and synthesizes deletes for filter mismatches.\n * Targets that are invalidated by filter mismatches are added to\n * `pendingTargetResets`.\n */\n t.prototype.$e = function(t) {\n var e = t.targetId, n = t.oe.count, r = this.ke(e);\n if (r) {\n var i = r.target;\n if (dt(i)) if (0 === n) {\n // The existence filter told us the document does not exist. We deduce\n // that this document does not exist and apply a deleted document to\n // our updates. Without applying this deleted document there might be\n // another query that will raise this document as part of a snapshot\n // until it is resolved, essentially exposing inconsistency between\n // queries.\n var o = new A(i.path);\n this.Se(e, o, new Rn(o, st.min()));\n } else g(1 === n); else this.Me(e) !== n && (\n // Existence filter mismatch: We reset the mapping and raise a new\n // snapshot with `isFromCache:true`.\n this.xe(e), this.pe = this.pe.add(e));\n }\n }, \n /**\n * Converts the currently accumulated state into a remote event at the\n * provided snapshot version. Resets the accumulated changes before returning.\n */\n t.prototype.Oe = function(t) {\n var e = this, n = new Map;\n this.Pe.forEach((function(r, i) {\n var o = e.ke(i);\n if (o) {\n if (r.te && dt(o.target)) {\n // Document queries for document that don't exist can produce an empty\n // result set. To update our local cache, we synthesize a document\n // delete if we have not previously received the document. This\n // resolves the limbo state of the document, removing it from\n // limboDocumentRefs.\n // TODO(dimond): Ideally we would have an explicit lookup target\n // instead resulting in an explicit delete message and we could\n // remove this special logic.\n var s = new A(o.target.path);\n null !== e.ye.get(s) || e.Le(i, s) || e.Se(i, s, new Rn(s, t));\n }\n r.fe && (n.set(i, r.we()), r.me());\n }\n }));\n var r = Ot();\n // We extract the set of limbo-only document updates as the GC logic\n // special-cases documents that do not appear in the target cache.\n // TODO(gsoltis): Expand on this comment once GC is available in the JS\n // client.\n this.Ve.forEach((function(t, n) {\n var i = !0;\n n.xt((function(t) {\n var n = e.ke(t);\n return !n || 2 /* LimboResolution */ === n.et || (i = !1, !1);\n })), i && (r = r.add(t));\n }));\n var i = new Mt(t, n, this.pe, this.ye, r);\n return this.ye = St(), this.Ve = Kt(), this.pe = new Tt(H), i;\n }, \n /**\n * Adds the provided document to the internal list of document updates and\n * its document key to the given target's mapping.\n */\n // Visible for testing.\n t.prototype.ve = function(t, e) {\n if (this.Fe(t)) {\n var n = this.Le(t, e.key) ? 2 /* Modified */ : 0 /* Added */;\n this.Ne(t).Te(e.key, n), this.ye = this.ye.ot(e.key, e), this.Ve = this.Ve.ot(e.key, this.Be(e.key).add(t));\n }\n }, \n /**\n * Removes the provided document from the target mapping. If the\n * document no longer matches the target, but the document's state is still\n * known (e.g. we know that the document was deleted or we received the change\n * that caused the filter mismatch), the new document can be provided\n * to update the remote document cache.\n */\n // Visible for testing.\n t.prototype.Se = function(t, e, n) {\n if (this.Fe(t)) {\n var r = this.Ne(t);\n this.Le(t, e) ? r.Te(e, 1 /* Removed */) : \n // The document may have entered and left the target before we raised a\n // snapshot, so we can just ignore the change.\n r.Ee(e), this.Ve = this.Ve.ot(e, this.Be(e).delete(t)), n && (this.ye = this.ye.ot(e, n));\n }\n }, t.prototype.removeTarget = function(t) {\n this.Pe.delete(t);\n }, \n /**\n * Returns the current count of documents in the target. This includes both\n * the number of documents that the LocalStore considers to be part of the\n * target as well as any accumulated changes.\n */\n t.prototype.Me = function(t) {\n var e = this.Ne(t).we();\n return this.ge.qe(t).size + e.ee.size - e.se.size;\n }, \n /**\n * Increment the number of acks needed from watch before we can consider the\n * server to be 'in-sync' with the client's active targets.\n */\n t.prototype.Ie = function(t) {\n this.Ne(t).Ie();\n }, t.prototype.Ne = function(t) {\n var e = this.Pe.get(t);\n return e || (e = new Bt, this.Pe.set(t, e)), e;\n }, t.prototype.Be = function(t) {\n var e = this.Ve.get(t);\n return e || (e = new Tt(H), this.Ve = this.Ve.ot(t, e)), e;\n }, \n /**\n * Verifies that the user is still interested in this target (by calling\n * `getTargetDataForTarget()`) and that we are not waiting for pending ADDs\n * from watch.\n */\n t.prototype.Fe = function(t) {\n var e = null !== this.ke(t);\n return e || l(\"WatchChangeAggregator\", \"Detected inactive target\", t), e;\n }, \n /**\n * Returns the TargetData for an active target (i.e. a target that the user\n * is still interested in that has no outstanding target change requests).\n */\n t.prototype.ke = function(t) {\n var e = this.Pe.get(t);\n return e && e._e ? null : this.ge.Ue(t);\n }, \n /**\n * Resets the state of a Watch target to its initial state (e.g. sets\n * 'current' to false, clears the resume token and removes its target mapping\n * from all documents).\n */\n t.prototype.xe = function(t) {\n var e = this;\n this.Pe.set(t, new Bt), this.ge.qe(t).forEach((function(n) {\n e.Se(t, n, /*updatedDocument=*/ null);\n }));\n }, \n /**\n * Returns whether the LocalStore considers the document to be part of the\n * specified target.\n */\n t.prototype.Le = function(t, e) {\n return this.ge.qe(t).has(e);\n }, t;\n}();\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * DocumentChangeSet keeps track of a set of changes to docs in a query, merging\n * duplicate events for the same doc.\n */ function Kt() {\n return new bt(A.i);\n}\n\nfunction Qt() {\n return new bt(A.i);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents a locally-applied ServerTimestamp.\n *\n * Server Timestamps are backed by MapValues that contain an internal field\n * `__type__` with a value of `server_timestamp`. The previous value and local\n * write time are stored in its `__previous_value__` and `__local_write_time__`\n * fields respectively.\n *\n * Notes:\n * - ServerTimestampValue instances are created as the result of applying a\n * TransformMutation (see TransformMutation.applyTo()). They can only exist in\n * the local view of a document. Therefore they do not need to be parsed or\n * serialized.\n * - When evaluated locally (e.g. for snapshot.data()), they by default\n * evaluate to `null`. This behavior can be configured by passing custom\n * FieldValueOptions to value().\n * - With respect to other ServerTimestampValues, they sort by their\n * localWriteTime.\n */ function Ht(t) {\n var e, n;\n return \"server_timestamp\" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);\n}\n\n/**\n * Creates a new ServerTimestamp proto value (using the internal format).\n */\n/**\n * Returns the value of the field before this ServerTimestamp was set.\n *\n * Preserving the previous values allows the user to display the last resoled\n * value until the backend responds with the timestamp.\n */ function Yt(t) {\n var e = t.mapValue.fields.__previous_value__;\n return Ht(e) ? Yt(e) : e;\n}\n\n/**\n * Returns the local time at which this timestamp was first set.\n */ function $t(t) {\n var e = oe(t.mapValue.fields.__local_write_time__.timestampValue);\n return new ot(e.seconds, e.nanos);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// A RegExp matching ISO 8601 UTC timestamps with optional fraction.\nvar Xt = new RegExp(/^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.(\\d+))?Z$/);\n\n/** Extracts the backend's type order for the provided value. */ function Jt(t) {\n return \"nullValue\" in t ? 0 /* NullValue */ : \"booleanValue\" in t ? 1 /* BooleanValue */ : \"integerValue\" in t || \"doubleValue\" in t ? 2 /* NumberValue */ : \"timestampValue\" in t ? 3 /* TimestampValue */ : \"stringValue\" in t ? 5 /* StringValue */ : \"bytesValue\" in t ? 6 /* BlobValue */ : \"referenceValue\" in t ? 7 /* RefValue */ : \"geoPointValue\" in t ? 8 /* GeoPointValue */ : \"arrayValue\" in t ? 9 /* ArrayValue */ : \"mapValue\" in t ? Ht(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : y();\n}\n\n/** Tests `left` and `right` for equality based on the backend semantics. */ function Zt(t, e) {\n var n = Jt(t);\n if (n !== Jt(e)) return !1;\n switch (n) {\n case 0 /* NullValue */ :\n return !0;\n\n case 1 /* BooleanValue */ :\n return t.booleanValue === e.booleanValue;\n\n case 4 /* ServerTimestampValue */ :\n return $t(t).isEqual($t(e));\n\n case 3 /* TimestampValue */ :\n return function(t, e) {\n if (\"string\" == typeof t.timestampValue && \"string\" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length) \n // Use string equality for ISO 8601 timestamps\n return t.timestampValue === e.timestampValue;\n var n = oe(t.timestampValue), r = oe(e.timestampValue);\n return n.seconds === r.seconds && n.nanos === r.nanos;\n }(t, e);\n\n case 5 /* StringValue */ :\n return t.stringValue === e.stringValue;\n\n case 6 /* BlobValue */ :\n return function(t, e) {\n return ue(t.bytesValue).isEqual(ue(e.bytesValue));\n }(t, e);\n\n case 7 /* RefValue */ :\n return t.referenceValue === e.referenceValue;\n\n case 8 /* GeoPointValue */ :\n return function(t, e) {\n return se(t.geoPointValue.latitude) === se(e.geoPointValue.latitude) && se(t.geoPointValue.longitude) === se(e.geoPointValue.longitude);\n }(t, e);\n\n case 2 /* NumberValue */ :\n return function(t, e) {\n if (\"integerValue\" in t && \"integerValue\" in e) return se(t.integerValue) === se(e.integerValue);\n if (\"doubleValue\" in t && \"doubleValue\" in e) {\n var n = se(t.doubleValue), r = se(e.doubleValue);\n return n === r ? at(n) === at(r) : isNaN(n) && isNaN(r);\n }\n return !1;\n }(t, e);\n\n case 9 /* ArrayValue */ :\n return Y(t.arrayValue.values || [], e.arrayValue.values || [], Zt);\n\n case 10 /* ObjectValue */ :\n return function(t, e) {\n var n = t.mapValue.fields || {}, r = e.mapValue.fields || {};\n if (w(n) !== w(r)) return !1;\n for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Zt(n[i], r[i]))) return !1;\n return !0;\n }(t, e);\n\n default:\n return y();\n }\n}\n\nfunction te(t, e) {\n return void 0 !== (t.values || []).find((function(t) {\n return Zt(t, e);\n }));\n}\n\nfunction ee(t, e) {\n var n = Jt(t), r = Jt(e);\n if (n !== r) return H(n, r);\n switch (n) {\n case 0 /* NullValue */ :\n return 0;\n\n case 1 /* BooleanValue */ :\n return H(t.booleanValue, e.booleanValue);\n\n case 2 /* NumberValue */ :\n return function(t, e) {\n var n = se(t.integerValue || t.doubleValue), r = se(e.integerValue || e.doubleValue);\n return n < r ? -1 : n > r ? 1 : n === r ? 0 : \n // one or both are NaN.\n isNaN(n) ? isNaN(r) ? 0 : -1 : 1;\n }(t, e);\n\n case 3 /* TimestampValue */ :\n return ne(t.timestampValue, e.timestampValue);\n\n case 4 /* ServerTimestampValue */ :\n return ne($t(t), $t(e));\n\n case 5 /* StringValue */ :\n return H(t.stringValue, e.stringValue);\n\n case 6 /* BlobValue */ :\n return function(t, e) {\n var n = ue(t), r = ue(e);\n return n.L(r);\n }(t.bytesValue, e.bytesValue);\n\n case 7 /* RefValue */ :\n return function(t, e) {\n for (var n = t.split(\"/\"), r = e.split(\"/\"), i = 0; i < n.length && i < r.length; i++) {\n var o = H(n[i], r[i]);\n if (0 !== o) return o;\n }\n return H(n.length, r.length);\n }(t.referenceValue, e.referenceValue);\n\n case 8 /* GeoPointValue */ :\n return function(t, e) {\n var n = H(se(t.latitude), se(e.latitude));\n return 0 !== n ? n : H(se(t.longitude), se(e.longitude));\n }(t.geoPointValue, e.geoPointValue);\n\n case 9 /* ArrayValue */ :\n return function(t, e) {\n for (var n = t.values || [], r = e.values || [], i = 0; i < n.length && i < r.length; ++i) {\n var o = ee(n[i], r[i]);\n if (o) return o;\n }\n return H(n.length, r.length);\n }(t.arrayValue, e.arrayValue);\n\n case 10 /* ObjectValue */ :\n return function(t, e) {\n var n = t.fields || {}, r = Object.keys(n), i = e.fields || {}, o = Object.keys(i);\n // Even though MapValues are likely sorted correctly based on their insertion\n // order (e.g. when received from the backend), local modifications can bring\n // elements out of order. We need to re-sort the elements to ensure that\n // canonical IDs are independent of insertion order.\n r.sort(), o.sort();\n for (var s = 0; s < r.length && s < o.length; ++s) {\n var u = H(r[s], o[s]);\n if (0 !== u) return u;\n var a = ee(n[r[s]], i[o[s]]);\n if (0 !== a) return a;\n }\n return H(r.length, o.length);\n }(t.mapValue, e.mapValue);\n\n default:\n throw y();\n }\n}\n\nfunction ne(t, e) {\n if (\"string\" == typeof t && \"string\" == typeof e && t.length === e.length) return H(t, e);\n var n = oe(t), r = oe(e), i = H(n.seconds, r.seconds);\n return 0 !== i ? i : H(n.nanos, r.nanos);\n}\n\nfunction re(t) {\n return ie(t);\n}\n\nfunction ie(t) {\n return \"nullValue\" in t ? \"null\" : \"booleanValue\" in t ? \"\" + t.booleanValue : \"integerValue\" in t ? \"\" + t.integerValue : \"doubleValue\" in t ? \"\" + t.doubleValue : \"timestampValue\" in t ? function(t) {\n var e = oe(t);\n return \"time(\" + e.seconds + \",\" + e.nanos + \")\";\n }(t.timestampValue) : \"stringValue\" in t ? t.stringValue : \"bytesValue\" in t ? ue(t.bytesValue).toBase64() : \"referenceValue\" in t ? (n = t.referenceValue, \n A.C(n).toString()) : \"geoPointValue\" in t ? \"geo(\" + (e = t.geoPointValue).latitude + \",\" + e.longitude + \")\" : \"arrayValue\" in t ? function(t) {\n for (var e = \"[\", n = !0, r = 0, i = t.values || []; r < i.length; r++) {\n n ? n = !1 : e += \",\", e += ie(i[r]);\n }\n return e + \"]\";\n }(t.arrayValue) : \"mapValue\" in t ? function(t) {\n for (\n // Iteration order in JavaScript is not guaranteed. To ensure that we generate\n // matching canonical IDs for identical maps, we need to sort the keys.\n var e = \"{\", n = !0, r = 0, i = Object.keys(t.fields || {}).sort(); r < i.length; r++) {\n var o = i[r];\n n ? n = !1 : e += \",\", e += o + \":\" + ie(t.fields[o]);\n }\n return e + \"}\";\n }(t.mapValue) : y();\n var e, n;\n}\n\nfunction oe(t) {\n // The json interface (for the browser) will return an iso timestamp string,\n // while the proto js library (for node) will return a\n // google.protobuf.Timestamp instance.\n if (g(!!t), \"string\" == typeof t) {\n // The date string can have higher precision (nanos) than the Date class\n // (millis), so we do some custom parsing here.\n // Parse the nanos right out of the string.\n var e = 0, n = Xt.exec(t);\n if (g(!!n), n[1]) {\n // Pad the fraction out to 9 digits (nanos).\n var r = n[1];\n r = (r + \"000000000\").substr(0, 9), e = Number(r);\n }\n // Parse the date to get the seconds.\n var i = new Date(t);\n return {\n seconds: Math.floor(i.getTime() / 1e3),\n nanos: e\n };\n }\n return {\n seconds: se(t.seconds),\n nanos: se(t.nanos)\n };\n}\n\n/**\n * Converts the possible Proto types for numbers into a JavaScript number.\n * Returns 0 if the value is not numeric.\n */ function se(t) {\n // TODO(bjornick): Handle int64 greater than 53 bits.\n return \"number\" == typeof t ? t : \"string\" == typeof t ? Number(t) : 0;\n}\n\n/** Converts the possible Proto types for Blobs into a ByteString. */ function ue(t) {\n return \"string\" == typeof t ? X.fromBase64String(t) : X.fromUint8Array(t);\n}\n\n/** Returns a reference value for the provided database and key. */ function ae(t, e) {\n return {\n referenceValue: \"projects/\" + t.projectId + \"/databases/\" + t.database + \"/documents/\" + e.path.R()\n };\n}\n\n/** Returns true if `value` is an IntegerValue . */ function ce(t) {\n return !!t && \"integerValue\" in t;\n}\n\n/** Returns true if `value` is a DoubleValue. */\n/** Returns true if `value` is an ArrayValue. */ function he(t) {\n return !!t && \"arrayValue\" in t;\n}\n\n/** Returns true if `value` is a NullValue. */ function fe(t) {\n return !!t && \"nullValue\" in t;\n}\n\n/** Returns true if `value` is NaN. */ function le(t) {\n return !!t && \"doubleValue\" in t && isNaN(Number(t.doubleValue));\n}\n\n/** Returns true if `value` is a MapValue. */ function pe(t) {\n return !!t && \"mapValue\" in t;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ var de = {\n asc: \"ASCENDING\",\n desc: \"DESCENDING\"\n}, ve = {\n \"<\": \"LESS_THAN\",\n \"<=\": \"LESS_THAN_OR_EQUAL\",\n \">\": \"GREATER_THAN\",\n \">=\": \"GREATER_THAN_OR_EQUAL\",\n \"==\": \"EQUAL\",\n \"!=\": \"NOT_EQUAL\",\n \"array-contains\": \"ARRAY_CONTAINS\",\n in: \"IN\",\n \"not-in\": \"NOT_IN\",\n \"array-contains-any\": \"ARRAY_CONTAINS_ANY\"\n}, ye = function(t, e) {\n this.U = t, this.Qe = e;\n};\n\n/**\n * This class generates JsonObject values for the Datastore API suitable for\n * sending to either GRPC stub methods or via the JSON/HTTP REST API.\n *\n * The serializer supports both Protobuf.js and Proto3 JSON formats. By\n * setting `useProto3Json` to true, the serializer will use the Proto3 JSON\n * format.\n *\n * For a description of the Proto3 JSON format check\n * https://developers.google.com/protocol-buffers/docs/proto3#json\n *\n * TODO(klimt): We can remove the databaseId argument if we keep the full\n * resource name in documents.\n */\n/**\n * Returns an IntegerValue for `value`.\n */\nfunction ge(t) {\n return {\n integerValue: \"\" + t\n };\n}\n\n/**\n * Returns an DoubleValue for `value` that is encoded based the serializer's\n * `useProto3Json` setting.\n */ function me(t, e) {\n if (t.Qe) {\n if (isNaN(e)) return {\n doubleValue: \"NaN\"\n };\n if (e === 1 / 0) return {\n doubleValue: \"Infinity\"\n };\n if (e === -1 / 0) return {\n doubleValue: \"-Infinity\"\n };\n }\n return {\n doubleValue: at(e) ? \"-0\" : e\n };\n}\n\n/**\n * Returns a value for a number that's appropriate to put into a proto.\n * The return value is an IntegerValue if it can safely represent the value,\n * otherwise a DoubleValue is returned.\n */ function we(t, e) {\n return ct(e) ? ge(e) : me(t, e);\n}\n\n/**\n * Returns a value for a Date that's appropriate to put into a proto.\n */ function _e(t, e) {\n return t.Qe ? new Date(1e3 * e.seconds).toISOString().replace(/\\.\\d*/, \"\").replace(\"Z\", \"\") + \".\" + (\"000000000\" + e.nanoseconds).slice(-9) + \"Z\" : {\n seconds: \"\" + e.seconds,\n nanos: e.nanoseconds\n };\n}\n\n/**\n * Returns a value for bytes that's appropriate to put in a proto.\n *\n * Visible for testing.\n */ function be(t, e) {\n return t.Qe ? e.toBase64() : e.toUint8Array();\n}\n\n/**\n * Returns a ByteString based on the proto string value.\n */ function Ie(t, e) {\n return _e(t, e.Z());\n}\n\nfunction Ee(t) {\n return g(!!t), st.J(function(t) {\n var e = oe(t);\n return new ot(e.seconds, e.nanos);\n }(t));\n}\n\nfunction Te(t, e) {\n return function(t) {\n return new E([ \"projects\", t.projectId, \"databases\", t.database ]);\n }(t).child(\"documents\").child(e).R();\n}\n\nfunction Ne(t) {\n var e = E.g(t);\n return g(He(e)), e;\n}\n\nfunction Ae(t, e) {\n return Te(t.U, e.path);\n}\n\nfunction Se(t, e) {\n var n = Ne(e);\n return g(n.get(1) === t.U.projectId), g(!n.get(3) && !t.U.database || n.get(3) === t.U.database), \n new A(ke(n));\n}\n\nfunction De(t, e) {\n return Te(t.U, e);\n}\n\nfunction xe(t) {\n var e = Ne(t);\n // In v1beta1 queries for collections at the root did not have a trailing\n // \"/documents\". In v1 all resource paths contain \"/documents\". Preserve the\n // ability to read the v1beta1 form for compatibility with queries persisted\n // in the local target cache.\n return 4 === e.length ? E.P() : ke(e);\n}\n\nfunction Le(t) {\n return new E([ \"projects\", t.U.projectId, \"databases\", t.U.database ]).R();\n}\n\nfunction ke(t) {\n return g(t.length > 4 && \"documents\" === t.get(4)), t.u(5)\n /** Creates a Document proto from key and fields (but no create/update time) */;\n}\n\nfunction Re(t, e, n) {\n return {\n name: Ae(t, e),\n fields: n.proto.mapValue.fields\n };\n}\n\nfunction Oe(t, e) {\n var n;\n if (e instanceof wn) n = {\n update: Re(t, e.key, e.value)\n }; else if (e instanceof Nn) n = {\n delete: Ae(t, e.key)\n }; else if (e instanceof _n) n = {\n update: Re(t, e.key, e.data),\n updateMask: Qe(e.We)\n }; else if (e instanceof In) n = {\n transform: {\n document: Ae(t, e.key),\n fieldTransforms: e.fieldTransforms.map((function(t) {\n return function(t, e) {\n var n = e.transform;\n if (n instanceof Ze) return {\n fieldPath: e.field.R(),\n setToServerValue: \"REQUEST_TIME\"\n };\n if (n instanceof tn) return {\n fieldPath: e.field.R(),\n appendMissingElements: {\n values: n.elements\n }\n };\n if (n instanceof nn) return {\n fieldPath: e.field.R(),\n removeAllFromArray: {\n values: n.elements\n }\n };\n if (n instanceof on) return {\n fieldPath: e.field.R(),\n increment: n.je\n };\n throw y();\n }(0, t);\n }))\n }\n }; else {\n if (!(e instanceof An)) return y();\n n = {\n verify: Ae(t, e.key)\n };\n }\n return e.Ge.Ke || (n.currentDocument = function(t, e) {\n return void 0 !== e.updateTime ? {\n updateTime: Ie(t, e.updateTime)\n } : void 0 !== e.exists ? {\n exists: e.exists\n } : y();\n }(t, e.Ge)), n;\n}\n\nfunction Pe(t, e) {\n var n = e.currentDocument ? function(t) {\n return void 0 !== t.updateTime ? fn.updateTime(Ee(t.updateTime)) : void 0 !== t.exists ? fn.exists(t.exists) : fn.ze();\n }(e.currentDocument) : fn.ze();\n if (e.update) {\n e.update.name;\n var r = Se(t, e.update.name), i = new Sn({\n mapValue: {\n fields: e.update.fields\n }\n });\n if (e.updateMask) {\n var o = function(t) {\n var e = t.fieldPaths || [];\n return new an(e.map((function(t) {\n return N.S(t);\n })));\n }(e.updateMask);\n return new _n(r, i, o, n);\n }\n return new wn(r, i, n);\n }\n if (e.delete) {\n var s = Se(t, e.delete);\n return new Nn(s, n);\n }\n if (e.transform) {\n var u = Se(t, e.transform.document), a = e.transform.fieldTransforms.map((function(e) {\n return function(t, e) {\n var n = null;\n if (\"setToServerValue\" in e) g(\"REQUEST_TIME\" === e.setToServerValue), n = new Ze; else if (\"appendMissingElements\" in e) {\n var r = e.appendMissingElements.values || [];\n n = new tn(r);\n } else if (\"removeAllFromArray\" in e) {\n var i = e.removeAllFromArray.values || [];\n n = new nn(i);\n } else \"increment\" in e ? n = new on(t, e.increment) : y();\n var o = N.S(e.fieldPath);\n return new cn(o, n);\n }(t, e);\n }));\n return g(!0 === n.exists), new In(u, a);\n }\n if (e.verify) {\n var c = Se(t, e.verify);\n return new An(c, n);\n }\n return y();\n}\n\nfunction Ve(t, e) {\n return {\n documents: [ De(t, e.path) ]\n };\n}\n\nfunction Ue(t, e) {\n // Dissect the path into parent, collectionId, and optional key filter.\n var n = {\n structuredQuery: {}\n }, r = e.path;\n null !== e.collectionGroup ? (n.parent = De(t, r), n.structuredQuery.from = [ {\n collectionId: e.collectionGroup,\n allDescendants: !0\n } ]) : (n.parent = De(t, r.h()), n.structuredQuery.from = [ {\n collectionId: r._()\n } ]);\n var i = function(t) {\n if (0 !== t.length) {\n var e = t.map((function(t) {\n // visible for testing\n return function(t) {\n if (\"==\" /* EQUAL */ === t.op) {\n if (le(t.value)) return {\n unaryFilter: {\n field: ze(t.field),\n op: \"IS_NAN\"\n }\n };\n if (fe(t.value)) return {\n unaryFilter: {\n field: ze(t.field),\n op: \"IS_NULL\"\n }\n };\n } else if (\"!=\" /* NOT_EQUAL */ === t.op) {\n if (le(t.value)) return {\n unaryFilter: {\n field: ze(t.field),\n op: \"IS_NOT_NAN\"\n }\n };\n if (fe(t.value)) return {\n unaryFilter: {\n field: ze(t.field),\n op: \"IS_NOT_NULL\"\n }\n };\n }\n return {\n fieldFilter: {\n field: ze(t.field),\n op: Ge(t.op),\n value: t.value\n }\n };\n }(t);\n }));\n return 1 === e.length ? e[0] : {\n compositeFilter: {\n op: \"AND\",\n filters: e\n }\n };\n }\n }(e.filters);\n i && (n.structuredQuery.where = i);\n var o = function(t) {\n if (0 !== t.length) return t.map((function(t) {\n // visible for testing\n return function(t) {\n return {\n field: ze(t.field),\n direction: je(t.dir)\n };\n }(t);\n }));\n }(e.orderBy);\n o && (n.structuredQuery.orderBy = o);\n var s = function(t, e) {\n return t.Qe || ut(e) ? e : {\n value: e\n };\n }(t, e.limit);\n return null !== s && (n.structuredQuery.limit = s), e.startAt && (n.structuredQuery.startAt = Me(e.startAt)), \n e.endAt && (n.structuredQuery.endAt = Me(e.endAt)), n;\n}\n\nfunction Ce(t) {\n var e = xe(t.parent), n = t.structuredQuery, r = n.from ? n.from.length : 0, i = null;\n if (r > 0) {\n g(1 === r);\n var o = n.from[0];\n o.allDescendants ? i = o.collectionId : e = e.child(o.collectionId);\n }\n var s = [];\n n.where && (s = Fe(n.where));\n var u = [];\n n.orderBy && (u = n.orderBy.map((function(t) {\n return function(t) {\n return new fr(Be(t.field), \n // visible for testing\n function(t) {\n switch (t) {\n case \"ASCENDING\":\n return \"asc\" /* ASCENDING */;\n\n case \"DESCENDING\":\n return \"desc\" /* DESCENDING */;\n\n default:\n return;\n }\n }(t.direction));\n }(t);\n })));\n var a = null;\n n.limit && (a = function(t) {\n var e;\n return ut(e = \"object\" == typeof t ? t.value : t) ? null : e;\n }(n.limit));\n var c = null;\n n.startAt && (c = qe(n.startAt));\n var h = null;\n return n.endAt && (h = qe(n.endAt)), zn(Vn(e, i, u, s, a, \"F\" /* First */ , c, h));\n}\n\nfunction Fe(t) {\n return t ? void 0 !== t.unaryFilter ? [ Ke(t) ] : void 0 !== t.fieldFilter ? [ We(t) ] : void 0 !== t.compositeFilter ? t.compositeFilter.filters.map((function(t) {\n return Fe(t);\n })).reduce((function(t, e) {\n return t.concat(e);\n })) : y() : [];\n}\n\nfunction Me(t) {\n return {\n before: t.before,\n values: t.position\n };\n}\n\nfunction qe(t) {\n var e = !!t.before, n = t.values || [];\n return new ur(n, e);\n}\n\n// visible for testing\nfunction je(t) {\n return de[t];\n}\n\nfunction Ge(t) {\n return ve[t];\n}\n\nfunction ze(t) {\n return {\n fieldPath: t.R()\n };\n}\n\nfunction Be(t) {\n return N.S(t.fieldPath);\n}\n\nfunction We(t) {\n return Jn.create(Be(t.fieldFilter.field), function(t) {\n switch (t) {\n case \"EQUAL\":\n return \"==\" /* EQUAL */;\n\n case \"NOT_EQUAL\":\n return \"!=\" /* NOT_EQUAL */;\n\n case \"GREATER_THAN\":\n return \">\" /* GREATER_THAN */;\n\n case \"GREATER_THAN_OR_EQUAL\":\n return \">=\" /* GREATER_THAN_OR_EQUAL */;\n\n case \"LESS_THAN\":\n return \"<\" /* LESS_THAN */;\n\n case \"LESS_THAN_OR_EQUAL\":\n return \"<=\" /* LESS_THAN_OR_EQUAL */;\n\n case \"ARRAY_CONTAINS\":\n return \"array-contains\" /* ARRAY_CONTAINS */;\n\n case \"IN\":\n return \"in\" /* IN */;\n\n case \"NOT_IN\":\n return \"not-in\" /* NOT_IN */;\n\n case \"ARRAY_CONTAINS_ANY\":\n return \"array-contains-any\" /* ARRAY_CONTAINS_ANY */;\n\n case \"OPERATOR_UNSPECIFIED\":\n default:\n return y();\n }\n }(t.fieldFilter.op), t.fieldFilter.value);\n}\n\nfunction Ke(t) {\n switch (t.unaryFilter.op) {\n case \"IS_NAN\":\n var e = Be(t.unaryFilter.field);\n return Jn.create(e, \"==\" /* EQUAL */ , {\n doubleValue: NaN\n });\n\n case \"IS_NULL\":\n var n = Be(t.unaryFilter.field);\n return Jn.create(n, \"==\" /* EQUAL */ , {\n nullValue: \"NULL_VALUE\"\n });\n\n case \"IS_NOT_NAN\":\n var r = Be(t.unaryFilter.field);\n return Jn.create(r, \"!=\" /* NOT_EQUAL */ , {\n doubleValue: NaN\n });\n\n case \"IS_NOT_NULL\":\n var i = Be(t.unaryFilter.field);\n return Jn.create(i, \"!=\" /* NOT_EQUAL */ , {\n nullValue: \"NULL_VALUE\"\n });\n\n case \"OPERATOR_UNSPECIFIED\":\n default:\n return y();\n }\n}\n\nfunction Qe(t) {\n var e = [];\n return t.fields.forEach((function(t) {\n return e.push(t.R());\n })), {\n fieldPaths: e\n };\n}\n\nfunction He(t) {\n // Resource names have at least 4 components (project ID, database ID)\n return t.length >= 4 && \"projects\" === t.get(0) && \"databases\" === t.get(2);\n}\n\n/**\n * @license\n * Copyright 2018 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Represents a transform within a TransformMutation. */ var Ye = function() {\n // Make sure that the structural type of `TransformOperation` is unique.\n // See https://github.com/microsoft/TypeScript/issues/5451\n this.He = void 0;\n};\n\n/**\n * Computes the local transform result against the provided `previousValue`,\n * optionally using the provided localWriteTime.\n */ function $e(t, e, n) {\n return t instanceof Ze ? function(t, e) {\n var n = {\n fields: {\n __type__: {\n stringValue: \"server_timestamp\"\n },\n __local_write_time__: {\n timestampValue: {\n seconds: t.seconds,\n nanos: t.nanoseconds\n }\n }\n }\n };\n return e && (n.fields.__previous_value__ = e), {\n mapValue: n\n };\n }(n, e) : t instanceof tn ? en(t, e) : t instanceof nn ? rn(t, e) : function(t, e) {\n // PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit\n // precision and resolves overflows by reducing precision, we do not\n // manually cap overflows at 2^63.\n var n = Je(t, e), r = sn(n) + sn(t.je);\n return ce(n) && ce(t.je) ? ge(r) : me(t.serializer, r);\n }(t, e);\n}\n\n/**\n * Computes a final transform result after the transform has been acknowledged\n * by the server, potentially using the server-provided transformResult.\n */ function Xe(t, e, n) {\n // The server just sends null as the transform result for array operations,\n // so we have to calculate a result the same as we do for local\n // applications.\n return t instanceof tn ? en(t, e) : t instanceof nn ? rn(t, e) : n;\n}\n\n/**\n * If this transform operation is not idempotent, returns the base value to\n * persist for this transform. If a base value is returned, the transform\n * operation is always applied to this base value, even if document has\n * already been updated.\n *\n * Base values provide consistent behavior for non-idempotent transforms and\n * allow us to return the same latency-compensated value even if the backend\n * has already applied the transform operation. The base value is null for\n * idempotent transforms, as they can be re-played even if the backend has\n * already applied them.\n *\n * @return a base value to store along with the mutation, or null for\n * idempotent transforms.\n */ function Je(t, e) {\n return t instanceof on ? ce(n = e) || function(t) {\n return !!t && \"doubleValue\" in t;\n }(n) ? e : {\n integerValue: 0\n } : null;\n var n;\n}\n\n/** Transforms a value into a server-generated timestamp. */ var Ze = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n;\n}(Ye), tn = /** @class */ function(e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).elements = t, n;\n }\n return t.__extends(n, e), n;\n}(Ye);\n\n/** Transforms an array value via a union operation. */ function en(t, e) {\n for (var n = un(e), r = function(t) {\n n.some((function(e) {\n return Zt(e, t);\n })) || n.push(t);\n }, i = 0, o = t.elements; i < o.length; i++) {\n r(o[i]);\n }\n return {\n arrayValue: {\n values: n\n }\n };\n}\n\n/** Transforms an array value via a remove operation. */ var nn = /** @class */ function(e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).elements = t, n;\n }\n return t.__extends(n, e), n;\n}(Ye);\n\nfunction rn(t, e) {\n for (var n = un(e), r = function(t) {\n n = n.filter((function(e) {\n return !Zt(e, t);\n }));\n }, i = 0, o = t.elements; i < o.length; i++) {\n r(o[i]);\n }\n return {\n arrayValue: {\n values: n\n }\n };\n}\n\n/**\n * Implements the backend semantics for locally computed NUMERIC_ADD (increment)\n * transforms. Converts all field values to integers or doubles, but unlike the\n * backend does not cap integer values at 2^63. Instead, JavaScript number\n * arithmetic is used and precision loss can occur for values greater than 2^53.\n */ var on = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).serializer = t, r.je = n, r;\n }\n return t.__extends(n, e), n;\n}(Ye);\n\nfunction sn(t) {\n return se(t.integerValue || t.doubleValue);\n}\n\nfunction un(t) {\n return he(t) && t.arrayValue.values ? t.arrayValue.values.slice() : [];\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provides a set of fields that can be used to partially patch a document.\n * FieldMask is used in conjunction with ObjectValue.\n * Examples:\n * foo - Overwrites foo entirely with the provided value. If foo is not\n * present in the companion ObjectValue, the field is deleted.\n * foo.bar - Overwrites only the field bar of the object foo.\n * If foo is not an object, foo is replaced with an object\n * containing foo\n */ var an = /** @class */ function() {\n function t(t) {\n this.fields = t, \n // TODO(dimond): validation of FieldMask\n // Sort the field mask to support `FieldMask.isEqual()` and assert below.\n t.sort(N.i)\n /**\n * Verifies that `fieldPath` is included by at least one field in this field\n * mask.\n *\n * This is an O(n) operation, where `n` is the size of the field mask.\n */;\n }\n return t.prototype.Ye = function(t) {\n for (var e = 0, n = this.fields; e < n.length; e++) {\n if (n[e].T(t)) return !0;\n }\n return !1;\n }, t.prototype.isEqual = function(t) {\n return Y(this.fields, t.fields, (function(t, e) {\n return t.isEqual(e);\n }));\n }, t;\n}(), cn = function(t, e) {\n this.field = t, this.transform = e;\n};\n\n/** A field path and the TransformOperation to perform upon it. */\n/** The result of successfully applying a mutation to the backend. */ var hn = function(\n/**\n * The version at which the mutation was committed:\n *\n * - For most operations, this is the updateTime in the WriteResult.\n * - For deletes, the commitTime of the WriteResponse (because deletes are\n * not stored and have no updateTime).\n *\n * Note that these versions can be different: No-op writes will not change\n * the updateTime even though the commitTime advances.\n */\nt, \n/**\n * The resulting fields returned from the backend after a\n * TransformMutation has been committed. Contains one FieldValue for each\n * FieldTransform that was in the mutation.\n *\n * Will be null if the mutation was not a TransformMutation.\n */\ne) {\n this.version = t, this.transformResults = e;\n}, fn = /** @class */ function() {\n function t(t, e) {\n this.updateTime = t, this.exists = e\n /** Creates a new empty Precondition. */;\n }\n return t.ze = function() {\n return new t;\n }, \n /** Creates a new Precondition with an exists flag. */ t.exists = function(e) {\n return new t(void 0, e);\n }, \n /** Creates a new Precondition based on a version a document exists at. */ t.updateTime = function(e) {\n return new t(e);\n }, Object.defineProperty(t.prototype, \"Ke\", {\n /** Returns whether this Precondition is empty. */ get: function() {\n return void 0 === this.updateTime && void 0 === this.exists;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function(t) {\n return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);\n }, t;\n}();\n\n/**\n * Encodes a precondition for a mutation. This follows the model that the\n * backend accepts with the special case of an explicit \"empty\" precondition\n * (meaning no precondition).\n */\n/**\n * Returns true if the preconditions is valid for the given document\n * (or null if no document is available).\n */\nfunction ln(t, e) {\n return void 0 !== t.updateTime ? e instanceof kn && e.version.isEqual(t.updateTime) : void 0 === t.exists || t.exists === e instanceof kn;\n}\n\n/**\n * A mutation describes a self-contained change to a document. Mutations can\n * create, replace, delete, and update subsets of documents.\n *\n * Mutations not only act on the value of the document but also its version.\n *\n * For local mutations (mutations that haven't been committed yet), we preserve\n * the existing version for Set, Patch, and Transform mutations. For Delete\n * mutations, we reset the version to 0.\n *\n * Here's the expected transition table.\n *\n * MUTATION APPLIED TO RESULTS IN\n *\n * SetMutation Document(v3) Document(v3)\n * SetMutation NoDocument(v3) Document(v0)\n * SetMutation null Document(v0)\n * PatchMutation Document(v3) Document(v3)\n * PatchMutation NoDocument(v3) NoDocument(v3)\n * PatchMutation null null\n * TransformMutation Document(v3) Document(v3)\n * TransformMutation NoDocument(v3) NoDocument(v3)\n * TransformMutation null null\n * DeleteMutation Document(v3) NoDocument(v0)\n * DeleteMutation NoDocument(v3) NoDocument(v0)\n * DeleteMutation null NoDocument(v0)\n *\n * For acknowledged mutations, we use the updateTime of the WriteResponse as\n * the resulting version for Set, Patch, and Transform mutations. As deletes\n * have no explicit update time, we use the commitTime of the WriteResponse for\n * Delete mutations.\n *\n * If a mutation is acknowledged by the backend but fails the precondition check\n * locally, we return an `UnknownDocument` and rely on Watch to send us the\n * updated version.\n *\n * Note that TransformMutations don't create Documents (in the case of being\n * applied to a NoDocument), even though they would on the backend. This is\n * because the client always combines the TransformMutation with a SetMutation\n * or PatchMutation and we only want to apply the transform if the prior\n * mutation resulted in a Document (always true for a SetMutation, but not\n * necessarily for a PatchMutation).\n *\n * ## Subclassing Notes\n *\n * Subclasses of Mutation need to implement applyToRemoteDocument() and\n * applyToLocalView() to implement the actual behavior of applying the mutation\n * to some source document.\n */ var pn = function() {};\n\n/**\n * Applies this mutation to the given MaybeDocument or null for the purposes\n * of computing a new remote document. If the input document doesn't match the\n * expected state (e.g. it is null or outdated), an `UnknownDocument` can be\n * returned.\n *\n * @param mutation The mutation to apply.\n * @param maybeDoc The document to mutate. The input document can be null if\n * the client has no knowledge of the pre-mutation state of the document.\n * @param mutationResult The result of applying the mutation from the backend.\n * @return The mutated document. The returned document may be an\n * UnknownDocument if the mutation could not be applied to the locally\n * cached base document.\n */ function dn(t, e, n) {\n return t instanceof wn ? function(t, e, n) {\n // Unlike applySetMutationToLocalView, if we're applying a mutation to a\n // remote document the server has accepted the mutation so the precondition\n // must have held.\n return new kn(t.key, n.version, t.value, {\n hasCommittedMutations: !0\n });\n }(t, 0, n) : t instanceof _n ? function(t, e, n) {\n if (!ln(t.Ge, e)) \n // Since the mutation was not rejected, we know that the precondition\n // matched on the backend. We therefore must not have the expected version\n // of the document in our cache and return an UnknownDocument with the\n // known updateTime.\n return new On(t.key, n.version);\n var r = bn(t, e);\n return new kn(t.key, n.version, r, {\n hasCommittedMutations: !0\n });\n }(t, e, n) : t instanceof In ? function(t, e, n) {\n if (g(null != n.transformResults), !ln(t.Ge, e)) \n // Since the mutation was not rejected, we know that the precondition\n // matched on the backend. We therefore must not have the expected version\n // of the document in our cache and return an UnknownDocument with the\n // known updateTime.\n return new On(t.key, n.version);\n var r = En(t, e), i = \n /**\n * Creates a list of \"transform results\" (a transform result is a field value\n * representing the result of applying a transform) for use after a\n * TransformMutation has been acknowledged by the server.\n *\n * @param fieldTransforms The field transforms to apply the result to.\n * @param baseDoc The document prior to applying this mutation batch.\n * @param serverTransformResults The transform results received by the server.\n * @return The transform results list.\n */\n function(t, e, n) {\n var r = [];\n g(t.length === n.length);\n for (var i = 0; i < n.length; i++) {\n var o = t[i], s = o.transform, u = null;\n e instanceof kn && (u = e.field(o.field)), r.push(Xe(s, u, n[i]));\n }\n return r;\n }(t.fieldTransforms, e, n.transformResults), o = n.version, s = Tn(t, r.data(), i);\n return new kn(t.key, o, s, {\n hasCommittedMutations: !0\n });\n }(t, e, n) : function(t, e, n) {\n // Unlike applyToLocalView, if we're applying a mutation to a remote\n // document the server has accepted the mutation so the precondition must\n // have held.\n return new Rn(t.key, n.version, {\n hasCommittedMutations: !0\n });\n }(t, 0, n);\n}\n\n/**\n * Applies this mutation to the given MaybeDocument or null for the purposes\n * of computing the new local view of a document. Both the input and returned\n * documents can be null.\n *\n * @param mutation The mutation to apply.\n * @param maybeDoc The document to mutate. The input document can be null if\n * the client has no knowledge of the pre-mutation state of the document.\n * @param baseDoc The state of the document prior to this mutation batch. The\n * input document can be null if the client has no knowledge of the\n * pre-mutation state of the document.\n * @param localWriteTime A timestamp indicating the local write time of the\n * batch this mutation is a part of.\n * @return The mutated document. The returned document may be null, but only\n * if maybeDoc was null and the mutation would not create a new document.\n */ function vn(t, e, n, r) {\n return t instanceof wn ? function(t, e) {\n if (!ln(t.Ge, e)) return e;\n var n = mn(e);\n return new kn(t.key, n, t.value, {\n Je: !0\n });\n }(t, e) : t instanceof _n ? function(t, e) {\n if (!ln(t.Ge, e)) return e;\n var n = mn(e), r = bn(t, e);\n return new kn(t.key, n, r, {\n Je: !0\n });\n }(t, e) : t instanceof In ? function(t, e, n, r) {\n if (!ln(t.Ge, e)) return e;\n var i = En(t, e), o = function(t, e, n, r) {\n for (var i = [], o = 0, s = t; o < s.length; o++) {\n var u = s[o], a = u.transform, c = null;\n n instanceof kn && (c = n.field(u.field)), null === c && r instanceof kn && (\n // If the current document does not contain a value for the mutated\n // field, use the value that existed before applying this mutation\n // batch. This solves an edge case where a PatchMutation clears the\n // values in a nested map before the TransformMutation is applied.\n c = r.field(u.field)), i.push($e(a, c, e));\n }\n return i;\n }(t.fieldTransforms, n, e, r), s = Tn(t, i.data(), o);\n return new kn(t.key, i.version, s, {\n Je: !0\n });\n }(t, e, r, n) : function(t, e) {\n return ln(t.Ge, e) ? new Rn(t.key, st.min()) : e;\n }(t, e);\n}\n\n/**\n * If this mutation is not idempotent, returns the base value to persist with\n * this mutation. If a base value is returned, the mutation is always applied\n * to this base value, even if document has already been updated.\n *\n * The base value is a sparse object that consists of only the document\n * fields for which this mutation contains a non-idempotent transformation\n * (e.g. a numeric increment). The provided value guarantees consistent\n * behavior for non-idempotent transforms and allow us to return the same\n * latency-compensated value even if the backend has already applied the\n * mutation. The base value is null for idempotent mutations, as they can be\n * re-played even if the backend has already applied them.\n *\n * @return a base value to store along with the mutation, or null for\n * idempotent mutations.\n */ function yn(t, e) {\n return t instanceof In ? function(t, e) {\n for (var n = null, r = 0, i = t.fieldTransforms; r < i.length; r++) {\n var o = i[r], s = e instanceof kn ? e.field(o.field) : void 0, u = Je(o.transform, s || null);\n null != u && (n = null == n ? (new Dn).set(o.field, u) : n.set(o.field, u));\n }\n return n ? n.Xe() : null;\n }(t, e) : null;\n}\n\nfunction gn(t, e) {\n return t.type === e.type && !!t.key.isEqual(e.key) && !!t.Ge.isEqual(e.Ge) && (0 /* Set */ === t.type ? t.value.isEqual(e.value) : 1 /* Patch */ === t.type ? t.data.isEqual(e.data) && t.We.isEqual(e.We) : 2 /* Transform */ !== t.type || Y(t.fieldTransforms, t.fieldTransforms, (function(t, e) {\n return function(t, e) {\n return t.field.isEqual(e.field) && function(t, e) {\n return t instanceof tn && e instanceof tn || t instanceof nn && e instanceof nn ? Y(t.elements, e.elements, Zt) : t instanceof on && e instanceof on ? Zt(t.je, e.je) : t instanceof Ze && e instanceof Ze;\n }(t.transform, e.transform);\n }(t, e);\n })));\n}\n\n/**\n * Returns the version from the given document for use as the result of a\n * mutation. Mutations are defined to return the version of the base document\n * only if it is an existing document. Deleted and unknown documents have a\n * post-mutation version of SnapshotVersion.min().\n */ function mn(t) {\n return t instanceof kn ? t.version : st.min();\n}\n\n/**\n * A mutation that creates or replaces the document at the given key with the\n * object value contents.\n */ var wn = /** @class */ function(e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).key = t, i.value = n, i.Ge = r, i.type = 0 /* Set */ , \n i;\n }\n return t.__extends(n, e), n;\n}(pn), _n = /** @class */ function(e) {\n function n(t, n, r, i) {\n var o = this;\n return (o = e.call(this) || this).key = t, o.data = n, o.We = r, o.Ge = i, o.type = 1 /* Patch */ , \n o;\n }\n return t.__extends(n, e), n;\n}(pn);\n\nfunction bn(t, e) {\n return function(t, e) {\n var n = new Dn(e);\n return t.We.fields.forEach((function(e) {\n if (!e.m()) {\n var r = t.data.field(e);\n null !== r ? n.set(e, r) : n.delete(e);\n }\n })), n.Xe();\n }(t, e instanceof kn ? e.data() : Sn.empty());\n}\n\nvar In = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).key = t, r.fieldTransforms = n, r.type = 2 /* Transform */ , \n // NOTE: We set a precondition of exists: true as a safety-check, since we\n // always combine TransformMutations with a SetMutation or PatchMutation which\n // (if successful) should end up with an existing document.\n r.Ge = fn.exists(!0), r;\n }\n return t.__extends(n, e), n;\n}(pn);\n\nfunction En(t, e) {\n return e;\n}\n\nfunction Tn(t, e, n) {\n for (var r = new Dn(e), i = 0; i < t.fieldTransforms.length; i++) {\n var o = t.fieldTransforms[i];\n r.set(o.field, n[i]);\n }\n return r.Xe();\n}\n\n/** A mutation that deletes the document at the given key. */ var Nn = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).key = t, r.Ge = n, r.type = 3 /* Delete */ , r;\n }\n return t.__extends(n, e), n;\n}(pn), An = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).key = t, r.Ge = n, r.type = 4 /* Verify */ , r;\n }\n return t.__extends(n, e), n;\n}(pn), Sn = /** @class */ function() {\n function t(t) {\n this.proto = t;\n }\n return t.empty = function() {\n return new t({\n mapValue: {}\n });\n }, \n /**\n * Returns the value at the given path or null.\n *\n * @param path the path to search\n * @return The value at the path or if there it doesn't exist.\n */\n t.prototype.field = function(t) {\n if (t.m()) return this.proto;\n for (var e = this.proto, n = 0; n < t.length - 1; ++n) {\n if (!e.mapValue.fields) return null;\n if (!pe(e = e.mapValue.fields[t.get(n)])) return null;\n }\n return (e = (e.mapValue.fields || {})[t._()]) || null;\n }, t.prototype.isEqual = function(t) {\n return Zt(this.proto, t.proto);\n }, t;\n}(), Dn = /** @class */ function() {\n /**\n * @param baseObject The object to mutate.\n */\n function t(t) {\n void 0 === t && (t = Sn.empty()), this.Ze = t, \n /** A map that contains the accumulated changes in this builder. */\n this.tn = new Map;\n }\n /**\n * Sets the field to the provided value.\n *\n * @param path The field path to set.\n * @param value The value to set.\n * @return The current Builder instance.\n */ return t.prototype.set = function(t, e) {\n return this.en(t, e), this;\n }, \n /**\n * Removes the field at the specified path. If there is no field at the\n * specified path, nothing is changed.\n *\n * @param path The field path to remove.\n * @return The current Builder instance.\n */\n t.prototype.delete = function(t) {\n return this.en(t, null), this;\n }, \n /**\n * Adds `value` to the overlay map at `path`. Creates nested map entries if\n * needed.\n */\n t.prototype.en = function(t, e) {\n for (var n = this.tn, r = 0; r < t.length - 1; ++r) {\n var i = t.get(r), o = n.get(i);\n o instanceof Map ? \n // Re-use a previously created map\n n = o : o && 10 /* ObjectValue */ === Jt(o) ? (\n // Convert the existing Protobuf MapValue into a map\n o = new Map(Object.entries(o.mapValue.fields || {})), n.set(i, o), n = o) : (\n // Create an empty map to represent the current nesting level\n o = new Map, n.set(i, o), n = o);\n }\n n.set(t._(), e);\n }, \n /** Returns an ObjectValue with all mutations applied. */ t.prototype.Xe = function() {\n var t = this.nn(N.P(), this.tn);\n return null != t ? new Sn(t) : this.Ze;\n }, \n /**\n * Applies any overlays from `currentOverlays` that exist at `currentPath`\n * and returns the merged data at `currentPath` (or null if there were no\n * changes).\n *\n * @param currentPath The path at the current nesting level. Can be set to\n * FieldValue.emptyPath() to represent the root.\n * @param currentOverlays The overlays at the current nesting level in the\n * same format as `overlayMap`.\n * @return The merged data at `currentPath` or null if no modifications\n * were applied.\n */\n t.prototype.nn = function(t, e) {\n var n = this, r = !1, i = this.Ze.field(t), o = pe(i) ? // If there is already data at the current path, base our\n Object.assign({}, i.mapValue.fields) : {};\n return e.forEach((function(e, i) {\n if (e instanceof Map) {\n var s = n.nn(t.child(i), e);\n null != s && (o[i] = s, r = !0);\n } else null !== e ? (o[i] = e, r = !0) : o.hasOwnProperty(i) && (delete o[i], r = !0);\n })), r ? {\n mapValue: {\n fields: o\n }\n } : null;\n }, t;\n}();\n\n/**\n * Returns a FieldMask built from all fields in a MapValue.\n */\nfunction xn(t) {\n var e = [];\n return _(t.fields || {}, (function(t, n) {\n var r = new N([ t ]);\n if (pe(n)) {\n var i = xn(n.mapValue).fields;\n if (0 === i.length) \n // Preserve the empty map by adding it to the FieldMask.\n e.push(r); else \n // For nested and non-empty ObjectValues, add the FieldPath of the\n // leaf nodes.\n for (var o = 0, s = i; o < s.length; o++) {\n var u = s[o];\n e.push(r.child(u));\n }\n } else \n // For nested and non-empty ObjectValues, add the FieldPath of the leaf\n // nodes.\n e.push(r);\n })), new an(e)\n /**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * The result of a lookup for a given path may be an existing document or a\n * marker that this document does not exist at a given version.\n */;\n}\n\nvar Ln = function(t, e) {\n this.key = t, this.version = e;\n}, kn = /** @class */ function(e) {\n function n(t, n, r, i) {\n var o = this;\n return (o = e.call(this, t, n) || this).sn = r, o.Je = !!i.Je, o.hasCommittedMutations = !!i.hasCommittedMutations, \n o;\n }\n return t.__extends(n, e), n.prototype.field = function(t) {\n return this.sn.field(t);\n }, n.prototype.data = function() {\n return this.sn;\n }, n.prototype.rn = function() {\n return this.sn.proto;\n }, n.prototype.isEqual = function(t) {\n return t instanceof n && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.Je === t.Je && this.hasCommittedMutations === t.hasCommittedMutations && this.sn.isEqual(t.sn);\n }, n.prototype.toString = function() {\n return \"Document(\" + this.key + \", \" + this.version + \", \" + this.sn.toString() + \", {hasLocalMutations: \" + this.Je + \"}), {hasCommittedMutations: \" + this.hasCommittedMutations + \"})\";\n }, Object.defineProperty(n.prototype, \"hasPendingWrites\", {\n get: function() {\n return this.Je || this.hasCommittedMutations;\n },\n enumerable: !1,\n configurable: !0\n }), n;\n}(Ln), Rn = /** @class */ function(e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this, t, n) || this).hasCommittedMutations = !(!r || !r.hasCommittedMutations), \n i;\n }\n return t.__extends(n, e), n.prototype.toString = function() {\n return \"NoDocument(\" + this.key + \", \" + this.version + \")\";\n }, Object.defineProperty(n.prototype, \"hasPendingWrites\", {\n get: function() {\n return this.hasCommittedMutations;\n },\n enumerable: !1,\n configurable: !0\n }), n.prototype.isEqual = function(t) {\n return t instanceof n && t.hasCommittedMutations === this.hasCommittedMutations && t.version.isEqual(this.version) && t.key.isEqual(this.key);\n }, n;\n}(Ln), On = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.prototype.toString = function() {\n return \"UnknownDocument(\" + this.key + \", \" + this.version + \")\";\n }, Object.defineProperty(n.prototype, \"hasPendingWrites\", {\n get: function() {\n return !0;\n },\n enumerable: !1,\n configurable: !0\n }), n.prototype.isEqual = function(t) {\n return t instanceof n && t.version.isEqual(this.version) && t.key.isEqual(this.key);\n }, n;\n}(Ln), Pn = \n/**\n * Initializes a Query with a path and optional additional query constraints.\n * Path must currently be empty if this is a collection group query.\n */\nfunction(t, e, n, r, i, o /* First */ , s, u) {\n void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []), \n void 0 === i && (i = null), void 0 === o && (o = \"F\"), void 0 === s && (s = null), \n void 0 === u && (u = null), this.path = t, this.collectionGroup = e, this.on = n, \n this.filters = r, this.limit = i, this.an = o, this.startAt = s, this.endAt = u, \n this.cn = null, \n // The corresponding `Target` of this `Query` instance.\n this.un = null, this.startAt, this.endAt;\n};\n\n/**\n * Represents a document in Firestore with a key, version, data and whether the\n * data has local mutations applied to it.\n */\n/** Creates a new Query instance with the options provided. */ function Vn(t, e, n, r, i, o, s, u) {\n return new Pn(t, e, n, r, i, o, s, u);\n}\n\n/** Creates a new Query for a query that matches all documents at `path` */ function Un(t) {\n return new Pn(t);\n}\n\n/**\n * Helper to convert a collection group query into a collection query at a\n * specific path. This is used when executing collection group queries, since\n * we have to split the query into a set of collection queries at multiple\n * paths.\n */ function Cn(t) {\n return !ut(t.limit) && \"F\" /* First */ === t.an;\n}\n\nfunction Fn(t) {\n return !ut(t.limit) && \"L\" /* Last */ === t.an;\n}\n\nfunction Mn(t) {\n return t.on.length > 0 ? t.on[0].field : null;\n}\n\nfunction qn(t) {\n for (var e = 0, n = t.filters; e < n.length; e++) {\n var r = n[e];\n if (r.hn()) return r.field;\n }\n return null;\n}\n\n/**\n * Checks if any of the provided Operators are included in the query and\n * returns the first one that is, or null if none are.\n */\n/**\n * Returns whether the query matches a collection group rather than a specific\n * collection.\n */ function jn(t) {\n return null !== t.collectionGroup;\n}\n\n/**\n * Returns the implicit order by constraint that is used to execute the Query,\n * which can be different from the order by constraints the user provided (e.g.\n * the SDK and backend always orders by `__name__`).\n */ function Gn(t) {\n var e = m(t);\n if (null === e.cn) {\n e.cn = [];\n var n = qn(e), r = Mn(e);\n if (null !== n && null === r) \n // In order to implicitly add key ordering, we must also add the\n // inequality filter field for it to be a valid query.\n // Note that the default inequality field and key ordering is ascending.\n n.p() || e.cn.push(new fr(n)), e.cn.push(new fr(N.v(), \"asc\" /* ASCENDING */)); else {\n for (var i = !1, o = 0, s = e.on; o < s.length; o++) {\n var u = s[o];\n e.cn.push(u), u.field.p() && (i = !0);\n }\n if (!i) {\n // The order of the implicit key ordering always matches the last\n // explicit order by\n var a = e.on.length > 0 ? e.on[e.on.length - 1].dir : \"asc\" /* ASCENDING */;\n e.cn.push(new fr(N.v(), a));\n }\n }\n }\n return e.cn;\n}\n\n/**\n * Converts this `Query` instance to it's corresponding `Target` representation.\n */ function zn(t) {\n var e = m(t);\n if (!e.un) if (\"F\" /* First */ === e.an) e.un = ft(e.path, e.collectionGroup, Gn(e), e.filters, e.limit, e.startAt, e.endAt); else {\n for (\n // Flip the orderBy directions since we want the last results\n var n = [], r = 0, i = Gn(e); r < i.length; r++) {\n var o = i[r], s = \"desc\" /* DESCENDING */ === o.dir ? \"asc\" /* ASCENDING */ : \"desc\" /* DESCENDING */;\n n.push(new fr(o.field, s));\n }\n // We need to swap the cursors to match the now-flipped query ordering.\n var u = e.endAt ? new ur(e.endAt.position, !e.endAt.before) : null, a = e.startAt ? new ur(e.startAt.position, !e.startAt.before) : null;\n // Now return as a LimitType.First query.\n e.un = ft(e.path, e.collectionGroup, n, e.filters, e.limit, u, a);\n }\n return e.un;\n}\n\nfunction Bn(t, e, n) {\n return new Pn(t.path, t.collectionGroup, t.on.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);\n}\n\nfunction Wn(t, e) {\n return new Pn(t.path, t.collectionGroup, t.on.slice(), t.filters.slice(), t.limit, t.an, e, t.endAt);\n}\n\nfunction Kn(t, e) {\n return new Pn(t.path, t.collectionGroup, t.on.slice(), t.filters.slice(), t.limit, t.an, t.startAt, e);\n}\n\nfunction Qn(t, e) {\n return pt(zn(t), zn(e)) && t.an === e.an;\n}\n\n// TODO(b/29183165): This is used to get a unique string from a query to, for\n// example, use as a dictionary key, but the implementation is subject to\n// collisions. Make it collision-free.\nfunction Hn(t) {\n return lt(zn(t)) + \"|lt:\" + t.an;\n}\n\nfunction Yn(t) {\n return \"Query(target=\" + function(t) {\n var e = t.path.R();\n return null !== t.collectionGroup && (e += \" collectionGroup=\" + t.collectionGroup), \n t.filters.length > 0 && (e += \", filters: [\" + t.filters.map((function(t) {\n return (e = t).field.R() + \" \" + e.op + \" \" + re(e.value);\n /** Returns a debug description for `filter`. */ var e;\n /** Filter that matches on key fields (i.e. '__name__'). */ })).join(\", \") + \"]\"), \n ut(t.limit) || (e += \", limit: \" + t.limit), t.orderBy.length > 0 && (e += \", orderBy: [\" + t.orderBy.map((function(t) {\n return (e = t).field.R() + \" (\" + e.dir + \")\";\n var e;\n })).join(\", \") + \"]\"), t.startAt && (e += \", startAt: \" + ar(t.startAt)), t.endAt && (e += \", endAt: \" + ar(t.endAt)), \n \"Target(\" + e + \")\";\n }(zn(t)) + \"; limitType=\" + t.an + \")\";\n}\n\n/** Returns whether `doc` matches the constraints of `query`. */ function $n(t, e) {\n return function(t, e) {\n var n = e.key.path;\n return null !== t.collectionGroup ? e.key.N(t.collectionGroup) && t.path.T(n) : A.F(t.path) ? t.path.isEqual(n) : t.path.I(n);\n }(t, e) && function(t, e) {\n for (var n = 0, r = t.on; n < r.length; n++) {\n var i = r[n];\n // order by key always matches\n if (!i.field.p() && null === e.field(i.field)) return !1;\n }\n return !0;\n }(t, e) && function(t, e) {\n for (var n = 0, r = t.filters; n < r.length; n++) {\n if (!r[n].matches(e)) return !1;\n }\n return !0;\n }(t, e) && function(t, e) {\n return !(t.startAt && !cr(t.startAt, Gn(t), e)) && (!t.endAt || !cr(t.endAt, Gn(t), e));\n }(t, e);\n}\n\nfunction Xn(t) {\n return function(e, n) {\n for (var r = !1, i = 0, o = Gn(t); i < o.length; i++) {\n var s = o[i], u = lr(s, e, n);\n if (0 !== u) return u;\n r = r || s.field.p();\n }\n return 0;\n };\n}\n\nvar Jn = /** @class */ function(e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;\n }\n /**\n * Creates a filter based on the provided arguments.\n */ return t.__extends(n, e), n.create = function(t, e, r) {\n if (t.p()) return \"in\" /* IN */ === e || \"not-in\" /* NOT_IN */ === e ? this.ln(t, e, r) : new Zn(t, e, r);\n if (fe(r)) {\n if (\"==\" /* EQUAL */ !== e && \"!=\" /* NOT_EQUAL */ !== e) throw new c(a.INVALID_ARGUMENT, \"Invalid query. Null only supports '==' and '!=' comparisons.\");\n return new n(t, e, r);\n }\n if (le(r)) {\n if (\"==\" /* EQUAL */ !== e && \"!=\" /* NOT_EQUAL */ !== e) throw new c(a.INVALID_ARGUMENT, \"Invalid query. NaN only supports '==' and '!=' comparisons.\");\n return new n(t, e, r);\n }\n return \"array-contains\" /* ARRAY_CONTAINS */ === e ? new rr(t, r) : \"in\" /* IN */ === e ? new ir(t, r) : \"not-in\" /* NOT_IN */ === e ? new or(t, r) : \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ === e ? new sr(t, r) : new n(t, e, r);\n }, n.ln = function(t, e, n) {\n return \"in\" /* IN */ === e ? new tr(t, n) : new er(t, n);\n }, n.prototype.matches = function(t) {\n var e = t.field(this.field);\n // Types do not have to match in NOT_EQUAL filters.\n return \"!=\" /* NOT_EQUAL */ === this.op ? null !== e && this._n(ee(e, this.value)) : null !== e && Jt(this.value) === Jt(e) && this._n(ee(e, this.value));\n // Only compare types with matching backend order (such as double and int).\n }, n.prototype._n = function(t) {\n switch (this.op) {\n case \"<\" /* LESS_THAN */ :\n return t < 0;\n\n case \"<=\" /* LESS_THAN_OR_EQUAL */ :\n return t <= 0;\n\n case \"==\" /* EQUAL */ :\n return 0 === t;\n\n case \"!=\" /* NOT_EQUAL */ :\n return 0 !== t;\n\n case \">\" /* GREATER_THAN */ :\n return t > 0;\n\n case \">=\" /* GREATER_THAN_OR_EQUAL */ :\n return t >= 0;\n\n default:\n return y();\n }\n }, n.prototype.hn = function() {\n return [ \"<\" /* LESS_THAN */ , \"<=\" /* LESS_THAN_OR_EQUAL */ , \">\" /* GREATER_THAN */ , \">=\" /* GREATER_THAN_OR_EQUAL */ , \"!=\" /* NOT_EQUAL */ , \"not-in\" /* NOT_IN */ ].indexOf(this.op) >= 0;\n }, n;\n}((function() {}));\n\nvar Zn = /** @class */ function(e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this, t, n, r) || this).key = A.C(r.referenceValue), i;\n }\n return t.__extends(n, e), n.prototype.matches = function(t) {\n var e = A.i(t.key, this.key);\n return this._n(e);\n }, n;\n}(Jn), tr = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t, \"in\" /* IN */ , n) || this).keys = nr(\"in\" /* IN */ , n), \n r;\n }\n return t.__extends(n, e), n.prototype.matches = function(t) {\n return this.keys.some((function(e) {\n return e.isEqual(t.key);\n }));\n }, n;\n}(Jn), er = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t, \"not-in\" /* NOT_IN */ , n) || this).keys = nr(\"not-in\" /* NOT_IN */ , n), \n r;\n }\n return t.__extends(n, e), n.prototype.matches = function(t) {\n return !this.keys.some((function(e) {\n return e.isEqual(t.key);\n }));\n }, n;\n}(Jn);\n\n/** Filter that matches on key fields within an array. */ function nr(t, e) {\n var n;\n return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((function(t) {\n return A.C(t.referenceValue);\n }));\n}\n\n/** A Filter that implements the array-contains operator. */ var rr = /** @class */ function(e) {\n function n(t, n) {\n return e.call(this, t, \"array-contains\" /* ARRAY_CONTAINS */ , n) || this;\n }\n return t.__extends(n, e), n.prototype.matches = function(t) {\n var e = t.field(this.field);\n return he(e) && te(e.arrayValue, this.value);\n }, n;\n}(Jn), ir = /** @class */ function(e) {\n function n(t, n) {\n return e.call(this, t, \"in\" /* IN */ , n) || this;\n }\n return t.__extends(n, e), n.prototype.matches = function(t) {\n var e = t.field(this.field);\n return null !== e && te(this.value.arrayValue, e);\n }, n;\n}(Jn), or = /** @class */ function(e) {\n function n(t, n) {\n return e.call(this, t, \"not-in\" /* NOT_IN */ , n) || this;\n }\n return t.__extends(n, e), n.prototype.matches = function(t) {\n if (te(this.value.arrayValue, {\n nullValue: \"NULL_VALUE\"\n })) return !1;\n var e = t.field(this.field);\n return null !== e && !te(this.value.arrayValue, e);\n }, n;\n}(Jn), sr = /** @class */ function(e) {\n function n(t, n) {\n return e.call(this, t, \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ , n) || this;\n }\n return t.__extends(n, e), n.prototype.matches = function(t) {\n var e = this, n = t.field(this.field);\n return !(!he(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {\n return te(e.value.arrayValue, t);\n }));\n }, n;\n}(Jn), ur = function(t, e) {\n this.position = t, this.before = e;\n};\n\n/** A Filter that implements the IN operator. */ function ar(t) {\n // TODO(b/29183165): Make this collision robust.\n return (t.before ? \"b\" : \"a\") + \":\" + t.position.map((function(t) {\n return re(t);\n })).join(\",\");\n}\n\n/**\n * Returns true if a document sorts before a bound using the provided sort\n * order.\n */ function cr(t, e, n) {\n for (var r = 0, i = 0; i < t.position.length; i++) {\n var o = e[i], s = t.position[i];\n if (r = o.field.p() ? A.i(A.C(s.referenceValue), n.key) : ee(s, n.field(o.field)), \n \"desc\" /* DESCENDING */ === o.dir && (r *= -1), 0 !== r) break;\n }\n return t.before ? r <= 0 : r < 0;\n}\n\nfunction hr(t, e) {\n if (null === t) return null === e;\n if (null === e) return !1;\n if (t.before !== e.before || t.position.length !== e.position.length) return !1;\n for (var n = 0; n < t.position.length; n++) if (!Zt(t.position[n], e.position[n])) return !1;\n return !0;\n}\n\n/**\n * An ordering on a field, in some Direction. Direction defaults to ASCENDING.\n */ var fr = function(t, e /* ASCENDING */) {\n void 0 === e && (e = \"asc\"), this.field = t, this.dir = e;\n};\n\nfunction lr(t, e, n) {\n var r = t.field.p() ? A.i(e.key, n.key) : function(t, e, n) {\n var r = e.field(t), i = n.field(t);\n return null !== r && null !== i ? ee(r, i) : y();\n }(t.field, e, n);\n switch (t.dir) {\n case \"asc\" /* ASCENDING */ :\n return r;\n\n case \"desc\" /* DESCENDING */ :\n return -1 * r;\n\n default:\n return y();\n }\n}\n\nfunction pr(t, e) {\n return t.dir === e.dir && t.field.isEqual(e.field);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ var dr = function() {\n var t = this;\n this.promise = new Promise((function(e, n) {\n t.resolve = e, t.reject = n;\n }));\n}, vr = /** @class */ function() {\n function t(\n /**\n * The AsyncQueue to run backoff operations on.\n */\n t, \n /**\n * The ID to use when scheduling backoff operations on the AsyncQueue.\n */\n e, \n /**\n * The initial delay (used as the base delay on the first retry attempt).\n * Note that jitter will still be applied, so the actual delay could be as\n * little as 0.5*initialDelayMs.\n */\n n\n /**\n * The multiplier to use to determine the extended base delay after each\n * attempt.\n */ , r\n /**\n * The maximum base delay after which no further backoff is performed.\n * Note that jitter will still be applied, so the actual delay could be as\n * much as 1.5*maxDelayMs.\n */ , i) {\n void 0 === n && (n = 1e3), void 0 === r && (r = 1.5), void 0 === i && (i = 6e4), \n this.fn = t, this.dn = e, this.wn = n, this.mn = r, this.Tn = i, this.En = 0, this.In = null, \n /** The last backoff attempt, as epoch milliseconds. */\n this.An = Date.now(), this.reset();\n }\n /**\n * Resets the backoff delay.\n *\n * The very next backoffAndWait() will have no delay. If it is called again\n * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and\n * subsequent ones will increase according to the backoffFactor.\n */ return t.prototype.reset = function() {\n this.En = 0;\n }, \n /**\n * Resets the backoff delay to the maximum delay (e.g. for use after a\n * RESOURCE_EXHAUSTED error).\n */\n t.prototype.Rn = function() {\n this.En = this.Tn;\n }, \n /**\n * Returns a promise that resolves after currentDelayMs, and increases the\n * delay for any subsequent attempts. If there was a pending backoff operation\n * already, it will be canceled.\n */\n t.prototype.gn = function(t) {\n var e = this;\n // Cancel any pending backoff operation.\n this.cancel();\n // First schedule using the current base (which may be 0 and should be\n // honored as such).\n var n = Math.floor(this.En + this.Pn()), r = Math.max(0, Date.now() - this.An), i = Math.max(0, n - r);\n // Guard against lastAttemptTime being in the future due to a clock change.\n i > 0 && l(\"ExponentialBackoff\", \"Backing off for \" + i + \" ms (base delay: \" + this.En + \" ms, delay with jitter: \" + n + \" ms, last attempt: \" + r + \" ms ago)\"), \n this.In = this.fn.yn(this.dn, i, (function() {\n return e.An = Date.now(), t();\n })), \n // Apply backoff factor to determine next delay and ensure it is within\n // bounds.\n this.En *= this.mn, this.En < this.wn && (this.En = this.wn), this.En > this.Tn && (this.En = this.Tn);\n }, t.prototype.Vn = function() {\n null !== this.In && (this.In.pn(), this.In = null);\n }, t.prototype.cancel = function() {\n null !== this.In && (this.In.cancel(), this.In = null);\n }, \n /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.Pn = function() {\n return (Math.random() - .5) * this.En;\n }, t;\n}(), yr = /** @class */ function() {\n function t(t) {\n var e = this;\n // NOTE: next/catchCallback will always point to our own wrapper functions,\n // not the user's raw next() or catch() callbacks.\n this.bn = null, this.vn = null, \n // When the operation resolves, we'll set result or error and mark isDone.\n this.result = void 0, this.error = void 0, this.Sn = !1, \n // Set to true when .then() or .catch() are called and prevents additional\n // chaining.\n this.Dn = !1, t((function(t) {\n e.Sn = !0, e.result = t, e.bn && \n // value should be defined unless T is Void, but we can't express\n // that in the type system.\n e.bn(t);\n }), (function(t) {\n e.Sn = !0, e.error = t, e.vn && e.vn(t);\n }));\n }\n return t.prototype.catch = function(t) {\n return this.next(void 0, t);\n }, t.prototype.next = function(e, n) {\n var r = this;\n return this.Dn && y(), this.Dn = !0, this.Sn ? this.error ? this.Cn(n, this.error) : this.Nn(e, this.result) : new t((function(t, i) {\n r.bn = function(n) {\n r.Nn(e, n).next(t, i);\n }, r.vn = function(e) {\n r.Cn(n, e).next(t, i);\n };\n }));\n }, t.prototype.Fn = function() {\n var t = this;\n return new Promise((function(e, n) {\n t.next(e, n);\n }));\n }, t.prototype.xn = function(e) {\n try {\n var n = e();\n return n instanceof t ? n : t.resolve(n);\n } catch (e) {\n return t.reject(e);\n }\n }, t.prototype.Nn = function(e, n) {\n return e ? this.xn((function() {\n return e(n);\n })) : t.resolve(n);\n }, t.prototype.Cn = function(e, n) {\n return e ? this.xn((function() {\n return e(n);\n })) : t.reject(n);\n }, t.resolve = function(e) {\n return new t((function(t, n) {\n t(e);\n }));\n }, t.reject = function(e) {\n return new t((function(t, n) {\n n(e);\n }));\n }, t.$n = function(\n // Accept all Promise types in waitFor().\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n e) {\n return new t((function(t, n) {\n var r = 0, i = 0, o = !1;\n e.forEach((function(e) {\n ++r, e.next((function() {\n ++i, o && i === r && t();\n }), (function(t) {\n return n(t);\n }));\n })), o = !0, i === r && t();\n }));\n }, \n /**\n * Given an array of predicate functions that asynchronously evaluate to a\n * boolean, implements a short-circuiting `or` between the results. Predicates\n * will be evaluated until one of them returns `true`, then stop. The final\n * result will be whether any of them returned `true`.\n */\n t.kn = function(e) {\n for (var n = t.resolve(!1), r = function(e) {\n n = n.next((function(n) {\n return n ? t.resolve(n) : e();\n }));\n }, i = 0, o = e; i < o.length; i++) {\n r(o[i]);\n }\n return n;\n }, t.forEach = function(t, e) {\n var n = this, r = [];\n return t.forEach((function(t, i) {\n r.push(e.call(n, t, i));\n })), this.$n(r);\n }, t;\n}(), gr = /** @class */ function() {\n /*\n * Creates a new SimpleDb wrapper for IndexedDb database `name`.\n *\n * Note that `version` must not be a downgrade. IndexedDB does not support\n * downgrading the schema version. We currently do not support any way to do\n * versioning outside of IndexedDB's versioning mechanism, as only\n * version-upgrade transactions are allowed to do things like create\n * objectstores.\n */\n function e(t, n, i) {\n this.name = t, this.version = n, this.Mn = i, \n // NOTE: According to https://bugs.webkit.org/show_bug.cgi?id=197050, the\n // bug we're checking for should exist in iOS >= 12.2 and < 13, but for\n // whatever reason it's much harder to hit after 12.2 so we only proactively\n // log on 12.2.\n 12.2 === e.On(r.getUA()) && p(\"Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.\");\n }\n /** Deletes the specified database. */ return e.delete = function(t) {\n return l(\"SimpleDb\", \"Removing database:\", t), Er(window.indexedDB.deleteDatabase(t)).Fn();\n }, \n /** Returns true if IndexedDB is available in the current environment. */ e.Ln = function() {\n if (\"undefined\" == typeof indexedDB) return !1;\n if (e.Bn()) return !0;\n // We extensively use indexed array values and compound keys,\n // which IE and Edge do not support. However, they still have indexedDB\n // defined on the window, so we need to check for them here and make sure\n // to return that persistence is not enabled for those browsers.\n // For tracking support of this feature, see here:\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/\n // Check the UA string to find out the browser.\n var t = r.getUA(), n = e.On(t), i = 0 < n && n < 10, o = e.qn(t), s = 0 < o && o < 4.5;\n // IE 10\n // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';\n // IE 11\n // ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';\n // Edge\n // ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML,\n // like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0';\n // iOS Safari: Disable for users running iOS version < 10.\n return !(t.indexOf(\"MSIE \") > 0 || t.indexOf(\"Trident/\") > 0 || t.indexOf(\"Edge/\") > 0 || i || s);\n }, \n /**\n * Returns true if the backing IndexedDB store is the Node IndexedDBShim\n * (see https://github.com/axemclion/IndexedDBShim).\n */\n e.Bn = function() {\n var t;\n return \"undefined\" != typeof process && \"YES\" === (null === (t = process.env) || void 0 === t ? void 0 : t.Un);\n }, \n /** Helper to get a typed SimpleDbStore from a transaction. */ e.Qn = function(t, e) {\n return t.store(e);\n }, \n // visible for testing\n /** Parse User Agent to determine iOS version. Returns -1 if not found. */\n e.On = function(t) {\n var e = t.match(/i(?:phone|pad|pod) os ([\\d_]+)/i), n = e ? e[1].split(\"_\").slice(0, 2).join(\".\") : \"-1\";\n return Number(n);\n }, \n // visible for testing\n /** Parse User Agent to determine Android version. Returns -1 if not found. */\n e.qn = function(t) {\n var e = t.match(/Android ([\\d.]+)/i), n = e ? e[1].split(\".\").slice(0, 2).join(\".\") : \"-1\";\n return Number(n);\n }, \n /**\n * Opens the specified database, creating or upgrading it if necessary.\n */\n e.prototype.Wn = function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r = this;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return this.db ? [ 3 /*break*/ , 2 ] : (l(\"SimpleDb\", \"Opening database:\", this.name), \n n = this, [ 4 /*yield*/ , new Promise((function(t, n) {\n // TODO(mikelehen): Investigate browser compatibility.\n // https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB\n // suggests IE9 and older WebKit browsers handle upgrade\n // differently. They expect setVersion, as described here:\n // https://developer.mozilla.org/en-US/docs/Web/API/IDBVersionChangeRequest/setVersion\n var i = indexedDB.open(r.name, r.version);\n i.onsuccess = function(e) {\n var n = e.target.result;\n t(n);\n }, i.onblocked = function() {\n n(new wr(e, \"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed.\"));\n }, i.onerror = function(t) {\n var r = t.target.error;\n \"VersionError\" === r.name ? n(new c(a.FAILED_PRECONDITION, \"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.\")) : n(new wr(e, r));\n }, i.onupgradeneeded = function(t) {\n l(\"SimpleDb\", 'Database \"' + r.name + '\" requires upgrade from version:', t.oldVersion);\n var e = t.target.result;\n r.Mn.createOrUpgrade(e, i.transaction, t.oldVersion, r.version).next((function() {\n l(\"SimpleDb\", \"Database upgrade to version \" + r.version + \" complete\");\n }));\n };\n })) ]);\n\n case 1:\n n.db = t.sent(), t.label = 2;\n\n case 2:\n return [ 2 /*return*/ , (this.jn && (this.db.onversionchange = function(t) {\n return r.jn(t);\n }), this.db) ];\n }\n }));\n }));\n }, e.prototype.Kn = function(t) {\n this.jn = t, this.db && (this.db.onversionchange = function(e) {\n return t(e);\n });\n }, e.prototype.runTransaction = function(e, n, r, i) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var o, s, u, a, c;\n return t.__generator(this, (function(h) {\n switch (h.label) {\n case 0:\n o = \"readonly\" === n, s = 0, u = function() {\n var n, u, c, h, f;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n ++s, t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 4, , 5 ]), [ 4 /*yield*/ , a.Wn(e) ];\n\n case 2:\n // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to\n // fire), but still return the original transactionFnResult back to the\n // caller.\n return a.db = t.sent(), n = br.open(a.db, e, o ? \"readonly\" : \"readwrite\", r), u = i(n).catch((function(t) {\n // Abort the transaction if there was an error.\n return n.abort(t), yr.reject(t);\n })).Fn(), c = {}, u.catch((function() {})), [ 4 /*yield*/ , n.Gn ];\n\n case 3:\n return [ 2 /*return*/ , (c.value = (\n // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to\n // fire), but still return the original transactionFnResult back to the\n // caller.\n t.sent(), u), c) ];\n\n case 4:\n return h = t.sent(), f = \"FirebaseError\" !== h.name && s < 3, l(\"SimpleDb\", \"Transaction failed with error:\", h.message, \"Retrying:\", f), \n a.close(), f ? [ 3 /*break*/ , 5 ] : [ 2 /*return*/ , {\n value: Promise.reject(h)\n } ];\n\n case 5:\n return [ 2 /*return*/ ];\n }\n }));\n }, a = this, h.label = 1;\n\n case 1:\n return [ 5 /*yield**/ , u() ];\n\n case 2:\n if (\"object\" == typeof (c = h.sent())) return [ 2 /*return*/ , c.value ];\n h.label = 3;\n\n case 3:\n return [ 3 /*break*/ , 1 ];\n\n case 4:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }, e.prototype.close = function() {\n this.db && this.db.close(), this.db = void 0;\n }, e;\n}(), mr = /** @class */ function() {\n function t(t) {\n this.zn = t, this.Hn = !1, this.Yn = null;\n }\n return Object.defineProperty(t.prototype, \"Sn\", {\n get: function() {\n return this.Hn;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"Jn\", {\n get: function() {\n return this.Yn;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"cursor\", {\n set: function(t) {\n this.zn = t;\n },\n enumerable: !1,\n configurable: !0\n }), \n /**\n * This function can be called to stop iteration at any point.\n */\n t.prototype.done = function() {\n this.Hn = !0;\n }, \n /**\n * This function can be called to skip to that next key, which could be\n * an index or a primary key.\n */\n t.prototype.Xn = function(t) {\n this.Yn = t;\n }, \n /**\n * Delete the current cursor value from the object store.\n *\n * NOTE: You CANNOT do this with a keysOnly query.\n */\n t.prototype.delete = function() {\n return Er(this.zn.delete());\n }, t;\n}(), wr = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, a.UNAVAILABLE, \"IndexedDB transaction '\" + t + \"' failed: \" + n) || this).name = \"IndexedDbTransactionError\", \n r;\n }\n return t.__extends(n, e), n;\n}(c);\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A helper for running delayed tasks following an exponential backoff curve\n * between attempts.\n *\n * Each delay is made up of a \"base\" delay which follows the exponential\n * backoff curve, and a +/- 50% \"jitter\" that is calculated and added to the\n * base delay. This prevents clients from accidentally synchronizing their\n * delays causing spikes of load to the backend.\n */\n/** Verifies whether `e` is an IndexedDbTransactionError. */ function _r(t) {\n // Use name equality, as instanceof checks on errors don't work with errors\n // that wrap other errors.\n return \"IndexedDbTransactionError\" === t.name;\n}\n\n/**\n * Wraps an IDBTransaction and exposes a store() method to get a handle to a\n * specific object store.\n */ var br = /** @class */ function() {\n function t(t, e) {\n var n = this;\n this.action = t, this.transaction = e, this.aborted = !1, \n /**\n * A promise that resolves with the result of the IndexedDb transaction.\n */\n this.Zn = new dr, this.transaction.oncomplete = function() {\n n.Zn.resolve();\n }, this.transaction.onabort = function() {\n e.error ? n.Zn.reject(new wr(t, e.error)) : n.Zn.resolve();\n }, this.transaction.onerror = function(e) {\n var r = Nr(e.target.error);\n n.Zn.reject(new wr(t, r));\n };\n }\n return t.open = function(e, n, r, i) {\n try {\n return new t(n, e.transaction(i, r));\n } catch (e) {\n throw new wr(n, e);\n }\n }, Object.defineProperty(t.prototype, \"Gn\", {\n get: function() {\n return this.Zn.promise;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.abort = function(t) {\n t && this.Zn.reject(t), this.aborted || (l(\"SimpleDb\", \"Aborting transaction:\", t ? t.message : \"Client-initiated abort\"), \n this.aborted = !0, this.transaction.abort());\n }, \n /**\n * Returns a SimpleDbStore for the specified store. All\n * operations performed on the SimpleDbStore happen within the context of this\n * transaction and it cannot be used anymore once the transaction is\n * completed.\n *\n * Note that we can't actually enforce that the KeyType and ValueType are\n * correct, but they allow type safety through the rest of the consuming code.\n */\n t.prototype.store = function(t) {\n var e = this.transaction.objectStore(t);\n return new Ir(e);\n }, t;\n}(), Ir = /** @class */ function() {\n function t(t) {\n this.store = t;\n }\n return t.prototype.put = function(t, e) {\n var n;\n return void 0 !== e ? (l(\"SimpleDb\", \"PUT\", this.store.name, t, e), n = this.store.put(e, t)) : (l(\"SimpleDb\", \"PUT\", this.store.name, \"\", t), \n n = this.store.put(t)), Er(n);\n }, \n /**\n * Adds a new value into an Object Store and returns the new key. Similar to\n * IndexedDb's `add()`, this method will fail on primary key collisions.\n *\n * @param value The object to write.\n * @return The key of the value to add.\n */\n t.prototype.add = function(t) {\n return l(\"SimpleDb\", \"ADD\", this.store.name, t, t), Er(this.store.add(t));\n }, \n /**\n * Gets the object with the specified key from the specified store, or null\n * if no object exists with the specified key.\n *\n * @key The key of the object to get.\n * @return The object with the specified key or null if no object exists.\n */\n t.prototype.get = function(t) {\n var e = this;\n // We're doing an unsafe cast to ValueType.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return Er(this.store.get(t)).next((function(n) {\n // Normalize nonexistence to null.\n return void 0 === n && (n = null), l(\"SimpleDb\", \"GET\", e.store.name, t, n), n;\n }));\n }, t.prototype.delete = function(t) {\n return l(\"SimpleDb\", \"DELETE\", this.store.name, t), Er(this.store.delete(t));\n }, \n /**\n * If we ever need more of the count variants, we can add overloads. For now,\n * all we need is to count everything in a store.\n *\n * Returns the number of rows in the store.\n */\n t.prototype.count = function() {\n return l(\"SimpleDb\", \"COUNT\", this.store.name), Er(this.store.count());\n }, t.prototype.ts = function(t, e) {\n var n = this.cursor(this.options(t, e)), r = [];\n return this.es(n, (function(t, e) {\n r.push(e);\n })).next((function() {\n return r;\n }));\n }, t.prototype.ns = function(t, e) {\n l(\"SimpleDb\", \"DELETE ALL\", this.store.name);\n var n = this.options(t, e);\n n.ss = !1;\n var r = this.cursor(n);\n return this.es(r, (function(t, e, n) {\n return n.delete();\n }));\n }, t.prototype.rs = function(t, e) {\n var n;\n e ? n = t : (n = {}, e = t);\n var r = this.cursor(n);\n return this.es(r, e);\n }, \n /**\n * Iterates over a store, but waits for the given callback to complete for\n * each entry before iterating the next entry. This allows the callback to do\n * asynchronous work to determine if this iteration should continue.\n *\n * The provided callback should return `true` to continue iteration, and\n * `false` otherwise.\n */\n t.prototype.os = function(t) {\n var e = this.cursor({});\n return new yr((function(n, r) {\n e.onerror = function(t) {\n var e = Nr(t.target.error);\n r(e);\n }, e.onsuccess = function(e) {\n var r = e.target.result;\n r ? t(r.primaryKey, r.value).next((function(t) {\n t ? r.continue() : n();\n })) : n();\n };\n }));\n }, t.prototype.es = function(t, e) {\n var n = [];\n return new yr((function(r, i) {\n t.onerror = function(t) {\n i(t.target.error);\n }, t.onsuccess = function(t) {\n var i = t.target.result;\n if (i) {\n var o = new mr(i), s = e(i.primaryKey, i.value, o);\n if (s instanceof yr) {\n var u = s.catch((function(t) {\n return o.done(), yr.reject(t);\n }));\n n.push(u);\n }\n o.Sn ? r() : null === o.Jn ? i.continue() : i.continue(o.Jn);\n } else r();\n };\n })).next((function() {\n return yr.$n(n);\n }));\n }, t.prototype.options = function(t, e) {\n var n = void 0;\n return void 0 !== t && (\"string\" == typeof t ? n = t : e = t), {\n index: n,\n range: e\n };\n }, t.prototype.cursor = function(t) {\n var e = \"next\";\n if (t.reverse && (e = \"prev\"), t.index) {\n var n = this.store.index(t.index);\n return t.ss ? n.openKeyCursor(t.range, e) : n.openCursor(t.range, e);\n }\n return this.store.openCursor(t.range, e);\n }, t;\n}();\n\n/**\n * A wrapper around an IDBObjectStore providing an API that:\n *\n * 1) Has generic KeyType / ValueType parameters to provide strongly-typed\n * methods for acting against the object store.\n * 2) Deals with IndexedDB's onsuccess / onerror event callbacks, making every\n * method return a PersistencePromise instead.\n * 3) Provides a higher-level API to avoid needing to do excessive wrapping of\n * intermediate IndexedDB types (IDBCursorWithValue, etc.)\n */\n/**\n * Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror\n * handlers to resolve / reject the PersistencePromise as appropriate.\n */\nfunction Er(t) {\n return new yr((function(e, n) {\n t.onsuccess = function(t) {\n var n = t.target.result;\n e(n);\n }, t.onerror = function(t) {\n var e = Nr(t.target.error);\n n(e);\n };\n }));\n}\n\n// Guard so we only report the error once.\nvar Tr = !1;\n\nfunction Nr(t) {\n var e = gr.On(r.getUA());\n if (e >= 12.2 && e < 13) {\n var n = \"An internal error was encountered in the Indexed Database server\";\n if (t.message.indexOf(n) >= 0) {\n // Wrap error in a more descriptive one.\n var i = new c(\"internal\", \"IOS_INDEXEDDB_BUG1: IndexedDb has thrown '\" + n + \"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.\");\n return Tr || (Tr = !0, \n // Throw a global exception outside of this promise chain, for the user to\n // potentially catch.\n setTimeout((function() {\n throw i;\n }), 0)), i;\n }\n }\n return t;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** The Platform's 'window' implementation or null if not available. */ function Ar() {\n // `window` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof window ? window : null;\n}\n\n/** The Platform's 'document' implementation or null if not available. */ function Sr() {\n // `document` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof document ? document : null;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents an operation scheduled to be run in the future on an AsyncQueue.\n *\n * It is created via DelayedOperation.createAndSchedule().\n *\n * Supports cancellation (via cancel()) and early execution (via skipDelay()).\n *\n * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type\n * in newer versions of TypeScript defines `finally`, which is not available in\n * IE.\n */ var Dr = /** @class */ function() {\n function t(t, e, n, r, i) {\n this.cs = t, this.dn = e, this.us = n, this.op = r, this.hs = i, this.ls = new dr, \n this.then = this.ls.promise.then.bind(this.ls.promise), \n // It's normal for the deferred promise to be canceled (due to cancellation)\n // and so we attach a dummy catch callback to avoid\n // 'UnhandledPromiseRejectionWarning' log spam.\n this.ls.promise.catch((function(t) {}))\n /**\n * Creates and returns a DelayedOperation that has been scheduled to be\n * executed on the provided asyncQueue after the provided delayMs.\n *\n * @param asyncQueue The queue to schedule the operation on.\n * @param id A Timer ID identifying the type of operation this is.\n * @param delayMs The delay (ms) before the operation should be scheduled.\n * @param op The operation to run.\n * @param removalCallback A callback to be called synchronously once the\n * operation is executed or canceled, notifying the AsyncQueue to remove it\n * from its delayedOperations list.\n * PORTING NOTE: This exists to prevent making removeDelayedOperation() and\n * the DelayedOperation class public.\n */;\n }\n return t._s = function(e, n, r, i, o) {\n var s = new t(e, n, Date.now() + r, i, o);\n return s.start(r), s;\n }, \n /**\n * Starts the timer. This is called immediately after construction by\n * createAndSchedule().\n */\n t.prototype.start = function(t) {\n var e = this;\n this.fs = setTimeout((function() {\n return e.ds();\n }), t);\n }, \n /**\n * Queues the operation to run immediately (if it hasn't already been run or\n * canceled).\n */\n t.prototype.pn = function() {\n return this.ds();\n }, \n /**\n * Cancels the operation if it hasn't already been executed or canceled. The\n * promise will be rejected.\n *\n * As long as the operation has not yet been run, calling cancel() provides a\n * guarantee that the operation will not be run.\n */\n t.prototype.cancel = function(t) {\n null !== this.fs && (this.clearTimeout(), this.ls.reject(new c(a.CANCELLED, \"Operation cancelled\" + (t ? \": \" + t : \"\"))));\n }, t.prototype.ds = function() {\n var t = this;\n this.cs.ws((function() {\n return null !== t.fs ? (t.clearTimeout(), t.op().then((function(e) {\n return t.ls.resolve(e);\n }))) : Promise.resolve();\n }));\n }, t.prototype.clearTimeout = function() {\n null !== this.fs && (this.hs(this), clearTimeout(this.fs), this.fs = null);\n }, t;\n}(), xr = /** @class */ function() {\n function e() {\n var t = this;\n // The last promise in the queue.\n this.Ts = Promise.resolve(), \n // A list of retryable operations. Retryable operations are run in order and\n // retried with backoff.\n this.Es = [], \n // Is this AsyncQueue being shut down? Once it is set to true, it will not\n // be changed again.\n this.Is = !1, \n // Operations scheduled to be queued in the future. Operations are\n // automatically removed after they are run or canceled.\n this.As = [], \n // visible for testing\n this.Rs = null, \n // Flag set while there's an outstanding AsyncQueue operation, used for\n // assertion sanity-checks.\n this.gs = !1, \n // List of TimerIds to fast-forward delays for.\n this.Ps = [], \n // Backoff timer used to schedule retries for retryable operations\n this.ys = new vr(this, \"async_queue_retry\" /* AsyncQueueRetry */), \n // Visibility handler that triggers an immediate retry of all retryable\n // operations. Meant to speed up recovery when we regain file system access\n // after page comes into foreground.\n this.Vs = function() {\n var e = Sr();\n e && l(\"AsyncQueue\", \"Visibility state changed to \", e.visibilityState), t.ys.Vn();\n };\n var e = Sr();\n e && \"function\" == typeof e.addEventListener && e.addEventListener(\"visibilitychange\", this.Vs);\n }\n return Object.defineProperty(e.prototype, \"ps\", {\n // Is this AsyncQueue being shut down? If true, this instance will not enqueue\n // any new operations, Promises from enqueue requests will not resolve.\n get: function() {\n return this.Is;\n },\n enumerable: !1,\n configurable: !0\n }), \n /**\n * Adds a new operation to the queue without waiting for it to complete (i.e.\n * we ignore the Promise result).\n */\n e.prototype.ws = function(t) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.enqueue(t);\n }, \n /**\n * Regardless if the queue has initialized shutdown, adds a new operation to the\n * queue without waiting for it to complete (i.e. we ignore the Promise result).\n */\n e.prototype.bs = function(t) {\n this.vs(), \n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.Ss(t);\n }, \n /**\n * Initialize the shutdown of this queue. Once this method is called, the\n * only possible way to request running an operation is through\n * `enqueueEvenWhileRestricted()`.\n */\n e.prototype.Ds = function() {\n if (!this.Is) {\n this.Is = !0;\n var t = Sr();\n t && \"function\" == typeof t.removeEventListener && t.removeEventListener(\"visibilitychange\", this.Vs);\n }\n }, \n /**\n * Adds a new operation to the queue. Returns a promise that will be resolved\n * when the promise returned by the new operation is (with its value).\n */\n e.prototype.enqueue = function(t) {\n return this.vs(), this.Is ? new Promise((function(t) {})) : this.Ss(t);\n }, \n /**\n * Enqueue a retryable operation.\n *\n * A retryable operation is rescheduled with backoff if it fails with a\n * IndexedDbTransactionError (the error type used by SimpleDb). All\n * retryable operations are executed in order and only run if all prior\n * operations were retried successfully.\n */\n e.prototype.Cs = function(t) {\n var e = this;\n this.ws((function() {\n return e.Es.push(t), e.Ns();\n }));\n }, \n /**\n * Runs the next operation from the retryable queue. If the operation fails,\n * reschedules with backoff.\n */\n e.prototype.Ns = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n var e, n = this;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n if (0 === this.Es.length) return [ 3 /*break*/ , 5 ];\n t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Es[0]() ];\n\n case 2:\n return t.sent(), this.Es.shift(), this.ys.reset(), [ 3 /*break*/ , 4 ];\n\n case 3:\n if (!_r(e = t.sent())) throw e;\n // Failure will be handled by AsyncQueue\n return l(\"AsyncQueue\", \"Operation failed with retryable error: \" + e), \n [ 3 /*break*/ , 4 ];\n\n case 4:\n this.Es.length > 0 && \n // If there are additional operations, we re-schedule `retryNextOp()`.\n // This is necessary to run retryable operations that failed during\n // their initial attempt since we don't know whether they are already\n // enqueued. If, for example, `op1`, `op2`, `op3` are enqueued and `op1`\n // needs to be re-run, we will run `op1`, `op1`, `op2` using the\n // already enqueued calls to `retryNextOp()`. `op3()` will then run in the\n // call scheduled here.\n // Since `backoffAndRun()` cancels an existing backoff and schedules a\n // new backoff on every call, there is only ever a single additional\n // operation in the queue.\n this.ys.gn((function() {\n return n.Ns();\n })), t.label = 5;\n\n case 5:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }, e.prototype.Ss = function(t) {\n var e = this, n = this.Ts.then((function() {\n return e.gs = !0, t().catch((function(t) {\n // Re-throw the error so that this.tail becomes a rejected Promise and\n // all further attempts to chain (via .then) will just short-circuit\n // and return the rejected Promise.\n throw e.Rs = t, e.gs = !1, p(\"INTERNAL UNHANDLED ERROR: \", \n /**\n * Chrome includes Error.message in Error.stack. Other browsers do not.\n * This returns expected output of message + stack when available.\n * @param error Error or FirestoreError\n */\n function(t) {\n var e = t.message || \"\";\n return t.stack && (e = t.stack.includes(t.message) ? t.stack : t.message + \"\\n\" + t.stack), \n e;\n }(t)), t;\n })).then((function(t) {\n return e.gs = !1, t;\n }));\n }));\n return this.Ts = n, n;\n }, \n /**\n * Schedules an operation to be queued on the AsyncQueue once the specified\n * `delayMs` has elapsed. The returned DelayedOperation can be used to cancel\n * or fast-forward the operation prior to its running.\n */\n e.prototype.yn = function(t, e, n) {\n var r = this;\n this.vs(), \n // Fast-forward delays for timerIds that have been overriden.\n this.Ps.indexOf(t) > -1 && (e = 0);\n var i = Dr._s(this, t, e, n, (function(t) {\n return r.Fs(t);\n }));\n return this.As.push(i), i;\n }, e.prototype.vs = function() {\n this.Rs && y();\n }, \n /**\n * Verifies there's an operation currently in-progress on the AsyncQueue.\n * Unfortunately we can't verify that the running code is in the promise chain\n * of that operation, so this isn't a foolproof check, but it should be enough\n * to catch some bugs.\n */\n e.prototype.xs = function() {}, \n /**\n * Waits until all currently queued tasks are finished executing. Delayed\n * operations are not run.\n */\n e.prototype.$s = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n var e;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return [ 4 /*yield*/ , e = this.Ts ];\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n if (e !== this.Ts) return [ 3 /*break*/ , 0 ];\n t.label = 3;\n\n case 3:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }, \n /**\n * For Tests: Determine if a delayed operation with a particular TimerId\n * exists.\n */\n e.prototype.ks = function(t) {\n for (var e = 0, n = this.As; e < n.length; e++) {\n if (n[e].dn === t) return !0;\n }\n return !1;\n }, \n /**\n * For Tests: Runs some or all delayed operations early.\n *\n * @param lastTimerId Delayed operations up to and including this TimerId will\n * be drained. Pass TimerId.All to run all delayed operations.\n * @returns a Promise that resolves once all operations have been run.\n */\n e.prototype.Ms = function(t) {\n var e = this;\n // Note that draining may generate more delayed ops, so we do that first.\n return this.$s().then((function() {\n // Run ops in the same order they'd run if they ran naturally.\n e.As.sort((function(t, e) {\n return t.us - e.us;\n }));\n for (var n = 0, r = e.As; n < r.length; n++) {\n var i = r[n];\n if (i.pn(), \"all\" /* All */ !== t && i.dn === t) break;\n }\n return e.$s();\n }));\n }, \n /**\n * For Tests: Skip all subsequent delays for a timer id.\n */\n e.prototype.Os = function(t) {\n this.Ps.push(t);\n }, \n /** Called once a DelayedOperation is run or canceled. */ e.prototype.Fs = function(t) {\n // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.\n var e = this.As.indexOf(t);\n this.As.splice(e, 1);\n }, e;\n}();\n\n/**\n * Returns a FirestoreError that can be surfaced to the user if the provided\n * error is an IndexedDbTransactionError. Re-throws the error otherwise.\n */\nfunction Lr(t, e) {\n if (p(\"AsyncQueue\", e + \": \" + t), _r(t)) return new c(a.UNAVAILABLE, e + \": \" + t);\n throw t;\n}\n\nvar kr = function() {\n this.Ls = void 0, this.listeners = [];\n}, Rr = function() {\n this.Bs = new it((function(t) {\n return Hn(t);\n }), Qn), this.onlineState = \"Unknown\" /* Unknown */ , this.qs = new Set;\n};\n\nfunction Or(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s, u, a, c;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n if (r = m(e), i = n.query, o = !1, (s = r.Bs.get(i)) || (o = !0, s = new kr), !o) return [ 3 /*break*/ , 4 ];\n t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 3, , 4 ]), u = s, [ 4 /*yield*/ , r.Us(i) ];\n\n case 2:\n return u.Ls = t.sent(), [ 3 /*break*/ , 4 ];\n\n case 3:\n return a = t.sent(), c = Lr(a, \"Initialization of query '\" + Yn(n.query) + \"' failed\"), \n [ 2 /*return*/ , void n.onError(c) ];\n\n case 4:\n return r.Bs.set(i, s), s.listeners.push(n), \n // Run global snapshot listeners if a consistent snapshot has been emitted.\n n.Qs(r.onlineState), s.Ls && n.Ws(s.Ls) && Cr(r), [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction Pr(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s, u;\n return t.__generator(this, (function(t) {\n return r = m(e), i = n.query, o = !1, (s = r.Bs.get(i)) && (u = s.listeners.indexOf(n)) >= 0 && (s.listeners.splice(u, 1), \n o = 0 === s.listeners.length), o ? [ 2 /*return*/ , (r.Bs.delete(i), r.js(i)) ] : [ 2 /*return*/ ];\n }));\n }));\n}\n\nfunction Vr(t, e) {\n for (var n = m(t), r = !1, i = 0, o = e; i < o.length; i++) {\n var s = o[i], u = s.query, a = n.Bs.get(u);\n if (a) {\n for (var c = 0, h = a.listeners; c < h.length; c++) {\n h[c].Ws(s) && (r = !0);\n }\n a.Ls = s;\n }\n }\n r && Cr(n);\n}\n\nfunction Ur(t, e, n) {\n var r = m(t), i = r.Bs.get(e);\n if (i) for (var o = 0, s = i.listeners; o < s.length; o++) {\n s[o].onError(n);\n }\n // Remove all listeners. NOTE: We don't need to call syncEngine.unlisten()\n // after an error.\n r.Bs.delete(e);\n}\n\n// Call all global snapshot listeners that have been set.\nfunction Cr(t) {\n t.qs.forEach((function(t) {\n t.next();\n }));\n}\n\n/**\n * QueryListener takes a series of internal view snapshots and determines\n * when to raise the event.\n *\n * It uses an Observer to dispatch events.\n */ var Fr = /** @class */ function() {\n function t(t, e, n) {\n this.query = t, this.Ks = e, \n /**\n * Initial snapshots (e.g. from cache) may not be propagated to the wrapped\n * observer. This flag is set to true once we've actually raised an event.\n */\n this.Gs = !1, this.zs = null, this.onlineState = \"Unknown\" /* Unknown */ , this.options = n || {}\n /**\n * Applies the new ViewSnapshot to this listener, raising a user-facing event\n * if applicable (depending on what changed, whether the user has opted into\n * metadata-only changes, etc.). Returns true if a user-facing event was\n * indeed raised.\n */;\n }\n return t.prototype.Ws = function(t) {\n if (!this.options.includeMetadataChanges) {\n for (\n // Remove the metadata only changes.\n var e = [], n = 0, r = t.docChanges; n < r.length; n++) {\n var i = r[n];\n 3 /* Metadata */ !== i.type && e.push(i);\n }\n t = new Ft(t.query, t.docs, t.Qt, e, t.Wt, t.fromCache, t.jt, \n /* excludesMetadataChanges= */ !0);\n }\n var o = !1;\n return this.Gs ? this.Hs(t) && (this.Ks.next(t), o = !0) : this.Ys(t, this.onlineState) && (this.Js(t), \n o = !0), this.zs = t, o;\n }, t.prototype.onError = function(t) {\n this.Ks.error(t);\n }, \n /** Returns whether a snapshot was raised. */ t.prototype.Qs = function(t) {\n this.onlineState = t;\n var e = !1;\n return this.zs && !this.Gs && this.Ys(this.zs, t) && (this.Js(this.zs), e = !0), \n e;\n }, t.prototype.Ys = function(t, e) {\n // Always raise the first event when we're synced\n if (!t.fromCache) return !0;\n // NOTE: We consider OnlineState.Unknown as online (it should become Offline\n // or Online if we wait long enough).\n var n = \"Offline\" /* Offline */ !== e;\n // Don't raise the event if we're online, aren't synced yet (checked\n // above) and are waiting for a sync.\n return !(this.options.Xs && n || t.docs.m() && \"Offline\" /* Offline */ !== e);\n // Raise data from cache if we have any documents or we are offline\n }, t.prototype.Hs = function(t) {\n // We don't need to handle includeDocumentMetadataChanges here because\n // the Metadata only changes have already been stripped out if needed.\n // At this point the only changes we will see are the ones we should\n // propagate.\n if (t.docChanges.length > 0) return !0;\n var e = this.zs && this.zs.hasPendingWrites !== t.hasPendingWrites;\n return !(!t.jt && !e) && !0 === this.options.includeMetadataChanges;\n // Generally we should have hit one of the cases above, but it's possible\n // to get here if there were only metadata docChanges and they got\n // stripped out.\n }, t.prototype.Js = function(t) {\n t = Ft.Gt(t.query, t.docs, t.Wt, t.fromCache), this.Gs = !0, this.Ks.next(t);\n }, t;\n}(), Mr = /** @class */ function() {\n function t(t) {\n this.uid = t;\n }\n return t.prototype.Zs = function() {\n return null != this.uid;\n }, \n /**\n * Returns a key representing this user, suitable for inclusion in a\n * dictionary.\n */\n t.prototype.ti = function() {\n return this.Zs() ? \"uid:\" + this.uid : \"anonymous-user\";\n }, t.prototype.isEqual = function(t) {\n return t.uid === this.uid;\n }, t;\n}();\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Simple wrapper around a nullable UID. Mostly exists to make code more\n * readable.\n */\n/** A user with a null UID. */ Mr.UNAUTHENTICATED = new Mr(null), \n// TODO(mikelehen): Look into getting a proper uid-equivalent for\n// non-FirebaseAuth providers.\nMr.ei = new Mr(\"google-credentials-uid\"), Mr.ni = new Mr(\"first-party-uid\");\n\n/**\n * @license\n * Copyright 2018 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * `ListenSequence` is a monotonic sequence. It is initialized with a minimum value to\n * exceed. All subsequent calls to next will return increasing values. If provided with a\n * `SequenceNumberSyncer`, it will additionally bump its next value when told of a new value, as\n * well as write out sequence numbers that it produces via `next()`.\n */\nvar qr = /** @class */ function() {\n function t(t, e) {\n var n = this;\n this.previousValue = t, e && (e.si = function(t) {\n return n.ii(t);\n }, this.ri = function(t) {\n return e.oi(t);\n });\n }\n return t.prototype.ii = function(t) {\n return this.previousValue = Math.max(t, this.previousValue), this.previousValue;\n }, t.prototype.next = function() {\n var t = ++this.previousValue;\n return this.ri && this.ri(t), t;\n }, t;\n}();\n\n/** Assembles the key for a client state in WebStorage */\nfunction jr(t, e) {\n return \"firestore_clients_\" + t + \"_\" + e;\n}\n\n// The format of the WebStorage key that stores the mutation state is:\n// firestore_mutations__\n// (for unauthenticated users)\n// or: firestore_mutations___\n// 'user_uid' is last to avoid needing to escape '_' characters that it might\n// contain.\n/** Assembles the key for a mutation batch in WebStorage */ function Gr(t, e, n) {\n var r = \"firestore_mutations_\" + t + \"_\" + n;\n return e.Zs() && (r += \"_\" + e.uid), r;\n}\n\n// The format of the WebStorage key that stores a query target's metadata is:\n// firestore_targets__\n/** Assembles the key for a query state in WebStorage */ function zr(t, e) {\n return \"firestore_targets_\" + t + \"_\" + e;\n}\n\n// The WebStorage prefix that stores the primary tab's online state. The\n// format of the key is:\n// firestore_online_state_\n/**\n * Holds the state of a mutation batch, including its user ID, batch ID and\n * whether the batch is 'pending', 'acknowledged' or 'rejected'.\n */\n// Visible for testing\nqr.ai = -1;\n\nvar Br = /** @class */ function() {\n function t(t, e, n, r) {\n this.user = t, this.batchId = e, this.state = n, this.error = r\n /**\n * Parses a MutationMetadata from its JSON representation in WebStorage.\n * Logs a warning and returns null if the format of the data is not valid.\n */;\n }\n return t.ci = function(e, n, r) {\n var i = JSON.parse(r), o = \"object\" == typeof i && -1 !== [ \"pending\", \"acknowledged\", \"rejected\" ].indexOf(i.state) && (void 0 === i.error || \"object\" == typeof i.error), s = void 0;\n return o && i.error && ((o = \"string\" == typeof i.error.message && \"string\" == typeof i.error.code) && (s = new c(i.error.code, i.error.message))), \n o ? new t(e, n, i.state, s) : (p(\"SharedClientState\", \"Failed to parse mutation state for ID '\" + n + \"': \" + r), \n null);\n }, t.prototype.ui = function() {\n var t = {\n state: this.state,\n updateTimeMs: Date.now()\n };\n return this.error && (t.error = {\n code: this.error.code,\n message: this.error.message\n }), JSON.stringify(t);\n }, t;\n}(), Wr = /** @class */ function() {\n function t(t, e, n) {\n this.targetId = t, this.state = e, this.error = n\n /**\n * Parses a QueryTargetMetadata from its JSON representation in WebStorage.\n * Logs a warning and returns null if the format of the data is not valid.\n */;\n }\n return t.ci = function(e, n) {\n var r = JSON.parse(n), i = \"object\" == typeof r && -1 !== [ \"not-current\", \"current\", \"rejected\" ].indexOf(r.state) && (void 0 === r.error || \"object\" == typeof r.error), o = void 0;\n return i && r.error && ((i = \"string\" == typeof r.error.message && \"string\" == typeof r.error.code) && (o = new c(r.error.code, r.error.message))), \n i ? new t(e, r.state, o) : (p(\"SharedClientState\", \"Failed to parse target state for ID '\" + e + \"': \" + n), \n null);\n }, t.prototype.ui = function() {\n var t = {\n state: this.state,\n updateTimeMs: Date.now()\n };\n return this.error && (t.error = {\n code: this.error.code,\n message: this.error.message\n }), JSON.stringify(t);\n }, t;\n}(), Kr = /** @class */ function() {\n function t(t, e) {\n this.clientId = t, this.activeTargetIds = e\n /**\n * Parses a RemoteClientState from the JSON representation in WebStorage.\n * Logs a warning and returns null if the format of the data is not valid.\n */;\n }\n return t.ci = function(e, n) {\n for (var r = JSON.parse(n), i = \"object\" == typeof r && r.activeTargetIds instanceof Array, o = Vt(), s = 0; i && s < r.activeTargetIds.length; ++s) i = ct(r.activeTargetIds[s]), \n o = o.add(r.activeTargetIds[s]);\n return i ? new t(e, o) : (p(\"SharedClientState\", \"Failed to parse client data for instance '\" + e + \"': \" + n), \n null);\n }, t;\n}(), Qr = /** @class */ function() {\n function t(t, e) {\n this.clientId = t, this.onlineState = e\n /**\n * Parses a SharedOnlineState from its JSON representation in WebStorage.\n * Logs a warning and returns null if the format of the data is not valid.\n */;\n }\n return t.ci = function(e) {\n var n = JSON.parse(e);\n return \"object\" == typeof n && -1 !== [ \"Unknown\", \"Online\", \"Offline\" ].indexOf(n.onlineState) && \"string\" == typeof n.clientId ? new t(n.clientId, n.onlineState) : (p(\"SharedClientState\", \"Failed to parse online state: \" + e), \n null);\n }, t;\n}(), Hr = /** @class */ function() {\n function t() {\n this.activeTargetIds = Vt();\n }\n return t.prototype.hi = function(t) {\n this.activeTargetIds = this.activeTargetIds.add(t);\n }, t.prototype.li = function(t) {\n this.activeTargetIds = this.activeTargetIds.delete(t);\n }, \n /**\n * Converts this entry into a JSON-encoded format we can use for WebStorage.\n * Does not encode `clientId` as it is part of the key in WebStorage.\n */\n t.prototype.ui = function() {\n var t = {\n activeTargetIds: this.activeTargetIds.A(),\n updateTimeMs: Date.now()\n };\n return JSON.stringify(t);\n }, t;\n}(), Yr = /** @class */ function() {\n function e(t, e, n, r, i) {\n this.window = t, this.fn = e, this.persistenceKey = n, this._i = r, this.fi = null, \n this.di = null, this.si = null, this.wi = this.mi.bind(this), this.Ti = new bt(H), \n this.Ei = !1, \n /**\n * Captures WebStorage events that occur before `start()` is called. These\n * events are replayed once `WebStorageSharedClientState` is started.\n */\n this.Ii = [];\n // Escape the special characters mentioned here:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\n var o = n.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n this.storage = this.window.localStorage, this.currentUser = i, this.Ai = jr(this.persistenceKey, this._i), \n this.Ri = \n /** Assembles the key for the current sequence number. */\n function(t) {\n return \"firestore_sequence_number_\" + t;\n }(this.persistenceKey), this.Ti = this.Ti.ot(this._i, new Hr), this.gi = new RegExp(\"^firestore_clients_\" + o + \"_([^_]*)$\"), \n this.Pi = new RegExp(\"^firestore_mutations_\" + o + \"_(\\\\d+)(?:_(.*))?$\"), this.yi = new RegExp(\"^firestore_targets_\" + o + \"_(\\\\d+)$\"), \n this.Vi = \n /** Assembles the key for the online state of the primary tab. */\n function(t) {\n return \"firestore_online_state_\" + t;\n }(this.persistenceKey), \n // Rather than adding the storage observer during start(), we add the\n // storage observer during initialization. This ensures that we collect\n // events before other components populate their initial state (during their\n // respective start() calls). Otherwise, we might for example miss a\n // mutation that is added after LocalStore's start() processed the existing\n // mutations but before we observe WebStorage events.\n this.window.addEventListener(\"storage\", this.wi);\n }\n /** Returns 'true' if WebStorage is available in the current environment. */ return e.Ln = function(t) {\n return !(!t || !t.localStorage);\n }, e.prototype.start = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n var e, n, r, i, o, s, u, a, c, h, f, l = this;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return [ 4 /*yield*/ , this.fi.pi() ];\n\n case 1:\n for (e = t.sent(), n = 0, r = e; n < r.length; n++) (i = r[n]) !== this._i && (o = this.getItem(jr(this.persistenceKey, i))) && (s = Kr.ci(i, o)) && (this.Ti = this.Ti.ot(s.clientId, s));\n for (this.bi(), (u = this.storage.getItem(this.Vi)) && (a = this.vi(u)) && this.Si(a), \n c = 0, h = this.Ii; c < h.length; c++) f = h[c], this.mi(f);\n return this.Ii = [], \n // Register a window unload hook to remove the client metadata entry from\n // WebStorage even if `shutdown()` was not called.\n this.window.addEventListener(\"unload\", (function() {\n return l.Di();\n })), this.Ei = !0, [ 2 /*return*/ ];\n }\n }));\n }));\n }, e.prototype.oi = function(t) {\n this.setItem(this.Ri, JSON.stringify(t));\n }, e.prototype.Ci = function() {\n return this.Ni(this.Ti);\n }, e.prototype.Fi = function(t) {\n var e = !1;\n return this.Ti.forEach((function(n, r) {\n r.activeTargetIds.has(t) && (e = !0);\n })), e;\n }, e.prototype.xi = function(t) {\n this.$i(t, \"pending\");\n }, e.prototype.ki = function(t, e, n) {\n this.$i(t, e, n), \n // Once a final mutation result is observed by other clients, they no longer\n // access the mutation's metadata entry. Since WebStorage replays events\n // in order, it is safe to delete the entry right after updating it.\n this.Mi(t);\n }, e.prototype.Oi = function(t) {\n var e = \"not-current\";\n // Lookup an existing query state if the target ID was already registered\n // by another tab\n if (this.Fi(t)) {\n var n = this.storage.getItem(zr(this.persistenceKey, t));\n if (n) {\n var r = Wr.ci(t, n);\n r && (e = r.state);\n }\n }\n return this.Li.hi(t), this.bi(), e;\n }, e.prototype.Bi = function(t) {\n this.Li.li(t), this.bi();\n }, e.prototype.qi = function(t) {\n return this.Li.activeTargetIds.has(t);\n }, e.prototype.Ui = function(t) {\n this.removeItem(zr(this.persistenceKey, t));\n }, e.prototype.Qi = function(t, e, n) {\n this.Wi(t, e, n);\n }, e.prototype.ji = function(t, e, n) {\n var r = this;\n e.forEach((function(t) {\n r.Mi(t);\n })), this.currentUser = t, n.forEach((function(t) {\n r.xi(t);\n }));\n }, e.prototype.Ki = function(t) {\n this.Gi(t);\n }, e.prototype.Di = function() {\n this.Ei && (this.window.removeEventListener(\"storage\", this.wi), this.removeItem(this.Ai), \n this.Ei = !1);\n }, e.prototype.getItem = function(t) {\n var e = this.storage.getItem(t);\n return l(\"SharedClientState\", \"READ\", t, e), e;\n }, e.prototype.setItem = function(t, e) {\n l(\"SharedClientState\", \"SET\", t, e), this.storage.setItem(t, e);\n }, e.prototype.removeItem = function(t) {\n l(\"SharedClientState\", \"REMOVE\", t), this.storage.removeItem(t);\n }, e.prototype.mi = function(e) {\n var n = this, r = e;\n // Note: The function is typed to take Event to be interface-compatible with\n // `Window.addEventListener`.\n if (r.storageArea === this.storage) {\n if (l(\"SharedClientState\", \"EVENT\", r.key, r.newValue), r.key === this.Ai) return void p(\"Received WebStorage notification for local change. Another client might have garbage-collected our state\");\n this.fn.Cs((function() {\n return t.__awaiter(n, void 0, void 0, (function() {\n var e, n, i, o, s, u;\n return t.__generator(this, (function(t) {\n if (this.Ei) {\n if (null !== r.key) if (this.gi.test(r.key)) {\n if (null == r.newValue) return e = this.zi(r.key), [ 2 /*return*/ , this.Hi(e, null) ];\n if (n = this.Yi(r.key, r.newValue)) return [ 2 /*return*/ , this.Hi(n.clientId, n) ];\n } else if (this.Pi.test(r.key)) {\n if (null !== r.newValue && (i = this.Ji(r.key, r.newValue))) return [ 2 /*return*/ , this.Xi(i) ];\n } else if (this.yi.test(r.key)) {\n if (null !== r.newValue && (o = this.Zi(r.key, r.newValue))) return [ 2 /*return*/ , this.tr(o) ];\n } else if (r.key === this.Vi) {\n if (null !== r.newValue && (s = this.vi(r.newValue))) return [ 2 /*return*/ , this.Si(s) ];\n } else r.key === this.Ri && (u = function(t) {\n var e = qr.ai;\n if (null != t) try {\n var n = JSON.parse(t);\n g(\"number\" == typeof n), e = n;\n } catch (t) {\n p(\"SharedClientState\", \"Failed to read sequence number from WebStorage\", t);\n }\n return e;\n }(r.newValue)) !== qr.ai && this.si(u);\n } else this.Ii.push(r);\n return [ 2 /*return*/ ];\n }));\n }));\n }));\n }\n }, Object.defineProperty(e.prototype, \"Li\", {\n get: function() {\n return this.Ti.get(this._i);\n },\n enumerable: !1,\n configurable: !0\n }), e.prototype.bi = function() {\n this.setItem(this.Ai, this.Li.ui());\n }, e.prototype.$i = function(t, e, n) {\n var r = new Br(this.currentUser, t, e, n), i = Gr(this.persistenceKey, this.currentUser, t);\n this.setItem(i, r.ui());\n }, e.prototype.Mi = function(t) {\n var e = Gr(this.persistenceKey, this.currentUser, t);\n this.removeItem(e);\n }, e.prototype.Gi = function(t) {\n var e = {\n clientId: this._i,\n onlineState: t\n };\n this.storage.setItem(this.Vi, JSON.stringify(e));\n }, e.prototype.Wi = function(t, e, n) {\n var r = zr(this.persistenceKey, t), i = new Wr(t, e, n);\n this.setItem(r, i.ui());\n }, \n /**\n * Parses a client state key in WebStorage. Returns null if the key does not\n * match the expected key format.\n */\n e.prototype.zi = function(t) {\n var e = this.gi.exec(t);\n return e ? e[1] : null;\n }, \n /**\n * Parses a client state in WebStorage. Returns 'null' if the value could not\n * be parsed.\n */\n e.prototype.Yi = function(t, e) {\n var n = this.zi(t);\n return Kr.ci(n, e);\n }, \n /**\n * Parses a mutation batch state in WebStorage. Returns 'null' if the value\n * could not be parsed.\n */\n e.prototype.Ji = function(t, e) {\n var n = this.Pi.exec(t), r = Number(n[1]), i = void 0 !== n[2] ? n[2] : null;\n return Br.ci(new Mr(i), r, e);\n }, \n /**\n * Parses a query target state from WebStorage. Returns 'null' if the value\n * could not be parsed.\n */\n e.prototype.Zi = function(t, e) {\n var n = this.yi.exec(t), r = Number(n[1]);\n return Wr.ci(r, e);\n }, \n /**\n * Parses an online state from WebStorage. Returns 'null' if the value\n * could not be parsed.\n */\n e.prototype.vi = function(t) {\n return Qr.ci(t);\n }, e.prototype.Xi = function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return e.user.uid === this.currentUser.uid ? [ 2 /*return*/ , this.fi.er(e.batchId, e.state, e.error) ] : (l(\"SharedClientState\", \"Ignoring mutation for non-active user \" + e.user.uid), \n [ 2 /*return*/ ]);\n }));\n }));\n }, e.prototype.tr = function(t) {\n return this.fi.nr(t.targetId, t.state, t.error);\n }, e.prototype.Hi = function(t, e) {\n var n = this, r = e ? this.Ti.ot(t, e) : this.Ti.remove(t), i = this.Ni(this.Ti), o = this.Ni(r), s = [], u = [];\n return o.forEach((function(t) {\n i.has(t) || s.push(t);\n })), i.forEach((function(t) {\n o.has(t) || u.push(t);\n })), this.fi.sr(s, u).then((function() {\n n.Ti = r;\n }));\n }, e.prototype.Si = function(t) {\n // We check whether the client that wrote this online state is still active\n // by comparing its client ID to the list of clients kept active in\n // IndexedDb. If a client does not update their IndexedDb client state\n // within 5 seconds, it is considered inactive and we don't emit an online\n // state event.\n this.Ti.get(t.clientId) && this.di(t.onlineState);\n }, e.prototype.Ni = function(t) {\n var e = Vt();\n return t.forEach((function(t, n) {\n e = e.kt(n.activeTargetIds);\n })), e;\n }, e;\n}(), $r = /** @class */ function() {\n function t() {\n this.ir = new Hr, this.rr = {}, this.di = null, this.si = null;\n }\n return t.prototype.xi = function(t) {\n // No op.\n }, t.prototype.ki = function(t, e, n) {\n // No op.\n }, t.prototype.Oi = function(t) {\n return this.ir.hi(t), this.rr[t] || \"not-current\";\n }, t.prototype.Qi = function(t, e, n) {\n this.rr[t] = e;\n }, t.prototype.Bi = function(t) {\n this.ir.li(t);\n }, t.prototype.qi = function(t) {\n return this.ir.activeTargetIds.has(t);\n }, t.prototype.Ui = function(t) {\n delete this.rr[t];\n }, t.prototype.Ci = function() {\n return this.ir.activeTargetIds;\n }, t.prototype.Fi = function(t) {\n return this.ir.activeTargetIds.has(t);\n }, t.prototype.start = function() {\n return this.ir = new Hr, Promise.resolve();\n }, t.prototype.ji = function(t, e, n) {\n // No op.\n }, t.prototype.Ki = function(t) {\n // No op.\n }, t.prototype.Di = function() {}, t.prototype.oi = function(t) {}, t;\n}(), Xr = /** @class */ function() {\n /**\n * @param batchId The unique ID of this mutation batch.\n * @param localWriteTime The original write time of this mutation.\n * @param baseMutations Mutations that are used to populate the base\n * values when this mutation is applied locally. This can be used to locally\n * overwrite values that are persisted in the remote document cache. Base\n * mutations are never sent to the backend.\n * @param mutations The user-provided mutations in this mutation batch.\n * User-provided mutations are applied both locally and remotely on the\n * backend.\n */\n function t(t, e, n, r) {\n this.batchId = t, this.ar = e, this.baseMutations = n, this.mutations = r\n /**\n * Applies all the mutations in this MutationBatch to the specified document\n * to create a new remote document\n *\n * @param docKey The key of the document to apply mutations to.\n * @param maybeDoc The document to apply mutations to.\n * @param batchResult The result of applying the MutationBatch to the\n * backend.\n */;\n }\n return t.prototype.cr = function(t, e, n) {\n for (var r = n.ur, i = 0; i < this.mutations.length; i++) {\n var o = this.mutations[i];\n o.key.isEqual(t) && (e = dn(o, e, r[i]));\n }\n return e;\n }, \n /**\n * Computes the local view of a document given all the mutations in this\n * batch.\n *\n * @param docKey The key of the document to apply mutations to.\n * @param maybeDoc The document to apply mutations to.\n */\n t.prototype.hr = function(t, e) {\n // First, apply the base state. This allows us to apply non-idempotent\n // transform against a consistent set of values.\n for (var n = 0, r = this.baseMutations; n < r.length; n++) {\n var i = r[n];\n i.key.isEqual(t) && (e = vn(i, e, e, this.ar));\n }\n // Second, apply all user-provided mutations.\n for (var o = e, s = 0, u = this.mutations; s < u.length; s++) {\n var a = u[s];\n a.key.isEqual(t) && (e = vn(a, e, o, this.ar));\n }\n return e;\n }, \n /**\n * Computes the local view for all provided documents given the mutations in\n * this batch.\n */\n t.prototype.lr = function(t) {\n var e = this, n = t;\n // TODO(mrschmidt): This implementation is O(n^2). If we apply the mutations\n // directly (as done in `applyToLocalView()`), we can reduce the complexity\n // to O(n).\n return this.mutations.forEach((function(r) {\n var i = e.hr(r.key, t.get(r.key));\n i && (n = n.ot(r.key, i));\n })), n;\n }, t.prototype.keys = function() {\n return this.mutations.reduce((function(t, e) {\n return t.add(e.key);\n }), Ot());\n }, t.prototype.isEqual = function(t) {\n return this.batchId === t.batchId && Y(this.mutations, t.mutations, (function(t, e) {\n return gn(t, e);\n })) && Y(this.baseMutations, t.baseMutations, (function(t, e) {\n return gn(t, e);\n }));\n }, t;\n}(), Jr = /** @class */ function() {\n function t(t, e, n, \n /**\n * A pre-computed mapping from each mutated document to the resulting\n * version.\n */\n r) {\n this.batch = t, this._r = e, this.ur = n, this.dr = r\n /**\n * Creates a new MutationBatchResult for the given batch and results. There\n * must be one result for each mutation in the batch. This static factory\n * caches a document=>version mapping (docVersions).\n */;\n }\n return t.from = function(e, n, r) {\n g(e.mutations.length === r.length);\n for (var i = kt, o = e.mutations, s = 0; s < o.length; s++) i = i.ot(o[s].key, r[s].version);\n return new t(e, n, r, i);\n }, t;\n}(), Zr = /** @class */ function() {\n function t() {\n // A mapping of document key to the new cache entry that should be written (or null if any\n // existing cache entry should be removed).\n this.wr = new it((function(t) {\n return t.toString();\n }), (function(t, e) {\n return t.isEqual(e);\n })), this.mr = !1;\n }\n return Object.defineProperty(t.prototype, \"readTime\", {\n get: function() {\n return this.Tr;\n },\n set: function(t) {\n this.Tr = t;\n },\n enumerable: !1,\n configurable: !0\n }), \n /**\n * Buffers a `RemoteDocumentCache.addEntry()` call.\n *\n * You can only modify documents that have already been retrieved via\n * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).\n */\n t.prototype.Er = function(t, e) {\n this.Ir(), this.readTime = e, this.wr.set(t.key, t);\n }, \n /**\n * Buffers a `RemoteDocumentCache.removeEntry()` call.\n *\n * You can only remove documents that have already been retrieved via\n * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).\n */\n t.prototype.Ar = function(t, e) {\n this.Ir(), e && (this.readTime = e), this.wr.set(t, null);\n }, \n /**\n * Looks up an entry in the cache. The buffered changes will first be checked,\n * and if no buffered change applies, this will forward to\n * `RemoteDocumentCache.getEntry()`.\n *\n * @param transaction The transaction in which to perform any persistence\n * operations.\n * @param documentKey The key of the entry to look up.\n * @return The cached Document or NoDocument entry, or null if we have nothing\n * cached.\n */\n t.prototype.Rr = function(t, e) {\n this.Ir();\n var n = this.wr.get(e);\n return void 0 !== n ? yr.resolve(n) : this.gr(t, e);\n }, \n /**\n * Looks up several entries in the cache, forwarding to\n * `RemoteDocumentCache.getEntry()`.\n *\n * @param transaction The transaction in which to perform any persistence\n * operations.\n * @param documentKeys The keys of the entries to look up.\n * @return A map of cached `Document`s or `NoDocument`s, indexed by key. If an\n * entry cannot be found, the corresponding key will be mapped to a null\n * value.\n */\n t.prototype.getEntries = function(t, e) {\n return this.Pr(t, e);\n }, \n /**\n * Applies buffered changes to the underlying RemoteDocumentCache, using\n * the provided transaction.\n */\n t.prototype.apply = function(t) {\n return this.Ir(), this.mr = !0, this.yr(t);\n }, \n /** Helper to assert this.changes is not null */ t.prototype.Ir = function() {}, \n t;\n}(), ti = \"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.\", ei = /** @class */ function() {\n function t() {\n this.Vr = [];\n }\n return t.prototype.pr = function(t) {\n this.Vr.push(t);\n }, t.prototype.br = function() {\n this.Vr.forEach((function(t) {\n return t();\n }));\n }, t;\n}(), ni = /** @class */ function() {\n function t(t, e, n) {\n this.vr = t, this.Sr = e, this.Dr = n\n /**\n * Get the local view of the document identified by `key`.\n *\n * @return Local view of the document or null if we don't have any cached\n * state for it.\n */;\n }\n return t.prototype.Cr = function(t, e) {\n var n = this;\n return this.Sr.Nr(t, e).next((function(r) {\n return n.Fr(t, e, r);\n }));\n }, \n /** Internal version of `getDocument` that allows reusing batches. */ t.prototype.Fr = function(t, e, n) {\n return this.vr.Rr(t, e).next((function(t) {\n for (var r = 0, i = n; r < i.length; r++) {\n t = i[r].hr(e, t);\n }\n return t;\n }));\n }, \n // Returns the view of the given `docs` as they would appear after applying\n // all mutations in the given `batches`.\n t.prototype.$r = function(t, e, n) {\n var r = Dt();\n return e.forEach((function(t, e) {\n for (var i = 0, o = n; i < o.length; i++) {\n e = o[i].hr(t, e);\n }\n r = r.ot(t, e);\n })), r;\n }, \n /**\n * Gets the local view of the documents identified by `keys`.\n *\n * If we don't have cached state for a document in `keys`, a NoDocument will\n * be stored for that key in the resulting set.\n */\n t.prototype.kr = function(t, e) {\n var n = this;\n return this.vr.getEntries(t, e).next((function(e) {\n return n.Mr(t, e);\n }));\n }, \n /**\n * Similar to `getDocuments`, but creates the local view from the given\n * `baseDocs` without retrieving documents from the local store.\n */\n t.prototype.Mr = function(t, e) {\n var n = this;\n return this.Sr.Or(t, e).next((function(r) {\n var i = n.$r(t, e, r), o = St();\n return i.forEach((function(t, e) {\n // TODO(http://b/32275378): Don't conflate missing / deleted.\n e || (e = new Rn(t, st.min())), o = o.ot(t, e);\n })), o;\n }));\n }, \n /**\n * Performs a query against the local view of all documents.\n *\n * @param transaction The persistence transaction.\n * @param query The query to match documents against.\n * @param sinceReadTime If not set to SnapshotVersion.min(), return only\n * documents that have been read since this snapshot version (exclusive).\n */\n t.prototype.Lr = function(t, e, n) {\n /**\n * Returns whether the query matches a single document by path (rather than a\n * collection).\n */\n return function(t) {\n return A.F(t.path) && null === t.collectionGroup && 0 === t.filters.length;\n }(e) ? this.Br(t, e.path) : jn(e) ? this.qr(t, e, n) : this.Ur(t, e, n);\n }, t.prototype.Br = function(t, e) {\n // Just do a simple document lookup.\n return this.Cr(t, new A(e)).next((function(t) {\n var e = Lt();\n return t instanceof kn && (e = e.ot(t.key, t)), e;\n }));\n }, t.prototype.qr = function(t, e, n) {\n var r = this, i = e.collectionGroup, o = Lt();\n return this.Dr.Qr(t, i).next((function(s) {\n return yr.forEach(s, (function(s) {\n var u = function(t, e) {\n return new Pn(e, \n /*collectionGroup=*/ null, t.on.slice(), t.filters.slice(), t.limit, t.an, t.startAt, t.endAt);\n }(e, s.child(i));\n return r.Ur(t, u, n).next((function(t) {\n t.forEach((function(t, e) {\n o = o.ot(t, e);\n }));\n }));\n })).next((function() {\n return o;\n }));\n }));\n }, t.prototype.Ur = function(t, e, n) {\n var r, i, o = this;\n // Query the remote documents and overlay mutations.\n return this.vr.Lr(t, e, n).next((function(n) {\n return r = n, o.Sr.Wr(t, e);\n })).next((function(e) {\n return i = e, o.jr(t, i, r).next((function(t) {\n r = t;\n for (var e = 0, n = i; e < n.length; e++) for (var o = n[e], s = 0, u = o.mutations; s < u.length; s++) {\n var a = u[s], c = a.key, h = r.get(c), f = vn(a, h, h, o.ar);\n r = f instanceof kn ? r.ot(c, f) : r.remove(c);\n }\n }));\n })).next((function() {\n // Finally, filter out any documents that don't actually match\n // the query.\n return r.forEach((function(t, n) {\n $n(e, n) || (r = r.remove(t));\n })), r;\n }));\n }, t.prototype.jr = function(t, e, n) {\n for (var r = Ot(), i = 0, o = e; i < o.length; i++) for (var s = 0, u = o[i].mutations; s < u.length; s++) {\n var a = u[s];\n a instanceof _n && null === n.get(a.key) && (r = r.add(a.key));\n }\n var c = n;\n return this.vr.getEntries(t, r).next((function(t) {\n return t.forEach((function(t, e) {\n null !== e && e instanceof kn && (c = c.ot(t, e));\n })), c;\n }));\n }, t;\n}(), ri = /** @class */ function() {\n function t(t, e, n, r) {\n this.targetId = t, this.fromCache = e, this.Kr = n, this.Gr = r;\n }\n return t.zr = function(e, n) {\n for (var r = Ot(), i = Ot(), o = 0, s = n.docChanges; o < s.length; o++) {\n var u = s[o];\n switch (u.type) {\n case 0 /* Added */ :\n r = r.add(u.doc.key);\n break;\n\n case 1 /* Removed */ :\n i = i.add(u.doc.key);\n // do nothing\n }\n }\n return new t(e, n.fromCache, r, i);\n }, t;\n}();\n\n/**\n * Holds the state of a query target, including its target ID and whether the\n * target is 'not-current', 'current' or 'rejected'.\n */\n// Visible for testing\n/**\n * @license\n * Copyright 2018 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction ii(t, e) {\n var n = t[0], r = t[1], i = e[0], o = e[1], s = H(n, i);\n return 0 === s ? H(r, o) : s;\n}\n\n/**\n * Used to calculate the nth sequence number. Keeps a rolling buffer of the\n * lowest n values passed to `addElement`, and finally reports the largest of\n * them in `maxValue`.\n */ var oi = /** @class */ function() {\n function t(t) {\n this.Hr = t, this.buffer = new Tt(ii), this.Yr = 0;\n }\n return t.prototype.Jr = function() {\n return ++this.Yr;\n }, t.prototype.Xr = function(t) {\n var e = [ t, this.Jr() ];\n if (this.buffer.size < this.Hr) this.buffer = this.buffer.add(e); else {\n var n = this.buffer.last();\n ii(e, n) < 0 && (this.buffer = this.buffer.delete(n).add(e));\n }\n }, Object.defineProperty(t.prototype, \"maxValue\", {\n get: function() {\n // Guaranteed to be non-empty. If we decide we are not collecting any\n // sequence numbers, nthSequenceNumber below short-circuits. If we have\n // decided that we are collecting n sequence numbers, it's because n is some\n // percentage of the existing sequence numbers. That means we should never\n // be in a situation where we are collecting sequence numbers but don't\n // actually have any.\n return this.buffer.last()[0];\n },\n enumerable: !1,\n configurable: !0\n }), t;\n}(), si = {\n Zr: !1,\n eo: 0,\n no: 0,\n so: 0\n}, ui = /** @class */ function() {\n function t(\n // When we attempt to collect, we will only do so if the cache size is greater than this\n // threshold. Passing `COLLECTION_DISABLED` here will cause collection to always be skipped.\n t, \n // The percentage of sequence numbers that we will attempt to collect\n e, \n // A cap on the total number of sequence numbers that will be collected. This prevents\n // us from collecting a huge number of sequence numbers if the cache has grown very large.\n n) {\n this.io = t, this.ro = e, this.oo = n;\n }\n return t.ao = function(e) {\n return new t(e, t.co, t.uo);\n }, t;\n}();\n\nui.ho = -1, ui.lo = 1048576, ui._o = 41943040, ui.co = 10, ui.uo = 1e3, ui.fo = new ui(ui._o, ui.co, ui.uo), \nui.do = new ui(ui.ho, 0, 0);\n\n/**\n * This class is responsible for the scheduling of LRU garbage collection. It handles checking\n * whether or not GC is enabled, as well as which delay to use before the next run.\n */\nvar ai = /** @class */ function() {\n function e(t, e) {\n this.wo = t, this.cs = e, this.mo = !1, this.To = null;\n }\n return e.prototype.start = function(t) {\n this.wo.params.io !== ui.ho && this.Eo(t);\n }, e.prototype.stop = function() {\n this.To && (this.To.cancel(), this.To = null);\n }, Object.defineProperty(e.prototype, \"Ei\", {\n get: function() {\n return null !== this.To;\n },\n enumerable: !1,\n configurable: !0\n }), e.prototype.Eo = function(e) {\n var n = this, r = this.mo ? 3e5 : 6e4;\n l(\"LruGarbageCollector\", \"Garbage collection scheduled in \" + r + \"ms\"), this.To = this.cs.yn(\"lru_garbage_collection\" /* LruGarbageCollection */ , r, (function() {\n return t.__awaiter(n, void 0, void 0, (function() {\n var n;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n this.To = null, this.mo = !0, t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 3, , 7 ]), [ 4 /*yield*/ , e.Io(this.wo) ];\n\n case 2:\n return t.sent(), [ 3 /*break*/ , 7 ];\n\n case 3:\n return _r(n = t.sent()) ? (l(\"LruGarbageCollector\", \"Ignoring IndexedDB error during garbage collection: \", n), \n [ 3 /*break*/ , 6 ]) : [ 3 /*break*/ , 4 ];\n\n case 4:\n return [ 4 /*yield*/ , Do(n) ];\n\n case 5:\n t.sent(), t.label = 6;\n\n case 6:\n return [ 3 /*break*/ , 7 ];\n\n case 7:\n return [ 4 /*yield*/ , this.Eo(e) ];\n\n case 8:\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }));\n }, e;\n}(), ci = /** @class */ function() {\n function t(t, e) {\n this.Ao = t, this.params = e\n /** Given a percentile of target to collect, returns the number of targets to collect. */;\n }\n return t.prototype.Ro = function(t, e) {\n return this.Ao.Po(t).next((function(t) {\n return Math.floor(e / 100 * t);\n }));\n }, \n /** Returns the nth sequence number, counting in order from the smallest. */ t.prototype.yo = function(t, e) {\n var n = this;\n if (0 === e) return yr.resolve(qr.ai);\n var r = new oi(e);\n return this.Ao.Ce(t, (function(t) {\n return r.Xr(t.sequenceNumber);\n })).next((function() {\n return n.Ao.Vo(t, (function(t) {\n return r.Xr(t);\n }));\n })).next((function() {\n return r.maxValue;\n }));\n }, \n /**\n * Removes targets with a sequence number equal to or less than the given upper bound, and removes\n * document associations with those targets.\n */\n t.prototype.po = function(t, e, n) {\n return this.Ao.po(t, e, n);\n }, \n /**\n * Removes documents that have a sequence number equal to or less than the upper bound and are not\n * otherwise pinned.\n */\n t.prototype.bo = function(t, e) {\n return this.Ao.bo(t, e);\n }, t.prototype.vo = function(t, e) {\n var n = this;\n return this.params.io === ui.ho ? (l(\"LruGarbageCollector\", \"Garbage collection skipped; disabled\"), \n yr.resolve(si)) : this.So(t).next((function(r) {\n return r < n.params.io ? (l(\"LruGarbageCollector\", \"Garbage collection skipped; Cache size \" + r + \" is lower than threshold \" + n.params.io), \n si) : n.Do(t, e);\n }));\n }, t.prototype.So = function(t) {\n return this.Ao.So(t);\n }, t.prototype.Do = function(t, e) {\n var r, i, o, s, u, a, c, h = this, p = Date.now();\n return this.Ro(t, this.params.ro).next((function(e) {\n // Cap at the configured max\n return e > h.params.oo ? (l(\"LruGarbageCollector\", \"Capping sequence numbers to collect down to the maximum of \" + h.params.oo + \" from \" + e), \n i = h.params.oo) : i = e, s = Date.now(), h.yo(t, i);\n })).next((function(n) {\n return r = n, u = Date.now(), h.po(t, r, e);\n })).next((function(e) {\n return o = e, a = Date.now(), h.bo(t, r);\n })).next((function(t) {\n return c = Date.now(), f() <= n.LogLevel.DEBUG && l(\"LruGarbageCollector\", \"LRU Garbage Collection\\n\\tCounted targets in \" + (s - p) + \"ms\\n\\tDetermined least recently used \" + i + \" in \" + (u - s) + \"ms\\n\\tRemoved \" + o + \" targets in \" + (a - u) + \"ms\\n\\tRemoved \" + t + \" documents in \" + (c - a) + \"ms\\nTotal Duration: \" + (c - p) + \"ms\"), \n yr.resolve({\n Zr: !0,\n eo: i,\n no: o,\n so: t\n });\n }));\n }, t;\n}();\n\n/** Implements the steps for LRU garbage collection. */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Encodes a resource path into a IndexedDb-compatible string form.\n */\nfunction hi(t) {\n for (var e = \"\", n = 0; n < t.length; n++) e.length > 0 && (e = li(e)), e = fi(t.get(n), e);\n return li(e);\n}\n\n/** Encodes a single segment of a resource path into the given result */ function fi(t, e) {\n for (var n = e, r = t.length, i = 0; i < r; i++) {\n var o = t.charAt(i);\n switch (o) {\n case \"\\0\":\n n += \"\u0001\u0010\";\n break;\n\n case \"\u0001\":\n n += \"\u0001\u0011\";\n break;\n\n default:\n n += o;\n }\n }\n return n;\n}\n\n/** Encodes a path separator into the given result */ function li(t) {\n return t + \"\u0001\u0001\";\n}\n\n/**\n * Decodes the given IndexedDb-compatible string form of a resource path into\n * a ResourcePath instance. Note that this method is not suitable for use with\n * decoding resource names from the server; those are One Platform format\n * strings.\n */ function pi(t) {\n // Event the empty path must encode as a path of at least length 2. A path\n // with exactly 2 must be the empty path.\n var e = t.length;\n if (g(e >= 2), 2 === e) return g(\"\u0001\" === t.charAt(0) && \"\u0001\" === t.charAt(1)), E.P();\n // Escape characters cannot exist past the second-to-last position in the\n // source value.\n for (var n = e - 2, r = [], i = \"\", o = 0; o < e; ) {\n // The last two characters of a valid encoded path must be a separator, so\n // there must be an end to this segment.\n var s = t.indexOf(\"\u0001\", o);\n switch ((s < 0 || s > n) && y(), t.charAt(s + 1)) {\n case \"\u0001\":\n var u = t.substring(o, s), a = void 0;\n 0 === i.length ? \n // Avoid copying for the common case of a segment that excludes \\0\n // and \\001\n a = u : (a = i += u, i = \"\"), r.push(a);\n break;\n\n case \"\u0010\":\n i += t.substring(o, s), i += \"\\0\";\n break;\n\n case \"\u0011\":\n // The escape character can be used in the output to encode itself.\n i += t.substring(o, s + 1);\n break;\n\n default:\n y();\n }\n o = s + 2;\n }\n return new E(r);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Serializer for values stored in the LocalStore. */ var di = function(t) {\n this.Co = t;\n};\n\n/** Decodes a remote document from storage locally to a Document. */ function vi(t, e) {\n if (e.document) return function(t, e, n) {\n var r = Se(t, e.name), i = Ee(e.updateTime), o = new Sn({\n mapValue: {\n fields: e.fields\n }\n });\n return new kn(r, i, o, {\n hasCommittedMutations: !!n\n });\n }(t.Co, e.document, !!e.hasCommittedMutations);\n if (e.noDocument) {\n var n = A.$(e.noDocument.path), r = _i(e.noDocument.readTime);\n return new Rn(n, r, {\n hasCommittedMutations: !!e.hasCommittedMutations\n });\n }\n if (e.unknownDocument) {\n var i = A.$(e.unknownDocument.path), o = _i(e.unknownDocument.version);\n return new On(i, o);\n }\n return y();\n}\n\n/** Encodes a document for storage locally. */ function yi(t, e, n) {\n var r = gi(n), i = e.key.path.h().A();\n if (e instanceof kn) {\n var o = function(t, e) {\n return {\n name: Ae(t, e.key),\n fields: e.rn().mapValue.fields,\n updateTime: _e(t, e.version.Z())\n };\n }(t.Co, e), s = e.hasCommittedMutations;\n return new Ki(\n /* unknownDocument= */ null, \n /* noDocument= */ null, o, s, r, i);\n }\n if (e instanceof Rn) {\n var u = e.key.path.A(), a = wi(e.version), c = e.hasCommittedMutations;\n return new Ki(\n /* unknownDocument= */ null, new Bi(u, a), \n /* document= */ null, c, r, i);\n }\n if (e instanceof On) {\n var h = e.key.path.A(), f = wi(e.version);\n return new Ki(new Wi(h, f), \n /* noDocument= */ null, \n /* document= */ null, \n /* hasCommittedMutations= */ !0, r, i);\n }\n return y();\n}\n\nfunction gi(t) {\n var e = t.Z();\n return [ e.seconds, e.nanoseconds ];\n}\n\nfunction mi(t) {\n var e = new ot(t[0], t[1]);\n return st.J(e);\n}\n\nfunction wi(t) {\n var e = t.Z();\n return new Mi(e.seconds, e.nanoseconds);\n}\n\nfunction _i(t) {\n var e = new ot(t.seconds, t.nanoseconds);\n return st.J(e);\n}\n\n/** Encodes a batch of mutations into a DbMutationBatch for local storage. */\n/** Decodes a DbMutationBatch into a MutationBatch */ function bi(t, e) {\n var n = (e.baseMutations || []).map((function(e) {\n return Pe(t.Co, e);\n })), r = e.mutations.map((function(e) {\n return Pe(t.Co, e);\n })), i = ot.fromMillis(e.localWriteTimeMs);\n return new Xr(e.batchId, i, n, r);\n}\n\n/** Decodes a DbTarget into TargetData */ function Ii(t) {\n var e, n, r = _i(t.readTime), i = void 0 !== t.lastLimboFreeSnapshotVersion ? _i(t.lastLimboFreeSnapshotVersion) : st.min();\n return void 0 !== t.query.documents ? (g(1 === (n = t.query).documents.length), \n e = zn(Un(xe(n.documents[0])))) : e = Ce(t.query), new gt(e, t.targetId, 0 /* Listen */ , t.lastListenSequenceNumber, r, i, X.fromBase64String(t.resumeToken))\n /** Encodes TargetData into a DbTarget for storage locally. */;\n}\n\nfunction Ei(t, e) {\n var n, r = wi(e.nt), i = wi(e.lastLimboFreeSnapshotVersion);\n n = dt(e.target) ? Ve(t.Co, e.target) : Ue(t.Co, e.target);\n // We can't store the resumeToken as a ByteString in IndexedDb, so we\n // convert it to a base64 string for storage.\n var o = e.resumeToken.toBase64();\n // lastListenSequenceNumber is always 0 until we do real GC.\n return new Hi(e.targetId, lt(e.target), r, o, e.sequenceNumber, i, n);\n}\n\n/**\n * A helper function for figuring out what kind of query has been stored.\n */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** A mutation queue for a specific user, backed by IndexedDB. */ var Ti = /** @class */ function() {\n function t(\n /**\n * The normalized userId (e.g. null UID => \"\" userId) used to store /\n * retrieve mutations.\n */\n t, e, n, r) {\n this.userId = t, this.serializer = e, this.Dr = n, this.No = r, \n /**\n * Caches the document keys for pending mutation batches. If the mutation\n * has been removed from IndexedDb, the cached value may continue to\n * be used to retrieve the batch's document keys. To remove a cached value\n * locally, `removeCachedMutationKeys()` should be invoked either directly\n * or through `removeMutationBatches()`.\n *\n * With multi-tab, when the primary client acknowledges or rejects a mutation,\n * this cache is used by secondary clients to invalidate the local\n * view of the documents that were previously affected by the mutation.\n */\n // PORTING NOTE: Multi-tab only.\n this.Fo = {}\n /**\n * Creates a new mutation queue for the given user.\n * @param user The user for which to create a mutation queue.\n * @param serializer The serializer to use when persisting to IndexedDb.\n */;\n }\n return t.xo = function(e, n, r, i) {\n // TODO(mcg): Figure out what constraints there are on userIDs\n // In particular, are there any reserved characters? are empty ids allowed?\n // For the moment store these together in the same mutations table assuming\n // that empty userIDs aren't allowed.\n return g(\"\" !== e.uid), new t(e.Zs() ? e.uid : \"\", n, r, i);\n }, t.prototype.$o = function(t) {\n var e = !0, n = IDBKeyRange.bound([ this.userId, Number.NEGATIVE_INFINITY ], [ this.userId, Number.POSITIVE_INFINITY ]);\n return Si(t).rs({\n index: Gi.userMutationsIndex,\n range: n\n }, (function(t, n, r) {\n e = !1, r.done();\n })).next((function() {\n return e;\n }));\n }, t.prototype.ko = function(t, e, n, r) {\n var i = this, o = Di(t), s = Si(t);\n // The IndexedDb implementation in Chrome (and Firefox) does not handle\n // compound indices that include auto-generated keys correctly. To ensure\n // that the index entry is added correctly in all browsers, we perform two\n // writes: The first write is used to retrieve the next auto-generated Batch\n // ID, and the second write populates the index and stores the actual\n // mutation batch.\n // See: https://bugs.chromium.org/p/chromium/issues/detail?id=701972\n // We write an empty object to obtain key\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return s.add({}).next((function(u) {\n g(\"number\" == typeof u);\n for (var a = new Xr(u, e, n, r), c = function(t, e, n) {\n var r = n.baseMutations.map((function(e) {\n return Oe(t.Co, e);\n })), i = n.mutations.map((function(e) {\n return Oe(t.Co, e);\n }));\n return new Gi(e, n.batchId, n.ar.toMillis(), r, i);\n }(i.serializer, i.userId, a), h = [], f = new Tt((function(t, e) {\n return H(t.R(), e.R());\n })), l = 0, p = r; l < p.length; l++) {\n var d = p[l], v = zi.key(i.userId, d.key.path, u);\n f = f.add(d.key.path.h()), h.push(s.put(c)), h.push(o.put(v, zi.PLACEHOLDER));\n }\n return f.forEach((function(e) {\n h.push(i.Dr.Mo(t, e));\n })), t.pr((function() {\n i.Fo[u] = a.keys();\n })), yr.$n(h).next((function() {\n return a;\n }));\n }));\n }, t.prototype.Oo = function(t, e) {\n var n = this;\n return Si(t).get(e).next((function(t) {\n return t ? (g(t.userId === n.userId), bi(n.serializer, t)) : null;\n }));\n }, \n /**\n * Returns the document keys for the mutation batch with the given batchId.\n * For primary clients, this method returns `null` after\n * `removeMutationBatches()` has been called. Secondary clients return a\n * cached result until `removeCachedMutationKeys()` is invoked.\n */\n // PORTING NOTE: Multi-tab only.\n t.prototype.Lo = function(t, e) {\n var n = this;\n return this.Fo[e] ? yr.resolve(this.Fo[e]) : this.Oo(t, e).next((function(t) {\n if (t) {\n var r = t.keys();\n return n.Fo[e] = r, r;\n }\n return null;\n }));\n }, t.prototype.Bo = function(t, e) {\n var n = this, r = e + 1, i = IDBKeyRange.lowerBound([ this.userId, r ]), o = null;\n return Si(t).rs({\n index: Gi.userMutationsIndex,\n range: i\n }, (function(t, e, i) {\n e.userId === n.userId && (g(e.batchId >= r), o = bi(n.serializer, e)), i.done();\n })).next((function() {\n return o;\n }));\n }, t.prototype.qo = function(t) {\n var e = IDBKeyRange.upperBound([ this.userId, Number.POSITIVE_INFINITY ]), n = -1;\n return Si(t).rs({\n index: Gi.userMutationsIndex,\n range: e,\n reverse: !0\n }, (function(t, e, r) {\n n = e.batchId, r.done();\n })).next((function() {\n return n;\n }));\n }, t.prototype.Uo = function(t) {\n var e = this, n = IDBKeyRange.bound([ this.userId, -1 ], [ this.userId, Number.POSITIVE_INFINITY ]);\n return Si(t).ts(Gi.userMutationsIndex, n).next((function(t) {\n return t.map((function(t) {\n return bi(e.serializer, t);\n }));\n }));\n }, t.prototype.Nr = function(t, e) {\n var n = this, r = zi.prefixForPath(this.userId, e.path), i = IDBKeyRange.lowerBound(r), o = [];\n // Scan the document-mutation index starting with a prefix starting with\n // the given documentKey.\n return Di(t).rs({\n range: i\n }, (function(r, i, s) {\n var u = r[0], a = r[1], c = r[2], h = pi(a);\n // Only consider rows matching exactly the specific key of\n // interest. Note that because we order by path first, and we\n // order terminators before path separators, we'll encounter all\n // the index rows for documentKey contiguously. In particular, all\n // the rows for documentKey will occur before any rows for\n // documents nested in a subcollection beneath documentKey so we\n // can stop as soon as we hit any such row.\n if (u === n.userId && e.path.isEqual(h)) \n // Look up the mutation batch in the store.\n return Si(t).get(c).next((function(t) {\n if (!t) throw y();\n g(t.userId === n.userId), o.push(bi(n.serializer, t));\n }));\n s.done();\n })).next((function() {\n return o;\n }));\n }, t.prototype.Or = function(t, e) {\n var n = this, r = new Tt(H), i = [];\n return e.forEach((function(e) {\n var o = zi.prefixForPath(n.userId, e.path), s = IDBKeyRange.lowerBound(o), u = Di(t).rs({\n range: s\n }, (function(t, i, o) {\n var s = t[0], u = t[1], a = t[2], c = pi(u);\n // Only consider rows matching exactly the specific key of\n // interest. Note that because we order by path first, and we\n // order terminators before path separators, we'll encounter all\n // the index rows for documentKey contiguously. In particular, all\n // the rows for documentKey will occur before any rows for\n // documents nested in a subcollection beneath documentKey so we\n // can stop as soon as we hit any such row.\n s === n.userId && e.path.isEqual(c) ? r = r.add(a) : o.done();\n }));\n i.push(u);\n })), yr.$n(i).next((function() {\n return n.Qo(t, r);\n }));\n }, t.prototype.Wr = function(t, e) {\n var n = this, r = e.path, i = r.length + 1, o = zi.prefixForPath(this.userId, r), s = IDBKeyRange.lowerBound(o), u = new Tt(H);\n return Di(t).rs({\n range: s\n }, (function(t, e, o) {\n var s = t[0], a = t[1], c = t[2], h = pi(a);\n s === n.userId && r.T(h) ? \n // Rows with document keys more than one segment longer than the\n // query path can't be matches. For example, a query on 'rooms'\n // can't match the document /rooms/abc/messages/xyx.\n // TODO(mcg): we'll need a different scanner when we implement\n // ancestor queries.\n h.length === i && (u = u.add(c)) : o.done();\n })).next((function() {\n return n.Qo(t, u);\n }));\n }, t.prototype.Qo = function(t, e) {\n var n = this, r = [], i = [];\n // TODO(rockwood): Implement this using iterate.\n return e.forEach((function(e) {\n i.push(Si(t).get(e).next((function(t) {\n if (null === t) throw y();\n g(t.userId === n.userId), r.push(bi(n.serializer, t));\n })));\n })), yr.$n(i).next((function() {\n return r;\n }));\n }, t.prototype.Wo = function(t, e) {\n var n = this;\n return Ai(t.jo, this.userId, e).next((function(r) {\n return t.pr((function() {\n n.Ko(e.batchId);\n })), yr.forEach(r, (function(e) {\n return n.No.Go(t, e);\n }));\n }));\n }, \n /**\n * Clears the cached keys for a mutation batch. This method should be\n * called by secondary clients after they process mutation updates.\n *\n * Note that this method does not have to be called from primary clients as\n * the corresponding cache entries are cleared when an acknowledged or\n * rejected batch is removed from the mutation queue.\n */\n // PORTING NOTE: Multi-tab only\n t.prototype.Ko = function(t) {\n delete this.Fo[t];\n }, t.prototype.zo = function(t) {\n var e = this;\n return this.$o(t).next((function(n) {\n if (!n) return yr.resolve();\n // Verify that there are no entries in the documentMutations index if\n // the queue is empty.\n var r = IDBKeyRange.lowerBound(zi.prefixForUser(e.userId)), i = [];\n return Di(t).rs({\n range: r\n }, (function(t, n, r) {\n if (t[0] === e.userId) {\n var o = pi(t[1]);\n i.push(o);\n } else r.done();\n })).next((function() {\n g(0 === i.length);\n }));\n }));\n }, t.prototype.Ho = function(t, e) {\n return Ni(t, this.userId, e);\n }, \n // PORTING NOTE: Multi-tab only (state is held in memory in other clients).\n /** Returns the mutation queue's metadata from IndexedDb. */\n t.prototype.Yo = function(t) {\n var e = this;\n return xi(t).get(this.userId).next((function(t) {\n return t || new ji(e.userId, -1, \n /*lastStreamToken=*/ \"\");\n }));\n }, t;\n}();\n\n/**\n * @return true if the mutation queue for the given user contains a pending\n * mutation for the given key.\n */ function Ni(t, e, n) {\n var r = zi.prefixForPath(e, n.path), i = r[1], o = IDBKeyRange.lowerBound(r), s = !1;\n return Di(t).rs({\n range: o,\n ss: !0\n }, (function(t, n, r) {\n var o = t[0], u = t[1];\n t[2];\n o === e && u === i && (s = !0), r.done();\n })).next((function() {\n return s;\n }));\n}\n\n/** Returns true if any mutation queue contains the given document. */\n/**\n * Delete a mutation batch and the associated document mutations.\n * @return A PersistencePromise of the document mutations that were removed.\n */ function Ai(t, e, n) {\n var r = t.store(Gi.store), i = t.store(zi.store), o = [], s = IDBKeyRange.only(n.batchId), u = 0, a = r.rs({\n range: s\n }, (function(t, e, n) {\n return u++, n.delete();\n }));\n o.push(a.next((function() {\n g(1 === u);\n })));\n for (var c = [], h = 0, f = n.mutations; h < f.length; h++) {\n var l = f[h], p = zi.key(e, l.key.path, n.batchId);\n o.push(i.delete(p)), c.push(l.key);\n }\n return yr.$n(o).next((function() {\n return c;\n }));\n}\n\n/**\n * Helper to get a typed SimpleDbStore for the mutations object store.\n */ function Si(t) {\n return ho.Qn(t, Gi.store);\n}\n\n/**\n * Helper to get a typed SimpleDbStore for the mutationQueues object store.\n */ function Di(t) {\n return ho.Qn(t, zi.store);\n}\n\n/**\n * Helper to get a typed SimpleDbStore for the mutationQueues object store.\n */ function xi(t) {\n return ho.Qn(t, ji.store);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The RemoteDocumentCache for IndexedDb. To construct, invoke\n * `newIndexedDbRemoteDocumentCache()`.\n */ var Li = /** @class */ function() {\n /**\n * @param serializer The document serializer.\n * @param indexManager The query indexes that need to be maintained.\n */\n function t(t, e) {\n this.serializer = t, this.Dr = e\n /**\n * Adds the supplied entries to the cache.\n *\n * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()` to ensure proper accounting of metadata.\n */;\n }\n return t.prototype.Er = function(t, e, n) {\n return Oi(t).put(Pi(e), n);\n }, \n /**\n * Removes a document from the cache.\n *\n * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()` to ensure proper accounting of metadata.\n */\n t.prototype.Ar = function(t, e) {\n var n = Oi(t), r = Pi(e);\n return n.delete(r);\n }, \n /**\n * Updates the current cache size.\n *\n * Callers to `addEntry()` and `removeEntry()` *must* call this afterwards to update the\n * cache's metadata.\n */\n t.prototype.updateMetadata = function(t, e) {\n var n = this;\n return this.getMetadata(t).next((function(r) {\n return r.byteSize += e, n.Jo(t, r);\n }));\n }, t.prototype.Rr = function(t, e) {\n var n = this;\n return Oi(t).get(Pi(e)).next((function(t) {\n return n.Xo(t);\n }));\n }, \n /**\n * Looks up an entry in the cache.\n *\n * @param documentKey The key of the entry to look up.\n * @return The cached MaybeDocument entry and its size, or null if we have nothing cached.\n */\n t.prototype.Zo = function(t, e) {\n var n = this;\n return Oi(t).get(Pi(e)).next((function(t) {\n var e = n.Xo(t);\n return e ? {\n ta: e,\n size: Vi(t)\n } : null;\n }));\n }, t.prototype.getEntries = function(t, e) {\n var n = this, r = Dt();\n return this.ea(t, e, (function(t, e) {\n var i = n.Xo(e);\n r = r.ot(t, i);\n })).next((function() {\n return r;\n }));\n }, \n /**\n * Looks up several entries in the cache.\n *\n * @param documentKeys The set of keys entries to look up.\n * @return A map of MaybeDocuments indexed by key (if a document cannot be\n * found, the key will be mapped to null) and a map of sizes indexed by\n * key (zero if the key cannot be found).\n */\n t.prototype.na = function(t, e) {\n var n = this, r = Dt(), i = new bt(A.i);\n return this.ea(t, e, (function(t, e) {\n var o = n.Xo(e);\n o ? (r = r.ot(t, o), i = i.ot(t, Vi(e))) : (r = r.ot(t, null), i = i.ot(t, 0));\n })).next((function() {\n return {\n sa: r,\n ia: i\n };\n }));\n }, t.prototype.ea = function(t, e, n) {\n if (e.m()) return yr.resolve();\n var r = IDBKeyRange.bound(e.first().path.A(), e.last().path.A()), i = e._t(), o = i.It();\n return Oi(t).rs({\n range: r\n }, (function(t, e, r) {\n // Go through keys not found in cache.\n for (var s = A.$(t); o && A.i(o, s) < 0; ) n(o, null), o = i.It();\n o && o.isEqual(s) && (\n // Key found in cache.\n n(o, e), o = i.At() ? i.It() : null), \n // Skip to the next key (if there is one).\n o ? r.Xn(o.path.A()) : r.done();\n })).next((function() {\n // The rest of the keys are not in the cache. One case where `iterate`\n // above won't go through them is when the cache is empty.\n for (;o; ) n(o, null), o = i.At() ? i.It() : null;\n }));\n }, t.prototype.Lr = function(t, e, n) {\n var r = this, i = Lt(), o = e.path.length + 1, s = {};\n if (n.isEqual(st.min())) {\n // Documents are ordered by key, so we can use a prefix scan to narrow\n // down the documents we need to match the query against.\n var u = e.path.A();\n s.range = IDBKeyRange.lowerBound(u);\n } else {\n // Execute an index-free query and filter by read time. This is safe\n // since all document changes to queries that have a\n // lastLimboFreeSnapshotVersion (`sinceReadTime`) have a read time set.\n var a = e.path.A(), c = gi(n);\n s.range = IDBKeyRange.lowerBound([ a, c ], \n /* open= */ !0), s.index = Ki.collectionReadTimeIndex;\n }\n return Oi(t).rs(s, (function(t, n, s) {\n // The query is actually returning any path that starts with the query\n // path prefix which may include documents in subcollections. For\n // example, a query on 'rooms' will return rooms/abc/messages/xyx but we\n // shouldn't match it. Fix this by discarding rows with document keys\n // more than one segment longer than the query path.\n if (t.length === o) {\n var u = vi(r.serializer, n);\n e.path.T(u.key.path) ? u instanceof kn && $n(e, u) && (i = i.ot(u.key, u)) : s.done();\n }\n })).next((function() {\n return i;\n }));\n }, t.prototype.ra = function(t) {\n return new ki(this, !!t && t.oa);\n }, t.prototype.aa = function(t) {\n return this.getMetadata(t).next((function(t) {\n return t.byteSize;\n }));\n }, t.prototype.getMetadata = function(t) {\n return Ri(t).get(Qi.key).next((function(t) {\n return g(!!t), t;\n }));\n }, t.prototype.Jo = function(t, e) {\n return Ri(t).put(Qi.key, e);\n }, \n /**\n * Decodes `remoteDoc` and returns the document (or null, if the document\n * corresponds to the format used for sentinel deletes).\n */\n t.prototype.Xo = function(t) {\n if (t) {\n var e = vi(this.serializer, t);\n return e instanceof Rn && e.version.isEqual(st.min()) ? null : e;\n }\n return null;\n }, t;\n}(), ki = /** @class */ function(e) {\n /**\n * @param documentCache The IndexedDbRemoteDocumentCache to apply the changes to.\n * @param trackRemovals Whether to create sentinel deletes that can be tracked by\n * `getNewDocumentChanges()`.\n */\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).ca = t, r.oa = n, \n // A map of document sizes prior to applying the changes in this buffer.\n r.ua = new it((function(t) {\n return t.toString();\n }), (function(t, e) {\n return t.isEqual(e);\n })), r;\n }\n return t.__extends(n, e), n.prototype.yr = function(t) {\n var e = this, n = [], r = 0, i = new Tt((function(t, e) {\n return H(t.R(), e.R());\n }));\n return this.wr.forEach((function(o, s) {\n var u = e.ua.get(o);\n if (s) {\n var a = yi(e.ca.serializer, s, e.readTime);\n i = i.add(o.path.h());\n var c = Vi(a);\n r += c - u, n.push(e.ca.Er(t, o, a));\n } else if (r -= u, e.oa) {\n // In order to track removals, we store a \"sentinel delete\" in the\n // RemoteDocumentCache. This entry is represented by a NoDocument\n // with a version of 0 and ignored by `maybeDecodeDocument()` but\n // preserved in `getNewDocumentChanges()`.\n var h = yi(e.ca.serializer, new Rn(o, st.min()), e.readTime);\n n.push(e.ca.Er(t, o, h));\n } else n.push(e.ca.Ar(t, o));\n })), i.forEach((function(r) {\n n.push(e.ca.Dr.Mo(t, r));\n })), n.push(this.ca.updateMetadata(t, r)), yr.$n(n);\n }, n.prototype.gr = function(t, e) {\n var n = this;\n // Record the size of everything we load from the cache so we can compute a delta later.\n return this.ca.Zo(t, e).next((function(t) {\n return null === t ? (n.ua.set(e, 0), null) : (n.ua.set(e, t.size), t.ta);\n }));\n }, n.prototype.Pr = function(t, e) {\n var n = this;\n // Record the size of everything we load from the cache so we can compute\n // a delta later.\n return this.ca.na(t, e).next((function(t) {\n var e = t.sa;\n // Note: `getAllFromCache` returns two maps instead of a single map from\n // keys to `DocumentSizeEntry`s. This is to allow returning the\n // `NullableMaybeDocumentMap` directly, without a conversion.\n return t.ia.forEach((function(t, e) {\n n.ua.set(t, e);\n })), e;\n }));\n }, n;\n}(Zr);\n\n/**\n * Creates a new IndexedDbRemoteDocumentCache.\n *\n * @param serializer The document serializer.\n * @param indexManager The query indexes that need to be maintained.\n */\n/**\n * Handles the details of adding and updating documents in the IndexedDbRemoteDocumentCache.\n *\n * Unlike the MemoryRemoteDocumentChangeBuffer, the IndexedDb implementation computes the size\n * delta for all submitted changes. This avoids having to re-read all documents from IndexedDb\n * when we apply the changes.\n */ function Ri(t) {\n return ho.Qn(t, Qi.store);\n}\n\n/**\n * Helper to get a typed SimpleDbStore for the remoteDocuments object store.\n */ function Oi(t) {\n return ho.Qn(t, Ki.store);\n}\n\nfunction Pi(t) {\n return t.path.A();\n}\n\n/**\n * Retrusn an approximate size for the given document.\n */ function Vi(t) {\n var e;\n if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else {\n if (!t.noDocument) throw y();\n e = t.noDocument;\n }\n return JSON.stringify(e).length;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An in-memory implementation of IndexManager.\n */ var Ui = /** @class */ function() {\n function t() {\n this.ha = new Ci;\n }\n return t.prototype.Mo = function(t, e) {\n return this.ha.add(e), yr.resolve();\n }, t.prototype.Qr = function(t, e) {\n return yr.resolve(this.ha.getEntries(e));\n }, t;\n}(), Ci = /** @class */ function() {\n function t() {\n this.index = {};\n }\n // Returns false if the entry already existed.\n return t.prototype.add = function(t) {\n var e = t._(), n = t.h(), r = this.index[e] || new Tt(E.i), i = !r.has(n);\n return this.index[e] = r.add(n), i;\n }, t.prototype.has = function(t) {\n var e = t._(), n = t.h(), r = this.index[e];\n return r && r.has(n);\n }, t.prototype.getEntries = function(t) {\n return (this.index[t] || new Tt(E.i)).A();\n }, t;\n}(), Fi = /** @class */ function() {\n function t(t) {\n this.serializer = t;\n }\n /**\n * Performs database creation and schema upgrades.\n *\n * Note that in production, this method is only ever used to upgrade the schema\n * to SCHEMA_VERSION. Different values of toVersion are only used for testing\n * and local feature development.\n */ return t.prototype.createOrUpgrade = function(t, e, n, r) {\n var i = this;\n g(n < r && n >= 0 && r <= 10);\n var o = new br(\"createOrUpgrade\", e);\n n < 1 && r >= 1 && (function(t) {\n t.createObjectStore(qi.store);\n }(t), function(t) {\n t.createObjectStore(ji.store, {\n keyPath: ji.keyPath\n }), t.createObjectStore(Gi.store, {\n keyPath: Gi.keyPath,\n autoIncrement: !0\n }).createIndex(Gi.userMutationsIndex, Gi.userMutationsKeyPath, {\n unique: !0\n }), t.createObjectStore(zi.store);\n }(t), Ji(t), function(t) {\n t.createObjectStore(Ki.store);\n }(t));\n // Migration 2 to populate the targetGlobal object no longer needed since\n // migration 3 unconditionally clears it.\n var s = yr.resolve();\n return n < 3 && r >= 3 && (\n // Brand new clients don't need to drop and recreate--only clients that\n // potentially have corrupt data.\n 0 !== n && (function(t) {\n t.deleteObjectStore(Yi.store), t.deleteObjectStore(Hi.store), t.deleteObjectStore($i.store);\n }(t), Ji(t)), s = s.next((function() {\n /**\n * Creates the target global singleton row.\n *\n * @param {IDBTransaction} txn The version upgrade transaction for indexeddb\n */\n return function(t) {\n var e = t.store($i.store), n = new $i(\n /*highestTargetId=*/ 0, \n /*lastListenSequenceNumber=*/ 0, st.min().Z(), \n /*targetCount=*/ 0);\n return e.put($i.key, n);\n }(o);\n }))), n < 4 && r >= 4 && (0 !== n && (\n // Schema version 3 uses auto-generated keys to generate globally unique\n // mutation batch IDs (this was previously ensured internally by the\n // client). To migrate to the new schema, we have to read all mutations\n // and write them back out. We preserve the existing batch IDs to guarantee\n // consistency with other object stores. Any further mutation batch IDs will\n // be auto-generated.\n s = s.next((function() {\n return function(t, e) {\n return e.store(Gi.store).ts().next((function(n) {\n t.deleteObjectStore(Gi.store), t.createObjectStore(Gi.store, {\n keyPath: Gi.keyPath,\n autoIncrement: !0\n }).createIndex(Gi.userMutationsIndex, Gi.userMutationsKeyPath, {\n unique: !0\n });\n var r = e.store(Gi.store), i = n.map((function(t) {\n return r.put(t);\n }));\n return yr.$n(i);\n }));\n }(t, o);\n }))), s = s.next((function() {\n !function(t) {\n t.createObjectStore(Zi.store, {\n keyPath: Zi.keyPath\n });\n }(t);\n }))), n < 5 && r >= 5 && (s = s.next((function() {\n return i.removeAcknowledgedMutations(o);\n }))), n < 6 && r >= 6 && (s = s.next((function() {\n return function(t) {\n t.createObjectStore(Qi.store);\n }(t), i.addDocumentGlobal(o);\n }))), n < 7 && r >= 7 && (s = s.next((function() {\n return i.ensureSequenceNumbers(o);\n }))), n < 8 && r >= 8 && (s = s.next((function() {\n return i.createCollectionParentIndex(t, o);\n }))), n < 9 && r >= 9 && (s = s.next((function() {\n // Multi-Tab used to manage its own changelog, but this has been moved\n // to the DbRemoteDocument object store itself. Since the previous change\n // log only contained transient data, we can drop its object store.\n !function(t) {\n t.objectStoreNames.contains(\"remoteDocumentChanges\") && t.deleteObjectStore(\"remoteDocumentChanges\");\n }(t), function(t) {\n var e = t.objectStore(Ki.store);\n e.createIndex(Ki.readTimeIndex, Ki.readTimeIndexPath, {\n unique: !1\n }), e.createIndex(Ki.collectionReadTimeIndex, Ki.collectionReadTimeIndexPath, {\n unique: !1\n });\n }(e);\n }))), n < 10 && r >= 10 && (s = s.next((function() {\n return i.rewriteCanonicalIds(o);\n }))), s;\n }, t.prototype.addDocumentGlobal = function(t) {\n var e = 0;\n return t.store(Ki.store).rs((function(t, n) {\n e += Vi(n);\n })).next((function() {\n var n = new Qi(e);\n return t.store(Qi.store).put(Qi.key, n);\n }));\n }, t.prototype.removeAcknowledgedMutations = function(t) {\n var e = this, n = t.store(ji.store), r = t.store(Gi.store);\n return n.ts().next((function(n) {\n return yr.forEach(n, (function(n) {\n var i = IDBKeyRange.bound([ n.userId, -1 ], [ n.userId, n.lastAcknowledgedBatchId ]);\n return r.ts(Gi.userMutationsIndex, i).next((function(r) {\n return yr.forEach(r, (function(r) {\n g(r.userId === n.userId);\n var i = bi(e.serializer, r);\n return Ai(t, n.userId, i).next((function() {}));\n }));\n }));\n }));\n }));\n }, \n /**\n * Ensures that every document in the remote document cache has a corresponding sentinel row\n * with a sequence number. Missing rows are given the most recently used sequence number.\n */\n t.prototype.ensureSequenceNumbers = function(t) {\n var e = t.store(Yi.store), n = t.store(Ki.store);\n return t.store($i.store).get($i.key).next((function(t) {\n var r = [];\n return n.rs((function(n, i) {\n var o = new E(n), s = function(t) {\n return [ 0, hi(t) ];\n }(o);\n r.push(e.get(s).next((function(n) {\n return n ? yr.resolve() : function(n) {\n return e.put(new Yi(0, hi(n), t.highestListenSequenceNumber));\n }(o);\n })));\n })).next((function() {\n return yr.$n(r);\n }));\n }));\n }, t.prototype.createCollectionParentIndex = function(t, e) {\n // Create the index.\n t.createObjectStore(Xi.store, {\n keyPath: Xi.keyPath\n });\n var n = e.store(Xi.store), r = new Ci, i = function(t) {\n if (r.add(t)) {\n var e = t._(), i = t.h();\n return n.put({\n collectionId: e,\n parent: hi(i)\n });\n }\n };\n // Helper to add an index entry iff we haven't already written it.\n // Index existing remote documents.\n return e.store(Ki.store).rs({\n ss: !0\n }, (function(t, e) {\n var n = new E(t);\n return i(n.h());\n })).next((function() {\n return e.store(zi.store).rs({\n ss: !0\n }, (function(t, e) {\n t[0];\n var n = t[1], r = (t[2], pi(n));\n return i(r.h());\n }));\n }));\n }, t.prototype.rewriteCanonicalIds = function(t) {\n var e = this, n = t.store(Hi.store);\n return n.rs((function(t, r) {\n var i = Ii(r), o = Ei(e.serializer, i);\n return n.put(o);\n }));\n }, t;\n}(), Mi = function(t, e) {\n this.seconds = t, this.nanoseconds = e;\n}, qi = function(t, \n/** Whether to allow shared access from multiple tabs. */\ne, n) {\n this.ownerId = t, this.allowTabSynchronization = e, this.leaseTimestampMs = n;\n};\n\n/**\n * Internal implementation of the collection-parent index exposed by MemoryIndexManager.\n * Also used for in-memory caching by IndexedDbIndexManager and initial index population\n * in indexeddb_schema.ts\n */\n/**\n * Name of the IndexedDb object store.\n *\n * Note that the name 'owner' is chosen to ensure backwards compatibility with\n * older clients that only supported single locked access to the persistence\n * layer.\n */\nqi.store = \"owner\", \n/**\n * The key string used for the single object that exists in the\n * DbPrimaryClient store.\n */\nqi.key = \"owner\";\n\nvar ji = function(\n/**\n * The normalized user ID to which this queue belongs.\n */\nt, \n/**\n * An identifier for the highest numbered batch that has been acknowledged\n * by the server. All MutationBatches in this queue with batchIds less\n * than or equal to this value are considered to have been acknowledged by\n * the server.\n *\n * NOTE: this is deprecated and no longer used by the code.\n */\ne, \n/**\n * A stream token that was previously sent by the server.\n *\n * See StreamingWriteRequest in datastore.proto for more details about\n * usage.\n *\n * After sending this token, earlier tokens may not be used anymore so\n * only a single stream token is retained.\n *\n * NOTE: this is deprecated and no longer used by the code.\n */\nn) {\n this.userId = t, this.lastAcknowledgedBatchId = e, this.lastStreamToken = n;\n};\n\n/** Name of the IndexedDb object store. */ ji.store = \"mutationQueues\", \n/** Keys are automatically assigned via the userId property. */\nji.keyPath = \"userId\";\n\n/**\n * An object to be stored in the 'mutations' store in IndexedDb.\n *\n * Represents a batch of user-level mutations intended to be sent to the server\n * in a single write. Each user-level batch gets a separate DbMutationBatch\n * with a new batchId.\n */\nvar Gi = function(\n/**\n * The normalized user ID to which this batch belongs.\n */\nt, \n/**\n * An identifier for this batch, allocated using an auto-generated key.\n */\ne, \n/**\n * The local write time of the batch, stored as milliseconds since the\n * epoch.\n */\nn, \n/**\n * A list of \"mutations\" that represent a partial base state from when this\n * write batch was initially created. During local application of the write\n * batch, these baseMutations are applied prior to the real writes in order\n * to override certain document fields from the remote document cache. This\n * is necessary in the case of non-idempotent writes (e.g. `increment()`\n * transforms) to make sure that the local view of the modified documents\n * doesn't flicker if the remote document cache receives the result of the\n * non-idempotent write before the write is removed from the queue.\n *\n * These mutations are never sent to the backend.\n */\nr, \n/**\n * A list of mutations to apply. All mutations will be applied atomically.\n *\n * Mutations are serialized via toMutation().\n */\ni) {\n this.userId = t, this.batchId = e, this.localWriteTimeMs = n, this.baseMutations = r, \n this.mutations = i;\n};\n\n/** Name of the IndexedDb object store. */ Gi.store = \"mutations\", \n/** Keys are automatically assigned via the userId, batchId properties. */\nGi.keyPath = \"batchId\", \n/** The index name for lookup of mutations by user. */\nGi.userMutationsIndex = \"userMutationsIndex\", \n/** The user mutations index is keyed by [userId, batchId] pairs. */\nGi.userMutationsKeyPath = [ \"userId\", \"batchId\" ];\n\nvar zi = /** @class */ function() {\n function t() {}\n /**\n * Creates a [userId] key for use in the DbDocumentMutations index to iterate\n * over all of a user's document mutations.\n */ return t.prefixForUser = function(t) {\n return [ t ];\n }, \n /**\n * Creates a [userId, encodedPath] key for use in the DbDocumentMutations\n * index to iterate over all at document mutations for a given path or lower.\n */\n t.prefixForPath = function(t, e) {\n return [ t, hi(e) ];\n }, \n /**\n * Creates a full index key of [userId, encodedPath, batchId] for inserting\n * and deleting into the DbDocumentMutations index.\n */\n t.key = function(t, e, n) {\n return [ t, hi(e), n ];\n }, t;\n}();\n\nzi.store = \"documentMutations\", \n/**\n * Because we store all the useful information for this store in the key,\n * there is no useful information to store as the value. The raw (unencoded)\n * path cannot be stored because IndexedDb doesn't store prototype\n * information.\n */\nzi.PLACEHOLDER = new zi;\n\nvar Bi = function(t, e) {\n this.path = t, this.readTime = e;\n}, Wi = function(t, e) {\n this.path = t, this.version = e;\n}, Ki = \n// TODO: We are currently storing full document keys almost three times\n// (once as part of the primary key, once - partly - as `parentPath` and once\n// inside the encoded documents). During our next migration, we should\n// rewrite the primary key as parentPath + document ID which would allow us\n// to drop one value.\nfunction(\n/**\n * Set to an instance of DbUnknownDocument if the data for a document is\n * not known, but it is known that a document exists at the specified\n * version (e.g. it had a successful update applied to it)\n */\nt, \n/**\n * Set to an instance of a DbNoDocument if it is known that no document\n * exists.\n */\ne, \n/**\n * Set to an instance of a Document if there's a cached version of the\n * document.\n */\nn, \n/**\n * Documents that were written to the remote document store based on\n * a write acknowledgment are marked with `hasCommittedMutations`. These\n * documents are potentially inconsistent with the backend's copy and use\n * the write's commit version as their document version.\n */\nr, \n/**\n * When the document was read from the backend. Undefined for data written\n * prior to schema version 9.\n */\ni, \n/**\n * The path of the collection this document is part of. Undefined for data\n * written prior to schema version 9.\n */\no) {\n this.unknownDocument = t, this.noDocument = e, this.document = n, this.hasCommittedMutations = r, \n this.readTime = i, this.parentPath = o;\n};\n\n/**\n * Represents a document that is known to exist but whose data is unknown.\n * Stored in IndexedDb as part of a DbRemoteDocument object.\n */ Ki.store = \"remoteDocuments\", \n/**\n * An index that provides access to all entries sorted by read time (which\n * corresponds to the last modification time of each row).\n *\n * This index is used to provide a changelog for Multi-Tab.\n */\nKi.readTimeIndex = \"readTimeIndex\", Ki.readTimeIndexPath = \"readTime\", \n/**\n * An index that provides access to documents in a collection sorted by read\n * time.\n *\n * This index is used to allow the RemoteDocumentCache to fetch newly changed\n * documents in a collection.\n */\nKi.collectionReadTimeIndex = \"collectionReadTimeIndex\", Ki.collectionReadTimeIndexPath = [ \"parentPath\", \"readTime\" ];\n\n/**\n * Contains a single entry that has metadata about the remote document cache.\n */\nvar Qi = \n/**\n * @param byteSize Approximately the total size in bytes of all the documents in the document\n * cache.\n */\nfunction(t) {\n this.byteSize = t;\n};\n\nQi.store = \"remoteDocumentGlobal\", Qi.key = \"remoteDocumentGlobalKey\";\n\nvar Hi = function(\n/**\n * An auto-generated sequential numeric identifier for the query.\n *\n * Queries are stored using their canonicalId as the key, but these\n * canonicalIds can be quite long so we additionally assign a unique\n * queryId which can be used by referenced data structures (e.g.\n * indexes) to minimize the on-disk cost.\n */\nt, \n/**\n * The canonical string representing this query. This is not unique.\n */\ne, \n/**\n * The last readTime received from the Watch Service for this query.\n *\n * This is the same value as TargetChange.read_time in the protos.\n */\nn, \n/**\n * An opaque, server-assigned token that allows watching a query to be\n * resumed after disconnecting without retransmitting all the data\n * that matches the query. The resume token essentially identifies a\n * point in time from which the server should resume sending results.\n *\n * This is related to the snapshotVersion in that the resumeToken\n * effectively also encodes that value, but the resumeToken is opaque\n * and sometimes encodes additional information.\n *\n * A consequence of this is that the resumeToken should be used when\n * asking the server to reason about where this client is in the watch\n * stream, but the client should use the snapshotVersion for its own\n * purposes.\n *\n * This is the same value as TargetChange.resume_token in the protos.\n */\nr, \n/**\n * A sequence number representing the last time this query was\n * listened to, used for garbage collection purposes.\n *\n * Conventionally this would be a timestamp value, but device-local\n * clocks are unreliable and they must be able to create new listens\n * even while disconnected. Instead this should be a monotonically\n * increasing number that's incremented on each listen call.\n *\n * This is different from the queryId since the queryId is an\n * immutable identifier assigned to the Query on first use while\n * lastListenSequenceNumber is updated every time the query is\n * listened to.\n */\ni, \n/**\n * Denotes the maximum snapshot version at which the associated query view\n * contained no limbo documents. Undefined for data written prior to\n * schema version 9.\n */\no, \n/**\n * The query for this target.\n *\n * Because canonical ids are not unique we must store the actual query. We\n * use the proto to have an object we can persist without having to\n * duplicate translation logic to and from a `Query` object.\n */\ns) {\n this.targetId = t, this.canonicalId = e, this.readTime = n, this.resumeToken = r, \n this.lastListenSequenceNumber = i, this.lastLimboFreeSnapshotVersion = o, this.query = s;\n};\n\nHi.store = \"targets\", \n/** Keys are automatically assigned via the targetId property. */\nHi.keyPath = \"targetId\", \n/** The name of the queryTargets index. */\nHi.queryTargetsIndexName = \"queryTargetsIndex\", \n/**\n * The index of all canonicalIds to the targets that they match. This is not\n * a unique mapping because canonicalId does not promise a unique name for all\n * possible queries, so we append the targetId to make the mapping unique.\n */\nHi.queryTargetsKeyPath = [ \"canonicalId\", \"targetId\" ];\n\n/**\n * An object representing an association between a target and a document, or a\n * sentinel row marking the last sequence number at which a document was used.\n * Each document cached must have a corresponding sentinel row before lru\n * garbage collection is enabled.\n *\n * The target associations and sentinel rows are co-located so that orphaned\n * documents and their sequence numbers can be identified efficiently via a scan\n * of this store.\n */\nvar Yi = function(\n/**\n * The targetId identifying a target or 0 for a sentinel row.\n */\nt, \n/**\n * The path to the document, as encoded in the key.\n */\ne, \n/**\n * If this is a sentinel row, this should be the sequence number of the last\n * time the document specified by `path` was used. Otherwise, it should be\n * `undefined`.\n */\nn) {\n this.targetId = t, this.path = e, this.sequenceNumber = n;\n};\n\n/** Name of the IndexedDb object store. */ Yi.store = \"targetDocuments\", \n/** Keys are automatically assigned via the targetId, path properties. */\nYi.keyPath = [ \"targetId\", \"path\" ], \n/** The index name for the reverse index. */\nYi.documentTargetsIndex = \"documentTargetsIndex\", \n/** We also need to create the reverse index for these properties. */\nYi.documentTargetsKeyPath = [ \"path\", \"targetId\" ];\n\n/**\n * A record of global state tracked across all Targets, tracked separately\n * to avoid the need for extra indexes.\n *\n * This should be kept in-sync with the proto used in the iOS client.\n */\nvar $i = function(\n/**\n * The highest numbered target id across all targets.\n *\n * See DbTarget.targetId.\n */\nt, \n/**\n * The highest numbered lastListenSequenceNumber across all targets.\n *\n * See DbTarget.lastListenSequenceNumber.\n */\ne, \n/**\n * A global snapshot version representing the last consistent snapshot we\n * received from the backend. This is monotonically increasing and any\n * snapshots received from the backend prior to this version (e.g. for\n * targets resumed with a resumeToken) should be suppressed (buffered)\n * until the backend has caught up to this snapshot version again. This\n * prevents our cache from ever going backwards in time.\n */\nn, \n/**\n * The number of targets persisted.\n */\nr) {\n this.highestTargetId = t, this.highestListenSequenceNumber = e, this.lastRemoteSnapshotVersion = n, \n this.targetCount = r;\n};\n\n/**\n * The key string used for the single object that exists in the\n * DbTargetGlobal store.\n */ $i.key = \"targetGlobalKey\", $i.store = \"targetGlobal\";\n\n/**\n * An object representing an association between a Collection id (e.g. 'messages')\n * to a parent path (e.g. '/chats/123') that contains it as a (sub)collection.\n * This is used to efficiently find all collections to query when performing\n * a Collection Group query.\n */\nvar Xi = function(\n/**\n * The collectionId (e.g. 'messages')\n */\nt, \n/**\n * The path to the parent (either a document location or an empty path for\n * a root-level collection).\n */\ne) {\n this.collectionId = t, this.parent = e;\n};\n\n/** Name of the IndexedDb object store. */ function Ji(t) {\n t.createObjectStore(Yi.store, {\n keyPath: Yi.keyPath\n }).createIndex(Yi.documentTargetsIndex, Yi.documentTargetsKeyPath, {\n unique: !0\n }), \n // NOTE: This is unique only because the TargetId is the suffix.\n t.createObjectStore(Hi.store, {\n keyPath: Hi.keyPath\n }).createIndex(Hi.queryTargetsIndexName, Hi.queryTargetsKeyPath, {\n unique: !0\n }), t.createObjectStore($i.store);\n}\n\nXi.store = \"collectionParents\", \n/** Keys are automatically assigned via the collectionId, parent properties. */\nXi.keyPath = [ \"collectionId\", \"parent\" ];\n\nvar Zi = function(\n// Note: Previous schema versions included a field\n// \"lastProcessedDocumentChangeId\". Don't use anymore.\n/** The auto-generated client id assigned at client startup. */\nt, \n/** The last time this state was updated. */\ne, \n/** Whether the client's network connection is enabled. */\nn, \n/** Whether this client is running in a foreground tab. */\nr) {\n this.clientId = t, this.updateTimeMs = e, this.networkEnabled = n, this.inForeground = r;\n};\n\n/** Name of the IndexedDb object store. */ Zi.store = \"clientMetadata\", \n/** Keys are automatically assigned via the clientId properties. */\nZi.keyPath = \"clientId\";\n\nvar to = t.__spreadArrays(t.__spreadArrays(t.__spreadArrays([ ji.store, Gi.store, zi.store, Ki.store, Hi.store, qi.store, $i.store, Yi.store ], [ Zi.store ]), [ Qi.store ]), [ Xi.store ]), eo = /** @class */ function() {\n function t() {\n /**\n * An in-memory copy of the index entries we've already written since the SDK\n * launched. Used to avoid re-writing the same entry repeatedly.\n *\n * This is *NOT* a complete cache of what's in persistence and so can never be used to\n * satisfy reads.\n */\n this.la = new Ci;\n }\n /**\n * Adds a new entry to the collection parent index.\n *\n * Repeated calls for the same collectionPath should be avoided within a\n * transaction as IndexedDbIndexManager only caches writes once a transaction\n * has been committed.\n */ return t.prototype.Mo = function(t, e) {\n var n = this;\n if (!this.la.has(e)) {\n var r = e._(), i = e.h();\n t.pr((function() {\n // Add the collection to the in memory cache only if the transaction was\n // successfully committed.\n n.la.add(e);\n }));\n var o = {\n collectionId: r,\n parent: hi(i)\n };\n return no(t).put(o);\n }\n return yr.resolve();\n }, t.prototype.Qr = function(t, e) {\n var n = [], r = IDBKeyRange.bound([ e, \"\" ], [ $(e), \"\" ], \n /*lowerOpen=*/ !1, \n /*upperOpen=*/ !0);\n return no(t).ts(r).next((function(t) {\n for (var r = 0, i = t; r < i.length; r++) {\n var o = i[r];\n // This collectionId guard shouldn't be necessary (and isn't as long\n // as we're running in a real browser), but there's a bug in\n // indexeddbshim that breaks our range in our tests running in node:\n // https://github.com/axemclion/IndexedDBShim/issues/334\n if (o.collectionId !== e) break;\n n.push(pi(o.parent));\n }\n return n;\n }));\n }, t;\n}();\n\n// V2 is no longer usable (see comment at top of file)\n// Visible for testing\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A persisted implementation of IndexManager.\n */\n/**\n * Helper to get a typed SimpleDbStore for the collectionParents\n * document store.\n */\nfunction no(t) {\n return ho.Qn(t, Xi.store);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Offset to ensure non-overlapping target ids. */\n/**\n * Generates monotonically increasing target IDs for sending targets to the\n * watch stream.\n *\n * The client constructs two generators, one for the target cache, and one for\n * for the sync engine (to generate limbo documents targets). These\n * generators produce non-overlapping IDs (by using even and odd IDs\n * respectively).\n *\n * By separating the target ID space, the query cache can generate target IDs\n * that persist across client restarts, while sync engine can independently\n * generate in-memory target IDs that are transient and can be reused after a\n * restart.\n */ var ro = /** @class */ function() {\n function t(t) {\n this._a = t;\n }\n return t.prototype.next = function() {\n return this._a += 2, this._a;\n }, t.fa = function() {\n // The target cache generator must return '2' in its first call to `next()`\n // as there is no differentiation in the protocol layer between an unset\n // number and the number '0'. If we were to sent a target with target ID\n // '0', the backend would consider it unset and replace it with its own ID.\n return new t(0);\n }, t.da = function() {\n // Sync engine assigns target IDs for limbo document detection.\n return new t(-1);\n }, t;\n}(), io = /** @class */ function() {\n function t(t, e) {\n this.No = t, this.serializer = e;\n }\n // PORTING NOTE: We don't cache global metadata for the target cache, since\n // some of it (in particular `highestTargetId`) can be modified by secondary\n // tabs. We could perhaps be more granular (and e.g. still cache\n // `lastRemoteSnapshotVersion` in memory) but for simplicity we currently go\n // to IndexedDb whenever we need to read metadata. We can revisit if it turns\n // out to have a meaningful performance impact.\n return t.prototype.wa = function(t) {\n var e = this;\n return this.ma(t).next((function(n) {\n var r = new ro(n.highestTargetId);\n return n.highestTargetId = r.next(), e.Ta(t, n).next((function() {\n return n.highestTargetId;\n }));\n }));\n }, t.prototype.Ea = function(t) {\n return this.ma(t).next((function(t) {\n return st.J(new ot(t.lastRemoteSnapshotVersion.seconds, t.lastRemoteSnapshotVersion.nanoseconds));\n }));\n }, t.prototype.Ia = function(t) {\n return this.ma(t).next((function(t) {\n return t.highestListenSequenceNumber;\n }));\n }, t.prototype.Aa = function(t, e, n) {\n var r = this;\n return this.ma(t).next((function(i) {\n return i.highestListenSequenceNumber = e, n && (i.lastRemoteSnapshotVersion = n.Z()), \n e > i.highestListenSequenceNumber && (i.highestListenSequenceNumber = e), r.Ta(t, i);\n }));\n }, t.prototype.Ra = function(t, e) {\n var n = this;\n return this.ga(t, e).next((function() {\n return n.ma(t).next((function(r) {\n return r.targetCount += 1, n.Pa(e, r), n.Ta(t, r);\n }));\n }));\n }, t.prototype.ya = function(t, e) {\n return this.ga(t, e);\n }, t.prototype.Va = function(t, e) {\n var n = this;\n return this.pa(t, e.targetId).next((function() {\n return oo(t).delete(e.targetId);\n })).next((function() {\n return n.ma(t);\n })).next((function(e) {\n return g(e.targetCount > 0), e.targetCount -= 1, n.Ta(t, e);\n }));\n }, \n /**\n * Drops any targets with sequence number less than or equal to the upper bound, excepting those\n * present in `activeTargetIds`. Document associations for the removed targets are also removed.\n * Returns the number of targets removed.\n */\n t.prototype.po = function(t, e, n) {\n var r = this, i = 0, o = [];\n return oo(t).rs((function(s, u) {\n var a = Ii(u);\n a.sequenceNumber <= e && null === n.get(a.targetId) && (i++, o.push(r.Va(t, a)));\n })).next((function() {\n return yr.$n(o);\n })).next((function() {\n return i;\n }));\n }, \n /**\n * Call provided function with each `TargetData` that we have cached.\n */\n t.prototype.Ce = function(t, e) {\n return oo(t).rs((function(t, n) {\n var r = Ii(n);\n e(r);\n }));\n }, t.prototype.ma = function(t) {\n return so(t).get($i.key).next((function(t) {\n return g(null !== t), t;\n }));\n }, t.prototype.Ta = function(t, e) {\n return so(t).put($i.key, e);\n }, t.prototype.ga = function(t, e) {\n return oo(t).put(Ei(this.serializer, e));\n }, \n /**\n * In-place updates the provided metadata to account for values in the given\n * TargetData. Saving is done separately. Returns true if there were any\n * changes to the metadata.\n */\n t.prototype.Pa = function(t, e) {\n var n = !1;\n return t.targetId > e.highestTargetId && (e.highestTargetId = t.targetId, n = !0), \n t.sequenceNumber > e.highestListenSequenceNumber && (e.highestListenSequenceNumber = t.sequenceNumber, \n n = !0), n;\n }, t.prototype.ba = function(t) {\n return this.ma(t).next((function(t) {\n return t.targetCount;\n }));\n }, t.prototype.va = function(t, e) {\n // Iterating by the canonicalId may yield more than one result because\n // canonicalId values are not required to be unique per target. This query\n // depends on the queryTargets index to be efficient.\n var n = lt(e), r = IDBKeyRange.bound([ n, Number.NEGATIVE_INFINITY ], [ n, Number.POSITIVE_INFINITY ]), i = null;\n return oo(t).rs({\n range: r,\n index: Hi.queryTargetsIndexName\n }, (function(t, n, r) {\n var o = Ii(n);\n // After finding a potential match, check that the target is\n // actually equal to the requested target.\n pt(e, o.target) && (i = o, r.done());\n })).next((function() {\n return i;\n }));\n }, t.prototype.Sa = function(t, e, n) {\n var r = this, i = [], o = uo(t);\n // PORTING NOTE: The reverse index (documentsTargets) is maintained by\n // IndexedDb.\n return e.forEach((function(e) {\n var s = hi(e.path);\n i.push(o.put(new Yi(n, s))), i.push(r.No.Da(t, n, e));\n })), yr.$n(i);\n }, t.prototype.Ca = function(t, e, n) {\n var r = this, i = uo(t);\n // PORTING NOTE: The reverse index (documentsTargets) is maintained by\n // IndexedDb.\n return yr.forEach(e, (function(e) {\n var o = hi(e.path);\n return yr.$n([ i.delete([ n, o ]), r.No.Na(t, n, e) ]);\n }));\n }, t.prototype.pa = function(t, e) {\n var n = uo(t), r = IDBKeyRange.bound([ e ], [ e + 1 ], \n /*lowerOpen=*/ !1, \n /*upperOpen=*/ !0);\n return n.delete(r);\n }, t.prototype.Fa = function(t, e) {\n var n = IDBKeyRange.bound([ e ], [ e + 1 ], \n /*lowerOpen=*/ !1, \n /*upperOpen=*/ !0), r = uo(t), i = Ot();\n return r.rs({\n range: n,\n ss: !0\n }, (function(t, e, n) {\n var r = pi(t[1]), o = new A(r);\n i = i.add(o);\n })).next((function() {\n return i;\n }));\n }, t.prototype.Ho = function(t, e) {\n var n = hi(e.path), r = IDBKeyRange.bound([ n ], [ $(n) ], \n /*lowerOpen=*/ !1, \n /*upperOpen=*/ !0), i = 0;\n return uo(t).rs({\n index: Yi.documentTargetsIndex,\n ss: !0,\n range: r\n }, (function(t, e, n) {\n var r = t[0];\n // Having a sentinel row for a document does not count as containing that document;\n // For the target cache, containing the document means the document is part of some\n // target.\n t[1];\n 0 !== r && (i++, n.done());\n })).next((function() {\n return i > 0;\n }));\n }, \n /**\n * Looks up a TargetData entry by target ID.\n *\n * @param targetId The target ID of the TargetData entry to look up.\n * @return The cached TargetData entry, or null if the cache has no entry for\n * the target.\n */\n // PORTING NOTE: Multi-tab only.\n t.prototype.Ue = function(t, e) {\n return oo(t).get(e).next((function(t) {\n return t ? Ii(t) : null;\n }));\n }, t;\n}();\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Helper to get a typed SimpleDbStore for the queries object store.\n */\nfunction oo(t) {\n return ho.Qn(t, Hi.store);\n}\n\n/**\n * Helper to get a typed SimpleDbStore for the target globals object store.\n */ function so(t) {\n return ho.Qn(t, $i.store);\n}\n\n/**\n * Helper to get a typed SimpleDbStore for the document target object store.\n */ function uo(t) {\n return ho.Qn(t, Yi.store);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ var ao = \"Failed to obtain exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.\", co = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this) || this).jo = t, r.xa = n, r;\n }\n return t.__extends(n, e), n;\n}(ei), ho = /** @class */ function() {\n function e(\n /**\n * Whether to synchronize the in-memory state of multiple tabs and share\n * access to local persistence.\n */\n t, n, r, i, o, s, u, h, f, \n /**\n * If set to true, forcefully obtains database access. Existing tabs will\n * no longer be able to access IndexedDB.\n */\n l) {\n if (this.allowTabSynchronization = t, this.persistenceKey = n, this.clientId = r, \n this.fn = o, this.window = s, this.document = u, this.$a = f, this.ka = l, this.Ma = null, \n this.Oa = !1, this.isPrimary = !1, this.networkEnabled = !0, \n /** Our window.unload handler, if registered. */\n this.La = null, this.inForeground = !1, \n /** Our 'visibilitychange' listener if registered. */\n this.Ba = null, \n /** The client metadata refresh task. */\n this.qa = null, \n /** The last time we garbage collected the client metadata object store. */\n this.Ua = Number.NEGATIVE_INFINITY, \n /** A listener to notify on primary state changes. */\n this.Qa = function(t) {\n return Promise.resolve();\n }, !e.Ln()) throw new c(a.UNIMPLEMENTED, \"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.\");\n this.No = new po(this, i), this.Wa = n + \"main\", this.serializer = new di(h), this.ja = new gr(this.Wa, 10, new Fi(this.serializer)), \n this.Ka = new io(this.No, this.serializer), this.Dr = new eo, this.vr = function(t, e) {\n return new Li(t, e);\n }(this.serializer, this.Dr), this.window && this.window.localStorage ? this.Ga = this.window.localStorage : (this.Ga = null, \n !1 === l && p(\"IndexedDbPersistence\", \"LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page.\"));\n }\n return e.Qn = function(t, e) {\n if (t instanceof co) return gr.Qn(t.jo, e);\n throw y();\n }, \n /**\n * Attempt to start IndexedDb persistence.\n *\n * @return {Promise} Whether persistence was enabled.\n */\n e.prototype.start = function() {\n var t = this;\n // NOTE: This is expected to fail sometimes (in the case of another tab\n // already having the persistence lock), so it's the first thing we should\n // do.\n return this.za().then((function() {\n if (!t.isPrimary && !t.allowTabSynchronization) \n // Fail `start()` if `synchronizeTabs` is disabled and we cannot\n // obtain the primary lease.\n throw new c(a.FAILED_PRECONDITION, ao);\n return t.Ha(), t.Ya(), t.Ja(), t.runTransaction(\"getHighestListenSequenceNumber\", \"readonly\", (function(e) {\n return t.Ka.Ia(e);\n }));\n })).then((function(e) {\n t.Ma = new qr(e, t.$a);\n })).then((function() {\n t.Oa = !0;\n })).catch((function(e) {\n return t.ja && t.ja.close(), Promise.reject(e);\n }));\n }, \n /**\n * Registers a listener that gets called when the primary state of the\n * instance changes. Upon registering, this listener is invoked immediately\n * with the current primary state.\n *\n * PORTING NOTE: This is only used for Web multi-tab.\n */\n e.prototype.Xa = function(e) {\n var n = this;\n return this.Qa = function(r) {\n return t.__awaiter(n, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return this.Ei ? [ 2 /*return*/ , e(r) ] : [ 2 /*return*/ ];\n }));\n }));\n }, e(this.isPrimary);\n }, \n /**\n * Registers a listener that gets called when the database receives a\n * version change event indicating that it has deleted.\n *\n * PORTING NOTE: This is only used for Web multi-tab.\n */\n e.prototype.Za = function(e) {\n var n = this;\n this.ja.Kn((function(r) {\n return t.__awaiter(n, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return null === r.newVersion ? [ 4 /*yield*/ , e() ] : [ 3 /*break*/ , 2 ];\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }));\n }, \n /**\n * Adjusts the current network state in the client's metadata, potentially\n * affecting the primary lease.\n *\n * PORTING NOTE: This is only used for Web multi-tab.\n */\n e.prototype.tc = function(e) {\n var n = this;\n this.networkEnabled !== e && (this.networkEnabled = e, \n // Schedule a primary lease refresh for immediate execution. The eventual\n // lease update will be propagated via `primaryStateListener`.\n this.fn.ws((function() {\n return t.__awaiter(n, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return this.Ei ? [ 4 /*yield*/ , this.za() ] : [ 3 /*break*/ , 2 ];\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n })));\n }, \n /**\n * Updates the client metadata in IndexedDb and attempts to either obtain or\n * extend the primary lease for the local client. Asynchronously notifies the\n * primary state listener if the client either newly obtained or released its\n * primary lease.\n */\n e.prototype.za = function() {\n var t = this;\n return this.runTransaction(\"updateClientMetadataAndTryBecomePrimary\", \"readwrite\", (function(e) {\n return lo(e).put(new Zi(t.clientId, Date.now(), t.networkEnabled, t.inForeground)).next((function() {\n if (t.isPrimary) return t.ec(e).next((function(e) {\n e || (t.isPrimary = !1, t.fn.Cs((function() {\n return t.Qa(!1);\n })));\n }));\n })).next((function() {\n return t.nc(e);\n })).next((function(n) {\n return t.isPrimary && !n ? t.sc(e).next((function() {\n return !1;\n })) : !!n && t.ic(e).next((function() {\n return !0;\n }));\n }));\n })).catch((function(e) {\n if (_r(e)) \n // Proceed with the existing state. Any subsequent access to\n // IndexedDB will verify the lease.\n return l(\"IndexedDbPersistence\", \"Failed to extend owner lease: \", e), t.isPrimary;\n if (!t.allowTabSynchronization) throw e;\n return l(\"IndexedDbPersistence\", \"Releasing owner lease after error during lease refresh\", e), \n /* isPrimary= */ !1;\n })).then((function(e) {\n t.isPrimary !== e && t.fn.Cs((function() {\n return t.Qa(e);\n })), t.isPrimary = e;\n }));\n }, e.prototype.ec = function(t) {\n var e = this;\n return fo(t).get(qi.key).next((function(t) {\n return yr.resolve(e.rc(t));\n }));\n }, e.prototype.oc = function(t) {\n return lo(t).delete(this.clientId);\n }, \n /**\n * If the garbage collection threshold has passed, prunes the\n * RemoteDocumentChanges and the ClientMetadata store based on the last update\n * time of all clients.\n */\n e.prototype.ac = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r, i, o, s = this;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return !this.isPrimary || this.cc(this.Ua, 18e5) ? [ 3 /*break*/ , 2 ] : (this.Ua = Date.now(), \n [ 4 /*yield*/ , this.runTransaction(\"maybeGarbageCollectMultiClientState\", \"readwrite-primary\", (function(t) {\n var n = e.Qn(t, Zi.store);\n return n.ts().next((function(t) {\n var e = s.uc(t, 18e5), r = t.filter((function(t) {\n return -1 === e.indexOf(t);\n }));\n // Delete metadata for clients that are no longer considered active.\n return yr.forEach(r, (function(t) {\n return n.delete(t.clientId);\n })).next((function() {\n return r;\n }));\n }));\n })).catch((function() {\n return [];\n })) ]);\n\n case 1:\n // Delete potential leftover entries that may continue to mark the\n // inactive clients as zombied in LocalStorage.\n // Ideally we'd delete the IndexedDb and LocalStorage zombie entries for\n // the client atomically, but we can't. So we opt to delete the IndexedDb\n // entries first to avoid potentially reviving a zombied client.\n if (n = t.sent(), this.Ga) for (r = 0, i = n; r < i.length; r++) o = i[r], this.Ga.removeItem(this.hc(o.clientId));\n t.label = 2;\n\n case 2:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }, \n /**\n * Schedules a recurring timer to update the client metadata and to either\n * extend or acquire the primary lease if the client is eligible.\n */\n e.prototype.Ja = function() {\n var t = this;\n this.qa = this.fn.yn(\"client_metadata_refresh\" /* ClientMetadataRefresh */ , 4e3, (function() {\n return t.za().then((function() {\n return t.ac();\n })).then((function() {\n return t.Ja();\n }));\n }));\n }, \n /** Checks whether `client` is the local client. */ e.prototype.rc = function(t) {\n return !!t && t.ownerId === this.clientId;\n }, \n /**\n * Evaluate the state of all active clients and determine whether the local\n * client is or can act as the holder of the primary lease. Returns whether\n * the client is eligible for the lease, but does not actually acquire it.\n * May return 'false' even if there is no active leaseholder and another\n * (foreground) client should become leaseholder instead.\n */\n e.prototype.nc = function(t) {\n var e = this;\n return this.ka ? yr.resolve(!0) : fo(t).get(qi.key).next((function(n) {\n // A client is eligible for the primary lease if:\n // - its network is enabled and the client's tab is in the foreground.\n // - its network is enabled and no other client's tab is in the\n // foreground.\n // - every clients network is disabled and the client's tab is in the\n // foreground.\n // - every clients network is disabled and no other client's tab is in\n // the foreground.\n // - the `forceOwningTab` setting was passed in.\n if (null !== n && e.cc(n.leaseTimestampMs, 5e3) && !e.lc(n.ownerId)) {\n if (e.rc(n) && e.networkEnabled) return !0;\n if (!e.rc(n)) {\n if (!n.allowTabSynchronization) \n // Fail the `canActAsPrimary` check if the current leaseholder has\n // not opted into multi-tab synchronization. If this happens at\n // client startup, we reject the Promise returned by\n // `enablePersistence()` and the user can continue to use Firestore\n // with in-memory persistence.\n // If this fails during a lease refresh, we will instead block the\n // AsyncQueue from executing further operations. Note that this is\n // acceptable since mixing & matching different `synchronizeTabs`\n // settings is not supported.\n // TODO(b/114226234): Remove this check when `synchronizeTabs` can\n // no longer be turned off.\n throw new c(a.FAILED_PRECONDITION, ao);\n return !1;\n }\n }\n return !(!e.networkEnabled || !e.inForeground) || lo(t).ts().next((function(t) {\n return void 0 === e.uc(t, 5e3).find((function(t) {\n if (e.clientId !== t.clientId) {\n var n = !e.networkEnabled && t.networkEnabled, r = !e.inForeground && t.inForeground, i = e.networkEnabled === t.networkEnabled;\n if (n || r && i) return !0;\n }\n return !1;\n }));\n }));\n })).next((function(t) {\n return e.isPrimary !== t && l(\"IndexedDbPersistence\", \"Client \" + (t ? \"is\" : \"is not\") + \" eligible for a primary lease.\"), \n t;\n }));\n }, e.prototype.Di = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n var e = this;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n // Use `SimpleDb.runTransaction` directly to avoid failing if another tab\n // has obtained the primary lease.\n // The shutdown() operations are idempotent and can be called even when\n // start() aborted (e.g. because it couldn't acquire the persistence lease).\n return this.Oa = !1, this._c(), this.qa && (this.qa.cancel(), this.qa = null), this.fc(), \n this.dc(), [ 4 /*yield*/ , this.ja.runTransaction(\"shutdown\", \"readwrite\", [ qi.store, Zi.store ], (function(t) {\n var n = new co(t, qr.ai);\n return e.sc(n).next((function() {\n return e.oc(n);\n }));\n })) ];\n\n case 1:\n // The shutdown() operations are idempotent and can be called even when\n // start() aborted (e.g. because it couldn't acquire the persistence lease).\n // Use `SimpleDb.runTransaction` directly to avoid failing if another tab\n // has obtained the primary lease.\n return t.sent(), this.ja.close(), \n // Remove the entry marking the client as zombied from LocalStorage since\n // we successfully deleted its metadata from IndexedDb.\n this.wc(), [ 2 /*return*/ ];\n }\n }));\n }));\n }, \n /**\n * Returns clients that are not zombied and have an updateTime within the\n * provided threshold.\n */\n e.prototype.uc = function(t, e) {\n var n = this;\n return t.filter((function(t) {\n return n.cc(t.updateTimeMs, e) && !n.lc(t.clientId);\n }));\n }, \n /**\n * Returns the IDs of the clients that are currently active. If multi-tab\n * is not supported, returns an array that only contains the local client's\n * ID.\n *\n * PORTING NOTE: This is only used for Web multi-tab.\n */\n e.prototype.pi = function() {\n var t = this;\n return this.runTransaction(\"getActiveClients\", \"readonly\", (function(e) {\n return lo(e).ts().next((function(e) {\n return t.uc(e, 18e5).map((function(t) {\n return t.clientId;\n }));\n }));\n }));\n }, Object.defineProperty(e.prototype, \"Ei\", {\n get: function() {\n return this.Oa;\n },\n enumerable: !1,\n configurable: !0\n }), e.prototype.mc = function(t) {\n return Ti.xo(t, this.serializer, this.Dr, this.No);\n }, e.prototype.Tc = function() {\n return this.Ka;\n }, e.prototype.Ec = function() {\n return this.vr;\n }, e.prototype.Ic = function() {\n return this.Dr;\n }, e.prototype.runTransaction = function(t, e, n) {\n var r = this;\n l(\"IndexedDbPersistence\", \"Starting transaction:\", t);\n var i, o = \"readonly\" === e ? \"readonly\" : \"readwrite\";\n // Do all transactions as readwrite against all object stores, since we\n // are the only reader/writer.\n return this.ja.runTransaction(t, o, to, (function(o) {\n return i = new co(o, r.Ma ? r.Ma.next() : qr.ai), \"readwrite-primary\" === e ? r.ec(i).next((function(t) {\n return !!t || r.nc(i);\n })).next((function(e) {\n if (!e) throw p(\"Failed to obtain primary lease for action '\" + t + \"'.\"), r.isPrimary = !1, \n r.fn.Cs((function() {\n return r.Qa(!1);\n })), new c(a.FAILED_PRECONDITION, ti);\n return n(i);\n })).next((function(t) {\n return r.ic(i).next((function() {\n return t;\n }));\n })) : r.Ac(i).next((function() {\n return n(i);\n }));\n })).then((function(t) {\n return i.br(), t;\n }));\n }, \n /**\n * Verifies that the current tab is the primary leaseholder or alternatively\n * that the leaseholder has opted into multi-tab synchronization.\n */\n // TODO(b/114226234): Remove this check when `synchronizeTabs` can no longer\n // be turned off.\n e.prototype.Ac = function(t) {\n var e = this;\n return fo(t).get(qi.key).next((function(t) {\n if (null !== t && e.cc(t.leaseTimestampMs, 5e3) && !e.lc(t.ownerId) && !e.rc(t) && !(e.ka || e.allowTabSynchronization && t.allowTabSynchronization)) throw new c(a.FAILED_PRECONDITION, ao);\n }));\n }, \n /**\n * Obtains or extends the new primary lease for the local client. This\n * method does not verify that the client is eligible for this lease.\n */\n e.prototype.ic = function(t) {\n var e = new qi(this.clientId, this.allowTabSynchronization, Date.now());\n return fo(t).put(qi.key, e);\n }, e.Ln = function() {\n return gr.Ln();\n }, \n /** Checks the primary lease and removes it if we are the current primary. */ e.prototype.sc = function(t) {\n var e = this, n = fo(t);\n return n.get(qi.key).next((function(t) {\n return e.rc(t) ? (l(\"IndexedDbPersistence\", \"Releasing primary lease.\"), n.delete(qi.key)) : yr.resolve();\n }));\n }, \n /** Verifies that `updateTimeMs` is within `maxAgeMs`. */ e.prototype.cc = function(t, e) {\n var n = Date.now();\n return !(t < n - e || t > n && (p(\"Detected an update time that is in the future: \" + t + \" > \" + n), \n 1));\n }, e.prototype.Ha = function() {\n var t = this;\n null !== this.document && \"function\" == typeof this.document.addEventListener && (this.Ba = function() {\n t.fn.ws((function() {\n return t.inForeground = \"visible\" === t.document.visibilityState, t.za();\n }));\n }, this.document.addEventListener(\"visibilitychange\", this.Ba), this.inForeground = \"visible\" === this.document.visibilityState);\n }, e.prototype.fc = function() {\n this.Ba && (this.document.removeEventListener(\"visibilitychange\", this.Ba), this.Ba = null);\n }, \n /**\n * Attaches a window.unload handler that will synchronously write our\n * clientId to a \"zombie client id\" location in LocalStorage. This can be used\n * by tabs trying to acquire the primary lease to determine that the lease\n * is no longer valid even if the timestamp is recent. This is particularly\n * important for the refresh case (so the tab correctly re-acquires the\n * primary lease). LocalStorage is used for this rather than IndexedDb because\n * it is a synchronous API and so can be used reliably from an unload\n * handler.\n */\n e.prototype.Ya = function() {\n var t, e = this;\n \"function\" == typeof (null === (t = this.window) || void 0 === t ? void 0 : t.addEventListener) && (this.La = function() {\n // Note: In theory, this should be scheduled on the AsyncQueue since it\n // accesses internal state. We execute this code directly during shutdown\n // to make sure it gets a chance to run.\n e._c(), e.fn.ws((function() {\n return e.Di();\n }));\n }, this.window.addEventListener(\"unload\", this.La));\n }, e.prototype.dc = function() {\n this.La && (this.window.removeEventListener(\"unload\", this.La), this.La = null);\n }, \n /**\n * Returns whether a client is \"zombied\" based on its LocalStorage entry.\n * Clients become zombied when their tab closes without running all of the\n * cleanup logic in `shutdown()`.\n */\n e.prototype.lc = function(t) {\n var e;\n try {\n var n = null !== (null === (e = this.Ga) || void 0 === e ? void 0 : e.getItem(this.hc(t)));\n return l(\"IndexedDbPersistence\", \"Client '\" + t + \"' \" + (n ? \"is\" : \"is not\") + \" zombied in LocalStorage\"), \n n;\n } catch (t) {\n // Gracefully handle if LocalStorage isn't working.\n return p(\"IndexedDbPersistence\", \"Failed to get zombied client id.\", t), !1;\n }\n }, \n /**\n * Record client as zombied (a client that had its tab closed). Zombied\n * clients are ignored during primary tab selection.\n */\n e.prototype._c = function() {\n if (this.Ga) try {\n this.Ga.setItem(this.hc(this.clientId), String(Date.now()));\n } catch (t) {\n // Gracefully handle if LocalStorage isn't available / working.\n p(\"Failed to set zombie client id.\", t);\n }\n }, \n /** Removes the zombied client entry if it exists. */ e.prototype.wc = function() {\n if (this.Ga) try {\n this.Ga.removeItem(this.hc(this.clientId));\n } catch (t) {\n // Ignore\n }\n }, e.prototype.hc = function(t) {\n return \"firestore_zombie_\" + this.persistenceKey + \"_\" + t;\n }, e;\n}();\n\n/**\n * Oldest acceptable age in milliseconds for client metadata before the client\n * is considered inactive and its associated data is garbage collected.\n */\n/**\n * Helper to get a typed SimpleDbStore for the primary client object store.\n */\nfunction fo(t) {\n return ho.Qn(t, qi.store);\n}\n\n/**\n * Helper to get a typed SimpleDbStore for the client metadata object store.\n */ function lo(t) {\n return ho.Qn(t, Zi.store);\n}\n\n/** Provides LRU functionality for IndexedDB persistence. */ var po = /** @class */ function() {\n function t(t, e) {\n this.db = t, this.wo = new ci(this, e);\n }\n return t.prototype.Po = function(t) {\n var e = this.Rc(t);\n return this.db.Tc().ba(t).next((function(t) {\n return e.next((function(e) {\n return t + e;\n }));\n }));\n }, t.prototype.Rc = function(t) {\n var e = 0;\n return this.Vo(t, (function(t) {\n e++;\n })).next((function() {\n return e;\n }));\n }, t.prototype.Ce = function(t, e) {\n return this.db.Tc().Ce(t, e);\n }, t.prototype.Vo = function(t, e) {\n return this.gc(t, (function(t, n) {\n return e(n);\n }));\n }, t.prototype.Da = function(t, e, n) {\n return vo(t, n);\n }, t.prototype.Na = function(t, e, n) {\n return vo(t, n);\n }, t.prototype.po = function(t, e, n) {\n return this.db.Tc().po(t, e, n);\n }, t.prototype.Go = function(t, e) {\n return vo(t, e);\n }, \n /**\n * Returns true if anything would prevent this document from being garbage\n * collected, given that the document in question is not present in any\n * targets and has a sequence number less than or equal to the upper bound for\n * the collection run.\n */\n t.prototype.Pc = function(t, e) {\n return function(t, e) {\n var n = !1;\n return xi(t).os((function(r) {\n return Ni(t, r, e).next((function(t) {\n return t && (n = !0), yr.resolve(!t);\n }));\n })).next((function() {\n return n;\n }));\n }(t, e);\n }, t.prototype.bo = function(t, e) {\n var n = this, r = this.db.Ec().ra(), i = [], o = 0;\n return this.gc(t, (function(s, u) {\n if (u <= e) {\n var a = n.Pc(t, s).next((function(e) {\n if (!e) \n // Our size accounting requires us to read all documents before\n // removing them.\n return o++, r.Rr(t, s).next((function() {\n return r.Ar(s), uo(t).delete([ 0, hi(s.path) ]);\n }));\n }));\n i.push(a);\n }\n })).next((function() {\n return yr.$n(i);\n })).next((function() {\n return r.apply(t);\n })).next((function() {\n return o;\n }));\n }, t.prototype.removeTarget = function(t, e) {\n var n = e.st(t.xa);\n return this.db.Tc().ya(t, n);\n }, t.prototype.yc = function(t, e) {\n return vo(t, e);\n }, \n /**\n * Call provided function for each document in the cache that is 'orphaned'. Orphaned\n * means not a part of any target, so the only entry in the target-document index for\n * that document will be the sentinel row (targetId 0), which will also have the sequence\n * number for the last time the document was accessed.\n */\n t.prototype.gc = function(t, e) {\n var n, r = uo(t), i = qr.ai;\n return r.rs({\n index: Yi.documentTargetsIndex\n }, (function(t, r) {\n var o = t[0], s = (t[1], r.path), u = r.sequenceNumber;\n 0 === o ? (\n // if nextToReport is valid, report it, this is a new key so the\n // last one must not be a member of any targets.\n i !== qr.ai && e(new A(pi(n)), i), \n // set nextToReport to be this sequence number. It's the next one we\n // might report, if we don't find any targets for this document.\n // Note that the sequence number must be defined when the targetId\n // is 0.\n i = u, n = s) : \n // set nextToReport to be invalid, we know we don't need to report\n // this one since we found a target for it.\n i = qr.ai;\n })).next((function() {\n // Since we report sequence numbers after getting to the next key, we\n // need to check if the last key we iterated over was an orphaned\n // document and report it.\n i !== qr.ai && e(new A(pi(n)), i);\n }));\n }, t.prototype.So = function(t) {\n return this.db.Ec().aa(t);\n }, t;\n}();\n\nfunction vo(t, e) {\n return uo(t).put(\n /**\n * @return A value suitable for writing a sentinel row in the target-document\n * store.\n */\n function(t, e) {\n return new Yi(0, hi(t.path), e);\n }(e, t.xa));\n}\n\n/**\n * Generates a string used as a prefix when storing data in IndexedDB and\n * LocalStorage.\n */ function yo(t, e) {\n // Use two different prefix formats:\n // * firestore / persistenceKey / projectID . databaseID / ...\n // * firestore / persistenceKey / projectID / ...\n // projectIDs are DNS-compatible names and cannot contain dots\n // so there's no danger of collisions.\n var n = t.projectId;\n return t.j || (n += \".\" + t.database), \"firestore/\" + e + \"/\" + n + \"/\"\n /**\n * Implements `LocalStore` interface.\n *\n * Note: some field defined in this class might have public access level, but\n * the class is not exported so they are only accessible from this module.\n * This is useful to implement optional features (like bundles) in free\n * functions, such that they are tree-shakeable.\n */;\n}\n\nvar go = /** @class */ function() {\n function t(\n /** Manages our in-memory or durable persistence. */\n t, e, n) {\n this.persistence = t, this.Vc = e, \n /**\n * Maps a targetID to data about its target.\n *\n * PORTING NOTE: We are using an immutable data structure on Web to make re-runs\n * of `applyRemoteEvent()` idempotent.\n */\n this.bc = new bt(H), \n /** Maps a target to its targetID. */\n // TODO(wuandy): Evaluate if TargetId can be part of Target.\n this.vc = new it((function(t) {\n return lt(t);\n }), pt), \n /**\n * The read time of the last entry processed by `getNewDocumentChanges()`.\n *\n * PORTING NOTE: This is only used for multi-tab synchronization.\n */\n this.Sc = st.min(), this.Sr = t.mc(n), this.Dc = t.Ec(), this.Ka = t.Tc(), this.Cc = new ni(this.Dc, this.Sr, this.persistence.Ic()), \n this.Vc.Nc(this.Cc);\n }\n return t.prototype.Io = function(t) {\n var e = this;\n return this.persistence.runTransaction(\"Collect garbage\", \"readwrite-primary\", (function(n) {\n return t.vo(n, e.bc);\n }));\n }, t;\n}();\n\n/**\n * Acknowledges the given batch.\n *\n * On the happy path when a batch is acknowledged, the local store will\n *\n * + remove the batch from the mutation queue;\n * + apply the changes to the remote document cache;\n * + recalculate the latency compensated view implied by those changes (there\n * may be mutations in the queue that affect the documents but haven't been\n * acknowledged yet); and\n * + give the changed documents back the sync engine\n *\n * @returns The resulting (modified) documents.\n */ function mo(t, e) {\n var n = m(t);\n return n.persistence.runTransaction(\"Acknowledge batch\", \"readwrite-primary\", (function(t) {\n var r = e.batch.keys(), i = n.Dc.ra({\n oa: !0\n });\n return function(t, e, n, r) {\n var i = n.batch, o = i.keys(), s = yr.resolve();\n return o.forEach((function(t) {\n s = s.next((function() {\n return r.Rr(e, t);\n })).next((function(e) {\n var o = e, s = n.dr.get(t);\n g(null !== s), (!o || o.version.L(s) < 0) && ((o = i.cr(t, o, n)) && \n // We use the commitVersion as the readTime rather than the\n // document's updateTime since the updateTime is not advanced\n // for updates that do not modify the underlying document.\n r.Er(o, n._r));\n }));\n })), s.next((function() {\n return t.Sr.Wo(e, i);\n }));\n }(n, t, e, i).next((function() {\n return i.apply(t);\n })).next((function() {\n return n.Sr.zo(t);\n })).next((function() {\n return n.Cc.kr(t, r);\n }));\n }));\n}\n\n/**\n * Removes mutations from the MutationQueue for the specified batch;\n * LocalDocuments will be recalculated.\n *\n * @returns The resulting modified documents.\n */\n/**\n * Returns the last consistent snapshot processed (used by the RemoteStore to\n * determine whether to buffer incoming snapshots from the backend).\n */ function wo(t) {\n var e = m(t);\n return e.persistence.runTransaction(\"Get last remote snapshot version\", \"readonly\", (function(t) {\n return e.Ka.Ea(t);\n }));\n}\n\n/**\n * Updates the \"ground-state\" (remote) documents. We assume that the remote\n * event reflects any write batches that have been acknowledged or rejected\n * (i.e. we do not re-apply local mutations to updates from this event).\n *\n * LocalDocuments are re-calculated if there are remaining mutations in the\n * queue.\n */ function _o(t, e) {\n var n = m(t), r = e.nt, i = n.bc;\n return n.persistence.runTransaction(\"Apply remote event\", \"readwrite-primary\", (function(t) {\n var o = n.Dc.ra({\n oa: !0\n });\n // Reset newTargetDataByTargetMap in case this transaction gets re-run.\n i = n.bc;\n var s = [];\n e.zt.forEach((function(e, o) {\n var u = i.get(o);\n if (u) {\n // Only update the remote keys if the target is still active. This\n // ensures that we can persist the updated target data along with\n // the updated assignment.\n s.push(n.Ka.Ca(t, e.se, o).next((function() {\n return n.Ka.Sa(t, e.ee, o);\n })));\n var a = e.resumeToken;\n // Update the resume token if the change includes one.\n if (a.O() > 0) {\n var c = u.it(a, r).st(t.xa);\n i = i.ot(o, c), \n // Update the target data if there are target changes (or if\n // sufficient time has passed since the last update).\n /**\n * Returns true if the newTargetData should be persisted during an update of\n * an active target. TargetData should always be persisted when a target is\n * being released and should not call this function.\n *\n * While the target is active, TargetData updates can be omitted when nothing\n * about the target has changed except metadata like the resume token or\n * snapshot version. Occasionally it's worth the extra write to prevent these\n * values from getting too stale after a crash, but this doesn't have to be\n * too frequent.\n */\n function(t, e, n) {\n // Always persist target data if we don't already have a resume token.\n return g(e.resumeToken.O() > 0), 0 === t.resumeToken.O() || (\n // Don't allow resume token changes to be buffered indefinitely. This\n // allows us to be reasonably up-to-date after a crash and avoids needing\n // to loop over all active queries on shutdown. Especially in the browser\n // we may not get time to do anything interesting while the current tab is\n // closing.\n e.nt.X() - t.nt.X() >= 3e8 || n.ee.size + n.ne.size + n.se.size > 0);\n }(u, c, e) && s.push(n.Ka.ya(t, c));\n }\n }\n }));\n var u = St(), a = Ot();\n // HACK: The only reason we allow a null snapshot version is so that we\n // can synthesize remote events when we get permission denied errors while\n // trying to resolve the state of a locally cached document that is in\n // limbo.\n if (e.Yt.forEach((function(t, e) {\n a = a.add(t);\n })), \n // Each loop iteration only affects its \"own\" doc, so it's safe to get all the remote\n // documents in advance in a single call.\n s.push(o.getEntries(t, a).next((function(i) {\n e.Yt.forEach((function(a, c) {\n var h = i.get(a);\n // Note: The order of the steps below is important, since we want\n // to ensure that rejected limbo resolutions (which fabricate\n // NoDocuments with SnapshotVersion.min()) never add documents to\n // cache.\n c instanceof Rn && c.version.isEqual(st.min()) ? (\n // NoDocuments with SnapshotVersion.min() are used in manufactured\n // events. We remove these documents from cache since we lost\n // access.\n o.Ar(a, r), u = u.ot(a, c)) : null == h || c.version.L(h.version) > 0 || 0 === c.version.L(h.version) && h.hasPendingWrites ? (o.Er(c, r), \n u = u.ot(a, c)) : l(\"LocalStore\", \"Ignoring outdated watch update for \", a, \". Current version:\", h.version, \" Watch version:\", c.version), \n e.Jt.has(a) && s.push(n.persistence.No.yc(t, a));\n }));\n }))), !r.isEqual(st.min())) {\n var c = n.Ka.Ea(t).next((function(e) {\n return n.Ka.Aa(t, t.xa, r);\n }));\n s.push(c);\n }\n return yr.$n(s).next((function() {\n return o.apply(t);\n })).next((function() {\n return n.Cc.Mr(t, u);\n }));\n })).then((function(t) {\n return n.bc = i, t;\n }));\n}\n\n/**\n * Gets the mutation batch after the passed in batchId in the mutation queue\n * or null if empty.\n * @param afterBatchId If provided, the batch to search after.\n * @returns The next mutation or null if there wasn't one.\n */ function bo(t, e) {\n var n = m(t);\n return n.persistence.runTransaction(\"Get next mutation batch\", \"readonly\", (function(t) {\n return void 0 === e && (e = -1), n.Sr.Bo(t, e);\n }));\n}\n\n/**\n * Reads the current value of a Document with a given key or null if not\n * found - used for testing.\n */\n/**\n * Assigns the given target an internal ID so that its results can be pinned so\n * they don't get GC'd. A target must be allocated in the local store before\n * the store can be used to manage its view.\n *\n * Allocating an already allocated `Target` will return the existing `TargetData`\n * for that `Target`.\n */ function Io(t, e) {\n var n = m(t);\n return n.persistence.runTransaction(\"Allocate target\", \"readwrite\", (function(t) {\n var r;\n return n.Ka.va(t, e).next((function(i) {\n return i ? (\n // This target has been listened to previously, so reuse the\n // previous targetID.\n // TODO(mcg): freshen last accessed date?\n r = i, yr.resolve(r)) : n.Ka.wa(t).next((function(i) {\n return r = new gt(e, i, 0 /* Listen */ , t.xa), n.Ka.Ra(t, r).next((function() {\n return r;\n }));\n }));\n }));\n })).then((function(t) {\n // If Multi-Tab is enabled, the existing target data may be newer than\n // the in-memory data\n var r = n.bc.get(t.targetId);\n return (null === r || t.nt.L(r.nt) > 0) && (n.bc = n.bc.ot(t.targetId, t), n.vc.set(e, t.targetId)), \n t;\n }));\n}\n\n/**\n * Returns the TargetData as seen by the LocalStore, including updates that may\n * have not yet been persisted to the TargetCache.\n */\n// Visible for testing.\n/**\n * Unpins all the documents associated with the given target. If\n * `keepPersistedTargetData` is set to false and Eager GC enabled, the method\n * directly removes the associated target data from the target cache.\n *\n * Releasing a non-existing `Target` is a no-op.\n */\n// PORTING NOTE: `keepPersistedTargetData` is multi-tab only.\nfunction Eo(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o, s, u;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n i = m(e), o = i.bc.get(n), s = r ? \"readwrite\" : \"readwrite-primary\", t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 4, , 5 ]), r ? [ 3 /*break*/ , 3 ] : [ 4 /*yield*/ , i.persistence.runTransaction(\"Release target\", s, (function(t) {\n return i.persistence.No.removeTarget(t, o);\n })) ];\n\n case 2:\n t.sent(), t.label = 3;\n\n case 3:\n return [ 3 /*break*/ , 5 ];\n\n case 4:\n if (!_r(u = t.sent())) throw u;\n // All `releaseTarget` does is record the final metadata state for the\n // target, but we've been recording this periodically during target\n // activity. If we lose this write this could cause a very slight\n // difference in the order of target deletion during GC, but we\n // don't define exact LRU semantics so this is acceptable.\n return l(\"LocalStore\", \"Failed to update sequence numbers for target \" + n + \": \" + u), \n [ 3 /*break*/ , 5 ];\n\n case 5:\n return i.bc = i.bc.remove(n), i.vc.delete(o.target), [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Runs the specified query against the local store and returns the results,\n * potentially taking advantage of query data from previous executions (such\n * as the set of remote keys).\n *\n * @param usePreviousResults Whether results from previous executions can\n * be used to optimize this query execution.\n */ function To(t, e, n) {\n var r = m(t), i = st.min(), o = Ot();\n return r.persistence.runTransaction(\"Execute query\", \"readonly\", (function(t) {\n return function(t, e, n) {\n var r = m(t), i = r.vc.get(n);\n return void 0 !== i ? yr.resolve(r.bc.get(i)) : r.Ka.va(e, n);\n }(r, t, zn(e)).next((function(e) {\n if (e) return i = e.lastLimboFreeSnapshotVersion, r.Ka.Fa(t, e.targetId).next((function(t) {\n o = t;\n }));\n })).next((function() {\n return r.Vc.Lr(t, e, n ? i : st.min(), n ? o : Ot());\n })).next((function(t) {\n return {\n documents: t,\n Fc: o\n };\n }));\n }));\n}\n\n// PORTING NOTE: Multi-Tab only.\nfunction No(t, e) {\n var n = m(t), r = m(n.Ka), i = n.bc.get(e);\n return i ? Promise.resolve(i.target) : n.persistence.runTransaction(\"Get target data\", \"readonly\", (function(t) {\n return r.Ue(t, e).next((function(t) {\n return t ? t.target : null;\n }));\n }));\n}\n\n/**\n * Returns the set of documents that have been updated since the last call.\n * If this is the first call, returns the set of changes since client\n * initialization. Further invocations will return document that have changed\n * since the prior call.\n */\n// PORTING NOTE: Multi-Tab only.\nfunction Ao(t) {\n var e = m(t);\n return e.persistence.runTransaction(\"Get new document changes\", \"readonly\", (function(t) {\n return function(t, e, n) {\n var r = m(t), i = St(), o = gi(n), s = Oi(e), u = IDBKeyRange.lowerBound(o, !0);\n return s.rs({\n index: Ki.readTimeIndex,\n range: u\n }, (function(t, e) {\n // Unlike `getEntry()` and others, `getNewDocumentChanges()` parses\n // the documents directly since we want to keep sentinel deletes.\n var n = vi(r.serializer, e);\n i = i.ot(n.key, n), o = e.readTime;\n })).next((function() {\n return {\n xc: i,\n readTime: mi(o)\n };\n }));\n }(e.Dc, t, e.Sc);\n })).then((function(t) {\n var n = t.xc, r = t.readTime;\n return e.Sc = r, n;\n }));\n}\n\n/**\n * Reads the newest document change from persistence and moves the internal\n * synchronization marker forward so that calls to `getNewDocumentChanges()`\n * only return changes that happened after client initialization.\n */\n// PORTING NOTE: Multi-Tab only.\nfunction So(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n;\n return t.__generator(this, (function(t) {\n return [ 2 /*return*/ , (n = m(e)).persistence.runTransaction(\"Synchronize last document change read time\", \"readonly\", (function(t) {\n return function(t) {\n var e = Oi(t), n = st.min();\n // If there are no existing entries, we return SnapshotVersion.min().\n return e.rs({\n index: Ki.readTimeIndex,\n reverse: !0\n }, (function(t, e, r) {\n e.readTime && (n = mi(e.readTime)), r.done();\n })).next((function() {\n return n;\n }));\n }(t);\n })).then((function(t) {\n n.Sc = t;\n })) ];\n }));\n }));\n}\n\n/**\n * Verifies the error thrown by a LocalStore operation. If a LocalStore\n * operation fails because the primary lease has been taken by another client,\n * we ignore the error (the persistence layer will immediately call\n * `applyPrimaryLease` to propagate the primary state change). All other errors\n * are re-thrown.\n *\n * @param err An error returned by a LocalStore operation.\n * @return A Promise that resolves after we recovered, or the original error.\n */ function Do(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n if (e.code !== a.FAILED_PRECONDITION || e.message !== ti) throw e;\n return l(\"LocalStore\", \"Unexpectedly lost primary lease\"), [ 2 /*return*/ ];\n }));\n }));\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A collection of references to a document from some kind of numbered entity\n * (either a target ID or batch ID). As references are added to or removed from\n * the set corresponding events are emitted to a registered garbage collector.\n *\n * Each reference is represented by a DocumentReference object. Each of them\n * contains enough information to uniquely identify the reference. They are all\n * stored primarily in a set sorted by key. A document is considered garbage if\n * there's no references in that set (this can be efficiently checked thanks to\n * sorting by key).\n *\n * ReferenceSet also keeps a secondary set that contains references sorted by\n * IDs. This one is used to efficiently implement removal of all references by\n * some target ID.\n */ var xo = /** @class */ function() {\n function t() {\n // A set of outstanding references to a document sorted by key.\n this.$c = new Tt(Lo.kc), \n // A set of outstanding references to a document sorted by target id.\n this.Mc = new Tt(Lo.Oc)\n /** Returns true if the reference set contains no references. */;\n }\n return t.prototype.m = function() {\n return this.$c.m();\n }, \n /** Adds a reference to the given document key for the given ID. */ t.prototype.Da = function(t, e) {\n var n = new Lo(t, e);\n this.$c = this.$c.add(n), this.Mc = this.Mc.add(n);\n }, \n /** Add references to the given document keys for the given ID. */ t.prototype.Lc = function(t, e) {\n var n = this;\n t.forEach((function(t) {\n return n.Da(t, e);\n }));\n }, \n /**\n * Removes a reference to the given document key for the given\n * ID.\n */\n t.prototype.Na = function(t, e) {\n this.Bc(new Lo(t, e));\n }, t.prototype.qc = function(t, e) {\n var n = this;\n t.forEach((function(t) {\n return n.Na(t, e);\n }));\n }, \n /**\n * Clears all references with a given ID. Calls removeRef() for each key\n * removed.\n */\n t.prototype.Uc = function(t) {\n var e = this, n = new A(new E([])), r = new Lo(n, t), i = new Lo(n, t + 1), o = [];\n return this.Mc.Ft([ r, i ], (function(t) {\n e.Bc(t), o.push(t.key);\n })), o;\n }, t.prototype.Qc = function() {\n var t = this;\n this.$c.forEach((function(e) {\n return t.Bc(e);\n }));\n }, t.prototype.Bc = function(t) {\n this.$c = this.$c.delete(t), this.Mc = this.Mc.delete(t);\n }, t.prototype.Wc = function(t) {\n var e = new A(new E([])), n = new Lo(e, t), r = new Lo(e, t + 1), i = Ot();\n return this.Mc.Ft([ n, r ], (function(t) {\n i = i.add(t.key);\n })), i;\n }, t.prototype.Ho = function(t) {\n var e = new Lo(t, 0), n = this.$c.$t(e);\n return null !== n && t.isEqual(n.key);\n }, t;\n}(), Lo = /** @class */ function() {\n function t(t, e) {\n this.key = t, this.jc = e\n /** Compare by key then by ID */;\n }\n return t.kc = function(t, e) {\n return A.i(t.key, e.key) || H(t.jc, e.jc);\n }, \n /** Compare by ID then by key */ t.Oc = function(t, e) {\n return H(t.jc, e.jc) || A.i(t.key, e.key);\n }, t;\n}(), ko = function(t, e) {\n this.user = e, this.type = \"OAuth\", this.Kc = {}, \n // Set the headers using Object Literal notation to avoid minification\n this.Kc.Authorization = \"Bearer \" + t;\n}, Ro = /** @class */ function() {\n function t() {\n /**\n * Stores the listener registered with setChangeListener()\n * This isn't actually necessary since the UID never changes, but we use this\n * to verify the listen contract is adhered to in tests.\n */\n this.Gc = null;\n }\n return t.prototype.getToken = function() {\n return Promise.resolve(null);\n }, t.prototype.zc = function() {}, t.prototype.Hc = function(t) {\n this.Gc = t, \n // Fire with initial user.\n t(Mr.UNAUTHENTICATED);\n }, t.prototype.Yc = function() {\n this.Gc = null;\n }, t;\n}(), Oo = /** @class */ function() {\n function t(t) {\n var e = this;\n /**\n * The auth token listener registered with FirebaseApp, retained here so we\n * can unregister it.\n */ this.Jc = null, \n /** Tracks the current User. */\n this.currentUser = Mr.UNAUTHENTICATED, this.Xc = !1, \n /**\n * Counter used to detect if the token changed while a getToken request was\n * outstanding.\n */\n this.Zc = 0, \n /** The listener registered with setChangeListener(). */\n this.Gc = null, this.forceRefresh = !1, this.Jc = function() {\n e.Zc++, e.currentUser = e.tu(), e.Xc = !0, e.Gc && e.Gc(e.currentUser);\n }, this.Zc = 0, this.auth = t.getImmediate({\n optional: !0\n }), this.auth ? this.auth.addAuthTokenListener(this.Jc) : (\n // if auth is not available, invoke tokenListener once with null token\n this.Jc(null), t.get().then((function(t) {\n e.auth = t, e.Jc && \n // tokenListener can be removed by removeChangeListener()\n e.auth.addAuthTokenListener(e.Jc);\n }), (function() {})));\n }\n return t.prototype.getToken = function() {\n var t = this, e = this.Zc, n = this.forceRefresh;\n // Take note of the current value of the tokenCounter so that this method\n // can fail (with an ABORTED error) if there is a token change while the\n // request is outstanding.\n return this.forceRefresh = !1, this.auth ? this.auth.getToken(n).then((function(n) {\n // Cancel the request since the token changed while the request was\n // outstanding so the response is potentially for a previous user (which\n // user, we can't be sure).\n return t.Zc !== e ? (l(\"FirebaseCredentialsProvider\", \"getToken aborted due to token change.\"), \n t.getToken()) : n ? (g(\"string\" == typeof n.accessToken), new ko(n.accessToken, t.currentUser)) : null;\n })) : Promise.resolve(null);\n }, t.prototype.zc = function() {\n this.forceRefresh = !0;\n }, t.prototype.Hc = function(t) {\n this.Gc = t, \n // Fire the initial event\n this.Xc && t(this.currentUser);\n }, t.prototype.Yc = function() {\n this.auth && this.auth.removeAuthTokenListener(this.Jc), this.Jc = null, this.Gc = null;\n }, \n // Auth.getUid() can return null even with a user logged in. It is because\n // getUid() is synchronous, but the auth code populating Uid is asynchronous.\n // This method should only be called in the AuthTokenListener callback\n // to guarantee to get the actual user.\n t.prototype.tu = function() {\n var t = this.auth && this.auth.getUid();\n return g(null === t || \"string\" == typeof t), new Mr(t);\n }, t;\n}(), Po = /** @class */ function() {\n function t(t, e) {\n this.eu = t, this.nu = e, this.type = \"FirstParty\", this.user = Mr.ni;\n }\n return Object.defineProperty(t.prototype, \"Kc\", {\n get: function() {\n var t = {\n \"X-Goog-AuthUser\": this.nu\n }, e = this.eu.auth.getAuthHeaderValueForFirstParty([]);\n // Use array notation to prevent minification\n return e && (t.Authorization = e), t;\n },\n enumerable: !1,\n configurable: !0\n }), t;\n}(), Vo = /** @class */ function() {\n function t(t, e) {\n this.eu = t, this.nu = e;\n }\n return t.prototype.getToken = function() {\n return Promise.resolve(new Po(this.eu, this.nu));\n }, t.prototype.Hc = function(t) {\n // Fire with initial uid.\n t(Mr.ni);\n }, t.prototype.Yc = function() {}, t.prototype.zc = function() {}, t;\n}(), Uo = /** @class */ function() {\n function e(t, e, n, r, i, o) {\n this.fn = t, this.su = n, this.iu = r, this.ru = i, this.listener = o, this.state = 0 /* Initial */ , \n /**\n * A close count that's incremented every time the stream is closed; used by\n * getCloseGuardedDispatcher() to invalidate callbacks that happen after\n * close.\n */\n this.ou = 0, this.au = null, this.stream = null, this.ys = new vr(t, e)\n /**\n * Returns true if start() has been called and no error has occurred. True\n * indicates the stream is open or in the process of opening (which\n * encompasses respecting backoff, getting auth tokens, and starting the\n * actual RPC). Use isOpen() to determine if the stream is open and ready for\n * outbound requests.\n */;\n }\n return e.prototype.cu = function() {\n return 1 /* Starting */ === this.state || 2 /* Open */ === this.state || 4 /* Backoff */ === this.state;\n }, \n /**\n * Returns true if the underlying RPC is open (the onOpen() listener has been\n * called) and the stream is ready for outbound requests.\n */\n e.prototype.uu = function() {\n return 2 /* Open */ === this.state;\n }, \n /**\n * Starts the RPC. Only allowed if isStarted() returns false. The stream is\n * not immediately ready for use: onOpen() will be invoked when the RPC is\n * ready for outbound requests, at which point isOpen() will return true.\n *\n * When start returns, isStarted() will return true.\n */\n e.prototype.start = function() {\n 3 /* Error */ !== this.state ? this.auth() : this.hu();\n }, \n /**\n * Stops the RPC. This call is idempotent and allowed regardless of the\n * current isStarted() state.\n *\n * When stop returns, isStarted() and isOpen() will both return false.\n */\n e.prototype.stop = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return this.cu() ? [ 4 /*yield*/ , this.close(0 /* Initial */) ] : [ 3 /*break*/ , 2 ];\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }, \n /**\n * After an error the stream will usually back off on the next attempt to\n * start it. If the error warrants an immediate restart of the stream, the\n * sender can use this to indicate that the receiver should not back off.\n *\n * Each error will call the onClose() listener. That function can decide to\n * inhibit backoff if required.\n */\n e.prototype.lu = function() {\n this.state = 0 /* Initial */ , this.ys.reset();\n }, \n /**\n * Marks this stream as idle. If no further actions are performed on the\n * stream for one minute, the stream will automatically close itself and\n * notify the stream's onClose() handler with Status.OK. The stream will then\n * be in a !isStarted() state, requiring the caller to start the stream again\n * before further use.\n *\n * Only streams that are in state 'Open' can be marked idle, as all other\n * states imply pending network operations.\n */\n e.prototype._u = function() {\n var t = this;\n // Starts the idle time if we are in state 'Open' and are not yet already\n // running a timer (in which case the previous idle timeout still applies).\n this.uu() && null === this.au && (this.au = this.fn.yn(this.su, 6e4, (function() {\n return t.fu();\n })));\n }, \n /** Sends a message to the underlying stream. */ e.prototype.du = function(t) {\n this.wu(), this.stream.send(t);\n }, \n /** Called by the idle timer when the stream should close due to inactivity. */ e.prototype.fu = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return this.uu() ? [ 2 /*return*/ , this.close(0 /* Initial */) ] : [ 2 /*return*/ ];\n }));\n }));\n }, \n /** Marks the stream as active again. */ e.prototype.wu = function() {\n this.au && (this.au.cancel(), this.au = null);\n }, \n /**\n * Closes the stream and cleans up as necessary:\n *\n * * closes the underlying GRPC stream;\n * * calls the onClose handler with the given 'error';\n * * sets internal stream state to 'finalState';\n * * adjusts the backoff timer based on the error\n *\n * A new stream can be opened by calling start().\n *\n * @param finalState the intended state of the stream after closing.\n * @param error the error the connection was closed with.\n */\n e.prototype.close = function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n // Notify the listener that the stream closed.\n // Cancel any outstanding timers (they're guaranteed not to execute).\n return this.wu(), this.ys.cancel(), \n // Invalidates any stream-related callbacks (e.g. from auth or the\n // underlying stream), guaranteeing they won't execute.\n this.ou++, 3 /* Error */ !== e ? \n // If this is an intentional close ensure we don't delay our next connection attempt.\n this.ys.reset() : n && n.code === a.RESOURCE_EXHAUSTED ? (\n // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)\n p(n.toString()), p(\"Using maximum backoff delay to prevent overloading the backend.\"), \n this.ys.Rn()) : n && n.code === a.UNAUTHENTICATED && \n // \"unauthenticated\" error means the token was rejected. Try force refreshing it in case it\n // just expired.\n this.ru.zc(), \n // Clean up the underlying stream because we are no longer interested in events.\n null !== this.stream && (this.mu(), this.stream.close(), this.stream = null), \n // This state must be assigned before calling onClose() to allow the callback to\n // inhibit backoff or otherwise manipulate the state in its non-started state.\n this.state = e, [ 4 /*yield*/ , this.listener.Tu(n) ];\n\n case 1:\n // Cancel any outstanding timers (they're guaranteed not to execute).\n // Notify the listener that the stream closed.\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }, \n /**\n * Can be overridden to perform additional cleanup before the stream is closed.\n * Calling super.tearDown() is not required.\n */\n e.prototype.mu = function() {}, e.prototype.auth = function() {\n var t = this;\n this.state = 1 /* Starting */;\n var e = this.Eu(this.ou), n = this.ou;\n // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.\n this.ru.getToken().then((function(e) {\n // Stream can be stopped while waiting for authentication.\n // TODO(mikelehen): We really should just use dispatchIfNotClosed\n // and let this dispatch onto the queue, but that opened a spec test can\n // of worms that I don't want to deal with in this PR.\n t.ou === n && \n // Normally we'd have to schedule the callback on the AsyncQueue.\n // However, the following calls are safe to be called outside the\n // AsyncQueue since they don't chain asynchronous calls\n t.Iu(e);\n }), (function(n) {\n e((function() {\n var e = new c(a.UNKNOWN, \"Fetching auth token failed: \" + n.message);\n return t.Au(e);\n }));\n }));\n }, e.prototype.Iu = function(t) {\n var e = this, n = this.Eu(this.ou);\n this.stream = this.Ru(t), this.stream.gu((function() {\n n((function() {\n return e.state = 2 /* Open */ , e.listener.gu();\n }));\n })), this.stream.Tu((function(t) {\n n((function() {\n return e.Au(t);\n }));\n })), this.stream.onMessage((function(t) {\n n((function() {\n return e.onMessage(t);\n }));\n }));\n }, e.prototype.hu = function() {\n var e = this;\n this.state = 4 /* Backoff */ , this.ys.gn((function() {\n return t.__awaiter(e, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return this.state = 0 /* Initial */ , this.start(), [ 2 /*return*/ ];\n }));\n }));\n }));\n }, \n // Visible for tests\n e.prototype.Au = function(t) {\n // In theory the stream could close cleanly, however, in our current model\n // we never expect this to happen because if we stop a stream ourselves,\n // this callback will never be called. To prevent cases where we retry\n // without a backoff accidentally, we set the stream to error in all cases.\n return l(\"PersistentStream\", \"close with error: \" + t), this.stream = null, this.close(3 /* Error */ , t);\n }, \n /**\n * Returns a \"dispatcher\" function that dispatches operations onto the\n * AsyncQueue but only runs them if closeCount remains unchanged. This allows\n * us to turn auth / stream callbacks into no-ops if the stream is closed /\n * re-opened, etc.\n */\n e.prototype.Eu = function(t) {\n var e = this;\n return function(n) {\n e.fn.ws((function() {\n return e.ou === t ? n() : (l(\"PersistentStream\", \"stream callback skipped by getCloseGuardedDispatcher.\"), \n Promise.resolve());\n }));\n };\n }, e;\n}(), Co = /** @class */ function(e) {\n function n(t, n, r, i, o) {\n var s = this;\n return (s = e.call(this, t, \"listen_stream_connection_backoff\" /* ListenStreamConnectionBackoff */ , \"listen_stream_idle\" /* ListenStreamIdle */ , n, r, o) || this).serializer = i, \n s;\n }\n return t.__extends(n, e), n.prototype.Ru = function(t) {\n return this.iu.Pu(\"Listen\", t);\n }, n.prototype.onMessage = function(t) {\n // A successful response means the stream is healthy\n this.ys.reset();\n var e = function(t, e) {\n var n;\n if (\"targetChange\" in e) {\n e.targetChange;\n // proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE'\n // if unset\n var r = function(t) {\n return \"NO_CHANGE\" === t ? 0 /* NoChange */ : \"ADD\" === t ? 1 /* Added */ : \"REMOVE\" === t ? 2 /* Removed */ : \"CURRENT\" === t ? 3 /* Current */ : \"RESET\" === t ? 4 /* Reset */ : y();\n }(e.targetChange.targetChangeType || \"NO_CHANGE\"), i = e.targetChange.targetIds || [], o = function(t, e) {\n return t.Qe ? (g(void 0 === e || \"string\" == typeof e), X.fromBase64String(e || \"\")) : (g(void 0 === e || e instanceof Uint8Array), \n X.fromUint8Array(e || new Uint8Array));\n }(t, e.targetChange.resumeToken), s = e.targetChange.cause, u = s && function(t) {\n var e = void 0 === t.code ? a.UNKNOWN : _t(t.code);\n return new c(e, t.message || \"\");\n }(s);\n n = new zt(r, i, o, u || null);\n } else if (\"documentChange\" in e) {\n e.documentChange;\n var h = e.documentChange;\n h.document, h.document.name, h.document.updateTime;\n var f = Se(t, h.document.name), l = Ee(h.document.updateTime), p = new Sn({\n mapValue: {\n fields: h.document.fields\n }\n }), d = new kn(f, l, p, {}), v = h.targetIds || [], m = h.removedTargetIds || [];\n n = new jt(v, m, d.key, d);\n } else if (\"documentDelete\" in e) {\n e.documentDelete;\n var w = e.documentDelete;\n w.document;\n var _ = Se(t, w.document), b = w.readTime ? Ee(w.readTime) : st.min(), I = new Rn(_, b), E = w.removedTargetIds || [];\n n = new jt([], E, I.key, I);\n } else if (\"documentRemove\" in e) {\n e.documentRemove;\n var T = e.documentRemove;\n T.document;\n var N = Se(t, T.document), A = T.removedTargetIds || [];\n n = new jt([], A, N, null);\n } else {\n if (!(\"filter\" in e)) return y();\n e.filter;\n var S = e.filter;\n S.targetId;\n var D = S.count || 0, x = new mt(D), L = S.targetId;\n n = new Gt(L, x);\n }\n return n;\n }(this.serializer, t), n = function(t) {\n // We have only reached a consistent snapshot for the entire stream if there\n // is a read_time set and it applies to all targets (i.e. the list of\n // targets is empty). The backend is guaranteed to send such responses.\n if (!(\"targetChange\" in t)) return st.min();\n var e = t.targetChange;\n return e.targetIds && e.targetIds.length ? st.min() : e.readTime ? Ee(e.readTime) : st.min();\n }(t);\n return this.listener.yu(e, n);\n }, \n /**\n * Registers interest in the results of the given target. If the target\n * includes a resumeToken it will be included in the request. Results that\n * affect the target will be streamed back as WatchChange messages that\n * reference the targetId.\n */\n n.prototype.Vu = function(t) {\n var e = {};\n e.database = Le(this.serializer), e.addTarget = function(t, e) {\n var n, r = e.target;\n return (n = dt(r) ? {\n documents: Ve(t, r)\n } : {\n query: Ue(t, r)\n }).targetId = e.targetId, e.resumeToken.O() > 0 && (n.resumeToken = be(t, e.resumeToken)), \n n;\n }(this.serializer, t);\n var n = function(t, e) {\n var n = function(t, e) {\n switch (e) {\n case 0 /* Listen */ :\n return null;\n\n case 1 /* ExistenceFilterMismatch */ :\n return \"existence-filter-mismatch\";\n\n case 2 /* LimboResolution */ :\n return \"limbo-document\";\n\n default:\n return y();\n }\n }(0, e.et);\n return null == n ? null : {\n \"goog-listen-tags\": n\n };\n }(this.serializer, t);\n n && (e.labels = n), this.du(e);\n }, \n /**\n * Unregisters interest in the results of the target associated with the\n * given targetId.\n */\n n.prototype.pu = function(t) {\n var e = {};\n e.database = Le(this.serializer), e.removeTarget = t, this.du(e);\n }, n;\n}(Uo), Fo = /** @class */ function(e) {\n function n(t, n, r, i, o) {\n var s = this;\n return (s = e.call(this, t, \"write_stream_connection_backoff\" /* WriteStreamConnectionBackoff */ , \"write_stream_idle\" /* WriteStreamIdle */ , n, r, o) || this).serializer = i, \n s.bu = !1, s;\n }\n return t.__extends(n, e), Object.defineProperty(n.prototype, \"vu\", {\n /**\n * Tracks whether or not a handshake has been successfully exchanged and\n * the stream is ready to accept mutations.\n */\n get: function() {\n return this.bu;\n },\n enumerable: !1,\n configurable: !0\n }), \n // Override of PersistentStream.start\n n.prototype.start = function() {\n this.bu = !1, this.lastStreamToken = void 0, e.prototype.start.call(this);\n }, n.prototype.mu = function() {\n this.bu && this.Su([]);\n }, n.prototype.Ru = function(t) {\n return this.iu.Pu(\"Write\", t);\n }, n.prototype.onMessage = function(t) {\n if (\n // Always capture the last stream token.\n g(!!t.streamToken), this.lastStreamToken = t.streamToken, this.bu) {\n // A successful first write response means the stream is healthy,\n // Note, that we could consider a successful handshake healthy, however,\n // the write itself might be causing an error we want to back off from.\n this.ys.reset();\n var e = function(t, e) {\n return t && t.length > 0 ? (g(void 0 !== e), t.map((function(t) {\n return function(t, e) {\n // NOTE: Deletes don't have an updateTime.\n var n = t.updateTime ? Ee(t.updateTime) : Ee(e);\n n.isEqual(st.min()) && (\n // The Firestore Emulator currently returns an update time of 0 for\n // deletes of non-existing documents (rather than null). This breaks the\n // test \"get deleted doc while offline with source=cache\" as NoDocuments\n // with version 0 are filtered by IndexedDb's RemoteDocumentCache.\n // TODO(#2149): Remove this when Emulator is fixed\n n = Ee(e));\n var r = null;\n return t.transformResults && t.transformResults.length > 0 && (r = t.transformResults), \n new hn(n, r);\n }(t, e);\n }))) : [];\n }(t.writeResults, t.commitTime), n = Ee(t.commitTime);\n return this.listener.Du(n, e);\n }\n // The first response is always the handshake response\n return g(!t.writeResults || 0 === t.writeResults.length), this.bu = !0, \n this.listener.Cu();\n }, \n /**\n * Sends an initial streamToken to the server, performing the handshake\n * required to make the StreamingWrite RPC work. Subsequent\n * calls should wait until onHandshakeComplete was called.\n */\n n.prototype.Nu = function() {\n // TODO(dimond): Support stream resumption. We intentionally do not set the\n // stream token on the handshake, ignoring any stream token we might have.\n var t = {};\n t.database = Le(this.serializer), this.du(t);\n }, \n /** Sends a group of mutations to the Firestore backend to apply. */ n.prototype.Su = function(t) {\n var e = this, n = {\n streamToken: this.lastStreamToken,\n writes: t.map((function(t) {\n return Oe(e.serializer, t);\n }))\n };\n this.du(n);\n }, n;\n}(Uo), Mo = /** @class */ function(e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this) || this).credentials = t, i.iu = n, i.serializer = r, i.Fu = !1, \n i;\n }\n return t.__extends(n, e), n.prototype.xu = function() {\n if (this.Fu) throw new c(a.FAILED_PRECONDITION, \"The client has already been terminated.\");\n }, \n /** Gets an auth token and invokes the provided RPC. */ n.prototype.$u = function(t, e, n) {\n var r = this;\n return this.xu(), this.credentials.getToken().then((function(i) {\n return r.iu.$u(t, e, n, i);\n })).catch((function(t) {\n throw t.code === a.UNAUTHENTICATED && r.credentials.zc(), t;\n }));\n }, \n /** Gets an auth token and invokes the provided RPC with streamed results. */ n.prototype.ku = function(t, e, n) {\n var r = this;\n return this.xu(), this.credentials.getToken().then((function(i) {\n return r.iu.ku(t, e, n, i);\n })).catch((function(t) {\n throw t.code === a.UNAUTHENTICATED && r.credentials.zc(), t;\n }));\n }, n.prototype.terminate = function() {\n this.Fu = !1;\n }, n;\n}((function() {})), qo = /** @class */ function() {\n function t(t, e) {\n this.cs = t, this.di = e, \n /** The current OnlineState. */\n this.state = \"Unknown\" /* Unknown */ , \n /**\n * A count of consecutive failures to open the stream. If it reaches the\n * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to\n * Offline.\n */\n this.Mu = 0, \n /**\n * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we\n * transition from OnlineState.Unknown to OnlineState.Offline without waiting\n * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times).\n */\n this.Ou = null, \n /**\n * Whether the client should log a warning message if it fails to connect to\n * the backend (initially true, cleared after a successful stream, or if we've\n * logged the message already).\n */\n this.Lu = !0\n /**\n * Called by RemoteStore when a watch stream is started (including on each\n * backoff attempt).\n *\n * If this is the first attempt, it sets the OnlineState to Unknown and starts\n * the onlineStateTimer.\n */;\n }\n return t.prototype.Bu = function() {\n var t = this;\n 0 === this.Mu && (this.qu(\"Unknown\" /* Unknown */), this.Ou = this.cs.yn(\"online_state_timeout\" /* OnlineStateTimeout */ , 1e4, (function() {\n return t.Ou = null, t.Uu(\"Backend didn't respond within 10 seconds.\"), t.qu(\"Offline\" /* Offline */), \n Promise.resolve();\n })));\n }, \n /**\n * Updates our OnlineState as appropriate after the watch stream reports a\n * failure. The first failure moves us to the 'Unknown' state. We then may\n * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we\n * actually transition to the 'Offline' state.\n */\n t.prototype.Qu = function(t) {\n \"Online\" /* Online */ === this.state ? this.qu(\"Unknown\" /* Unknown */) : (this.Mu++, \n this.Mu >= 1 && (this.Wu(), this.Uu(\"Connection failed 1 times. Most recent error: \" + t.toString()), \n this.qu(\"Offline\" /* Offline */)));\n }, \n /**\n * Explicitly sets the OnlineState to the specified state.\n *\n * Note that this resets our timers / failure counters, etc. used by our\n * Offline heuristics, so must not be used in place of\n * handleWatchStreamStart() and handleWatchStreamFailure().\n */\n t.prototype.set = function(t) {\n this.Wu(), this.Mu = 0, \"Online\" /* Online */ === t && (\n // We've connected to watch at least once. Don't warn the developer\n // about being offline going forward.\n this.Lu = !1), this.qu(t);\n }, t.prototype.qu = function(t) {\n t !== this.state && (this.state = t, this.di(t));\n }, t.prototype.Uu = function(t) {\n var e = \"Could not reach Cloud Firestore backend. \" + t + \"\\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.\";\n this.Lu ? (p(e), this.Lu = !1) : l(\"OnlineStateTracker\", e);\n }, t.prototype.Wu = function() {\n null !== this.Ou && (this.Ou.cancel(), this.Ou = null);\n }, t;\n}(), jo = function(\n/**\n * The local store, used to fill the write pipeline with outbound mutations.\n */\ne, \n/** The client-side proxy for interacting with the backend. */\nn, r, i, o) {\n var s = this;\n this.ju = e, this.Ku = n, this.cs = r, this.Gu = {}, \n /**\n * A list of up to MAX_PENDING_WRITES writes that we have fetched from the\n * LocalStore via fillWritePipeline() and have or will send to the write\n * stream.\n *\n * Whenever writePipeline.length > 0 the RemoteStore will attempt to start or\n * restart the write stream. When the stream is established the writes in the\n * pipeline will be sent in order.\n *\n * Writes remain in writePipeline until they are acknowledged by the backend\n * and thus will automatically be re-sent if the stream is interrupted /\n * restarted before they're acknowledged.\n *\n * Write responses from the backend are linked to their originating request\n * purely based on order, and so we can just shift() writes from the front of\n * the writePipeline as we receive responses.\n */\n this.zu = [], \n /**\n * A mapping of watched targets that the client cares about tracking and the\n * user has explicitly called a 'listen' for this target.\n *\n * These targets may or may not have been sent to or acknowledged by the\n * server. On re-establishing the listen stream, these targets should be sent\n * to the server. The targets removed with unlistens are removed eagerly\n * without waiting for confirmation from the listen stream.\n */\n this.Hu = new Map, \n /**\n * A set of reasons for why the RemoteStore may be offline. If empty, the\n * RemoteStore may start its network connections.\n */\n this.Yu = new Set, \n /**\n * Event handlers that get called when the network is disabled or enabled.\n *\n * PORTING NOTE: These functions are used on the Web client to create the\n * underlying streams (to support tree-shakeable streams). On Android and iOS,\n * the streams are created during construction of RemoteStore.\n */\n this.Ju = [], this.Xu = o, this.Xu.Zu((function(e) {\n r.ws((function() {\n return t.__awaiter(s, void 0, void 0, (function() {\n return t.__generator(this, (function(e) {\n switch (e.label) {\n case 0:\n return Xo(this) ? (l(\"RemoteStore\", \"Restarting streams for network reachability change.\"), \n [ 4 /*yield*/ , function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return (n = m(e)).Yu.add(4 /* ConnectivityChange */), [ 4 /*yield*/ , zo(n) ];\n\n case 1:\n return t.sent(), n.th.set(\"Unknown\" /* Unknown */), n.Yu.delete(4 /* ConnectivityChange */), \n [ 4 /*yield*/ , Go(n) ];\n\n case 2:\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }(this) ]) : [ 3 /*break*/ , 2 ];\n\n case 1:\n e.sent(), e.label = 2;\n\n case 2:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }));\n })), this.th = new qo(r, i);\n};\n\nfunction Go(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n if (!Xo(e)) return [ 3 /*break*/ , 4 ];\n n = 0, r = e.Ju, t.label = 1;\n\n case 1:\n return n < r.length ? [ 4 /*yield*/ , (0, r[n])(/* enabled= */ !0) ] : [ 3 /*break*/ , 4 ];\n\n case 2:\n t.sent(), t.label = 3;\n\n case 3:\n return n++, [ 3 /*break*/ , 1 ];\n\n case 4:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Temporarily disables the network. The network can be re-enabled using\n * enableNetwork().\n */ function zo(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n n = 0, r = e.Ju, t.label = 1;\n\n case 1:\n return n < r.length ? [ 4 /*yield*/ , (0, r[n])(/* enabled= */ !1) ] : [ 3 /*break*/ , 4 ];\n\n case 2:\n t.sent(), t.label = 3;\n\n case 3:\n return n++, [ 3 /*break*/ , 1 ];\n\n case 4:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction Bo(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return n = m(e), l(\"RemoteStore\", \"RemoteStore shutting down.\"), n.Yu.add(5 /* Shutdown */), \n [ 4 /*yield*/ , zo(n) ];\n\n case 1:\n return t.sent(), n.Xu.Di(), \n // Set the OnlineState to Unknown (rather than Offline) to avoid potentially\n // triggering spurious listener events with cached data, etc.\n n.th.set(\"Unknown\" /* Unknown */), [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Starts new listen for the given target. Uses resume token if provided. It\n * is a no-op if the target of given `TargetData` is already being listened to.\n */ function Wo(t, e) {\n var n = m(t);\n n.Hu.has(e.targetId) || (\n // Mark this as something the client is currently listening for.\n n.Hu.set(e.targetId, e), $o(n) ? \n // The listen will be sent in onWatchStreamOpen\n Yo(n) : ls(n).uu() && Qo(n, e));\n}\n\n/**\n * Removes the listen from server. It is a no-op if the given target id is\n * not being listened to.\n */ function Ko(t, e) {\n var n = m(t), r = ls(n);\n n.Hu.delete(e), r.uu() && Ho(n, e), 0 === n.Hu.size && (r.uu() ? r._u() : Xo(n) && \n // Revert to OnlineState.Unknown if the watch stream is not open and we\n // have no listeners, since without any listens to send we cannot\n // confirm if the stream is healthy and upgrade to OnlineState.Online.\n n.th.set(\"Unknown\" /* Unknown */));\n}\n\n/**\n * We need to increment the the expected number of pending responses we're due\n * from watch so we wait for the ack to process any messages from this target.\n */ function Qo(t, e) {\n t.eh.Ie(e.targetId), ls(t).Vu(e)\n /**\n * We need to increment the expected number of pending responses we're due\n * from watch so we wait for the removal on the server before we process any\n * messages from this target.\n */;\n}\n\nfunction Ho(t, e) {\n t.eh.Ie(e), ls(t).pu(e);\n}\n\nfunction Yo(t) {\n t.eh = new Wt({\n qe: function(e) {\n return t.Gu.qe(e);\n },\n Ue: function(e) {\n return t.Hu.get(e) || null;\n }\n }), ls(t).start(), t.th.Bu()\n /**\n * Returns whether the watch stream should be started because it's necessary\n * and has not yet been started.\n */;\n}\n\nfunction $o(t) {\n return Xo(t) && !ls(t).cu() && t.Hu.size > 0;\n}\n\nfunction Xo(t) {\n return 0 === m(t).Yu.size;\n}\n\nfunction Jo(t) {\n t.eh = void 0;\n}\n\nfunction Zo(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return e.Hu.forEach((function(t, n) {\n Qo(e, t);\n })), [ 2 /*return*/ ];\n }));\n }));\n}\n\nfunction ts(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return Jo(e), \n // If we still need the watch stream, retry the connection.\n $o(e) ? (e.th.Qu(n), Yo(e)) : \n // No need to restart watch stream because there are no active targets.\n // The online state is set to unknown because there is no active attempt\n // at establishing a connection\n e.th.set(\"Unknown\" /* Unknown */), [ 2 /*return*/ ];\n }));\n }));\n}\n\nfunction es(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o, s;\n return t.__generator(this, (function(u) {\n switch (u.label) {\n case 0:\n if (e.th.set(\"Online\" /* Online */), !(n instanceof zt && 2 /* Removed */ === n.state && n.cause)) \n // Mark the client as online since we got a message from the server\n return [ 3 /*break*/ , 6 ];\n u.label = 1;\n\n case 1:\n return u.trys.push([ 1, 3, , 5 ]), [ 4 /*yield*/ , \n /** Handles an error on a target */\n function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n r = n.cause, i = 0, o = n.targetIds, t.label = 1;\n\n case 1:\n return i < o.length ? (s = o[i], e.Hu.has(s) ? [ 4 /*yield*/ , e.Gu.nh(s, r) ] : [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 5 ];\n\n case 2:\n t.sent(), e.Hu.delete(s), e.eh.removeTarget(s), t.label = 3;\n\n case 3:\n t.label = 4;\n\n case 4:\n return i++, [ 3 /*break*/ , 1 ];\n\n case 5:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }(e, n) ];\n\n case 2:\n return u.sent(), [ 3 /*break*/ , 5 ];\n\n case 3:\n return i = u.sent(), l(\"RemoteStore\", \"Failed to remove targets %s: %s \", n.targetIds.join(\",\"), i), \n [ 4 /*yield*/ , ns(e, i) ];\n\n case 4:\n return u.sent(), [ 3 /*break*/ , 5 ];\n\n case 5:\n return [ 3 /*break*/ , 13 ];\n\n case 6:\n if (n instanceof jt ? e.eh.be(n) : n instanceof Gt ? e.eh.$e(n) : e.eh.De(n), r.isEqual(st.min())) return [ 3 /*break*/ , 13 ];\n u.label = 7;\n\n case 7:\n return u.trys.push([ 7, 11, , 13 ]), [ 4 /*yield*/ , wo(e.ju) ];\n\n case 8:\n return o = u.sent(), r.L(o) >= 0 ? [ 4 /*yield*/ , \n /**\n * Takes a batch of changes from the Datastore, repackages them as a\n * RemoteEvent, and passes that on to the listener, which is typically the\n * SyncEngine.\n */\n function(t, e) {\n var n = t.eh.Oe(e);\n // Update in-memory resume tokens. LocalStore will update the\n // persistent view of these when applying the completed RemoteEvent.\n return n.zt.forEach((function(n, r) {\n if (n.resumeToken.O() > 0) {\n var i = t.Hu.get(r);\n // A watched target might have been removed already.\n i && t.Hu.set(r, i.it(n.resumeToken, e));\n }\n })), \n // Re-establish listens for the targets that have been invalidated by\n // existence filter mismatches.\n n.Ht.forEach((function(e) {\n var n = t.Hu.get(e);\n if (n) {\n // Clear the resume token for the target, since we're in a known mismatch\n // state.\n t.Hu.set(e, n.it(X.B, n.nt)), \n // Cause a hard reset by unwatching and rewatching immediately, but\n // deliberately don't send a resume token so that we get a full update.\n Ho(t, e);\n // Mark the target we send as being on behalf of an existence filter\n // mismatch, but don't actually retain that in listenTargets. This ensures\n // that we flag the first re-listen this way without impacting future\n // listens of this target (that might happen e.g. on reconnect).\n var r = new gt(n.target, e, 1 /* ExistenceFilterMismatch */ , n.sequenceNumber);\n Qo(t, r);\n }\n })), t.Gu.sh(n);\n }(e, r) ] : [ 3 /*break*/ , 10 ];\n\n // We have received a target change with a global snapshot if the snapshot\n // version is not equal to SnapshotVersion.min().\n case 9:\n // We have received a target change with a global snapshot if the snapshot\n // version is not equal to SnapshotVersion.min().\n u.sent(), u.label = 10;\n\n case 10:\n return [ 3 /*break*/ , 13 ];\n\n case 11:\n return l(\"RemoteStore\", \"Failed to raise snapshot:\", s = u.sent()), [ 4 /*yield*/ , ns(e, s) ];\n\n case 12:\n return u.sent(), [ 3 /*break*/ , 13 ];\n\n case 13:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Recovery logic for IndexedDB errors that takes the network offline until\n * `op` succeeds. Retries are scheduled with backoff using\n * `enqueueRetryable()`. If `op()` is not provided, IndexedDB access is\n * validated via a generic operation.\n *\n * The returned Promise is resolved once the network is disabled and before\n * any retry attempt.\n */ function ns(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i = this;\n return t.__generator(this, (function(o) {\n switch (o.label) {\n case 0:\n if (!_r(n)) throw n;\n // Disable network and raise offline snapshots\n return e.Yu.add(1 /* IndexedDbFailed */), [ 4 /*yield*/ , zo(e) ];\n\n case 1:\n // Disable network and raise offline snapshots\n return o.sent(), e.th.set(\"Offline\" /* Offline */), r || (\n // Use a simple read operation to determine if IndexedDB recovered.\n // Ideally, we would expose a health check directly on SimpleDb, but\n // RemoteStore only has access to persistence through LocalStore.\n r = function() {\n return wo(e.ju);\n }), \n // Probe IndexedDB periodically and re-enable network\n e.cs.Cs((function() {\n return t.__awaiter(i, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return l(\"RemoteStore\", \"Retrying IndexedDB access\"), [ 4 /*yield*/ , r() ];\n\n case 1:\n return t.sent(), e.Yu.delete(1 /* IndexedDbFailed */), [ 4 /*yield*/ , Go(e) ];\n\n case 2:\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n })), [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Executes `op`. If `op` fails, takes the network offline until `op`\n * succeeds. Returns after the first attempt.\n */ function rs(t, e) {\n return e().catch((function(n) {\n return ns(t, n, e);\n }));\n}\n\nfunction is(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r, i, o, s;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n n = m(e), r = ps(n), i = n.zu.length > 0 ? n.zu[n.zu.length - 1].batchId : -1, t.label = 1;\n\n case 1:\n if (!\n /**\n * Returns true if we can add to the write pipeline (i.e. the network is\n * enabled and the write pipeline is not full).\n */\n function(t) {\n return Xo(t) && t.zu.length < 10;\n }\n /**\n * Queues additional writes to be sent to the write stream, sending them\n * immediately if the write stream is established.\n */ (n)) return [ 3 /*break*/ , 7 ];\n t.label = 2;\n\n case 2:\n return t.trys.push([ 2, 4, , 6 ]), [ 4 /*yield*/ , bo(n.ju, i) ];\n\n case 3:\n return null === (o = t.sent()) ? (0 === n.zu.length && r._u(), [ 3 /*break*/ , 7 ]) : (i = o.batchId, \n function(t, e) {\n t.zu.push(e);\n var n = ps(t);\n n.uu() && n.vu && n.Su(e.mutations);\n }(n, o), [ 3 /*break*/ , 6 ]);\n\n case 4:\n return s = t.sent(), [ 4 /*yield*/ , ns(n, s) ];\n\n case 5:\n return t.sent(), [ 3 /*break*/ , 6 ];\n\n case 6:\n return [ 3 /*break*/ , 1 ];\n\n case 7:\n return os(n) && ss(n), [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction os(t) {\n return Xo(t) && !ps(t).cu() && t.zu.length > 0;\n}\n\nfunction ss(t) {\n ps(t).start();\n}\n\nfunction us(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return ps(e).Nu(), [ 2 /*return*/ ];\n }));\n }));\n}\n\nfunction as(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r, i, o;\n return t.__generator(this, (function(t) {\n // Send the write pipeline now that the stream is established.\n for (n = ps(e), r = 0, i = e.zu; r < i.length; r++) o = i[r], n.Su(o.mutations);\n return [ 2 /*return*/ ];\n }));\n }));\n}\n\nfunction cs(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return i = e.zu.shift(), o = Jr.from(i, n, r), [ 4 /*yield*/ , rs(e, (function() {\n return e.Gu.ih(o);\n })) ];\n\n case 1:\n // It's possible that with the completion of this mutation another\n // slot has freed up.\n return t.sent(), [ 4 /*yield*/ , is(e) ];\n\n case 2:\n // It's possible that with the completion of this mutation another\n // slot has freed up.\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction hs(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(r) {\n switch (r.label) {\n case 0:\n return n && ps(e).vu ? [ 4 /*yield*/ , function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return wt(i = n.code) && i !== a.ABORTED ? (r = e.zu.shift(), \n // In this case it's also unlikely that the server itself is melting\n // down -- this was just a bad request so inhibit backoff on the next\n // restart.\n ps(e).lu(), [ 4 /*yield*/ , rs(e, (function() {\n return e.Gu.rh(r.batchId, n);\n })) ]) : [ 3 /*break*/ , 3 ];\n\n case 1:\n // It's possible that with the completion of this mutation\n // another slot has freed up.\n return t.sent(), [ 4 /*yield*/ , is(e) ];\n\n case 2:\n // In this case it's also unlikely that the server itself is melting\n // down -- this was just a bad request so inhibit backoff on the next\n // restart.\n // It's possible that with the completion of this mutation\n // another slot has freed up.\n t.sent(), t.label = 3;\n\n case 3:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }(e, n) ] : [ 3 /*break*/ , 2 ];\n\n // This error affects the actual write.\n case 1:\n // This error affects the actual write.\n r.sent(), r.label = 2;\n\n case 2:\n // If the write stream closed after the write handshake completes, a write\n // operation failed and we fail the pending operation.\n // The write stream might have been started by refilling the write\n // pipeline for failed writes\n return os(e) && ss(e), [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Toggles the network state when the client gains or loses its primary lease.\n */ function fs(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return r = m(e), n ? (r.Yu.delete(2 /* IsSecondary */), [ 4 /*yield*/ , Go(r) ]) : [ 3 /*break*/ , 2 ];\n\n case 1:\n return t.sent(), [ 3 /*break*/ , 5 ];\n\n case 2:\n return (i = n) ? [ 3 /*break*/ , 4 ] : (r.Yu.add(2 /* IsSecondary */), [ 4 /*yield*/ , zo(r) ]);\n\n case 3:\n t.sent(), i = r.th.set(\"Unknown\" /* Unknown */), t.label = 4;\n\n case 4:\n i, t.label = 5;\n\n case 5:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * If not yet initialized, registers the WatchStream and its network state\n * callback with `remoteStoreImpl`. Returns the existing stream if one is\n * already available.\n *\n * PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.\n * This is not done on Web to allow it to be tree-shaken.\n */ function ls(e) {\n var n = this;\n return e.oh || (\n // Create stream (but note that it is not started yet).\n e.oh = function(t, e, n) {\n var r = m(t);\n return r.xu(), new Co(e, r.iu, r.credentials, r.serializer, n);\n }(e.Ku, e.cs, {\n gu: Zo.bind(null, e),\n Tu: ts.bind(null, e),\n yu: es.bind(null, e)\n }), e.Ju.push((function(r) {\n return t.__awaiter(n, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return r ? (e.oh.lu(), $o(e) ? Yo(e) : e.th.set(\"Unknown\" /* Unknown */), [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 1 ];\n\n case 1:\n return [ 4 /*yield*/ , e.oh.stop() ];\n\n case 2:\n t.sent(), Jo(e), t.label = 3;\n\n case 3:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }))), e.oh\n /**\n * If not yet initialized, registers the WriteStream and its network state\n * callback with `remoteStoreImpl`. Returns the existing stream if one is\n * already available.\n *\n * PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup.\n * This is not done on Web to allow it to be tree-shaken.\n */;\n}\n\nfunction ps(e) {\n var n = this;\n return e.ah || (\n // Create stream (but note that it is not started yet).\n e.ah = function(t, e, n) {\n var r = m(t);\n return r.xu(), new Fo(e, r.iu, r.credentials, r.serializer, n);\n }(e.Ku, e.cs, {\n gu: us.bind(null, e),\n Tu: hs.bind(null, e),\n Cu: as.bind(null, e),\n Du: cs.bind(null, e)\n }), e.Ju.push((function(r) {\n return t.__awaiter(n, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return r ? (e.ah.lu(), [ 4 /*yield*/ , is(e) ]) : [ 3 /*break*/ , 2 ];\n\n case 1:\n // This will start the write stream if necessary.\n return t.sent(), [ 3 /*break*/ , 4 ];\n\n case 2:\n return [ 4 /*yield*/ , e.ah.stop() ];\n\n case 3:\n t.sent(), e.zu.length > 0 && (l(\"RemoteStore\", \"Stopping write stream with \" + e.zu.length + \" pending writes\"), \n e.zu = []), t.label = 4;\n\n case 4:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }))), e.ah\n /**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */;\n}\n\nvar ds = function(t) {\n this.key = t;\n}, vs = function(t) {\n this.key = t;\n}, ys = /** @class */ function() {\n function t(t, \n /** Documents included in the remote target */\n e) {\n this.query = t, this.uh = e, this.hh = null, \n /**\n * A flag whether the view is current with the backend. A view is considered\n * current after it has seen the current flag from the backend and did not\n * lose consistency within the watch stream (e.g. because of an existence\n * filter mismatch).\n */\n this.te = !1, \n /** Documents in the view but not in the remote target */\n this.lh = Ot(), \n /** Document Keys that have local changes */\n this.Wt = Ot(), this._h = Xn(t), this.fh = new Ut(this._h);\n }\n return Object.defineProperty(t.prototype, \"dh\", {\n /**\n * The set of remote documents that the server has told us belongs to the target associated with\n * this view.\n */\n get: function() {\n return this.uh;\n },\n enumerable: !1,\n configurable: !0\n }), \n /**\n * Iterates over a set of doc changes, applies the query limit, and computes\n * what the new results should be, what the changes were, and whether we may\n * need to go back to the local cache for more results. Does not make any\n * changes to the view.\n * @param docChanges The doc changes to apply to this view.\n * @param previousChanges If this is being called with a refill, then start\n * with this set of docs and changes instead of the current view.\n * @return a new set of docs, changes, and refill flag.\n */\n t.prototype.wh = function(t, e) {\n var n = this, r = e ? e.mh : new Ct, i = e ? e.fh : this.fh, o = e ? e.Wt : this.Wt, s = i, u = !1, a = Cn(this.query) && i.size === this.query.limit ? i.last() : null, c = Fn(this.query) && i.size === this.query.limit ? i.first() : null;\n // Drop documents out to meet limit/limitToLast requirement.\n if (t.ht((function(t, e) {\n var h = i.get(t), f = e instanceof kn ? e : null;\n f && (f = $n(n.query, f) ? f : null);\n var l = !!h && n.Wt.has(h.key), p = !!f && (f.Je || \n // We only consider committed mutations for documents that were\n // mutated during the lifetime of the view.\n n.Wt.has(f.key) && f.hasCommittedMutations), d = !1;\n // Calculate change\n h && f ? h.data().isEqual(f.data()) ? l !== p && (r.track({\n type: 3 /* Metadata */ ,\n doc: f\n }), d = !0) : n.Th(h, f) || (r.track({\n type: 2 /* Modified */ ,\n doc: f\n }), d = !0, (a && n._h(f, a) > 0 || c && n._h(f, c) < 0) && (\n // This doc moved from inside the limit to outside the limit.\n // That means there may be some other doc in the local cache\n // that should be included instead.\n u = !0)) : !h && f ? (r.track({\n type: 0 /* Added */ ,\n doc: f\n }), d = !0) : h && !f && (r.track({\n type: 1 /* Removed */ ,\n doc: h\n }), d = !0, (a || c) && (\n // A doc was removed from a full limit query. We'll need to\n // requery from the local cache to see if we know about some other\n // doc that should be in the results.\n u = !0)), d && (f ? (s = s.add(f), o = p ? o.add(t) : o.delete(t)) : (s = s.delete(t), \n o = o.delete(t)));\n })), Cn(this.query) || Fn(this.query)) for (;s.size > this.query.limit; ) {\n var h = Cn(this.query) ? s.last() : s.first();\n s = s.delete(h.key), o = o.delete(h.key), r.track({\n type: 1 /* Removed */ ,\n doc: h\n });\n }\n return {\n fh: s,\n mh: r,\n Eh: u,\n Wt: o\n };\n }, t.prototype.Th = function(t, e) {\n // We suppress the initial change event for documents that were modified as\n // part of a write acknowledgment (e.g. when the value of a server transform\n // is applied) as Watch will send us the same document again.\n // By suppressing the event, we only raise two user visible events (one with\n // `hasPendingWrites` and the final state of the document) instead of three\n // (one with `hasPendingWrites`, the modified document with\n // `hasPendingWrites` and the final state of the document).\n return t.Je && e.hasCommittedMutations && !e.Je;\n }, \n /**\n * Updates the view with the given ViewDocumentChanges and optionally updates\n * limbo docs and sync state from the provided target change.\n * @param docChanges The set of changes to make to the view's docs.\n * @param updateLimboDocuments Whether to update limbo documents based on this\n * change.\n * @param targetChange A target change to apply for computing limbo docs and\n * sync state.\n * @return A new ViewChange with the given docs, changes, and sync state.\n */\n // PORTING NOTE: The iOS/Android clients always compute limbo document changes.\n t.prototype.yr = function(t, e, n) {\n var r = this, i = this.fh;\n this.fh = t.fh, this.Wt = t.Wt;\n // Sort changes based on type and query comparator\n var o = t.mh.Ut();\n o.sort((function(t, e) {\n return function(t, e) {\n var n = function(t) {\n switch (t) {\n case 0 /* Added */ :\n return 1;\n\n case 2 /* Modified */ :\n case 3 /* Metadata */ :\n // A metadata change is converted to a modified change at the public\n // api layer. Since we sort by document key and then change type,\n // metadata and modified changes must be sorted equivalently.\n return 2;\n\n case 1 /* Removed */ :\n return 0;\n\n default:\n return y();\n }\n };\n return n(t) - n(e);\n }(t.type, e.type) || r._h(t.doc, e.doc);\n })), this.Ih(n);\n var s = e ? this.Ah() : [], u = 0 === this.lh.size && this.te ? 1 /* Synced */ : 0 /* Local */ , a = u !== this.hh;\n return this.hh = u, 0 !== o.length || a ? {\n snapshot: new Ft(this.query, t.fh, i, o, t.Wt, 0 /* Local */ === u, a, \n /* excludesMetadataChanges= */ !1),\n Rh: s\n } : {\n Rh: s\n };\n // no changes\n }, \n /**\n * Applies an OnlineState change to the view, potentially generating a\n * ViewChange if the view's syncState changes as a result.\n */\n t.prototype.Qs = function(t) {\n return this.te && \"Offline\" /* Offline */ === t ? (\n // If we're offline, set `current` to false and then call applyChanges()\n // to refresh our syncState and generate a ViewChange as appropriate. We\n // are guaranteed to get a new TargetChange that sets `current` back to\n // true once the client is back online.\n this.te = !1, this.yr({\n fh: this.fh,\n mh: new Ct,\n Wt: this.Wt,\n Eh: !1\n }, \n /* updateLimboDocuments= */ !1)) : {\n Rh: []\n };\n }, \n /**\n * Returns whether the doc for the given key should be in limbo.\n */\n t.prototype.gh = function(t) {\n // If the remote end says it's part of this query, it's not in limbo.\n return !this.uh.has(t) && \n // The local store doesn't think it's a result, so it shouldn't be in limbo.\n !!this.fh.has(t) && !this.fh.get(t).Je;\n }, \n /**\n * Updates syncedDocuments, current, and limbo docs based on the given change.\n * Returns the list of changes to which docs are in limbo.\n */\n t.prototype.Ih = function(t) {\n var e = this;\n t && (t.ee.forEach((function(t) {\n return e.uh = e.uh.add(t);\n })), t.ne.forEach((function(t) {})), t.se.forEach((function(t) {\n return e.uh = e.uh.delete(t);\n })), this.te = t.te);\n }, t.prototype.Ah = function() {\n var t = this;\n // We can only determine limbo documents when we're in-sync with the server.\n if (!this.te) return [];\n // TODO(klimt): Do this incrementally so that it's not quadratic when\n // updating many documents.\n var e = this.lh;\n this.lh = Ot(), this.fh.forEach((function(e) {\n t.gh(e.key) && (t.lh = t.lh.add(e.key));\n }));\n // Diff the new limbo docs with the old limbo docs.\n var n = [];\n return e.forEach((function(e) {\n t.lh.has(e) || n.push(new vs(e));\n })), this.lh.forEach((function(t) {\n e.has(t) || n.push(new ds(t));\n })), n;\n }, \n /**\n * Update the in-memory state of the current view with the state read from\n * persistence.\n *\n * We update the query view whenever a client's primary status changes:\n * - When a client transitions from primary to secondary, it can miss\n * LocalStorage updates and its query views may temporarily not be\n * synchronized with the state on disk.\n * - For secondary to primary transitions, the client needs to update the list\n * of `syncedDocuments` since secondary clients update their query views\n * based purely on synthesized RemoteEvents.\n *\n * @param queryResult.documents - The documents that match the query according\n * to the LocalStore.\n * @param queryResult.remoteKeys - The keys of the documents that match the\n * query according to the backend.\n *\n * @return The ViewChange that resulted from this synchronization.\n */\n // PORTING NOTE: Multi-tab only.\n t.prototype.Ph = function(t) {\n this.uh = t.Fc, this.lh = Ot();\n var e = this.wh(t.documents);\n return this.yr(e, /*updateLimboDocuments=*/ !0);\n }, \n /**\n * Returns a view snapshot as if this query was just listened to. Contains\n * a document add for every existing document and the `fromCache` and\n * `hasPendingWrites` status of the already established view.\n */\n // PORTING NOTE: Multi-tab only.\n t.prototype.yh = function() {\n return Ft.Gt(this.query, this.fh, this.Wt, 0 /* Local */ === this.hh);\n }, t;\n}(), gs = function(\n/**\n * The query itself.\n */\nt, \n/**\n * The target number created by the client that is used in the watch\n * stream to identify this query.\n */\ne, \n/**\n * The view is responsible for computing the final merged truth of what\n * docs are in the query. It gets notified of local and remote changes,\n * and applies the query filters and limits to determine the most correct\n * possible results.\n */\nn) {\n this.query = t, this.targetId = e, this.view = n;\n}, ms = function(t) {\n this.key = t, \n /**\n * Set to true once we've received a document. This is used in\n * getRemoteKeysForTarget() and ultimately used by WatchChangeAggregator to\n * decide whether it needs to manufacture a delete event for the target once\n * the target is CURRENT.\n */\n this.Vh = !1;\n}, ws = /** @class */ function() {\n function t(t, e, n, \n // PORTING NOTE: Manages state synchronization in multi-tab environments.\n r, i, o) {\n this.ju = t, this.ph = e, this.bh = n, this.Sh = r, this.currentUser = i, this.Dh = o, \n this.Ch = {}, this.Nh = new it((function(t) {\n return Hn(t);\n }), Qn), this.Fh = new Map, \n /**\n * The keys of documents that are in limbo for which we haven't yet started a\n * limbo resolution query.\n */\n this.xh = [], \n /**\n * Keeps track of the target ID for each document that is in limbo with an\n * active target.\n */\n this.$h = new bt(A.i), \n /**\n * Keeps track of the information about an active limbo resolution for each\n * active target ID that was started for the purpose of limbo resolution.\n */\n this.kh = new Map, this.Mh = new xo, \n /** Stores user completion handlers, indexed by User and BatchId. */\n this.Oh = {}, \n /** Stores user callbacks waiting for all pending writes to be acknowledged. */\n this.Lh = new Map, this.Bh = ro.da(), this.onlineState = \"Unknown\" /* Unknown */ , \n // The primary state is set to `true` or `false` immediately after Firestore\n // startup. In the interim, a client should only be considered primary if\n // `isPrimary` is true.\n this.qh = void 0;\n }\n return Object.defineProperty(t.prototype, \"Uh\", {\n get: function() {\n return !0 === this.qh;\n },\n enumerable: !1,\n configurable: !0\n }), t;\n}();\n\n/**\n * Initiates the new listen, resolves promise when listen enqueued to the\n * server. All the subsequent view snapshots or errors are sent to the\n * subscribed handlers. Returns the initial snapshot.\n */\nfunction _s(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s, u, a;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return r = Ks(e), (s = r.Nh.get(n)) ? (\n // PORTING NOTE: With Multi-Tab Web, it is possible that a query view\n // already exists when EventManager calls us for the first time. This\n // happens when the primary tab is already listening to this query on\n // behalf of another tab and the user of the primary also starts listening\n // to the query. EventManager will not have an assigned target ID in this\n // case and calls `listen` to obtain this ID.\n i = s.targetId, r.Sh.Oi(i), o = s.view.yh(), [ 3 /*break*/ , 4 ]) : [ 3 /*break*/ , 1 ];\n\n case 1:\n return [ 4 /*yield*/ , Io(r.ju, zn(n)) ];\n\n case 2:\n return u = t.sent(), a = r.Sh.Oi(u.targetId), i = u.targetId, [ 4 /*yield*/ , bs(r, n, i, \"current\" === a) ];\n\n case 3:\n o = t.sent(), r.Uh && Wo(r.ph, u), t.label = 4;\n\n case 4:\n return [ 2 /*return*/ , o ];\n }\n }));\n }));\n}\n\n/**\n * Registers a view for a previously unknown query and computes its initial\n * snapshot.\n */ function bs(e, n, r, i) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var o, s, u, a, c, h;\n return t.__generator(this, (function(f) {\n switch (f.label) {\n case 0:\n // PORTING NOTE: On Web only, we inject the code that registers new Limbo\n // targets based on view changes. This allows us to only depend on Limbo\n // changes when user code includes queries.\n return e.Qh = function(n, r, i) {\n return function(e, n, r, i) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var o, s, u;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return o = n.view.wh(r), o.Eh ? [ 4 /*yield*/ , To(e.ju, n.query, \n /* usePreviousResults= */ !1).then((function(t) {\n var e = t.documents;\n return n.view.wh(e, o);\n })) ] : [ 3 /*break*/ , 2 ];\n\n case 1:\n // The query has a limit and some docs were removed, so we need\n // to re-run the query against the local store to make sure we\n // didn't lose any good docs that had been past the limit.\n o = t.sent(), t.label = 2;\n\n case 2:\n return s = i && i.zt.get(n.targetId), u = n.view.yr(o, \n /* updateLimboDocuments= */ e.Uh, s), [ 2 /*return*/ , (Rs(e, n.targetId, u.Rh), \n u.snapshot) ];\n }\n }));\n }));\n }(e, n, r, i);\n }, [ 4 /*yield*/ , To(e.ju, n, \n /* usePreviousResults= */ !0) ];\n\n case 1:\n return o = f.sent(), s = new ys(n, o.Fc), u = s.wh(o.documents), a = qt.Zt(r, i && \"Offline\" /* Offline */ !== e.onlineState), \n c = s.yr(u, \n /* updateLimboDocuments= */ e.Uh, a), Rs(e, r, c.Rh), h = new gs(n, r, s), [ 2 /*return*/ , (e.Nh.set(n, h), \n e.Fh.has(r) ? e.Fh.get(r).push(n) : e.Fh.set(r, [ n ]), c.snapshot) ];\n }\n }));\n }));\n}\n\n/** Stops listening to the query. */ function Is(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return r = m(e), i = r.Nh.get(n), (o = r.Fh.get(i.targetId)).length > 1 ? [ 2 /*return*/ , (r.Fh.set(i.targetId, o.filter((function(t) {\n return !Qn(t, n);\n }))), void r.Nh.delete(n)) ] : r.Uh ? (\n // We need to remove the local query target first to allow us to verify\n // whether any other client is still interested in this target.\n r.Sh.Bi(i.targetId), r.Sh.Fi(i.targetId) ? [ 3 /*break*/ , 2 ] : [ 4 /*yield*/ , Eo(r.ju, i.targetId, \n /*keepPersistedTargetData=*/ !1).then((function() {\n r.Sh.Ui(i.targetId), Ko(r.ph, i.targetId), Ls(r, i.targetId);\n })).catch(Do) ]) : [ 3 /*break*/ , 3 ];\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n return [ 3 /*break*/ , 5 ];\n\n case 3:\n return Ls(r, i.targetId), [ 4 /*yield*/ , Eo(r.ju, i.targetId, \n /*keepPersistedTargetData=*/ !0) ];\n\n case 4:\n t.sent(), t.label = 5;\n\n case 5:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Initiates the write of local mutation batch which involves adding the\n * writes to the mutation queue, notifying the remote store about new\n * mutations and raising events for any changes this write caused.\n *\n * The promise returned by this call is resolved when the above steps\n * have completed, *not* when the write was acked by the backend. The\n * userCallback is resolved once the write was acked/rejected by the\n * backend (or failed locally for any other reason).\n */\n/**\n * Applies one remote event to the sync engine, notifying any views of the\n * changes, and releasing any pending mutation batches that would become\n * visible because of the snapshot version the remote event contains.\n */\nfunction Es(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n r = m(e), t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , _o(r.ju, n) ];\n\n case 2:\n return i = t.sent(), \n // Update `receivedDocument` as appropriate for any limbo targets.\n n.zt.forEach((function(t, e) {\n var n = r.kh.get(e);\n n && (\n // Since this is a limbo resolution lookup, it's for a single document\n // and it could be added, modified, or removed, but not a combination.\n g(t.ee.size + t.ne.size + t.se.size <= 1), t.ee.size > 0 ? n.Vh = !0 : t.ne.size > 0 ? g(n.Vh) : t.se.size > 0 && (g(n.Vh), \n n.Vh = !1));\n })), [ 4 /*yield*/ , Vs(r, i, n) ];\n\n case 3:\n // Update `receivedDocument` as appropriate for any limbo targets.\n return t.sent(), [ 3 /*break*/ , 6 ];\n\n case 4:\n return [ 4 /*yield*/ , Do(t.sent()) ];\n\n case 5:\n return t.sent(), [ 3 /*break*/ , 6 ];\n\n case 6:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Applies an OnlineState change to the sync engine and notifies any views of\n * the change.\n */ function Ts(t, e, n) {\n var r = m(t);\n // If we are the secondary client, we explicitly ignore the remote store's\n // online state (the local client may go offline, even though the primary\n // tab remains online) and only apply the primary tab's online state from\n // SharedClientState.\n if (r.Uh && 0 /* RemoteStore */ === n || !r.Uh && 1 /* SharedClientState */ === n) {\n var i = [];\n r.Nh.forEach((function(t, n) {\n var r = n.view.Qs(e);\n r.snapshot && i.push(r.snapshot);\n })), function(t, e) {\n var n = m(t);\n n.onlineState = e;\n var r = !1;\n n.Bs.forEach((function(t, n) {\n for (var i = 0, o = n.listeners; i < o.length; i++) {\n // Run global snapshot listeners if a consistent snapshot has been emitted.\n o[i].Qs(e) && (r = !0);\n }\n })), r && Cr(n);\n }(r.bh, e), i.length && r.Ch.yu(i), r.onlineState = e, r.Uh && r.Sh.Ki(e);\n }\n}\n\n/**\n * Rejects the listen for the given targetID. This can be triggered by the\n * backend for any active target.\n *\n * @param syncEngine The sync engine implementation.\n * @param targetId The targetID corresponds to one previously initiated by the\n * user as part of TargetData passed to listen() on RemoteStore.\n * @param err A description of the condition that has forced the rejection.\n * Nearly always this will be an indication that the user is no longer\n * authorized to see the data matching the target.\n */ function Ns(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o, s, u, a, c;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n // PORTING NOTE: Multi-tab only.\n return (i = m(e)).Sh.Qi(n, \"rejected\", r), o = i.kh.get(n), (s = o && o.key) ? (u = (u = new bt(A.i)).ot(s, new Rn(s, st.min())), \n a = Ot().add(s), c = new Mt(st.min(), \n /* targetChanges= */ new Map, \n /* targetMismatches= */ new Tt(H), u, a), [ 4 /*yield*/ , Es(i, c) ]) : [ 3 /*break*/ , 2 ];\n\n case 1:\n return t.sent(), \n // Since this query failed, we won't want to manually unlisten to it.\n // We only remove it from bookkeeping after we successfully applied the\n // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to\n // this query when the RemoteStore restarts the Watch stream, which should\n // re-trigger the target failure.\n i.$h = i.$h.remove(s), i.kh.delete(n), Ps(i), [ 3 /*break*/ , 4 ];\n\n case 2:\n return [ 4 /*yield*/ , Eo(i.ju, n, \n /* keepPersistedTargetData */ !1).then((function() {\n return Ls(i, n, r);\n })).catch(Do) ];\n\n case 3:\n t.sent(), t.label = 4;\n\n case 4:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction As(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n r = m(e), i = n.batch.batchId, t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , mo(r.ju, n) ];\n\n case 2:\n return o = t.sent(), \n // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught\n // up), so we raise user callbacks first so that they consistently happen\n // before listen events.\n xs(r, i, /*error=*/ null), Ds(r, i), r.Sh.ki(i, \"acknowledged\"), [ 4 /*yield*/ , Vs(r, o) ];\n\n case 3:\n // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught\n // up), so we raise user callbacks first so that they consistently happen\n // before listen events.\n return t.sent(), [ 3 /*break*/ , 6 ];\n\n case 4:\n return [ 4 /*yield*/ , Do(t.sent()) ];\n\n case 5:\n return t.sent(), [ 3 /*break*/ , 6 ];\n\n case 6:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction Ss(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n i = m(e), t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , function(t, e) {\n var n = m(t);\n return n.persistence.runTransaction(\"Reject batch\", \"readwrite-primary\", (function(t) {\n var r;\n return n.Sr.Oo(t, e).next((function(e) {\n return g(null !== e), r = e.keys(), n.Sr.Wo(t, e);\n })).next((function() {\n return n.Sr.zo(t);\n })).next((function() {\n return n.Cc.kr(t, r);\n }));\n }));\n }(i.ju, n) ];\n\n case 2:\n return o = t.sent(), \n // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught up),\n // so we raise user callbacks first so that they consistently happen before\n // listen events.\n xs(i, n, r), Ds(i, n), i.Sh.ki(n, \"rejected\", r), [ 4 /*yield*/ , Vs(i, o) ];\n\n case 3:\n // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught up),\n // so we raise user callbacks first so that they consistently happen before\n // listen events.\n return t.sent(), [ 3 /*break*/ , 6 ];\n\n case 4:\n return [ 4 /*yield*/ , Do(t.sent()) ];\n\n case 5:\n return t.sent(), [ 3 /*break*/ , 6 ];\n\n case 6:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/**\n * Registers a user callback that resolves when all pending mutations at the moment of calling\n * are acknowledged .\n */\n/**\n * Triggers the callbacks that are waiting for this batch id to get acknowledged by server,\n * if there are any.\n */\nfunction Ds(t, e) {\n (t.Lh.get(e) || []).forEach((function(t) {\n t.resolve();\n })), t.Lh.delete(e)\n /** Reject all outstanding callbacks waiting for pending writes to complete. */;\n}\n\nfunction xs(t, e, n) {\n var r = m(t), i = r.Oh[r.currentUser.ti()];\n // NOTE: Mutations restored from persistence won't have callbacks, so it's\n // okay for there to be no callback for this ID.\n if (i) {\n var o = i.get(e);\n o && (n ? o.reject(n) : o.resolve(), i = i.remove(e)), r.Oh[r.currentUser.ti()] = i;\n }\n}\n\nfunction Ls(t, e, n) {\n void 0 === n && (n = null), t.Sh.Bi(e);\n for (var r = 0, i = t.Fh.get(e); r < i.length; r++) {\n var o = i[r];\n t.Nh.delete(o), n && t.Ch.Wh(o, n);\n }\n t.Fh.delete(e), t.Uh && t.Mh.Uc(e).forEach((function(e) {\n t.Mh.Ho(e) || \n // We removed the last reference for this key\n ks(t, e);\n }));\n}\n\nfunction ks(t, e) {\n // It's possible that the target already got removed because the query failed. In that case,\n // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.\n var n = t.$h.get(e);\n null !== n && (Ko(t.ph, n), t.$h = t.$h.remove(e), t.kh.delete(n), Ps(t));\n}\n\nfunction Rs(t, e, n) {\n for (var r = 0, i = n; r < i.length; r++) {\n var o = i[r];\n o instanceof ds ? (t.Mh.Da(o.key, e), Os(t, o)) : o instanceof vs ? (l(\"SyncEngine\", \"Document no longer in limbo: \" + o.key), \n t.Mh.Na(o.key, e), t.Mh.Ho(o.key) || \n // We removed the last reference for this key\n ks(t, o.key)) : y();\n }\n}\n\nfunction Os(t, e) {\n var n = e.key;\n t.$h.get(n) || (l(\"SyncEngine\", \"New document in limbo: \" + n), t.xh.push(n), Ps(t));\n}\n\n/**\n * Starts listens for documents in limbo that are enqueued for resolution,\n * subject to a maximum number of concurrent resolutions.\n *\n * Without bounding the number of concurrent resolutions, the server can fail\n * with \"resource exhausted\" errors which can lead to pathological client\n * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.\n */ function Ps(t) {\n for (;t.xh.length > 0 && t.$h.size < t.Dh; ) {\n var e = t.xh.shift(), n = t.Bh.next();\n t.kh.set(n, new ms(e)), t.$h = t.$h.ot(e, n), Wo(t.ph, new gt(zn(Un(e.path)), n, 2 /* LimboResolution */ , qr.ai));\n }\n}\n\nfunction Vs(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o, s, u;\n return t.__generator(this, (function(a) {\n switch (a.label) {\n case 0:\n return i = m(e), o = [], s = [], u = [], i.Nh.m() ? [ 3 /*break*/ , 3 ] : (i.Nh.forEach((function(t, e) {\n u.push(i.Qh(e, n, r).then((function(t) {\n if (t) {\n i.Uh && i.Sh.Qi(e.targetId, t.fromCache ? \"not-current\" : \"current\"), o.push(t);\n var n = ri.zr(e.targetId, t);\n s.push(n);\n }\n })));\n })), [ 4 /*yield*/ , Promise.all(u) ]);\n\n case 1:\n return a.sent(), i.Ch.yu(o), [ 4 /*yield*/ , function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s, u, a, c, h, f;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n r = m(e), t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , r.persistence.runTransaction(\"notifyLocalViewChanges\", \"readwrite\", (function(t) {\n return yr.forEach(n, (function(e) {\n return yr.forEach(e.Kr, (function(n) {\n return r.persistence.No.Da(t, e.targetId, n);\n })).next((function() {\n return yr.forEach(e.Gr, (function(n) {\n return r.persistence.No.Na(t, e.targetId, n);\n }));\n }));\n }));\n })) ];\n\n case 2:\n return t.sent(), [ 3 /*break*/ , 4 ];\n\n case 3:\n if (!_r(i = t.sent())) throw i;\n // If `notifyLocalViewChanges` fails, we did not advance the sequence\n // number for the documents that were included in this transaction.\n // This might trigger them to be deleted earlier than they otherwise\n // would have, but it should not invalidate the integrity of the data.\n return l(\"LocalStore\", \"Failed to update sequence numbers: \" + i), \n [ 3 /*break*/ , 4 ];\n\n case 4:\n for (o = 0, s = n; o < s.length; o++) u = s[o], a = u.targetId, u.fromCache || (c = r.bc.get(a), \n h = c.nt, f = c.rt(h), \n // Advance the last limbo free snapshot version\n r.bc = r.bc.ot(a, f));\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }(i.ju, s) ];\n\n case 2:\n a.sent(), a.label = 3;\n\n case 3:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction Us(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i;\n return t.__generator(this, (function(o) {\n switch (o.label) {\n case 0:\n return (r = m(e)).currentUser.isEqual(n) ? [ 3 /*break*/ , 3 ] : (l(\"SyncEngine\", \"User change. New user:\", n.ti()), \n [ 4 /*yield*/ , \n /**\n * Tells the LocalStore that the currently authenticated user has changed.\n *\n * In response the local store switches the mutation queue to the new user and\n * returns any resulting document changes.\n */\n // PORTING NOTE: Android and iOS only return the documents affected by the\n // change.\n function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return r = m(e), i = r.Sr, o = r.Cc, [ 4 /*yield*/ , r.persistence.runTransaction(\"Handle user change\", \"readonly\", (function(t) {\n // Swap out the mutation queue, grabbing the pending mutation batches\n // before and after.\n var e;\n return r.Sr.Uo(t).next((function(s) {\n return e = s, i = r.persistence.mc(n), \n // Recreate our LocalDocumentsView using the new\n // MutationQueue.\n o = new ni(r.Dc, i, r.persistence.Ic()), i.Uo(t);\n })).next((function(n) {\n for (var r = [], i = [], s = Ot(), u = 0, a = e\n // Union the old/new changed keys.\n ; u < a.length; u++) {\n var c = a[u];\n r.push(c.batchId);\n for (var h = 0, f = c.mutations; h < f.length; h++) {\n var l = f[h];\n s = s.add(l.key);\n }\n }\n for (var p = 0, d = n; p < d.length; p++) {\n var v = d[p];\n i.push(v.batchId);\n for (var y = 0, g = v.mutations; y < g.length; y++) {\n var m = g[y];\n s = s.add(m.key);\n }\n }\n // Return the set of all (potentially) changed documents and the list\n // of mutation batch IDs that were affected by change.\n return o.kr(t, s).next((function(t) {\n return {\n jh: t,\n Kh: r,\n Gh: i\n };\n }));\n }));\n })) ];\n\n case 1:\n return s = t.sent(), [ 2 /*return*/ , (r.Sr = i, r.Cc = o, r.Vc.Nc(r.Cc), s) ];\n }\n }));\n }));\n }(r.ju, n) ]);\n\n case 1:\n return i = o.sent(), r.currentUser = n, \n // Fails tasks waiting for pending writes requested by previous user.\n function(t, e) {\n t.Lh.forEach((function(t) {\n t.forEach((function(t) {\n t.reject(new c(a.CANCELLED, \"'waitForPendingWrites' promise is rejected due to a user change.\"));\n }));\n })), t.Lh.clear();\n }(r), \n // TODO(b/114226417): Consider calling this only in the primary tab.\n r.Sh.ji(n, i.Kh, i.Gh), [ 4 /*yield*/ , Vs(r, i.jh) ];\n\n case 2:\n o.sent(), o.label = 3;\n\n case 3:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction Cs(t, e) {\n var n = m(t), r = n.kh.get(e);\n if (r && r.Vh) return Ot().add(r.key);\n var i = Ot(), o = n.Fh.get(e);\n if (!o) return i;\n for (var s = 0, u = o; s < u.length; s++) {\n var a = u[s], c = n.Nh.get(a);\n i = i.kt(c.view.dh);\n }\n return i;\n}\n\n/**\n * Reconcile the list of synced documents in an existing view with those\n * from persistence.\n */ function Fs(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return [ 4 /*yield*/ , To((r = m(e)).ju, n.query, \n /* usePreviousResults= */ !0) ];\n\n case 1:\n return i = t.sent(), o = n.view.Ph(i), [ 2 /*return*/ , (r.Uh && Rs(r, n.targetId, o.Rh), \n o) ];\n }\n }));\n }));\n}\n\n/** Applies a mutation state to an existing batch. */\n// PORTING NOTE: Multi-Tab only.\nfunction Ms(e, n, r, i) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var o, s;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return [ 4 /*yield*/ , function(t, e) {\n var n = m(t), r = m(n.Sr);\n return n.persistence.runTransaction(\"Lookup mutation documents\", \"readonly\", (function(t) {\n return r.Lo(t, e).next((function(e) {\n return e ? n.Cc.kr(t, e) : yr.resolve(null);\n }));\n }));\n }((o = m(e)).ju, n) ];\n\n case 1:\n return null === (s = t.sent()) ? [ 3 /*break*/ , 6 ] : \"pending\" !== r ? [ 3 /*break*/ , 3 ] : [ 4 /*yield*/ , is(o.ph) ];\n\n case 2:\n // If we are the primary client, we need to send this write to the\n // backend. Secondary clients will ignore these writes since their remote\n // connection is disabled.\n return t.sent(), [ 3 /*break*/ , 4 ];\n\n case 3:\n \"acknowledged\" === r || \"rejected\" === r ? (\n // NOTE: Both these methods are no-ops for batches that originated from\n // other clients.\n xs(o, n, i || null), Ds(o, n), function(t, e) {\n m(m(t).Sr).Ko(e);\n }(o.ju, n)) : y(), t.label = 4;\n\n case 4:\n return [ 4 /*yield*/ , Vs(o, s) ];\n\n case 5:\n return t.sent(), [ 3 /*break*/ , 7 ];\n\n case 6:\n // A throttled tab may not have seen the mutation before it was completed\n // and removed from the mutation queue, in which case we won't have cached\n // the affected documents. In this case we can safely ignore the update\n // since that means we didn't apply the mutation locally at all (if we\n // had, we would have cached the affected documents), and so we will just\n // see any resulting document changes via normal remote document updates\n // as applicable.\n l(\"SyncEngine\", \"Cannot apply mutation batch with id: \" + n), t.label = 7;\n\n case 7:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/** Applies a query target change from a different tab. */\n// PORTING NOTE: Multi-Tab only.\nfunction qs(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s, u, a, c, h;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return Ks(r = m(e)), Qs(r), !0 !== n || !0 === r.qh ? [ 3 /*break*/ , 3 ] : (i = r.Sh.Ci(), \n [ 4 /*yield*/ , js(r, i.A()) ]);\n\n case 1:\n return o = t.sent(), r.qh = !0, [ 4 /*yield*/ , fs(r.ph, !0) ];\n\n case 2:\n for (t.sent(), s = 0, u = o; s < u.length; s++) a = u[s], Wo(r.ph, a);\n return [ 3 /*break*/ , 7 ];\n\n case 3:\n return !1 !== n || !1 === r.qh ? [ 3 /*break*/ , 7 ] : (c = [], h = Promise.resolve(), \n r.Fh.forEach((function(t, e) {\n r.Sh.qi(e) ? c.push(e) : h = h.then((function() {\n return Ls(r, e), Eo(r.ju, e, \n /*keepPersistedTargetData=*/ !0);\n })), Ko(r.ph, e);\n })), [ 4 /*yield*/ , h ]);\n\n case 4:\n return t.sent(), [ 4 /*yield*/ , js(r, c) ];\n\n case 5:\n return t.sent(), \n // PORTING NOTE: Multi-Tab only.\n function(t) {\n var e = m(t);\n e.kh.forEach((function(t, n) {\n Ko(e.ph, n);\n })), e.Mh.Qc(), e.kh = new Map, e.$h = new bt(A.i);\n }(r), r.qh = !1, [ 4 /*yield*/ , fs(r.ph, !1) ];\n\n case 6:\n t.sent(), t.label = 7;\n\n case 7:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction js(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s, u, a, c, h, f, l, p, d, v, y;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n r = m(e), i = [], o = [], s = 0, u = n, t.label = 1;\n\n case 1:\n return s < u.length ? (a = u[s], c = void 0, (h = r.Fh.get(a)) && 0 !== h.length ? [ 4 /*yield*/ , Io(r.ju, zn(h[0])) ] : [ 3 /*break*/ , 7 ]) : [ 3 /*break*/ , 13 ];\n\n case 2:\n // For queries that have a local View, we fetch their current state\n // from LocalStore (as the resume token and the snapshot version\n // might have changed) and reconcile their views with the persisted\n // state (the list of syncedDocuments may have gotten out of sync).\n c = t.sent(), f = 0, l = h, t.label = 3;\n\n case 3:\n return f < l.length ? (p = l[f], d = r.Nh.get(p), [ 4 /*yield*/ , Fs(r, d) ]) : [ 3 /*break*/ , 6 ];\n\n case 4:\n (v = t.sent()).snapshot && o.push(v.snapshot), t.label = 5;\n\n case 5:\n return f++, [ 3 /*break*/ , 3 ];\n\n case 6:\n return [ 3 /*break*/ , 11 ];\n\n case 7:\n return [ 4 /*yield*/ , No(r.ju, a) ];\n\n case 8:\n return y = t.sent(), [ 4 /*yield*/ , Io(r.ju, y) ];\n\n case 9:\n return c = t.sent(), [ 4 /*yield*/ , bs(r, Gs(y), a, \n /*current=*/ !1) ];\n\n case 10:\n t.sent(), t.label = 11;\n\n case 11:\n i.push(c), t.label = 12;\n\n case 12:\n return s++, [ 3 /*break*/ , 1 ];\n\n case 13:\n return [ 2 /*return*/ , (r.Ch.yu(o), i) ];\n }\n }));\n }));\n}\n\n/**\n * Creates a `Query` object from the specified `Target`. There is no way to\n * obtain the original `Query`, so we synthesize a `Query` from the `Target`\n * object.\n *\n * The synthesized result might be different from the original `Query`, but\n * since the synthesized `Query` should return the same results as the\n * original one (only the presentation of results might differ), the potential\n * difference will not cause issues.\n */\n// PORTING NOTE: Multi-Tab only.\nfunction Gs(t) {\n return Vn(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, \"F\" /* First */ , t.startAt, t.endAt);\n}\n\n/** Returns the IDs of the clients that are currently active. */\n// PORTING NOTE: Multi-Tab only.\nfunction zs(t) {\n var e = m(t);\n return m(m(e.ju).persistence).pi();\n}\n\n/** Applies a query target change from a different tab. */\n// PORTING NOTE: Multi-Tab only.\nfunction Bs(e, n, r, i) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var o, s, u;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return (o = m(e)).qh ? (\n // If we receive a target state notification via WebStorage, we are\n // either already secondary or another tab has taken the primary lease.\n l(\"SyncEngine\", \"Ignoring unexpected query state notification.\"), [ 3 /*break*/ , 8 ]) : [ 3 /*break*/ , 1 ];\n\n case 1:\n if (!o.Fh.has(n)) return [ 3 /*break*/ , 8 ];\n switch (r) {\n case \"current\":\n case \"not-current\":\n return [ 3 /*break*/ , 2 ];\n\n case \"rejected\":\n return [ 3 /*break*/ , 5 ];\n }\n return [ 3 /*break*/ , 7 ];\n\n case 2:\n return [ 4 /*yield*/ , Ao(o.ju) ];\n\n case 3:\n return s = t.sent(), u = Mt.Xt(n, \"current\" === r), [ 4 /*yield*/ , Vs(o, s, u) ];\n\n case 4:\n return t.sent(), [ 3 /*break*/ , 8 ];\n\n case 5:\n return [ 4 /*yield*/ , Eo(o.ju, n, \n /* keepPersistedTargetData */ !0) ];\n\n case 6:\n return t.sent(), Ls(o, n, i), [ 3 /*break*/ , 8 ];\n\n case 7:\n y(), t.label = 8;\n\n case 8:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\n/** Adds or removes Watch targets for queries from different tabs. */ function Ws(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o, s, u, a, c, h, f, p, d;\n return t.__generator(this, (function(v) {\n switch (v.label) {\n case 0:\n if (!(i = Ks(e)).qh) return [ 3 /*break*/ , 10 ];\n o = 0, s = n, v.label = 1;\n\n case 1:\n return o < s.length ? (u = s[o], i.Fh.has(u) ? (\n // A target might have been added in a previous attempt\n l(\"SyncEngine\", \"Adding an already active target \" + u), [ 3 /*break*/ , 5 ]) : [ 4 /*yield*/ , No(i.ju, u) ]) : [ 3 /*break*/ , 6 ];\n\n case 2:\n return a = v.sent(), [ 4 /*yield*/ , Io(i.ju, a) ];\n\n case 3:\n return c = v.sent(), [ 4 /*yield*/ , bs(i, Gs(a), c.targetId, \n /*current=*/ !1) ];\n\n case 4:\n v.sent(), Wo(i.ph, c), v.label = 5;\n\n case 5:\n return o++, [ 3 /*break*/ , 1 ];\n\n case 6:\n h = function(e) {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return i.Fh.has(e) ? [ 4 /*yield*/ , Eo(i.ju, e, \n /* keepPersistedTargetData */ !1).then((function() {\n Ko(i.ph, e), Ls(i, e);\n })).catch(Do) ] : [ 3 /*break*/ , 2 ];\n\n // Release queries that are still active.\n case 1:\n // Release queries that are still active.\n t.sent(), t.label = 2;\n\n case 2:\n return [ 2 /*return*/ ];\n }\n }));\n }, f = 0, p = r, v.label = 7;\n\n case 7:\n return f < p.length ? (d = p[f], [ 5 /*yield**/ , h(d) ]) : [ 3 /*break*/ , 10 ];\n\n case 8:\n v.sent(), v.label = 9;\n\n case 9:\n return f++, [ 3 /*break*/ , 7 ];\n\n case 10:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n}\n\nfunction Ks(t) {\n var e = m(t);\n return e.ph.Gu.sh = Es.bind(null, e), e.ph.Gu.qe = Cs.bind(null, e), e.ph.Gu.nh = Ns.bind(null, e), \n e.Ch.yu = Vr.bind(null, e.bh), e.Ch.Wh = Ur.bind(null, e.bh), e;\n}\n\nfunction Qs(t) {\n var e = m(t);\n return e.ph.Gu.ih = As.bind(null, e), e.ph.Gu.rh = Ss.bind(null, e), e;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// TOOD(b/140938512): Drop SimpleQueryEngine and rename IndexFreeQueryEngine.\n/**\n * A query engine that takes advantage of the target document mapping in the\n * QueryCache. The IndexFreeQueryEngine optimizes query execution by only\n * reading the documents that previously matched a query plus any documents that were\n * edited after the query was last listened to.\n *\n * There are some cases where Index-Free queries are not guaranteed to produce\n * the same results as full collection scans. In these cases, the\n * IndexFreeQueryEngine falls back to full query processing. These cases are:\n *\n * - Limit queries where a document that matched the query previously no longer\n * matches the query.\n *\n * - Limit queries where a document edit may cause the document to sort below\n * another document that is in the local cache.\n *\n * - Queries that have never been CURRENT or free of Limbo documents.\n */ var Hs = /** @class */ function() {\n function t() {}\n return t.prototype.Nc = function(t) {\n this.zh = t;\n }, t.prototype.Lr = function(t, e, r, i) {\n var o = this;\n // Queries that match all documents don't benefit from using\n // IndexFreeQueries. It is more efficient to scan all documents in a\n // collection, rather than to perform individual lookups.\n return function(t) {\n return 0 === t.filters.length && null === t.limit && null == t.startAt && null == t.endAt && (0 === t.on.length || 1 === t.on.length && t.on[0].field.p());\n }(e) || r.isEqual(st.min()) ? this.Hh(t, e) : this.zh.kr(t, i).next((function(s) {\n var u = o.Yh(e, s);\n return (Cn(e) || Fn(e)) && o.Eh(e.an, u, i, r) ? o.Hh(t, e) : (f() <= n.LogLevel.DEBUG && l(\"IndexFreeQueryEngine\", \"Re-using previous result from %s to execute query: %s\", r.toString(), Yn(e)), \n o.zh.Lr(t, e, r).next((function(t) {\n // We merge `previousResults` into `updateResults`, since\n // `updateResults` is already a DocumentMap. If a document is\n // contained in both lists, then its contents are the same.\n return u.forEach((function(e) {\n t = t.ot(e.key, e);\n })), t;\n })));\n }));\n // Queries that have never seen a snapshot without limbo free documents\n // should also be run as a full collection scan.\n }, \n /** Applies the query filter and sorting to the provided documents. */ t.prototype.Yh = function(t, e) {\n // Sort the documents and re-apply the query filter since previously\n // matching documents do not necessarily still match the query.\n var n = new Tt(Xn(t));\n return e.forEach((function(e, r) {\n r instanceof kn && $n(t, r) && (n = n.add(r));\n })), n;\n }, \n /**\n * Determines if a limit query needs to be refilled from cache, making it\n * ineligible for index-free execution.\n *\n * @param sortedPreviousResults The documents that matched the query when it\n * was last synchronized, sorted by the query's comparator.\n * @param remoteKeys The document keys that matched the query at the last\n * snapshot.\n * @param limboFreeSnapshotVersion The version of the snapshot when the query\n * was last synchronized.\n */\n t.prototype.Eh = function(t, e, n, r) {\n // The query needs to be refilled if a previously matching document no\n // longer matches.\n if (n.size !== e.size) return !0;\n // Limit queries are not eligible for index-free query execution if there is\n // a potential that an older document from cache now sorts before a document\n // that was previously part of the limit. This, however, can only happen if\n // the document at the edge of the limit goes out of limit.\n // If a document that is not the limit boundary sorts differently,\n // the boundary of the limit itself did not change and documents from cache\n // will continue to be \"rejected\" by this boundary. Therefore, we can ignore\n // any modifications that don't affect the last document.\n var i = \"F\" /* First */ === t ? e.last() : e.first();\n return !!i && (i.hasPendingWrites || i.version.L(r) > 0);\n }, t.prototype.Hh = function(t, e) {\n return f() <= n.LogLevel.DEBUG && l(\"IndexFreeQueryEngine\", \"Using full collection scan to execute query:\", Yn(e)), \n this.zh.Lr(t, e, st.min());\n }, t;\n}(), Ys = /** @class */ function() {\n function t(t, e) {\n this.Dr = t, this.No = e, \n /**\n * The set of all mutations that have been sent but not yet been applied to\n * the backend.\n */\n this.Sr = [], \n /** Next value to use when assigning sequential IDs to each mutation batch. */\n this.Jh = 1, \n /** An ordered mapping between documents and the mutations batch IDs. */\n this.Xh = new Tt(Lo.kc);\n }\n return t.prototype.$o = function(t) {\n return yr.resolve(0 === this.Sr.length);\n }, t.prototype.ko = function(t, e, n, r) {\n var i = this.Jh;\n this.Jh++, this.Sr.length > 0 && this.Sr[this.Sr.length - 1];\n var o = new Xr(i, e, n, r);\n this.Sr.push(o);\n // Track references by document key and index collection parents.\n for (var s = 0, u = r; s < u.length; s++) {\n var a = u[s];\n this.Xh = this.Xh.add(new Lo(a.key, i)), this.Dr.Mo(t, a.key.path.h());\n }\n return yr.resolve(o);\n }, t.prototype.Oo = function(t, e) {\n return yr.resolve(this.Zh(e));\n }, t.prototype.Bo = function(t, e) {\n var n = e + 1, r = this.tl(n), i = r < 0 ? 0 : r;\n // The requested batchId may still be out of range so normalize it to the\n // start of the queue.\n return yr.resolve(this.Sr.length > i ? this.Sr[i] : null);\n }, t.prototype.qo = function() {\n return yr.resolve(0 === this.Sr.length ? -1 : this.Jh - 1);\n }, t.prototype.Uo = function(t) {\n return yr.resolve(this.Sr.slice());\n }, t.prototype.Nr = function(t, e) {\n var n = this, r = new Lo(e, 0), i = new Lo(e, Number.POSITIVE_INFINITY), o = [];\n return this.Xh.Ft([ r, i ], (function(t) {\n var e = n.Zh(t.jc);\n o.push(e);\n })), yr.resolve(o);\n }, t.prototype.Or = function(t, e) {\n var n = this, r = new Tt(H);\n return e.forEach((function(t) {\n var e = new Lo(t, 0), i = new Lo(t, Number.POSITIVE_INFINITY);\n n.Xh.Ft([ e, i ], (function(t) {\n r = r.add(t.jc);\n }));\n })), yr.resolve(this.el(r));\n }, t.prototype.Wr = function(t, e) {\n // Use the query path as a prefix for testing if a document matches the\n // query.\n var n = e.path, r = n.length + 1, i = n;\n // Construct a document reference for actually scanning the index. Unlike\n // the prefix the document key in this reference must have an even number of\n // segments. The empty segment can be used a suffix of the query path\n // because it precedes all other segments in an ordered traversal.\n A.F(i) || (i = i.child(\"\"));\n var o = new Lo(new A(i), 0), s = new Tt(H);\n // Find unique batchIDs referenced by all documents potentially matching the\n // query.\n return this.Xh.xt((function(t) {\n var e = t.key.path;\n return !!n.T(e) && (\n // Rows with document keys more than one segment longer than the query\n // path can't be matches. For example, a query on 'rooms' can't match\n // the document /rooms/abc/messages/xyx.\n // TODO(mcg): we'll need a different scanner when we implement\n // ancestor queries.\n e.length === r && (s = s.add(t.jc)), !0);\n }), o), yr.resolve(this.el(s));\n }, t.prototype.el = function(t) {\n var e = this, n = [];\n // Construct an array of matching batches, sorted by batchID to ensure that\n // multiple mutations affecting the same document key are applied in order.\n return t.forEach((function(t) {\n var r = e.Zh(t);\n null !== r && n.push(r);\n })), n;\n }, t.prototype.Wo = function(t, e) {\n var n = this;\n g(0 === this.nl(e.batchId, \"removed\")), this.Sr.shift();\n var r = this.Xh;\n return yr.forEach(e.mutations, (function(i) {\n var o = new Lo(i.key, e.batchId);\n return r = r.delete(o), n.No.Go(t, i.key);\n })).next((function() {\n n.Xh = r;\n }));\n }, t.prototype.Ko = function(t) {\n // No-op since the memory mutation queue does not maintain a separate cache.\n }, t.prototype.Ho = function(t, e) {\n var n = new Lo(e, 0), r = this.Xh.$t(n);\n return yr.resolve(e.isEqual(r && r.key));\n }, t.prototype.zo = function(t) {\n return this.Sr.length, yr.resolve();\n }, \n /**\n * Finds the index of the given batchId in the mutation queue and asserts that\n * the resulting index is within the bounds of the queue.\n *\n * @param batchId The batchId to search for\n * @param action A description of what the caller is doing, phrased in passive\n * form (e.g. \"acknowledged\" in a routine that acknowledges batches).\n */\n t.prototype.nl = function(t, e) {\n return this.tl(t);\n }, \n /**\n * Finds the index of the given batchId in the mutation queue. This operation\n * is O(1).\n *\n * @return The computed index of the batch with the given batchId, based on\n * the state of the queue. Note this index can be negative if the requested\n * batchId has already been remvoed from the queue or past the end of the\n * queue if the batchId is larger than the last added batch.\n */\n t.prototype.tl = function(t) {\n return 0 === this.Sr.length ? 0 : t - this.Sr[0].batchId;\n // Examine the front of the queue to figure out the difference between the\n // batchId and indexes in the array. Note that since the queue is ordered\n // by batchId, if the first batch has a larger batchId then the requested\n // batchId doesn't exist in the queue.\n }, \n /**\n * A version of lookupMutationBatch that doesn't return a promise, this makes\n * other functions that uses this code easier to read and more efficent.\n */\n t.prototype.Zh = function(t) {\n var e = this.tl(t);\n return e < 0 || e >= this.Sr.length ? null : this.Sr[e];\n }, t;\n}(), $s = /** @class */ function() {\n /**\n * @param sizer Used to assess the size of a document. For eager GC, this is expected to just\n * return 0 to avoid unnecessarily doing the work of calculating the size.\n */\n function t(t, e) {\n this.Dr = t, this.sl = e, \n /** Underlying cache of documents and their read times. */\n this.docs = new bt(A.i), \n /** Size of all cached documents. */\n this.size = 0\n /**\n * Adds the supplied entry to the cache and updates the cache size as appropriate.\n *\n * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()`.\n */;\n }\n return t.prototype.Er = function(t, e, n) {\n var r = e.key, i = this.docs.get(r), o = i ? i.size : 0, s = this.sl(e);\n return this.docs = this.docs.ot(r, {\n ta: e,\n size: s,\n readTime: n\n }), this.size += s - o, this.Dr.Mo(t, r.path.h());\n }, \n /**\n * Removes the specified entry from the cache and updates the cache size as appropriate.\n *\n * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()`.\n */\n t.prototype.Ar = function(t) {\n var e = this.docs.get(t);\n e && (this.docs = this.docs.remove(t), this.size -= e.size);\n }, t.prototype.Rr = function(t, e) {\n var n = this.docs.get(e);\n return yr.resolve(n ? n.ta : null);\n }, t.prototype.getEntries = function(t, e) {\n var n = this, r = Dt();\n return e.forEach((function(t) {\n var e = n.docs.get(t);\n r = r.ot(t, e ? e.ta : null);\n })), yr.resolve(r);\n }, t.prototype.Lr = function(t, e, n) {\n for (var r = Lt(), i = new A(e.path.child(\"\")), o = this.docs.ft(i)\n // Documents are ordered by key, so we can use a prefix scan to narrow down\n // the documents we need to match the query against.\n ; o.At(); ) {\n var s = o.It(), u = s.key, a = s.value, c = a.ta, h = a.readTime;\n if (!e.path.T(u.path)) break;\n h.L(n) <= 0 || c instanceof kn && $n(e, c) && (r = r.ot(c.key, c));\n }\n return yr.resolve(r);\n }, t.prototype.il = function(t, e) {\n return yr.forEach(this.docs, (function(t) {\n return e(t);\n }));\n }, t.prototype.ra = function(t) {\n // `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps\n // a separate changelog and does not need special handling for removals.\n return new Xs(this);\n }, t.prototype.aa = function(t) {\n return yr.resolve(this.size);\n }, t;\n}(), Xs = /** @class */ function(e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).ca = t, n;\n }\n return t.__extends(n, e), n.prototype.yr = function(t) {\n var e = this, n = [];\n return this.wr.forEach((function(r, i) {\n i ? n.push(e.ca.Er(t, i, e.readTime)) : e.ca.Ar(r);\n })), yr.$n(n);\n }, n.prototype.gr = function(t, e) {\n return this.ca.Rr(t, e);\n }, n.prototype.Pr = function(t, e) {\n return this.ca.getEntries(t, e);\n }, n;\n}(Zr), Js = /** @class */ function() {\n function t(t) {\n this.persistence = t, \n /**\n * Maps a target to the data about that target\n */\n this.rl = new it((function(t) {\n return lt(t);\n }), pt), \n /** The last received snapshot version. */\n this.lastRemoteSnapshotVersion = st.min(), \n /** The highest numbered target ID encountered. */\n this.highestTargetId = 0, \n /** The highest sequence number encountered. */\n this.ol = 0, \n /**\n * A ordered bidirectional mapping between documents and the remote target\n * IDs.\n */\n this.al = new xo, this.targetCount = 0, this.cl = ro.fa();\n }\n return t.prototype.Ce = function(t, e) {\n return this.rl.forEach((function(t, n) {\n return e(n);\n })), yr.resolve();\n }, t.prototype.Ea = function(t) {\n return yr.resolve(this.lastRemoteSnapshotVersion);\n }, t.prototype.Ia = function(t) {\n return yr.resolve(this.ol);\n }, t.prototype.wa = function(t) {\n return this.highestTargetId = this.cl.next(), yr.resolve(this.highestTargetId);\n }, t.prototype.Aa = function(t, e, n) {\n return n && (this.lastRemoteSnapshotVersion = n), e > this.ol && (this.ol = e), \n yr.resolve();\n }, t.prototype.ga = function(t) {\n this.rl.set(t.target, t);\n var e = t.targetId;\n e > this.highestTargetId && (this.cl = new ro(e), this.highestTargetId = e), t.sequenceNumber > this.ol && (this.ol = t.sequenceNumber);\n }, t.prototype.Ra = function(t, e) {\n return this.ga(e), this.targetCount += 1, yr.resolve();\n }, t.prototype.ya = function(t, e) {\n return this.ga(e), yr.resolve();\n }, t.prototype.Va = function(t, e) {\n return this.rl.delete(e.target), this.al.Uc(e.targetId), this.targetCount -= 1, \n yr.resolve();\n }, t.prototype.po = function(t, e, n) {\n var r = this, i = 0, o = [];\n return this.rl.forEach((function(s, u) {\n u.sequenceNumber <= e && null === n.get(u.targetId) && (r.rl.delete(s), o.push(r.pa(t, u.targetId)), \n i++);\n })), yr.$n(o).next((function() {\n return i;\n }));\n }, t.prototype.ba = function(t) {\n return yr.resolve(this.targetCount);\n }, t.prototype.va = function(t, e) {\n var n = this.rl.get(e) || null;\n return yr.resolve(n);\n }, t.prototype.Sa = function(t, e, n) {\n return this.al.Lc(e, n), yr.resolve();\n }, t.prototype.Ca = function(t, e, n) {\n this.al.qc(e, n);\n var r = this.persistence.No, i = [];\n return r && e.forEach((function(e) {\n i.push(r.Go(t, e));\n })), yr.$n(i);\n }, t.prototype.pa = function(t, e) {\n return this.al.Uc(e), yr.resolve();\n }, t.prototype.Fa = function(t, e) {\n var n = this.al.Wc(e);\n return yr.resolve(n);\n }, t.prototype.Ho = function(t, e) {\n return yr.resolve(this.al.Ho(e));\n }, t;\n}(), Zs = /** @class */ function() {\n /**\n * The constructor accepts a factory for creating a reference delegate. This\n * allows both the delegate and this instance to have strong references to\n * each other without having nullable fields that would then need to be\n * checked or asserted on every access.\n */\n function t(t) {\n var e = this;\n this.ul = {}, this.Ma = new qr(0), this.Oa = !1, this.Oa = !0, this.No = t(this), \n this.Ka = new Js(this), this.Dr = new Ui, this.vr = function(t, n) {\n return new $s(t, (function(t) {\n return e.No.hl(t);\n }));\n }(this.Dr);\n }\n return t.prototype.start = function() {\n return Promise.resolve();\n }, t.prototype.Di = function() {\n // No durable state to ensure is closed on shutdown.\n return this.Oa = !1, Promise.resolve();\n }, Object.defineProperty(t.prototype, \"Ei\", {\n get: function() {\n return this.Oa;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.Za = function() {\n // No op.\n }, t.prototype.tc = function() {\n // No op.\n }, t.prototype.Ic = function() {\n return this.Dr;\n }, t.prototype.mc = function(t) {\n var e = this.ul[t.ti()];\n return e || (e = new Ys(this.Dr, this.No), this.ul[t.ti()] = e), e;\n }, t.prototype.Tc = function() {\n return this.Ka;\n }, t.prototype.Ec = function() {\n return this.vr;\n }, t.prototype.runTransaction = function(t, e, n) {\n var r = this;\n l(\"MemoryPersistence\", \"Starting transaction:\", t);\n var i = new tu(this.Ma.next());\n return this.No.ll(), n(i).next((function(t) {\n return r.No._l(i).next((function() {\n return t;\n }));\n })).Fn().then((function(t) {\n return i.br(), t;\n }));\n }, t.prototype.fl = function(t, e) {\n return yr.kn(Object.values(this.ul).map((function(n) {\n return function() {\n return n.Ho(t, e);\n };\n })));\n }, t;\n}(), tu = /** @class */ function(e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).xa = t, n;\n }\n return t.__extends(n, e), n;\n}(ei), eu = /** @class */ function() {\n function t(t) {\n this.persistence = t, \n /** Tracks all documents that are active in Query views. */\n this.dl = new xo, \n /** The list of documents that are potentially GCed after each transaction. */\n this.wl = null;\n }\n return t.ml = function(e) {\n return new t(e);\n }, Object.defineProperty(t.prototype, \"Tl\", {\n get: function() {\n if (this.wl) return this.wl;\n throw y();\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.Da = function(t, e, n) {\n return this.dl.Da(n, e), this.Tl.delete(n.toString()), yr.resolve();\n }, t.prototype.Na = function(t, e, n) {\n return this.dl.Na(n, e), this.Tl.add(n.toString()), yr.resolve();\n }, t.prototype.Go = function(t, e) {\n return this.Tl.add(e.toString()), yr.resolve();\n }, t.prototype.removeTarget = function(t, e) {\n var n = this;\n this.dl.Uc(e.targetId).forEach((function(t) {\n return n.Tl.add(t.toString());\n }));\n var r = this.persistence.Tc();\n return r.Fa(t, e.targetId).next((function(t) {\n t.forEach((function(t) {\n return n.Tl.add(t.toString());\n }));\n })).next((function() {\n return r.Va(t, e);\n }));\n }, t.prototype.ll = function() {\n this.wl = new Set;\n }, t.prototype._l = function(t) {\n var e = this, n = this.persistence.Ec().ra();\n // Remove newly orphaned documents.\n return yr.forEach(this.Tl, (function(r) {\n var i = A.D(r);\n return e.El(t, i).next((function(t) {\n t || n.Ar(i);\n }));\n })).next((function() {\n return e.wl = null, n.apply(t);\n }));\n }, t.prototype.yc = function(t, e) {\n var n = this;\n return this.El(t, e).next((function(t) {\n t ? n.Tl.delete(e.toString()) : n.Tl.add(e.toString());\n }));\n }, t.prototype.hl = function(t) {\n // For eager GC, we don't care about the document size, there are no size thresholds.\n return 0;\n }, t.prototype.El = function(t, e) {\n var n = this;\n return yr.kn([ function() {\n return yr.resolve(n.dl.Ho(e));\n }, function() {\n return n.persistence.Tc().Ho(t, e);\n }, function() {\n return n.persistence.fl(t, e);\n } ]);\n }, t;\n}(), nu = /** @class */ function() {\n function t(t) {\n this.Il = t.Il, this.Al = t.Al;\n }\n return t.prototype.gu = function(t) {\n this.Rl = t;\n }, t.prototype.Tu = function(t) {\n this.gl = t;\n }, t.prototype.onMessage = function(t) {\n this.Pl = t;\n }, t.prototype.close = function() {\n this.Al();\n }, t.prototype.send = function(t) {\n this.Il(t);\n }, t.prototype.yl = function() {\n this.Rl();\n }, t.prototype.Vl = function(t) {\n this.gl(t);\n }, t.prototype.pl = function(t) {\n this.Pl(t);\n }, t;\n}(), ru = {\n BatchGetDocuments: \"batchGet\",\n Commit: \"commit\",\n RunQuery: \"runQuery\"\n}, iu = /** @class */ function(e) {\n function n(t) {\n var n = this;\n return (n = e.call(this, t) || this).forceLongPolling = t.forceLongPolling, n.W = t.W, \n n;\n }\n /**\n * Base class for all Rest-based connections to the backend (WebChannel and\n * HTTP).\n */\n return t.__extends(n, e), n.prototype.Nl = function(t, e, n, r) {\n return new Promise((function(o, s) {\n var u = new i.XhrIo;\n u.listenOnce(i.EventType.COMPLETE, (function() {\n try {\n switch (u.getLastErrorCode()) {\n case i.ErrorCode.NO_ERROR:\n var e = u.getResponseJson();\n l(\"Connection\", \"XHR received:\", JSON.stringify(e)), o(e);\n break;\n\n case i.ErrorCode.TIMEOUT:\n l(\"Connection\", 'RPC \"' + t + '\" timed out'), s(new c(a.DEADLINE_EXCEEDED, \"Request time out\"));\n break;\n\n case i.ErrorCode.HTTP_ERROR:\n var n = u.getStatus();\n if (l(\"Connection\", 'RPC \"' + t + '\" failed with status:', n, \"response text:\", u.getResponseText()), \n n > 0) {\n var r = u.getResponseJson().error;\n if (r && r.status && r.message) {\n var h = function(t) {\n var e = t.toLowerCase().replace(\"_\", \"-\");\n return Object.values(a).indexOf(e) >= 0 ? e : a.UNKNOWN;\n }(r.status);\n s(new c(h, r.message));\n } else s(new c(a.UNKNOWN, \"Server responded with status \" + u.getStatus()));\n } else \n // If we received an HTTP_ERROR but there's no status code,\n // it's most probably a connection issue\n s(new c(a.UNAVAILABLE, \"Connection failed.\"));\n break;\n\n default:\n y();\n }\n } finally {\n l(\"Connection\", 'RPC \"' + t + '\" completed.');\n }\n }));\n var h = JSON.stringify(r);\n u.send(e, \"POST\", h, n, 15);\n }));\n }, n.prototype.Pu = function(t, e) {\n var n = [ this.vl, \"/\", \"google.firestore.v1.Firestore\", \"/\", t, \"/channel\" ], o = i.createWebChannelTransport(), s = {\n // Required for backend stickiness, routing behavior is based on this\n // parameter.\n httpSessionIdParam: \"gsessionid\",\n initMessageHeaders: {},\n messageUrlParams: {\n // This param is used to improve routing and project isolation by the\n // backend and must be included in every request.\n database: \"projects/\" + this.U.projectId + \"/databases/\" + this.U.database\n },\n sendRawJson: !0,\n supportsCrossDomainXhr: !0,\n internalChannelParams: {\n // Override the default timeout (randomized between 10-20 seconds) since\n // a large write batch on a slow internet connection may take a long\n // time to send to the backend. Rather than have WebChannel impose a\n // tight timeout which could lead to infinite timeouts and retries, we\n // set it very large (5-10 minutes) and rely on the browser's builtin\n // timeouts to kick in if the request isn't working.\n forwardChannelRequestTimeoutMs: 6e5\n },\n forceLongPolling: this.forceLongPolling,\n detectBufferingProxy: this.W\n };\n this.Cl(s.initMessageHeaders, e), \n // Sending the custom headers we just added to request.initMessageHeaders\n // (Authorization, etc.) will trigger the browser to make a CORS preflight\n // request because the XHR will no longer meet the criteria for a \"simple\"\n // CORS request:\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests\n // Therefore to avoid the CORS preflight request (an extra network\n // roundtrip), we use the httpHeadersOverwriteParam option to specify that\n // the headers should instead be encoded into a special \"$httpHeaders\" query\n // parameter, which is recognized by the webchannel backend. This is\n // formally defined here:\n // https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L32\n // TODO(b/145624756): There is a backend bug where $httpHeaders isn't respected if the request\n // doesn't have an Origin header. So we have to exclude a few browser environments that are\n // known to (sometimes) not include an Origin. See\n // https://github.com/firebase/firebase-js-sdk/issues/1491.\n r.isMobileCordova() || r.isReactNative() || r.isElectron() || r.isIE() || r.isUWP() || r.isBrowserExtension() || (s.httpHeadersOverwriteParam = \"$httpHeaders\");\n var u = n.join(\"\");\n l(\"Connection\", \"Creating WebChannel: \" + u, s);\n var h = o.createWebChannel(u, s), f = !1, p = !1, v = new nu({\n Il: function(t) {\n p ? l(\"Connection\", \"Not sending because WebChannel is closed:\", t) : (f || (l(\"Connection\", \"Opening WebChannel transport.\"), \n h.open(), f = !0), l(\"Connection\", \"WebChannel sending:\", t), h.send(t));\n },\n Al: function() {\n return h.close();\n }\n }), y = function(t, e) {\n // TODO(dimond): closure typing seems broken because WebChannel does\n // not implement goog.events.Listenable\n h.listen(t, (function(t) {\n try {\n e(t);\n } catch (t) {\n setTimeout((function() {\n throw t;\n }), 0);\n }\n }));\n };\n // WebChannel supports sending the first message with the handshake - saving\n // a network round trip. However, it will have to call send in the same\n // JS event loop as open. In order to enforce this, we delay actually\n // opening the WebChannel until send is called. Whether we have called\n // open is tracked with this variable.\n // Closure events are guarded and exceptions are swallowed, so catch any\n // exception and rethrow using a setTimeout so they become visible again.\n // Note that eventually this function could go away if we are confident\n // enough the code is exception free.\n return y(i.WebChannel.EventType.OPEN, (function() {\n p || l(\"Connection\", \"WebChannel transport opened.\");\n })), y(i.WebChannel.EventType.CLOSE, (function() {\n p || (p = !0, l(\"Connection\", \"WebChannel transport closed\"), v.Vl());\n })), y(i.WebChannel.EventType.ERROR, (function(t) {\n p || (p = !0, d(\"Connection\", \"WebChannel transport errored:\", t), v.Vl(new c(a.UNAVAILABLE, \"The operation could not be completed\")));\n })), y(i.WebChannel.EventType.MESSAGE, (function(t) {\n var e;\n if (!p) {\n var n = t.data[0];\n g(!!n);\n // TODO(b/35143891): There is a bug in One Platform that caused errors\n // (and only errors) to be wrapped in an extra array. To be forward\n // compatible with the bug we need to check either condition. The latter\n // can be removed once the fix has been rolled out.\n // Use any because msgData.error is not typed.\n var r = n, i = r.error || (null === (e = r[0]) || void 0 === e ? void 0 : e.error);\n if (i) {\n l(\"Connection\", \"WebChannel received error:\", i);\n // error.status will be a string like 'OK' or 'NOT_FOUND'.\n var o = i.status, s = function(t) {\n // lookup by string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var e = vt[t];\n if (void 0 !== e) return _t(e);\n }(o), u = i.message;\n void 0 === s && (s = a.INTERNAL, u = \"Unknown error status: \" + o + \" with message \" + i.message), \n // Mark closed so no further events are propagated\n p = !0, v.Vl(new c(s, u)), h.close();\n } else l(\"Connection\", \"WebChannel received:\", n), v.pl(n);\n }\n })), setTimeout((function() {\n // Technically we could/should wait for the WebChannel opened event,\n // but because we want to send the first message with the WebChannel\n // handshake we pretend the channel opened here (asynchronously), and\n // then delay the actual open until the first message is sent.\n v.yl();\n }), 0), v;\n }, n;\n}(/** @class */ function() {\n function t(t) {\n this.bl = t, this.U = t.U;\n var e = t.ssl ? \"https\" : \"http\";\n this.vl = e + \"://\" + t.host, this.Sl = \"projects/\" + this.U.projectId + \"/databases/\" + this.U.database + \"/documents\";\n }\n return t.prototype.$u = function(t, e, n, r) {\n var i = this.Dl(t, e);\n l(\"RestConnection\", \"Sending: \", i, n);\n var o = {};\n return this.Cl(o, r), this.Nl(t, i, o, n).then((function(t) {\n return l(\"RestConnection\", \"Received: \", t), t;\n }), (function(e) {\n throw d(\"RestConnection\", t + \" failed with error: \", e, \"url: \", i, \"request:\", n), \n e;\n }));\n }, t.prototype.ku = function(t, e, n, r) {\n // The REST API automatically aggregates all of the streamed results, so we\n // can just use the normal invoke() method.\n return this.$u(t, e, n, r);\n }, \n /**\n * Modifies the headers for a request, adding any authorization token if\n * present and any additional headers for the request.\n */\n t.prototype.Cl = function(t, e) {\n if (t[\"X-Goog-Api-Client\"] = \"gl-js/ fire/7.24.0\", \n // Content-Type: text/plain will avoid preflight requests which might\n // mess with CORS and redirects by proxies. If we add custom headers\n // we will need to change this code to potentially use the $httpOverwrite\n // parameter supported by ESF to avoid triggering preflight requests.\n t[\"Content-Type\"] = \"text/plain\", e) for (var n in e.Kc) e.Kc.hasOwnProperty(n) && (t[n] = e.Kc[n]);\n }, t.prototype.Dl = function(t, e) {\n var n = ru[t];\n return this.vl + \"/v1/\" + e + \":\" + n;\n }, t;\n}()), ou = /** @class */ function() {\n function t() {\n var t = this;\n this.Fl = function() {\n return t.xl();\n }, this.$l = function() {\n return t.kl();\n }, this.Ml = [], this.Ol();\n }\n return t.prototype.Zu = function(t) {\n this.Ml.push(t);\n }, t.prototype.Di = function() {\n window.removeEventListener(\"online\", this.Fl), window.removeEventListener(\"offline\", this.$l);\n }, t.prototype.Ol = function() {\n window.addEventListener(\"online\", this.Fl), window.addEventListener(\"offline\", this.$l);\n }, t.prototype.xl = function() {\n l(\"ConnectivityMonitor\", \"Network connectivity changed: AVAILABLE\");\n for (var t = 0, e = this.Ml; t < e.length; t++) {\n (0, e[t])(0 /* AVAILABLE */);\n }\n }, t.prototype.kl = function() {\n l(\"ConnectivityMonitor\", \"Network connectivity changed: UNAVAILABLE\");\n for (var t = 0, e = this.Ml; t < e.length; t++) {\n (0, e[t])(1 /* UNAVAILABLE */);\n }\n }, \n // TODO(chenbrian): Consider passing in window either into this component or\n // here for testing via FakeWindow.\n /** Checks that all used attributes of window are available. */\n t.Ln = function() {\n return \"undefined\" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener;\n }, t;\n}(), su = /** @class */ function() {\n function t() {}\n return t.prototype.Zu = function(t) {\n // No-op.\n }, t.prototype.Di = function() {\n // No-op.\n }, t;\n}();\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Initializes the WebChannelConnection for the browser. */\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction uu(t) {\n return new ye(t, /* useProto3Json= */ !0);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ var au = \"You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.\", cu = /** @class */ function() {\n function e() {}\n return e.prototype.initialize = function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return this.Sh = this.Ll(e), this.persistence = this.Bl(e), [ 4 /*yield*/ , this.persistence.start() ];\n\n case 1:\n return t.sent(), this.ql = this.Ul(e), this.ju = this.Ql(e), [ 2 /*return*/ ];\n }\n }));\n }));\n }, e.prototype.Ul = function(t) {\n return null;\n }, e.prototype.Ql = function(t) {\n /** Manages our in-memory or durable persistence. */\n return e = this.persistence, n = new Hs, r = t.Wl, new go(e, n, r);\n var e, n, r;\n }, e.prototype.Bl = function(t) {\n if (t.persistenceSettings.jl) throw new c(a.FAILED_PRECONDITION, au);\n return new Zs(eu.ml);\n }, e.prototype.Ll = function(t) {\n return new $r;\n }, e.prototype.terminate = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return this.ql && this.ql.stop(), [ 4 /*yield*/ , this.Sh.Di() ];\n\n case 1:\n return t.sent(), [ 4 /*yield*/ , this.persistence.Di() ];\n\n case 2:\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }, e.prototype.clearPersistence = function(t, e) {\n throw new c(a.FAILED_PRECONDITION, au);\n }, e;\n}(), hu = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.prototype.initialize = function(n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i = this;\n return t.__generator(this, (function(o) {\n switch (o.label) {\n case 0:\n return [ 4 /*yield*/ , e.prototype.initialize.call(this, n) ];\n\n case 1:\n return o.sent(), r = this.Kl.fi, this.Sh instanceof Yr ? (this.Sh.fi = {\n er: Ms.bind(null, r),\n nr: Bs.bind(null, r),\n sr: Ws.bind(null, r),\n pi: zs.bind(null, r)\n }, [ 4 /*yield*/ , this.Sh.start() ]) : [ 3 /*break*/ , 3 ];\n\n case 2:\n o.sent(), o.label = 3;\n\n case 3:\n // NOTE: This will immediately call the listener, so we make sure to\n // set it after localStore / remoteStore are started.\n return [ 4 /*yield*/ , this.persistence.Xa((function(e) {\n return t.__awaiter(i, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return [ 4 /*yield*/ , qs(this.Kl.fi, e) ];\n\n case 1:\n return t.sent(), this.ql && (e && !this.ql.Ei ? this.ql.start(this.ju) : e || this.ql.stop()), \n [ 2 /*return*/ ];\n }\n }));\n }));\n })) ];\n\n case 4:\n // NOTE: This will immediately call the listener, so we make sure to\n // set it after localStore / remoteStore are started.\n return o.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }, n.prototype.Ll = function(t) {\n if (t.persistenceSettings.jl && t.persistenceSettings.synchronizeTabs) {\n var e = Ar();\n if (!Yr.Ln(e)) throw new c(a.UNIMPLEMENTED, \"IndexedDB persistence is only available on platforms that support LocalStorage.\");\n var n = yo(t.bl.U, t.bl.persistenceKey);\n return new Yr(e, t.cs, n, t.clientId, t.Wl);\n }\n return new $r;\n }, n;\n}(/** @class */ function(e) {\n function n(t) {\n var n = this;\n return (n = e.call(this) || this).Kl = t, n;\n }\n return t.__extends(n, e), n.prototype.initialize = function(n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return [ 4 /*yield*/ , e.prototype.initialize.call(this, n) ];\n\n case 1:\n return t.sent(), [ 4 /*yield*/ , So(this.ju) ];\n\n case 2:\n return t.sent(), [ 4 /*yield*/ , this.Kl.initialize(this, n) ];\n\n case 3:\n // Enqueue writes from a previous session\n return t.sent(), [ 4 /*yield*/ , Qs(this.Kl.fi) ];\n\n case 4:\n // Enqueue writes from a previous session\n return t.sent(), [ 4 /*yield*/ , is(this.Kl.ph) ];\n\n case 5:\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }, n.prototype.Ul = function(t) {\n var e = this.persistence.No.wo;\n return new ai(e, t.cs);\n }, n.prototype.Bl = function(t) {\n var e = yo(t.bl.U, t.bl.persistenceKey), n = uu(t.bl.U);\n return new ho(t.persistenceSettings.synchronizeTabs, e, t.clientId, ui.ao(t.persistenceSettings.cacheSizeBytes), t.cs, Ar(), Sr(), n, this.Sh, t.persistenceSettings.ka);\n }, n.prototype.Ll = function(t) {\n return new $r;\n }, n.prototype.clearPersistence = function(e, n) {\n return function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return gr.Ln() ? (n = e + \"main\", [ 4 /*yield*/ , gr.delete(n) ]) : [ 2 /*return*/ , Promise.resolve() ];\n\n case 1:\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }(yo(e, n));\n }, n;\n}(cu)), fu = /** @class */ function() {\n function e() {}\n return e.prototype.initialize = function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r = this;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return this.ju ? [ 3 /*break*/ , 2 ] : (this.ju = e.ju, this.Sh = e.Sh, this.Ku = this.Gl(n), \n this.ph = this.zl(n), this.bh = this.Hl(n), this.fi = this.Yl(n), this.Sh.di = function(t) {\n return Ts(r.fi, t, 1 /* SharedClientState */);\n }, this.ph.Gu.Jl = Us.bind(null, this.fi), [ 4 /*yield*/ , fs(this.ph, this.fi.Uh) ]);\n\n case 1:\n t.sent(), t.label = 2;\n\n case 2:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }, e.prototype.Hl = function(t) {\n return new Rr;\n }, e.prototype.Gl = function(t) {\n var e, n = uu(t.bl.U), r = (e = t.bl, new iu(e));\n /** Return the Platform-specific connectivity monitor. */ return function(t, e, n) {\n return new Mo(t, e, n);\n }(t.credentials, r, n);\n }, e.prototype.zl = function(t) {\n var e, n, r, i, o, s = this;\n return e = this.ju, n = this.Ku, r = t.cs, i = function(t) {\n return Ts(s.fi, t, 0 /* RemoteStore */);\n }, o = ou.Ln() ? new ou : new su, new jo(e, n, r, i, o);\n }, e.prototype.Yl = function(t) {\n return function(t, e, n, \n // PORTING NOTE: Manages state synchronization in multi-tab environments.\n r, i, o, s) {\n var u = new ws(t, e, n, r, i, o);\n return s && (u.qh = !0), u;\n }(this.ju, this.ph, this.bh, this.Sh, t.Wl, t.Dh, !t.persistenceSettings.jl || !t.persistenceSettings.synchronizeTabs);\n }, e.prototype.terminate = function() {\n return Bo(this.ph);\n }, e;\n}(), lu = /** @class */ function() {\n function t(t) {\n this.observer = t, \n /**\n * When set to true, will not raise future events. Necessary to deal with\n * async detachment of listener.\n */\n this.muted = !1;\n }\n return t.prototype.next = function(t) {\n this.observer.next && this.Xl(this.observer.next, t);\n }, t.prototype.error = function(t) {\n this.observer.error ? this.Xl(this.observer.error, t) : console.error(\"Uncaught Error in snapshot listener:\", t);\n }, t.prototype.Zl = function() {\n this.muted = !0;\n }, t.prototype.Xl = function(t, e) {\n var n = this;\n this.muted || setTimeout((function() {\n n.muted || t(e);\n }), 0);\n }, t;\n}(), pu = function(t) {\n !function(t, e, n, r) {\n if (!(e instanceof Array) || e.length < 1) throw new c(a.INVALID_ARGUMENT, \"Function FieldPath() requires its fieldNames argument to be an array with at least \" + W(1, \"element\") + \".\");\n }(0, t);\n for (var e = 0; e < t.length; ++e) if (k(\"FieldPath\", \"string\", e, t[e]), 0 === t[e].length) throw new c(a.INVALID_ARGUMENT, \"Invalid field name at argument $(i + 1). Field names must not be empty.\");\n this.t_ = new N(t);\n}, du = /** @class */ function(e) {\n /**\n * Creates a FieldPath from the provided field names. If more than one field\n * name is provided, the path will point to a nested field in a document.\n *\n * @param fieldNames A list of field names.\n */\n function n() {\n for (var t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];\n return e.call(this, t) || this;\n }\n return t.__extends(n, e), n.documentId = function() {\n /**\n * Internal Note: The backend doesn't technically support querying by\n * document ID. Instead it queries by the entire document name (full path\n * included), but in the cases we currently support documentId(), the net\n * effect is the same.\n */\n return new n(N.v().R());\n }, n.prototype.isEqual = function(t) {\n if (!(t instanceof n)) throw G(\"isEqual\", \"FieldPath\", 1, t);\n return this.t_.isEqual(t.t_);\n }, n;\n}(pu), vu = new RegExp(\"[~\\\\*/\\\\[\\\\]]\"), yu = \n/**\n * @param _methodName The public API endpoint that returns this class.\n */\nfunction(t) {\n this.e_ = t;\n}, gu = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.prototype.n_ = function(t) {\n if (2 /* MergeSet */ !== t.s_) throw 1 /* Update */ === t.s_ ? t.i_(this.e_ + \"() can only appear at the top level of your update data\") : t.i_(this.e_ + \"() cannot be used with set() unless you pass {merge:true}\");\n // No transform to add for a delete, but we need to add it to our\n // fieldMask so it gets deleted.\n return t.We.push(t.path), null;\n }, n.prototype.isEqual = function(t) {\n return t instanceof n;\n }, n;\n}(yu);\n\n/**\n * Provides all components needed for Firestore with in-memory persistence.\n * Uses EagerGC garbage collection.\n */\n/**\n * Creates a child context for parsing SerializableFieldValues.\n *\n * This is different than calling `ParseContext.contextWith` because it keeps\n * the fieldTransforms and fieldMask separate.\n *\n * The created context has its `dataSource` set to `UserDataSource.Argument`.\n * Although these values are used with writes, any elements in these FieldValues\n * are not considered writes since they cannot contain any FieldValue sentinels,\n * etc.\n *\n * @param fieldValue The sentinel FieldValue for which to create a child\n * context.\n * @param context The parent context.\n * @param arrayElement Whether or not the FieldValue has an array.\n */\nfunction mu(t, e, n) {\n return new Lu({\n s_: 3 /* Argument */ ,\n r_: e.settings.r_,\n methodName: t.e_,\n o_: n\n }, e.U, e.serializer, e.ignoreUndefinedProperties);\n}\n\nvar wu = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.prototype.n_ = function(t) {\n return new cn(t.path, new Ze);\n }, n.prototype.isEqual = function(t) {\n return t instanceof n;\n }, n;\n}(yu), _u = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t) || this).a_ = n, r;\n }\n return t.__extends(n, e), n.prototype.n_ = function(t) {\n var e = mu(this, t, \n /*array=*/ !0), n = this.a_.map((function(t) {\n return Uu(t, e);\n })), r = new tn(n);\n return new cn(t.path, r);\n }, n.prototype.isEqual = function(t) {\n // TODO(mrschmidt): Implement isEquals\n return this === t;\n }, n;\n}(yu), bu = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t) || this).a_ = n, r;\n }\n return t.__extends(n, e), n.prototype.n_ = function(t) {\n var e = mu(this, t, \n /*array=*/ !0), n = this.a_.map((function(t) {\n return Uu(t, e);\n })), r = new nn(n);\n return new cn(t.path, r);\n }, n.prototype.isEqual = function(t) {\n // TODO(mrschmidt): Implement isEquals\n return this === t;\n }, n;\n}(yu), Iu = /** @class */ function(e) {\n function n(t, n) {\n var r = this;\n return (r = e.call(this, t) || this).c_ = n, r;\n }\n return t.__extends(n, e), n.prototype.n_ = function(t) {\n var e = new on(t.serializer, we(t.serializer, this.c_));\n return new cn(t.path, e);\n }, n.prototype.isEqual = function(t) {\n // TODO(mrschmidt): Implement isEquals\n return this === t;\n }, n;\n}(yu), Eu = /** @class */ function() {\n /**\n * Creates a new immutable `GeoPoint` object with the provided latitude and\n * longitude values.\n * @param latitude The latitude as number between -90 and 90.\n * @param longitude The longitude as number between -180 and 180.\n */\n function t(t, e) {\n if (D(\"GeoPoint\", arguments, 2), k(\"GeoPoint\", \"number\", 1, t), k(\"GeoPoint\", \"number\", 2, e), \n !isFinite(t) || t < -90 || t > 90) throw new c(a.INVALID_ARGUMENT, \"Latitude must be a number between -90 and 90, but was: \" + t);\n if (!isFinite(e) || e < -180 || e > 180) throw new c(a.INVALID_ARGUMENT, \"Longitude must be a number between -180 and 180, but was: \" + e);\n this.u_ = t, this.h_ = e;\n }\n return Object.defineProperty(t.prototype, \"latitude\", {\n /**\n * The latitude of this `GeoPoint` instance.\n */\n get: function() {\n return this.u_;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"longitude\", {\n /**\n * The longitude of this `GeoPoint` instance.\n */\n get: function() {\n return this.h_;\n },\n enumerable: !1,\n configurable: !0\n }), \n /**\n * Returns true if this `GeoPoint` is equal to the provided one.\n *\n * @param other The `GeoPoint` to compare against.\n * @return true if this `GeoPoint` is equal to the provided one.\n */\n t.prototype.isEqual = function(t) {\n return this.u_ === t.u_ && this.h_ === t.h_;\n }, t.prototype.toJSON = function() {\n return {\n latitude: this.u_,\n longitude: this.h_\n };\n }, \n /**\n * Actually private to JS consumers of our API, so this function is prefixed\n * with an underscore.\n */\n t.prototype.Y = function(t) {\n return H(this.u_, t.u_) || H(this.h_, t.h_);\n }, t;\n}(), Tu = function(t) {\n this.l_ = t;\n}, Nu = /^__.*__$/, Au = function(t, e, n) {\n this.__ = t, this.f_ = e, this.d_ = n;\n}, Su = /** @class */ function() {\n function t(t, e, n) {\n this.data = t, this.We = e, this.fieldTransforms = n;\n }\n return t.prototype.w_ = function(t, e) {\n var n = [];\n return null !== this.We ? n.push(new _n(t, this.data, this.We, e)) : n.push(new wn(t, this.data, e)), \n this.fieldTransforms.length > 0 && n.push(new In(t, this.fieldTransforms)), n;\n }, t;\n}(), Du = /** @class */ function() {\n function t(t, e, n) {\n this.data = t, this.We = e, this.fieldTransforms = n;\n }\n return t.prototype.w_ = function(t, e) {\n var n = [ new _n(t, this.data, this.We, e) ];\n return this.fieldTransforms.length > 0 && n.push(new In(t, this.fieldTransforms)), \n n;\n }, t;\n}();\n\nfunction xu(t) {\n switch (t) {\n case 0 /* Set */ :\n // fall through\n case 2 /* MergeSet */ :\n // fall through\n case 1 /* Update */ :\n return !0;\n\n case 3 /* Argument */ :\n case 4 /* ArrayArgument */ :\n return !1;\n\n default:\n throw y();\n }\n}\n\n/** A \"context\" object passed around while parsing user data. */ var Lu = /** @class */ function() {\n /**\n * Initializes a ParseContext with the given source and path.\n *\n * @param settings The settings for the parser.\n * @param databaseId The database ID of the Firestore instance.\n * @param serializer The serializer to use to generate the Value proto.\n * @param ignoreUndefinedProperties Whether to ignore undefined properties\n * rather than throw.\n * @param fieldTransforms A mutable list of field transforms encountered while\n * parsing the data.\n * @param fieldMask A mutable list of field paths encountered while parsing\n * the data.\n *\n * TODO(b/34871131): We don't support array paths right now, so path can be\n * null to indicate the context represents any location within an array (in\n * which case certain features will not work and errors will be somewhat\n * compromised).\n */\n function t(t, e, n, r, i, o) {\n this.settings = t, this.U = e, this.serializer = n, this.ignoreUndefinedProperties = r, \n // Minor hack: If fieldTransforms is undefined, we assume this is an\n // external call and we need to validate the entire path.\n void 0 === i && this.m_(), this.fieldTransforms = i || [], this.We = o || [];\n }\n return Object.defineProperty(t.prototype, \"path\", {\n get: function() {\n return this.settings.path;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"s_\", {\n get: function() {\n return this.settings.s_;\n },\n enumerable: !1,\n configurable: !0\n }), \n /** Returns a new context with the specified settings overwritten. */ t.prototype.T_ = function(e) {\n return new t(Object.assign(Object.assign({}, this.settings), e), this.U, this.serializer, this.ignoreUndefinedProperties, this.fieldTransforms, this.We);\n }, t.prototype.E_ = function(t) {\n var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.T_({\n path: n,\n o_: !1\n });\n return r.I_(t), r;\n }, t.prototype.A_ = function(t) {\n var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.T_({\n path: n,\n o_: !1\n });\n return r.m_(), r;\n }, t.prototype.R_ = function(t) {\n // TODO(b/34871131): We don't support array paths right now; so make path\n // undefined.\n return this.T_({\n path: void 0,\n o_: !0\n });\n }, t.prototype.i_ = function(t) {\n return Gu(t, this.settings.methodName, this.settings.g_ || !1, this.path, this.settings.r_);\n }, \n /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {\n return void 0 !== this.We.find((function(e) {\n return t.T(e);\n })) || void 0 !== this.fieldTransforms.find((function(e) {\n return t.T(e.field);\n }));\n }, t.prototype.m_ = function() {\n // TODO(b/34871131): Remove null check once we have proper paths for fields\n // within arrays.\n if (this.path) for (var t = 0; t < this.path.length; t++) this.I_(this.path.get(t));\n }, t.prototype.I_ = function(t) {\n if (0 === t.length) throw this.i_(\"Document fields must not be empty\");\n if (xu(this.s_) && Nu.test(t)) throw this.i_('Document fields cannot begin and end with \"__\"');\n }, t;\n}(), ku = /** @class */ function() {\n function t(t, e, n) {\n this.U = t, this.ignoreUndefinedProperties = e, this.serializer = n || uu(t)\n /** Creates a new top-level parse context. */;\n }\n return t.prototype.P_ = function(t, e, n, r) {\n return void 0 === r && (r = !1), new Lu({\n s_: t,\n methodName: e,\n r_: n,\n path: N.P(),\n o_: !1,\n g_: r\n }, this.U, this.serializer, this.ignoreUndefinedProperties);\n }, t;\n}();\n\n/**\n * Helper for parsing raw user input (provided via the API) into internal model\n * classes.\n */\n/** Parse document data from a set() call. */ function Ru(t, e, n, r, i, o) {\n void 0 === o && (o = {});\n var s = t.P_(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);\n Mu(\"Data must be an object, but it was:\", s, r);\n var u, h, f = Cu(r, s);\n if (o.merge) u = new an(s.We), h = s.fieldTransforms; else if (o.mergeFields) {\n for (var l = [], p = 0, d = o.mergeFields; p < d.length; p++) {\n var v = d[p], g = void 0;\n if (v instanceof pu) g = v.t_; else {\n if (\"string\" != typeof v) throw y();\n g = ju(e, v, n);\n }\n if (!s.contains(g)) throw new c(a.INVALID_ARGUMENT, \"Field '\" + g + \"' is specified in your field mask but missing from your input data.\");\n zu(l, g) || l.push(g);\n }\n u = new an(l), h = s.fieldTransforms.filter((function(t) {\n return u.Ye(t.field);\n }));\n } else u = null, h = s.fieldTransforms;\n return new Su(new Sn(f), u, h);\n}\n\n/** Parse update data from an update() call. */ function Ou(t, e, n, r) {\n var i = t.P_(1 /* Update */ , e, n);\n Mu(\"Data must be an object, but it was:\", i, r);\n var o = [], s = new Dn;\n _(r, (function(t, r) {\n var u = ju(e, t, n), a = i.A_(u);\n if (r instanceof gu || r instanceof Tu && r.l_ instanceof gu) \n // Add it to the field mask, but don't add anything to updateData.\n o.push(u); else {\n var c = Uu(r, a);\n null != c && (o.push(u), s.set(u, c));\n }\n }));\n var u = new an(o);\n return new Du(s.Xe(), u, i.fieldTransforms);\n}\n\n/** Parse update data from a list of field/value arguments. */ function Pu(t, e, n, r, i, o) {\n var s = t.P_(1 /* Update */ , e, n), u = [ qu(e, r, n) ], h = [ i ];\n if (o.length % 2 != 0) throw new c(a.INVALID_ARGUMENT, \"Function \" + e + \"() needs to be called with an even number of arguments that alternate between field names and values.\");\n for (var f = 0; f < o.length; f += 2) u.push(qu(e, o[f])), h.push(o[f + 1]);\n // We iterate in reverse order to pick the last value for a field if the\n // user specified the field multiple times.\n for (var l = [], p = new Dn, d = u.length - 1; d >= 0; --d) if (!zu(l, u[d])) {\n var v = u[d], y = h[d], g = s.A_(v);\n if (y instanceof gu || y instanceof Tu && y.l_ instanceof gu) \n // Add it to the field mask, but don't add anything to updateData.\n l.push(v); else {\n var m = Uu(y, g);\n null != m && (l.push(v), p.set(v, m));\n }\n }\n var w = new an(l);\n return new Du(p.Xe(), w, s.fieldTransforms);\n}\n\n/**\n * Parse a \"query value\" (e.g. value in a where filter or a value in a cursor\n * bound).\n *\n * @param allowArrays Whether the query value is an array that may directly\n * contain additional arrays (e.g. the operand of an `in` query).\n */ function Vu(t, e, n, r) {\n return void 0 === r && (r = !1), Uu(n, t.P_(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));\n}\n\n/**\n * Parses user data to Protobuf Values.\n *\n * @param input Data to be parsed.\n * @param context A context object representing the current path being parsed,\n * the source of the data being parsed, etc.\n * @return The parsed value, or null if the value was a FieldValue sentinel\n * that should not be included in the resulting parsed data.\n */ function Uu(t, e) {\n if (\n // Unwrap the API type from the Compat SDK. This will return the API type\n // from firestore-exp.\n t instanceof Tu && (t = t.l_), Fu(t)) return Mu(\"Unsupported field value:\", e, t), \n Cu(t, e);\n if (t instanceof yu) \n // FieldValues usually parse into transforms (except FieldValue.delete())\n // in which case we do not want to include this field in our parsed data\n // (as doing so will overwrite the field directly prior to the transform\n // trying to transform it). So we don't add this location to\n // context.fieldMask and we return null as our parsing result.\n /**\n * \"Parses\" the provided FieldValueImpl, adding any necessary transforms to\n * context.fieldTransforms.\n */\n return function(t, e) {\n // Sentinels are only supported with writes, and not within arrays.\n if (!xu(e.s_)) throw e.i_(t.e_ + \"() can only be used with update() and set()\");\n if (!e.path) throw e.i_(t.e_ + \"() is not currently supported inside arrays\");\n var n = t.n_(e);\n n && e.fieldTransforms.push(n);\n }(t, e), null;\n if (\n // If context.path is null we are inside an array and we don't support\n // field mask paths more granular than the top-level array.\n e.path && e.We.push(e.path), t instanceof Array) {\n // TODO(b/34871131): Include the path containing the array in the error\n // message.\n // In the case of IN queries, the parsed data is an array (representing\n // the set of values to be included for the IN query) that may directly\n // contain additional arrays (each representing an individual field\n // value), so we disable this validation.\n if (e.settings.o_ && 4 /* ArrayArgument */ !== e.s_) throw e.i_(\"Nested arrays are not supported\");\n return function(t, e) {\n for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {\n var s = Uu(o[i], e.R_(r));\n null == s && (\n // Just include nulls in the array for fields being replaced with a\n // sentinel.\n s = {\n nullValue: \"NULL_VALUE\"\n }), n.push(s), r++;\n }\n return {\n arrayValue: {\n values: n\n }\n };\n }(t, e);\n }\n return function(t, e) {\n if (null === t) return {\n nullValue: \"NULL_VALUE\"\n };\n if (\"number\" == typeof t) return we(e.serializer, t);\n if (\"boolean\" == typeof t) return {\n booleanValue: t\n };\n if (\"string\" == typeof t) return {\n stringValue: t\n };\n if (t instanceof Date) {\n var n = ot.fromDate(t);\n return {\n timestampValue: _e(e.serializer, n)\n };\n }\n if (t instanceof ot) {\n // Firestore backend truncates precision down to microseconds. To ensure\n // offline mode works the same with regards to truncation, perform the\n // truncation immediately without waiting for the backend to do that.\n var r = new ot(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));\n return {\n timestampValue: _e(e.serializer, r)\n };\n }\n if (t instanceof Eu) return {\n geoPointValue: {\n latitude: t.latitude,\n longitude: t.longitude\n }\n };\n if (t instanceof J) return {\n bytesValue: be(e.serializer, t.q)\n };\n if (t instanceof Au) {\n var i = e.U, o = t.__;\n if (!o.isEqual(i)) throw e.i_(\"Document reference is for database \" + o.projectId + \"/\" + o.database + \" but should be for database \" + i.projectId + \"/\" + i.database);\n return {\n referenceValue: Te(t.__ || e.U, t.f_.path)\n };\n }\n if (void 0 === t && e.ignoreUndefinedProperties) return null;\n throw e.i_(\"Unsupported field value: \" + M(t));\n }(t, e);\n}\n\nfunction Cu(t, e) {\n var n = {};\n return b(t) ? \n // If we encounter an empty object, we explicitly add it to the update\n // mask to ensure that the server creates a map entry.\n e.path && e.path.length > 0 && e.We.push(e.path) : _(t, (function(t, r) {\n var i = Uu(r, e.E_(t));\n null != i && (n[t] = i);\n })), {\n mapValue: {\n fields: n\n }\n };\n}\n\nfunction Fu(t) {\n return !(\"object\" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ot || t instanceof Eu || t instanceof J || t instanceof Au || t instanceof yu);\n}\n\nfunction Mu(t, e, n) {\n if (!Fu(n) || !F(n)) {\n var r = M(n);\n throw \"an object\" === r ? e.i_(t + \" a custom object\") : e.i_(t + \" \" + r);\n }\n}\n\n/**\n * Helper that calls fromDotSeparatedString() but wraps any error thrown.\n */ function qu(t, e, n) {\n if (e instanceof pu) return e.t_;\n if (\"string\" == typeof e) return ju(t, e);\n throw Gu(\"Field path arguments must be of type string or FieldPath.\", t, \n /* hasConverter= */ !1, \n /* path= */ void 0, n);\n}\n\n/**\n * Wraps fromDotSeparatedString with an error message about the method that\n * was thrown.\n * @param methodName The publicly visible method name\n * @param path The dot-separated string form of a field path which will be split\n * on dots.\n * @param targetDoc The document against which the field path will be evaluated.\n */ function ju(e, n, r) {\n try {\n return function(e) {\n if (e.search(vu) >= 0) throw new c(a.INVALID_ARGUMENT, \"Invalid field path (\" + e + \"). Paths must not contain '~', '*', '/', '[', or ']'\");\n try {\n return new (du.bind.apply(du, t.__spreadArrays([ void 0 ], e.split(\".\"))));\n } catch (t) {\n throw new c(a.INVALID_ARGUMENT, \"Invalid field path (\" + e + \"). Paths must not be empty, begin with '.', end with '.', or contain '..'\");\n }\n }(n).t_;\n } catch (n) {\n throw Gu((i = n) instanceof Error ? i.message : i.toString(), e, \n /* hasConverter= */ !1, \n /* path= */ void 0, r);\n }\n /**\n * Extracts the message from a caught exception, which should be an Error object\n * though JS doesn't guarantee that.\n */ var i;\n /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */}\n\nfunction Gu(t, e, n, r, i) {\n var o = r && !r.m(), s = void 0 !== i, u = \"Function \" + e + \"() called with invalid data\";\n n && (u += \" (via `toFirestore()`)\");\n var h = \"\";\n return (o || s) && (h += \" (found\", o && (h += \" in field \" + r), s && (h += \" in document \" + i), \n h += \")\"), new c(a.INVALID_ARGUMENT, (u += \". \") + t + h);\n}\n\nfunction zu(t, e) {\n return t.some((function(t) {\n return t.isEqual(e);\n }));\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Internal transaction object responsible for accumulating the mutations to\n * perform and the base versions for any documents read.\n */ var Bu = /** @class */ function() {\n function e(t) {\n this.Ku = t, \n // The version of each document that was read during this transaction.\n this.y_ = new Map, this.mutations = [], this.V_ = !1, \n /**\n * A deferred usage error that occurred previously in this transaction that\n * will cause the transaction to fail once it actually commits.\n */\n this.p_ = null, \n /**\n * Set of documents that have been written in the transaction.\n *\n * When there's more than one write to the same key in a transaction, any\n * writes after the first are handled differently.\n */\n this.b_ = new Set;\n }\n return e.prototype.v_ = function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r = this;\n return t.__generator(this, (function(i) {\n switch (i.label) {\n case 0:\n if (this.S_(), this.mutations.length > 0) throw new c(a.INVALID_ARGUMENT, \"Firestore transactions require all reads to be executed before all writes.\");\n return [ 4 /*yield*/ , function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s, u, a;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return r = m(e), i = Le(r.serializer) + \"/documents\", o = {\n documents: n.map((function(t) {\n return Ae(r.serializer, t);\n }))\n }, [ 4 /*yield*/ , r.ku(\"BatchGetDocuments\", i, o) ];\n\n case 1:\n return s = t.sent(), u = new Map, s.forEach((function(t) {\n var e = function(t, e) {\n return \"found\" in e ? function(t, e) {\n g(!!e.found), e.found.name, e.found.updateTime;\n var n = Se(t, e.found.name), r = Ee(e.found.updateTime), i = new Sn({\n mapValue: {\n fields: e.found.fields\n }\n });\n return new kn(n, r, i, {});\n }(t, e) : \"missing\" in e ? function(t, e) {\n g(!!e.missing), g(!!e.readTime);\n var n = Se(t, e.missing), r = Ee(e.readTime);\n return new Rn(n, r);\n }(t, e) : y();\n }(r.serializer, t);\n u.set(e.key.toString(), e);\n })), a = [], [ 2 /*return*/ , (n.forEach((function(t) {\n var e = u.get(t.toString());\n g(!!e), a.push(e);\n })), a) ];\n }\n }));\n }));\n }(this.Ku, e) ];\n\n case 1:\n return [ 2 /*return*/ , ((n = i.sent()).forEach((function(t) {\n t instanceof Rn || t instanceof kn ? r.D_(t) : y();\n })), n) ];\n }\n }));\n }));\n }, e.prototype.set = function(t, e) {\n this.write(e.w_(t, this.Ge(t))), this.b_.add(t.toString());\n }, e.prototype.update = function(t, e) {\n try {\n this.write(e.w_(t, this.C_(t)));\n } catch (t) {\n this.p_ = t;\n }\n this.b_.add(t.toString());\n }, e.prototype.delete = function(t) {\n this.write([ new Nn(t, this.Ge(t)) ]), this.b_.add(t.toString());\n }, e.prototype.commit = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n var e, n = this;\n return t.__generator(this, (function(r) {\n switch (r.label) {\n case 0:\n if (this.S_(), this.p_) throw this.p_;\n return e = this.y_, \n // For each mutation, note that the doc was written.\n this.mutations.forEach((function(t) {\n e.delete(t.key.toString());\n })), \n // For each document that was read but not written to, we want to perform\n // a `verify` operation.\n e.forEach((function(t, e) {\n var r = A.D(e);\n n.mutations.push(new An(r, n.Ge(r)));\n })), [ 4 /*yield*/ , function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return r = m(e), i = Le(r.serializer) + \"/documents\", o = {\n writes: n.map((function(t) {\n return Oe(r.serializer, t);\n }))\n }, [ 4 /*yield*/ , r.$u(\"Commit\", i, o) ];\n\n case 1:\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }(this.Ku, this.mutations) ];\n\n case 1:\n // For each mutation, note that the doc was written.\n return r.sent(), this.V_ = !0, [ 2 /*return*/ ];\n }\n }));\n }));\n }, e.prototype.D_ = function(t) {\n var e;\n if (t instanceof kn) e = t.version; else {\n if (!(t instanceof Rn)) throw y();\n // For deleted docs, we must use baseVersion 0 when we overwrite them.\n e = st.min();\n }\n var n = this.y_.get(t.key.toString());\n if (n) {\n if (!e.isEqual(n)) \n // This transaction will fail no matter what.\n throw new c(a.ABORTED, \"Document version changed between two reads.\");\n } else this.y_.set(t.key.toString(), e);\n }, \n /**\n * Returns the version of this document when it was read in this transaction,\n * as a precondition, or no precondition if it was not read.\n */\n e.prototype.Ge = function(t) {\n var e = this.y_.get(t.toString());\n return !this.b_.has(t.toString()) && e ? fn.updateTime(e) : fn.ze();\n }, \n /**\n * Returns the precondition for a document if the operation is an update.\n */\n e.prototype.C_ = function(t) {\n var e = this.y_.get(t.toString());\n // The first time a document is written, we want to take into account the\n // read time and existence\n if (!this.b_.has(t.toString()) && e) {\n if (e.isEqual(st.min())) \n // The document doesn't exist, so fail the transaction.\n // This has to be validated locally because you can't send a\n // precondition that a document does not exist without changing the\n // semantics of the backend write to be an insert. This is the reverse\n // of what we want, since we want to assert that the document doesn't\n // exist but then send the update and have it fail. Since we can't\n // express that to the backend, we have to validate locally.\n // Note: this can change once we can send separate verify writes in the\n // transaction.\n throw new c(a.INVALID_ARGUMENT, \"Can't update a document that doesn't exist.\");\n // Document exists, base precondition on document update time.\n return fn.updateTime(e);\n }\n // Document was not read, so we just use the preconditions for a blind\n // update.\n return fn.exists(!0);\n }, e.prototype.write = function(t) {\n this.S_(), this.mutations = this.mutations.concat(t);\n }, e.prototype.S_ = function() {}, e;\n}(), Wu = /** @class */ function() {\n function e(t, e, n, r) {\n this.cs = t, this.Ku = e, this.updateFunction = n, this.ls = r, this.N_ = 5, this.ys = new vr(this.cs, \"transaction_retry\" /* TransactionRetry */)\n /** Runs the transaction and sets the result on deferred. */;\n }\n return e.prototype.run = function() {\n this.F_();\n }, e.prototype.F_ = function() {\n var e = this;\n this.ys.gn((function() {\n return t.__awaiter(e, void 0, void 0, (function() {\n var e, n, r = this;\n return t.__generator(this, (function(t) {\n return e = new Bu(this.Ku), (n = this.x_(e)) && n.then((function(t) {\n r.cs.ws((function() {\n return e.commit().then((function() {\n r.ls.resolve(t);\n })).catch((function(t) {\n r.k_(t);\n }));\n }));\n })).catch((function(t) {\n r.k_(t);\n })), [ 2 /*return*/ ];\n }));\n }));\n }));\n }, e.prototype.x_ = function(t) {\n try {\n var e = this.updateFunction(t);\n return !ut(e) && e.catch && e.then ? e : (this.ls.reject(Error(\"Transaction callback must return a Promise\")), \n null);\n } catch (t) {\n // Do not retry errors thrown by user provided updateFunction.\n return this.ls.reject(t), null;\n }\n }, e.prototype.k_ = function(t) {\n var e = this;\n this.N_ > 0 && this.M_(t) ? (this.N_ -= 1, this.cs.ws((function() {\n return e.F_(), Promise.resolve();\n }))) : this.ls.reject(t);\n }, e.prototype.M_ = function(t) {\n if (\"FirebaseError\" === t.name) {\n // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and\n // non-matching document versions with ABORTED. These errors should be retried.\n var e = t.code;\n return \"aborted\" === e || \"failed-precondition\" === e || !wt(e);\n }\n return !1;\n }, e;\n}(), Ku = /** @class */ function() {\n function e(t, \n /**\n * Asynchronous queue responsible for all of our internal processing. When\n * we get incoming work from the user (via public API) or the network\n * (incoming GRPC messages), we should always schedule onto this queue.\n * This ensures all of our work is properly serialized (e.g. we don't\n * start processing a new operation while the previous one is waiting for\n * an async I/O to complete).\n */\n e) {\n this.credentials = t, this.cs = e, this.clientId = Q.k(), \n // We defer our initialization until we get the current user from\n // setChangeListener(). We block the async queue until we got the initial\n // user and the initialization is completed. This will prevent any scheduled\n // work from happening before initialization is completed.\n // If initializationDone resolved then the FirestoreClient is in a usable\n // state.\n this.O_ = new dr\n /**\n * Starts up the FirestoreClient, returning only whether or not enabling\n * persistence succeeded.\n *\n * The intent here is to \"do the right thing\" as far as users are concerned.\n * Namely, in cases where offline persistence is requested and possible,\n * enable it, but otherwise fall back to persistence disabled. For the most\n * part we expect this to succeed one way or the other so we don't expect our\n * users to actually wait on the firestore.enablePersistence Promise since\n * they generally won't care.\n *\n * Of course some users actually do care about whether or not persistence\n * was successfully enabled, so the Promise returned from this method\n * indicates this outcome.\n *\n * This presents a problem though: even before enablePersistence resolves or\n * rejects, users may have made calls to e.g. firestore.collection() which\n * means that the FirestoreClient in there will be available and will be\n * enqueuing actions on the async queue.\n *\n * Meanwhile any failure of an operation on the async queue causes it to\n * panic and reject any further work, on the premise that unhandled errors\n * are fatal.\n *\n * Consequently the fallback is handled internally here in start, and if the\n * fallback succeeds we signal success to the async queue even though the\n * start() itself signals failure.\n *\n * @param databaseInfo The connection information for the current instance.\n * @param offlineComponentProvider Provider that returns all components\n * required for memory-only or IndexedDB persistence.\n * @param onlineComponentProvider Provider that returns all components\n * required for online support.\n * @param persistenceSettings Settings object to configure offline\n * persistence.\n * @returns A deferred result indicating the user-visible result of enabling\n * offline persistence. This method will reject this if IndexedDB fails to\n * start for any reason. If usePersistence is false this is\n * unconditionally resolved.\n */;\n }\n return e.prototype.start = function(e, n, r, i) {\n var o = this;\n this.L_(), this.bl = e;\n // If usePersistence is true, certain classes of errors while starting are\n // recoverable but only by falling back to persistence disabled.\n // If there's an error in the first case but not in recovery we cannot\n // reject the promise blocking the async queue because this will cause the\n // async queue to panic.\n var s = new dr, u = !1;\n // Return only the result of enabling persistence. Note that this does not\n // need to await the completion of initializationDone because the result of\n // this method should not reflect any other kind of failure to start.\n return this.credentials.Hc((function(e) {\n if (!u) return u = !0, l(\"FirestoreClient\", \"Initializing. user=\", e.uid), o.B_(n, r, i, e, s).then(o.O_.resolve, o.O_.reject);\n o.cs.Cs((function() {\n return function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return (r = m(e)).cs.xs(), l(\"RemoteStore\", \"RemoteStore received new credentials\"), \n i = Xo(r), \n // Tear down and re-create our network streams. This will ensure we get a\n // fresh auth token for the new user and re-fill the write pipeline with\n // new mutations from the LocalStore (since mutations are per-user).\n r.Yu.add(3 /* CredentialChange */), [ 4 /*yield*/ , zo(r) ];\n\n case 1:\n return t.sent(), i && \n // Don't set the network status to Unknown if we are offline.\n r.th.set(\"Unknown\" /* Unknown */), [ 4 /*yield*/ , r.Gu.Jl(n) ];\n\n case 2:\n return t.sent(), r.Yu.delete(3 /* CredentialChange */), [ 4 /*yield*/ , Go(r) ];\n\n case 3:\n // Tear down and re-create our network streams. This will ensure we get a\n // fresh auth token for the new user and re-fill the write pipeline with\n // new mutations from the LocalStore (since mutations are per-user).\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }(o.ph, e);\n }));\n })), \n // Block the async queue until initialization is done\n this.cs.ws((function() {\n return o.O_.promise;\n })), s.promise;\n }, \n /** Enables the network connection and requeues all pending operations. */ e.prototype.enableNetwork = function() {\n var t = this;\n return this.L_(), this.cs.enqueue((function() {\n return t.persistence.tc(!0), function(t) {\n var e = m(t);\n return e.Yu.delete(0 /* UserDisabled */), Go(e);\n }(t.ph);\n }));\n }, \n /**\n * Initializes persistent storage, attempting to use IndexedDB if\n * usePersistence is true or memory-only if false.\n *\n * If IndexedDB fails because it's already open in another tab or because the\n * platform can't possibly support our implementation then this method rejects\n * the persistenceResult and falls back on memory-only persistence.\n *\n * @param offlineComponentProvider Provider that returns all components\n * required for memory-only or IndexedDB persistence.\n * @param onlineComponentProvider Provider that returns all components\n * required for online support.\n * @param persistenceSettings Settings object to configure offline persistence\n * @param user The initial user\n * @param persistenceResult A deferred result indicating the user-visible\n * result of enabling offline persistence. This method will reject this if\n * IndexedDB fails to start for any reason. If usePersistence is false\n * this is unconditionally resolved.\n * @returns a Promise indicating whether or not initialization should\n * continue, i.e. that one of the persistence implementations actually\n * succeeded.\n */\n e.prototype.B_ = function(e, n, r, i, o) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var s, u, a = this;\n return t.__generator(this, (function(c) {\n switch (c.label) {\n case 0:\n return c.trys.push([ 0, 3, , 4 ]), s = {\n cs: this.cs,\n bl: this.bl,\n clientId: this.clientId,\n credentials: this.credentials,\n Wl: i,\n Dh: 100,\n persistenceSettings: r\n }, [ 4 /*yield*/ , e.initialize(s) ];\n\n case 1:\n return c.sent(), [ 4 /*yield*/ , n.initialize(e, s) ];\n\n case 2:\n return c.sent(), this.persistence = e.persistence, this.Sh = e.Sh, this.ju = e.ju, \n this.ql = e.ql, this.Ku = n.Ku, this.ph = n.ph, this.fi = n.fi, this.q_ = n.bh, \n this.q_.Us = _s.bind(null, this.fi), this.q_.js = Is.bind(null, this.fi), \n // When a user calls clearPersistence() in one client, all other clients\n // need to be terminated to allow the delete to succeed.\n this.persistence.Za((function() {\n return t.__awaiter(a, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return [ 4 /*yield*/ , this.terminate() ];\n\n case 1:\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n })), o.resolve(), [ 3 /*break*/ , 4 ];\n\n case 3:\n // An unknown failure on the first stage shuts everything down.\n if (u = c.sent(), \n // Regardless of whether or not the retry succeeds, from an user\n // perspective, offline persistence has failed.\n o.reject(u), !this.U_(u)) throw u;\n return [ 2 /*return*/ , (console.warn(\"Error enabling offline persistence. Falling back to persistence disabled: \" + u), \n this.B_(new cu, new fu, {\n jl: !1\n }, i, o)) ];\n\n case 4:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }, \n /**\n * Decides whether the provided error allows us to gracefully disable\n * persistence (as opposed to crashing the client).\n */\n e.prototype.U_ = function(t) {\n return \"FirebaseError\" === t.name ? t.code === a.FAILED_PRECONDITION || t.code === a.UNIMPLEMENTED : !(\"undefined\" != typeof DOMException && t instanceof DOMException) || \n // When the browser is out of quota we could get either quota exceeded\n // or an aborted error depending on whether the error happened during\n // schema migration.\n 22 === t.code || 20 === t.code || \n // Firefox Private Browsing mode disables IndexedDb and returns\n // INVALID_STATE for any usage.\n 11 === t.code;\n }, \n /**\n * Checks that the client has not been terminated. Ensures that other methods on\n * this class cannot be called after the client is terminated.\n */\n e.prototype.L_ = function() {\n if (this.cs.ps) throw new c(a.FAILED_PRECONDITION, \"The client has already been terminated.\");\n }, \n /** Disables the network connection. Pending operations will not complete. */ e.prototype.disableNetwork = function() {\n var e = this;\n return this.L_(), this.cs.enqueue((function() {\n return e.persistence.tc(!1), function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return (n = m(e)).Yu.add(0 /* UserDisabled */), [ 4 /*yield*/ , zo(n) ];\n\n case 1:\n return t.sent(), \n // Set the OnlineState to Offline so get()s return from cache, etc.\n n.th.set(\"Offline\" /* Offline */), [ 2 /*return*/ ];\n }\n }));\n }));\n }(e.ph);\n }));\n }, e.prototype.terminate = function() {\n var e = this;\n this.cs.Ds();\n var n = new dr;\n return this.cs.bs((function() {\n return t.__awaiter(e, void 0, void 0, (function() {\n var e, r;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return t.trys.push([ 0, 4, , 5 ]), \n // PORTING NOTE: LocalStore does not need an explicit shutdown on web.\n this.ql && this.ql.stop(), [ 4 /*yield*/ , Bo(this.ph) ];\n\n case 1:\n return t.sent(), [ 4 /*yield*/ , this.Sh.Di() ];\n\n case 2:\n return t.sent(), [ 4 /*yield*/ , this.persistence.Di() ];\n\n case 3:\n // PORTING NOTE: LocalStore does not need an explicit shutdown on web.\n return t.sent(), \n // `removeChangeListener` must be called after shutting down the\n // RemoteStore as it will prevent the RemoteStore from retrieving\n // auth tokens.\n this.credentials.Yc(), n.resolve(), [ 3 /*break*/ , 5 ];\n\n case 4:\n return e = t.sent(), r = Lr(e, \"Failed to shutdown persistence\"), n.reject(r), [ 3 /*break*/ , 5 ];\n\n case 5:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n })), n.promise;\n }, \n /**\n * Returns a Promise that resolves when all writes that were pending at the time this\n * method was called received server acknowledgement. An acknowledgement can be either acceptance\n * or rejection.\n */\n e.prototype.waitForPendingWrites = function() {\n var e = this;\n this.L_();\n var n = new dr;\n return this.cs.ws((function() {\n return function(e, n) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var r, i, o, s, u;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n Xo((r = m(e)).ph) || l(\"SyncEngine\", \"The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.\"), \n t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , function(t) {\n var e = m(t);\n return e.persistence.runTransaction(\"Get highest unacknowledged batch id\", \"readonly\", (function(t) {\n return e.Sr.qo(t);\n }));\n }(r.ju) ];\n\n case 2:\n return -1 === (i = t.sent()) ? [ 2 /*return*/ , void n.resolve() ] : ((o = r.Lh.get(i) || []).push(n), \n r.Lh.set(i, o), [ 3 /*break*/ , 4 ]);\n\n case 3:\n return s = t.sent(), u = Lr(s, \"Initialization of waitForPendingWrites() operation failed\"), \n n.reject(u), [ 3 /*break*/ , 4 ];\n\n case 4:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }(e.fi, n);\n })), n.promise;\n }, e.prototype.listen = function(t, e, n) {\n var r = this;\n this.L_();\n var i = new lu(n), o = new Fr(t, i, e);\n return this.cs.ws((function() {\n return Or(r.q_, o);\n })), function() {\n i.Zl(), r.cs.ws((function() {\n return Pr(r.q_, o);\n }));\n };\n }, e.prototype.Q_ = function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r = this;\n return t.__generator(this, (function(i) {\n switch (i.label) {\n case 0:\n return this.L_(), [ 4 /*yield*/ , this.O_.promise ];\n\n case 1:\n return i.sent(), n = new dr, [ 2 /*return*/ , (this.cs.ws((function() {\n return function(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o, s;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return t.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , function(t, e) {\n var n = m(t);\n return n.persistence.runTransaction(\"read document\", \"readonly\", (function(t) {\n return n.Cc.Cr(t, e);\n }));\n }(e, n) ];\n\n case 1:\n return (i = t.sent()) instanceof kn ? r.resolve(i) : i instanceof Rn ? r.resolve(null) : r.reject(new c(a.UNAVAILABLE, \"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)\")), \n [ 3 /*break*/ , 3 ];\n\n case 2:\n return o = t.sent(), s = Lr(o, \"Failed to get document '\" + n + \" from cache\"), \n r.reject(s), [ 3 /*break*/ , 3 ];\n\n case 3:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }(r.ju, e, n);\n })), n.promise) ];\n }\n }));\n }));\n }, e.prototype.W_ = function(e, n) {\n return void 0 === n && (n = {}), t.__awaiter(this, void 0, void 0, (function() {\n var r, i = this;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return this.L_(), [ 4 /*yield*/ , this.O_.promise ];\n\n case 1:\n return t.sent(), r = new dr, [ 2 /*return*/ , (this.cs.ws((function() {\n return function(t, e, n, r, i) {\n var o = new lu({\n next: function(o) {\n // Remove query first before passing event to user to avoid\n // user actions affecting the now stale query.\n e.ws((function() {\n return Pr(t, s);\n }));\n var u = o.docs.has(n);\n !u && o.fromCache ? \n // TODO(dimond): If we're online and the document doesn't\n // exist then we resolve with a doc.exists set to false. If\n // we're offline however, we reject the Promise in this\n // case. Two options: 1) Cache the negative response from\n // the server so we can deliver that even when you're\n // offline 2) Actually reject the Promise in the online case\n // if the document doesn't exist.\n i.reject(new c(a.UNAVAILABLE, \"Failed to get document because the client is offline.\")) : u && o.fromCache && r && \"server\" === r.source ? i.reject(new c(a.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to \"server\" to retrieve the cached document.)')) : i.resolve(o);\n },\n error: function(t) {\n return i.reject(t);\n }\n }), s = new Fr(Un(n.path), o, {\n includeMetadataChanges: !0,\n Xs: !0\n });\n return Or(t, s);\n }(i.q_, i.cs, e, n, r);\n })), r.promise) ];\n }\n }));\n }));\n }, e.prototype.j_ = function(e) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var n, r = this;\n return t.__generator(this, (function(i) {\n switch (i.label) {\n case 0:\n return this.L_(), [ 4 /*yield*/ , this.O_.promise ];\n\n case 1:\n return i.sent(), n = new dr, [ 2 /*return*/ , (this.cs.ws((function() {\n return function(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o, s, u, a, c;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return t.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , To(e, n, \n /* usePreviousResults= */ !0) ];\n\n case 1:\n return i = t.sent(), o = new ys(n, i.Fc), s = o.wh(i.documents), u = o.yr(s, \n /* updateLimboDocuments= */ !1), r.resolve(u.snapshot), [ 3 /*break*/ , 3 ];\n\n case 2:\n return a = t.sent(), c = Lr(a, \"Failed to execute query '\" + n + \" against cache\"), \n r.reject(c), [ 3 /*break*/ , 3 ];\n\n case 3:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }(r.ju, e, n);\n })), n.promise) ];\n }\n }));\n }));\n }, e.prototype.K_ = function(e, n) {\n return void 0 === n && (n = {}), t.__awaiter(this, void 0, void 0, (function() {\n var r, i = this;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return this.L_(), [ 4 /*yield*/ , this.O_.promise ];\n\n case 1:\n return t.sent(), r = new dr, [ 2 /*return*/ , (this.cs.ws((function() {\n return function(t, e, n, r, i) {\n var o = new lu({\n next: function(n) {\n // Remove query first before passing event to user to avoid\n // user actions affecting the now stale query.\n e.ws((function() {\n return Pr(t, s);\n })), n.fromCache && \"server\" === r.source ? i.reject(new c(a.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to \"server\" to retrieve the cached documents.)')) : i.resolve(n);\n },\n error: function(t) {\n return i.reject(t);\n }\n }), s = new Fr(n, o, {\n includeMetadataChanges: !0,\n Xs: !0\n });\n return Or(t, s);\n }(i.q_, i.cs, e, n, r);\n })), r.promise) ];\n }\n }));\n }));\n }, e.prototype.write = function(e) {\n var n = this;\n this.L_();\n var r = new dr;\n return this.cs.ws((function() {\n return function(e, n, r) {\n return t.__awaiter(this, void 0, void 0, (function() {\n var i, o, s, u;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n i = Qs(e), t.label = 1;\n\n case 1:\n return t.trys.push([ 1, 5, , 6 ]), [ 4 /*yield*/ , \n /* Accepts locally generated Mutations and commit them to storage. */\n function(t, e) {\n var n, r = m(t), i = ot.now(), o = e.reduce((function(t, e) {\n return t.add(e.key);\n }), Ot());\n return r.persistence.runTransaction(\"Locally write mutations\", \"readwrite\", (function(t) {\n return r.Cc.kr(t, o).next((function(o) {\n n = o;\n for (\n // For non-idempotent mutations (such as `FieldValue.increment()`),\n // we record the base state in a separate patch mutation. This is\n // later used to guarantee consistent values and prevents flicker\n // even if the backend sends us an update that already includes our\n // transform.\n var s = [], u = 0, a = e; u < a.length; u++) {\n var c = a[u], h = yn(c, n.get(c.key));\n null != h && \n // NOTE: The base state should only be applied if there's some\n // existing document to override, so use a Precondition of\n // exists=true\n s.push(new _n(c.key, h, xn(h.proto.mapValue), fn.exists(!0)));\n }\n return r.Sr.ko(t, i, s, e);\n }));\n })).then((function(t) {\n var e = t.lr(n);\n return {\n batchId: t.batchId,\n wr: e\n };\n }));\n }(i.ju, n) ];\n\n case 2:\n return o = t.sent(), i.Sh.xi(o.batchId), function(t, e, n) {\n var r = t.Oh[t.currentUser.ti()];\n r || (r = new bt(H)), r = r.ot(e, n), t.Oh[t.currentUser.ti()] = r;\n }(i, o.batchId, r), [ 4 /*yield*/ , Vs(i, o.wr) ];\n\n case 3:\n return t.sent(), [ 4 /*yield*/ , is(i.ph) ];\n\n case 4:\n return t.sent(), [ 3 /*break*/ , 6 ];\n\n case 5:\n return s = t.sent(), u = Lr(s, \"Failed to persist write\"), r.reject(u), [ 3 /*break*/ , 6 ];\n\n case 6:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n }(n.fi, e, r);\n })), r.promise;\n }, e.prototype.U = function() {\n return this.bl.U;\n }, e.prototype.G_ = function(e) {\n var n = this;\n this.L_();\n var r = new lu(e);\n return this.cs.ws((function() {\n return t.__awaiter(n, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return [ 2 /*return*/ , function(t, e) {\n m(t).qs.add(e), \n // Immediately fire an initial event, indicating all existing listeners\n // are in-sync.\n e.next();\n }(this.q_, r) ];\n }));\n }));\n })), function() {\n r.Zl(), n.cs.ws((function() {\n return t.__awaiter(n, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n return [ 2 /*return*/ , function(t, e) {\n m(t).qs.delete(e);\n }(this.q_, r) ];\n }));\n }));\n }));\n };\n }, Object.defineProperty(e.prototype, \"z_\", {\n get: function() {\n // Technically, the asyncQueue is still running, but only accepting operations\n // related to termination or supposed to be run after termination. It is effectively\n // terminated to the eyes of users.\n return this.cs.ps;\n },\n enumerable: !1,\n configurable: !0\n }), \n /**\n * Takes an updateFunction in which a set of reads and writes can be performed\n * atomically. In the updateFunction, the client can read and write values\n * using the supplied transaction object. After the updateFunction, all\n * changes will be committed. If a retryable error occurs (ex: some other\n * client has changed any of the data referenced), then the updateFunction\n * will be called again after a backoff. If the updateFunction still fails\n * after all retries, then the transaction will be rejected.\n *\n * The transaction object passed to the updateFunction contains methods for\n * accessing documents and collections. Unlike other datastore access, data\n * accessed with the transaction will not reflect local changes that have not\n * been committed. For this reason, it is required that all reads are\n * performed before any writes. Transactions must be performed while online.\n */\n e.prototype.transaction = function(t) {\n var e = this;\n this.L_();\n var n = new dr;\n return this.cs.ws((function() {\n return new Wu(e.cs, e.Ku, t, n).run(), Promise.resolve();\n })), n.promise;\n }, e;\n}();\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * TransactionRunner encapsulates the logic needed to run and retry transactions\n * with backoff.\n */ function Qu(t) {\n /**\n * Returns true if obj is an object and contains at least one of the specified\n * methods.\n */\n return function(t, e) {\n if (\"object\" != typeof t || null === t) return !1;\n for (var n = t, r = 0, i = [ \"next\", \"error\", \"complete\" ]; r < i.length; r++) {\n var o = i[r];\n if (o in n && \"function\" == typeof n[o]) return !0;\n }\n return !1;\n }(t);\n}\n\nvar Hu = /** @class */ function() {\n function t(t, e, n, r, i) {\n this.U = t, this.timestampsInSnapshots = e, this.H_ = n, this.Y_ = r, this.J_ = i;\n }\n return t.prototype.X_ = function(t) {\n switch (Jt(t)) {\n case 0 /* NullValue */ :\n return null;\n\n case 1 /* BooleanValue */ :\n return t.booleanValue;\n\n case 2 /* NumberValue */ :\n return se(t.integerValue || t.doubleValue);\n\n case 3 /* TimestampValue */ :\n return this.Z_(t.timestampValue);\n\n case 4 /* ServerTimestampValue */ :\n return this.tf(t);\n\n case 5 /* StringValue */ :\n return t.stringValue;\n\n case 6 /* BlobValue */ :\n return this.J_(ue(t.bytesValue));\n\n case 7 /* RefValue */ :\n return this.ef(t.referenceValue);\n\n case 8 /* GeoPointValue */ :\n return this.nf(t.geoPointValue);\n\n case 9 /* ArrayValue */ :\n return this.sf(t.arrayValue);\n\n case 10 /* ObjectValue */ :\n return this.if(t.mapValue);\n\n default:\n throw y();\n }\n }, t.prototype.if = function(t) {\n var e = this, n = {};\n return _(t.fields || {}, (function(t, r) {\n n[t] = e.X_(r);\n })), n;\n }, t.prototype.nf = function(t) {\n return new Eu(se(t.latitude), se(t.longitude));\n }, t.prototype.sf = function(t) {\n var e = this;\n return (t.values || []).map((function(t) {\n return e.X_(t);\n }));\n }, t.prototype.tf = function(t) {\n switch (this.H_) {\n case \"previous\":\n var e = Yt(t);\n return null == e ? null : this.X_(e);\n\n case \"estimate\":\n return this.Z_($t(t));\n\n default:\n return null;\n }\n }, t.prototype.Z_ = function(t) {\n var e = oe(t), n = new ot(e.seconds, e.nanos);\n return this.timestampsInSnapshots ? n : n.toDate();\n }, t.prototype.ef = function(t) {\n var e = E.g(t);\n g(He(e));\n var n = new rt(e.get(1), e.get(3)), r = new A(e.u(5));\n return n.isEqual(this.U) || \n // TODO(b/64130202): Somehow support foreign references.\n p(\"Document \" + r + \" contains a document reference within a different database (\" + n.projectId + \"/\" + n.database + \") which is not supported. It will be treated as a reference in the current database (\" + this.U.projectId + \"/\" + this.U.database + \") instead.\"), \n this.Y_(r);\n }, t;\n}(), Yu = ui.ho, $u = /** @class */ function() {\n function t(t) {\n var e, n, r, i, o;\n if (void 0 === t.host) {\n if (void 0 !== t.ssl) throw new c(a.INVALID_ARGUMENT, \"Can't provide ssl option if host option is not set\");\n this.host = \"firestore.googleapis.com\", this.ssl = !0;\n } else O(\"settings\", \"non-empty string\", \"host\", t.host), this.host = t.host, P(\"settings\", \"boolean\", \"ssl\", t.ssl), \n this.ssl = null === (e = t.ssl) || void 0 === e || e;\n if (j(\"settings\", t, [ \"host\", \"ssl\", \"credentials\", \"timestampsInSnapshots\", \"cacheSizeBytes\", \"experimentalForceLongPolling\", \"experimentalAutoDetectLongPolling\", \"ignoreUndefinedProperties\" ]), \n P(\"settings\", \"object\", \"credentials\", t.credentials), this.credentials = t.credentials, \n P(\"settings\", \"boolean\", \"timestampsInSnapshots\", t.timestampsInSnapshots), P(\"settings\", \"boolean\", \"ignoreUndefinedProperties\", t.ignoreUndefinedProperties), \n // Nobody should set timestampsInSnapshots anymore, but the error depends on\n // whether they set it to true or false...\n !0 === t.timestampsInSnapshots ? p(\"The setting 'timestampsInSnapshots: true' is no longer required and should be removed.\") : !1 === t.timestampsInSnapshots && p(\"Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects.\"), \n this.timestampsInSnapshots = null === (n = t.timestampsInSnapshots) || void 0 === n || n, \n this.ignoreUndefinedProperties = null !== (r = t.ignoreUndefinedProperties) && void 0 !== r && r, \n P(\"settings\", \"number\", \"cacheSizeBytes\", t.cacheSizeBytes), void 0 === t.cacheSizeBytes) this.cacheSizeBytes = ui._o; else {\n if (t.cacheSizeBytes !== Yu && t.cacheSizeBytes < ui.lo) throw new c(a.INVALID_ARGUMENT, \"cacheSizeBytes must be at least \" + ui.lo);\n this.cacheSizeBytes = t.cacheSizeBytes;\n }\n P(\"settings\", \"boolean\", \"experimentalForceLongPolling\", t.experimentalForceLongPolling), \n this.experimentalForceLongPolling = null !== (i = t.experimentalForceLongPolling) && void 0 !== i && i, \n P(\"settings\", \"boolean\", \"experimentalAutoDetectLongPolling\", t.experimentalAutoDetectLongPolling), \n this.experimentalAutoDetectLongPolling = null !== (o = t.experimentalAutoDetectLongPolling) && void 0 !== o && o, \n function(t, e, n, r) {\n if (!0 === e && !0 === r) throw new c(a.INVALID_ARGUMENT, \"experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.\");\n }(0, t.experimentalForceLongPolling, 0, t.experimentalAutoDetectLongPolling);\n }\n return t.prototype.isEqual = function(t) {\n return this.host === t.host && this.ssl === t.ssl && this.timestampsInSnapshots === t.timestampsInSnapshots && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties;\n }, t;\n}(), Xu = /** @class */ function() {\n // Note: We are using `MemoryComponentProvider` as a default\n // ComponentProvider to ensure backwards compatibility with the format\n // expected by the console build.\n function e(n, r, i, o) {\n var s = this;\n if (void 0 === i && (i = new cu), void 0 === o && (o = new fu), this.rf = i, this.af = o, \n this.cf = null, \n // Public for use in tests.\n // TODO(mikelehen): Use modularized initialization instead.\n this.uf = new xr, this.INTERNAL = {\n delete: function() {\n return t.__awaiter(s, void 0, void 0, (function() {\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n // The client must be initalized to ensure that all subsequent API usage\n // throws an exception.\n return this.hf(), [ 4 /*yield*/ , this.lf.terminate() ];\n\n case 1:\n // The client must be initalized to ensure that all subsequent API usage\n // throws an exception.\n return t.sent(), [ 2 /*return*/ ];\n }\n }));\n }));\n }\n }, \"object\" == typeof n.options) {\n // This is very likely a Firebase app object\n // TODO(b/34177605): Can we somehow use instanceof?\n var u = n;\n this.cf = u, this.__ = e._f(u), this.ff = u.name, this.df = new Oo(r);\n } else {\n var h = n;\n if (!h.projectId) throw new c(a.INVALID_ARGUMENT, \"Must provide projectId\");\n this.__ = new rt(h.projectId, h.database), \n // Use a default persistenceKey that lines up with FirebaseApp.\n this.ff = \"[DEFAULT]\", this.df = new Ro;\n }\n this.wf = new $u({});\n }\n return Object.defineProperty(e.prototype, \"mf\", {\n get: function() {\n return this.Tf || (\n // Lazy initialize UserDataReader once the settings are frozen\n this.Tf = new ku(this.__, this.wf.ignoreUndefinedProperties)), this.Tf;\n },\n enumerable: !1,\n configurable: !0\n }), e.prototype.settings = function(t) {\n D(\"Firestore.settings\", arguments, 1), k(\"Firestore.settings\", \"object\", 1, t), \n t.merge && \n // Remove the property from the settings once the merge is completed\n delete (t = Object.assign(Object.assign({}, this.wf), t)).merge;\n var e = new $u(t);\n if (this.lf && !this.wf.isEqual(e)) throw new c(a.FAILED_PRECONDITION, \"Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.\");\n this.wf = e, void 0 !== e.credentials && (this.df = function(t) {\n if (!t) return new Ro;\n switch (t.type) {\n case \"gapi\":\n var e = t.client;\n // Make sure this really is a Gapi client.\n return g(!(\"object\" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)), \n new Vo(e, t.sessionIndex || \"0\");\n\n case \"provider\":\n return t.client;\n\n default:\n throw new c(a.INVALID_ARGUMENT, \"makeCredentialsProvider failed due to invalid credential type\");\n }\n }(e.credentials));\n }, e.prototype.enableNetwork = function() {\n return this.hf(), this.lf.enableNetwork();\n }, e.prototype.disableNetwork = function() {\n return this.hf(), this.lf.disableNetwork();\n }, e.prototype.enablePersistence = function(t) {\n var e, n;\n if (this.lf) throw new c(a.FAILED_PRECONDITION, \"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.\");\n var r = !1, i = !1;\n if (t && (void 0 !== t.experimentalTabSynchronization && p(\"The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead.\"), \n r = null !== (n = null !== (e = t.synchronizeTabs) && void 0 !== e ? e : t.experimentalTabSynchronization) && void 0 !== n && n, \n i = !!t.experimentalForceOwningTab && t.experimentalForceOwningTab, r && i)) throw new c(a.INVALID_ARGUMENT, \"The 'experimentalForceOwningTab' setting cannot be used with 'synchronizeTabs'.\");\n return this.Ef(this.rf, this.af, {\n jl: !0,\n cacheSizeBytes: this.wf.cacheSizeBytes,\n synchronizeTabs: r,\n ka: i\n });\n }, e.prototype.clearPersistence = function() {\n return t.__awaiter(this, void 0, void 0, (function() {\n var e, n = this;\n return t.__generator(this, (function(r) {\n if (void 0 !== this.lf && !this.lf.z_) throw new c(a.FAILED_PRECONDITION, \"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.\");\n return e = new dr, [ 2 /*return*/ , (this.uf.bs((function() {\n return t.__awaiter(n, void 0, void 0, (function() {\n var n;\n return t.__generator(this, (function(t) {\n switch (t.label) {\n case 0:\n return t.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , this.rf.clearPersistence(this.__, this.ff) ];\n\n case 1:\n return t.sent(), e.resolve(), [ 3 /*break*/ , 3 ];\n\n case 2:\n return n = t.sent(), e.reject(n), [ 3 /*break*/ , 3 ];\n\n case 3:\n return [ 2 /*return*/ ];\n }\n }));\n }));\n })), e.promise) ];\n }));\n }));\n }, e.prototype.terminate = function() {\n return this.app._removeServiceInstance(\"firestore\"), this.INTERNAL.delete();\n }, Object.defineProperty(e.prototype, \"If\", {\n get: function() {\n return this.hf(), this.lf.z_;\n },\n enumerable: !1,\n configurable: !0\n }), e.prototype.waitForPendingWrites = function() {\n return this.hf(), this.lf.waitForPendingWrites();\n }, e.prototype.onSnapshotsInSync = function(t) {\n if (this.hf(), Qu(t)) return this.lf.G_(t);\n k(\"Firestore.onSnapshotsInSync\", \"function\", 1, t);\n var e = {\n next: t\n };\n return this.lf.G_(e);\n }, e.prototype.hf = function() {\n return this.lf || \n // Kick off starting the client but don't actually wait for it.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.Ef(new cu, new fu, {\n jl: !1\n }), this.lf;\n }, e.prototype.Af = function() {\n return new nt(this.__, this.ff, this.wf.host, this.wf.ssl, this.wf.experimentalForceLongPolling, this.wf.experimentalAutoDetectLongPolling);\n }, e.prototype.Ef = function(t, e, n) {\n var r = this.Af();\n return this.lf = new Ku(this.df, this.uf), this.lf.start(r, t, e, n);\n }, e._f = function(t) {\n if (e = t.options, \"projectId\", !Object.prototype.hasOwnProperty.call(e, \"projectId\")) throw new c(a.INVALID_ARGUMENT, '\"projectId\" not provided in firebase.initializeApp.');\n var e, n = t.options.projectId;\n if (!n || \"string\" != typeof n) throw new c(a.INVALID_ARGUMENT, \"projectId must be a string in FirebaseApp.options\");\n return new rt(n);\n }, Object.defineProperty(e.prototype, \"app\", {\n get: function() {\n if (!this.cf) throw new c(a.FAILED_PRECONDITION, \"Firestore was not initialized using the Firebase SDK. 'app' is not available\");\n return this.cf;\n },\n enumerable: !1,\n configurable: !0\n }), e.prototype.collection = function(t) {\n return D(\"Firestore.collection\", arguments, 1), k(\"Firestore.collection\", \"non-empty string\", 1, t), \n this.hf(), new la(E.g(t), this, \n /* converter= */ null);\n }, e.prototype.doc = function(t) {\n return D(\"Firestore.doc\", arguments, 1), k(\"Firestore.doc\", \"non-empty string\", 1, t), \n this.hf(), ta.Rf(E.g(t), this, \n /* converter= */ null);\n }, e.prototype.collectionGroup = function(t) {\n if (D(\"Firestore.collectionGroup\", arguments, 1), k(\"Firestore.collectionGroup\", \"non-empty string\", 1, t), \n t.indexOf(\"/\") >= 0) throw new c(a.INVALID_ARGUMENT, \"Invalid collection ID '\" + t + \"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.\");\n return this.hf(), new ha(\n /**\n * Creates a new Query for a collection group query that matches all documents\n * within the provided collection group.\n */\n function(t) {\n return new Pn(E.P(), t);\n }(t), this, \n /* converter= */ null);\n }, e.prototype.runTransaction = function(t) {\n var e = this;\n return D(\"Firestore.runTransaction\", arguments, 1), k(\"Firestore.runTransaction\", \"function\", 1, t), \n this.hf().transaction((function(n) {\n return t(new Ju(e, n));\n }));\n }, e.prototype.batch = function() {\n return this.hf(), new Zu(this);\n }, Object.defineProperty(e, \"logLevel\", {\n get: function() {\n switch (f()) {\n case n.LogLevel.DEBUG:\n return \"debug\";\n\n case n.LogLevel.ERROR:\n return \"error\";\n\n case n.LogLevel.SILENT:\n return \"silent\";\n\n case n.LogLevel.WARN:\n return \"warn\";\n\n case n.LogLevel.INFO:\n return \"info\";\n\n case n.LogLevel.VERBOSE:\n return \"verbose\";\n\n default:\n // The default log level is error\n return \"error\";\n }\n },\n enumerable: !1,\n configurable: !0\n }), e.setLogLevel = function(t) {\n var e;\n D(\"Firestore.setLogLevel\", arguments, 1), U(\"setLogLevel\", [ \"debug\", \"error\", \"silent\", \"warn\", \"info\", \"verbose\" ], 1, t), \n e = t, h.setLogLevel(e);\n }, \n // Note: this is not a property because the minifier can't work correctly with\n // the way TypeScript compiler outputs properties.\n e.prototype.gf = function() {\n return this.wf.timestampsInSnapshots;\n }, \n // Visible for testing.\n e.prototype.Pf = function() {\n return this.wf;\n }, e;\n}(), Ju = /** @class */ function() {\n function t(t, e) {\n this.yf = t, this.Vf = e;\n }\n return t.prototype.get = function(t) {\n var e = this;\n D(\"Transaction.get\", arguments, 1);\n var n = ya(\"Transaction.get\", t, this.yf);\n return this.Vf.v_([ n.f_ ]).then((function(t) {\n if (!t || 1 !== t.length) return y();\n var r = t[0];\n if (r instanceof Rn) return new na(e.yf, n.f_, null, \n /* fromCache= */ !1, \n /* hasPendingWrites= */ !1, n.d_);\n if (r instanceof kn) return new na(e.yf, n.f_, r, \n /* fromCache= */ !1, \n /* hasPendingWrites= */ !1, n.d_);\n throw y();\n }));\n }, t.prototype.set = function(t, e, n) {\n L(\"Transaction.set\", arguments, 2, 3);\n var r = ya(\"Transaction.set\", t, this.yf);\n n = pa(\"Transaction.set\", n);\n var i = ma(r.d_, e, n), o = Ru(this.yf.mf, \"Transaction.set\", r.f_, i, null !== r.d_, n);\n return this.Vf.set(r.f_, o), this;\n }, t.prototype.update = function(t, e, n) {\n for (var r, i, o = [], s = 3; s < arguments.length; s++) o[s - 3] = arguments[s];\n return \"string\" == typeof e || e instanceof du ? (x(\"Transaction.update\", arguments, 3), \n r = ya(\"Transaction.update\", t, this.yf), i = Pu(this.yf.mf, \"Transaction.update\", r.f_, e, n, o)) : (D(\"Transaction.update\", arguments, 2), \n r = ya(\"Transaction.update\", t, this.yf), i = Ou(this.yf.mf, \"Transaction.update\", r.f_, e)), \n this.Vf.update(r.f_, i), this;\n }, t.prototype.delete = function(t) {\n D(\"Transaction.delete\", arguments, 1);\n var e = ya(\"Transaction.delete\", t, this.yf);\n return this.Vf.delete(e.f_), this;\n }, t;\n}(), Zu = /** @class */ function() {\n function t(t) {\n this.yf = t, this.pf = [], this.bf = !1;\n }\n return t.prototype.set = function(t, e, n) {\n L(\"WriteBatch.set\", arguments, 2, 3), this.vf();\n var r = ya(\"WriteBatch.set\", t, this.yf);\n n = pa(\"WriteBatch.set\", n);\n var i = ma(r.d_, e, n), o = Ru(this.yf.mf, \"WriteBatch.set\", r.f_, i, null !== r.d_, n);\n return this.pf = this.pf.concat(o.w_(r.f_, fn.ze())), this;\n }, t.prototype.update = function(t, e, n) {\n for (var r, i, o = [], s = 3; s < arguments.length; s++) o[s - 3] = arguments[s];\n return this.vf(), \"string\" == typeof e || e instanceof du ? (x(\"WriteBatch.update\", arguments, 3), \n r = ya(\"WriteBatch.update\", t, this.yf), i = Pu(this.yf.mf, \"WriteBatch.update\", r.f_, e, n, o)) : (D(\"WriteBatch.update\", arguments, 2), \n r = ya(\"WriteBatch.update\", t, this.yf), i = Ou(this.yf.mf, \"WriteBatch.update\", r.f_, e)), \n this.pf = this.pf.concat(i.w_(r.f_, fn.exists(!0))), this;\n }, t.prototype.delete = function(t) {\n D(\"WriteBatch.delete\", arguments, 1), this.vf();\n var e = ya(\"WriteBatch.delete\", t, this.yf);\n return this.pf = this.pf.concat(new Nn(e.f_, fn.ze())), this;\n }, t.prototype.commit = function() {\n return this.vf(), this.bf = !0, this.pf.length > 0 ? this.yf.hf().write(this.pf) : Promise.resolve();\n }, t.prototype.vf = function() {\n if (this.bf) throw new c(a.FAILED_PRECONDITION, \"A write batch can no longer be used after commit() has been called.\");\n }, t;\n}(), ta = /** @class */ function(e) {\n function n(t, n, r) {\n var i = this;\n return (i = e.call(this, n.__, t, r) || this).f_ = t, i.firestore = n, i.d_ = r, \n i.lf = i.firestore.hf(), i;\n }\n return t.__extends(n, e), n.Rf = function(t, e, r) {\n if (t.length % 2 != 0) throw new c(a.INVALID_ARGUMENT, \"Invalid document reference. Document references must have an even number of segments, but \" + t.R() + \" has \" + t.length);\n return new n(new A(t), e, r);\n }, Object.defineProperty(n.prototype, \"id\", {\n get: function() {\n return this.f_.path._();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(n.prototype, \"parent\", {\n get: function() {\n return new la(this.f_.path.h(), this.firestore, this.d_);\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(n.prototype, \"path\", {\n get: function() {\n return this.f_.path.R();\n },\n enumerable: !1,\n configurable: !0\n }), n.prototype.collection = function(t) {\n if (D(\"DocumentReference.collection\", arguments, 1), k(\"DocumentReference.collection\", \"non-empty string\", 1, t), \n !t) throw new c(a.INVALID_ARGUMENT, \"Must provide a non-empty collection name to collection()\");\n var e = E.g(t);\n return new la(this.f_.path.child(e), this.firestore, \n /* converter= */ null);\n }, n.prototype.isEqual = function(t) {\n if (!(t instanceof n)) throw G(\"isEqual\", \"DocumentReference\", 1, t);\n return this.firestore === t.firestore && this.f_.isEqual(t.f_) && this.d_ === t.d_;\n }, n.prototype.set = function(t, e) {\n L(\"DocumentReference.set\", arguments, 1, 2), e = pa(\"DocumentReference.set\", e);\n var n = ma(this.d_, t, e), r = Ru(this.firestore.mf, \"DocumentReference.set\", this.f_, n, null !== this.d_, e);\n return this.lf.write(r.w_(this.f_, fn.ze()));\n }, n.prototype.update = function(t, e) {\n for (var n, r = [], i = 2; i < arguments.length; i++) r[i - 2] = arguments[i];\n return \"string\" == typeof t || t instanceof du ? (x(\"DocumentReference.update\", arguments, 2), \n n = Pu(this.firestore.mf, \"DocumentReference.update\", this.f_, t, e, r)) : (D(\"DocumentReference.update\", arguments, 1), \n n = Ou(this.firestore.mf, \"DocumentReference.update\", this.f_, t)), this.lf.write(n.w_(this.f_, fn.exists(!0)));\n }, n.prototype.delete = function() {\n return D(\"DocumentReference.delete\", arguments, 0), this.lf.write([ new Nn(this.f_, fn.ze()) ]);\n }, n.prototype.onSnapshot = function() {\n for (var t, e, n, r = this, i = [], o = 0; o < arguments.length; o++) i[o] = arguments[o];\n L(\"DocumentReference.onSnapshot\", arguments, 1, 4);\n var s = {\n includeMetadataChanges: !1\n }, u = 0;\n \"object\" != typeof i[u] || Qu(i[u]) || (j(\"DocumentReference.onSnapshot\", s = i[u], [ \"includeMetadataChanges\" ]), \n P(\"DocumentReference.onSnapshot\", \"boolean\", \"includeMetadataChanges\", s.includeMetadataChanges), \n u++);\n var a = {\n includeMetadataChanges: s.includeMetadataChanges\n };\n if (Qu(i[u])) {\n var c = i[u];\n i[u] = null === (t = c.next) || void 0 === t ? void 0 : t.bind(c), i[u + 1] = null === (e = c.error) || void 0 === e ? void 0 : e.bind(c), \n i[u + 2] = null === (n = c.complete) || void 0 === n ? void 0 : n.bind(c);\n } else k(\"DocumentReference.onSnapshot\", \"function\", u, i[u]), R(\"DocumentReference.onSnapshot\", \"function\", u + 1, i[u + 1]), \n R(\"DocumentReference.onSnapshot\", \"function\", u + 2, i[u + 2]);\n var h = {\n next: function(t) {\n i[u] && i[u](r.Sf(t));\n },\n error: i[u + 1],\n complete: i[u + 2]\n };\n return this.lf.listen(Un(this.f_.path), a, h);\n }, n.prototype.get = function(t) {\n var e = this;\n L(\"DocumentReference.get\", arguments, 0, 1), va(\"DocumentReference.get\", t);\n var n = this.firestore.hf();\n return t && \"cache\" === t.source ? n.Q_(this.f_).then((function(t) {\n return new na(e.firestore, e.f_, t, \n /*fromCache=*/ !0, t instanceof kn && t.Je, e.d_);\n })) : n.W_(this.f_, t).then((function(t) {\n return e.Sf(t);\n }));\n }, n.prototype.withConverter = function(t) {\n return new n(this.f_, this.firestore, t);\n }, \n /**\n * Converts a ViewSnapshot that contains the current document to a\n * DocumentSnapshot.\n */\n n.prototype.Sf = function(t) {\n var e = t.docs.get(this.f_);\n return new na(this.firestore, this.f_, e, t.fromCache, t.hasPendingWrites, this.d_);\n }, n;\n}(Au), ea = /** @class */ function() {\n function t(t, e) {\n this.hasPendingWrites = t, this.fromCache = e\n /**\n * Returns true if this `SnapshotMetadata` is equal to the provided one.\n *\n * @param other The `SnapshotMetadata` to compare against.\n * @return true if this `SnapshotMetadata` is equal to the provided one.\n */;\n }\n return t.prototype.isEqual = function(t) {\n return this.hasPendingWrites === t.hasPendingWrites && this.fromCache === t.fromCache;\n }, t;\n}(), na = /** @class */ function() {\n function t(t, e, n, r, i, o) {\n this.yf = t, this.f_ = e, this.Df = n, this.Cf = r, this.Nf = i, this.d_ = o;\n }\n return t.prototype.data = function(t) {\n var e = this;\n if (L(\"DocumentSnapshot.data\", arguments, 0, 1), t = da(\"DocumentSnapshot.data\", t), \n this.Df) {\n // We only want to use the converter and create a new DocumentSnapshot\n // if a converter has been provided.\n if (this.d_) {\n var n = new ra(this.yf, this.f_, this.Df, this.Cf, this.Nf, \n /* converter= */ null);\n return this.d_.fromFirestore(n, t);\n }\n return new Hu(this.yf.__, this.yf.gf(), t.serverTimestamps || \"none\", (function(t) {\n return new ta(t, e.yf, /* converter= */ null);\n }), (function(t) {\n return new et(t);\n })).X_(this.Df.rn());\n }\n }, t.prototype.get = function(t, e) {\n var n = this;\n if (L(\"DocumentSnapshot.get\", arguments, 1, 2), e = da(\"DocumentSnapshot.get\", e), \n this.Df) {\n var r = this.Df.data().field(qu(\"DocumentSnapshot.get\", t, this.f_));\n if (null !== r) return new Hu(this.yf.__, this.yf.gf(), e.serverTimestamps || \"none\", (function(t) {\n return new ta(t, n.yf, n.d_);\n }), (function(t) {\n return new et(t);\n })).X_(r);\n }\n }, Object.defineProperty(t.prototype, \"id\", {\n get: function() {\n return this.f_.path._();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"ref\", {\n get: function() {\n return new ta(this.f_, this.yf, this.d_);\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"exists\", {\n get: function() {\n return null !== this.Df;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"metadata\", {\n get: function() {\n return new ea(this.Nf, this.Cf);\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.isEqual = function(e) {\n if (!(e instanceof t)) throw G(\"isEqual\", \"DocumentSnapshot\", 1, e);\n return this.yf === e.yf && this.Cf === e.Cf && this.f_.isEqual(e.f_) && (null === this.Df ? null === e.Df : this.Df.isEqual(e.Df)) && this.d_ === e.d_;\n }, t;\n}(), ra = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.prototype.data = function(t) {\n return e.prototype.data.call(this, t);\n }, n;\n}(na);\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// settings() defaults:\nfunction ia(t, e, n, r, i, o, s) {\n var u;\n if (i.p()) {\n if (\"array-contains\" /* ARRAY_CONTAINS */ === o || \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ === o) throw new c(a.INVALID_ARGUMENT, \"Invalid Query. You can't perform '\" + o + \"' queries on FieldPath.documentId().\");\n if (\"in\" /* IN */ === o || \"not-in\" /* NOT_IN */ === o) {\n ua(s, o);\n for (var h = [], f = 0, l = s; f < l.length; f++) {\n var p = l[f];\n h.push(sa(r, t, p));\n }\n u = {\n arrayValue: {\n values: h\n }\n };\n } else u = sa(r, t, s);\n } else \"in\" /* IN */ !== o && \"not-in\" /* NOT_IN */ !== o && \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ !== o || ua(s, o), \n u = Vu(n, e, s, \n /* allowArrays= */ \"in\" /* IN */ === o || \"not-in\" /* NOT_IN */ === o);\n var d = Jn.create(i, o, u);\n return function(t, e) {\n if (e.hn()) {\n var n = qn(t);\n if (null !== n && !n.isEqual(e.field)) throw new c(a.INVALID_ARGUMENT, \"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '\" + n.toString() + \"' and '\" + e.field.toString() + \"'\");\n var r = Mn(t);\n null !== r && aa(t, e.field, r);\n }\n var i = function(t, e) {\n for (var n = 0, r = t.filters; n < r.length; n++) {\n var i = r[n];\n if (e.indexOf(i.op) >= 0) return i.op;\n }\n return null;\n }(t, \n /**\n * Given an operator, returns the set of operators that cannot be used with it.\n *\n * Operators in a query must adhere to the following set of rules:\n * 1. Only one array operator is allowed.\n * 2. Only one disjunctive operator is allowed.\n * 3. NOT_EQUAL cannot be used with another NOT_EQUAL operator.\n * 4. NOT_IN cannot be used with array, disjunctive, or NOT_EQUAL operators.\n *\n * Array operators: ARRAY_CONTAINS, ARRAY_CONTAINS_ANY\n * Disjunctive operators: IN, ARRAY_CONTAINS_ANY, NOT_IN\n */\n function(t) {\n switch (t) {\n case \"!=\" /* NOT_EQUAL */ :\n return [ \"!=\" /* NOT_EQUAL */ , \"not-in\" /* NOT_IN */ ];\n\n case \"array-contains\" /* ARRAY_CONTAINS */ :\n return [ \"array-contains\" /* ARRAY_CONTAINS */ , \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ , \"not-in\" /* NOT_IN */ ];\n\n case \"in\" /* IN */ :\n return [ \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ , \"in\" /* IN */ , \"not-in\" /* NOT_IN */ ];\n\n case \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ :\n return [ \"array-contains\" /* ARRAY_CONTAINS */ , \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ , \"in\" /* IN */ , \"not-in\" /* NOT_IN */ ];\n\n case \"not-in\" /* NOT_IN */ :\n return [ \"array-contains\" /* ARRAY_CONTAINS */ , \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ , \"in\" /* IN */ , \"not-in\" /* NOT_IN */ , \"!=\" /* NOT_EQUAL */ ];\n\n default:\n return [];\n }\n }(e.op));\n if (null !== i) \n // Special case when it's a duplicate op to give a slightly clearer error message.\n throw i === e.op ? new c(a.INVALID_ARGUMENT, \"Invalid query. You cannot use more than one '\" + e.op.toString() + \"' filter.\") : new c(a.INVALID_ARGUMENT, \"Invalid query. You cannot use '\" + e.op.toString() + \"' filters with '\" + i.toString() + \"' filters.\");\n }(t, d), d;\n}\n\nfunction oa(t, e, n) {\n if (null !== t.startAt) throw new c(a.INVALID_ARGUMENT, \"Invalid query. You must not call startAt() or startAfter() before calling orderBy().\");\n if (null !== t.endAt) throw new c(a.INVALID_ARGUMENT, \"Invalid query. You must not call endAt() or endBefore() before calling orderBy().\");\n var r = new fr(e, n);\n return function(t, e) {\n if (null === Mn(t)) {\n // This is the first order by. It must match any inequality.\n var n = qn(t);\n null !== n && aa(t, n, e.field);\n }\n }(t, r), r\n /**\n * Create a Bound from a query and a document.\n *\n * Note that the Bound will always include the key of the document\n * and so only the provided document will compare equal to the returned\n * position.\n *\n * Will throw if the document does not contain all fields of the order by\n * of the query or if any of the fields in the order by are an uncommitted\n * server timestamp.\n */\n /**\n * Parses the given documentIdValue into a ReferenceValue, throwing\n * appropriate errors if the value is anything other than a DocumentReference\n * or String, or if the string is malformed.\n */;\n}\n\nfunction sa(t, e, n) {\n if (\"string\" == typeof n) {\n if (\"\" === n) throw new c(a.INVALID_ARGUMENT, \"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.\");\n if (!jn(e) && -1 !== n.indexOf(\"/\")) throw new c(a.INVALID_ARGUMENT, \"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '\" + n + \"' contains a '/' character.\");\n var r = e.path.child(E.g(n));\n if (!A.F(r)) throw new c(a.INVALID_ARGUMENT, \"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '\" + r + \"' is not because it has an odd number of segments (\" + r.length + \").\");\n return ae(t, new A(r));\n }\n if (n instanceof Au) return ae(t, n.f_);\n throw new c(a.INVALID_ARGUMENT, \"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: \" + M(n) + \".\");\n}\n\n/**\n * Validates that the value passed into a disjunctive filter satisfies all\n * array requirements.\n */ function ua(t, e) {\n if (!Array.isArray(t) || 0 === t.length) throw new c(a.INVALID_ARGUMENT, \"Invalid Query. A non-empty array is required for '\" + e.toString() + \"' filters.\");\n if (t.length > 10) throw new c(a.INVALID_ARGUMENT, \"Invalid Query. '\" + e.toString() + \"' filters support a maximum of 10 elements in the value array.\");\n if (\"in\" /* IN */ === e || \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ === e) {\n if (t.indexOf(null) >= 0) throw new c(a.INVALID_ARGUMENT, \"Invalid Query. '\" + e.toString() + \"' filters cannot contain 'null' in the value array.\");\n if (t.filter((function(t) {\n return Number.isNaN(t);\n })).length > 0) throw new c(a.INVALID_ARGUMENT, \"Invalid Query. '\" + e.toString() + \"' filters cannot contain 'NaN' in the value array.\");\n }\n}\n\nfunction aa(t, e, n) {\n if (!n.isEqual(e)) throw new c(a.INVALID_ARGUMENT, \"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '\" + e.toString() + \"' and so you must also use '\" + e.toString() + \"' as your first orderBy(), but your first orderBy() is on field '\" + n.toString() + \"' instead.\");\n}\n\nfunction ca(t) {\n if (Fn(t) && 0 === t.on.length) throw new c(a.UNIMPLEMENTED, \"limitToLast() queries require specifying at least one orderBy() clause\");\n}\n\nvar ha = /** @class */ function() {\n function e(t, e, n) {\n this.Ff = t, this.firestore = e, this.d_ = n;\n }\n return e.prototype.where = function(t, n, r) {\n D(\"Query.where\", arguments, 3), q(\"Query.where\", 3, r);\n // Enumerated from the WhereFilterOp type in index.d.ts.\n var i = U(\"Query.where\", [ \"<\" /* LESS_THAN */ , \"<=\" /* LESS_THAN_OR_EQUAL */ , \"==\" /* EQUAL */ , \"!=\" /* NOT_EQUAL */ , \">=\" /* GREATER_THAN_OR_EQUAL */ , \">\" /* GREATER_THAN */ , \"array-contains\" /* ARRAY_CONTAINS */ , \"in\" /* IN */ , \"array-contains-any\" /* ARRAY_CONTAINS_ANY */ , \"not-in\" /* NOT_IN */ ], 2, n), o = qu(\"Query.where\", t), s = ia(this.Ff, \"Query.where\", this.firestore.mf, this.firestore.__, o, i, r);\n return new e(function(t, e) {\n var n = t.filters.concat([ e ]);\n return new Pn(t.path, t.collectionGroup, t.on.slice(), n, t.limit, t.an, t.startAt, t.endAt);\n }(this.Ff, s), this.firestore, this.d_);\n }, e.prototype.orderBy = function(t, n) {\n var r;\n if (L(\"Query.orderBy\", arguments, 1, 2), R(\"Query.orderBy\", \"non-empty string\", 2, n), \n void 0 === n || \"asc\" === n) r = \"asc\" /* ASCENDING */; else {\n if (\"desc\" !== n) throw new c(a.INVALID_ARGUMENT, \"Function Query.orderBy() has unknown direction '\" + n + \"', expected 'asc' or 'desc'.\");\n r = \"desc\" /* DESCENDING */;\n }\n var i = qu(\"Query.orderBy\", t), o = oa(this.Ff, i, r);\n return new e(function(t, e) {\n // TODO(dimond): validate that orderBy does not list the same key twice.\n var n = t.on.concat([ e ]);\n return new Pn(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.an, t.startAt, t.endAt);\n }(this.Ff, o), this.firestore, this.d_);\n }, e.prototype.limit = function(t) {\n return D(\"Query.limit\", arguments, 1), k(\"Query.limit\", \"number\", 1, t), z(\"Query.limit\", 1, t), \n new e(Bn(this.Ff, t, \"F\" /* First */), this.firestore, this.d_);\n }, e.prototype.limitToLast = function(t) {\n return D(\"Query.limitToLast\", arguments, 1), k(\"Query.limitToLast\", \"number\", 1, t), \n z(\"Query.limitToLast\", 1, t), new e(Bn(this.Ff, t, \"L\" /* Last */), this.firestore, this.d_);\n }, e.prototype.startAt = function(t) {\n for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];\n x(\"Query.startAt\", arguments, 1);\n var i = this.xf(\"Query.startAt\", t, n, \n /*before=*/ !0);\n return new e(Wn(this.Ff, i), this.firestore, this.d_);\n }, e.prototype.startAfter = function(t) {\n for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];\n x(\"Query.startAfter\", arguments, 1);\n var i = this.xf(\"Query.startAfter\", t, n, \n /*before=*/ !1);\n return new e(Wn(this.Ff, i), this.firestore, this.d_);\n }, e.prototype.endBefore = function(t) {\n for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];\n x(\"Query.endBefore\", arguments, 1);\n var i = this.xf(\"Query.endBefore\", t, n, \n /*before=*/ !0);\n return new e(Kn(this.Ff, i), this.firestore, this.d_);\n }, e.prototype.endAt = function(t) {\n for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];\n x(\"Query.endAt\", arguments, 1);\n var i = this.xf(\"Query.endAt\", t, n, \n /*before=*/ !1);\n return new e(Kn(this.Ff, i), this.firestore, this.d_);\n }, e.prototype.isEqual = function(t) {\n if (!(t instanceof e)) throw G(\"isEqual\", \"Query\", 1, t);\n return this.firestore === t.firestore && Qn(this.Ff, t.Ff) && this.d_ === t.d_;\n }, e.prototype.withConverter = function(t) {\n return new e(this.Ff, this.firestore, t);\n }, \n /** Helper function to create a bound from a document or fields */ e.prototype.xf = function(e, n, r, i) {\n if (q(e, 1, n), n instanceof na) return D(e, t.__spreadArrays([ n ], r), 1), function(t, e, n, r, i) {\n if (!r) throw new c(a.NOT_FOUND, \"Can't use a DocumentSnapshot that doesn't exist for \" + n + \"().\");\n // Because people expect to continue/end a query at the exact document\n // provided, we need to use the implicit sort order rather than the explicit\n // sort order, because it's guaranteed to contain the document key. That way\n // the position becomes unambiguous and the query continues/ends exactly at\n // the provided document. Without the key (by using the explicit sort\n // orders), multiple documents could match the position, yielding duplicate\n // results.\n for (var o = [], s = 0, u = Gn(t); s < u.length; s++) {\n var h = u[s];\n if (h.field.p()) o.push(ae(e, r.key)); else {\n var f = r.field(h.field);\n if (Ht(f)) throw new c(a.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field \"' + h.field + '\" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');\n if (null === f) {\n var l = h.field.R();\n throw new c(a.INVALID_ARGUMENT, \"Invalid query. You are trying to start or end a query using a document for which the field '\" + l + \"' (used as the orderBy) does not exist.\");\n }\n o.push(f);\n }\n }\n return new ur(o, i);\n }(this.Ff, this.firestore.__, e, n.Df, i);\n var o = [ n ].concat(r);\n return function(t, e, n, r, i, o) {\n // Use explicit order by's because it has to match the query the user made\n var s = t.on;\n if (i.length > s.length) throw new c(a.INVALID_ARGUMENT, \"Too many arguments provided to \" + r + \"(). The number of arguments must be less than or equal to the number of orderBy() clauses\");\n for (var u = [], h = 0; h < i.length; h++) {\n var f = i[h];\n if (s[h].field.p()) {\n if (\"string\" != typeof f) throw new c(a.INVALID_ARGUMENT, \"Invalid query. Expected a string for document ID in \" + r + \"(), but got a \" + typeof f);\n if (!jn(t) && -1 !== f.indexOf(\"/\")) throw new c(a.INVALID_ARGUMENT, \"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to \" + r + \"() must be a plain document ID, but '\" + f + \"' contains a slash.\");\n var l = t.path.child(E.g(f));\n if (!A.F(l)) throw new c(a.INVALID_ARGUMENT, \"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to \" + r + \"() must result in a valid document path, but '\" + l + \"' is not because it contains an odd number of segments.\");\n var p = new A(l);\n u.push(ae(e, p));\n } else {\n var d = Vu(n, r, f);\n u.push(d);\n }\n }\n return new ur(u, o);\n }(this.Ff, this.firestore.__, this.firestore.mf, e, o, i);\n }, e.prototype.onSnapshot = function() {\n for (var t, e, n, r = this, i = [], o = 0; o < arguments.length; o++) i[o] = arguments[o];\n L(\"Query.onSnapshot\", arguments, 1, 4);\n var s = {}, u = 0;\n if (\"object\" != typeof i[u] || Qu(i[u]) || (j(\"Query.onSnapshot\", s = i[u], [ \"includeMetadataChanges\" ]), \n P(\"Query.onSnapshot\", \"boolean\", \"includeMetadataChanges\", s.includeMetadataChanges), \n u++), Qu(i[u])) {\n var a = i[u];\n i[u] = null === (t = a.next) || void 0 === t ? void 0 : t.bind(a), i[u + 1] = null === (e = a.error) || void 0 === e ? void 0 : e.bind(a), \n i[u + 2] = null === (n = a.complete) || void 0 === n ? void 0 : n.bind(a);\n } else k(\"Query.onSnapshot\", \"function\", u, i[u]), R(\"Query.onSnapshot\", \"function\", u + 1, i[u + 1]), \n R(\"Query.onSnapshot\", \"function\", u + 2, i[u + 2]);\n var c = {\n next: function(t) {\n i[u] && i[u](new fa(r.firestore, r.Ff, t, r.d_));\n },\n error: i[u + 1],\n complete: i[u + 2]\n };\n return ca(this.Ff), this.firestore.hf().listen(this.Ff, s, c);\n }, e.prototype.get = function(t) {\n var e = this;\n L(\"Query.get\", arguments, 0, 1), va(\"Query.get\", t), ca(this.Ff);\n var n = this.firestore.hf();\n return (t && \"cache\" === t.source ? n.j_(this.Ff) : n.K_(this.Ff, t)).then((function(t) {\n return new fa(e.firestore, e.Ff, t, e.d_);\n }));\n }, e;\n}(), fa = /** @class */ function() {\n function t(t, e, n, r) {\n this.yf = t, this.$f = e, this.kf = n, this.d_ = r, this.Mf = null, this.Of = null, \n this.metadata = new ea(n.hasPendingWrites, n.fromCache);\n }\n return Object.defineProperty(t.prototype, \"docs\", {\n get: function() {\n var t = [];\n return this.forEach((function(e) {\n return t.push(e);\n })), t;\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"empty\", {\n get: function() {\n return this.kf.docs.m();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(t.prototype, \"size\", {\n get: function() {\n return this.kf.docs.size;\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.forEach = function(t, e) {\n var n = this;\n L(\"QuerySnapshot.forEach\", arguments, 1, 2), k(\"QuerySnapshot.forEach\", \"function\", 1, t), \n this.kf.docs.forEach((function(r) {\n t.call(e, n.Lf(r, n.metadata.fromCache, n.kf.Wt.has(r.key)));\n }));\n }, Object.defineProperty(t.prototype, \"query\", {\n get: function() {\n return new ha(this.$f, this.yf, this.d_);\n },\n enumerable: !1,\n configurable: !0\n }), t.prototype.docChanges = function(t) {\n t && (j(\"QuerySnapshot.docChanges\", t, [ \"includeMetadataChanges\" ]), P(\"QuerySnapshot.docChanges\", \"boolean\", \"includeMetadataChanges\", t.includeMetadataChanges));\n var e = !(!t || !t.includeMetadataChanges);\n if (e && this.kf.Kt) throw new c(a.INVALID_ARGUMENT, \"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().\");\n return this.Mf && this.Of === e || (this.Mf = \n /**\n * Calculates the array of DocumentChanges for a given ViewSnapshot.\n *\n * Exported for testing.\n *\n * @param snapshot The ViewSnapshot that represents the expected state.\n * @param includeMetadataChanges Whether to include metadata changes.\n * @param converter A factory function that returns a QueryDocumentSnapshot.\n * @return An object that matches the DocumentChange API.\n */\n function(t, e, n) {\n if (t.Qt.m()) {\n // Special case the first snapshot because index calculation is easy and\n // fast\n var r = 0;\n return t.docChanges.map((function(e) {\n var i = n(e.doc, t.fromCache, t.Wt.has(e.doc.key));\n return e.doc, {\n type: \"added\",\n doc: i,\n oldIndex: -1,\n newIndex: r++\n };\n }));\n }\n // A DocumentSet that is updated incrementally as changes are applied to use\n // to lookup the index of a document.\n var i = t.Qt;\n return t.docChanges.filter((function(t) {\n return e || 3 /* Metadata */ !== t.type;\n })).map((function(e) {\n var r = n(e.doc, t.fromCache, t.Wt.has(e.doc.key)), o = -1, s = -1;\n return 0 /* Added */ !== e.type && (o = i.indexOf(e.doc.key), i = i.delete(e.doc.key)), \n 1 /* Removed */ !== e.type && (s = (i = i.add(e.doc)).indexOf(e.doc.key)), {\n type: ga(e.type),\n doc: r,\n oldIndex: o,\n newIndex: s\n };\n }));\n }(this.kf, e, this.Lf.bind(this)), this.Of = e), this.Mf;\n }, \n /** Check the equality. The call can be very expensive. */ t.prototype.isEqual = function(e) {\n if (!(e instanceof t)) throw G(\"isEqual\", \"QuerySnapshot\", 1, e);\n return this.yf === e.yf && Qn(this.$f, e.$f) && this.kf.isEqual(e.kf) && this.d_ === e.d_;\n }, t.prototype.Lf = function(t, e, n) {\n return new ra(this.yf, t.key, t, e, n, this.d_);\n }, t;\n}(), la = /** @class */ function(e) {\n function n(t, n, r) {\n var i = this;\n if ((i = e.call(this, Un(t), n, r) || this).Bf = t, t.length % 2 != 1) throw new c(a.INVALID_ARGUMENT, \"Invalid collection reference. Collection references must have an odd number of segments, but \" + t.R() + \" has \" + t.length);\n return i;\n }\n return t.__extends(n, e), Object.defineProperty(n.prototype, \"id\", {\n get: function() {\n return this.Ff.path._();\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(n.prototype, \"parent\", {\n get: function() {\n var t = this.Ff.path.h();\n return t.m() ? null : new ta(new A(t), this.firestore, \n /* converter= */ null);\n },\n enumerable: !1,\n configurable: !0\n }), Object.defineProperty(n.prototype, \"path\", {\n get: function() {\n return this.Ff.path.R();\n },\n enumerable: !1,\n configurable: !0\n }), n.prototype.doc = function(t) {\n L(\"CollectionReference.doc\", arguments, 0, 1), \n // We allow omission of 'pathString' but explicitly prohibit passing in both\n // 'undefined' and 'null'.\n 0 === arguments.length && (t = Q.k()), k(\"CollectionReference.doc\", \"non-empty string\", 1, t);\n var e = E.g(t);\n return ta.Rf(this.Ff.path.child(e), this.firestore, this.d_);\n }, n.prototype.add = function(t) {\n D(\"CollectionReference.add\", arguments, 1);\n var e = this.d_ ? this.d_.toFirestore(t) : t;\n k(\"CollectionReference.add\", \"object\", 1, e);\n var n = this.doc();\n // Call set() with the converted value directly to avoid calling toFirestore() a second time.\n return new ta(n.f_, this.firestore, null).set(e).then((function() {\n return n;\n }));\n }, n.prototype.withConverter = function(t) {\n return new n(this.Bf, this.firestore, t);\n }, n;\n}(ha);\n\nfunction pa(t, e) {\n if (void 0 === e) return {\n merge: !1\n };\n if (j(t, e, [ \"merge\", \"mergeFields\" ]), P(t, \"boolean\", \"merge\", e.merge), function(t, e, n, r, i) {\n void 0 !== r && function(t, e, n, r, i) {\n if (!(r instanceof Array)) throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires its \" + e + \" option to be an array, but it was: \" + M(r));\n for (var o = 0; o < r.length; ++o) if (!i(r[o])) throw new c(a.INVALID_ARGUMENT, \"Function \" + t + \"() requires all \" + e + \" elements to be \" + n + \", but the value at index \" + o + \" was: \" + M(r[o]));\n }(t, e, n, r, i);\n }(t, \"mergeFields\", \"a string or a FieldPath\", e.mergeFields, (function(t) {\n return \"string\" == typeof t || t instanceof du;\n })), void 0 !== e.mergeFields && void 0 !== e.merge) throw new c(a.INVALID_ARGUMENT, \"Invalid options passed to function \" + t + '(): You cannot specify both \"merge\" and \"mergeFields\".');\n return e;\n}\n\nfunction da(t, e) {\n return void 0 === e ? {} : (j(t, e, [ \"serverTimestamps\" ]), V(t, 0, \"serverTimestamps\", e.serverTimestamps, [ \"estimate\", \"previous\", \"none\" ]), \n e);\n}\n\nfunction va(t, e) {\n R(t, \"object\", 1, e), e && (j(t, e, [ \"source\" ]), V(t, 0, \"source\", e.source, [ \"default\", \"server\", \"cache\" ]));\n}\n\nfunction ya(t, e, n) {\n if (e instanceof Au) {\n if (e.firestore !== n) throw new c(a.INVALID_ARGUMENT, \"Provided document reference is from a different Firestore instance.\");\n return e;\n }\n throw G(t, \"DocumentReference\", 1, e);\n}\n\nfunction ga(t) {\n switch (t) {\n case 0 /* Added */ :\n return \"added\";\n\n case 2 /* Modified */ :\n case 3 /* Metadata */ :\n return \"modified\";\n\n case 1 /* Removed */ :\n return \"removed\";\n\n default:\n return y();\n }\n}\n\n/**\n * Converts custom model object of type T into DocumentData by applying the\n * converter if it exists.\n *\n * This function is used when converting user objects to DocumentData\n * because we want to provide the user with a more specific error message if\n * their set() or fails due to invalid data originating from a toFirestore()\n * call.\n */ function ma(t, e, n) {\n // Cast to `any` in order to satisfy the union type constraint on\n // toFirestore().\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ var wa = /** @class */ function(e) {\n function n() {\n return null !== e && e.apply(this, arguments) || this;\n }\n return t.__extends(n, e), n.serverTimestamp = function() {\n S(\"FieldValue.serverTimestamp\", arguments);\n var t = new wu(\"serverTimestamp\");\n return t.e_ = \"FieldValue.serverTimestamp\", new n(t);\n }, n.delete = function() {\n S(\"FieldValue.delete\", arguments);\n var t = new gu(\"deleteField\");\n return t.e_ = \"FieldValue.delete\", new n(t);\n }, n.arrayUnion = function() {\n for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];\n x(\"FieldValue.arrayUnion\", arguments, 1);\n var r = \n /**\n * Returns a special value that can be used with {@link setDoc()} or {@link\n * updateDoc()} that tells the server to union the given elements with any array\n * value that already exists on the server. Each specified element that doesn't\n * already exist in the array will be added to the end. If the field being\n * modified is not already an array it will be overwritten with an array\n * containing exactly the specified elements.\n *\n * @param elements The elements to union into the array.\n * @return The `FieldValue` sentinel for use in a call to `setDoc()` or\n * `updateDoc()`.\n */\n function() {\n for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];\n // NOTE: We don't actually parse the data until it's used in set() or\n // update() since we'd need the Firestore instance to do this.\n return x(\"arrayUnion()\", arguments, 1), new _u(\"arrayUnion\", t);\n }.apply(void 0, t);\n return r.e_ = \"FieldValue.arrayUnion\", new n(r);\n }, n.arrayRemove = function() {\n for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];\n x(\"FieldValue.arrayRemove\", arguments, 1);\n var r = function() {\n for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];\n // NOTE: We don't actually parse the data until it's used in set() or\n // update() since we'd need the Firestore instance to do this.\n return x(\"arrayRemove()\", arguments, 1), new bu(\"arrayRemove\", t);\n }.apply(void 0, t);\n return r.e_ = \"FieldValue.arrayRemove\", new n(r);\n }, n.increment = function(t) {\n k(\"FieldValue.increment\", \"number\", 1, t), D(\"FieldValue.increment\", arguments, 1);\n var e = function(t) {\n return new Iu(\"increment\", t);\n }(t);\n return e.e_ = \"FieldValue.increment\", new n(e);\n }, n.prototype.isEqual = function(t) {\n return this.l_.isEqual(t.l_);\n }, n;\n}(Tu), _a = {\n Firestore: Xu,\n GeoPoint: Eu,\n Timestamp: ot,\n Blob: et,\n Transaction: Ju,\n WriteBatch: Zu,\n DocumentReference: ta,\n DocumentSnapshot: na,\n Query: ha,\n QueryDocumentSnapshot: ra,\n QuerySnapshot: fa,\n CollectionReference: la,\n FieldPath: du,\n FieldValue: wa,\n setLogLevel: Xu.setLogLevel,\n CACHE_SIZE_UNLIMITED: Yu\n};\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Configures Firestore as part of the Firebase SDK by calling registerService.\n *\n * @param firebase The FirebaseNamespace to register Firestore with\n * @param firestoreFactory A factory function that returns a new Firestore\n * instance.\n */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Registers the main Firestore build with the components framework.\n * Persistence can be enabled via `firebase.firestore().enablePersistence()`.\n */\nfunction ba(t) {\n !function(t, e) {\n t.INTERNAL.registerComponent(new o.Component(\"firestore\", (function(t) {\n return function(t, e) {\n var n = new fu, r = new hu(n);\n return new Xu(t, e, r, n);\n }(t.getProvider(\"app\").getImmediate(), t.getProvider(\"auth-internal\"));\n }), \"PUBLIC\" /* PUBLIC */).setServiceProps(Object.assign({}, _a)));\n }(t), t.registerVersion(\"@firebase/firestore\", \"1.18.0\");\n}\n\nba(u.default), exports.__PRIVATE_registerFirestore = ba;\n//# sourceMappingURL=index.cjs.js.map\n","'use strict';\n// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap\nvar $export = require('./_export');\nvar flattenIntoArray = require('./_flatten-into-array');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar aFunction = require('./_a-function');\nvar arraySpeciesCreate = require('./_array-species-create');\n\n$export($export.P, 'Array', {\n flatMap: function flatMap(callbackfn /* , thisArg */) {\n var O = toObject(this);\n var sourceLen, A;\n aFunction(callbackfn);\n sourceLen = toLength(O.length);\n A = arraySpeciesCreate(O, 0);\n flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]);\n return A;\n }\n});\n\nrequire('./_add-to-unscopables')('flatMap');\n","var toString = require('./toString'),\n upperFirst = require('./upperFirst');\n\n/**\n * Converts the first character of `string` to upper case and the remaining\n * to lower case.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('FRED');\n * // => 'Fred'\n */\nfunction capitalize(string) {\n return upperFirst(toString(string).toLowerCase());\n}\n\nmodule.exports = capitalize;\n","// https://rwaldron.github.io/proposal-math-extensions/\nmodule.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {\n if (\n arguments.length === 0\n // eslint-disable-next-line no-self-compare\n || x != x\n // eslint-disable-next-line no-self-compare\n || inLow != inLow\n // eslint-disable-next-line no-self-compare\n || inHigh != inHigh\n // eslint-disable-next-line no-self-compare\n || outLow != outLow\n // eslint-disable-next-line no-self-compare\n || outHigh != outHigh\n ) return NaN;\n if (x === Infinity || x === -Infinity) return x;\n return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;\n};\n","var asciiWords = require('./_asciiWords'),\n hasUnicodeWord = require('./_hasUnicodeWord'),\n toString = require('./toString'),\n unicodeWords = require('./_unicodeWords');\n\n/**\n * Splits `string` into an array of its words.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {RegExp|string} [pattern] The pattern to match words.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the words of `string`.\n * @example\n *\n * _.words('fred, barney, & pebbles');\n * // => ['fred', 'barney', 'pebbles']\n *\n * _.words('fred, barney, & pebbles', /[^, ]+/g);\n * // => ['fred', 'barney', '&', 'pebbles']\n */\nfunction words(string, pattern, guard) {\n string = toString(string);\n pattern = guard ? undefined : pattern;\n\n if (pattern === undefined) {\n return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);\n }\n return string.match(pattern) || [];\n}\n\nmodule.exports = words;\n","import '@firebase/auth';\n//# sourceMappingURL=index.esm.js.map\n","// 7.3.20 SpeciesConstructor(O, defaultConstructor)\nvar anObject = require('./_an-object');\nvar aFunction = require('./_a-function');\nvar SPECIES = require('./_wks')('species');\nmodule.exports = function (O, D) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);\n};\n","// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)\nvar gOPD = require('./_object-gopd');\nvar $export = require('./_export');\nvar anObject = require('./_an-object');\n\n$export($export.S, 'Reflect', {\n getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) {\n return gOPD.f(anObject(target), propertyKey);\n }\n});\n","//! moment.js locale configuration\n//! locale : Malay [ms]\n//! author : Weldan Jamili : https://github.com/weldan\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var ms = moment.defineLocale('ms', {\n months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split(\n '_'\n ),\n monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),\n weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),\n weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),\n weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),\n longDateFormat: {\n LT: 'HH.mm',\n LTS: 'HH.mm.ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY [pukul] HH.mm',\n LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',\n },\n meridiemParse: /pagi|tengahari|petang|malam/,\n meridiemHour: function (hour, meridiem) {\n if (hour === 12) {\n hour = 0;\n }\n if (meridiem === 'pagi') {\n return hour;\n } else if (meridiem === 'tengahari') {\n return hour >= 11 ? hour : hour + 12;\n } else if (meridiem === 'petang' || meridiem === 'malam') {\n return hour + 12;\n }\n },\n meridiem: function (hours, minutes, isLower) {\n if (hours < 11) {\n return 'pagi';\n } else if (hours < 15) {\n return 'tengahari';\n } else if (hours < 19) {\n return 'petang';\n } else {\n return 'malam';\n }\n },\n calendar: {\n sameDay: '[Hari ini pukul] LT',\n nextDay: '[Esok pukul] LT',\n nextWeek: 'dddd [pukul] LT',\n lastDay: '[Kelmarin pukul] LT',\n lastWeek: 'dddd [lepas pukul] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: 'dalam %s',\n past: '%s yang lepas',\n s: 'beberapa saat',\n ss: '%d saat',\n m: 'seminit',\n mm: '%d minit',\n h: 'sejam',\n hh: '%d jam',\n d: 'sehari',\n dd: '%d hari',\n M: 'sebulan',\n MM: '%d bulan',\n y: 'setahun',\n yy: '%d tahun',\n },\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 7, // The week that contains Jan 7th is the first week of the year.\n },\n });\n\n return ms;\n\n})));\n","var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n","//! moment.js locale configuration\n//! locale : Estonian [et]\n//! author : Henry Kehlmann : https://github.com/madhenry\n//! improvements : Illimar Tambek : https://github.com/ragulka\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }\n\n var et = moment.defineLocale('et', {\n months: 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split(\n '_'\n ),\n monthsShort:\n 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'),\n weekdays:\n 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split(\n '_'\n ),\n weekdaysShort: 'P_E_T_K_N_R_L'.split('_'),\n weekdaysMin: 'P_E_T_K_N_R_L'.split('_'),\n longDateFormat: {\n LT: 'H:mm',\n LTS: 'H:mm:ss',\n L: 'DD.MM.YYYY',\n LL: 'D. MMMM YYYY',\n LLL: 'D. MMMM YYYY H:mm',\n LLLL: 'dddd, D. MMMM YYYY H:mm',\n },\n calendar: {\n sameDay: '[Täna,] LT',\n nextDay: '[Homme,] LT',\n nextWeek: '[Järgmine] dddd LT',\n lastDay: '[Eile,] LT',\n lastWeek: '[Eelmine] dddd LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: '%s pärast',\n past: '%s tagasi',\n s: processRelativeTime,\n ss: processRelativeTime,\n m: processRelativeTime,\n mm: processRelativeTime,\n h: processRelativeTime,\n hh: processRelativeTime,\n d: processRelativeTime,\n dd: '%d päeva',\n M: processRelativeTime,\n MM: processRelativeTime,\n y: processRelativeTime,\n yy: processRelativeTime,\n },\n dayOfMonthOrdinalParse: /\\d{1,2}\\./,\n ordinal: '%d.',\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 4, // The week that contains Jan 4th is the first week of the year.\n },\n });\n\n return et;\n\n})));\n","//! moment.js locale configuration\n//! locale : English (India) [en-in]\n//! author : Jatin Agrawal : https://github.com/jatinag22\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var enIn = moment.defineLocale('en-in', {\n months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(\n '_'\n ),\n monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),\n weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(\n '_'\n ),\n weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),\n weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),\n longDateFormat: {\n LT: 'h:mm A',\n LTS: 'h:mm:ss A',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY h:mm A',\n LLLL: 'dddd, D MMMM YYYY h:mm A',\n },\n calendar: {\n sameDay: '[Today at] LT',\n nextDay: '[Tomorrow at] LT',\n nextWeek: 'dddd [at] LT',\n lastDay: '[Yesterday at] LT',\n lastWeek: '[Last] dddd [at] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n ss: '%d seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years',\n },\n dayOfMonthOrdinalParse: /\\d{1,2}(st|nd|rd|th)/,\n ordinal: function (number) {\n var b = number % 10,\n output =\n ~~((number % 100) / 10) === 1\n ? 'th'\n : b === 1\n ? 'st'\n : b === 2\n ? 'nd'\n : b === 3\n ? 'rd'\n : 'th';\n return number + output;\n },\n week: {\n dow: 0, // Sunday is the first day of the week.\n doy: 6, // The week that contains Jan 1st is the first week of the year.\n },\n });\n\n return enIn;\n\n})));\n","'use strict';\nif (require('./_descriptors')) {\n var LIBRARY = require('./_library');\n var global = require('./_global');\n var fails = require('./_fails');\n var $export = require('./_export');\n var $typed = require('./_typed');\n var $buffer = require('./_typed-buffer');\n var ctx = require('./_ctx');\n var anInstance = require('./_an-instance');\n var propertyDesc = require('./_property-desc');\n var hide = require('./_hide');\n var redefineAll = require('./_redefine-all');\n var toInteger = require('./_to-integer');\n var toLength = require('./_to-length');\n var toIndex = require('./_to-index');\n var toAbsoluteIndex = require('./_to-absolute-index');\n var toPrimitive = require('./_to-primitive');\n var has = require('./_has');\n var classof = require('./_classof');\n var isObject = require('./_is-object');\n var toObject = require('./_to-object');\n var isArrayIter = require('./_is-array-iter');\n var create = require('./_object-create');\n var getPrototypeOf = require('./_object-gpo');\n var gOPN = require('./_object-gopn').f;\n var getIterFn = require('./core.get-iterator-method');\n var uid = require('./_uid');\n var wks = require('./_wks');\n var createArrayMethod = require('./_array-methods');\n var createArrayIncludes = require('./_array-includes');\n var speciesConstructor = require('./_species-constructor');\n var ArrayIterators = require('./es6.array.iterator');\n var Iterators = require('./_iterators');\n var $iterDetect = require('./_iter-detect');\n var setSpecies = require('./_set-species');\n var arrayFill = require('./_array-fill');\n var arrayCopyWithin = require('./_array-copy-within');\n var $DP = require('./_object-dp');\n var $GOPD = require('./_object-gopd');\n var dP = $DP.f;\n var gOPD = $GOPD.f;\n var RangeError = global.RangeError;\n var TypeError = global.TypeError;\n var Uint8Array = global.Uint8Array;\n var ARRAY_BUFFER = 'ArrayBuffer';\n var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER;\n var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';\n var PROTOTYPE = 'prototype';\n var ArrayProto = Array[PROTOTYPE];\n var $ArrayBuffer = $buffer.ArrayBuffer;\n var $DataView = $buffer.DataView;\n var arrayForEach = createArrayMethod(0);\n var arrayFilter = createArrayMethod(2);\n var arraySome = createArrayMethod(3);\n var arrayEvery = createArrayMethod(4);\n var arrayFind = createArrayMethod(5);\n var arrayFindIndex = createArrayMethod(6);\n var arrayIncludes = createArrayIncludes(true);\n var arrayIndexOf = createArrayIncludes(false);\n var arrayValues = ArrayIterators.values;\n var arrayKeys = ArrayIterators.keys;\n var arrayEntries = ArrayIterators.entries;\n var arrayLastIndexOf = ArrayProto.lastIndexOf;\n var arrayReduce = ArrayProto.reduce;\n var arrayReduceRight = ArrayProto.reduceRight;\n var arrayJoin = ArrayProto.join;\n var arraySort = ArrayProto.sort;\n var arraySlice = ArrayProto.slice;\n var arrayToString = ArrayProto.toString;\n var arrayToLocaleString = ArrayProto.toLocaleString;\n var ITERATOR = wks('iterator');\n var TAG = wks('toStringTag');\n var TYPED_CONSTRUCTOR = uid('typed_constructor');\n var DEF_CONSTRUCTOR = uid('def_constructor');\n var ALL_CONSTRUCTORS = $typed.CONSTR;\n var TYPED_ARRAY = $typed.TYPED;\n var VIEW = $typed.VIEW;\n var WRONG_LENGTH = 'Wrong length!';\n\n var $map = createArrayMethod(1, function (O, length) {\n return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);\n });\n\n var LITTLE_ENDIAN = fails(function () {\n // eslint-disable-next-line no-undef\n return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;\n });\n\n var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () {\n new Uint8Array(1).set({});\n });\n\n var toOffset = function (it, BYTES) {\n var offset = toInteger(it);\n if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!');\n return offset;\n };\n\n var validate = function (it) {\n if (isObject(it) && TYPED_ARRAY in it) return it;\n throw TypeError(it + ' is not a typed array!');\n };\n\n var allocate = function (C, length) {\n if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) {\n throw TypeError('It is not a typed array constructor!');\n } return new C(length);\n };\n\n var speciesFromList = function (O, list) {\n return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);\n };\n\n var fromList = function (C, list) {\n var index = 0;\n var length = list.length;\n var result = allocate(C, length);\n while (length > index) result[index] = list[index++];\n return result;\n };\n\n var addGetter = function (it, key, internal) {\n dP(it, key, { get: function () { return this._d[internal]; } });\n };\n\n var $from = function from(source /* , mapfn, thisArg */) {\n var O = toObject(source);\n var aLen = arguments.length;\n var mapfn = aLen > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iterFn = getIterFn(O);\n var i, length, values, result, step, iterator;\n if (iterFn != undefined && !isArrayIter(iterFn)) {\n for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) {\n values.push(step.value);\n } O = values;\n }\n if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2);\n for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) {\n result[i] = mapping ? mapfn(O[i], i) : O[i];\n }\n return result;\n };\n\n var $of = function of(/* ...items */) {\n var index = 0;\n var length = arguments.length;\n var result = allocate(this, length);\n while (length > index) result[index] = arguments[index++];\n return result;\n };\n\n // iOS Safari 6.x fails here\n var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); });\n\n var $toLocaleString = function toLocaleString() {\n return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);\n };\n\n var proto = {\n copyWithin: function copyWithin(target, start /* , end */) {\n return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);\n },\n every: function every(callbackfn /* , thisArg */) {\n return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n },\n fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars\n return arrayFill.apply(validate(this), arguments);\n },\n filter: function filter(callbackfn /* , thisArg */) {\n return speciesFromList(this, arrayFilter(validate(this), callbackfn,\n arguments.length > 1 ? arguments[1] : undefined));\n },\n find: function find(predicate /* , thisArg */) {\n return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);\n },\n findIndex: function findIndex(predicate /* , thisArg */) {\n return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);\n },\n forEach: function forEach(callbackfn /* , thisArg */) {\n arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n },\n indexOf: function indexOf(searchElement /* , fromIndex */) {\n return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);\n },\n includes: function includes(searchElement /* , fromIndex */) {\n return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);\n },\n join: function join(separator) { // eslint-disable-line no-unused-vars\n return arrayJoin.apply(validate(this), arguments);\n },\n lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars\n return arrayLastIndexOf.apply(validate(this), arguments);\n },\n map: function map(mapfn /* , thisArg */) {\n return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);\n },\n reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars\n return arrayReduce.apply(validate(this), arguments);\n },\n reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars\n return arrayReduceRight.apply(validate(this), arguments);\n },\n reverse: function reverse() {\n var that = this;\n var length = validate(that).length;\n var middle = Math.floor(length / 2);\n var index = 0;\n var value;\n while (index < middle) {\n value = that[index];\n that[index++] = that[--length];\n that[length] = value;\n } return that;\n },\n some: function some(callbackfn /* , thisArg */) {\n return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n },\n sort: function sort(comparefn) {\n return arraySort.call(validate(this), comparefn);\n },\n subarray: function subarray(begin, end) {\n var O = validate(this);\n var length = O.length;\n var $begin = toAbsoluteIndex(begin, length);\n return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(\n O.buffer,\n O.byteOffset + $begin * O.BYTES_PER_ELEMENT,\n toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin)\n );\n }\n };\n\n var $slice = function slice(start, end) {\n return speciesFromList(this, arraySlice.call(validate(this), start, end));\n };\n\n var $set = function set(arrayLike /* , offset */) {\n validate(this);\n var offset = toOffset(arguments[1], 1);\n var length = this.length;\n var src = toObject(arrayLike);\n var len = toLength(src.length);\n var index = 0;\n if (len + offset > length) throw RangeError(WRONG_LENGTH);\n while (index < len) this[offset + index] = src[index++];\n };\n\n var $iterators = {\n entries: function entries() {\n return arrayEntries.call(validate(this));\n },\n keys: function keys() {\n return arrayKeys.call(validate(this));\n },\n values: function values() {\n return arrayValues.call(validate(this));\n }\n };\n\n var isTAIndex = function (target, key) {\n return isObject(target)\n && target[TYPED_ARRAY]\n && typeof key != 'symbol'\n && key in target\n && String(+key) == String(key);\n };\n var $getDesc = function getOwnPropertyDescriptor(target, key) {\n return isTAIndex(target, key = toPrimitive(key, true))\n ? propertyDesc(2, target[key])\n : gOPD(target, key);\n };\n var $setDesc = function defineProperty(target, key, desc) {\n if (isTAIndex(target, key = toPrimitive(key, true))\n && isObject(desc)\n && has(desc, 'value')\n && !has(desc, 'get')\n && !has(desc, 'set')\n // TODO: add validation descriptor w/o calling accessors\n && !desc.configurable\n && (!has(desc, 'writable') || desc.writable)\n && (!has(desc, 'enumerable') || desc.enumerable)\n ) {\n target[key] = desc.value;\n return target;\n } return dP(target, key, desc);\n };\n\n if (!ALL_CONSTRUCTORS) {\n $GOPD.f = $getDesc;\n $DP.f = $setDesc;\n }\n\n $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {\n getOwnPropertyDescriptor: $getDesc,\n defineProperty: $setDesc\n });\n\n if (fails(function () { arrayToString.call({}); })) {\n arrayToString = arrayToLocaleString = function toString() {\n return arrayJoin.call(this);\n };\n }\n\n var $TypedArrayPrototype$ = redefineAll({}, proto);\n redefineAll($TypedArrayPrototype$, $iterators);\n hide($TypedArrayPrototype$, ITERATOR, $iterators.values);\n redefineAll($TypedArrayPrototype$, {\n slice: $slice,\n set: $set,\n constructor: function () { /* noop */ },\n toString: arrayToString,\n toLocaleString: $toLocaleString\n });\n addGetter($TypedArrayPrototype$, 'buffer', 'b');\n addGetter($TypedArrayPrototype$, 'byteOffset', 'o');\n addGetter($TypedArrayPrototype$, 'byteLength', 'l');\n addGetter($TypedArrayPrototype$, 'length', 'e');\n dP($TypedArrayPrototype$, TAG, {\n get: function () { return this[TYPED_ARRAY]; }\n });\n\n // eslint-disable-next-line max-statements\n module.exports = function (KEY, BYTES, wrapper, CLAMPED) {\n CLAMPED = !!CLAMPED;\n var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array';\n var GETTER = 'get' + KEY;\n var SETTER = 'set' + KEY;\n var TypedArray = global[NAME];\n var Base = TypedArray || {};\n var TAC = TypedArray && getPrototypeOf(TypedArray);\n var FORCED = !TypedArray || !$typed.ABV;\n var O = {};\n var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];\n var getter = function (that, index) {\n var data = that._d;\n return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);\n };\n var setter = function (that, index, value) {\n var data = that._d;\n if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;\n data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);\n };\n var addElement = function (that, index) {\n dP(that, index, {\n get: function () {\n return getter(this, index);\n },\n set: function (value) {\n return setter(this, index, value);\n },\n enumerable: true\n });\n };\n if (FORCED) {\n TypedArray = wrapper(function (that, data, $offset, $length) {\n anInstance(that, TypedArray, NAME, '_d');\n var index = 0;\n var offset = 0;\n var buffer, byteLength, length, klass;\n if (!isObject(data)) {\n length = toIndex(data);\n byteLength = length * BYTES;\n buffer = new $ArrayBuffer(byteLength);\n } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {\n buffer = data;\n offset = toOffset($offset, BYTES);\n var $len = data.byteLength;\n if ($length === undefined) {\n if ($len % BYTES) throw RangeError(WRONG_LENGTH);\n byteLength = $len - offset;\n if (byteLength < 0) throw RangeError(WRONG_LENGTH);\n } else {\n byteLength = toLength($length) * BYTES;\n if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH);\n }\n length = byteLength / BYTES;\n } else if (TYPED_ARRAY in data) {\n return fromList(TypedArray, data);\n } else {\n return $from.call(TypedArray, data);\n }\n hide(that, '_d', {\n b: buffer,\n o: offset,\n l: byteLength,\n e: length,\n v: new $DataView(buffer)\n });\n while (index < length) addElement(that, index++);\n });\n TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);\n hide(TypedArrayPrototype, 'constructor', TypedArray);\n } else if (!fails(function () {\n TypedArray(1);\n }) || !fails(function () {\n new TypedArray(-1); // eslint-disable-line no-new\n }) || !$iterDetect(function (iter) {\n new TypedArray(); // eslint-disable-line no-new\n new TypedArray(null); // eslint-disable-line no-new\n new TypedArray(1.5); // eslint-disable-line no-new\n new TypedArray(iter); // eslint-disable-line no-new\n }, true)) {\n TypedArray = wrapper(function (that, data, $offset, $length) {\n anInstance(that, TypedArray, NAME);\n var klass;\n // `ws` module bug, temporarily remove validation length for Uint8Array\n // https://github.com/websockets/ws/pull/645\n if (!isObject(data)) return new Base(toIndex(data));\n if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {\n return $length !== undefined\n ? new Base(data, toOffset($offset, BYTES), $length)\n : $offset !== undefined\n ? new Base(data, toOffset($offset, BYTES))\n : new Base(data);\n }\n if (TYPED_ARRAY in data) return fromList(TypedArray, data);\n return $from.call(TypedArray, data);\n });\n arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) {\n if (!(key in TypedArray)) hide(TypedArray, key, Base[key]);\n });\n TypedArray[PROTOTYPE] = TypedArrayPrototype;\n if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray;\n }\n var $nativeIterator = TypedArrayPrototype[ITERATOR];\n var CORRECT_ITER_NAME = !!$nativeIterator\n && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined);\n var $iterator = $iterators.values;\n hide(TypedArray, TYPED_CONSTRUCTOR, true);\n hide(TypedArrayPrototype, TYPED_ARRAY, NAME);\n hide(TypedArrayPrototype, VIEW, true);\n hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);\n\n if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) {\n dP(TypedArrayPrototype, TAG, {\n get: function () { return NAME; }\n });\n }\n\n O[NAME] = TypedArray;\n\n $export($export.G + $export.W + $export.F * (TypedArray != Base), O);\n\n $export($export.S, NAME, {\n BYTES_PER_ELEMENT: BYTES\n });\n\n $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, {\n from: $from,\n of: $of\n });\n\n if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);\n\n $export($export.P, NAME, proto);\n\n setSpecies(NAME);\n\n $export($export.P + $export.F * FORCED_SET, NAME, { set: $set });\n\n $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);\n\n if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString;\n\n $export($export.P + $export.F * fails(function () {\n new TypedArray(1).slice();\n }), NAME, { slice: $slice });\n\n $export($export.P + $export.F * (fails(function () {\n return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString();\n }) || !fails(function () {\n TypedArrayPrototype.toLocaleString.call([1, 2]);\n })), NAME, { toLocaleString: $toLocaleString });\n\n Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;\n if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator);\n };\n} else module.exports = function () { /* empty */ };\n","var metadata = require('./_metadata');\nvar anObject = require('./_an-object');\nvar ordinaryHasOwnMetadata = metadata.has;\nvar toMetaKey = metadata.key;\n\nmetadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) {\n return ordinaryHasOwnMetadata(metadataKey, anObject(target)\n , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));\n} });\n","'use strict';\nvar global = require('./_global');\nvar DESCRIPTORS = require('./_descriptors');\nvar LIBRARY = require('./_library');\nvar $typed = require('./_typed');\nvar hide = require('./_hide');\nvar redefineAll = require('./_redefine-all');\nvar fails = require('./_fails');\nvar anInstance = require('./_an-instance');\nvar toInteger = require('./_to-integer');\nvar toLength = require('./_to-length');\nvar toIndex = require('./_to-index');\nvar gOPN = require('./_object-gopn').f;\nvar dP = require('./_object-dp').f;\nvar arrayFill = require('./_array-fill');\nvar setToStringTag = require('./_set-to-string-tag');\nvar ARRAY_BUFFER = 'ArrayBuffer';\nvar DATA_VIEW = 'DataView';\nvar PROTOTYPE = 'prototype';\nvar WRONG_LENGTH = 'Wrong length!';\nvar WRONG_INDEX = 'Wrong index!';\nvar $ArrayBuffer = global[ARRAY_BUFFER];\nvar $DataView = global[DATA_VIEW];\nvar Math = global.Math;\nvar RangeError = global.RangeError;\n// eslint-disable-next-line no-shadow-restricted-names\nvar Infinity = global.Infinity;\nvar BaseBuffer = $ArrayBuffer;\nvar abs = Math.abs;\nvar pow = Math.pow;\nvar floor = Math.floor;\nvar log = Math.log;\nvar LN2 = Math.LN2;\nvar BUFFER = 'buffer';\nvar BYTE_LENGTH = 'byteLength';\nvar BYTE_OFFSET = 'byteOffset';\nvar $BUFFER = DESCRIPTORS ? '_b' : BUFFER;\nvar $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH;\nvar $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;\n\n// IEEE754 conversions based on https://github.com/feross/ieee754\nfunction packIEEE754(value, mLen, nBytes) {\n var buffer = new Array(nBytes);\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;\n var i = 0;\n var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\n var e, m, c;\n value = abs(value);\n // eslint-disable-next-line no-self-compare\n if (value != value || value === Infinity) {\n // eslint-disable-next-line no-self-compare\n m = value != value ? 1 : 0;\n e = eMax;\n } else {\n e = floor(log(value) / LN2);\n if (value * (c = pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * pow(2, eBias - 1) * pow(2, mLen);\n e = 0;\n }\n }\n for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);\n e = e << mLen | m;\n eLen += mLen;\n for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);\n buffer[--i] |= s * 128;\n return buffer;\n}\nfunction unpackIEEE754(buffer, mLen, nBytes) {\n var eLen = nBytes * 8 - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = eLen - 7;\n var i = nBytes - 1;\n var s = buffer[i--];\n var e = s & 127;\n var m;\n s >>= 7;\n for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8);\n m = e & (1 << -nBits) - 1;\n e >>= -nBits;\n nBits += mLen;\n for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8);\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : s ? -Infinity : Infinity;\n } else {\n m = m + pow(2, mLen);\n e = e - eBias;\n } return (s ? -1 : 1) * m * pow(2, e - mLen);\n}\n\nfunction unpackI32(bytes) {\n return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];\n}\nfunction packI8(it) {\n return [it & 0xff];\n}\nfunction packI16(it) {\n return [it & 0xff, it >> 8 & 0xff];\n}\nfunction packI32(it) {\n return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];\n}\nfunction packF64(it) {\n return packIEEE754(it, 52, 8);\n}\nfunction packF32(it) {\n return packIEEE754(it, 23, 4);\n}\n\nfunction addGetter(C, key, internal) {\n dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } });\n}\n\nfunction get(view, bytes, index, isLittleEndian) {\n var numIndex = +index;\n var intIndex = toIndex(numIndex);\n if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);\n var store = view[$BUFFER]._b;\n var start = intIndex + view[$OFFSET];\n var pack = store.slice(start, start + bytes);\n return isLittleEndian ? pack : pack.reverse();\n}\nfunction set(view, bytes, index, conversion, value, isLittleEndian) {\n var numIndex = +index;\n var intIndex = toIndex(numIndex);\n if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);\n var store = view[$BUFFER]._b;\n var start = intIndex + view[$OFFSET];\n var pack = conversion(+value);\n for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];\n}\n\nif (!$typed.ABV) {\n $ArrayBuffer = function ArrayBuffer(length) {\n anInstance(this, $ArrayBuffer, ARRAY_BUFFER);\n var byteLength = toIndex(length);\n this._b = arrayFill.call(new Array(byteLength), 0);\n this[$LENGTH] = byteLength;\n };\n\n $DataView = function DataView(buffer, byteOffset, byteLength) {\n anInstance(this, $DataView, DATA_VIEW);\n anInstance(buffer, $ArrayBuffer, DATA_VIEW);\n var bufferLength = buffer[$LENGTH];\n var offset = toInteger(byteOffset);\n if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!');\n byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);\n if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);\n this[$BUFFER] = buffer;\n this[$OFFSET] = offset;\n this[$LENGTH] = byteLength;\n };\n\n if (DESCRIPTORS) {\n addGetter($ArrayBuffer, BYTE_LENGTH, '_l');\n addGetter($DataView, BUFFER, '_b');\n addGetter($DataView, BYTE_LENGTH, '_l');\n addGetter($DataView, BYTE_OFFSET, '_o');\n }\n\n redefineAll($DataView[PROTOTYPE], {\n getInt8: function getInt8(byteOffset) {\n return get(this, 1, byteOffset)[0] << 24 >> 24;\n },\n getUint8: function getUint8(byteOffset) {\n return get(this, 1, byteOffset)[0];\n },\n getInt16: function getInt16(byteOffset /* , littleEndian */) {\n var bytes = get(this, 2, byteOffset, arguments[1]);\n return (bytes[1] << 8 | bytes[0]) << 16 >> 16;\n },\n getUint16: function getUint16(byteOffset /* , littleEndian */) {\n var bytes = get(this, 2, byteOffset, arguments[1]);\n return bytes[1] << 8 | bytes[0];\n },\n getInt32: function getInt32(byteOffset /* , littleEndian */) {\n return unpackI32(get(this, 4, byteOffset, arguments[1]));\n },\n getUint32: function getUint32(byteOffset /* , littleEndian */) {\n return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;\n },\n getFloat32: function getFloat32(byteOffset /* , littleEndian */) {\n return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);\n },\n getFloat64: function getFloat64(byteOffset /* , littleEndian */) {\n return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);\n },\n setInt8: function setInt8(byteOffset, value) {\n set(this, 1, byteOffset, packI8, value);\n },\n setUint8: function setUint8(byteOffset, value) {\n set(this, 1, byteOffset, packI8, value);\n },\n setInt16: function setInt16(byteOffset, value /* , littleEndian */) {\n set(this, 2, byteOffset, packI16, value, arguments[2]);\n },\n setUint16: function setUint16(byteOffset, value /* , littleEndian */) {\n set(this, 2, byteOffset, packI16, value, arguments[2]);\n },\n setInt32: function setInt32(byteOffset, value /* , littleEndian */) {\n set(this, 4, byteOffset, packI32, value, arguments[2]);\n },\n setUint32: function setUint32(byteOffset, value /* , littleEndian */) {\n set(this, 4, byteOffset, packI32, value, arguments[2]);\n },\n setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {\n set(this, 4, byteOffset, packF32, value, arguments[2]);\n },\n setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {\n set(this, 8, byteOffset, packF64, value, arguments[2]);\n }\n });\n} else {\n if (!fails(function () {\n $ArrayBuffer(1);\n }) || !fails(function () {\n new $ArrayBuffer(-1); // eslint-disable-line no-new\n }) || fails(function () {\n new $ArrayBuffer(); // eslint-disable-line no-new\n new $ArrayBuffer(1.5); // eslint-disable-line no-new\n new $ArrayBuffer(NaN); // eslint-disable-line no-new\n return $ArrayBuffer.name != ARRAY_BUFFER;\n })) {\n $ArrayBuffer = function ArrayBuffer(length) {\n anInstance(this, $ArrayBuffer);\n return new BaseBuffer(toIndex(length));\n };\n var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];\n for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) {\n if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]);\n }\n if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer;\n }\n // iOS Safari 7.x bug\n var view = new $DataView(new $ArrayBuffer(2));\n var $setInt8 = $DataView[PROTOTYPE].setInt8;\n view.setInt8(0, 2147483648);\n view.setInt8(1, 2147483649);\n if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], {\n setInt8: function setInt8(byteOffset, value) {\n $setInt8.call(this, byteOffset, value << 24 >> 24);\n },\n setUint8: function setUint8(byteOffset, value) {\n $setInt8.call(this, byteOffset, value << 24 >> 24);\n }\n }, true);\n}\nsetToStringTag($ArrayBuffer, ARRAY_BUFFER);\nsetToStringTag($DataView, DATA_VIEW);\nhide($DataView[PROTOTYPE], $typed.VIEW, true);\nexports[ARRAY_BUFFER] = $ArrayBuffer;\nexports[DATA_VIEW] = $DataView;\n","'use strict';\n// https://github.com/tc39/proposal-string-pad-start-end\nvar $export = require('./_export');\nvar $pad = require('./_string-pad');\nvar userAgent = require('./_user-agent');\n\n// https://github.com/zloirock/core-js/issues/280\nvar WEBKIT_BUG = /Version\\/10\\.\\d+(\\.\\d+)?( Mobile\\/\\w+)? Safari\\//.test(userAgent);\n\n$export($export.P + $export.F * WEBKIT_BUG, 'String', {\n padEnd: function padEnd(maxLength /* , fillString = ' ' */) {\n return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);\n }\n});\n","// http://jfbastien.github.io/papers/Math.signbit.html\nvar $export = require('./_export');\n\n$export($export.S, 'Math', { signbit: function signbit(x) {\n // eslint-disable-next-line no-self-compare\n return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0;\n} });\n","//! moment.js locale configuration\n//! locale : Sinhalese [si]\n//! author : Sampath Sitinamaluwa : https://github.com/sampathsris\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n /*jshint -W100*/\n var si = moment.defineLocale('si', {\n months: 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split(\n '_'\n ),\n monthsShort: 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split(\n '_'\n ),\n weekdays:\n 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split(\n '_'\n ),\n weekdaysShort: 'ඉරි_සඳු_අඟ_බදා_බ්රහ_සිකු_සෙන'.split('_'),\n weekdaysMin: 'ඉ_ස_අ_බ_බ්ර_සි_සෙ'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'a h:mm',\n LTS: 'a h:mm:ss',\n L: 'YYYY/MM/DD',\n LL: 'YYYY MMMM D',\n LLL: 'YYYY MMMM D, a h:mm',\n LLLL: 'YYYY MMMM D [වැනි] dddd, a h:mm:ss',\n },\n calendar: {\n sameDay: '[අද] LT[ට]',\n nextDay: '[හෙට] LT[ට]',\n nextWeek: 'dddd LT[ට]',\n lastDay: '[ඊයේ] LT[ට]',\n lastWeek: '[පසුගිය] dddd LT[ට]',\n sameElse: 'L',\n },\n relativeTime: {\n future: '%sකින්',\n past: '%sකට පෙර',\n s: 'තත්පර කිහිපය',\n ss: 'තත්පර %d',\n m: 'මිනිත්තුව',\n mm: 'මිනිත්තු %d',\n h: 'පැය',\n hh: 'පැය %d',\n d: 'දිනය',\n dd: 'දින %d',\n M: 'මාසය',\n MM: 'මාස %d',\n y: 'වසර',\n yy: 'වසර %d',\n },\n dayOfMonthOrdinalParse: /\\d{1,2} වැනි/,\n ordinal: function (number) {\n return number + ' වැනි';\n },\n meridiemParse: /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,\n isPM: function (input) {\n return input === 'ප.ව.' || input === 'පස් වරු';\n },\n meridiem: function (hours, minutes, isLower) {\n if (hours > 11) {\n return isLower ? 'ප.ව.' : 'පස් වරු';\n } else {\n return isLower ? 'පෙ.ව.' : 'පෙර වරු';\n }\n },\n });\n\n return si;\n\n})));\n","// 20.1.2.4 Number.isNaN(number)\nvar $export = require('./_export');\n\n$export($export.S, 'Number', {\n isNaN: function isNaN(number) {\n // eslint-disable-next-line no-self-compare\n return number != number;\n }\n});\n","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"vue\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"vue\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"vue-notification\"] = factory(require(\"vue\"));\n\telse\n\t\troot[\"vue-notification\"] = factory(root[\"vue\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_20__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 2);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\n// this module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle\n\nmodule.exports = function normalizeComponent (\n rawScriptExports,\n compiledTemplate,\n scopeId,\n cssModules\n) {\n var esModule\n var scriptExports = rawScriptExports = rawScriptExports || {}\n\n // ES6 modules interop\n var type = typeof rawScriptExports.default\n if (type === 'object' || type === 'function') {\n esModule = rawScriptExports\n scriptExports = rawScriptExports.default\n }\n\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (compiledTemplate) {\n options.render = compiledTemplate.render\n options.staticRenderFns = compiledTemplate.staticRenderFns\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = scopeId\n }\n\n // inject cssModules\n if (cssModules) {\n var computed = Object.create(options.computed || null)\n Object.keys(cssModules).forEach(function (key) {\n var module = cssModules[key]\n computed[key] = function () { return module }\n })\n options.computed = computed\n }\n\n return {\n esModule: esModule,\n exports: scriptExports,\n options: options\n }\n}\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return events; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(20);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);\n\n\nvar events = new __WEBPACK_IMPORTED_MODULE_0_vue___default.a({ name: 'vue-notification' });\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Notifications_vue__ = __webpack_require__(3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Notifications_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__Notifications_vue__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__events__ = __webpack_require__(1);\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n\n\n\nvar Notify = {\n install: function install(Vue) {\n var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (this.installed) {\n return;\n }\n\n this.installed = true;\n this.params = args;\n\n Vue.component(args.componentName || 'notifications', __WEBPACK_IMPORTED_MODULE_0__Notifications_vue___default.a);\n\n var notify = function notify(params) {\n if (typeof params === 'string') {\n params = { title: '', text: params };\n }\n\n if ((typeof params === 'undefined' ? 'undefined' : _typeof(params)) === 'object') {\n __WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* events */].$emit('add', params);\n }\n };\n\n notify.close = function (id) {\n __WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* events */].$emit('close', id);\n };\n\n var name = args.name || 'notify';\n\n Vue.prototype['$' + name] = notify;\n Vue[name] = notify;\n }\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Notify);\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\n/* styles */\n__webpack_require__(17)\n\nvar Component = __webpack_require__(0)(\n /* script */\n __webpack_require__(5),\n /* template */\n __webpack_require__(15),\n /* scopeId */\n null,\n /* cssModules */\n null\n)\n\nmodule.exports = Component.exports\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'CssGroup',\n props: ['name']\n});\n\n/***/ }),\n/* 5 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__events__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util__ = __webpack_require__(9);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__defaults__ = __webpack_require__(7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__VelocityGroup_vue__ = __webpack_require__(13);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__VelocityGroup_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__VelocityGroup_vue__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CssGroup_vue__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CssGroup_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__CssGroup_vue__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__parser__ = __webpack_require__(8);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n\n\n\nvar STATE = {\n IDLE: 0,\n DESTROYED: 2\n};\n\nvar Component = {\n name: 'Notifications',\n components: {\n VelocityGroup: __WEBPACK_IMPORTED_MODULE_4__VelocityGroup_vue___default.a,\n CssGroup: __WEBPACK_IMPORTED_MODULE_5__CssGroup_vue___default.a\n },\n props: {\n group: {\n type: String,\n default: ''\n },\n\n width: {\n type: [Number, String],\n default: 300\n },\n\n reverse: {\n type: Boolean,\n default: false\n },\n\n position: {\n type: [String, Array],\n default: function _default() {\n return __WEBPACK_IMPORTED_MODULE_3__defaults__[\"a\" /* default */].position;\n }\n },\n\n classes: {\n type: String,\n default: 'vue-notification'\n },\n\n animationType: {\n type: String,\n default: 'css',\n validator: function validator(value) {\n return value === 'css' || value === 'velocity';\n }\n },\n\n animation: {\n type: Object,\n default: function _default() {\n return __WEBPACK_IMPORTED_MODULE_3__defaults__[\"a\" /* default */].velocityAnimation;\n }\n },\n\n animationName: {\n type: String,\n default: __WEBPACK_IMPORTED_MODULE_3__defaults__[\"a\" /* default */].cssAnimation\n },\n\n speed: {\n type: Number,\n default: 300\n },\n\n cooldown: {\n type: Number,\n default: 0\n },\n\n duration: {\n type: Number,\n default: 3000\n },\n\n delay: {\n type: Number,\n default: 0\n },\n\n max: {\n type: Number,\n default: Infinity\n },\n\n ignoreDuplicates: {\n type: Boolean,\n default: false\n },\n\n closeOnClick: {\n type: Boolean,\n default: true\n }\n },\n data: function data() {\n return {\n list: [],\n velocity: __WEBPACK_IMPORTED_MODULE_0__index__[\"default\"].params.velocity\n };\n },\n mounted: function mounted() {\n __WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* events */].$on('add', this.addItem);\n __WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* events */].$on('close', this.closeItem);\n },\n\n computed: {\n actualWidth: function actualWidth() {\n return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__parser__[\"a\" /* default */])(this.width);\n },\n isVA: function isVA() {\n return this.animationType === 'velocity';\n },\n componentName: function componentName() {\n return this.isVA ? 'VelocityGroup' : 'CssGroup';\n },\n styles: function styles() {\n var _listToDirection = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__util__[\"a\" /* listToDirection */])(this.position),\n x = _listToDirection.x,\n y = _listToDirection.y;\n\n var width = this.actualWidth.value;\n var suffix = this.actualWidth.type;\n\n var styles = _defineProperty({\n width: width + suffix\n }, y, '0px');\n\n if (x === 'center') {\n styles['left'] = 'calc(50% - ' + width / 2 + suffix + ')';\n } else {\n styles[x] = '0px';\n }\n\n return styles;\n },\n active: function active() {\n return this.list.filter(function (v) {\n return v.state !== STATE.DESTROYED;\n });\n },\n botToTop: function botToTop() {\n return this.styles.hasOwnProperty('bottom');\n }\n },\n methods: {\n destroyIfNecessary: function destroyIfNecessary(item) {\n if (this.closeOnClick) {\n this.destroy(item);\n }\n },\n addItem: function addItem(event) {\n var _this = this;\n\n event.group = event.group || '';\n\n if (this.group !== event.group) {\n return;\n }\n\n if (event.clean || event.clear) {\n this.destroyAll();\n return;\n }\n\n var duration = typeof event.duration === 'number' ? event.duration : this.duration;\n\n var speed = typeof event.speed === 'number' ? event.speed : this.speed;\n\n var ignoreDuplicates = typeof event.ignoreDuplicates === 'boolean' ? event.ignoreDuplicates : this.ignoreDuplicates;\n\n var title = event.title,\n text = event.text,\n type = event.type,\n data = event.data,\n id = event.id;\n\n\n var item = {\n id: id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__util__[\"b\" /* Id */])(),\n title: title,\n text: text,\n type: type,\n state: STATE.IDLE,\n speed: speed,\n length: duration + 2 * speed,\n data: data\n };\n\n if (duration >= 0) {\n item.timer = setTimeout(function () {\n _this.destroy(item);\n }, item.length);\n }\n\n var direction = this.reverse ? !this.botToTop : this.botToTop;\n\n var indexToDestroy = -1;\n\n var isDuplicate = this.active.some(function (item) {\n return item.title === event.title && item.text === event.text;\n });\n\n var canAdd = ignoreDuplicates ? !isDuplicate : true;\n\n if (!canAdd) return;\n\n if (direction) {\n this.list.push(item);\n\n if (this.active.length > this.max) {\n indexToDestroy = 0;\n }\n } else {\n this.list.unshift(item);\n\n if (this.active.length > this.max) {\n indexToDestroy = this.active.length - 1;\n }\n }\n\n if (indexToDestroy !== -1) {\n this.destroy(this.active[indexToDestroy]);\n }\n },\n closeItem: function closeItem(id) {\n this.destroyById(id);\n },\n notifyClass: function notifyClass(item) {\n return ['vue-notification-template', this.classes, item.type];\n },\n notifyWrapperStyle: function notifyWrapperStyle(item) {\n return this.isVA ? null : { transition: 'all ' + item.speed + 'ms' };\n },\n destroy: function destroy(item) {\n clearTimeout(item.timer);\n item.state = STATE.DESTROYED;\n\n if (!this.isVA) {\n this.clean();\n }\n },\n destroyById: function destroyById(id) {\n var item = this.list.find(function (v) {\n return v.id === id;\n });\n\n if (item) {\n this.destroy(item);\n }\n },\n destroyAll: function destroyAll() {\n this.active.forEach(this.destroy);\n },\n getAnimation: function getAnimation(index, el) {\n var animation = this.animation[index];\n\n return typeof animation === 'function' ? animation.call(this, el) : animation;\n },\n enter: function enter(_ref) {\n var el = _ref.el,\n complete = _ref.complete;\n\n var animation = this.getAnimation('enter', el);\n\n this.velocity(el, animation, {\n duration: this.speed,\n complete: complete\n });\n },\n leave: function leave(_ref2) {\n var el = _ref2.el,\n complete = _ref2.complete;\n\n var animation = this.getAnimation('leave', el);\n\n this.velocity(el, animation, {\n duration: this.speed,\n complete: complete\n });\n },\n clean: function clean() {\n this.list = this.list.filter(function (v) {\n return v.state !== STATE.DESTROYED;\n });\n }\n }\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Component);\n\n/***/ }),\n/* 6 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'VelocityGroup',\n methods: {\n enter: function enter(el, complete) {\n this.$emit('enter', { el: el, complete: complete });\n },\n leave: function leave(el, complete) {\n this.$emit('leave', { el: el, complete: complete });\n },\n afterLeave: function afterLeave() {\n this.$emit('afterLeave');\n }\n }\n});\n\n/***/ }),\n/* 7 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony default export */ __webpack_exports__[\"a\"] = ({\n position: ['top', 'right'],\n cssAnimation: 'vn-fade',\n velocityAnimation: {\n enter: function enter(el) {\n var height = el.clientHeight;\n\n return {\n height: [height, 0],\n opacity: [1, 0]\n };\n },\n leave: {\n height: 0,\n opacity: [0, 1]\n }\n }\n});\n\n/***/ }),\n/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* unused harmony export parse */\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar floatRegexp = '[-+]?[0-9]*.?[0-9]+';\n\nvar types = [{\n name: 'px',\n regexp: new RegExp('^' + floatRegexp + 'px$')\n}, {\n name: '%',\n regexp: new RegExp('^' + floatRegexp + '%$')\n}, {\n name: 'px',\n regexp: new RegExp('^' + floatRegexp + '$')\n}];\n\nvar getType = function getType(value) {\n if (value === 'auto') {\n return {\n type: value,\n value: 0\n };\n }\n\n for (var i = 0; i < types.length; i++) {\n var type = types[i];\n if (type.regexp.test(value)) {\n return {\n type: type.name,\n value: parseFloat(value)\n };\n }\n }\n\n return {\n type: '',\n value: value\n };\n};\n\nvar parse = function parse(value) {\n switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) {\n case 'number':\n return { type: 'px', value: value };\n case 'string':\n return getType(value);\n default:\n return { type: '', value: value };\n }\n};\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (parse);\n\n/***/ }),\n/* 9 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return Id; });\n/* unused harmony export split */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return listToDirection; });\nvar directions = {\n x: ['left', 'center', 'right'],\n y: ['top', 'bottom']\n};\n\nvar Id = function (i) {\n return function () {\n return i++;\n };\n}(0);\n\nvar split = function split(value) {\n if (typeof value !== 'string') {\n return [];\n }\n\n return value.split(/\\s+/gi).filter(function (v) {\n return v;\n });\n};\n\nvar listToDirection = function listToDirection(value) {\n if (typeof value === 'string') {\n value = split(value);\n }\n\n var x = null;\n var y = null;\n\n value.forEach(function (v) {\n if (directions.y.indexOf(v) !== -1) {\n y = v;\n }\n if (directions.x.indexOf(v) !== -1) {\n x = v;\n }\n });\n\n return { x: x, y: y };\n};\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(11)();\n// imports\n\n\n// module\nexports.push([module.i, \".vue-notification-group{display:block;position:fixed;z-index:5000}.vue-notification-wrapper{display:block;overflow:hidden;width:100%;margin:0;padding:0}.notification-title{font-weight:600}.vue-notification-template{background:#fff}.vue-notification,.vue-notification-template{display:block;box-sizing:border-box;text-align:left}.vue-notification{font-size:12px;padding:10px;margin:0 5px 5px;color:#fff;background:#44a4fc;border-left:5px solid #187fe7}.vue-notification.warn{background:#ffb648;border-left-color:#f48a06}.vue-notification.error{background:#e54d42;border-left-color:#b82e24}.vue-notification.success{background:#68cd86;border-left-color:#42a85f}.vn-fade-enter-active,.vn-fade-leave-active,.vn-fade-move{transition:all .5s}.vn-fade-enter,.vn-fade-leave-to{opacity:0}\", \"\"]);\n\n// exports\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports) {\n\n/*\r\n\tMIT License http://www.opensource.org/licenses/mit-license.php\r\n\tAuthor Tobias Koppers @sokra\r\n*/\r\n// css base code, injected by the css-loader\r\nmodule.exports = function() {\r\n\tvar list = [];\r\n\r\n\t// return the list of modules as css string\r\n\tlist.toString = function toString() {\r\n\t\tvar result = [];\r\n\t\tfor(var i = 0; i < this.length; i++) {\r\n\t\t\tvar item = this[i];\r\n\t\t\tif(item[2]) {\r\n\t\t\t\tresult.push(\"@media \" + item[2] + \"{\" + item[1] + \"}\");\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(item[1]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result.join(\"\");\r\n\t};\r\n\r\n\t// import a list of modules into the list\r\n\tlist.i = function(modules, mediaQuery) {\r\n\t\tif(typeof modules === \"string\")\r\n\t\t\tmodules = [[null, modules, \"\"]];\r\n\t\tvar alreadyImportedModules = {};\r\n\t\tfor(var i = 0; i < this.length; i++) {\r\n\t\t\tvar id = this[i][0];\r\n\t\t\tif(typeof id === \"number\")\r\n\t\t\t\talreadyImportedModules[id] = true;\r\n\t\t}\r\n\t\tfor(i = 0; i < modules.length; i++) {\r\n\t\t\tvar item = modules[i];\r\n\t\t\t// skip already imported module\r\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\r\n\t\t\t// when a module is imported multiple times with different media queries.\r\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\r\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\r\n\t\t\t\tif(mediaQuery && !item[2]) {\r\n\t\t\t\t\titem[2] = mediaQuery;\r\n\t\t\t\t} else if(mediaQuery) {\r\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\r\n\t\t\t\t}\r\n\t\t\t\tlist.push(item);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\treturn list;\r\n};\r\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar Component = __webpack_require__(0)(\n /* script */\n __webpack_require__(4),\n /* template */\n __webpack_require__(16),\n /* scopeId */\n null,\n /* cssModules */\n null\n)\n\nmodule.exports = Component.exports\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar Component = __webpack_require__(0)(\n /* script */\n __webpack_require__(6),\n /* template */\n __webpack_require__(14),\n /* scopeId */\n null,\n /* cssModules */\n null\n)\n\nmodule.exports = Component.exports\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports) {\n\nmodule.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;\n return _c('transition-group', {\n attrs: {\n \"css\": false\n },\n on: {\n \"enter\": _vm.enter,\n \"leave\": _vm.leave,\n \"after-leave\": _vm.afterLeave\n }\n }, [_vm._t(\"default\")], 2)\n},staticRenderFns: []}\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports) {\n\nmodule.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;\n return _c('div', {\n staticClass: \"vue-notification-group\",\n style: (_vm.styles)\n }, [_c(_vm.componentName, {\n tag: \"component\",\n attrs: {\n \"name\": _vm.animationName\n },\n on: {\n \"enter\": _vm.enter,\n \"leave\": _vm.leave,\n \"after-leave\": _vm.clean\n }\n }, _vm._l((_vm.active), function(item) {\n return _c('div', {\n key: item.id,\n staticClass: \"vue-notification-wrapper\",\n style: (_vm.notifyWrapperStyle(item)),\n attrs: {\n \"data-id\": item.id\n }\n }, [_vm._t(\"body\", [_c('div', {\n class: _vm.notifyClass(item),\n on: {\n \"click\": function($event) {\n return _vm.destroyIfNecessary(item)\n }\n }\n }, [(item.title) ? _c('div', {\n staticClass: \"notification-title\",\n domProps: {\n \"innerHTML\": _vm._s(item.title)\n }\n }) : _vm._e(), _vm._v(\" \"), _c('div', {\n staticClass: \"notification-content\",\n domProps: {\n \"innerHTML\": _vm._s(item.text)\n }\n })])], {\n \"item\": item,\n \"close\": function () { return _vm.destroy(item); }\n })], 2)\n }), 0)], 1)\n},staticRenderFns: []}\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports) {\n\nmodule.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;\n return _c('transition-group', {\n attrs: {\n \"name\": _vm.name\n }\n }, [_vm._t(\"default\")], 2)\n},staticRenderFns: []}\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// style-loader: Adds some css to the DOM by adding a