From 187459e21f8d7417ba09afff451df54a85e23041 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 21:05:34 +0000 Subject: [PATCH] 15.4.2 --- CHANGELOG.md | 5 ++++- dist/cjs/plugins/test-utils/config.js | 13 ------------- dist/cjs/plugins/test-utils/config.js.map | 2 +- dist/cjs/plugins/utils/utils-rxdb-version.js | 2 +- dist/cjs/plugins/utils/utils-rxdb-version.js.map | 2 +- dist/esm/plugins/test-utils/config.js | 10 ---------- dist/esm/plugins/test-utils/config.js.map | 2 +- dist/esm/plugins/utils/utils-rxdb-version.js | 2 +- dist/esm/plugins/utils/utils-rxdb-version.js.map | 2 +- dist/types/plugins/storage-denokv/index.d.ts | 2 +- .../plugins/storage-dexie/rx-storage-dexie.d.ts | 2 +- .../plugins/storage-lokijs/rx-storage-lokijs.d.ts | 2 +- .../plugins/storage-mongodb/rx-storage-mongodb.d.ts | 2 +- .../plugins/storage-remote/rx-storage-remote.d.ts | 2 +- dist/types/plugins/test-utils/config.d.ts | 1 - dist/types/plugins/utils/utils-rxdb-version.d.ts | 2 +- dist/types/rx-database.d.ts | 2 +- docs/404.html | 4 ++-- docs/adapters.html | 4 ++-- docs/alternatives.html | 4 ++-- docs/articles/angular-database.html | 4 ++-- docs/articles/browser-database.html | 4 ++-- docs/articles/browser-storage.html | 4 ++-- docs/articles/data-base.html | 4 ++-- docs/articles/embedded-database.html | 4 ++-- docs/articles/flutter-database.html | 4 ++-- docs/articles/frontend-database.html | 4 ++-- docs/articles/in-memory-nosql-database.html | 4 ++-- docs/articles/ionic-database.html | 4 ++-- docs/articles/json-database.html | 4 ++-- docs/articles/localstorage.html | 4 ++-- docs/articles/mobile-database.html | 4 ++-- docs/articles/progressive-web-app-database.html | 4 ++-- docs/articles/react-database.html | 4 ++-- docs/articles/realtime-database.html | 4 ++-- .../{0e268d20.a51dda1a.js => 0e268d20.e23b606a.js} | 2 +- .../{1df93b7f.5d342824.js => 1df93b7f.937c5c7c.js} | 2 +- docs/assets/js/25a43fd4.8118b3fa.js | 1 - docs/assets/js/25a43fd4.9c1c20df.js | 1 + docs/assets/js/6187b59a.20f1333d.js | 1 - docs/assets/js/6187b59a.4ca02723.js | 1 + .../js/{6560.071ab844.js => 6560.7fe8753b.js} | 2 +- docs/assets/js/aa14e6b1.fbc151ec.js | 1 + docs/assets/js/aa14e6b1.fda346b3.js | 1 - .../js/{main.b9c9341f.js => main.b2130183.js} | 4 ++-- ....js.LICENSE.txt => main.b2130183.js.LICENSE.txt} | 0 ...me~main.cfee3674.js => runtime~main.170c9526.js} | 2 +- docs/backup.html | 4 ++-- docs/capacitor-database.html | 4 ++-- docs/chat/index.html | 4 ++-- docs/cleanup.html | 4 ++-- docs/code/index.html | 4 ++-- docs/contribution.html | 4 ++-- docs/crdt.html | 4 ++-- docs/data-migration/index.html | 4 ++-- docs/dev-mode.html | 4 ++-- docs/downsides-of-offline-first.html | 4 ++-- docs/electron-database.html | 4 ++-- docs/electron.html | 4 ++-- docs/encryption.html | 4 ++-- docs/index.html | 4 ++-- docs/install.html | 4 ++-- docs/key-compression.html | 4 ++-- docs/leader-election.html | 4 ++-- docs/legal-notice/index.html | 4 ++-- docs/logger.html | 4 ++-- docs/lunr-index-1706097670718.json | 1 - docs/lunr-index-1706130296364.json | 1 + docs/lunr-index.json | 2 +- docs/markdown-page/index.html | 4 ++-- docs/middleware.html | 4 ++-- docs/migration-schema.html | 4 ++-- docs/migration-storage.html | 4 ++-- docs/newsletter/index.html | 4 ++-- docs/nodejs-database.html | 4 ++-- docs/nosql-performance-tips.html | 4 ++-- docs/offline-first.html | 4 ++-- docs/orm.html | 4 ++-- docs/plugins.html | 4 ++-- docs/population.html | 4 ++-- docs/premium/index.html | 4 ++-- docs/query-cache.html | 4 ++-- docs/query-optimizer.html | 4 ++-- docs/questions-answers.html | 4 ++-- docs/quickstart.html | 4 ++-- docs/react-native-database.html | 4 ++-- docs/releases/10.0.0.html | 4 ++-- docs/releases/11.0.0.html | 4 ++-- docs/releases/12.0.0.html | 4 ++-- docs/releases/13.0.0.html | 4 ++-- docs/releases/14.0.0.html | 4 ++-- docs/releases/15.0.0.html | 4 ++-- docs/releases/8.0.0.html | 4 ++-- docs/releases/9.0.0.html | 4 ++-- docs/replication-couchdb.html | 4 ++-- docs/replication-firestore.html | 4 ++-- docs/replication-graphql.html | 5 +++-- docs/replication-http.html | 4 ++-- docs/replication-nats.html | 4 ++-- docs/replication-p2p.html | 4 ++-- docs/replication-server/index.html | 4 ++-- docs/replication-webrtc.html | 4 ++-- docs/replication-websocket.html | 4 ++-- docs/replication.html | 4 ++-- docs/rx-attachment.html | 4 ++-- docs/rx-collection.html | 4 ++-- docs/rx-database.html | 4 ++-- docs/rx-document.html | 4 ++-- docs/rx-local-document.html | 4 ++-- docs/rx-query.html | 4 ++-- docs/rx-schema.html | 4 ++-- docs/rx-storage-denokv.html | 4 ++-- docs/rx-storage-dexie.html | 4 ++-- docs/rx-storage-filesystem-node.html | 4 ++-- docs/rx-storage-foundationdb.html | 4 ++-- docs/rx-storage-indexeddb.html | 4 ++-- docs/rx-storage-localstorage-meta-optimizer.html | 4 ++-- docs/rx-storage-lokijs.html | 4 ++-- docs/rx-storage-memory-synced.html | 4 ++-- docs/rx-storage-memory.html | 4 ++-- docs/rx-storage-mongodb.html | 4 ++-- docs/rx-storage-opfs.html | 4 ++-- docs/rx-storage-performance.html | 4 ++-- docs/rx-storage-pouchdb.html | 4 ++-- docs/rx-storage-remote.html | 4 ++-- docs/rx-storage-sharding.html | 4 ++-- docs/rx-storage-shared-worker.html | 9 ++++++--- docs/rx-storage-sqlite.html | 4 ++-- docs/rx-storage-worker.html | 12 +++++++++--- docs/rx-storage.html | 4 ++-- docs/rxdb-tradeoffs.html | 4 ++-- docs/schema-validation.html | 4 ++-- docs/search-doc-1706097670718.json | 1 - docs/search-doc-1706130296364.json | 1 + docs/search-doc.json | 2 +- docs/server/index.html | 4 ++-- docs/slow-indexeddb.html | 4 ++-- docs/survey/index.html | 4 ++-- docs/third-party-plugins.html | 4 ++-- docs/transactions-conflicts-revisions.html | 4 ++-- docs/tutorials/typescript.html | 4 ++-- docs/why-nosql.html | 4 ++-- package.json | 2 +- src/plugins/utils/utils-rxdb-version.ts | 2 +- 144 files changed, 258 insertions(+), 269 deletions(-) rename docs/assets/js/{0e268d20.a51dda1a.js => 0e268d20.e23b606a.js} (99%) rename docs/assets/js/{1df93b7f.5d342824.js => 1df93b7f.937c5c7c.js} (99%) delete mode 100644 docs/assets/js/25a43fd4.8118b3fa.js create mode 100644 docs/assets/js/25a43fd4.9c1c20df.js delete mode 100644 docs/assets/js/6187b59a.20f1333d.js create mode 100644 docs/assets/js/6187b59a.4ca02723.js rename docs/assets/js/{6560.071ab844.js => 6560.7fe8753b.js} (62%) create mode 100644 docs/assets/js/aa14e6b1.fbc151ec.js delete mode 100644 docs/assets/js/aa14e6b1.fda346b3.js rename docs/assets/js/{main.b9c9341f.js => main.b2130183.js} (99%) rename docs/assets/js/{main.b9c9341f.js.LICENSE.txt => main.b2130183.js.LICENSE.txt} (100%) rename docs/assets/js/{runtime~main.cfee3674.js => runtime~main.170c9526.js} (95%) delete mode 100644 docs/lunr-index-1706097670718.json create mode 100644 docs/lunr-index-1706130296364.json delete mode 100644 docs/search-doc-1706097670718.json create mode 100644 docs/search-doc-1706130296364.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 6838b024ff2..091931a5416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ # RxDB Changelog -- ADD(worker storage) support for directly imported `Worker` and `SharedWorker` functions as `workerInput`. @@ -10,6 +9,10 @@ +### 15.4.2 (24 January 2024) + +- ADD(worker storage) support for directly imported `Worker` and `SharedWorker` functions as `workerInput`. + ### 15.4.1 (24 January 2024) - ADD export test utilities so other projects can use them diff --git a/dist/cjs/plugins/test-utils/config.js b/dist/cjs/plugins/test-utils/config.js index ab77f4d2619..9ff71b6f3a2 100644 --- a/dist/cjs/plugins/test-utils/config.js +++ b/dist/cjs/plugins/test-utils/config.js @@ -8,7 +8,6 @@ exports.ENV_VARIABLES = exports.DEFAULT_STORAGE = void 0; exports.getConfig = getConfig; exports.getEncryptedStorage = getEncryptedStorage; exports.getPassword = getPassword; -exports.getRootPath = getRootPath; exports.initTestEnvironment = initTestEnvironment; exports.isDeno = exports.isBun = void 0; exports.isFastMode = isFastMode; @@ -18,11 +17,7 @@ exports.setConfig = setConfig; var _index = require("../utils/index.js"); var _broadcastChannel = require("broadcast-channel"); var _nodeEvents = _interopRequireDefault(require("node:events")); -var path = _interopRequireWildcard(require("node:path")); -var _nodeUrl = _interopRequireDefault(require("node:url")); var _index2 = require("../encryption-crypto-js/index.js"); -function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } -function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } /// var isDeno = exports.isDeno = typeof window !== 'undefined' && 'Deno' in window; @@ -59,10 +54,6 @@ function isFastMode() { return false; } } -var rootPath = ''; -function getRootPath() { - return rootPath; -} function initTestEnvironment() { if (ENV_VARIABLES.NODE_ENV === 'fast') { (0, _broadcastChannel.enforceOptions)({ @@ -97,10 +88,6 @@ function initTestEnvironment() { if (isNode) { process.setMaxListeners(100); _nodeEvents.default.EventEmitter.defaultMaxListeners = 100; - var __filename = _nodeUrl.default.fileURLToPath(import.meta.url); - var __dirname = path.dirname(__filename); - rootPath = path.join(__dirname, '../../../../'); - console.log('rootPath: ' + rootPath); /** * Add a global function to process, so we can debug timings diff --git a/dist/cjs/plugins/test-utils/config.js.map b/dist/cjs/plugins/test-utils/config.js.map index b251f9d88d1..0901f4ef63f 100644 --- a/dist/cjs/plugins/test-utils/config.js.map +++ b/dist/cjs/plugins/test-utils/config.js.map @@ -1 +1 @@ -{"version":3,"file":"config.js","names":["_index","require","_broadcastChannel","_nodeEvents","_interopRequireDefault","path","_interopRequireWildcard","_nodeUrl","_index2","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","isDeno","exports","window","isBun","process","versions","bun","isNode","config","setConfig","newConfig","initDone","getConfig","initTestEnvironment","ensureNotFalsy","getEnvVariables","ret","forEach","k","Deno","env","__karma__","ENV_VARIABLES","DEFAULT_STORAGE","isFastMode","NODE_ENV","err","rootPath","getRootPath","broadcastChannelEnforceOptions","type","oldConsoleLog","console","log","bind","oldConsoleDir","dir","newLog","value","isPromise","Error","JSON","stringify","setMaxListeners","events","EventEmitter","defaultMaxListeners","__filename","url","fileURLToPath","import","meta","__dirname","dirname","join","startTime","performance","now","logTime","msg","diff","getEncryptedStorage","baseStorage","storage","getStorage","hasEncryption","wrappedKeyEncryptionCryptoJsStorage","isNotOneOfTheseStorages","storageNames","isName","name","includes","getPassword","Promise","resolve","randomCouchString"],"sources":["../../../../src/plugins/test-utils/config.ts"],"sourcesContent":["/// \nimport {\n ensureNotFalsy,\n isPromise,\n randomCouchString\n} from '../utils/index.ts';\nimport {\n enforceOptions as broadcastChannelEnforceOptions\n} from 'broadcast-channel';\nimport events from 'node:events';\nimport * as path from 'node:path';\nimport url from 'node:url';\nimport type { RxStorage, RxTestStorage } from '../../types';\nimport { wrappedKeyEncryptionCryptoJsStorage } from '../encryption-crypto-js/index.ts';\n\nexport type TestConfig = {\n storage: RxTestStorage;\n};\n\nexport const isDeno = typeof window !== 'undefined' && 'Deno' in window;\nexport const isBun = typeof process !== 'undefined' && !!process.versions.bun;\nexport const isNode = !isDeno && !isBun && typeof window === 'undefined';\n\nlet config: TestConfig;\n\nexport function setConfig(newConfig: TestConfig) {\n config = newConfig;\n}\n\nlet initDone = false;\nexport function getConfig() {\n if (!initDone) {\n initTestEnvironment();\n initDone = true;\n }\n return ensureNotFalsy(config, 'testConfig not set')\n}\n\n\ndeclare const Deno: any;\nfunction getEnvVariables() {\n if (isDeno) {\n const ret: any = {};\n [\n 'DEFAULT_STORAGE',\n 'NODE_ENV'\n ].forEach(k => {\n ret[k] = Deno.env.get(k);\n });\n return ret;\n }\n\n return isBun || isNode ? process.env : (window as any).__karma__.config.env;\n}\nexport const ENV_VARIABLES = getEnvVariables();\nexport const DEFAULT_STORAGE = ENV_VARIABLES.DEFAULT_STORAGE as string;\n\nexport function isFastMode(): boolean {\n try {\n return ENV_VARIABLES.NODE_ENV === 'fast';\n } catch (err) {\n return false;\n }\n}\n\nlet rootPath = '';\nexport function getRootPath() {\n return rootPath;\n}\n\nexport function initTestEnvironment() {\n if (ENV_VARIABLES.NODE_ENV === 'fast') {\n broadcastChannelEnforceOptions({\n type: 'simulate'\n });\n }\n\n /**\n * Overwrite the console for easier debugging\n */\n const oldConsoleLog = console.log.bind(console);\n const oldConsoleDir = console.dir.bind(console);\n function newLog(this: typeof console, value: any) {\n if (isPromise(value)) {\n oldConsoleDir(value);\n throw new Error('cannot log Promise(), you should await it first');\n }\n if (typeof value === 'string' || typeof value === 'number') {\n oldConsoleLog(value);\n return;\n }\n try {\n JSON.stringify(value);\n oldConsoleLog(JSON.stringify(value, null, 4));\n } catch (err) {\n oldConsoleDir(value);\n }\n }\n console.log = newLog.bind(console);\n console.dir = newLog.bind(console);\n\n console.log('DEFAULT_STORAGE: ' + DEFAULT_STORAGE);\n\n if (isNode) {\n process.setMaxListeners(100);\n\n events.EventEmitter.defaultMaxListeners = 100;\n\n const __filename = url.fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n\n rootPath = path.join(__dirname, '../../../../');\n console.log('rootPath: ' + rootPath);\n\n /**\n * Add a global function to process, so we can debug timings\n */\n (process as any).startTime = performance.now();\n (process as any).logTime = (msg: string = '') => {\n const diff = performance.now() - (process as any).startTime;\n console.log('process logTime(' + msg + ') ' + diff + 'ms');\n };\n }\n}\n\nexport function getEncryptedStorage(baseStorage = getConfig().storage.getStorage()): RxStorage {\n const ret = config.storage.hasEncryption ?\n baseStorage :\n wrappedKeyEncryptionCryptoJsStorage({\n storage: baseStorage\n });\n return ret;\n}\n\nexport function isNotOneOfTheseStorages(storageNames: string[]) {\n const isName = getConfig().storage.name;\n if (storageNames.includes(isName)) {\n return false;\n } else {\n return true;\n }\n}\n\n\nexport function getPassword(): Promise {\n if (getConfig().storage.hasEncryption) {\n return ensureNotFalsy(getConfig().storage.hasEncryption)();\n } else {\n return Promise.resolve('test-password-' + randomCouchString(10));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,IAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,QAAA,GAAAH,sBAAA,CAAAH,OAAA;AAEA,IAAAO,OAAA,GAAAP,OAAA;AAAuF,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAbvF;;AAmBO,IAAMY,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,OAAOE,MAAM,KAAK,WAAW,IAAI,MAAM,IAAIA,MAAM;AAChE,IAAMC,KAAK,GAAAF,OAAA,CAAAE,KAAA,GAAG,OAAOC,OAAO,KAAK,WAAW,IAAI,CAAC,CAACA,OAAO,CAACC,QAAQ,CAACC,GAAG;AACtE,IAAMC,MAAM,GAAAN,OAAA,CAAAM,MAAA,GAAG,CAACP,MAAM,IAAI,CAACG,KAAK,IAAI,OAAOD,MAAM,KAAK,WAAW;AAExE,IAAIM,MAAkB;AAEf,SAASC,SAASA,CAACC,SAAqB,EAAE;EAC7CF,MAAM,GAAGE,SAAS;AACtB;AAEA,IAAIC,QAAQ,GAAG,KAAK;AACb,SAASC,SAASA,CAAA,EAAG;EACxB,IAAI,CAACD,QAAQ,EAAE;IACXE,mBAAmB,CAAC,CAAC;IACrBF,QAAQ,GAAG,IAAI;EACnB;EACA,OAAO,IAAAG,qBAAc,EAACN,MAAM,EAAE,oBAAoB,CAAC;AACvD;AAIA,SAASO,eAAeA,CAAA,EAAG;EACvB,IAAIf,MAAM,EAAE;IACR,IAAMgB,GAAQ,GAAG,CAAC,CAAC;IACnB,CACI,iBAAiB,EACjB,UAAU,CACb,CAACC,OAAO,CAACC,CAAC,IAAI;MACXF,GAAG,CAACE,CAAC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACjC,GAAG,CAAC+B,CAAC,CAAC;IAC5B,CAAC,CAAC;IACF,OAAOF,GAAG;EACd;EAEA,OAAOb,KAAK,IAAII,MAAM,GAAGH,OAAO,CAACgB,GAAG,GAAIlB,MAAM,CAASmB,SAAS,CAACb,MAAM,CAACY,GAAG;AAC/E;AACO,IAAME,aAAa,GAAArB,OAAA,CAAAqB,aAAA,GAAGP,eAAe,CAAC,CAAC;AACvC,IAAMQ,eAAe,GAAAtB,OAAA,CAAAsB,eAAA,GAAGD,aAAa,CAACC,eAAyB;AAE/D,SAASC,UAAUA,CAAA,EAAY;EAClC,IAAI;IACA,OAAOF,aAAa,CAACG,QAAQ,KAAK,MAAM;EAC5C,CAAC,CAAC,OAAOC,GAAG,EAAE;IACV,OAAO,KAAK;EAChB;AACJ;AAEA,IAAIC,QAAQ,GAAG,EAAE;AACV,SAASC,WAAWA,CAAA,EAAG;EAC1B,OAAOD,QAAQ;AACnB;AAEO,SAASd,mBAAmBA,CAAA,EAAG;EAClC,IAAIS,aAAa,CAACG,QAAQ,KAAK,MAAM,EAAE;IACnC,IAAAI,gCAA8B,EAAC;MAC3BC,IAAI,EAAE;IACV,CAAC,CAAC;EACN;;EAEA;AACJ;AACA;EACI,IAAMC,aAAa,GAAGC,OAAO,CAACC,GAAG,CAACC,IAAI,CAACF,OAAO,CAAC;EAC/C,IAAMG,aAAa,GAAGH,OAAO,CAACI,GAAG,CAACF,IAAI,CAACF,OAAO,CAAC;EAC/C,SAASK,MAAMA,CAAuBC,KAAU,EAAE;IAC9C,IAAI,IAAAC,gBAAS,EAACD,KAAK,CAAC,EAAE;MAClBH,aAAa,CAACG,KAAK,CAAC;MACpB,MAAM,IAAIE,KAAK,CAAC,iDAAiD,CAAC;IACtE;IACA,IAAI,OAAOF,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MACxDP,aAAa,CAACO,KAAK,CAAC;MACpB;IACJ;IACA,IAAI;MACAG,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC;MACrBP,aAAa,CAACU,IAAI,CAACC,SAAS,CAACJ,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,OAAOZ,GAAG,EAAE;MACVS,aAAa,CAACG,KAAK,CAAC;IACxB;EACJ;EACAN,OAAO,CAACC,GAAG,GAAGI,MAAM,CAACH,IAAI,CAACF,OAAO,CAAC;EAClCA,OAAO,CAACI,GAAG,GAAGC,MAAM,CAACH,IAAI,CAACF,OAAO,CAAC;EAElCA,OAAO,CAACC,GAAG,CAAC,mBAAmB,GAAGV,eAAe,CAAC;EAElD,IAAIhB,MAAM,EAAE;IACRH,OAAO,CAACuC,eAAe,CAAC,GAAG,CAAC;IAE5BC,mBAAM,CAACC,YAAY,CAACC,mBAAmB,GAAG,GAAG;IAE7C,IAAMC,UAAU,GAAGC,gBAAG,CAACC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACH,GAAG,CAAC;IACrD,IAAMI,SAAS,GAAG7E,IAAI,CAAC8E,OAAO,CAACN,UAAU,CAAC;IAE1CpB,QAAQ,GAAGpD,IAAI,CAAC+E,IAAI,CAACF,SAAS,EAAE,cAAc,CAAC;IAC/CpB,OAAO,CAACC,GAAG,CAAC,YAAY,GAAGN,QAAQ,CAAC;;IAEpC;AACR;AACA;IACSvB,OAAO,CAASmD,SAAS,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;IAC7CrD,OAAO,CAASsD,OAAO,GAAG,CAACC,GAAW,GAAG,EAAE,KAAK;MAC7C,IAAMC,IAAI,GAAGJ,WAAW,CAACC,GAAG,CAAC,CAAC,GAAIrD,OAAO,CAASmD,SAAS;MAC3DvB,OAAO,CAACC,GAAG,CAAC,kBAAkB,GAAG0B,GAAG,GAAG,IAAI,GAAGC,IAAI,GAAG,IAAI,CAAC;IAC9D,CAAC;EACL;AACJ;AAEO,SAASC,mBAAmBA,CAACC,WAAW,GAAGlD,SAAS,CAAC,CAAC,CAACmD,OAAO,CAACC,UAAU,CAAC,CAAC,EAAuB;EACrG,IAAMhD,GAAG,GAAGR,MAAM,CAACuD,OAAO,CAACE,aAAa,GACpCH,WAAW,GACX,IAAAI,2CAAmC,EAAC;IAChCH,OAAO,EAAED;EACb,CAAC,CAAC;EACN,OAAO9C,GAAG;AACd;AAEO,SAASmD,uBAAuBA,CAACC,YAAsB,EAAE;EAC5D,IAAMC,MAAM,GAAGzD,SAAS,CAAC,CAAC,CAACmD,OAAO,CAACO,IAAI;EACvC,IAAIF,YAAY,CAACG,QAAQ,CAACF,MAAM,CAAC,EAAE;IAC/B,OAAO,KAAK;EAChB,CAAC,MAAM;IACH,OAAO,IAAI;EACf;AACJ;AAGO,SAASG,WAAWA,CAAA,EAAoB;EAC3C,IAAI5D,SAAS,CAAC,CAAC,CAACmD,OAAO,CAACE,aAAa,EAAE;IACnC,OAAO,IAAAnD,qBAAc,EAACF,SAAS,CAAC,CAAC,CAACmD,OAAO,CAACE,aAAa,CAAC,CAAC,CAAC;EAC9D,CAAC,MAAM;IACH,OAAOQ,OAAO,CAACC,OAAO,CAAC,gBAAgB,GAAG,IAAAC,wBAAiB,EAAC,EAAE,CAAC,CAAC;EACpE;AACJ"} \ No newline at end of file +{"version":3,"file":"config.js","names":["_index","require","_broadcastChannel","_nodeEvents","_interopRequireDefault","_index2","isDeno","exports","window","isBun","process","versions","bun","isNode","config","setConfig","newConfig","initDone","getConfig","initTestEnvironment","ensureNotFalsy","getEnvVariables","ret","forEach","k","Deno","env","get","__karma__","ENV_VARIABLES","DEFAULT_STORAGE","isFastMode","NODE_ENV","err","broadcastChannelEnforceOptions","type","oldConsoleLog","console","log","bind","oldConsoleDir","dir","newLog","value","isPromise","Error","JSON","stringify","setMaxListeners","events","EventEmitter","defaultMaxListeners","startTime","performance","now","logTime","msg","diff","getEncryptedStorage","baseStorage","storage","getStorage","hasEncryption","wrappedKeyEncryptionCryptoJsStorage","isNotOneOfTheseStorages","storageNames","isName","name","includes","getPassword","Promise","resolve","randomCouchString"],"sources":["../../../../src/plugins/test-utils/config.ts"],"sourcesContent":["/// \nimport {\n ensureNotFalsy,\n isPromise,\n randomCouchString\n} from '../utils/index.ts';\nimport {\n enforceOptions as broadcastChannelEnforceOptions\n} from 'broadcast-channel';\nimport events from 'node:events';\nimport * as path from 'node:path';\nimport url from 'node:url';\nimport type { RxStorage, RxTestStorage } from '../../types';\nimport { wrappedKeyEncryptionCryptoJsStorage } from '../encryption-crypto-js/index.ts';\n\nexport type TestConfig = {\n storage: RxTestStorage;\n};\n\nexport const isDeno = typeof window !== 'undefined' && 'Deno' in window;\nexport const isBun = typeof process !== 'undefined' && !!process.versions.bun;\nexport const isNode = !isDeno && !isBun && typeof window === 'undefined';\n\nlet config: TestConfig;\n\nexport function setConfig(newConfig: TestConfig) {\n config = newConfig;\n}\n\nlet initDone = false;\nexport function getConfig() {\n if (!initDone) {\n initTestEnvironment();\n initDone = true;\n }\n return ensureNotFalsy(config, 'testConfig not set')\n}\n\n\ndeclare const Deno: any;\nfunction getEnvVariables() {\n if (isDeno) {\n const ret: any = {};\n [\n 'DEFAULT_STORAGE',\n 'NODE_ENV'\n ].forEach(k => {\n ret[k] = Deno.env.get(k);\n });\n return ret;\n }\n\n return isBun || isNode ? process.env : (window as any).__karma__.config.env;\n}\nexport const ENV_VARIABLES = getEnvVariables();\nexport const DEFAULT_STORAGE = ENV_VARIABLES.DEFAULT_STORAGE as string;\n\nexport function isFastMode(): boolean {\n try {\n return ENV_VARIABLES.NODE_ENV === 'fast';\n } catch (err) {\n return false;\n }\n}\n\nexport function initTestEnvironment() {\n if (ENV_VARIABLES.NODE_ENV === 'fast') {\n broadcastChannelEnforceOptions({\n type: 'simulate'\n });\n }\n\n /**\n * Overwrite the console for easier debugging\n */\n const oldConsoleLog = console.log.bind(console);\n const oldConsoleDir = console.dir.bind(console);\n function newLog(this: typeof console, value: any) {\n if (isPromise(value)) {\n oldConsoleDir(value);\n throw new Error('cannot log Promise(), you should await it first');\n }\n if (typeof value === 'string' || typeof value === 'number') {\n oldConsoleLog(value);\n return;\n }\n try {\n JSON.stringify(value);\n oldConsoleLog(JSON.stringify(value, null, 4));\n } catch (err) {\n oldConsoleDir(value);\n }\n }\n console.log = newLog.bind(console);\n console.dir = newLog.bind(console);\n\n console.log('DEFAULT_STORAGE: ' + DEFAULT_STORAGE);\n\n if (isNode) {\n process.setMaxListeners(100);\n\n events.EventEmitter.defaultMaxListeners = 100;\n\n /**\n * Add a global function to process, so we can debug timings\n */\n (process as any).startTime = performance.now();\n (process as any).logTime = (msg: string = '') => {\n const diff = performance.now() - (process as any).startTime;\n console.log('process logTime(' + msg + ') ' + diff + 'ms');\n };\n }\n}\n\nexport function getEncryptedStorage(baseStorage = getConfig().storage.getStorage()): RxStorage {\n const ret = config.storage.hasEncryption ?\n baseStorage :\n wrappedKeyEncryptionCryptoJsStorage({\n storage: baseStorage\n });\n return ret;\n}\n\nexport function isNotOneOfTheseStorages(storageNames: string[]) {\n const isName = getConfig().storage.name;\n if (storageNames.includes(isName)) {\n return false;\n } else {\n return true;\n }\n}\n\n\nexport function getPassword(): Promise {\n if (getConfig().storage.hasEncryption) {\n return ensureNotFalsy(getConfig().storage.hasEncryption)();\n } else {\n return Promise.resolve('test-password-' + randomCouchString(10));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAIA,IAAAI,OAAA,GAAAJ,OAAA;AAbA;;AAmBO,IAAMK,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,OAAOE,MAAM,KAAK,WAAW,IAAI,MAAM,IAAIA,MAAM;AAChE,IAAMC,KAAK,GAAAF,OAAA,CAAAE,KAAA,GAAG,OAAOC,OAAO,KAAK,WAAW,IAAI,CAAC,CAACA,OAAO,CAACC,QAAQ,CAACC,GAAG;AACtE,IAAMC,MAAM,GAAAN,OAAA,CAAAM,MAAA,GAAG,CAACP,MAAM,IAAI,CAACG,KAAK,IAAI,OAAOD,MAAM,KAAK,WAAW;AAExE,IAAIM,MAAkB;AAEf,SAASC,SAASA,CAACC,SAAqB,EAAE;EAC7CF,MAAM,GAAGE,SAAS;AACtB;AAEA,IAAIC,QAAQ,GAAG,KAAK;AACb,SAASC,SAASA,CAAA,EAAG;EACxB,IAAI,CAACD,QAAQ,EAAE;IACXE,mBAAmB,CAAC,CAAC;IACrBF,QAAQ,GAAG,IAAI;EACnB;EACA,OAAO,IAAAG,qBAAc,EAACN,MAAM,EAAE,oBAAoB,CAAC;AACvD;AAIA,SAASO,eAAeA,CAAA,EAAG;EACvB,IAAIf,MAAM,EAAE;IACR,IAAMgB,GAAQ,GAAG,CAAC,CAAC;IACnB,CACI,iBAAiB,EACjB,UAAU,CACb,CAACC,OAAO,CAACC,CAAC,IAAI;MACXF,GAAG,CAACE,CAAC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACC,GAAG,CAACH,CAAC,CAAC;IAC5B,CAAC,CAAC;IACF,OAAOF,GAAG;EACd;EAEA,OAAOb,KAAK,IAAII,MAAM,GAAGH,OAAO,CAACgB,GAAG,GAAIlB,MAAM,CAASoB,SAAS,CAACd,MAAM,CAACY,GAAG;AAC/E;AACO,IAAMG,aAAa,GAAAtB,OAAA,CAAAsB,aAAA,GAAGR,eAAe,CAAC,CAAC;AACvC,IAAMS,eAAe,GAAAvB,OAAA,CAAAuB,eAAA,GAAGD,aAAa,CAACC,eAAyB;AAE/D,SAASC,UAAUA,CAAA,EAAY;EAClC,IAAI;IACA,OAAOF,aAAa,CAACG,QAAQ,KAAK,MAAM;EAC5C,CAAC,CAAC,OAAOC,GAAG,EAAE;IACV,OAAO,KAAK;EAChB;AACJ;AAEO,SAASd,mBAAmBA,CAAA,EAAG;EAClC,IAAIU,aAAa,CAACG,QAAQ,KAAK,MAAM,EAAE;IACnC,IAAAE,gCAA8B,EAAC;MAC3BC,IAAI,EAAE;IACV,CAAC,CAAC;EACN;;EAEA;AACJ;AACA;EACI,IAAMC,aAAa,GAAGC,OAAO,CAACC,GAAG,CAACC,IAAI,CAACF,OAAO,CAAC;EAC/C,IAAMG,aAAa,GAAGH,OAAO,CAACI,GAAG,CAACF,IAAI,CAACF,OAAO,CAAC;EAC/C,SAASK,MAAMA,CAAuBC,KAAU,EAAE;IAC9C,IAAI,IAAAC,gBAAS,EAACD,KAAK,CAAC,EAAE;MAClBH,aAAa,CAACG,KAAK,CAAC;MACpB,MAAM,IAAIE,KAAK,CAAC,iDAAiD,CAAC;IACtE;IACA,IAAI,OAAOF,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MACxDP,aAAa,CAACO,KAAK,CAAC;MACpB;IACJ;IACA,IAAI;MACAG,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC;MACrBP,aAAa,CAACU,IAAI,CAACC,SAAS,CAACJ,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,OAAOV,GAAG,EAAE;MACVO,aAAa,CAACG,KAAK,CAAC;IACxB;EACJ;EACAN,OAAO,CAACC,GAAG,GAAGI,MAAM,CAACH,IAAI,CAACF,OAAO,CAAC;EAClCA,OAAO,CAACI,GAAG,GAAGC,MAAM,CAACH,IAAI,CAACF,OAAO,CAAC;EAElCA,OAAO,CAACC,GAAG,CAAC,mBAAmB,GAAGR,eAAe,CAAC;EAElD,IAAIjB,MAAM,EAAE;IACRH,OAAO,CAACsC,eAAe,CAAC,GAAG,CAAC;IAE5BC,mBAAM,CAACC,YAAY,CAACC,mBAAmB,GAAG,GAAG;;IAE7C;AACR;AACA;IACSzC,OAAO,CAAS0C,SAAS,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;IAC7C5C,OAAO,CAAS6C,OAAO,GAAG,CAACC,GAAW,GAAG,EAAE,KAAK;MAC7C,IAAMC,IAAI,GAAGJ,WAAW,CAACC,GAAG,CAAC,CAAC,GAAI5C,OAAO,CAAS0C,SAAS;MAC3Df,OAAO,CAACC,GAAG,CAAC,kBAAkB,GAAGkB,GAAG,GAAG,IAAI,GAAGC,IAAI,GAAG,IAAI,CAAC;IAC9D,CAAC;EACL;AACJ;AAEO,SAASC,mBAAmBA,CAACC,WAAW,GAAGzC,SAAS,CAAC,CAAC,CAAC0C,OAAO,CAACC,UAAU,CAAC,CAAC,EAAuB;EACrG,IAAMvC,GAAG,GAAGR,MAAM,CAAC8C,OAAO,CAACE,aAAa,GACpCH,WAAW,GACX,IAAAI,2CAAmC,EAAC;IAChCH,OAAO,EAAED;EACb,CAAC,CAAC;EACN,OAAOrC,GAAG;AACd;AAEO,SAAS0C,uBAAuBA,CAACC,YAAsB,EAAE;EAC5D,IAAMC,MAAM,GAAGhD,SAAS,CAAC,CAAC,CAAC0C,OAAO,CAACO,IAAI;EACvC,IAAIF,YAAY,CAACG,QAAQ,CAACF,MAAM,CAAC,EAAE;IAC/B,OAAO,KAAK;EAChB,CAAC,MAAM;IACH,OAAO,IAAI;EACf;AACJ;AAGO,SAASG,WAAWA,CAAA,EAAoB;EAC3C,IAAInD,SAAS,CAAC,CAAC,CAAC0C,OAAO,CAACE,aAAa,EAAE;IACnC,OAAO,IAAA1C,qBAAc,EAACF,SAAS,CAAC,CAAC,CAAC0C,OAAO,CAACE,aAAa,CAAC,CAAC,CAAC;EAC9D,CAAC,MAAM;IACH,OAAOQ,OAAO,CAACC,OAAO,CAAC,gBAAgB,GAAG,IAAAC,wBAAiB,EAAC,EAAE,CAAC,CAAC;EACpE;AACJ"} \ No newline at end of file diff --git a/dist/cjs/plugins/utils/utils-rxdb-version.js b/dist/cjs/plugins/utils/utils-rxdb-version.js index 76867bab5f9..2322c966aee 100644 --- a/dist/cjs/plugins/utils/utils-rxdb-version.js +++ b/dist/cjs/plugins/utils/utils-rxdb-version.js @@ -7,5 +7,5 @@ exports.RXDB_VERSION = void 0; /** * This file is replaced in the 'npm run build:version' script. */ -var RXDB_VERSION = exports.RXDB_VERSION = '15.4.1'; +var RXDB_VERSION = exports.RXDB_VERSION = '15.4.2'; //# sourceMappingURL=utils-rxdb-version.js.map \ No newline at end of file diff --git a/dist/cjs/plugins/utils/utils-rxdb-version.js.map b/dist/cjs/plugins/utils/utils-rxdb-version.js.map index d443533e03d..7766fbd7640 100644 --- a/dist/cjs/plugins/utils/utils-rxdb-version.js.map +++ b/dist/cjs/plugins/utils/utils-rxdb-version.js.map @@ -1 +1 @@ -{"version":3,"file":"utils-rxdb-version.js","names":["RXDB_VERSION","exports"],"sources":["../../../../src/plugins/utils/utils-rxdb-version.ts"],"sourcesContent":["/**\n * This file is replaced in the 'npm run build:version' script.\n */\nexport const RXDB_VERSION = '15.4.1';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,IAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,QAAQ"} \ No newline at end of file +{"version":3,"file":"utils-rxdb-version.js","names":["RXDB_VERSION","exports"],"sources":["../../../../src/plugins/utils/utils-rxdb-version.ts"],"sourcesContent":["/**\n * This file is replaced in the 'npm run build:version' script.\n */\nexport const RXDB_VERSION = '15.4.2';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,IAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,QAAQ"} \ No newline at end of file diff --git a/dist/esm/plugins/test-utils/config.js b/dist/esm/plugins/test-utils/config.js index b1ac167bf44..c2600626153 100644 --- a/dist/esm/plugins/test-utils/config.js +++ b/dist/esm/plugins/test-utils/config.js @@ -2,8 +2,6 @@ import { ensureNotFalsy, isPromise, randomCouchString } from "../utils/index.js"; import { enforceOptions as broadcastChannelEnforceOptions } from 'broadcast-channel'; import events from 'node:events'; -import * as path from 'node:path'; -import url from 'node:url'; import { wrappedKeyEncryptionCryptoJsStorage } from "../encryption-crypto-js/index.js"; export var isDeno = typeof window !== 'undefined' && 'Deno' in window; export var isBun = typeof process !== 'undefined' && !!process.versions.bun; @@ -39,10 +37,6 @@ export function isFastMode() { return false; } } -var rootPath = ''; -export function getRootPath() { - return rootPath; -} export function initTestEnvironment() { if (ENV_VARIABLES.NODE_ENV === 'fast') { broadcastChannelEnforceOptions({ @@ -77,10 +71,6 @@ export function initTestEnvironment() { if (isNode) { process.setMaxListeners(100); events.EventEmitter.defaultMaxListeners = 100; - var __filename = url.fileURLToPath(import.meta.url); - var __dirname = path.dirname(__filename); - rootPath = path.join(__dirname, '../../../../'); - console.log('rootPath: ' + rootPath); /** * Add a global function to process, so we can debug timings diff --git a/dist/esm/plugins/test-utils/config.js.map b/dist/esm/plugins/test-utils/config.js.map index 04bfe059337..538927d2633 100644 --- a/dist/esm/plugins/test-utils/config.js.map +++ b/dist/esm/plugins/test-utils/config.js.map @@ -1 +1 @@ -{"version":3,"file":"config.js","names":["ensureNotFalsy","isPromise","randomCouchString","enforceOptions","broadcastChannelEnforceOptions","events","path","url","wrappedKeyEncryptionCryptoJsStorage","isDeno","window","isBun","process","versions","bun","isNode","config","setConfig","newConfig","initDone","getConfig","initTestEnvironment","getEnvVariables","ret","forEach","k","Deno","env","get","__karma__","ENV_VARIABLES","DEFAULT_STORAGE","isFastMode","NODE_ENV","err","rootPath","getRootPath","type","oldConsoleLog","console","log","bind","oldConsoleDir","dir","newLog","value","Error","JSON","stringify","setMaxListeners","EventEmitter","defaultMaxListeners","__filename","fileURLToPath","import","meta","__dirname","dirname","join","startTime","performance","now","logTime","msg","diff","getEncryptedStorage","baseStorage","storage","getStorage","hasEncryption","isNotOneOfTheseStorages","storageNames","isName","name","includes","getPassword","Promise","resolve"],"sources":["../../../../src/plugins/test-utils/config.ts"],"sourcesContent":["/// \nimport {\n ensureNotFalsy,\n isPromise,\n randomCouchString\n} from '../utils/index.ts';\nimport {\n enforceOptions as broadcastChannelEnforceOptions\n} from 'broadcast-channel';\nimport events from 'node:events';\nimport * as path from 'node:path';\nimport url from 'node:url';\nimport type { RxStorage, RxTestStorage } from '../../types';\nimport { wrappedKeyEncryptionCryptoJsStorage } from '../encryption-crypto-js/index.ts';\n\nexport type TestConfig = {\n storage: RxTestStorage;\n};\n\nexport const isDeno = typeof window !== 'undefined' && 'Deno' in window;\nexport const isBun = typeof process !== 'undefined' && !!process.versions.bun;\nexport const isNode = !isDeno && !isBun && typeof window === 'undefined';\n\nlet config: TestConfig;\n\nexport function setConfig(newConfig: TestConfig) {\n config = newConfig;\n}\n\nlet initDone = false;\nexport function getConfig() {\n if (!initDone) {\n initTestEnvironment();\n initDone = true;\n }\n return ensureNotFalsy(config, 'testConfig not set')\n}\n\n\ndeclare const Deno: any;\nfunction getEnvVariables() {\n if (isDeno) {\n const ret: any = {};\n [\n 'DEFAULT_STORAGE',\n 'NODE_ENV'\n ].forEach(k => {\n ret[k] = Deno.env.get(k);\n });\n return ret;\n }\n\n return isBun || isNode ? process.env : (window as any).__karma__.config.env;\n}\nexport const ENV_VARIABLES = getEnvVariables();\nexport const DEFAULT_STORAGE = ENV_VARIABLES.DEFAULT_STORAGE as string;\n\nexport function isFastMode(): boolean {\n try {\n return ENV_VARIABLES.NODE_ENV === 'fast';\n } catch (err) {\n return false;\n }\n}\n\nlet rootPath = '';\nexport function getRootPath() {\n return rootPath;\n}\n\nexport function initTestEnvironment() {\n if (ENV_VARIABLES.NODE_ENV === 'fast') {\n broadcastChannelEnforceOptions({\n type: 'simulate'\n });\n }\n\n /**\n * Overwrite the console for easier debugging\n */\n const oldConsoleLog = console.log.bind(console);\n const oldConsoleDir = console.dir.bind(console);\n function newLog(this: typeof console, value: any) {\n if (isPromise(value)) {\n oldConsoleDir(value);\n throw new Error('cannot log Promise(), you should await it first');\n }\n if (typeof value === 'string' || typeof value === 'number') {\n oldConsoleLog(value);\n return;\n }\n try {\n JSON.stringify(value);\n oldConsoleLog(JSON.stringify(value, null, 4));\n } catch (err) {\n oldConsoleDir(value);\n }\n }\n console.log = newLog.bind(console);\n console.dir = newLog.bind(console);\n\n console.log('DEFAULT_STORAGE: ' + DEFAULT_STORAGE);\n\n if (isNode) {\n process.setMaxListeners(100);\n\n events.EventEmitter.defaultMaxListeners = 100;\n\n const __filename = url.fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n\n rootPath = path.join(__dirname, '../../../../');\n console.log('rootPath: ' + rootPath);\n\n /**\n * Add a global function to process, so we can debug timings\n */\n (process as any).startTime = performance.now();\n (process as any).logTime = (msg: string = '') => {\n const diff = performance.now() - (process as any).startTime;\n console.log('process logTime(' + msg + ') ' + diff + 'ms');\n };\n }\n}\n\nexport function getEncryptedStorage(baseStorage = getConfig().storage.getStorage()): RxStorage {\n const ret = config.storage.hasEncryption ?\n baseStorage :\n wrappedKeyEncryptionCryptoJsStorage({\n storage: baseStorage\n });\n return ret;\n}\n\nexport function isNotOneOfTheseStorages(storageNames: string[]) {\n const isName = getConfig().storage.name;\n if (storageNames.includes(isName)) {\n return false;\n } else {\n return true;\n }\n}\n\n\nexport function getPassword(): Promise {\n if (getConfig().storage.hasEncryption) {\n return ensureNotFalsy(getConfig().storage.hasEncryption)();\n } else {\n return Promise.resolve('test-password-' + randomCouchString(10));\n }\n}\n"],"mappings":"AAAA;AACA,SACIA,cAAc,EACdC,SAAS,EACTC,iBAAiB,QACd,mBAAmB;AAC1B,SACIC,cAAc,IAAIC,8BAA8B,QAC7C,mBAAmB;AAC1B,OAAOC,MAAM,MAAM,aAAa;AAChC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,GAAG,MAAM,UAAU;AAE1B,SAASC,mCAAmC,QAAQ,kCAAkC;AAMtF,OAAO,IAAMC,MAAM,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAI,MAAM,IAAIA,MAAM;AACvE,OAAO,IAAMC,KAAK,GAAG,OAAOC,OAAO,KAAK,WAAW,IAAI,CAAC,CAACA,OAAO,CAACC,QAAQ,CAACC,GAAG;AAC7E,OAAO,IAAMC,MAAM,GAAG,CAACN,MAAM,IAAI,CAACE,KAAK,IAAI,OAAOD,MAAM,KAAK,WAAW;AAExE,IAAIM,MAAkB;AAEtB,OAAO,SAASC,SAASA,CAACC,SAAqB,EAAE;EAC7CF,MAAM,GAAGE,SAAS;AACtB;AAEA,IAAIC,QAAQ,GAAG,KAAK;AACpB,OAAO,SAASC,SAASA,CAAA,EAAG;EACxB,IAAI,CAACD,QAAQ,EAAE;IACXE,mBAAmB,CAAC,CAAC;IACrBF,QAAQ,GAAG,IAAI;EACnB;EACA,OAAOnB,cAAc,CAACgB,MAAM,EAAE,oBAAoB,CAAC;AACvD;AAIA,SAASM,eAAeA,CAAA,EAAG;EACvB,IAAIb,MAAM,EAAE;IACR,IAAMc,GAAQ,GAAG,CAAC,CAAC;IACnB,CACI,iBAAiB,EACjB,UAAU,CACb,CAACC,OAAO,CAACC,CAAC,IAAI;MACXF,GAAG,CAACE,CAAC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACC,GAAG,CAACH,CAAC,CAAC;IAC5B,CAAC,CAAC;IACF,OAAOF,GAAG;EACd;EAEA,OAAOZ,KAAK,IAAII,MAAM,GAAGH,OAAO,CAACe,GAAG,GAAIjB,MAAM,CAASmB,SAAS,CAACb,MAAM,CAACW,GAAG;AAC/E;AACA,OAAO,IAAMG,aAAa,GAAGR,eAAe,CAAC,CAAC;AAC9C,OAAO,IAAMS,eAAe,GAAGD,aAAa,CAACC,eAAyB;AAEtE,OAAO,SAASC,UAAUA,CAAA,EAAY;EAClC,IAAI;IACA,OAAOF,aAAa,CAACG,QAAQ,KAAK,MAAM;EAC5C,CAAC,CAAC,OAAOC,GAAG,EAAE;IACV,OAAO,KAAK;EAChB;AACJ;AAEA,IAAIC,QAAQ,GAAG,EAAE;AACjB,OAAO,SAASC,WAAWA,CAAA,EAAG;EAC1B,OAAOD,QAAQ;AACnB;AAEA,OAAO,SAASd,mBAAmBA,CAAA,EAAG;EAClC,IAAIS,aAAa,CAACG,QAAQ,KAAK,MAAM,EAAE;IACnC7B,8BAA8B,CAAC;MAC3BiC,IAAI,EAAE;IACV,CAAC,CAAC;EACN;;EAEA;AACJ;AACA;EACI,IAAMC,aAAa,GAAGC,OAAO,CAACC,GAAG,CAACC,IAAI,CAACF,OAAO,CAAC;EAC/C,IAAMG,aAAa,GAAGH,OAAO,CAACI,GAAG,CAACF,IAAI,CAACF,OAAO,CAAC;EAC/C,SAASK,MAAMA,CAAuBC,KAAU,EAAE;IAC9C,IAAI5C,SAAS,CAAC4C,KAAK,CAAC,EAAE;MAClBH,aAAa,CAACG,KAAK,CAAC;MACpB,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC;IACtE;IACA,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MACxDP,aAAa,CAACO,KAAK,CAAC;MACpB;IACJ;IACA,IAAI;MACAE,IAAI,CAACC,SAAS,CAACH,KAAK,CAAC;MACrBP,aAAa,CAACS,IAAI,CAACC,SAAS,CAACH,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,OAAOX,GAAG,EAAE;MACVQ,aAAa,CAACG,KAAK,CAAC;IACxB;EACJ;EACAN,OAAO,CAACC,GAAG,GAAGI,MAAM,CAACH,IAAI,CAACF,OAAO,CAAC;EAClCA,OAAO,CAACI,GAAG,GAAGC,MAAM,CAACH,IAAI,CAACF,OAAO,CAAC;EAElCA,OAAO,CAACC,GAAG,CAAC,mBAAmB,GAAGT,eAAe,CAAC;EAElD,IAAIhB,MAAM,EAAE;IACRH,OAAO,CAACqC,eAAe,CAAC,GAAG,CAAC;IAE5B5C,MAAM,CAAC6C,YAAY,CAACC,mBAAmB,GAAG,GAAG;IAE7C,IAAMC,UAAU,GAAG7C,GAAG,CAAC8C,aAAa,CAACC,MAAM,CAACC,IAAI,CAAChD,GAAG,CAAC;IACrD,IAAMiD,SAAS,GAAGlD,IAAI,CAACmD,OAAO,CAACL,UAAU,CAAC;IAE1CjB,QAAQ,GAAG7B,IAAI,CAACoD,IAAI,CAACF,SAAS,EAAE,cAAc,CAAC;IAC/CjB,OAAO,CAACC,GAAG,CAAC,YAAY,GAAGL,QAAQ,CAAC;;IAEpC;AACR;AACA;IACSvB,OAAO,CAAS+C,SAAS,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;IAC7CjD,OAAO,CAASkD,OAAO,GAAG,CAACC,GAAW,GAAG,EAAE,KAAK;MAC7C,IAAMC,IAAI,GAAGJ,WAAW,CAACC,GAAG,CAAC,CAAC,GAAIjD,OAAO,CAAS+C,SAAS;MAC3DpB,OAAO,CAACC,GAAG,CAAC,kBAAkB,GAAGuB,GAAG,GAAG,IAAI,GAAGC,IAAI,GAAG,IAAI,CAAC;IAC9D,CAAC;EACL;AACJ;AAEA,OAAO,SAASC,mBAAmBA,CAACC,WAAW,GAAG9C,SAAS,CAAC,CAAC,CAAC+C,OAAO,CAACC,UAAU,CAAC,CAAC,EAAuB;EACrG,IAAM7C,GAAG,GAAGP,MAAM,CAACmD,OAAO,CAACE,aAAa,GACpCH,WAAW,GACX1D,mCAAmC,CAAC;IAChC2D,OAAO,EAAED;EACb,CAAC,CAAC;EACN,OAAO3C,GAAG;AACd;AAEA,OAAO,SAAS+C,uBAAuBA,CAACC,YAAsB,EAAE;EAC5D,IAAMC,MAAM,GAAGpD,SAAS,CAAC,CAAC,CAAC+C,OAAO,CAACM,IAAI;EACvC,IAAIF,YAAY,CAACG,QAAQ,CAACF,MAAM,CAAC,EAAE;IAC/B,OAAO,KAAK;EAChB,CAAC,MAAM;IACH,OAAO,IAAI;EACf;AACJ;AAGA,OAAO,SAASG,WAAWA,CAAA,EAAoB;EAC3C,IAAIvD,SAAS,CAAC,CAAC,CAAC+C,OAAO,CAACE,aAAa,EAAE;IACnC,OAAOrE,cAAc,CAACoB,SAAS,CAAC,CAAC,CAAC+C,OAAO,CAACE,aAAa,CAAC,CAAC,CAAC;EAC9D,CAAC,MAAM;IACH,OAAOO,OAAO,CAACC,OAAO,CAAC,gBAAgB,GAAG3E,iBAAiB,CAAC,EAAE,CAAC,CAAC;EACpE;AACJ"} \ No newline at end of file +{"version":3,"file":"config.js","names":["ensureNotFalsy","isPromise","randomCouchString","enforceOptions","broadcastChannelEnforceOptions","events","wrappedKeyEncryptionCryptoJsStorage","isDeno","window","isBun","process","versions","bun","isNode","config","setConfig","newConfig","initDone","getConfig","initTestEnvironment","getEnvVariables","ret","forEach","k","Deno","env","get","__karma__","ENV_VARIABLES","DEFAULT_STORAGE","isFastMode","NODE_ENV","err","type","oldConsoleLog","console","log","bind","oldConsoleDir","dir","newLog","value","Error","JSON","stringify","setMaxListeners","EventEmitter","defaultMaxListeners","startTime","performance","now","logTime","msg","diff","getEncryptedStorage","baseStorage","storage","getStorage","hasEncryption","isNotOneOfTheseStorages","storageNames","isName","name","includes","getPassword","Promise","resolve"],"sources":["../../../../src/plugins/test-utils/config.ts"],"sourcesContent":["/// \nimport {\n ensureNotFalsy,\n isPromise,\n randomCouchString\n} from '../utils/index.ts';\nimport {\n enforceOptions as broadcastChannelEnforceOptions\n} from 'broadcast-channel';\nimport events from 'node:events';\nimport * as path from 'node:path';\nimport url from 'node:url';\nimport type { RxStorage, RxTestStorage } from '../../types';\nimport { wrappedKeyEncryptionCryptoJsStorage } from '../encryption-crypto-js/index.ts';\n\nexport type TestConfig = {\n storage: RxTestStorage;\n};\n\nexport const isDeno = typeof window !== 'undefined' && 'Deno' in window;\nexport const isBun = typeof process !== 'undefined' && !!process.versions.bun;\nexport const isNode = !isDeno && !isBun && typeof window === 'undefined';\n\nlet config: TestConfig;\n\nexport function setConfig(newConfig: TestConfig) {\n config = newConfig;\n}\n\nlet initDone = false;\nexport function getConfig() {\n if (!initDone) {\n initTestEnvironment();\n initDone = true;\n }\n return ensureNotFalsy(config, 'testConfig not set')\n}\n\n\ndeclare const Deno: any;\nfunction getEnvVariables() {\n if (isDeno) {\n const ret: any = {};\n [\n 'DEFAULT_STORAGE',\n 'NODE_ENV'\n ].forEach(k => {\n ret[k] = Deno.env.get(k);\n });\n return ret;\n }\n\n return isBun || isNode ? process.env : (window as any).__karma__.config.env;\n}\nexport const ENV_VARIABLES = getEnvVariables();\nexport const DEFAULT_STORAGE = ENV_VARIABLES.DEFAULT_STORAGE as string;\n\nexport function isFastMode(): boolean {\n try {\n return ENV_VARIABLES.NODE_ENV === 'fast';\n } catch (err) {\n return false;\n }\n}\n\nexport function initTestEnvironment() {\n if (ENV_VARIABLES.NODE_ENV === 'fast') {\n broadcastChannelEnforceOptions({\n type: 'simulate'\n });\n }\n\n /**\n * Overwrite the console for easier debugging\n */\n const oldConsoleLog = console.log.bind(console);\n const oldConsoleDir = console.dir.bind(console);\n function newLog(this: typeof console, value: any) {\n if (isPromise(value)) {\n oldConsoleDir(value);\n throw new Error('cannot log Promise(), you should await it first');\n }\n if (typeof value === 'string' || typeof value === 'number') {\n oldConsoleLog(value);\n return;\n }\n try {\n JSON.stringify(value);\n oldConsoleLog(JSON.stringify(value, null, 4));\n } catch (err) {\n oldConsoleDir(value);\n }\n }\n console.log = newLog.bind(console);\n console.dir = newLog.bind(console);\n\n console.log('DEFAULT_STORAGE: ' + DEFAULT_STORAGE);\n\n if (isNode) {\n process.setMaxListeners(100);\n\n events.EventEmitter.defaultMaxListeners = 100;\n\n /**\n * Add a global function to process, so we can debug timings\n */\n (process as any).startTime = performance.now();\n (process as any).logTime = (msg: string = '') => {\n const diff = performance.now() - (process as any).startTime;\n console.log('process logTime(' + msg + ') ' + diff + 'ms');\n };\n }\n}\n\nexport function getEncryptedStorage(baseStorage = getConfig().storage.getStorage()): RxStorage {\n const ret = config.storage.hasEncryption ?\n baseStorage :\n wrappedKeyEncryptionCryptoJsStorage({\n storage: baseStorage\n });\n return ret;\n}\n\nexport function isNotOneOfTheseStorages(storageNames: string[]) {\n const isName = getConfig().storage.name;\n if (storageNames.includes(isName)) {\n return false;\n } else {\n return true;\n }\n}\n\n\nexport function getPassword(): Promise {\n if (getConfig().storage.hasEncryption) {\n return ensureNotFalsy(getConfig().storage.hasEncryption)();\n } else {\n return Promise.resolve('test-password-' + randomCouchString(10));\n }\n}\n"],"mappings":"AAAA;AACA,SACIA,cAAc,EACdC,SAAS,EACTC,iBAAiB,QACd,mBAAmB;AAC1B,SACIC,cAAc,IAAIC,8BAA8B,QAC7C,mBAAmB;AAC1B,OAAOC,MAAM,MAAM,aAAa;AAIhC,SAASC,mCAAmC,QAAQ,kCAAkC;AAMtF,OAAO,IAAMC,MAAM,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAI,MAAM,IAAIA,MAAM;AACvE,OAAO,IAAMC,KAAK,GAAG,OAAOC,OAAO,KAAK,WAAW,IAAI,CAAC,CAACA,OAAO,CAACC,QAAQ,CAACC,GAAG;AAC7E,OAAO,IAAMC,MAAM,GAAG,CAACN,MAAM,IAAI,CAACE,KAAK,IAAI,OAAOD,MAAM,KAAK,WAAW;AAExE,IAAIM,MAAkB;AAEtB,OAAO,SAASC,SAASA,CAACC,SAAqB,EAAE;EAC7CF,MAAM,GAAGE,SAAS;AACtB;AAEA,IAAIC,QAAQ,GAAG,KAAK;AACpB,OAAO,SAASC,SAASA,CAAA,EAAG;EACxB,IAAI,CAACD,QAAQ,EAAE;IACXE,mBAAmB,CAAC,CAAC;IACrBF,QAAQ,GAAG,IAAI;EACnB;EACA,OAAOjB,cAAc,CAACc,MAAM,EAAE,oBAAoB,CAAC;AACvD;AAIA,SAASM,eAAeA,CAAA,EAAG;EACvB,IAAIb,MAAM,EAAE;IACR,IAAMc,GAAQ,GAAG,CAAC,CAAC;IACnB,CACI,iBAAiB,EACjB,UAAU,CACb,CAACC,OAAO,CAACC,CAAC,IAAI;MACXF,GAAG,CAACE,CAAC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACC,GAAG,CAACH,CAAC,CAAC;IAC5B,CAAC,CAAC;IACF,OAAOF,GAAG;EACd;EAEA,OAAOZ,KAAK,IAAII,MAAM,GAAGH,OAAO,CAACe,GAAG,GAAIjB,MAAM,CAASmB,SAAS,CAACb,MAAM,CAACW,GAAG;AAC/E;AACA,OAAO,IAAMG,aAAa,GAAGR,eAAe,CAAC,CAAC;AAC9C,OAAO,IAAMS,eAAe,GAAGD,aAAa,CAACC,eAAyB;AAEtE,OAAO,SAASC,UAAUA,CAAA,EAAY;EAClC,IAAI;IACA,OAAOF,aAAa,CAACG,QAAQ,KAAK,MAAM;EAC5C,CAAC,CAAC,OAAOC,GAAG,EAAE;IACV,OAAO,KAAK;EAChB;AACJ;AAEA,OAAO,SAASb,mBAAmBA,CAAA,EAAG;EAClC,IAAIS,aAAa,CAACG,QAAQ,KAAK,MAAM,EAAE;IACnC3B,8BAA8B,CAAC;MAC3B6B,IAAI,EAAE;IACV,CAAC,CAAC;EACN;;EAEA;AACJ;AACA;EACI,IAAMC,aAAa,GAAGC,OAAO,CAACC,GAAG,CAACC,IAAI,CAACF,OAAO,CAAC;EAC/C,IAAMG,aAAa,GAAGH,OAAO,CAACI,GAAG,CAACF,IAAI,CAACF,OAAO,CAAC;EAC/C,SAASK,MAAMA,CAAuBC,KAAU,EAAE;IAC9C,IAAIxC,SAAS,CAACwC,KAAK,CAAC,EAAE;MAClBH,aAAa,CAACG,KAAK,CAAC;MACpB,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC;IACtE;IACA,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MACxDP,aAAa,CAACO,KAAK,CAAC;MACpB;IACJ;IACA,IAAI;MACAE,IAAI,CAACC,SAAS,CAACH,KAAK,CAAC;MACrBP,aAAa,CAACS,IAAI,CAACC,SAAS,CAACH,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,OAAOT,GAAG,EAAE;MACVM,aAAa,CAACG,KAAK,CAAC;IACxB;EACJ;EACAN,OAAO,CAACC,GAAG,GAAGI,MAAM,CAACH,IAAI,CAACF,OAAO,CAAC;EAClCA,OAAO,CAACI,GAAG,GAAGC,MAAM,CAACH,IAAI,CAACF,OAAO,CAAC;EAElCA,OAAO,CAACC,GAAG,CAAC,mBAAmB,GAAGP,eAAe,CAAC;EAElD,IAAIhB,MAAM,EAAE;IACRH,OAAO,CAACmC,eAAe,CAAC,GAAG,CAAC;IAE5BxC,MAAM,CAACyC,YAAY,CAACC,mBAAmB,GAAG,GAAG;;IAE7C;AACR;AACA;IACSrC,OAAO,CAASsC,SAAS,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;IAC7CxC,OAAO,CAASyC,OAAO,GAAG,CAACC,GAAW,GAAG,EAAE,KAAK;MAC7C,IAAMC,IAAI,GAAGJ,WAAW,CAACC,GAAG,CAAC,CAAC,GAAIxC,OAAO,CAASsC,SAAS;MAC3Db,OAAO,CAACC,GAAG,CAAC,kBAAkB,GAAGgB,GAAG,GAAG,IAAI,GAAGC,IAAI,GAAG,IAAI,CAAC;IAC9D,CAAC;EACL;AACJ;AAEA,OAAO,SAASC,mBAAmBA,CAACC,WAAW,GAAGrC,SAAS,CAAC,CAAC,CAACsC,OAAO,CAACC,UAAU,CAAC,CAAC,EAAuB;EACrG,IAAMpC,GAAG,GAAGP,MAAM,CAAC0C,OAAO,CAACE,aAAa,GACpCH,WAAW,GACXjD,mCAAmC,CAAC;IAChCkD,OAAO,EAAED;EACb,CAAC,CAAC;EACN,OAAOlC,GAAG;AACd;AAEA,OAAO,SAASsC,uBAAuBA,CAACC,YAAsB,EAAE;EAC5D,IAAMC,MAAM,GAAG3C,SAAS,CAAC,CAAC,CAACsC,OAAO,CAACM,IAAI;EACvC,IAAIF,YAAY,CAACG,QAAQ,CAACF,MAAM,CAAC,EAAE;IAC/B,OAAO,KAAK;EAChB,CAAC,MAAM;IACH,OAAO,IAAI;EACf;AACJ;AAGA,OAAO,SAASG,WAAWA,CAAA,EAAoB;EAC3C,IAAI9C,SAAS,CAAC,CAAC,CAACsC,OAAO,CAACE,aAAa,EAAE;IACnC,OAAO1D,cAAc,CAACkB,SAAS,CAAC,CAAC,CAACsC,OAAO,CAACE,aAAa,CAAC,CAAC,CAAC;EAC9D,CAAC,MAAM;IACH,OAAOO,OAAO,CAACC,OAAO,CAAC,gBAAgB,GAAGhE,iBAAiB,CAAC,EAAE,CAAC,CAAC;EACpE;AACJ"} \ No newline at end of file diff --git a/dist/esm/plugins/utils/utils-rxdb-version.js b/dist/esm/plugins/utils/utils-rxdb-version.js index 2f81dbb8fea..aec9c9746b1 100644 --- a/dist/esm/plugins/utils/utils-rxdb-version.js +++ b/dist/esm/plugins/utils/utils-rxdb-version.js @@ -1,5 +1,5 @@ /** * This file is replaced in the 'npm run build:version' script. */ -export var RXDB_VERSION = '15.4.1'; +export var RXDB_VERSION = '15.4.2'; //# sourceMappingURL=utils-rxdb-version.js.map \ No newline at end of file diff --git a/dist/esm/plugins/utils/utils-rxdb-version.js.map b/dist/esm/plugins/utils/utils-rxdb-version.js.map index 295c28e9626..7e431ba22e6 100644 --- a/dist/esm/plugins/utils/utils-rxdb-version.js.map +++ b/dist/esm/plugins/utils/utils-rxdb-version.js.map @@ -1 +1 @@ -{"version":3,"file":"utils-rxdb-version.js","names":["RXDB_VERSION"],"sources":["../../../../src/plugins/utils/utils-rxdb-version.ts"],"sourcesContent":["/**\n * This file is replaced in the 'npm run build:version' script.\n */\nexport const RXDB_VERSION = '15.4.1';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,IAAMA,YAAY,GAAG,QAAQ"} \ No newline at end of file +{"version":3,"file":"utils-rxdb-version.js","names":["RXDB_VERSION"],"sources":["../../../../src/plugins/utils/utils-rxdb-version.ts"],"sourcesContent":["/**\n * This file is replaced in the 'npm run build:version' script.\n */\nexport const RXDB_VERSION = '15.4.2';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,IAAMA,YAAY,GAAG,QAAQ"} \ No newline at end of file diff --git a/dist/types/plugins/storage-denokv/index.d.ts b/dist/types/plugins/storage-denokv/index.d.ts index dc1c653669f..c22e03ccdd6 100644 --- a/dist/types/plugins/storage-denokv/index.d.ts +++ b/dist/types/plugins/storage-denokv/index.d.ts @@ -4,7 +4,7 @@ import { RxStorageInstanceDenoKV } from "./rx-storage-instance-denokv.ts"; export declare class RxStorageDenoKV implements RxStorage, DenoKVSettings> { settings: DenoKVSettings; name: string; - readonly rxdbVersion = "15.4.1"; + readonly rxdbVersion = "15.4.2"; constructor(settings: DenoKVSettings); createStorageInstance(params: RxStorageInstanceCreationParams): Promise>; } diff --git a/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts b/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts index b2f68fe6946..610d1293b12 100644 --- a/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts +++ b/dist/types/plugins/storage-dexie/rx-storage-dexie.d.ts @@ -4,7 +4,7 @@ import { RxStorageInstanceDexie } from './rx-storage-instance-dexie.ts'; export declare class RxStorageDexie implements RxStorage { settings: DexieSettings; name: string; - readonly rxdbVersion = "15.4.1"; + readonly rxdbVersion = "15.4.2"; constructor(settings: DexieSettings); createStorageInstance(params: RxStorageInstanceCreationParams): Promise>; } diff --git a/dist/types/plugins/storage-lokijs/rx-storage-lokijs.d.ts b/dist/types/plugins/storage-lokijs/rx-storage-lokijs.d.ts index da6b0d77cdb..71e569aad15 100644 --- a/dist/types/plugins/storage-lokijs/rx-storage-lokijs.d.ts +++ b/dist/types/plugins/storage-lokijs/rx-storage-lokijs.d.ts @@ -4,7 +4,7 @@ import type { LeaderElector } from 'broadcast-channel'; export declare class RxStorageLoki implements RxStorage { databaseSettings: LokiDatabaseSettings; name: string; - readonly rxdbVersion = "15.4.1"; + readonly rxdbVersion = "15.4.2"; /** * Create one leader elector by db name. * This is done inside of the storage, not globally diff --git a/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts b/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts index d443c9f012c..9e80b901cf5 100644 --- a/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts +++ b/dist/types/plugins/storage-mongodb/rx-storage-mongodb.d.ts @@ -4,7 +4,7 @@ import { RxStorageInstanceMongoDB } from './rx-storage-instance-mongodb.ts'; export declare class RxStorageMongoDB implements RxStorage { databaseSettings: MongoDBDatabaseSettings; name: string; - readonly rxdbVersion = "15.4.1"; + readonly rxdbVersion = "15.4.2"; constructor(databaseSettings: MongoDBDatabaseSettings); createStorageInstance(params: RxStorageInstanceCreationParams): Promise>; } diff --git a/dist/types/plugins/storage-remote/rx-storage-remote.d.ts b/dist/types/plugins/storage-remote/rx-storage-remote.d.ts index 5a5fd9cd560..07a853a7062 100644 --- a/dist/types/plugins/storage-remote/rx-storage-remote.d.ts +++ b/dist/types/plugins/storage-remote/rx-storage-remote.d.ts @@ -4,7 +4,7 @@ import type { MessageFromRemote, RemoteMessageChannel, RxStorageRemoteInternals, export declare class RxStorageRemote implements RxStorage { readonly settings: RxStorageRemoteSettings; readonly name: string; - readonly rxdbVersion = "15.4.1"; + readonly rxdbVersion = "15.4.2"; private seed; private lastRequestId; messageChannelIfOneMode?: Promise; diff --git a/dist/types/plugins/test-utils/config.d.ts b/dist/types/plugins/test-utils/config.d.ts index e7e7b412ab1..cc999f36936 100644 --- a/dist/types/plugins/test-utils/config.d.ts +++ b/dist/types/plugins/test-utils/config.d.ts @@ -11,7 +11,6 @@ export declare function getConfig(): TestConfig; export declare const ENV_VARIABLES: any; export declare const DEFAULT_STORAGE: string; export declare function isFastMode(): boolean; -export declare function getRootPath(): string; export declare function initTestEnvironment(): void; export declare function getEncryptedStorage(baseStorage?: RxStorage): RxStorage; export declare function isNotOneOfTheseStorages(storageNames: string[]): boolean; diff --git a/dist/types/plugins/utils/utils-rxdb-version.d.ts b/dist/types/plugins/utils/utils-rxdb-version.d.ts index ed3ff250a01..0b8e9175a59 100644 --- a/dist/types/plugins/utils/utils-rxdb-version.d.ts +++ b/dist/types/plugins/utils/utils-rxdb-version.d.ts @@ -1,4 +1,4 @@ /** * This file is replaced in the 'npm run build:version' script. */ -export declare const RXDB_VERSION = "15.4.1"; +export declare const RXDB_VERSION = "15.4.2"; diff --git a/dist/types/rx-database.d.ts b/dist/types/rx-database.d.ts index 33a6af695a2..55941e9766b 100644 --- a/dist/types/rx-database.d.ts +++ b/dist/types/rx-database.d.ts @@ -27,7 +27,7 @@ export declare class RxDatabaseBase | undefined; readonly allowSlowCount?: boolean | undefined; readonly idleQueue: IdleQueue; - readonly rxdbVersion = "15.4.1"; + readonly rxdbVersion = "15.4.2"; /** * Contains all known non-closed storage instances * that belong to this database. diff --git a/docs/404.html b/docs/404.html index 154a8c5c7ef..1acb15c09b0 100644 --- a/docs/404.html +++ b/docs/404.html @@ -11,8 +11,8 @@ - - + +

RxDB
404 Page Not Found

The page you are looking for does not exist anymore or never has existed. If you have found this page through a link, you should tell the link author to update it.

Maybe one of these can help you to find the desired content:

diff --git a/docs/adapters.html b/docs/adapters.html index 672ab3aa93e..f12527edd5f 100644 --- a/docs/adapters.html +++ b/docs/adapters.html @@ -11,8 +11,8 @@ - - + +

PouchDB Adapters

diff --git a/docs/alternatives.html b/docs/alternatives.html index 9dc49307480..c956e0f5c47 100644 --- a/docs/alternatives.html +++ b/docs/alternatives.html @@ -11,8 +11,8 @@ - - + +

Alternatives for realtime offline-first JavaScript applications

diff --git a/docs/articles/angular-database.html b/docs/articles/angular-database.html index 0d78fd0df8f..441210a0d03 100644 --- a/docs/articles/angular-database.html +++ b/docs/articles/angular-database.html @@ -11,8 +11,8 @@ - - + +

RxDB as a Database in an Angular Application

diff --git a/docs/articles/browser-database.html b/docs/articles/browser-database.html index 5829ca05d2f..ae19ab5d8d2 100644 --- a/docs/articles/browser-database.html +++ b/docs/articles/browser-database.html @@ -11,8 +11,8 @@ - - + +

RxDB: The benefits of Browser Databases

diff --git a/docs/articles/browser-storage.html b/docs/articles/browser-storage.html index 0bf4d688e61..b2d7892d285 100644 --- a/docs/articles/browser-storage.html +++ b/docs/articles/browser-storage.html @@ -11,8 +11,8 @@ - - + +

Browser Storage - RxDB as a Database for Browsers

diff --git a/docs/articles/data-base.html b/docs/articles/data-base.html index d1d8c7c6245..48a1c0b9468 100644 --- a/docs/articles/data-base.html +++ b/docs/articles/data-base.html @@ -11,8 +11,8 @@ - - + +

RxDB as a data base: Empowering Web Applications with Reactive Data Handling

diff --git a/docs/articles/embedded-database.html b/docs/articles/embedded-database.html index 0ab7d8a8c2a..17708fc269e 100644 --- a/docs/articles/embedded-database.html +++ b/docs/articles/embedded-database.html @@ -11,8 +11,8 @@ - - + +

Using RxDB as an Embedded Database

diff --git a/docs/articles/flutter-database.html b/docs/articles/flutter-database.html index 26bebc989f6..5f6228f7037 100644 --- a/docs/articles/flutter-database.html +++ b/docs/articles/flutter-database.html @@ -11,8 +11,8 @@ - - + +

RxDB as a Database in a Flutter Application

diff --git a/docs/articles/frontend-database.html b/docs/articles/frontend-database.html index ff39d667dba..b8234998400 100644 --- a/docs/articles/frontend-database.html +++ b/docs/articles/frontend-database.html @@ -11,8 +11,8 @@ - - + +

RxDB JavaScript Frontend Database: Efficient Data Storage in Frontend Applications

diff --git a/docs/articles/in-memory-nosql-database.html b/docs/articles/in-memory-nosql-database.html index dd987be6ba9..aaea65b8c53 100644 --- a/docs/articles/in-memory-nosql-database.html +++ b/docs/articles/in-memory-nosql-database.html @@ -11,8 +11,8 @@ - - + +

RxDB as In-memory NoSQL Database: Empowering Real-Time Applications

diff --git a/docs/articles/ionic-database.html b/docs/articles/ionic-database.html index 81f45c71d63..0d67a47666d 100644 --- a/docs/articles/ionic-database.html +++ b/docs/articles/ionic-database.html @@ -11,8 +11,8 @@ - - + +

Ionic Storage - RxDB as database for hybrid apps

diff --git a/docs/articles/json-database.html b/docs/articles/json-database.html index 38e47dbb0ac..102d19f915c 100644 --- a/docs/articles/json-database.html +++ b/docs/articles/json-database.html @@ -11,8 +11,8 @@ - - + +

RxDB - JSON Database for JavaScript

diff --git a/docs/articles/localstorage.html b/docs/articles/localstorage.html index 398800cb52b..d6f3789802c 100644 --- a/docs/articles/localstorage.html +++ b/docs/articles/localstorage.html @@ -11,8 +11,8 @@ - - + +

Using localStorage in Modern Applications: A Comprehensive Guide

diff --git a/docs/articles/mobile-database.html b/docs/articles/mobile-database.html index 6c44a7ad894..dbab2caad06 100644 --- a/docs/articles/mobile-database.html +++ b/docs/articles/mobile-database.html @@ -11,8 +11,8 @@ - - + +

Mobile Database - RxDB as Database for Mobile Applications

diff --git a/docs/articles/progressive-web-app-database.html b/docs/articles/progressive-web-app-database.html index 9c81bea3777..de683b652c4 100644 --- a/docs/articles/progressive-web-app-database.html +++ b/docs/articles/progressive-web-app-database.html @@ -11,8 +11,8 @@ - - + +

RxDB as a Database for Progressive Web Apps (PWA)

diff --git a/docs/articles/react-database.html b/docs/articles/react-database.html index f75e76c16ed..1711e9a2f11 100644 --- a/docs/articles/react-database.html +++ b/docs/articles/react-database.html @@ -11,8 +11,8 @@ - - + +

RxDB as a Database for React Applications

diff --git a/docs/articles/realtime-database.html b/docs/articles/realtime-database.html index eeaa8ef5995..0cab16a7b2c 100644 --- a/docs/articles/realtime-database.html +++ b/docs/articles/realtime-database.html @@ -11,8 +11,8 @@ - - + +

What is a realtime database?

diff --git a/docs/assets/js/0e268d20.a51dda1a.js b/docs/assets/js/0e268d20.e23b606a.js similarity index 99% rename from docs/assets/js/0e268d20.a51dda1a.js rename to docs/assets/js/0e268d20.e23b606a.js index 6ad8dd76940..6bae785eaff 100644 --- a/docs/assets/js/0e268d20.a51dda1a.js +++ b/docs/assets/js/0e268d20.e23b606a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[2160],{5921:(e,t,r)=>{r.d(t,{O9:()=>Hr,N8:()=>Qr,dZ:()=>Fr});var a=r(8061);function n(e,t){var r=e.get(t);if(void 0===r)throw new Error("missing value from map "+t);return r}function i(e,t,r,a){var n=e.get(t);return void 0===n?(n=r(),e.set(t,n)):a&&a(n),n}function s(e){return Object.assign({},e)}function o(e,t){if(void 0===t&&(t=!1),!e)return e;if(!t&&Array.isArray(e))return e.sort(((e,t)=>"string"==typeof e&&"string"==typeof t?e.localeCompare(t):"object"==typeof e?1:-1)).map((e=>o(e,t)));if("object"==typeof e&&!Array.isArray(e)){var r={};return Object.keys(e).sort(((e,t)=>e.localeCompare(t))).forEach((a=>{r[a]=o(e[a],t)})),r}return e}var c=function e(t){if(!t)return t;if(null===t||"object"!=typeof t)return t;if(Array.isArray(t)){for(var r=new Array(t.length),a=r.length;a--;)r[a]=e(t[a]);return r}var n={};for(var i in t)n[i]=e(t[i]);return n};function l(e,t,r){return Object.defineProperty(e,t,{get:function(){return r}}),r}var u=e=>{var t=typeof e;return null!==e&&("object"===t||"function"===t)},h=new Set(["__proto__","prototype","constructor"]),d=new Set("0123456789");function m(e){var t=[],r="",a="start",n=!1;for(var i of e)switch(i){case"\\":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a)throw new Error("Invalid character after an index");n&&(r+=i),a="property",n=!n;break;case".":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a){a="property";break}if(n){n=!1,r+=i;break}if(h.has(r))return[];t.push(r),r="",a="property";break;case"[":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a){a="index";break}if(n){n=!1,r+=i;break}if("property"===a){if(h.has(r))return[];t.push(r),r=""}a="index";break;case"]":if("index"===a){t.push(Number.parseInt(r,10)),r="",a="indexEnd";break}if("indexEnd"===a)throw new Error("Invalid character after an index");default:if("index"===a&&!d.has(i))throw new Error("Invalid character in an index");if("indexEnd"===a)throw new Error("Invalid character after an index");"start"===a&&(a="property"),n&&(n=!1,r+="\\"),r+=i}switch(n&&(r+="\\"),a){case"property":if(h.has(r))return[];t.push(r);break;case"index":throw new Error("Index was not closed");case"start":t.push("")}return t}function p(e,t){if("number"!=typeof t&&Array.isArray(e)){var r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function f(e,t){if(p(e,t))throw new Error("Cannot use string index")}function y(e,t,r){if(Array.isArray(t)&&(t=t.join(".")),!t.includes(".")&&!t.includes("["))return e[t];if(!u(e)||"string"!=typeof t)return void 0===r?e:r;var a=m(t);if(0===a.length)return r;for(var n=0;n!1,deepFreezeWhenDevMode:e=>e,tunnelErrorMessage:e=>"RxDB Error-Code "+e+".\n Error messages are not included in RxDB core to reduce build size.\n - To find out what this error means, either use the dev-mode-plugin https://rxdb.info/dev-mode.html\n - or search for the error code here: https://github.com/pubkey/rxdb/search?q="+e+"\n "};function k(e,t,r){return"RxError ("+t+"):\n"+e+"\n"+function(e){var t="";return 0===Object.keys(e).length?t:(t+="Given parameters: {\n",t+=Object.keys(e).map((t=>{var r="[object Object]";try{r="errors"===t?e[t].map((e=>JSON.stringify(e,Object.getOwnPropertyNames(e)))):JSON.stringify(e[t],(function(e,t){return void 0===t?null:t}),2)}catch(a){}return t+":"+r})).join("\n"),t+="}")}(r)}var D=function(e){function t(t,r,a){var n;void 0===a&&(a={});var i=k(r,t,a);return(n=e.call(this,i)||this).code=t,n.message=i,n.parameters=a,n.rxdb=!0,n}return(0,x.Z)(t,e),t.prototype.toString=function(){return this.message},(0,b.Z)(t,[{key:"name",get:function(){return"RxError ("+this.code+")"}},{key:"typeError",get:function(){return!1}}]),t}((0,w.Z)(Error)),_=function(e){function t(t,r,a){var n;void 0===a&&(a={});var i=k(r,t,a);return(n=e.call(this,i)||this).code=t,n.message=i,n.parameters=a,n.rxdb=!0,n}return(0,x.Z)(t,e),t.prototype.toString=function(){return this.message},(0,b.Z)(t,[{key:"name",get:function(){return"RxTypeError ("+this.code+")"}},{key:"typeError",get:function(){return!0}}]),t}((0,w.Z)(TypeError));function I(e,t){return new D(e,j.tunnelErrorMessage(e),t)}function R(e,t){return new _(e,j.tunnelErrorMessage(e),t)}function E(e){return!(!e||409!==e.status)&&e}var P={409:"document write conflict",422:"schema validation error",510:"attachment data missing"};var S=/\./g,C="abcdefghijklmnopqrstuvwxyz";function O(e){void 0===e&&(e=10);for(var t="",r=0;r{var r=y(t,e);if(void 0===r)throw I("DOC18",{args:{field:e,documentData:t}});return r})).join(r.separator)}function W(e){var t=T((e=s(e)).primaryKey);e.properties=s(e.properties),e.additionalProperties=!1,Object.prototype.hasOwnProperty.call(e,"keyCompression")||(e.keyCompression=!1),e.indexes=e.indexes?e.indexes.slice(0):[],e.required=e.required?e.required.slice(0):[],e.encrypted=e.encrypted?e.encrypted.slice(0):[],e.properties._rev={type:"string",minLength:1},e.properties._attachments={type:"object"},e.properties._deleted={type:"boolean"},e.properties._meta=z,e.required=e.required?e.required.slice(0):[],e.required.push("_deleted"),e.required.push("_rev"),e.required.push("_meta"),e.required.push("_attachments");var r=F(e);(0,g.gu)(e.required,r),e.required=e.required.filter((e=>!e.includes("."))).filter(((e,t,r)=>r.indexOf(e)===t)),e.version=e.version||0;var a=e.indexes.map((e=>{var r=(0,g.AD)(e)?e.slice(0):[e];return r.includes(t)||r.push(t),"_deleted"!==r[0]&&r.unshift("_deleted"),r}));0===a.length&&a.push(function(e){return["_deleted",e]}(t)),a.push(["_meta.lwt",t]),e.internalIndexes&&e.internalIndexes.map((e=>{a.push(e)}));var n=new Set;return a.filter((e=>{var t=e.join(",");return!n.has(t)&&(n.add(t),!0)})),e.indexes=a,e}var z={type:"object",properties:{lwt:{type:"number",minimum:A,maximum:1e15,multipleOf:.01}},additionalProperties:!0,required:["lwt"]};function F(e){var t=Object.keys(e.properties).filter((t=>e.properties[t].final)),r=T(e.primaryKey);return t.push(r),"string"!=typeof e.primaryKey&&e.primaryKey.fields.forEach((e=>t.push(e))),t}var Q="docs",H="changes",U="attachments",K="dexie",Z=new Map,V=new Map;var J="__";function G(e){var t=e.split(".");if(t.length>1)return t.map((e=>G(e))).join(".");if(e.startsWith("|")){var r=e.substring(1);return J+r}return e}function Y(e){var t=e.split(".");return t.length>1?t.map((e=>Y(e))).join("."):e.startsWith(J)?"|"+e.substring(J.length):e}function X(e,t){return t?(t=te(t=s(t)),e.forEach((e=>{var r=y(t,e);v(t,e,r?"1":"0")})),t):t}function ee(e,t){return t?(t=re(t=s(t)),e.forEach((e=>{var r=y(t,e);v(t,e,"1"===r)})),t):t}function te(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>te(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((e=>{let[r,a]=e;"object"==typeof a&&(a=te(a)),t[G(r)]=a})),t}}function re(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>re(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((r=>{let[a,n]=r;("object"==typeof n||Array.isArray(e))&&(n=re(n)),t[Y(a)]=n})),t}}function ae(e){var t=[],r=T(e.primaryKey);t.push([r]),t.push(["_deleted",r]),e.indexes&&e.indexes.forEach((e=>{var r=(0,g.qo)(e);t.push(r)})),t.push(["_meta.lwt",r]),t.push(["_meta.lwt"]);var a=(t=t.map((e=>e.map((e=>G(e)))))).map((e=>1===e.length?e[0]:"["+e.join("+")+"]"));return(a=a.filter(((e,t,r)=>r.indexOf(e)===t))).join(", ")}async function ne(e,t){var r=await e;return(await r.dexieTable.bulkGet(t)).map((e=>ee(r.booleanIndexes,e)))}function ie(e,t){return e+"||"+t}function se(e){var t=new Set,r=[];return e.indexes?(e.indexes.forEach((a=>{(0,g.qo)(a).forEach((a=>{t.has(a)||(t.add(a),"boolean"===M(e,a).type&&r.push(a))}))})),r.push("_deleted"),(0,g.Nb)(r)):r}var oe=r(6974),ce=r(984),le=r(7400),ue=String.fromCharCode(65535),he=Number.MIN_SAFE_INTEGER;function de(e,t){var r=t.selector,a=e.indexes?e.indexes.slice(0):[];t.index&&(a=[t.index]);var n=!!t.sort.find((e=>"desc"===Object.values(e)[0])),i=new Set;Object.keys(r).forEach((t=>{var a=M(e,t);a&&"boolean"===a.type&&Object.prototype.hasOwnProperty.call(r[t],"$eq")&&i.add(t)}));var s,o=t.sort.map((e=>Object.keys(e)[0])).filter((e=>!i.has(e))).join(","),c=-1;if(a.forEach((e=>{var a=!0,l=!0,u=e.map((e=>{var t=r[e],n=t?Object.keys(t):[],i={};t&&n.length?n.forEach((e=>{if(me.has(e)){var r=function(e,t){switch(e){case"$eq":return{startKey:t,endKey:t,inclusiveEnd:!0,inclusiveStart:!0};case"$lte":return{endKey:t,inclusiveEnd:!0};case"$gte":return{startKey:t,inclusiveStart:!0};case"$lt":return{endKey:t,inclusiveEnd:!1};case"$gt":return{startKey:t,inclusiveStart:!1};default:throw new Error("SNH")}}(e,t[e]);i=Object.assign(i,r)}})):i={startKey:l?he:ue,endKey:a?ue:he,inclusiveStart:!0,inclusiveEnd:!0};return void 0===i.startKey&&(i.startKey=he),void 0===i.endKey&&(i.endKey=ue),void 0===i.inclusiveStart&&(i.inclusiveStart=!0),void 0===i.inclusiveEnd&&(i.inclusiveEnd=!0),l&&!i.inclusiveStart&&(l=!1),a&&!i.inclusiveEnd&&(a=!1),i})),h=u.map((e=>e.startKey)),d=u.map((e=>e.endKey)),m={index:e,startKeys:h,endKeys:d,inclusiveEnd:a,inclusiveStart:l,sortSatisfiedByIndex:!n&&o===e.filter((e=>!i.has(e))).join(","),selectorSatisfiedByIndex:ye(e,t.selector,h,d)},p=function(e,t,r){var a=0,n=e=>{e>0&&(a+=e)},i=10,s=(0,g.r0)(r.startKeys,(e=>e!==he&&e!==ue));n(s*i);var o=(0,g.r0)(r.startKeys,(e=>e!==ue&&e!==he));n(o*i);var c=(0,g.r0)(r.startKeys,((e,t)=>e===r.endKeys[t]));n(c*i*1.5);var l=r.sortSatisfiedByIndex?5:0;return n(l),a}(0,0,m);(p>=c||t.index)&&(c=p,s=m)})),!s)throw I("SNH",{query:t});return s}var me=new Set(["$eq","$gt","$gte","$lt","$lte"]),pe=new Set(["$eq","$gt","$gte"]),fe=new Set(["$eq","$lt","$lte"]);function ye(e,t,r,a){var n=Object.entries(t).find((t=>{let[r,a]=t;return!e.includes(r)||Object.entries(a).find((e=>{let[t,r]=e;return!me.has(t)}))}));if(n)return!1;if(t.$and||t.$or)return!1;var i=[],s=new Set;for(var[o,c]of Object.entries(t)){if(!e.includes(o))return!1;var l=Object.keys(c).filter((e=>pe.has(e)));if(l.length>1)return!1;var u=l[0];if(u&&s.add(o),"$eq"!==u){if(i.length>0)return!1;i.push(u)}}var h=[],d=new Set;for(var[m,p]of Object.entries(t)){if(!e.includes(m))return!1;var f=Object.keys(p).filter((e=>fe.has(e)));if(f.length>1)return!1;var y=f[0];if(y&&d.add(m),"$eq"!==y){if(h.length>0)return!1;h.push(y)}}var v=0;for(var g of e){for(var b of[s,d]){if(!b.has(g)&&b.size>0)return!1;b.delete(g)}if(r[v]!==a[v]&&s.size>0&&d.size>0)return!1;v++}return!0}var ve=r(6250),ge=r(7761),be=r(7132),xe=r(6496),we=r(6851),je=r(3516),ke=r(8039),De=r(5308),_e=r(2106),Ie=!1;function Re(e){return Ie||((0,ge.Qs)(ge.$M.PIPELINE,{$sort:xe.E3,$project:xe.FM}),(0,ge.Qs)(ge.$M.QUERY,{$and:we.h$,$eq:je.l3,$elemMatch:De.rr,$exists:_e.G,$gt:je.ok,$gte:je.m9,$in:je.FI,$lt:je.Ty,$lte:je.HG,$ne:je.ny,$nin:je.IS,$mod:ke.JD,$nor:we.ps,$not:we._w,$or:we.Ko,$regex:ke.GO,$size:De.QH,$type:_e.e}),Ie=!0),new be.A(e)}function Ee(e,t){var r=T(e.primaryKey);t=s(t);var a=c(t);if("number"!=typeof a.skip&&(a.skip=0),a.selector?(a.selector=a.selector,Object.entries(a.selector).forEach((e=>{let[t,r]=e;"object"==typeof r&&null!==r||(a.selector[t]={$eq:r})}))):a.selector={},a.index){var n=(0,g.qo)(a.index);n.includes(r)||n.push(r),a.index=n}if(a.sort)a.sort.find((e=>{return t=e,Object.keys(t)[0]===r;var t}))||(a.sort=a.sort.slice(0),a.sort.push({[r]:"asc"}));else if(a.index)a.sort=a.index.map((e=>({[e]:"asc"})));else{if(e.indexes){var i=new Set;Object.entries(a.selector).forEach((e=>{let[t,r]=e;("object"!=typeof r||null===r||!!Object.keys(r).find((e=>me.has(e))))&&i.add(t)}));var o,l=-1;e.indexes.forEach((e=>{var t=(0,g.AD)(e)?e:[e],r=t.findIndex((e=>!i.has(e)));r>0&&r>l&&(l=r,o=t)})),o&&(a.sort=o.map((e=>({[e]:"asc"}))))}a.sort||(a.sort=[{[r]:"asc"}])}return a}function Pe(e,t){if(!t.sort)throw I("SNH",{query:t});var r=[];t.sort.forEach((e=>{var t,a,n,i=Object.keys(e)[0],s=Object.values(e)[0];r.push({key:i,direction:s,getValueFn:(t=i,a=t.split("."),n=a.length,1===n?e=>e[t]:e=>{for(var t=e,r=0;r{for(var a=0;ar.test(e)}function Ce(e){return e===he?-1/0:e}function Oe(e,t,r){return e.includes(t)?r===ue||!0===r?"1":"0":r}function Ne(e,t,r){if(!r){if("undefined"==typeof window)throw new Error("IDBKeyRange missing");r=window.IDBKeyRange}var a=t.startKeys.map(((r,a)=>{var n=t.index[a];return Oe(e,n,r)})).map(Ce),n=t.endKeys.map(((r,a)=>{var n=t.index[a];return Oe(e,n,r)})).map(Ce);return r.bound(a,n,!t.inclusiveStart,!t.inclusiveEnd)}async function Be(e,t){var r=await e.internals,a=t.query,n=a.skip?a.skip:0,i=n+(a.limit?a.limit:1/0),s=t.queryPlan,o=!1;s.selectorSatisfiedByIndex||(o=Se(e.schema,t.query));var c=Ne(r.booleanIndexes,s,r.dexieDb._options.IDBKeyRange),l=s.index,u=[];if(await r.dexieDb.transaction("r",r.dexieTable,(async e=>{var t,a=e.idbtrans.objectStore(Q);t="["+l.map((e=>G(e))).join("+")+"]";var n=a.index(t).openCursor(c);await new Promise((e=>{n.onsuccess=function(t){var a=t.target.result;if(a){var n=ee(r.booleanIndexes,a.value);o&&!o(n)||u.push(n),s.sortSatisfiedByIndex&&u.length===i?e():a.continue()}else e()}}))})),!s.sortSatisfiedByIndex){var h=Pe(e.schema,t.query);u=u.sort(h)}return{documents:u=u.slice(n,i)}}function Ae(e){var t=e.split("-");if(2!==t.length)throw new Error("malformatted revision: "+e);return{height:parseInt(t[0],10),hash:t[1]}}function qe(e){return parseInt(e.split("-")[0],10)}function Me(e,t){var r=t?t._rev:null;return(r?Ae(r).height:0)+1+"-"+e}var $e="_rxdb_internal";async function Te(e,t){var r=(await e.findDocumentsById([t],!1))[0];return r||void 0}async function Le(e,t,r){var a=await e.bulkWrite([t],r);if(a.error.length>0)throw a.error[0];return a.success[0]}function We(e,t,r){var a=t.documentData,n=t.previousDocumentData;return{documentId:t.documentId,collectionName:r?r.name:void 0,isLocal:e,operation:t.operation,documentData:j.deepFreezeWhenDevMode(a),previousDocumentData:j.deepFreezeWhenDevMode(n)}}function ze(e,t,r,a){if(a)throw 409===a.status?I("CONFLICT",{collection:e.name,id:t,writeError:a,data:r}):422===a.status?I("VD2",{collection:e.name,id:t,writeError:a,data:r}):a}function Fe(e){return{previous:e.previous,document:Qe(e.document)}}function Qe(e){if(!e._attachments||0===Object.keys(e._attachments).length)return e;var t=s(e);return t._attachments={},Object.entries(e._attachments).forEach((e=>{let[r,a]=e;var n,i,s;t._attachments[r]=(s=(n=a).data)?{length:(i=s,atob(i).length),digest:n.digest,type:n.type}:n})),t}function He(e){var t=s(e);return t._meta=s(e._meta),t}function Ue(e,t,r){j.deepFreezeWhenDevMode(r);var a=T(r.primaryKey);var n={originalStorageInstance:t,schema:t.schema,internals:t.internals,collectionName:t.collectionName,databaseName:t.databaseName,options:t.options,bulkWrite(n,i){var o=n.map((n=>function(n){var i=s(n.document);if(i._meta=s(i._meta),j.isDevMode()){i=$(a,r,i);try{"function"==typeof structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n))}catch(o){throw I("DOC24",{collection:t.collectionName,document:n.document})}n.previous,n.previous&&Object.keys(n.previous._meta).forEach((e=>{if(!Object.prototype.hasOwnProperty.call(n.document._meta,e))throw I("SNH",{dataBefore:n.previous,dataAfter:n.document})}))}return i._meta.lwt=(0,ce.z)(),i._rev=Me(e.token,n.previous),{document:i,previous:n.previous}}(n)));return e.lockedRun((()=>t.bulkWrite(o,i))).then((r=>{var a={error:[],success:r.success.slice(0)},n=r.error.filter((e=>!(409!==e.status||e.writeRow.previous||e.writeRow.document._deleted||!(0,le.Is)(e.documentInDb)._deleted)||(a.error.push(e),!1)));if(n.length>0){var s=n.map((t=>({previous:t.documentInDb,document:Object.assign({},t.writeRow.document,{_rev:Me(e.token,t.documentInDb)})})));return e.lockedRun((()=>t.bulkWrite(s,i))).then((e=>((0,g.gu)(a.error,e.error),(0,g.gu)(a.success,e.success),a)))}return r}))},query:r=>e.lockedRun((()=>t.query(r))),count:r=>e.lockedRun((()=>t.count(r))),findDocumentsById:(r,a)=>e.lockedRun((()=>t.findDocumentsById(r,a))),getAttachmentData:(r,a,n)=>e.lockedRun((()=>t.getAttachmentData(r,a,n))),getChangedDocumentsSince:t.getChangedDocumentsSince?(r,a)=>e.lockedRun((()=>t.getChangedDocumentsSince((0,le.Is)(r),a))):void 0,cleanup:r=>e.lockedRun((()=>t.cleanup(r))),remove:()=>(e.storageInstances.delete(n),e.lockedRun((()=>t.remove()))),close:()=>(e.storageInstances.delete(n),e.lockedRun((()=>t.close()))),changeStream:()=>t.changeStream(),conflictResultionTasks:()=>t.conflictResultionTasks(),resolveConflictResultionTask(e){if(e.output.isEqual)return t.resolveConflictResultionTask(e);var r=s(Object.assign({},e.output.documentData,{_meta:q(),_rev:"",_attachments:{}}));return delete r._meta,delete r._rev,delete r._attachments,t.resolveConflictResultionTask({id:e.id,output:{isEqual:!1,documentData:r}})}};return e.storageInstances.add(n),n}var Ke=r(5677),Ze=r(3981),Ve=new Map;function Je(e,t){var r=Ve.get(e);if(r)return r.refs.delete(t),0===r.refs.size?(Ve.delete(e),r.bc.close()):void 0}function Ge(e,t,r,a){if(t.multiInstance){var n=a||function(e,t,r,a){var n=Ve.get(t);return n||(n={bc:new Ze.g0(["RxDB:",e,r].join("|")),refs:new Set},Ve.set(t,n)),n.refs.add(a),n.bc}(e,t.databaseInstanceToken,r.databaseName,r),i=new oe.x,s=r=>{r.storageName===e&&r.databaseName===t.databaseName&&r.collectionName===t.collectionName&&r.version===t.schema.version&&i.next(r.eventBulk)};n.addEventListener("message",s);var o=r.changeStream(),c=!1,l=o.subscribe((r=>{c||n.postMessage({storageName:e,databaseName:t.databaseName,collectionName:t.collectionName,version:t.schema.version,eventBulk:r})}));r.changeStream=function(){return i.asObservable().pipe((0,Ke.b)(o))};var u=r.close.bind(r);r.close=async function(){return c=!0,l.unsubscribe(),n.removeEventListener("message",s),a||await Je(t.databaseInstanceToken,r),u()};var h=r.remove.bind(r);r.remove=async function(){return c=!0,l.unsubscribe(),n.removeEventListener("message",s),a||await Je(t.databaseInstanceToken,r),h()}}}var Ye=(0,ce.z)(),Xe=function(){function e(e,t,r,a,n,i,s){this.changes$=new oe.x,this.instanceId=Ye++,this.storage=e,this.databaseName=t,this.collectionName=r,this.schema=a,this.internals=n,this.options=i,this.settings=s,this.primaryPath=T(this.schema.primaryKey)}var t=e.prototype;return t.bulkWrite=async function(e,t){tt(this),e.forEach((e=>{if(!e.document._rev||e.previous&&!e.previous._rev)throw I("SNH",{args:{row:e}})}));var r,a=await this.internals,n={success:[],error:[]},i=e.map((e=>e.document[this.primaryPath]));if(await a.dexieDb.transaction("rw",a.dexieTable,a.dexieAttachmentsTable,(async()=>{var s=new Map;(await ne(this.internals,i)).forEach((e=>{var t=e;return t&&s.set(t[this.primaryPath],t),t})),r=function(e,t,r,a,n,i,s){for(var o,c=!!e.schema.attachments,l=[],u=[],h=[],d={id:O(10),events:[],checkpoint:null,context:n,startTime:(0,ce.z)(),endTime:0},m=d.events,p=[],f=[],y=[],v=r.size>0,g=a.length,b=function(){var e,n=a[x],d=n.document,g=n.previous,b=d[t],w=d._deleted,j=g&&g._deleted,k=void 0;if(v&&(k=r.get(b)),k){var D=k._rev;if(!g||g&&D!==g._rev){var _={isError:!0,status:409,documentId:b,writeRow:n,documentInDb:k};return h.push(_),1}var R=c?Fe(n):n;c&&(w?g&&Object.keys(g._attachments).forEach((e=>{f.push({documentId:b,attachmentId:e,digest:(0,le.Is)(g)._attachments[e].digest})})):(Object.entries(d._attachments).find((t=>{let[r,a]=t;return(g?g._attachments[r]:void 0)||a.data||(e={documentId:b,documentInDb:k,isError:!0,status:510,writeRow:n,attachmentId:r}),!0})),e||Object.entries(d._attachments).forEach((e=>{let[t,r]=e;var a=g?g._attachments[t]:void 0;if(a){var n=R.document._attachments[t].digest;r.data&&a.digest!==n&&y.push({documentId:b,attachmentId:t,attachmentData:r,digest:r.digest})}else p.push({documentId:b,attachmentId:t,attachmentData:r,digest:r.digest})})))),e?h.push(e):(c?(u.push(Fe(R)),s&&s(d)):(u.push(R),s&&s(d)),o=R);var E=null,P=null,S=null;if(j&&!w)S="INSERT",E=c?Qe(d):d;else if(!g||j||w){if(!w)throw I("SNH",{args:{writeRow:n}});S="DELETE",E=(0,le.Is)(d),P=g}else S="UPDATE",E=c?Qe(d):d,P=g;var C={documentId:b,documentData:E,previousDocumentData:P,operation:S};m.push(C)}else{var O=!!w;if(c&&Object.entries(d._attachments).forEach((t=>{let[r,a]=t;a.data?p.push({documentId:b,attachmentId:r,attachmentData:a,digest:a.digest}):(e={documentId:b,isError:!0,status:510,writeRow:n,attachmentId:r},h.push(e))})),e||(c?(l.push(Fe(n)),i&&i(d)):(l.push(n),i&&i(d)),o=n),!O){var N={documentId:b,operation:"INSERT",documentData:c?Qe(d):d,previousDocumentData:c&&g?Qe(g):g};m.push(N)}}},x=0;x{n.success.push(e.document),o.push(e.document)})),r.bulkUpdateDocs.forEach((e=>{n.success.push(e.document),o.push(e.document)})),(o=o.map((e=>X(a.booleanIndexes,e)))).length>0&&await a.dexieTable.bulkPut(o);var c=[];r.attachmentsAdd.forEach((e=>{c.push({id:ie(e.documentId,e.attachmentId),data:e.attachmentData.data})})),r.attachmentsUpdate.forEach((e=>{c.push({id:ie(e.documentId,e.attachmentId),data:e.attachmentData.data})})),await a.dexieAttachmentsTable.bulkPut(c),await a.dexieAttachmentsTable.bulkDelete(r.attachmentsRemove.map((e=>ie(e.documentId,e.attachmentId))))})),(r=(0,le.Is)(r)).eventBulk.events.length>0){var s=(0,le.Is)(r.newestRow).document;r.eventBulk.checkpoint={id:s[this.primaryPath],lwt:s._meta.lwt},r.eventBulk.endTime=(0,ce.z)(),this.changes$.next(r.eventBulk)}return n},t.findDocumentsById=async function(e,t){tt(this);var r=await this.internals,a=[];return await r.dexieDb.transaction("r",r.dexieTable,(async()=>{(await ne(this.internals,e)).forEach((e=>{!e||e._deleted&&!t||a.push(e)}))})),a},t.query=function(e){return tt(this),Be(this,e)},t.count=async function(e){if(e.queryPlan.selectorSatisfiedByIndex){var t=await async function(e,t){var r=await e.internals,a=t.queryPlan,n=a.index,i=Ne(r.booleanIndexes,a,r.dexieDb._options.IDBKeyRange),s=-1;return await r.dexieDb.transaction("r",r.dexieTable,(async e=>{var t,r=e.idbtrans.objectStore(Q);t="["+n.map((e=>G(e))).join("+")+"]";var a=r.index(t).count(i);s=await new Promise(((e,t)=>{a.onsuccess=function(){e(a.result)},a.onerror=e=>t(e)}))})),s}(this,e);return{count:t,mode:"fast"}}return{count:(await Be(this,e)).documents.length,mode:"slow"}},t.changeStream=function(){return tt(this),this.changes$.asObservable()},t.cleanup=async function(e){tt(this);var t=await this.internals;return await t.dexieDb.transaction("rw",t.dexieTable,(async()=>{var r=(0,ce.z)()-e,a=await t.dexieTable.where("_meta.lwt").below(r).toArray(),n=[];a.forEach((e=>{"1"===e._deleted&&n.push(e[this.primaryPath])})),await t.dexieTable.bulkDelete(n)})),!0},t.getAttachmentData=async function(e,t,r){tt(this);var a=await this.internals,n=ie(e,t);return await a.dexieDb.transaction("r",a.dexieAttachmentsTable,(async()=>{var r=await a.dexieAttachmentsTable.get(n);if(r)return r.data;throw new Error("attachment missing documentId: "+e+" attachmentId: "+t)}))},t.remove=async function(){tt(this);var e=await this.internals;return await e.dexieTable.clear(),this.close()},t.close=function(){return this.closed||(this.closed=(async()=>{this.changes$.complete(),await async function(e){var t=await e,r=V.get(e)-1;0===r?(t.dexieDb.close(),V.delete(e)):V.set(e,r)}(this.internals)})()),this.closed},t.conflictResultionTasks=function(){return new oe.x},t.resolveConflictResultionTask=async function(e){},e}();async function et(e,t,r){var n=function(e,t,r,n){var o="rxdb-dexie-"+e+"--"+n.version+"--"+t,c=i(Z,o,(()=>{var e=(async()=>{var e=s(r);e.autoOpen=!1;var t=new a.U(o,e),i={[Q]:ae(n),[H]:"++sequence, id",[U]:"id"};return t.version(1).stores(i),await t.open(),{dexieDb:t,dexieTable:t[Q],dexieAttachmentsTable:t[U],booleanIndexes:se(n)}})();return Z.set(o,c),V.set(c,0),e}));return c}(t.databaseName,t.collectionName,r,t.schema),o=new Xe(e,t.databaseName,t.collectionName,t.schema,n,t.options,r);return await Ge(K,t,o),Promise.resolve(o)}function tt(e){if(e.closed)throw new Error("RxStorageInstanceDexie is closed "+e.databaseName+"-"+e.collectionName)}var rt="15.4.1",at=function(){function e(e){this.name=K,this.rxdbVersion=rt,this.settings=e}return e.prototype.createStorageInstance=function(e){return function(e){if(e.schema.keyCompression)throw I("UT5",{args:{params:e}});if((t=e.schema).encrypted&&t.encrypted.length>0||t.attachments&&t.attachments.encrypted)throw I("UT6",{args:{params:e}});var t;if(e.schema.attachments&&e.schema.attachments.compression)throw I("UT7",{args:{params:e}})}(e),et(this,e,this.settings)},e}();function nt(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,a;if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(a=r;0!=a--;)if(!nt(e[a],t[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e);if((r=n.length)!==Object.keys(t).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,n[a]))return!1;for(a=r;0!=a--;){var i=n[a];if(!nt(e[i],t[i]))return!1}return!0}return e!=e&&t!=t}var it={preAddRxPlugin:[],preCreateRxDatabase:[],createRxDatabase:[],preCreateRxCollection:[],createRxCollection:[],postDestroyRxCollection:[],postRemoveRxCollection:[],preCreateRxSchema:[],createRxSchema:[],preCreateRxQuery:[],prePrepareQuery:[],createRxDocument:[],postCreateRxDocument:[],preCreateRxStorageInstance:[],preMigrateDocument:[],postMigrateDocument:[],preDestroyRxDatabase:[],postRemoveRxDatabase:[],preReplicationMasterWrite:[],preReplicationMasterWriteDocumentsHandle:[]};function st(e,t){it[e]&&it[e].forEach((e=>e(t)))}function ot(e,t){return Promise.all(it[e].map((e=>e(t))))}var ct=function(){function e(e,t){this.jsonSchema=e,this.hashFunction=t,this.indexes=function(e){return(e.indexes||[]).map((e=>(0,g.AD)(e)?e:[e]))}(this.jsonSchema),this.primaryPath=T(this.jsonSchema.primaryKey),this.finalFields=F(this.jsonSchema)}var t=e.prototype;return t.validateChange=function(e,t){this.finalFields.forEach((r=>{if(!nt(e[r],t[r]))throw I("DOC9",{dataBefore:e,dataAfter:t,fieldName:r,schema:this.jsonSchema})}))},t.getDocumentPrototype=function(){var e={},t=M(this.jsonSchema,"");return Object.keys(t).forEach((t=>{var r=t;e.__defineGetter__(t,(function(){if(this.get&&"function"==typeof this.get)return this.get(r)})),Object.defineProperty(e,t+"$",{get:function(){return this.get$(r)},enumerable:!1,configurable:!1}),Object.defineProperty(e,t+"_",{get:function(){return this.populate(r)},enumerable:!1,configurable:!1})})),l(this,"getDocumentPrototype",(()=>e)),e},t.getPrimaryOfDocumentData=function(e){return L(this.jsonSchema,e)},(0,b.Z)(e,[{key:"version",get:function(){return this.jsonSchema.version}},{key:"defaultValues",get:function(){var e={};return Object.entries(this.jsonSchema.properties).filter((e=>{let[,t]=e;return Object.prototype.hasOwnProperty.call(t,"default")})).forEach((t=>{let[r,a]=t;return e[r]=a.default})),l(this,"defaultValues",e)}},{key:"hash",get:function(){return l(this,"hash",this.hashFunction(JSON.stringify(this.jsonSchema)))}}]),e}();function lt(e,t,r){void 0===r&&(r=!0),r&&st("preCreateRxSchema",e);var a=W(e);a=function(e){return o(e,!0)}(a),j.deepFreezeWhenDevMode(a);var n=new ct(a,t);return st("createRxSchema",n),n}var ut=r(598),ht=r(6621),dt=r(6728),mt=r(6005),pt=r(7570),ft=r(4419);function yt(e){var t=e.split("-"),r="RxDB";return t.forEach((e=>{r+=N(e)})),r+="Plugin",new Error("You are using a function which must be overwritten by a plugin.\n You should either prevent the usage of this function or add the plugin via:\n import { "+r+" } from 'rxdb/plugins/"+e+"';\n addRxPlugin("+r+");\n ")}function vt(e){return e.documentData?e.documentData:e.previousDocumentData}var gt=function(){function e(e,t,r,a){this.queueByDocId=new Map,this.isRunning=!1,this.storageInstance=e,this.primaryPath=t,this.preWrite=r,this.postWrite=a}var t=e.prototype;return t.addWrite=function(e,t){var r=e[this.primaryPath],a=i(this.queueByDocId,r,(()=>[]));return new Promise(((r,n)=>{var i={lastKnownDocumentState:e,modifier:t,resolve:r,reject:n};(0,le.Is)(a).push(i),this.triggerRun()}))},t.triggerRun=async function(){if(!0!==this.isRunning&&0!==this.queueByDocId.size){this.isRunning=!0;var e=[],t=this.queueByDocId;this.queueByDocId=new Map,await Promise.all(Array.from(t.entries()).map((async t=>{let[r,a]=t;var n,i,s,o=(n=a.map((e=>e.lastKnownDocumentState)),i=n[0],s=Ae(i._rev).height,n.forEach((e=>{var t=Ae(e._rev).height;t>s&&(i=e,s=t)})),i),l=o;for(var u of a)try{l=await u.modifier(c(l))}catch(h){u.reject(h),u.reject=()=>{},u.resolve=()=>{}}try{await this.preWrite(l,o)}catch(h){return void a.forEach((e=>e.reject(h)))}e.push({previous:o,document:l})})));var r=e.length>0?await this.storageInstance.bulkWrite(e,"incremental-write"):{error:[],success:[]};return await Promise.all(r.success.map((e=>{var r=e[this.primaryPath];this.postWrite(e),n(t,r).forEach((t=>t.resolve(e)))}))),r.error.forEach((e=>{var r,a=e.documentId,s=n(t,a),o=E(e);if(o){var c=i(this.queueByDocId,a,(()=>[]));s.reverse().forEach((e=>{e.lastKnownDocumentState=(0,le.Is)(o.documentInDb),(0,le.Is)(c).unshift(e)}))}else{var l=I("COL20",{name:P[(r=e).status],document:r.documentId,writeError:r});s.forEach((e=>e.reject(l)))}})),this.isRunning=!1,this.triggerRun()}},e}();function bt(e){return async t=>{var r=function(e){return Object.assign({},e,{_meta:void 0,_deleted:void 0,_rev:void 0})}(t);r._deleted=t._deleted;var a=await e(r),n=Object.assign({},a,{_meta:t._meta,_attachments:t._attachments,_rev:t._rev,_deleted:void 0!==a._deleted?a._deleted:t._deleted});return void 0===n._deleted&&(n._deleted=!1),n}}var xt={get primaryPath(){if(this.isInstanceOfRxDocument)return this.collection.schema.primaryPath},get primary(){var e=this;if(e.isInstanceOfRxDocument)return e._data[e.primaryPath]},get revision(){if(this.isInstanceOfRxDocument)return this._data._rev},get deleted$(){if(this.isInstanceOfRxDocument)return this.$.pipe((0,ut.U)((e=>e._data._deleted)))},get deleted(){if(this.isInstanceOfRxDocument)return this._data._deleted},getLatest(){var e=this.collection._docCache.getLatestDocumentData(this.primary);return this.collection._docCache.getCachedRxDocument(e)},get $(){return this.collection.$.pipe((0,ht.h)((e=>!e.isLocal)),(0,ht.h)((e=>e.documentId===this.primary)),(0,ut.U)((e=>vt(e))),(0,dt.O)(this.collection._docCache.getLatestDocumentData(this.primary)),(0,mt.x)(((e,t)=>e._rev===t._rev)),(0,ut.U)((e=>this.collection._docCache.getCachedRxDocument(e))),(0,pt.d)(le.kv))},get$(e){if(j.isDevMode()){if(e.includes(".item."))throw I("DOC1",{path:e});if(e===this.primaryPath)throw I("DOC2");if(this.collection.schema.finalFields.includes(e))throw I("DOC3",{path:e});if(!M(this.collection.schema.jsonSchema,e))throw I("DOC4",{path:e})}return this.$.pipe((0,ut.U)((t=>y(t,e))),(0,mt.x)())},populate(e){var t=M(this.collection.schema.jsonSchema,e),r=this.get(e);if(!r)return ft.m5;if(!t)throw I("DOC5",{path:e});if(!t.ref)throw I("DOC6",{path:e,schemaObj:t});var a=this.collection.database.collections[t.ref];if(!a)throw I("DOC7",{ref:t.ref,path:e,schemaObj:t});return"array"===t.type?a.findByIds(r).exec().then((e=>{var t=e.values();return Array.from(t)})):a.findOne(r).exec()},get(e){return i(this._propertyCache,e,(()=>{var t=y(this._data,e);if("object"!=typeof t||null===t||Array.isArray(t))return j.deepFreezeWhenDevMode(t);var r=this;return new Proxy(s(t),{get(t,a){if("string"!=typeof a)return t[a];var n=a.charAt(a.length-1);if("$"===n){var i=a.slice(0,-1);return r.get$(B(e+"."+i))}if("_"===n){var s=a.slice(0,-1);return r.populate(B(e+"."+s))}return r.get(B(e+"."+a))}})}))},toJSON(e){if(void 0===e&&(e=!1),e)return j.deepFreezeWhenDevMode(this._data);var t=s(this._data);return delete t._rev,delete t._attachments,delete t._deleted,delete t._meta,j.deepFreezeWhenDevMode(t)},toMutableJSON(e){return void 0===e&&(e=!1),c(this.toJSON(e))},update(e){throw yt("update")},incrementalUpdate(e){throw yt("update")},updateCRDT(e){throw yt("crdt")},putAttachment(){throw yt("attachments")},getAttachment(){throw yt("attachments")},allAttachments(){throw yt("attachments")},get allAttachments$(){throw yt("attachments")},async modify(e,t){var r=this._data,a=await bt(e)(r);return this._saveData(a,r)},incrementalModify(e,t){return this.collection.incrementalWriteQueue.addWrite(this._data,bt(e)).then((e=>this.collection._docCache.getCachedRxDocument(e)))},patch(e){var t=this._data,r=c(t);return Object.entries(e).forEach((e=>{let[t,a]=e;r[t]=a})),this._saveData(r,t)},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[r,a]=e;t[r]=a})),t)))},async _saveData(e,t){if(e=s(e),this._data._deleted)throw I("DOC11",{id:this.primary,document:this});await jt(this.collection,e,t);var r=await this.collection.storageInstance.bulkWrite([{previous:t,document:e}],"rx-document-save-data"),a=r.error[0];return ze(this.collection,this.primary,e,a),await this.collection._runHooks("post","save",e,this),this.collection._docCache.getCachedRxDocument(r.success[0])},remove(){var e=this.collection;if(this.deleted)return Promise.reject(I("DOC13",{document:this,id:this.primary}));var t,r=s(this._data);return e._runHooks("pre","remove",r,this).then((async()=>{r._deleted=!0;var t=await e.storageInstance.bulkWrite([{previous:this._data,document:r}],"rx-document-remove"),a=t.error[0];return ze(e,this.primary,r,a),t.success[0]})).then((e=>(t=e,this.collection._runHooks("post","remove",r,this)))).then((()=>this.collection._docCache.getCachedRxDocument(t)))},incrementalRemove(){return this.incrementalModify((async e=>(await this.collection._runHooks("pre","remove",e,this),e._deleted=!0,e))).then((async e=>(await this.collection._runHooks("post","remove",e._data,e),e)))},destroy(){throw I("DOC14")}};function wt(e){void 0===e&&(e=xt);var t=function(e,t){this.collection=e,this._data=t,this._propertyCache=new Map,this.isInstanceOfRxDocument=!0};return t.prototype=e,t}function jt(e,t,r){return t._meta=Object.assign({},r._meta,t._meta),j.isDevMode()&&e.schema.validateChange(r,t),e._runHooks("pre","save",t,r)}var kt=r(10),Dt=r(6871),_t=r(3028),It=r(1556),Rt=r(8456);function Et(e,t){return t.sort&&0!==t.sort.length?t.sort.map((e=>Object.keys(e)[0])):[e]}var Pt=new WeakMap;function St(e,t){if(!e.collection.database.eventReduce)return{runFullQueryAgain:!0};var r=function(e){return i(Pt,e,(()=>{var t=e.collection,r=Ee(t.storageInstance.schema,c(e.mangoQuery)),a=t.schema.primaryPath,n=Pe(t.schema.jsonSchema,r),i=Se(t.schema.jsonSchema,r);return{primaryKey:e.collection.schema.primaryPath,skip:r.skip,limit:r.limit,sortFields:Et(a,r),sortComparator:(t,r)=>{var a={docA:t,docB:r,rxQuery:e};return n(a.docA,a.docB)},queryMatcher:t=>i({doc:t,rxQuery:e}.doc)}}))}(e),a=(0,le.Is)(e._result).docsData.slice(0),n=(0,le.Is)(e._result).docsDataMap,s=!1;return t.map((e=>function(e){switch(e.operation){case"INSERT":return{operation:e.operation,id:e.documentId,doc:e.documentData,previous:null};case"UPDATE":return{operation:e.operation,id:e.documentId,doc:j.deepFreezeWhenDevMode(e.documentData),previous:e.previousDocumentData?e.previousDocumentData:"UNKNOWN"};case"DELETE":return{operation:e.operation,id:e.documentId,doc:null,previous:e.previousDocumentData}}}(e))).filter(g.S7).find((e=>{var t={queryParams:r,changeEvent:e,previousResults:a,keyDocumentMap:n},i=(0,Rt.Rf)(t);return"runFullQueryAgain"===i||("doNothing"!==i?(s=!0,(0,Rt.wu)(i,r,e,a,n),!1):void 0)}))?{runFullQueryAgain:!0}:{runFullQueryAgain:!1,changed:s,newResults:a}}var Ct=function(){function e(){this._map=new Map}return e.prototype.getByQuery=function(e){var t=e.toString();return i(this._map,t,(()=>e))},e}();function Ot(e,t){t.uncached=!0;var r=t.toString();e._map.delete(r)}function Nt(e){return e.refCount$.observers.length}var Bt,At,qt=(Bt=100,At=3e4,(e,t)=>{if(!(t._map.size0||(0===i._lastEnsureEqual&&i._creationTimee._lastEnsureEqual-t._lastEnsureEqual)).slice(0,s).forEach((e=>Ot(t,e)))}}),Mt=new WeakSet;var $t=function(){function e(e,t,r){this.cacheItemByDocId=new Map,this.registry="function"==typeof FinalizationRegistry?new FinalizationRegistry((e=>{var t=e.docId,r=this.cacheItemByDocId.get(t);r&&(r.byRev.delete(e.revisionHeight),0===r.byRev.size&&this.cacheItemByDocId.delete(t))})):void 0,this.registerIdleTasks=[],this.primaryPath=e,this.changes$=t,this.documentCreator=r,t.subscribe((e=>{var t=e.documentId,r=this.cacheItemByDocId.get(t);if(r){var a=vt(e);r.last=a}}))}var t=e.prototype;return t.getLatestDocumentData=function(e){return n(this.cacheItemByDocId,e).last},t.getLatestDocumentDataIfExists=function(e){var t=this.cacheItemByDocId.get(e);if(t)return t.last},(0,b.Z)(e,[{key:"getCachedRxDocument",get:function(){return l(this,"getCachedRxDocument",function(e){var t=e.primaryPath,r=e.cacheItemByDocId,a=e.registry,n=j.deepFreezeWhenDevMode,s=e.documentCreator,o=o=>{var c=o[t],l=qe(o._rev),u=i(r,c,(()=>function(e){return{byRev:new Map,last:e}}(o))),h=u.byRev,d=h.get(l),m=d?d.deref():void 0;return m||(o=n(o),m=s(o),h.set(l,Lt(m)),a&&(e.registerIdleTasks.push(m),e.registerIdlePromise||(e.registerIdlePromise=(0,ft.y$)().then((()=>{e.registerIdlePromise=void 0;var t=e.registerIdleTasks;0!==t.length&&(e.registerIdleTasks=[],t.forEach((e=>{a.register(e,{docId:e.primary,revisionHeight:qe(e.revision)})})))}))))),m};return o}(this))}}]),e}();function Tt(e,t){for(var r=e.getCachedRxDocument,a=[],n=0;ne}};var Wt=function(){function e(e,t,r){this.time=(0,ce.z)(),this.collection=e,this.count=r,this.documents=Tt(this.collection._docCache,t)}return(0,b.Z)(e,[{key:"docsData",get:function(){return l(this,"docsData",this.documents.map((e=>e._data)))}},{key:"docsDataMap",get:function(){var e=new Map;return this.documents.forEach((t=>{e.set(t.primary,t._data)})),l(this,"docsDataMap",e)}},{key:"docsMap",get:function(){for(var e=new Map,t=this.documents,r=0;r"string"!=typeof e)))return r.$eq}return!1}(this.collection.schema.primaryPath,t)}var t=e.prototype;return t._setResultData=function(e){if("number"!=typeof e){e instanceof Map&&(e=Array.from(e.values()));var t=new Wt(this.collection,e,e.length);this._result=t}else this._result=new Wt(this.collection,[],e)},t._execOverDatabase=async function(){if(this._execOverDatabaseCount=this._execOverDatabaseCount+1,this._lastExecStart=(0,ce.z)(),"count"===this.op){var e=this.getPreparedQuery(),t=await this.collection.storageInstance.count(e);if("slow"!==t.mode||this.collection.database.allowSlowCount)return t.count;throw I("QU14",{collection:this.collection,queryObj:this.mangoQuery})}if("findByIds"===this.op){var r=(0,le.Is)(this.mangoQuery.selector)[this.collection.schema.primaryPath].$in,a=new Map,n=[];if(r.forEach((e=>{var t=this.collection._docCache.getLatestDocumentDataIfExists(e);if(t){if(!t._deleted){var r=this.collection._docCache.getCachedRxDocument(t);a.set(e,r)}}else n.push(e)})),n.length>0)(await this.collection.storageInstance.findDocumentsById(n,!1)).forEach((e=>{var t=this.collection._docCache.getCachedRxDocument(e);a.set(t.primary,t)}));return a}var i=async function(e){var t=[],r=e.collection;if(e.isFindOneByIdQuery)if(Array.isArray(e.isFindOneByIdQuery)){var a=e.isFindOneByIdQuery;if(a=a.filter((r=>{var a=e.collection._docCache.getLatestDocumentDataIfExists(r);return!a||(a._deleted||t.push(a),!1)})),a.length>0){var n=await r.storageInstance.findDocumentsById(a,!1);(0,g.gu)(t,n)}}else{var i=e.isFindOneByIdQuery,s=e.collection._docCache.getLatestDocumentDataIfExists(i);if(!s){var o=await r.storageInstance.findDocumentsById([i],!1);o[0]&&(s=o[0])}s&&!s._deleted&&t.push(s)}else{var c=e.getPreparedQuery(),l=await r.storageInstance.query(c);t=l.documents}return t}(this);return i.then((e=>(this._lastExecEnd=(0,ce.z)(),e)))},t.exec=function(e){if(e&&"findOne"!==this.op)throw I("QU9",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return Ut(this).then((()=>(0,Dt.z)(this.$))).then((t=>{if(!t&&e)throw I("QU10",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return t}))},t.toString=function(){var e=o({op:this.op,query:this.mangoQuery,other:this.other},!0),t=JSON.stringify(e);return this.toString=()=>t,t},t.getPreparedQuery=function(){var e={rxQuery:this,mangoQuery:Ee(this.collection.schema.jsonSchema,this.mangoQuery)};e.mangoQuery.selector._deleted={$eq:!1},e.mangoQuery.index&&e.mangoQuery.index.unshift("_deleted"),st("prePrepareQuery",e);var t=Kt(this.collection.schema.jsonSchema,e.mangoQuery);return this.getPreparedQuery=()=>t,t},t.doesDocumentDataMatch=function(e){return!e._deleted&&this.queryMatcher(e)},t.remove=function(){return this.exec().then((e=>Array.isArray(e)?Promise.all(e.map((e=>e.remove()))):e.remove()))},t.update=function(e){throw yt("update")},t.where=function(e){throw yt("query-builder")},t.sort=function(e){throw yt("query-builder")},t.skip=function(e){throw yt("query-builder")},t.limit=function(e){throw yt("query-builder")},(0,b.Z)(e,[{key:"$",get:function(){if(!this._$){var e=this.collection.$.pipe((0,ht.h)((e=>!e.isLocal)),(0,dt.O)(null),(0,It.z)((()=>Ut(this))),(0,ut.U)((()=>this._result)),(0,pt.d)(le.kv),(0,mt.x)(((e,t)=>!(!e||e.time!==(0,le.Is)(t).time))),(0,ht.h)((e=>!!e)),(0,ut.U)((e=>{var t=(0,le.Is)(e);return"count"===this.op?t.count:"findOne"===this.op?0===t.documents.length?null:t.documents[0]:"findByIds"===this.op?t.docsMap:t.documents.slice(0)})));this._$=(0,_t.T)(e,this.refCount$.pipe((0,ht.h)((()=>!1))))}return this._$}},{key:"queryMatcher",get:function(){this.collection.schema.jsonSchema;return l(this,"queryMatcher",Se(0,Ee(this.collection.schema.jsonSchema,this.mangoQuery)))}},{key:"asRxQuery",get:function(){return this}}]),e}();function Qt(e,t,r,a){st("preCreateRxQuery",{op:e,queryObj:t,collection:r,other:a});var n,i,s=new Ft(e,t,r,a);return s=(n=s).collection._queryCache.getByQuery(n),i=r,Mt.has(i)||(Mt.add(i),(0,ft.Y3)().then((()=>(0,ft.C2)(200))).then((()=>{i.destroyed||i.cacheReplacementPolicy(i,i._queryCache),Mt.delete(i)}))),s}function Ht(e){var t=e.asRxQuery.collection._changeEventBuffer.counter;return e._latestChangeEvent>=t}function Ut(e){return e.collection.database.destroyed||Ht(e)?ft.kZ:(e._ensureEqualQueue=e._ensureEqualQueue.then((()=>function(e){if(e._lastEnsureEqual=(0,ce.z)(),e.collection.database.destroyed||Ht(e))return ft.kZ;var t=!1,r=!1;-1===e._latestChangeEvent&&(r=!0);if(!r){var a=e.asRxQuery.collection._changeEventBuffer.getFrom(e._latestChangeEvent+1);if(null===a)r=!0;else{e._latestChangeEvent=e.asRxQuery.collection._changeEventBuffer.counter;var n=e.asRxQuery.collection._changeEventBuffer.reduceByLastOfDoc(a);if("count"===e.op){var i=(0,le.Is)(e._result).count,s=i;n.forEach((t=>{var r=t.previousDocumentData&&e.doesDocumentDataMatch(t.previousDocumentData),a=e.doesDocumentDataMatch(t.documentData);!r&&a&&s++,r&&!a&&s--})),s!==i&&(t=!0,e._setResultData(s))}else{var o=St(e,n);o.runFullQueryAgain?r=!0:o.changed&&(t=!0,e._setResultData(o.newResults))}}}if(r)return e._execOverDatabase().then((r=>(e._latestChangeEvent=e.collection._changeEventBuffer.counter,"number"==typeof r?(e._result&&r===e._result.count||(t=!0,e._setResultData(r)),t):(e._result&&function(e,t,r){if(t.length!==r.length)return!1;for(var a=0,n=t.length;ae.data.name===n)),c=[];o.forEach((e=>{c.push({collectionName:e.data.name,schema:e.data.schema,isCollection:!0}),e.data.connectedStorages.forEach((e=>c.push({collectionName:e.collectionName,isCollection:!1,schema:e.schema})))}));var l=new Set;if(c=c.filter((e=>{var t=e.collectionName+"||"+e.schema.version;return!l.has(t)&&(l.add(t),!0)})),await Promise.all(c.map((async t=>{var s=await e.createStorageInstance({collectionName:t.collectionName,databaseInstanceToken:r,databaseName:a,multiInstance:!1,options:{},schema:t.schema,password:i,devMode:j.isDevMode()});await s.remove(),t.isCollection&&await ot("postRemoveRxCollection",{storage:e,databaseName:a,collectionName:n})}))),s){var u=o.map((e=>{var t=He(e);return t._deleted=!0,t._meta.lwt=(0,ce.z)(),t._rev=Me(r,e),{previous:e,document:t}}));await t.bulkWrite(u,"rx-database-remove-collection-all")}}var nr=function(){function e(e){this.subs=[],this.limit=100,this.counter=0,this.eventCounterMap=new WeakMap,this.buffer=[],this.collection=e,this.subs.push(this.collection.$.pipe((0,ht.h)((e=>!e.isLocal))).subscribe((e=>this._handleChangeEvent(e))))}var t=e.prototype;return t._handleChangeEvent=function(e){for(this.counter++,this.buffer.push(e),this.eventCounterMap.set(e,this.counter);this.buffer.length>this.limit;)this.buffer.shift()},t.getArrayIndexByPointer=function(e){var t=this.buffer[0],r=this.eventCounterMap.get(t);return et(e)))},t.reduceByLastOfDoc=function(e){return e.slice(0)},t.destroy=function(){this.subs.forEach((e=>e.unsubscribe()))},e}();var ir=new WeakMap;function sr(e){var t=e.schema.getDocumentPrototype(),r=function(e){var t={};return Object.entries(e.methods).forEach((e=>{let[r,a]=e;t[r]=a})),t}(e),a={};return[t,r,xt].forEach((e=>{Object.getOwnPropertyNames(e).forEach((t=>{var r=Object.getOwnPropertyDescriptor(e,t),n=!0;(t.startsWith("_")||t.endsWith("_")||t.startsWith("$")||t.endsWith("$"))&&(n=!1),"function"==typeof r.value?Object.defineProperty(a,t,{get(){return r.value.bind(this)},enumerable:n,configurable:!1}):(r.enumerable=n,r.configurable=!1,r.writable&&(r.writable=!1),Object.defineProperty(a,t,r))}))})),a}function or(e,t){var r=function(e,t,r){var a=new e(t,r);return st("createRxDocument",a),a}(function(e){return i(ir,e,(()=>wt(sr(e))))}(e),e,j.deepFreezeWhenDevMode(t));return e._runHooksSync("post","create",t,r),st("postCreateRxDocument",r),r}var cr=function(e,t){return nt(Qe(e.newDocumentState),Qe(e.realMasterState))?Promise.resolve({isEqual:!0}):Promise.resolve({isEqual:!1,documentData:e.realMasterState})};var lr=["pre","post"],ur=["insert","save","remove","create"],hr=!1,dr=function(){function e(e,t,r,a,n,i,s,o,c,l,u,h){void 0===n&&(n={}),void 0===i&&(i={}),void 0===s&&(s={}),void 0===o&&(o={}),void 0===c&&(c={}),void 0===l&&(l=qt),void 0===u&&(u={}),void 0===h&&(h=cr),this.storageInstance={},this.timeouts=new Set,this.incrementalWriteQueue={},this._incrementalUpsertQueues=new Map,this.synced=!1,this.hooks={},this._subs=[],this._docCache={},this._queryCache=new Ct,this.$={},this.checkpoint$={},this._changeEventBuffer={},this.onDestroy=[],this.destroyed=!1,this.database=e,this.name=t,this.schema=r,this.internalStorageInstance=a,this.instanceCreationOptions=n,this.migrationStrategies=i,this.methods=s,this.attachments=o,this.options=c,this.cacheReplacementPolicy=l,this.statics=u,this.conflictHandler=h,function(e){if(hr)return;hr=!0;var t=Object.getPrototypeOf(e);ur.forEach((e=>{lr.map((r=>{var a=r+N(e);t[a]=function(t,a){return this.addHook(r,e,t,a)}}))}))}(this.asRxCollection)}var t=e.prototype;return t.prepare=async function(){this.storageInstance=Ue(this.database,this.internalStorageInstance,this.schema.jsonSchema),this.incrementalWriteQueue=new gt(this.storageInstance,this.schema.primaryPath,((e,t)=>jt(this,e,t)),(e=>this._runHooks("post","save",e)));var e,t=this.database.eventBulks$.pipe((0,ht.h)((e=>e.collectionName===this.name)));this.$=t.pipe((0,It.z)((e=>e.events))),this.checkpoint$=t.pipe((0,ut.U)((e=>e.checkpoint))),this._changeEventBuffer=(e=this.asRxCollection,new nr(e)),this._docCache=new $t(this.schema.primaryPath,this.$.pipe((0,ht.h)((e=>!e.isLocal))),(e=>or(this.asRxCollection,e)));var r=await this.database.storageToken,a=this.storageInstance.changeStream().subscribe((e=>{var t={id:e.id,internal:!1,collectionName:this.name,storageToken:r,events:e.events.map((e=>We(!1,e,this))),databaseToken:this.database.token,checkpoint:e.checkpoint,context:e.context,endTime:e.endTime,startTime:e.startTime};this.database.$emit(t)}));return this._subs.push(a),this._subs.push(this.storageInstance.conflictResultionTasks().subscribe((e=>{this.conflictHandler(e.input,e.context).then((t=>{this.storageInstance.resolveConflictResultionTask({id:e.id,output:t})}))}))),ft.$Y},t.cleanup=function(e){throw yt("cleanup")},t.migrationNeeded=function(){throw yt("migration-schema")},t.getMigrationState=function(){throw yt("migration-schema")},t.startMigration=function(e){return void 0===e&&(e=10),this.getMigrationState().startMigration(e)},t.migratePromise=function(e){return void 0===e&&(e=10),this.getMigrationState().migratePromise(e)},t.insert=async function(e){var t=await this.bulkInsert([e]),r=t.error[0];return ze(this,e[this.schema.primaryPath],e,r),(0,le.Is)(t.success[0])},t.bulkInsert=async function(e){if(0===e.length)return{success:[],error:[]};var t=this.schema.primaryPath,r=e.map((e=>rr(this.schema,e))),a=this.hasHooks("pre","insert")?await Promise.all(r.map((e=>this._runHooks("pre","insert",e).then((()=>e))))):r,n=a.map((e=>({document:e}))),i=await this.storageInstance.bulkWrite(n,"rx-collection-bulk-insert"),s=Tt(this._docCache,i.success);if(this.hasHooks("post","insert")){var o=new Map;a.forEach((e=>{o.set(e[t],e)})),await Promise.all(s.map((e=>this._runHooks("post","insert",o.get(e.primary),e))))}return{success:s,error:i.error}},t.bulkRemove=async function(e){var t=this.schema.primaryPath;if(0===e.length)return{success:[],error:[]};var r=await this.findByIds(e).exec(),a=[],i=new Map;Array.from(r.values()).forEach((e=>{var t=e.toMutableJSON(!0);a.push(t),i.set(e.primary,t)})),await Promise.all(a.map((e=>{var t=e[this.schema.primaryPath];return this._runHooks("pre","remove",e,r.get(t))})));var o=a.map((e=>{var t=s(e);return t._deleted=!0,{previous:e,document:t}})),c=await this.storageInstance.bulkWrite(o,"rx-collection-bulk-remove"),l=c.success.map((e=>e[t]));return await Promise.all(l.map((e=>this._runHooks("post","remove",i.get(e),r.get(e))))),{success:l.map((e=>n(r,e))),error:c.error}},t.bulkUpsert=async function(e){var t=[],r=new Map;e.forEach((e=>{var a=rr(this.schema,e),n=a[this.schema.primaryPath];if(!n)throw I("COL3",{primaryPath:this.schema.primaryPath,data:a,schema:this.schema.jsonSchema});r.set(n,a),t.push(a)}));var a=await this.bulkInsert(t),i=a.success.slice(0),s=[];return await Promise.all(a.error.map((async e=>{if(409!==e.status)s.push(e);else{var t=e.documentId,a=n(r,t),o=(0,le.Is)(e.documentInDb),c=this._docCache.getCachedRxDocument(o),l=await c.incrementalModify((()=>a));i.push(l)}}))),{error:s,success:i}},t.upsert=async function(e){var t=await this.bulkUpsert([e]);return ze(this.asRxCollection,e[this.schema.primaryPath],e,t.error[0]),t.success[0]},t.incrementalUpsert=function(e){var t=rr(this.schema,e),r=t[this.schema.primaryPath];if(!r)throw I("COL4",{data:e});var a=this._incrementalUpsertQueues.get(r);return a||(a=ft.$Y),a=a.then((()=>function(e,t,r){var a=e._docCache.getLatestDocumentDataIfExists(t);if(a)return Promise.resolve({doc:e._docCache.getCachedRxDocument(a),inserted:!1});return e.findOne(t).exec().then((t=>t?{doc:t,inserted:!1}:e.insert(r).then((e=>({doc:e,inserted:!0})))))}(this,r,t))).then((e=>e.inserted?e.doc:function(e,t){return e.incrementalModify((e=>t))}(e.doc,t))),this._incrementalUpsertQueues.set(r,a),a},t.find=function(e){if("string"==typeof e)throw I("COL5",{queryObj:e});return e||(e={selector:{}}),Qt("find",e,this)},t.findOne=function(e){if("number"==typeof e||Array.isArray(e))throw R("COL6",{queryObj:e});var t;if("string"==typeof e)t=Qt("findOne",{selector:{[this.schema.primaryPath]:e},limit:1},this);else{if(e||(e={selector:{}}),e.limit)throw I("QU6");(e=s(e)).limit=1,t=Qt("findOne",e,this)}return t},t.count=function(e){return e||(e={selector:{}}),Qt("count",e,this)},t.findByIds=function(e){return Qt("findByIds",{selector:{[this.schema.primaryPath]:{$in:e.slice(0)}}},this)},t.exportJSON=function(){throw yt("json-dump")},t.importJSON=function(e){throw yt("json-dump")},t.insertCRDT=function(e){throw yt("crdt")},t.addHook=function(e,t,r,a){if(void 0===a&&(a=!1),"function"!=typeof r)throw R("COL7",{key:t,when:e});if(!lr.includes(e))throw R("COL8",{key:t,when:e});if(!ur.includes(t))throw I("COL9",{key:t});if("post"===e&&"create"===t&&!0===a)throw I("COL10",{when:e,key:t,parallel:a});var n=r.bind(this),i=a?"parallel":"series";this.hooks[t]=this.hooks[t]||{},this.hooks[t][e]=this.hooks[t][e]||{series:[],parallel:[]},this.hooks[t][e][i].push(n)},t.getHooks=function(e,t){return this.hooks[t]&&this.hooks[t][e]?this.hooks[t][e]:{series:[],parallel:[]}},t.hasHooks=function(e,t){var r=this.getHooks(e,t);return!!r&&(r.series.length>0||r.parallel.length>0)},t._runHooks=function(e,t,r,a){var n=this.getHooks(e,t);if(!n)return ft.$Y;var i=n.series.map((e=>()=>e(r,a)));return(0,ft.Ze)(i).then((()=>Promise.all(n.parallel.map((e=>e(r,a))))))},t._runHooksSync=function(e,t,r,a){var n=this.getHooks(e,t);n&&n.series.forEach((e=>e(r,a)))},t.promiseWait=function(e){return new Promise((t=>{var r=setTimeout((()=>{this.timeouts.delete(r),t()}),e);this.timeouts.add(r)}))},t.destroy=function(){return this.destroyed?ft.kZ:(this.destroyed=!0,Array.from(this.timeouts).forEach((e=>clearTimeout(e))),this._changeEventBuffer&&this._changeEventBuffer.destroy(),this.database.requestIdlePromise().then((()=>Promise.all(this.onDestroy.map((e=>e()))))).then((()=>this.storageInstance.close())).then((()=>(this._subs.forEach((e=>e.unsubscribe())),delete this.database.collections[this.name],ot("postDestroyRxCollection",this).then((()=>!0))))))},t.remove=async function(){await this.destroy(),await ar(this.database.storage,this.database.internalStore,this.database.token,this.database.name,this.name,this.database.password,this.database.hashFunction)},(0,b.Z)(e,[{key:"insert$",get:function(){return this.$.pipe((0,ht.h)((e=>"INSERT"===e.operation)))}},{key:"update$",get:function(){return this.$.pipe((0,ht.h)((e=>"UPDATE"===e.operation)))}},{key:"remove$",get:function(){return this.$.pipe((0,ht.h)((e=>"DELETE"===e.operation)))}},{key:"asRxCollection",get:function(){return this}}]),e}();var mr=r(7782),pr=r(6753);var fr="undefined"!=typeof crypto&&void 0!==crypto.subtle&&"function"==typeof crypto.subtle.digest?async function(e){var t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-256",t);return Array.prototype.map.call(new Uint8Array(r),(e=>("00"+e.toString(16)).slice(-2))).join("")}:function(e){return Promise.resolve((0,pr.JQ)(e))},yr=r(5898),vr=new Set,gr=function(){function e(e,t,r,a,n,i,s,o,c,l,u,h){void 0===s&&(s=!1),void 0===o&&(o={}),this.idleQueue=new mr.F,this.rxdbVersion=rt,this.storageInstances=new Set,this._subs=[],this.startupErrors=[],this.onDestroy=[],this.destroyed=!1,this.collections={},this.eventBulks$=new oe.x,this.observable$=this.eventBulks$.pipe((0,It.z)((e=>e.events))),this.storageToken=ft.kZ,this.storageTokenDocument=ft.kZ,this.emittedEventBulkIds=new yr.i(6e4),this.name=e,this.token=t,this.storage=r,this.instanceCreationOptions=a,this.password=n,this.multiInstance=i,this.eventReduce=s,this.options=o,this.internalStore=c,this.hashFunction=l,this.cleanupPolicy=u,this.allowSlowCount=h,"pseudoInstance"!==this.name&&(this.internalStore=Ue(this.asRxDatabase,c,Jt),this.storageTokenDocument=async function(e){var t=O(10),r=e.password?await e.hashFunction(JSON.stringify(e.password)):void 0,a={id:er,context:Vt,key:Xt,data:{rxdbVersion:e.rxdbVersion,token:t,instanceToken:e.token,passwordHash:r},_deleted:!1,_meta:q(),_rev:"",_attachments:{}},n=await e.internalStore.bulkWrite([{document:a}],"internal-add-storage-token");if(n.success[0])return n.success[0];var i=(0,le.Is)(n.error[0]);if(i.isError&&E(i)){var s=i;if(c=s.documentInDb.data.rxdbVersion,l=e.rxdbVersion,!c||l.includes("beta")&&l!==c||c.split(".")[0]!==l.split(".")[0])throw I("DM5",{args:{database:e.name,databaseStateVersion:s.documentInDb.data.rxdbVersion,codeVersion:e.rxdbVersion}});if(r&&r!==s.documentInDb.data.passwordHash)throw I("DB1",{passwordHash:r,existingPasswordHash:s.documentInDb.data.passwordHash});var o=s.documentInDb;return(0,le.Is)(o)}var c,l;throw i}(this.asRxDatabase).catch((e=>this.startupErrors.push(e))),this.storageToken=this.storageTokenDocument.then((e=>e.data.token)).catch((e=>this.startupErrors.push(e))))}var t=e.prototype;return t.$emit=function(e){this.emittedEventBulkIds.has(e.id)||(this.emittedEventBulkIds.add(e.id),this.eventBulks$.next(e))},t.removeCollectionDoc=async function(e,t){var r=await Te(this.internalStore,Gt(tr(e,t),Zt));if(!r)throw I("SNH",{name:e,schema:t});var a=He(r);a._deleted=!0,await this.internalStore.bulkWrite([{document:a,previous:r}],"rx-database-remove-collection")},t.addCollections=async function(e){var t={},r={},a=[],n={};await Promise.all(Object.entries(e).map((async e=>{let[i,o]=e;var c=i,l=o.schema;t[c]=l;var u=lt(l,this.hashFunction);if(r[c]=u,this.collections[i])throw I("DB3",{name:i});var h=tr(i,l),d={id:Gt(h,Zt),key:h,context:Zt,data:{name:c,schemaHash:await u.hash,schema:u.jsonSchema,version:u.version,connectedStorages:[]},_deleted:!1,_meta:q(),_rev:"",_attachments:{}};a.push({document:d});var m=Object.assign({},o,{name:c,schema:u,database:this}),p=s(o);p.database=this,p.name=i,st("preCreateRxCollection",p),m.conflictHandler=p.conflictHandler,n[c]=m})));var i=await this.internalStore.bulkWrite(a,"rx-database-add-collection");await async function(e){if(await e.storageToken,e.startupErrors[0])throw e.startupErrors[0]}(this),await Promise.all(i.error.map((async e=>{if(409!==e.status)throw I("DB12",{database:this.name,writeError:e});var a=(0,le.Is)(e.documentInDb),n=a.data.name,i=r[n];if(a.data.schemaHash!==await i.hash)throw I("DB6",{database:this.name,collection:n,previousSchemaHash:a.data.schemaHash,schemaHash:await i.hash,previousSchema:a.data.schema,schema:(0,le.Is)(t[n])})})));var o={};return await Promise.all(Object.keys(e).map((async e=>{var t=n[e],r=await function(e){let{database:t,name:r,schema:a,instanceCreationOptions:n={},migrationStrategies:i={},autoMigrate:s=!0,statics:o={},methods:c={},attachments:l={},options:u={},localDocuments:h=!1,cacheReplacementPolicy:d=qt,conflictHandler:m=cr}=e;var p={databaseInstanceToken:t.token,databaseName:t.name,collectionName:r,schema:a.jsonSchema,options:n,multiInstance:t.multiInstance,password:t.password,devMode:j.isDevMode()};return st("preCreateRxStorageInstance",p),async function(e,t){return t.multiInstance=e.multiInstance,await e.storage.createStorageInstance(t)}(t,p).then((e=>{var p=new dr(t,r,a,e,n,i,c,l,u,d,o,m);return p.prepare().then((()=>{Object.entries(o).forEach((e=>{let[t,r]=e;Object.defineProperty(p,t,{get:()=>r.bind(p)})}));var e=ft.$Y;return s&&0!==p.schema.version&&(e=p.migratePromise()),e})).then((()=>(st("createRxCollection",{collection:p,creator:{name:r,schema:a,storageInstance:e,instanceCreationOptions:n,migrationStrategies:i,methods:c,attachments:l,options:u,cacheReplacementPolicy:d,localDocuments:h,statics:o}}),p))).catch((t=>e.close().then((()=>Promise.reject(t)))))}))}(t);o[e]=r,this.collections[e]=r,this[e]||Object.defineProperty(this,e,{get:()=>this.collections[e]})}))),o},t.lockedRun=function(e){return this.idleQueue.wrapCall(e)},t.requestIdlePromise=function(){return this.idleQueue.requestIdlePromise()},t.exportJSON=function(e){throw yt("json-dump")},t.importJSON=function(e){throw yt("json-dump")},t.backup=function(e){throw yt("backup")},t.leaderElector=function(){throw yt("leader-election")},t.isLeader=function(){throw yt("leader-election")},t.waitForLeadership=function(){throw yt("leader-election")},t.migrationStates=function(){throw yt("migration-schema")},t.destroy=async function(){return this.destroyed?ft.kZ:(this.destroyed=!0,await ot("preDestroyRxDatabase",this),this.eventBulks$.complete(),this._subs.map((e=>e.unsubscribe())),"pseudoInstance"===this.name?ft.kZ:this.requestIdlePromise().then((()=>Promise.all(this.onDestroy.map((e=>e()))))).then((()=>Promise.all(Object.keys(this.collections).map((e=>this.collections[e])).map((e=>e.destroy()))))).then((()=>this.internalStore.close())).then((()=>vr.delete(this.name))).then((()=>!0)))},t.remove=function(){return this.destroy().then((()=>async function(e,t,r){var a=O(10),n=await br(a,t,e,{},!1,r),i=await Yt(n),s=new Set;i.forEach((e=>s.add(e.data.name)));var o=Array.from(s);return await Promise.all(o.map((i=>ar(t,n,a,e,i,r)))),await ot("postRemoveRxDatabase",{databaseName:e,storage:t}),await n.remove(),o}(this.name,this.storage,this.password)))},(0,b.Z)(e,[{key:"$",get:function(){return this.observable$}},{key:"asRxDatabase",get:function(){return this}}]),e}();async function br(e,t,r,a,n,i){return await t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:$e,schema:Jt,options:a,multiInstance:n,password:i,devMode:j.isDevMode()})}function xr(e){let{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:i=!0,eventReduce:s=!0,ignoreDuplicate:o=!1,options:c={},cleanupPolicy:l,allowSlowCount:u=!1,localDocuments:h=!1,hashFunction:d=fr}=e;st("preCreateRxDatabase",{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:i,eventReduce:s,ignoreDuplicate:o,options:c,localDocuments:h}),o||function(e){if(vr.has(e))throw I("DB8",{name:e,link:"https://pubkey.github.io/rxdb/rx-database.html#ignoreduplicate"})}(a),vr.add(a);var m=O(10);return br(m,t,a,r,i,n).catch((e=>{throw vr.delete(a),e})).then((e=>{var p=new gr(a,m,t,r,n,i,s,c,e,d,l,u);return ot("createRxDatabase",{database:p,creator:{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:i,eventReduce:s,ignoreDuplicate:o,options:c,localDocuments:h}}).then((()=>p))}))}var wr={RxSchema:ct.prototype,RxDocument:xt,RxQuery:Ft.prototype,RxCollection:dr.prototype,RxDatabase:gr.prototype},jr=new Set,kr=new Set;var Dr=function(e){function t(t,r,a){var n;return(n=e.call(this,null,r)||this).id=t,n.parent=a,n}return(0,x.Z)(t,e),t}(wt()),_r={get isLocal(){return!0},get allAttachments$(){throw I("LD1",{document:this})},get primaryPath(){return"id"},get primary(){return this.id},get $(){var e=n(Pr,this.parent);return this.parent.$.pipe((0,ht.h)((e=>e.documentId===this.primary)),(0,ht.h)((e=>e.isLocal)),(0,ut.U)((e=>vt(e))),(0,dt.O)(e.docCache.getLatestDocumentData(this.primary)),(0,mt.x)(((e,t)=>e._rev===t._rev)),(0,ut.U)((t=>e.docCache.getCachedRxDocument(t))),(0,pt.d)(le.kv))},getLatest(){var e=n(Pr,this.parent),t=e.docCache.getLatestDocumentData(this.primary);return e.docCache.getCachedRxDocument(t)},get(e){if(e="data."+e,this._data){if("string"!=typeof e)throw R("LD2",{objPath:e});var t=y(this._data,e);return t=j.deepFreezeWhenDevMode(t)}},get$(e){if(e="data."+e,j.isDevMode()){if(e.includes(".item."))throw I("LD3",{objPath:e});if(e===this.primaryPath)throw I("LD4")}return this.$.pipe((0,ut.U)((e=>e._data)),(0,ut.U)((t=>y(t,e))),(0,mt.x)())},async incrementalModify(e){var t=await Cr(this.parent);return t.incrementalWriteQueue.addWrite(this._data,(async t=>(t.data=await e(t.data,this),t))).then((e=>t.docCache.getCachedRxDocument(e)))},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[r,a]=e;t[r]=a})),t)))},async _saveData(e){var t=await Cr(this.parent),r=this._data;return e.id=this.id,t.storageInstance.bulkWrite([{previous:r,document:e}],"local-document-save-data").then((t=>{var r=t.success[0];if(!r)throw t.error[0];(e=s(e))._rev=r._rev}))},async remove(){var e=await Cr(this.parent),t={id:this._data.id,data:{},_deleted:!0,_meta:q(),_rev:"",_attachments:{}};return Le(e.storageInstance,{previous:this._data,document:t},"local-document-remove").then((t=>e.docCache.getCachedRxDocument(t)))}},Ir=!1,Rr=()=>{if(!Ir){Ir=!0;var e=xt;Object.getOwnPropertyNames(e).forEach((t=>{if(!Object.getOwnPropertyDescriptor(_r,t)){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(_r,t,r)}}));["populate","update","putAttachment","getAttachment","allAttachments"].forEach((e=>_r[e]=(e=>()=>{throw I("LD6",{functionName:e})})(e)))}};var Er=new WeakMap,Pr=new WeakMap;function Sr(e){var t=e.database?e.database:e,r=e.database?e.name:"",a=(async()=>{var a=await Or(t.token,t.storage,t.name,r,t.instanceCreationOptions,t.multiInstance);a=Ue(t,a,qr);var n=new $t("id",e.$.pipe((0,ht.h)((e=>e.isLocal))),(t=>function(e,t){Rr();var r=new Dr(e.id,e,t);return Object.setPrototypeOf(r,_r),r.prototype=_r,r}(t,e))),i=new gt(a,"id",(()=>{}),(()=>{})),s=await t.storageToken,o=a.changeStream().subscribe((r=>{var a={id:r.id,internal:!1,collectionName:e.database?e.name:void 0,storageToken:s,events:r.events.map((t=>We(!0,t,e.database?e:void 0))),databaseToken:t.token,checkpoint:r.checkpoint,context:r.context,endTime:r.endTime,startTime:r.startTime};t.$emit(a)}));e._subs.push(o);var c={database:t,parent:e,storageInstance:a,docCache:n,incrementalWriteQueue:i};return Pr.set(e,c),c})();Er.set(e,a)}function Cr(e){var t=Er.get(e);if(!t){var r=e.database?e.database:e,a=e.database?e.name:"";throw I("LD8",{database:r.name,collection:a})}return t}function Or(e,t,r,a,n,i){return t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:Ar(a),schema:qr,options:n,multiInstance:i,devMode:j.isDevMode()})}function Nr(e){var t=Er.get(e);if(t)return Er.delete(e),t.then((e=>e.storageInstance.close()))}async function Br(e,t,r){var a=O(10),n=await Or(a,e,t,r,{},!1);await n.remove()}function Ar(e){return"plugin-local-documents-"+e}var qr=W({title:"RxLocalDocument",version:0,primaryKey:"id",type:"object",properties:{id:{type:"string",maxLength:128},data:{type:"object",additionalProperties:!0}},required:["id","data"]});async function Mr(e,t){var r=await Cr(this),a={id:e,data:t,_deleted:!1,_meta:q(),_rev:"",_attachments:{}};return Le(r.storageInstance,{document:a},"local-document-insert").then((e=>r.docCache.getCachedRxDocument(e)))}function $r(e,t){return this.getLocal(e).then((r=>r?r.incrementalModify((()=>t)):this.insertLocal(e,t)))}async function Tr(e){var t=await Cr(this),r=t.docCache,a=r.getLatestDocumentDataIfExists(e);return a?Promise.resolve(r.getCachedRxDocument(a)):Te(t.storageInstance,e).then((e=>e?t.docCache.getCachedRxDocument(e):null))}function Lr(e){return this.$.pipe((0,dt.O)(null),(0,It.z)((async t=>t?{changeEvent:t}:{doc:await this.getLocal(e)})),(0,It.z)((async t=>{if(t.changeEvent){var r=t.changeEvent;return r.isLocal&&r.documentId===e?{use:!0,doc:await this.getLocal(e)}:{use:!1}}return{use:!0,doc:t.doc}})),(0,ht.h)((e=>e.use)),(0,ut.U)((e=>e.doc)))}var Wr={name:"local-documents",rxdb:!0,prototypes:{RxCollection:e=>{e.insertLocal=Mr,e.upsertLocal=$r,e.getLocal=Tr,e.getLocal$=Lr},RxDatabase:e=>{e.insertLocal=Mr,e.upsertLocal=$r,e.getLocal=Tr,e.getLocal$=Lr}},hooks:{createRxDatabase:{before:e=>{e.creator.localDocuments&&Sr(e.database)}},createRxCollection:{before:e=>{e.creator.localDocuments&&Sr(e.collection)}},preDestroyRxDatabase:{after:e=>Nr(e)},postDestroyRxCollection:{after:e=>Nr(e)},postRemoveRxDatabase:{after:e=>Br(e.storage,e.databaseName,"")},postRemoveRxCollection:{after:e=>Br(e.storage,e.databaseName,e.collectionName)}},overwritable:{}};let zr;function Fr(){return"undefined"!=typeof window&&window.indexedDB}function Qr(){return zr||(zr=(async()=>{!function(e){if(st("preAddRxPlugin",{plugin:e,plugins:jr}),!jr.has(e)){if(kr.has(e.name))throw I("PL3",{name:e.name,plugin:e});if(jr.add(e),kr.add(e.name),!e.rxdb)throw R("PL1",{plugin:e});e.init&&e.init(),e.prototypes&&Object.entries(e.prototypes).forEach((e=>{let[t,r]=e;return r(wr[t])})),e.overwritable&&Object.assign(j,e.overwritable),e.hooks&&Object.entries(e.hooks).forEach((e=>{let[t,r]=e;r.after&&it[t].push(r.after),r.before&&it[t].unshift(r.before)}))}}(Wr);var e;return await xr({name:"rxdb-landing-v3",localDocuments:!0,storage:(void 0===e&&(e={}),new at(e))})})()),zr}const Hr=["#e6008d","#8d2089","#5f2688"]},341:(e,t,r)=>{function a(e,t){if(!window.trigger)throw new Error("window.trigger not defined");return window.trigger(e,t)}r.d(t,{X:()=>a})},6451:(e,t,r)=>{r.r(t),r.d(t,{default:()=>g});var a=r(2263),n=r(3799),i=r(5742),s=r(7294),o=r(7400),c=r(6087);const l=[{name:"Antigua and Barbuda",code:"AG",salary:49527},{name:"Argentina",code:"AR",salary:17158},{name:"Australia",code:"AU",salary:76036},{name:"Austria",code:"AT",salary:59383},{name:"Bahamas",code:"BS",salary:62024},{name:"Belarus",code:"BY",salary:5749},{name:"Belgium",code:"BE",salary:63749},{name:"Bermuda",code:"BM",salary:86590},{name:"Bosnia and Herzegovina",code:"BA",salary:11992},{name:"Brazil",code:"BR",salary:26464},{name:"Bulgaria",code:"BG",salary:23384},{name:"Cambodia",code:"KH",salary:18e3},{name:"Canada",code:"CA",salary:71554},{name:"Chile",code:"CL",salary:31073},{name:"China",code:"CN",salary:40611},{name:"Colombia",code:"CO",salary:12894},{name:"Costa Rica",code:"CR",salary:40256},{name:"Croatia",code:"HR",salary:22566},{name:"Czech Republic",code:"CZ",salary:33760},{name:"Denmark",code:"DK",salary:68778},{name:"Ecuador",code:"EC",salary:35016},{name:"Egypt",code:"EG",salary:7758},{name:"Estonia",code:"EE",salary:26728},{name:"Finland",code:"FI",salary:64198},{name:"France",code:"FR",salary:58137},{name:"Georgia",code:"GE",salary:40315},{name:"Germany",code:"DE",salary:72138},{name:"Greece",code:"GR",salary:36824},{name:"Guatemala",code:"GT",salary:49612},{name:"Holy See (Vatican City State)",code:"VA",salary:51474},{name:"Hong Kong",code:"HK",salary:71970},{name:"Hungary",code:"HU",salary:22341},{name:"Iceland",code:"IS",salary:66512},{name:"India",code:"IN",salary:17710},{name:"Indonesia",code:"ID",salary:20978},{name:"Iraq",code:"IQ",salary:21029},{name:"Ireland",code:"IE",salary:66281},{name:"Israel",code:"IL",salary:57466},{name:"Italy",code:"IT",salary:50900},{name:"Jamaica",code:"JM",salary:21048},{name:"Japan",code:"JP",salary:57793},{name:"Kazakhstan",code:"KZ",salary:12243},{name:"Korea, Republic of",code:"KR",salary:45957},{name:"Latvia",code:"LV",salary:26728},{name:"Luxembourg",code:"LU",salary:84663},{name:"Malaysia",code:"MY",salary:26117},{name:"Malta",code:"MT",salary:41971},{name:"Mexico",code:"MX",salary:24050},{name:"Morocco",code:"MA",salary:17903},{name:"Netherlands",code:"NL",salary:62661},{name:"New Zealand",code:"NZ",salary:63948},{name:"Norway",code:"NO",salary:69498},{name:"Pakistan",code:"PK",salary:9066},{name:"Panama",code:"PA",salary:39143},{name:"Peru",code:"PE",salary:17469},{name:"Philippines",code:"PH",salary:11088},{name:"Poland",code:"PL",salary:30236},{name:"Portugal",code:"PT",salary:37959},{name:"Romania",code:"RO",salary:22319},{name:"Russian Federation",code:"RU",salary:20492},{name:"Saudi Arabia",code:"SA",salary:47336},{name:"Singapore",code:"SG",salary:66023},{name:"Slovakia",code:"SK",salary:29650},{name:"South Africa",code:"ZA",salary:40336},{name:"Spain",code:"ES",salary:47819},{name:"Sweden",code:"SE",salary:49361},{name:"Switzerland",code:"CH",salary:92820},{name:"Taiwan",code:"TW",salary:47737},{name:"Thailand",code:"TH",salary:21772},{name:"Turkey",code:"TR",salary:8788},{name:"Ukraine",code:"UA",salary:14139},{name:"United Arab Emirates",code:"AE",salary:66381},{name:"United Kingdom",code:"GB",salary:61188},{name:"United States",code:"US",salary:91935},{name:"Uruguay",code:"UY",salary:23754},{name:"Vietnam",code:"VN",salary:19058}],u={browser:.4,native:.4,performance:.35,sourcecode:0,perpetual:0},h=.05;var d=r(341),m=r(5921),p=r(2389),f=r(5893);function y(e){let{children:t,fallback:r}=e;return(0,p.Z)()?(0,f.jsx)(f.Fragment,{children:t?.()}):r??null}const v="premium-price-form-value";function g(){const{siteConfig:e}=(0,a.Z)(),t=(0,p.Z)();return(0,s.useEffect)((()=>{(async()=>{if(!t||!(0,m.dZ)())return;const e=await(0,m.N8)(),r=await e.getLocal(v);r&&(console.log("formValueDoc:"),console.dir(r),b("home-country",r._data.data.homeCountry),b("company-size",r._data.data.companySize),b("project-amount",r._data.data.projectAmount),b("license-period",r._data.data.licensePeriod),Object.keys(u).forEach((e=>{b("package-"+e,!1)})),r._data.data.packages.forEach((e=>{b("package-"+e,!0)})))})()})),(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.Z,{children:(0,f.jsx)("body",{className:"homepage"})}),(0,f.jsx)(n.Z,{title:`Premium Plugins - ${e.title}`,description:"RxDB plugins for professionals. FAQ, pricing and license",children:(0,f.jsxs)("main",{children:[(0,f.jsx)("div",{className:"block first",children:(0,f.jsxs)("div",{className:"content centered",children:[(0,f.jsxs)("h2",{children:["\ud83d\udc51 ",(0,f.jsx)("b",{className:"underline",children:"RxDB"})," Premium Plugins"]}),(0,f.jsxs)("p",{style:{width:"80%"},children:["To make RxDB a sustainable project, some plugins are not part of the RxDB open source project. Instead they are part of the"," ",(0,f.jsx)("b",{children:"rxdb-premium"})," package which must be purchased.",(0,f.jsx)("br",{}),"Professional developers use these to get the best ",(0,f.jsx)("b",{children:"performance"})," and the most out of RxDB."]}),(0,f.jsxs)("div",{className:"premium-blocks",children:[(0,f.jsx)("a",{href:"/rx-storage-opfs.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage OPFS"}),(0,f.jsxs)("p",{children:["Currently the fastest RxStorage that can be used in the browser. Based on the ",(0,f.jsx)("b",{children:"File System Access API"}),"."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-indexeddb.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage IndexedDB"}),(0,f.jsxs)("p",{children:["A really fast storage based on ",(0,f.jsx)("b",{children:"IndexedDB"}),". Made to be used in browsers."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-sqlite.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage SQLite"}),(0,f.jsxs)("p",{children:["A really fast storage based on ",(0,f.jsx)("b",{children:"SQLite"}),". Used with"," ",(0,f.jsx)("b",{children:"Node.js"}),", ",(0,f.jsx)("b",{children:"Electron"}),", ",(0,f.jsx)("b",{children:"React Native"}),", ",(0,f.jsx)("b",{children:"Capacitor"}),"."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-sharding.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Sharding"}),(0,f.jsx)("p",{children:"A wrapper around any other storage that improves performance by applying the sharding technique."})]})})}),(0,f.jsx)("a",{href:"/rx-storage-memory-synced.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Memory Synced"}),(0,f.jsx)("p",{children:"A wrapper around any other storage that creates a synced in-memory copy which improves performance for the initial page load time and write & read operations."})]})})}),(0,f.jsx)("a",{href:"/query-optimizer.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"Query Optimizer"}),(0,f.jsx)("p",{children:"A tool to find the best index for a given query. You can use this during build time to find the best index and then use that index during runtime."})]})})}),(0,f.jsx)("a",{href:"/rx-storage-localstorage-meta-optimizer.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Localstorage Meta Optimizer"}),(0,f.jsxs)("p",{children:["A wrapper around any other storage which optimizes the initial page load one by using localstorage for meta key-value document. Only works in ",(0,f.jsx)("b",{children:"browsers"}),"."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-shared-worker.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage SharedWorker"}),(0,f.jsxs)("p",{children:["A RxStorage wrapper to run the storage inside of a SharedWorker which improves the performance by taking CPU load away from the main process. Used in ",(0,f.jsx)("b",{children:"browsers"}),"."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-worker.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Worker"}),(0,f.jsx)("p",{children:"A RxStorage wrapper to run the storage inside of a Worker which improves the performance by taking CPU load away from the main process."})]})})}),(0,f.jsx)("a",{href:"/encryption.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"WebCrypto Encryption"}),(0,f.jsx)("p",{children:"A faster and more secure encryption plugin based on the Web Crypto API."})]})})}),(0,f.jsx)("a",{href:"/rx-storage-filesystem-node.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Filesystem Node"}),(0,f.jsxs)("p",{children:["A fast RxStorage based on the ",(0,f.jsx)("b",{children:"Node.js"})," Filesystem."]})]})})}),(0,f.jsx)("a",{href:"/logger.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"Logger"}),(0,f.jsx)("p",{children:"A logging plugin useful to debug performance problems and for monitoring with Application Performance Monitoring (APM) tools like Bugsnag, Datadog, Elastic, Sentry and others"})]})})})]})]})}),(0,f.jsx)("div",{className:"block dark",id:"faq",children:(0,f.jsxs)("div",{className:"content centered premium-faq",children:[(0,f.jsxs)("h2",{children:["F.A.Q. ",(0,f.jsx)("b",{children:"(click to toggle)"})]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Do I need the Premium Plugins?"}),"When you start using RxDB, you do not need access to the premium plugins. Most use cases can be implemented with the Open Core part of RxDB. There are many"," ",(0,f.jsx)("a",{href:"/rx-storage.html",target:"_blank",children:"RxStorage"}),"options and all core plugins that are required for replication, schema validation, encryption and so on, are totally free. As soon as your application is more then a side project, it is pretty easy to switch to RxDB Premium Plugins by just changing a few lines of configuration.",(0,f.jsx)("br",{}),"The main benefit of the Premium Plugins is ",(0,f.jsx)("b",{children:"performance"}),". The Premium RxStorage implementations have a better performance so reading and writing data is much faster especially on low-end devices. You can find a performance comparison"," ",(0,f.jsx)("a",{href:"/rx-storage-performance.html",target:"_blank",children:"here"}),". Also there are additional Premium Plugins that can be used to further optimize the performance of your application like the"," ",(0,f.jsx)("a",{href:"/query-optimizer.html",target:"_blank",children:"Query Optimizer"})," ","or the"," ",(0,f.jsx)("a",{href:"/rx-storage-sharding.html",target:"_blank",children:"Sharding"})," ","plugin."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Why is it not for free?"}),"The development of RxDB started in 2016 and after all these years it became clear that big implementation and improvement steps will not be done by the RxDB community. While the community submits valuable pull requests, they are mostly small improvements or bugfixes for specific edge case. Big rewrites and optimizations that require a big effort have only be done by the RxDB maintainer.",(0,f.jsx)("br",{}),"Selling RxDB Premium ensures that there will be always an incentive for someone to add features, keep everything up to date and to further improve and optimize the codebase. This gives the user the confidence that RxDB is a ",(0,f.jsx)("b",{children:"future proof"})," tech stack to build on which lets RxDB stand out compared to similar technologies."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Why is there no free trial period?"}),(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:"RxDB is written in JavaScript and the code of the Premium Plugins does not contain any tracking or measurement code that would send information from your application to our servers in production mode. As soon as someone has the code on his computer, the maintainer has no chance to really ensure that after a free trial period the code is no longer used and deleted."}),(0,f.jsxs)("li",{children:["Before you can use the Premium Plugins you have to debate and sign a license agreement with the maintainer. This is a sophisticated process that creates overhead which distracts the maintainer from writing RxDB code. So handling trial period users is just not manageable. For this reason there is also no monthly subscriptions. Premium access must be paid ",(0,f.jsx)("b",{children:"per year"}),"."]})]})]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Why is it not cheaper?"}),"The price of the Premium Plugins is chosen in way that ensures that there can be always one person that develops RxDB ",(0,f.jsx)("b",{children:"full time"}),". Compared to other JavaScript frameworks and developer tools, RxDB satisfies an edge use case for people that want to store data inside of their application on the users device. Most web developers do not need to do that and rely on the traditional client-server stack. So RxDB cannot be sold to that many people which increases the price."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Can I install/build the premium plugins in my CI?"}),(0,f.jsx)("b",{children:"Yes"})," you can safely install and use the Premium Plugins in your CI without additional payment."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Can I get a discount?"}),"Discounts are provided for people that have made a significant contribution to RxDB or one of RxDB's dependencies or to the Open Source Community overall. Also for private personal projects there is the option to solve one of the",(0,f.jsx)("a",{href:"https://github.com/pubkey/rxdb/blob/master/orga/premium-tasks.md",target:"_blank",children:"Premium Tasks"}),"to get 3 years access to the Premium Plugins."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Which payment methods are accepted?"}),(0,f.jsx)("b",{children:"Stripe.com"})," is used as payment processor so most known payment options like credit card, PayPal, SEPA transfer and others are available. A list of all options can be found"," ",(0,f.jsx)("a",{href:"https://stripe.com/docs/payments/payment-methods/overview",title:"stripe payment options",target:"_blank",children:"here"}),"."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Can I still use the premium plugins when the license has expired?"}),"By default you are not allowed to use the premium plugins after the license has expired and you will no longer be able to install them. But you can choose the ",(0,f.jsx)("b",{children:"Perpetual license"})," option. With the perpetual license option, you can still use the plugins even after the license is expired. But you will no longer get any updates from newer RxDB versions."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Is there any tracking code inside of the premium plugins?"}),'No, the premium plugins themself do not contain any tracking code. When you build your application with RxDB and deploy it to production, it will not make requests to any RxDB server. But when you run "npm install" with the premium package there will be some metadata send from your developers machine to RxDB.']})]})}),(0,f.jsxs)("div",{className:"block",children:[(0,f.jsxs)("div",{className:"content centered",children:[(0,f.jsxs)("h2",{children:["RxDB Premium ",(0,f.jsx)("b",{className:"underline",children:"Price Calculator"})]}),(0,f.jsx)("div",{className:"price-calculator",children:(0,f.jsxs)("div",{className:"price-calculator-inner",children:[(0,f.jsxs)("form",{id:"price-calculator-form",children:[(0,f.jsxs)("div",{className:"field",children:[(0,f.jsx)("label",{htmlFor:"home-country",children:"Company Home Country:"}),(0,f.jsxs)("div",{className:"input",children:[(0,f.jsx)("input",{list:"home-country",name:"home-country",pattern:"[A-Za-z \\-]{2,}",required:!0,style:{width:"100%",maxWidth:240},autoComplete:"off"}),(0,f.jsx)("datalist",{id:"home-country",children:l.sort(((e,t)=>e.code>=t.code?1:-1)).map(((e,t)=>(0,f.jsx)("option",{value:e.name,children:e.name},t)))})]})]}),(0,f.jsxs)("div",{className:"field",children:[(0,f.jsx)("label",{htmlFor:"company-size",children:"Company Size:"}),(0,f.jsxs)("div",{className:"input",children:[(0,f.jsx)("input",{type:"number",name:"company-size",min:1,max:1e6,required:!0,onKeyDown:()=>{const e=(0,o.Is)(event);return 69!==e.keyCode&&189!==e.keyCode&&190!==e.keyCode}}),(0,f.jsx)("div",{className:"suffix",children:"employee(s)"})]})]}),(0,f.jsxs)("div",{className:"field",children:[(0,f.jsx)("label",{htmlFor:"project-amount",children:"Project Amount:"}),(0,f.jsxs)("div",{className:"input",children:[(0,f.jsxs)("select",{name:"project-amount",id:"project-amount",required:!0,defaultValue:1,children:[(0,f.jsx)("option",{value:1,children:"1"}),(0,f.jsx)("option",{value:2,children:"2"}),(0,f.jsx)("option",{value:"infinity",children:"Infinity"})]}),(0,f.jsx)("div",{className:"suffix",children:"project(s)"})]})]}),(0,f.jsxs)("div",{className:"packages",children:[(0,f.jsx)("h3",{children:"Packages:"}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-browser",type:"checkbox",className:"package-checkbox",defaultChecked:!0}),(0,f.jsx)("h4",{children:"Browser Package"}),(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-opfs.html",target:"_blank",children:"RxStorage OPFS"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-indexeddb.html",target:"_blank",children:"RxStorage IndexedDB"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-worker.html",target:"_blank",children:"RxStorage Worker"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/encryption.html",target:"_blank",children:"WebCrypto Encryption"})})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-native",type:"checkbox",className:"package-checkbox",defaultChecked:!0}),(0,f.jsx)("h4",{children:"Native Package"}),(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-sqlite.html",target:"_blank",children:"RxStorage SQLite"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-filesystem-node.html",target:"_blank",children:"RxStorage Filesystem Node"})})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-performance",type:"checkbox",className:"package-checkbox",defaultChecked:!0}),(0,f.jsx)("h4",{children:"Performance Package"}),(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-sharding.html",target:"_blank",children:"RxStorage Sharding"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-memory-synced.html",target:"_blank",children:"RxStorage Memory Synced"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/query-optimizer.html",target:"_blank",children:"Query Optimizer"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-localstorage-meta-optimizer.html",target:"_blank",children:"RxStorage Localstorage Meta Optimizer"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-shared-worker.html",target:"_blank",children:"RxStorage Shared Worker"})})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-utilities",type:"checkbox",className:"package-checkbox",defaultChecked:!0,disabled:!0}),(0,f.jsxs)("h4",{children:["Utilities Package ",(0,f.jsx)("b",{children:"always included"})]}),(0,f.jsx)("ul",{children:(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/logger.html",target:"_blank",children:"Logger"})})})]})}),(0,f.jsx)("div",{className:"clear"}),(0,f.jsx)("h3",{children:"Other Options:"}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-sourcecode",type:"checkbox",className:"package-checkbox"}),(0,f.jsx)("h4",{children:"Source Code access"}),(0,f.jsxs)("p",{children:["Get read access to the unminified plain source code of all purchased packages.",(0,f.jsx)("br",{})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-perpetual",type:"checkbox",className:"package-checkbox"}),(0,f.jsx)("h4",{children:"Perpetual license"}),(0,f.jsxs)("p",{children:["With the perpetual license option, you can still use the plugins even after the license is expired. But you will no longer get any updates from newer RxDB versions.",(0,f.jsx)("br",{})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("h4",{children:"Increase license period"}),(0,f.jsxs)("p",{children:["The default license period is one year. We can do a longer license period to safe time on both sides by not having to go through the licensing process each single year. By choosing a license period of 2 years, you get a 10% discount. With a 3 year license the discount is 20%.",(0,f.jsx)("br",{})]}),(0,f.jsxs)("div",{className:"field",children:[(0,f.jsxs)("div",{className:"input",style:{float:"left",width:"100%"},children:[(0,f.jsx)("div",{className:"prefix",children:"License period "}),(0,f.jsxs)("select",{name:"license-period",id:"license-period",required:!0,defaultValue:1,children:[(0,f.jsx)("option",{value:1,children:"1"}),(0,f.jsx)("option",{value:2,children:"2 (10% discount)"}),(0,f.jsx)("option",{value:3,children:"3 (20% discount)"})]}),(0,f.jsx)("div",{className:"suffix",children:"year(s)"})]}),(0,f.jsx)("div",{className:"clear"})]}),(0,f.jsx)("p",{})]})}),(0,f.jsx)("div",{className:"clear"})]}),(0,f.jsx)("div",{className:"button",id:"price-calculator-submit",onClick:async()=>{(0,d.X)("calculate_premium_price",3);const e=(0,o.Is)(document.getElementById("price-calculator-form"));if(!e.reportValidity())return void console.log("form not valid");const t=new FormData(e),r=Object.fromEntries(t.entries());console.log("formData:"),console.dir(r);const a=l.find((e=>e.name.toLowerCase()===r["home-country"].toLowerCase()));if(!a)return;const n=Object.entries(r).filter((e=>{let[t,r]=e;return t.startsWith("package-")})).map((e=>{let[t]=e;return(0,c.SI)(t.split("-"))})),i=await(0,m.N8)();await i.upsertLocal(v,{companySize:r["company-size"],projectAmount:r["project-amount"],licensePeriod:r["license-period"],homeCountry:a.name,packages:n});const s={companySize:r["company-size"],teamSize:r["developer-count"],projectAmount:r["project-amount"],licensePeriod:parseInt(r["license-period"],10),homeCountryCode:a.code,packages:n},p=function(e){if(console.log("calculatePrice:"),console.dir(e),"number"!=typeof e.licensePeriod)throw new Error("not a number "+typeof e.licensePeriod);const t=(0,o.Is)(l.find((t=>t.code===e.homeCountryCode))).salary;let r=0;e.packages.forEach((e=>{const t=u[e];r+=t})),console.log("aimInPercent: "+r);let a=350+1.4*t*(r/100);if(2===e.packages.length&&(a*=.9),e.packages.length>2&&(a*=.85),e.companySize>1){let t=1+Math.pow(1*e.companySize-1,.95)/100*4.5;const r=6;t>r&&(t=r),console.log("input.companySize "+e.companySize+" - "+t),a*=t}if(e.packages.includes("sourcecode")){a*=1.75;const e=1520;a{console.log("setPrice:"),console.dir(t),e.innerHTML=Math.ceil(t).toString()+" € (EUR)",e.href=function(e){return"https://www.xe.com/en/currencyconverter/convert/?Amount="+e+"&From=EUR&To=USD"}(Math.ceil(t))},w=p.totalPrice/s.licensePeriod;x(y,"infinity"!==s.projectAmount?w/parseInt(s.projectAmount,10)/12:0),x(g,w),x(b,p.totalPrice),f.style.display="block"},children:"Estimate Price"})]}),(0,f.jsxs)("div",{id:"price-calculator-result",style:{display:"none"},children:[(0,f.jsx)("hr",{}),(0,f.jsx)("h4",{children:"Estimated Price:"}),(0,f.jsx)("table",{children:(0,f.jsxs)("tbody",{children:[(0,f.jsxs)("tr",{children:[(0,f.jsx)("th",{children:"Price Per Project per Month"}),(0,f.jsx)("td",{children:(0,f.jsx)("a",{id:"total-per-project-per-month",target:"_blank",rel:"nofollow noopener noreferrer",title:"Click to convert to other currency",href:"#",children:"XX \u20ac"})})]}),(0,f.jsxs)("tr",{children:[(0,f.jsx)("th",{children:"Total Price per Year"}),(0,f.jsx)("td",{children:(0,f.jsx)("a",{id:"total-per-year",target:"_blank",rel:"nofollow noopener noreferrer",title:"Click to convert to other currency",href:"#",children:"XX \u20ac"})})]}),(0,f.jsxs)("tr",{children:[(0,f.jsx)("th",{children:"Total Price"}),(0,f.jsx)("td",{children:(0,f.jsx)("a",{id:"total-price",target:"_blank",rel:"nofollow noopener noreferrer",title:"Click to convert to other currency",href:"#",children:"XX \u20ac"})})]})]})}),(0,f.jsxs)("div",{className:"proceed-hint",children:["Fill out",(0,f.jsxs)("a",{href:"#premium-request-form-block",children:[" ",(0,f.jsx)("b",{children:"this form"})," "]}),"to proceed."]})]})]})})]}),(0,f.jsx)("div",{className:"block dark",id:"premium-request-form-block",children:(0,f.jsxs)("div",{className:"content centered premium-request",children:[(0,f.jsxs)("h2",{children:["Request Premium ",(0,f.jsx)("b",{className:"underline",children:"Form"})]}),(0,f.jsx)("p",{}),(0,f.jsx)(y,{fallback:(0,f.jsx)("span",{children:"Loading form iframe..."}),children:()=>(0,f.jsxs)("iframe",{id:"request-premium-form",src:"https://webforms.pipedrive.com/f/6qflURDWONiPpj67lpG6r45n8feakrtS2AqMRcBf1EuCPRvNcXWdvNH2unFm5EpjW3",children:["Your browser doesn't support iframes, ",(0,f.jsx)("a",{href:"https://webforms.pipedrive.com/f/6qflURDWONiPpj67lpG6r45n8feakrtS2AqMRcBf1EuCPRvNcXWdvNH2unFm5EpjW3",target:"_blank",rel:"nofollow",children:"go here"})]})})]})})]})]})})]})}function b(e,t){if(void 0===t)return;const r=document.querySelector("[name="+e+"]");r&&(r.type&&"checkbox"===r.type?r.checked=t:r.value=t)}},6087:(e,t,r)=>{function a(e){return e[e.length-1]}function n(e){return Array.isArray(e)?e.slice(0):[e]}function i(e){return Array.isArray(e)}function s(e){return null!=e}function o(e,t){var r=0,a=-1;for(var n of e){if(!t(n,a+=1))break;r+=1}return r}function c(e,t){for(var r=t.length,a=0;ai,Nb:()=>l,S7:()=>s,SI:()=>a,gu:()=>c,qo:()=>n,r0:()=>o})},7400:(e,t,r)=>{function a(e,t){if(!e)throw t||(t=""),new Error("ensureNotFalsy() is falsy: "+t);return e}r.d(t,{Is:()=>a,kv:()=>n});var n={bufferSize:1,refCount:!0}},4419:(e,t,r)=>{function a(){return new Promise((e=>setTimeout(e,0)))}function n(e){return void 0===e&&(e=0),new Promise((t=>setTimeout(t,e)))}r.d(t,{$Y:()=>o,C2:()=>u,Y3:()=>a,YB:()=>n,Ze:()=>h,kZ:()=>i,m5:()=>s,y$:()=>c});Promise.resolve(!0);var i=Promise.resolve(!1),s=Promise.resolve(null),o=Promise.resolve();function c(e){return void 0===e&&(e=1e4),"function"==typeof requestIdleCallback?new Promise((t=>{requestIdleCallback((()=>t()),{timeout:e})})):n(0)}var l=o;function u(e){return void 0===e&&(e=void 0),l=l.then((()=>c(e)))}function h(e,t){return e.reduce(((e,t)=>e.then(t)),Promise.resolve(t))}},984:(e,t,r)=>{r.d(t,{z:()=>n});var a=0;function n(){var e=Date.now();(e+=.01)<=a&&(e=a+.01);var t=parseFloat(e.toFixed(2));return a=t,t}}}]); \ No newline at end of file +"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[2160],{5921:(e,t,r)=>{r.d(t,{O9:()=>Hr,N8:()=>Qr,dZ:()=>Fr});var a=r(8061);function n(e,t){var r=e.get(t);if(void 0===r)throw new Error("missing value from map "+t);return r}function i(e,t,r,a){var n=e.get(t);return void 0===n?(n=r(),e.set(t,n)):a&&a(n),n}function s(e){return Object.assign({},e)}function o(e,t){if(void 0===t&&(t=!1),!e)return e;if(!t&&Array.isArray(e))return e.sort(((e,t)=>"string"==typeof e&&"string"==typeof t?e.localeCompare(t):"object"==typeof e?1:-1)).map((e=>o(e,t)));if("object"==typeof e&&!Array.isArray(e)){var r={};return Object.keys(e).sort(((e,t)=>e.localeCompare(t))).forEach((a=>{r[a]=o(e[a],t)})),r}return e}var c=function e(t){if(!t)return t;if(null===t||"object"!=typeof t)return t;if(Array.isArray(t)){for(var r=new Array(t.length),a=r.length;a--;)r[a]=e(t[a]);return r}var n={};for(var i in t)n[i]=e(t[i]);return n};function l(e,t,r){return Object.defineProperty(e,t,{get:function(){return r}}),r}var u=e=>{var t=typeof e;return null!==e&&("object"===t||"function"===t)},h=new Set(["__proto__","prototype","constructor"]),d=new Set("0123456789");function m(e){var t=[],r="",a="start",n=!1;for(var i of e)switch(i){case"\\":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a)throw new Error("Invalid character after an index");n&&(r+=i),a="property",n=!n;break;case".":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a){a="property";break}if(n){n=!1,r+=i;break}if(h.has(r))return[];t.push(r),r="",a="property";break;case"[":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a){a="index";break}if(n){n=!1,r+=i;break}if("property"===a){if(h.has(r))return[];t.push(r),r=""}a="index";break;case"]":if("index"===a){t.push(Number.parseInt(r,10)),r="",a="indexEnd";break}if("indexEnd"===a)throw new Error("Invalid character after an index");default:if("index"===a&&!d.has(i))throw new Error("Invalid character in an index");if("indexEnd"===a)throw new Error("Invalid character after an index");"start"===a&&(a="property"),n&&(n=!1,r+="\\"),r+=i}switch(n&&(r+="\\"),a){case"property":if(h.has(r))return[];t.push(r);break;case"index":throw new Error("Index was not closed");case"start":t.push("")}return t}function p(e,t){if("number"!=typeof t&&Array.isArray(e)){var r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function f(e,t){if(p(e,t))throw new Error("Cannot use string index")}function y(e,t,r){if(Array.isArray(t)&&(t=t.join(".")),!t.includes(".")&&!t.includes("["))return e[t];if(!u(e)||"string"!=typeof t)return void 0===r?e:r;var a=m(t);if(0===a.length)return r;for(var n=0;n!1,deepFreezeWhenDevMode:e=>e,tunnelErrorMessage:e=>"RxDB Error-Code "+e+".\n Error messages are not included in RxDB core to reduce build size.\n - To find out what this error means, either use the dev-mode-plugin https://rxdb.info/dev-mode.html\n - or search for the error code here: https://github.com/pubkey/rxdb/search?q="+e+"\n "};function k(e,t,r){return"RxError ("+t+"):\n"+e+"\n"+function(e){var t="";return 0===Object.keys(e).length?t:(t+="Given parameters: {\n",t+=Object.keys(e).map((t=>{var r="[object Object]";try{r="errors"===t?e[t].map((e=>JSON.stringify(e,Object.getOwnPropertyNames(e)))):JSON.stringify(e[t],(function(e,t){return void 0===t?null:t}),2)}catch(a){}return t+":"+r})).join("\n"),t+="}")}(r)}var D=function(e){function t(t,r,a){var n;void 0===a&&(a={});var i=k(r,t,a);return(n=e.call(this,i)||this).code=t,n.message=i,n.parameters=a,n.rxdb=!0,n}return(0,x.Z)(t,e),t.prototype.toString=function(){return this.message},(0,b.Z)(t,[{key:"name",get:function(){return"RxError ("+this.code+")"}},{key:"typeError",get:function(){return!1}}]),t}((0,w.Z)(Error)),_=function(e){function t(t,r,a){var n;void 0===a&&(a={});var i=k(r,t,a);return(n=e.call(this,i)||this).code=t,n.message=i,n.parameters=a,n.rxdb=!0,n}return(0,x.Z)(t,e),t.prototype.toString=function(){return this.message},(0,b.Z)(t,[{key:"name",get:function(){return"RxTypeError ("+this.code+")"}},{key:"typeError",get:function(){return!0}}]),t}((0,w.Z)(TypeError));function I(e,t){return new D(e,j.tunnelErrorMessage(e),t)}function R(e,t){return new _(e,j.tunnelErrorMessage(e),t)}function E(e){return!(!e||409!==e.status)&&e}var P={409:"document write conflict",422:"schema validation error",510:"attachment data missing"};var S=/\./g,C="abcdefghijklmnopqrstuvwxyz";function O(e){void 0===e&&(e=10);for(var t="",r=0;r{var r=y(t,e);if(void 0===r)throw I("DOC18",{args:{field:e,documentData:t}});return r})).join(r.separator)}function W(e){var t=T((e=s(e)).primaryKey);e.properties=s(e.properties),e.additionalProperties=!1,Object.prototype.hasOwnProperty.call(e,"keyCompression")||(e.keyCompression=!1),e.indexes=e.indexes?e.indexes.slice(0):[],e.required=e.required?e.required.slice(0):[],e.encrypted=e.encrypted?e.encrypted.slice(0):[],e.properties._rev={type:"string",minLength:1},e.properties._attachments={type:"object"},e.properties._deleted={type:"boolean"},e.properties._meta=z,e.required=e.required?e.required.slice(0):[],e.required.push("_deleted"),e.required.push("_rev"),e.required.push("_meta"),e.required.push("_attachments");var r=F(e);(0,g.gu)(e.required,r),e.required=e.required.filter((e=>!e.includes("."))).filter(((e,t,r)=>r.indexOf(e)===t)),e.version=e.version||0;var a=e.indexes.map((e=>{var r=(0,g.AD)(e)?e.slice(0):[e];return r.includes(t)||r.push(t),"_deleted"!==r[0]&&r.unshift("_deleted"),r}));0===a.length&&a.push(function(e){return["_deleted",e]}(t)),a.push(["_meta.lwt",t]),e.internalIndexes&&e.internalIndexes.map((e=>{a.push(e)}));var n=new Set;return a.filter((e=>{var t=e.join(",");return!n.has(t)&&(n.add(t),!0)})),e.indexes=a,e}var z={type:"object",properties:{lwt:{type:"number",minimum:A,maximum:1e15,multipleOf:.01}},additionalProperties:!0,required:["lwt"]};function F(e){var t=Object.keys(e.properties).filter((t=>e.properties[t].final)),r=T(e.primaryKey);return t.push(r),"string"!=typeof e.primaryKey&&e.primaryKey.fields.forEach((e=>t.push(e))),t}var Q="docs",H="changes",U="attachments",K="dexie",Z=new Map,V=new Map;var J="__";function G(e){var t=e.split(".");if(t.length>1)return t.map((e=>G(e))).join(".");if(e.startsWith("|")){var r=e.substring(1);return J+r}return e}function Y(e){var t=e.split(".");return t.length>1?t.map((e=>Y(e))).join("."):e.startsWith(J)?"|"+e.substring(J.length):e}function X(e,t){return t?(t=te(t=s(t)),e.forEach((e=>{var r=y(t,e);v(t,e,r?"1":"0")})),t):t}function ee(e,t){return t?(t=re(t=s(t)),e.forEach((e=>{var r=y(t,e);v(t,e,"1"===r)})),t):t}function te(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>te(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((e=>{let[r,a]=e;"object"==typeof a&&(a=te(a)),t[G(r)]=a})),t}}function re(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>re(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((r=>{let[a,n]=r;("object"==typeof n||Array.isArray(e))&&(n=re(n)),t[Y(a)]=n})),t}}function ae(e){var t=[],r=T(e.primaryKey);t.push([r]),t.push(["_deleted",r]),e.indexes&&e.indexes.forEach((e=>{var r=(0,g.qo)(e);t.push(r)})),t.push(["_meta.lwt",r]),t.push(["_meta.lwt"]);var a=(t=t.map((e=>e.map((e=>G(e)))))).map((e=>1===e.length?e[0]:"["+e.join("+")+"]"));return(a=a.filter(((e,t,r)=>r.indexOf(e)===t))).join(", ")}async function ne(e,t){var r=await e;return(await r.dexieTable.bulkGet(t)).map((e=>ee(r.booleanIndexes,e)))}function ie(e,t){return e+"||"+t}function se(e){var t=new Set,r=[];return e.indexes?(e.indexes.forEach((a=>{(0,g.qo)(a).forEach((a=>{t.has(a)||(t.add(a),"boolean"===M(e,a).type&&r.push(a))}))})),r.push("_deleted"),(0,g.Nb)(r)):r}var oe=r(6974),ce=r(984),le=r(7400),ue=String.fromCharCode(65535),he=Number.MIN_SAFE_INTEGER;function de(e,t){var r=t.selector,a=e.indexes?e.indexes.slice(0):[];t.index&&(a=[t.index]);var n=!!t.sort.find((e=>"desc"===Object.values(e)[0])),i=new Set;Object.keys(r).forEach((t=>{var a=M(e,t);a&&"boolean"===a.type&&Object.prototype.hasOwnProperty.call(r[t],"$eq")&&i.add(t)}));var s,o=t.sort.map((e=>Object.keys(e)[0])).filter((e=>!i.has(e))).join(","),c=-1;if(a.forEach((e=>{var a=!0,l=!0,u=e.map((e=>{var t=r[e],n=t?Object.keys(t):[],i={};t&&n.length?n.forEach((e=>{if(me.has(e)){var r=function(e,t){switch(e){case"$eq":return{startKey:t,endKey:t,inclusiveEnd:!0,inclusiveStart:!0};case"$lte":return{endKey:t,inclusiveEnd:!0};case"$gte":return{startKey:t,inclusiveStart:!0};case"$lt":return{endKey:t,inclusiveEnd:!1};case"$gt":return{startKey:t,inclusiveStart:!1};default:throw new Error("SNH")}}(e,t[e]);i=Object.assign(i,r)}})):i={startKey:l?he:ue,endKey:a?ue:he,inclusiveStart:!0,inclusiveEnd:!0};return void 0===i.startKey&&(i.startKey=he),void 0===i.endKey&&(i.endKey=ue),void 0===i.inclusiveStart&&(i.inclusiveStart=!0),void 0===i.inclusiveEnd&&(i.inclusiveEnd=!0),l&&!i.inclusiveStart&&(l=!1),a&&!i.inclusiveEnd&&(a=!1),i})),h=u.map((e=>e.startKey)),d=u.map((e=>e.endKey)),m={index:e,startKeys:h,endKeys:d,inclusiveEnd:a,inclusiveStart:l,sortSatisfiedByIndex:!n&&o===e.filter((e=>!i.has(e))).join(","),selectorSatisfiedByIndex:ye(e,t.selector,h,d)},p=function(e,t,r){var a=0,n=e=>{e>0&&(a+=e)},i=10,s=(0,g.r0)(r.startKeys,(e=>e!==he&&e!==ue));n(s*i);var o=(0,g.r0)(r.startKeys,(e=>e!==ue&&e!==he));n(o*i);var c=(0,g.r0)(r.startKeys,((e,t)=>e===r.endKeys[t]));n(c*i*1.5);var l=r.sortSatisfiedByIndex?5:0;return n(l),a}(0,0,m);(p>=c||t.index)&&(c=p,s=m)})),!s)throw I("SNH",{query:t});return s}var me=new Set(["$eq","$gt","$gte","$lt","$lte"]),pe=new Set(["$eq","$gt","$gte"]),fe=new Set(["$eq","$lt","$lte"]);function ye(e,t,r,a){var n=Object.entries(t).find((t=>{let[r,a]=t;return!e.includes(r)||Object.entries(a).find((e=>{let[t,r]=e;return!me.has(t)}))}));if(n)return!1;if(t.$and||t.$or)return!1;var i=[],s=new Set;for(var[o,c]of Object.entries(t)){if(!e.includes(o))return!1;var l=Object.keys(c).filter((e=>pe.has(e)));if(l.length>1)return!1;var u=l[0];if(u&&s.add(o),"$eq"!==u){if(i.length>0)return!1;i.push(u)}}var h=[],d=new Set;for(var[m,p]of Object.entries(t)){if(!e.includes(m))return!1;var f=Object.keys(p).filter((e=>fe.has(e)));if(f.length>1)return!1;var y=f[0];if(y&&d.add(m),"$eq"!==y){if(h.length>0)return!1;h.push(y)}}var v=0;for(var g of e){for(var b of[s,d]){if(!b.has(g)&&b.size>0)return!1;b.delete(g)}if(r[v]!==a[v]&&s.size>0&&d.size>0)return!1;v++}return!0}var ve=r(6250),ge=r(7761),be=r(7132),xe=r(6496),we=r(6851),je=r(3516),ke=r(8039),De=r(5308),_e=r(2106),Ie=!1;function Re(e){return Ie||((0,ge.Qs)(ge.$M.PIPELINE,{$sort:xe.E3,$project:xe.FM}),(0,ge.Qs)(ge.$M.QUERY,{$and:we.h$,$eq:je.l3,$elemMatch:De.rr,$exists:_e.G,$gt:je.ok,$gte:je.m9,$in:je.FI,$lt:je.Ty,$lte:je.HG,$ne:je.ny,$nin:je.IS,$mod:ke.JD,$nor:we.ps,$not:we._w,$or:we.Ko,$regex:ke.GO,$size:De.QH,$type:_e.e}),Ie=!0),new be.A(e)}function Ee(e,t){var r=T(e.primaryKey);t=s(t);var a=c(t);if("number"!=typeof a.skip&&(a.skip=0),a.selector?(a.selector=a.selector,Object.entries(a.selector).forEach((e=>{let[t,r]=e;"object"==typeof r&&null!==r||(a.selector[t]={$eq:r})}))):a.selector={},a.index){var n=(0,g.qo)(a.index);n.includes(r)||n.push(r),a.index=n}if(a.sort)a.sort.find((e=>{return t=e,Object.keys(t)[0]===r;var t}))||(a.sort=a.sort.slice(0),a.sort.push({[r]:"asc"}));else if(a.index)a.sort=a.index.map((e=>({[e]:"asc"})));else{if(e.indexes){var i=new Set;Object.entries(a.selector).forEach((e=>{let[t,r]=e;("object"!=typeof r||null===r||!!Object.keys(r).find((e=>me.has(e))))&&i.add(t)}));var o,l=-1;e.indexes.forEach((e=>{var t=(0,g.AD)(e)?e:[e],r=t.findIndex((e=>!i.has(e)));r>0&&r>l&&(l=r,o=t)})),o&&(a.sort=o.map((e=>({[e]:"asc"}))))}a.sort||(a.sort=[{[r]:"asc"}])}return a}function Pe(e,t){if(!t.sort)throw I("SNH",{query:t});var r=[];t.sort.forEach((e=>{var t,a,n,i=Object.keys(e)[0],s=Object.values(e)[0];r.push({key:i,direction:s,getValueFn:(t=i,a=t.split("."),n=a.length,1===n?e=>e[t]:e=>{for(var t=e,r=0;r{for(var a=0;ar.test(e)}function Ce(e){return e===he?-1/0:e}function Oe(e,t,r){return e.includes(t)?r===ue||!0===r?"1":"0":r}function Ne(e,t,r){if(!r){if("undefined"==typeof window)throw new Error("IDBKeyRange missing");r=window.IDBKeyRange}var a=t.startKeys.map(((r,a)=>{var n=t.index[a];return Oe(e,n,r)})).map(Ce),n=t.endKeys.map(((r,a)=>{var n=t.index[a];return Oe(e,n,r)})).map(Ce);return r.bound(a,n,!t.inclusiveStart,!t.inclusiveEnd)}async function Be(e,t){var r=await e.internals,a=t.query,n=a.skip?a.skip:0,i=n+(a.limit?a.limit:1/0),s=t.queryPlan,o=!1;s.selectorSatisfiedByIndex||(o=Se(e.schema,t.query));var c=Ne(r.booleanIndexes,s,r.dexieDb._options.IDBKeyRange),l=s.index,u=[];if(await r.dexieDb.transaction("r",r.dexieTable,(async e=>{var t,a=e.idbtrans.objectStore(Q);t="["+l.map((e=>G(e))).join("+")+"]";var n=a.index(t).openCursor(c);await new Promise((e=>{n.onsuccess=function(t){var a=t.target.result;if(a){var n=ee(r.booleanIndexes,a.value);o&&!o(n)||u.push(n),s.sortSatisfiedByIndex&&u.length===i?e():a.continue()}else e()}}))})),!s.sortSatisfiedByIndex){var h=Pe(e.schema,t.query);u=u.sort(h)}return{documents:u=u.slice(n,i)}}function Ae(e){var t=e.split("-");if(2!==t.length)throw new Error("malformatted revision: "+e);return{height:parseInt(t[0],10),hash:t[1]}}function qe(e){return parseInt(e.split("-")[0],10)}function Me(e,t){var r=t?t._rev:null;return(r?Ae(r).height:0)+1+"-"+e}var $e="_rxdb_internal";async function Te(e,t){var r=(await e.findDocumentsById([t],!1))[0];return r||void 0}async function Le(e,t,r){var a=await e.bulkWrite([t],r);if(a.error.length>0)throw a.error[0];return a.success[0]}function We(e,t,r){var a=t.documentData,n=t.previousDocumentData;return{documentId:t.documentId,collectionName:r?r.name:void 0,isLocal:e,operation:t.operation,documentData:j.deepFreezeWhenDevMode(a),previousDocumentData:j.deepFreezeWhenDevMode(n)}}function ze(e,t,r,a){if(a)throw 409===a.status?I("CONFLICT",{collection:e.name,id:t,writeError:a,data:r}):422===a.status?I("VD2",{collection:e.name,id:t,writeError:a,data:r}):a}function Fe(e){return{previous:e.previous,document:Qe(e.document)}}function Qe(e){if(!e._attachments||0===Object.keys(e._attachments).length)return e;var t=s(e);return t._attachments={},Object.entries(e._attachments).forEach((e=>{let[r,a]=e;var n,i,s;t._attachments[r]=(s=(n=a).data)?{length:(i=s,atob(i).length),digest:n.digest,type:n.type}:n})),t}function He(e){var t=s(e);return t._meta=s(e._meta),t}function Ue(e,t,r){j.deepFreezeWhenDevMode(r);var a=T(r.primaryKey);var n={originalStorageInstance:t,schema:t.schema,internals:t.internals,collectionName:t.collectionName,databaseName:t.databaseName,options:t.options,bulkWrite(n,i){var o=n.map((n=>function(n){var i=s(n.document);if(i._meta=s(i._meta),j.isDevMode()){i=$(a,r,i);try{"function"==typeof structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n))}catch(o){throw I("DOC24",{collection:t.collectionName,document:n.document})}n.previous,n.previous&&Object.keys(n.previous._meta).forEach((e=>{if(!Object.prototype.hasOwnProperty.call(n.document._meta,e))throw I("SNH",{dataBefore:n.previous,dataAfter:n.document})}))}return i._meta.lwt=(0,ce.z)(),i._rev=Me(e.token,n.previous),{document:i,previous:n.previous}}(n)));return e.lockedRun((()=>t.bulkWrite(o,i))).then((r=>{var a={error:[],success:r.success.slice(0)},n=r.error.filter((e=>!(409!==e.status||e.writeRow.previous||e.writeRow.document._deleted||!(0,le.Is)(e.documentInDb)._deleted)||(a.error.push(e),!1)));if(n.length>0){var s=n.map((t=>({previous:t.documentInDb,document:Object.assign({},t.writeRow.document,{_rev:Me(e.token,t.documentInDb)})})));return e.lockedRun((()=>t.bulkWrite(s,i))).then((e=>((0,g.gu)(a.error,e.error),(0,g.gu)(a.success,e.success),a)))}return r}))},query:r=>e.lockedRun((()=>t.query(r))),count:r=>e.lockedRun((()=>t.count(r))),findDocumentsById:(r,a)=>e.lockedRun((()=>t.findDocumentsById(r,a))),getAttachmentData:(r,a,n)=>e.lockedRun((()=>t.getAttachmentData(r,a,n))),getChangedDocumentsSince:t.getChangedDocumentsSince?(r,a)=>e.lockedRun((()=>t.getChangedDocumentsSince((0,le.Is)(r),a))):void 0,cleanup:r=>e.lockedRun((()=>t.cleanup(r))),remove:()=>(e.storageInstances.delete(n),e.lockedRun((()=>t.remove()))),close:()=>(e.storageInstances.delete(n),e.lockedRun((()=>t.close()))),changeStream:()=>t.changeStream(),conflictResultionTasks:()=>t.conflictResultionTasks(),resolveConflictResultionTask(e){if(e.output.isEqual)return t.resolveConflictResultionTask(e);var r=s(Object.assign({},e.output.documentData,{_meta:q(),_rev:"",_attachments:{}}));return delete r._meta,delete r._rev,delete r._attachments,t.resolveConflictResultionTask({id:e.id,output:{isEqual:!1,documentData:r}})}};return e.storageInstances.add(n),n}var Ke=r(5677),Ze=r(3981),Ve=new Map;function Je(e,t){var r=Ve.get(e);if(r)return r.refs.delete(t),0===r.refs.size?(Ve.delete(e),r.bc.close()):void 0}function Ge(e,t,r,a){if(t.multiInstance){var n=a||function(e,t,r,a){var n=Ve.get(t);return n||(n={bc:new Ze.g0(["RxDB:",e,r].join("|")),refs:new Set},Ve.set(t,n)),n.refs.add(a),n.bc}(e,t.databaseInstanceToken,r.databaseName,r),i=new oe.x,s=r=>{r.storageName===e&&r.databaseName===t.databaseName&&r.collectionName===t.collectionName&&r.version===t.schema.version&&i.next(r.eventBulk)};n.addEventListener("message",s);var o=r.changeStream(),c=!1,l=o.subscribe((r=>{c||n.postMessage({storageName:e,databaseName:t.databaseName,collectionName:t.collectionName,version:t.schema.version,eventBulk:r})}));r.changeStream=function(){return i.asObservable().pipe((0,Ke.b)(o))};var u=r.close.bind(r);r.close=async function(){return c=!0,l.unsubscribe(),n.removeEventListener("message",s),a||await Je(t.databaseInstanceToken,r),u()};var h=r.remove.bind(r);r.remove=async function(){return c=!0,l.unsubscribe(),n.removeEventListener("message",s),a||await Je(t.databaseInstanceToken,r),h()}}}var Ye=(0,ce.z)(),Xe=function(){function e(e,t,r,a,n,i,s){this.changes$=new oe.x,this.instanceId=Ye++,this.storage=e,this.databaseName=t,this.collectionName=r,this.schema=a,this.internals=n,this.options=i,this.settings=s,this.primaryPath=T(this.schema.primaryKey)}var t=e.prototype;return t.bulkWrite=async function(e,t){tt(this),e.forEach((e=>{if(!e.document._rev||e.previous&&!e.previous._rev)throw I("SNH",{args:{row:e}})}));var r,a=await this.internals,n={success:[],error:[]},i=e.map((e=>e.document[this.primaryPath]));if(await a.dexieDb.transaction("rw",a.dexieTable,a.dexieAttachmentsTable,(async()=>{var s=new Map;(await ne(this.internals,i)).forEach((e=>{var t=e;return t&&s.set(t[this.primaryPath],t),t})),r=function(e,t,r,a,n,i,s){for(var o,c=!!e.schema.attachments,l=[],u=[],h=[],d={id:O(10),events:[],checkpoint:null,context:n,startTime:(0,ce.z)(),endTime:0},m=d.events,p=[],f=[],y=[],v=r.size>0,g=a.length,b=function(){var e,n=a[x],d=n.document,g=n.previous,b=d[t],w=d._deleted,j=g&&g._deleted,k=void 0;if(v&&(k=r.get(b)),k){var D=k._rev;if(!g||g&&D!==g._rev){var _={isError:!0,status:409,documentId:b,writeRow:n,documentInDb:k};return h.push(_),1}var R=c?Fe(n):n;c&&(w?g&&Object.keys(g._attachments).forEach((e=>{f.push({documentId:b,attachmentId:e,digest:(0,le.Is)(g)._attachments[e].digest})})):(Object.entries(d._attachments).find((t=>{let[r,a]=t;return(g?g._attachments[r]:void 0)||a.data||(e={documentId:b,documentInDb:k,isError:!0,status:510,writeRow:n,attachmentId:r}),!0})),e||Object.entries(d._attachments).forEach((e=>{let[t,r]=e;var a=g?g._attachments[t]:void 0;if(a){var n=R.document._attachments[t].digest;r.data&&a.digest!==n&&y.push({documentId:b,attachmentId:t,attachmentData:r,digest:r.digest})}else p.push({documentId:b,attachmentId:t,attachmentData:r,digest:r.digest})})))),e?h.push(e):(c?(u.push(Fe(R)),s&&s(d)):(u.push(R),s&&s(d)),o=R);var E=null,P=null,S=null;if(j&&!w)S="INSERT",E=c?Qe(d):d;else if(!g||j||w){if(!w)throw I("SNH",{args:{writeRow:n}});S="DELETE",E=(0,le.Is)(d),P=g}else S="UPDATE",E=c?Qe(d):d,P=g;var C={documentId:b,documentData:E,previousDocumentData:P,operation:S};m.push(C)}else{var O=!!w;if(c&&Object.entries(d._attachments).forEach((t=>{let[r,a]=t;a.data?p.push({documentId:b,attachmentId:r,attachmentData:a,digest:a.digest}):(e={documentId:b,isError:!0,status:510,writeRow:n,attachmentId:r},h.push(e))})),e||(c?(l.push(Fe(n)),i&&i(d)):(l.push(n),i&&i(d)),o=n),!O){var N={documentId:b,operation:"INSERT",documentData:c?Qe(d):d,previousDocumentData:c&&g?Qe(g):g};m.push(N)}}},x=0;x{n.success.push(e.document),o.push(e.document)})),r.bulkUpdateDocs.forEach((e=>{n.success.push(e.document),o.push(e.document)})),(o=o.map((e=>X(a.booleanIndexes,e)))).length>0&&await a.dexieTable.bulkPut(o);var c=[];r.attachmentsAdd.forEach((e=>{c.push({id:ie(e.documentId,e.attachmentId),data:e.attachmentData.data})})),r.attachmentsUpdate.forEach((e=>{c.push({id:ie(e.documentId,e.attachmentId),data:e.attachmentData.data})})),await a.dexieAttachmentsTable.bulkPut(c),await a.dexieAttachmentsTable.bulkDelete(r.attachmentsRemove.map((e=>ie(e.documentId,e.attachmentId))))})),(r=(0,le.Is)(r)).eventBulk.events.length>0){var s=(0,le.Is)(r.newestRow).document;r.eventBulk.checkpoint={id:s[this.primaryPath],lwt:s._meta.lwt},r.eventBulk.endTime=(0,ce.z)(),this.changes$.next(r.eventBulk)}return n},t.findDocumentsById=async function(e,t){tt(this);var r=await this.internals,a=[];return await r.dexieDb.transaction("r",r.dexieTable,(async()=>{(await ne(this.internals,e)).forEach((e=>{!e||e._deleted&&!t||a.push(e)}))})),a},t.query=function(e){return tt(this),Be(this,e)},t.count=async function(e){if(e.queryPlan.selectorSatisfiedByIndex){var t=await async function(e,t){var r=await e.internals,a=t.queryPlan,n=a.index,i=Ne(r.booleanIndexes,a,r.dexieDb._options.IDBKeyRange),s=-1;return await r.dexieDb.transaction("r",r.dexieTable,(async e=>{var t,r=e.idbtrans.objectStore(Q);t="["+n.map((e=>G(e))).join("+")+"]";var a=r.index(t).count(i);s=await new Promise(((e,t)=>{a.onsuccess=function(){e(a.result)},a.onerror=e=>t(e)}))})),s}(this,e);return{count:t,mode:"fast"}}return{count:(await Be(this,e)).documents.length,mode:"slow"}},t.changeStream=function(){return tt(this),this.changes$.asObservable()},t.cleanup=async function(e){tt(this);var t=await this.internals;return await t.dexieDb.transaction("rw",t.dexieTable,(async()=>{var r=(0,ce.z)()-e,a=await t.dexieTable.where("_meta.lwt").below(r).toArray(),n=[];a.forEach((e=>{"1"===e._deleted&&n.push(e[this.primaryPath])})),await t.dexieTable.bulkDelete(n)})),!0},t.getAttachmentData=async function(e,t,r){tt(this);var a=await this.internals,n=ie(e,t);return await a.dexieDb.transaction("r",a.dexieAttachmentsTable,(async()=>{var r=await a.dexieAttachmentsTable.get(n);if(r)return r.data;throw new Error("attachment missing documentId: "+e+" attachmentId: "+t)}))},t.remove=async function(){tt(this);var e=await this.internals;return await e.dexieTable.clear(),this.close()},t.close=function(){return this.closed||(this.closed=(async()=>{this.changes$.complete(),await async function(e){var t=await e,r=V.get(e)-1;0===r?(t.dexieDb.close(),V.delete(e)):V.set(e,r)}(this.internals)})()),this.closed},t.conflictResultionTasks=function(){return new oe.x},t.resolveConflictResultionTask=async function(e){},e}();async function et(e,t,r){var n=function(e,t,r,n){var o="rxdb-dexie-"+e+"--"+n.version+"--"+t,c=i(Z,o,(()=>{var e=(async()=>{var e=s(r);e.autoOpen=!1;var t=new a.U(o,e),i={[Q]:ae(n),[H]:"++sequence, id",[U]:"id"};return t.version(1).stores(i),await t.open(),{dexieDb:t,dexieTable:t[Q],dexieAttachmentsTable:t[U],booleanIndexes:se(n)}})();return Z.set(o,c),V.set(c,0),e}));return c}(t.databaseName,t.collectionName,r,t.schema),o=new Xe(e,t.databaseName,t.collectionName,t.schema,n,t.options,r);return await Ge(K,t,o),Promise.resolve(o)}function tt(e){if(e.closed)throw new Error("RxStorageInstanceDexie is closed "+e.databaseName+"-"+e.collectionName)}var rt="15.4.2",at=function(){function e(e){this.name=K,this.rxdbVersion=rt,this.settings=e}return e.prototype.createStorageInstance=function(e){return function(e){if(e.schema.keyCompression)throw I("UT5",{args:{params:e}});if((t=e.schema).encrypted&&t.encrypted.length>0||t.attachments&&t.attachments.encrypted)throw I("UT6",{args:{params:e}});var t;if(e.schema.attachments&&e.schema.attachments.compression)throw I("UT7",{args:{params:e}})}(e),et(this,e,this.settings)},e}();function nt(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,a;if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(a=r;0!=a--;)if(!nt(e[a],t[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e);if((r=n.length)!==Object.keys(t).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,n[a]))return!1;for(a=r;0!=a--;){var i=n[a];if(!nt(e[i],t[i]))return!1}return!0}return e!=e&&t!=t}var it={preAddRxPlugin:[],preCreateRxDatabase:[],createRxDatabase:[],preCreateRxCollection:[],createRxCollection:[],postDestroyRxCollection:[],postRemoveRxCollection:[],preCreateRxSchema:[],createRxSchema:[],preCreateRxQuery:[],prePrepareQuery:[],createRxDocument:[],postCreateRxDocument:[],preCreateRxStorageInstance:[],preMigrateDocument:[],postMigrateDocument:[],preDestroyRxDatabase:[],postRemoveRxDatabase:[],preReplicationMasterWrite:[],preReplicationMasterWriteDocumentsHandle:[]};function st(e,t){it[e]&&it[e].forEach((e=>e(t)))}function ot(e,t){return Promise.all(it[e].map((e=>e(t))))}var ct=function(){function e(e,t){this.jsonSchema=e,this.hashFunction=t,this.indexes=function(e){return(e.indexes||[]).map((e=>(0,g.AD)(e)?e:[e]))}(this.jsonSchema),this.primaryPath=T(this.jsonSchema.primaryKey),this.finalFields=F(this.jsonSchema)}var t=e.prototype;return t.validateChange=function(e,t){this.finalFields.forEach((r=>{if(!nt(e[r],t[r]))throw I("DOC9",{dataBefore:e,dataAfter:t,fieldName:r,schema:this.jsonSchema})}))},t.getDocumentPrototype=function(){var e={},t=M(this.jsonSchema,"");return Object.keys(t).forEach((t=>{var r=t;e.__defineGetter__(t,(function(){if(this.get&&"function"==typeof this.get)return this.get(r)})),Object.defineProperty(e,t+"$",{get:function(){return this.get$(r)},enumerable:!1,configurable:!1}),Object.defineProperty(e,t+"_",{get:function(){return this.populate(r)},enumerable:!1,configurable:!1})})),l(this,"getDocumentPrototype",(()=>e)),e},t.getPrimaryOfDocumentData=function(e){return L(this.jsonSchema,e)},(0,b.Z)(e,[{key:"version",get:function(){return this.jsonSchema.version}},{key:"defaultValues",get:function(){var e={};return Object.entries(this.jsonSchema.properties).filter((e=>{let[,t]=e;return Object.prototype.hasOwnProperty.call(t,"default")})).forEach((t=>{let[r,a]=t;return e[r]=a.default})),l(this,"defaultValues",e)}},{key:"hash",get:function(){return l(this,"hash",this.hashFunction(JSON.stringify(this.jsonSchema)))}}]),e}();function lt(e,t,r){void 0===r&&(r=!0),r&&st("preCreateRxSchema",e);var a=W(e);a=function(e){return o(e,!0)}(a),j.deepFreezeWhenDevMode(a);var n=new ct(a,t);return st("createRxSchema",n),n}var ut=r(598),ht=r(6621),dt=r(6728),mt=r(6005),pt=r(7570),ft=r(4419);function yt(e){var t=e.split("-"),r="RxDB";return t.forEach((e=>{r+=N(e)})),r+="Plugin",new Error("You are using a function which must be overwritten by a plugin.\n You should either prevent the usage of this function or add the plugin via:\n import { "+r+" } from 'rxdb/plugins/"+e+"';\n addRxPlugin("+r+");\n ")}function vt(e){return e.documentData?e.documentData:e.previousDocumentData}var gt=function(){function e(e,t,r,a){this.queueByDocId=new Map,this.isRunning=!1,this.storageInstance=e,this.primaryPath=t,this.preWrite=r,this.postWrite=a}var t=e.prototype;return t.addWrite=function(e,t){var r=e[this.primaryPath],a=i(this.queueByDocId,r,(()=>[]));return new Promise(((r,n)=>{var i={lastKnownDocumentState:e,modifier:t,resolve:r,reject:n};(0,le.Is)(a).push(i),this.triggerRun()}))},t.triggerRun=async function(){if(!0!==this.isRunning&&0!==this.queueByDocId.size){this.isRunning=!0;var e=[],t=this.queueByDocId;this.queueByDocId=new Map,await Promise.all(Array.from(t.entries()).map((async t=>{let[r,a]=t;var n,i,s,o=(n=a.map((e=>e.lastKnownDocumentState)),i=n[0],s=Ae(i._rev).height,n.forEach((e=>{var t=Ae(e._rev).height;t>s&&(i=e,s=t)})),i),l=o;for(var u of a)try{l=await u.modifier(c(l))}catch(h){u.reject(h),u.reject=()=>{},u.resolve=()=>{}}try{await this.preWrite(l,o)}catch(h){return void a.forEach((e=>e.reject(h)))}e.push({previous:o,document:l})})));var r=e.length>0?await this.storageInstance.bulkWrite(e,"incremental-write"):{error:[],success:[]};return await Promise.all(r.success.map((e=>{var r=e[this.primaryPath];this.postWrite(e),n(t,r).forEach((t=>t.resolve(e)))}))),r.error.forEach((e=>{var r,a=e.documentId,s=n(t,a),o=E(e);if(o){var c=i(this.queueByDocId,a,(()=>[]));s.reverse().forEach((e=>{e.lastKnownDocumentState=(0,le.Is)(o.documentInDb),(0,le.Is)(c).unshift(e)}))}else{var l=I("COL20",{name:P[(r=e).status],document:r.documentId,writeError:r});s.forEach((e=>e.reject(l)))}})),this.isRunning=!1,this.triggerRun()}},e}();function bt(e){return async t=>{var r=function(e){return Object.assign({},e,{_meta:void 0,_deleted:void 0,_rev:void 0})}(t);r._deleted=t._deleted;var a=await e(r),n=Object.assign({},a,{_meta:t._meta,_attachments:t._attachments,_rev:t._rev,_deleted:void 0!==a._deleted?a._deleted:t._deleted});return void 0===n._deleted&&(n._deleted=!1),n}}var xt={get primaryPath(){if(this.isInstanceOfRxDocument)return this.collection.schema.primaryPath},get primary(){var e=this;if(e.isInstanceOfRxDocument)return e._data[e.primaryPath]},get revision(){if(this.isInstanceOfRxDocument)return this._data._rev},get deleted$(){if(this.isInstanceOfRxDocument)return this.$.pipe((0,ut.U)((e=>e._data._deleted)))},get deleted(){if(this.isInstanceOfRxDocument)return this._data._deleted},getLatest(){var e=this.collection._docCache.getLatestDocumentData(this.primary);return this.collection._docCache.getCachedRxDocument(e)},get $(){return this.collection.$.pipe((0,ht.h)((e=>!e.isLocal)),(0,ht.h)((e=>e.documentId===this.primary)),(0,ut.U)((e=>vt(e))),(0,dt.O)(this.collection._docCache.getLatestDocumentData(this.primary)),(0,mt.x)(((e,t)=>e._rev===t._rev)),(0,ut.U)((e=>this.collection._docCache.getCachedRxDocument(e))),(0,pt.d)(le.kv))},get$(e){if(j.isDevMode()){if(e.includes(".item."))throw I("DOC1",{path:e});if(e===this.primaryPath)throw I("DOC2");if(this.collection.schema.finalFields.includes(e))throw I("DOC3",{path:e});if(!M(this.collection.schema.jsonSchema,e))throw I("DOC4",{path:e})}return this.$.pipe((0,ut.U)((t=>y(t,e))),(0,mt.x)())},populate(e){var t=M(this.collection.schema.jsonSchema,e),r=this.get(e);if(!r)return ft.m5;if(!t)throw I("DOC5",{path:e});if(!t.ref)throw I("DOC6",{path:e,schemaObj:t});var a=this.collection.database.collections[t.ref];if(!a)throw I("DOC7",{ref:t.ref,path:e,schemaObj:t});return"array"===t.type?a.findByIds(r).exec().then((e=>{var t=e.values();return Array.from(t)})):a.findOne(r).exec()},get(e){return i(this._propertyCache,e,(()=>{var t=y(this._data,e);if("object"!=typeof t||null===t||Array.isArray(t))return j.deepFreezeWhenDevMode(t);var r=this;return new Proxy(s(t),{get(t,a){if("string"!=typeof a)return t[a];var n=a.charAt(a.length-1);if("$"===n){var i=a.slice(0,-1);return r.get$(B(e+"."+i))}if("_"===n){var s=a.slice(0,-1);return r.populate(B(e+"."+s))}return r.get(B(e+"."+a))}})}))},toJSON(e){if(void 0===e&&(e=!1),e)return j.deepFreezeWhenDevMode(this._data);var t=s(this._data);return delete t._rev,delete t._attachments,delete t._deleted,delete t._meta,j.deepFreezeWhenDevMode(t)},toMutableJSON(e){return void 0===e&&(e=!1),c(this.toJSON(e))},update(e){throw yt("update")},incrementalUpdate(e){throw yt("update")},updateCRDT(e){throw yt("crdt")},putAttachment(){throw yt("attachments")},getAttachment(){throw yt("attachments")},allAttachments(){throw yt("attachments")},get allAttachments$(){throw yt("attachments")},async modify(e,t){var r=this._data,a=await bt(e)(r);return this._saveData(a,r)},incrementalModify(e,t){return this.collection.incrementalWriteQueue.addWrite(this._data,bt(e)).then((e=>this.collection._docCache.getCachedRxDocument(e)))},patch(e){var t=this._data,r=c(t);return Object.entries(e).forEach((e=>{let[t,a]=e;r[t]=a})),this._saveData(r,t)},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[r,a]=e;t[r]=a})),t)))},async _saveData(e,t){if(e=s(e),this._data._deleted)throw I("DOC11",{id:this.primary,document:this});await jt(this.collection,e,t);var r=await this.collection.storageInstance.bulkWrite([{previous:t,document:e}],"rx-document-save-data"),a=r.error[0];return ze(this.collection,this.primary,e,a),await this.collection._runHooks("post","save",e,this),this.collection._docCache.getCachedRxDocument(r.success[0])},remove(){var e=this.collection;if(this.deleted)return Promise.reject(I("DOC13",{document:this,id:this.primary}));var t,r=s(this._data);return e._runHooks("pre","remove",r,this).then((async()=>{r._deleted=!0;var t=await e.storageInstance.bulkWrite([{previous:this._data,document:r}],"rx-document-remove"),a=t.error[0];return ze(e,this.primary,r,a),t.success[0]})).then((e=>(t=e,this.collection._runHooks("post","remove",r,this)))).then((()=>this.collection._docCache.getCachedRxDocument(t)))},incrementalRemove(){return this.incrementalModify((async e=>(await this.collection._runHooks("pre","remove",e,this),e._deleted=!0,e))).then((async e=>(await this.collection._runHooks("post","remove",e._data,e),e)))},destroy(){throw I("DOC14")}};function wt(e){void 0===e&&(e=xt);var t=function(e,t){this.collection=e,this._data=t,this._propertyCache=new Map,this.isInstanceOfRxDocument=!0};return t.prototype=e,t}function jt(e,t,r){return t._meta=Object.assign({},r._meta,t._meta),j.isDevMode()&&e.schema.validateChange(r,t),e._runHooks("pre","save",t,r)}var kt=r(10),Dt=r(6871),_t=r(3028),It=r(1556),Rt=r(8456);function Et(e,t){return t.sort&&0!==t.sort.length?t.sort.map((e=>Object.keys(e)[0])):[e]}var Pt=new WeakMap;function St(e,t){if(!e.collection.database.eventReduce)return{runFullQueryAgain:!0};var r=function(e){return i(Pt,e,(()=>{var t=e.collection,r=Ee(t.storageInstance.schema,c(e.mangoQuery)),a=t.schema.primaryPath,n=Pe(t.schema.jsonSchema,r),i=Se(t.schema.jsonSchema,r);return{primaryKey:e.collection.schema.primaryPath,skip:r.skip,limit:r.limit,sortFields:Et(a,r),sortComparator:(t,r)=>{var a={docA:t,docB:r,rxQuery:e};return n(a.docA,a.docB)},queryMatcher:t=>i({doc:t,rxQuery:e}.doc)}}))}(e),a=(0,le.Is)(e._result).docsData.slice(0),n=(0,le.Is)(e._result).docsDataMap,s=!1;return t.map((e=>function(e){switch(e.operation){case"INSERT":return{operation:e.operation,id:e.documentId,doc:e.documentData,previous:null};case"UPDATE":return{operation:e.operation,id:e.documentId,doc:j.deepFreezeWhenDevMode(e.documentData),previous:e.previousDocumentData?e.previousDocumentData:"UNKNOWN"};case"DELETE":return{operation:e.operation,id:e.documentId,doc:null,previous:e.previousDocumentData}}}(e))).filter(g.S7).find((e=>{var t={queryParams:r,changeEvent:e,previousResults:a,keyDocumentMap:n},i=(0,Rt.Rf)(t);return"runFullQueryAgain"===i||("doNothing"!==i?(s=!0,(0,Rt.wu)(i,r,e,a,n),!1):void 0)}))?{runFullQueryAgain:!0}:{runFullQueryAgain:!1,changed:s,newResults:a}}var Ct=function(){function e(){this._map=new Map}return e.prototype.getByQuery=function(e){var t=e.toString();return i(this._map,t,(()=>e))},e}();function Ot(e,t){t.uncached=!0;var r=t.toString();e._map.delete(r)}function Nt(e){return e.refCount$.observers.length}var Bt,At,qt=(Bt=100,At=3e4,(e,t)=>{if(!(t._map.size0||(0===i._lastEnsureEqual&&i._creationTimee._lastEnsureEqual-t._lastEnsureEqual)).slice(0,s).forEach((e=>Ot(t,e)))}}),Mt=new WeakSet;var $t=function(){function e(e,t,r){this.cacheItemByDocId=new Map,this.registry="function"==typeof FinalizationRegistry?new FinalizationRegistry((e=>{var t=e.docId,r=this.cacheItemByDocId.get(t);r&&(r.byRev.delete(e.revisionHeight),0===r.byRev.size&&this.cacheItemByDocId.delete(t))})):void 0,this.registerIdleTasks=[],this.primaryPath=e,this.changes$=t,this.documentCreator=r,t.subscribe((e=>{var t=e.documentId,r=this.cacheItemByDocId.get(t);if(r){var a=vt(e);r.last=a}}))}var t=e.prototype;return t.getLatestDocumentData=function(e){return n(this.cacheItemByDocId,e).last},t.getLatestDocumentDataIfExists=function(e){var t=this.cacheItemByDocId.get(e);if(t)return t.last},(0,b.Z)(e,[{key:"getCachedRxDocument",get:function(){return l(this,"getCachedRxDocument",function(e){var t=e.primaryPath,r=e.cacheItemByDocId,a=e.registry,n=j.deepFreezeWhenDevMode,s=e.documentCreator,o=o=>{var c=o[t],l=qe(o._rev),u=i(r,c,(()=>function(e){return{byRev:new Map,last:e}}(o))),h=u.byRev,d=h.get(l),m=d?d.deref():void 0;return m||(o=n(o),m=s(o),h.set(l,Lt(m)),a&&(e.registerIdleTasks.push(m),e.registerIdlePromise||(e.registerIdlePromise=(0,ft.y$)().then((()=>{e.registerIdlePromise=void 0;var t=e.registerIdleTasks;0!==t.length&&(e.registerIdleTasks=[],t.forEach((e=>{a.register(e,{docId:e.primary,revisionHeight:qe(e.revision)})})))}))))),m};return o}(this))}}]),e}();function Tt(e,t){for(var r=e.getCachedRxDocument,a=[],n=0;ne}};var Wt=function(){function e(e,t,r){this.time=(0,ce.z)(),this.collection=e,this.count=r,this.documents=Tt(this.collection._docCache,t)}return(0,b.Z)(e,[{key:"docsData",get:function(){return l(this,"docsData",this.documents.map((e=>e._data)))}},{key:"docsDataMap",get:function(){var e=new Map;return this.documents.forEach((t=>{e.set(t.primary,t._data)})),l(this,"docsDataMap",e)}},{key:"docsMap",get:function(){for(var e=new Map,t=this.documents,r=0;r"string"!=typeof e)))return r.$eq}return!1}(this.collection.schema.primaryPath,t)}var t=e.prototype;return t._setResultData=function(e){if("number"!=typeof e){e instanceof Map&&(e=Array.from(e.values()));var t=new Wt(this.collection,e,e.length);this._result=t}else this._result=new Wt(this.collection,[],e)},t._execOverDatabase=async function(){if(this._execOverDatabaseCount=this._execOverDatabaseCount+1,this._lastExecStart=(0,ce.z)(),"count"===this.op){var e=this.getPreparedQuery(),t=await this.collection.storageInstance.count(e);if("slow"!==t.mode||this.collection.database.allowSlowCount)return t.count;throw I("QU14",{collection:this.collection,queryObj:this.mangoQuery})}if("findByIds"===this.op){var r=(0,le.Is)(this.mangoQuery.selector)[this.collection.schema.primaryPath].$in,a=new Map,n=[];if(r.forEach((e=>{var t=this.collection._docCache.getLatestDocumentDataIfExists(e);if(t){if(!t._deleted){var r=this.collection._docCache.getCachedRxDocument(t);a.set(e,r)}}else n.push(e)})),n.length>0)(await this.collection.storageInstance.findDocumentsById(n,!1)).forEach((e=>{var t=this.collection._docCache.getCachedRxDocument(e);a.set(t.primary,t)}));return a}var i=async function(e){var t=[],r=e.collection;if(e.isFindOneByIdQuery)if(Array.isArray(e.isFindOneByIdQuery)){var a=e.isFindOneByIdQuery;if(a=a.filter((r=>{var a=e.collection._docCache.getLatestDocumentDataIfExists(r);return!a||(a._deleted||t.push(a),!1)})),a.length>0){var n=await r.storageInstance.findDocumentsById(a,!1);(0,g.gu)(t,n)}}else{var i=e.isFindOneByIdQuery,s=e.collection._docCache.getLatestDocumentDataIfExists(i);if(!s){var o=await r.storageInstance.findDocumentsById([i],!1);o[0]&&(s=o[0])}s&&!s._deleted&&t.push(s)}else{var c=e.getPreparedQuery(),l=await r.storageInstance.query(c);t=l.documents}return t}(this);return i.then((e=>(this._lastExecEnd=(0,ce.z)(),e)))},t.exec=function(e){if(e&&"findOne"!==this.op)throw I("QU9",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return Ut(this).then((()=>(0,Dt.z)(this.$))).then((t=>{if(!t&&e)throw I("QU10",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return t}))},t.toString=function(){var e=o({op:this.op,query:this.mangoQuery,other:this.other},!0),t=JSON.stringify(e);return this.toString=()=>t,t},t.getPreparedQuery=function(){var e={rxQuery:this,mangoQuery:Ee(this.collection.schema.jsonSchema,this.mangoQuery)};e.mangoQuery.selector._deleted={$eq:!1},e.mangoQuery.index&&e.mangoQuery.index.unshift("_deleted"),st("prePrepareQuery",e);var t=Kt(this.collection.schema.jsonSchema,e.mangoQuery);return this.getPreparedQuery=()=>t,t},t.doesDocumentDataMatch=function(e){return!e._deleted&&this.queryMatcher(e)},t.remove=function(){return this.exec().then((e=>Array.isArray(e)?Promise.all(e.map((e=>e.remove()))):e.remove()))},t.update=function(e){throw yt("update")},t.where=function(e){throw yt("query-builder")},t.sort=function(e){throw yt("query-builder")},t.skip=function(e){throw yt("query-builder")},t.limit=function(e){throw yt("query-builder")},(0,b.Z)(e,[{key:"$",get:function(){if(!this._$){var e=this.collection.$.pipe((0,ht.h)((e=>!e.isLocal)),(0,dt.O)(null),(0,It.z)((()=>Ut(this))),(0,ut.U)((()=>this._result)),(0,pt.d)(le.kv),(0,mt.x)(((e,t)=>!(!e||e.time!==(0,le.Is)(t).time))),(0,ht.h)((e=>!!e)),(0,ut.U)((e=>{var t=(0,le.Is)(e);return"count"===this.op?t.count:"findOne"===this.op?0===t.documents.length?null:t.documents[0]:"findByIds"===this.op?t.docsMap:t.documents.slice(0)})));this._$=(0,_t.T)(e,this.refCount$.pipe((0,ht.h)((()=>!1))))}return this._$}},{key:"queryMatcher",get:function(){this.collection.schema.jsonSchema;return l(this,"queryMatcher",Se(0,Ee(this.collection.schema.jsonSchema,this.mangoQuery)))}},{key:"asRxQuery",get:function(){return this}}]),e}();function Qt(e,t,r,a){st("preCreateRxQuery",{op:e,queryObj:t,collection:r,other:a});var n,i,s=new Ft(e,t,r,a);return s=(n=s).collection._queryCache.getByQuery(n),i=r,Mt.has(i)||(Mt.add(i),(0,ft.Y3)().then((()=>(0,ft.C2)(200))).then((()=>{i.destroyed||i.cacheReplacementPolicy(i,i._queryCache),Mt.delete(i)}))),s}function Ht(e){var t=e.asRxQuery.collection._changeEventBuffer.counter;return e._latestChangeEvent>=t}function Ut(e){return e.collection.database.destroyed||Ht(e)?ft.kZ:(e._ensureEqualQueue=e._ensureEqualQueue.then((()=>function(e){if(e._lastEnsureEqual=(0,ce.z)(),e.collection.database.destroyed||Ht(e))return ft.kZ;var t=!1,r=!1;-1===e._latestChangeEvent&&(r=!0);if(!r){var a=e.asRxQuery.collection._changeEventBuffer.getFrom(e._latestChangeEvent+1);if(null===a)r=!0;else{e._latestChangeEvent=e.asRxQuery.collection._changeEventBuffer.counter;var n=e.asRxQuery.collection._changeEventBuffer.reduceByLastOfDoc(a);if("count"===e.op){var i=(0,le.Is)(e._result).count,s=i;n.forEach((t=>{var r=t.previousDocumentData&&e.doesDocumentDataMatch(t.previousDocumentData),a=e.doesDocumentDataMatch(t.documentData);!r&&a&&s++,r&&!a&&s--})),s!==i&&(t=!0,e._setResultData(s))}else{var o=St(e,n);o.runFullQueryAgain?r=!0:o.changed&&(t=!0,e._setResultData(o.newResults))}}}if(r)return e._execOverDatabase().then((r=>(e._latestChangeEvent=e.collection._changeEventBuffer.counter,"number"==typeof r?(e._result&&r===e._result.count||(t=!0,e._setResultData(r)),t):(e._result&&function(e,t,r){if(t.length!==r.length)return!1;for(var a=0,n=t.length;ae.data.name===n)),c=[];o.forEach((e=>{c.push({collectionName:e.data.name,schema:e.data.schema,isCollection:!0}),e.data.connectedStorages.forEach((e=>c.push({collectionName:e.collectionName,isCollection:!1,schema:e.schema})))}));var l=new Set;if(c=c.filter((e=>{var t=e.collectionName+"||"+e.schema.version;return!l.has(t)&&(l.add(t),!0)})),await Promise.all(c.map((async t=>{var s=await e.createStorageInstance({collectionName:t.collectionName,databaseInstanceToken:r,databaseName:a,multiInstance:!1,options:{},schema:t.schema,password:i,devMode:j.isDevMode()});await s.remove(),t.isCollection&&await ot("postRemoveRxCollection",{storage:e,databaseName:a,collectionName:n})}))),s){var u=o.map((e=>{var t=He(e);return t._deleted=!0,t._meta.lwt=(0,ce.z)(),t._rev=Me(r,e),{previous:e,document:t}}));await t.bulkWrite(u,"rx-database-remove-collection-all")}}var nr=function(){function e(e){this.subs=[],this.limit=100,this.counter=0,this.eventCounterMap=new WeakMap,this.buffer=[],this.collection=e,this.subs.push(this.collection.$.pipe((0,ht.h)((e=>!e.isLocal))).subscribe((e=>this._handleChangeEvent(e))))}var t=e.prototype;return t._handleChangeEvent=function(e){for(this.counter++,this.buffer.push(e),this.eventCounterMap.set(e,this.counter);this.buffer.length>this.limit;)this.buffer.shift()},t.getArrayIndexByPointer=function(e){var t=this.buffer[0],r=this.eventCounterMap.get(t);return et(e)))},t.reduceByLastOfDoc=function(e){return e.slice(0)},t.destroy=function(){this.subs.forEach((e=>e.unsubscribe()))},e}();var ir=new WeakMap;function sr(e){var t=e.schema.getDocumentPrototype(),r=function(e){var t={};return Object.entries(e.methods).forEach((e=>{let[r,a]=e;t[r]=a})),t}(e),a={};return[t,r,xt].forEach((e=>{Object.getOwnPropertyNames(e).forEach((t=>{var r=Object.getOwnPropertyDescriptor(e,t),n=!0;(t.startsWith("_")||t.endsWith("_")||t.startsWith("$")||t.endsWith("$"))&&(n=!1),"function"==typeof r.value?Object.defineProperty(a,t,{get(){return r.value.bind(this)},enumerable:n,configurable:!1}):(r.enumerable=n,r.configurable=!1,r.writable&&(r.writable=!1),Object.defineProperty(a,t,r))}))})),a}function or(e,t){var r=function(e,t,r){var a=new e(t,r);return st("createRxDocument",a),a}(function(e){return i(ir,e,(()=>wt(sr(e))))}(e),e,j.deepFreezeWhenDevMode(t));return e._runHooksSync("post","create",t,r),st("postCreateRxDocument",r),r}var cr=function(e,t){return nt(Qe(e.newDocumentState),Qe(e.realMasterState))?Promise.resolve({isEqual:!0}):Promise.resolve({isEqual:!1,documentData:e.realMasterState})};var lr=["pre","post"],ur=["insert","save","remove","create"],hr=!1,dr=function(){function e(e,t,r,a,n,i,s,o,c,l,u,h){void 0===n&&(n={}),void 0===i&&(i={}),void 0===s&&(s={}),void 0===o&&(o={}),void 0===c&&(c={}),void 0===l&&(l=qt),void 0===u&&(u={}),void 0===h&&(h=cr),this.storageInstance={},this.timeouts=new Set,this.incrementalWriteQueue={},this._incrementalUpsertQueues=new Map,this.synced=!1,this.hooks={},this._subs=[],this._docCache={},this._queryCache=new Ct,this.$={},this.checkpoint$={},this._changeEventBuffer={},this.onDestroy=[],this.destroyed=!1,this.database=e,this.name=t,this.schema=r,this.internalStorageInstance=a,this.instanceCreationOptions=n,this.migrationStrategies=i,this.methods=s,this.attachments=o,this.options=c,this.cacheReplacementPolicy=l,this.statics=u,this.conflictHandler=h,function(e){if(hr)return;hr=!0;var t=Object.getPrototypeOf(e);ur.forEach((e=>{lr.map((r=>{var a=r+N(e);t[a]=function(t,a){return this.addHook(r,e,t,a)}}))}))}(this.asRxCollection)}var t=e.prototype;return t.prepare=async function(){this.storageInstance=Ue(this.database,this.internalStorageInstance,this.schema.jsonSchema),this.incrementalWriteQueue=new gt(this.storageInstance,this.schema.primaryPath,((e,t)=>jt(this,e,t)),(e=>this._runHooks("post","save",e)));var e,t=this.database.eventBulks$.pipe((0,ht.h)((e=>e.collectionName===this.name)));this.$=t.pipe((0,It.z)((e=>e.events))),this.checkpoint$=t.pipe((0,ut.U)((e=>e.checkpoint))),this._changeEventBuffer=(e=this.asRxCollection,new nr(e)),this._docCache=new $t(this.schema.primaryPath,this.$.pipe((0,ht.h)((e=>!e.isLocal))),(e=>or(this.asRxCollection,e)));var r=await this.database.storageToken,a=this.storageInstance.changeStream().subscribe((e=>{var t={id:e.id,internal:!1,collectionName:this.name,storageToken:r,events:e.events.map((e=>We(!1,e,this))),databaseToken:this.database.token,checkpoint:e.checkpoint,context:e.context,endTime:e.endTime,startTime:e.startTime};this.database.$emit(t)}));return this._subs.push(a),this._subs.push(this.storageInstance.conflictResultionTasks().subscribe((e=>{this.conflictHandler(e.input,e.context).then((t=>{this.storageInstance.resolveConflictResultionTask({id:e.id,output:t})}))}))),ft.$Y},t.cleanup=function(e){throw yt("cleanup")},t.migrationNeeded=function(){throw yt("migration-schema")},t.getMigrationState=function(){throw yt("migration-schema")},t.startMigration=function(e){return void 0===e&&(e=10),this.getMigrationState().startMigration(e)},t.migratePromise=function(e){return void 0===e&&(e=10),this.getMigrationState().migratePromise(e)},t.insert=async function(e){var t=await this.bulkInsert([e]),r=t.error[0];return ze(this,e[this.schema.primaryPath],e,r),(0,le.Is)(t.success[0])},t.bulkInsert=async function(e){if(0===e.length)return{success:[],error:[]};var t=this.schema.primaryPath,r=e.map((e=>rr(this.schema,e))),a=this.hasHooks("pre","insert")?await Promise.all(r.map((e=>this._runHooks("pre","insert",e).then((()=>e))))):r,n=a.map((e=>({document:e}))),i=await this.storageInstance.bulkWrite(n,"rx-collection-bulk-insert"),s=Tt(this._docCache,i.success);if(this.hasHooks("post","insert")){var o=new Map;a.forEach((e=>{o.set(e[t],e)})),await Promise.all(s.map((e=>this._runHooks("post","insert",o.get(e.primary),e))))}return{success:s,error:i.error}},t.bulkRemove=async function(e){var t=this.schema.primaryPath;if(0===e.length)return{success:[],error:[]};var r=await this.findByIds(e).exec(),a=[],i=new Map;Array.from(r.values()).forEach((e=>{var t=e.toMutableJSON(!0);a.push(t),i.set(e.primary,t)})),await Promise.all(a.map((e=>{var t=e[this.schema.primaryPath];return this._runHooks("pre","remove",e,r.get(t))})));var o=a.map((e=>{var t=s(e);return t._deleted=!0,{previous:e,document:t}})),c=await this.storageInstance.bulkWrite(o,"rx-collection-bulk-remove"),l=c.success.map((e=>e[t]));return await Promise.all(l.map((e=>this._runHooks("post","remove",i.get(e),r.get(e))))),{success:l.map((e=>n(r,e))),error:c.error}},t.bulkUpsert=async function(e){var t=[],r=new Map;e.forEach((e=>{var a=rr(this.schema,e),n=a[this.schema.primaryPath];if(!n)throw I("COL3",{primaryPath:this.schema.primaryPath,data:a,schema:this.schema.jsonSchema});r.set(n,a),t.push(a)}));var a=await this.bulkInsert(t),i=a.success.slice(0),s=[];return await Promise.all(a.error.map((async e=>{if(409!==e.status)s.push(e);else{var t=e.documentId,a=n(r,t),o=(0,le.Is)(e.documentInDb),c=this._docCache.getCachedRxDocument(o),l=await c.incrementalModify((()=>a));i.push(l)}}))),{error:s,success:i}},t.upsert=async function(e){var t=await this.bulkUpsert([e]);return ze(this.asRxCollection,e[this.schema.primaryPath],e,t.error[0]),t.success[0]},t.incrementalUpsert=function(e){var t=rr(this.schema,e),r=t[this.schema.primaryPath];if(!r)throw I("COL4",{data:e});var a=this._incrementalUpsertQueues.get(r);return a||(a=ft.$Y),a=a.then((()=>function(e,t,r){var a=e._docCache.getLatestDocumentDataIfExists(t);if(a)return Promise.resolve({doc:e._docCache.getCachedRxDocument(a),inserted:!1});return e.findOne(t).exec().then((t=>t?{doc:t,inserted:!1}:e.insert(r).then((e=>({doc:e,inserted:!0})))))}(this,r,t))).then((e=>e.inserted?e.doc:function(e,t){return e.incrementalModify((e=>t))}(e.doc,t))),this._incrementalUpsertQueues.set(r,a),a},t.find=function(e){if("string"==typeof e)throw I("COL5",{queryObj:e});return e||(e={selector:{}}),Qt("find",e,this)},t.findOne=function(e){if("number"==typeof e||Array.isArray(e))throw R("COL6",{queryObj:e});var t;if("string"==typeof e)t=Qt("findOne",{selector:{[this.schema.primaryPath]:e},limit:1},this);else{if(e||(e={selector:{}}),e.limit)throw I("QU6");(e=s(e)).limit=1,t=Qt("findOne",e,this)}return t},t.count=function(e){return e||(e={selector:{}}),Qt("count",e,this)},t.findByIds=function(e){return Qt("findByIds",{selector:{[this.schema.primaryPath]:{$in:e.slice(0)}}},this)},t.exportJSON=function(){throw yt("json-dump")},t.importJSON=function(e){throw yt("json-dump")},t.insertCRDT=function(e){throw yt("crdt")},t.addHook=function(e,t,r,a){if(void 0===a&&(a=!1),"function"!=typeof r)throw R("COL7",{key:t,when:e});if(!lr.includes(e))throw R("COL8",{key:t,when:e});if(!ur.includes(t))throw I("COL9",{key:t});if("post"===e&&"create"===t&&!0===a)throw I("COL10",{when:e,key:t,parallel:a});var n=r.bind(this),i=a?"parallel":"series";this.hooks[t]=this.hooks[t]||{},this.hooks[t][e]=this.hooks[t][e]||{series:[],parallel:[]},this.hooks[t][e][i].push(n)},t.getHooks=function(e,t){return this.hooks[t]&&this.hooks[t][e]?this.hooks[t][e]:{series:[],parallel:[]}},t.hasHooks=function(e,t){var r=this.getHooks(e,t);return!!r&&(r.series.length>0||r.parallel.length>0)},t._runHooks=function(e,t,r,a){var n=this.getHooks(e,t);if(!n)return ft.$Y;var i=n.series.map((e=>()=>e(r,a)));return(0,ft.Ze)(i).then((()=>Promise.all(n.parallel.map((e=>e(r,a))))))},t._runHooksSync=function(e,t,r,a){var n=this.getHooks(e,t);n&&n.series.forEach((e=>e(r,a)))},t.promiseWait=function(e){return new Promise((t=>{var r=setTimeout((()=>{this.timeouts.delete(r),t()}),e);this.timeouts.add(r)}))},t.destroy=function(){return this.destroyed?ft.kZ:(this.destroyed=!0,Array.from(this.timeouts).forEach((e=>clearTimeout(e))),this._changeEventBuffer&&this._changeEventBuffer.destroy(),this.database.requestIdlePromise().then((()=>Promise.all(this.onDestroy.map((e=>e()))))).then((()=>this.storageInstance.close())).then((()=>(this._subs.forEach((e=>e.unsubscribe())),delete this.database.collections[this.name],ot("postDestroyRxCollection",this).then((()=>!0))))))},t.remove=async function(){await this.destroy(),await ar(this.database.storage,this.database.internalStore,this.database.token,this.database.name,this.name,this.database.password,this.database.hashFunction)},(0,b.Z)(e,[{key:"insert$",get:function(){return this.$.pipe((0,ht.h)((e=>"INSERT"===e.operation)))}},{key:"update$",get:function(){return this.$.pipe((0,ht.h)((e=>"UPDATE"===e.operation)))}},{key:"remove$",get:function(){return this.$.pipe((0,ht.h)((e=>"DELETE"===e.operation)))}},{key:"asRxCollection",get:function(){return this}}]),e}();var mr=r(7782),pr=r(6753);var fr="undefined"!=typeof crypto&&void 0!==crypto.subtle&&"function"==typeof crypto.subtle.digest?async function(e){var t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-256",t);return Array.prototype.map.call(new Uint8Array(r),(e=>("00"+e.toString(16)).slice(-2))).join("")}:function(e){return Promise.resolve((0,pr.JQ)(e))},yr=r(5898),vr=new Set,gr=function(){function e(e,t,r,a,n,i,s,o,c,l,u,h){void 0===s&&(s=!1),void 0===o&&(o={}),this.idleQueue=new mr.F,this.rxdbVersion=rt,this.storageInstances=new Set,this._subs=[],this.startupErrors=[],this.onDestroy=[],this.destroyed=!1,this.collections={},this.eventBulks$=new oe.x,this.observable$=this.eventBulks$.pipe((0,It.z)((e=>e.events))),this.storageToken=ft.kZ,this.storageTokenDocument=ft.kZ,this.emittedEventBulkIds=new yr.i(6e4),this.name=e,this.token=t,this.storage=r,this.instanceCreationOptions=a,this.password=n,this.multiInstance=i,this.eventReduce=s,this.options=o,this.internalStore=c,this.hashFunction=l,this.cleanupPolicy=u,this.allowSlowCount=h,"pseudoInstance"!==this.name&&(this.internalStore=Ue(this.asRxDatabase,c,Jt),this.storageTokenDocument=async function(e){var t=O(10),r=e.password?await e.hashFunction(JSON.stringify(e.password)):void 0,a={id:er,context:Vt,key:Xt,data:{rxdbVersion:e.rxdbVersion,token:t,instanceToken:e.token,passwordHash:r},_deleted:!1,_meta:q(),_rev:"",_attachments:{}},n=await e.internalStore.bulkWrite([{document:a}],"internal-add-storage-token");if(n.success[0])return n.success[0];var i=(0,le.Is)(n.error[0]);if(i.isError&&E(i)){var s=i;if(c=s.documentInDb.data.rxdbVersion,l=e.rxdbVersion,!c||l.includes("beta")&&l!==c||c.split(".")[0]!==l.split(".")[0])throw I("DM5",{args:{database:e.name,databaseStateVersion:s.documentInDb.data.rxdbVersion,codeVersion:e.rxdbVersion}});if(r&&r!==s.documentInDb.data.passwordHash)throw I("DB1",{passwordHash:r,existingPasswordHash:s.documentInDb.data.passwordHash});var o=s.documentInDb;return(0,le.Is)(o)}var c,l;throw i}(this.asRxDatabase).catch((e=>this.startupErrors.push(e))),this.storageToken=this.storageTokenDocument.then((e=>e.data.token)).catch((e=>this.startupErrors.push(e))))}var t=e.prototype;return t.$emit=function(e){this.emittedEventBulkIds.has(e.id)||(this.emittedEventBulkIds.add(e.id),this.eventBulks$.next(e))},t.removeCollectionDoc=async function(e,t){var r=await Te(this.internalStore,Gt(tr(e,t),Zt));if(!r)throw I("SNH",{name:e,schema:t});var a=He(r);a._deleted=!0,await this.internalStore.bulkWrite([{document:a,previous:r}],"rx-database-remove-collection")},t.addCollections=async function(e){var t={},r={},a=[],n={};await Promise.all(Object.entries(e).map((async e=>{let[i,o]=e;var c=i,l=o.schema;t[c]=l;var u=lt(l,this.hashFunction);if(r[c]=u,this.collections[i])throw I("DB3",{name:i});var h=tr(i,l),d={id:Gt(h,Zt),key:h,context:Zt,data:{name:c,schemaHash:await u.hash,schema:u.jsonSchema,version:u.version,connectedStorages:[]},_deleted:!1,_meta:q(),_rev:"",_attachments:{}};a.push({document:d});var m=Object.assign({},o,{name:c,schema:u,database:this}),p=s(o);p.database=this,p.name=i,st("preCreateRxCollection",p),m.conflictHandler=p.conflictHandler,n[c]=m})));var i=await this.internalStore.bulkWrite(a,"rx-database-add-collection");await async function(e){if(await e.storageToken,e.startupErrors[0])throw e.startupErrors[0]}(this),await Promise.all(i.error.map((async e=>{if(409!==e.status)throw I("DB12",{database:this.name,writeError:e});var a=(0,le.Is)(e.documentInDb),n=a.data.name,i=r[n];if(a.data.schemaHash!==await i.hash)throw I("DB6",{database:this.name,collection:n,previousSchemaHash:a.data.schemaHash,schemaHash:await i.hash,previousSchema:a.data.schema,schema:(0,le.Is)(t[n])})})));var o={};return await Promise.all(Object.keys(e).map((async e=>{var t=n[e],r=await function(e){let{database:t,name:r,schema:a,instanceCreationOptions:n={},migrationStrategies:i={},autoMigrate:s=!0,statics:o={},methods:c={},attachments:l={},options:u={},localDocuments:h=!1,cacheReplacementPolicy:d=qt,conflictHandler:m=cr}=e;var p={databaseInstanceToken:t.token,databaseName:t.name,collectionName:r,schema:a.jsonSchema,options:n,multiInstance:t.multiInstance,password:t.password,devMode:j.isDevMode()};return st("preCreateRxStorageInstance",p),async function(e,t){return t.multiInstance=e.multiInstance,await e.storage.createStorageInstance(t)}(t,p).then((e=>{var p=new dr(t,r,a,e,n,i,c,l,u,d,o,m);return p.prepare().then((()=>{Object.entries(o).forEach((e=>{let[t,r]=e;Object.defineProperty(p,t,{get:()=>r.bind(p)})}));var e=ft.$Y;return s&&0!==p.schema.version&&(e=p.migratePromise()),e})).then((()=>(st("createRxCollection",{collection:p,creator:{name:r,schema:a,storageInstance:e,instanceCreationOptions:n,migrationStrategies:i,methods:c,attachments:l,options:u,cacheReplacementPolicy:d,localDocuments:h,statics:o}}),p))).catch((t=>e.close().then((()=>Promise.reject(t)))))}))}(t);o[e]=r,this.collections[e]=r,this[e]||Object.defineProperty(this,e,{get:()=>this.collections[e]})}))),o},t.lockedRun=function(e){return this.idleQueue.wrapCall(e)},t.requestIdlePromise=function(){return this.idleQueue.requestIdlePromise()},t.exportJSON=function(e){throw yt("json-dump")},t.importJSON=function(e){throw yt("json-dump")},t.backup=function(e){throw yt("backup")},t.leaderElector=function(){throw yt("leader-election")},t.isLeader=function(){throw yt("leader-election")},t.waitForLeadership=function(){throw yt("leader-election")},t.migrationStates=function(){throw yt("migration-schema")},t.destroy=async function(){return this.destroyed?ft.kZ:(this.destroyed=!0,await ot("preDestroyRxDatabase",this),this.eventBulks$.complete(),this._subs.map((e=>e.unsubscribe())),"pseudoInstance"===this.name?ft.kZ:this.requestIdlePromise().then((()=>Promise.all(this.onDestroy.map((e=>e()))))).then((()=>Promise.all(Object.keys(this.collections).map((e=>this.collections[e])).map((e=>e.destroy()))))).then((()=>this.internalStore.close())).then((()=>vr.delete(this.name))).then((()=>!0)))},t.remove=function(){return this.destroy().then((()=>async function(e,t,r){var a=O(10),n=await br(a,t,e,{},!1,r),i=await Yt(n),s=new Set;i.forEach((e=>s.add(e.data.name)));var o=Array.from(s);return await Promise.all(o.map((i=>ar(t,n,a,e,i,r)))),await ot("postRemoveRxDatabase",{databaseName:e,storage:t}),await n.remove(),o}(this.name,this.storage,this.password)))},(0,b.Z)(e,[{key:"$",get:function(){return this.observable$}},{key:"asRxDatabase",get:function(){return this}}]),e}();async function br(e,t,r,a,n,i){return await t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:$e,schema:Jt,options:a,multiInstance:n,password:i,devMode:j.isDevMode()})}function xr(e){let{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:i=!0,eventReduce:s=!0,ignoreDuplicate:o=!1,options:c={},cleanupPolicy:l,allowSlowCount:u=!1,localDocuments:h=!1,hashFunction:d=fr}=e;st("preCreateRxDatabase",{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:i,eventReduce:s,ignoreDuplicate:o,options:c,localDocuments:h}),o||function(e){if(vr.has(e))throw I("DB8",{name:e,link:"https://pubkey.github.io/rxdb/rx-database.html#ignoreduplicate"})}(a),vr.add(a);var m=O(10);return br(m,t,a,r,i,n).catch((e=>{throw vr.delete(a),e})).then((e=>{var p=new gr(a,m,t,r,n,i,s,c,e,d,l,u);return ot("createRxDatabase",{database:p,creator:{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:i,eventReduce:s,ignoreDuplicate:o,options:c,localDocuments:h}}).then((()=>p))}))}var wr={RxSchema:ct.prototype,RxDocument:xt,RxQuery:Ft.prototype,RxCollection:dr.prototype,RxDatabase:gr.prototype},jr=new Set,kr=new Set;var Dr=function(e){function t(t,r,a){var n;return(n=e.call(this,null,r)||this).id=t,n.parent=a,n}return(0,x.Z)(t,e),t}(wt()),_r={get isLocal(){return!0},get allAttachments$(){throw I("LD1",{document:this})},get primaryPath(){return"id"},get primary(){return this.id},get $(){var e=n(Pr,this.parent);return this.parent.$.pipe((0,ht.h)((e=>e.documentId===this.primary)),(0,ht.h)((e=>e.isLocal)),(0,ut.U)((e=>vt(e))),(0,dt.O)(e.docCache.getLatestDocumentData(this.primary)),(0,mt.x)(((e,t)=>e._rev===t._rev)),(0,ut.U)((t=>e.docCache.getCachedRxDocument(t))),(0,pt.d)(le.kv))},getLatest(){var e=n(Pr,this.parent),t=e.docCache.getLatestDocumentData(this.primary);return e.docCache.getCachedRxDocument(t)},get(e){if(e="data."+e,this._data){if("string"!=typeof e)throw R("LD2",{objPath:e});var t=y(this._data,e);return t=j.deepFreezeWhenDevMode(t)}},get$(e){if(e="data."+e,j.isDevMode()){if(e.includes(".item."))throw I("LD3",{objPath:e});if(e===this.primaryPath)throw I("LD4")}return this.$.pipe((0,ut.U)((e=>e._data)),(0,ut.U)((t=>y(t,e))),(0,mt.x)())},async incrementalModify(e){var t=await Cr(this.parent);return t.incrementalWriteQueue.addWrite(this._data,(async t=>(t.data=await e(t.data,this),t))).then((e=>t.docCache.getCachedRxDocument(e)))},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[r,a]=e;t[r]=a})),t)))},async _saveData(e){var t=await Cr(this.parent),r=this._data;return e.id=this.id,t.storageInstance.bulkWrite([{previous:r,document:e}],"local-document-save-data").then((t=>{var r=t.success[0];if(!r)throw t.error[0];(e=s(e))._rev=r._rev}))},async remove(){var e=await Cr(this.parent),t={id:this._data.id,data:{},_deleted:!0,_meta:q(),_rev:"",_attachments:{}};return Le(e.storageInstance,{previous:this._data,document:t},"local-document-remove").then((t=>e.docCache.getCachedRxDocument(t)))}},Ir=!1,Rr=()=>{if(!Ir){Ir=!0;var e=xt;Object.getOwnPropertyNames(e).forEach((t=>{if(!Object.getOwnPropertyDescriptor(_r,t)){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(_r,t,r)}}));["populate","update","putAttachment","getAttachment","allAttachments"].forEach((e=>_r[e]=(e=>()=>{throw I("LD6",{functionName:e})})(e)))}};var Er=new WeakMap,Pr=new WeakMap;function Sr(e){var t=e.database?e.database:e,r=e.database?e.name:"",a=(async()=>{var a=await Or(t.token,t.storage,t.name,r,t.instanceCreationOptions,t.multiInstance);a=Ue(t,a,qr);var n=new $t("id",e.$.pipe((0,ht.h)((e=>e.isLocal))),(t=>function(e,t){Rr();var r=new Dr(e.id,e,t);return Object.setPrototypeOf(r,_r),r.prototype=_r,r}(t,e))),i=new gt(a,"id",(()=>{}),(()=>{})),s=await t.storageToken,o=a.changeStream().subscribe((r=>{var a={id:r.id,internal:!1,collectionName:e.database?e.name:void 0,storageToken:s,events:r.events.map((t=>We(!0,t,e.database?e:void 0))),databaseToken:t.token,checkpoint:r.checkpoint,context:r.context,endTime:r.endTime,startTime:r.startTime};t.$emit(a)}));e._subs.push(o);var c={database:t,parent:e,storageInstance:a,docCache:n,incrementalWriteQueue:i};return Pr.set(e,c),c})();Er.set(e,a)}function Cr(e){var t=Er.get(e);if(!t){var r=e.database?e.database:e,a=e.database?e.name:"";throw I("LD8",{database:r.name,collection:a})}return t}function Or(e,t,r,a,n,i){return t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:Ar(a),schema:qr,options:n,multiInstance:i,devMode:j.isDevMode()})}function Nr(e){var t=Er.get(e);if(t)return Er.delete(e),t.then((e=>e.storageInstance.close()))}async function Br(e,t,r){var a=O(10),n=await Or(a,e,t,r,{},!1);await n.remove()}function Ar(e){return"plugin-local-documents-"+e}var qr=W({title:"RxLocalDocument",version:0,primaryKey:"id",type:"object",properties:{id:{type:"string",maxLength:128},data:{type:"object",additionalProperties:!0}},required:["id","data"]});async function Mr(e,t){var r=await Cr(this),a={id:e,data:t,_deleted:!1,_meta:q(),_rev:"",_attachments:{}};return Le(r.storageInstance,{document:a},"local-document-insert").then((e=>r.docCache.getCachedRxDocument(e)))}function $r(e,t){return this.getLocal(e).then((r=>r?r.incrementalModify((()=>t)):this.insertLocal(e,t)))}async function Tr(e){var t=await Cr(this),r=t.docCache,a=r.getLatestDocumentDataIfExists(e);return a?Promise.resolve(r.getCachedRxDocument(a)):Te(t.storageInstance,e).then((e=>e?t.docCache.getCachedRxDocument(e):null))}function Lr(e){return this.$.pipe((0,dt.O)(null),(0,It.z)((async t=>t?{changeEvent:t}:{doc:await this.getLocal(e)})),(0,It.z)((async t=>{if(t.changeEvent){var r=t.changeEvent;return r.isLocal&&r.documentId===e?{use:!0,doc:await this.getLocal(e)}:{use:!1}}return{use:!0,doc:t.doc}})),(0,ht.h)((e=>e.use)),(0,ut.U)((e=>e.doc)))}var Wr={name:"local-documents",rxdb:!0,prototypes:{RxCollection:e=>{e.insertLocal=Mr,e.upsertLocal=$r,e.getLocal=Tr,e.getLocal$=Lr},RxDatabase:e=>{e.insertLocal=Mr,e.upsertLocal=$r,e.getLocal=Tr,e.getLocal$=Lr}},hooks:{createRxDatabase:{before:e=>{e.creator.localDocuments&&Sr(e.database)}},createRxCollection:{before:e=>{e.creator.localDocuments&&Sr(e.collection)}},preDestroyRxDatabase:{after:e=>Nr(e)},postDestroyRxCollection:{after:e=>Nr(e)},postRemoveRxDatabase:{after:e=>Br(e.storage,e.databaseName,"")},postRemoveRxCollection:{after:e=>Br(e.storage,e.databaseName,e.collectionName)}},overwritable:{}};let zr;function Fr(){return"undefined"!=typeof window&&window.indexedDB}function Qr(){return zr||(zr=(async()=>{!function(e){if(st("preAddRxPlugin",{plugin:e,plugins:jr}),!jr.has(e)){if(kr.has(e.name))throw I("PL3",{name:e.name,plugin:e});if(jr.add(e),kr.add(e.name),!e.rxdb)throw R("PL1",{plugin:e});e.init&&e.init(),e.prototypes&&Object.entries(e.prototypes).forEach((e=>{let[t,r]=e;return r(wr[t])})),e.overwritable&&Object.assign(j,e.overwritable),e.hooks&&Object.entries(e.hooks).forEach((e=>{let[t,r]=e;r.after&&it[t].push(r.after),r.before&&it[t].unshift(r.before)}))}}(Wr);var e;return await xr({name:"rxdb-landing-v3",localDocuments:!0,storage:(void 0===e&&(e={}),new at(e))})})()),zr}const Hr=["#e6008d","#8d2089","#5f2688"]},341:(e,t,r)=>{function a(e,t){if(!window.trigger)throw new Error("window.trigger not defined");return window.trigger(e,t)}r.d(t,{X:()=>a})},6451:(e,t,r)=>{r.r(t),r.d(t,{default:()=>g});var a=r(2263),n=r(3799),i=r(5742),s=r(7294),o=r(7400),c=r(6087);const l=[{name:"Antigua and Barbuda",code:"AG",salary:49527},{name:"Argentina",code:"AR",salary:17158},{name:"Australia",code:"AU",salary:76036},{name:"Austria",code:"AT",salary:59383},{name:"Bahamas",code:"BS",salary:62024},{name:"Belarus",code:"BY",salary:5749},{name:"Belgium",code:"BE",salary:63749},{name:"Bermuda",code:"BM",salary:86590},{name:"Bosnia and Herzegovina",code:"BA",salary:11992},{name:"Brazil",code:"BR",salary:26464},{name:"Bulgaria",code:"BG",salary:23384},{name:"Cambodia",code:"KH",salary:18e3},{name:"Canada",code:"CA",salary:71554},{name:"Chile",code:"CL",salary:31073},{name:"China",code:"CN",salary:40611},{name:"Colombia",code:"CO",salary:12894},{name:"Costa Rica",code:"CR",salary:40256},{name:"Croatia",code:"HR",salary:22566},{name:"Czech Republic",code:"CZ",salary:33760},{name:"Denmark",code:"DK",salary:68778},{name:"Ecuador",code:"EC",salary:35016},{name:"Egypt",code:"EG",salary:7758},{name:"Estonia",code:"EE",salary:26728},{name:"Finland",code:"FI",salary:64198},{name:"France",code:"FR",salary:58137},{name:"Georgia",code:"GE",salary:40315},{name:"Germany",code:"DE",salary:72138},{name:"Greece",code:"GR",salary:36824},{name:"Guatemala",code:"GT",salary:49612},{name:"Holy See (Vatican City State)",code:"VA",salary:51474},{name:"Hong Kong",code:"HK",salary:71970},{name:"Hungary",code:"HU",salary:22341},{name:"Iceland",code:"IS",salary:66512},{name:"India",code:"IN",salary:17710},{name:"Indonesia",code:"ID",salary:20978},{name:"Iraq",code:"IQ",salary:21029},{name:"Ireland",code:"IE",salary:66281},{name:"Israel",code:"IL",salary:57466},{name:"Italy",code:"IT",salary:50900},{name:"Jamaica",code:"JM",salary:21048},{name:"Japan",code:"JP",salary:57793},{name:"Kazakhstan",code:"KZ",salary:12243},{name:"Korea, Republic of",code:"KR",salary:45957},{name:"Latvia",code:"LV",salary:26728},{name:"Luxembourg",code:"LU",salary:84663},{name:"Malaysia",code:"MY",salary:26117},{name:"Malta",code:"MT",salary:41971},{name:"Mexico",code:"MX",salary:24050},{name:"Morocco",code:"MA",salary:17903},{name:"Netherlands",code:"NL",salary:62661},{name:"New Zealand",code:"NZ",salary:63948},{name:"Norway",code:"NO",salary:69498},{name:"Pakistan",code:"PK",salary:9066},{name:"Panama",code:"PA",salary:39143},{name:"Peru",code:"PE",salary:17469},{name:"Philippines",code:"PH",salary:11088},{name:"Poland",code:"PL",salary:30236},{name:"Portugal",code:"PT",salary:37959},{name:"Romania",code:"RO",salary:22319},{name:"Russian Federation",code:"RU",salary:20492},{name:"Saudi Arabia",code:"SA",salary:47336},{name:"Singapore",code:"SG",salary:66023},{name:"Slovakia",code:"SK",salary:29650},{name:"South Africa",code:"ZA",salary:40336},{name:"Spain",code:"ES",salary:47819},{name:"Sweden",code:"SE",salary:49361},{name:"Switzerland",code:"CH",salary:92820},{name:"Taiwan",code:"TW",salary:47737},{name:"Thailand",code:"TH",salary:21772},{name:"Turkey",code:"TR",salary:8788},{name:"Ukraine",code:"UA",salary:14139},{name:"United Arab Emirates",code:"AE",salary:66381},{name:"United Kingdom",code:"GB",salary:61188},{name:"United States",code:"US",salary:91935},{name:"Uruguay",code:"UY",salary:23754},{name:"Vietnam",code:"VN",salary:19058}],u={browser:.4,native:.4,performance:.35,sourcecode:0,perpetual:0},h=.05;var d=r(341),m=r(5921),p=r(2389),f=r(5893);function y(e){let{children:t,fallback:r}=e;return(0,p.Z)()?(0,f.jsx)(f.Fragment,{children:t?.()}):r??null}const v="premium-price-form-value";function g(){const{siteConfig:e}=(0,a.Z)(),t=(0,p.Z)();return(0,s.useEffect)((()=>{(async()=>{if(!t||!(0,m.dZ)())return;const e=await(0,m.N8)(),r=await e.getLocal(v);r&&(console.log("formValueDoc:"),console.dir(r),b("home-country",r._data.data.homeCountry),b("company-size",r._data.data.companySize),b("project-amount",r._data.data.projectAmount),b("license-period",r._data.data.licensePeriod),Object.keys(u).forEach((e=>{b("package-"+e,!1)})),r._data.data.packages.forEach((e=>{b("package-"+e,!0)})))})()})),(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.Z,{children:(0,f.jsx)("body",{className:"homepage"})}),(0,f.jsx)(n.Z,{title:`Premium Plugins - ${e.title}`,description:"RxDB plugins for professionals. FAQ, pricing and license",children:(0,f.jsxs)("main",{children:[(0,f.jsx)("div",{className:"block first",children:(0,f.jsxs)("div",{className:"content centered",children:[(0,f.jsxs)("h2",{children:["\ud83d\udc51 ",(0,f.jsx)("b",{className:"underline",children:"RxDB"})," Premium Plugins"]}),(0,f.jsxs)("p",{style:{width:"80%"},children:["To make RxDB a sustainable project, some plugins are not part of the RxDB open source project. Instead they are part of the"," ",(0,f.jsx)("b",{children:"rxdb-premium"})," package which must be purchased.",(0,f.jsx)("br",{}),"Professional developers use these to get the best ",(0,f.jsx)("b",{children:"performance"})," and the most out of RxDB."]}),(0,f.jsxs)("div",{className:"premium-blocks",children:[(0,f.jsx)("a",{href:"/rx-storage-opfs.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage OPFS"}),(0,f.jsxs)("p",{children:["Currently the fastest RxStorage that can be used in the browser. Based on the ",(0,f.jsx)("b",{children:"File System Access API"}),"."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-indexeddb.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage IndexedDB"}),(0,f.jsxs)("p",{children:["A really fast storage based on ",(0,f.jsx)("b",{children:"IndexedDB"}),". Made to be used in browsers."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-sqlite.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage SQLite"}),(0,f.jsxs)("p",{children:["A really fast storage based on ",(0,f.jsx)("b",{children:"SQLite"}),". Used with"," ",(0,f.jsx)("b",{children:"Node.js"}),", ",(0,f.jsx)("b",{children:"Electron"}),", ",(0,f.jsx)("b",{children:"React Native"}),", ",(0,f.jsx)("b",{children:"Capacitor"}),"."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-sharding.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Sharding"}),(0,f.jsx)("p",{children:"A wrapper around any other storage that improves performance by applying the sharding technique."})]})})}),(0,f.jsx)("a",{href:"/rx-storage-memory-synced.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Memory Synced"}),(0,f.jsx)("p",{children:"A wrapper around any other storage that creates a synced in-memory copy which improves performance for the initial page load time and write & read operations."})]})})}),(0,f.jsx)("a",{href:"/query-optimizer.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"Query Optimizer"}),(0,f.jsx)("p",{children:"A tool to find the best index for a given query. You can use this during build time to find the best index and then use that index during runtime."})]})})}),(0,f.jsx)("a",{href:"/rx-storage-localstorage-meta-optimizer.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Localstorage Meta Optimizer"}),(0,f.jsxs)("p",{children:["A wrapper around any other storage which optimizes the initial page load one by using localstorage for meta key-value document. Only works in ",(0,f.jsx)("b",{children:"browsers"}),"."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-shared-worker.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage SharedWorker"}),(0,f.jsxs)("p",{children:["A RxStorage wrapper to run the storage inside of a SharedWorker which improves the performance by taking CPU load away from the main process. Used in ",(0,f.jsx)("b",{children:"browsers"}),"."]})]})})}),(0,f.jsx)("a",{href:"/rx-storage-worker.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Worker"}),(0,f.jsx)("p",{children:"A RxStorage wrapper to run the storage inside of a Worker which improves the performance by taking CPU load away from the main process."})]})})}),(0,f.jsx)("a",{href:"/encryption.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"WebCrypto Encryption"}),(0,f.jsx)("p",{children:"A faster and more secure encryption plugin based on the Web Crypto API."})]})})}),(0,f.jsx)("a",{href:"/rx-storage-filesystem-node.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"RxStorage Filesystem Node"}),(0,f.jsxs)("p",{children:["A fast RxStorage based on the ",(0,f.jsx)("b",{children:"Node.js"})," Filesystem."]})]})})}),(0,f.jsx)("a",{href:"/logger.html",target:"_blank",children:(0,f.jsx)("div",{className:"premium-block hover-shadow-middle bg-gradient-right-top",children:(0,f.jsxs)("div",{className:"premium-block-inner",children:[(0,f.jsx)("h4",{children:"Logger"}),(0,f.jsx)("p",{children:"A logging plugin useful to debug performance problems and for monitoring with Application Performance Monitoring (APM) tools like Bugsnag, Datadog, Elastic, Sentry and others"})]})})})]})]})}),(0,f.jsx)("div",{className:"block dark",id:"faq",children:(0,f.jsxs)("div",{className:"content centered premium-faq",children:[(0,f.jsxs)("h2",{children:["F.A.Q. ",(0,f.jsx)("b",{children:"(click to toggle)"})]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Do I need the Premium Plugins?"}),"When you start using RxDB, you do not need access to the premium plugins. Most use cases can be implemented with the Open Core part of RxDB. There are many"," ",(0,f.jsx)("a",{href:"/rx-storage.html",target:"_blank",children:"RxStorage"}),"options and all core plugins that are required for replication, schema validation, encryption and so on, are totally free. As soon as your application is more then a side project, it is pretty easy to switch to RxDB Premium Plugins by just changing a few lines of configuration.",(0,f.jsx)("br",{}),"The main benefit of the Premium Plugins is ",(0,f.jsx)("b",{children:"performance"}),". The Premium RxStorage implementations have a better performance so reading and writing data is much faster especially on low-end devices. You can find a performance comparison"," ",(0,f.jsx)("a",{href:"/rx-storage-performance.html",target:"_blank",children:"here"}),". Also there are additional Premium Plugins that can be used to further optimize the performance of your application like the"," ",(0,f.jsx)("a",{href:"/query-optimizer.html",target:"_blank",children:"Query Optimizer"})," ","or the"," ",(0,f.jsx)("a",{href:"/rx-storage-sharding.html",target:"_blank",children:"Sharding"})," ","plugin."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Why is it not for free?"}),"The development of RxDB started in 2016 and after all these years it became clear that big implementation and improvement steps will not be done by the RxDB community. While the community submits valuable pull requests, they are mostly small improvements or bugfixes for specific edge case. Big rewrites and optimizations that require a big effort have only be done by the RxDB maintainer.",(0,f.jsx)("br",{}),"Selling RxDB Premium ensures that there will be always an incentive for someone to add features, keep everything up to date and to further improve and optimize the codebase. This gives the user the confidence that RxDB is a ",(0,f.jsx)("b",{children:"future proof"})," tech stack to build on which lets RxDB stand out compared to similar technologies."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Why is there no free trial period?"}),(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:"RxDB is written in JavaScript and the code of the Premium Plugins does not contain any tracking or measurement code that would send information from your application to our servers in production mode. As soon as someone has the code on his computer, the maintainer has no chance to really ensure that after a free trial period the code is no longer used and deleted."}),(0,f.jsxs)("li",{children:["Before you can use the Premium Plugins you have to debate and sign a license agreement with the maintainer. This is a sophisticated process that creates overhead which distracts the maintainer from writing RxDB code. So handling trial period users is just not manageable. For this reason there is also no monthly subscriptions. Premium access must be paid ",(0,f.jsx)("b",{children:"per year"}),"."]})]})]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Why is it not cheaper?"}),"The price of the Premium Plugins is chosen in way that ensures that there can be always one person that develops RxDB ",(0,f.jsx)("b",{children:"full time"}),". Compared to other JavaScript frameworks and developer tools, RxDB satisfies an edge use case for people that want to store data inside of their application on the users device. Most web developers do not need to do that and rely on the traditional client-server stack. So RxDB cannot be sold to that many people which increases the price."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Can I install/build the premium plugins in my CI?"}),(0,f.jsx)("b",{children:"Yes"})," you can safely install and use the Premium Plugins in your CI without additional payment."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Can I get a discount?"}),"Discounts are provided for people that have made a significant contribution to RxDB or one of RxDB's dependencies or to the Open Source Community overall. Also for private personal projects there is the option to solve one of the",(0,f.jsx)("a",{href:"https://github.com/pubkey/rxdb/blob/master/orga/premium-tasks.md",target:"_blank",children:"Premium Tasks"}),"to get 3 years access to the Premium Plugins."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Which payment methods are accepted?"}),(0,f.jsx)("b",{children:"Stripe.com"})," is used as payment processor so most known payment options like credit card, PayPal, SEPA transfer and others are available. A list of all options can be found"," ",(0,f.jsx)("a",{href:"https://stripe.com/docs/payments/payment-methods/overview",title:"stripe payment options",target:"_blank",children:"here"}),"."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Can I still use the premium plugins when the license has expired?"}),"By default you are not allowed to use the premium plugins after the license has expired and you will no longer be able to install them. But you can choose the ",(0,f.jsx)("b",{children:"Perpetual license"})," option. With the perpetual license option, you can still use the plugins even after the license is expired. But you will no longer get any updates from newer RxDB versions."]}),(0,f.jsxs)("details",{children:[(0,f.jsx)("summary",{children:"Is there any tracking code inside of the premium plugins?"}),'No, the premium plugins themself do not contain any tracking code. When you build your application with RxDB and deploy it to production, it will not make requests to any RxDB server. But when you run "npm install" with the premium package there will be some metadata send from your developers machine to RxDB.']})]})}),(0,f.jsxs)("div",{className:"block",children:[(0,f.jsxs)("div",{className:"content centered",children:[(0,f.jsxs)("h2",{children:["RxDB Premium ",(0,f.jsx)("b",{className:"underline",children:"Price Calculator"})]}),(0,f.jsx)("div",{className:"price-calculator",children:(0,f.jsxs)("div",{className:"price-calculator-inner",children:[(0,f.jsxs)("form",{id:"price-calculator-form",children:[(0,f.jsxs)("div",{className:"field",children:[(0,f.jsx)("label",{htmlFor:"home-country",children:"Company Home Country:"}),(0,f.jsxs)("div",{className:"input",children:[(0,f.jsx)("input",{list:"home-country",name:"home-country",pattern:"[A-Za-z \\-]{2,}",required:!0,style:{width:"100%",maxWidth:240},autoComplete:"off"}),(0,f.jsx)("datalist",{id:"home-country",children:l.sort(((e,t)=>e.code>=t.code?1:-1)).map(((e,t)=>(0,f.jsx)("option",{value:e.name,children:e.name},t)))})]})]}),(0,f.jsxs)("div",{className:"field",children:[(0,f.jsx)("label",{htmlFor:"company-size",children:"Company Size:"}),(0,f.jsxs)("div",{className:"input",children:[(0,f.jsx)("input",{type:"number",name:"company-size",min:1,max:1e6,required:!0,onKeyDown:()=>{const e=(0,o.Is)(event);return 69!==e.keyCode&&189!==e.keyCode&&190!==e.keyCode}}),(0,f.jsx)("div",{className:"suffix",children:"employee(s)"})]})]}),(0,f.jsxs)("div",{className:"field",children:[(0,f.jsx)("label",{htmlFor:"project-amount",children:"Project Amount:"}),(0,f.jsxs)("div",{className:"input",children:[(0,f.jsxs)("select",{name:"project-amount",id:"project-amount",required:!0,defaultValue:1,children:[(0,f.jsx)("option",{value:1,children:"1"}),(0,f.jsx)("option",{value:2,children:"2"}),(0,f.jsx)("option",{value:"infinity",children:"Infinity"})]}),(0,f.jsx)("div",{className:"suffix",children:"project(s)"})]})]}),(0,f.jsxs)("div",{className:"packages",children:[(0,f.jsx)("h3",{children:"Packages:"}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-browser",type:"checkbox",className:"package-checkbox",defaultChecked:!0}),(0,f.jsx)("h4",{children:"Browser Package"}),(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-opfs.html",target:"_blank",children:"RxStorage OPFS"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-indexeddb.html",target:"_blank",children:"RxStorage IndexedDB"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-worker.html",target:"_blank",children:"RxStorage Worker"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/encryption.html",target:"_blank",children:"WebCrypto Encryption"})})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-native",type:"checkbox",className:"package-checkbox",defaultChecked:!0}),(0,f.jsx)("h4",{children:"Native Package"}),(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-sqlite.html",target:"_blank",children:"RxStorage SQLite"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-filesystem-node.html",target:"_blank",children:"RxStorage Filesystem Node"})})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-performance",type:"checkbox",className:"package-checkbox",defaultChecked:!0}),(0,f.jsx)("h4",{children:"Performance Package"}),(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-sharding.html",target:"_blank",children:"RxStorage Sharding"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-memory-synced.html",target:"_blank",children:"RxStorage Memory Synced"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/query-optimizer.html",target:"_blank",children:"Query Optimizer"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-localstorage-meta-optimizer.html",target:"_blank",children:"RxStorage Localstorage Meta Optimizer"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/rx-storage-shared-worker.html",target:"_blank",children:"RxStorage Shared Worker"})})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-utilities",type:"checkbox",className:"package-checkbox",defaultChecked:!0,disabled:!0}),(0,f.jsxs)("h4",{children:["Utilities Package ",(0,f.jsx)("b",{children:"always included"})]}),(0,f.jsx)("ul",{children:(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:"/logger.html",target:"_blank",children:"Logger"})})})]})}),(0,f.jsx)("div",{className:"clear"}),(0,f.jsx)("h3",{children:"Other Options:"}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-sourcecode",type:"checkbox",className:"package-checkbox"}),(0,f.jsx)("h4",{children:"Source Code access"}),(0,f.jsxs)("p",{children:["Get read access to the unminified plain source code of all purchased packages.",(0,f.jsx)("br",{})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("input",{name:"package-perpetual",type:"checkbox",className:"package-checkbox"}),(0,f.jsx)("h4",{children:"Perpetual license"}),(0,f.jsxs)("p",{children:["With the perpetual license option, you can still use the plugins even after the license is expired. But you will no longer get any updates from newer RxDB versions.",(0,f.jsx)("br",{})]})]})}),(0,f.jsx)("div",{className:"package bg-gradient-left-top",children:(0,f.jsxs)("div",{className:"package-inner",children:[(0,f.jsx)("h4",{children:"Increase license period"}),(0,f.jsxs)("p",{children:["The default license period is one year. We can do a longer license period to safe time on both sides by not having to go through the licensing process each single year. By choosing a license period of 2 years, you get a 10% discount. With a 3 year license the discount is 20%.",(0,f.jsx)("br",{})]}),(0,f.jsxs)("div",{className:"field",children:[(0,f.jsxs)("div",{className:"input",style:{float:"left",width:"100%"},children:[(0,f.jsx)("div",{className:"prefix",children:"License period "}),(0,f.jsxs)("select",{name:"license-period",id:"license-period",required:!0,defaultValue:1,children:[(0,f.jsx)("option",{value:1,children:"1"}),(0,f.jsx)("option",{value:2,children:"2 (10% discount)"}),(0,f.jsx)("option",{value:3,children:"3 (20% discount)"})]}),(0,f.jsx)("div",{className:"suffix",children:"year(s)"})]}),(0,f.jsx)("div",{className:"clear"})]}),(0,f.jsx)("p",{})]})}),(0,f.jsx)("div",{className:"clear"})]}),(0,f.jsx)("div",{className:"button",id:"price-calculator-submit",onClick:async()=>{(0,d.X)("calculate_premium_price",3);const e=(0,o.Is)(document.getElementById("price-calculator-form"));if(!e.reportValidity())return void console.log("form not valid");const t=new FormData(e),r=Object.fromEntries(t.entries());console.log("formData:"),console.dir(r);const a=l.find((e=>e.name.toLowerCase()===r["home-country"].toLowerCase()));if(!a)return;const n=Object.entries(r).filter((e=>{let[t,r]=e;return t.startsWith("package-")})).map((e=>{let[t]=e;return(0,c.SI)(t.split("-"))})),i=await(0,m.N8)();await i.upsertLocal(v,{companySize:r["company-size"],projectAmount:r["project-amount"],licensePeriod:r["license-period"],homeCountry:a.name,packages:n});const s={companySize:r["company-size"],teamSize:r["developer-count"],projectAmount:r["project-amount"],licensePeriod:parseInt(r["license-period"],10),homeCountryCode:a.code,packages:n},p=function(e){if(console.log("calculatePrice:"),console.dir(e),"number"!=typeof e.licensePeriod)throw new Error("not a number "+typeof e.licensePeriod);const t=(0,o.Is)(l.find((t=>t.code===e.homeCountryCode))).salary;let r=0;e.packages.forEach((e=>{const t=u[e];r+=t})),console.log("aimInPercent: "+r);let a=350+1.4*t*(r/100);if(2===e.packages.length&&(a*=.9),e.packages.length>2&&(a*=.85),e.companySize>1){let t=1+Math.pow(1*e.companySize-1,.95)/100*4.5;const r=6;t>r&&(t=r),console.log("input.companySize "+e.companySize+" - "+t),a*=t}if(e.packages.includes("sourcecode")){a*=1.75;const e=1520;a{console.log("setPrice:"),console.dir(t),e.innerHTML=Math.ceil(t).toString()+" € (EUR)",e.href=function(e){return"https://www.xe.com/en/currencyconverter/convert/?Amount="+e+"&From=EUR&To=USD"}(Math.ceil(t))},w=p.totalPrice/s.licensePeriod;x(y,"infinity"!==s.projectAmount?w/parseInt(s.projectAmount,10)/12:0),x(g,w),x(b,p.totalPrice),f.style.display="block"},children:"Estimate Price"})]}),(0,f.jsxs)("div",{id:"price-calculator-result",style:{display:"none"},children:[(0,f.jsx)("hr",{}),(0,f.jsx)("h4",{children:"Estimated Price:"}),(0,f.jsx)("table",{children:(0,f.jsxs)("tbody",{children:[(0,f.jsxs)("tr",{children:[(0,f.jsx)("th",{children:"Price Per Project per Month"}),(0,f.jsx)("td",{children:(0,f.jsx)("a",{id:"total-per-project-per-month",target:"_blank",rel:"nofollow noopener noreferrer",title:"Click to convert to other currency",href:"#",children:"XX \u20ac"})})]}),(0,f.jsxs)("tr",{children:[(0,f.jsx)("th",{children:"Total Price per Year"}),(0,f.jsx)("td",{children:(0,f.jsx)("a",{id:"total-per-year",target:"_blank",rel:"nofollow noopener noreferrer",title:"Click to convert to other currency",href:"#",children:"XX \u20ac"})})]}),(0,f.jsxs)("tr",{children:[(0,f.jsx)("th",{children:"Total Price"}),(0,f.jsx)("td",{children:(0,f.jsx)("a",{id:"total-price",target:"_blank",rel:"nofollow noopener noreferrer",title:"Click to convert to other currency",href:"#",children:"XX \u20ac"})})]})]})}),(0,f.jsxs)("div",{className:"proceed-hint",children:["Fill out",(0,f.jsxs)("a",{href:"#premium-request-form-block",children:[" ",(0,f.jsx)("b",{children:"this form"})," "]}),"to proceed."]})]})]})})]}),(0,f.jsx)("div",{className:"block dark",id:"premium-request-form-block",children:(0,f.jsxs)("div",{className:"content centered premium-request",children:[(0,f.jsxs)("h2",{children:["Request Premium ",(0,f.jsx)("b",{className:"underline",children:"Form"})]}),(0,f.jsx)("p",{}),(0,f.jsx)(y,{fallback:(0,f.jsx)("span",{children:"Loading form iframe..."}),children:()=>(0,f.jsxs)("iframe",{id:"request-premium-form",src:"https://webforms.pipedrive.com/f/6qflURDWONiPpj67lpG6r45n8feakrtS2AqMRcBf1EuCPRvNcXWdvNH2unFm5EpjW3",children:["Your browser doesn't support iframes, ",(0,f.jsx)("a",{href:"https://webforms.pipedrive.com/f/6qflURDWONiPpj67lpG6r45n8feakrtS2AqMRcBf1EuCPRvNcXWdvNH2unFm5EpjW3",target:"_blank",rel:"nofollow",children:"go here"})]})})]})})]})]})})]})}function b(e,t){if(void 0===t)return;const r=document.querySelector("[name="+e+"]");r&&(r.type&&"checkbox"===r.type?r.checked=t:r.value=t)}},6087:(e,t,r)=>{function a(e){return e[e.length-1]}function n(e){return Array.isArray(e)?e.slice(0):[e]}function i(e){return Array.isArray(e)}function s(e){return null!=e}function o(e,t){var r=0,a=-1;for(var n of e){if(!t(n,a+=1))break;r+=1}return r}function c(e,t){for(var r=t.length,a=0;ai,Nb:()=>l,S7:()=>s,SI:()=>a,gu:()=>c,qo:()=>n,r0:()=>o})},7400:(e,t,r)=>{function a(e,t){if(!e)throw t||(t=""),new Error("ensureNotFalsy() is falsy: "+t);return e}r.d(t,{Is:()=>a,kv:()=>n});var n={bufferSize:1,refCount:!0}},4419:(e,t,r)=>{function a(){return new Promise((e=>setTimeout(e,0)))}function n(e){return void 0===e&&(e=0),new Promise((t=>setTimeout(t,e)))}r.d(t,{$Y:()=>o,C2:()=>u,Y3:()=>a,YB:()=>n,Ze:()=>h,kZ:()=>i,m5:()=>s,y$:()=>c});Promise.resolve(!0);var i=Promise.resolve(!1),s=Promise.resolve(null),o=Promise.resolve();function c(e){return void 0===e&&(e=1e4),"function"==typeof requestIdleCallback?new Promise((t=>{requestIdleCallback((()=>t()),{timeout:e})})):n(0)}var l=o;function u(e){return void 0===e&&(e=void 0),l=l.then((()=>c(e)))}function h(e,t){return e.reduce(((e,t)=>e.then(t)),Promise.resolve(t))}},984:(e,t,r)=>{r.d(t,{z:()=>n});var a=0;function n(){var e=Date.now();(e+=.01)<=a&&(e=a+.01);var t=parseFloat(e.toFixed(2));return a=t,t}}}]); \ No newline at end of file diff --git a/docs/assets/js/1df93b7f.5d342824.js b/docs/assets/js/1df93b7f.937c5c7c.js similarity index 99% rename from docs/assets/js/1df93b7f.5d342824.js rename to docs/assets/js/1df93b7f.937c5c7c.js index e6597e3f063..1581f812d83 100644 --- a/docs/assets/js/1df93b7f.5d342824.js +++ b/docs/assets/js/1df93b7f.937c5c7c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[3237],{5921:(e,t,r)=>{r.d(t,{O9:()=>zr,N8:()=>Hr,dZ:()=>Fr});var a=r(8061);function n(e,t){var r=e.get(t);if(void 0===r)throw new Error("missing value from map "+t);return r}function s(e,t,r,a){var n=e.get(t);return void 0===n?(n=r(),e.set(t,n)):a&&a(n),n}function i(e){return Object.assign({},e)}function o(e,t){if(void 0===t&&(t=!1),!e)return e;if(!t&&Array.isArray(e))return e.sort(((e,t)=>"string"==typeof e&&"string"==typeof t?e.localeCompare(t):"object"==typeof e?1:-1)).map((e=>o(e,t)));if("object"==typeof e&&!Array.isArray(e)){var r={};return Object.keys(e).sort(((e,t)=>e.localeCompare(t))).forEach((a=>{r[a]=o(e[a],t)})),r}return e}var c=function e(t){if(!t)return t;if(null===t||"object"!=typeof t)return t;if(Array.isArray(t)){for(var r=new Array(t.length),a=r.length;a--;)r[a]=e(t[a]);return r}var n={};for(var s in t)n[s]=e(t[s]);return n};function l(e,t,r){return Object.defineProperty(e,t,{get:function(){return r}}),r}var u=e=>{var t=typeof e;return null!==e&&("object"===t||"function"===t)},h=new Set(["__proto__","prototype","constructor"]),d=new Set("0123456789");function m(e){var t=[],r="",a="start",n=!1;for(var s of e)switch(s){case"\\":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a)throw new Error("Invalid character after an index");n&&(r+=s),a="property",n=!n;break;case".":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a){a="property";break}if(n){n=!1,r+=s;break}if(h.has(r))return[];t.push(r),r="",a="property";break;case"[":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a){a="index";break}if(n){n=!1,r+=s;break}if("property"===a){if(h.has(r))return[];t.push(r),r=""}a="index";break;case"]":if("index"===a){t.push(Number.parseInt(r,10)),r="",a="indexEnd";break}if("indexEnd"===a)throw new Error("Invalid character after an index");default:if("index"===a&&!d.has(s))throw new Error("Invalid character in an index");if("indexEnd"===a)throw new Error("Invalid character after an index");"start"===a&&(a="property"),n&&(n=!1,r+="\\"),r+=s}switch(n&&(r+="\\"),a){case"property":if(h.has(r))return[];t.push(r);break;case"index":throw new Error("Index was not closed");case"start":t.push("")}return t}function p(e,t){if("number"!=typeof t&&Array.isArray(e)){var r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function f(e,t){if(p(e,t))throw new Error("Cannot use string index")}function v(e,t,r){if(Array.isArray(t)&&(t=t.join(".")),!t.includes(".")&&!t.includes("["))return e[t];if(!u(e)||"string"!=typeof t)return void 0===r?e:r;var a=m(t);if(0===a.length)return r;for(var n=0;n!1,deepFreezeWhenDevMode:e=>e,tunnelErrorMessage:e=>"RxDB Error-Code "+e+".\n Error messages are not included in RxDB core to reduce build size.\n - To find out what this error means, either use the dev-mode-plugin https://rxdb.info/dev-mode.html\n - or search for the error code here: https://github.com/pubkey/rxdb/search?q="+e+"\n "};function k(e,t,r){return"RxError ("+t+"):\n"+e+"\n"+function(e){var t="";return 0===Object.keys(e).length?t:(t+="Given parameters: {\n",t+=Object.keys(e).map((t=>{var r="[object Object]";try{r="errors"===t?e[t].map((e=>JSON.stringify(e,Object.getOwnPropertyNames(e)))):JSON.stringify(e[t],(function(e,t){return void 0===t?null:t}),2)}catch(a){}return t+":"+r})).join("\n"),t+="}")}(r)}var _=function(e){function t(t,r,a){var n;void 0===a&&(a={});var s=k(r,t,a);return(n=e.call(this,s)||this).code=t,n.message=s,n.parameters=a,n.rxdb=!0,n}return(0,x.Z)(t,e),t.prototype.toString=function(){return this.message},(0,b.Z)(t,[{key:"name",get:function(){return"RxError ("+this.code+")"}},{key:"typeError",get:function(){return!1}}]),t}((0,w.Z)(Error)),D=function(e){function t(t,r,a){var n;void 0===a&&(a={});var s=k(r,t,a);return(n=e.call(this,s)||this).code=t,n.message=s,n.parameters=a,n.rxdb=!0,n}return(0,x.Z)(t,e),t.prototype.toString=function(){return this.message},(0,b.Z)(t,[{key:"name",get:function(){return"RxTypeError ("+this.code+")"}},{key:"typeError",get:function(){return!0}}]),t}((0,w.Z)(TypeError));function N(e,t){return new _(e,j.tunnelErrorMessage(e),t)}function I(e,t){return new D(e,j.tunnelErrorMessage(e),t)}function E(e){return!(!e||409!==e.status)&&e}var C={409:"document write conflict",422:"schema validation error",510:"attachment data missing"};var R=/\./g,O="abcdefghijklmnopqrstuvwxyz";function S(e){void 0===e&&(e=10);for(var t="",r=0;r{var r=v(t,e);if(void 0===r)throw N("DOC18",{args:{field:e,documentData:t}});return r})).join(r.separator)}function Q(e){var t=A((e=i(e)).primaryKey);e.properties=i(e.properties),e.additionalProperties=!1,Object.prototype.hasOwnProperty.call(e,"keyCompression")||(e.keyCompression=!1),e.indexes=e.indexes?e.indexes.slice(0):[],e.required=e.required?e.required.slice(0):[],e.encrypted=e.encrypted?e.encrypted.slice(0):[],e.properties._rev={type:"string",minLength:1},e.properties._attachments={type:"object"},e.properties._deleted={type:"boolean"},e.properties._meta=W,e.required=e.required?e.required.slice(0):[],e.required.push("_deleted"),e.required.push("_rev"),e.required.push("_meta"),e.required.push("_attachments");var r=F(e);(0,y.gu)(e.required,r),e.required=e.required.filter((e=>!e.includes("."))).filter(((e,t,r)=>r.indexOf(e)===t)),e.version=e.version||0;var a=e.indexes.map((e=>{var r=(0,y.AD)(e)?e.slice(0):[e];return r.includes(t)||r.push(t),"_deleted"!==r[0]&&r.unshift("_deleted"),r}));0===a.length&&a.push(function(e){return["_deleted",e]}(t)),a.push(["_meta.lwt",t]),e.internalIndexes&&e.internalIndexes.map((e=>{a.push(e)}));var n=new Set;return a.filter((e=>{var t=e.join(",");return!n.has(t)&&(n.add(t),!0)})),e.indexes=a,e}var W={type:"object",properties:{lwt:{type:"number",minimum:$,maximum:1e15,multipleOf:.01}},additionalProperties:!0,required:["lwt"]};function F(e){var t=Object.keys(e.properties).filter((t=>e.properties[t].final)),r=A(e.primaryKey);return t.push(r),"string"!=typeof e.primaryKey&&e.primaryKey.fields.forEach((e=>t.push(e))),t}var H="docs",z="changes",K="attachments",U="dexie",Z=new Map,J=new Map;var V="__";function X(e){var t=e.split(".");if(t.length>1)return t.map((e=>X(e))).join(".");if(e.startsWith("|")){var r=e.substring(1);return V+r}return e}function Y(e){var t=e.split(".");return t.length>1?t.map((e=>Y(e))).join("."):e.startsWith(V)?"|"+e.substring(V.length):e}function G(e,t){return t?(t=te(t=i(t)),e.forEach((e=>{var r=v(t,e);g(t,e,r?"1":"0")})),t):t}function ee(e,t){return t?(t=re(t=i(t)),e.forEach((e=>{var r=v(t,e);g(t,e,"1"===r)})),t):t}function te(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>te(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((e=>{let[r,a]=e;"object"==typeof a&&(a=te(a)),t[X(r)]=a})),t}}function re(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>re(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((r=>{let[a,n]=r;("object"==typeof n||Array.isArray(e))&&(n=re(n)),t[Y(a)]=n})),t}}function ae(e){var t=[],r=A(e.primaryKey);t.push([r]),t.push(["_deleted",r]),e.indexes&&e.indexes.forEach((e=>{var r=(0,y.qo)(e);t.push(r)})),t.push(["_meta.lwt",r]),t.push(["_meta.lwt"]);var a=(t=t.map((e=>e.map((e=>X(e)))))).map((e=>1===e.length?e[0]:"["+e.join("+")+"]"));return(a=a.filter(((e,t,r)=>r.indexOf(e)===t))).join(", ")}async function ne(e,t){var r=await e;return(await r.dexieTable.bulkGet(t)).map((e=>ee(r.booleanIndexes,e)))}function se(e,t){return e+"||"+t}function ie(e){var t=new Set,r=[];return e.indexes?(e.indexes.forEach((a=>{(0,y.qo)(a).forEach((a=>{t.has(a)||(t.add(a),"boolean"===q(e,a).type&&r.push(a))}))})),r.push("_deleted"),(0,y.Nb)(r)):r}var oe=r(6974),ce=r(984),le=r(7400),ue=String.fromCharCode(65535),he=Number.MIN_SAFE_INTEGER;function de(e,t){var r=t.selector,a=e.indexes?e.indexes.slice(0):[];t.index&&(a=[t.index]);var n=!!t.sort.find((e=>"desc"===Object.values(e)[0])),s=new Set;Object.keys(r).forEach((t=>{var a=q(e,t);a&&"boolean"===a.type&&Object.prototype.hasOwnProperty.call(r[t],"$eq")&&s.add(t)}));var i,o=t.sort.map((e=>Object.keys(e)[0])).filter((e=>!s.has(e))).join(","),c=-1;if(a.forEach((e=>{var a=!0,l=!0,u=e.map((e=>{var t=r[e],n=t?Object.keys(t):[],s={};t&&n.length?n.forEach((e=>{if(me.has(e)){var r=function(e,t){switch(e){case"$eq":return{startKey:t,endKey:t,inclusiveEnd:!0,inclusiveStart:!0};case"$lte":return{endKey:t,inclusiveEnd:!0};case"$gte":return{startKey:t,inclusiveStart:!0};case"$lt":return{endKey:t,inclusiveEnd:!1};case"$gt":return{startKey:t,inclusiveStart:!1};default:throw new Error("SNH")}}(e,t[e]);s=Object.assign(s,r)}})):s={startKey:l?he:ue,endKey:a?ue:he,inclusiveStart:!0,inclusiveEnd:!0};return void 0===s.startKey&&(s.startKey=he),void 0===s.endKey&&(s.endKey=ue),void 0===s.inclusiveStart&&(s.inclusiveStart=!0),void 0===s.inclusiveEnd&&(s.inclusiveEnd=!0),l&&!s.inclusiveStart&&(l=!1),a&&!s.inclusiveEnd&&(a=!1),s})),h=u.map((e=>e.startKey)),d=u.map((e=>e.endKey)),m={index:e,startKeys:h,endKeys:d,inclusiveEnd:a,inclusiveStart:l,sortSatisfiedByIndex:!n&&o===e.filter((e=>!s.has(e))).join(","),selectorSatisfiedByIndex:ve(e,t.selector,h,d)},p=function(e,t,r){var a=0,n=e=>{e>0&&(a+=e)},s=10,i=(0,y.r0)(r.startKeys,(e=>e!==he&&e!==ue));n(i*s);var o=(0,y.r0)(r.startKeys,(e=>e!==ue&&e!==he));n(o*s);var c=(0,y.r0)(r.startKeys,((e,t)=>e===r.endKeys[t]));n(c*s*1.5);var l=r.sortSatisfiedByIndex?5:0;return n(l),a}(0,0,m);(p>=c||t.index)&&(c=p,i=m)})),!i)throw N("SNH",{query:t});return i}var me=new Set(["$eq","$gt","$gte","$lt","$lte"]),pe=new Set(["$eq","$gt","$gte"]),fe=new Set(["$eq","$lt","$lte"]);function ve(e,t,r,a){var n=Object.entries(t).find((t=>{let[r,a]=t;return!e.includes(r)||Object.entries(a).find((e=>{let[t,r]=e;return!me.has(t)}))}));if(n)return!1;if(t.$and||t.$or)return!1;var s=[],i=new Set;for(var[o,c]of Object.entries(t)){if(!e.includes(o))return!1;var l=Object.keys(c).filter((e=>pe.has(e)));if(l.length>1)return!1;var u=l[0];if(u&&i.add(o),"$eq"!==u){if(s.length>0)return!1;s.push(u)}}var h=[],d=new Set;for(var[m,p]of Object.entries(t)){if(!e.includes(m))return!1;var f=Object.keys(p).filter((e=>fe.has(e)));if(f.length>1)return!1;var v=f[0];if(v&&d.add(m),"$eq"!==v){if(h.length>0)return!1;h.push(v)}}var g=0;for(var y of e){for(var b of[i,d]){if(!b.has(y)&&b.size>0)return!1;b.delete(y)}if(r[g]!==a[g]&&i.size>0&&d.size>0)return!1;g++}return!0}var ge=r(6250),ye=r(7761),be=r(7132),xe=r(6496),we=r(6851),je=r(3516),ke=r(8039),_e=r(5308),De=r(2106),Ne=!1;function Ie(e){return Ne||((0,ye.Qs)(ye.$M.PIPELINE,{$sort:xe.E3,$project:xe.FM}),(0,ye.Qs)(ye.$M.QUERY,{$and:we.h$,$eq:je.l3,$elemMatch:_e.rr,$exists:De.G,$gt:je.ok,$gte:je.m9,$in:je.FI,$lt:je.Ty,$lte:je.HG,$ne:je.ny,$nin:je.IS,$mod:ke.JD,$nor:we.ps,$not:we._w,$or:we.Ko,$regex:ke.GO,$size:_e.QH,$type:De.e}),Ne=!0),new be.A(e)}function Ee(e,t){var r=A(e.primaryKey);t=i(t);var a=c(t);if("number"!=typeof a.skip&&(a.skip=0),a.selector?(a.selector=a.selector,Object.entries(a.selector).forEach((e=>{let[t,r]=e;"object"==typeof r&&null!==r||(a.selector[t]={$eq:r})}))):a.selector={},a.index){var n=(0,y.qo)(a.index);n.includes(r)||n.push(r),a.index=n}if(a.sort)a.sort.find((e=>{return t=e,Object.keys(t)[0]===r;var t}))||(a.sort=a.sort.slice(0),a.sort.push({[r]:"asc"}));else if(a.index)a.sort=a.index.map((e=>({[e]:"asc"})));else{if(e.indexes){var s=new Set;Object.entries(a.selector).forEach((e=>{let[t,r]=e;("object"!=typeof r||null===r||!!Object.keys(r).find((e=>me.has(e))))&&s.add(t)}));var o,l=-1;e.indexes.forEach((e=>{var t=(0,y.AD)(e)?e:[e],r=t.findIndex((e=>!s.has(e)));r>0&&r>l&&(l=r,o=t)})),o&&(a.sort=o.map((e=>({[e]:"asc"}))))}a.sort||(a.sort=[{[r]:"asc"}])}return a}function Ce(e,t){if(!t.sort)throw N("SNH",{query:t});var r=[];t.sort.forEach((e=>{var t,a,n,s=Object.keys(e)[0],i=Object.values(e)[0];r.push({key:s,direction:i,getValueFn:(t=s,a=t.split("."),n=a.length,1===n?e=>e[t]:e=>{for(var t=e,r=0;r{for(var a=0;ar.test(e)}function Oe(e){return e===he?-1/0:e}function Se(e,t,r){return e.includes(t)?r===ue||!0===r?"1":"0":r}function Pe(e,t,r){if(!r){if("undefined"==typeof window)throw new Error("IDBKeyRange missing");r=window.IDBKeyRange}var a=t.startKeys.map(((r,a)=>{var n=t.index[a];return Se(e,n,r)})).map(Oe),n=t.endKeys.map(((r,a)=>{var n=t.index[a];return Se(e,n,r)})).map(Oe);return r.bound(a,n,!t.inclusiveStart,!t.inclusiveEnd)}async function Be(e,t){var r=await e.internals,a=t.query,n=a.skip?a.skip:0,s=n+(a.limit?a.limit:1/0),i=t.queryPlan,o=!1;i.selectorSatisfiedByIndex||(o=Re(e.schema,t.query));var c=Pe(r.booleanIndexes,i,r.dexieDb._options.IDBKeyRange),l=i.index,u=[];if(await r.dexieDb.transaction("r",r.dexieTable,(async e=>{var t,a=e.idbtrans.objectStore(H);t="["+l.map((e=>X(e))).join("+")+"]";var n=a.index(t).openCursor(c);await new Promise((e=>{n.onsuccess=function(t){var a=t.target.result;if(a){var n=ee(r.booleanIndexes,a.value);o&&!o(n)||u.push(n),i.sortSatisfiedByIndex&&u.length===s?e():a.continue()}else e()}}))})),!i.sortSatisfiedByIndex){var h=Ce(e.schema,t.query);u=u.sort(h)}return{documents:u=u.slice(n,s)}}function $e(e){var t=e.split("-");if(2!==t.length)throw new Error("malformatted revision: "+e);return{height:parseInt(t[0],10),hash:t[1]}}function Te(e){return parseInt(e.split("-")[0],10)}function qe(e,t){var r=t?t._rev:null;return(r?$e(r).height:0)+1+"-"+e}var Me="_rxdb_internal";async function Ae(e,t){var r=(await e.findDocumentsById([t],!1))[0];return r||void 0}async function Le(e,t,r){var a=await e.bulkWrite([t],r);if(a.error.length>0)throw a.error[0];return a.success[0]}function Qe(e,t,r){var a=t.documentData,n=t.previousDocumentData;return{documentId:t.documentId,collectionName:r?r.name:void 0,isLocal:e,operation:t.operation,documentData:j.deepFreezeWhenDevMode(a),previousDocumentData:j.deepFreezeWhenDevMode(n)}}function We(e,t,r,a){if(a)throw 409===a.status?N("CONFLICT",{collection:e.name,id:t,writeError:a,data:r}):422===a.status?N("VD2",{collection:e.name,id:t,writeError:a,data:r}):a}function Fe(e){return{previous:e.previous,document:He(e.document)}}function He(e){if(!e._attachments||0===Object.keys(e._attachments).length)return e;var t=i(e);return t._attachments={},Object.entries(e._attachments).forEach((e=>{let[r,a]=e;var n,s,i;t._attachments[r]=(i=(n=a).data)?{length:(s=i,atob(s).length),digest:n.digest,type:n.type}:n})),t}function ze(e){var t=i(e);return t._meta=i(e._meta),t}function Ke(e,t,r){j.deepFreezeWhenDevMode(r);var a=A(r.primaryKey);var n={originalStorageInstance:t,schema:t.schema,internals:t.internals,collectionName:t.collectionName,databaseName:t.databaseName,options:t.options,bulkWrite(n,s){var o=n.map((n=>function(n){var s=i(n.document);if(s._meta=i(s._meta),j.isDevMode()){s=M(a,r,s);try{"function"==typeof structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n))}catch(o){throw N("DOC24",{collection:t.collectionName,document:n.document})}n.previous,n.previous&&Object.keys(n.previous._meta).forEach((e=>{if(!Object.prototype.hasOwnProperty.call(n.document._meta,e))throw N("SNH",{dataBefore:n.previous,dataAfter:n.document})}))}return s._meta.lwt=(0,ce.z)(),s._rev=qe(e.token,n.previous),{document:s,previous:n.previous}}(n)));return e.lockedRun((()=>t.bulkWrite(o,s))).then((r=>{var a={error:[],success:r.success.slice(0)},n=r.error.filter((e=>!(409!==e.status||e.writeRow.previous||e.writeRow.document._deleted||!(0,le.Is)(e.documentInDb)._deleted)||(a.error.push(e),!1)));if(n.length>0){var i=n.map((t=>({previous:t.documentInDb,document:Object.assign({},t.writeRow.document,{_rev:qe(e.token,t.documentInDb)})})));return e.lockedRun((()=>t.bulkWrite(i,s))).then((e=>((0,y.gu)(a.error,e.error),(0,y.gu)(a.success,e.success),a)))}return r}))},query:r=>e.lockedRun((()=>t.query(r))),count:r=>e.lockedRun((()=>t.count(r))),findDocumentsById:(r,a)=>e.lockedRun((()=>t.findDocumentsById(r,a))),getAttachmentData:(r,a,n)=>e.lockedRun((()=>t.getAttachmentData(r,a,n))),getChangedDocumentsSince:t.getChangedDocumentsSince?(r,a)=>e.lockedRun((()=>t.getChangedDocumentsSince((0,le.Is)(r),a))):void 0,cleanup:r=>e.lockedRun((()=>t.cleanup(r))),remove:()=>(e.storageInstances.delete(n),e.lockedRun((()=>t.remove()))),close:()=>(e.storageInstances.delete(n),e.lockedRun((()=>t.close()))),changeStream:()=>t.changeStream(),conflictResultionTasks:()=>t.conflictResultionTasks(),resolveConflictResultionTask(e){if(e.output.isEqual)return t.resolveConflictResultionTask(e);var r=i(Object.assign({},e.output.documentData,{_meta:T(),_rev:"",_attachments:{}}));return delete r._meta,delete r._rev,delete r._attachments,t.resolveConflictResultionTask({id:e.id,output:{isEqual:!1,documentData:r}})}};return e.storageInstances.add(n),n}var Ue=r(5677),Ze=r(3981),Je=new Map;function Ve(e,t){var r=Je.get(e);if(r)return r.refs.delete(t),0===r.refs.size?(Je.delete(e),r.bc.close()):void 0}function Xe(e,t,r,a){if(t.multiInstance){var n=a||function(e,t,r,a){var n=Je.get(t);return n||(n={bc:new Ze.g0(["RxDB:",e,r].join("|")),refs:new Set},Je.set(t,n)),n.refs.add(a),n.bc}(e,t.databaseInstanceToken,r.databaseName,r),s=new oe.x,i=r=>{r.storageName===e&&r.databaseName===t.databaseName&&r.collectionName===t.collectionName&&r.version===t.schema.version&&s.next(r.eventBulk)};n.addEventListener("message",i);var o=r.changeStream(),c=!1,l=o.subscribe((r=>{c||n.postMessage({storageName:e,databaseName:t.databaseName,collectionName:t.collectionName,version:t.schema.version,eventBulk:r})}));r.changeStream=function(){return s.asObservable().pipe((0,Ue.b)(o))};var u=r.close.bind(r);r.close=async function(){return c=!0,l.unsubscribe(),n.removeEventListener("message",i),a||await Ve(t.databaseInstanceToken,r),u()};var h=r.remove.bind(r);r.remove=async function(){return c=!0,l.unsubscribe(),n.removeEventListener("message",i),a||await Ve(t.databaseInstanceToken,r),h()}}}var Ye=(0,ce.z)(),Ge=function(){function e(e,t,r,a,n,s,i){this.changes$=new oe.x,this.instanceId=Ye++,this.storage=e,this.databaseName=t,this.collectionName=r,this.schema=a,this.internals=n,this.options=s,this.settings=i,this.primaryPath=A(this.schema.primaryKey)}var t=e.prototype;return t.bulkWrite=async function(e,t){tt(this),e.forEach((e=>{if(!e.document._rev||e.previous&&!e.previous._rev)throw N("SNH",{args:{row:e}})}));var r,a=await this.internals,n={success:[],error:[]},s=e.map((e=>e.document[this.primaryPath]));if(await a.dexieDb.transaction("rw",a.dexieTable,a.dexieAttachmentsTable,(async()=>{var i=new Map;(await ne(this.internals,s)).forEach((e=>{var t=e;return t&&i.set(t[this.primaryPath],t),t})),r=function(e,t,r,a,n,s,i){for(var o,c=!!e.schema.attachments,l=[],u=[],h=[],d={id:S(10),events:[],checkpoint:null,context:n,startTime:(0,ce.z)(),endTime:0},m=d.events,p=[],f=[],v=[],g=r.size>0,y=a.length,b=function(){var e,n=a[x],d=n.document,y=n.previous,b=d[t],w=d._deleted,j=y&&y._deleted,k=void 0;if(g&&(k=r.get(b)),k){var _=k._rev;if(!y||y&&_!==y._rev){var D={isError:!0,status:409,documentId:b,writeRow:n,documentInDb:k};return h.push(D),1}var I=c?Fe(n):n;c&&(w?y&&Object.keys(y._attachments).forEach((e=>{f.push({documentId:b,attachmentId:e,digest:(0,le.Is)(y)._attachments[e].digest})})):(Object.entries(d._attachments).find((t=>{let[r,a]=t;return(y?y._attachments[r]:void 0)||a.data||(e={documentId:b,documentInDb:k,isError:!0,status:510,writeRow:n,attachmentId:r}),!0})),e||Object.entries(d._attachments).forEach((e=>{let[t,r]=e;var a=y?y._attachments[t]:void 0;if(a){var n=I.document._attachments[t].digest;r.data&&a.digest!==n&&v.push({documentId:b,attachmentId:t,attachmentData:r,digest:r.digest})}else p.push({documentId:b,attachmentId:t,attachmentData:r,digest:r.digest})})))),e?h.push(e):(c?(u.push(Fe(I)),i&&i(d)):(u.push(I),i&&i(d)),o=I);var E=null,C=null,R=null;if(j&&!w)R="INSERT",E=c?He(d):d;else if(!y||j||w){if(!w)throw N("SNH",{args:{writeRow:n}});R="DELETE",E=(0,le.Is)(d),C=y}else R="UPDATE",E=c?He(d):d,C=y;var O={documentId:b,documentData:E,previousDocumentData:C,operation:R};m.push(O)}else{var S=!!w;if(c&&Object.entries(d._attachments).forEach((t=>{let[r,a]=t;a.data?p.push({documentId:b,attachmentId:r,attachmentData:a,digest:a.digest}):(e={documentId:b,isError:!0,status:510,writeRow:n,attachmentId:r},h.push(e))})),e||(c?(l.push(Fe(n)),s&&s(d)):(l.push(n),s&&s(d)),o=n),!S){var P={documentId:b,operation:"INSERT",documentData:c?He(d):d,previousDocumentData:c&&y?He(y):y};m.push(P)}}},x=0;x{n.success.push(e.document),o.push(e.document)})),r.bulkUpdateDocs.forEach((e=>{n.success.push(e.document),o.push(e.document)})),(o=o.map((e=>G(a.booleanIndexes,e)))).length>0&&await a.dexieTable.bulkPut(o);var c=[];r.attachmentsAdd.forEach((e=>{c.push({id:se(e.documentId,e.attachmentId),data:e.attachmentData.data})})),r.attachmentsUpdate.forEach((e=>{c.push({id:se(e.documentId,e.attachmentId),data:e.attachmentData.data})})),await a.dexieAttachmentsTable.bulkPut(c),await a.dexieAttachmentsTable.bulkDelete(r.attachmentsRemove.map((e=>se(e.documentId,e.attachmentId))))})),(r=(0,le.Is)(r)).eventBulk.events.length>0){var i=(0,le.Is)(r.newestRow).document;r.eventBulk.checkpoint={id:i[this.primaryPath],lwt:i._meta.lwt},r.eventBulk.endTime=(0,ce.z)(),this.changes$.next(r.eventBulk)}return n},t.findDocumentsById=async function(e,t){tt(this);var r=await this.internals,a=[];return await r.dexieDb.transaction("r",r.dexieTable,(async()=>{(await ne(this.internals,e)).forEach((e=>{!e||e._deleted&&!t||a.push(e)}))})),a},t.query=function(e){return tt(this),Be(this,e)},t.count=async function(e){if(e.queryPlan.selectorSatisfiedByIndex){var t=await async function(e,t){var r=await e.internals,a=t.queryPlan,n=a.index,s=Pe(r.booleanIndexes,a,r.dexieDb._options.IDBKeyRange),i=-1;return await r.dexieDb.transaction("r",r.dexieTable,(async e=>{var t,r=e.idbtrans.objectStore(H);t="["+n.map((e=>X(e))).join("+")+"]";var a=r.index(t).count(s);i=await new Promise(((e,t)=>{a.onsuccess=function(){e(a.result)},a.onerror=e=>t(e)}))})),i}(this,e);return{count:t,mode:"fast"}}return{count:(await Be(this,e)).documents.length,mode:"slow"}},t.changeStream=function(){return tt(this),this.changes$.asObservable()},t.cleanup=async function(e){tt(this);var t=await this.internals;return await t.dexieDb.transaction("rw",t.dexieTable,(async()=>{var r=(0,ce.z)()-e,a=await t.dexieTable.where("_meta.lwt").below(r).toArray(),n=[];a.forEach((e=>{"1"===e._deleted&&n.push(e[this.primaryPath])})),await t.dexieTable.bulkDelete(n)})),!0},t.getAttachmentData=async function(e,t,r){tt(this);var a=await this.internals,n=se(e,t);return await a.dexieDb.transaction("r",a.dexieAttachmentsTable,(async()=>{var r=await a.dexieAttachmentsTable.get(n);if(r)return r.data;throw new Error("attachment missing documentId: "+e+" attachmentId: "+t)}))},t.remove=async function(){tt(this);var e=await this.internals;return await e.dexieTable.clear(),this.close()},t.close=function(){return this.closed||(this.closed=(async()=>{this.changes$.complete(),await async function(e){var t=await e,r=J.get(e)-1;0===r?(t.dexieDb.close(),J.delete(e)):J.set(e,r)}(this.internals)})()),this.closed},t.conflictResultionTasks=function(){return new oe.x},t.resolveConflictResultionTask=async function(e){},e}();async function et(e,t,r){var n=function(e,t,r,n){var o="rxdb-dexie-"+e+"--"+n.version+"--"+t,c=s(Z,o,(()=>{var e=(async()=>{var e=i(r);e.autoOpen=!1;var t=new a.U(o,e),s={[H]:ae(n),[z]:"++sequence, id",[K]:"id"};return t.version(1).stores(s),await t.open(),{dexieDb:t,dexieTable:t[H],dexieAttachmentsTable:t[K],booleanIndexes:ie(n)}})();return Z.set(o,c),J.set(c,0),e}));return c}(t.databaseName,t.collectionName,r,t.schema),o=new Ge(e,t.databaseName,t.collectionName,t.schema,n,t.options,r);return await Xe(U,t,o),Promise.resolve(o)}function tt(e){if(e.closed)throw new Error("RxStorageInstanceDexie is closed "+e.databaseName+"-"+e.collectionName)}var rt="15.4.1",at=function(){function e(e){this.name=U,this.rxdbVersion=rt,this.settings=e}return e.prototype.createStorageInstance=function(e){return function(e){if(e.schema.keyCompression)throw N("UT5",{args:{params:e}});if((t=e.schema).encrypted&&t.encrypted.length>0||t.attachments&&t.attachments.encrypted)throw N("UT6",{args:{params:e}});var t;if(e.schema.attachments&&e.schema.attachments.compression)throw N("UT7",{args:{params:e}})}(e),et(this,e,this.settings)},e}();function nt(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,a;if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(a=r;0!=a--;)if(!nt(e[a],t[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e);if((r=n.length)!==Object.keys(t).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,n[a]))return!1;for(a=r;0!=a--;){var s=n[a];if(!nt(e[s],t[s]))return!1}return!0}return e!=e&&t!=t}var st={preAddRxPlugin:[],preCreateRxDatabase:[],createRxDatabase:[],preCreateRxCollection:[],createRxCollection:[],postDestroyRxCollection:[],postRemoveRxCollection:[],preCreateRxSchema:[],createRxSchema:[],preCreateRxQuery:[],prePrepareQuery:[],createRxDocument:[],postCreateRxDocument:[],preCreateRxStorageInstance:[],preMigrateDocument:[],postMigrateDocument:[],preDestroyRxDatabase:[],postRemoveRxDatabase:[],preReplicationMasterWrite:[],preReplicationMasterWriteDocumentsHandle:[]};function it(e,t){st[e]&&st[e].forEach((e=>e(t)))}function ot(e,t){return Promise.all(st[e].map((e=>e(t))))}var ct=function(){function e(e,t){this.jsonSchema=e,this.hashFunction=t,this.indexes=function(e){return(e.indexes||[]).map((e=>(0,y.AD)(e)?e:[e]))}(this.jsonSchema),this.primaryPath=A(this.jsonSchema.primaryKey),this.finalFields=F(this.jsonSchema)}var t=e.prototype;return t.validateChange=function(e,t){this.finalFields.forEach((r=>{if(!nt(e[r],t[r]))throw N("DOC9",{dataBefore:e,dataAfter:t,fieldName:r,schema:this.jsonSchema})}))},t.getDocumentPrototype=function(){var e={},t=q(this.jsonSchema,"");return Object.keys(t).forEach((t=>{var r=t;e.__defineGetter__(t,(function(){if(this.get&&"function"==typeof this.get)return this.get(r)})),Object.defineProperty(e,t+"$",{get:function(){return this.get$(r)},enumerable:!1,configurable:!1}),Object.defineProperty(e,t+"_",{get:function(){return this.populate(r)},enumerable:!1,configurable:!1})})),l(this,"getDocumentPrototype",(()=>e)),e},t.getPrimaryOfDocumentData=function(e){return L(this.jsonSchema,e)},(0,b.Z)(e,[{key:"version",get:function(){return this.jsonSchema.version}},{key:"defaultValues",get:function(){var e={};return Object.entries(this.jsonSchema.properties).filter((e=>{let[,t]=e;return Object.prototype.hasOwnProperty.call(t,"default")})).forEach((t=>{let[r,a]=t;return e[r]=a.default})),l(this,"defaultValues",e)}},{key:"hash",get:function(){return l(this,"hash",this.hashFunction(JSON.stringify(this.jsonSchema)))}}]),e}();function lt(e,t,r){void 0===r&&(r=!0),r&&it("preCreateRxSchema",e);var a=Q(e);a=function(e){return o(e,!0)}(a),j.deepFreezeWhenDevMode(a);var n=new ct(a,t);return it("createRxSchema",n),n}var ut=r(598),ht=r(6621),dt=r(6728),mt=r(6005),pt=r(7570),ft=r(4419);function vt(e){var t=e.split("-"),r="RxDB";return t.forEach((e=>{r+=P(e)})),r+="Plugin",new Error("You are using a function which must be overwritten by a plugin.\n You should either prevent the usage of this function or add the plugin via:\n import { "+r+" } from 'rxdb/plugins/"+e+"';\n addRxPlugin("+r+");\n ")}function gt(e){return e.documentData?e.documentData:e.previousDocumentData}var yt=function(){function e(e,t,r,a){this.queueByDocId=new Map,this.isRunning=!1,this.storageInstance=e,this.primaryPath=t,this.preWrite=r,this.postWrite=a}var t=e.prototype;return t.addWrite=function(e,t){var r=e[this.primaryPath],a=s(this.queueByDocId,r,(()=>[]));return new Promise(((r,n)=>{var s={lastKnownDocumentState:e,modifier:t,resolve:r,reject:n};(0,le.Is)(a).push(s),this.triggerRun()}))},t.triggerRun=async function(){if(!0!==this.isRunning&&0!==this.queueByDocId.size){this.isRunning=!0;var e=[],t=this.queueByDocId;this.queueByDocId=new Map,await Promise.all(Array.from(t.entries()).map((async t=>{let[r,a]=t;var n,s,i,o=(n=a.map((e=>e.lastKnownDocumentState)),s=n[0],i=$e(s._rev).height,n.forEach((e=>{var t=$e(e._rev).height;t>i&&(s=e,i=t)})),s),l=o;for(var u of a)try{l=await u.modifier(c(l))}catch(h){u.reject(h),u.reject=()=>{},u.resolve=()=>{}}try{await this.preWrite(l,o)}catch(h){return void a.forEach((e=>e.reject(h)))}e.push({previous:o,document:l})})));var r=e.length>0?await this.storageInstance.bulkWrite(e,"incremental-write"):{error:[],success:[]};return await Promise.all(r.success.map((e=>{var r=e[this.primaryPath];this.postWrite(e),n(t,r).forEach((t=>t.resolve(e)))}))),r.error.forEach((e=>{var r,a=e.documentId,i=n(t,a),o=E(e);if(o){var c=s(this.queueByDocId,a,(()=>[]));i.reverse().forEach((e=>{e.lastKnownDocumentState=(0,le.Is)(o.documentInDb),(0,le.Is)(c).unshift(e)}))}else{var l=N("COL20",{name:C[(r=e).status],document:r.documentId,writeError:r});i.forEach((e=>e.reject(l)))}})),this.isRunning=!1,this.triggerRun()}},e}();function bt(e){return async t=>{var r=function(e){return Object.assign({},e,{_meta:void 0,_deleted:void 0,_rev:void 0})}(t);r._deleted=t._deleted;var a=await e(r),n=Object.assign({},a,{_meta:t._meta,_attachments:t._attachments,_rev:t._rev,_deleted:void 0!==a._deleted?a._deleted:t._deleted});return void 0===n._deleted&&(n._deleted=!1),n}}var xt={get primaryPath(){if(this.isInstanceOfRxDocument)return this.collection.schema.primaryPath},get primary(){var e=this;if(e.isInstanceOfRxDocument)return e._data[e.primaryPath]},get revision(){if(this.isInstanceOfRxDocument)return this._data._rev},get deleted$(){if(this.isInstanceOfRxDocument)return this.$.pipe((0,ut.U)((e=>e._data._deleted)))},get deleted(){if(this.isInstanceOfRxDocument)return this._data._deleted},getLatest(){var e=this.collection._docCache.getLatestDocumentData(this.primary);return this.collection._docCache.getCachedRxDocument(e)},get $(){return this.collection.$.pipe((0,ht.h)((e=>!e.isLocal)),(0,ht.h)((e=>e.documentId===this.primary)),(0,ut.U)((e=>gt(e))),(0,dt.O)(this.collection._docCache.getLatestDocumentData(this.primary)),(0,mt.x)(((e,t)=>e._rev===t._rev)),(0,ut.U)((e=>this.collection._docCache.getCachedRxDocument(e))),(0,pt.d)(le.kv))},get$(e){if(j.isDevMode()){if(e.includes(".item."))throw N("DOC1",{path:e});if(e===this.primaryPath)throw N("DOC2");if(this.collection.schema.finalFields.includes(e))throw N("DOC3",{path:e});if(!q(this.collection.schema.jsonSchema,e))throw N("DOC4",{path:e})}return this.$.pipe((0,ut.U)((t=>v(t,e))),(0,mt.x)())},populate(e){var t=q(this.collection.schema.jsonSchema,e),r=this.get(e);if(!r)return ft.m5;if(!t)throw N("DOC5",{path:e});if(!t.ref)throw N("DOC6",{path:e,schemaObj:t});var a=this.collection.database.collections[t.ref];if(!a)throw N("DOC7",{ref:t.ref,path:e,schemaObj:t});return"array"===t.type?a.findByIds(r).exec().then((e=>{var t=e.values();return Array.from(t)})):a.findOne(r).exec()},get(e){return s(this._propertyCache,e,(()=>{var t=v(this._data,e);if("object"!=typeof t||null===t||Array.isArray(t))return j.deepFreezeWhenDevMode(t);var r=this;return new Proxy(i(t),{get(t,a){if("string"!=typeof a)return t[a];var n=a.charAt(a.length-1);if("$"===n){var s=a.slice(0,-1);return r.get$(B(e+"."+s))}if("_"===n){var i=a.slice(0,-1);return r.populate(B(e+"."+i))}return r.get(B(e+"."+a))}})}))},toJSON(e){if(void 0===e&&(e=!1),e)return j.deepFreezeWhenDevMode(this._data);var t=i(this._data);return delete t._rev,delete t._attachments,delete t._deleted,delete t._meta,j.deepFreezeWhenDevMode(t)},toMutableJSON(e){return void 0===e&&(e=!1),c(this.toJSON(e))},update(e){throw vt("update")},incrementalUpdate(e){throw vt("update")},updateCRDT(e){throw vt("crdt")},putAttachment(){throw vt("attachments")},getAttachment(){throw vt("attachments")},allAttachments(){throw vt("attachments")},get allAttachments$(){throw vt("attachments")},async modify(e,t){var r=this._data,a=await bt(e)(r);return this._saveData(a,r)},incrementalModify(e,t){return this.collection.incrementalWriteQueue.addWrite(this._data,bt(e)).then((e=>this.collection._docCache.getCachedRxDocument(e)))},patch(e){var t=this._data,r=c(t);return Object.entries(e).forEach((e=>{let[t,a]=e;r[t]=a})),this._saveData(r,t)},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[r,a]=e;t[r]=a})),t)))},async _saveData(e,t){if(e=i(e),this._data._deleted)throw N("DOC11",{id:this.primary,document:this});await jt(this.collection,e,t);var r=await this.collection.storageInstance.bulkWrite([{previous:t,document:e}],"rx-document-save-data"),a=r.error[0];return We(this.collection,this.primary,e,a),await this.collection._runHooks("post","save",e,this),this.collection._docCache.getCachedRxDocument(r.success[0])},remove(){var e=this.collection;if(this.deleted)return Promise.reject(N("DOC13",{document:this,id:this.primary}));var t,r=i(this._data);return e._runHooks("pre","remove",r,this).then((async()=>{r._deleted=!0;var t=await e.storageInstance.bulkWrite([{previous:this._data,document:r}],"rx-document-remove"),a=t.error[0];return We(e,this.primary,r,a),t.success[0]})).then((e=>(t=e,this.collection._runHooks("post","remove",r,this)))).then((()=>this.collection._docCache.getCachedRxDocument(t)))},incrementalRemove(){return this.incrementalModify((async e=>(await this.collection._runHooks("pre","remove",e,this),e._deleted=!0,e))).then((async e=>(await this.collection._runHooks("post","remove",e._data,e),e)))},destroy(){throw N("DOC14")}};function wt(e){void 0===e&&(e=xt);var t=function(e,t){this.collection=e,this._data=t,this._propertyCache=new Map,this.isInstanceOfRxDocument=!0};return t.prototype=e,t}function jt(e,t,r){return t._meta=Object.assign({},r._meta,t._meta),j.isDevMode()&&e.schema.validateChange(r,t),e._runHooks("pre","save",t,r)}var kt=r(10),_t=r(6871),Dt=r(3028),Nt=r(1556),It=r(8456);function Et(e,t){return t.sort&&0!==t.sort.length?t.sort.map((e=>Object.keys(e)[0])):[e]}var Ct=new WeakMap;function Rt(e,t){if(!e.collection.database.eventReduce)return{runFullQueryAgain:!0};var r=function(e){return s(Ct,e,(()=>{var t=e.collection,r=Ee(t.storageInstance.schema,c(e.mangoQuery)),a=t.schema.primaryPath,n=Ce(t.schema.jsonSchema,r),s=Re(t.schema.jsonSchema,r);return{primaryKey:e.collection.schema.primaryPath,skip:r.skip,limit:r.limit,sortFields:Et(a,r),sortComparator:(t,r)=>{var a={docA:t,docB:r,rxQuery:e};return n(a.docA,a.docB)},queryMatcher:t=>s({doc:t,rxQuery:e}.doc)}}))}(e),a=(0,le.Is)(e._result).docsData.slice(0),n=(0,le.Is)(e._result).docsDataMap,i=!1;return t.map((e=>function(e){switch(e.operation){case"INSERT":return{operation:e.operation,id:e.documentId,doc:e.documentData,previous:null};case"UPDATE":return{operation:e.operation,id:e.documentId,doc:j.deepFreezeWhenDevMode(e.documentData),previous:e.previousDocumentData?e.previousDocumentData:"UNKNOWN"};case"DELETE":return{operation:e.operation,id:e.documentId,doc:null,previous:e.previousDocumentData}}}(e))).filter(y.S7).find((e=>{var t={queryParams:r,changeEvent:e,previousResults:a,keyDocumentMap:n},s=(0,It.Rf)(t);return"runFullQueryAgain"===s||("doNothing"!==s?(i=!0,(0,It.wu)(s,r,e,a,n),!1):void 0)}))?{runFullQueryAgain:!0}:{runFullQueryAgain:!1,changed:i,newResults:a}}var Ot=function(){function e(){this._map=new Map}return e.prototype.getByQuery=function(e){var t=e.toString();return s(this._map,t,(()=>e))},e}();function St(e,t){t.uncached=!0;var r=t.toString();e._map.delete(r)}function Pt(e){return e.refCount$.observers.length}var Bt,$t,Tt=(Bt=100,$t=3e4,(e,t)=>{if(!(t._map.size0||(0===s._lastEnsureEqual&&s._creationTimee._lastEnsureEqual-t._lastEnsureEqual)).slice(0,i).forEach((e=>St(t,e)))}}),qt=new WeakSet;var Mt=function(){function e(e,t,r){this.cacheItemByDocId=new Map,this.registry="function"==typeof FinalizationRegistry?new FinalizationRegistry((e=>{var t=e.docId,r=this.cacheItemByDocId.get(t);r&&(r.byRev.delete(e.revisionHeight),0===r.byRev.size&&this.cacheItemByDocId.delete(t))})):void 0,this.registerIdleTasks=[],this.primaryPath=e,this.changes$=t,this.documentCreator=r,t.subscribe((e=>{var t=e.documentId,r=this.cacheItemByDocId.get(t);if(r){var a=gt(e);r.last=a}}))}var t=e.prototype;return t.getLatestDocumentData=function(e){return n(this.cacheItemByDocId,e).last},t.getLatestDocumentDataIfExists=function(e){var t=this.cacheItemByDocId.get(e);if(t)return t.last},(0,b.Z)(e,[{key:"getCachedRxDocument",get:function(){return l(this,"getCachedRxDocument",function(e){var t=e.primaryPath,r=e.cacheItemByDocId,a=e.registry,n=j.deepFreezeWhenDevMode,i=e.documentCreator,o=o=>{var c=o[t],l=Te(o._rev),u=s(r,c,(()=>function(e){return{byRev:new Map,last:e}}(o))),h=u.byRev,d=h.get(l),m=d?d.deref():void 0;return m||(o=n(o),m=i(o),h.set(l,Lt(m)),a&&(e.registerIdleTasks.push(m),e.registerIdlePromise||(e.registerIdlePromise=(0,ft.y$)().then((()=>{e.registerIdlePromise=void 0;var t=e.registerIdleTasks;0!==t.length&&(e.registerIdleTasks=[],t.forEach((e=>{a.register(e,{docId:e.primary,revisionHeight:Te(e.revision)})})))}))))),m};return o}(this))}}]),e}();function At(e,t){for(var r=e.getCachedRxDocument,a=[],n=0;ne}};var Qt=function(){function e(e,t,r){this.time=(0,ce.z)(),this.collection=e,this.count=r,this.documents=At(this.collection._docCache,t)}return(0,b.Z)(e,[{key:"docsData",get:function(){return l(this,"docsData",this.documents.map((e=>e._data)))}},{key:"docsDataMap",get:function(){var e=new Map;return this.documents.forEach((t=>{e.set(t.primary,t._data)})),l(this,"docsDataMap",e)}},{key:"docsMap",get:function(){for(var e=new Map,t=this.documents,r=0;r"string"!=typeof e)))return r.$eq}return!1}(this.collection.schema.primaryPath,t)}var t=e.prototype;return t._setResultData=function(e){if("number"!=typeof e){e instanceof Map&&(e=Array.from(e.values()));var t=new Qt(this.collection,e,e.length);this._result=t}else this._result=new Qt(this.collection,[],e)},t._execOverDatabase=async function(){if(this._execOverDatabaseCount=this._execOverDatabaseCount+1,this._lastExecStart=(0,ce.z)(),"count"===this.op){var e=this.getPreparedQuery(),t=await this.collection.storageInstance.count(e);if("slow"!==t.mode||this.collection.database.allowSlowCount)return t.count;throw N("QU14",{collection:this.collection,queryObj:this.mangoQuery})}if("findByIds"===this.op){var r=(0,le.Is)(this.mangoQuery.selector)[this.collection.schema.primaryPath].$in,a=new Map,n=[];if(r.forEach((e=>{var t=this.collection._docCache.getLatestDocumentDataIfExists(e);if(t){if(!t._deleted){var r=this.collection._docCache.getCachedRxDocument(t);a.set(e,r)}}else n.push(e)})),n.length>0)(await this.collection.storageInstance.findDocumentsById(n,!1)).forEach((e=>{var t=this.collection._docCache.getCachedRxDocument(e);a.set(t.primary,t)}));return a}var s=async function(e){var t=[],r=e.collection;if(e.isFindOneByIdQuery)if(Array.isArray(e.isFindOneByIdQuery)){var a=e.isFindOneByIdQuery;if(a=a.filter((r=>{var a=e.collection._docCache.getLatestDocumentDataIfExists(r);return!a||(a._deleted||t.push(a),!1)})),a.length>0){var n=await r.storageInstance.findDocumentsById(a,!1);(0,y.gu)(t,n)}}else{var s=e.isFindOneByIdQuery,i=e.collection._docCache.getLatestDocumentDataIfExists(s);if(!i){var o=await r.storageInstance.findDocumentsById([s],!1);o[0]&&(i=o[0])}i&&!i._deleted&&t.push(i)}else{var c=e.getPreparedQuery(),l=await r.storageInstance.query(c);t=l.documents}return t}(this);return s.then((e=>(this._lastExecEnd=(0,ce.z)(),e)))},t.exec=function(e){if(e&&"findOne"!==this.op)throw N("QU9",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return Kt(this).then((()=>(0,_t.z)(this.$))).then((t=>{if(!t&&e)throw N("QU10",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return t}))},t.toString=function(){var e=o({op:this.op,query:this.mangoQuery,other:this.other},!0),t=JSON.stringify(e);return this.toString=()=>t,t},t.getPreparedQuery=function(){var e={rxQuery:this,mangoQuery:Ee(this.collection.schema.jsonSchema,this.mangoQuery)};e.mangoQuery.selector._deleted={$eq:!1},e.mangoQuery.index&&e.mangoQuery.index.unshift("_deleted"),it("prePrepareQuery",e);var t=Ut(this.collection.schema.jsonSchema,e.mangoQuery);return this.getPreparedQuery=()=>t,t},t.doesDocumentDataMatch=function(e){return!e._deleted&&this.queryMatcher(e)},t.remove=function(){return this.exec().then((e=>Array.isArray(e)?Promise.all(e.map((e=>e.remove()))):e.remove()))},t.update=function(e){throw vt("update")},t.where=function(e){throw vt("query-builder")},t.sort=function(e){throw vt("query-builder")},t.skip=function(e){throw vt("query-builder")},t.limit=function(e){throw vt("query-builder")},(0,b.Z)(e,[{key:"$",get:function(){if(!this._$){var e=this.collection.$.pipe((0,ht.h)((e=>!e.isLocal)),(0,dt.O)(null),(0,Nt.z)((()=>Kt(this))),(0,ut.U)((()=>this._result)),(0,pt.d)(le.kv),(0,mt.x)(((e,t)=>!(!e||e.time!==(0,le.Is)(t).time))),(0,ht.h)((e=>!!e)),(0,ut.U)((e=>{var t=(0,le.Is)(e);return"count"===this.op?t.count:"findOne"===this.op?0===t.documents.length?null:t.documents[0]:"findByIds"===this.op?t.docsMap:t.documents.slice(0)})));this._$=(0,Dt.T)(e,this.refCount$.pipe((0,ht.h)((()=>!1))))}return this._$}},{key:"queryMatcher",get:function(){this.collection.schema.jsonSchema;return l(this,"queryMatcher",Re(0,Ee(this.collection.schema.jsonSchema,this.mangoQuery)))}},{key:"asRxQuery",get:function(){return this}}]),e}();function Ht(e,t,r,a){it("preCreateRxQuery",{op:e,queryObj:t,collection:r,other:a});var n,s,i=new Ft(e,t,r,a);return i=(n=i).collection._queryCache.getByQuery(n),s=r,qt.has(s)||(qt.add(s),(0,ft.Y3)().then((()=>(0,ft.C2)(200))).then((()=>{s.destroyed||s.cacheReplacementPolicy(s,s._queryCache),qt.delete(s)}))),i}function zt(e){var t=e.asRxQuery.collection._changeEventBuffer.counter;return e._latestChangeEvent>=t}function Kt(e){return e.collection.database.destroyed||zt(e)?ft.kZ:(e._ensureEqualQueue=e._ensureEqualQueue.then((()=>function(e){if(e._lastEnsureEqual=(0,ce.z)(),e.collection.database.destroyed||zt(e))return ft.kZ;var t=!1,r=!1;-1===e._latestChangeEvent&&(r=!0);if(!r){var a=e.asRxQuery.collection._changeEventBuffer.getFrom(e._latestChangeEvent+1);if(null===a)r=!0;else{e._latestChangeEvent=e.asRxQuery.collection._changeEventBuffer.counter;var n=e.asRxQuery.collection._changeEventBuffer.reduceByLastOfDoc(a);if("count"===e.op){var s=(0,le.Is)(e._result).count,i=s;n.forEach((t=>{var r=t.previousDocumentData&&e.doesDocumentDataMatch(t.previousDocumentData),a=e.doesDocumentDataMatch(t.documentData);!r&&a&&i++,r&&!a&&i--})),i!==s&&(t=!0,e._setResultData(i))}else{var o=Rt(e,n);o.runFullQueryAgain?r=!0:o.changed&&(t=!0,e._setResultData(o.newResults))}}}if(r)return e._execOverDatabase().then((r=>(e._latestChangeEvent=e.collection._changeEventBuffer.counter,"number"==typeof r?(e._result&&r===e._result.count||(t=!0,e._setResultData(r)),t):(e._result&&function(e,t,r){if(t.length!==r.length)return!1;for(var a=0,n=t.length;ae.data.name===n)),c=[];o.forEach((e=>{c.push({collectionName:e.data.name,schema:e.data.schema,isCollection:!0}),e.data.connectedStorages.forEach((e=>c.push({collectionName:e.collectionName,isCollection:!1,schema:e.schema})))}));var l=new Set;if(c=c.filter((e=>{var t=e.collectionName+"||"+e.schema.version;return!l.has(t)&&(l.add(t),!0)})),await Promise.all(c.map((async t=>{var i=await e.createStorageInstance({collectionName:t.collectionName,databaseInstanceToken:r,databaseName:a,multiInstance:!1,options:{},schema:t.schema,password:s,devMode:j.isDevMode()});await i.remove(),t.isCollection&&await ot("postRemoveRxCollection",{storage:e,databaseName:a,collectionName:n})}))),i){var u=o.map((e=>{var t=ze(e);return t._deleted=!0,t._meta.lwt=(0,ce.z)(),t._rev=qe(r,e),{previous:e,document:t}}));await t.bulkWrite(u,"rx-database-remove-collection-all")}}var nr=function(){function e(e){this.subs=[],this.limit=100,this.counter=0,this.eventCounterMap=new WeakMap,this.buffer=[],this.collection=e,this.subs.push(this.collection.$.pipe((0,ht.h)((e=>!e.isLocal))).subscribe((e=>this._handleChangeEvent(e))))}var t=e.prototype;return t._handleChangeEvent=function(e){for(this.counter++,this.buffer.push(e),this.eventCounterMap.set(e,this.counter);this.buffer.length>this.limit;)this.buffer.shift()},t.getArrayIndexByPointer=function(e){var t=this.buffer[0],r=this.eventCounterMap.get(t);return et(e)))},t.reduceByLastOfDoc=function(e){return e.slice(0)},t.destroy=function(){this.subs.forEach((e=>e.unsubscribe()))},e}();var sr=new WeakMap;function ir(e){var t=e.schema.getDocumentPrototype(),r=function(e){var t={};return Object.entries(e.methods).forEach((e=>{let[r,a]=e;t[r]=a})),t}(e),a={};return[t,r,xt].forEach((e=>{Object.getOwnPropertyNames(e).forEach((t=>{var r=Object.getOwnPropertyDescriptor(e,t),n=!0;(t.startsWith("_")||t.endsWith("_")||t.startsWith("$")||t.endsWith("$"))&&(n=!1),"function"==typeof r.value?Object.defineProperty(a,t,{get(){return r.value.bind(this)},enumerable:n,configurable:!1}):(r.enumerable=n,r.configurable=!1,r.writable&&(r.writable=!1),Object.defineProperty(a,t,r))}))})),a}function or(e,t){var r=function(e,t,r){var a=new e(t,r);return it("createRxDocument",a),a}(function(e){return s(sr,e,(()=>wt(ir(e))))}(e),e,j.deepFreezeWhenDevMode(t));return e._runHooksSync("post","create",t,r),it("postCreateRxDocument",r),r}var cr=function(e,t){return nt(He(e.newDocumentState),He(e.realMasterState))?Promise.resolve({isEqual:!0}):Promise.resolve({isEqual:!1,documentData:e.realMasterState})};var lr=["pre","post"],ur=["insert","save","remove","create"],hr=!1,dr=function(){function e(e,t,r,a,n,s,i,o,c,l,u,h){void 0===n&&(n={}),void 0===s&&(s={}),void 0===i&&(i={}),void 0===o&&(o={}),void 0===c&&(c={}),void 0===l&&(l=Tt),void 0===u&&(u={}),void 0===h&&(h=cr),this.storageInstance={},this.timeouts=new Set,this.incrementalWriteQueue={},this._incrementalUpsertQueues=new Map,this.synced=!1,this.hooks={},this._subs=[],this._docCache={},this._queryCache=new Ot,this.$={},this.checkpoint$={},this._changeEventBuffer={},this.onDestroy=[],this.destroyed=!1,this.database=e,this.name=t,this.schema=r,this.internalStorageInstance=a,this.instanceCreationOptions=n,this.migrationStrategies=s,this.methods=i,this.attachments=o,this.options=c,this.cacheReplacementPolicy=l,this.statics=u,this.conflictHandler=h,function(e){if(hr)return;hr=!0;var t=Object.getPrototypeOf(e);ur.forEach((e=>{lr.map((r=>{var a=r+P(e);t[a]=function(t,a){return this.addHook(r,e,t,a)}}))}))}(this.asRxCollection)}var t=e.prototype;return t.prepare=async function(){this.storageInstance=Ke(this.database,this.internalStorageInstance,this.schema.jsonSchema),this.incrementalWriteQueue=new yt(this.storageInstance,this.schema.primaryPath,((e,t)=>jt(this,e,t)),(e=>this._runHooks("post","save",e)));var e,t=this.database.eventBulks$.pipe((0,ht.h)((e=>e.collectionName===this.name)));this.$=t.pipe((0,Nt.z)((e=>e.events))),this.checkpoint$=t.pipe((0,ut.U)((e=>e.checkpoint))),this._changeEventBuffer=(e=this.asRxCollection,new nr(e)),this._docCache=new Mt(this.schema.primaryPath,this.$.pipe((0,ht.h)((e=>!e.isLocal))),(e=>or(this.asRxCollection,e)));var r=await this.database.storageToken,a=this.storageInstance.changeStream().subscribe((e=>{var t={id:e.id,internal:!1,collectionName:this.name,storageToken:r,events:e.events.map((e=>Qe(!1,e,this))),databaseToken:this.database.token,checkpoint:e.checkpoint,context:e.context,endTime:e.endTime,startTime:e.startTime};this.database.$emit(t)}));return this._subs.push(a),this._subs.push(this.storageInstance.conflictResultionTasks().subscribe((e=>{this.conflictHandler(e.input,e.context).then((t=>{this.storageInstance.resolveConflictResultionTask({id:e.id,output:t})}))}))),ft.$Y},t.cleanup=function(e){throw vt("cleanup")},t.migrationNeeded=function(){throw vt("migration-schema")},t.getMigrationState=function(){throw vt("migration-schema")},t.startMigration=function(e){return void 0===e&&(e=10),this.getMigrationState().startMigration(e)},t.migratePromise=function(e){return void 0===e&&(e=10),this.getMigrationState().migratePromise(e)},t.insert=async function(e){var t=await this.bulkInsert([e]),r=t.error[0];return We(this,e[this.schema.primaryPath],e,r),(0,le.Is)(t.success[0])},t.bulkInsert=async function(e){if(0===e.length)return{success:[],error:[]};var t=this.schema.primaryPath,r=e.map((e=>rr(this.schema,e))),a=this.hasHooks("pre","insert")?await Promise.all(r.map((e=>this._runHooks("pre","insert",e).then((()=>e))))):r,n=a.map((e=>({document:e}))),s=await this.storageInstance.bulkWrite(n,"rx-collection-bulk-insert"),i=At(this._docCache,s.success);if(this.hasHooks("post","insert")){var o=new Map;a.forEach((e=>{o.set(e[t],e)})),await Promise.all(i.map((e=>this._runHooks("post","insert",o.get(e.primary),e))))}return{success:i,error:s.error}},t.bulkRemove=async function(e){var t=this.schema.primaryPath;if(0===e.length)return{success:[],error:[]};var r=await this.findByIds(e).exec(),a=[],s=new Map;Array.from(r.values()).forEach((e=>{var t=e.toMutableJSON(!0);a.push(t),s.set(e.primary,t)})),await Promise.all(a.map((e=>{var t=e[this.schema.primaryPath];return this._runHooks("pre","remove",e,r.get(t))})));var o=a.map((e=>{var t=i(e);return t._deleted=!0,{previous:e,document:t}})),c=await this.storageInstance.bulkWrite(o,"rx-collection-bulk-remove"),l=c.success.map((e=>e[t]));return await Promise.all(l.map((e=>this._runHooks("post","remove",s.get(e),r.get(e))))),{success:l.map((e=>n(r,e))),error:c.error}},t.bulkUpsert=async function(e){var t=[],r=new Map;e.forEach((e=>{var a=rr(this.schema,e),n=a[this.schema.primaryPath];if(!n)throw N("COL3",{primaryPath:this.schema.primaryPath,data:a,schema:this.schema.jsonSchema});r.set(n,a),t.push(a)}));var a=await this.bulkInsert(t),s=a.success.slice(0),i=[];return await Promise.all(a.error.map((async e=>{if(409!==e.status)i.push(e);else{var t=e.documentId,a=n(r,t),o=(0,le.Is)(e.documentInDb),c=this._docCache.getCachedRxDocument(o),l=await c.incrementalModify((()=>a));s.push(l)}}))),{error:i,success:s}},t.upsert=async function(e){var t=await this.bulkUpsert([e]);return We(this.asRxCollection,e[this.schema.primaryPath],e,t.error[0]),t.success[0]},t.incrementalUpsert=function(e){var t=rr(this.schema,e),r=t[this.schema.primaryPath];if(!r)throw N("COL4",{data:e});var a=this._incrementalUpsertQueues.get(r);return a||(a=ft.$Y),a=a.then((()=>function(e,t,r){var a=e._docCache.getLatestDocumentDataIfExists(t);if(a)return Promise.resolve({doc:e._docCache.getCachedRxDocument(a),inserted:!1});return e.findOne(t).exec().then((t=>t?{doc:t,inserted:!1}:e.insert(r).then((e=>({doc:e,inserted:!0})))))}(this,r,t))).then((e=>e.inserted?e.doc:function(e,t){return e.incrementalModify((e=>t))}(e.doc,t))),this._incrementalUpsertQueues.set(r,a),a},t.find=function(e){if("string"==typeof e)throw N("COL5",{queryObj:e});return e||(e={selector:{}}),Ht("find",e,this)},t.findOne=function(e){if("number"==typeof e||Array.isArray(e))throw I("COL6",{queryObj:e});var t;if("string"==typeof e)t=Ht("findOne",{selector:{[this.schema.primaryPath]:e},limit:1},this);else{if(e||(e={selector:{}}),e.limit)throw N("QU6");(e=i(e)).limit=1,t=Ht("findOne",e,this)}return t},t.count=function(e){return e||(e={selector:{}}),Ht("count",e,this)},t.findByIds=function(e){return Ht("findByIds",{selector:{[this.schema.primaryPath]:{$in:e.slice(0)}}},this)},t.exportJSON=function(){throw vt("json-dump")},t.importJSON=function(e){throw vt("json-dump")},t.insertCRDT=function(e){throw vt("crdt")},t.addHook=function(e,t,r,a){if(void 0===a&&(a=!1),"function"!=typeof r)throw I("COL7",{key:t,when:e});if(!lr.includes(e))throw I("COL8",{key:t,when:e});if(!ur.includes(t))throw N("COL9",{key:t});if("post"===e&&"create"===t&&!0===a)throw N("COL10",{when:e,key:t,parallel:a});var n=r.bind(this),s=a?"parallel":"series";this.hooks[t]=this.hooks[t]||{},this.hooks[t][e]=this.hooks[t][e]||{series:[],parallel:[]},this.hooks[t][e][s].push(n)},t.getHooks=function(e,t){return this.hooks[t]&&this.hooks[t][e]?this.hooks[t][e]:{series:[],parallel:[]}},t.hasHooks=function(e,t){var r=this.getHooks(e,t);return!!r&&(r.series.length>0||r.parallel.length>0)},t._runHooks=function(e,t,r,a){var n=this.getHooks(e,t);if(!n)return ft.$Y;var s=n.series.map((e=>()=>e(r,a)));return(0,ft.Ze)(s).then((()=>Promise.all(n.parallel.map((e=>e(r,a))))))},t._runHooksSync=function(e,t,r,a){var n=this.getHooks(e,t);n&&n.series.forEach((e=>e(r,a)))},t.promiseWait=function(e){return new Promise((t=>{var r=setTimeout((()=>{this.timeouts.delete(r),t()}),e);this.timeouts.add(r)}))},t.destroy=function(){return this.destroyed?ft.kZ:(this.destroyed=!0,Array.from(this.timeouts).forEach((e=>clearTimeout(e))),this._changeEventBuffer&&this._changeEventBuffer.destroy(),this.database.requestIdlePromise().then((()=>Promise.all(this.onDestroy.map((e=>e()))))).then((()=>this.storageInstance.close())).then((()=>(this._subs.forEach((e=>e.unsubscribe())),delete this.database.collections[this.name],ot("postDestroyRxCollection",this).then((()=>!0))))))},t.remove=async function(){await this.destroy(),await ar(this.database.storage,this.database.internalStore,this.database.token,this.database.name,this.name,this.database.password,this.database.hashFunction)},(0,b.Z)(e,[{key:"insert$",get:function(){return this.$.pipe((0,ht.h)((e=>"INSERT"===e.operation)))}},{key:"update$",get:function(){return this.$.pipe((0,ht.h)((e=>"UPDATE"===e.operation)))}},{key:"remove$",get:function(){return this.$.pipe((0,ht.h)((e=>"DELETE"===e.operation)))}},{key:"asRxCollection",get:function(){return this}}]),e}();var mr=r(7782),pr=r(6753);var fr="undefined"!=typeof crypto&&void 0!==crypto.subtle&&"function"==typeof crypto.subtle.digest?async function(e){var t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-256",t);return Array.prototype.map.call(new Uint8Array(r),(e=>("00"+e.toString(16)).slice(-2))).join("")}:function(e){return Promise.resolve((0,pr.JQ)(e))},vr=r(5898),gr=new Set,yr=function(){function e(e,t,r,a,n,s,i,o,c,l,u,h){void 0===i&&(i=!1),void 0===o&&(o={}),this.idleQueue=new mr.F,this.rxdbVersion=rt,this.storageInstances=new Set,this._subs=[],this.startupErrors=[],this.onDestroy=[],this.destroyed=!1,this.collections={},this.eventBulks$=new oe.x,this.observable$=this.eventBulks$.pipe((0,Nt.z)((e=>e.events))),this.storageToken=ft.kZ,this.storageTokenDocument=ft.kZ,this.emittedEventBulkIds=new vr.i(6e4),this.name=e,this.token=t,this.storage=r,this.instanceCreationOptions=a,this.password=n,this.multiInstance=s,this.eventReduce=i,this.options=o,this.internalStore=c,this.hashFunction=l,this.cleanupPolicy=u,this.allowSlowCount=h,"pseudoInstance"!==this.name&&(this.internalStore=Ke(this.asRxDatabase,c,Vt),this.storageTokenDocument=async function(e){var t=S(10),r=e.password?await e.hashFunction(JSON.stringify(e.password)):void 0,a={id:er,context:Jt,key:Gt,data:{rxdbVersion:e.rxdbVersion,token:t,instanceToken:e.token,passwordHash:r},_deleted:!1,_meta:T(),_rev:"",_attachments:{}},n=await e.internalStore.bulkWrite([{document:a}],"internal-add-storage-token");if(n.success[0])return n.success[0];var s=(0,le.Is)(n.error[0]);if(s.isError&&E(s)){var i=s;if(c=i.documentInDb.data.rxdbVersion,l=e.rxdbVersion,!c||l.includes("beta")&&l!==c||c.split(".")[0]!==l.split(".")[0])throw N("DM5",{args:{database:e.name,databaseStateVersion:i.documentInDb.data.rxdbVersion,codeVersion:e.rxdbVersion}});if(r&&r!==i.documentInDb.data.passwordHash)throw N("DB1",{passwordHash:r,existingPasswordHash:i.documentInDb.data.passwordHash});var o=i.documentInDb;return(0,le.Is)(o)}var c,l;throw s}(this.asRxDatabase).catch((e=>this.startupErrors.push(e))),this.storageToken=this.storageTokenDocument.then((e=>e.data.token)).catch((e=>this.startupErrors.push(e))))}var t=e.prototype;return t.$emit=function(e){this.emittedEventBulkIds.has(e.id)||(this.emittedEventBulkIds.add(e.id),this.eventBulks$.next(e))},t.removeCollectionDoc=async function(e,t){var r=await Ae(this.internalStore,Xt(tr(e,t),Zt));if(!r)throw N("SNH",{name:e,schema:t});var a=ze(r);a._deleted=!0,await this.internalStore.bulkWrite([{document:a,previous:r}],"rx-database-remove-collection")},t.addCollections=async function(e){var t={},r={},a=[],n={};await Promise.all(Object.entries(e).map((async e=>{let[s,o]=e;var c=s,l=o.schema;t[c]=l;var u=lt(l,this.hashFunction);if(r[c]=u,this.collections[s])throw N("DB3",{name:s});var h=tr(s,l),d={id:Xt(h,Zt),key:h,context:Zt,data:{name:c,schemaHash:await u.hash,schema:u.jsonSchema,version:u.version,connectedStorages:[]},_deleted:!1,_meta:T(),_rev:"",_attachments:{}};a.push({document:d});var m=Object.assign({},o,{name:c,schema:u,database:this}),p=i(o);p.database=this,p.name=s,it("preCreateRxCollection",p),m.conflictHandler=p.conflictHandler,n[c]=m})));var s=await this.internalStore.bulkWrite(a,"rx-database-add-collection");await async function(e){if(await e.storageToken,e.startupErrors[0])throw e.startupErrors[0]}(this),await Promise.all(s.error.map((async e=>{if(409!==e.status)throw N("DB12",{database:this.name,writeError:e});var a=(0,le.Is)(e.documentInDb),n=a.data.name,s=r[n];if(a.data.schemaHash!==await s.hash)throw N("DB6",{database:this.name,collection:n,previousSchemaHash:a.data.schemaHash,schemaHash:await s.hash,previousSchema:a.data.schema,schema:(0,le.Is)(t[n])})})));var o={};return await Promise.all(Object.keys(e).map((async e=>{var t=n[e],r=await function(e){let{database:t,name:r,schema:a,instanceCreationOptions:n={},migrationStrategies:s={},autoMigrate:i=!0,statics:o={},methods:c={},attachments:l={},options:u={},localDocuments:h=!1,cacheReplacementPolicy:d=Tt,conflictHandler:m=cr}=e;var p={databaseInstanceToken:t.token,databaseName:t.name,collectionName:r,schema:a.jsonSchema,options:n,multiInstance:t.multiInstance,password:t.password,devMode:j.isDevMode()};return it("preCreateRxStorageInstance",p),async function(e,t){return t.multiInstance=e.multiInstance,await e.storage.createStorageInstance(t)}(t,p).then((e=>{var p=new dr(t,r,a,e,n,s,c,l,u,d,o,m);return p.prepare().then((()=>{Object.entries(o).forEach((e=>{let[t,r]=e;Object.defineProperty(p,t,{get:()=>r.bind(p)})}));var e=ft.$Y;return i&&0!==p.schema.version&&(e=p.migratePromise()),e})).then((()=>(it("createRxCollection",{collection:p,creator:{name:r,schema:a,storageInstance:e,instanceCreationOptions:n,migrationStrategies:s,methods:c,attachments:l,options:u,cacheReplacementPolicy:d,localDocuments:h,statics:o}}),p))).catch((t=>e.close().then((()=>Promise.reject(t)))))}))}(t);o[e]=r,this.collections[e]=r,this[e]||Object.defineProperty(this,e,{get:()=>this.collections[e]})}))),o},t.lockedRun=function(e){return this.idleQueue.wrapCall(e)},t.requestIdlePromise=function(){return this.idleQueue.requestIdlePromise()},t.exportJSON=function(e){throw vt("json-dump")},t.importJSON=function(e){throw vt("json-dump")},t.backup=function(e){throw vt("backup")},t.leaderElector=function(){throw vt("leader-election")},t.isLeader=function(){throw vt("leader-election")},t.waitForLeadership=function(){throw vt("leader-election")},t.migrationStates=function(){throw vt("migration-schema")},t.destroy=async function(){return this.destroyed?ft.kZ:(this.destroyed=!0,await ot("preDestroyRxDatabase",this),this.eventBulks$.complete(),this._subs.map((e=>e.unsubscribe())),"pseudoInstance"===this.name?ft.kZ:this.requestIdlePromise().then((()=>Promise.all(this.onDestroy.map((e=>e()))))).then((()=>Promise.all(Object.keys(this.collections).map((e=>this.collections[e])).map((e=>e.destroy()))))).then((()=>this.internalStore.close())).then((()=>gr.delete(this.name))).then((()=>!0)))},t.remove=function(){return this.destroy().then((()=>async function(e,t,r){var a=S(10),n=await br(a,t,e,{},!1,r),s=await Yt(n),i=new Set;s.forEach((e=>i.add(e.data.name)));var o=Array.from(i);return await Promise.all(o.map((s=>ar(t,n,a,e,s,r)))),await ot("postRemoveRxDatabase",{databaseName:e,storage:t}),await n.remove(),o}(this.name,this.storage,this.password)))},(0,b.Z)(e,[{key:"$",get:function(){return this.observable$}},{key:"asRxDatabase",get:function(){return this}}]),e}();async function br(e,t,r,a,n,s){return await t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:Me,schema:Vt,options:a,multiInstance:n,password:s,devMode:j.isDevMode()})}function xr(e){let{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:s=!0,eventReduce:i=!0,ignoreDuplicate:o=!1,options:c={},cleanupPolicy:l,allowSlowCount:u=!1,localDocuments:h=!1,hashFunction:d=fr}=e;it("preCreateRxDatabase",{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:s,eventReduce:i,ignoreDuplicate:o,options:c,localDocuments:h}),o||function(e){if(gr.has(e))throw N("DB8",{name:e,link:"https://pubkey.github.io/rxdb/rx-database.html#ignoreduplicate"})}(a),gr.add(a);var m=S(10);return br(m,t,a,r,s,n).catch((e=>{throw gr.delete(a),e})).then((e=>{var p=new yr(a,m,t,r,n,s,i,c,e,d,l,u);return ot("createRxDatabase",{database:p,creator:{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:s,eventReduce:i,ignoreDuplicate:o,options:c,localDocuments:h}}).then((()=>p))}))}var wr={RxSchema:ct.prototype,RxDocument:xt,RxQuery:Ft.prototype,RxCollection:dr.prototype,RxDatabase:yr.prototype},jr=new Set,kr=new Set;var _r=function(e){function t(t,r,a){var n;return(n=e.call(this,null,r)||this).id=t,n.parent=a,n}return(0,x.Z)(t,e),t}(wt()),Dr={get isLocal(){return!0},get allAttachments$(){throw N("LD1",{document:this})},get primaryPath(){return"id"},get primary(){return this.id},get $(){var e=n(Cr,this.parent);return this.parent.$.pipe((0,ht.h)((e=>e.documentId===this.primary)),(0,ht.h)((e=>e.isLocal)),(0,ut.U)((e=>gt(e))),(0,dt.O)(e.docCache.getLatestDocumentData(this.primary)),(0,mt.x)(((e,t)=>e._rev===t._rev)),(0,ut.U)((t=>e.docCache.getCachedRxDocument(t))),(0,pt.d)(le.kv))},getLatest(){var e=n(Cr,this.parent),t=e.docCache.getLatestDocumentData(this.primary);return e.docCache.getCachedRxDocument(t)},get(e){if(e="data."+e,this._data){if("string"!=typeof e)throw I("LD2",{objPath:e});var t=v(this._data,e);return t=j.deepFreezeWhenDevMode(t)}},get$(e){if(e="data."+e,j.isDevMode()){if(e.includes(".item."))throw N("LD3",{objPath:e});if(e===this.primaryPath)throw N("LD4")}return this.$.pipe((0,ut.U)((e=>e._data)),(0,ut.U)((t=>v(t,e))),(0,mt.x)())},async incrementalModify(e){var t=await Or(this.parent);return t.incrementalWriteQueue.addWrite(this._data,(async t=>(t.data=await e(t.data,this),t))).then((e=>t.docCache.getCachedRxDocument(e)))},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[r,a]=e;t[r]=a})),t)))},async _saveData(e){var t=await Or(this.parent),r=this._data;return e.id=this.id,t.storageInstance.bulkWrite([{previous:r,document:e}],"local-document-save-data").then((t=>{var r=t.success[0];if(!r)throw t.error[0];(e=i(e))._rev=r._rev}))},async remove(){var e=await Or(this.parent),t={id:this._data.id,data:{},_deleted:!0,_meta:T(),_rev:"",_attachments:{}};return Le(e.storageInstance,{previous:this._data,document:t},"local-document-remove").then((t=>e.docCache.getCachedRxDocument(t)))}},Nr=!1,Ir=()=>{if(!Nr){Nr=!0;var e=xt;Object.getOwnPropertyNames(e).forEach((t=>{if(!Object.getOwnPropertyDescriptor(Dr,t)){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(Dr,t,r)}}));["populate","update","putAttachment","getAttachment","allAttachments"].forEach((e=>Dr[e]=(e=>()=>{throw N("LD6",{functionName:e})})(e)))}};var Er=new WeakMap,Cr=new WeakMap;function Rr(e){var t=e.database?e.database:e,r=e.database?e.name:"",a=(async()=>{var a=await Sr(t.token,t.storage,t.name,r,t.instanceCreationOptions,t.multiInstance);a=Ke(t,a,Tr);var n=new Mt("id",e.$.pipe((0,ht.h)((e=>e.isLocal))),(t=>function(e,t){Ir();var r=new _r(e.id,e,t);return Object.setPrototypeOf(r,Dr),r.prototype=Dr,r}(t,e))),s=new yt(a,"id",(()=>{}),(()=>{})),i=await t.storageToken,o=a.changeStream().subscribe((r=>{var a={id:r.id,internal:!1,collectionName:e.database?e.name:void 0,storageToken:i,events:r.events.map((t=>Qe(!0,t,e.database?e:void 0))),databaseToken:t.token,checkpoint:r.checkpoint,context:r.context,endTime:r.endTime,startTime:r.startTime};t.$emit(a)}));e._subs.push(o);var c={database:t,parent:e,storageInstance:a,docCache:n,incrementalWriteQueue:s};return Cr.set(e,c),c})();Er.set(e,a)}function Or(e){var t=Er.get(e);if(!t){var r=e.database?e.database:e,a=e.database?e.name:"";throw N("LD8",{database:r.name,collection:a})}return t}function Sr(e,t,r,a,n,s){return t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:$r(a),schema:Tr,options:n,multiInstance:s,devMode:j.isDevMode()})}function Pr(e){var t=Er.get(e);if(t)return Er.delete(e),t.then((e=>e.storageInstance.close()))}async function Br(e,t,r){var a=S(10),n=await Sr(a,e,t,r,{},!1);await n.remove()}function $r(e){return"plugin-local-documents-"+e}var Tr=Q({title:"RxLocalDocument",version:0,primaryKey:"id",type:"object",properties:{id:{type:"string",maxLength:128},data:{type:"object",additionalProperties:!0}},required:["id","data"]});async function qr(e,t){var r=await Or(this),a={id:e,data:t,_deleted:!1,_meta:T(),_rev:"",_attachments:{}};return Le(r.storageInstance,{document:a},"local-document-insert").then((e=>r.docCache.getCachedRxDocument(e)))}function Mr(e,t){return this.getLocal(e).then((r=>r?r.incrementalModify((()=>t)):this.insertLocal(e,t)))}async function Ar(e){var t=await Or(this),r=t.docCache,a=r.getLatestDocumentDataIfExists(e);return a?Promise.resolve(r.getCachedRxDocument(a)):Ae(t.storageInstance,e).then((e=>e?t.docCache.getCachedRxDocument(e):null))}function Lr(e){return this.$.pipe((0,dt.O)(null),(0,Nt.z)((async t=>t?{changeEvent:t}:{doc:await this.getLocal(e)})),(0,Nt.z)((async t=>{if(t.changeEvent){var r=t.changeEvent;return r.isLocal&&r.documentId===e?{use:!0,doc:await this.getLocal(e)}:{use:!1}}return{use:!0,doc:t.doc}})),(0,ht.h)((e=>e.use)),(0,ut.U)((e=>e.doc)))}var Qr={name:"local-documents",rxdb:!0,prototypes:{RxCollection:e=>{e.insertLocal=qr,e.upsertLocal=Mr,e.getLocal=Ar,e.getLocal$=Lr},RxDatabase:e=>{e.insertLocal=qr,e.upsertLocal=Mr,e.getLocal=Ar,e.getLocal$=Lr}},hooks:{createRxDatabase:{before:e=>{e.creator.localDocuments&&Rr(e.database)}},createRxCollection:{before:e=>{e.creator.localDocuments&&Rr(e.collection)}},preDestroyRxDatabase:{after:e=>Pr(e)},postDestroyRxCollection:{after:e=>Pr(e)},postRemoveRxDatabase:{after:e=>Br(e.storage,e.databaseName,"")},postRemoveRxCollection:{after:e=>Br(e.storage,e.databaseName,e.collectionName)}},overwritable:{}};let Wr;function Fr(){return"undefined"!=typeof window&&window.indexedDB}function Hr(){return Wr||(Wr=(async()=>{!function(e){if(it("preAddRxPlugin",{plugin:e,plugins:jr}),!jr.has(e)){if(kr.has(e.name))throw N("PL3",{name:e.name,plugin:e});if(jr.add(e),kr.add(e.name),!e.rxdb)throw I("PL1",{plugin:e});e.init&&e.init(),e.prototypes&&Object.entries(e.prototypes).forEach((e=>{let[t,r]=e;return r(wr[t])})),e.overwritable&&Object.assign(j,e.overwritable),e.hooks&&Object.entries(e.hooks).forEach((e=>{let[t,r]=e;r.after&&st[t].push(r.after),r.before&&st[t].unshift(r.before)}))}}(Qr);var e;return await xr({name:"rxdb-landing-v3",localDocuments:!0,storage:(void 0===e&&(e={}),new at(e))})})()),Wr}const zr=["#e6008d","#8d2089","#5f2688"]},341:(e,t,r)=>{function a(e,t){if(!window.trigger)throw new Error("window.trigger not defined");return window.trigger(e,t)}r.d(t,{X:()=>a})},1960:(e,t,r)=>{r.r(t),r.d(t,{default:()=>O});var a=r(2263),n=r(3799),s=r(5742),i=r(3028),o=r(5556),c=r(9655),l=r(3784),u=r(1556),h=r(7236),d=r(8804),m=r(598),p=Array.isArray;function f(e){return(0,m.U)((function(t){return function(e,t){return p(t)?e.apply(void 0,(0,o.ev)([],(0,o.CR)(t))):e(t)}(e,t)}))}var v=["addListener","removeListener"],g=["addEventListener","removeEventListener"],y=["on","off"];function b(e,t,r,a){if((0,d.m)(r)&&(a=r,r=void 0),a)return b(e,t,r).pipe(f(a));var n=(0,o.CR)(function(e){return(0,d.m)(e.addEventListener)&&(0,d.m)(e.removeEventListener)}(e)?g.map((function(a){return function(n){return e[a](t,n,r)}})):function(e){return(0,d.m)(e.addListener)&&(0,d.m)(e.removeListener)}(e)?v.map(x(e,t)):function(e){return(0,d.m)(e.on)&&(0,d.m)(e.off)}(e)?y.map(x(e,t)):[],2),s=n[0],i=n[1];if(!s&&(0,h.z)(e))return(0,u.z)((function(e){return b(e,t,r)}))((0,c.Xf)(e));if(!s)throw new TypeError("Invalid event target");return new l.y((function(e){var t=function(){for(var t=[],r=0;r{for(await(0,k.YB)(B);C;){const e=$(),r=(0,k.YB)(e.timeToNextPeriod);if(e.period%2==0)try{await t.incrementalModify((t=>(t.beatPeriod>=e.period||(t.beatPeriod=e.period,t.color=D.O9[e.period%3],e.period%4==0?t.text1=L(S,e.period)[0]:t.text2=L(P,e.period)[0]),t)))}catch(p){}await r}})();const r=await e.upsertLocal("mousepos",{x:0,y:0,time:0});let a=[];window.addEventListener("mousemove",(e=>{a=[e.clientX,e.clientY]})),(0,i.T)(b(window,"mousemove"),b(window,"scroll"),b(window,"resize")).subscribe((()=>{r.incrementalPatch({x:a[0],y:a[1],time:(0,_.z)()})})),function(e){const t=document.getElementsByClassName("tilt-to-mouse"),r=100;function a(e,t,a){const n=a.getBoundingClientRect(),s=-(t-n.y-n.height/2)/r,i=(e-n.x-n.width/2)/r;return`perspective(150px) rotateX(${M(s)}deg) rotateY(${M(i)}deg) `}function n(e,t){e.style.transform=a.apply(null,t)}e.$.subscribe((e=>{e._data.data.time&&Array.from(t).forEach((t=>{if(!W(t))return;n(t,(0,j.Is)([e._data.data.x,e._data.data.y]).concat([t]))}))}))}(r),function(e){const t=document.getElementsByClassName("enlarge-on-mouse");function r(e){const t=e.getBoundingClientRect();return{centerX:t.left+t.width/2,centerY:t.top+t.height/2,width:t.width,height:t.height}}function a(e,t){const r=`scale(${t})`;e.style.transform=r}e.$.pipe((0,m.U)((e=>e._data))).subscribe((e=>{e.data.time&&e.data.x&&e.data.y&&Array.from(t).forEach((t=>{if(!W(t))return;const n=r(t),s=e.data.x-n.centerX,i=e.data.y-n.centerY,o=Math.sqrt(s*s+i*i);function c(e){return 1.9^e}let l=1+n.width/2/c(o+300);l>1.5&&(l=1.5),l<1.01&&(l=1),a(t,l)}))}))}(r);const n=document.getElementsByClassName("beating"),s=document.getElementsByClassName("beating-first"),o=document.getElementsByClassName("beating-second"),c=document.getElementsByClassName("beating-number"),l=document.getElementsByClassName("beating-color"),u=document.getElementsByClassName("beating-color-string"),h=[];let d=0;$(),t.$.pipe((0,m.U)((e=>e._data.data)),(0,w.x)(((e,t)=>JSON.stringify(e)===JSON.stringify(t)))).subscribe((e=>{h.forEach((function(e){e(d)})),d+=1;const t=e.color;Array.from(l).forEach((function(e){e.style.backgroundColor=t})),Array.from(u).forEach((function(e){e.innerHTML=t}))})),h.push((function(){Array.from(n).forEach((function(e){e.style.animationDuration=B+"ms",e.classList.remove("animation"),e.offsetWidth,e.classList.add("animation")})),Array.from(s).forEach((function(e){e.style.animationDuration=B+"ms",e.classList.remove("animation"),e.offsetWidth,e.classList.add("animation")})),Array.from(o).forEach((function(e){e.style.animationDuration=B+"ms",e.classList.remove("animation"),e.offsetWidth,e.classList.add("animation")}))})),h.push((function(){Array.from(c).forEach((function(e){A()&&A()&&setTimeout((function(){const t=parseFloat(e.innerHTML)+1;e.innerHTML=t+""}),105)}))}))}function O(){const{siteConfig:e}=(0,a.Z)();return(0,N.useEffect)((()=>(R(),()=>{console.log("stop animation"),C=!1}))),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(s.Z,{children:(0,E.jsx)("body",{className:"homepage"})}),(0,E.jsx)(n.Z,{title:`${e.title}`,description:"RxDB is a fast, local-first NoSQL-database for JavaScript Applications like Websites, hybrid Apps, Electron-Apps, Progressive Web Apps and Node.js",children:(0,E.jsxs)("main",{children:[(0,E.jsx)("div",{className:"block first centered",children:(0,E.jsx)("div",{className:"content",children:(0,E.jsxs)("div",{className:"inner",children:[(0,E.jsxs)("div",{className:"half",children:[(0,E.jsx)("br",{}),(0,E.jsxs)("h1",{children:["The local ",(0,E.jsx)("b",{className:"underline",children:"Database"})," for"," ",(0,E.jsx)("b",{className:"underline",children:"JavaScript"})," Applications"]}),(0,E.jsx)("br",{}),(0,E.jsxs)("ul",{className:"checked",children:[(0,E.jsx)("li",{children:"Realtime Queries"}),(0,E.jsx)("li",{children:"Realtime Replication"}),(0,E.jsx)("li",{children:"Works Offline"}),(0,E.jsx)("li",{children:"Supports all JavaScript runtimes"}),(0,E.jsx)("li",{children:"Great Performance"})]}),(0,E.jsx)("a",{className:"button",href:"/quickstart.html",target:"_blank",children:"Get Started"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsx)("div",{className:"half",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,E.jsxs)("div",{className:"content-canvas",style:{marginTop:30,marginBottom:30},children:[(0,E.jsx)("div",{className:"device tablet",style:{marginLeft:481,marginTop:117},children:(0,E.jsx)("div",{className:"beating-color",style:{backgroundColor:"rgb(141, 32, 137)"},children:(0,E.jsx)("img",{src:"./files/logo/logo.svg",className:"beating logo animation",alt:"RxDB",style:{animationDuration:"851ms"}})})}),(0,E.jsx)("div",{className:"device desktop",style:{marginTop:"0%"},children:(0,E.jsx)("div",{className:"beating-color",style:{backgroundColor:"rgb(141, 32, 137)"},children:(0,E.jsx)("img",{src:"/files/logo/logo_text.svg",className:"beating logo animation",alt:"RxDB",style:{animationDuration:"851ms",width:"52%"}})})}),(0,E.jsxs)("div",{className:"device server",style:{marginLeft:0,marginTop:168},children:[(0,E.jsx)("div",{className:"beating-color one",style:{backgroundColor:"rgb(141, 32, 137)"}}),(0,E.jsx)("div",{className:"beating-color two",style:{backgroundColor:"rgb(141, 32, 137)"}}),(0,E.jsx)("div",{className:"beating-color three",style:{backgroundColor:"rgb(141, 32, 137)"}})]})]})})]})})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb",onClick:()=>(0,I.X)("github_trophy_click",.2),target:"_blank",children:(0,E.jsxs)("div",{className:"trophy",children:[(0,E.jsx)("img",{src:"./files/icons/github-star-with-logo.svg",alt:"RxDB github star"}),(0,E.jsxs)("div",{style:{flex:1},children:[(0,E.jsx)("div",{className:"subtitle",children:"Open Source on"}),(0,E.jsx)("div",{className:"title",children:"GitHub"})]}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"valuetitle",children:"stars"}),(0,E.jsxs)("div",{className:"value",children:["19247",(0,E.jsx)("div",{className:"arrow-up",children:" "})]})]})]})}),(0,E.jsx)("div",{className:"block second dark",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsxs)("h2",{children:["Realtime applications ",(0,E.jsx)("b",{className:"underline",children:"made easy"})]}),(0,E.jsxs)("p",{children:["From the results of a query, to a single field of a document, with RxDB you can ",(0,E.jsx)("b",{children:"observe everything"}),". This enables you to build realtime applications ",(0,E.jsx)("b",{children:"fast"})," and ",(0,E.jsx)("b",{children:"reliable"}),". It does not matter if the data was changed by"," ",(0,E.jsx)("b",{children:"a user event"}),", ",(0,E.jsx)("b",{children:"another browser tab"})," or by the",(0,E.jsx)("b",{children:" replication"}),"."," ","Whenever your data changes, your UI reflects the new state."]}),(0,E.jsxs)("div",{className:"inner",children:[(0,E.jsxs)("div",{className:"code half",children:[(0,E.jsxs)("fieldset",{className:"samp-wrapper",style:{backgroundColor:"var(--bg-color)"},children:[(0,E.jsx)("legend",{children:"Write"}),(0,E.jsxs)("samp",{children:[(0,E.jsx)("span",{className:"cm-keyword",children:"await "}),(0,E.jsx)("span",{className:"cm-variable",children:"collection"}),".",(0,E.jsx)("span",{className:"cm-method",children:"upsert"}),"(","{",(0,E.jsx)("br",{}),(0,E.jsx)("span",{className:"cm-property",children:"\xa0 id"}),": ",(0,E.jsx)("span",{className:"cm-string",children:"'foobar'"}),",",(0,E.jsx)("br",{}),(0,E.jsx)("span",{className:"cm-property",children:"\xa0 color"}),": ",(0,E.jsxs)("span",{className:"cm-string",children:["'",(0,E.jsx)("span",{className:"beating-color-string beating-color",children:"#e6008d"}),"'"]}),(0,E.jsx)("br",{}),"}",");"]})]}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsxs)("fieldset",{className:"samp-wrapper",style:{backgroundColor:"var(--bg-color)"},children:[(0,E.jsx)("legend",{children:"Observe"}),(0,E.jsxs)("samp",{style:{backgroundColor:"var(--bg-color)"},children:[(0,E.jsx)("span",{className:"cm-keyword",children:"await "}),(0,E.jsx)("span",{className:"cm-variable",children:"collection"}),".",(0,E.jsxs)("span",{className:"cm-method",children:["findOne(",(0,E.jsx)("span",{className:"cm-string",children:"'foobar'"}),")"]}),(0,E.jsx)("br",{}),"\xa0.",(0,E.jsx)("span",{className:"cm-property",children:"$"}),(0,E.jsx)("span",{className:"cm-comment",children:" // get observable"}),(0,E.jsx)("br",{}),"\xa0.",(0,E.jsx)("span",{className:"cm-method",children:"subscribe"}),"(",(0,E.jsx)("span",{className:"cm-def",children:"d"}),(0,E.jsx)("span",{className:"cm-operator",children:" =>"})," ","{",(0,E.jsx)("br",{}),(0,E.jsx)("span",{className:"cm-variable",children:"\xa0\xa0 screen"}),".",(0,E.jsx)("span",{className:"cm-property",children:"backgroundColor"}),(0,E.jsx)("span",{className:"cm-operator",children:" = "}),(0,E.jsx)("span",{className:"cm-variable",children:"d"}),".",(0,E.jsx)("span",{className:"cm-property beating-color",children:"color"}),";",(0,E.jsx)("br",{}),"\xa0","}",");"]})]})]}),(0,E.jsx)("div",{className:"canvas half",children:(0,E.jsxs)("div",{className:"content-canvas",children:[(0,E.jsx)("div",{className:"device tablet",style:{marginLeft:481,marginTop:117},children:(0,E.jsx)("div",{className:"beating-color",children:(0,E.jsx)("img",{src:"./files/logo/logo.svg",className:"beating logo",alt:"RxDB"})})}),(0,E.jsx)("div",{className:"device desktop",style:{marginTop:"0%"},children:(0,E.jsx)("div",{className:"beating-color",children:(0,E.jsx)("img",{src:"./files/logo/logo.svg",className:"beating logo",alt:"RxDB"})})}),(0,E.jsxs)("div",{className:"device server",style:{marginLeft:0,marginTop:168},children:[(0,E.jsx)("div",{className:"beating-color one"}),(0,E.jsx)("div",{className:"beating-color two"}),(0,E.jsx)("div",{className:"beating-color three"})]})]})})]})]})}),(0,E.jsx)("a",{href:"https://twitter.com/intent/user?screen_name=rxdbjs",onClick:()=>(0,I.X)("twitter_trophy_click",.2),target:"_blank",children:(0,E.jsxs)("div",{className:"trophy twitter",children:[(0,E.jsx)("img",{src:"./files/icons/twitter-blue.svg",alt:"RxDB Twitter"}),(0,E.jsxs)("div",{style:{flex:1},children:[(0,E.jsx)("div",{className:"subtitle",children:"Follow on"}),(0,E.jsx)("div",{className:"title",children:"Twitter"})]}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"valuetitle",children:"followers"}),(0,E.jsxs)("div",{className:"value",children:["2843",(0,E.jsx)("div",{className:"arrow-up",children:" "})]})]})]})}),(0,E.jsx)("div",{className:"block replication",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsxs)("div",{className:"half left",children:[(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsxs)("h2",{children:["Replicate ",(0,E.jsx)("b",{children:"with your existing infrastructure"})]}),(0,E.jsxs)("p",{children:["RxDB supports replication with a"," ",(0,E.jsx)("a",{href:"/replication-couchdb.html",target:"_blank",children:"CouchDB"})," ","server or any custom"," ",(0,E.jsx)("a",{href:"/replication-graphql.html",target:"_blank",children:"GraphQL"})," ","endpoint which smoothly integrates with your existing infrastructure. Also you can use the replication primitives plugin to create custom replications over any protocol like"," ",(0,E.jsx)("a",{href:"/replication-http.html",target:"_blank",children:"HTTP"}),","," ",(0,E.jsx)("a",{href:"/replication-websocket.html",target:"_blank",children:"Websocket"}),","," ",(0,E.jsx)("a",{href:"/replication-webrtc.html",target:"_blank",children:"WebRTC"})," ","or"," ",(0,E.jsx)("a",{href:"/replication-firestore.html",target:"_blank",children:"Firestore"}),"."]})]}),(0,E.jsx)("div",{className:"half right",children:(0,E.jsxs)("div",{className:"replication-icons",children:[(0,E.jsx)("img",{src:"./files/logo/logo.svg",alt:"RxDB",className:"replicate-logo tilt-to-mouse"}),(0,E.jsx)("a",{href:"/replication-graphql.html",target:"_blank",children:(0,E.jsx)("div",{className:"neumorphism-circle-xl centered replicate-graphql enlarge-on-mouse",children:(0,E.jsx)("img",{src:"./files/icons/graphql-text.svg",alt:"GraphQL",className:"protocol"})})}),(0,E.jsx)("a",{href:"/replication-couchdb.html",target:"_blank",children:(0,E.jsx)("div",{className:"neumorphism-circle-xl centered replicate-couchdb enlarge-on-mouse",children:(0,E.jsx)("img",{src:"./files/icons/couchdb-text.svg",alt:"CouchDB",className:"protocol"})})}),(0,E.jsxs)("div",{className:"neumorphism-circle-xs centered replicate-rest enlarge-on-mouse",children:["{"," REST ","}"]}),(0,E.jsx)("a",{href:"/replication-websocket.html",target:"_blank",children:(0,E.jsx)("div",{className:"neumorphism-circle-xs centered replicate-websocket enlarge-on-mouse",children:"websocket"})}),(0,E.jsx)("a",{href:"/replication-webrtc.html",target:"_blank",children:(0,E.jsx)("div",{className:"neumorphism-circle-xs centered replicate-webrtc enlarge-on-mouse",children:"WebRTC"})})]})}),(0,E.jsx)("div",{className:"clear"})]})}),(0,E.jsx)("a",{href:"https://rxdb.info/chat.html",onClick:()=>(0,I.X)("discord_trophy_click",.2),target:"_blank",children:(0,E.jsxs)("div",{className:"trophy discord",children:[(0,E.jsx)("img",{src:"./files/icons/discord.svg",alt:"RxDB Discord chat"}),(0,E.jsxs)("div",{style:{flex:1},children:[(0,E.jsx)("div",{className:"subtitle",children:"Chat on"}),(0,E.jsx)("div",{className:"title",children:"Discord"})]}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"valuetitle",children:"members"}),(0,E.jsxs)("div",{className:"value",children:["414",(0,E.jsx)("div",{className:"arrow-up",children:" "})]})]})]})}),(0,E.jsxs)("div",{className:"block offline-first dark",children:[(0,E.jsx)("div",{className:"offline-image-wrapper",children:(0,E.jsx)("img",{src:"files/icons/wifi/wifi_1a202c.svg",className:"offline-image beating-second",alt:"offline"})}),(0,E.jsxs)("div",{className:"content",children:[(0,E.jsxs)("h2",{children:["Online ",(0,E.jsx)("b",{className:"underline",children:"is optional"})]}),(0,E.jsxs)("div",{className:"full-width",children:[(0,E.jsx)("div",{className:"half left",children:(0,E.jsxs)("p",{children:["RxDB follows the"," ",(0,E.jsx)("a",{href:"/offline-first.html",target:"_blank",children:"Offline First"})," ","paradigm where an application must work as well offline as it does online. This is done by persisting data locally on the client side and replicating it in the background. RxDB can even be used solely on the client side, with no backend at all."]})}),(0,E.jsx)("div",{className:"half right",children:(0,E.jsxs)("ul",{className:"checked",children:[(0,E.jsxs)("li",{children:["Your application still ",(0,E.jsx)("b",{children:"works offline"})]}),(0,E.jsxs)("li",{children:["Increases ",(0,E.jsx)("b",{children:"perceived performance"})]}),(0,E.jsxs)("li",{children:["Easier and ",(0,E.jsx)("b",{children:"faster implementation"})]}),(0,E.jsxs)("li",{children:["Needs less backend resources and ",(0,E.jsx)("b",{children:"scales better"})]})]})})]})]})]}),(0,E.jsx)("div",{className:"block frameworks",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/angular",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"-10%",left:"10%"},children:[(0,E.jsx)("img",{src:"./files/icons/angular.svg",alt:"angular"}),"Angular"]})}),(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"10%",left:"58%"},children:[(0,E.jsx)("img",{src:"./files/icons/capacitor.svg",alt:"capacitor"}),"Capacitor"]}),(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"-4%",left:"44%"},children:[(0,E.jsx)("img",{src:"./files/icons/deno.svg",alt:"deno"}),"Deno"]}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/node",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"-5%",left:"85%"},children:[(0,E.jsx)("img",{src:"./files/icons/nodejs.svg",alt:"Node.js"}),"Node.js"]})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/react",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"4%",left:"26%"},children:[(0,E.jsx)("img",{src:"./files/icons/react.svg",alt:"React"}),"React"]})}),(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"15%",left:"90%",marginLeft:"-35px"},children:[(0,E.jsx)("img",{src:"./files/icons/svelte.svg",alt:"Svelte"}),"Svelte"]}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsxs)("h2",{children:["Flexible ",(0,E.jsx)("b",{className:"underline",children:"storage layer"})]}),(0,E.jsxs)("p",{children:["RxDB is based on a storage interface that enables you to swap out the underlying storage engine. This increases code reuse because the same database code can be used in ",(0,E.jsx)("b",{children:"any JavaScript runtime"})," ","by just switching out the storage settings.",(0,E.jsx)("br",{})]}),(0,E.jsxs)("div",{className:"below-text",children:[(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/electron",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"2%",left:"18%"},children:[(0,E.jsx)("img",{src:"./files/icons/electron.svg",alt:"electron"}),"Electron"]})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/vue",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"3%",left:"45%"},children:[(0,E.jsx)("img",{src:"./files/icons/vuejs.svg",alt:"Vue.js"}),"Vue.js"]})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/ionic2",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"2%",left:"71%"},children:[(0,E.jsx)("img",{src:"./files/icons/ionic.svg",alt:"ionic"}),"Ionic"]})}),(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"46%",left:"11%"},children:[(0,E.jsx)("img",{src:"./files/icons/nativescript.svg",alt:"NativeScript"}),"NativeScript"]}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/react-native",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"45%",left:"35%"},children:[(0,E.jsx)("img",{src:"./files/icons/react.svg",alt:"React Native"}),"React Native"]})}),(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"45%",left:"62%"},children:[(0,E.jsx)("img",{src:"./files/icons/nextjs.svg",alt:"Next.js"}),"Next.js"]}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/flutter",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"40%",left:"86%"},children:[(0,E.jsx)("img",{src:"./files/icons/flutter.svg",alt:"Flutter"}),"Flutter"]})})]})]})}),(0,E.jsx)("div",{className:"block fifth dark",children:(0,E.jsx)("div",{className:"content centered",children:(0,E.jsxs)("div",{className:"inner",children:[(0,E.jsxs)("h2",{children:["Trusted and ",(0,E.jsx)("b",{className:"underline",children:"open source"})]}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/github-star.svg",alt:"github star"}),(0,E.jsx)("div",{className:"label",children:"Github Stars"}),(0,E.jsx)("a",{className:"value",href:"https://github.com/pubkey/rxdb",rel:"noopener",target:"_blank",children:"19247"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/download.svg",alt:"npm downloads"}),(0,E.jsx)("div",{className:"label",children:"npm downloads"}),(0,E.jsx)("a",{className:"value beating-number",href:"https://www.npmjs.com/package/rxdb",rel:"noopener",target:"_blank",children:"238572"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsx)("div",{className:"clear"}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/person.svg",alt:"contributor"}),(0,E.jsx)("div",{className:"label",children:"Contributors"}),(0,E.jsx)("a",{className:"value",href:"https://github.com/pubkey/rxdb/graphs/contributors",rel:"noopener",target:"_blank",children:"133"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/commit.svg",alt:"commit"}),(0,E.jsx)("div",{className:"label",children:"Commits"}),(0,E.jsx)("a",{className:"value",href:"https://github.com/pubkey/rxdb/commits/master",rel:"noopener",target:"_blank",children:"6891"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsx)("div",{className:"clear"}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/gear.svg",alt:"gear"}),(0,E.jsx)("div",{className:"label",children:"Projects build with RxDB"}),(0,E.jsx)("a",{className:"value",href:"https://github.com/pubkey/rxdb/network/dependents?package_id=UGFja2FnZS0xODM0NzAyMw%3D%3D",rel:"noopener",target:"_blank",children:"825"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/twitter.svg",alt:"twitter"}),(0,E.jsx)("div",{className:"label",children:"Twitter followers"}),(0,E.jsx)("a",{className:"value",href:"https://twitter.com/intent/user?screen_name=rxdbjs",rel:"noopener",target:"_blank",children:"2843"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsx)("div",{className:"clear"})]})})}),(0,E.jsx)("div",{className:"block sixth",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsx)("h2",{children:"Pricing Models"}),(0,E.jsx)("div",{className:"inner",children:(0,E.jsxs)("div",{className:"buy-options",children:[(0,E.jsx)("div",{className:"buy-option bg-gradient-left-top",children:(0,E.jsxs)("div",{className:"buy-option-inner",children:[(0,E.jsxs)("div",{className:"buy-option-title",children:[(0,E.jsx)("h2",{children:"RxDB Basics"}),(0,E.jsx)("div",{className:"price",children:"Free & Open Source"})]}),(0,E.jsx)("div",{className:"buy-option-features",children:(0,E.jsxs)("ul",{children:[(0,E.jsx)("li",{children:"Basic RxStorages"}),(0,E.jsx)("li",{children:"Realtime Replication"}),(0,E.jsx)("li",{children:"Live Queries"}),(0,E.jsx)("li",{children:"Schema Validation"}),(0,E.jsx)("li",{children:"Multi-Tab Support"}),(0,E.jsx)("li",{children:"Encryption"}),(0,E.jsx)("li",{children:"Compression"})]})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb",target:"_blank",rel:"noopener",onClick:()=>(0,I.X)("goto_code",.2),children:(0,E.jsx)("div",{className:"buy-option-action bg-top hover-shadow-top",children:"Get the Code"})})]})}),(0,E.jsx)("div",{className:"buy-option bg-gradient-right-top",children:(0,E.jsxs)("div",{className:"buy-option-inner",children:[(0,E.jsxs)("div",{className:"buy-option-title",children:[(0,E.jsx)("h2",{children:"Premium Plugins"}),(0,E.jsx)("div",{className:"price",children:"for professionals to get the most out of RxDB"})]}),(0,E.jsx)("div",{className:"buy-option-features",children:(0,E.jsxs)("ul",{children:[(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-sqlite.html",target:"_blank",children:"SQLite RxStorage"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-opfs.html",target:"_blank",children:"OPFS RxStorage"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-indexeddb.html",target:"_blank",children:"IndexedDB RxStorage"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-memory-synced.html",target:"_blank",children:"Memory-Synced RxStorage"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-sharding.html",target:"_blank",children:"Sharding Plugin"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/query-optimizer.html",target:"_blank",children:"Query Optimizer"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/migration-storage.html",target:"_blank",children:"Storage Migrator"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-localstorage-meta-optimizer.html",target:"_blank",children:"RxStorage Localstorage Meta Optimizer"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-shared-worker.html",target:"_blank",children:"Shared Worker"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-worker.html",target:"_blank",children:"Worker"})})]})}),(0,E.jsx)("a",{href:"/premium",onClick:()=>(0,I.X)("premium_request",1),children:(0,E.jsx)("div",{className:"buy-option-action bg-middle hover-shadow-middle",children:"Request Premium"})})]})}),(0,E.jsx)("div",{className:"buy-option bg-gradient-left-top",children:(0,E.jsxs)("div",{className:"buy-option-inner",children:[(0,E.jsxs)("div",{className:"buy-option-title",children:[(0,E.jsx)("h2",{children:"Consulting Session"}),(0,E.jsx)("div",{className:"price",children:"fast in person consulting"})]}),(0,E.jsx)("div",{className:"buy-option-features",children:(0,E.jsxs)("p",{children:["Book a one hour consulting session with the RxDB maintainer. I will answer all your questions, give proposals for your use case and we can even do a pair programming session if you have a specific problem in your source code.",(0,E.jsx)("br",{}),"You can book this by doing a one-time donation via github sponsors."]})}),(0,E.jsx)("a",{href:"https://github.com/sponsors/pubkey?frequency=one-time&sponsor=pubkey",target:"_blank",onClick:()=>(0,I.X)("consulting_session_request",1.5),children:(0,E.jsx)("div",{className:"buy-option-action bg-bottom hover-shadow-bottom",children:"Book Now"})})]})})]})})]})}),(0,E.jsx)("div",{className:"block last dark",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsxs)("h2",{children:["Start using ",(0,E.jsx)("b",{className:"underline",children:"RxDB"})," today"]}),(0,E.jsxs)("div",{className:"buttons full-width",children:[(0,E.jsx)("a",{href:"/quickstart.html",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("start_now",.4),children:(0,E.jsx)("div",{className:"button get-premium",style:{left:"50%",top:"20%",marginLeft:"-122px"},children:"Start now"})}),(0,E.jsx)("a",{href:"https://rxdb.info/newsletter.html",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("get_newsletter",.4),children:(0,E.jsx)("div",{className:"button",style:{left:"25%",marginLeft:"-90px"},children:"Get the Newsletter"})}),(0,E.jsx)("a",{href:"https://rxdb.info/chat.html",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("join_chat",.4),children:(0,E.jsx)("div",{className:"button",style:{left:"77%",top:"6%",marginLeft:"-70.5px"},children:"Join the Chat"})}),(0,E.jsx)("a",{href:"/premium",onClick:()=>(0,I.X)("premium_request",1),children:(0,E.jsx)("div",{className:"button",style:{top:"40%",left:"20%",marginLeft:"-70.5px"},children:"Get Premium"})}),(0,E.jsx)("a",{href:"https://twitter.com/intent/user?screen_name=rxdbjs",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("follow_twitter",.4),children:(0,E.jsx)("div",{className:"button",style:{top:"44%",left:"73%",marginLeft:"-85px"},children:"Follow on Twitter"})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("goto_code",.4),children:(0,E.jsx)("div",{className:"button",style:{top:"54%",left:"32%",marginLeft:"-70px"},children:"Get the Code"})})]})]})})]})})]})}const S=["NoSQL","OfflineFirst","JavaScript","observable","reactive","realtime","client side","fast"],P=["for the Web","for Node.js","for Browsers","for Capacitor","for Electron","for hybrid apps","for PWAs","for React Native","for NativeScript","for UI apps","you deserve","that syncs"],B=851;function $(){const e=((new Date).getTime()-196e7)/B,t=Math.floor(e);return{ratio:e,period:t,timeToNextPeriod:(e-t)*B}}const T=22,q=-1*T;function M(e){return eT?T:e}function A(){return Math.random()<.5}function L(e,t){let r,a,n=(e=e.slice(0)).length;for(;n;)a=Math.floor(Q(t)*n--),r=e[n],e[n]=e[a],e[a]=r,++t;return e}function Q(e){const t=1e4*Math.sin(e++);return t-Math.floor(t)}function W(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}},6087:(e,t,r)=>{function a(e){return e[e.length-1]}function n(e){return Array.isArray(e)?e.slice(0):[e]}function s(e){return Array.isArray(e)}function i(e){return null!=e}function o(e,t){var r=0,a=-1;for(var n of e){if(!t(n,a+=1))break;r+=1}return r}function c(e,t){for(var r=t.length,a=0;as,Nb:()=>l,S7:()=>i,SI:()=>a,gu:()=>c,qo:()=>n,r0:()=>o})},7400:(e,t,r)=>{function a(e,t){if(!e)throw t||(t=""),new Error("ensureNotFalsy() is falsy: "+t);return e}r.d(t,{Is:()=>a,kv:()=>n});var n={bufferSize:1,refCount:!0}},4419:(e,t,r)=>{function a(){return new Promise((e=>setTimeout(e,0)))}function n(e){return void 0===e&&(e=0),new Promise((t=>setTimeout(t,e)))}r.d(t,{$Y:()=>o,C2:()=>u,Y3:()=>a,YB:()=>n,Ze:()=>h,kZ:()=>s,m5:()=>i,y$:()=>c});Promise.resolve(!0);var s=Promise.resolve(!1),i=Promise.resolve(null),o=Promise.resolve();function c(e){return void 0===e&&(e=1e4),"function"==typeof requestIdleCallback?new Promise((t=>{requestIdleCallback((()=>t()),{timeout:e})})):n(0)}var l=o;function u(e){return void 0===e&&(e=void 0),l=l.then((()=>c(e)))}function h(e,t){return e.reduce(((e,t)=>e.then(t)),Promise.resolve(t))}},984:(e,t,r)=>{r.d(t,{z:()=>n});var a=0;function n(){var e=Date.now();(e+=.01)<=a&&(e=a+.01);var t=parseFloat(e.toFixed(2));return a=t,t}}}]); \ No newline at end of file +"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[3237],{5921:(e,t,r)=>{r.d(t,{O9:()=>zr,N8:()=>Hr,dZ:()=>Fr});var a=r(8061);function n(e,t){var r=e.get(t);if(void 0===r)throw new Error("missing value from map "+t);return r}function s(e,t,r,a){var n=e.get(t);return void 0===n?(n=r(),e.set(t,n)):a&&a(n),n}function i(e){return Object.assign({},e)}function o(e,t){if(void 0===t&&(t=!1),!e)return e;if(!t&&Array.isArray(e))return e.sort(((e,t)=>"string"==typeof e&&"string"==typeof t?e.localeCompare(t):"object"==typeof e?1:-1)).map((e=>o(e,t)));if("object"==typeof e&&!Array.isArray(e)){var r={};return Object.keys(e).sort(((e,t)=>e.localeCompare(t))).forEach((a=>{r[a]=o(e[a],t)})),r}return e}var c=function e(t){if(!t)return t;if(null===t||"object"!=typeof t)return t;if(Array.isArray(t)){for(var r=new Array(t.length),a=r.length;a--;)r[a]=e(t[a]);return r}var n={};for(var s in t)n[s]=e(t[s]);return n};function l(e,t,r){return Object.defineProperty(e,t,{get:function(){return r}}),r}var u=e=>{var t=typeof e;return null!==e&&("object"===t||"function"===t)},h=new Set(["__proto__","prototype","constructor"]),d=new Set("0123456789");function m(e){var t=[],r="",a="start",n=!1;for(var s of e)switch(s){case"\\":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a)throw new Error("Invalid character after an index");n&&(r+=s),a="property",n=!n;break;case".":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a){a="property";break}if(n){n=!1,r+=s;break}if(h.has(r))return[];t.push(r),r="",a="property";break;case"[":if("index"===a)throw new Error("Invalid character in an index");if("indexEnd"===a){a="index";break}if(n){n=!1,r+=s;break}if("property"===a){if(h.has(r))return[];t.push(r),r=""}a="index";break;case"]":if("index"===a){t.push(Number.parseInt(r,10)),r="",a="indexEnd";break}if("indexEnd"===a)throw new Error("Invalid character after an index");default:if("index"===a&&!d.has(s))throw new Error("Invalid character in an index");if("indexEnd"===a)throw new Error("Invalid character after an index");"start"===a&&(a="property"),n&&(n=!1,r+="\\"),r+=s}switch(n&&(r+="\\"),a){case"property":if(h.has(r))return[];t.push(r);break;case"index":throw new Error("Index was not closed");case"start":t.push("")}return t}function p(e,t){if("number"!=typeof t&&Array.isArray(e)){var r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function f(e,t){if(p(e,t))throw new Error("Cannot use string index")}function v(e,t,r){if(Array.isArray(t)&&(t=t.join(".")),!t.includes(".")&&!t.includes("["))return e[t];if(!u(e)||"string"!=typeof t)return void 0===r?e:r;var a=m(t);if(0===a.length)return r;for(var n=0;n!1,deepFreezeWhenDevMode:e=>e,tunnelErrorMessage:e=>"RxDB Error-Code "+e+".\n Error messages are not included in RxDB core to reduce build size.\n - To find out what this error means, either use the dev-mode-plugin https://rxdb.info/dev-mode.html\n - or search for the error code here: https://github.com/pubkey/rxdb/search?q="+e+"\n "};function k(e,t,r){return"RxError ("+t+"):\n"+e+"\n"+function(e){var t="";return 0===Object.keys(e).length?t:(t+="Given parameters: {\n",t+=Object.keys(e).map((t=>{var r="[object Object]";try{r="errors"===t?e[t].map((e=>JSON.stringify(e,Object.getOwnPropertyNames(e)))):JSON.stringify(e[t],(function(e,t){return void 0===t?null:t}),2)}catch(a){}return t+":"+r})).join("\n"),t+="}")}(r)}var _=function(e){function t(t,r,a){var n;void 0===a&&(a={});var s=k(r,t,a);return(n=e.call(this,s)||this).code=t,n.message=s,n.parameters=a,n.rxdb=!0,n}return(0,x.Z)(t,e),t.prototype.toString=function(){return this.message},(0,b.Z)(t,[{key:"name",get:function(){return"RxError ("+this.code+")"}},{key:"typeError",get:function(){return!1}}]),t}((0,w.Z)(Error)),D=function(e){function t(t,r,a){var n;void 0===a&&(a={});var s=k(r,t,a);return(n=e.call(this,s)||this).code=t,n.message=s,n.parameters=a,n.rxdb=!0,n}return(0,x.Z)(t,e),t.prototype.toString=function(){return this.message},(0,b.Z)(t,[{key:"name",get:function(){return"RxTypeError ("+this.code+")"}},{key:"typeError",get:function(){return!0}}]),t}((0,w.Z)(TypeError));function N(e,t){return new _(e,j.tunnelErrorMessage(e),t)}function I(e,t){return new D(e,j.tunnelErrorMessage(e),t)}function E(e){return!(!e||409!==e.status)&&e}var C={409:"document write conflict",422:"schema validation error",510:"attachment data missing"};var R=/\./g,O="abcdefghijklmnopqrstuvwxyz";function S(e){void 0===e&&(e=10);for(var t="",r=0;r{var r=v(t,e);if(void 0===r)throw N("DOC18",{args:{field:e,documentData:t}});return r})).join(r.separator)}function Q(e){var t=A((e=i(e)).primaryKey);e.properties=i(e.properties),e.additionalProperties=!1,Object.prototype.hasOwnProperty.call(e,"keyCompression")||(e.keyCompression=!1),e.indexes=e.indexes?e.indexes.slice(0):[],e.required=e.required?e.required.slice(0):[],e.encrypted=e.encrypted?e.encrypted.slice(0):[],e.properties._rev={type:"string",minLength:1},e.properties._attachments={type:"object"},e.properties._deleted={type:"boolean"},e.properties._meta=W,e.required=e.required?e.required.slice(0):[],e.required.push("_deleted"),e.required.push("_rev"),e.required.push("_meta"),e.required.push("_attachments");var r=F(e);(0,y.gu)(e.required,r),e.required=e.required.filter((e=>!e.includes("."))).filter(((e,t,r)=>r.indexOf(e)===t)),e.version=e.version||0;var a=e.indexes.map((e=>{var r=(0,y.AD)(e)?e.slice(0):[e];return r.includes(t)||r.push(t),"_deleted"!==r[0]&&r.unshift("_deleted"),r}));0===a.length&&a.push(function(e){return["_deleted",e]}(t)),a.push(["_meta.lwt",t]),e.internalIndexes&&e.internalIndexes.map((e=>{a.push(e)}));var n=new Set;return a.filter((e=>{var t=e.join(",");return!n.has(t)&&(n.add(t),!0)})),e.indexes=a,e}var W={type:"object",properties:{lwt:{type:"number",minimum:$,maximum:1e15,multipleOf:.01}},additionalProperties:!0,required:["lwt"]};function F(e){var t=Object.keys(e.properties).filter((t=>e.properties[t].final)),r=A(e.primaryKey);return t.push(r),"string"!=typeof e.primaryKey&&e.primaryKey.fields.forEach((e=>t.push(e))),t}var H="docs",z="changes",K="attachments",U="dexie",Z=new Map,J=new Map;var V="__";function X(e){var t=e.split(".");if(t.length>1)return t.map((e=>X(e))).join(".");if(e.startsWith("|")){var r=e.substring(1);return V+r}return e}function Y(e){var t=e.split(".");return t.length>1?t.map((e=>Y(e))).join("."):e.startsWith(V)?"|"+e.substring(V.length):e}function G(e,t){return t?(t=te(t=i(t)),e.forEach((e=>{var r=v(t,e);g(t,e,r?"1":"0")})),t):t}function ee(e,t){return t?(t=re(t=i(t)),e.forEach((e=>{var r=v(t,e);g(t,e,"1"===r)})),t):t}function te(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>te(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((e=>{let[r,a]=e;"object"==typeof a&&(a=te(a)),t[X(r)]=a})),t}}function re(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>re(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((r=>{let[a,n]=r;("object"==typeof n||Array.isArray(e))&&(n=re(n)),t[Y(a)]=n})),t}}function ae(e){var t=[],r=A(e.primaryKey);t.push([r]),t.push(["_deleted",r]),e.indexes&&e.indexes.forEach((e=>{var r=(0,y.qo)(e);t.push(r)})),t.push(["_meta.lwt",r]),t.push(["_meta.lwt"]);var a=(t=t.map((e=>e.map((e=>X(e)))))).map((e=>1===e.length?e[0]:"["+e.join("+")+"]"));return(a=a.filter(((e,t,r)=>r.indexOf(e)===t))).join(", ")}async function ne(e,t){var r=await e;return(await r.dexieTable.bulkGet(t)).map((e=>ee(r.booleanIndexes,e)))}function se(e,t){return e+"||"+t}function ie(e){var t=new Set,r=[];return e.indexes?(e.indexes.forEach((a=>{(0,y.qo)(a).forEach((a=>{t.has(a)||(t.add(a),"boolean"===q(e,a).type&&r.push(a))}))})),r.push("_deleted"),(0,y.Nb)(r)):r}var oe=r(6974),ce=r(984),le=r(7400),ue=String.fromCharCode(65535),he=Number.MIN_SAFE_INTEGER;function de(e,t){var r=t.selector,a=e.indexes?e.indexes.slice(0):[];t.index&&(a=[t.index]);var n=!!t.sort.find((e=>"desc"===Object.values(e)[0])),s=new Set;Object.keys(r).forEach((t=>{var a=q(e,t);a&&"boolean"===a.type&&Object.prototype.hasOwnProperty.call(r[t],"$eq")&&s.add(t)}));var i,o=t.sort.map((e=>Object.keys(e)[0])).filter((e=>!s.has(e))).join(","),c=-1;if(a.forEach((e=>{var a=!0,l=!0,u=e.map((e=>{var t=r[e],n=t?Object.keys(t):[],s={};t&&n.length?n.forEach((e=>{if(me.has(e)){var r=function(e,t){switch(e){case"$eq":return{startKey:t,endKey:t,inclusiveEnd:!0,inclusiveStart:!0};case"$lte":return{endKey:t,inclusiveEnd:!0};case"$gte":return{startKey:t,inclusiveStart:!0};case"$lt":return{endKey:t,inclusiveEnd:!1};case"$gt":return{startKey:t,inclusiveStart:!1};default:throw new Error("SNH")}}(e,t[e]);s=Object.assign(s,r)}})):s={startKey:l?he:ue,endKey:a?ue:he,inclusiveStart:!0,inclusiveEnd:!0};return void 0===s.startKey&&(s.startKey=he),void 0===s.endKey&&(s.endKey=ue),void 0===s.inclusiveStart&&(s.inclusiveStart=!0),void 0===s.inclusiveEnd&&(s.inclusiveEnd=!0),l&&!s.inclusiveStart&&(l=!1),a&&!s.inclusiveEnd&&(a=!1),s})),h=u.map((e=>e.startKey)),d=u.map((e=>e.endKey)),m={index:e,startKeys:h,endKeys:d,inclusiveEnd:a,inclusiveStart:l,sortSatisfiedByIndex:!n&&o===e.filter((e=>!s.has(e))).join(","),selectorSatisfiedByIndex:ve(e,t.selector,h,d)},p=function(e,t,r){var a=0,n=e=>{e>0&&(a+=e)},s=10,i=(0,y.r0)(r.startKeys,(e=>e!==he&&e!==ue));n(i*s);var o=(0,y.r0)(r.startKeys,(e=>e!==ue&&e!==he));n(o*s);var c=(0,y.r0)(r.startKeys,((e,t)=>e===r.endKeys[t]));n(c*s*1.5);var l=r.sortSatisfiedByIndex?5:0;return n(l),a}(0,0,m);(p>=c||t.index)&&(c=p,i=m)})),!i)throw N("SNH",{query:t});return i}var me=new Set(["$eq","$gt","$gte","$lt","$lte"]),pe=new Set(["$eq","$gt","$gte"]),fe=new Set(["$eq","$lt","$lte"]);function ve(e,t,r,a){var n=Object.entries(t).find((t=>{let[r,a]=t;return!e.includes(r)||Object.entries(a).find((e=>{let[t,r]=e;return!me.has(t)}))}));if(n)return!1;if(t.$and||t.$or)return!1;var s=[],i=new Set;for(var[o,c]of Object.entries(t)){if(!e.includes(o))return!1;var l=Object.keys(c).filter((e=>pe.has(e)));if(l.length>1)return!1;var u=l[0];if(u&&i.add(o),"$eq"!==u){if(s.length>0)return!1;s.push(u)}}var h=[],d=new Set;for(var[m,p]of Object.entries(t)){if(!e.includes(m))return!1;var f=Object.keys(p).filter((e=>fe.has(e)));if(f.length>1)return!1;var v=f[0];if(v&&d.add(m),"$eq"!==v){if(h.length>0)return!1;h.push(v)}}var g=0;for(var y of e){for(var b of[i,d]){if(!b.has(y)&&b.size>0)return!1;b.delete(y)}if(r[g]!==a[g]&&i.size>0&&d.size>0)return!1;g++}return!0}var ge=r(6250),ye=r(7761),be=r(7132),xe=r(6496),we=r(6851),je=r(3516),ke=r(8039),_e=r(5308),De=r(2106),Ne=!1;function Ie(e){return Ne||((0,ye.Qs)(ye.$M.PIPELINE,{$sort:xe.E3,$project:xe.FM}),(0,ye.Qs)(ye.$M.QUERY,{$and:we.h$,$eq:je.l3,$elemMatch:_e.rr,$exists:De.G,$gt:je.ok,$gte:je.m9,$in:je.FI,$lt:je.Ty,$lte:je.HG,$ne:je.ny,$nin:je.IS,$mod:ke.JD,$nor:we.ps,$not:we._w,$or:we.Ko,$regex:ke.GO,$size:_e.QH,$type:De.e}),Ne=!0),new be.A(e)}function Ee(e,t){var r=A(e.primaryKey);t=i(t);var a=c(t);if("number"!=typeof a.skip&&(a.skip=0),a.selector?(a.selector=a.selector,Object.entries(a.selector).forEach((e=>{let[t,r]=e;"object"==typeof r&&null!==r||(a.selector[t]={$eq:r})}))):a.selector={},a.index){var n=(0,y.qo)(a.index);n.includes(r)||n.push(r),a.index=n}if(a.sort)a.sort.find((e=>{return t=e,Object.keys(t)[0]===r;var t}))||(a.sort=a.sort.slice(0),a.sort.push({[r]:"asc"}));else if(a.index)a.sort=a.index.map((e=>({[e]:"asc"})));else{if(e.indexes){var s=new Set;Object.entries(a.selector).forEach((e=>{let[t,r]=e;("object"!=typeof r||null===r||!!Object.keys(r).find((e=>me.has(e))))&&s.add(t)}));var o,l=-1;e.indexes.forEach((e=>{var t=(0,y.AD)(e)?e:[e],r=t.findIndex((e=>!s.has(e)));r>0&&r>l&&(l=r,o=t)})),o&&(a.sort=o.map((e=>({[e]:"asc"}))))}a.sort||(a.sort=[{[r]:"asc"}])}return a}function Ce(e,t){if(!t.sort)throw N("SNH",{query:t});var r=[];t.sort.forEach((e=>{var t,a,n,s=Object.keys(e)[0],i=Object.values(e)[0];r.push({key:s,direction:i,getValueFn:(t=s,a=t.split("."),n=a.length,1===n?e=>e[t]:e=>{for(var t=e,r=0;r{for(var a=0;ar.test(e)}function Oe(e){return e===he?-1/0:e}function Se(e,t,r){return e.includes(t)?r===ue||!0===r?"1":"0":r}function Pe(e,t,r){if(!r){if("undefined"==typeof window)throw new Error("IDBKeyRange missing");r=window.IDBKeyRange}var a=t.startKeys.map(((r,a)=>{var n=t.index[a];return Se(e,n,r)})).map(Oe),n=t.endKeys.map(((r,a)=>{var n=t.index[a];return Se(e,n,r)})).map(Oe);return r.bound(a,n,!t.inclusiveStart,!t.inclusiveEnd)}async function Be(e,t){var r=await e.internals,a=t.query,n=a.skip?a.skip:0,s=n+(a.limit?a.limit:1/0),i=t.queryPlan,o=!1;i.selectorSatisfiedByIndex||(o=Re(e.schema,t.query));var c=Pe(r.booleanIndexes,i,r.dexieDb._options.IDBKeyRange),l=i.index,u=[];if(await r.dexieDb.transaction("r",r.dexieTable,(async e=>{var t,a=e.idbtrans.objectStore(H);t="["+l.map((e=>X(e))).join("+")+"]";var n=a.index(t).openCursor(c);await new Promise((e=>{n.onsuccess=function(t){var a=t.target.result;if(a){var n=ee(r.booleanIndexes,a.value);o&&!o(n)||u.push(n),i.sortSatisfiedByIndex&&u.length===s?e():a.continue()}else e()}}))})),!i.sortSatisfiedByIndex){var h=Ce(e.schema,t.query);u=u.sort(h)}return{documents:u=u.slice(n,s)}}function $e(e){var t=e.split("-");if(2!==t.length)throw new Error("malformatted revision: "+e);return{height:parseInt(t[0],10),hash:t[1]}}function Te(e){return parseInt(e.split("-")[0],10)}function qe(e,t){var r=t?t._rev:null;return(r?$e(r).height:0)+1+"-"+e}var Me="_rxdb_internal";async function Ae(e,t){var r=(await e.findDocumentsById([t],!1))[0];return r||void 0}async function Le(e,t,r){var a=await e.bulkWrite([t],r);if(a.error.length>0)throw a.error[0];return a.success[0]}function Qe(e,t,r){var a=t.documentData,n=t.previousDocumentData;return{documentId:t.documentId,collectionName:r?r.name:void 0,isLocal:e,operation:t.operation,documentData:j.deepFreezeWhenDevMode(a),previousDocumentData:j.deepFreezeWhenDevMode(n)}}function We(e,t,r,a){if(a)throw 409===a.status?N("CONFLICT",{collection:e.name,id:t,writeError:a,data:r}):422===a.status?N("VD2",{collection:e.name,id:t,writeError:a,data:r}):a}function Fe(e){return{previous:e.previous,document:He(e.document)}}function He(e){if(!e._attachments||0===Object.keys(e._attachments).length)return e;var t=i(e);return t._attachments={},Object.entries(e._attachments).forEach((e=>{let[r,a]=e;var n,s,i;t._attachments[r]=(i=(n=a).data)?{length:(s=i,atob(s).length),digest:n.digest,type:n.type}:n})),t}function ze(e){var t=i(e);return t._meta=i(e._meta),t}function Ke(e,t,r){j.deepFreezeWhenDevMode(r);var a=A(r.primaryKey);var n={originalStorageInstance:t,schema:t.schema,internals:t.internals,collectionName:t.collectionName,databaseName:t.databaseName,options:t.options,bulkWrite(n,s){var o=n.map((n=>function(n){var s=i(n.document);if(s._meta=i(s._meta),j.isDevMode()){s=M(a,r,s);try{"function"==typeof structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n))}catch(o){throw N("DOC24",{collection:t.collectionName,document:n.document})}n.previous,n.previous&&Object.keys(n.previous._meta).forEach((e=>{if(!Object.prototype.hasOwnProperty.call(n.document._meta,e))throw N("SNH",{dataBefore:n.previous,dataAfter:n.document})}))}return s._meta.lwt=(0,ce.z)(),s._rev=qe(e.token,n.previous),{document:s,previous:n.previous}}(n)));return e.lockedRun((()=>t.bulkWrite(o,s))).then((r=>{var a={error:[],success:r.success.slice(0)},n=r.error.filter((e=>!(409!==e.status||e.writeRow.previous||e.writeRow.document._deleted||!(0,le.Is)(e.documentInDb)._deleted)||(a.error.push(e),!1)));if(n.length>0){var i=n.map((t=>({previous:t.documentInDb,document:Object.assign({},t.writeRow.document,{_rev:qe(e.token,t.documentInDb)})})));return e.lockedRun((()=>t.bulkWrite(i,s))).then((e=>((0,y.gu)(a.error,e.error),(0,y.gu)(a.success,e.success),a)))}return r}))},query:r=>e.lockedRun((()=>t.query(r))),count:r=>e.lockedRun((()=>t.count(r))),findDocumentsById:(r,a)=>e.lockedRun((()=>t.findDocumentsById(r,a))),getAttachmentData:(r,a,n)=>e.lockedRun((()=>t.getAttachmentData(r,a,n))),getChangedDocumentsSince:t.getChangedDocumentsSince?(r,a)=>e.lockedRun((()=>t.getChangedDocumentsSince((0,le.Is)(r),a))):void 0,cleanup:r=>e.lockedRun((()=>t.cleanup(r))),remove:()=>(e.storageInstances.delete(n),e.lockedRun((()=>t.remove()))),close:()=>(e.storageInstances.delete(n),e.lockedRun((()=>t.close()))),changeStream:()=>t.changeStream(),conflictResultionTasks:()=>t.conflictResultionTasks(),resolveConflictResultionTask(e){if(e.output.isEqual)return t.resolveConflictResultionTask(e);var r=i(Object.assign({},e.output.documentData,{_meta:T(),_rev:"",_attachments:{}}));return delete r._meta,delete r._rev,delete r._attachments,t.resolveConflictResultionTask({id:e.id,output:{isEqual:!1,documentData:r}})}};return e.storageInstances.add(n),n}var Ue=r(5677),Ze=r(3981),Je=new Map;function Ve(e,t){var r=Je.get(e);if(r)return r.refs.delete(t),0===r.refs.size?(Je.delete(e),r.bc.close()):void 0}function Xe(e,t,r,a){if(t.multiInstance){var n=a||function(e,t,r,a){var n=Je.get(t);return n||(n={bc:new Ze.g0(["RxDB:",e,r].join("|")),refs:new Set},Je.set(t,n)),n.refs.add(a),n.bc}(e,t.databaseInstanceToken,r.databaseName,r),s=new oe.x,i=r=>{r.storageName===e&&r.databaseName===t.databaseName&&r.collectionName===t.collectionName&&r.version===t.schema.version&&s.next(r.eventBulk)};n.addEventListener("message",i);var o=r.changeStream(),c=!1,l=o.subscribe((r=>{c||n.postMessage({storageName:e,databaseName:t.databaseName,collectionName:t.collectionName,version:t.schema.version,eventBulk:r})}));r.changeStream=function(){return s.asObservable().pipe((0,Ue.b)(o))};var u=r.close.bind(r);r.close=async function(){return c=!0,l.unsubscribe(),n.removeEventListener("message",i),a||await Ve(t.databaseInstanceToken,r),u()};var h=r.remove.bind(r);r.remove=async function(){return c=!0,l.unsubscribe(),n.removeEventListener("message",i),a||await Ve(t.databaseInstanceToken,r),h()}}}var Ye=(0,ce.z)(),Ge=function(){function e(e,t,r,a,n,s,i){this.changes$=new oe.x,this.instanceId=Ye++,this.storage=e,this.databaseName=t,this.collectionName=r,this.schema=a,this.internals=n,this.options=s,this.settings=i,this.primaryPath=A(this.schema.primaryKey)}var t=e.prototype;return t.bulkWrite=async function(e,t){tt(this),e.forEach((e=>{if(!e.document._rev||e.previous&&!e.previous._rev)throw N("SNH",{args:{row:e}})}));var r,a=await this.internals,n={success:[],error:[]},s=e.map((e=>e.document[this.primaryPath]));if(await a.dexieDb.transaction("rw",a.dexieTable,a.dexieAttachmentsTable,(async()=>{var i=new Map;(await ne(this.internals,s)).forEach((e=>{var t=e;return t&&i.set(t[this.primaryPath],t),t})),r=function(e,t,r,a,n,s,i){for(var o,c=!!e.schema.attachments,l=[],u=[],h=[],d={id:S(10),events:[],checkpoint:null,context:n,startTime:(0,ce.z)(),endTime:0},m=d.events,p=[],f=[],v=[],g=r.size>0,y=a.length,b=function(){var e,n=a[x],d=n.document,y=n.previous,b=d[t],w=d._deleted,j=y&&y._deleted,k=void 0;if(g&&(k=r.get(b)),k){var _=k._rev;if(!y||y&&_!==y._rev){var D={isError:!0,status:409,documentId:b,writeRow:n,documentInDb:k};return h.push(D),1}var I=c?Fe(n):n;c&&(w?y&&Object.keys(y._attachments).forEach((e=>{f.push({documentId:b,attachmentId:e,digest:(0,le.Is)(y)._attachments[e].digest})})):(Object.entries(d._attachments).find((t=>{let[r,a]=t;return(y?y._attachments[r]:void 0)||a.data||(e={documentId:b,documentInDb:k,isError:!0,status:510,writeRow:n,attachmentId:r}),!0})),e||Object.entries(d._attachments).forEach((e=>{let[t,r]=e;var a=y?y._attachments[t]:void 0;if(a){var n=I.document._attachments[t].digest;r.data&&a.digest!==n&&v.push({documentId:b,attachmentId:t,attachmentData:r,digest:r.digest})}else p.push({documentId:b,attachmentId:t,attachmentData:r,digest:r.digest})})))),e?h.push(e):(c?(u.push(Fe(I)),i&&i(d)):(u.push(I),i&&i(d)),o=I);var E=null,C=null,R=null;if(j&&!w)R="INSERT",E=c?He(d):d;else if(!y||j||w){if(!w)throw N("SNH",{args:{writeRow:n}});R="DELETE",E=(0,le.Is)(d),C=y}else R="UPDATE",E=c?He(d):d,C=y;var O={documentId:b,documentData:E,previousDocumentData:C,operation:R};m.push(O)}else{var S=!!w;if(c&&Object.entries(d._attachments).forEach((t=>{let[r,a]=t;a.data?p.push({documentId:b,attachmentId:r,attachmentData:a,digest:a.digest}):(e={documentId:b,isError:!0,status:510,writeRow:n,attachmentId:r},h.push(e))})),e||(c?(l.push(Fe(n)),s&&s(d)):(l.push(n),s&&s(d)),o=n),!S){var P={documentId:b,operation:"INSERT",documentData:c?He(d):d,previousDocumentData:c&&y?He(y):y};m.push(P)}}},x=0;x{n.success.push(e.document),o.push(e.document)})),r.bulkUpdateDocs.forEach((e=>{n.success.push(e.document),o.push(e.document)})),(o=o.map((e=>G(a.booleanIndexes,e)))).length>0&&await a.dexieTable.bulkPut(o);var c=[];r.attachmentsAdd.forEach((e=>{c.push({id:se(e.documentId,e.attachmentId),data:e.attachmentData.data})})),r.attachmentsUpdate.forEach((e=>{c.push({id:se(e.documentId,e.attachmentId),data:e.attachmentData.data})})),await a.dexieAttachmentsTable.bulkPut(c),await a.dexieAttachmentsTable.bulkDelete(r.attachmentsRemove.map((e=>se(e.documentId,e.attachmentId))))})),(r=(0,le.Is)(r)).eventBulk.events.length>0){var i=(0,le.Is)(r.newestRow).document;r.eventBulk.checkpoint={id:i[this.primaryPath],lwt:i._meta.lwt},r.eventBulk.endTime=(0,ce.z)(),this.changes$.next(r.eventBulk)}return n},t.findDocumentsById=async function(e,t){tt(this);var r=await this.internals,a=[];return await r.dexieDb.transaction("r",r.dexieTable,(async()=>{(await ne(this.internals,e)).forEach((e=>{!e||e._deleted&&!t||a.push(e)}))})),a},t.query=function(e){return tt(this),Be(this,e)},t.count=async function(e){if(e.queryPlan.selectorSatisfiedByIndex){var t=await async function(e,t){var r=await e.internals,a=t.queryPlan,n=a.index,s=Pe(r.booleanIndexes,a,r.dexieDb._options.IDBKeyRange),i=-1;return await r.dexieDb.transaction("r",r.dexieTable,(async e=>{var t,r=e.idbtrans.objectStore(H);t="["+n.map((e=>X(e))).join("+")+"]";var a=r.index(t).count(s);i=await new Promise(((e,t)=>{a.onsuccess=function(){e(a.result)},a.onerror=e=>t(e)}))})),i}(this,e);return{count:t,mode:"fast"}}return{count:(await Be(this,e)).documents.length,mode:"slow"}},t.changeStream=function(){return tt(this),this.changes$.asObservable()},t.cleanup=async function(e){tt(this);var t=await this.internals;return await t.dexieDb.transaction("rw",t.dexieTable,(async()=>{var r=(0,ce.z)()-e,a=await t.dexieTable.where("_meta.lwt").below(r).toArray(),n=[];a.forEach((e=>{"1"===e._deleted&&n.push(e[this.primaryPath])})),await t.dexieTable.bulkDelete(n)})),!0},t.getAttachmentData=async function(e,t,r){tt(this);var a=await this.internals,n=se(e,t);return await a.dexieDb.transaction("r",a.dexieAttachmentsTable,(async()=>{var r=await a.dexieAttachmentsTable.get(n);if(r)return r.data;throw new Error("attachment missing documentId: "+e+" attachmentId: "+t)}))},t.remove=async function(){tt(this);var e=await this.internals;return await e.dexieTable.clear(),this.close()},t.close=function(){return this.closed||(this.closed=(async()=>{this.changes$.complete(),await async function(e){var t=await e,r=J.get(e)-1;0===r?(t.dexieDb.close(),J.delete(e)):J.set(e,r)}(this.internals)})()),this.closed},t.conflictResultionTasks=function(){return new oe.x},t.resolveConflictResultionTask=async function(e){},e}();async function et(e,t,r){var n=function(e,t,r,n){var o="rxdb-dexie-"+e+"--"+n.version+"--"+t,c=s(Z,o,(()=>{var e=(async()=>{var e=i(r);e.autoOpen=!1;var t=new a.U(o,e),s={[H]:ae(n),[z]:"++sequence, id",[K]:"id"};return t.version(1).stores(s),await t.open(),{dexieDb:t,dexieTable:t[H],dexieAttachmentsTable:t[K],booleanIndexes:ie(n)}})();return Z.set(o,c),J.set(c,0),e}));return c}(t.databaseName,t.collectionName,r,t.schema),o=new Ge(e,t.databaseName,t.collectionName,t.schema,n,t.options,r);return await Xe(U,t,o),Promise.resolve(o)}function tt(e){if(e.closed)throw new Error("RxStorageInstanceDexie is closed "+e.databaseName+"-"+e.collectionName)}var rt="15.4.2",at=function(){function e(e){this.name=U,this.rxdbVersion=rt,this.settings=e}return e.prototype.createStorageInstance=function(e){return function(e){if(e.schema.keyCompression)throw N("UT5",{args:{params:e}});if((t=e.schema).encrypted&&t.encrypted.length>0||t.attachments&&t.attachments.encrypted)throw N("UT6",{args:{params:e}});var t;if(e.schema.attachments&&e.schema.attachments.compression)throw N("UT7",{args:{params:e}})}(e),et(this,e,this.settings)},e}();function nt(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,a;if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(a=r;0!=a--;)if(!nt(e[a],t[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e);if((r=n.length)!==Object.keys(t).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,n[a]))return!1;for(a=r;0!=a--;){var s=n[a];if(!nt(e[s],t[s]))return!1}return!0}return e!=e&&t!=t}var st={preAddRxPlugin:[],preCreateRxDatabase:[],createRxDatabase:[],preCreateRxCollection:[],createRxCollection:[],postDestroyRxCollection:[],postRemoveRxCollection:[],preCreateRxSchema:[],createRxSchema:[],preCreateRxQuery:[],prePrepareQuery:[],createRxDocument:[],postCreateRxDocument:[],preCreateRxStorageInstance:[],preMigrateDocument:[],postMigrateDocument:[],preDestroyRxDatabase:[],postRemoveRxDatabase:[],preReplicationMasterWrite:[],preReplicationMasterWriteDocumentsHandle:[]};function it(e,t){st[e]&&st[e].forEach((e=>e(t)))}function ot(e,t){return Promise.all(st[e].map((e=>e(t))))}var ct=function(){function e(e,t){this.jsonSchema=e,this.hashFunction=t,this.indexes=function(e){return(e.indexes||[]).map((e=>(0,y.AD)(e)?e:[e]))}(this.jsonSchema),this.primaryPath=A(this.jsonSchema.primaryKey),this.finalFields=F(this.jsonSchema)}var t=e.prototype;return t.validateChange=function(e,t){this.finalFields.forEach((r=>{if(!nt(e[r],t[r]))throw N("DOC9",{dataBefore:e,dataAfter:t,fieldName:r,schema:this.jsonSchema})}))},t.getDocumentPrototype=function(){var e={},t=q(this.jsonSchema,"");return Object.keys(t).forEach((t=>{var r=t;e.__defineGetter__(t,(function(){if(this.get&&"function"==typeof this.get)return this.get(r)})),Object.defineProperty(e,t+"$",{get:function(){return this.get$(r)},enumerable:!1,configurable:!1}),Object.defineProperty(e,t+"_",{get:function(){return this.populate(r)},enumerable:!1,configurable:!1})})),l(this,"getDocumentPrototype",(()=>e)),e},t.getPrimaryOfDocumentData=function(e){return L(this.jsonSchema,e)},(0,b.Z)(e,[{key:"version",get:function(){return this.jsonSchema.version}},{key:"defaultValues",get:function(){var e={};return Object.entries(this.jsonSchema.properties).filter((e=>{let[,t]=e;return Object.prototype.hasOwnProperty.call(t,"default")})).forEach((t=>{let[r,a]=t;return e[r]=a.default})),l(this,"defaultValues",e)}},{key:"hash",get:function(){return l(this,"hash",this.hashFunction(JSON.stringify(this.jsonSchema)))}}]),e}();function lt(e,t,r){void 0===r&&(r=!0),r&&it("preCreateRxSchema",e);var a=Q(e);a=function(e){return o(e,!0)}(a),j.deepFreezeWhenDevMode(a);var n=new ct(a,t);return it("createRxSchema",n),n}var ut=r(598),ht=r(6621),dt=r(6728),mt=r(6005),pt=r(7570),ft=r(4419);function vt(e){var t=e.split("-"),r="RxDB";return t.forEach((e=>{r+=P(e)})),r+="Plugin",new Error("You are using a function which must be overwritten by a plugin.\n You should either prevent the usage of this function or add the plugin via:\n import { "+r+" } from 'rxdb/plugins/"+e+"';\n addRxPlugin("+r+");\n ")}function gt(e){return e.documentData?e.documentData:e.previousDocumentData}var yt=function(){function e(e,t,r,a){this.queueByDocId=new Map,this.isRunning=!1,this.storageInstance=e,this.primaryPath=t,this.preWrite=r,this.postWrite=a}var t=e.prototype;return t.addWrite=function(e,t){var r=e[this.primaryPath],a=s(this.queueByDocId,r,(()=>[]));return new Promise(((r,n)=>{var s={lastKnownDocumentState:e,modifier:t,resolve:r,reject:n};(0,le.Is)(a).push(s),this.triggerRun()}))},t.triggerRun=async function(){if(!0!==this.isRunning&&0!==this.queueByDocId.size){this.isRunning=!0;var e=[],t=this.queueByDocId;this.queueByDocId=new Map,await Promise.all(Array.from(t.entries()).map((async t=>{let[r,a]=t;var n,s,i,o=(n=a.map((e=>e.lastKnownDocumentState)),s=n[0],i=$e(s._rev).height,n.forEach((e=>{var t=$e(e._rev).height;t>i&&(s=e,i=t)})),s),l=o;for(var u of a)try{l=await u.modifier(c(l))}catch(h){u.reject(h),u.reject=()=>{},u.resolve=()=>{}}try{await this.preWrite(l,o)}catch(h){return void a.forEach((e=>e.reject(h)))}e.push({previous:o,document:l})})));var r=e.length>0?await this.storageInstance.bulkWrite(e,"incremental-write"):{error:[],success:[]};return await Promise.all(r.success.map((e=>{var r=e[this.primaryPath];this.postWrite(e),n(t,r).forEach((t=>t.resolve(e)))}))),r.error.forEach((e=>{var r,a=e.documentId,i=n(t,a),o=E(e);if(o){var c=s(this.queueByDocId,a,(()=>[]));i.reverse().forEach((e=>{e.lastKnownDocumentState=(0,le.Is)(o.documentInDb),(0,le.Is)(c).unshift(e)}))}else{var l=N("COL20",{name:C[(r=e).status],document:r.documentId,writeError:r});i.forEach((e=>e.reject(l)))}})),this.isRunning=!1,this.triggerRun()}},e}();function bt(e){return async t=>{var r=function(e){return Object.assign({},e,{_meta:void 0,_deleted:void 0,_rev:void 0})}(t);r._deleted=t._deleted;var a=await e(r),n=Object.assign({},a,{_meta:t._meta,_attachments:t._attachments,_rev:t._rev,_deleted:void 0!==a._deleted?a._deleted:t._deleted});return void 0===n._deleted&&(n._deleted=!1),n}}var xt={get primaryPath(){if(this.isInstanceOfRxDocument)return this.collection.schema.primaryPath},get primary(){var e=this;if(e.isInstanceOfRxDocument)return e._data[e.primaryPath]},get revision(){if(this.isInstanceOfRxDocument)return this._data._rev},get deleted$(){if(this.isInstanceOfRxDocument)return this.$.pipe((0,ut.U)((e=>e._data._deleted)))},get deleted(){if(this.isInstanceOfRxDocument)return this._data._deleted},getLatest(){var e=this.collection._docCache.getLatestDocumentData(this.primary);return this.collection._docCache.getCachedRxDocument(e)},get $(){return this.collection.$.pipe((0,ht.h)((e=>!e.isLocal)),(0,ht.h)((e=>e.documentId===this.primary)),(0,ut.U)((e=>gt(e))),(0,dt.O)(this.collection._docCache.getLatestDocumentData(this.primary)),(0,mt.x)(((e,t)=>e._rev===t._rev)),(0,ut.U)((e=>this.collection._docCache.getCachedRxDocument(e))),(0,pt.d)(le.kv))},get$(e){if(j.isDevMode()){if(e.includes(".item."))throw N("DOC1",{path:e});if(e===this.primaryPath)throw N("DOC2");if(this.collection.schema.finalFields.includes(e))throw N("DOC3",{path:e});if(!q(this.collection.schema.jsonSchema,e))throw N("DOC4",{path:e})}return this.$.pipe((0,ut.U)((t=>v(t,e))),(0,mt.x)())},populate(e){var t=q(this.collection.schema.jsonSchema,e),r=this.get(e);if(!r)return ft.m5;if(!t)throw N("DOC5",{path:e});if(!t.ref)throw N("DOC6",{path:e,schemaObj:t});var a=this.collection.database.collections[t.ref];if(!a)throw N("DOC7",{ref:t.ref,path:e,schemaObj:t});return"array"===t.type?a.findByIds(r).exec().then((e=>{var t=e.values();return Array.from(t)})):a.findOne(r).exec()},get(e){return s(this._propertyCache,e,(()=>{var t=v(this._data,e);if("object"!=typeof t||null===t||Array.isArray(t))return j.deepFreezeWhenDevMode(t);var r=this;return new Proxy(i(t),{get(t,a){if("string"!=typeof a)return t[a];var n=a.charAt(a.length-1);if("$"===n){var s=a.slice(0,-1);return r.get$(B(e+"."+s))}if("_"===n){var i=a.slice(0,-1);return r.populate(B(e+"."+i))}return r.get(B(e+"."+a))}})}))},toJSON(e){if(void 0===e&&(e=!1),e)return j.deepFreezeWhenDevMode(this._data);var t=i(this._data);return delete t._rev,delete t._attachments,delete t._deleted,delete t._meta,j.deepFreezeWhenDevMode(t)},toMutableJSON(e){return void 0===e&&(e=!1),c(this.toJSON(e))},update(e){throw vt("update")},incrementalUpdate(e){throw vt("update")},updateCRDT(e){throw vt("crdt")},putAttachment(){throw vt("attachments")},getAttachment(){throw vt("attachments")},allAttachments(){throw vt("attachments")},get allAttachments$(){throw vt("attachments")},async modify(e,t){var r=this._data,a=await bt(e)(r);return this._saveData(a,r)},incrementalModify(e,t){return this.collection.incrementalWriteQueue.addWrite(this._data,bt(e)).then((e=>this.collection._docCache.getCachedRxDocument(e)))},patch(e){var t=this._data,r=c(t);return Object.entries(e).forEach((e=>{let[t,a]=e;r[t]=a})),this._saveData(r,t)},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[r,a]=e;t[r]=a})),t)))},async _saveData(e,t){if(e=i(e),this._data._deleted)throw N("DOC11",{id:this.primary,document:this});await jt(this.collection,e,t);var r=await this.collection.storageInstance.bulkWrite([{previous:t,document:e}],"rx-document-save-data"),a=r.error[0];return We(this.collection,this.primary,e,a),await this.collection._runHooks("post","save",e,this),this.collection._docCache.getCachedRxDocument(r.success[0])},remove(){var e=this.collection;if(this.deleted)return Promise.reject(N("DOC13",{document:this,id:this.primary}));var t,r=i(this._data);return e._runHooks("pre","remove",r,this).then((async()=>{r._deleted=!0;var t=await e.storageInstance.bulkWrite([{previous:this._data,document:r}],"rx-document-remove"),a=t.error[0];return We(e,this.primary,r,a),t.success[0]})).then((e=>(t=e,this.collection._runHooks("post","remove",r,this)))).then((()=>this.collection._docCache.getCachedRxDocument(t)))},incrementalRemove(){return this.incrementalModify((async e=>(await this.collection._runHooks("pre","remove",e,this),e._deleted=!0,e))).then((async e=>(await this.collection._runHooks("post","remove",e._data,e),e)))},destroy(){throw N("DOC14")}};function wt(e){void 0===e&&(e=xt);var t=function(e,t){this.collection=e,this._data=t,this._propertyCache=new Map,this.isInstanceOfRxDocument=!0};return t.prototype=e,t}function jt(e,t,r){return t._meta=Object.assign({},r._meta,t._meta),j.isDevMode()&&e.schema.validateChange(r,t),e._runHooks("pre","save",t,r)}var kt=r(10),_t=r(6871),Dt=r(3028),Nt=r(1556),It=r(8456);function Et(e,t){return t.sort&&0!==t.sort.length?t.sort.map((e=>Object.keys(e)[0])):[e]}var Ct=new WeakMap;function Rt(e,t){if(!e.collection.database.eventReduce)return{runFullQueryAgain:!0};var r=function(e){return s(Ct,e,(()=>{var t=e.collection,r=Ee(t.storageInstance.schema,c(e.mangoQuery)),a=t.schema.primaryPath,n=Ce(t.schema.jsonSchema,r),s=Re(t.schema.jsonSchema,r);return{primaryKey:e.collection.schema.primaryPath,skip:r.skip,limit:r.limit,sortFields:Et(a,r),sortComparator:(t,r)=>{var a={docA:t,docB:r,rxQuery:e};return n(a.docA,a.docB)},queryMatcher:t=>s({doc:t,rxQuery:e}.doc)}}))}(e),a=(0,le.Is)(e._result).docsData.slice(0),n=(0,le.Is)(e._result).docsDataMap,i=!1;return t.map((e=>function(e){switch(e.operation){case"INSERT":return{operation:e.operation,id:e.documentId,doc:e.documentData,previous:null};case"UPDATE":return{operation:e.operation,id:e.documentId,doc:j.deepFreezeWhenDevMode(e.documentData),previous:e.previousDocumentData?e.previousDocumentData:"UNKNOWN"};case"DELETE":return{operation:e.operation,id:e.documentId,doc:null,previous:e.previousDocumentData}}}(e))).filter(y.S7).find((e=>{var t={queryParams:r,changeEvent:e,previousResults:a,keyDocumentMap:n},s=(0,It.Rf)(t);return"runFullQueryAgain"===s||("doNothing"!==s?(i=!0,(0,It.wu)(s,r,e,a,n),!1):void 0)}))?{runFullQueryAgain:!0}:{runFullQueryAgain:!1,changed:i,newResults:a}}var Ot=function(){function e(){this._map=new Map}return e.prototype.getByQuery=function(e){var t=e.toString();return s(this._map,t,(()=>e))},e}();function St(e,t){t.uncached=!0;var r=t.toString();e._map.delete(r)}function Pt(e){return e.refCount$.observers.length}var Bt,$t,Tt=(Bt=100,$t=3e4,(e,t)=>{if(!(t._map.size0||(0===s._lastEnsureEqual&&s._creationTimee._lastEnsureEqual-t._lastEnsureEqual)).slice(0,i).forEach((e=>St(t,e)))}}),qt=new WeakSet;var Mt=function(){function e(e,t,r){this.cacheItemByDocId=new Map,this.registry="function"==typeof FinalizationRegistry?new FinalizationRegistry((e=>{var t=e.docId,r=this.cacheItemByDocId.get(t);r&&(r.byRev.delete(e.revisionHeight),0===r.byRev.size&&this.cacheItemByDocId.delete(t))})):void 0,this.registerIdleTasks=[],this.primaryPath=e,this.changes$=t,this.documentCreator=r,t.subscribe((e=>{var t=e.documentId,r=this.cacheItemByDocId.get(t);if(r){var a=gt(e);r.last=a}}))}var t=e.prototype;return t.getLatestDocumentData=function(e){return n(this.cacheItemByDocId,e).last},t.getLatestDocumentDataIfExists=function(e){var t=this.cacheItemByDocId.get(e);if(t)return t.last},(0,b.Z)(e,[{key:"getCachedRxDocument",get:function(){return l(this,"getCachedRxDocument",function(e){var t=e.primaryPath,r=e.cacheItemByDocId,a=e.registry,n=j.deepFreezeWhenDevMode,i=e.documentCreator,o=o=>{var c=o[t],l=Te(o._rev),u=s(r,c,(()=>function(e){return{byRev:new Map,last:e}}(o))),h=u.byRev,d=h.get(l),m=d?d.deref():void 0;return m||(o=n(o),m=i(o),h.set(l,Lt(m)),a&&(e.registerIdleTasks.push(m),e.registerIdlePromise||(e.registerIdlePromise=(0,ft.y$)().then((()=>{e.registerIdlePromise=void 0;var t=e.registerIdleTasks;0!==t.length&&(e.registerIdleTasks=[],t.forEach((e=>{a.register(e,{docId:e.primary,revisionHeight:Te(e.revision)})})))}))))),m};return o}(this))}}]),e}();function At(e,t){for(var r=e.getCachedRxDocument,a=[],n=0;ne}};var Qt=function(){function e(e,t,r){this.time=(0,ce.z)(),this.collection=e,this.count=r,this.documents=At(this.collection._docCache,t)}return(0,b.Z)(e,[{key:"docsData",get:function(){return l(this,"docsData",this.documents.map((e=>e._data)))}},{key:"docsDataMap",get:function(){var e=new Map;return this.documents.forEach((t=>{e.set(t.primary,t._data)})),l(this,"docsDataMap",e)}},{key:"docsMap",get:function(){for(var e=new Map,t=this.documents,r=0;r"string"!=typeof e)))return r.$eq}return!1}(this.collection.schema.primaryPath,t)}var t=e.prototype;return t._setResultData=function(e){if("number"!=typeof e){e instanceof Map&&(e=Array.from(e.values()));var t=new Qt(this.collection,e,e.length);this._result=t}else this._result=new Qt(this.collection,[],e)},t._execOverDatabase=async function(){if(this._execOverDatabaseCount=this._execOverDatabaseCount+1,this._lastExecStart=(0,ce.z)(),"count"===this.op){var e=this.getPreparedQuery(),t=await this.collection.storageInstance.count(e);if("slow"!==t.mode||this.collection.database.allowSlowCount)return t.count;throw N("QU14",{collection:this.collection,queryObj:this.mangoQuery})}if("findByIds"===this.op){var r=(0,le.Is)(this.mangoQuery.selector)[this.collection.schema.primaryPath].$in,a=new Map,n=[];if(r.forEach((e=>{var t=this.collection._docCache.getLatestDocumentDataIfExists(e);if(t){if(!t._deleted){var r=this.collection._docCache.getCachedRxDocument(t);a.set(e,r)}}else n.push(e)})),n.length>0)(await this.collection.storageInstance.findDocumentsById(n,!1)).forEach((e=>{var t=this.collection._docCache.getCachedRxDocument(e);a.set(t.primary,t)}));return a}var s=async function(e){var t=[],r=e.collection;if(e.isFindOneByIdQuery)if(Array.isArray(e.isFindOneByIdQuery)){var a=e.isFindOneByIdQuery;if(a=a.filter((r=>{var a=e.collection._docCache.getLatestDocumentDataIfExists(r);return!a||(a._deleted||t.push(a),!1)})),a.length>0){var n=await r.storageInstance.findDocumentsById(a,!1);(0,y.gu)(t,n)}}else{var s=e.isFindOneByIdQuery,i=e.collection._docCache.getLatestDocumentDataIfExists(s);if(!i){var o=await r.storageInstance.findDocumentsById([s],!1);o[0]&&(i=o[0])}i&&!i._deleted&&t.push(i)}else{var c=e.getPreparedQuery(),l=await r.storageInstance.query(c);t=l.documents}return t}(this);return s.then((e=>(this._lastExecEnd=(0,ce.z)(),e)))},t.exec=function(e){if(e&&"findOne"!==this.op)throw N("QU9",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return Kt(this).then((()=>(0,_t.z)(this.$))).then((t=>{if(!t&&e)throw N("QU10",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return t}))},t.toString=function(){var e=o({op:this.op,query:this.mangoQuery,other:this.other},!0),t=JSON.stringify(e);return this.toString=()=>t,t},t.getPreparedQuery=function(){var e={rxQuery:this,mangoQuery:Ee(this.collection.schema.jsonSchema,this.mangoQuery)};e.mangoQuery.selector._deleted={$eq:!1},e.mangoQuery.index&&e.mangoQuery.index.unshift("_deleted"),it("prePrepareQuery",e);var t=Ut(this.collection.schema.jsonSchema,e.mangoQuery);return this.getPreparedQuery=()=>t,t},t.doesDocumentDataMatch=function(e){return!e._deleted&&this.queryMatcher(e)},t.remove=function(){return this.exec().then((e=>Array.isArray(e)?Promise.all(e.map((e=>e.remove()))):e.remove()))},t.update=function(e){throw vt("update")},t.where=function(e){throw vt("query-builder")},t.sort=function(e){throw vt("query-builder")},t.skip=function(e){throw vt("query-builder")},t.limit=function(e){throw vt("query-builder")},(0,b.Z)(e,[{key:"$",get:function(){if(!this._$){var e=this.collection.$.pipe((0,ht.h)((e=>!e.isLocal)),(0,dt.O)(null),(0,Nt.z)((()=>Kt(this))),(0,ut.U)((()=>this._result)),(0,pt.d)(le.kv),(0,mt.x)(((e,t)=>!(!e||e.time!==(0,le.Is)(t).time))),(0,ht.h)((e=>!!e)),(0,ut.U)((e=>{var t=(0,le.Is)(e);return"count"===this.op?t.count:"findOne"===this.op?0===t.documents.length?null:t.documents[0]:"findByIds"===this.op?t.docsMap:t.documents.slice(0)})));this._$=(0,Dt.T)(e,this.refCount$.pipe((0,ht.h)((()=>!1))))}return this._$}},{key:"queryMatcher",get:function(){this.collection.schema.jsonSchema;return l(this,"queryMatcher",Re(0,Ee(this.collection.schema.jsonSchema,this.mangoQuery)))}},{key:"asRxQuery",get:function(){return this}}]),e}();function Ht(e,t,r,a){it("preCreateRxQuery",{op:e,queryObj:t,collection:r,other:a});var n,s,i=new Ft(e,t,r,a);return i=(n=i).collection._queryCache.getByQuery(n),s=r,qt.has(s)||(qt.add(s),(0,ft.Y3)().then((()=>(0,ft.C2)(200))).then((()=>{s.destroyed||s.cacheReplacementPolicy(s,s._queryCache),qt.delete(s)}))),i}function zt(e){var t=e.asRxQuery.collection._changeEventBuffer.counter;return e._latestChangeEvent>=t}function Kt(e){return e.collection.database.destroyed||zt(e)?ft.kZ:(e._ensureEqualQueue=e._ensureEqualQueue.then((()=>function(e){if(e._lastEnsureEqual=(0,ce.z)(),e.collection.database.destroyed||zt(e))return ft.kZ;var t=!1,r=!1;-1===e._latestChangeEvent&&(r=!0);if(!r){var a=e.asRxQuery.collection._changeEventBuffer.getFrom(e._latestChangeEvent+1);if(null===a)r=!0;else{e._latestChangeEvent=e.asRxQuery.collection._changeEventBuffer.counter;var n=e.asRxQuery.collection._changeEventBuffer.reduceByLastOfDoc(a);if("count"===e.op){var s=(0,le.Is)(e._result).count,i=s;n.forEach((t=>{var r=t.previousDocumentData&&e.doesDocumentDataMatch(t.previousDocumentData),a=e.doesDocumentDataMatch(t.documentData);!r&&a&&i++,r&&!a&&i--})),i!==s&&(t=!0,e._setResultData(i))}else{var o=Rt(e,n);o.runFullQueryAgain?r=!0:o.changed&&(t=!0,e._setResultData(o.newResults))}}}if(r)return e._execOverDatabase().then((r=>(e._latestChangeEvent=e.collection._changeEventBuffer.counter,"number"==typeof r?(e._result&&r===e._result.count||(t=!0,e._setResultData(r)),t):(e._result&&function(e,t,r){if(t.length!==r.length)return!1;for(var a=0,n=t.length;ae.data.name===n)),c=[];o.forEach((e=>{c.push({collectionName:e.data.name,schema:e.data.schema,isCollection:!0}),e.data.connectedStorages.forEach((e=>c.push({collectionName:e.collectionName,isCollection:!1,schema:e.schema})))}));var l=new Set;if(c=c.filter((e=>{var t=e.collectionName+"||"+e.schema.version;return!l.has(t)&&(l.add(t),!0)})),await Promise.all(c.map((async t=>{var i=await e.createStorageInstance({collectionName:t.collectionName,databaseInstanceToken:r,databaseName:a,multiInstance:!1,options:{},schema:t.schema,password:s,devMode:j.isDevMode()});await i.remove(),t.isCollection&&await ot("postRemoveRxCollection",{storage:e,databaseName:a,collectionName:n})}))),i){var u=o.map((e=>{var t=ze(e);return t._deleted=!0,t._meta.lwt=(0,ce.z)(),t._rev=qe(r,e),{previous:e,document:t}}));await t.bulkWrite(u,"rx-database-remove-collection-all")}}var nr=function(){function e(e){this.subs=[],this.limit=100,this.counter=0,this.eventCounterMap=new WeakMap,this.buffer=[],this.collection=e,this.subs.push(this.collection.$.pipe((0,ht.h)((e=>!e.isLocal))).subscribe((e=>this._handleChangeEvent(e))))}var t=e.prototype;return t._handleChangeEvent=function(e){for(this.counter++,this.buffer.push(e),this.eventCounterMap.set(e,this.counter);this.buffer.length>this.limit;)this.buffer.shift()},t.getArrayIndexByPointer=function(e){var t=this.buffer[0],r=this.eventCounterMap.get(t);return et(e)))},t.reduceByLastOfDoc=function(e){return e.slice(0)},t.destroy=function(){this.subs.forEach((e=>e.unsubscribe()))},e}();var sr=new WeakMap;function ir(e){var t=e.schema.getDocumentPrototype(),r=function(e){var t={};return Object.entries(e.methods).forEach((e=>{let[r,a]=e;t[r]=a})),t}(e),a={};return[t,r,xt].forEach((e=>{Object.getOwnPropertyNames(e).forEach((t=>{var r=Object.getOwnPropertyDescriptor(e,t),n=!0;(t.startsWith("_")||t.endsWith("_")||t.startsWith("$")||t.endsWith("$"))&&(n=!1),"function"==typeof r.value?Object.defineProperty(a,t,{get(){return r.value.bind(this)},enumerable:n,configurable:!1}):(r.enumerable=n,r.configurable=!1,r.writable&&(r.writable=!1),Object.defineProperty(a,t,r))}))})),a}function or(e,t){var r=function(e,t,r){var a=new e(t,r);return it("createRxDocument",a),a}(function(e){return s(sr,e,(()=>wt(ir(e))))}(e),e,j.deepFreezeWhenDevMode(t));return e._runHooksSync("post","create",t,r),it("postCreateRxDocument",r),r}var cr=function(e,t){return nt(He(e.newDocumentState),He(e.realMasterState))?Promise.resolve({isEqual:!0}):Promise.resolve({isEqual:!1,documentData:e.realMasterState})};var lr=["pre","post"],ur=["insert","save","remove","create"],hr=!1,dr=function(){function e(e,t,r,a,n,s,i,o,c,l,u,h){void 0===n&&(n={}),void 0===s&&(s={}),void 0===i&&(i={}),void 0===o&&(o={}),void 0===c&&(c={}),void 0===l&&(l=Tt),void 0===u&&(u={}),void 0===h&&(h=cr),this.storageInstance={},this.timeouts=new Set,this.incrementalWriteQueue={},this._incrementalUpsertQueues=new Map,this.synced=!1,this.hooks={},this._subs=[],this._docCache={},this._queryCache=new Ot,this.$={},this.checkpoint$={},this._changeEventBuffer={},this.onDestroy=[],this.destroyed=!1,this.database=e,this.name=t,this.schema=r,this.internalStorageInstance=a,this.instanceCreationOptions=n,this.migrationStrategies=s,this.methods=i,this.attachments=o,this.options=c,this.cacheReplacementPolicy=l,this.statics=u,this.conflictHandler=h,function(e){if(hr)return;hr=!0;var t=Object.getPrototypeOf(e);ur.forEach((e=>{lr.map((r=>{var a=r+P(e);t[a]=function(t,a){return this.addHook(r,e,t,a)}}))}))}(this.asRxCollection)}var t=e.prototype;return t.prepare=async function(){this.storageInstance=Ke(this.database,this.internalStorageInstance,this.schema.jsonSchema),this.incrementalWriteQueue=new yt(this.storageInstance,this.schema.primaryPath,((e,t)=>jt(this,e,t)),(e=>this._runHooks("post","save",e)));var e,t=this.database.eventBulks$.pipe((0,ht.h)((e=>e.collectionName===this.name)));this.$=t.pipe((0,Nt.z)((e=>e.events))),this.checkpoint$=t.pipe((0,ut.U)((e=>e.checkpoint))),this._changeEventBuffer=(e=this.asRxCollection,new nr(e)),this._docCache=new Mt(this.schema.primaryPath,this.$.pipe((0,ht.h)((e=>!e.isLocal))),(e=>or(this.asRxCollection,e)));var r=await this.database.storageToken,a=this.storageInstance.changeStream().subscribe((e=>{var t={id:e.id,internal:!1,collectionName:this.name,storageToken:r,events:e.events.map((e=>Qe(!1,e,this))),databaseToken:this.database.token,checkpoint:e.checkpoint,context:e.context,endTime:e.endTime,startTime:e.startTime};this.database.$emit(t)}));return this._subs.push(a),this._subs.push(this.storageInstance.conflictResultionTasks().subscribe((e=>{this.conflictHandler(e.input,e.context).then((t=>{this.storageInstance.resolveConflictResultionTask({id:e.id,output:t})}))}))),ft.$Y},t.cleanup=function(e){throw vt("cleanup")},t.migrationNeeded=function(){throw vt("migration-schema")},t.getMigrationState=function(){throw vt("migration-schema")},t.startMigration=function(e){return void 0===e&&(e=10),this.getMigrationState().startMigration(e)},t.migratePromise=function(e){return void 0===e&&(e=10),this.getMigrationState().migratePromise(e)},t.insert=async function(e){var t=await this.bulkInsert([e]),r=t.error[0];return We(this,e[this.schema.primaryPath],e,r),(0,le.Is)(t.success[0])},t.bulkInsert=async function(e){if(0===e.length)return{success:[],error:[]};var t=this.schema.primaryPath,r=e.map((e=>rr(this.schema,e))),a=this.hasHooks("pre","insert")?await Promise.all(r.map((e=>this._runHooks("pre","insert",e).then((()=>e))))):r,n=a.map((e=>({document:e}))),s=await this.storageInstance.bulkWrite(n,"rx-collection-bulk-insert"),i=At(this._docCache,s.success);if(this.hasHooks("post","insert")){var o=new Map;a.forEach((e=>{o.set(e[t],e)})),await Promise.all(i.map((e=>this._runHooks("post","insert",o.get(e.primary),e))))}return{success:i,error:s.error}},t.bulkRemove=async function(e){var t=this.schema.primaryPath;if(0===e.length)return{success:[],error:[]};var r=await this.findByIds(e).exec(),a=[],s=new Map;Array.from(r.values()).forEach((e=>{var t=e.toMutableJSON(!0);a.push(t),s.set(e.primary,t)})),await Promise.all(a.map((e=>{var t=e[this.schema.primaryPath];return this._runHooks("pre","remove",e,r.get(t))})));var o=a.map((e=>{var t=i(e);return t._deleted=!0,{previous:e,document:t}})),c=await this.storageInstance.bulkWrite(o,"rx-collection-bulk-remove"),l=c.success.map((e=>e[t]));return await Promise.all(l.map((e=>this._runHooks("post","remove",s.get(e),r.get(e))))),{success:l.map((e=>n(r,e))),error:c.error}},t.bulkUpsert=async function(e){var t=[],r=new Map;e.forEach((e=>{var a=rr(this.schema,e),n=a[this.schema.primaryPath];if(!n)throw N("COL3",{primaryPath:this.schema.primaryPath,data:a,schema:this.schema.jsonSchema});r.set(n,a),t.push(a)}));var a=await this.bulkInsert(t),s=a.success.slice(0),i=[];return await Promise.all(a.error.map((async e=>{if(409!==e.status)i.push(e);else{var t=e.documentId,a=n(r,t),o=(0,le.Is)(e.documentInDb),c=this._docCache.getCachedRxDocument(o),l=await c.incrementalModify((()=>a));s.push(l)}}))),{error:i,success:s}},t.upsert=async function(e){var t=await this.bulkUpsert([e]);return We(this.asRxCollection,e[this.schema.primaryPath],e,t.error[0]),t.success[0]},t.incrementalUpsert=function(e){var t=rr(this.schema,e),r=t[this.schema.primaryPath];if(!r)throw N("COL4",{data:e});var a=this._incrementalUpsertQueues.get(r);return a||(a=ft.$Y),a=a.then((()=>function(e,t,r){var a=e._docCache.getLatestDocumentDataIfExists(t);if(a)return Promise.resolve({doc:e._docCache.getCachedRxDocument(a),inserted:!1});return e.findOne(t).exec().then((t=>t?{doc:t,inserted:!1}:e.insert(r).then((e=>({doc:e,inserted:!0})))))}(this,r,t))).then((e=>e.inserted?e.doc:function(e,t){return e.incrementalModify((e=>t))}(e.doc,t))),this._incrementalUpsertQueues.set(r,a),a},t.find=function(e){if("string"==typeof e)throw N("COL5",{queryObj:e});return e||(e={selector:{}}),Ht("find",e,this)},t.findOne=function(e){if("number"==typeof e||Array.isArray(e))throw I("COL6",{queryObj:e});var t;if("string"==typeof e)t=Ht("findOne",{selector:{[this.schema.primaryPath]:e},limit:1},this);else{if(e||(e={selector:{}}),e.limit)throw N("QU6");(e=i(e)).limit=1,t=Ht("findOne",e,this)}return t},t.count=function(e){return e||(e={selector:{}}),Ht("count",e,this)},t.findByIds=function(e){return Ht("findByIds",{selector:{[this.schema.primaryPath]:{$in:e.slice(0)}}},this)},t.exportJSON=function(){throw vt("json-dump")},t.importJSON=function(e){throw vt("json-dump")},t.insertCRDT=function(e){throw vt("crdt")},t.addHook=function(e,t,r,a){if(void 0===a&&(a=!1),"function"!=typeof r)throw I("COL7",{key:t,when:e});if(!lr.includes(e))throw I("COL8",{key:t,when:e});if(!ur.includes(t))throw N("COL9",{key:t});if("post"===e&&"create"===t&&!0===a)throw N("COL10",{when:e,key:t,parallel:a});var n=r.bind(this),s=a?"parallel":"series";this.hooks[t]=this.hooks[t]||{},this.hooks[t][e]=this.hooks[t][e]||{series:[],parallel:[]},this.hooks[t][e][s].push(n)},t.getHooks=function(e,t){return this.hooks[t]&&this.hooks[t][e]?this.hooks[t][e]:{series:[],parallel:[]}},t.hasHooks=function(e,t){var r=this.getHooks(e,t);return!!r&&(r.series.length>0||r.parallel.length>0)},t._runHooks=function(e,t,r,a){var n=this.getHooks(e,t);if(!n)return ft.$Y;var s=n.series.map((e=>()=>e(r,a)));return(0,ft.Ze)(s).then((()=>Promise.all(n.parallel.map((e=>e(r,a))))))},t._runHooksSync=function(e,t,r,a){var n=this.getHooks(e,t);n&&n.series.forEach((e=>e(r,a)))},t.promiseWait=function(e){return new Promise((t=>{var r=setTimeout((()=>{this.timeouts.delete(r),t()}),e);this.timeouts.add(r)}))},t.destroy=function(){return this.destroyed?ft.kZ:(this.destroyed=!0,Array.from(this.timeouts).forEach((e=>clearTimeout(e))),this._changeEventBuffer&&this._changeEventBuffer.destroy(),this.database.requestIdlePromise().then((()=>Promise.all(this.onDestroy.map((e=>e()))))).then((()=>this.storageInstance.close())).then((()=>(this._subs.forEach((e=>e.unsubscribe())),delete this.database.collections[this.name],ot("postDestroyRxCollection",this).then((()=>!0))))))},t.remove=async function(){await this.destroy(),await ar(this.database.storage,this.database.internalStore,this.database.token,this.database.name,this.name,this.database.password,this.database.hashFunction)},(0,b.Z)(e,[{key:"insert$",get:function(){return this.$.pipe((0,ht.h)((e=>"INSERT"===e.operation)))}},{key:"update$",get:function(){return this.$.pipe((0,ht.h)((e=>"UPDATE"===e.operation)))}},{key:"remove$",get:function(){return this.$.pipe((0,ht.h)((e=>"DELETE"===e.operation)))}},{key:"asRxCollection",get:function(){return this}}]),e}();var mr=r(7782),pr=r(6753);var fr="undefined"!=typeof crypto&&void 0!==crypto.subtle&&"function"==typeof crypto.subtle.digest?async function(e){var t=(new TextEncoder).encode(e),r=await crypto.subtle.digest("SHA-256",t);return Array.prototype.map.call(new Uint8Array(r),(e=>("00"+e.toString(16)).slice(-2))).join("")}:function(e){return Promise.resolve((0,pr.JQ)(e))},vr=r(5898),gr=new Set,yr=function(){function e(e,t,r,a,n,s,i,o,c,l,u,h){void 0===i&&(i=!1),void 0===o&&(o={}),this.idleQueue=new mr.F,this.rxdbVersion=rt,this.storageInstances=new Set,this._subs=[],this.startupErrors=[],this.onDestroy=[],this.destroyed=!1,this.collections={},this.eventBulks$=new oe.x,this.observable$=this.eventBulks$.pipe((0,Nt.z)((e=>e.events))),this.storageToken=ft.kZ,this.storageTokenDocument=ft.kZ,this.emittedEventBulkIds=new vr.i(6e4),this.name=e,this.token=t,this.storage=r,this.instanceCreationOptions=a,this.password=n,this.multiInstance=s,this.eventReduce=i,this.options=o,this.internalStore=c,this.hashFunction=l,this.cleanupPolicy=u,this.allowSlowCount=h,"pseudoInstance"!==this.name&&(this.internalStore=Ke(this.asRxDatabase,c,Vt),this.storageTokenDocument=async function(e){var t=S(10),r=e.password?await e.hashFunction(JSON.stringify(e.password)):void 0,a={id:er,context:Jt,key:Gt,data:{rxdbVersion:e.rxdbVersion,token:t,instanceToken:e.token,passwordHash:r},_deleted:!1,_meta:T(),_rev:"",_attachments:{}},n=await e.internalStore.bulkWrite([{document:a}],"internal-add-storage-token");if(n.success[0])return n.success[0];var s=(0,le.Is)(n.error[0]);if(s.isError&&E(s)){var i=s;if(c=i.documentInDb.data.rxdbVersion,l=e.rxdbVersion,!c||l.includes("beta")&&l!==c||c.split(".")[0]!==l.split(".")[0])throw N("DM5",{args:{database:e.name,databaseStateVersion:i.documentInDb.data.rxdbVersion,codeVersion:e.rxdbVersion}});if(r&&r!==i.documentInDb.data.passwordHash)throw N("DB1",{passwordHash:r,existingPasswordHash:i.documentInDb.data.passwordHash});var o=i.documentInDb;return(0,le.Is)(o)}var c,l;throw s}(this.asRxDatabase).catch((e=>this.startupErrors.push(e))),this.storageToken=this.storageTokenDocument.then((e=>e.data.token)).catch((e=>this.startupErrors.push(e))))}var t=e.prototype;return t.$emit=function(e){this.emittedEventBulkIds.has(e.id)||(this.emittedEventBulkIds.add(e.id),this.eventBulks$.next(e))},t.removeCollectionDoc=async function(e,t){var r=await Ae(this.internalStore,Xt(tr(e,t),Zt));if(!r)throw N("SNH",{name:e,schema:t});var a=ze(r);a._deleted=!0,await this.internalStore.bulkWrite([{document:a,previous:r}],"rx-database-remove-collection")},t.addCollections=async function(e){var t={},r={},a=[],n={};await Promise.all(Object.entries(e).map((async e=>{let[s,o]=e;var c=s,l=o.schema;t[c]=l;var u=lt(l,this.hashFunction);if(r[c]=u,this.collections[s])throw N("DB3",{name:s});var h=tr(s,l),d={id:Xt(h,Zt),key:h,context:Zt,data:{name:c,schemaHash:await u.hash,schema:u.jsonSchema,version:u.version,connectedStorages:[]},_deleted:!1,_meta:T(),_rev:"",_attachments:{}};a.push({document:d});var m=Object.assign({},o,{name:c,schema:u,database:this}),p=i(o);p.database=this,p.name=s,it("preCreateRxCollection",p),m.conflictHandler=p.conflictHandler,n[c]=m})));var s=await this.internalStore.bulkWrite(a,"rx-database-add-collection");await async function(e){if(await e.storageToken,e.startupErrors[0])throw e.startupErrors[0]}(this),await Promise.all(s.error.map((async e=>{if(409!==e.status)throw N("DB12",{database:this.name,writeError:e});var a=(0,le.Is)(e.documentInDb),n=a.data.name,s=r[n];if(a.data.schemaHash!==await s.hash)throw N("DB6",{database:this.name,collection:n,previousSchemaHash:a.data.schemaHash,schemaHash:await s.hash,previousSchema:a.data.schema,schema:(0,le.Is)(t[n])})})));var o={};return await Promise.all(Object.keys(e).map((async e=>{var t=n[e],r=await function(e){let{database:t,name:r,schema:a,instanceCreationOptions:n={},migrationStrategies:s={},autoMigrate:i=!0,statics:o={},methods:c={},attachments:l={},options:u={},localDocuments:h=!1,cacheReplacementPolicy:d=Tt,conflictHandler:m=cr}=e;var p={databaseInstanceToken:t.token,databaseName:t.name,collectionName:r,schema:a.jsonSchema,options:n,multiInstance:t.multiInstance,password:t.password,devMode:j.isDevMode()};return it("preCreateRxStorageInstance",p),async function(e,t){return t.multiInstance=e.multiInstance,await e.storage.createStorageInstance(t)}(t,p).then((e=>{var p=new dr(t,r,a,e,n,s,c,l,u,d,o,m);return p.prepare().then((()=>{Object.entries(o).forEach((e=>{let[t,r]=e;Object.defineProperty(p,t,{get:()=>r.bind(p)})}));var e=ft.$Y;return i&&0!==p.schema.version&&(e=p.migratePromise()),e})).then((()=>(it("createRxCollection",{collection:p,creator:{name:r,schema:a,storageInstance:e,instanceCreationOptions:n,migrationStrategies:s,methods:c,attachments:l,options:u,cacheReplacementPolicy:d,localDocuments:h,statics:o}}),p))).catch((t=>e.close().then((()=>Promise.reject(t)))))}))}(t);o[e]=r,this.collections[e]=r,this[e]||Object.defineProperty(this,e,{get:()=>this.collections[e]})}))),o},t.lockedRun=function(e){return this.idleQueue.wrapCall(e)},t.requestIdlePromise=function(){return this.idleQueue.requestIdlePromise()},t.exportJSON=function(e){throw vt("json-dump")},t.importJSON=function(e){throw vt("json-dump")},t.backup=function(e){throw vt("backup")},t.leaderElector=function(){throw vt("leader-election")},t.isLeader=function(){throw vt("leader-election")},t.waitForLeadership=function(){throw vt("leader-election")},t.migrationStates=function(){throw vt("migration-schema")},t.destroy=async function(){return this.destroyed?ft.kZ:(this.destroyed=!0,await ot("preDestroyRxDatabase",this),this.eventBulks$.complete(),this._subs.map((e=>e.unsubscribe())),"pseudoInstance"===this.name?ft.kZ:this.requestIdlePromise().then((()=>Promise.all(this.onDestroy.map((e=>e()))))).then((()=>Promise.all(Object.keys(this.collections).map((e=>this.collections[e])).map((e=>e.destroy()))))).then((()=>this.internalStore.close())).then((()=>gr.delete(this.name))).then((()=>!0)))},t.remove=function(){return this.destroy().then((()=>async function(e,t,r){var a=S(10),n=await br(a,t,e,{},!1,r),s=await Yt(n),i=new Set;s.forEach((e=>i.add(e.data.name)));var o=Array.from(i);return await Promise.all(o.map((s=>ar(t,n,a,e,s,r)))),await ot("postRemoveRxDatabase",{databaseName:e,storage:t}),await n.remove(),o}(this.name,this.storage,this.password)))},(0,b.Z)(e,[{key:"$",get:function(){return this.observable$}},{key:"asRxDatabase",get:function(){return this}}]),e}();async function br(e,t,r,a,n,s){return await t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:Me,schema:Vt,options:a,multiInstance:n,password:s,devMode:j.isDevMode()})}function xr(e){let{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:s=!0,eventReduce:i=!0,ignoreDuplicate:o=!1,options:c={},cleanupPolicy:l,allowSlowCount:u=!1,localDocuments:h=!1,hashFunction:d=fr}=e;it("preCreateRxDatabase",{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:s,eventReduce:i,ignoreDuplicate:o,options:c,localDocuments:h}),o||function(e){if(gr.has(e))throw N("DB8",{name:e,link:"https://pubkey.github.io/rxdb/rx-database.html#ignoreduplicate"})}(a),gr.add(a);var m=S(10);return br(m,t,a,r,s,n).catch((e=>{throw gr.delete(a),e})).then((e=>{var p=new yr(a,m,t,r,n,s,i,c,e,d,l,u);return ot("createRxDatabase",{database:p,creator:{storage:t,instanceCreationOptions:r,name:a,password:n,multiInstance:s,eventReduce:i,ignoreDuplicate:o,options:c,localDocuments:h}}).then((()=>p))}))}var wr={RxSchema:ct.prototype,RxDocument:xt,RxQuery:Ft.prototype,RxCollection:dr.prototype,RxDatabase:yr.prototype},jr=new Set,kr=new Set;var _r=function(e){function t(t,r,a){var n;return(n=e.call(this,null,r)||this).id=t,n.parent=a,n}return(0,x.Z)(t,e),t}(wt()),Dr={get isLocal(){return!0},get allAttachments$(){throw N("LD1",{document:this})},get primaryPath(){return"id"},get primary(){return this.id},get $(){var e=n(Cr,this.parent);return this.parent.$.pipe((0,ht.h)((e=>e.documentId===this.primary)),(0,ht.h)((e=>e.isLocal)),(0,ut.U)((e=>gt(e))),(0,dt.O)(e.docCache.getLatestDocumentData(this.primary)),(0,mt.x)(((e,t)=>e._rev===t._rev)),(0,ut.U)((t=>e.docCache.getCachedRxDocument(t))),(0,pt.d)(le.kv))},getLatest(){var e=n(Cr,this.parent),t=e.docCache.getLatestDocumentData(this.primary);return e.docCache.getCachedRxDocument(t)},get(e){if(e="data."+e,this._data){if("string"!=typeof e)throw I("LD2",{objPath:e});var t=v(this._data,e);return t=j.deepFreezeWhenDevMode(t)}},get$(e){if(e="data."+e,j.isDevMode()){if(e.includes(".item."))throw N("LD3",{objPath:e});if(e===this.primaryPath)throw N("LD4")}return this.$.pipe((0,ut.U)((e=>e._data)),(0,ut.U)((t=>v(t,e))),(0,mt.x)())},async incrementalModify(e){var t=await Or(this.parent);return t.incrementalWriteQueue.addWrite(this._data,(async t=>(t.data=await e(t.data,this),t))).then((e=>t.docCache.getCachedRxDocument(e)))},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[r,a]=e;t[r]=a})),t)))},async _saveData(e){var t=await Or(this.parent),r=this._data;return e.id=this.id,t.storageInstance.bulkWrite([{previous:r,document:e}],"local-document-save-data").then((t=>{var r=t.success[0];if(!r)throw t.error[0];(e=i(e))._rev=r._rev}))},async remove(){var e=await Or(this.parent),t={id:this._data.id,data:{},_deleted:!0,_meta:T(),_rev:"",_attachments:{}};return Le(e.storageInstance,{previous:this._data,document:t},"local-document-remove").then((t=>e.docCache.getCachedRxDocument(t)))}},Nr=!1,Ir=()=>{if(!Nr){Nr=!0;var e=xt;Object.getOwnPropertyNames(e).forEach((t=>{if(!Object.getOwnPropertyDescriptor(Dr,t)){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(Dr,t,r)}}));["populate","update","putAttachment","getAttachment","allAttachments"].forEach((e=>Dr[e]=(e=>()=>{throw N("LD6",{functionName:e})})(e)))}};var Er=new WeakMap,Cr=new WeakMap;function Rr(e){var t=e.database?e.database:e,r=e.database?e.name:"",a=(async()=>{var a=await Sr(t.token,t.storage,t.name,r,t.instanceCreationOptions,t.multiInstance);a=Ke(t,a,Tr);var n=new Mt("id",e.$.pipe((0,ht.h)((e=>e.isLocal))),(t=>function(e,t){Ir();var r=new _r(e.id,e,t);return Object.setPrototypeOf(r,Dr),r.prototype=Dr,r}(t,e))),s=new yt(a,"id",(()=>{}),(()=>{})),i=await t.storageToken,o=a.changeStream().subscribe((r=>{var a={id:r.id,internal:!1,collectionName:e.database?e.name:void 0,storageToken:i,events:r.events.map((t=>Qe(!0,t,e.database?e:void 0))),databaseToken:t.token,checkpoint:r.checkpoint,context:r.context,endTime:r.endTime,startTime:r.startTime};t.$emit(a)}));e._subs.push(o);var c={database:t,parent:e,storageInstance:a,docCache:n,incrementalWriteQueue:s};return Cr.set(e,c),c})();Er.set(e,a)}function Or(e){var t=Er.get(e);if(!t){var r=e.database?e.database:e,a=e.database?e.name:"";throw N("LD8",{database:r.name,collection:a})}return t}function Sr(e,t,r,a,n,s){return t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:$r(a),schema:Tr,options:n,multiInstance:s,devMode:j.isDevMode()})}function Pr(e){var t=Er.get(e);if(t)return Er.delete(e),t.then((e=>e.storageInstance.close()))}async function Br(e,t,r){var a=S(10),n=await Sr(a,e,t,r,{},!1);await n.remove()}function $r(e){return"plugin-local-documents-"+e}var Tr=Q({title:"RxLocalDocument",version:0,primaryKey:"id",type:"object",properties:{id:{type:"string",maxLength:128},data:{type:"object",additionalProperties:!0}},required:["id","data"]});async function qr(e,t){var r=await Or(this),a={id:e,data:t,_deleted:!1,_meta:T(),_rev:"",_attachments:{}};return Le(r.storageInstance,{document:a},"local-document-insert").then((e=>r.docCache.getCachedRxDocument(e)))}function Mr(e,t){return this.getLocal(e).then((r=>r?r.incrementalModify((()=>t)):this.insertLocal(e,t)))}async function Ar(e){var t=await Or(this),r=t.docCache,a=r.getLatestDocumentDataIfExists(e);return a?Promise.resolve(r.getCachedRxDocument(a)):Ae(t.storageInstance,e).then((e=>e?t.docCache.getCachedRxDocument(e):null))}function Lr(e){return this.$.pipe((0,dt.O)(null),(0,Nt.z)((async t=>t?{changeEvent:t}:{doc:await this.getLocal(e)})),(0,Nt.z)((async t=>{if(t.changeEvent){var r=t.changeEvent;return r.isLocal&&r.documentId===e?{use:!0,doc:await this.getLocal(e)}:{use:!1}}return{use:!0,doc:t.doc}})),(0,ht.h)((e=>e.use)),(0,ut.U)((e=>e.doc)))}var Qr={name:"local-documents",rxdb:!0,prototypes:{RxCollection:e=>{e.insertLocal=qr,e.upsertLocal=Mr,e.getLocal=Ar,e.getLocal$=Lr},RxDatabase:e=>{e.insertLocal=qr,e.upsertLocal=Mr,e.getLocal=Ar,e.getLocal$=Lr}},hooks:{createRxDatabase:{before:e=>{e.creator.localDocuments&&Rr(e.database)}},createRxCollection:{before:e=>{e.creator.localDocuments&&Rr(e.collection)}},preDestroyRxDatabase:{after:e=>Pr(e)},postDestroyRxCollection:{after:e=>Pr(e)},postRemoveRxDatabase:{after:e=>Br(e.storage,e.databaseName,"")},postRemoveRxCollection:{after:e=>Br(e.storage,e.databaseName,e.collectionName)}},overwritable:{}};let Wr;function Fr(){return"undefined"!=typeof window&&window.indexedDB}function Hr(){return Wr||(Wr=(async()=>{!function(e){if(it("preAddRxPlugin",{plugin:e,plugins:jr}),!jr.has(e)){if(kr.has(e.name))throw N("PL3",{name:e.name,plugin:e});if(jr.add(e),kr.add(e.name),!e.rxdb)throw I("PL1",{plugin:e});e.init&&e.init(),e.prototypes&&Object.entries(e.prototypes).forEach((e=>{let[t,r]=e;return r(wr[t])})),e.overwritable&&Object.assign(j,e.overwritable),e.hooks&&Object.entries(e.hooks).forEach((e=>{let[t,r]=e;r.after&&st[t].push(r.after),r.before&&st[t].unshift(r.before)}))}}(Qr);var e;return await xr({name:"rxdb-landing-v3",localDocuments:!0,storage:(void 0===e&&(e={}),new at(e))})})()),Wr}const zr=["#e6008d","#8d2089","#5f2688"]},341:(e,t,r)=>{function a(e,t){if(!window.trigger)throw new Error("window.trigger not defined");return window.trigger(e,t)}r.d(t,{X:()=>a})},1960:(e,t,r)=>{r.r(t),r.d(t,{default:()=>O});var a=r(2263),n=r(3799),s=r(5742),i=r(3028),o=r(5556),c=r(9655),l=r(3784),u=r(1556),h=r(7236),d=r(8804),m=r(598),p=Array.isArray;function f(e){return(0,m.U)((function(t){return function(e,t){return p(t)?e.apply(void 0,(0,o.ev)([],(0,o.CR)(t))):e(t)}(e,t)}))}var v=["addListener","removeListener"],g=["addEventListener","removeEventListener"],y=["on","off"];function b(e,t,r,a){if((0,d.m)(r)&&(a=r,r=void 0),a)return b(e,t,r).pipe(f(a));var n=(0,o.CR)(function(e){return(0,d.m)(e.addEventListener)&&(0,d.m)(e.removeEventListener)}(e)?g.map((function(a){return function(n){return e[a](t,n,r)}})):function(e){return(0,d.m)(e.addListener)&&(0,d.m)(e.removeListener)}(e)?v.map(x(e,t)):function(e){return(0,d.m)(e.on)&&(0,d.m)(e.off)}(e)?y.map(x(e,t)):[],2),s=n[0],i=n[1];if(!s&&(0,h.z)(e))return(0,u.z)((function(e){return b(e,t,r)}))((0,c.Xf)(e));if(!s)throw new TypeError("Invalid event target");return new l.y((function(e){var t=function(){for(var t=[],r=0;r{for(await(0,k.YB)(B);C;){const e=$(),r=(0,k.YB)(e.timeToNextPeriod);if(e.period%2==0)try{await t.incrementalModify((t=>(t.beatPeriod>=e.period||(t.beatPeriod=e.period,t.color=D.O9[e.period%3],e.period%4==0?t.text1=L(S,e.period)[0]:t.text2=L(P,e.period)[0]),t)))}catch(p){}await r}})();const r=await e.upsertLocal("mousepos",{x:0,y:0,time:0});let a=[];window.addEventListener("mousemove",(e=>{a=[e.clientX,e.clientY]})),(0,i.T)(b(window,"mousemove"),b(window,"scroll"),b(window,"resize")).subscribe((()=>{r.incrementalPatch({x:a[0],y:a[1],time:(0,_.z)()})})),function(e){const t=document.getElementsByClassName("tilt-to-mouse"),r=100;function a(e,t,a){const n=a.getBoundingClientRect(),s=-(t-n.y-n.height/2)/r,i=(e-n.x-n.width/2)/r;return`perspective(150px) rotateX(${M(s)}deg) rotateY(${M(i)}deg) `}function n(e,t){e.style.transform=a.apply(null,t)}e.$.subscribe((e=>{e._data.data.time&&Array.from(t).forEach((t=>{if(!W(t))return;n(t,(0,j.Is)([e._data.data.x,e._data.data.y]).concat([t]))}))}))}(r),function(e){const t=document.getElementsByClassName("enlarge-on-mouse");function r(e){const t=e.getBoundingClientRect();return{centerX:t.left+t.width/2,centerY:t.top+t.height/2,width:t.width,height:t.height}}function a(e,t){const r=`scale(${t})`;e.style.transform=r}e.$.pipe((0,m.U)((e=>e._data))).subscribe((e=>{e.data.time&&e.data.x&&e.data.y&&Array.from(t).forEach((t=>{if(!W(t))return;const n=r(t),s=e.data.x-n.centerX,i=e.data.y-n.centerY,o=Math.sqrt(s*s+i*i);function c(e){return 1.9^e}let l=1+n.width/2/c(o+300);l>1.5&&(l=1.5),l<1.01&&(l=1),a(t,l)}))}))}(r);const n=document.getElementsByClassName("beating"),s=document.getElementsByClassName("beating-first"),o=document.getElementsByClassName("beating-second"),c=document.getElementsByClassName("beating-number"),l=document.getElementsByClassName("beating-color"),u=document.getElementsByClassName("beating-color-string"),h=[];let d=0;$(),t.$.pipe((0,m.U)((e=>e._data.data)),(0,w.x)(((e,t)=>JSON.stringify(e)===JSON.stringify(t)))).subscribe((e=>{h.forEach((function(e){e(d)})),d+=1;const t=e.color;Array.from(l).forEach((function(e){e.style.backgroundColor=t})),Array.from(u).forEach((function(e){e.innerHTML=t}))})),h.push((function(){Array.from(n).forEach((function(e){e.style.animationDuration=B+"ms",e.classList.remove("animation"),e.offsetWidth,e.classList.add("animation")})),Array.from(s).forEach((function(e){e.style.animationDuration=B+"ms",e.classList.remove("animation"),e.offsetWidth,e.classList.add("animation")})),Array.from(o).forEach((function(e){e.style.animationDuration=B+"ms",e.classList.remove("animation"),e.offsetWidth,e.classList.add("animation")}))})),h.push((function(){Array.from(c).forEach((function(e){A()&&A()&&setTimeout((function(){const t=parseFloat(e.innerHTML)+1;e.innerHTML=t+""}),105)}))}))}function O(){const{siteConfig:e}=(0,a.Z)();return(0,N.useEffect)((()=>(R(),()=>{console.log("stop animation"),C=!1}))),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(s.Z,{children:(0,E.jsx)("body",{className:"homepage"})}),(0,E.jsx)(n.Z,{title:`${e.title}`,description:"RxDB is a fast, local-first NoSQL-database for JavaScript Applications like Websites, hybrid Apps, Electron-Apps, Progressive Web Apps and Node.js",children:(0,E.jsxs)("main",{children:[(0,E.jsx)("div",{className:"block first centered",children:(0,E.jsx)("div",{className:"content",children:(0,E.jsxs)("div",{className:"inner",children:[(0,E.jsxs)("div",{className:"half",children:[(0,E.jsx)("br",{}),(0,E.jsxs)("h1",{children:["The local ",(0,E.jsx)("b",{className:"underline",children:"Database"})," for"," ",(0,E.jsx)("b",{className:"underline",children:"JavaScript"})," Applications"]}),(0,E.jsx)("br",{}),(0,E.jsxs)("ul",{className:"checked",children:[(0,E.jsx)("li",{children:"Realtime Queries"}),(0,E.jsx)("li",{children:"Realtime Replication"}),(0,E.jsx)("li",{children:"Works Offline"}),(0,E.jsx)("li",{children:"Supports all JavaScript runtimes"}),(0,E.jsx)("li",{children:"Great Performance"})]}),(0,E.jsx)("a",{className:"button",href:"/quickstart.html",target:"_blank",children:"Get Started"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsx)("div",{className:"half",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,E.jsxs)("div",{className:"content-canvas",style:{marginTop:30,marginBottom:30},children:[(0,E.jsx)("div",{className:"device tablet",style:{marginLeft:481,marginTop:117},children:(0,E.jsx)("div",{className:"beating-color",style:{backgroundColor:"rgb(141, 32, 137)"},children:(0,E.jsx)("img",{src:"./files/logo/logo.svg",className:"beating logo animation",alt:"RxDB",style:{animationDuration:"851ms"}})})}),(0,E.jsx)("div",{className:"device desktop",style:{marginTop:"0%"},children:(0,E.jsx)("div",{className:"beating-color",style:{backgroundColor:"rgb(141, 32, 137)"},children:(0,E.jsx)("img",{src:"/files/logo/logo_text.svg",className:"beating logo animation",alt:"RxDB",style:{animationDuration:"851ms",width:"52%"}})})}),(0,E.jsxs)("div",{className:"device server",style:{marginLeft:0,marginTop:168},children:[(0,E.jsx)("div",{className:"beating-color one",style:{backgroundColor:"rgb(141, 32, 137)"}}),(0,E.jsx)("div",{className:"beating-color two",style:{backgroundColor:"rgb(141, 32, 137)"}}),(0,E.jsx)("div",{className:"beating-color three",style:{backgroundColor:"rgb(141, 32, 137)"}})]})]})})]})})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb",onClick:()=>(0,I.X)("github_trophy_click",.2),target:"_blank",children:(0,E.jsxs)("div",{className:"trophy",children:[(0,E.jsx)("img",{src:"./files/icons/github-star-with-logo.svg",alt:"RxDB github star"}),(0,E.jsxs)("div",{style:{flex:1},children:[(0,E.jsx)("div",{className:"subtitle",children:"Open Source on"}),(0,E.jsx)("div",{className:"title",children:"GitHub"})]}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"valuetitle",children:"stars"}),(0,E.jsxs)("div",{className:"value",children:["19247",(0,E.jsx)("div",{className:"arrow-up",children:" "})]})]})]})}),(0,E.jsx)("div",{className:"block second dark",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsxs)("h2",{children:["Realtime applications ",(0,E.jsx)("b",{className:"underline",children:"made easy"})]}),(0,E.jsxs)("p",{children:["From the results of a query, to a single field of a document, with RxDB you can ",(0,E.jsx)("b",{children:"observe everything"}),". This enables you to build realtime applications ",(0,E.jsx)("b",{children:"fast"})," and ",(0,E.jsx)("b",{children:"reliable"}),". It does not matter if the data was changed by"," ",(0,E.jsx)("b",{children:"a user event"}),", ",(0,E.jsx)("b",{children:"another browser tab"})," or by the",(0,E.jsx)("b",{children:" replication"}),"."," ","Whenever your data changes, your UI reflects the new state."]}),(0,E.jsxs)("div",{className:"inner",children:[(0,E.jsxs)("div",{className:"code half",children:[(0,E.jsxs)("fieldset",{className:"samp-wrapper",style:{backgroundColor:"var(--bg-color)"},children:[(0,E.jsx)("legend",{children:"Write"}),(0,E.jsxs)("samp",{children:[(0,E.jsx)("span",{className:"cm-keyword",children:"await "}),(0,E.jsx)("span",{className:"cm-variable",children:"collection"}),".",(0,E.jsx)("span",{className:"cm-method",children:"upsert"}),"(","{",(0,E.jsx)("br",{}),(0,E.jsx)("span",{className:"cm-property",children:"\xa0 id"}),": ",(0,E.jsx)("span",{className:"cm-string",children:"'foobar'"}),",",(0,E.jsx)("br",{}),(0,E.jsx)("span",{className:"cm-property",children:"\xa0 color"}),": ",(0,E.jsxs)("span",{className:"cm-string",children:["'",(0,E.jsx)("span",{className:"beating-color-string beating-color",children:"#e6008d"}),"'"]}),(0,E.jsx)("br",{}),"}",");"]})]}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsxs)("fieldset",{className:"samp-wrapper",style:{backgroundColor:"var(--bg-color)"},children:[(0,E.jsx)("legend",{children:"Observe"}),(0,E.jsxs)("samp",{style:{backgroundColor:"var(--bg-color)"},children:[(0,E.jsx)("span",{className:"cm-keyword",children:"await "}),(0,E.jsx)("span",{className:"cm-variable",children:"collection"}),".",(0,E.jsxs)("span",{className:"cm-method",children:["findOne(",(0,E.jsx)("span",{className:"cm-string",children:"'foobar'"}),")"]}),(0,E.jsx)("br",{}),"\xa0.",(0,E.jsx)("span",{className:"cm-property",children:"$"}),(0,E.jsx)("span",{className:"cm-comment",children:" // get observable"}),(0,E.jsx)("br",{}),"\xa0.",(0,E.jsx)("span",{className:"cm-method",children:"subscribe"}),"(",(0,E.jsx)("span",{className:"cm-def",children:"d"}),(0,E.jsx)("span",{className:"cm-operator",children:" =>"})," ","{",(0,E.jsx)("br",{}),(0,E.jsx)("span",{className:"cm-variable",children:"\xa0\xa0 screen"}),".",(0,E.jsx)("span",{className:"cm-property",children:"backgroundColor"}),(0,E.jsx)("span",{className:"cm-operator",children:" = "}),(0,E.jsx)("span",{className:"cm-variable",children:"d"}),".",(0,E.jsx)("span",{className:"cm-property beating-color",children:"color"}),";",(0,E.jsx)("br",{}),"\xa0","}",");"]})]})]}),(0,E.jsx)("div",{className:"canvas half",children:(0,E.jsxs)("div",{className:"content-canvas",children:[(0,E.jsx)("div",{className:"device tablet",style:{marginLeft:481,marginTop:117},children:(0,E.jsx)("div",{className:"beating-color",children:(0,E.jsx)("img",{src:"./files/logo/logo.svg",className:"beating logo",alt:"RxDB"})})}),(0,E.jsx)("div",{className:"device desktop",style:{marginTop:"0%"},children:(0,E.jsx)("div",{className:"beating-color",children:(0,E.jsx)("img",{src:"./files/logo/logo.svg",className:"beating logo",alt:"RxDB"})})}),(0,E.jsxs)("div",{className:"device server",style:{marginLeft:0,marginTop:168},children:[(0,E.jsx)("div",{className:"beating-color one"}),(0,E.jsx)("div",{className:"beating-color two"}),(0,E.jsx)("div",{className:"beating-color three"})]})]})})]})]})}),(0,E.jsx)("a",{href:"https://twitter.com/intent/user?screen_name=rxdbjs",onClick:()=>(0,I.X)("twitter_trophy_click",.2),target:"_blank",children:(0,E.jsxs)("div",{className:"trophy twitter",children:[(0,E.jsx)("img",{src:"./files/icons/twitter-blue.svg",alt:"RxDB Twitter"}),(0,E.jsxs)("div",{style:{flex:1},children:[(0,E.jsx)("div",{className:"subtitle",children:"Follow on"}),(0,E.jsx)("div",{className:"title",children:"Twitter"})]}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"valuetitle",children:"followers"}),(0,E.jsxs)("div",{className:"value",children:["2843",(0,E.jsx)("div",{className:"arrow-up",children:" "})]})]})]})}),(0,E.jsx)("div",{className:"block replication",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsxs)("div",{className:"half left",children:[(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsxs)("h2",{children:["Replicate ",(0,E.jsx)("b",{children:"with your existing infrastructure"})]}),(0,E.jsxs)("p",{children:["RxDB supports replication with a"," ",(0,E.jsx)("a",{href:"/replication-couchdb.html",target:"_blank",children:"CouchDB"})," ","server or any custom"," ",(0,E.jsx)("a",{href:"/replication-graphql.html",target:"_blank",children:"GraphQL"})," ","endpoint which smoothly integrates with your existing infrastructure. Also you can use the replication primitives plugin to create custom replications over any protocol like"," ",(0,E.jsx)("a",{href:"/replication-http.html",target:"_blank",children:"HTTP"}),","," ",(0,E.jsx)("a",{href:"/replication-websocket.html",target:"_blank",children:"Websocket"}),","," ",(0,E.jsx)("a",{href:"/replication-webrtc.html",target:"_blank",children:"WebRTC"})," ","or"," ",(0,E.jsx)("a",{href:"/replication-firestore.html",target:"_blank",children:"Firestore"}),"."]})]}),(0,E.jsx)("div",{className:"half right",children:(0,E.jsxs)("div",{className:"replication-icons",children:[(0,E.jsx)("img",{src:"./files/logo/logo.svg",alt:"RxDB",className:"replicate-logo tilt-to-mouse"}),(0,E.jsx)("a",{href:"/replication-graphql.html",target:"_blank",children:(0,E.jsx)("div",{className:"neumorphism-circle-xl centered replicate-graphql enlarge-on-mouse",children:(0,E.jsx)("img",{src:"./files/icons/graphql-text.svg",alt:"GraphQL",className:"protocol"})})}),(0,E.jsx)("a",{href:"/replication-couchdb.html",target:"_blank",children:(0,E.jsx)("div",{className:"neumorphism-circle-xl centered replicate-couchdb enlarge-on-mouse",children:(0,E.jsx)("img",{src:"./files/icons/couchdb-text.svg",alt:"CouchDB",className:"protocol"})})}),(0,E.jsxs)("div",{className:"neumorphism-circle-xs centered replicate-rest enlarge-on-mouse",children:["{"," REST ","}"]}),(0,E.jsx)("a",{href:"/replication-websocket.html",target:"_blank",children:(0,E.jsx)("div",{className:"neumorphism-circle-xs centered replicate-websocket enlarge-on-mouse",children:"websocket"})}),(0,E.jsx)("a",{href:"/replication-webrtc.html",target:"_blank",children:(0,E.jsx)("div",{className:"neumorphism-circle-xs centered replicate-webrtc enlarge-on-mouse",children:"WebRTC"})})]})}),(0,E.jsx)("div",{className:"clear"})]})}),(0,E.jsx)("a",{href:"https://rxdb.info/chat.html",onClick:()=>(0,I.X)("discord_trophy_click",.2),target:"_blank",children:(0,E.jsxs)("div",{className:"trophy discord",children:[(0,E.jsx)("img",{src:"./files/icons/discord.svg",alt:"RxDB Discord chat"}),(0,E.jsxs)("div",{style:{flex:1},children:[(0,E.jsx)("div",{className:"subtitle",children:"Chat on"}),(0,E.jsx)("div",{className:"title",children:"Discord"})]}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"valuetitle",children:"members"}),(0,E.jsxs)("div",{className:"value",children:["414",(0,E.jsx)("div",{className:"arrow-up",children:" "})]})]})]})}),(0,E.jsxs)("div",{className:"block offline-first dark",children:[(0,E.jsx)("div",{className:"offline-image-wrapper",children:(0,E.jsx)("img",{src:"files/icons/wifi/wifi_1a202c.svg",className:"offline-image beating-second",alt:"offline"})}),(0,E.jsxs)("div",{className:"content",children:[(0,E.jsxs)("h2",{children:["Online ",(0,E.jsx)("b",{className:"underline",children:"is optional"})]}),(0,E.jsxs)("div",{className:"full-width",children:[(0,E.jsx)("div",{className:"half left",children:(0,E.jsxs)("p",{children:["RxDB follows the"," ",(0,E.jsx)("a",{href:"/offline-first.html",target:"_blank",children:"Offline First"})," ","paradigm where an application must work as well offline as it does online. This is done by persisting data locally on the client side and replicating it in the background. RxDB can even be used solely on the client side, with no backend at all."]})}),(0,E.jsx)("div",{className:"half right",children:(0,E.jsxs)("ul",{className:"checked",children:[(0,E.jsxs)("li",{children:["Your application still ",(0,E.jsx)("b",{children:"works offline"})]}),(0,E.jsxs)("li",{children:["Increases ",(0,E.jsx)("b",{children:"perceived performance"})]}),(0,E.jsxs)("li",{children:["Easier and ",(0,E.jsx)("b",{children:"faster implementation"})]}),(0,E.jsxs)("li",{children:["Needs less backend resources and ",(0,E.jsx)("b",{children:"scales better"})]})]})})]})]})]}),(0,E.jsx)("div",{className:"block frameworks",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/angular",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"-10%",left:"10%"},children:[(0,E.jsx)("img",{src:"./files/icons/angular.svg",alt:"angular"}),"Angular"]})}),(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"10%",left:"58%"},children:[(0,E.jsx)("img",{src:"./files/icons/capacitor.svg",alt:"capacitor"}),"Capacitor"]}),(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"-4%",left:"44%"},children:[(0,E.jsx)("img",{src:"./files/icons/deno.svg",alt:"deno"}),"Deno"]}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/node",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"-5%",left:"85%"},children:[(0,E.jsx)("img",{src:"./files/icons/nodejs.svg",alt:"Node.js"}),"Node.js"]})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/react",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"4%",left:"26%"},children:[(0,E.jsx)("img",{src:"./files/icons/react.svg",alt:"React"}),"React"]})}),(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"15%",left:"90%",marginLeft:"-35px"},children:[(0,E.jsx)("img",{src:"./files/icons/svelte.svg",alt:"Svelte"}),"Svelte"]}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsx)("br",{}),(0,E.jsxs)("h2",{children:["Flexible ",(0,E.jsx)("b",{className:"underline",children:"storage layer"})]}),(0,E.jsxs)("p",{children:["RxDB is based on a storage interface that enables you to swap out the underlying storage engine. This increases code reuse because the same database code can be used in ",(0,E.jsx)("b",{children:"any JavaScript runtime"})," ","by just switching out the storage settings.",(0,E.jsx)("br",{})]}),(0,E.jsxs)("div",{className:"below-text",children:[(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/electron",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"2%",left:"18%"},children:[(0,E.jsx)("img",{src:"./files/icons/electron.svg",alt:"electron"}),"Electron"]})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/vue",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"3%",left:"45%"},children:[(0,E.jsx)("img",{src:"./files/icons/vuejs.svg",alt:"Vue.js"}),"Vue.js"]})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/ionic2",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"2%",left:"71%"},children:[(0,E.jsx)("img",{src:"./files/icons/ionic.svg",alt:"ionic"}),"Ionic"]})}),(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"46%",left:"11%"},children:[(0,E.jsx)("img",{src:"./files/icons/nativescript.svg",alt:"NativeScript"}),"NativeScript"]}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/react-native",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"45%",left:"35%"},children:[(0,E.jsx)("img",{src:"./files/icons/react.svg",alt:"React Native"}),"React Native"]})}),(0,E.jsxs)("div",{className:"neumorphism-circle-m circle centered enlarge-on-mouse",style:{top:"45%",left:"62%"},children:[(0,E.jsx)("img",{src:"./files/icons/nextjs.svg",alt:"Next.js"}),"Next.js"]}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb/tree/master/examples/flutter",target:"_blank",children:(0,E.jsxs)("div",{className:"neumorphism-circle-s circle centered enlarge-on-mouse",style:{top:"40%",left:"86%"},children:[(0,E.jsx)("img",{src:"./files/icons/flutter.svg",alt:"Flutter"}),"Flutter"]})})]})]})}),(0,E.jsx)("div",{className:"block fifth dark",children:(0,E.jsx)("div",{className:"content centered",children:(0,E.jsxs)("div",{className:"inner",children:[(0,E.jsxs)("h2",{children:["Trusted and ",(0,E.jsx)("b",{className:"underline",children:"open source"})]}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/github-star.svg",alt:"github star"}),(0,E.jsx)("div",{className:"label",children:"Github Stars"}),(0,E.jsx)("a",{className:"value",href:"https://github.com/pubkey/rxdb",rel:"noopener",target:"_blank",children:"19247"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/download.svg",alt:"npm downloads"}),(0,E.jsx)("div",{className:"label",children:"npm downloads"}),(0,E.jsx)("a",{className:"value beating-number",href:"https://www.npmjs.com/package/rxdb",rel:"noopener",target:"_blank",children:"238572"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsx)("div",{className:"clear"}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/person.svg",alt:"contributor"}),(0,E.jsx)("div",{className:"label",children:"Contributors"}),(0,E.jsx)("a",{className:"value",href:"https://github.com/pubkey/rxdb/graphs/contributors",rel:"noopener",target:"_blank",children:"133"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/commit.svg",alt:"commit"}),(0,E.jsx)("div",{className:"label",children:"Commits"}),(0,E.jsx)("a",{className:"value",href:"https://github.com/pubkey/rxdb/commits/master",rel:"noopener",target:"_blank",children:"6891"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsx)("div",{className:"clear"}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/gear.svg",alt:"gear"}),(0,E.jsx)("div",{className:"label",children:"Projects build with RxDB"}),(0,E.jsx)("a",{className:"value",href:"https://github.com/pubkey/rxdb/network/dependents?package_id=UGFja2FnZS0xODM0NzAyMw%3D%3D",rel:"noopener",target:"_blank",children:"825"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsxs)("div",{className:"box dark",children:[(0,E.jsx)("img",{src:"files/icons/twitter.svg",alt:"twitter"}),(0,E.jsx)("div",{className:"label",children:"Twitter followers"}),(0,E.jsx)("a",{className:"value",href:"https://twitter.com/intent/user?screen_name=rxdbjs",rel:"noopener",target:"_blank",children:"2843"}),(0,E.jsx)("div",{className:"clear"})]}),(0,E.jsx)("div",{className:"clear"})]})})}),(0,E.jsx)("div",{className:"block sixth",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsx)("h2",{children:"Pricing Models"}),(0,E.jsx)("div",{className:"inner",children:(0,E.jsxs)("div",{className:"buy-options",children:[(0,E.jsx)("div",{className:"buy-option bg-gradient-left-top",children:(0,E.jsxs)("div",{className:"buy-option-inner",children:[(0,E.jsxs)("div",{className:"buy-option-title",children:[(0,E.jsx)("h2",{children:"RxDB Basics"}),(0,E.jsx)("div",{className:"price",children:"Free & Open Source"})]}),(0,E.jsx)("div",{className:"buy-option-features",children:(0,E.jsxs)("ul",{children:[(0,E.jsx)("li",{children:"Basic RxStorages"}),(0,E.jsx)("li",{children:"Realtime Replication"}),(0,E.jsx)("li",{children:"Live Queries"}),(0,E.jsx)("li",{children:"Schema Validation"}),(0,E.jsx)("li",{children:"Multi-Tab Support"}),(0,E.jsx)("li",{children:"Encryption"}),(0,E.jsx)("li",{children:"Compression"})]})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb",target:"_blank",rel:"noopener",onClick:()=>(0,I.X)("goto_code",.2),children:(0,E.jsx)("div",{className:"buy-option-action bg-top hover-shadow-top",children:"Get the Code"})})]})}),(0,E.jsx)("div",{className:"buy-option bg-gradient-right-top",children:(0,E.jsxs)("div",{className:"buy-option-inner",children:[(0,E.jsxs)("div",{className:"buy-option-title",children:[(0,E.jsx)("h2",{children:"Premium Plugins"}),(0,E.jsx)("div",{className:"price",children:"for professionals to get the most out of RxDB"})]}),(0,E.jsx)("div",{className:"buy-option-features",children:(0,E.jsxs)("ul",{children:[(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-sqlite.html",target:"_blank",children:"SQLite RxStorage"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-opfs.html",target:"_blank",children:"OPFS RxStorage"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-indexeddb.html",target:"_blank",children:"IndexedDB RxStorage"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-memory-synced.html",target:"_blank",children:"Memory-Synced RxStorage"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-sharding.html",target:"_blank",children:"Sharding Plugin"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/query-optimizer.html",target:"_blank",children:"Query Optimizer"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/migration-storage.html",target:"_blank",children:"Storage Migrator"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-localstorage-meta-optimizer.html",target:"_blank",children:"RxStorage Localstorage Meta Optimizer"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-shared-worker.html",target:"_blank",children:"Shared Worker"})}),(0,E.jsx)("li",{children:(0,E.jsx)("a",{href:"https://rxdb.info/rx-storage-worker.html",target:"_blank",children:"Worker"})})]})}),(0,E.jsx)("a",{href:"/premium",onClick:()=>(0,I.X)("premium_request",1),children:(0,E.jsx)("div",{className:"buy-option-action bg-middle hover-shadow-middle",children:"Request Premium"})})]})}),(0,E.jsx)("div",{className:"buy-option bg-gradient-left-top",children:(0,E.jsxs)("div",{className:"buy-option-inner",children:[(0,E.jsxs)("div",{className:"buy-option-title",children:[(0,E.jsx)("h2",{children:"Consulting Session"}),(0,E.jsx)("div",{className:"price",children:"fast in person consulting"})]}),(0,E.jsx)("div",{className:"buy-option-features",children:(0,E.jsxs)("p",{children:["Book a one hour consulting session with the RxDB maintainer. I will answer all your questions, give proposals for your use case and we can even do a pair programming session if you have a specific problem in your source code.",(0,E.jsx)("br",{}),"You can book this by doing a one-time donation via github sponsors."]})}),(0,E.jsx)("a",{href:"https://github.com/sponsors/pubkey?frequency=one-time&sponsor=pubkey",target:"_blank",onClick:()=>(0,I.X)("consulting_session_request",1.5),children:(0,E.jsx)("div",{className:"buy-option-action bg-bottom hover-shadow-bottom",children:"Book Now"})})]})})]})})]})}),(0,E.jsx)("div",{className:"block last dark",children:(0,E.jsxs)("div",{className:"content",children:[(0,E.jsxs)("h2",{children:["Start using ",(0,E.jsx)("b",{className:"underline",children:"RxDB"})," today"]}),(0,E.jsxs)("div",{className:"buttons full-width",children:[(0,E.jsx)("a",{href:"/quickstart.html",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("start_now",.4),children:(0,E.jsx)("div",{className:"button get-premium",style:{left:"50%",top:"20%",marginLeft:"-122px"},children:"Start now"})}),(0,E.jsx)("a",{href:"https://rxdb.info/newsletter.html",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("get_newsletter",.4),children:(0,E.jsx)("div",{className:"button",style:{left:"25%",marginLeft:"-90px"},children:"Get the Newsletter"})}),(0,E.jsx)("a",{href:"https://rxdb.info/chat.html",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("join_chat",.4),children:(0,E.jsx)("div",{className:"button",style:{left:"77%",top:"6%",marginLeft:"-70.5px"},children:"Join the Chat"})}),(0,E.jsx)("a",{href:"/premium",onClick:()=>(0,I.X)("premium_request",1),children:(0,E.jsx)("div",{className:"button",style:{top:"40%",left:"20%",marginLeft:"-70.5px"},children:"Get Premium"})}),(0,E.jsx)("a",{href:"https://twitter.com/intent/user?screen_name=rxdbjs",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("follow_twitter",.4),children:(0,E.jsx)("div",{className:"button",style:{top:"44%",left:"73%",marginLeft:"-85px"},children:"Follow on Twitter"})}),(0,E.jsx)("a",{href:"https://github.com/pubkey/rxdb",rel:"noopener",target:"_blank",onClick:()=>(0,I.X)("goto_code",.4),children:(0,E.jsx)("div",{className:"button",style:{top:"54%",left:"32%",marginLeft:"-70px"},children:"Get the Code"})})]})]})})]})})]})}const S=["NoSQL","OfflineFirst","JavaScript","observable","reactive","realtime","client side","fast"],P=["for the Web","for Node.js","for Browsers","for Capacitor","for Electron","for hybrid apps","for PWAs","for React Native","for NativeScript","for UI apps","you deserve","that syncs"],B=851;function $(){const e=((new Date).getTime()-196e7)/B,t=Math.floor(e);return{ratio:e,period:t,timeToNextPeriod:(e-t)*B}}const T=22,q=-1*T;function M(e){return eT?T:e}function A(){return Math.random()<.5}function L(e,t){let r,a,n=(e=e.slice(0)).length;for(;n;)a=Math.floor(Q(t)*n--),r=e[n],e[n]=e[a],e[a]=r,++t;return e}function Q(e){const t=1e4*Math.sin(e++);return t-Math.floor(t)}function W(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}},6087:(e,t,r)=>{function a(e){return e[e.length-1]}function n(e){return Array.isArray(e)?e.slice(0):[e]}function s(e){return Array.isArray(e)}function i(e){return null!=e}function o(e,t){var r=0,a=-1;for(var n of e){if(!t(n,a+=1))break;r+=1}return r}function c(e,t){for(var r=t.length,a=0;as,Nb:()=>l,S7:()=>i,SI:()=>a,gu:()=>c,qo:()=>n,r0:()=>o})},7400:(e,t,r)=>{function a(e,t){if(!e)throw t||(t=""),new Error("ensureNotFalsy() is falsy: "+t);return e}r.d(t,{Is:()=>a,kv:()=>n});var n={bufferSize:1,refCount:!0}},4419:(e,t,r)=>{function a(){return new Promise((e=>setTimeout(e,0)))}function n(e){return void 0===e&&(e=0),new Promise((t=>setTimeout(t,e)))}r.d(t,{$Y:()=>o,C2:()=>u,Y3:()=>a,YB:()=>n,Ze:()=>h,kZ:()=>s,m5:()=>i,y$:()=>c});Promise.resolve(!0);var s=Promise.resolve(!1),i=Promise.resolve(null),o=Promise.resolve();function c(e){return void 0===e&&(e=1e4),"function"==typeof requestIdleCallback?new Promise((t=>{requestIdleCallback((()=>t()),{timeout:e})})):n(0)}var l=o;function u(e){return void 0===e&&(e=void 0),l=l.then((()=>c(e)))}function h(e,t){return e.reduce(((e,t)=>e.then(t)),Promise.resolve(t))}},984:(e,t,r)=>{r.d(t,{z:()=>n});var a=0;function n(){var e=Date.now();(e+=.01)<=a&&(e=a+.01);var t=parseFloat(e.toFixed(2));return a=t,t}}}]); \ No newline at end of file diff --git a/docs/assets/js/25a43fd4.8118b3fa.js b/docs/assets/js/25a43fd4.8118b3fa.js deleted file mode 100644 index f717b2bc53f..00000000000 --- a/docs/assets/js/25a43fd4.8118b3fa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[7739],{3797:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>d,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>h});var t=n(5893),a=n(1151);const o={title:"SharedWorker RxStorage \ud83d\udc51",slug:"rx-storage-shared-worker.html"},s="SharedWorker RxStorage",i={id:"rx-storage-shared-worker",title:"SharedWorker RxStorage \ud83d\udc51",description:"The SharedWorker RxStorage uses the SharedWorker API to run the storage inside of a separate JavaScript process in browsers. Compared to a normal WebWorker, the SharedWorker is created exactly once, even when there are multiple browser tabs opened. Because of having exactly one worker, multiple performance optimizations can be done because the storage itself does not have to handle multiple opened database connections.",source:"@site/docs/rx-storage-shared-worker.md",sourceDirName:".",slug:"/rx-storage-shared-worker.html",permalink:"/rx-storage-shared-worker.html",draft:!1,unlisted:!1,editUrl:"https://github.com/pubkey/rxdb/tree/master/docs-src/docs/rx-storage-shared-worker.md",tags:[],version:"current",frontMatter:{title:"SharedWorker RxStorage \ud83d\udc51",slug:"rx-storage-shared-worker.html"},sidebar:"tutorialSidebar",previous:{title:"Worker RxStorage \ud83d\udc51",permalink:"/rx-storage-worker.html"},next:{title:"Memory Synced RxStorage \ud83d\udc51",permalink:"/rx-storage-memory-synced.html"}},d={},h=[{value:"Usage",id:"usage",level:2},{value:"On the SharedWorker process",id:"on-the-sharedworker-process",level:3},{value:"On the main process",id:"on-the-main-process",level:3},{value:"Pre-build workers",id:"pre-build-workers",level:2},{value:"Replication with SharedWorker",id:"replication-with-sharedworker",level:2}];function l(e){const r={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,a.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h1,{id:"sharedworker-rxstorage",children:"SharedWorker RxStorage"}),"\n",(0,t.jsxs)(r.p,{children:["The SharedWorker ",(0,t.jsx)(r.a,{href:"/rx-storage.html",children:"RxStorage"})," uses the ",(0,t.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker",children:"SharedWorker API"})," to run the storage inside of a separate JavaScript process ",(0,t.jsx)(r.strong,{children:"in browsers"}),". Compared to a normal ",(0,t.jsx)(r.a,{href:"/rx-storage-worker.html",children:"WebWorker"}),", the SharedWorker is created exactly once, even when there are multiple browser tabs opened. Because of having exactly one worker, multiple performance optimizations can be done because the storage itself does not have to handle multiple opened database connections."]}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.strong,{children:"NOTICE:"})," This plugin is part of ",(0,t.jsx)(r.a,{href:"/premium",children:"\ud83d\udc51 RxDB premium"}),". It is not part of the default RxDB module."]}),"\n",(0,t.jsx)(r.h2,{id:"usage",children:"Usage"}),"\n",(0,t.jsx)(r.h3,{id:"on-the-sharedworker-process",children:"On the SharedWorker process"}),"\n",(0,t.jsxs)(r.p,{children:["In the worker process JavaScript file, you have wrap the original RxStorage with ",(0,t.jsx)(r.code,{children:"getRxStorageIndexedDB()"}),"."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"// shared-worker.ts\n\nimport { exposeWorkerRxStorage } from 'rxdb-premium/plugins/storage-worker';\nimport { \n getRxStorageIndexedDB\n} from 'rxdb-premium/plugins/indexeddb';\n\nexposeWorkerRxStorage({\n /**\n * You can wrap any implementation of the RxStorage interface\n * into a worker.\n * Here we use the IndexedDB RxStorage.\n */\n storage: getRxStorageIndexedDB()\n});\n"})}),"\n",(0,t.jsx)(r.h3,{id:"on-the-main-process",children:"On the main process"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"import {\n createRxDatabase\n} from 'rxdb';\nimport { getRxStorageSharedWorker } from 'rxdb-premium/plugins/storage-worker';\nimport { getRxStorageIndexedDB } from 'rxdb/plugins/storage-indexeddb';\n\n\nconst database = await createRxDatabase({\n name: 'mydatabase',\n storage: getRxStorageSharedWorker(\n {\n /**\n * Contains any value that can be used as parameter\n * to the SharedWorker constructor of thread.js\n * Most likely you want to put the path to the shared-worker.js file in here.\n * \n * @link https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker?retiredLocale=de\n */\n workerInput: 'path/to/shared-worker.js',\n /**\n * (Optional) options\n * for the worker.\n */\n workerOptions: {\n type: 'module',\n credentials: 'omit'\n }\n }\n )\n});\n"})}),"\n",(0,t.jsx)(r.h2,{id:"pre-build-workers",children:"Pre-build workers"}),"\n",(0,t.jsxs)(r.p,{children:["The ",(0,t.jsx)(r.code,{children:"shared-worker.js"})," must be a self containing JavaScript file that contains all dependencies in a bundle.\nTo make it easier for you, RxDB ships with pre-bundles worker files that are ready to use.\nYou can find them in the folder ",(0,t.jsx)(r.code,{children:"node_modules/rxdb-premium/dist/workers"})," after you have installed the ",(0,t.jsx)(r.a,{href:"/premium",children:"\ud83d\udc51 RxDB Premium Plugin"}),". From there you can copy them to a location where it can be served from the webserver and then use their path to create the ",(0,t.jsx)(r.code,{children:"RxDatabase"})]}),"\n",(0,t.jsxs)(r.p,{children:["Any valid ",(0,t.jsx)(r.code,{children:"worker.js"})," JavaScript file can be used both, for normal Workers and SharedWorkers."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"import {\n createRxDatabase\n} from 'rxdb';\nimport { getRxStorageSharedWorker } from 'rxdb-premium/plugins/storage-worker';\nconst database = await createRxDatabase({\n name: 'mydatabase',\n storage: getRxStorageSharedWorker(\n {\n /**\n * Path to where the copied file from node_modules/rxdb-premium/dist/workers\n * is reachable from the webserver.\n */\n workerInput: '/indexeddb.shared-worker.js'\n }\n )\n});\n"})}),"\n",(0,t.jsx)(r.h2,{id:"replication-with-sharedworker",children:"Replication with SharedWorker"}),"\n",(0,t.jsxs)(r.p,{children:["When a SharedWorker RxStorage is used, it is recommended to run the replication ",(0,t.jsx)(r.strong,{children:"inside"})," of the worker. You can do that by opening another ",(0,t.jsx)(r.a,{href:"/rx-database.html",children:"RxDatabase"})," inside of it and starting the replication there."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"// shared-worker.ts\n\nimport { exposeSharedWorkerRxStorage } from 'rxdb-premium/plugins/storage-worker';\nimport { \n getRxStorageIndexedDB\n} from 'rxdb-premium/plugins/storage-indexeddb';\nimport {\n createRxDatabase,\n addRxPlugin\n} from 'rxdb';\nimport {\n RxDBReplicationGraphQLPlugin\n} from 'rxdb/plugins/replication-graphql';\naddRxPlugin(RxDBReplicationGraphQLPlugin);\n\nconst baseStorage = getRxStorageIndexedDB();\n\n// first expose the RxStorage to the outside\nexposeSharedWorkerRxStorage({\n storage: baseStorage\n});\n\n/**\n * Then create a normal RxDatabase and RxCollections\n * and start the replication.\n */\nconst database = await createRxDatabase({\n name: 'mydatabase',\n /**\n * Important: INSIDE of your SharedWorker, you can\n * be sure that there is exactly one instance running.\n * Therefore you MUST set multiInstance=false for better performance.\n */\n multiInstance: false,\n storage: baseStorage\n});\nawait db.addCollections({\n humans: {/* ... */}\n});\nconst replicationState = db.humans.syncGraphQL({/* ... */});\n"})})]})}function c(e={}){const{wrapper:r}={...(0,a.a)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},1151:(e,r,n)=>{n.d(r,{Z:()=>i,a:()=>s});var t=n(7294);const a={},o=t.createContext(a);function s(e){const r=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function i(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),t.createElement(o.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/docs/assets/js/25a43fd4.9c1c20df.js b/docs/assets/js/25a43fd4.9c1c20df.js new file mode 100644 index 00000000000..9000c64c7de --- /dev/null +++ b/docs/assets/js/25a43fd4.9c1c20df.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[7739],{3797:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>d,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>h});var a=n(5893),t=n(1151);const o={title:"SharedWorker RxStorage \ud83d\udc51",slug:"rx-storage-shared-worker.html"},s="SharedWorker RxStorage",i={id:"rx-storage-shared-worker",title:"SharedWorker RxStorage \ud83d\udc51",description:"The SharedWorker RxStorage uses the SharedWorker API to run the storage inside of a separate JavaScript process in browsers. Compared to a normal WebWorker, the SharedWorker is created exactly once, even when there are multiple browser tabs opened. Because of having exactly one worker, multiple performance optimizations can be done because the storage itself does not have to handle multiple opened database connections.",source:"@site/docs/rx-storage-shared-worker.md",sourceDirName:".",slug:"/rx-storage-shared-worker.html",permalink:"/rx-storage-shared-worker.html",draft:!1,unlisted:!1,editUrl:"https://github.com/pubkey/rxdb/tree/master/docs-src/docs/rx-storage-shared-worker.md",tags:[],version:"current",frontMatter:{title:"SharedWorker RxStorage \ud83d\udc51",slug:"rx-storage-shared-worker.html"},sidebar:"tutorialSidebar",previous:{title:"Worker RxStorage \ud83d\udc51",permalink:"/rx-storage-worker.html"},next:{title:"Memory Synced RxStorage \ud83d\udc51",permalink:"/rx-storage-memory-synced.html"}},d={},h=[{value:"Usage",id:"usage",level:2},{value:"On the SharedWorker process",id:"on-the-sharedworker-process",level:3},{value:"On the main process",id:"on-the-main-process",level:3},{value:"Pre-build workers",id:"pre-build-workers",level:2},{value:"Passing in a SharedWorker instance",id:"passing-in-a-sharedworker-instance",level:2},{value:"Replication with SharedWorker",id:"replication-with-sharedworker",level:2}];function l(e){const r={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,t.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.h1,{id:"sharedworker-rxstorage",children:"SharedWorker RxStorage"}),"\n",(0,a.jsxs)(r.p,{children:["The SharedWorker ",(0,a.jsx)(r.a,{href:"/rx-storage.html",children:"RxStorage"})," uses the ",(0,a.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker",children:"SharedWorker API"})," to run the storage inside of a separate JavaScript process ",(0,a.jsx)(r.strong,{children:"in browsers"}),". Compared to a normal ",(0,a.jsx)(r.a,{href:"/rx-storage-worker.html",children:"WebWorker"}),", the SharedWorker is created exactly once, even when there are multiple browser tabs opened. Because of having exactly one worker, multiple performance optimizations can be done because the storage itself does not have to handle multiple opened database connections."]}),"\n",(0,a.jsxs)(r.p,{children:[(0,a.jsx)(r.strong,{children:"NOTICE:"})," This plugin is part of ",(0,a.jsx)(r.a,{href:"/premium",children:"\ud83d\udc51 RxDB premium"}),". It is not part of the default RxDB module."]}),"\n",(0,a.jsx)(r.h2,{id:"usage",children:"Usage"}),"\n",(0,a.jsx)(r.h3,{id:"on-the-sharedworker-process",children:"On the SharedWorker process"}),"\n",(0,a.jsxs)(r.p,{children:["In the worker process JavaScript file, you have wrap the original RxStorage with ",(0,a.jsx)(r.code,{children:"getRxStorageIndexedDB()"}),"."]}),"\n",(0,a.jsx)(r.pre,{children:(0,a.jsx)(r.code,{className:"language-ts",children:"// shared-worker.ts\n\nimport { exposeWorkerRxStorage } from 'rxdb-premium/plugins/storage-worker';\nimport { \n getRxStorageIndexedDB\n} from 'rxdb-premium/plugins/indexeddb';\n\nexposeWorkerRxStorage({\n /**\n * You can wrap any implementation of the RxStorage interface\n * into a worker.\n * Here we use the IndexedDB RxStorage.\n */\n storage: getRxStorageIndexedDB()\n});\n"})}),"\n",(0,a.jsx)(r.h3,{id:"on-the-main-process",children:"On the main process"}),"\n",(0,a.jsx)(r.pre,{children:(0,a.jsx)(r.code,{className:"language-ts",children:"import {\n createRxDatabase\n} from 'rxdb';\nimport { getRxStorageSharedWorker } from 'rxdb-premium/plugins/storage-worker';\nimport { getRxStorageIndexedDB } from 'rxdb/plugins/storage-indexeddb';\n\n\nconst database = await createRxDatabase({\n name: 'mydatabase',\n storage: getRxStorageSharedWorker(\n {\n /**\n * Contains any value that can be used as parameter\n * to the SharedWorker constructor of thread.js\n * Most likely you want to put the path to the shared-worker.js file in here.\n * \n * @link https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker?retiredLocale=de\n */\n workerInput: 'path/to/shared-worker.js',\n /**\n * (Optional) options\n * for the worker.\n */\n workerOptions: {\n type: 'module',\n credentials: 'omit'\n }\n }\n )\n});\n"})}),"\n",(0,a.jsx)(r.h2,{id:"pre-build-workers",children:"Pre-build workers"}),"\n",(0,a.jsxs)(r.p,{children:["The ",(0,a.jsx)(r.code,{children:"shared-worker.js"})," must be a self containing JavaScript file that contains all dependencies in a bundle.\nTo make it easier for you, RxDB ships with pre-bundles worker files that are ready to use.\nYou can find them in the folder ",(0,a.jsx)(r.code,{children:"node_modules/rxdb-premium/dist/workers"})," after you have installed the ",(0,a.jsx)(r.a,{href:"/premium",children:"\ud83d\udc51 RxDB Premium Plugin"}),". From there you can copy them to a location where it can be served from the webserver and then use their path to create the ",(0,a.jsx)(r.code,{children:"RxDatabase"})]}),"\n",(0,a.jsxs)(r.p,{children:["Any valid ",(0,a.jsx)(r.code,{children:"worker.js"})," JavaScript file can be used both, for normal Workers and SharedWorkers."]}),"\n",(0,a.jsx)(r.pre,{children:(0,a.jsx)(r.code,{className:"language-ts",children:"import {\n createRxDatabase\n} from 'rxdb';\nimport { getRxStorageSharedWorker } from 'rxdb-premium/plugins/storage-worker';\nconst database = await createRxDatabase({\n name: 'mydatabase',\n storage: getRxStorageSharedWorker(\n {\n /**\n * Path to where the copied file from node_modules/rxdb-premium/dist/workers\n * is reachable from the webserver.\n */\n workerInput: '/indexeddb.shared-worker.js'\n }\n )\n});\n"})}),"\n",(0,a.jsx)(r.h2,{id:"passing-in-a-sharedworker-instance",children:"Passing in a SharedWorker instance"}),"\n",(0,a.jsxs)(r.p,{children:["Instead of setting an url as ",(0,a.jsx)(r.code,{children:"workerInput"}),", you can also specify a function that returns a new ",(0,a.jsx)(r.code,{children:"SharedWorker"})," instance when called. This is mostly used when you have a custom worker file and dynamically import it.\nThis works equal to the ",(0,a.jsx)(r.a,{href:"/rx-storage-worker.html#passing-in-a-worker-instance",children:"workerInput of the Worker Storage"})]}),"\n",(0,a.jsx)(r.h2,{id:"replication-with-sharedworker",children:"Replication with SharedWorker"}),"\n",(0,a.jsxs)(r.p,{children:["When a SharedWorker RxStorage is used, it is recommended to run the replication ",(0,a.jsx)(r.strong,{children:"inside"})," of the worker. You can do that by opening another ",(0,a.jsx)(r.a,{href:"/rx-database.html",children:"RxDatabase"})," inside of it and starting the replication there."]}),"\n",(0,a.jsx)(r.pre,{children:(0,a.jsx)(r.code,{className:"language-ts",children:"// shared-worker.ts\n\nimport { exposeSharedWorkerRxStorage } from 'rxdb-premium/plugins/storage-worker';\nimport { \n getRxStorageIndexedDB\n} from 'rxdb-premium/plugins/storage-indexeddb';\nimport {\n createRxDatabase,\n addRxPlugin\n} from 'rxdb';\nimport {\n RxDBReplicationGraphQLPlugin\n} from 'rxdb/plugins/replication-graphql';\naddRxPlugin(RxDBReplicationGraphQLPlugin);\n\nconst baseStorage = getRxStorageIndexedDB();\n\n// first expose the RxStorage to the outside\nexposeSharedWorkerRxStorage({\n storage: baseStorage\n});\n\n/**\n * Then create a normal RxDatabase and RxCollections\n * and start the replication.\n */\nconst database = await createRxDatabase({\n name: 'mydatabase',\n /**\n * Important: INSIDE of your SharedWorker, you can\n * be sure that there is exactly one instance running.\n * Therefore you MUST set multiInstance=false for better performance.\n */\n multiInstance: false,\n storage: baseStorage\n});\nawait db.addCollections({\n humans: {/* ... */}\n});\nconst replicationState = db.humans.syncGraphQL({/* ... */});\n"})})]})}function c(e={}){const{wrapper:r}={...(0,t.a)(),...e.components};return r?(0,a.jsx)(r,{...e,children:(0,a.jsx)(l,{...e})}):l(e)}},1151:(e,r,n)=>{n.d(r,{Z:()=>i,a:()=>s});var a=n(7294);const t={},o=a.createContext(t);function s(e){const r=a.useContext(o);return a.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function i(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),a.createElement(o.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/docs/assets/js/6187b59a.20f1333d.js b/docs/assets/js/6187b59a.20f1333d.js deleted file mode 100644 index 5d9f73ba043..00000000000 --- a/docs/assets/js/6187b59a.20f1333d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[7987],{6846:(e,r,o)=>{o.r(r),o.d(r,{assets:()=>d,contentTitle:()=>s,default:()=>l,frontMatter:()=>n,metadata:()=>i,toc:()=>c});var t=o(5893),a=o(1151);const n={title:"Worker RxStorage \ud83d\udc51",slug:"rx-storage-worker.html"},s="Worker RxStorage",i={id:"rx-storage-worker",title:"Worker RxStorage \ud83d\udc51",description:"With the worker plugin, you can put the RxStorage of your database inside of a WebWorker (in browsers) or a Worker Thread (in node.js). By doing so, you can take CPU load from the main process and move it into the worker's process which can improve the perceived performance of your application. Notice that for browsers, it is recommend to use the SharedWorker instead to get a better performance.",source:"@site/docs/rx-storage-worker.md",sourceDirName:".",slug:"/rx-storage-worker.html",permalink:"/rx-storage-worker.html",draft:!1,unlisted:!1,editUrl:"https://github.com/pubkey/rxdb/tree/master/docs-src/docs/rx-storage-worker.md",tags:[],version:"current",frontMatter:{title:"Worker RxStorage \ud83d\udc51",slug:"rx-storage-worker.html"},sidebar:"tutorialSidebar",previous:{title:"Remote RxStorage",permalink:"/rx-storage-remote.html"},next:{title:"SharedWorker RxStorage \ud83d\udc51",permalink:"/rx-storage-shared-worker.html"}},d={},c=[{value:"On the worker process",id:"on-the-worker-process",level:2},{value:"On the main process",id:"on-the-main-process",level:2},{value:"Pre-build workers",id:"pre-build-workers",level:2},{value:"One worker per database",id:"one-worker-per-database",level:2}];function h(e){const r={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",strong:"strong",...(0,a.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h1,{id:"worker-rxstorage",children:"Worker RxStorage"}),"\n",(0,t.jsxs)(r.p,{children:["With the worker plugin, you can put the ",(0,t.jsx)(r.code,{children:"RxStorage"})," of your database inside of a WebWorker (in browsers) or a Worker Thread (in node.js). By doing so, you can take CPU load from the main process and move it into the worker's process which can improve the perceived performance of your application. Notice that for browsers, it is recommend to use the ",(0,t.jsx)(r.a,{href:"/rx-storage-shared-worker.html",children:"SharedWorker"})," instead to get a better performance."]}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.strong,{children:"NOTICE:"})," This plugin is part of ",(0,t.jsx)(r.a,{href:"/premium",children:"\ud83d\udc51 RxDB premium"}),". It is not part of the default RxDB module."]}),"\n",(0,t.jsx)(r.h2,{id:"on-the-worker-process",children:"On the worker process"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"// worker.ts\n\nimport { exposeWorkerRxStorage } from 'rxdb-premium/plugins/storage-worker';\nimport { getRxStorageLoki } from 'rxdb/plugins/storage-lokijs';\n\nexposeWorkerRxStorage({\n /**\n * You can wrap any implementation of the RxStorage interface\n * into a worker.\n * Here we use the LokiJS RxStorage.\n */\n storage: getRxStorageLoki()\n});\n"})}),"\n",(0,t.jsx)(r.h2,{id:"on-the-main-process",children:"On the main process"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"import {\n createRxDatabase\n} from 'rxdb';\nimport { getRxStorageWorker } from 'rxdb-premium/plugins/storage-worker';\n\nconst database = await createRxDatabase({\n name: 'mydatabase',\n storage: getRxStorageWorker(\n {\n /**\n * Contains any value that can be used as parameter\n * to the Worker constructor of thread.js\n * Most likely you want to put the path to the worker.js file in here.\n * \n * @link https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker\n */\n workerInput: 'path/to/worker.js',\n /**\n * (Optional) options\n * for the worker.\n */\n workerOptions: {\n type: 'module',\n credentials: 'omit'\n }\n }\n )\n});\n"})}),"\n",(0,t.jsx)(r.h2,{id:"pre-build-workers",children:"Pre-build workers"}),"\n",(0,t.jsxs)(r.p,{children:["The ",(0,t.jsx)(r.code,{children:"worker.js"})," must be a self containing JavaScript file that contains all dependencies in a bundle.\nTo make it easier for you, RxDB ships with pre-bundles worker files that are ready to use.\nYou can find them in the folder ",(0,t.jsx)(r.code,{children:"node_modules/rxdb-premium/dist/workers"})," after you have installed the ",(0,t.jsx)(r.a,{href:"/premium",children:"\ud83d\udc51 RxDB Premium Plugin"}),". From there you can copy them to a location where it can be served from the webserver and then use their path to create the ",(0,t.jsx)(r.code,{children:"RxDatabase"}),"."]}),"\n",(0,t.jsxs)(r.p,{children:["Any valid ",(0,t.jsx)(r.code,{children:"worker.js"})," JavaScript file can be used both, for normal Workers and SharedWorkers."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"import {\n createRxDatabase\n} from 'rxdb';\nimport { getRxStorageWorker } from 'rxdb-premium/plugins/storage-worker';\nconst database = await createRxDatabase({\n name: 'mydatabase',\n storage: getRxStorageWorker(\n {\n /**\n * Path to where the copied file from node_modules/rxdb/dist/workers\n * is reachable from the webserver.\n */\n workerInput: '/lokijs-incremental-indexeddb.worker.js'\n }\n )\n});\n"})}),"\n",(0,t.jsx)(r.h2,{id:"one-worker-per-database",children:"One worker per database"}),"\n",(0,t.jsxs)(r.p,{children:["Each call to ",(0,t.jsx)(r.code,{children:"getRxStorageWorker()"})," will create a different worker instance so that when you have more then one ",(0,t.jsx)(r.code,{children:"RxDatabase"}),", each database will have its own JavaScript worker process."]}),"\n",(0,t.jsxs)(r.p,{children:["To reuse the worker instance in more than one ",(0,t.jsx)(r.code,{children:"RxDatabase"}),", you can store the output of ",(0,t.jsx)(r.code,{children:"getRxStorageWorker()"})," into a variable an use that one. Reusing the worker can decrease the initial page load, but you might get slower database operations."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"// Call getRxStorageWorker() exactly once\nconst workerStorage = getRxStorageWorker({\n workerInput: 'path/to/worker.js'\n});\n\n// use the same storage for both databases.\nconst databaseOne = await createRxDatabase({\n name: 'database-one',\n storage: workerStorage\n});\nconst databaseTwo = await createRxDatabase({\n name: 'database-two',\n storage: workerStorage\n});\n\n"})})]})}function l(e={}){const{wrapper:r}={...(0,a.a)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(h,{...e})}):h(e)}},1151:(e,r,o)=>{o.d(r,{Z:()=>i,a:()=>s});var t=o(7294);const a={},n=t.createContext(a);function s(e){const r=t.useContext(n);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function i(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),t.createElement(n.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/docs/assets/js/6187b59a.4ca02723.js b/docs/assets/js/6187b59a.4ca02723.js new file mode 100644 index 00000000000..6e38e61aa86 --- /dev/null +++ b/docs/assets/js/6187b59a.4ca02723.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[7987],{6846:(e,r,o)=>{o.r(r),o.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>h,frontMatter:()=>a,metadata:()=>i,toc:()=>d});var t=o(5893),n=o(1151);const a={title:"Worker RxStorage \ud83d\udc51",slug:"rx-storage-worker.html"},s="Worker RxStorage",i={id:"rx-storage-worker",title:"Worker RxStorage \ud83d\udc51",description:"With the worker plugin, you can put the RxStorage of your database inside of a WebWorker (in browsers) or a Worker Thread (in node.js). By doing so, you can take CPU load from the main process and move it into the worker's process which can improve the perceived performance of your application. Notice that for browsers, it is recommend to use the SharedWorker instead to get a better performance.",source:"@site/docs/rx-storage-worker.md",sourceDirName:".",slug:"/rx-storage-worker.html",permalink:"/rx-storage-worker.html",draft:!1,unlisted:!1,editUrl:"https://github.com/pubkey/rxdb/tree/master/docs-src/docs/rx-storage-worker.md",tags:[],version:"current",frontMatter:{title:"Worker RxStorage \ud83d\udc51",slug:"rx-storage-worker.html"},sidebar:"tutorialSidebar",previous:{title:"Remote RxStorage",permalink:"/rx-storage-remote.html"},next:{title:"SharedWorker RxStorage \ud83d\udc51",permalink:"/rx-storage-shared-worker.html"}},c={},d=[{value:"On the worker process",id:"on-the-worker-process",level:2},{value:"On the main process",id:"on-the-main-process",level:2},{value:"Pre-build workers",id:"pre-build-workers",level:2},{value:"One worker per database",id:"one-worker-per-database",level:2},{value:"Passing in a Worker instance",id:"passing-in-a-worker-instance",level:2}];function l(e){const r={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",strong:"strong",...(0,n.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h1,{id:"worker-rxstorage",children:"Worker RxStorage"}),"\n",(0,t.jsxs)(r.p,{children:["With the worker plugin, you can put the ",(0,t.jsx)(r.code,{children:"RxStorage"})," of your database inside of a WebWorker (in browsers) or a Worker Thread (in node.js). By doing so, you can take CPU load from the main process and move it into the worker's process which can improve the perceived performance of your application. Notice that for browsers, it is recommend to use the ",(0,t.jsx)(r.a,{href:"/rx-storage-shared-worker.html",children:"SharedWorker"})," instead to get a better performance."]}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.strong,{children:"NOTICE:"})," This plugin is part of ",(0,t.jsx)(r.a,{href:"/premium",children:"\ud83d\udc51 RxDB premium"}),". It is not part of the default RxDB module."]}),"\n",(0,t.jsx)(r.h2,{id:"on-the-worker-process",children:"On the worker process"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"// worker.ts\n\nimport { exposeWorkerRxStorage } from 'rxdb-premium/plugins/storage-worker';\nimport { getRxStorageLoki } from 'rxdb/plugins/storage-lokijs';\n\nexposeWorkerRxStorage({\n /**\n * You can wrap any implementation of the RxStorage interface\n * into a worker.\n * Here we use the LokiJS RxStorage.\n */\n storage: getRxStorageLoki()\n});\n"})}),"\n",(0,t.jsx)(r.h2,{id:"on-the-main-process",children:"On the main process"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"import {\n createRxDatabase\n} from 'rxdb';\nimport { getRxStorageWorker } from 'rxdb-premium/plugins/storage-worker';\n\nconst database = await createRxDatabase({\n name: 'mydatabase',\n storage: getRxStorageWorker(\n {\n /**\n * Contains any value that can be used as parameter\n * to the Worker constructor of thread.js\n * Most likely you want to put the path to the worker.js file in here.\n * \n * @link https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker\n */\n workerInput: 'path/to/worker.js',\n /**\n * (Optional) options\n * for the worker.\n */\n workerOptions: {\n type: 'module',\n credentials: 'omit'\n }\n }\n )\n});\n"})}),"\n",(0,t.jsx)(r.h2,{id:"pre-build-workers",children:"Pre-build workers"}),"\n",(0,t.jsxs)(r.p,{children:["The ",(0,t.jsx)(r.code,{children:"worker.js"})," must be a self containing JavaScript file that contains all dependencies in a bundle.\nTo make it easier for you, RxDB ships with pre-bundles worker files that are ready to use.\nYou can find them in the folder ",(0,t.jsx)(r.code,{children:"node_modules/rxdb-premium/dist/workers"})," after you have installed the ",(0,t.jsx)(r.a,{href:"/premium",children:"\ud83d\udc51 RxDB Premium Plugin"}),". From there you can copy them to a location where it can be served from the webserver and then use their path to create the ",(0,t.jsx)(r.code,{children:"RxDatabase"}),"."]}),"\n",(0,t.jsxs)(r.p,{children:["Any valid ",(0,t.jsx)(r.code,{children:"worker.js"})," JavaScript file can be used both, for normal Workers and SharedWorkers."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"import {\n createRxDatabase\n} from 'rxdb';\nimport { getRxStorageWorker } from 'rxdb-premium/plugins/storage-worker';\nconst database = await createRxDatabase({\n name: 'mydatabase',\n storage: getRxStorageWorker(\n {\n /**\n * Path to where the copied file from node_modules/rxdb/dist/workers\n * is reachable from the webserver.\n */\n workerInput: '/lokijs-incremental-indexeddb.worker.js'\n }\n )\n});\n"})}),"\n",(0,t.jsx)(r.h2,{id:"one-worker-per-database",children:"One worker per database"}),"\n",(0,t.jsxs)(r.p,{children:["Each call to ",(0,t.jsx)(r.code,{children:"getRxStorageWorker()"})," will create a different worker instance so that when you have more then one ",(0,t.jsx)(r.code,{children:"RxDatabase"}),", each database will have its own JavaScript worker process."]}),"\n",(0,t.jsxs)(r.p,{children:["To reuse the worker instance in more than one ",(0,t.jsx)(r.code,{children:"RxDatabase"}),", you can store the output of ",(0,t.jsx)(r.code,{children:"getRxStorageWorker()"})," into a variable an use that one. Reusing the worker can decrease the initial page load, but you might get slower database operations."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"// Call getRxStorageWorker() exactly once\nconst workerStorage = getRxStorageWorker({\n workerInput: 'path/to/worker.js'\n});\n\n// use the same storage for both databases.\nconst databaseOne = await createRxDatabase({\n name: 'database-one',\n storage: workerStorage\n});\nconst databaseTwo = await createRxDatabase({\n name: 'database-two',\n storage: workerStorage\n});\n\n"})}),"\n",(0,t.jsx)(r.h2,{id:"passing-in-a-worker-instance",children:"Passing in a Worker instance"}),"\n",(0,t.jsxs)(r.p,{children:["Instead of setting an url as ",(0,t.jsx)(r.code,{children:"workerInput"}),", you can also specify a function that returns a new ",(0,t.jsx)(r.code,{children:"Worker"})," instance when called."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"getRxStorageWorker({\n workerInput: () => new Worker('path/to/worker.js')\n})\n"})}),"\n",(0,t.jsxs)(r.p,{children:["This can be helpful for environments where the worker is build dynamically by the bundler. For example in angular you would create a ",(0,t.jsx)(r.code,{children:"my-custom.worker.ts"})," file that contains a custom build worker and then import it."]}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"const storage = getRxStorageWorker({\n workerInput: () => new Worker(new URL('./my-custom.worker', import.meta.url)),\n});\n"})}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"//> my-custom.worker.ts\nimport { exposeWorkerRxStorage } from 'rxdb-premium/plugins/storage-worker';\nimport { getRxStorageLoki } from 'rxdb/plugins/storage-lokijs';\n\nexposeWorkerRxStorage({\n storage: getRxStorageLoki()\n});\n"})})]})}function h(e={}){const{wrapper:r}={...(0,n.a)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},1151:(e,r,o)=>{o.d(r,{Z:()=>i,a:()=>s});var t=o(7294);const n={},a=t.createContext(n);function s(e){const r=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function i(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:s(e.components),t.createElement(a.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/docs/assets/js/6560.071ab844.js b/docs/assets/js/6560.7fe8753b.js similarity index 62% rename from docs/assets/js/6560.071ab844.js rename to docs/assets/js/6560.7fe8753b.js index 2f6cbd8842c..4e3b335bfbb 100644 --- a/docs/assets/js/6560.071ab844.js +++ b/docs/assets/js/6560.7fe8753b.js @@ -1 +1 @@ -(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[6560],{7782:(e,t,n)=>{"use strict";n.d(t,{F:()=>r});var r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this._parallels=e||1,this._qC=0,this._iC=new Set,this._lHN=0,this._hPM=new Map,this._pHM=new Map};function o(e,t){if(t){if(t._timeoutObj&&clearTimeout(t._timeoutObj),e._pHM.has(t)){var n=e._pHM.get(t);e._hPM.delete(n),e._pHM.delete(t)}e._iC.delete(t)}}function i(e){e._tryIR||0===e._iC.size||(e._tryIR=!0,setTimeout((function(){e.isIdle()?setTimeout((function(){e.isIdle()?(!function(e){0!==e._iC.size&&(e._iC.values().next().value._manRes(),setTimeout((function(){return i(e)}),0))}(e),e._tryIR=!1):e._tryIR=!1}),0):e._tryIR=!1}),0))}r.prototype={isIdle:function(){return this._qC.",lt="String expected.",ft=[],ht="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),dt=ht,pt=ht,yt="__dbnames",vt="readonly",mt="readwrite";function bt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var gt={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function wt(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=C(t))[e],t}}function _t(){throw Z.Type()}function xt(e,t){try{var n=kt(e),r=kt(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return ti+u&&o(i+d)}))}))}return o(0).then((function(){if(0=c})).forEach((function(e){h.push((function(){var t=p,n=e._cfg.dbschema;_n(r,t,f),_n(r,n,f),p=r._dbSchema=n;var o=mn(t,n);o.add.forEach((function(e){bn(f,e[0],e[1].primKey,e[1].indexes)})),o.change.forEach((function(e){if(e.recreate)throw new Z.Upgrade("Not yet support for changing primary key");var t=f.objectStore(e.name);e.add.forEach((function(e){return gn(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),gn(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var u=e._cfg.contentUpgrade;if(u&&e._cfg.version>c){hn(r,f),l._memoizedTables={},y=!0;var s=O(n);o.del.forEach((function(e){s[e]=t[e]})),pn(r,[r.Transaction.prototype]),dn(r,[r.Transaction.prototype],i(s),s),l.schema=s;var a,h=B(u);return h&&Qe(),o=Ce.follow((function(){var e;(a=u(l))&&h&&(e=Ye.bind(null,null),a.then(e,e))})),a&&"function"==typeof a.then?Ce.resolve(a):o.then((function(){return a}))}})),h.push((function(t){var n,o,i;y&&dt||(n=e._cfg.dbschema,o=n,i=t,[].slice.call(i.db.objectStoreNames).forEach((function(e){return null==o[e]&&i.db.deleteObjectStore(e)}))),pn(r,[r.Transaction.prototype]),dn(r,[r.Transaction.prototype],r._storeNames,r._dbSchema),l.schema=r._dbSchema}))})),function e(){return h.length?Ce.resolve(h.shift()(l.idbtrans)).then(e):Ce.resolve()}().then((function(){var e,t;t=f,i(e=p).forEach((function(n){t.db.objectStoreNames.contains(n)||bn(t,n,e[n].primKey,e[n].indexes)}))})).catch(s))}))}function mn(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var o=e[n],i=t[n];if(o){var u={name:n,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||o.primKey.auto!==i.primKey.auto&&!ht)u.recreate=!0,r.change.push(u);else{var s=o.idxByName,a=i.idxByName,c=void 0;for(c in s)a[c]||u.del.push(c);for(c in a){var l=s[c],f=a[c];l?l.src!==f.src&&u.change.push(f):u.add.push(f)}(0Math.pow(2,62)?0:r.oldVersion,l=r<1,e.idbdb=a.result,vn(e,r/10,c,u))}),u),a.onsuccess=Ue((function(){c=null;var n,o,u,f,h,d=e.idbdb=a.result,p=b(d.objectStoreNames);if(0t.limit?n.length=t.limit:e.length===t.limit&&n.length=r.limit&&(!r.values||e.req.values)&&or(e.req.query.range,r.query.range)})),!1,o,i];case"count":return u=i.find((function(e){return rr(e.req.query.range,r.query.range)})),[u,!!u,o,i]}}(n,r,"query",e),a=s[0],c=s[1],l=s[2],f=s[3];return a&&c?a.obsSet=e.obsSet:(c=o.query(e).then((function(e){var n=e.result;if(a.res=n,t){for(var r=0,o=n.length;r{"use strict";n.d(t,{j:()=>u});var r=n(7761),o=n(1645),i=n(6250);class u{constructor(e,t){this.pipeline=e,this.options=(0,r.Tc)(t)}stream(e){let t=(0,o.oM)(e);const n=this.options.processingMode;n!=r.qD.CLONE_ALL&&n!=r.qD.CLONE_INPUT||t.map(i.Xh);const u=new Array;if(!(0,i.xb)(this.pipeline))for(const o of this.pipeline){const e=Object.keys(o),n=e[0],s=(0,r.jQ)(r.$M.PIPELINE,n,this.options);(0,i.hu)(1===e.length&&!!s,`invalid pipeline operator ${n}`),u.push(n),t=s(t,o[n],this.options)}return(n==r.qD.CLONE_OUTPUT||n==r.qD.CLONE_ALL&&(0,i.jV)([["$group","$unwind"],u]).length)&&t.map(i.Xh),t}run(e){return this.stream(e).value()}}},7761:(e,t,n)=>{"use strict";n.d(t,{$M:()=>o,Cw:()=>u,Kr:()=>p,Qs:()=>l,Tc:()=>s,jQ:()=>f,qD:()=>r});var r,o,i=n(6250);!function(e){e.CLONE_ALL="CLONE_ALL",e.CLONE_INPUT="CLONE_INPUT",e.CLONE_OUTPUT="CLONE_OUTPUT",e.CLONE_OFF="CLONE_OFF"}(r||(r={}));class u{constructor(e,t,n,r=Date.now()){this._opts=e,this._root=t,this._local=n,this.timestamp=r,this.update(t,n)}static init(e,t,n){return e instanceof u?new u(e._opts,(0,i.kK)(e.root)?t:e.root,Object.assign({},e.local,n)):new u(e,t,n)}update(e,t){var n;return this._root=e,this._local=t?Object.assign({},t,{variables:Object.assign({},null===(n=this._local)||void 0===n?void 0:n.variables,null==t?void 0:t.variables)}):t,this}getOptions(){return Object.freeze(Object.assign(Object.assign({},this._opts),{context:a.from(this._opts.context)}))}get root(){return this._root}get local(){return this._local}get idKey(){return this._opts.idKey}get collation(){var e;return null===(e=this._opts)||void 0===e?void 0:e.collation}get processingMode(){var e;return(null===(e=this._opts)||void 0===e?void 0:e.processingMode)||r.CLONE_OFF}get useStrictMode(){var e;return null===(e=this._opts)||void 0===e?void 0:e.useStrictMode}get scriptEnabled(){var e;return null===(e=this._opts)||void 0===e?void 0:e.scriptEnabled}get useGlobalContext(){var e;return null===(e=this._opts)||void 0===e?void 0:e.useGlobalContext}get hashFunction(){var e;return null===(e=this._opts)||void 0===e?void 0:e.hashFunction}get collectionResolver(){var e;return null===(e=this._opts)||void 0===e?void 0:e.collectionResolver}get jsonSchemaValidator(){var e;return null===(e=this._opts)||void 0===e?void 0:e.jsonSchemaValidator}get variables(){var e;return null===(e=this._opts)||void 0===e?void 0:e.variables}get context(){var e;return null===(e=this._opts)||void 0===e?void 0:e.context}}function s(e){return e instanceof u?e.getOptions():Object.freeze(Object.assign(Object.assign({idKey:"_id",scriptEnabled:!0,useStrictMode:!0,useGlobalContext:!0,processingMode:r.CLONE_OFF},e),{context:(null==e?void 0:e.context)?a.from(null==e?void 0:e.context):a.init({})}))}!function(e){e.ACCUMULATOR="accumulator",e.EXPRESSION="expression",e.PIPELINE="pipeline",e.PROJECTION="projection",e.QUERY="query",e.WINDOW="window"}(o||(o={}));class a{constructor(e){this.operators={[o.ACCUMULATOR]:{},[o.EXPRESSION]:{},[o.PIPELINE]:{},[o.PROJECTION]:{},[o.QUERY]:{},[o.WINDOW]:{}};for(const[t,n]of Object.entries(e))this.addOperators(t,n)}static init(e={}){return new a(e)}static from(e){return new a(e.operators)}addOperators(e,t){for(const[n,r]of Object.entries(t))this.getOperator(e,n)||(this.operators[e][n]=r);return this}addAccumulatorOps(e){return this.addOperators(o.ACCUMULATOR,e)}addExpressionOps(e){return this.addOperators(o.EXPRESSION,e)}addQueryOps(e){return this.addOperators(o.QUERY,e)}addPipelineOps(e){return this.addOperators(o.PIPELINE,e)}addProjectionOps(e){return this.addOperators(o.PROJECTION,e)}addWindowOps(e){return this.addOperators(o.WINDOW,e)}getOperator(e,t){return e in this.operators&&this.operators[e][t]||null}}const c=a.init();function l(e,t){for(const[n,r]of Object.entries(t)){(0,i.hu)((0,i.mf)(r)&&(0,i.S6)(n),`'${n}' is not a valid operator`);const t=f(e,n,null);(0,i.hu)(!t||r===t,`${n} already exists for '${e}' operators. Cannot change operator function once registered.`)}switch(e){case o.ACCUMULATOR:c.addAccumulatorOps(t);break;case o.EXPRESSION:c.addExpressionOps(t);break;case o.PIPELINE:c.addPipelineOps(t);break;case o.PROJECTION:c.addProjectionOps(t);break;case o.QUERY:c.addQueryOps(t);break;case o.WINDOW:c.addWindowOps(t)}}function f(e,t,n){const{context:r,useGlobalContext:o}=n||{},i=r?r.getOperator(e,t):null;return!i&&o?c.getOperator(e,t):i}const h={$$ROOT:(e,t,n)=>n.root,$$CURRENT:(e,t,n)=>e,$$REMOVE(e,t,n){},$$NOW:(e,t,n)=>new Date(n.timestamp)},d={$$KEEP:(e,t,n)=>e,$$PRUNE(e,t,n){},$$DESCEND(e,t,n){if(!(0,i.e$)(t,"$cond"))return e;let r;for(const[o,u]of Object.entries(e))if((0,i.yD)(u)){if(u instanceof Array){const e=[];for(let r of u)(0,i.Kn)(r)&&(r=y(r,t,n.update(r))),(0,i.kK)(r)||e.push(r);r=e}else r=y(u,t,n.update(u));(0,i.kK)(r)?delete e[o]:e[o]=r}return e}};function p(e,t,n,r){var s;const a=u.init(r,e);if(n=n||"",(0,i.S6)(n)){const u=f(o.EXPRESSION,n,r);if(u)return u(e,t,a);const s=f(o.ACCUMULATOR,n,r);if(s)return e instanceof Array||(e=p(e,t,null,a),t=null),(0,i.hu)(e instanceof Array,`'${n}' target must be an array.`),s(e,t,a.update(null,a.local));throw new Error(`operator '${n}' is not registered`)}if((0,i.HD)(t)&&t.length>0&&"$"===t[0]){if((0,i.e$)(d,t))return t;let n=a.root;const r=t.split(".");if((0,i.e$)(h,r[0]))n=h[r[0]](e,null,a),t=t.slice(r[0].length+1);else if("$$"===r[0].slice(0,2)){n=Object.assign({},a.variables,{this:e},null===(s=a.local)||void 0===s?void 0:s.variables);const o=r[0].slice(2);(0,i.hu)((0,i.e$)(n,o),`Use of undefined variable: ${o}`),t=t.slice(2)}else t=t.slice(1);return""===t?n:(0,i.DB)(n,t)}if((0,i.kJ)(t))return t.map((t=>p(e,t,null,a)));if((0,i.Kn)(t)){const n={};for(const[u,s]of Object.entries(t))if(n[u]=p(e,s,u,a),[o.EXPRESSION,o.ACCUMULATOR].some((e=>!!f(e,u,r))))return(0,i.hu)(1===Object.keys(t).length,"Invalid aggregation expression '"+JSON.stringify(t)+"'"),n[u];return n}return t}function y(e,t,n){const r=p(e,t,null,n);return(0,i.e$)(d,r)?d[r](e,t,n):r}},1645:(e,t,n)=>{"use strict";function r(e){return e instanceof a?e:new a(e)}function o(...e){let t=0;return r((()=>{for(;tr,qC:()=>o});const u=new Error;var s;!function(e){e[e.MAP=0]="MAP",e[e.FILTER=1]="FILTER",e[e.TAKE=2]="TAKE",e[e.DROP=3]="DROP"}(s||(s={}));class a{constructor(e){let t;if(this.iteratees=[],this.yieldedValues=[],this.isDone=!1,e instanceof Function&&(e={next:e}),(n=e)&&"object"==typeof n&&(null==n?void 0:n.next)instanceof Function){const n=e;t=()=>{const e=n.next();if(e.done)throw u;return e.value}}else if(e instanceof Array){const n=e,r=n.length;let o=0;t=()=>{if(o0?this.push(s.TAKE,e):this}drop(e){return e>0?this.push(s.DROP,e):this}transform(e){const t=this;let n;return r((()=>(n||(n=r(e(t.value()))),n.next())))}value(){return this.isDone||(this.isDone=this.getNext(!0).done),this.yieldedValues}each(e){for(;;){const t=this.next();if(t.done)break;if(!1===e(t.value))return!1}return!0}reduce(e,t){let n=this.next();for(void 0!==t||n.done||(t=n.value,n=this.next());!n.done;)t=e(t,n.value),n=this.next();return t}size(){return this.reduce(((e,t)=>++e),0)}[Symbol.iterator](){return this}}},7469:(e,t,n)=>{"use strict";n.d(t,{FI:()=>l,G6:()=>b,GO:()=>m,HG:()=>d,IS:()=>f,JD:()=>v,Ns:()=>g,QH:()=>w,Ty:()=>h,ey:()=>A,hk:()=>s,iG:()=>u,l3:()=>a,m9:()=>y,ny:()=>c,ok:()=>p,rr:()=>x});var r=n(7761),o=n(7132),i=n(6250);function u(e){const t=(t,n,r)=>{const o={unwrapArray:!0},u=Math.max(1,t.split(".").length-1);return s=>{const a=(0,i.DB)(s,t,o);return e(a,n,Object.assign(Object.assign({},r),{depth:u}))}};return t.op="query",t}function s(e){return(t,n,o)=>{const i=(0,r.Kr)(t,n,null,o);return e(...i)}}function a(e,t,n){if((0,i.Xy)(e,t))return!0;if((0,i.kK)(e)&&(0,i.kK)(t))return!0;if(e instanceof Array){const r=i.Xy.bind(null,t);return e.some(r)||(0,i.xH)(e,null==n?void 0:n.depth).some(r)}return!1}function c(e,t,n){return!a(e,t,n)}function l(e,t,n){return(0,i.kK)(e)?t.some((e=>null===e)):(0,i.jV)([(0,i.rY)(e),t],null==n?void 0:n.hashFunction).length>0}function f(e,t,n){return!l(e,t,n)}function h(e,t,n){return j(e,t,((e,t)=>(0,i.qu)(e,t)<0))}function d(e,t,n){return j(e,t,((e,t)=>(0,i.qu)(e,t)<=0))}function p(e,t,n){return j(e,t,((e,t)=>(0,i.qu)(e,t)>0))}function y(e,t,n){return j(e,t,((e,t)=>(0,i.qu)(e,t)>=0))}function v(e,t,n){return(0,i.rY)(e).some((e=>2===t.length&&e%t[0]===t[1]))}function m(e,t,n){const r=(0,i.rY)(e),o=e=>(0,i.HD)(e)&&(0,i.yb)(t.exec(e),null==n?void 0:n.useStrictMode);return r.some(o)||(0,i.xH)(r,1).some(o)}function b(e,t,n){return(!1===t||0===t)&&void 0===e||(!0===t||1===t)&&void 0!==e}function g(e,t,n){if(!((0,i.kJ)(e)&&(0,i.kJ)(t)&&e.length&&t.length))return!1;let r=!0;for(const o of t){if(!r)break;r=(0,i.Kn)(o)&&(0,i.d3)(Object.keys(o),"$elemMatch")?x(e,o.$elemMatch,n):o instanceof RegExp?e.some((e=>"string"==typeof e&&o.test(e))):e.some((e=>(0,i.Xy)(o,e)))}return r}function w(e,t,n){return Array.isArray(e)&&e.length===t}function _(e){return(0,i.S6)(e)&&-1===["$and","$or","$nor"].indexOf(e)}function x(e,t,n){if((0,i.kJ)(e)&&!(0,i.xb)(e)){let r=e=>e,i=t;Object.keys(t).every(_)&&(i={temp:t},r=e=>({temp:e}));const u=new o.A(i,n);for(let t=0,n=e.length;tnull===e,O=e=>(0,i.hj)(e)&&e>=i.xm&&e<=i.n1&&-1===e.toString().indexOf("."),E=e=>(0,i.hj)(e)&&e>=i.Hu&&e<=i.JV&&-1===e.toString().indexOf("."),P={array:i.kJ,bool:i.jn,boolean:i.jn,date:i.J_,decimal:i.hj,double:i.hj,int:O,long:E,number:i.hj,null:k,object:i.Kn,regex:i.Kj,regexp:i.Kj,string:i.HD,undefined:i.kK,function:e=>{throw new Error("unsupported type key `function`.")},1:i.hj,2:i.HD,3:i.Kn,4:i.kJ,6:i.kK,8:i.jn,9:i.J_,10:k,11:i.Kj,16:O,18:E,19:i.hj};function S(e,t,n){const r=P[t];return!!r&&r(e)}function A(e,t,n){return Array.isArray(t)?t.findIndex((t=>S(e,t)))>=0:S(e,t)}function j(e,t,n){return(0,i.rY)(e).some((e=>(0,i.oL)(e)===(0,i.oL)(t)&&n(e,t)))}},6496:(e,t,n)=>{"use strict";n.d(t,{FM:()=>p,E3:()=>i});var r=n(7761),o=n(6250);n(1645);n(8123);new WeakMap;const i=(e,t,n)=>{if((0,o.xb)(t)||!(0,o.Kn)(t))return e;let r=o.qu;const i=n.collation;return(0,o.Kn)(i)&&(0,o.HD)(i.locale)&&(r=function(e){const t={sensitivity:u[e.strength||3],caseFirst:"off"===e.caseFirst?"false":e.caseFirst||"false",numeric:e.numericOrdering||!1,ignorePunctuation:"shifted"===e.alternate};!0===(e.caseLevel||!1)&&("base"===t.sensitivity&&(t.sensitivity="case"),"accent"===t.sensitivity&&(t.sensitivity="variant"));const n=new Intl.Collator(e.locale,t);return(e,t)=>{if(!(0,o.HD)(e)||!(0,o.HD)(t))return(0,o.qu)(e,t);const r=n.compare(e,t);return r<0?-1:r>0?1:0}}(i)),e.transform((e=>{const i=Object.keys(t);for(const u of i.reverse()){const i=(0,o.vM)(e,(e=>(0,o.DB)(e,u)),n.hashFunction),s=Array.from(i.keys()).sort(r);-1===t[u]&&s.reverse(),e=[],s.reduce(((e,t)=>(0,o.gi)(e,i.get(t))),e)}return e}))},u={1:"base",2:"accent",3:"variant"};new Set(["$denseRank","$documentNumber","$first","$last","$linearFill","$rank","$shift"]),new Set(["$denseRank","$expMovingAvg","$linearFill","$locf","$rank","$shift"]);n(7132);var s=n(7469);(0,s.hk)(s.IS);const a=(e,t)=>(n,i,u)=>{(0,o.hu)((0,o.kJ)(i),`${e}: expression must be an array.`);const s=(0,r.Kr)(n,i,null,u);return s.some(o.kK)?null:((0,o.hu)(s.every(o.hj),`${e}: expression must evalue to array of numbers.`),t(s))};a("$bitAnd",(e=>e.reduce(((e,t)=>e&t),-1))),a("$bitOr",(e=>e.reduce(((e,t)=>e|t),0))),a("$bitXor",(e=>e.reduce(((e,t)=>e^t),0))),(0,s.hk)(s.l3),(0,s.hk)(s.ok),(0,s.hk)(s.m9),(0,s.hk)(s.Ty),(0,s.hk)(s.HG),(0,s.hk)(s.ny);const c=(e,t)=>{const n={};return e.split("").forEach(((e,r)=>n[e]=t*(r+1))),n};Object.assign(Object.assign(Object.assign({},c("ABCDEFGHIKLM",1)),c("NOPQRSTUVWXY",-1)),{Z:0});const l={undefined:null,null:null,NaN:NaN,Infinity:new Error,"-Infinity":new Error};function f(e,t=l){const n=Object.assign({},l,t),o=new Set(Object.keys(n));return(t,i,u)=>{const s=(0,r.Kr)(t,i,null,u);if(o.has(`${s}`)){const t=n[`${s}`];if(t instanceof Error)throw new Error(`cannot apply $${e.name} to -inf, value must in (-inf,inf)`);return t}return e(s)}}f(Math.acos,{Infinity:1/0,0:new Error}),f(Math.acosh,{Infinity:1/0,0:new Error}),f(Math.asin),f(Math.asinh,{Infinity:1/0,"-Infinity":-1/0}),f(Math.atan),f(Math.atanh,{1:1/0,"-1":-1/0}),f(Math.cos),f(Math.cosh,{"-Infinity":1/0,Infinity:1/0});const h=Math.PI/180,d=(f((e=>e*h),{Infinity:1/0,"-Infinity":1/0}),180/Math.PI);f((e=>e*d),{Infinity:1/0,"-Infinity":-1/0}),f(Math.sin),f(Math.sinh,{"-Infinity":-1/0,Infinity:1/0}),f(Math.tan);const p=(e,t,n)=>{if((0,o.xb)(t))return e;let i=Object.keys(t),u=!1;v(t,n);const s=n.idKey;if((0,o.d3)(i,s)){const e=t[s];0!==e&&!1!==e||(i=i.filter(o.Nl.bind(null,[s])),u=0==i.length)}else i.push(s);const a=r.Cw.init(n);return e.map((e=>y(e,t,a.update(e),i,u)))};function y(e,t,n,i,u){let s={},a=!1,c=!1;const l=[];u&&l.push(n.idKey);for(const f of i){let i;const u=t[f];if(f!==n.idKey&&(0,o.d3)([0,!1],u)&&(c=!0),f===n.idKey&&(0,o.xb)(u))i=e[f];else if((0,o.HD)(u))i=(0,r.Kr)(e,u,f,n);else if((0,o.d3)([1,!0],u));else if(u instanceof Array)i=u.map((t=>{const i=(0,r.Kr)(e,t,null,n);return(0,o.kK)(i)?null:i}));else{if(!(0,o.Kn)(u)){l.push(f);continue}{const t=u,s=Object.keys(u),c=1==s.length?s[0]:"",l=(0,r.jQ)(r.$M.PROJECTION,c,n);if(l)"$slice"===c?(0,o.rY)(t[c]).every(o.hj)?(i=l(e,t[c],f,n),a=!0):i=(0,r.Kr)(e,t,f,n):i=l(e,t[c],f,n);else if((0,o.S6)(c))i=(0,r.Kr)(e,t[c],c,n);else if((0,o.e$)(e,f)){v(t,n);let r=e[f];r instanceof Array?i=r.map((e=>y(e,t,n,s,!1))):(r=(0,o.Kn)(r)?r:e,i=y(r,t,n,s,!1))}else i=(0,r.Kr)(e,u,null,n)}}const h=(0,o.hB)(e,f,{preserveMissing:!0});void 0!==h&&(0,o.TS)(s,h,{flatten:!0}),(0,o.Nl)([0,1,!1,!0],u)&&(void 0===i?(0,o.fY)(s,f,{descendArray:!0}):(0,o.sO)(s,f,i))}if((0,o.TO)(s),(a||c||u)&&(s=(0,o.gi)({},e,s),l.length>0))for(const r of l)(0,o.fY)(s,r,{descendArray:!0});return s}function v(e,t){const n=[!1,!1];for(const[r,i]of Object.entries(e)){if(r===(null==t?void 0:t.idKey))return;0===i||!1===i?n[0]=!0:1!==i&&!0!==i||(n[1]=!0),(0,o.hu)(!(n[0]&&n[1]),"Projection cannot have a mix of inclusion and exclusion.")}}},5308:(e,t,n)=>{"use strict";n.d(t,{rr:()=>o,QH:()=>i});var r=n(7469);(0,r.iG)(r.Ns);const o=(0,r.iG)(r.rr),i=(0,r.iG)(r.QH)},3516:(e,t,n)=>{"use strict";n.d(t,{l3:()=>o,ok:()=>i,m9:()=>u,FI:()=>s,Ty:()=>a,HG:()=>c,ny:()=>l,IS:()=>f});var r=n(7469);const o=(0,r.iG)(r.l3),i=(0,r.iG)(r.ok),u=(0,r.iG)(r.m9),s=(0,r.iG)(r.FI),a=(0,r.iG)(r.Ty),c=(0,r.iG)(r.HG),l=(0,r.iG)(r.ny),f=(0,r.iG)(r.IS)},2106:(e,t,n)=>{"use strict";n.d(t,{G:()=>o,e:()=>i});var r=n(7469);const o=(0,r.iG)(r.G6),i=(0,r.iG)(r.ey)},8039:(e,t,n)=>{"use strict";n.d(t,{JD:()=>o,GO:()=>i});n(7761);var r=n(7469);const o=(0,r.iG)(r.JD),i=(0,r.iG)(r.GO);n(6250)},6851:(e,t,n)=>{"use strict";n.d(t,{h$:()=>i,ps:()=>s,_w:()=>a,Ko:()=>u});var r=n(7132),o=n(6250);const i=(e,t,n)=>{(0,o.hu)((0,o.kJ)(t),"Invalid expression: $and expects value to be an Array.");const i=t.map((e=>new r.A(e,n)));return e=>i.every((t=>t.test(e)))},u=(e,t,n)=>{(0,o.hu)((0,o.kJ)(t),"Invalid expression. $or expects value to be an Array");const i=t.map((e=>new r.A(e,n)));return e=>i.some((t=>t.test(e)))},s=(e,t,n)=>{(0,o.hu)((0,o.kJ)(t),"Invalid expression. $nor expects value to be an array.");const r=u("$or",t,n);return e=>!r(e)},a=(e,t,n)=>{const i={};i[e]=(0,o.Fv)(t);const u=new r.A(i,n);return e=>!u.test(e)}},7132:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(7761),o=n(8123),i=n(1645),u=n(6250);class s{constructor(e,t,n,r){this.source=e,this.predicate=t,this.projection=n,this.options=r,this.operators=[],this.result=null,this.buffer=[]}fetch(){return this.result||((0,u.Kn)(this.projection)&&this.operators.push({$project:this.projection}),this.result=(0,i.oM)(this.source).filter(this.predicate),this.operators.length>0&&(this.result=new o.j(this.operators,this.options).stream(this.result))),this.result}fetchAll(){const e=(0,i.oM)([...this.buffer]);return this.buffer=[],(0,i.qC)(e,this.fetch())}all(){return this.fetchAll().value()}count(){return this.all().length}skip(e){return this.operators.push({$skip:e}),this}limit(e){return this.operators.push({$limit:e}),this}sort(e){return this.operators.push({$sort:e}),this}collation(e){return this.options=Object.assign(Object.assign({},this.options),{collation:e}),this}next(){if(this.buffer.length>0)return this.buffer.pop();const e=this.fetch().next();return e.done?void 0:e.value}hasNext(){if(this.buffer.length>0)return!0;const e=this.fetch().next();return!e.done&&(this.buffer.push(e.value),!0)}map(e){return this.all().map(e)}forEach(e){this.all().forEach(e)}[Symbol.iterator](){return this.fetchAll()}}class a{constructor(e,t){this.condition=e,this.options=(0,r.Tc)(t),this.compiled=[],this.compile()}compile(){(0,u.hu)((0,u.Kn)(this.condition),`query criteria must be an object: ${JSON.stringify(this.condition)}`);const e={};for(const[t,n]of Object.entries(this.condition)){if("$where"===t)Object.assign(e,{field:t,expr:n});else if((0,u.d3)(["$and","$or","$nor","$expr","$jsonSchema"],t))this.processOperator(t,t,n);else{(0,u.hu)(!(0,u.S6)(t),`unknown top level operator: ${t}`);for(const[e,r]of Object.entries((0,u.Fv)(n)))this.processOperator(t,e,r)}e.field&&this.processOperator(e.field,e.field,e.expr)}}processOperator(e,t,n){const o=(0,r.jQ)(r.$M.QUERY,t,this.options);if(!o)throw new Error(`unknown operator ${t}`);const i=o(e,n,this.options);this.compiled.push(i)}test(e){for(let t=0,n=this.compiled.length;tthis.test(e)),t||{},this.options)}remove(e){return e.reduce(((e,t)=>(this.test(t)||e.push(t),e)),[])}}},6250:(e,t,n)=>{"use strict";n.d(t,{DB:()=>te,Fv:()=>le,HD:()=>S,Hu:()=>u,JV:()=>i,J_:()=>T,Kj:()=>K,Kn:()=>C,Nl:()=>q,S6:()=>ce,TO:()=>re,TS:()=>z,Xh:()=>O,Xy:()=>W,d3:()=>R,e$:()=>$,fY:()=>se,gi:()=>Z,hB:()=>ne,hj:()=>A,hu:()=>k,jV:()=>H,jn:()=>P,kJ:()=>j,kK:()=>D,mf:()=>M,n1:()=>r,oL:()=>E,qu:()=>x,rY:()=>L,sO:()=>ue,vM:()=>Q,xH:()=>V,xb:()=>N,xm:()=>o,yD:()=>I,yb:()=>B});const r=2147483647,o=-2147483648,i=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,s=Symbol("missing"),a=Object.freeze(new Error("mingo: cycle detected while processing object/array")),c=Object.getPrototypeOf([]),l=Object.getPrototypeOf({}),f=/^\[object ([a-zA-Z0-9]+)\]$/;class h{}class d{}const p=e=>null===e?h:void 0===e?d:e.constructor,y=e=>{const t=function(e){const t=new Set,n=e=>{const r=p(e);if(w.has(r))return w.get(r)(e);const o=r===Object?"":r.name;if(M(e.toJSON))return`${o}(${JSON.stringify(e)})`;if(t.has(e))throw a;t.add(e);try{if(r===Array)return"["+e.map(n).join(",")+"]";if(r!==Object){const[t,r]=J(e);if(j(e))return`${o}${n([...e,t])}`;e=t}const t=Object.keys(e);return t.sort(),`${o}{`+t.map((t=>`${t}:${n(e[t])}`)).join(",")+"}"}finally{t.delete(e)}};return n(e)}(e);let n=0,r=t.length;for(;r;)n=(n<<5)-n^t.charCodeAt(--r);return n>>>0},v=new Set(["null","undefined","boolean","number","string","date","regexp"]),m=new Set([d,h,Boolean,String,Number]),b=e=>e.toString(),g=e=>`${p(e).name}[${e.toString()}]`,w=new Map([[Number,b],[Boolean,b],[RegExp,b],[Function,b],[Symbol,b],[Date,e=>e.toISOString()],[String,JSON.stringify],[h,e=>"null"],[d,e=>"undefined"],[Int8Array,g],[Uint8Array,g],[Uint8ClampedArray,g],[Int16Array,g],[Uint16Array,g],[Int32Array,g],[Uint32Array,g],[Float32Array,g],[Float64Array,g]]);"undefined"!=typeof BigInt&&w.set(BigInt,(e=>"0x"+e.toString(16))),"undefined"!=typeof BigInt64Array&&w.set(BigInt64Array,g),"undefined"!=typeof BigUint64Array&&w.set(BigUint64Array,g);const _={null:0,undefined:0,number:1,string:2,object:3,array:4,boolean:5,date:6,regexp:7,function:8},x=(e,t)=>{e===s&&(e=void 0),t===s&&(t=void 0);const[n,r]=[e,t].map((e=>_[E(e).toLowerCase()]));return n!==r?n-r:1===n||2===n||6===n?et?1:0:W(e,t)?0:et?1:0};function k(e,t){if(!e)throw new Error(t)}const O=e=>{if(m.has(p(e)))return e;const t=new Set,n=e=>{if(t.has(e))throw a;const r=p(e);if(m.has(r))return e;try{if(j(e))return t.add(e),e.map(n);if(C(e)){t.add(e);const r={};for(const t in e)r[t]=n(e[t]);return r}}finally{t.delete(e)}return r===Date||r===RegExp||(e=>{const t=Object.getPrototypeOf(p(e));return t&&"TypedArray"===t.name})(e)?new r(e):e};return n(e)},E=e=>f.exec(Object.prototype.toString.call(e))[1],P=e=>"boolean"==typeof e,S=e=>"string"==typeof e,A=e=>!isNaN(e)&&"number"==typeof e,j=Array.isArray,C=e=>{if(!e)return!1;const t=Object.getPrototypeOf(e);return(t===l||null===t)&&"[object Object]"===Object.prototype.toString.call(e)},I=e=>e===Object(e),T=e=>e instanceof Date,K=e=>e instanceof RegExp,M=e=>"function"==typeof e,D=e=>null==e,R=(e,t)=>e.includes(t),q=(e,t)=>!R(e,t),B=(e,t=!0)=>!!e||t&&""===e,N=e=>D(e)||S(e)&&!e||e instanceof Array&&0===e.length||C(e)&&0===Object.keys(e).length,F=e=>e===s,L=e=>e instanceof Array?e:[e],$=(e,t)=>!!e&&Object.prototype.hasOwnProperty.call(e,t),U=(e,t)=>C(e)&&C(t)||j(e)&&j(t);function z(e,t,n){if(n=n||{flatten:!1},F(e)||D(e))return t;if(F(t)||D(t))return e;if(!U(e,t)){if(n.skipValidation)return t||e;throw Error("mismatched types. must both be array or object")}if(n.skipValidation=!0,j(e)){const r=e,o=t;if(n.flatten){let e=0,i=0;for(;e{const i=X(r,t);n.has(i)?n.get(i).some((t=>W(e[t],r)))||n.get(i).push(o):n.set(i,[o])})),n}function H(e,t=y){if(e.some((e=>0==e.length)))return[];if(1===e.length)return Array.from(e);const n=function(e,t,n=x){if(N(e))return e;const r=new Array,o=new Array;for(let i=0;in(e[0],t[0]))),Z(o,r.map((e=>e[1])))}(e.map(((e,t)=>[t,e.length])),(e=>e[1])),r=e[n[0][0]],o=G(r,t),i=new Map,u=new Array;return o.forEach(((t,o)=>{const a=t.map((e=>r[e])),c=a.map((e=>0)),l=a.map((e=>[n[0][0],0]));let f=!1;for(let r=1;rs[e]));f=a.map(((n,u)=>e.some(((e,s)=>{const a=c[u];return W(n,e)&&(c[u]++,tt===e.length-1?[a[n],l[n]]:s)).filter((e=>e!==s)))})),u.sort(((e,t)=>{const[n,[r,o]]=e,[i,[u,s]]=t,a=x(r,u);return 0!==a?a:x(o,s)})).map((e=>e[0]))}function V(e,t=0){const n=new Array;return function e(t,r){for(let o=0,i=t.length;o0||r<0)?e(t[o],Math.max(-1,r-1)):n.push(t[o])}(e,t),n}const J=e=>{let[t,n]=[Object.getPrototypeOf(e),Object.getOwnPropertyNames(e)],r=t;for(;!n.length&&t!==l&&t!==c;)r=t,n=Object.getOwnPropertyNames(t),t=Object.getPrototypeOf(t);const o={};return n.forEach((t=>o[t]=e[t])),[o,r]};function W(e,t){const n=[[e,t]];for(;n.length>0;){if([e,t]=n.pop(),e===t)continue;const r=p(e);if(r!==p(t)||M(e))return!1;if(w.has(r)){const n=w.get(r);if(n(e)!==n(t))return!1}else{if(r!==Array&&r!==Object)return!1;{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(new Set(r.concat(o)).size!=r.length)return!1;for(const i of r)n.push([e[i],t[i]])}}}return!n.length}function X(e,t){return t=t||y,D(e)?null:t(e).toString()}function Q(e,t,n=y){if(e.length<1)return new Map;const r=new Map,o=new Map;for(let i=0;iW(e,s))):null;D(e)?(o.set(s,[u]),r.has(a)?r.get(a).push(s):r.set(a,[s])):o.get(e).push(u)}}return o}const Y=5e4;function Z(e,...t){return e instanceof Array?t.reduce(((e,t)=>{let n=Math.ceil(t.length/Y),r=0;for(;n-- >0;)Array.prototype.push.apply(e,t.slice(r,r+Y)),r+=Y;return e}),e):t.filter(I).reduce(((e,t)=>(Object.assign(e,t),e)),e)}function ee(e,t){return I(e)?e[t]:void 0}function te(e,t,n){let r=0;const o=v.has(E(e).toLowerCase())?e:function e(t,n){let o=t;for(let i=0;i0)break;r+=1;const t=n.slice(i);o=o.reduce(((n,r)=>{const o=e(r,t);return void 0!==o&&n.push(o),n}),[]);break}if(o=ee(o,t),void 0===o)break}return o}(e,t.split("."));return o instanceof Array&&(null==n?void 0:n.unwrapArray)?function(e,t){if(t<1)return e;for(;t--&&1===e.length;)e=e[0];return e}(o,r):o}function ne(e,t,n){const r=t.split("."),o=r[0],i=r.slice(1).join("."),u=null!==/^\d+$/.exec(o),a=r.length>1;let c,l;if(e instanceof Array)if(u)c=ee(e,Number(o)),a&&(c=ne(c,i,n)),c=[c];else{c=[];for(const r of e)l=ne(r,t,n),(null==n?void 0:n.preserveMissing)?(void 0===l&&(l=s),c.push(l)):void 0!==l&&c.push(l)}else{if(l=ee(e,o),a&&(l=ne(l,i,n)),void 0===l)return;c=(null==n?void 0:n.preserveKeys)?Object.assign({},e):{},c[o]=l}return c}function re(e){if(e instanceof Array)for(let t=e.length-1;t>=0;t--)e[t]===s?e.splice(t,1):re(e[t]);else if(C(e))for(const t in e)$(e,t)&&re(e[t])}const oe=/^\d+$/;function ie(e,t,n,r){const o=t.split("."),i=o[0],u=o.slice(1).join(".");if(1===o.length)(C(e)||j(e)&&oe.test(i))&&n(e,i);else{(null==r?void 0:r.buildGraph)&&D(e[i])&&(e[i]={});const t=e[i];if(!t)return;const s=!!(o.length>1&&oe.test(o[1]));t instanceof Array&&(null==r?void 0:r.descendArray)&&!s?t.forEach((e=>ie(e,u,n,r))):ie(t,u,n,r)}}function ue(e,t,n){ie(e,t,((e,t)=>{e[t]=M(n)?n(e[t]):n}),{buildGraph:!0})}function se(e,t,n){ie(e,t,((e,t)=>{if(e instanceof Array){if(/^\d+$/.test(t))e.splice(parseInt(t),1);else if(n&&n.descendArray)for(const n of e)C(n)&&delete n[t]}else C(e)&&delete e[t]}),n)}const ae=/^\$[a-zA-Z0-9_]+$/;function ce(e){return ae.test(e)}function le(e){if(v.has(E(e).toLowerCase()))return K(e)?{$regex:e}:{$eq:e};if(I(e)){const t=e;if(!Object.keys(t).some(ce))return{$eq:e};if($(e,"$regex")){const t=Object.assign({},e);return t.$regex=new RegExp(e.$regex,e.$options),delete t.$options,t}}return e}},10:(e,t,n)=>{"use strict";n.d(t,{X:()=>o});var r=n(5556),o=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return(0,r.ZT)(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(n(6974).x)},3784:(e,t,n)=>{"use strict";n.d(t,{y:()=>f});var r=n(7409),o=n(7592),i=n(3046),u=n(4512);function s(e){return 0===e.length?u.y:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var a=n(8867),c=n(8804),l=n(3323),f=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var i,u=this,s=(i=e)&&i instanceof r.Lv||function(e){return e&&(0,c.m)(e.next)&&(0,c.m)(e.error)&&(0,c.m)(e.complete)}(i)&&(0,o.Nn)(i)?e:new r.Hp(e,t,n);return(0,l.x)((function(){var e=u,t=e.operator,n=e.source;s.add(t?t.call(s,n):n?u._subscribe(s):u._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=h(t))((function(t,o){var i=new r.Hp({next:function(t){try{e(t)}catch(n){o(n),i.unsubscribe()}},error:o,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[i.L]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t{"use strict";n.d(t,{x:()=>c});var r=n(5556),o=n(3784),i=n(7592),u=(0,n(8390).d)((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),s=n(1940),a=n(3323),c=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return(0,r.ZT)(t,e),t.prototype.lift=function(e){var t=new l(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new u},t.prototype.next=function(e){var t=this;(0,a.x)((function(){var n,o;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=(0,r.XA)(t.currentObservers),u=i.next();!u.done;u=i.next()){u.value.next(e)}}catch(s){n={error:s}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;(0,a.x)((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;(0,a.x)((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,o=n.isStopped,u=n.observers;return r||o?i.Lc:(this.currentObservers=null,u.push(e),new i.w0((function(){t.currentObservers=null,(0,s.P)(u,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,o=t.isStopped;n?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new o.y;return e.source=this,e},t.create=function(e,t){return new l(e,t)},t}(o.y),l=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return(0,r.ZT)(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:i.Lc},t}(c)},7409:(e,t,n)=>{"use strict";n.d(t,{Hp:()=>m,Lv:()=>d});var r=n(5556),o=n(8804),i=n(7592),u=n(8867),s=n(5046);function a(){}var c=l("C",void 0,void 0);function l(e,t,n){return{kind:e,value:t,error:n}}var f=n(8822),h=n(3323),d=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,(0,i.Nn)(t)&&t.add(n)):n.destination=w,n}return(0,r.ZT)(t,e),t.create=function(e,t,n){return new m(e,t,n)},t.prototype.next=function(e){this.isStopped?g(function(e){return l("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?g(l("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?g(c,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(i.w0),p=Function.prototype.bind;function y(e,t){return p.call(e,t)}var v=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){b(n)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){b(n)}else b(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){b(t)}},e}(),m=function(e){function t(t,n,r){var i,s,a=e.call(this)||this;(0,o.m)(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:a&&u.v.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},i={next:t.next&&y(t.next,s),error:t.error&&y(t.error,s),complete:t.complete&&y(t.complete,s)}):i=t;return a.destination=new v(i),a}return(0,r.ZT)(t,e),t}(d);function b(e){u.v.useDeprecatedSynchronousErrorHandling?(0,h.O)(e):(0,s.h)(e)}function g(e,t){var n=u.v.onStoppedNotification;n&&f.z.setTimeout((function(){return n(e,t)}))}var w={closed:!0,next:a,error:function(e){throw e},complete:a}},7592:(e,t,n)=>{"use strict";n.d(t,{Lc:()=>a,w0:()=>s,Nn:()=>c});var r=n(5556),o=n(8804),i=(0,n(8390).d)((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}})),u=n(1940),s=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,u,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=(0,r.XA)(a),f=c.next();!f.done;f=c.next()){f.value.remove(this)}}catch(m){e={error:m}}finally{try{f&&!f.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else a.remove(this);var h=this.initialTeardown;if((0,o.m)(h))try{h()}catch(b){s=b instanceof i?b.errors:[b]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var p=(0,r.XA)(d),y=p.next();!y.done;y=p.next()){var v=y.value;try{l(v)}catch(g){s=null!=s?s:[],g instanceof i?s=(0,r.ev)((0,r.ev)([],(0,r.CR)(s)),(0,r.CR)(g.errors)):s.push(g)}}}catch(w){n={error:w}}finally{try{y&&!y.done&&(u=p.return)&&u.call(p)}finally{if(n)throw n.error}}}if(s)throw new i(s)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)l(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&(0,u.P)(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&(0,u.P)(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),a=s.EMPTY;function c(e){return e instanceof s||e&&"closed"in e&&(0,o.m)(e.remove)&&(0,o.m)(e.add)&&(0,o.m)(e.unsubscribe)}function l(e){(0,o.m)(e)?e():e.unsubscribe()}},8867:(e,t,n)=>{"use strict";n.d(t,{v:()=>r});var r={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},6871:(e,t,n)=>{"use strict";n.d(t,{z:()=>i});var r=(0,n(8390).d)((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),o=n(7409);function i(e,t){var n="object"==typeof t;return new Promise((function(i,u){var s=new o.Hp({next:function(e){i(e),s.unsubscribe()},error:u,complete:function(){n?i(t.defaultValue):u(new r)}});e.subscribe(s)}))}},8816:(e,t,n)=>{"use strict";n.d(t,{D:()=>_});var r=n(9655),o=n(6771),i=n(5348),u=n(7554);function s(e,t){return void 0===t&&(t=0),(0,i.e)((function(n,r){n.subscribe((0,u.x)(r,(function(n){return(0,o.f)(r,e,(function(){return r.next(n)}),t)}),(function(){return(0,o.f)(r,e,(function(){return r.complete()}),t)}),(function(n){return(0,o.f)(r,e,(function(){return r.error(n)}),t)})))}))}function a(e,t){return void 0===t&&(t=0),(0,i.e)((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}var c=n(3784);var l=n(134),f=n(8804);function h(e,t){if(!e)throw new Error("Iterable cannot be null");return new c.y((function(n){(0,o.f)(n,t,(function(){var r=e[Symbol.asyncIterator]();(0,o.f)(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}var d=n(1525),p=n(1330),y=n(7236),v=n(7940),m=n(8063),b=n(7238),g=n(6527);function w(e,t){if(null!=e){if((0,d.c)(e))return function(e,t){return(0,r.Xf)(e).pipe(a(t),s(t))}(e,t);if((0,y.z)(e))return function(e,t){return new c.y((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if((0,p.t)(e))return function(e,t){return(0,r.Xf)(e).pipe(a(t),s(t))}(e,t);if((0,m.D)(e))return h(e,t);if((0,v.T)(e))return function(e,t){return new c.y((function(n){var r;return(0,o.f)(n,t,(function(){r=e[l.h](),(0,o.f)(n,t,(function(){var e,t,o;try{t=(e=r.next()).value,o=e.done}catch(i){return void n.error(i)}o?n.complete():n.next(t)}),0,!0)})),function(){return(0,f.m)(null==r?void 0:r.return)&&r.return()}}))}(e,t);if((0,g.L)(e))return function(e,t){return h((0,g.Q)(e),t)}(e,t)}throw(0,b.z)(e)}function _(e,t){return t?w(e,t):(0,r.Xf)(e)}},9655:(e,t,n)=>{"use strict";n.d(t,{Xf:()=>y});var r=n(5556),o=n(7236),i=n(1330),u=n(3784),s=n(1525),a=n(8063),c=n(7238),l=n(7940),f=n(6527),h=n(8804),d=n(5046),p=n(3046);function y(e){if(e instanceof u.y)return e;if(null!=e){if((0,s.c)(e))return b=e,new u.y((function(e){var t=b[p.L]();if((0,h.m)(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if((0,o.z)(e))return m=e,new u.y((function(e){for(var t=0;t{"use strict";n.d(t,{T:()=>a});var r=n(5014),o=n(9655),i=new(n(3784).y)((function(e){return e.complete()}));var u=n(3877),s=n(8816);function a(){for(var e=[],t=0;t{"use strict";n.d(t,{x:()=>o});var r=n(5556);function o(e,t,n,r,o){return new i(e,t,n,r,o)}var i=function(e){function t(t,n,r,o,i,u){var s=e.call(this,t)||this;return s.onFinalize=i,s.shouldUnsubscribe=u,s._next=n?function(e){try{n(e)}catch(r){t.error(r)}}:e.prototype._next,s._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return(0,r.ZT)(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(n(7409).Lv)},6005:(e,t,n)=>{"use strict";n.d(t,{x:()=>u});var r=n(4512),o=n(5348),i=n(7554);function u(e,t){return void 0===t&&(t=r.y),e=null!=e?e:s,(0,o.e)((function(n,r){var o,u=!0;n.subscribe((0,i.x)(r,(function(n){var i=t(n);!u&&e(o,i)||(u=!1,o=i,r.next(n))})))}))}function s(e,t){return e===t}},6621:(e,t,n)=>{"use strict";n.d(t,{h:()=>i});var r=n(5348),o=n(7554);function i(e,t){return(0,r.e)((function(n,r){var i=0;n.subscribe((0,o.x)(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}},598:(e,t,n)=>{"use strict";n.d(t,{U:()=>i});var r=n(5348),o=n(7554);function i(e,t){return(0,r.e)((function(n,r){var i=0;n.subscribe((0,o.x)(r,(function(n){r.next(e.call(t,n,i++))})))}))}},5014:(e,t,n)=>{"use strict";n.d(t,{J:()=>i});var r=n(1556),o=n(4512);function i(e){return void 0===e&&(e=1/0),(0,r.z)(o.y,e)}},1556:(e,t,n)=>{"use strict";n.d(t,{z:()=>c});var r=n(598),o=n(9655),i=n(5348),u=n(6771),s=n(7554);var a=n(8804);function c(e,t,n){return void 0===n&&(n=1/0),(0,a.m)(t)?c((function(n,i){return(0,r.U)((function(e,r){return t(n,e,i,r)}))((0,o.Xf)(e(n,i)))}),n):("number"==typeof t&&(n=t),(0,i.e)((function(t,r){return function(e,t,n,r,i,a,c,l){var f=[],h=0,d=0,p=!1,y=function(){!p||f.length||h||t.complete()},v=function(e){return h{"use strict";n.d(t,{b:()=>l});var r=n(5556),o=n(5348),i=Array.isArray;var u=n(5014),s=n(3877),a=n(8816);function c(){for(var e=[],t=0;t{"use strict";n.d(t,{d:()=>f});var r=n(5556),o=n(6974),i={now:function(){return(i.delegate||Date).now()},delegate:void 0},u=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=i);var o=e.call(this)||this;return o._bufferSize=t,o._windowTime=n,o._timestampProvider=r,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,n),o}return(0,r.ZT)(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,o=n._buffer,i=n._infiniteTimeWindow,u=n._timestampProvider,s=n._windowTime;r||(o.push(t),!i&&o.push(u.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),o=0;o0&&(t=new a.Hp({next:function(e){return b.next(e)},error:function(e){p=!0,y(),r=l(v,i,e),b.error(e)},complete:function(){h=!0,y(),r=l(v,f),b.complete()}}),(0,s.Xf)(e).subscribe(t))}))(e)}}({connector:function(){return new u(h,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:d})}},6728:(e,t,n)=>{"use strict";n.d(t,{O:()=>a});var r=n(5014);var o=n(3877),i=n(8816);function u(){for(var e=[],t=0;t{"use strict";n.d(t,{z:()=>o});var r=n(5556),o={setTimeout:function(e,t){for(var n=[],i=2;i{"use strict";n.d(t,{h:()=>r});var r="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"},3046:(e,t,n)=>{"use strict";n.d(t,{L:()=>r});var r="function"==typeof Symbol&&Symbol.observable||"@@observable"},3877:(e,t,n)=>{"use strict";n.d(t,{_6:()=>u,yG:()=>i});var r=n(8804);function o(e){return e[e.length-1]}function i(e){return(t=o(e))&&(0,r.m)(t.schedule)?e.pop():void 0;var t}function u(e,t){return"number"==typeof o(e)?e.pop():t}},1940:(e,t,n)=>{"use strict";function r(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}n.d(t,{P:()=>r})},8390:(e,t,n)=>{"use strict";function r(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}n.d(t,{d:()=>r})},3323:(e,t,n)=>{"use strict";n.d(t,{O:()=>u,x:()=>i});var r=n(8867),o=null;function i(e){if(r.v.useDeprecatedSynchronousErrorHandling){var t=!o;if(t&&(o={errorThrown:!1,error:null}),e(),t){var n=o,i=n.errorThrown,u=n.error;if(o=null,i)throw u}}else e()}function u(e){r.v.useDeprecatedSynchronousErrorHandling&&o&&(o.errorThrown=!0,o.error=e)}},6771:(e,t,n)=>{"use strict";function r(e,t,n,r,o){void 0===r&&(r=0),void 0===o&&(o=!1);var i=t.schedule((function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(i),!o)return i}n.d(t,{f:()=>r})},4512:(e,t,n)=>{"use strict";function r(e){return e}n.d(t,{y:()=>r})},7236:(e,t,n)=>{"use strict";n.d(t,{z:()=>r});var r=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},8063:(e,t,n)=>{"use strict";n.d(t,{D:()=>o});var r=n(8804);function o(e){return Symbol.asyncIterator&&(0,r.m)(null==e?void 0:e[Symbol.asyncIterator])}},8804:(e,t,n)=>{"use strict";function r(e){return"function"==typeof e}n.d(t,{m:()=>r})},1525:(e,t,n)=>{"use strict";n.d(t,{c:()=>i});var r=n(3046),o=n(8804);function i(e){return(0,o.m)(e[r.L])}},7940:(e,t,n)=>{"use strict";n.d(t,{T:()=>i});var r=n(134),o=n(8804);function i(e){return(0,o.m)(null==e?void 0:e[r.h])}},1330:(e,t,n)=>{"use strict";n.d(t,{t:()=>o});var r=n(8804);function o(e){return(0,r.m)(null==e?void 0:e.then)}},6527:(e,t,n)=>{"use strict";n.d(t,{L:()=>u,Q:()=>i});var r=n(5556),o=n(8804);function i(e){return(0,r.FC)(this,arguments,(function(){var t,n,o;return(0,r.Jh)(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,(0,r.qq)(t.read())];case 3:return n=i.sent(),o=n.value,n.done?[4,(0,r.qq)(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,(0,r.qq)(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function u(e){return(0,o.m)(null==e?void 0:e.getReader)}},5348:(e,t,n)=>{"use strict";n.d(t,{e:()=>o});var r=n(8804);function o(e){return function(t){if(function(e){return(0,r.m)(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}},5046:(e,t,n)=>{"use strict";n.d(t,{h:()=>i});var r=n(8867),o=n(8822);function i(e){o.z.setTimeout((function(){var t=r.v.onUnhandledError;if(!t)throw e;t(e)}))}},7238:(e,t,n)=>{"use strict";function r(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}n.d(t,{z:()=>r})},75:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==r(t)?t:String(t)}function i(e,t){for(var n=0;nu})},3219:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(6983);function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(0,r.Z)(e,t)}},6983:(e,t,n)=>{"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}n.d(t,{Z:()=>r})},8953:(e,t,n)=>{"use strict";function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}n.d(t,{Z:()=>u});var o=n(6983);function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(i=function(){return!!e})()}function u(e){var t="function"==typeof Map?new Map:void 0;return u=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(i())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var u=new(e.bind.apply(e,r));return n&&(0,o.Z)(u,n.prototype),u}(e,arguments,r(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),(0,o.Z)(n,e)},u(e)}},3981:(e,t,n)=>{"use strict";n.d(t,{g0:()=>K});Promise.resolve(!1),Promise.resolve(!0);var r=Promise.resolve();function o(e,t){return e||(e=0),new Promise((function(n){return setTimeout((function(){return n(t)}),e)}))}function i(){return Math.random().toString(36).substring(2)}var u=0;function s(){var e=1e3*Date.now();return e<=u&&(e=u+1),u=e,e}var a={create:function(e){var t={time:s(),messagesCallback:null,bc:new BroadcastChannel(e),subFns:[]};return t.bc.onmessage=function(e){t.messagesCallback&&t.messagesCallback(e.data)},t},close:function(e){e.bc.close(),e.subFns=[]},onMessage:function(e,t){e.messagesCallback=t},postMessage:function(e,t){try{return e.bc.postMessage(t,!1),r}catch(n){return Promise.reject(n)}},canBeUsed:function(){if("undefined"!=typeof globalThis&&globalThis.Deno&&globalThis.Deno.args)return!0;if("undefined"==typeof window&&"undefined"==typeof self||"function"!=typeof BroadcastChannel)return!1;if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0},type:"native",averageResponseTime:function(){return 150},microSeconds:s},c=n(5898);function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=JSON.parse(JSON.stringify(e));return void 0===t.webWorkerSupport&&(t.webWorkerSupport=!0),t.idb||(t.idb={}),t.idb.ttl||(t.idb.ttl=45e3),t.idb.fallbackInterval||(t.idb.fallbackInterval=150),e.idb&&"function"==typeof e.idb.onclose&&(t.idb.onclose=e.idb.onclose),t.localstorage||(t.localstorage={}),t.localstorage.removeTimeout||(t.localstorage.removeTimeout=6e4),e.methods&&(t.methods=e.methods),t.node||(t.node={}),t.node.ttl||(t.node.ttl=12e4),t.node.maxParallelWrites||(t.node.maxParallelWrites=2048),void 0===t.node.useFastPath&&(t.node.useFastPath=!0),t}var f="pubkey.broadcast-channel-0-",h="messages",d={durability:"relaxed"};function p(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){if(void 0!==window.mozIndexedDB)return window.mozIndexedDB;if(void 0!==window.webkitIndexedDB)return window.webkitIndexedDB;if(void 0!==window.msIndexedDB)return window.msIndexedDB}return!1}function y(e){e.commit&&e.commit()}function v(e,t){var n=e.transaction(h,"readonly",d),r=n.objectStore(h),o=[],i=IDBKeyRange.bound(t+1,1/0);if(r.getAll){var u=r.getAll(i);return new Promise((function(e,t){u.onerror=function(e){return t(e)},u.onsuccess=function(t){e(t.target.result)}}))}return new Promise((function(e,u){var s=function(){try{return i=IDBKeyRange.bound(t+1,1/0),r.openCursor(i)}catch(e){return r.openCursor()}}();s.onerror=function(e){return u(e)},s.onsuccess=function(r){var i=r.target.result;i?i.value.ide.lastCursorId&&(e.lastCursorId=t.id),t})).filter((function(t){return function(e,t){return!(e.uuid===t.uuid||t.eMIs.has(e.id)||e.data.time0||e._addEL.internal.length>0}function R(e,t,n){e._addEL[t].push(n),function(e){if(!e._iL&&D(e)){var t=function(t){e._addEL[t.type].forEach((function(e){t.time>=e.time&&e.fn(t.data)}))},n=e.method.microSeconds();e._prepP?e._prepP.then((function(){e._iL=!0,e.method.onMessage(e._state,t,n)})):(e._iL=!0,e.method.onMessage(e._state,t,n))}}(e)}function q(e,t,n){e._addEL[t]=e._addEL[t].filter((function(e){return e!==n})),function(e){if(e._iL&&!D(e)){e._iL=!1;var t=e.method.microSeconds();e.method.onMessage(e._state,null,t)}}(e)}K._pubkey=!0,K.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return M(this,"message",e)},postInternal:function(e){return M(this,"internal",e)},set onmessage(e){var t={time:this.method.microSeconds(),fn:e};q(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,R(this,"message",t)):this._onML=null},addEventListener:function(e,t){R(this,e,{time:this.method.microSeconds(),fn:t})},removeEventListener:function(e,t){q(this,e,this._addEL[e].find((function(e){return e.fn===t})))},close:function(){var e=this;if(!this.closed){I.delete(this),this.closed=!0;var t=this._prepP?this._prepP:r;return this._onML=null,this._addEL.message=[],t.then((function(){return Promise.all(Array.from(e._uMP))})).then((function(){return Promise.all(e._befC.map((function(e){return e()})))})).then((function(){return e.method.close(e._state)}))}},get type(){return this.method.type},get isClosed(){return this.closed}}},8061:(e,t,n)=>{"use strict";n.d(t,{U:()=>i});var r=n(3340);const o=Symbol.for("Dexie"),i=globalThis[o]||(globalThis[o]=r);if(r.semVer!==i.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${r.semVer} and ${i.semVer}`);const{liveQuery:u,mergeRanges:s,rangesOverlap:a,RangeSet:c,cmp:l,Entity:f}=i},8456:(e,t,n)=>{"use strict";n.d(t,{Rf:()=>N,wu:()=>F});const r=e=>{e.previousResults.unshift(e.changeEvent.doc),e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,e.changeEvent.doc)},o=e=>{e.previousResults.push(e.changeEvent.doc),e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,e.changeEvent.doc)},i=e=>{const t=e.previousResults.shift();e.keyDocumentMap&&t&&e.keyDocumentMap.delete(t[e.queryParams.primaryKey])},u=e=>{const t=e.previousResults.pop();e.keyDocumentMap&&t&&e.keyDocumentMap.delete(t[e.queryParams.primaryKey])},s=e=>{e.keyDocumentMap&&e.keyDocumentMap.delete(e.changeEvent.id);const t=e.queryParams.primaryKey,n=e.previousResults;for(let r=0;r{const t=e.changeEvent.id,n=e.changeEvent.doc;if(e.keyDocumentMap){if(e.keyDocumentMap.has(t))return;e.keyDocumentMap.set(t,n)}else{if(e.previousResults.find((n=>n[e.queryParams.primaryKey]===t)))return}!function(e,t,n,r){var o,i=e.length,u=i-1,s=0;if(0===i)return e.push(t),0;for(;r<=u;)n(o=e[s=r+(u-r>>1)],t)<=0?r=s+1:u=s-1;n(o,t)<=0&&s++,e.splice(s,0,t)}(e.previousResults,n,e.queryParams.sortComparator,0)},c=["doNothing","insertFirst","insertLast","removeFirstItem","removeLastItem","removeFirstInsertLast","removeLastInsertFirst","removeFirstInsertFirst","removeLastInsertLast","removeExisting","replaceExisting","alwaysWrong","insertAtSortPosition","removeExistingAndInsertAtSortPosition","runFullQueryAgain","unknownAction"],l={doNothing:e=>{},insertFirst:r,insertLast:o,removeFirstItem:i,removeLastItem:u,removeFirstInsertLast:e=>{i(e),o(e)},removeLastInsertFirst:e=>{u(e),r(e)},removeFirstInsertFirst:e=>{i(e),r(e)},removeLastInsertLast:e=>{u(e),o(e)},removeExisting:s,replaceExisting:e=>{const t=e.changeEvent.doc,n=e.queryParams.primaryKey,r=e.previousResults;for(let o=0;o{const t={_id:"wrongHuman"+(new Date).getTime()};e.previousResults.length=0,e.previousResults.push(t),e.keyDocumentMap&&(e.keyDocumentMap.clear(),e.keyDocumentMap.set(t._id,t))},insertAtSortPosition:a,removeExistingAndInsertAtSortPosition:e=>{s(e),a(e)},runFullQueryAgain:e=>{throw new Error("Action runFullQueryAgain must be implemented by yourself")},unknownAction:e=>{throw new Error("Action unknownAction should never be called")}};!function(e=6){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let r=0;r!!e.queryParams.limit,b=e=>1===e.queryParams.limit,g=e=>!!(e.queryParams.skip&&e.queryParams.skip>0),w=e=>"DELETE"===e.changeEvent.operation,_=e=>"INSERT"===e.changeEvent.operation,x=e=>"UPDATE"===e.changeEvent.operation,k=e=>m(e)&&e.previousResults.length>=e.queryParams.limit,O=e=>{const t=e.queryParams.sortFields,n=e.changeEvent.previous,r=e.changeEvent.doc;if(!r)return!1;if(!n)return!0;for(let o=0;o{const t=e.changeEvent.id;if(e.keyDocumentMap){return e.keyDocumentMap.has(t)}{const n=e.queryParams.primaryKey,r=e.previousResults;for(let e=0;e{const t=e.previousResults[0];return!(!t||t[e.queryParams.primaryKey]!==e.changeEvent.id)},S=e=>{const t=p(e.previousResults);return!(!t||t[e.queryParams.primaryKey]!==e.changeEvent.id)},A=e=>{const t=e.changeEvent.previous;if(!t)return!1;const n=e.previousResults[0];if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)<0},j=e=>{const t=e.changeEvent.previous;if(!t)return!1;const n=p(e.previousResults);if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)>0},C=e=>{const t=e.changeEvent.doc;if(!t)return!1;const n=e.previousResults[0];if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)<0},I=e=>{const t=e.changeEvent.doc;if(!t)return!1;const n=p(e.previousResults);if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)>0},T=e=>{const t=e.changeEvent.previous;return!!t&&e.queryParams.queryMatcher(t)},K=e=>{const t=e.changeEvent.doc;if(!t)return!1;return e.queryParams.queryMatcher(t)},M=e=>0===e.previousResults.length,D={0:_,1:x,2:w,3:m,4:b,5:g,6:M,7:k,8:P,9:S,10:O,11:E,12:A,13:j,14:C,15:I,16:T,17:K};let R;function q(){return R||(R=function(e){const t=new Map,n=2+2*parseInt(e.charAt(0)+e.charAt(1),10),r=f(e.substring(2,n),2);for(let a=0;afunction(e,t,n){let r=e,o=e.l;for(;;){if(r=r[t[o](n)?"1":"0"],"number"==typeof r||"string"==typeof r)return r;o=r.l}}(q(),D,e);function N(e){const t=B(e);return c[t]}function F(e,t,n,r,o){return(0,l[e])({queryParams:t,changeEvent:n,previousResults:r,keyDocumentMap:o}),r}},5898:(e,t,n)=>{"use strict";n.d(t,{i:()=>r});class r{ttl;map=new Map;_to=!1;constructor(e){this.ttl=e}has(e){return this.map.has(e)}add(e){this.map.set(e,o()),this._to||(this._to=!0,setTimeout((()=>{this._to=!1,function(e){const t=o()-e.ttl,n=e.map[Symbol.iterator]();for(;;){const r=n.next().value;if(!r)return;const o=r[0];if(!(r[1]{"use strict";n.d(t,{JQ:()=>p});Object.freeze({ignoreUnknown:!1,respectType:!1,respectFunctionNames:!1,respectFunctionProperties:!1,unorderedObjects:!0,unorderedArrays:!1,unorderedSets:!1,excludeKeys:void 0,excludeValues:void 0,replacer:void 0});Object.freeze(["prototype","__proto__","constructor"]);const r="[native code] }";r.length;class o{constructor(e,t){e=this.words=e||[],this.sigBytes=void 0===t?4*e.length:t}toString(e){return(e||i).stringify(this)}concat(e){if(this.clamp(),this.sigBytes%4)for(let t=0;t>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=n<<24-(this.sigBytes+t)%4*8}else for(let t=0;t>>2]=e.words[t>>>2];return this.sigBytes+=e.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new o([...this.words])}}const i={stringify(e){const t=[];for(let n=0;n>>2]>>>24-n%4*8&255;t.push((r>>>4).toString(16),(15&r).toString(16))}return t.join("")}},u={parse(e){const t=e.length,n=[];for(let r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o(n,t)}},s={parse:e=>u.parse(unescape(encodeURIComponent(e)))};class a{constructor(){this._data=new o,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=16}reset(){this._data=new o,this._nDataBytes=0}_append(e){"string"==typeof e&&(e=s.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_doProcessBlock(e,t){}_process(e){let t,n=this._data.sigBytes/(4*this.blockSize);n=e?Math.ceil(n):Math.max((0|n)-this._minBufferSize,0);const r=n*this.blockSize,i=Math.min(4*r,this._data.sigBytes);if(r){for(let e=0;e>>7)^(e<<14|e>>>18)^e>>>3,n=h[d-2],r=(n<<15|n>>>17)^(n<<13|n>>>19)^n>>>10;h[d]=t+h[d-7]+r+h[d-16]}const n=r&o^r&i^o&i,p=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),y=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&a^~s&c)+f[d]+h[d];l=c,c=a,a=s,s=u+y|0,u=i,i=o,o=r,r=y+(p+n)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+u|0,n[4]=n[4]+s|0,n[5]=n[5]+a|0,n[6]=n[6]+c|0,n[7]=n[7]+l|0}finalize(e){super.finalize(e);const t=8*this._nDataBytes,n=8*this._data.sigBytes;return this._data.words[n>>>5]|=128<<24-n%32,this._data.words[14+(n+64>>>9<<4)]=Math.floor(t/4294967296),this._data.words[15+(n+64>>>9<<4)]=t,this._data.sigBytes=4*this._data.words.length,this._process(),this._hash}}function p(e){return(new d).finalize(e).toString()}},5556:(e,t,n)=>{"use strict";n.d(t,{CR:()=>a,FC:()=>f,Jh:()=>u,KL:()=>h,XA:()=>s,ZT:()=>o,ev:()=>c,mG:()=>i,qq:()=>l});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function i(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(t){i(t)}}function s(e){try{a(r.throw(e))}catch(t){i(t)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,s)}a((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return u.label++,{value:s[1],done:!1};case 5:u.label++,r=s[1],s=[0];continue;case 7:s=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){u=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function c(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o1||s(e,t)}))})}function s(e,t){try{(n=o[e](t)).value instanceof l?Promise.resolve(n.value.v).then(a,c):f(i[0][2],n)}catch(r){f(i[0][3],r)}var n}function a(e){s("next",e)}function c(e){s("throw",e)}function f(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function h(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=s(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}Object.create;"function"==typeof SuppressedError&&SuppressedError}}]); \ No newline at end of file +(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[6560],{7782:(e,t,n)=>{"use strict";n.d(t,{F:()=>r});var r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this._parallels=e||1,this._qC=0,this._iC=new Set,this._lHN=0,this._hPM=new Map,this._pHM=new Map};function o(e,t){if(t){if(t._timeoutObj&&clearTimeout(t._timeoutObj),e._pHM.has(t)){var n=e._pHM.get(t);e._hPM.delete(n),e._pHM.delete(t)}e._iC.delete(t)}}function i(e){e._tryIR||0===e._iC.size||(e._tryIR=!0,setTimeout((function(){e.isIdle()?setTimeout((function(){e.isIdle()?(!function(e){0!==e._iC.size&&(e._iC.values().next().value._manRes(),setTimeout((function(){return i(e)}),0))}(e),e._tryIR=!1):e._tryIR=!1}),0):e._tryIR=!1}),0))}r.prototype={isIdle:function(){return this._qC.",lt="String expected.",ft=[],ht="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),dt=ht,pt=ht,yt="__dbnames",vt="readonly",mt="readwrite";function bt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var gt={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function wt(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=C(t))[e],t}}function _t(){throw Z.Type()}function xt(e,t){try{var n=kt(e),r=kt(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return ti+u&&o(i+d)}))}))}return o(0).then((function(){if(0=c})).forEach((function(e){h.push((function(){var t=p,n=e._cfg.dbschema;_n(r,t,f),_n(r,n,f),p=r._dbSchema=n;var o=mn(t,n);o.add.forEach((function(e){bn(f,e[0],e[1].primKey,e[1].indexes)})),o.change.forEach((function(e){if(e.recreate)throw new Z.Upgrade("Not yet support for changing primary key");var t=f.objectStore(e.name);e.add.forEach((function(e){return gn(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),gn(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var u=e._cfg.contentUpgrade;if(u&&e._cfg.version>c){hn(r,f),l._memoizedTables={},y=!0;var s=O(n);o.del.forEach((function(e){s[e]=t[e]})),pn(r,[r.Transaction.prototype]),dn(r,[r.Transaction.prototype],i(s),s),l.schema=s;var a,h=B(u);return h&&Qe(),o=Ce.follow((function(){var e;(a=u(l))&&h&&(e=Ye.bind(null,null),a.then(e,e))})),a&&"function"==typeof a.then?Ce.resolve(a):o.then((function(){return a}))}})),h.push((function(t){var n,o,i;y&&dt||(n=e._cfg.dbschema,o=n,i=t,[].slice.call(i.db.objectStoreNames).forEach((function(e){return null==o[e]&&i.db.deleteObjectStore(e)}))),pn(r,[r.Transaction.prototype]),dn(r,[r.Transaction.prototype],r._storeNames,r._dbSchema),l.schema=r._dbSchema}))})),function e(){return h.length?Ce.resolve(h.shift()(l.idbtrans)).then(e):Ce.resolve()}().then((function(){var e,t;t=f,i(e=p).forEach((function(n){t.db.objectStoreNames.contains(n)||bn(t,n,e[n].primKey,e[n].indexes)}))})).catch(s))}))}function mn(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var o=e[n],i=t[n];if(o){var u={name:n,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||o.primKey.auto!==i.primKey.auto&&!ht)u.recreate=!0,r.change.push(u);else{var s=o.idxByName,a=i.idxByName,c=void 0;for(c in s)a[c]||u.del.push(c);for(c in a){var l=s[c],f=a[c];l?l.src!==f.src&&u.change.push(f):u.add.push(f)}(0Math.pow(2,62)?0:r.oldVersion,l=r<1,e.idbdb=a.result,vn(e,r/10,c,u))}),u),a.onsuccess=Ue((function(){c=null;var n,o,u,f,h,d=e.idbdb=a.result,p=b(d.objectStoreNames);if(0t.limit?n.length=t.limit:e.length===t.limit&&n.length=r.limit&&(!r.values||e.req.values)&&or(e.req.query.range,r.query.range)})),!1,o,i];case"count":return u=i.find((function(e){return rr(e.req.query.range,r.query.range)})),[u,!!u,o,i]}}(n,r,"query",e),a=s[0],c=s[1],l=s[2],f=s[3];return a&&c?a.obsSet=e.obsSet:(c=o.query(e).then((function(e){var n=e.result;if(a.res=n,t){for(var r=0,o=n.length;r{"use strict";n.d(t,{j:()=>u});var r=n(7761),o=n(1645),i=n(6250);class u{constructor(e,t){this.pipeline=e,this.options=(0,r.Tc)(t)}stream(e){let t=(0,o.oM)(e);const n=this.options.processingMode;n!=r.qD.CLONE_ALL&&n!=r.qD.CLONE_INPUT||t.map(i.Xh);const u=new Array;if(!(0,i.xb)(this.pipeline))for(const o of this.pipeline){const e=Object.keys(o),n=e[0],s=(0,r.jQ)(r.$M.PIPELINE,n,this.options);(0,i.hu)(1===e.length&&!!s,`invalid pipeline operator ${n}`),u.push(n),t=s(t,o[n],this.options)}return(n==r.qD.CLONE_OUTPUT||n==r.qD.CLONE_ALL&&(0,i.jV)([["$group","$unwind"],u]).length)&&t.map(i.Xh),t}run(e){return this.stream(e).value()}}},7761:(e,t,n)=>{"use strict";n.d(t,{$M:()=>o,Cw:()=>u,Kr:()=>p,Qs:()=>l,Tc:()=>s,jQ:()=>f,qD:()=>r});var r,o,i=n(6250);!function(e){e.CLONE_ALL="CLONE_ALL",e.CLONE_INPUT="CLONE_INPUT",e.CLONE_OUTPUT="CLONE_OUTPUT",e.CLONE_OFF="CLONE_OFF"}(r||(r={}));class u{constructor(e,t,n,r=Date.now()){this._opts=e,this._root=t,this._local=n,this.timestamp=r,this.update(t,n)}static init(e,t,n){return e instanceof u?new u(e._opts,(0,i.kK)(e.root)?t:e.root,Object.assign({},e.local,n)):new u(e,t,n)}update(e,t){var n;return this._root=e,this._local=t?Object.assign({},t,{variables:Object.assign({},null===(n=this._local)||void 0===n?void 0:n.variables,null==t?void 0:t.variables)}):t,this}getOptions(){return Object.freeze(Object.assign(Object.assign({},this._opts),{context:a.from(this._opts.context)}))}get root(){return this._root}get local(){return this._local}get idKey(){return this._opts.idKey}get collation(){var e;return null===(e=this._opts)||void 0===e?void 0:e.collation}get processingMode(){var e;return(null===(e=this._opts)||void 0===e?void 0:e.processingMode)||r.CLONE_OFF}get useStrictMode(){var e;return null===(e=this._opts)||void 0===e?void 0:e.useStrictMode}get scriptEnabled(){var e;return null===(e=this._opts)||void 0===e?void 0:e.scriptEnabled}get useGlobalContext(){var e;return null===(e=this._opts)||void 0===e?void 0:e.useGlobalContext}get hashFunction(){var e;return null===(e=this._opts)||void 0===e?void 0:e.hashFunction}get collectionResolver(){var e;return null===(e=this._opts)||void 0===e?void 0:e.collectionResolver}get jsonSchemaValidator(){var e;return null===(e=this._opts)||void 0===e?void 0:e.jsonSchemaValidator}get variables(){var e;return null===(e=this._opts)||void 0===e?void 0:e.variables}get context(){var e;return null===(e=this._opts)||void 0===e?void 0:e.context}}function s(e){return e instanceof u?e.getOptions():Object.freeze(Object.assign(Object.assign({idKey:"_id",scriptEnabled:!0,useStrictMode:!0,useGlobalContext:!0,processingMode:r.CLONE_OFF},e),{context:(null==e?void 0:e.context)?a.from(null==e?void 0:e.context):a.init({})}))}!function(e){e.ACCUMULATOR="accumulator",e.EXPRESSION="expression",e.PIPELINE="pipeline",e.PROJECTION="projection",e.QUERY="query",e.WINDOW="window"}(o||(o={}));class a{constructor(e){this.operators={[o.ACCUMULATOR]:{},[o.EXPRESSION]:{},[o.PIPELINE]:{},[o.PROJECTION]:{},[o.QUERY]:{},[o.WINDOW]:{}};for(const[t,n]of Object.entries(e))this.addOperators(t,n)}static init(e={}){return new a(e)}static from(e){return new a(e.operators)}addOperators(e,t){for(const[n,r]of Object.entries(t))this.getOperator(e,n)||(this.operators[e][n]=r);return this}addAccumulatorOps(e){return this.addOperators(o.ACCUMULATOR,e)}addExpressionOps(e){return this.addOperators(o.EXPRESSION,e)}addQueryOps(e){return this.addOperators(o.QUERY,e)}addPipelineOps(e){return this.addOperators(o.PIPELINE,e)}addProjectionOps(e){return this.addOperators(o.PROJECTION,e)}addWindowOps(e){return this.addOperators(o.WINDOW,e)}getOperator(e,t){return e in this.operators&&this.operators[e][t]||null}}const c=a.init();function l(e,t){for(const[n,r]of Object.entries(t)){(0,i.hu)((0,i.mf)(r)&&(0,i.S6)(n),`'${n}' is not a valid operator`);const t=f(e,n,null);(0,i.hu)(!t||r===t,`${n} already exists for '${e}' operators. Cannot change operator function once registered.`)}switch(e){case o.ACCUMULATOR:c.addAccumulatorOps(t);break;case o.EXPRESSION:c.addExpressionOps(t);break;case o.PIPELINE:c.addPipelineOps(t);break;case o.PROJECTION:c.addProjectionOps(t);break;case o.QUERY:c.addQueryOps(t);break;case o.WINDOW:c.addWindowOps(t)}}function f(e,t,n){const{context:r,useGlobalContext:o}=n||{},i=r?r.getOperator(e,t):null;return!i&&o?c.getOperator(e,t):i}const h={$$ROOT:(e,t,n)=>n.root,$$CURRENT:(e,t,n)=>e,$$REMOVE(e,t,n){},$$NOW:(e,t,n)=>new Date(n.timestamp)},d={$$KEEP:(e,t,n)=>e,$$PRUNE(e,t,n){},$$DESCEND(e,t,n){if(!(0,i.e$)(t,"$cond"))return e;let r;for(const[o,u]of Object.entries(e))if((0,i.yD)(u)){if(u instanceof Array){const e=[];for(let r of u)(0,i.Kn)(r)&&(r=y(r,t,n.update(r))),(0,i.kK)(r)||e.push(r);r=e}else r=y(u,t,n.update(u));(0,i.kK)(r)?delete e[o]:e[o]=r}return e}};function p(e,t,n,r){var s;const a=u.init(r,e);if(n=n||"",(0,i.S6)(n)){const u=f(o.EXPRESSION,n,r);if(u)return u(e,t,a);const s=f(o.ACCUMULATOR,n,r);if(s)return e instanceof Array||(e=p(e,t,null,a),t=null),(0,i.hu)(e instanceof Array,`'${n}' target must be an array.`),s(e,t,a.update(null,a.local));throw new Error(`operator '${n}' is not registered`)}if((0,i.HD)(t)&&t.length>0&&"$"===t[0]){if((0,i.e$)(d,t))return t;let n=a.root;const r=t.split(".");if((0,i.e$)(h,r[0]))n=h[r[0]](e,null,a),t=t.slice(r[0].length+1);else if("$$"===r[0].slice(0,2)){n=Object.assign({},a.variables,{this:e},null===(s=a.local)||void 0===s?void 0:s.variables);const o=r[0].slice(2);(0,i.hu)((0,i.e$)(n,o),`Use of undefined variable: ${o}`),t=t.slice(2)}else t=t.slice(1);return""===t?n:(0,i.DB)(n,t)}if((0,i.kJ)(t))return t.map((t=>p(e,t,null,a)));if((0,i.Kn)(t)){const n={};for(const[u,s]of Object.entries(t))if(n[u]=p(e,s,u,a),[o.EXPRESSION,o.ACCUMULATOR].some((e=>!!f(e,u,r))))return(0,i.hu)(1===Object.keys(t).length,"Invalid aggregation expression '"+JSON.stringify(t)+"'"),n[u];return n}return t}function y(e,t,n){const r=p(e,t,null,n);return(0,i.e$)(d,r)?d[r](e,t,n):r}},1645:(e,t,n)=>{"use strict";function r(e){return e instanceof a?e:new a(e)}function o(...e){let t=0;return r((()=>{for(;tr,qC:()=>o});const u=new Error;var s;!function(e){e[e.MAP=0]="MAP",e[e.FILTER=1]="FILTER",e[e.TAKE=2]="TAKE",e[e.DROP=3]="DROP"}(s||(s={}));class a{constructor(e){let t;if(this.iteratees=[],this.yieldedValues=[],this.isDone=!1,e instanceof Function&&(e={next:e}),(n=e)&&"object"==typeof n&&(null==n?void 0:n.next)instanceof Function){const n=e;t=()=>{const e=n.next();if(e.done)throw u;return e.value}}else if(e instanceof Array){const n=e,r=n.length;let o=0;t=()=>{if(o0?this.push(s.TAKE,e):this}drop(e){return e>0?this.push(s.DROP,e):this}transform(e){const t=this;let n;return r((()=>(n||(n=r(e(t.value()))),n.next())))}value(){return this.isDone||(this.isDone=this.getNext(!0).done),this.yieldedValues}each(e){for(;;){const t=this.next();if(t.done)break;if(!1===e(t.value))return!1}return!0}reduce(e,t){let n=this.next();for(void 0!==t||n.done||(t=n.value,n=this.next());!n.done;)t=e(t,n.value),n=this.next();return t}size(){return this.reduce(((e,t)=>++e),0)}[Symbol.iterator](){return this}}},7469:(e,t,n)=>{"use strict";n.d(t,{FI:()=>l,G6:()=>b,GO:()=>m,HG:()=>d,IS:()=>f,JD:()=>v,Ns:()=>g,QH:()=>w,Ty:()=>h,ey:()=>A,hk:()=>s,iG:()=>u,l3:()=>a,m9:()=>y,ny:()=>c,ok:()=>p,rr:()=>x});var r=n(7761),o=n(7132),i=n(6250);function u(e){const t=(t,n,r)=>{const o={unwrapArray:!0},u=Math.max(1,t.split(".").length-1);return s=>{const a=(0,i.DB)(s,t,o);return e(a,n,Object.assign(Object.assign({},r),{depth:u}))}};return t.op="query",t}function s(e){return(t,n,o)=>{const i=(0,r.Kr)(t,n,null,o);return e(...i)}}function a(e,t,n){if((0,i.Xy)(e,t))return!0;if((0,i.kK)(e)&&(0,i.kK)(t))return!0;if(e instanceof Array){const r=i.Xy.bind(null,t);return e.some(r)||(0,i.xH)(e,null==n?void 0:n.depth).some(r)}return!1}function c(e,t,n){return!a(e,t,n)}function l(e,t,n){return(0,i.kK)(e)?t.some((e=>null===e)):(0,i.jV)([(0,i.rY)(e),t],null==n?void 0:n.hashFunction).length>0}function f(e,t,n){return!l(e,t,n)}function h(e,t,n){return j(e,t,((e,t)=>(0,i.qu)(e,t)<0))}function d(e,t,n){return j(e,t,((e,t)=>(0,i.qu)(e,t)<=0))}function p(e,t,n){return j(e,t,((e,t)=>(0,i.qu)(e,t)>0))}function y(e,t,n){return j(e,t,((e,t)=>(0,i.qu)(e,t)>=0))}function v(e,t,n){return(0,i.rY)(e).some((e=>2===t.length&&e%t[0]===t[1]))}function m(e,t,n){const r=(0,i.rY)(e),o=e=>(0,i.HD)(e)&&(0,i.yb)(t.exec(e),null==n?void 0:n.useStrictMode);return r.some(o)||(0,i.xH)(r,1).some(o)}function b(e,t,n){return(!1===t||0===t)&&void 0===e||(!0===t||1===t)&&void 0!==e}function g(e,t,n){if(!((0,i.kJ)(e)&&(0,i.kJ)(t)&&e.length&&t.length))return!1;let r=!0;for(const o of t){if(!r)break;r=(0,i.Kn)(o)&&(0,i.d3)(Object.keys(o),"$elemMatch")?x(e,o.$elemMatch,n):o instanceof RegExp?e.some((e=>"string"==typeof e&&o.test(e))):e.some((e=>(0,i.Xy)(o,e)))}return r}function w(e,t,n){return Array.isArray(e)&&e.length===t}function _(e){return(0,i.S6)(e)&&-1===["$and","$or","$nor"].indexOf(e)}function x(e,t,n){if((0,i.kJ)(e)&&!(0,i.xb)(e)){let r=e=>e,i=t;Object.keys(t).every(_)&&(i={temp:t},r=e=>({temp:e}));const u=new o.A(i,n);for(let t=0,n=e.length;tnull===e,O=e=>(0,i.hj)(e)&&e>=i.xm&&e<=i.n1&&-1===e.toString().indexOf("."),E=e=>(0,i.hj)(e)&&e>=i.Hu&&e<=i.JV&&-1===e.toString().indexOf("."),P={array:i.kJ,bool:i.jn,boolean:i.jn,date:i.J_,decimal:i.hj,double:i.hj,int:O,long:E,number:i.hj,null:k,object:i.Kn,regex:i.Kj,regexp:i.Kj,string:i.HD,undefined:i.kK,function:e=>{throw new Error("unsupported type key `function`.")},1:i.hj,2:i.HD,3:i.Kn,4:i.kJ,6:i.kK,8:i.jn,9:i.J_,10:k,11:i.Kj,16:O,18:E,19:i.hj};function S(e,t,n){const r=P[t];return!!r&&r(e)}function A(e,t,n){return Array.isArray(t)?t.findIndex((t=>S(e,t)))>=0:S(e,t)}function j(e,t,n){return(0,i.rY)(e).some((e=>(0,i.oL)(e)===(0,i.oL)(t)&&n(e,t)))}},6496:(e,t,n)=>{"use strict";n.d(t,{FM:()=>p,E3:()=>i});var r=n(7761),o=n(6250);n(1645);n(8123);new WeakMap;const i=(e,t,n)=>{if((0,o.xb)(t)||!(0,o.Kn)(t))return e;let r=o.qu;const i=n.collation;return(0,o.Kn)(i)&&(0,o.HD)(i.locale)&&(r=function(e){const t={sensitivity:u[e.strength||3],caseFirst:"off"===e.caseFirst?"false":e.caseFirst||"false",numeric:e.numericOrdering||!1,ignorePunctuation:"shifted"===e.alternate};!0===(e.caseLevel||!1)&&("base"===t.sensitivity&&(t.sensitivity="case"),"accent"===t.sensitivity&&(t.sensitivity="variant"));const n=new Intl.Collator(e.locale,t);return(e,t)=>{if(!(0,o.HD)(e)||!(0,o.HD)(t))return(0,o.qu)(e,t);const r=n.compare(e,t);return r<0?-1:r>0?1:0}}(i)),e.transform((e=>{const i=Object.keys(t);for(const u of i.reverse()){const i=(0,o.vM)(e,(e=>(0,o.DB)(e,u)),n.hashFunction),s=Array.from(i.keys()).sort(r);-1===t[u]&&s.reverse(),e=[],s.reduce(((e,t)=>(0,o.gi)(e,i.get(t))),e)}return e}))},u={1:"base",2:"accent",3:"variant"};new Set(["$denseRank","$documentNumber","$first","$last","$linearFill","$rank","$shift"]),new Set(["$denseRank","$expMovingAvg","$linearFill","$locf","$rank","$shift"]);n(7132);var s=n(7469);(0,s.hk)(s.IS);const a=(e,t)=>(n,i,u)=>{(0,o.hu)((0,o.kJ)(i),`${e}: expression must be an array.`);const s=(0,r.Kr)(n,i,null,u);return s.some(o.kK)?null:((0,o.hu)(s.every(o.hj),`${e}: expression must evalue to array of numbers.`),t(s))};a("$bitAnd",(e=>e.reduce(((e,t)=>e&t),-1))),a("$bitOr",(e=>e.reduce(((e,t)=>e|t),0))),a("$bitXor",(e=>e.reduce(((e,t)=>e^t),0))),(0,s.hk)(s.l3),(0,s.hk)(s.ok),(0,s.hk)(s.m9),(0,s.hk)(s.Ty),(0,s.hk)(s.HG),(0,s.hk)(s.ny);const c=(e,t)=>{const n={};return e.split("").forEach(((e,r)=>n[e]=t*(r+1))),n};Object.assign(Object.assign(Object.assign({},c("ABCDEFGHIKLM",1)),c("NOPQRSTUVWXY",-1)),{Z:0});const l={undefined:null,null:null,NaN:NaN,Infinity:new Error,"-Infinity":new Error};function f(e,t=l){const n=Object.assign({},l,t),o=new Set(Object.keys(n));return(t,i,u)=>{const s=(0,r.Kr)(t,i,null,u);if(o.has(`${s}`)){const t=n[`${s}`];if(t instanceof Error)throw new Error(`cannot apply $${e.name} to -inf, value must in (-inf,inf)`);return t}return e(s)}}f(Math.acos,{Infinity:1/0,0:new Error}),f(Math.acosh,{Infinity:1/0,0:new Error}),f(Math.asin),f(Math.asinh,{Infinity:1/0,"-Infinity":-1/0}),f(Math.atan),f(Math.atanh,{1:1/0,"-1":-1/0}),f(Math.cos),f(Math.cosh,{"-Infinity":1/0,Infinity:1/0});const h=Math.PI/180,d=(f((e=>e*h),{Infinity:1/0,"-Infinity":1/0}),180/Math.PI);f((e=>e*d),{Infinity:1/0,"-Infinity":-1/0}),f(Math.sin),f(Math.sinh,{"-Infinity":-1/0,Infinity:1/0}),f(Math.tan);Error;const p=(e,t,n)=>{if((0,o.xb)(t))return e;let i=Object.keys(t),u=!1;v(t,n);const s=n.idKey;if((0,o.d3)(i,s)){const e=t[s];0!==e&&!1!==e||(i=i.filter(o.Nl.bind(null,[s])),u=0==i.length)}else i.push(s);const a=r.Cw.init(n);return e.map((e=>y(e,t,a.update(e),i,u)))};function y(e,t,n,i,u){let s={},a=!1,c=!1;const l=[];u&&l.push(n.idKey);for(const f of i){let i;const u=t[f];if(f!==n.idKey&&(0,o.d3)([0,!1],u)&&(c=!0),f===n.idKey&&(0,o.xb)(u))i=e[f];else if((0,o.HD)(u))i=(0,r.Kr)(e,u,f,n);else if((0,o.d3)([1,!0],u));else if(u instanceof Array)i=u.map((t=>{const i=(0,r.Kr)(e,t,null,n);return(0,o.kK)(i)?null:i}));else{if(!(0,o.Kn)(u)){l.push(f);continue}{const t=u,s=Object.keys(u),c=1==s.length?s[0]:"",l=(0,r.jQ)(r.$M.PROJECTION,c,n);if(l)"$slice"===c?(0,o.rY)(t[c]).every(o.hj)?(i=l(e,t[c],f,n),a=!0):i=(0,r.Kr)(e,t,f,n):i=l(e,t[c],f,n);else if((0,o.S6)(c))i=(0,r.Kr)(e,t[c],c,n);else if((0,o.e$)(e,f)){v(t,n);let r=e[f];r instanceof Array?i=r.map((e=>y(e,t,n,s,!1))):(r=(0,o.Kn)(r)?r:e,i=y(r,t,n,s,!1))}else i=(0,r.Kr)(e,u,null,n)}}const h=(0,o.hB)(e,f,{preserveMissing:!0});void 0!==h&&(0,o.TS)(s,h,{flatten:!0}),(0,o.Nl)([0,1,!1,!0],u)&&(void 0===i?(0,o.fY)(s,f,{descendArray:!0}):(0,o.sO)(s,f,i))}if((0,o.TO)(s),(a||c||u)&&(s=(0,o.gi)({},e,s),l.length>0))for(const r of l)(0,o.fY)(s,r,{descendArray:!0});return s}function v(e,t){const n=[!1,!1];for(const[r,i]of Object.entries(e)){if(r===(null==t?void 0:t.idKey))return;0===i||!1===i?n[0]=!0:1!==i&&!0!==i||(n[1]=!0),(0,o.hu)(!(n[0]&&n[1]),"Projection cannot have a mix of inclusion and exclusion.")}}},5308:(e,t,n)=>{"use strict";n.d(t,{rr:()=>o,QH:()=>i});var r=n(7469);(0,r.iG)(r.Ns);const o=(0,r.iG)(r.rr),i=(0,r.iG)(r.QH)},3516:(e,t,n)=>{"use strict";n.d(t,{l3:()=>o,ok:()=>i,m9:()=>u,FI:()=>s,Ty:()=>a,HG:()=>c,ny:()=>l,IS:()=>f});var r=n(7469);const o=(0,r.iG)(r.l3),i=(0,r.iG)(r.ok),u=(0,r.iG)(r.m9),s=(0,r.iG)(r.FI),a=(0,r.iG)(r.Ty),c=(0,r.iG)(r.HG),l=(0,r.iG)(r.ny),f=(0,r.iG)(r.IS)},2106:(e,t,n)=>{"use strict";n.d(t,{G:()=>o,e:()=>i});var r=n(7469);const o=(0,r.iG)(r.G6),i=(0,r.iG)(r.ey)},8039:(e,t,n)=>{"use strict";n.d(t,{JD:()=>o,GO:()=>i});n(7761);var r=n(7469);const o=(0,r.iG)(r.JD),i=(0,r.iG)(r.GO);n(6250)},6851:(e,t,n)=>{"use strict";n.d(t,{h$:()=>i,ps:()=>s,_w:()=>a,Ko:()=>u});var r=n(7132),o=n(6250);const i=(e,t,n)=>{(0,o.hu)((0,o.kJ)(t),"Invalid expression: $and expects value to be an Array.");const i=t.map((e=>new r.A(e,n)));return e=>i.every((t=>t.test(e)))},u=(e,t,n)=>{(0,o.hu)((0,o.kJ)(t),"Invalid expression. $or expects value to be an Array");const i=t.map((e=>new r.A(e,n)));return e=>i.some((t=>t.test(e)))},s=(e,t,n)=>{(0,o.hu)((0,o.kJ)(t),"Invalid expression. $nor expects value to be an array.");const r=u("$or",t,n);return e=>!r(e)},a=(e,t,n)=>{const i={};i[e]=(0,o.Fv)(t);const u=new r.A(i,n);return e=>!u.test(e)}},7132:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(7761),o=n(8123),i=n(1645),u=n(6250);class s{constructor(e,t,n,r){this.source=e,this.predicate=t,this.projection=n,this.options=r,this.operators=[],this.result=null,this.buffer=[]}fetch(){return this.result||((0,u.Kn)(this.projection)&&this.operators.push({$project:this.projection}),this.result=(0,i.oM)(this.source).filter(this.predicate),this.operators.length>0&&(this.result=new o.j(this.operators,this.options).stream(this.result))),this.result}fetchAll(){const e=(0,i.oM)([...this.buffer]);return this.buffer=[],(0,i.qC)(e,this.fetch())}all(){return this.fetchAll().value()}count(){return this.all().length}skip(e){return this.operators.push({$skip:e}),this}limit(e){return this.operators.push({$limit:e}),this}sort(e){return this.operators.push({$sort:e}),this}collation(e){return this.options=Object.assign(Object.assign({},this.options),{collation:e}),this}next(){if(this.buffer.length>0)return this.buffer.pop();const e=this.fetch().next();return e.done?void 0:e.value}hasNext(){if(this.buffer.length>0)return!0;const e=this.fetch().next();return!e.done&&(this.buffer.push(e.value),!0)}map(e){return this.all().map(e)}forEach(e){this.all().forEach(e)}[Symbol.iterator](){return this.fetchAll()}}class a{constructor(e,t){this.condition=e,this.options=(0,r.Tc)(t),this.compiled=[],this.compile()}compile(){(0,u.hu)((0,u.Kn)(this.condition),`query criteria must be an object: ${JSON.stringify(this.condition)}`);const e={};for(const[t,n]of Object.entries(this.condition)){if("$where"===t)Object.assign(e,{field:t,expr:n});else if((0,u.d3)(["$and","$or","$nor","$expr","$jsonSchema"],t))this.processOperator(t,t,n);else{(0,u.hu)(!(0,u.S6)(t),`unknown top level operator: ${t}`);for(const[e,r]of Object.entries((0,u.Fv)(n)))this.processOperator(t,e,r)}e.field&&this.processOperator(e.field,e.field,e.expr)}}processOperator(e,t,n){const o=(0,r.jQ)(r.$M.QUERY,t,this.options);if(!o)throw new Error(`unknown operator ${t}`);const i=o(e,n,this.options);this.compiled.push(i)}test(e){for(let t=0,n=this.compiled.length;tthis.test(e)),t||{},this.options)}remove(e){return e.reduce(((e,t)=>(this.test(t)||e.push(t),e)),[])}}},6250:(e,t,n)=>{"use strict";n.d(t,{DB:()=>te,Fv:()=>le,HD:()=>S,Hu:()=>u,JV:()=>i,J_:()=>T,Kj:()=>K,Kn:()=>C,Nl:()=>q,S6:()=>ce,TO:()=>re,TS:()=>z,Xh:()=>O,Xy:()=>W,d3:()=>R,e$:()=>$,fY:()=>se,gi:()=>Z,hB:()=>ne,hj:()=>A,hu:()=>k,jV:()=>H,jn:()=>P,kJ:()=>j,kK:()=>D,mf:()=>M,n1:()=>r,oL:()=>E,qu:()=>x,rY:()=>L,sO:()=>ue,vM:()=>Q,xH:()=>V,xb:()=>N,xm:()=>o,yD:()=>I,yb:()=>B});const r=2147483647,o=-2147483648,i=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER,s=Symbol("missing"),a=Object.freeze(new Error("mingo: cycle detected while processing object/array")),c=Object.getPrototypeOf([]),l=Object.getPrototypeOf({}),f=/^\[object ([a-zA-Z0-9]+)\]$/;class h{}class d{}const p=e=>null===e?h:void 0===e?d:e.constructor,y=e=>{const t=function(e){const t=new Set,n=e=>{const r=p(e);if(w.has(r))return w.get(r)(e);const o=r===Object?"":r.name;if(M(e.toJSON))return`${o}(${JSON.stringify(e)})`;if(t.has(e))throw a;t.add(e);try{if(r===Array)return"["+e.map(n).join(",")+"]";if(r!==Object){const[t,r]=J(e);if(j(e))return`${o}${n([...e,t])}`;e=t}const t=Object.keys(e);return t.sort(),`${o}{`+t.map((t=>`${t}:${n(e[t])}`)).join(",")+"}"}finally{t.delete(e)}};return n(e)}(e);let n=0,r=t.length;for(;r;)n=(n<<5)-n^t.charCodeAt(--r);return n>>>0},v=new Set(["null","undefined","boolean","number","string","date","regexp"]),m=new Set([d,h,Boolean,String,Number]),b=e=>e.toString(),g=e=>`${p(e).name}[${e.toString()}]`,w=new Map([[Number,b],[Boolean,b],[RegExp,b],[Function,b],[Symbol,b],[Date,e=>e.toISOString()],[String,JSON.stringify],[h,e=>"null"],[d,e=>"undefined"],[Int8Array,g],[Uint8Array,g],[Uint8ClampedArray,g],[Int16Array,g],[Uint16Array,g],[Int32Array,g],[Uint32Array,g],[Float32Array,g],[Float64Array,g]]);"undefined"!=typeof BigInt&&w.set(BigInt,(e=>"0x"+e.toString(16))),"undefined"!=typeof BigInt64Array&&w.set(BigInt64Array,g),"undefined"!=typeof BigUint64Array&&w.set(BigUint64Array,g);const _={null:0,undefined:0,number:1,string:2,object:3,array:4,boolean:5,date:6,regexp:7,function:8},x=(e,t)=>{e===s&&(e=void 0),t===s&&(t=void 0);const[n,r]=[e,t].map((e=>_[E(e).toLowerCase()]));return n!==r?n-r:1===n||2===n||6===n?et?1:0:W(e,t)?0:et?1:0};function k(e,t){if(!e)throw new Error(t)}const O=e=>{if(m.has(p(e)))return e;const t=new Set,n=e=>{if(t.has(e))throw a;const r=p(e);if(m.has(r))return e;try{if(j(e))return t.add(e),e.map(n);if(C(e)){t.add(e);const r={};for(const t in e)r[t]=n(e[t]);return r}}finally{t.delete(e)}return r===Date||r===RegExp||(e=>{const t=Object.getPrototypeOf(p(e));return t&&"TypedArray"===t.name})(e)?new r(e):e};return n(e)},E=e=>f.exec(Object.prototype.toString.call(e))[1],P=e=>"boolean"==typeof e,S=e=>"string"==typeof e,A=e=>!isNaN(e)&&"number"==typeof e,j=Array.isArray,C=e=>{if(!e)return!1;const t=Object.getPrototypeOf(e);return(t===l||null===t)&&"[object Object]"===Object.prototype.toString.call(e)},I=e=>e===Object(e),T=e=>e instanceof Date,K=e=>e instanceof RegExp,M=e=>"function"==typeof e,D=e=>null==e,R=(e,t)=>e.includes(t),q=(e,t)=>!R(e,t),B=(e,t=!0)=>!!e||t&&""===e,N=e=>D(e)||S(e)&&!e||e instanceof Array&&0===e.length||C(e)&&0===Object.keys(e).length,F=e=>e===s,L=e=>e instanceof Array?e:[e],$=(e,t)=>!!e&&Object.prototype.hasOwnProperty.call(e,t),U=(e,t)=>C(e)&&C(t)||j(e)&&j(t);function z(e,t,n){if(n=n||{flatten:!1},F(e)||D(e))return t;if(F(t)||D(t))return e;if(!U(e,t)){if(n.skipValidation)return t||e;throw Error("mismatched types. must both be array or object")}if(n.skipValidation=!0,j(e)){const r=e,o=t;if(n.flatten){let e=0,i=0;for(;e{const i=X(r,t);n.has(i)?n.get(i).some((t=>W(e[t],r)))||n.get(i).push(o):n.set(i,[o])})),n}function H(e,t=y){if(e.some((e=>0==e.length)))return[];if(1===e.length)return Array.from(e);const n=function(e,t,n=x){if(N(e))return e;const r=new Array,o=new Array;for(let i=0;in(e[0],t[0]))),Z(o,r.map((e=>e[1])))}(e.map(((e,t)=>[t,e.length])),(e=>e[1])),r=e[n[0][0]],o=G(r,t),i=new Map,u=new Array;return o.forEach(((t,o)=>{const a=t.map((e=>r[e])),c=a.map((e=>0)),l=a.map((e=>[n[0][0],0]));let f=!1;for(let r=1;rs[e]));f=a.map(((n,u)=>e.some(((e,s)=>{const a=c[u];return W(n,e)&&(c[u]++,tt===e.length-1?[a[n],l[n]]:s)).filter((e=>e!==s)))})),u.sort(((e,t)=>{const[n,[r,o]]=e,[i,[u,s]]=t,a=x(r,u);return 0!==a?a:x(o,s)})).map((e=>e[0]))}function V(e,t=0){const n=new Array;return function e(t,r){for(let o=0,i=t.length;o0||r<0)?e(t[o],Math.max(-1,r-1)):n.push(t[o])}(e,t),n}const J=e=>{let[t,n]=[Object.getPrototypeOf(e),Object.getOwnPropertyNames(e)],r=t;for(;!n.length&&t!==l&&t!==c;)r=t,n=Object.getOwnPropertyNames(t),t=Object.getPrototypeOf(t);const o={};return n.forEach((t=>o[t]=e[t])),[o,r]};function W(e,t){const n=[[e,t]];for(;n.length>0;){if([e,t]=n.pop(),e===t)continue;const r=p(e);if(r!==p(t)||M(e))return!1;if(w.has(r)){const n=w.get(r);if(n(e)!==n(t))return!1}else{if(r!==Array&&r!==Object)return!1;{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(new Set(r.concat(o)).size!=r.length)return!1;for(const i of r)n.push([e[i],t[i]])}}}return!n.length}function X(e,t){return t=t||y,D(e)?null:t(e).toString()}function Q(e,t,n=y){if(e.length<1)return new Map;const r=new Map,o=new Map;for(let i=0;iW(e,s))):null;D(e)?(o.set(s,[u]),r.has(a)?r.get(a).push(s):r.set(a,[s])):o.get(e).push(u)}}return o}const Y=5e4;function Z(e,...t){return e instanceof Array?t.reduce(((e,t)=>{let n=Math.ceil(t.length/Y),r=0;for(;n-- >0;)Array.prototype.push.apply(e,t.slice(r,r+Y)),r+=Y;return e}),e):t.filter(I).reduce(((e,t)=>(Object.assign(e,t),e)),e)}function ee(e,t){return I(e)?e[t]:void 0}function te(e,t,n){let r=0;const o=v.has(E(e).toLowerCase())?e:function e(t,n){let o=t;for(let i=0;i0)break;r+=1;const t=n.slice(i);o=o.reduce(((n,r)=>{const o=e(r,t);return void 0!==o&&n.push(o),n}),[]);break}if(o=ee(o,t),void 0===o)break}return o}(e,t.split("."));return o instanceof Array&&(null==n?void 0:n.unwrapArray)?function(e,t){if(t<1)return e;for(;t--&&1===e.length;)e=e[0];return e}(o,r):o}function ne(e,t,n){const r=t.split("."),o=r[0],i=r.slice(1).join("."),u=null!==/^\d+$/.exec(o),a=r.length>1;let c,l;if(e instanceof Array)if(u)c=ee(e,Number(o)),a&&(c=ne(c,i,n)),c=[c];else{c=[];for(const r of e)l=ne(r,t,n),(null==n?void 0:n.preserveMissing)?(void 0===l&&(l=s),c.push(l)):void 0!==l&&c.push(l)}else{if(l=ee(e,o),a&&(l=ne(l,i,n)),void 0===l)return;c=(null==n?void 0:n.preserveKeys)?Object.assign({},e):{},c[o]=l}return c}function re(e){if(e instanceof Array)for(let t=e.length-1;t>=0;t--)e[t]===s?e.splice(t,1):re(e[t]);else if(C(e))for(const t in e)$(e,t)&&re(e[t])}const oe=/^\d+$/;function ie(e,t,n,r){const o=t.split("."),i=o[0],u=o.slice(1).join(".");if(1===o.length)(C(e)||j(e)&&oe.test(i))&&n(e,i);else{(null==r?void 0:r.buildGraph)&&D(e[i])&&(e[i]={});const t=e[i];if(!t)return;const s=!!(o.length>1&&oe.test(o[1]));t instanceof Array&&(null==r?void 0:r.descendArray)&&!s?t.forEach((e=>ie(e,u,n,r))):ie(t,u,n,r)}}function ue(e,t,n){ie(e,t,((e,t)=>{e[t]=M(n)?n(e[t]):n}),{buildGraph:!0})}function se(e,t,n){ie(e,t,((e,t)=>{if(e instanceof Array){if(/^\d+$/.test(t))e.splice(parseInt(t),1);else if(n&&n.descendArray)for(const n of e)C(n)&&delete n[t]}else C(e)&&delete e[t]}),n)}const ae=/^\$[a-zA-Z0-9_]+$/;function ce(e){return ae.test(e)}function le(e){if(v.has(E(e).toLowerCase()))return K(e)?{$regex:e}:{$eq:e};if(I(e)){const t=e;if(!Object.keys(t).some(ce))return{$eq:e};if($(e,"$regex")){const t=Object.assign({},e);return t.$regex=new RegExp(e.$regex,e.$options),delete t.$options,t}}return e}},10:(e,t,n)=>{"use strict";n.d(t,{X:()=>o});var r=n(5556),o=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return(0,r.ZT)(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(n(6974).x)},3784:(e,t,n)=>{"use strict";n.d(t,{y:()=>f});var r=n(7409),o=n(7592),i=n(3046),u=n(4512);function s(e){return 0===e.length?u.y:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var a=n(8867),c=n(8804),l=n(3323),f=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var i,u=this,s=(i=e)&&i instanceof r.Lv||function(e){return e&&(0,c.m)(e.next)&&(0,c.m)(e.error)&&(0,c.m)(e.complete)}(i)&&(0,o.Nn)(i)?e:new r.Hp(e,t,n);return(0,l.x)((function(){var e=u,t=e.operator,n=e.source;s.add(t?t.call(s,n):n?u._subscribe(s):u._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=h(t))((function(t,o){var i=new r.Hp({next:function(t){try{e(t)}catch(n){o(n),i.unsubscribe()}},error:o,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[i.L]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t{"use strict";n.d(t,{x:()=>c});var r=n(5556),o=n(3784),i=n(7592),u=(0,n(8390).d)((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),s=n(1940),a=n(3323),c=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return(0,r.ZT)(t,e),t.prototype.lift=function(e){var t=new l(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new u},t.prototype.next=function(e){var t=this;(0,a.x)((function(){var n,o;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=(0,r.XA)(t.currentObservers),u=i.next();!u.done;u=i.next()){u.value.next(e)}}catch(s){n={error:s}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;(0,a.x)((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;(0,a.x)((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,o=n.isStopped,u=n.observers;return r||o?i.Lc:(this.currentObservers=null,u.push(e),new i.w0((function(){t.currentObservers=null,(0,s.P)(u,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,o=t.isStopped;n?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new o.y;return e.source=this,e},t.create=function(e,t){return new l(e,t)},t}(o.y),l=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return(0,r.ZT)(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:i.Lc},t}(c)},7409:(e,t,n)=>{"use strict";n.d(t,{Hp:()=>m,Lv:()=>d});var r=n(5556),o=n(8804),i=n(7592),u=n(8867),s=n(5046);function a(){}var c=l("C",void 0,void 0);function l(e,t,n){return{kind:e,value:t,error:n}}var f=n(8822),h=n(3323),d=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,(0,i.Nn)(t)&&t.add(n)):n.destination=w,n}return(0,r.ZT)(t,e),t.create=function(e,t,n){return new m(e,t,n)},t.prototype.next=function(e){this.isStopped?g(function(e){return l("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?g(l("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?g(c,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(i.w0),p=Function.prototype.bind;function y(e,t){return p.call(e,t)}var v=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){b(n)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){b(n)}else b(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){b(t)}},e}(),m=function(e){function t(t,n,r){var i,s,a=e.call(this)||this;(0,o.m)(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:a&&u.v.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},i={next:t.next&&y(t.next,s),error:t.error&&y(t.error,s),complete:t.complete&&y(t.complete,s)}):i=t;return a.destination=new v(i),a}return(0,r.ZT)(t,e),t}(d);function b(e){u.v.useDeprecatedSynchronousErrorHandling?(0,h.O)(e):(0,s.h)(e)}function g(e,t){var n=u.v.onStoppedNotification;n&&f.z.setTimeout((function(){return n(e,t)}))}var w={closed:!0,next:a,error:function(e){throw e},complete:a}},7592:(e,t,n)=>{"use strict";n.d(t,{Lc:()=>a,w0:()=>s,Nn:()=>c});var r=n(5556),o=n(8804),i=(0,n(8390).d)((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}})),u=n(1940),s=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,u,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=(0,r.XA)(a),f=c.next();!f.done;f=c.next()){f.value.remove(this)}}catch(m){e={error:m}}finally{try{f&&!f.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else a.remove(this);var h=this.initialTeardown;if((0,o.m)(h))try{h()}catch(b){s=b instanceof i?b.errors:[b]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var p=(0,r.XA)(d),y=p.next();!y.done;y=p.next()){var v=y.value;try{l(v)}catch(g){s=null!=s?s:[],g instanceof i?s=(0,r.ev)((0,r.ev)([],(0,r.CR)(s)),(0,r.CR)(g.errors)):s.push(g)}}}catch(w){n={error:w}}finally{try{y&&!y.done&&(u=p.return)&&u.call(p)}finally{if(n)throw n.error}}}if(s)throw new i(s)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)l(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&(0,u.P)(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&(0,u.P)(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),a=s.EMPTY;function c(e){return e instanceof s||e&&"closed"in e&&(0,o.m)(e.remove)&&(0,o.m)(e.add)&&(0,o.m)(e.unsubscribe)}function l(e){(0,o.m)(e)?e():e.unsubscribe()}},8867:(e,t,n)=>{"use strict";n.d(t,{v:()=>r});var r={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},6871:(e,t,n)=>{"use strict";n.d(t,{z:()=>i});var r=(0,n(8390).d)((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),o=n(7409);function i(e,t){var n="object"==typeof t;return new Promise((function(i,u){var s=new o.Hp({next:function(e){i(e),s.unsubscribe()},error:u,complete:function(){n?i(t.defaultValue):u(new r)}});e.subscribe(s)}))}},8816:(e,t,n)=>{"use strict";n.d(t,{D:()=>_});var r=n(9655),o=n(6771),i=n(5348),u=n(7554);function s(e,t){return void 0===t&&(t=0),(0,i.e)((function(n,r){n.subscribe((0,u.x)(r,(function(n){return(0,o.f)(r,e,(function(){return r.next(n)}),t)}),(function(){return(0,o.f)(r,e,(function(){return r.complete()}),t)}),(function(n){return(0,o.f)(r,e,(function(){return r.error(n)}),t)})))}))}function a(e,t){return void 0===t&&(t=0),(0,i.e)((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}var c=n(3784);var l=n(134),f=n(8804);function h(e,t){if(!e)throw new Error("Iterable cannot be null");return new c.y((function(n){(0,o.f)(n,t,(function(){var r=e[Symbol.asyncIterator]();(0,o.f)(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}var d=n(1525),p=n(1330),y=n(7236),v=n(7940),m=n(8063),b=n(7238),g=n(6527);function w(e,t){if(null!=e){if((0,d.c)(e))return function(e,t){return(0,r.Xf)(e).pipe(a(t),s(t))}(e,t);if((0,y.z)(e))return function(e,t){return new c.y((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if((0,p.t)(e))return function(e,t){return(0,r.Xf)(e).pipe(a(t),s(t))}(e,t);if((0,m.D)(e))return h(e,t);if((0,v.T)(e))return function(e,t){return new c.y((function(n){var r;return(0,o.f)(n,t,(function(){r=e[l.h](),(0,o.f)(n,t,(function(){var e,t,o;try{t=(e=r.next()).value,o=e.done}catch(i){return void n.error(i)}o?n.complete():n.next(t)}),0,!0)})),function(){return(0,f.m)(null==r?void 0:r.return)&&r.return()}}))}(e,t);if((0,g.L)(e))return function(e,t){return h((0,g.Q)(e),t)}(e,t)}throw(0,b.z)(e)}function _(e,t){return t?w(e,t):(0,r.Xf)(e)}},9655:(e,t,n)=>{"use strict";n.d(t,{Xf:()=>y});var r=n(5556),o=n(7236),i=n(1330),u=n(3784),s=n(1525),a=n(8063),c=n(7238),l=n(7940),f=n(6527),h=n(8804),d=n(5046),p=n(3046);function y(e){if(e instanceof u.y)return e;if(null!=e){if((0,s.c)(e))return b=e,new u.y((function(e){var t=b[p.L]();if((0,h.m)(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if((0,o.z)(e))return m=e,new u.y((function(e){for(var t=0;t{"use strict";n.d(t,{T:()=>a});var r=n(5014),o=n(9655),i=new(n(3784).y)((function(e){return e.complete()}));var u=n(3877),s=n(8816);function a(){for(var e=[],t=0;t{"use strict";n.d(t,{x:()=>o});var r=n(5556);function o(e,t,n,r,o){return new i(e,t,n,r,o)}var i=function(e){function t(t,n,r,o,i,u){var s=e.call(this,t)||this;return s.onFinalize=i,s.shouldUnsubscribe=u,s._next=n?function(e){try{n(e)}catch(r){t.error(r)}}:e.prototype._next,s._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return(0,r.ZT)(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(n(7409).Lv)},6005:(e,t,n)=>{"use strict";n.d(t,{x:()=>u});var r=n(4512),o=n(5348),i=n(7554);function u(e,t){return void 0===t&&(t=r.y),e=null!=e?e:s,(0,o.e)((function(n,r){var o,u=!0;n.subscribe((0,i.x)(r,(function(n){var i=t(n);!u&&e(o,i)||(u=!1,o=i,r.next(n))})))}))}function s(e,t){return e===t}},6621:(e,t,n)=>{"use strict";n.d(t,{h:()=>i});var r=n(5348),o=n(7554);function i(e,t){return(0,r.e)((function(n,r){var i=0;n.subscribe((0,o.x)(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}},598:(e,t,n)=>{"use strict";n.d(t,{U:()=>i});var r=n(5348),o=n(7554);function i(e,t){return(0,r.e)((function(n,r){var i=0;n.subscribe((0,o.x)(r,(function(n){r.next(e.call(t,n,i++))})))}))}},5014:(e,t,n)=>{"use strict";n.d(t,{J:()=>i});var r=n(1556),o=n(4512);function i(e){return void 0===e&&(e=1/0),(0,r.z)(o.y,e)}},1556:(e,t,n)=>{"use strict";n.d(t,{z:()=>c});var r=n(598),o=n(9655),i=n(5348),u=n(6771),s=n(7554);var a=n(8804);function c(e,t,n){return void 0===n&&(n=1/0),(0,a.m)(t)?c((function(n,i){return(0,r.U)((function(e,r){return t(n,e,i,r)}))((0,o.Xf)(e(n,i)))}),n):("number"==typeof t&&(n=t),(0,i.e)((function(t,r){return function(e,t,n,r,i,a,c,l){var f=[],h=0,d=0,p=!1,y=function(){!p||f.length||h||t.complete()},v=function(e){return h{"use strict";n.d(t,{b:()=>l});var r=n(5556),o=n(5348),i=Array.isArray;var u=n(5014),s=n(3877),a=n(8816);function c(){for(var e=[],t=0;t{"use strict";n.d(t,{d:()=>f});var r=n(5556),o=n(6974),i={now:function(){return(i.delegate||Date).now()},delegate:void 0},u=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=i);var o=e.call(this)||this;return o._bufferSize=t,o._windowTime=n,o._timestampProvider=r,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,n),o}return(0,r.ZT)(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,o=n._buffer,i=n._infiniteTimeWindow,u=n._timestampProvider,s=n._windowTime;r||(o.push(t),!i&&o.push(u.now()+s)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),o=0;o0&&(t=new a.Hp({next:function(e){return b.next(e)},error:function(e){p=!0,y(),r=l(v,i,e),b.error(e)},complete:function(){h=!0,y(),r=l(v,f),b.complete()}}),(0,s.Xf)(e).subscribe(t))}))(e)}}({connector:function(){return new u(h,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:d})}},6728:(e,t,n)=>{"use strict";n.d(t,{O:()=>a});var r=n(5014);var o=n(3877),i=n(8816);function u(){for(var e=[],t=0;t{"use strict";n.d(t,{z:()=>o});var r=n(5556),o={setTimeout:function(e,t){for(var n=[],i=2;i{"use strict";n.d(t,{h:()=>r});var r="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"},3046:(e,t,n)=>{"use strict";n.d(t,{L:()=>r});var r="function"==typeof Symbol&&Symbol.observable||"@@observable"},3877:(e,t,n)=>{"use strict";n.d(t,{_6:()=>u,yG:()=>i});var r=n(8804);function o(e){return e[e.length-1]}function i(e){return(t=o(e))&&(0,r.m)(t.schedule)?e.pop():void 0;var t}function u(e,t){return"number"==typeof o(e)?e.pop():t}},1940:(e,t,n)=>{"use strict";function r(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}n.d(t,{P:()=>r})},8390:(e,t,n)=>{"use strict";function r(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}n.d(t,{d:()=>r})},3323:(e,t,n)=>{"use strict";n.d(t,{O:()=>u,x:()=>i});var r=n(8867),o=null;function i(e){if(r.v.useDeprecatedSynchronousErrorHandling){var t=!o;if(t&&(o={errorThrown:!1,error:null}),e(),t){var n=o,i=n.errorThrown,u=n.error;if(o=null,i)throw u}}else e()}function u(e){r.v.useDeprecatedSynchronousErrorHandling&&o&&(o.errorThrown=!0,o.error=e)}},6771:(e,t,n)=>{"use strict";function r(e,t,n,r,o){void 0===r&&(r=0),void 0===o&&(o=!1);var i=t.schedule((function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(i),!o)return i}n.d(t,{f:()=>r})},4512:(e,t,n)=>{"use strict";function r(e){return e}n.d(t,{y:()=>r})},7236:(e,t,n)=>{"use strict";n.d(t,{z:()=>r});var r=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},8063:(e,t,n)=>{"use strict";n.d(t,{D:()=>o});var r=n(8804);function o(e){return Symbol.asyncIterator&&(0,r.m)(null==e?void 0:e[Symbol.asyncIterator])}},8804:(e,t,n)=>{"use strict";function r(e){return"function"==typeof e}n.d(t,{m:()=>r})},1525:(e,t,n)=>{"use strict";n.d(t,{c:()=>i});var r=n(3046),o=n(8804);function i(e){return(0,o.m)(e[r.L])}},7940:(e,t,n)=>{"use strict";n.d(t,{T:()=>i});var r=n(134),o=n(8804);function i(e){return(0,o.m)(null==e?void 0:e[r.h])}},1330:(e,t,n)=>{"use strict";n.d(t,{t:()=>o});var r=n(8804);function o(e){return(0,r.m)(null==e?void 0:e.then)}},6527:(e,t,n)=>{"use strict";n.d(t,{L:()=>u,Q:()=>i});var r=n(5556),o=n(8804);function i(e){return(0,r.FC)(this,arguments,(function(){var t,n,o;return(0,r.Jh)(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,(0,r.qq)(t.read())];case 3:return n=i.sent(),o=n.value,n.done?[4,(0,r.qq)(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,(0,r.qq)(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function u(e){return(0,o.m)(null==e?void 0:e.getReader)}},5348:(e,t,n)=>{"use strict";n.d(t,{e:()=>o});var r=n(8804);function o(e){return function(t){if(function(e){return(0,r.m)(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}},5046:(e,t,n)=>{"use strict";n.d(t,{h:()=>i});var r=n(8867),o=n(8822);function i(e){o.z.setTimeout((function(){var t=r.v.onUnhandledError;if(!t)throw e;t(e)}))}},7238:(e,t,n)=>{"use strict";function r(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}n.d(t,{z:()=>r})},75:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==r(t)?t:String(t)}function i(e,t){for(var n=0;nu})},3219:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(6983);function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(0,r.Z)(e,t)}},6983:(e,t,n)=>{"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}n.d(t,{Z:()=>r})},8953:(e,t,n)=>{"use strict";function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}n.d(t,{Z:()=>u});var o=n(6983);function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(i=function(){return!!e})()}function u(e){var t="function"==typeof Map?new Map:void 0;return u=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(i())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var u=new(e.bind.apply(e,r));return n&&(0,o.Z)(u,n.prototype),u}(e,arguments,r(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),(0,o.Z)(n,e)},u(e)}},3981:(e,t,n)=>{"use strict";n.d(t,{g0:()=>K});Promise.resolve(!1),Promise.resolve(!0);var r=Promise.resolve();function o(e,t){return e||(e=0),new Promise((function(n){return setTimeout((function(){return n(t)}),e)}))}function i(){return Math.random().toString(36).substring(2)}var u=0;function s(){var e=1e3*Date.now();return e<=u&&(e=u+1),u=e,e}var a={create:function(e){var t={time:s(),messagesCallback:null,bc:new BroadcastChannel(e),subFns:[]};return t.bc.onmessage=function(e){t.messagesCallback&&t.messagesCallback(e.data)},t},close:function(e){e.bc.close(),e.subFns=[]},onMessage:function(e,t){e.messagesCallback=t},postMessage:function(e,t){try{return e.bc.postMessage(t,!1),r}catch(n){return Promise.reject(n)}},canBeUsed:function(){if("undefined"!=typeof globalThis&&globalThis.Deno&&globalThis.Deno.args)return!0;if("undefined"==typeof window&&"undefined"==typeof self||"function"!=typeof BroadcastChannel)return!1;if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0},type:"native",averageResponseTime:function(){return 150},microSeconds:s},c=n(5898);function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=JSON.parse(JSON.stringify(e));return void 0===t.webWorkerSupport&&(t.webWorkerSupport=!0),t.idb||(t.idb={}),t.idb.ttl||(t.idb.ttl=45e3),t.idb.fallbackInterval||(t.idb.fallbackInterval=150),e.idb&&"function"==typeof e.idb.onclose&&(t.idb.onclose=e.idb.onclose),t.localstorage||(t.localstorage={}),t.localstorage.removeTimeout||(t.localstorage.removeTimeout=6e4),e.methods&&(t.methods=e.methods),t.node||(t.node={}),t.node.ttl||(t.node.ttl=12e4),t.node.maxParallelWrites||(t.node.maxParallelWrites=2048),void 0===t.node.useFastPath&&(t.node.useFastPath=!0),t}var f="pubkey.broadcast-channel-0-",h="messages",d={durability:"relaxed"};function p(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){if(void 0!==window.mozIndexedDB)return window.mozIndexedDB;if(void 0!==window.webkitIndexedDB)return window.webkitIndexedDB;if(void 0!==window.msIndexedDB)return window.msIndexedDB}return!1}function y(e){e.commit&&e.commit()}function v(e,t){var n=e.transaction(h,"readonly",d),r=n.objectStore(h),o=[],i=IDBKeyRange.bound(t+1,1/0);if(r.getAll){var u=r.getAll(i);return new Promise((function(e,t){u.onerror=function(e){return t(e)},u.onsuccess=function(t){e(t.target.result)}}))}return new Promise((function(e,u){var s=function(){try{return i=IDBKeyRange.bound(t+1,1/0),r.openCursor(i)}catch(e){return r.openCursor()}}();s.onerror=function(e){return u(e)},s.onsuccess=function(r){var i=r.target.result;i?i.value.ide.lastCursorId&&(e.lastCursorId=t.id),t})).filter((function(t){return function(e,t){return!(e.uuid===t.uuid||t.eMIs.has(e.id)||e.data.time0||e._addEL.internal.length>0}function R(e,t,n){e._addEL[t].push(n),function(e){if(!e._iL&&D(e)){var t=function(t){e._addEL[t.type].forEach((function(e){t.time>=e.time&&e.fn(t.data)}))},n=e.method.microSeconds();e._prepP?e._prepP.then((function(){e._iL=!0,e.method.onMessage(e._state,t,n)})):(e._iL=!0,e.method.onMessage(e._state,t,n))}}(e)}function q(e,t,n){e._addEL[t]=e._addEL[t].filter((function(e){return e!==n})),function(e){if(e._iL&&!D(e)){e._iL=!1;var t=e.method.microSeconds();e.method.onMessage(e._state,null,t)}}(e)}K._pubkey=!0,K.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return M(this,"message",e)},postInternal:function(e){return M(this,"internal",e)},set onmessage(e){var t={time:this.method.microSeconds(),fn:e};q(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,R(this,"message",t)):this._onML=null},addEventListener:function(e,t){R(this,e,{time:this.method.microSeconds(),fn:t})},removeEventListener:function(e,t){q(this,e,this._addEL[e].find((function(e){return e.fn===t})))},close:function(){var e=this;if(!this.closed){I.delete(this),this.closed=!0;var t=this._prepP?this._prepP:r;return this._onML=null,this._addEL.message=[],t.then((function(){return Promise.all(Array.from(e._uMP))})).then((function(){return Promise.all(e._befC.map((function(e){return e()})))})).then((function(){return e.method.close(e._state)}))}},get type(){return this.method.type},get isClosed(){return this.closed}}},8061:(e,t,n)=>{"use strict";n.d(t,{U:()=>i});var r=n(3340);const o=Symbol.for("Dexie"),i=globalThis[o]||(globalThis[o]=r);if(r.semVer!==i.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${r.semVer} and ${i.semVer}`);const{liveQuery:u,mergeRanges:s,rangesOverlap:a,RangeSet:c,cmp:l,Entity:f}=i},8456:(e,t,n)=>{"use strict";n.d(t,{Rf:()=>N,wu:()=>F});const r=e=>{e.previousResults.unshift(e.changeEvent.doc),e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,e.changeEvent.doc)},o=e=>{e.previousResults.push(e.changeEvent.doc),e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,e.changeEvent.doc)},i=e=>{const t=e.previousResults.shift();e.keyDocumentMap&&t&&e.keyDocumentMap.delete(t[e.queryParams.primaryKey])},u=e=>{const t=e.previousResults.pop();e.keyDocumentMap&&t&&e.keyDocumentMap.delete(t[e.queryParams.primaryKey])},s=e=>{e.keyDocumentMap&&e.keyDocumentMap.delete(e.changeEvent.id);const t=e.queryParams.primaryKey,n=e.previousResults;for(let r=0;r{const t=e.changeEvent.id,n=e.changeEvent.doc;if(e.keyDocumentMap){if(e.keyDocumentMap.has(t))return;e.keyDocumentMap.set(t,n)}else{if(e.previousResults.find((n=>n[e.queryParams.primaryKey]===t)))return}!function(e,t,n,r){var o,i=e.length,u=i-1,s=0;if(0===i)return e.push(t),0;for(;r<=u;)n(o=e[s=r+(u-r>>1)],t)<=0?r=s+1:u=s-1;n(o,t)<=0&&s++,e.splice(s,0,t)}(e.previousResults,n,e.queryParams.sortComparator,0)},c=["doNothing","insertFirst","insertLast","removeFirstItem","removeLastItem","removeFirstInsertLast","removeLastInsertFirst","removeFirstInsertFirst","removeLastInsertLast","removeExisting","replaceExisting","alwaysWrong","insertAtSortPosition","removeExistingAndInsertAtSortPosition","runFullQueryAgain","unknownAction"],l={doNothing:e=>{},insertFirst:r,insertLast:o,removeFirstItem:i,removeLastItem:u,removeFirstInsertLast:e=>{i(e),o(e)},removeLastInsertFirst:e=>{u(e),r(e)},removeFirstInsertFirst:e=>{i(e),r(e)},removeLastInsertLast:e=>{u(e),o(e)},removeExisting:s,replaceExisting:e=>{const t=e.changeEvent.doc,n=e.queryParams.primaryKey,r=e.previousResults;for(let o=0;o{const t={_id:"wrongHuman"+(new Date).getTime()};e.previousResults.length=0,e.previousResults.push(t),e.keyDocumentMap&&(e.keyDocumentMap.clear(),e.keyDocumentMap.set(t._id,t))},insertAtSortPosition:a,removeExistingAndInsertAtSortPosition:e=>{s(e),a(e)},runFullQueryAgain:e=>{throw new Error("Action runFullQueryAgain must be implemented by yourself")},unknownAction:e=>{throw new Error("Action unknownAction should never be called")}};!function(e=6){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let r=0;r!!e.queryParams.limit,b=e=>1===e.queryParams.limit,g=e=>!!(e.queryParams.skip&&e.queryParams.skip>0),w=e=>"DELETE"===e.changeEvent.operation,_=e=>"INSERT"===e.changeEvent.operation,x=e=>"UPDATE"===e.changeEvent.operation,k=e=>m(e)&&e.previousResults.length>=e.queryParams.limit,O=e=>{const t=e.queryParams.sortFields,n=e.changeEvent.previous,r=e.changeEvent.doc;if(!r)return!1;if(!n)return!0;for(let o=0;o{const t=e.changeEvent.id;if(e.keyDocumentMap){return e.keyDocumentMap.has(t)}{const n=e.queryParams.primaryKey,r=e.previousResults;for(let e=0;e{const t=e.previousResults[0];return!(!t||t[e.queryParams.primaryKey]!==e.changeEvent.id)},S=e=>{const t=p(e.previousResults);return!(!t||t[e.queryParams.primaryKey]!==e.changeEvent.id)},A=e=>{const t=e.changeEvent.previous;if(!t)return!1;const n=e.previousResults[0];if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)<0},j=e=>{const t=e.changeEvent.previous;if(!t)return!1;const n=p(e.previousResults);if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)>0},C=e=>{const t=e.changeEvent.doc;if(!t)return!1;const n=e.previousResults[0];if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)<0},I=e=>{const t=e.changeEvent.doc;if(!t)return!1;const n=p(e.previousResults);if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)>0},T=e=>{const t=e.changeEvent.previous;return!!t&&e.queryParams.queryMatcher(t)},K=e=>{const t=e.changeEvent.doc;if(!t)return!1;return e.queryParams.queryMatcher(t)},M=e=>0===e.previousResults.length,D={0:_,1:x,2:w,3:m,4:b,5:g,6:M,7:k,8:P,9:S,10:O,11:E,12:A,13:j,14:C,15:I,16:T,17:K};let R;function q(){return R||(R=function(e){const t=new Map,n=2+2*parseInt(e.charAt(0)+e.charAt(1),10),r=f(e.substring(2,n),2);for(let a=0;afunction(e,t,n){let r=e,o=e.l;for(;;){if(r=r[t[o](n)?"1":"0"],"number"==typeof r||"string"==typeof r)return r;o=r.l}}(q(),D,e);function N(e){const t=B(e);return c[t]}function F(e,t,n,r,o){return(0,l[e])({queryParams:t,changeEvent:n,previousResults:r,keyDocumentMap:o}),r}},5898:(e,t,n)=>{"use strict";n.d(t,{i:()=>r});class r{ttl;map=new Map;_to=!1;constructor(e){this.ttl=e}has(e){return this.map.has(e)}add(e){this.map.set(e,o()),this._to||(this._to=!0,setTimeout((()=>{this._to=!1,function(e){const t=o()-e.ttl,n=e.map[Symbol.iterator]();for(;;){const r=n.next().value;if(!r)return;const o=r[0];if(!(r[1]{"use strict";n.d(t,{JQ:()=>p});Object.freeze({ignoreUnknown:!1,respectType:!1,respectFunctionNames:!1,respectFunctionProperties:!1,unorderedObjects:!0,unorderedArrays:!1,unorderedSets:!1,excludeKeys:void 0,excludeValues:void 0,replacer:void 0});Object.freeze(["prototype","__proto__","constructor"]);const r="[native code] }";r.length;class o{constructor(e,t){e=this.words=e||[],this.sigBytes=void 0===t?4*e.length:t}toString(e){return(e||i).stringify(this)}concat(e){if(this.clamp(),this.sigBytes%4)for(let t=0;t>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=n<<24-(this.sigBytes+t)%4*8}else for(let t=0;t>>2]=e.words[t>>>2];return this.sigBytes+=e.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new o([...this.words])}}const i={stringify(e){const t=[];for(let n=0;n>>2]>>>24-n%4*8&255;t.push((r>>>4).toString(16),(15&r).toString(16))}return t.join("")}},u={parse(e){const t=e.length,n=[];for(let r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o(n,t)}},s={parse:e=>u.parse(unescape(encodeURIComponent(e)))};class a{constructor(){this._data=new o,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=16}reset(){this._data=new o,this._nDataBytes=0}_append(e){"string"==typeof e&&(e=s.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_doProcessBlock(e,t){}_process(e){let t,n=this._data.sigBytes/(4*this.blockSize);n=e?Math.ceil(n):Math.max((0|n)-this._minBufferSize,0);const r=n*this.blockSize,i=Math.min(4*r,this._data.sigBytes);if(r){for(let e=0;e>>7)^(e<<14|e>>>18)^e>>>3,n=h[d-2],r=(n<<15|n>>>17)^(n<<13|n>>>19)^n>>>10;h[d]=t+h[d-7]+r+h[d-16]}const n=r&o^r&i^o&i,p=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),y=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&a^~s&c)+f[d]+h[d];l=c,c=a,a=s,s=u+y|0,u=i,i=o,o=r,r=y+(p+n)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+u|0,n[4]=n[4]+s|0,n[5]=n[5]+a|0,n[6]=n[6]+c|0,n[7]=n[7]+l|0}finalize(e){super.finalize(e);const t=8*this._nDataBytes,n=8*this._data.sigBytes;return this._data.words[n>>>5]|=128<<24-n%32,this._data.words[14+(n+64>>>9<<4)]=Math.floor(t/4294967296),this._data.words[15+(n+64>>>9<<4)]=t,this._data.sigBytes=4*this._data.words.length,this._process(),this._hash}}function p(e){return(new d).finalize(e).toString()}},5556:(e,t,n)=>{"use strict";n.d(t,{CR:()=>a,FC:()=>f,Jh:()=>u,KL:()=>h,XA:()=>s,ZT:()=>o,ev:()=>c,mG:()=>i,qq:()=>l});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function i(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(t){i(t)}}function s(e){try{a(r.throw(e))}catch(t){i(t)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,s)}a((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return u.label++,{value:s[1],done:!1};case 5:u.label++,r=s[1],s=[0];continue;case 7:s=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){u=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function c(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o1||s(e,t)}))})}function s(e,t){try{(n=o[e](t)).value instanceof l?Promise.resolve(n.value.v).then(a,c):f(i[0][2],n)}catch(r){f(i[0][3],r)}var n}function a(e){s("next",e)}function c(e){s("throw",e)}function f(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function h(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=s(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}Object.create;"function"==typeof SuppressedError&&SuppressedError}}]); \ No newline at end of file diff --git a/docs/assets/js/aa14e6b1.fbc151ec.js b/docs/assets/js/aa14e6b1.fbc151ec.js new file mode 100644 index 00000000000..0a48be8e482 --- /dev/null +++ b/docs/assets/js/aa14e6b1.fbc151ec.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[933],{8439:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var r=t(5893),i=t(1151);const a={title:"GraphQL Replication",slug:"replication-graphql.html"},s="Replication with GraphQL",o={id:"replication-graphql",title:"GraphQL Replication",description:"The GraphQL replication provides handlers for GraphQL to run replication with GraphQL as the transportation layer.",source:"@site/docs/replication-graphql.md",sourceDirName:".",slug:"/replication-graphql.html",permalink:"/replication-graphql.html",draft:!1,unlisted:!1,editUrl:"https://github.com/pubkey/rxdb/tree/master/docs-src/docs/replication-graphql.md",tags:[],version:"current",frontMatter:{title:"GraphQL Replication",slug:"replication-graphql.html"},sidebar:"tutorialSidebar",previous:{title:"HTTP Replication",permalink:"/replication-http.html"},next:{title:"Websocket Replication",permalink:"/replication-websocket.html"}},l={},c=[{value:"Usage",id:"usage",level:2},{value:"Creating a compatible GraphQL Server",id:"creating-a-compatible-graphql-server",level:3},{value:"RxDB Client",id:"rxdb-client",level:3},{value:"Pull replication",id:"pull-replication",level:4},{value:"Push replication",id:"push-replication",level:4},{value:"Pull Stream",id:"pull-stream",level:4},{value:"Transforming null to undefined in optional fields",id:"transforming-null-to-undefined-in-optional-fields",level:3},{value:"pull.responseModifier",id:"pullresponsemodifier",level:3},{value:"push.responseModifier",id:"pushresponsemodifier",level:3},{value:"Helper Functions",id:"helper-functions",level:4},{value:"RxGraphQLReplicationState",id:"rxgraphqlreplicationstate",level:3},{value:".setHeaders()",id:"setheaders",level:4},{value:"Sending Cookies",id:"sending-cookies",level:4}];function d(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"replication-with-graphql",children:"Replication with GraphQL"}),"\n",(0,r.jsxs)(n.p,{children:["The GraphQL replication provides handlers for GraphQL to run ",(0,r.jsx)(n.a,{href:"/replication.html",children:"replication"})," with GraphQL as the transportation layer."]}),"\n",(0,r.jsxs)(n.p,{children:["The GraphQL replication is mostly used when you already have a backend that exposes a GraphQL API that can be adjusted to serve as a replication endpoint. If you do not already have a GraphQL endpoint, using the ",(0,r.jsx)(n.a,{href:"/replication-http.html",children:"HTTP replication"})," is an easier solution."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"NOTICE:"})," To play around, check out the full example of the RxDB ",(0,r.jsx)(n.a,{href:"https://github.com/pubkey/rxdb/tree/master/examples/graphql",children:"GraphQL replication with server and client"})]}),"\n",(0,r.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,r.jsxs)(n.p,{children:["Before you use the GraphQL replication, make sure you've learned how the ",(0,r.jsx)(n.a,{href:"/replication.html",children:"RxDB replication"})," works."]}),"\n",(0,r.jsx)(n.h3,{id:"creating-a-compatible-graphql-server",children:"Creating a compatible GraphQL Server"}),"\n",(0,r.jsxs)(n.p,{children:["At the server-side, there must exist an endpoint which returns newer rows when the last ",(0,r.jsx)(n.code,{children:"checkpoint"})," is used as input. For example lets say you create a ",(0,r.jsx)(n.code,{children:"Query"})," ",(0,r.jsx)(n.code,{children:"pullHuman"})," which returns a list of document writes that happened after the given checkpoint."]}),"\n",(0,r.jsxs)(n.p,{children:["For the push-replication, you also need a ",(0,r.jsx)(n.code,{children:"Mutation"})," ",(0,r.jsx)(n.code,{children:"pushHuman"})," which lets RxDB update data of documents by sending the previous document state and the new client document state.\nAlso for being able to stream all ongoing events, we need a ",(0,r.jsx)(n.code,{children:"Subscription"})," called ",(0,r.jsx)(n.code,{children:"streamHuman"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-graphql",children:"input HumanInput {\n id: ID!,\n name: String!,\n lastName: String!,\n updatedAt: Float!,\n deleted: Boolean!\n}\ntype Human {\n id: ID!,\n name: String!,\n lastName: String!,\n updatedAt: Float!,\n deleted: Boolean!\n}\ninput Checkpoint {\n id: String!,\n updatedAt: Float!\n}\ntype HumanPullBulk {\n documents: [Human]!\n checkpoint: Checkpoint\n}\n\ntype Query {\n pullHuman(checkpoint: Checkpoint, limit: Int!): HumanPullBulk!\n}\n\ninput HumanInputPushRow {\n assumedMasterState: HeroInputPushRowT0AssumedMasterStateT0\n newDocumentState: HeroInputPushRowT0NewDocumentStateT0!\n}\n\ntype Mutation {\n # Returns a list of all conflicts\n # If no document write caused a conflict, return an empty list.\n pushHuman(rows: [HumanInputPushRow!]): [Human]\n}\n\n# headers are used to authenticate the subscriptions\n# over websockets.\ninput Headers {\n AUTH_TOKEN: String!;\n}\ntype Subscription {\n streamHuman(headers: Headers): HumanPullBulk!\n}\n\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The GraphQL resolver for the ",(0,r.jsx)(n.code,{children:"pullHuman"})," would then look like:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const rootValue = {\n pullHuman: args => {\n const minId = args.checkpoint ? args.checkpoint.id : '';\n const minUpdatedAt = args.checkpoint ? args.checkpoint.updatedAt : 0;\n\n // sorted by updatedAt first and the id as second\n const sortedDocuments = documents.sort((a, b) => {\n if (a.updatedAt > b.updatedAt) return 1;\n if (a.updatedAt < b.updatedAt) return -1;\n if (a.updatedAt === b.updatedAt) {\n if (a.id > b.id) return 1;\n if (a.id < b.id) return -1;\n else return 0;\n }\n });\n\n // only return documents newer than the input document\n const filterForMinUpdatedAtAndId = sortedDocuments.filter(doc => {\n if (doc.updatedAt < minUpdatedAt) return false;\n if (doc.updatedAt > minUpdatedAt) return true;\n if (doc.updatedAt === minUpdatedAt) {\n // if updatedAt is equal, compare by id\n if (doc.id > minId) return true;\n else return false;\n }\n });\n\n // only return some documents in one batch\n const limitedDocs = filterForMinUpdatedAtAndId.slice(0, args.limit);\n\n // use the last document for the checkpoint\n const lastDoc = limitedDocs[limitedDocs.length - 1];\n const retCheckpoint = {\n id: lastDoc.id,\n updatedAt: lastDoc.updatedAt\n }\n\n return {\n documents: limitedDocs,\n checkpoint: retCheckpoint\n }\n\n return limited;\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["For examples for the other resolvers, consult the ",(0,r.jsx)(n.a,{href:"https://github.com/pubkey/rxdb/blob/master/examples/graphql/server/index.js",children:"GraphQL Example Project"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"rxdb-client",children:"RxDB Client"}),"\n",(0,r.jsx)(n.h4,{id:"pull-replication",children:"Pull replication"}),"\n",(0,r.jsxs)(n.p,{children:["For the pull-replication, you first need a ",(0,r.jsx)(n.code,{children:"pullQueryBuilder"}),". This is a function that gets the last replication ",(0,r.jsx)(n.code,{children:"checkpoint"})," and a ",(0,r.jsx)(n.code,{children:"limit"})," as input and returns an object with a GraphQL-query and its variables (or a promise that resolves to the same object). RxDB will use the query builder to construct what is later sent to the GraphQL endpoint."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const pullQueryBuilder = (checkpoint, limit) => {\n /**\n * The first pull does not have a checkpoint\n * so we fill it up with defaults\n */\n if (!checkpoint) {\n checkpoint = {\n id: '',\n updatedAt: 0\n };\n }\n const query = `query PullHuman($checkpoint: CheckpointInput, $limit: Int!) {\n pullHuman(checkpoint: $checkpoint, limit: $limit) {\n documents {\n id\n name\n age\n updatedAt\n deleted\n }\n checkpoint {\n id\n updatedAt\n }\n }\n }`;\n return {\n query,\n operationName: 'PullHuman',\n variables: {\n checkpoint,\n limit\n }\n };\n};\n"})}),"\n",(0,r.jsx)(n.p,{children:"With the queryBuilder, you can then setup the pull-replication."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import { replicateGraphQL } from 'rxdb/plugins/replication-graphql';\nconst replicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n // urls to the GraphQL endpoints\n url: {\n http: 'http://example.com/graphql'\n },\n pull: {\n queryBuilder: pullQueryBuilder, // the queryBuilder from above\n modifier: doc => doc, // (optional) modifies all pulled documents before they are handled by RxDB\n dataPath: undefined, // (optional) specifies the object path to access the document(s). Otherwise, the first result of the response data is used.\n /**\n * Amount of documents that the remote will send in one request.\n * If the response contains less then [batchSize] documents,\n * RxDB will assume there are no more changes on the backend\n * that are not replicated.\n * This value is the same as the limit in the pullHuman() schema.\n * [default=100]\n */\n batchSize: 50\n },\n // headers which will be used in http requests against the server.\n headers: {\n Authorization: 'Bearer abcde...'\n },\n\n /**\n * Options that have been inherited from the RxReplication\n */\n deletedField: 'deleted',\n live: true,\n retryTime = 1000 * 5,\n waitForLeadership = true,\n autoStart = true,\n }\n);\n"})}),"\n",(0,r.jsx)(n.h4,{id:"push-replication",children:"Push replication"}),"\n",(0,r.jsxs)(n.p,{children:["For the push-replication, you also need a ",(0,r.jsx)(n.code,{children:"queryBuilder"}),". Here, the builder receives a changed document as input which has to be send to the server. It also returns a GraphQL-Query and its data."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const pushQueryBuilder = rows => {\n const query = `\n mutation PushHuman($writeRows: [HumanInputPushRow!]) {\n pushHuman(writeRows: $writeRows) {\n id\n name\n age\n updatedAt\n deleted\n }\n }\n `;\n const variables = {\n writeRows: rows\n };\n return {\n query,\n operationName: 'PushHuman',\n variables\n };\n};\n"})}),"\n",(0,r.jsx)(n.p,{children:"With the queryBuilder, you can then setup the push-replication."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const replicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n // urls to the GraphQL endpoints\n url: {\n http: 'http://example.com/graphql'\n },\n push: {\n queryBuilder: pushQueryBuilder, // the queryBuilder from above\n /**\n * batchSize (optional)\n * Amount of document that will be pushed to the server in a single request.\n */\n batchSize: 5,\n /**\n * modifier (optional)\n * Modifies all pushed documents before they are send to the GraphQL endpoint.\n * Returning null will skip the document.\n */\n modifier: doc => doc\n },\n headers: {\n Authorization: 'Bearer abcde...'\n },\n pull: {\n /* ... */\n },\n /* ... */\n }\n);\n"})}),"\n",(0,r.jsx)(n.h4,{id:"pull-stream",children:"Pull Stream"}),"\n",(0,r.jsxs)(n.p,{children:["To create a ",(0,r.jsx)(n.strong,{children:"realtime"})," replication, you need to create a pull stream that pulls ongoing writes from the server.\nThe pull stream gets the ",(0,r.jsx)(n.code,{children:"headers"})," of the ",(0,r.jsx)(n.code,{children:"RxReplicationState"})," as input, so that it can be authenticated on the backend."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const pullStreamQueryBuilder = (headers) => {\n const query = `subscription onStream($headers: Headers) {\n streamHero(headers: $headers) {\n documents {\n id,\n name,\n age,\n updatedAt,\n deleted\n },\n checkpoint {\n id\n updatedAt\n }\n }\n }`;\n return {\n query,\n variables: {\n headers\n }\n };\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["With the ",(0,r.jsx)(n.code,{children:"pullStreamQueryBuilder"})," you can then start a realtime replication."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const replicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n // urls to the GraphQL endpoints\n url: {\n http: 'http://example.com/graphql',\n ws: 'ws://example.com/subscriptions' // <- The websocket has to use a different url.\n },\n push: {\n batchSize: 100,\n queryBuilder: pushQueryBuilder\n },\n headers: {\n Authorization: 'Bearer abcde...'\n },\n pull: {\n batchSize: 100,\n queryBuilder: pullQueryBuilder,\n streamQueryBuilder: pullStreamQueryBuilder,\n includeWsHeaders: false, // Includes headers as connection parameter to Websocket.\n },\n deletedField: 'deleted'\n }\n);\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"NOTICE"}),": If it is not possible to create a websocket server on your backend, you can use any other method of pull out the ongoing events from the backend and then you can send them into ",(0,r.jsx)(n.code,{children:"RxReplicationState.emitEvent()"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"transforming-null-to-undefined-in-optional-fields",children:"Transforming null to undefined in optional fields"}),"\n",(0,r.jsxs)(n.p,{children:["GraphQL fills up non-existent optional values with ",(0,r.jsx)(n.code,{children:"null"})," while RxDB required them to be ",(0,r.jsx)(n.code,{children:"undefined"}),".\nTherefore, if your schema contains optional properties, you have to transform the pulled data to switch out ",(0,r.jsx)(n.code,{children:"null"})," to ",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const replicationState: RxGraphQLReplicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n url: {/* ... */},\n headers: {/* ... */},\n push: {/* ... */},\n pull: {\n queryBuilder: pullQueryBuilder,\n modifier: (doc => {\n // We have to remove optional non-existent field values\n // they are set as null by GraphQL but should be undefined\n Object.entries(doc).forEach(([k, v]) => {\n if (v === null) {\n delete doc[k];\n }\n });\n return doc;\n })\n },\n /* ... */\n }\n);\n"})}),"\n",(0,r.jsx)(n.h3,{id:"pullresponsemodifier",children:"pull.responseModifier"}),"\n",(0,r.jsxs)(n.p,{children:["With the ",(0,r.jsx)(n.code,{children:"pull.responseModifier"})," you can modify the whole response from the GraphQL endpoint ",(0,r.jsx)(n.strong,{children:"before"})," it is processed by RxDB.\nFor example if your endpoint is not capable of returning a valid checkpoint, but instead only returns the plain document array, you can use the ",(0,r.jsx)(n.code,{children:"responseModifier"})," to aggregate the checkpoint from the returned documents."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import {\n\n} from 'rxdb';\nconst replicationState: RxGraphQLReplicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n url: {/* ... */},\n headers: {/* ... */},\n push: {/* ... */},\n pull: {\n responseModifier: async function(\n plainResponse, // the exact response that was returned from the server\n origin, // either 'handler' if plainResponse came from the pull.handler, or 'stream' if it came from the pull.stream\n requestCheckpoint // if origin==='handler', the requestCheckpoint contains the checkpoint that was send to the backend\n ) {\n /**\n * In this example we aggregate the checkpoint from the documents array\n * that was returned from the graphql endpoint.\n */\n const docs = plainResponse;\n return {\n documents: docs,\n checkpoint: docs.length === 0 ? requestCheckpoint : {\n name: lastOfArray(docs).name,\n updatedAt: lastOfArray(docs).updatedAt\n }\n };\n }\n },\n /* ... */\n }\n);\n"})}),"\n",(0,r.jsx)(n.h3,{id:"pushresponsemodifier",children:"push.responseModifier"}),"\n",(0,r.jsx)(n.p,{children:"It's also possible to modify the response of a push mutation. For example if your server returns more than the just conflicting docs:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-graphql",children:"type PushResponse {\n conflicts: [Human]\n conflictMessages: [ReplicationConflictMessage]\n}\n\ntype Mutation {\n # Returns a PushResponse type that contains the conflicts along with other information\n pushHuman(rows: [HumanInputPushRow!]): PushResponse!\n}\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'import {} from "rxdb";\nconst replicationState: RxGraphQLReplicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n url: {/* ... */},\n headers: {/* ... */},\n push: {\n responseModifier: async function (plainResponse) {\n /**\n * In this example we aggregate the conflicting documents from a response object\n */\n return plainResponse.conflicts;\n },\n },\n pull: {/* ... */},\n /* ... */\n }\n);\n'})}),"\n",(0,r.jsx)(n.h4,{id:"helper-functions",children:"Helper Functions"}),"\n",(0,r.jsxs)(n.p,{children:["RxDB provides the helper functions ",(0,r.jsx)(n.code,{children:"graphQLSchemaFromRxSchema()"}),", ",(0,r.jsx)(n.code,{children:"pullQueryBuilderFromRxSchema()"}),", ",(0,r.jsx)(n.code,{children:"pullStreamBuilderFromRxSchema()"})," and ",(0,r.jsx)(n.code,{children:"pushQueryBuilderFromRxSchema()"})," that can be used to generate handlers and schemas from the ",(0,r.jsx)(n.code,{children:"RxJsonSchema"}),". To learn how to use them, please inspect the ",(0,r.jsx)(n.a,{href:"https://github.com/pubkey/rxdb/tree/master/examples/graphql",children:"GraphQL Example"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"rxgraphqlreplicationstate",children:"RxGraphQLReplicationState"}),"\n",(0,r.jsxs)(n.p,{children:["When you call ",(0,r.jsx)(n.code,{children:"myCollection.syncGraphQL()"})," it returns a ",(0,r.jsx)(n.code,{children:"RxGraphQLReplicationState"})," which can be used to subscribe to events, for debugging or other functions. It extends the ",(0,r.jsx)(n.a,{href:"/replication.html",children:"RxReplicationState"})," with some GraphQL specific methods."]}),"\n",(0,r.jsx)(n.h4,{id:"setheaders",children:".setHeaders()"}),"\n",(0,r.jsx)(n.p,{children:"Changes the headers for the replication after it has been set up."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"replicationState.setHeaders({\n Authorization: `...`\n});\n"})}),"\n",(0,r.jsx)(n.h4,{id:"sending-cookies",children:"Sending Cookies"}),"\n",(0,r.jsxs)(n.p,{children:["The underlying fetch framework uses a ",(0,r.jsx)(n.code,{children:"same-origin"})," policy for credentials per default. That means, cookies and session data is only shared if you backend and frontend run on the same domain and port. Pass the credential parameter to ",(0,r.jsx)(n.code,{children:"include"})," cookies in requests to servers from different origins via:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"replicationState.setCredentials('include');\n"})}),"\n",(0,r.jsxs)(n.p,{children:["or directly pass it in the the ",(0,r.jsx)(n.code,{children:"syncGraphQL"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"replicateGraphQL(\n {\n collection: myRxCollection,\n /* ... */\n credentials: 'include',\n /* ... */\n }\n);\n"})}),"\n",(0,r.jsxs)(n.p,{children:["See ",(0,r.jsx)(n.a,{href:"https://fetch.spec.whatwg.org/#concept-request-credentials-mode",children:"the fetch spec"})," for more information about available options."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"NOTICE:"})," To play around, check out the full example of the RxDB ",(0,r.jsx)(n.a,{href:"https://github.com/pubkey/rxdb/tree/master/examples/graphql",children:"GraphQL replication with server and client"})]})]})}function h(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},1151:(e,n,t)=>{t.d(n,{Z:()=>o,a:()=>s});var r=t(7294);const i={},a=r.createContext(i);function s(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/docs/assets/js/aa14e6b1.fda346b3.js b/docs/assets/js/aa14e6b1.fda346b3.js deleted file mode 100644 index a944c53abd7..00000000000 --- a/docs/assets/js/aa14e6b1.fda346b3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[933],{8439:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var r=t(5893),i=t(1151);const a={title:"GraphQL Replication",slug:"replication-graphql.html"},s="Replication with GraphQL",o={id:"replication-graphql",title:"GraphQL Replication",description:"The GraphQL replication provides handlers for GraphQL to run replication with GraphQL as the transportation layer.",source:"@site/docs/replication-graphql.md",sourceDirName:".",slug:"/replication-graphql.html",permalink:"/replication-graphql.html",draft:!1,unlisted:!1,editUrl:"https://github.com/pubkey/rxdb/tree/master/docs-src/docs/replication-graphql.md",tags:[],version:"current",frontMatter:{title:"GraphQL Replication",slug:"replication-graphql.html"},sidebar:"tutorialSidebar",previous:{title:"HTTP Replication",permalink:"/replication-http.html"},next:{title:"Websocket Replication",permalink:"/replication-websocket.html"}},l={},c=[{value:"Usage",id:"usage",level:2},{value:"Creating a compatible GraphQL Server",id:"creating-a-compatible-graphql-server",level:3},{value:"RxDB Client",id:"rxdb-client",level:3},{value:"Pull replication",id:"pull-replication",level:4},{value:"Push replication",id:"push-replication",level:4},{value:"Pull Stream",id:"pull-stream",level:4},{value:"Transforming null to undefined in optional fields",id:"transforming-null-to-undefined-in-optional-fields",level:3},{value:"pull.responseModifier",id:"pullresponsemodifier",level:3},{value:"push.responseModifier",id:"pushresponsemodifier",level:3},{value:"Helper Functions",id:"helper-functions",level:4},{value:"RxGraphQLReplicationState",id:"rxgraphqlreplicationstate",level:3},{value:".setHeaders()",id:"setheaders",level:4},{value:"Sending Cookies",id:"sending-cookies",level:4}];function d(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",p:"p",pre:"pre",strong:"strong",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"replication-with-graphql",children:"Replication with GraphQL"}),"\n",(0,r.jsxs)(n.p,{children:["The GraphQL replication provides handlers for GraphQL to run ",(0,r.jsx)(n.a,{href:"/replication.html",children:"replication"})," with GraphQL as the transportation layer."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"NOTICE:"})," To play around, check out the full example of the RxDB ",(0,r.jsx)(n.a,{href:"https://github.com/pubkey/rxdb/tree/master/examples/graphql",children:"GraphQL replication with server and client"})]}),"\n",(0,r.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,r.jsxs)(n.p,{children:["Before you use the GraphQL replication, make sure you've learned how the ",(0,r.jsx)(n.a,{href:"/replication.html",children:"RxDB replication"})," works."]}),"\n",(0,r.jsx)(n.h3,{id:"creating-a-compatible-graphql-server",children:"Creating a compatible GraphQL Server"}),"\n",(0,r.jsxs)(n.p,{children:["At the server-side, there must exist an endpoint which returns newer rows when the last ",(0,r.jsx)(n.code,{children:"checkpoint"})," is used as input. For example lets say you create a ",(0,r.jsx)(n.code,{children:"Query"})," ",(0,r.jsx)(n.code,{children:"pullHuman"})," which returns a list of document writes that happened after the given checkpoint."]}),"\n",(0,r.jsxs)(n.p,{children:["For the push-replication, you also need a ",(0,r.jsx)(n.code,{children:"Mutation"})," ",(0,r.jsx)(n.code,{children:"pushHuman"})," which lets RxDB update data of documents by sending the previous document state and the new client document state.\nAlso for being able to stream all ongoing events, we need a ",(0,r.jsx)(n.code,{children:"Subscription"})," called ",(0,r.jsx)(n.code,{children:"streamHuman"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-graphql",children:"input HumanInput {\n id: ID!,\n name: String!,\n lastName: String!,\n updatedAt: Float!,\n deleted: Boolean!\n}\ntype Human {\n id: ID!,\n name: String!,\n lastName: String!,\n updatedAt: Float!,\n deleted: Boolean!\n}\ninput Checkpoint {\n id: String!,\n updatedAt: Float!\n}\ntype HumanPullBulk {\n documents: [Human]!\n checkpoint: Checkpoint\n}\n\ntype Query {\n pullHuman(checkpoint: Checkpoint, limit: Int!): HumanPullBulk!\n}\n\ninput HumanInputPushRow {\n assumedMasterState: HeroInputPushRowT0AssumedMasterStateT0\n newDocumentState: HeroInputPushRowT0NewDocumentStateT0!\n}\n\ntype Mutation {\n # Returns a list of all conflicts\n # If no document write caused a conflict, return an empty list.\n pushHuman(rows: [HumanInputPushRow!]): [Human]\n}\n\n# headers are used to authenticate the subscriptions\n# over websockets.\ninput Headers {\n AUTH_TOKEN: String!;\n}\ntype Subscription {\n streamHuman(headers: Headers): HumanPullBulk!\n}\n\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The GraphQL resolver for the ",(0,r.jsx)(n.code,{children:"pullHuman"})," would then look like:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const rootValue = {\n pullHuman: args => {\n const minId = args.checkpoint ? args.checkpoint.id : '';\n const minUpdatedAt = args.checkpoint ? args.checkpoint.updatedAt : 0;\n\n // sorted by updatedAt first and the id as second\n const sortedDocuments = documents.sort((a, b) => {\n if (a.updatedAt > b.updatedAt) return 1;\n if (a.updatedAt < b.updatedAt) return -1;\n if (a.updatedAt === b.updatedAt) {\n if (a.id > b.id) return 1;\n if (a.id < b.id) return -1;\n else return 0;\n }\n });\n\n // only return documents newer than the input document\n const filterForMinUpdatedAtAndId = sortedDocuments.filter(doc => {\n if (doc.updatedAt < minUpdatedAt) return false;\n if (doc.updatedAt > minUpdatedAt) return true;\n if (doc.updatedAt === minUpdatedAt) {\n // if updatedAt is equal, compare by id\n if (doc.id > minId) return true;\n else return false;\n }\n });\n\n // only return some documents in one batch\n const limitedDocs = filterForMinUpdatedAtAndId.slice(0, args.limit);\n\n // use the last document for the checkpoint\n const lastDoc = limitedDocs[limitedDocs.length - 1];\n const retCheckpoint = {\n id: lastDoc.id,\n updatedAt: lastDoc.updatedAt\n }\n\n return {\n documents: limitedDocs,\n checkpoint: retCheckpoint\n }\n\n return limited;\n }\n}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["For examples for the other resolvers, consult the ",(0,r.jsx)(n.a,{href:"https://github.com/pubkey/rxdb/blob/master/examples/graphql/server/index.js",children:"GraphQL Example Project"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"rxdb-client",children:"RxDB Client"}),"\n",(0,r.jsx)(n.h4,{id:"pull-replication",children:"Pull replication"}),"\n",(0,r.jsxs)(n.p,{children:["For the pull-replication, you first need a ",(0,r.jsx)(n.code,{children:"pullQueryBuilder"}),". This is a function that gets the last replication ",(0,r.jsx)(n.code,{children:"checkpoint"})," and a ",(0,r.jsx)(n.code,{children:"limit"})," as input and returns an object with a GraphQL-query and its variables (or a promise that resolves to the same object). RxDB will use the query builder to construct what is later sent to the GraphQL endpoint."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const pullQueryBuilder = (checkpoint, limit) => {\n /**\n * The first pull does not have a checkpoint\n * so we fill it up with defaults\n */\n if (!checkpoint) {\n checkpoint = {\n id: '',\n updatedAt: 0\n };\n }\n const query = `query PullHuman($checkpoint: CheckpointInput, $limit: Int!) {\n pullHuman(checkpoint: $checkpoint, limit: $limit) {\n documents {\n id\n name\n age\n updatedAt\n deleted\n }\n checkpoint {\n id\n updatedAt\n }\n }\n }`;\n return {\n query,\n operationName: 'PullHuman',\n variables: {\n checkpoint,\n limit\n }\n };\n};\n"})}),"\n",(0,r.jsx)(n.p,{children:"With the queryBuilder, you can then setup the pull-replication."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"import { replicateGraphQL } from 'rxdb/plugins/replication-graphql';\nconst replicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n // urls to the GraphQL endpoints\n url: {\n http: 'http://example.com/graphql'\n },\n pull: {\n queryBuilder: pullQueryBuilder, // the queryBuilder from above\n modifier: doc => doc, // (optional) modifies all pulled documents before they are handled by RxDB\n dataPath: undefined, // (optional) specifies the object path to access the document(s). Otherwise, the first result of the response data is used.\n /**\n * Amount of documents that the remote will send in one request.\n * If the response contains less then [batchSize] documents,\n * RxDB will assume there are no more changes on the backend\n * that are not replicated.\n * This value is the same as the limit in the pullHuman() schema.\n * [default=100]\n */\n batchSize: 50\n },\n // headers which will be used in http requests against the server.\n headers: {\n Authorization: 'Bearer abcde...'\n },\n\n /**\n * Options that have been inherited from the RxReplication\n */\n deletedField: 'deleted',\n live: true,\n retryTime = 1000 * 5,\n waitForLeadership = true,\n autoStart = true,\n }\n);\n"})}),"\n",(0,r.jsx)(n.h4,{id:"push-replication",children:"Push replication"}),"\n",(0,r.jsxs)(n.p,{children:["For the push-replication, you also need a ",(0,r.jsx)(n.code,{children:"queryBuilder"}),". Here, the builder receives a changed document as input which has to be send to the server. It also returns a GraphQL-Query and its data."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const pushQueryBuilder = rows => {\n const query = `\n mutation PushHuman($writeRows: [HumanInputPushRow!]) {\n pushHuman(writeRows: $writeRows) {\n id\n name\n age\n updatedAt\n deleted\n }\n }\n `;\n const variables = {\n writeRows: rows\n };\n return {\n query,\n operationName: 'PushHuman',\n variables\n };\n};\n"})}),"\n",(0,r.jsx)(n.p,{children:"With the queryBuilder, you can then setup the push-replication."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const replicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n // urls to the GraphQL endpoints\n url: {\n http: 'http://example.com/graphql'\n },\n push: {\n queryBuilder: pushQueryBuilder, // the queryBuilder from above\n /**\n * batchSize (optional)\n * Amount of document that will be pushed to the server in a single request.\n */\n batchSize: 5,\n /**\n * modifier (optional)\n * Modifies all pushed documents before they are send to the GraphQL endpoint.\n * Returning null will skip the document.\n */\n modifier: doc => doc\n },\n headers: {\n Authorization: 'Bearer abcde...'\n },\n pull: {\n /* ... */\n },\n /* ... */\n }\n);\n"})}),"\n",(0,r.jsx)(n.h4,{id:"pull-stream",children:"Pull Stream"}),"\n",(0,r.jsxs)(n.p,{children:["To create a ",(0,r.jsx)(n.strong,{children:"realtime"})," replication, you need to create a pull stream that pulls ongoing writes from the server.\nThe pull stream gets the ",(0,r.jsx)(n.code,{children:"headers"})," of the ",(0,r.jsx)(n.code,{children:"RxReplicationState"})," as input, so that it can be authenticated on the backend."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const pullStreamQueryBuilder = (headers) => {\n const query = `subscription onStream($headers: Headers) {\n streamHero(headers: $headers) {\n documents {\n id,\n name,\n age,\n updatedAt,\n deleted\n },\n checkpoint {\n id\n updatedAt\n }\n }\n }`;\n return {\n query,\n variables: {\n headers\n }\n };\n};\n"})}),"\n",(0,r.jsxs)(n.p,{children:["With the ",(0,r.jsx)(n.code,{children:"pullStreamQueryBuilder"})," you can then start a realtime replication."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const replicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n // urls to the GraphQL endpoints\n url: {\n http: 'http://example.com/graphql',\n ws: 'ws://example.com/subscriptions' // <- The websocket has to use a different url.\n },\n push: {\n batchSize: 100,\n queryBuilder: pushQueryBuilder\n },\n headers: {\n Authorization: 'Bearer abcde...'\n },\n pull: {\n batchSize: 100,\n queryBuilder: pullQueryBuilder,\n streamQueryBuilder: pullStreamQueryBuilder,\n includeWsHeaders: false, // Includes headers as connection parameter to Websocket.\n },\n deletedField: 'deleted'\n }\n);\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"NOTICE"}),": If it is not possible to create a websocket server on your backend, you can use any other method of pull out the ongoing events from the backend and then you can send them into ",(0,r.jsx)(n.code,{children:"RxReplicationState.emitEvent()"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"transforming-null-to-undefined-in-optional-fields",children:"Transforming null to undefined in optional fields"}),"\n",(0,r.jsxs)(n.p,{children:["GraphQL fills up non-existent optional values with ",(0,r.jsx)(n.code,{children:"null"})," while RxDB required them to be ",(0,r.jsx)(n.code,{children:"undefined"}),".\nTherefore, if your schema contains optional properties, you have to transform the pulled data to switch out ",(0,r.jsx)(n.code,{children:"null"})," to ",(0,r.jsx)(n.code,{children:"undefined"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"const replicationState: RxGraphQLReplicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n url: {/* ... */},\n headers: {/* ... */},\n push: {/* ... */},\n pull: {\n queryBuilder: pullQueryBuilder,\n modifier: (doc => {\n // We have to remove optional non-existent field values\n // they are set as null by GraphQL but should be undefined\n Object.entries(doc).forEach(([k, v]) => {\n if (v === null) {\n delete doc[k];\n }\n });\n return doc;\n })\n },\n /* ... */\n }\n);\n"})}),"\n",(0,r.jsx)(n.h3,{id:"pullresponsemodifier",children:"pull.responseModifier"}),"\n",(0,r.jsxs)(n.p,{children:["With the ",(0,r.jsx)(n.code,{children:"pull.responseModifier"})," you can modify the whole response from the GraphQL endpoint ",(0,r.jsx)(n.strong,{children:"before"})," it is processed by RxDB.\nFor example if your endpoint is not capable of returning a valid checkpoint, but instead only returns the plain document array, you can use the ",(0,r.jsx)(n.code,{children:"responseModifier"})," to aggregate the checkpoint from the returned documents."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"import {\n\n} from 'rxdb';\nconst replicationState: RxGraphQLReplicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n url: {/* ... */},\n headers: {/* ... */},\n push: {/* ... */},\n pull: {\n responseModifier: async function(\n plainResponse, // the exact response that was returned from the server\n origin, // either 'handler' if plainResponse came from the pull.handler, or 'stream' if it came from the pull.stream\n requestCheckpoint // if origin==='handler', the requestCheckpoint contains the checkpoint that was send to the backend\n ) {\n /**\n * In this example we aggregate the checkpoint from the documents array\n * that was returned from the graphql endpoint.\n */\n const docs = plainResponse;\n return {\n documents: docs,\n checkpoint: docs.length === 0 ? requestCheckpoint : {\n name: lastOfArray(docs).name,\n updatedAt: lastOfArray(docs).updatedAt\n }\n };\n }\n },\n /* ... */\n }\n);\n"})}),"\n",(0,r.jsx)(n.h3,{id:"pushresponsemodifier",children:"push.responseModifier"}),"\n",(0,r.jsx)(n.p,{children:"It's also possible to modify the response of a push mutation. For example if your server returns more than the just conflicting docs:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-graphql",children:"type PushResponse {\n conflicts: [Human]\n conflictMessages: [ReplicationConflictMessage]\n}\n\ntype Mutation {\n # Returns a PushResponse type that contains the conflicts along with other information\n pushHuman(rows: [HumanInputPushRow!]): PushResponse!\n}\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'import {} from "rxdb";\nconst replicationState: RxGraphQLReplicationState = replicateGraphQL(\n {\n collection: myRxCollection,\n url: {/* ... */},\n headers: {/* ... */},\n push: {\n responseModifier: async function (plainResponse) {\n /**\n * In this example we aggregate the conflicting documents from a response object\n */\n return plainResponse.conflicts;\n },\n },\n pull: {/* ... */},\n /* ... */\n }\n);\n'})}),"\n",(0,r.jsx)(n.h4,{id:"helper-functions",children:"Helper Functions"}),"\n",(0,r.jsxs)(n.p,{children:["RxDB provides the helper functions ",(0,r.jsx)(n.code,{children:"graphQLSchemaFromRxSchema()"}),", ",(0,r.jsx)(n.code,{children:"pullQueryBuilderFromRxSchema()"}),", ",(0,r.jsx)(n.code,{children:"pullStreamBuilderFromRxSchema()"})," and ",(0,r.jsx)(n.code,{children:"pushQueryBuilderFromRxSchema()"})," that can be used to generate handlers and schemas from the ",(0,r.jsx)(n.code,{children:"RxJsonSchema"}),". To learn how to use them, please inspect the ",(0,r.jsx)(n.a,{href:"https://github.com/pubkey/rxdb/tree/master/examples/graphql",children:"GraphQL Example"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"rxgraphqlreplicationstate",children:"RxGraphQLReplicationState"}),"\n",(0,r.jsxs)(n.p,{children:["When you call ",(0,r.jsx)(n.code,{children:"myCollection.syncGraphQL()"})," it returns a ",(0,r.jsx)(n.code,{children:"RxGraphQLReplicationState"})," which can be used to subscribe to events, for debugging or other functions. It extends the ",(0,r.jsx)(n.a,{href:"/replication.html",children:"RxReplicationState"})," with some GraphQL specific methods."]}),"\n",(0,r.jsx)(n.h4,{id:"setheaders",children:".setHeaders()"}),"\n",(0,r.jsx)(n.p,{children:"Changes the headers for the replication after it has been set up."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"replicationState.setHeaders({\n Authorization: `...`\n});\n"})}),"\n",(0,r.jsx)(n.h4,{id:"sending-cookies",children:"Sending Cookies"}),"\n",(0,r.jsxs)(n.p,{children:["The underlying fetch framework uses a ",(0,r.jsx)(n.code,{children:"same-origin"})," policy for credentials per default. That means, cookies and session data is only shared if you backend and frontend run on the same domain and port. Pass the credential parameter to ",(0,r.jsx)(n.code,{children:"include"})," cookies in requests to servers from different origins via:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"replicationState.setCredentials('include');\n"})}),"\n",(0,r.jsxs)(n.p,{children:["or directly pass it in the the ",(0,r.jsx)(n.code,{children:"syncGraphQL"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-js",children:"replicateGraphQL(\n {\n collection: myRxCollection,\n /* ... */\n credentials: 'include',\n /* ... */\n }\n);\n"})}),"\n",(0,r.jsxs)(n.p,{children:["See ",(0,r.jsx)(n.a,{href:"https://fetch.spec.whatwg.org/#concept-request-credentials-mode",children:"the fetch spec"})," for more information about available options."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"NOTICE:"})," To play around, check out the full example of the RxDB ",(0,r.jsx)(n.a,{href:"https://github.com/pubkey/rxdb/tree/master/examples/graphql",children:"GraphQL replication with server and client"})]})]})}function h(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},1151:(e,n,t)=>{t.d(n,{Z:()=>o,a:()=>s});var r=t(7294);const i={},a=r.createContext(i);function s(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/docs/assets/js/main.b9c9341f.js b/docs/assets/js/main.b2130183.js similarity index 99% rename from docs/assets/js/main.b9c9341f.js rename to docs/assets/js/main.b2130183.js index f640f241ee5..23bcfd60be8 100644 --- a/docs/assets/js/main.b9c9341f.js +++ b/docs/assets/js/main.b2130183.js @@ -1,2 +1,2 @@ -/*! For license information please see main.b9c9341f.js.LICENSE.txt */ -(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[179],{723:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});n(7294);var r=n(8356),a=n.n(r),o=n(6887);const i={"0027230a":[()=>n.e(7729).then(n.bind(n,1314)),"@site/docs/rx-storage-lokijs.md",1314],"01684a0a":[()=>n.e(1705).then(n.bind(n,6262)),"@site/docs/rx-storage-memory-synced.md",6262],"03e37916":[()=>n.e(1920).then(n.bind(n,9593)),"@site/docs/transactions-conflicts-revisions.md",9593],"045bd6f5":[()=>n.e(1314).then(n.bind(n,2203)),"@site/docs/encryption.md",2203],"04b0214f":[()=>n.e(7681).then(n.t.bind(n,5745,19)),"/home/runner/work/rxdb/rxdb/docs-src/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",5745],"0e268d20":[()=>Promise.all([n.e(6560),n.e(2160)]).then(n.bind(n,6451)),"@site/src/pages/premium.tsx",6451],"0e945c41":[()=>n.e(8280).then(n.bind(n,1413)),"@site/docs/replication-server.md",1413],"0f6e10f0":[()=>n.e(8705).then(n.bind(n,7694)),"@site/docs/articles/progressive-web-app-database.md",7694],"118cde4c":[()=>n.e(6267).then(n.bind(n,2171)),"@site/docs/replication-couchdb.md",2171],"14d72841":[()=>n.e(7362).then(n.bind(n,6906)),"@site/src/pages/newsletter.tsx",6906],17896441:[()=>Promise.all([n.e(532),n.e(325),n.e(7918)]).then(n.bind(n,903)),"@theme/DocItem",903],"187b985e":[()=>n.e(8196).then(n.bind(n,4228)),"@site/docs/replication-webrtc.md",4228],"1b0f8c91":[()=>n.e(5489).then(n.bind(n,7693)),"@site/docs/backup.md",7693],"1b238727":[()=>n.e(7018).then(n.bind(n,9003)),"@site/docs/rx-storage-performance.md",9003],"1c0701dd":[()=>n.e(6235).then(n.bind(n,6137)),"@site/docs/middleware.md",6137],"1da545ff":[()=>n.e(432).then(n.bind(n,8942)),"@site/docs/releases/9.0.0.md",8942],"1df93b7f":[()=>Promise.all([n.e(6560),n.e(3237)]).then(n.bind(n,1960)),"@site/src/pages/index.tsx",1960],"1e0353aa":[()=>n.e(5691).then(n.bind(n,7566)),"@site/docs/rx-storage.md",7566],"1f391b9e":[()=>Promise.all([n.e(532),n.e(325),n.e(3085)]).then(n.bind(n,4247)),"@theme/MDXPage",4247],"21fa2740":[()=>n.e(3222).then(n.bind(n,9364)),"@site/docs/releases/15.0.0.md",9364],"2456d5e0":[()=>n.e(4136).then(n.bind(n,8722)),"@site/docs/rx-database.md",8722],"25626d15":[()=>n.e(9468).then(n.bind(n,7833)),"@site/src/pages/chat.tsx",7833],"2564bf4f":[()=>n.e(5729).then(n.bind(n,43)),"@site/docs/rxdb-tradeoffs.md",43],"25a43fd4":[()=>n.e(7739).then(n.bind(n,3797)),"@site/docs/rx-storage-shared-worker.md",3797],"26b8a621":[()=>n.e(529).then(n.bind(n,7597)),"@site/docs/replication-p2p.md",7597],"294ac9d5":[()=>n.e(8856).then(n.bind(n,3274)),"@site/docs/plugins.md",3274],"2dc45ced":[()=>n.e(1218).then(n.bind(n,8821)),"@site/docs/server.md",8821],"2efd0200":[()=>n.e(8306).then(n.bind(n,632)),"@site/docs/tutorials/typescript.md",632],"32667c41":[()=>n.e(2667).then(n.bind(n,5815)),"@site/docs/nosql-performance-tips.md",5815],"326aca46":[()=>n.e(149).then(n.bind(n,4684)),"@site/docs/offline-first.md",4684],"34f94d1b":[()=>n.e(8372).then(n.bind(n,5285)),"@site/docs/electron-database.md",5285],36715375:[()=>n.e(6822).then(n.bind(n,4680)),"@site/src/pages/code.tsx",4680],"380cc66a":[()=>n.e(2038).then(n.bind(n,4919)),"@site/docs/rx-storage-dexie.md",4919],"38bbf12a":[()=>n.e(6467).then(n.bind(n,9086)),"@site/docs/articles/data-base.md",9086],"393be207":[()=>n.e(7414).then(n.bind(n,1181)),"@site/src/pages/markdown-page.md",1181],"39600c95":[()=>n.e(7344).then(n.bind(n,1512)),"@site/docs/rx-query.md",1512],"401008a8":[()=>n.e(4264).then(n.bind(n,9636)),"@site/docs/nodejs-database.md",9636],"41f941a1":[()=>n.e(5687).then(n.bind(n,7315)),"@site/docs/leader-election.md",7315],"432b83f9":[()=>n.e(4843).then(n.bind(n,5807)),"@site/docs/releases/8.0.0.md",5807],"4616b86a":[()=>n.e(6174).then(n.bind(n,2115)),"@site/docs/rx-storage-mongodb.md",2115],"4777fd9a":[()=>n.e(2192).then(n.bind(n,7168)),"@site/docs/alternatives.md",7168],"4adf80bb":[()=>n.e(7532).then(n.bind(n,6203)),"@site/docs/rx-storage-pouchdb.md",6203],"4af60d2e":[()=>n.e(9164).then(n.bind(n,253)),"@site/docs/articles/realtime-database.md",253],"4ba7e5a3":[()=>n.e(9735).then(n.bind(n,2742)),"@site/docs/contribute.md",2742],"4ed9495b":[()=>n.e(3401).then(n.bind(n,4371)),"@site/docs/rx-storage-sqlite.md",4371],"502d8946":[()=>n.e(3636).then(n.bind(n,9739)),"@site/src/pages/legal-notice.tsx",9739],51334108:[()=>n.e(2716).then(n.bind(n,4320)),"@site/docs/articles/mobile-database.md",4320],"55a5b596":[()=>n.e(4669).then(n.bind(n,8021)),"@site/docs/rx-schema.md",8021],"5a273530":[()=>n.e(6082).then(n.bind(n,4995)),"@site/docs/rx-storage-remote.md",4995],"5e95c892":[()=>n.e(9661).then(n.bind(n,1892)),"@theme/DocsRoot",1892],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,6809)),"@generated/docusaurus.config",6809],"60c23941":[()=>n.e(6533).then(n.t.bind(n,3769,19)),"/home/runner/work/rxdb/rxdb/docs-src/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",3769],"6187b59a":[()=>n.e(7987).then(n.bind(n,6846)),"@site/docs/rx-storage-worker.md",6846],"68a466be":[()=>n.e(2270).then(n.bind(n,2358)),"@site/docs/downsides-of-offline-first.md",2358],"6ae3580c":[()=>n.e(6330).then(n.bind(n,7260)),"@site/docs/replication.md",7260],"6bfb0089":[()=>n.e(9971).then(n.bind(n,7562)),"@site/docs/adapters.md",7562],"6cbff7c2":[()=>n.e(1826).then(n.bind(n,9829)),"@site/docs/rx-storage-opfs.md",9829],"6fd28feb":[()=>n.e(5333).then(n.bind(n,1850)),"@site/docs/rx-storage-foundationdb.md",1850],"714575d7":[()=>n.e(6493).then(n.bind(n,279)),"@site/docs/rx-local-document.md",279],"77d975e6":[()=>n.e(7564).then(n.bind(n,7831)),"@site/docs/articles/in-memory-nosql-database.md",7831],"7815dd0c":[()=>n.e(1341).then(n.bind(n,8147)),"@site/docs/population.md",8147],"7f02c700":[()=>n.e(7168).then(n.bind(n,2843)),"@site/docs/replication-firestore.md",2843],"8070e160":[()=>n.e(2651).then(n.bind(n,9759)),"@site/docs/quickstart.md",9759],"8288c265":[()=>n.e(871).then(n.bind(n,4442)),"@site/docs/releases/11.0.0.md",4442],"84a3af36":[()=>n.e(8862).then(n.bind(n,7292)),"@site/docs/articles/json-database.md",7292],"84ae55a4":[()=>n.e(4674).then(n.bind(n,544)),"@site/docs/replication-nats.md",544],"86b4e356":[()=>n.e(980).then(n.bind(n,5760)),"@site/docs/orm.md",5760],"8aa53ed7":[()=>n.e(1254).then(n.bind(n,1341)),"@site/docs/articles/angular-database.md",1341],"8b0a0922":[()=>n.e(4869).then(n.bind(n,1028)),"@site/docs/slow-indexeddb.md",1028],"8bc07e20":[()=>n.e(1074).then(n.bind(n,7282)),"@site/docs/capacitor-database.md",7282],"91b454ee":[()=>n.e(5832).then(n.bind(n,3746)),"@site/docs/rx-storage-sharding.md",3746],"924d6dd6":[()=>n.e(3075).then(n.bind(n,1204)),"@site/docs/electron.md",1204],"92698a99":[()=>n.e(3238).then(n.bind(n,814)),"@site/docs/rx-storage-indexeddb.md",814],"931f4566":[()=>n.e(5657).then(n.bind(n,8852)),"@site/docs/schema-validation.md",8852],"935f2afb":[()=>n.e(53).then(n.t.bind(n,1109,19)),"~docs/default/version-current-metadata-prop-751.json",1109],98405524:[()=>n.e(3562).then(n.bind(n,6704)),"@site/src/pages/survey.tsx",6704],"9dd8ea89":[()=>n.e(8814).then(n.bind(n,7854)),"@site/docs/logger.md",7854],"9e91b6f0":[()=>n.e(803).then(n.bind(n,4296)),"@site/docs/why-nosql.md",4296],a406dc27:[()=>n.e(6432).then(n.bind(n,698)),"@site/docs/migration-storage.md",698],a574e172:[()=>n.e(9153).then(n.bind(n,2980)),"@site/docs/replication-http.md",2980],a69eebfc:[()=>n.e(8577).then(n.bind(n,566)),"@site/docs/query-optimizer.md",566],a7bd4aaa:[()=>n.e(8518).then(n.bind(n,8564)),"@theme/DocVersionRoot",8564],a7f10198:[()=>n.e(2566).then(n.bind(n,7164)),"@site/docs/data-migration.md",7164],a94703ab:[()=>Promise.all([n.e(532),n.e(4368)]).then(n.bind(n,2674)),"@theme/DocRoot",2674],aa14e6b1:[()=>n.e(933).then(n.bind(n,8439)),"@site/docs/replication-graphql.md",8439],ab919a1f:[()=>n.e(4133).then(n.bind(n,3372)),"@site/docs/articles/embedded-database.md",3372],ac62b32d:[()=>n.e(4724).then(n.bind(n,5135)),"@site/docs/replication-websocket.md",5135],ad16b3ea:[()=>n.e(4492).then(n.bind(n,3750)),"@site/docs/dev-mode.md",3750],b0889a22:[()=>n.e(606).then(n.bind(n,4530)),"@site/docs/cleanup.md",4530],b30f4f1f:[()=>n.e(1609).then(n.bind(n,2462)),"@site/docs/rx-attachment.md",2462],b8c49ce4:[()=>n.e(7035).then(n.bind(n,7547)),"@site/docs/releases/13.0.0.md",7547],badcd764:[()=>n.e(6071).then(n.bind(n,6651)),"@site/docs/articles/flutter-database.md",6651],c3bc9c50:[()=>n.e(453).then(n.bind(n,8896)),"@site/docs/articles/react-database.md",8896],c4de80f8:[()=>n.e(7943).then(n.bind(n,1378)),"@site/docs/install.md",1378],c6349bb6:[()=>n.e(2191).then(n.bind(n,7557)),"@site/docs/releases/14.0.0.md",7557],c843a053:[()=>n.e(694).then(n.bind(n,408)),"@site/docs/third-party-plugins.md",408],c9c8e0b6:[()=>n.e(7585).then(n.bind(n,7548)),"@site/docs/articles/ionic-database.md",7548],cbbe8f0a:[()=>n.e(9242).then(n.bind(n,5290)),"@site/docs/rx-collection.md",5290],d20e74b4:[()=>n.e(6284).then(n.bind(n,5305)),"@site/docs/crdt.md",5305],d2758528:[()=>n.e(2081).then(n.bind(n,3898)),"@site/docs/articles/browser-storage.md",3898],d4da9db3:[()=>n.e(6017).then(n.bind(n,2443)),"@site/docs/rx-storage-memory.md",2443],d622bd51:[()=>n.e(4431).then(n.bind(n,7798)),"@site/docs/migration-schema.md",7798],dbde2ffe:[()=>n.e(8994).then(n.bind(n,4592)),"@site/docs/rx-document.md",4592],dc42ba65:[()=>n.e(3305).then(n.bind(n,7239)),"@site/docs/key-compression.md",7239],e24529eb:[()=>n.e(5846).then(n.bind(n,1290)),"@site/docs/rx-storage-localstorage-meta-optimizer.md",1290],e6b4453d:[()=>n.e(2908).then(n.bind(n,9644)),"@site/docs/query-cache.md",9644],e7478ff0:[()=>n.e(3442).then(n.bind(n,7706)),"@site/docs/questions-answers.md",7706],eadd9b3c:[()=>n.e(463).then(n.bind(n,5716)),"@site/docs/rx-storage-filesystem-node.md",5716],ebace26e:[()=>n.e(4589).then(n.bind(n,8037)),"@site/docs/releases/10.0.0.md",8037],ec526260:[()=>n.e(4625).then(n.bind(n,500)),"@site/docs/articles/browser-database.md",500],ed2d6610:[()=>n.e(5096).then(n.bind(n,5705)),"@site/docs/releases/12.0.0.md",5705],ee1b9f21:[()=>n.e(7436).then(n.bind(n,7700)),"@site/docs/react-native-database.md",7700],f15938da:[()=>n.e(8053).then(n.bind(n,4953)),"@site/docs/articles/localstorage.md",4953],f44bb875:[()=>n.e(5522).then(n.bind(n,1600)),"@site/docs/articles/frontend-database.md",1600],fe7a07ee:[()=>n.e(3776).then(n.bind(n,1684)),"@site/docs/rx-storage-denokv.md",1684]};var l=n(5893);function s(e){let{error:t,retry:n,pastDelay:r}=e;return t?(0,l.jsxs)("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"},children:[(0,l.jsx)("p",{children:String(t)}),(0,l.jsx)("div",{children:(0,l.jsx)("button",{type:"button",onClick:n,children:"Retry"})})]}):r?(0,l.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,l.jsx)("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb",children:(0,l.jsxs)("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2",children:[(0,l.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,l.jsx)("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,l.jsx)("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,l.jsx)("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,l.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,l.jsx)("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,l.jsx)("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,l.jsx)("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,l.jsx)("circle",{cx:"22",cy:"22",r:"8",children:(0,l.jsx)("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"})})]})})}):null}var c=n(9670),u=n(226);function d(e,t){if("*"===e)return a()({loading:s,loader:()=>n.e(930).then(n.bind(n,930)),modules:["@theme/NotFound"],webpack:()=>[930],render(e,t){const n=e.default;return(0,l.jsx)(u.z,{value:{plugin:{name:"native",id:"default"}},children:(0,l.jsx)(n,{...t})})}});const r=o[`${e}-${t}`],d={},p=[],f=[],m=(0,c.Z)(r);return Object.entries(m).forEach((e=>{let[t,n]=e;const r=i[n];r&&(d[t]=r[0],p.push(r[1]),f.push(r[2]))})),a().Map({loading:s,loader:d,modules:p,webpack:()=>f,render(t,n){const a=JSON.parse(JSON.stringify(r));Object.entries(t).forEach((t=>{let[n,r]=t;const o=r.default;if(!o)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof o&&"function"!=typeof o||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{o[e]=r[e]}));let i=a;const l=n.split(".");l.slice(0,-1).forEach((e=>{i=i[e]})),i[l[l.length-1]]=o}));const o=a.__comp;delete a.__comp;const i=a.__context;return delete a.__context,(0,l.jsx)(u.z,{value:i,children:(0,l.jsx)(o,{...a,...n})})}})}const p=[{path:"/chat",component:d("/chat","fd7"),exact:!0},{path:"/code",component:d("/code","8ef"),exact:!0},{path:"/legal-notice",component:d("/legal-notice","cfc"),exact:!0},{path:"/markdown-page",component:d("/markdown-page","784"),exact:!0},{path:"/newsletter",component:d("/newsletter","d15"),exact:!0},{path:"/premium",component:d("/premium","d94"),exact:!0},{path:"/survey",component:d("/survey","9e0"),exact:!0},{path:"/",component:d("/","d82"),exact:!0},{path:"/",component:d("/","77d"),routes:[{path:"/",component:d("/","c0c"),routes:[{path:"/",component:d("/","5d9"),routes:[{path:"/adapters.html",component:d("/adapters.html","fb4"),exact:!0},{path:"/alternatives.html",component:d("/alternatives.html","d53"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/angular-database.html",component:d("/articles/angular-database.html","e30"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/browser-database.html",component:d("/articles/browser-database.html","b0a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/browser-storage.html",component:d("/articles/browser-storage.html","286"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/data-base.html",component:d("/articles/data-base.html","797"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/embedded-database.html",component:d("/articles/embedded-database.html","596"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/flutter-database.html",component:d("/articles/flutter-database.html","f8a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/frontend-database.html",component:d("/articles/frontend-database.html","a83"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/in-memory-nosql-database.html",component:d("/articles/in-memory-nosql-database.html","ead"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/ionic-database.html",component:d("/articles/ionic-database.html","df6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/json-database.html",component:d("/articles/json-database.html","bff"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/localstorage.html",component:d("/articles/localstorage.html","b1b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/mobile-database.html",component:d("/articles/mobile-database.html","1d7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/progressive-web-app-database.html",component:d("/articles/progressive-web-app-database.html","862"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/react-database.html",component:d("/articles/react-database.html","179"),exact:!0,sidebar:"tutorialSidebar"},{path:"/articles/realtime-database.html",component:d("/articles/realtime-database.html","bc3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/backup.html",component:d("/backup.html","123"),exact:!0,sidebar:"tutorialSidebar"},{path:"/capacitor-database.html",component:d("/capacitor-database.html","71f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/cleanup.html",component:d("/cleanup.html","d7f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/contribution.html",component:d("/contribution.html","129"),exact:!0,sidebar:"tutorialSidebar"},{path:"/crdt.html",component:d("/crdt.html","c69"),exact:!0,sidebar:"tutorialSidebar"},{path:"/data-migration",component:d("/data-migration","7c7"),exact:!0},{path:"/dev-mode.html",component:d("/dev-mode.html","11d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/downsides-of-offline-first.html",component:d("/downsides-of-offline-first.html","ba4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/electron-database.html",component:d("/electron-database.html","44e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/electron.html",component:d("/electron.html","693"),exact:!0,sidebar:"tutorialSidebar"},{path:"/encryption.html",component:d("/encryption.html","265"),exact:!0,sidebar:"tutorialSidebar"},{path:"/install.html",component:d("/install.html","9ec"),exact:!0,sidebar:"tutorialSidebar"},{path:"/key-compression.html",component:d("/key-compression.html","171"),exact:!0,sidebar:"tutorialSidebar"},{path:"/leader-election.html",component:d("/leader-election.html","9aa"),exact:!0,sidebar:"tutorialSidebar"},{path:"/logger.html",component:d("/logger.html","949"),exact:!0,sidebar:"tutorialSidebar"},{path:"/middleware.html",component:d("/middleware.html","34f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/migration-schema.html",component:d("/migration-schema.html","618"),exact:!0,sidebar:"tutorialSidebar"},{path:"/migration-storage.html",component:d("/migration-storage.html","34a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/nodejs-database.html",component:d("/nodejs-database.html","6a2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/nosql-performance-tips.html",component:d("/nosql-performance-tips.html","fd8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/offline-first.html",component:d("/offline-first.html","e1b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/orm.html",component:d("/orm.html","798"),exact:!0,sidebar:"tutorialSidebar"},{path:"/plugins.html",component:d("/plugins.html","f25"),exact:!0,sidebar:"tutorialSidebar"},{path:"/population.html",component:d("/population.html","b89"),exact:!0,sidebar:"tutorialSidebar"},{path:"/query-cache.html",component:d("/query-cache.html","45f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/query-optimizer.html",component:d("/query-optimizer.html","bd3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/questions-answers.html",component:d("/questions-answers.html","840"),exact:!0,sidebar:"tutorialSidebar"},{path:"/quickstart.html",component:d("/quickstart.html","417"),exact:!0,sidebar:"tutorialSidebar"},{path:"/react-native-database.html",component:d("/react-native-database.html","7b4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/releases/10.0.0.html",component:d("/releases/10.0.0.html","8ce"),exact:!0,sidebar:"tutorialSidebar"},{path:"/releases/11.0.0.html",component:d("/releases/11.0.0.html","712"),exact:!0,sidebar:"tutorialSidebar"},{path:"/releases/12.0.0.html",component:d("/releases/12.0.0.html","a36"),exact:!0,sidebar:"tutorialSidebar"},{path:"/releases/13.0.0.html",component:d("/releases/13.0.0.html","605"),exact:!0,sidebar:"tutorialSidebar"},{path:"/releases/14.0.0.html",component:d("/releases/14.0.0.html","14c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/releases/15.0.0.html",component:d("/releases/15.0.0.html","4dd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/releases/8.0.0.html",component:d("/releases/8.0.0.html","fdc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/releases/9.0.0.html",component:d("/releases/9.0.0.html","f4b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/replication-couchdb.html",component:d("/replication-couchdb.html","6d5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/replication-firestore.html",component:d("/replication-firestore.html","bcb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/replication-graphql.html",component:d("/replication-graphql.html","a6c"),exact:!0,sidebar:"tutorialSidebar"},{path:"/replication-http.html",component:d("/replication-http.html","16a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/replication-nats.html",component:d("/replication-nats.html","ac4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/replication-p2p.html",component:d("/replication-p2p.html","ec6"),exact:!0},{path:"/replication-server",component:d("/replication-server","ebc"),exact:!0},{path:"/replication-webrtc.html",component:d("/replication-webrtc.html","ff6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/replication-websocket.html",component:d("/replication-websocket.html","4f9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/replication.html",component:d("/replication.html","62b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-attachment.html",component:d("/rx-attachment.html","7d7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-collection.html",component:d("/rx-collection.html","7dc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-database.html",component:d("/rx-database.html","e4e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-document.html",component:d("/rx-document.html","e09"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-local-document.html",component:d("/rx-local-document.html","0db"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-query.html",component:d("/rx-query.html","2cf"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-schema.html",component:d("/rx-schema.html","671"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-denokv.html",component:d("/rx-storage-denokv.html","b6e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-dexie.html",component:d("/rx-storage-dexie.html","bb3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-filesystem-node.html",component:d("/rx-storage-filesystem-node.html","a57"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-foundationdb.html",component:d("/rx-storage-foundationdb.html","3c8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-indexeddb.html",component:d("/rx-storage-indexeddb.html","631"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-localstorage-meta-optimizer.html",component:d("/rx-storage-localstorage-meta-optimizer.html","064"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-lokijs.html",component:d("/rx-storage-lokijs.html","1be"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-memory-synced.html",component:d("/rx-storage-memory-synced.html","65f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-memory.html",component:d("/rx-storage-memory.html","c21"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-mongodb.html",component:d("/rx-storage-mongodb.html","5ad"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-opfs.html",component:d("/rx-storage-opfs.html","6f7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-performance.html",component:d("/rx-storage-performance.html","b12"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-pouchdb.html",component:d("/rx-storage-pouchdb.html","d82"),exact:!0},{path:"/rx-storage-remote.html",component:d("/rx-storage-remote.html","5df"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-sharding.html",component:d("/rx-storage-sharding.html","b30"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-shared-worker.html",component:d("/rx-storage-shared-worker.html","0f4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-sqlite.html",component:d("/rx-storage-sqlite.html","ad7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage-worker.html",component:d("/rx-storage-worker.html","a4e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-storage.html",component:d("/rx-storage.html","144"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rxdb-tradeoffs.html",component:d("/rxdb-tradeoffs.html","5cb"),exact:!0},{path:"/schema-validation.html",component:d("/schema-validation.html","3f1"),exact:!0},{path:"/server",component:d("/server","73f"),exact:!0},{path:"/slow-indexeddb.html",component:d("/slow-indexeddb.html","a40"),exact:!0,sidebar:"tutorialSidebar"},{path:"/third-party-plugins.html",component:d("/third-party-plugins.html","549"),exact:!0,sidebar:"tutorialSidebar"},{path:"/transactions-conflicts-revisions.html",component:d("/transactions-conflicts-revisions.html","53a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/tutorials/typescript.html",component:d("/tutorials/typescript.html","a33"),exact:!0,sidebar:"tutorialSidebar"},{path:"/why-nosql.html",component:d("/why-nosql.html","ad0"),exact:!0,sidebar:"tutorialSidebar"}]}]}]},{path:"*",component:d("*")}]},8934:(e,t,n)=>{"use strict";n.d(t,{_:()=>o,t:()=>i});var r=n(7294),a=n(5893);const o=r.createContext(!1);function i(e){let{children:t}=e;const[n,i]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{i(!0)}),[]),(0,a.jsx)(o.Provider,{value:n,children:t})}},2679:(e,t,n)=>{"use strict";var r=n(7294),a=n(745),o=n(3727),i=n(405),l=n(412);const s=[n(6657),n(2497),n(3310),n(8320),n(2295)];var c=n(723),u=n(6550),d=n(8790),p=n(2389),f=n(5893);function m(e){let{children:t}=e;const n=(0,p.Z)();return(0,r.useEffect)((()=>{n&&(function(){const e="fixed-chat-button";if(document.getElementById(e))return;const t=document.createElement("a");t.id=e,t.href="/chat",t.target="_blank",t.innerHTML="\ud83d\udcac Community Chat",t.onclick=function(){trigger("join_chat_action",.1)};const n=document.createElement("style");n.type="text/css",n.innerText="#"+e+" {color: white;position: fixed;right: 0;bottom: 0;background-color: var(--color-top);padding-left: 17px;padding-right: 17px;padding-top: 10px;padding-bottom: 5px;text-align: center;margin-right: 50px;font-weight: bold;border-top-left-radius: 9px;border-top-right-radius: 9px;}#fixed-chat-button:hover {box-shadow: 2px 2px 13px #ca007c, -2px -1px 14px #ff009e;text-decoration: underline;z-index: 10;}",document.head.appendChild(n),document.body.appendChild(t)}(),function(){const e=[{text:"Follow",keyword:"@twitter",url:"https://twitter.com/intent/user?screen_name=rxdbjs",icon:"\ud83d\udc26"},{text:"Follow",keyword:"@LinkedIn",url:"https://www.linkedin.com/company/rxdb",icon:"[in]"},{text:"Chat",keyword:"@discord",url:"https://rxdb.info/chat",icon:"\ud83d\udcac"},{text:"Star",keyword:"@github",url:"https://rxdb.info/code",icon:"\ud83d\udc19\ud83d\udcbb"},{text:"Subscribe",keyword:"@newsletter",url:"https://rxdb.info/newsletter",icon:"\ud83d\udcf0"}];function t(e,t){e.parentNode.insertBefore(t,e.nextSibling)}const n="rxdb-call-to-action-button";function r(){console.log("set call to action button");const r=Date.now()%e.length,a=e[r],o=document.querySelector(".call-to-action");o&&o.parentNode.removeChild(o);const i=document.querySelector(".navbar__items");if(!i)return;const l=document.createElement("div");l.classList.add("call-to-action");const s=document.createElement("a");s.classList.add("hover-shadow-top"),s.id=n,s.innerHTML=a.text+' '+a.keyword+''+a.icon+"",s.href=a.url,s.target="_blank",l.append(s),t(i,l)}r()}())})),(0,f.jsx)(f.Fragment,{children:t})}var h=n(5742),g=n(2263),b=n(4996),y=n(6668),v=n(1944),w=n(4711),x=n(9727),k=n(3320),S=n(8780),E=n(197);function _(){const{i18n:{currentLocale:e,defaultLocale:t,localeConfigs:n}}=(0,g.Z)(),r=(0,w.l)(),a=n[e].htmlLang,o=e=>e.replace("-","_");return(0,f.jsxs)(h.Z,{children:[Object.entries(n).map((e=>{let[t,{htmlLang:n}]=e;return(0,f.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:n},t)})),(0,f.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:"x-default"}),(0,f.jsx)("meta",{property:"og:locale",content:o(a)}),Object.values(n).filter((e=>a!==e.htmlLang)).map((e=>(0,f.jsx)("meta",{property:"og:locale:alternate",content:o(e.htmlLang)},`meta-og-${e.htmlLang}`)))]})}function C(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,g.Z)(),r=function(){const{siteConfig:{url:e,baseUrl:t,trailingSlash:n}}=(0,g.Z)(),{pathname:r}=(0,u.TH)();return e+(0,S.applyTrailingSlash)((0,b.Z)(r),{trailingSlash:n,baseUrl:t})}(),a=t?`${n}${t}`:r;return(0,f.jsxs)(h.Z,{children:[(0,f.jsx)("meta",{property:"og:url",content:a}),(0,f.jsx)("link",{rel:"canonical",href:a})]})}function T(){const{i18n:{currentLocale:e}}=(0,g.Z)(),{metadata:t,image:n}=(0,y.L)();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(h.Z,{children:[(0,f.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,f.jsx)("body",{className:x.h})]}),n&&(0,f.jsx)(v.d,{image:n}),(0,f.jsx)(C,{}),(0,f.jsx)(_,{}),(0,f.jsx)(E.Z,{tag:k.HX,locale:e}),(0,f.jsx)(h.Z,{children:t.map(((e,t)=>(0,f.jsx)("meta",{...e},t)))})]})}const j=new Map;function N(e){if(j.has(e.pathname))return{...e,pathname:j.get(e.pathname)};if((0,d.f)(c.Z,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return j.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return j.set(e.pathname,t),{...e,pathname:t}}var R=n(8934),A=n(8940),L=n(469);function P(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{const r=t.default?.[e]??t[e];return r?.(...n)}));return()=>a.forEach((e=>e?.()))}const O=function(e){let{children:t,location:n,previousLocation:r}=e;return(0,L.Z)((()=>{r!==n&&(!function(e){let{location:t,previousLocation:n}=e;if(!n)return;const r=t.pathname===n.pathname,a=t.hash===n.hash,o=t.search===n.search;if(r&&a&&!o)return;const{hash:i}=t;if(i){const e=decodeURIComponent(i.substring(1)),t=document.getElementById(e);t?.scrollIntoView()}else window.scrollTo(0,0)}({location:n,previousLocation:r}),P("onRouteDidUpdate",{previousLocation:r,location:n}))}),[r,n]),t};function I(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,d.f)(c.Z,e))).flat();return Promise.all(t.map((e=>e.route.component.preload?.())))}class D extends r.Component{previousLocation;routeUpdateCleanupCb;constructor(e){super(e),this.previousLocation=null,this.routeUpdateCleanupCb=l.Z.canUseDOM?P("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=P("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),I(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return(0,f.jsx)(O,{previousLocation:this.previousLocation,location:t,children:(0,f.jsx)(u.AW,{location:t,render:()=>e})})}}const M=D,F="__docusaurus-base-url-issue-banner-container",z="__docusaurus-base-url-issue-banner",B="__docusaurus-base-url-issue-banner-suggestion-container";function $(e){return`\ndocument.addEventListener('DOMContentLoaded', function maybeInsertBanner() {\n var shouldInsert = typeof window['docusaurus'] === 'undefined';\n shouldInsert && insertBanner();\n});\n\nfunction insertBanner() {\n var bannerContainer = document.createElement('div');\n bannerContainer.id = '${F}';\n var bannerHtml = ${JSON.stringify(function(e){return`\n
\n

Your Docusaurus site did not load properly.

\n

A very common reason is a wrong site baseUrl configuration.

\n

Current configured baseUrl = ${e} ${"/"===e?" (default value)":""}

\n

We suggest trying baseUrl =

\n
\n`}(e)).replace(/{if("undefined"==typeof document)return void n();const r=document.createElement("link");r.setAttribute("rel","prefetch"),r.setAttribute("href",e),r.onload=()=>t(),r.onerror=()=>n();const a=document.getElementsByTagName("head")[0]??document.getElementsByName("script")[0]?.parentNode;a?.appendChild(r)}))}:function(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.withCredentials=!0,r.onload=()=>{200===r.status?t():n()},r.send(null)}))};var Y=n(9670);const K=new Set,X=new Set,J=()=>navigator.connection?.effectiveType.includes("2g")||navigator.connection?.saveData,ee={prefetch(e){if(!(e=>!J()&&!X.has(e)&&!K.has(e))(e))return!1;K.add(e);const t=(0,d.f)(c.Z,e).flatMap((e=>{return t=e.route.path,Object.entries(V).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,Y.Z)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?Q(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!J()&&!X.has(e))(e)&&(X.add(e),I(e))},te=Object.freeze(ee),ne=Boolean(!0);if(l.Z.canUseDOM){window.docusaurus=te;const e=document.getElementById("__docusaurus"),t=(0,f.jsx)(i.B6,{children:(0,f.jsx)(o.VK,{children:(0,f.jsx)(W,{})})}),n=(e,t)=>{console.error("Docusaurus React Root onRecoverableError:",e,t)},l=()=>{if(ne)r.startTransition((()=>{a.hydrateRoot(e,t,{onRecoverableError:n})}));else{const o=a.createRoot(e,{onRecoverableError:n});r.startTransition((()=>{o.render(t)}))}};I(window.location.pathname).then(l)}},8940:(e,t,n)=>{"use strict";n.d(t,{_:()=>d,M:()=>p});var r=n(7294),a=n(6809);const o=JSON.parse('{"docusaurus-plugin-google-gtag":{"default":{"trackingID":["G-62D63SY3S0"],"anonymizeIP":false,"id":"default"}},"docusaurus-lunr-search":{"default":{"fileNames":{"searchDoc":"search-doc-1706097670718.json","lunrIndex":"lunr-index-1706097670718.json"}}},"docusaurus-plugin-content-docs":{"default":{"path":"/","versions":[{"name":"current","label":"Next","isLast":true,"path":"/","mainDocId":"quickstart","docs":[{"id":"adapters","path":"/adapters.html"},{"id":"alternatives","path":"/alternatives.html","sidebar":"tutorialSidebar"},{"id":"articles/angular-database","path":"/articles/angular-database.html","sidebar":"tutorialSidebar"},{"id":"articles/browser-database","path":"/articles/browser-database.html","sidebar":"tutorialSidebar"},{"id":"articles/browser-storage","path":"/articles/browser-storage.html","sidebar":"tutorialSidebar"},{"id":"articles/data-base","path":"/articles/data-base.html","sidebar":"tutorialSidebar"},{"id":"articles/embedded-database","path":"/articles/embedded-database.html","sidebar":"tutorialSidebar"},{"id":"articles/flutter-database","path":"/articles/flutter-database.html","sidebar":"tutorialSidebar"},{"id":"articles/frontend-database","path":"/articles/frontend-database.html","sidebar":"tutorialSidebar"},{"id":"articles/in-memory-nosql-database","path":"/articles/in-memory-nosql-database.html","sidebar":"tutorialSidebar"},{"id":"articles/ionic-database","path":"/articles/ionic-database.html","sidebar":"tutorialSidebar"},{"id":"articles/json-database","path":"/articles/json-database.html","sidebar":"tutorialSidebar"},{"id":"articles/localstorage","path":"/articles/localstorage.html","sidebar":"tutorialSidebar"},{"id":"articles/mobile-database","path":"/articles/mobile-database.html","sidebar":"tutorialSidebar"},{"id":"articles/progressive-web-app-database","path":"/articles/progressive-web-app-database.html","sidebar":"tutorialSidebar"},{"id":"articles/react-database","path":"/articles/react-database.html","sidebar":"tutorialSidebar"},{"id":"articles/realtime-database","path":"/articles/realtime-database.html","sidebar":"tutorialSidebar"},{"id":"backup","path":"/backup.html","sidebar":"tutorialSidebar"},{"id":"capacitor-database","path":"/capacitor-database.html","sidebar":"tutorialSidebar"},{"id":"cleanup","path":"/cleanup.html","sidebar":"tutorialSidebar"},{"id":"contribute","path":"/contribution.html","sidebar":"tutorialSidebar"},{"id":"crdt","path":"/crdt.html","sidebar":"tutorialSidebar"},{"id":"data-migration","path":"/data-migration"},{"id":"dev-mode","path":"/dev-mode.html","sidebar":"tutorialSidebar"},{"id":"downsides-of-offline-first","path":"/downsides-of-offline-first.html","sidebar":"tutorialSidebar"},{"id":"electron","path":"/electron.html","sidebar":"tutorialSidebar"},{"id":"electron-database","path":"/electron-database.html","sidebar":"tutorialSidebar"},{"id":"encryption","path":"/encryption.html","sidebar":"tutorialSidebar"},{"id":"install","path":"/install.html","sidebar":"tutorialSidebar"},{"id":"key-compression","path":"/key-compression.html","sidebar":"tutorialSidebar"},{"id":"leader-election","path":"/leader-election.html","sidebar":"tutorialSidebar"},{"id":"logger","path":"/logger.html","sidebar":"tutorialSidebar"},{"id":"middleware","path":"/middleware.html","sidebar":"tutorialSidebar"},{"id":"migration-schema","path":"/migration-schema.html","sidebar":"tutorialSidebar"},{"id":"migration-storage","path":"/migration-storage.html","sidebar":"tutorialSidebar"},{"id":"nodejs-database","path":"/nodejs-database.html","sidebar":"tutorialSidebar"},{"id":"nosql-performance-tips","path":"/nosql-performance-tips.html","sidebar":"tutorialSidebar"},{"id":"offline-first","path":"/offline-first.html","sidebar":"tutorialSidebar"},{"id":"orm","path":"/orm.html","sidebar":"tutorialSidebar"},{"id":"plugins","path":"/plugins.html","sidebar":"tutorialSidebar"},{"id":"population","path":"/population.html","sidebar":"tutorialSidebar"},{"id":"query-cache","path":"/query-cache.html","sidebar":"tutorialSidebar"},{"id":"query-optimizer","path":"/query-optimizer.html","sidebar":"tutorialSidebar"},{"id":"questions-answers","path":"/questions-answers.html","sidebar":"tutorialSidebar"},{"id":"quickstart","path":"/quickstart.html","sidebar":"tutorialSidebar"},{"id":"react-native-database","path":"/react-native-database.html","sidebar":"tutorialSidebar"},{"id":"releases/10.0.0","path":"/releases/10.0.0.html","sidebar":"tutorialSidebar"},{"id":"releases/11.0.0","path":"/releases/11.0.0.html","sidebar":"tutorialSidebar"},{"id":"releases/12.0.0","path":"/releases/12.0.0.html","sidebar":"tutorialSidebar"},{"id":"releases/13.0.0","path":"/releases/13.0.0.html","sidebar":"tutorialSidebar"},{"id":"releases/14.0.0","path":"/releases/14.0.0.html","sidebar":"tutorialSidebar"},{"id":"releases/15.0.0","path":"/releases/15.0.0.html","sidebar":"tutorialSidebar"},{"id":"releases/8.0.0","path":"/releases/8.0.0.html","sidebar":"tutorialSidebar"},{"id":"releases/9.0.0","path":"/releases/9.0.0.html","sidebar":"tutorialSidebar"},{"id":"replication","path":"/replication.html","sidebar":"tutorialSidebar"},{"id":"replication-couchdb","path":"/replication-couchdb.html","sidebar":"tutorialSidebar"},{"id":"replication-firestore","path":"/replication-firestore.html","sidebar":"tutorialSidebar"},{"id":"replication-graphql","path":"/replication-graphql.html","sidebar":"tutorialSidebar"},{"id":"replication-http","path":"/replication-http.html","sidebar":"tutorialSidebar"},{"id":"replication-nats","path":"/replication-nats.html","sidebar":"tutorialSidebar"},{"id":"replication-p2p","path":"/replication-p2p.html"},{"id":"replication-server","path":"/replication-server"},{"id":"replication-webrtc","path":"/replication-webrtc.html","sidebar":"tutorialSidebar"},{"id":"replication-websocket","path":"/replication-websocket.html","sidebar":"tutorialSidebar"},{"id":"rx-attachment","path":"/rx-attachment.html","sidebar":"tutorialSidebar"},{"id":"rx-collection","path":"/rx-collection.html","sidebar":"tutorialSidebar"},{"id":"rx-database","path":"/rx-database.html","sidebar":"tutorialSidebar"},{"id":"rx-document","path":"/rx-document.html","sidebar":"tutorialSidebar"},{"id":"rx-local-document","path":"/rx-local-document.html","sidebar":"tutorialSidebar"},{"id":"rx-query","path":"/rx-query.html","sidebar":"tutorialSidebar"},{"id":"rx-schema","path":"/rx-schema.html","sidebar":"tutorialSidebar"},{"id":"rx-storage","path":"/rx-storage.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-denokv","path":"/rx-storage-denokv.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-dexie","path":"/rx-storage-dexie.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-filesystem-node","path":"/rx-storage-filesystem-node.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-foundationdb","path":"/rx-storage-foundationdb.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-indexeddb","path":"/rx-storage-indexeddb.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-localstorage-meta-optimizer","path":"/rx-storage-localstorage-meta-optimizer.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-lokijs","path":"/rx-storage-lokijs.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-memory","path":"/rx-storage-memory.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-memory-synced","path":"/rx-storage-memory-synced.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-mongodb","path":"/rx-storage-mongodb.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-opfs","path":"/rx-storage-opfs.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-performance","path":"/rx-storage-performance.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-pouchdb","path":"/rx-storage-pouchdb.html"},{"id":"rx-storage-remote","path":"/rx-storage-remote.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-sharding","path":"/rx-storage-sharding.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-shared-worker","path":"/rx-storage-shared-worker.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-sqlite","path":"/rx-storage-sqlite.html","sidebar":"tutorialSidebar"},{"id":"rx-storage-worker","path":"/rx-storage-worker.html","sidebar":"tutorialSidebar"},{"id":"rxdb-tradeoffs","path":"/rxdb-tradeoffs.html"},{"id":"schema-validation","path":"/schema-validation.html"},{"id":"server","path":"/server"},{"id":"slow-indexeddb","path":"/slow-indexeddb.html","sidebar":"tutorialSidebar"},{"id":"third-party-plugins","path":"/third-party-plugins.html","sidebar":"tutorialSidebar"},{"id":"transactions-conflicts-revisions","path":"/transactions-conflicts-revisions.html","sidebar":"tutorialSidebar"},{"id":"tutorials/typescript","path":"/tutorials/typescript.html","sidebar":"tutorialSidebar"},{"id":"why-nosql","path":"/why-nosql.html","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/quickstart.html","label":"quickstart"}}}}],"breadcrumbs":true}}}'),i=JSON.parse('{"defaultLocale":"en","locales":["en"],"path":"i18n","currentLocale":"en","localeConfigs":{"en":{"label":"English","direction":"ltr","htmlLang":"en","calendar":"gregory","path":"en"}}}');var l=n(7529);const s=JSON.parse('{"docusaurusVersion":"3.0.1","siteVersion":"0.0.0","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"3.0.1"},"docusaurus-plugin-content-blog":{"type":"package","name":"@docusaurus/plugin-content-blog","version":"3.0.1"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"3.0.1"},"docusaurus-plugin-google-gtag":{"type":"package","name":"@docusaurus/plugin-google-gtag","version":"3.0.1"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"3.0.1"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"3.0.1"},"docusaurus-lunr-search":{"type":"package","name":"docusaurus-lunr-search","version":"3.3.1"}}}');var c=n(5893);const u={siteConfig:a.default,siteMetadata:s,globalData:o,i18n:i,codeTranslations:l},d=r.createContext(u);function p(e){let{children:t}=e;return(0,c.jsx)(d.Provider,{value:u,children:t})}},4763:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(7294),a=n(412),o=n(5742),i=n(8780),l=n(3799),s=n(5893);function c(e){let{error:t,tryAgain:n}=e;return(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",minHeight:"100vh",width:"100%",maxWidth:"80ch",fontSize:"20px",margin:"0 auto",padding:"1rem"},children:[(0,s.jsx)("h1",{style:{fontSize:"3rem"},children:"This page crashed"}),(0,s.jsx)("button",{type:"button",onClick:n,style:{margin:"1rem 0",fontSize:"2rem",cursor:"pointer",borderRadius:20,padding:"1rem"},children:"Try again"}),(0,s.jsx)(u,{error:t})]})}function u(e){let{error:t}=e;const n=(0,i.getErrorCausalChain)(t).map((e=>e.message)).join("\n\nCause:\n");return(0,s.jsx)("p",{style:{whiteSpace:"pre-wrap"},children:n})}function d(e){let{error:t,tryAgain:n}=e;return(0,s.jsxs)(f,{fallback:()=>(0,s.jsx)(c,{error:t,tryAgain:n}),children:[(0,s.jsx)(o.Z,{children:(0,s.jsx)("title",{children:"Page Error"})}),(0,s.jsx)(l.Z,{children:(0,s.jsx)(c,{error:t,tryAgain:n})})]})}const p=e=>(0,s.jsx)(d,{...e});class f extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){a.Z.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??p)(e)}return e??null}}},412:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,a={canUseDOM:r,canUseEventListeners:r&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&"screen"in window}},5742:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});n(7294);var r=n(405),a=n(5893);function o(e){return(0,a.jsx)(r.ql,{...e})}},9960:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(7294),a=n(3727),o=n(8780),i=n(2263),l=n(3919),s=n(412),c=n(5893);const u=r.createContext({collectLink:()=>{}});var d=n(4996);function p(e,t){let{isNavLink:n,to:p,href:f,activeClassName:m,isActive:h,"data-noBrokenLinkCheck":g,autoAddBaseUrl:b=!0,...y}=e;const{siteConfig:{trailingSlash:v,baseUrl:w}}=(0,i.Z)(),{withBaseUrl:x}=(0,d.C)(),k=(0,r.useContext)(u),S=(0,r.useRef)(null);(0,r.useImperativeHandle)(t,(()=>S.current));const E=p||f;const _=(0,l.Z)(E),C=E?.replace("pathname://","");let T=void 0!==C?(j=C,b&&(e=>e.startsWith("/"))(j)?x(j):j):void 0;var j;T&&_&&(T=(0,o.applyTrailingSlash)(T,{trailingSlash:v,baseUrl:w}));const N=(0,r.useRef)(!1),R=n?a.OL:a.rU,A=s.Z.canUseIntersectionObserver,L=(0,r.useRef)(),P=()=>{N.current||null==T||(window.docusaurus.preload(T),N.current=!0)};(0,r.useEffect)((()=>(!A&&_&&null!=T&&window.docusaurus.prefetch(T),()=>{A&&L.current&&L.current.disconnect()})),[L,T,A,_]);const O=T?.startsWith("#")??!1,I=!T||!_||O;return I||g||k.collectLink(T),I?(0,c.jsx)("a",{ref:S,href:T,...E&&!_&&{target:"_blank",rel:"noopener noreferrer"},...y}):(0,c.jsx)(R,{...y,onMouseEnter:P,onTouchStart:P,innerRef:e=>{S.current=e,A&&e&&_&&(L.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(L.current.unobserve(e),L.current.disconnect(),null!=T&&window.docusaurus.prefetch(T))}))})),L.current.observe(e))},to:T,...n&&{isActive:h,activeClassName:m}})}const f=r.forwardRef(p)},5999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c,I:()=>s});var r=n(7294),a=n(5893);function o(e,t){const n=e.split(/(\{\w+\})/).map(((e,n)=>{if(n%2==1){const n=t?.[e.slice(1,-1)];if(void 0!==n)return n}return e}));return n.some((e=>(0,r.isValidElement)(e)))?n.map(((e,t)=>(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):n.join("")}var i=n(7529);function l(e){let{id:t,message:n}=e;if(void 0===t&&void 0===n)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return i[t??n]??n??t}function s(e,t){let{message:n,id:r}=e;return o(l({message:n,id:r}),t)}function c(e){let{children:t,id:n,values:r}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal children",t),new Error("The Docusaurus component only accept simple string values");const i=l({message:t,id:n});return(0,a.jsx)(a.Fragment,{children:o(i,r)})}},9935:(e,t,n)=>{"use strict";n.d(t,{m:()=>r});const r="default"},3919:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,{Z:()=>a,b:()=>r})},4996:(e,t,n)=>{"use strict";n.d(t,{C:()=>i,Z:()=>l});var r=n(7294),a=n(2263),o=n(3919);function i(){const{siteConfig:{baseUrl:e,url:t}}=(0,a.Z)(),n=(0,r.useCallback)(((n,r)=>function(e,t,n,r){let{forcePrependBaseUrl:a=!1,absolute:i=!1}=void 0===r?{}:r;if(!n||n.startsWith("#")||(0,o.b)(n))return n;if(a)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;const l=n.startsWith(t)?n:t+n.replace(/^\//,"");return i?e+l:l}(t,e,n,r)),[t,e]);return{withBaseUrl:n}}function l(e,t){void 0===t&&(t={});const{withBaseUrl:n}=i();return n(e,t)}},2263:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(8940);function o(){return(0,r.useContext)(a._)}},8084:(e,t,n)=>{"use strict";n.d(t,{OD:()=>o,eZ:()=>i});var r=n(2263),a=n(9935);function o(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,r.Z)();return e}()[e];if(!n&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return n}function i(e,t,n){void 0===t&&(t=a.m),void 0===n&&(n={});const r=o(e),i=r?.[t];if(!i&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return i}},2389:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(8934);function o(){return(0,r.useContext)(a._)}},469:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(7294);const a=n(412).Z.canUseDOM?r.useLayoutEffect:r.useEffect},9670:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r=e=>"object"==typeof e&&!!e&&Object.keys(e).length>0;function a(e){const t={};return function e(n,a){Object.entries(n).forEach((n=>{let[o,i]=n;const l=a?`${a}.${o}`:o;r(i)?e(i,l):t[l]=i}))}(e),t}},226:(e,t,n)=>{"use strict";n.d(t,{_:()=>o,z:()=>i});var r=n(7294),a=n(5893);const o=r.createContext(null);function i(e){let{children:t,value:n}=e;const i=r.useContext(o),l=(0,r.useMemo)((()=>function(e){let{parent:t,value:n}=e;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}const r={...t.data,...n?.data};return{plugin:t.plugin,data:r}}({parent:i,value:n})),[i,n]);return(0,a.jsx)(o.Provider,{value:l,children:t})}},4104:(e,t,n)=>{"use strict";n.d(t,{Iw:()=>f,gA:()=>u,_r:()=>s,Jo:()=>m,zh:()=>c,yW:()=>p,gB:()=>d});var r=n(6550),a=n(8084);const o=e=>e.versions.find((e=>e.isLast));function i(e,t){const n=function(e,t){const n=o(e);return[...e.versions.filter((e=>e!==n)),n].find((e=>!!(0,r.LX)(t,{path:e.path,exact:!1,strict:!1})))}(e,t),a=n?.docs.find((e=>!!(0,r.LX)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:n,activeDoc:a,alternateDocVersions:a?function(t){const n={};return e.versions.forEach((e=>{e.docs.forEach((r=>{r.id===t&&(n[e.name]=r)}))})),n}(a.id):{}}}const l={},s=()=>(0,a.OD)("docusaurus-plugin-content-docs")??l,c=e=>(0,a.eZ)("docusaurus-plugin-content-docs",e,{failfast:!0});function u(e){void 0===e&&(e={});const t=s(),{pathname:n}=(0,r.TH)();return function(e,t,n){void 0===n&&(n={});const a=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,n]=e;return!!(0,r.LX)(t,{path:n.path,exact:!1,strict:!1})})),o=a?{pluginId:a[0],pluginData:a[1]}:void 0;if(!o&&n.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return o}(t,n,e)}function d(e){return c(e).versions}function p(e){const t=c(e);return o(t)}function f(e){const t=c(e),{pathname:n}=(0,r.TH)();return i(t,n)}function m(e){const t=c(e),{pathname:n}=(0,r.TH)();return function(e,t){const n=o(e);return{latestDocSuggestion:i(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},6657:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={onRouteDidUpdate(e){let{location:t,previousLocation:n}=e;!n||t.pathname===n.pathname&&t.search===n.search&&t.hash===n.hash||setTimeout((()=>{window.gtag("set","page_path",t.pathname+t.search+t.hash),window.gtag("event","page_view")}))}}},8320:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(4865),a=n.n(r);a().configure({showSpinner:!1});const o={onRouteUpdate(e){let{location:t,previousLocation:n}=e;if(n&&t.pathname!==n.pathname){const e=window.setTimeout((()=>{a().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){a().done()}}},3310:(e,t,n)=>{"use strict";n.r(t);var r=n(2573),a=n(6809);!function(e){const{themeConfig:{prism:t}}=a.default,{additionalLanguages:r}=t;globalThis.Prism=e,r.forEach((e=>{"php"===e&&n(6854),n(6726)(`./prism-${e}`)})),delete globalThis.Prism}(r.p1)},2503:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});n(7294);var r=n(512),a=n(5999),o=n(6668),i=n(9960);const l={anchorWithStickyNavbar:"anchorWithStickyNavbar_LWe7",anchorWithHideOnScrollNavbar:"anchorWithHideOnScrollNavbar_WYt5"};var s=n(5893);function c(e){let{as:t,id:n,...c}=e;const{navbar:{hideOnScroll:u}}=(0,o.L)();if("h1"===t||!n)return(0,s.jsx)(t,{...c,id:void 0});const d=(0,a.I)({id:"theme.common.headingLinkTitle",message:"Direct link to {heading}",description:"Title for link to heading"},{heading:"string"==typeof c.children?c.children:n});return(0,s.jsxs)(t,{...c,className:(0,r.Z)("anchor",u?l.anchorWithHideOnScrollNavbar:l.anchorWithStickyNavbar,c.className),id:n,children:[c.children,(0,s.jsx)(i.Z,{className:"hash-link",to:`#${n}`,"aria-label":d,title:d,children:"\u200b"})]})}},9471:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});n(7294);const r={iconExternalLink:"iconExternalLink_nPIU"};var a=n(5893);function o(e){let{width:t=13.5,height:n=13.5}=e;return(0,a.jsx)("svg",{width:t,height:n,"aria-hidden":"true",viewBox:"0 0 24 24",className:r.iconExternalLink,children:(0,a.jsx)("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"})})}},3799:(e,t,n)=>{"use strict";n.d(t,{Z:()=>bt});var r=n(7294),a=n(512),o=n(4763),i=n(1944),l=n(6550),s=n(5999),c=n(5936),u=n(5893);const d="__docusaurus_skipToContent_fallback";function p(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function f(){const e=(0,r.useRef)(null),{action:t}=(0,l.k6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(d);t&&p(t)}),[]);return(0,c.S)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&p(e.current)})),{containerRef:e,onClick:n}}const m=(0,s.I)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function h(e){const t=e.children??m,{containerRef:n,onClick:r}=f();return(0,u.jsx)("div",{ref:n,role:"region","aria-label":m,children:(0,u.jsx)("a",{...e,href:`#${d}`,onClick:r,children:t})})}var g=n(5281),b=n(9727);const y={skipToContent:"skipToContent_fXgn"};function v(){return(0,u.jsx)(h,{className:y.skipToContent})}var w=n(6668),x=n(9689);function k(e){let{width:t=21,height:n=21,color:r="currentColor",strokeWidth:a=1.2,className:o,...i}=e;return(0,u.jsx)("svg",{viewBox:"0 0 15 15",width:t,height:n,...i,children:(0,u.jsx)("g",{stroke:r,strokeWidth:a,children:(0,u.jsx)("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})})})}const S={closeButton:"closeButton_CVFx"};function E(e){return(0,u.jsx)("button",{type:"button","aria-label":(0,s.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"}),...e,className:(0,a.Z)("clean-btn close",S.closeButton,e.className),children:(0,u.jsx)(k,{width:14,height:14,strokeWidth:3.1})})}const _={content:"content_knG7"};function C(e){const{announcementBar:t}=(0,w.L)(),{content:n}=t;return(0,u.jsx)("div",{...e,className:(0,a.Z)(_.content,e.className),dangerouslySetInnerHTML:{__html:n}})}const T={announcementBar:"announcementBar_mb4j",announcementBarPlaceholder:"announcementBarPlaceholder_vyr4",announcementBarClose:"announcementBarClose_gvF7",announcementBarContent:"announcementBarContent_xLdY"};function j(){const{announcementBar:e}=(0,w.L)(),{isActive:t,close:n}=(0,x.nT)();if(!t)return null;const{backgroundColor:r,textColor:a,isCloseable:o}=e;return(0,u.jsxs)("div",{className:T.announcementBar,style:{backgroundColor:r,color:a},role:"banner",children:[o&&(0,u.jsx)("div",{className:T.announcementBarPlaceholder}),(0,u.jsx)(C,{className:T.announcementBarContent}),o&&(0,u.jsx)(E,{onClick:n,className:T.announcementBarClose})]})}var N=n(2961),R=n(2466);var A=n(902),L=n(3102);const P=r.createContext(null);function O(e){let{children:t}=e;const n=function(){const e=(0,N.e)(),t=(0,L.HY)(),[n,a]=(0,r.useState)(!1),o=null!==t.component,i=(0,A.D9)(o);return(0,r.useEffect)((()=>{o&&!i&&a(!0)}),[o,i]),(0,r.useEffect)((()=>{o?e.shown||a(!0):a(!1)}),[e.shown,o]),(0,r.useMemo)((()=>[n,a]),[n])}();return(0,u.jsx)(P.Provider,{value:n,children:t})}function I(e){if(e.component){const t=e.component;return(0,u.jsx)(t,{...e.props})}}function D(){const e=(0,r.useContext)(P);if(!e)throw new A.i6("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,a=(0,r.useCallback)((()=>n(!1)),[n]),o=(0,L.HY)();return(0,r.useMemo)((()=>({shown:t,hide:a,content:I(o)})),[a,o,t])}function M(e){let{header:t,primaryMenu:n,secondaryMenu:r}=e;const{shown:o}=D();return(0,u.jsxs)("div",{className:"navbar-sidebar",children:[t,(0,u.jsxs)("div",{className:(0,a.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":o}),children:[(0,u.jsx)("div",{className:"navbar-sidebar__item menu",children:n}),(0,u.jsx)("div",{className:"navbar-sidebar__item menu",children:r})]})]})}var F=n(2949),z=n(2389);function B(e){return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:24,height:24,...e,children:(0,u.jsx)("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"})})}function $(e){return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:24,height:24,...e,children:(0,u.jsx)("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"})})}const U={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function q(e){let{className:t,buttonClassName:n,value:r,onChange:o}=e;const i=(0,z.Z)(),l=(0,s.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===r?(0,s.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,s.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return(0,u.jsx)("div",{className:(0,a.Z)(U.toggle,t),children:(0,u.jsxs)("button",{className:(0,a.Z)("clean-btn",U.toggleButton,!i&&U.toggleButtonDisabled,n),type:"button",onClick:()=>o("dark"===r?"light":"dark"),disabled:!i,title:l,"aria-label":l,"aria-live":"polite",children:[(0,u.jsx)(B,{className:(0,a.Z)(U.toggleIcon,U.lightToggleIcon)}),(0,u.jsx)($,{className:(0,a.Z)(U.toggleIcon,U.darkToggleIcon)})]})})}const H=r.memo(q),Z={darkNavbarColorModeToggle:"darkNavbarColorModeToggle_X3D1"};function G(e){let{className:t}=e;const n=(0,w.L)().navbar.style,r=(0,w.L)().colorMode.disableSwitch,{colorMode:a,setColorMode:o}=(0,F.I)();return r?null:(0,u.jsx)(H,{className:t,buttonClassName:"dark"===n?Z.darkNavbarColorModeToggle:void 0,value:a,onChange:o})}var W=n(1327);function V(){return(0,u.jsx)(W.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function Q(){const e=(0,N.e)();return(0,u.jsx)("button",{type:"button","aria-label":(0,s.I)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle(),children:(0,u.jsx)(k,{color:"var(--ifm-color-emphasis-600)"})})}function Y(){return(0,u.jsxs)("div",{className:"navbar-sidebar__brand",children:[(0,u.jsx)(V,{}),(0,u.jsx)(G,{className:"margin-right--md"}),(0,u.jsx)(Q,{})]})}var K=n(9960),X=n(4996),J=n(3919);function ee(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}var te=n(9471);function ne(e){let{activeBasePath:t,activeBaseRegex:n,to:r,href:a,label:o,html:i,isDropdownLink:l,prependBaseUrlToHref:s,...c}=e;const d=(0,X.Z)(r),p=(0,X.Z)(t),f=(0,X.Z)(a,{forcePrependBaseUrl:!0}),m=o&&a&&!(0,J.Z)(a),h=i?{dangerouslySetInnerHTML:{__html:i}}:{children:(0,u.jsxs)(u.Fragment,{children:[o,m&&(0,u.jsx)(te.Z,{...l&&{width:12,height:12}})]})};return a?(0,u.jsx)(K.Z,{href:s?f:a,...c,...h}):(0,u.jsx)(K.Z,{to:d,isNavLink:!0,...(t||n)&&{isActive:(e,t)=>n?ee(n,t.pathname):t.pathname.startsWith(p)},...c,...h})}function re(e){let{className:t,isDropdownItem:n=!1,...r}=e;const o=(0,u.jsx)(ne,{className:(0,a.Z)(n?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:n,...r});return n?(0,u.jsx)("li",{children:o}):o}function ae(e){let{className:t,isDropdownItem:n,...r}=e;return(0,u.jsx)("li",{className:"menu__list-item",children:(0,u.jsx)(ne,{className:(0,a.Z)("menu__link",t),...r})})}function oe(e){let{mobile:t=!1,position:n,...r}=e;const a=t?ae:re;return(0,u.jsx)(a,{...r,activeClassName:r.activeClassName??(t?"menu__link--active":"navbar__link--active")})}var ie=n(6043),le=n(8596),se=n(2263);const ce={dropdownNavbarItemMobile:"dropdownNavbarItemMobile_S0Fm"};function ue(e,t){return e.some((e=>function(e,t){return!!(0,le.Mg)(e.to,t)||!!ee(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function de(e){let{items:t,position:n,className:o,onClick:i,...l}=e;const s=(0,r.useRef)(null),[c,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("focusin",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("focusin",e)}}),[s]),(0,u.jsxs)("div",{ref:s,className:(0,a.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===n,"dropdown--show":c}),children:[(0,u.jsx)(ne,{"aria-haspopup":"true","aria-expanded":c,role:"button",href:l.to?void 0:"#",className:(0,a.Z)("navbar__link",o),...l,onClick:l.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(!c))},children:l.children??l.label}),(0,u.jsx)("ul",{className:"dropdown__menu",children:t.map(((e,t)=>(0,r.createElement)(Ne,{isDropdownItem:!0,activeClassName:"dropdown__link--active",...e,key:t})))})]})}function pe(e){let{items:t,className:n,position:o,onClick:i,...s}=e;const c=function(){const{siteConfig:{baseUrl:e}}=(0,se.Z)(),{pathname:t}=(0,l.TH)();return t.replace(e,"/")}(),d=ue(t,c),{collapsed:p,toggleCollapsed:f,setCollapsed:m}=(0,ie.u)({initialState:()=>!d});return(0,r.useEffect)((()=>{d&&m(!d)}),[c,d,m]),(0,u.jsxs)("li",{className:(0,a.Z)("menu__list-item",{"menu__list-item--collapsed":p}),children:[(0,u.jsx)(ne,{role:"button",className:(0,a.Z)(ce.dropdownNavbarItemMobile,"menu__link menu__link--sublist menu__link--sublist-caret",n),...s,onClick:e=>{e.preventDefault(),f()},children:s.children??s.label}),(0,u.jsx)(ie.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:p,children:t.map(((e,t)=>(0,r.createElement)(Ne,{mobile:!0,isDropdownItem:!0,onClick:i,activeClassName:"menu__link--active",...e,key:t})))})]})}function fe(e){let{mobile:t=!1,...n}=e;const r=t?pe:de;return(0,u.jsx)(r,{...n})}var me=n(4711);function he(e){let{width:t=20,height:n=20,...r}=e;return(0,u.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:n,"aria-hidden":!0,...r,children:(0,u.jsx)("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"})})}const ge="iconLanguage_nlXk";var be=n(8084),ye=n(813),ve=n.n(ye);function we(){const e=(0,l.TH)(),t=(0,l.k6)(),{siteConfig:{baseUrl:n}}=(0,se.Z)(),[a,o]=(0,r.useState)({wordToHighlight:"",isTitleSuggestion:!1,titleText:""});return(0,r.useEffect)((()=>{if(!e.state?.highlightState||0===e.state.highlightState.wordToHighlight.length)return;o(e.state.highlightState);const{highlightState:n,...r}=e.state;t.replace({...e,state:r})}),[e.state?.highlightState,t,e]),(0,r.useEffect)((()=>{if(0===a.wordToHighlight.length)return;const e=document.getElementsByTagName("article")[0]??document.getElementsByTagName("main")[0];if(!e)return;const t=new(ve())(e),n={ignoreJoiners:!0};return t.mark(a.wordToHighlight,n),()=>t.unmark(n)}),[a,n]),null}const xe=e=>{const t=(0,r.useRef)(!1),o=(0,r.useRef)(null),[i,s]=(0,r.useState)(!1),c=(0,l.k6)(),{siteConfig:d={}}=(0,se.Z)(),p=(d.plugins||[]).find((e=>Array.isArray(e)&&"string"==typeof e[0]&&e[0].includes("docusaurus-lunr-search"))),f=(0,z.Z)(),{baseUrl:m}=d,h=p&&p[1]?.assetUrl||m,g=(0,be.eZ)("docusaurus-lunr-search"),b=()=>{t.current||(Promise.all([fetch(`${h}${g.fileNames.searchDoc}`).then((e=>e.json())),fetch(`${h}${g.fileNames.lunrIndex}`).then((e=>e.json())),Promise.all([n.e(9878),n.e(98)]).then(n.bind(n,7078)),Promise.all([n.e(532),n.e(3575)]).then(n.bind(n,3575))]).then((e=>{let[t,n,{default:r}]=e;const{searchDocs:a,options:o}=t;a&&0!==a.length&&(((e,t,n,r)=>{new n({searchDocs:e,searchIndex:t,baseUrl:m,inputSelector:"#search_input_react",handleSelected:(e,t,n)=>{const a=n.url||"/";document.createElement("a").href=a,e.setVal(""),t.target.blur();let o="";if(r.highlightResult)try{const e=(n.text||n.subcategory||n.title).match(new RegExp("\\w*","g"));if(e&&e.length>0){const t=document.createElement("div");t.innerHTML=e[0],o=t.textContent}}catch(i){console.log(i)}c.push(a,{highlightState:{wordToHighlight:o}})},maxHits:r.maxHits})})(a,n,r,o),s(!0))})),t.current=!0)},y=(0,r.useCallback)((t=>{o.current.contains(t.target)||o.current.focus(),e.handleSearchBarToggle&&e.handleSearchBarToggle(!e.isSearchBarExpanded)}),[e.isSearchBarExpanded]);let v;return f&&(b(),v=window.navigator.platform.startsWith("Mac")?"Search \u2318+K":"Search Ctrl+K"),(0,u.jsxs)("div",{className:"navbar__search",children:[(0,u.jsx)("span",{"aria-label":"expand searchbar",role:"button",className:(0,a.Z)("search-icon",{"search-icon-hidden":e.isSearchBarExpanded}),onClick:y,onKeyDown:y,tabIndex:0}),(0,u.jsx)("input",{id:"search_input_react",type:"search",placeholder:i?v:"Loading...","aria-label":"Search",className:(0,a.Z)("navbar__search-input",{"search-bar-expanded":e.isSearchBarExpanded},{"search-bar":!e.isSearchBarExpanded}),onClick:b,onMouseOver:b,onFocus:y,onBlur:y,ref:o,disabled:!i}),(0,u.jsx)(we,{})]},"search-box")},ke={navbarSearchContainer:"navbarSearchContainer_Bca1"};function Se(e){let{children:t,className:n}=e;return(0,u.jsx)("div",{className:(0,a.Z)(n,ke.navbarSearchContainer),children:t})}var Ee=n(4104),_e=n(2802);var Ce=n(373);const Te=e=>e.docs.find((t=>t.id===e.mainDocId));const je={default:oe,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:n,dropdownItemsAfter:r,queryString:a="",...o}=e;const{i18n:{currentLocale:i,locales:c,localeConfigs:d}}=(0,se.Z)(),p=(0,me.l)(),{search:f,hash:m}=(0,l.TH)(),h=[...n,...c.map((e=>{const n=`${`pathname://${p.createUrl({locale:e,fullyQualified:!1})}`}${f}${m}${a}`;return{label:d[e].label,lang:d[e].htmlLang,to:n,target:"_self",autoAddBaseUrl:!1,className:e===i?t?"menu__link--active":"dropdown__link--active":""}})),...r],g=t?(0,s.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):d[i].label;return(0,u.jsx)(fe,{...o,mobile:t,label:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(he,{className:ge}),g]}),items:h})},search:function(e){let{mobile:t,className:n}=e;return t?null:(0,u.jsx)(Se,{className:n,children:(0,u.jsx)(xe,{})})},dropdown:fe,html:function(e){let{value:t,className:n,mobile:r=!1,isDropdownItem:o=!1}=e;const i=o?"li":"div";return(0,u.jsx)(i,{className:(0,a.Z)({navbar__item:!r&&!o,"menu__list-item":r},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:n,docsPluginId:r,...a}=e;const{activeDoc:o}=(0,Ee.Iw)(r),i=(0,_e.vY)(t,r),l=o?.path===i?.path;return null===i||i.unlisted&&!l?null:(0,u.jsx)(oe,{exact:!0,...a,isActive:()=>l||!!o?.sidebar&&o.sidebar===i.sidebar,label:n??i.id,to:i.path})},docSidebar:function(e){let{sidebarId:t,label:n,docsPluginId:r,...a}=e;const{activeDoc:o}=(0,Ee.Iw)(r),i=(0,_e.oz)(t,r).link;if(!i)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return(0,u.jsx)(oe,{exact:!0,...a,isActive:()=>o?.sidebar===t,label:n??i.label,to:i.path})},docsVersion:function(e){let{label:t,to:n,docsPluginId:r,...a}=e;const o=(0,_e.lO)(r)[0],i=t??o.label,l=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(o).path;return(0,u.jsx)(oe,{...a,label:i,to:l})},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:r,dropdownItemsBefore:a,dropdownItemsAfter:o,...i}=e;const{search:c,hash:d}=(0,l.TH)(),p=(0,Ee.Iw)(n),f=(0,Ee.gB)(n),{savePreferredVersionName:m}=(0,Ce.J)(n),h=[...a,...f.map((e=>{const t=p.alternateDocVersions[e.name]??Te(e);return{label:e.label,to:`${t.path}${c}${d}`,isActive:()=>e===p.activeVersion,onClick:()=>m(e.name)}})),...o],g=(0,_e.lO)(n)[0],b=t&&h.length>1?(0,s.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):g.label,y=t&&h.length>1?void 0:Te(g).path;return h.length<=1?(0,u.jsx)(oe,{...i,mobile:t,label:b,to:y,isActive:r?()=>!1:void 0}):(0,u.jsx)(fe,{...i,mobile:t,label:b,to:y,items:h,isActive:r?()=>!1:void 0})}};function Ne(e){let{type:t,...n}=e;const r=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),a=je[r];if(!a)throw new Error(`No NavbarItem component found for type "${t}".`);return(0,u.jsx)(a,{...n})}function Re(){const e=(0,N.e)(),t=(0,w.L)().navbar.items;return(0,u.jsx)("ul",{className:"menu__list",children:t.map(((t,n)=>(0,r.createElement)(Ne,{mobile:!0,...t,onClick:()=>e.toggle(),key:n})))})}function Ae(e){return(0,u.jsx)("button",{...e,type:"button",className:"clean-btn navbar-sidebar__back",children:(0,u.jsx)(s.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)",children:"\u2190 Back to main menu"})})}function Le(){const e=0===(0,w.L)().navbar.items.length,t=D();return(0,u.jsxs)(u.Fragment,{children:[!e&&(0,u.jsx)(Ae,{onClick:()=>t.hide()}),t.content]})}function Pe(){const e=(0,N.e)();var t;return void 0===(t=e.shown)&&(t=!0),(0,r.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?(0,u.jsx)(M,{header:(0,u.jsx)(Y,{}),primaryMenu:(0,u.jsx)(Re,{}),secondaryMenu:(0,u.jsx)(Le,{})}):null}const Oe={navbarHideable:"navbarHideable_m1mJ",navbarHidden:"navbarHidden_jGov"};function Ie(e){return(0,u.jsx)("div",{role:"presentation",...e,className:(0,a.Z)("navbar-sidebar__backdrop",e.className)})}function De(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:o}}=(0,w.L)(),i=(0,N.e)(),{navbarRef:l,isNavbarVisible:d}=function(e){const[t,n]=(0,r.useState)(e),a=(0,r.useRef)(!1),o=(0,r.useRef)(0),i=(0,r.useCallback)((e=>{null!==e&&(o.current=e.getBoundingClientRect().height)}),[]);return(0,R.RF)(((t,r)=>{let{scrollY:i}=t;if(!e)return;if(i=l?n(!1):i+c{if(!e)return;const r=t.location.hash;if(r?document.getElementById(r.substring(1)):void 0)return a.current=!0,void n(!1);n(!0)})),{navbarRef:i,isNavbarVisible:t}}(n);return(0,u.jsxs)("nav",{ref:l,"aria-label":(0,s.I)({id:"theme.NavBar.navAriaLabel",message:"Main",description:"The ARIA label for the main navigation"}),className:(0,a.Z)("navbar","navbar--fixed-top",n&&[Oe.navbarHideable,!d&&Oe.navbarHidden],{"navbar--dark":"dark"===o,"navbar--primary":"primary"===o,"navbar-sidebar--show":i.shown}),children:[t,(0,u.jsx)(Ie,{onClick:i.toggle}),(0,u.jsx)(Pe,{})]})}var Me=n(8780);const Fe={errorBoundaryError:"errorBoundaryError_a6uf",errorBoundaryFallback:"errorBoundaryFallback_VBag"};function ze(e){return(0,u.jsx)("button",{type:"button",...e,children:(0,u.jsx)(s.Z,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again rendering when the React error boundary captures an error",children:"Try again"})})}function Be(e){let{error:t}=e;const n=(0,Me.getErrorCausalChain)(t).map((e=>e.message)).join("\n\nCause:\n");return(0,u.jsx)("p",{className:Fe.errorBoundaryError,children:n})}class $e extends r.Component{componentDidCatch(e,t){throw this.props.onError(e,t)}render(){return this.props.children}}const Ue="right";function qe(e){let{width:t=30,height:n=30,className:r,...a}=e;return(0,u.jsx)("svg",{className:r,width:t,height:n,viewBox:"0 0 30 30","aria-hidden":"true",...a,children:(0,u.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"})})}function He(){const{toggle:e,shown:t}=(0,N.e)();return(0,u.jsx)("button",{onClick:e,"aria-label":(0,s.I)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":t,className:"navbar__toggle clean-btn",type:"button",children:(0,u.jsx)(qe,{})})}const Ze={colorModeToggle:"colorModeToggle_DEke"};function Ge(e){let{items:t}=e;return(0,u.jsx)(u.Fragment,{children:t.map(((e,t)=>(0,u.jsx)($e,{onError:t=>new Error(`A theme navbar item failed to render.\nPlease double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:\n${JSON.stringify(e,null,2)}`,{cause:t}),children:(0,u.jsx)(Ne,{...e})},t)))})}function We(e){let{left:t,right:n}=e;return(0,u.jsxs)("div",{className:"navbar__inner",children:[(0,u.jsx)("div",{className:"navbar__items",children:t}),(0,u.jsx)("div",{className:"navbar__items navbar__items--right",children:n})]})}function Ve(){const e=(0,N.e)(),t=(0,w.L)().navbar.items,[n,r]=function(e){function t(e){return"left"===(e.position??Ue)}return[e.filter(t),e.filter((e=>!t(e)))]}(t),a=t.find((e=>"search"===e.type));return(0,u.jsx)(We,{left:(0,u.jsxs)(u.Fragment,{children:[!e.disabled&&(0,u.jsx)(He,{}),(0,u.jsx)(V,{}),(0,u.jsx)(Ge,{items:n})]}),right:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Ge,{items:r}),(0,u.jsx)(G,{className:Ze.colorModeToggle}),!a&&(0,u.jsx)(Se,{children:(0,u.jsx)(xe,{})})]})})}function Qe(){return(0,u.jsx)(De,{children:(0,u.jsx)(Ve,{})})}function Ye(e){let{item:t}=e;const{to:n,href:r,label:a,prependBaseUrlToHref:o,...i}=t,l=(0,X.Z)(n),s=(0,X.Z)(r,{forcePrependBaseUrl:!0});return(0,u.jsxs)(K.Z,{className:"footer__link-item",...r?{href:o?s:r}:{to:l},...i,children:[a,r&&!(0,J.Z)(r)&&(0,u.jsx)(te.Z,{})]})}function Ke(e){let{item:t}=e;return t.html?(0,u.jsx)("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):(0,u.jsx)("li",{className:"footer__item",children:(0,u.jsx)(Ye,{item:t})},t.href??t.to)}function Xe(e){let{column:t}=e;return(0,u.jsxs)("div",{className:"col footer__col",children:[(0,u.jsx)("div",{className:"footer__title",children:t.title}),(0,u.jsx)("ul",{className:"footer__items clean-list",children:t.items.map(((e,t)=>(0,u.jsx)(Ke,{item:e},t)))})]})}function Je(e){let{columns:t}=e;return(0,u.jsx)("div",{className:"row footer__links",children:t.map(((e,t)=>(0,u.jsx)(Xe,{column:e},t)))})}function et(){return(0,u.jsx)("span",{className:"footer__link-separator",children:"\xb7"})}function tt(e){let{item:t}=e;return t.html?(0,u.jsx)("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):(0,u.jsx)(Ye,{item:t})}function nt(e){let{links:t}=e;return(0,u.jsx)("div",{className:"footer__links text--center",children:(0,u.jsx)("div",{className:"footer__links",children:t.map(((e,n)=>(0,u.jsxs)(r.Fragment,{children:[(0,u.jsx)(tt,{item:e}),t.length!==n+1&&(0,u.jsx)(et,{})]},n)))})})}function rt(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?(0,u.jsx)(Je,{columns:t}):(0,u.jsx)(nt,{links:t})}var at=n(9965);const ot={footerLogoLink:"footerLogoLink_BH7S"};function it(e){let{logo:t}=e;const{withBaseUrl:n}=(0,X.C)(),r={light:n(t.src),dark:n(t.srcDark??t.src)};return(0,u.jsx)(at.Z,{className:(0,a.Z)("footer__logo",t.className),alt:t.alt,sources:r,width:t.width,height:t.height,style:t.style})}function lt(e){let{logo:t}=e;return t.href?(0,u.jsx)(K.Z,{href:t.href,className:ot.footerLogoLink,target:t.target,children:(0,u.jsx)(it,{logo:t})}):(0,u.jsx)(it,{logo:t})}function st(e){let{copyright:t}=e;return(0,u.jsx)("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function ct(e){let{style:t,links:n,logo:r,copyright:o}=e;return(0,u.jsx)("footer",{className:(0,a.Z)("footer",{"footer--dark":"dark"===t}),children:(0,u.jsxs)("div",{className:"container container-fluid",children:[n,(r||o)&&(0,u.jsxs)("div",{className:"footer__bottom text--center",children:[r&&(0,u.jsx)("div",{className:"margin-bottom--sm",children:r}),o]})]})})}function ut(){const{footer:e}=(0,w.L)();if(!e)return null;const{copyright:t,links:n,logo:r,style:a}=e;return(0,u.jsx)(ct,{style:a,links:n&&n.length>0&&(0,u.jsx)(rt,{links:n}),logo:r&&(0,u.jsx)(lt,{logo:r}),copyright:t&&(0,u.jsx)(st,{copyright:t})})}const dt=r.memo(ut),pt=(0,A.Qc)([F.S,x.pl,R.OC,Ce.L5,i.VC,function(e){let{children:t}=e;return(0,u.jsx)(L.n2,{children:(0,u.jsx)(N.M,{children:(0,u.jsx)(O,{children:t})})})}]);function ft(e){let{children:t}=e;return(0,u.jsx)(pt,{children:t})}var mt=n(2503);function ht(e){let{error:t,tryAgain:n}=e;return(0,u.jsx)("main",{className:"container margin-vert--xl",children:(0,u.jsx)("div",{className:"row",children:(0,u.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,u.jsx)(mt.Z,{as:"h1",className:"hero__title",children:(0,u.jsx)(s.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed",children:"This page crashed."})}),(0,u.jsx)("div",{className:"margin-vert--lg",children:(0,u.jsx)(ze,{onClick:n,className:"button button--primary shadow--lw"})}),(0,u.jsx)("hr",{}),(0,u.jsx)("div",{className:"margin-vert--md",children:(0,u.jsx)(Be,{error:t})})]})})})}const gt={mainWrapper:"mainWrapper_z2l0"};function bt(e){const{children:t,noFooter:n,wrapperClassName:r,title:l,description:s}=e;return(0,b.t)(),(0,u.jsxs)(ft,{children:[(0,u.jsx)(i.d,{title:l,description:s}),(0,u.jsx)(v,{}),(0,u.jsx)(j,{}),(0,u.jsx)(Qe,{}),(0,u.jsx)("div",{id:d,className:(0,a.Z)(g.k.wrapper.main,gt.mainWrapper,r),children:(0,u.jsx)(o.Z,{fallback:e=>(0,u.jsx)(ht,{...e}),children:t})}),!n&&(0,u.jsx)(dt,{})]})}},1327:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});n(7294);var r=n(9960),a=n(4996),o=n(2263),i=n(6668),l=n(9965),s=n(5893);function c(e){let{logo:t,alt:n,imageClassName:r}=e;const o={light:(0,a.Z)(t.src),dark:(0,a.Z)(t.srcDark||t.src)},i=(0,s.jsx)(l.Z,{className:t.className,sources:o,height:t.height,width:t.width,alt:n,style:t.style});return r?(0,s.jsx)("div",{className:r,children:i}):i}function u(e){const{siteConfig:{title:t}}=(0,o.Z)(),{navbar:{title:n,logo:l}}=(0,i.L)(),{imageClassName:u,titleClassName:d,...p}=e,f=(0,a.Z)(l?.href||"/"),m=n?"":t,h=l?.alt??m;return(0,s.jsxs)(r.Z,{to:f,...p,...l?.target&&{target:l.target},children:[l&&(0,s.jsx)(c,{logo:l,alt:h,imageClassName:u}),null!=n&&(0,s.jsx)("b",{className:d,children:n})]})}},197:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});n(7294);var r=n(5742),a=n(5893);function o(e){let{locale:t,version:n,tag:o}=e;const i=t;return(0,a.jsxs)(r.Z,{children:[t&&(0,a.jsx)("meta",{name:"docusaurus_locale",content:t}),n&&(0,a.jsx)("meta",{name:"docusaurus_version",content:n}),o&&(0,a.jsx)("meta",{name:"docusaurus_tag",content:o}),i&&(0,a.jsx)("meta",{name:"docsearch:language",content:i}),n&&(0,a.jsx)("meta",{name:"docsearch:version",content:n}),o&&(0,a.jsx)("meta",{name:"docsearch:docusaurus_tag",content:o})]})}},9965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(7294),a=n(512),o=n(2389),i=n(2949);const l={themedComponent:"themedComponent_mlkZ","themedComponent--light":"themedComponent--light_NVdE","themedComponent--dark":"themedComponent--dark_xIcU"};var s=n(5893);function c(e){let{className:t,children:n}=e;const c=(0,o.Z)(),{colorMode:u}=(0,i.I)();return(0,s.jsx)(s.Fragment,{children:(c?"dark"===u?["dark"]:["light"]:["light","dark"]).map((e=>{const o=n({theme:e,className:(0,a.Z)(t,l.themedComponent,l[`themedComponent--${e}`])});return(0,s.jsx)(r.Fragment,{children:o},e)}))})}function u(e){const{sources:t,className:n,alt:r,...a}=e;return(0,s.jsx)(c,{className:n,children:e=>{let{theme:n,className:o}=e;return(0,s.jsx)("img",{src:t[n],alt:r,className:o,...a})}})}},6043:(e,t,n)=>{"use strict";n.d(t,{u:()=>c,z:()=>b});var r=n(7294),a=n(412),o=n(469),i=n(1442),l=n(5893);const s="ease-in-out";function c(e){let{initialState:t}=e;const[n,a]=(0,r.useState)(t??!1),o=(0,r.useCallback)((()=>{a((e=>!e))}),[]);return{collapsed:n,setCollapsed:a,toggleCollapsed:o}}const u={display:"none",overflow:"hidden",height:"0px"},d={display:"block",overflow:"visible",height:"auto"};function p(e,t){const n=t?u:d;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function f(e){let{collapsibleRef:t,collapsed:n,animation:a}=e;const o=(0,r.useRef)(!1);(0,r.useEffect)((()=>{const e=t.current;function r(){const t=e.scrollHeight,n=a?.duration??function(e){if((0,i.n)())return 1;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${a?.easing??s}`,height:`${t}px`}}function l(){const t=r();e.style.transition=t.transition,e.style.height=t.height}if(!o.current)return p(e,n),void(o.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(l(),requestAnimationFrame((()=>{e.style.height=u.height,e.style.overflow=u.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{l()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,a])}function m(e){if(!a.Z.canUseDOM)return e?u:d}function h(e){let{as:t="div",collapsed:n,children:a,animation:o,onCollapseTransitionEnd:i,className:s,disableSSRStyle:c}=e;const u=(0,r.useRef)(null);return f({collapsibleRef:u,collapsed:n,animation:o}),(0,l.jsx)(t,{ref:u,style:c?void 0:m(n),onTransitionEnd:e=>{"height"===e.propertyName&&(p(u.current,n),i?.(n))},className:s,children:a})}function g(e){let{collapsed:t,...n}=e;const[a,i]=(0,r.useState)(!t),[s,c]=(0,r.useState)(t);return(0,o.Z)((()=>{t||i(!0)}),[t]),(0,o.Z)((()=>{a&&c(t)}),[a,t]),a?(0,l.jsx)(h,{...n,collapsed:s}):null}function b(e){let{lazy:t,...n}=e;const r=t?g:h;return(0,l.jsx)(r,{...n})}},9689:(e,t,n)=>{"use strict";n.d(t,{nT:()=>h,pl:()=>m});var r=n(7294),a=n(2389),o=n(12),i=n(902),l=n(6668),s=n(5893);const c=(0,o.WA)("docusaurus.announcement.dismiss"),u=(0,o.WA)("docusaurus.announcement.id"),d=()=>"true"===c.get(),p=e=>c.set(String(e)),f=r.createContext(null);function m(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,l.L)(),t=(0,a.Z)(),[n,o]=(0,r.useState)((()=>!!t&&d()));(0,r.useEffect)((()=>{o(d())}),[]);const i=(0,r.useCallback)((()=>{p(!0),o(!0)}),[]);return(0,r.useEffect)((()=>{if(!e)return;const{id:t}=e;let n=u.get();"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;u.set(t),r&&p(!1),!r&&d()||o(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:i})),[e,n,i])}();return(0,s.jsx)(f.Provider,{value:n,children:t})}function h(){const e=(0,r.useContext)(f);if(!e)throw new i.i6("AnnouncementBarProvider");return e}},2949:(e,t,n)=>{"use strict";n.d(t,{I:()=>b,S:()=>g});var r=n(7294),a=n(412),o=n(902),i=n(12),l=n(6668),s=n(5893);const c=r.createContext(void 0),u="theme",d=(0,i.WA)(u),p={light:"light",dark:"dark"},f=e=>e===p.dark?p.dark:p.light,m=e=>a.Z.canUseDOM?f(document.documentElement.getAttribute("data-theme")):f(e),h=e=>{d.set(f(e))};function g(e){let{children:t}=e;const n=function(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,l.L)(),[a,o]=(0,r.useState)(m(e));(0,r.useEffect)((()=>{t&&d.del()}),[t]);const i=(0,r.useCallback)((function(t,r){void 0===r&&(r={});const{persist:a=!0}=r;t?(o(t),a&&h(t)):(o(n?window.matchMedia("(prefers-color-scheme: dark)").matches?p.dark:p.light:e),d.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",f(a))}),[a]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==u)return;const t=d.get();null!==t&&i(f(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,i]);const s=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(t&&!n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{window.matchMedia("print").matches||s.current?s.current=window.matchMedia("print").matches:i(null)};return e.addListener(r),()=>e.removeListener(r)}),[i,t,n]),(0,r.useMemo)((()=>({colorMode:a,setColorMode:i,get isDarkTheme(){return a===p.dark},setLightTheme(){i(p.light)},setDarkTheme(){i(p.dark)}})),[a,i])}();return(0,s.jsx)(c.Provider,{value:n,children:t})}function b(){const e=(0,r.useContext)(c);if(null==e)throw new o.i6("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},373:(e,t,n)=>{"use strict";n.d(t,{J:()=>v,L5:()=>b});var r=n(7294),a=n(4104),o=n(9935),i=n(6668),l=n(2802),s=n(902),c=n(12),u=n(5893);const d=e=>`docs-preferred-version-${e}`,p={save:(e,t,n)=>{(0,c.WA)(d(e),{persistence:t}).set(n)},read:(e,t)=>(0,c.WA)(d(e),{persistence:t}).get(),clear:(e,t)=>{(0,c.WA)(d(e),{persistence:t}).del()}},f=e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}])));const m=r.createContext(null);function h(){const e=(0,a._r)(),t=(0,i.L)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[o,l]=(0,r.useState)((()=>f(n)));(0,r.useEffect)((()=>{l(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function a(e){const t=p.read(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(p.clear(e,n),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,a(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]);return[o,(0,r.useMemo)((()=>({savePreferredVersion:function(e,n){p.save(e,t,n),l((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function g(e){let{children:t}=e;const n=h();return(0,u.jsx)(m.Provider,{value:n,children:t})}function b(e){let{children:t}=e;return l.cE?(0,u.jsx)(g,{children:t}):(0,u.jsx)(u.Fragment,{children:t})}function y(){const e=(0,r.useContext)(m);if(!e)throw new s.i6("DocsPreferredVersionContextProvider");return e}function v(e){void 0===e&&(e=o.m);const t=(0,a.zh)(e),[n,i]=y(),{preferredVersionName:l}=n[e];return{preferredVersion:t.versions.find((e=>e.name===l))??null,savePreferredVersionName:(0,r.useCallback)((t=>{i.savePreferredVersion(e,t)}),[i,e])}}},1116:(e,t,n)=>{"use strict";n.d(t,{V:()=>c,b:()=>s});var r=n(7294),a=n(902),o=n(5893);const i=Symbol("EmptyContext"),l=r.createContext(i);function s(e){let{children:t,name:n,items:a}=e;const i=(0,r.useMemo)((()=>n&&a?{name:n,items:a}:null),[n,a]);return(0,o.jsx)(l.Provider,{value:i,children:t})}function c(){const e=(0,r.useContext)(l);if(e===i)throw new a.i6("DocsSidebarProvider");return e}},4477:(e,t,n)=>{"use strict";n.d(t,{E:()=>s,q:()=>l});var r=n(7294),a=n(902),o=n(5893);const i=r.createContext(null);function l(e){let{children:t,version:n}=e;return(0,o.jsx)(i.Provider,{value:n,children:t})}function s(){const e=(0,r.useContext)(i);if(null===e)throw new a.i6("DocsVersionProvider");return e}},2961:(e,t,n)=>{"use strict";n.d(t,{M:()=>f,e:()=>m});var r=n(7294),a=n(3102),o=n(7524),i=n(6550),l=n(902);function s(e){!function(e){const t=(0,i.k6)(),n=(0,l.zX)(e);(0,r.useEffect)((()=>t.block(((e,t)=>n(e,t)))),[t,n])}(((t,n)=>{if("POP"===n)return e(t,n)}))}var c=n(6668),u=n(5893);const d=r.createContext(void 0);function p(){const e=function(){const e=(0,a.HY)(),{items:t}=(0,c.L)().navbar;return 0===t.length&&!e.component}(),t=(0,o.i)(),n=!e&&"mobile"===t,[i,l]=(0,r.useState)(!1);s((()=>{if(i)return l(!1),!1}));const u=(0,r.useCallback)((()=>{l((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&l(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:i})),[e,n,u,i])}function f(e){let{children:t}=e;const n=p();return(0,u.jsx)(d.Provider,{value:n,children:t})}function m(){const e=r.useContext(d);if(void 0===e)throw new l.i6("NavbarMobileSidebarProvider");return e}},3102:(e,t,n)=>{"use strict";n.d(t,{HY:()=>s,Zo:()=>c,n2:()=>l});var r=n(7294),a=n(902),o=n(5893);const i=r.createContext(null);function l(e){let{children:t}=e;const n=(0,r.useState)({component:null,props:null});return(0,o.jsx)(i.Provider,{value:n,children:t})}function s(){const e=(0,r.useContext)(i);if(!e)throw new a.i6("NavbarSecondaryMenuContentProvider");return e[0]}function c(e){let{component:t,props:n}=e;const o=(0,r.useContext)(i);if(!o)throw new a.i6("NavbarSecondaryMenuContentProvider");const[,l]=o,s=(0,a.Ql)(n);return(0,r.useEffect)((()=>{l({component:t,props:s})}),[l,t,s]),(0,r.useEffect)((()=>()=>l({component:null,props:null})),[l]),null}},9727:(e,t,n)=>{"use strict";n.d(t,{h:()=>a,t:()=>o});var r=n(7294);const a="navigation-with-keyboard";function o(){(0,r.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(a),"mousedown"===e.type&&document.body.classList.remove(a)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(a),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},7524:(e,t,n)=>{"use strict";n.d(t,{i:()=>l});var r=n(7294),a=n(412);const o={desktop:"desktop",mobile:"mobile",ssr:"ssr"},i=996;function l(){const[e,t]=(0,r.useState)((()=>"ssr"));return(0,r.useEffect)((()=>{function e(){t(function(){if(!a.Z.canUseDOM)throw new Error("getWindowSize() should only be called after React hydration");return window.innerWidth>i?o.desktop:o.mobile}())}return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),e}},5281:(e,t,n)=>{"use strict";n.d(t,{k:()=>r});const r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",unlistedBanner:"theme-unlisted-banner",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{}}},1442:(e,t,n)=>{"use strict";function r(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}n.d(t,{n:()=>r})},2802:(e,t,n)=>{"use strict";n.d(t,{LM:()=>f,_F:()=>g,cE:()=>p,SN:()=>E,lO:()=>x,vY:()=>S,oz:()=>k,s1:()=>w,f:()=>y});var r=n(7294),a=n(6550),o=n(8790),i=n(4104),l=n(373),s=n(4477),c=n(1116);function u(e){return Array.from(new Set(e))}var d=n(8596);const p=!!i._r;function f(e){return"link"!==e.type||e.unlisted?"category"===e.type?function(e){if(e.href&&!e.linkUnlisted)return e.href;for(const t of e.items){const e=f(t);if(e)return e}}(e):void 0:e.href}const m=(e,t)=>void 0!==e&&(0,d.Mg)(e,t),h=(e,t)=>e.some((e=>g(e,t)));function g(e,t){return"link"===e.type?m(e.href,t):"category"===e.type&&(m(e.href,t)||h(e.items,t))}function b(e,t){switch(e.type){case"category":return g(e,t)||e.items.some((e=>b(e,t)));case"link":return!e.unlisted||g(e,t);default:return!0}}function y(e,t){return(0,r.useMemo)((()=>e.filter((e=>b(e,t)))),[e,t])}function v(e){let{sidebarItems:t,pathname:n,onlyCategories:r=!1}=e;const a=[];return function e(t){for(const o of t)if("category"===o.type&&((0,d.Mg)(o.href,n)||e(o.items))||"link"===o.type&&(0,d.Mg)(o.href,n)){return r&&"category"!==o.type||a.unshift(o),!0}return!1}(t),a}function w(){const e=(0,c.V)(),{pathname:t}=(0,a.TH)(),n=(0,i.gA)()?.pluginData.breadcrumbs;return!1!==n&&e?v({sidebarItems:e.items,pathname:t}):null}function x(e){const{activeVersion:t}=(0,i.Iw)(e),{preferredVersion:n}=(0,l.J)(e),a=(0,i.yW)(e);return(0,r.useMemo)((()=>u([t,n,a].filter(Boolean))),[t,n,a])}function k(e,t){const n=x(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),r=t.find((t=>t[0]===e));if(!r)throw new Error(`Can't find any sidebar with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\nAvailable sidebar ids are:\n- ${t.map((e=>e[0])).join("\n- ")}`);return r[1]}),[e,n])}function S(e,t){const n=x(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.docs)),r=t.find((t=>t.id===e));if(!r){if(n.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`Couldn't find any doc with id "${e}" in version${n.length>1?"s":""} "${n.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${u(t.map((e=>e.id))).join("\n- ")}`)}return r}),[e,n])}function E(e){let{route:t}=e;const n=(0,a.TH)(),r=(0,s.E)(),i=t.routes,l=i.find((e=>(0,a.LX)(n.pathname,e)));if(!l)return null;const c=l.sidebar,u=c?r.docsSidebars[c]:void 0;return{docElement:(0,o.H)(i),sidebarName:c,sidebarItems:u}}},1944:(e,t,n)=>{"use strict";n.d(t,{FG:()=>f,d:()=>d,VC:()=>m});var r=n(7294),a=n(512),o=n(5742),i=n(226);function l(){const e=r.useContext(i._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var s=n(4996),c=n(2263);var u=n(5893);function d(e){let{title:t,description:n,keywords:r,image:a,children:i}=e;const l=function(e){const{siteConfig:t}=(0,c.Z)(),{title:n,titleDelimiter:r}=t;return e?.trim().length?`${e.trim()} ${r} ${n}`:n}(t),{withBaseUrl:d}=(0,s.C)(),p=a?d(a,{absolute:!0}):void 0;return(0,u.jsxs)(o.Z,{children:[t&&(0,u.jsx)("title",{children:l}),t&&(0,u.jsx)("meta",{property:"og:title",content:l}),n&&(0,u.jsx)("meta",{name:"description",content:n}),n&&(0,u.jsx)("meta",{property:"og:description",content:n}),r&&(0,u.jsx)("meta",{name:"keywords",content:Array.isArray(r)?r.join(","):r}),p&&(0,u.jsx)("meta",{property:"og:image",content:p}),p&&(0,u.jsx)("meta",{name:"twitter:image",content:p}),i]})}const p=r.createContext(void 0);function f(e){let{className:t,children:n}=e;const i=r.useContext(p),l=(0,a.Z)(i,t);return(0,u.jsxs)(p.Provider,{value:l,children:[(0,u.jsx)(o.Z,{children:(0,u.jsx)("html",{className:l})}),n]})}function m(e){let{children:t}=e;const n=l(),r=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const o=`plugin-id-${n.plugin.id}`;return(0,u.jsx)(f,{className:(0,a.Z)(r,o),children:t})}},902:(e,t,n)=>{"use strict";n.d(t,{D9:()=>l,Qc:()=>u,Ql:()=>c,i6:()=>s,zX:()=>i});var r=n(7294),a=n(469),o=n(5893);function i(e){const t=(0,r.useRef)(e);return(0,a.Z)((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function l(e){const t=(0,r.useRef)();return(0,a.Z)((()=>{t.current=e})),t.current}class s extends Error{constructor(e,t){super(),this.name="ReactContextError",this.message=`Hook ${this.stack?.split("\n")[1]?.match(/at (?:\w+\.)?(?\w+)/)?.groups.name??""} is called outside the <${e}>. ${t??""}`}}function c(e){const t=Object.entries(e);return t.sort(((e,t)=>e[0].localeCompare(t[0]))),(0,r.useMemo)((()=>e),t.flat())}function u(e){return t=>{let{children:n}=t;return(0,o.jsx)(o.Fragment,{children:e.reduceRight(((e,t)=>(0,o.jsx)(t,{children:e})),n)})}}},8596:(e,t,n)=>{"use strict";n.d(t,{Mg:()=>i,Ns:()=>l});var r=n(7294),a=n(723),o=n(2263);function i(e,t){const n=e=>(!e||e.endsWith("/")?e:`${e}/`)?.toLowerCase();return n(e)===n(t)}function l(){const{baseUrl:e}=(0,o.Z)().siteConfig;return(0,r.useMemo)((()=>function(e){let{baseUrl:t,routes:n}=e;function r(e){return e.path===t&&!0===e.exact}function a(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(r)||e(t.filter(a).flatMap((e=>e.routes??[])))}(n)}({routes:a.Z,baseUrl:e})),[e])}},2466:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>f,OC:()=>c,RF:()=>p});var r=n(7294),a=n(412),o=n(2389),i=(n(469),n(902)),l=n(5893);const s=r.createContext(void 0);function c(e){let{children:t}=e;const n=function(){const e=(0,r.useRef)(!0);return(0,r.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return(0,l.jsx)(s.Provider,{value:n,children:t})}function u(){const e=(0,r.useContext)(s);if(null==e)throw new i.i6("ScrollControllerProvider");return e}const d=()=>a.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function p(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=u(),a=(0,r.useRef)(d()),o=(0,i.zX)(e);(0,r.useEffect)((()=>{const e=()=>{if(!n.current)return;const e=d();o(e,a.current),a.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[o,n,...t])}function f(){const e=(0,r.useRef)(null),t=(0,o.Z)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:n=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(n):function(e){let t=null;const n=document.documentElement.scrollTop>e;return function r(){const a=document.documentElement.scrollTop;(n&&a>e||!n&&at&&cancelAnimationFrame(t)}(n)},cancelScroll:()=>e.current?.()}}},3320:(e,t,n)=>{"use strict";n.d(t,{HX:()=>r,os:()=>a});n(2263);const r="default";function a(e,t){return`docs-${e}-${t}`}},12:(e,t,n)=>{"use strict";n.d(t,{WA:()=>s});n(7294);const r="localStorage";function a(e){let{key:t,oldValue:n,newValue:r,storage:a}=e;if(n===r)return;const o=document.createEvent("StorageEvent");o.initStorageEvent("storage",!1,!1,t,n,r,window.location.href,a),window.dispatchEvent(o)}function o(e){if(void 0===e&&(e=r),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,i||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),i=!0),null}var t}let i=!1;const l={get:()=>null,set:()=>{},del:()=>{},listen:()=>()=>{}};function s(e,t){if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t,listen:t}}(e);const n=o(t?.persistence);return null===n?l:{get:()=>{try{return n.getItem(e)}catch(t){return console.error(`Docusaurus storage error, can't get key=${e}`,t),null}},set:t=>{try{const r=n.getItem(e);n.setItem(e,t),a({key:e,oldValue:r,newValue:t,storage:n})}catch(r){console.error(`Docusaurus storage error, can't set ${e}=${t}`,r)}},del:()=>{try{const t=n.getItem(e);n.removeItem(e),a({key:e,oldValue:t,newValue:null,storage:n})}catch(t){console.error(`Docusaurus storage error, can't delete key=${e}`,t)}},listen:t=>{try{const r=r=>{r.storageArea===n&&r.key===e&&t(r)};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)}catch(r){return console.error(`Docusaurus storage error, can't listen for changes of key=${e}`,r),()=>{}}}}}},4711:(e,t,n)=>{"use strict";n.d(t,{l:()=>i});var r=n(2263),a=n(6550),o=n(8780);function i(){const{siteConfig:{baseUrl:e,url:t,trailingSlash:n},i18n:{defaultLocale:i,currentLocale:l}}=(0,r.Z)(),{pathname:s}=(0,a.TH)(),c=(0,o.applyTrailingSlash)(s,{trailingSlash:n,baseUrl:e}),u=l===i?e:e.replace(`/${l}/`,"/"),d=c.replace(e,"");return{createUrl:function(e){let{locale:n,fullyQualified:r}=e;return`${r?t:""}${function(e){return e===i?`${u}`:`${u}${e}/`}(n)}${d}`}}}},5936:(e,t,n)=>{"use strict";n.d(t,{S:()=>i});var r=n(7294),a=n(6550),o=n(902);function i(e){const t=(0,a.TH)(),n=(0,o.D9)(t),i=(0,o.zX)(e);(0,r.useEffect)((()=>{n&&t!==n&&i({location:t,previousLocation:n})}),[i,t,n])}},6668:(e,t,n)=>{"use strict";n.d(t,{L:()=>a});var r=n(2263);function a(){return(0,r.Z)().siteConfig.themeConfig}},8802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){const{trailingSlash:n,baseUrl:r}=t;if(e.startsWith("#"))return e;if(void 0===n)return e;const[a]=e.split(/[#?]/),o="/"===a||a===r?a:(i=a,n?function(e){return e.endsWith("/")?e:`${e}/`}(i):function(e){return e.endsWith("/")?e.slice(0,-1):e}(i));var i;return e.replace(a,o)}},4143:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCausalChain=void 0,t.getErrorCausalChain=function e(t){return t.cause?[t,...e(t.cause)]:[t]}},8780:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCausalChain=t.applyTrailingSlash=t.blogPostContainerID=void 0,t.blogPostContainerID="__blog-post-container";var a=n(8802);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return r(a).default}});var o=n(4143);Object.defineProperty(t,"getErrorCausalChain",{enumerable:!0,get:function(){return o.getErrorCausalChain}})},9318:(e,t,n)=>{"use strict";n.d(t,{lX:()=>w,q_:()=>C,ob:()=>f,PP:()=>j,Ep:()=>p});var r=n(7462);function a(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,r=n+1,a=e.length;r=0;p--){var f=i[p];"."===f?o(i,p):".."===f?(o(i,p),d++):d&&(o(i,p),d--)}if(!c)for(;d--;d)i.unshift("..");!c||""===i[0]||i[0]&&a(i[0])||i.unshift("");var m=i.join("/");return n&&"/"!==m.substr(-1)&&(m+="/"),m};var l=n(8776);function s(e){return"/"===e.charAt(0)?e:"/"+e}function c(e){return"/"===e.charAt(0)?e.substr(1):e}function u(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function d(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function p(e){var t=e.pathname,n=e.search,r=e.hash,a=t||"/";return n&&"?"!==n&&(a+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(a+="#"===r.charAt(0)?r:"#"+r),a}function f(e,t,n,a){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),o.state=t):(void 0===(o=(0,r.Z)({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(l){throw l instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):l}return n&&(o.key=n),a?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=i(o.pathname,a.pathname)):o.pathname=a.pathname:o.pathname||(o.pathname="/"),o}function m(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,a){if(null!=e){var o="function"==typeof e?e(t,n):e;"string"==typeof o?"function"==typeof r?r(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,a):n.push(a),d({action:r,location:a,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",a=f(e,t,h(),w.location);u.confirmTransitionTo(a,r,n,(function(e){e&&(w.entries[w.index]=a,d({action:r,location:a}))}))},go:v,goBack:function(){v(-1)},goForward:function(){v(1)},canGo:function(e){var t=w.index+e;return t>=0&&t{"use strict";var r=n(9864),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=f(n);a&&a!==m&&e(t,a,r)}var i=u(n);d&&(i=i.concat(d(n)));for(var l=s(t),h=s(n),g=0;g{"use strict";e.exports=function(e,t,n,r,a,o,i,l){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,o,i,l],u=0;(s=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},5826:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},813:function(e){e.exports=function(){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1])||arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;t(this,e),this.ctx=n,this.iframes=r,this.exclude=a,this.iframesTimeout=o}return n(e,[{key:"getContexts",value:function(){var e=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach((function(t){var n=e.filter((function(e){return e.contains(t)})).length>0;-1!==e.indexOf(t)||n||e.push(t)})),e}},{key:"getIframeContents",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=void 0;try{var a=e.contentWindow;if(r=a.document,!a||!r)throw new Error("iframe inaccessible")}catch(o){n()}r&&t(r)}},{key:"isIframeBlank",value:function(e){var t="about:blank",n=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&n!==t&&n}},{key:"observeIframeLoad",value:function(e,t,n){var r=this,a=!1,o=null,i=function i(){if(!a){a=!0,clearTimeout(o);try{r.isIframeBlank(e)||(e.removeEventListener("load",i),r.getIframeContents(e,t,n))}catch(l){n()}}};e.addEventListener("load",i),o=setTimeout(i,this.iframesTimeout)}},{key:"onIframeReady",value:function(e,t,n){try{"complete"===e.contentWindow.document.readyState?this.isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t,n):this.observeIframeLoad(e,t,n)}catch(r){n()}}},{key:"waitForIframes",value:function(e,t){var n=this,r=0;this.forEachIframe(e,(function(){return!0}),(function(e){r++,n.waitForIframes(e.querySelector("html"),(function(){--r||t()}))}),(function(e){e||t()}))}},{key:"forEachIframe",value:function(t,n,r){var a=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},i=t.querySelectorAll("iframe"),l=i.length,s=0;i=Array.prototype.slice.call(i);var c=function(){--l<=0&&o(s)};l||c(),i.forEach((function(t){e.matches(t,a.exclude)?c():a.onIframeReady(t,(function(e){n(t)&&(s++,r(e)),c()}),c)}))}},{key:"createIterator",value:function(e,t,n){return document.createNodeIterator(e,t,n,!1)}},{key:"createInstanceOnIframe",value:function(t){return new e(t.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(e,t,n){if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING){if(null===t)return!0;if(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(e){var t=e.previousNode();return{prevNode:t,node:(null===t||e.nextNode())&&e.nextNode()}}},{key:"checkIframeFilter",value:function(e,t,n,r){var a=!1,o=!1;return r.forEach((function(e,t){e.val===n&&(a=t,o=e.handled)})),this.compareNodeIframe(e,t,n)?(!1!==a||o?!1===a||o||(r[a].handled=!0):r.push({val:n,handled:!0}),!0):(!1===a&&r.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(e,t,n,r){var a=this;e.forEach((function(e){e.handled||a.getIframeContents(e.val,(function(e){a.createInstanceOnIframe(e).forEachNode(t,n,r)}))}))}},{key:"iterateThroughNodes",value:function(e,t,n,r,a){for(var o=this,i=this.createIterator(t,e,r),l=[],s=[],c=void 0,u=void 0,d=function(){var e=o.getIteratorNode(i);return u=e.prevNode,c=e.node};d();)this.iframes&&this.forEachIframe(t,(function(e){return o.checkIframeFilter(c,u,e,l)}),(function(t){o.createInstanceOnIframe(t).forEachNode(e,(function(e){return s.push(e)}),r)})),s.push(c);s.forEach((function(e){n(e)})),this.iframes&&this.handleOpenIframes(l,e,n,r),a()}},{key:"forEachNode",value:function(e,t,n){var r=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),i=o.length;i||a(),o.forEach((function(o){var l=function(){r.iterateThroughNodes(e,o,t,n,(function(){--i<=0&&a()}))};r.iframes?r.waitForIframes(o,l):l()}))}}],[{key:"matches",value:function(e,t){var n="string"==typeof t?[t]:t,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(r){var a=!1;return n.every((function(t){return!r.call(e,t)||(a=!0,!1)})),a}return!1}}]),e}(),o=function(){function o(e){t(this,o),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1)&&(this.ie=!0)}return n(o,[{key:"log",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",r=this.opt.log;this.opt.debug&&"object"===(void 0===r?"undefined":e(r))&&"function"==typeof r[n]&&r[n]("mark.js: "+t)}},{key:"escapeStr",value:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(e){return"disabled"!==this.opt.wildcards&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),"disabled"!==this.opt.wildcards&&(e=this.createWildcardsRegExp(e)),e=this.createAccuracyRegExp(e)}},{key:"createSynonymsRegExp",value:function(e){var t=this.opt.synonyms,n=this.opt.caseSensitive?"":"i",r=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var a in t)if(t.hasOwnProperty(a)){var o=t[a],i="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(a):this.escapeStr(a),l="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==i&&""!==l&&(e=e.replace(new RegExp("("+this.escapeStr(i)+"|"+this.escapeStr(l)+")","gm"+n),r+"("+this.processSynomyms(i)+"|"+this.processSynomyms(l)+")"+r))}return e}},{key:"processSynomyms",value:function(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}},{key:"setupWildcardsRegExp",value:function(e){return(e=e.replace(/(?:\\)*\?/g,(function(e){return"\\"===e.charAt(0)?"?":"\x01"}))).replace(/(?:\\)*\*/g,(function(e){return"\\"===e.charAt(0)?"*":"\x02"}))}},{key:"createWildcardsRegExp",value:function(e){var t="withSpaces"===this.opt.wildcards;return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(e){return e.replace(/[^(|)\\]/g,(function(e,t,n){var r=n.charAt(t+1);return/[(|)\\]/.test(r)||""===r?e:e+"\0"}))}},{key:"createJoinersRegExp",value:function(e){var t=[],n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join("["+t.join("")+"]*"):e}},{key:"createDiacriticsRegExp",value:function(e){var t=this.opt.caseSensitive?"":"i",n=this.opt.caseSensitive?["a\xe0\xe1\u1ea3\xe3\u1ea1\u0103\u1eb1\u1eaf\u1eb3\u1eb5\u1eb7\xe2\u1ea7\u1ea5\u1ea9\u1eab\u1ead\xe4\xe5\u0101\u0105","A\xc0\xc1\u1ea2\xc3\u1ea0\u0102\u1eb0\u1eae\u1eb2\u1eb4\u1eb6\xc2\u1ea6\u1ea4\u1ea8\u1eaa\u1eac\xc4\xc5\u0100\u0104","c\xe7\u0107\u010d","C\xc7\u0106\u010c","d\u0111\u010f","D\u0110\u010e","e\xe8\xe9\u1ebb\u1ebd\u1eb9\xea\u1ec1\u1ebf\u1ec3\u1ec5\u1ec7\xeb\u011b\u0113\u0119","E\xc8\xc9\u1eba\u1ebc\u1eb8\xca\u1ec0\u1ebe\u1ec2\u1ec4\u1ec6\xcb\u011a\u0112\u0118","i\xec\xed\u1ec9\u0129\u1ecb\xee\xef\u012b","I\xcc\xcd\u1ec8\u0128\u1eca\xce\xcf\u012a","l\u0142","L\u0141","n\xf1\u0148\u0144","N\xd1\u0147\u0143","o\xf2\xf3\u1ecf\xf5\u1ecd\xf4\u1ed3\u1ed1\u1ed5\u1ed7\u1ed9\u01a1\u1edf\u1ee1\u1edb\u1edd\u1ee3\xf6\xf8\u014d","O\xd2\xd3\u1ece\xd5\u1ecc\xd4\u1ed2\u1ed0\u1ed4\u1ed6\u1ed8\u01a0\u1ede\u1ee0\u1eda\u1edc\u1ee2\xd6\xd8\u014c","r\u0159","R\u0158","s\u0161\u015b\u0219\u015f","S\u0160\u015a\u0218\u015e","t\u0165\u021b\u0163","T\u0164\u021a\u0162","u\xf9\xfa\u1ee7\u0169\u1ee5\u01b0\u1eeb\u1ee9\u1eed\u1eef\u1ef1\xfb\xfc\u016f\u016b","U\xd9\xda\u1ee6\u0168\u1ee4\u01af\u1eea\u1ee8\u1eec\u1eee\u1ef0\xdb\xdc\u016e\u016a","y\xfd\u1ef3\u1ef7\u1ef9\u1ef5\xff","Y\xdd\u1ef2\u1ef6\u1ef8\u1ef4\u0178","z\u017e\u017c\u017a","Z\u017d\u017b\u0179"]:["a\xe0\xe1\u1ea3\xe3\u1ea1\u0103\u1eb1\u1eaf\u1eb3\u1eb5\u1eb7\xe2\u1ea7\u1ea5\u1ea9\u1eab\u1ead\xe4\xe5\u0101\u0105A\xc0\xc1\u1ea2\xc3\u1ea0\u0102\u1eb0\u1eae\u1eb2\u1eb4\u1eb6\xc2\u1ea6\u1ea4\u1ea8\u1eaa\u1eac\xc4\xc5\u0100\u0104","c\xe7\u0107\u010dC\xc7\u0106\u010c","d\u0111\u010fD\u0110\u010e","e\xe8\xe9\u1ebb\u1ebd\u1eb9\xea\u1ec1\u1ebf\u1ec3\u1ec5\u1ec7\xeb\u011b\u0113\u0119E\xc8\xc9\u1eba\u1ebc\u1eb8\xca\u1ec0\u1ebe\u1ec2\u1ec4\u1ec6\xcb\u011a\u0112\u0118","i\xec\xed\u1ec9\u0129\u1ecb\xee\xef\u012bI\xcc\xcd\u1ec8\u0128\u1eca\xce\xcf\u012a","l\u0142L\u0141","n\xf1\u0148\u0144N\xd1\u0147\u0143","o\xf2\xf3\u1ecf\xf5\u1ecd\xf4\u1ed3\u1ed1\u1ed5\u1ed7\u1ed9\u01a1\u1edf\u1ee1\u1edb\u1edd\u1ee3\xf6\xf8\u014dO\xd2\xd3\u1ece\xd5\u1ecc\xd4\u1ed2\u1ed0\u1ed4\u1ed6\u1ed8\u01a0\u1ede\u1ee0\u1eda\u1edc\u1ee2\xd6\xd8\u014c","r\u0159R\u0158","s\u0161\u015b\u0219\u015fS\u0160\u015a\u0218\u015e","t\u0165\u021b\u0163T\u0164\u021a\u0162","u\xf9\xfa\u1ee7\u0169\u1ee5\u01b0\u1eeb\u1ee9\u1eed\u1eef\u1ef1\xfb\xfc\u016f\u016bU\xd9\xda\u1ee6\u0168\u1ee4\u01af\u1eea\u1ee8\u1eec\u1eee\u1ef0\xdb\xdc\u016e\u016a","y\xfd\u1ef3\u1ef7\u1ef9\u1ef5\xffY\xdd\u1ef2\u1ef6\u1ef8\u1ef4\u0178","z\u017e\u017c\u017aZ\u017d\u017b\u0179"],r=[];return e.split("").forEach((function(a){n.every((function(n){if(-1!==n.indexOf(a)){if(r.indexOf(n)>-1)return!1;e=e.replace(new RegExp("["+n+"]","gm"+t),"["+n+"]"),r.push(n)}return!0}))})),e}},{key:"createMergedBlanksRegExp",value:function(e){return e.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(e){var t=this,n="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\xa1\xbf",r=this.opt.accuracy,a="string"==typeof r?r:r.value,o="string"==typeof r?[]:r.limiters,i="";switch(o.forEach((function(e){i+="|"+t.escapeStr(e)})),a){case"partially":default:return"()("+e+")";case"complementary":return"()([^"+(i="\\s"+(i||this.escapeStr(n)))+"]*"+e+"[^"+i+"]*)";case"exactly":return"(^|\\s"+i+")("+e+")(?=$|\\s"+i+")"}}},{key:"getSeparatedKeywords",value:function(e){var t=this,n=[];return e.forEach((function(e){t.opt.separateWordSearch?e.split(" ").forEach((function(e){e.trim()&&-1===n.indexOf(e)&&n.push(e)})):e.trim()&&-1===n.indexOf(e)&&n.push(e)})),{keywords:n.sort((function(e,t){return t.length-e.length})),length:n.length}}},{key:"isNumeric",value:function(e){return Number(parseFloat(e))==e}},{key:"checkRanges",value:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var n=[],r=0;return e.sort((function(e,t){return e.start-t.start})).forEach((function(e){var a=t.callNoMatchOnInvalidRanges(e,r),o=a.start,i=a.end;a.valid&&(e.start=o,e.length=i-o,n.push(e),r=i)})),n}},{key:"callNoMatchOnInvalidRanges",value:function(e,t){var n=void 0,r=void 0,a=!1;return e&&void 0!==e.start?(r=(n=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?a=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(e)),this.opt.noMatch(e))):(this.log("Ignoring invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:n,end:r,valid:a}}},{key:"checkWhitespaceRanges",value:function(e,t,n){var r=void 0,a=!0,o=n.length,i=t-o,l=parseInt(e.start,10)-i;return(r=(l=l>o?o:l)+parseInt(e.length,10))>o&&(r=o,this.log("End range automatically set to the max value of "+o)),l<0||r-l<0||l>o||r>o?(a=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===n.substring(l,r).replace(/\s+/g,"")&&(a=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:l,end:r,valid:a}}},{key:"getTextNodes",value:function(e){var t=this,n="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,(function(e){r.push({start:n.length,end:(n+=e.textContent).length,node:e})}),(function(e){return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),(function(){e({value:n,nodes:r})}))}},{key:"matchesExclude",value:function(e){return a.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(e,t,n){var r=this.opt.element?this.opt.element:"mark",a=e.splitText(t),o=a.splitText(n-t),i=document.createElement(r);return i.setAttribute("data-markjs","true"),this.opt.className&&i.setAttribute("class",this.opt.className),i.textContent=a.textContent,a.parentNode.replaceChild(i,a),o}},{key:"wrapRangeInMappedTextNode",value:function(e,t,n,r,a){var o=this;e.nodes.every((function(i,l){var s=e.nodes[l+1];if(void 0===s||s.start>t){if(!r(i.node))return!1;var c=t-i.start,u=(n>i.end?i.end:n)-i.start,d=e.value.substr(0,i.start),p=e.value.substr(u+i.start);if(i.node=o.wrapRangeInTextNode(i.node,c,u),e.value=d+p,e.nodes.forEach((function(t,n){n>=l&&(e.nodes[n].start>0&&n!==l&&(e.nodes[n].start-=u),e.nodes[n].end-=u)})),n-=u,a(i.node.previousSibling,i.start),!(n>i.end))return!1;t=i.end}return!0}))}},{key:"wrapMatches",value:function(e,t,n,r,a){var o=this,i=0===t?0:t+1;this.getTextNodes((function(t){t.nodes.forEach((function(t){t=t.node;for(var a=void 0;null!==(a=e.exec(t.textContent))&&""!==a[i];)if(n(a[i],t)){var l=a.index;if(0!==i)for(var s=1;s{"use strict";n.r(t)},2295:(e,t,n)=>{"use strict";n.r(t)},4865:function(e,t,n){var r,a;r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
'};function a(e,t,n){return en?n:e}function o(e){return 100*(-1+e)}function i(e,t,n){var a;return(a="translate3d"===r.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+n,a}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=a(e,r.minimum,1),n.status=1===e?null:e;var o=n.render(!t),c=o.querySelector(r.barSelector),u=r.speed,d=r.easing;return o.offsetWidth,l((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(c,i(e,u,d)),1===e?(s(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){s(o,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var a,i=t.querySelector(r.barSelector),l=e?"-100":o(n.status||0),c=document.querySelector(r.parent);return s(i,{transition:"all 0 linear",transform:"translate3d("+l+"%,0,0)"}),r.showSpinner||(a=t.querySelector(r.spinnerSelector))&&f(a),c!=document.body&&u(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var l=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,a=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);a--;)if((r=e[a]+o)in n)return r;return t}function a(e){return e=n(e),t[e]||(t[e]=r(e))}function o(e,t,n){t=a(t),e.style[t]=n}return function(e,t){var n,r,a=arguments;if(2==a.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&o(e,n,r);else o(e,a[1],a[2])}}();function c(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=p(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=p(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(a="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=a)},4779:(e,t,n)=>{var r=n(5826);e.exports=f,e.exports.parse=o,e.exports.compile=function(e,t){return l(o(e,t),t)},e.exports.tokensToFunction=l,e.exports.tokensToRegExp=p;var a=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function o(e,t){for(var n,r=[],o=0,i=0,l="",u=t&&t.delimiter||"/";null!=(n=a.exec(e));){var d=n[0],p=n[1],f=n.index;if(l+=e.slice(i,f),i=f+d.length,p)l+=p[1];else{var m=e[i],h=n[2],g=n[3],b=n[4],y=n[5],v=n[6],w=n[7];l&&(r.push(l),l="");var x=null!=h&&null!=m&&m!==h,k="+"===v||"*"===v,S="?"===v||"*"===v,E=n[2]||u,_=b||y;r.push({name:g||o++,prefix:h||"",delimiter:E,optional:S,repeat:k,partial:x,asterisk:!!w,pattern:_?c(_):w?".*":"[^"+s(E)+"]+?"})}}return i{e.exports&&(e.exports={core:{meta:{path:"components/prism-core.js",option:"mandatory"},core:"Core"},themes:{meta:{path:"themes/{id}.css",link:"index.html?theme={id}",exclusive:!0},prism:{title:"Default",option:"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{title:"Okaidia",owner:"ocodia"},"prism-twilight":{title:"Twilight",owner:"remybach"},"prism-coy":{title:"Coy",owner:"tshedor"},"prism-solarizedlight":{title:"Solarized Light",owner:"hectormatos2011 "},"prism-tomorrow":{title:"Tomorrow Night",owner:"Rosey"}},languages:{meta:{path:"components/prism-{id}",noCSS:!0,examplesPath:"examples/prism-{id}",addCheckAll:!0},markup:{title:"Markup",alias:["html","xml","svg","mathml","ssml","atom","rss"],aliasTitles:{html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",atom:"Atom",rss:"RSS"},option:"default"},css:{title:"CSS",option:"default",modify:"markup"},clike:{title:"C-like",option:"default"},javascript:{title:"JavaScript",require:"clike",modify:"markup",optional:"regex",alias:"js",option:"default"},abap:{title:"ABAP",owner:"dellagustin"},abnf:{title:"ABNF",owner:"RunDevelopment"},actionscript:{title:"ActionScript",require:"javascript",modify:"markup",owner:"Golmote"},ada:{title:"Ada",owner:"Lucretia"},agda:{title:"Agda",owner:"xy-ren"},al:{title:"AL",owner:"RunDevelopment"},antlr4:{title:"ANTLR4",alias:"g4",owner:"RunDevelopment"},apacheconf:{title:"Apache Configuration",owner:"GuiTeK"},apex:{title:"Apex",require:["clike","sql"],owner:"RunDevelopment"},apl:{title:"APL",owner:"ngn"},applescript:{title:"AppleScript",owner:"Golmote"},aql:{title:"AQL",owner:"RunDevelopment"},arduino:{title:"Arduino",require:"cpp",alias:"ino",owner:"dkern"},arff:{title:"ARFF",owner:"Golmote"},armasm:{title:"ARM Assembly",alias:"arm-asm",owner:"RunDevelopment"},arturo:{title:"Arturo",alias:"art",optional:["bash","css","javascript","markup","markdown","sql"],owner:"drkameleon"},asciidoc:{alias:"adoc",title:"AsciiDoc",owner:"Golmote"},aspnet:{title:"ASP.NET (C#)",require:["markup","csharp"],owner:"nauzilus"},asm6502:{title:"6502 Assembly",owner:"kzurawel"},asmatmel:{title:"Atmel AVR Assembly",owner:"cerkit"},autohotkey:{title:"AutoHotkey",owner:"aviaryan"},autoit:{title:"AutoIt",owner:"Golmote"},avisynth:{title:"AviSynth",alias:"avs",owner:"Zinfidel"},"avro-idl":{title:"Avro IDL",alias:"avdl",owner:"RunDevelopment"},awk:{title:"AWK",alias:"gawk",aliasTitles:{gawk:"GAWK"},owner:"RunDevelopment"},bash:{title:"Bash",alias:["sh","shell"],aliasTitles:{sh:"Shell",shell:"Shell"},owner:"zeitgeist87"},basic:{title:"BASIC",owner:"Golmote"},batch:{title:"Batch",owner:"Golmote"},bbcode:{title:"BBcode",alias:"shortcode",aliasTitles:{shortcode:"Shortcode"},owner:"RunDevelopment"},bbj:{title:"BBj",owner:"hyyan"},bicep:{title:"Bicep",owner:"johnnyreilly"},birb:{title:"Birb",require:"clike",owner:"Calamity210"},bison:{title:"Bison",require:"c",owner:"Golmote"},bnf:{title:"BNF",alias:"rbnf",aliasTitles:{rbnf:"RBNF"},owner:"RunDevelopment"},bqn:{title:"BQN",owner:"yewscion"},brainfuck:{title:"Brainfuck",owner:"Golmote"},brightscript:{title:"BrightScript",owner:"RunDevelopment"},bro:{title:"Bro",owner:"wayward710"},bsl:{title:"BSL (1C:Enterprise)",alias:"oscript",aliasTitles:{oscript:"OneScript"},owner:"Diversus23"},c:{title:"C",require:"clike",owner:"zeitgeist87"},csharp:{title:"C#",require:"clike",alias:["cs","dotnet"],owner:"mvalipour"},cpp:{title:"C++",require:"c",owner:"zeitgeist87"},cfscript:{title:"CFScript",require:"clike",alias:"cfc",owner:"mjclemente"},chaiscript:{title:"ChaiScript",require:["clike","cpp"],owner:"RunDevelopment"},cil:{title:"CIL",owner:"sbrl"},cilkc:{title:"Cilk/C",require:"c",alias:"cilk-c",owner:"OpenCilk"},cilkcpp:{title:"Cilk/C++",require:"cpp",alias:["cilk-cpp","cilk"],owner:"OpenCilk"},clojure:{title:"Clojure",owner:"troglotit"},cmake:{title:"CMake",owner:"mjrogozinski"},cobol:{title:"COBOL",owner:"RunDevelopment"},coffeescript:{title:"CoffeeScript",require:"javascript",alias:"coffee",owner:"R-osey"},concurnas:{title:"Concurnas",alias:"conc",owner:"jasontatton"},csp:{title:"Content-Security-Policy",owner:"ScottHelme"},cooklang:{title:"Cooklang",owner:"ahue"},coq:{title:"Coq",owner:"RunDevelopment"},crystal:{title:"Crystal",require:"ruby",owner:"MakeNowJust"},"css-extras":{title:"CSS Extras",require:"css",modify:"css",owner:"milesj"},csv:{title:"CSV",owner:"RunDevelopment"},cue:{title:"CUE",owner:"RunDevelopment"},cypher:{title:"Cypher",owner:"RunDevelopment"},d:{title:"D",require:"clike",owner:"Golmote"},dart:{title:"Dart",require:"clike",owner:"Golmote"},dataweave:{title:"DataWeave",owner:"machaval"},dax:{title:"DAX",owner:"peterbud"},dhall:{title:"Dhall",owner:"RunDevelopment"},diff:{title:"Diff",owner:"uranusjr"},django:{title:"Django/Jinja2",require:"markup-templating",alias:"jinja2",owner:"romanvm"},"dns-zone-file":{title:"DNS zone file",owner:"RunDevelopment",alias:"dns-zone"},docker:{title:"Docker",alias:"dockerfile",owner:"JustinBeckwith"},dot:{title:"DOT (Graphviz)",alias:"gv",optional:"markup",owner:"RunDevelopment"},ebnf:{title:"EBNF",owner:"RunDevelopment"},editorconfig:{title:"EditorConfig",owner:"osipxd"},eiffel:{title:"Eiffel",owner:"Conaclos"},ejs:{title:"EJS",require:["javascript","markup-templating"],owner:"RunDevelopment",alias:"eta",aliasTitles:{eta:"Eta"}},elixir:{title:"Elixir",owner:"Golmote"},elm:{title:"Elm",owner:"zwilias"},etlua:{title:"Embedded Lua templating",require:["lua","markup-templating"],owner:"RunDevelopment"},erb:{title:"ERB",require:["ruby","markup-templating"],owner:"Golmote"},erlang:{title:"Erlang",owner:"Golmote"},"excel-formula":{title:"Excel Formula",alias:["xlsx","xls"],owner:"RunDevelopment"},fsharp:{title:"F#",require:"clike",owner:"simonreynolds7"},factor:{title:"Factor",owner:"catb0t"},false:{title:"False",owner:"edukisto"},"firestore-security-rules":{title:"Firestore security rules",require:"clike",owner:"RunDevelopment"},flow:{title:"Flow",require:"javascript",owner:"Golmote"},fortran:{title:"Fortran",owner:"Golmote"},ftl:{title:"FreeMarker Template Language",require:"markup-templating",owner:"RunDevelopment"},gml:{title:"GameMaker Language",alias:"gamemakerlanguage",require:"clike",owner:"LiarOnce"},gap:{title:"GAP (CAS)",owner:"RunDevelopment"},gcode:{title:"G-code",owner:"RunDevelopment"},gdscript:{title:"GDScript",owner:"RunDevelopment"},gedcom:{title:"GEDCOM",owner:"Golmote"},gettext:{title:"gettext",alias:"po",owner:"RunDevelopment"},gherkin:{title:"Gherkin",owner:"hason"},git:{title:"Git",owner:"lgiraudel"},glsl:{title:"GLSL",require:"c",owner:"Golmote"},gn:{title:"GN",alias:"gni",owner:"RunDevelopment"},"linker-script":{title:"GNU Linker Script",alias:"ld",owner:"RunDevelopment"},go:{title:"Go",require:"clike",owner:"arnehormann"},"go-module":{title:"Go module",alias:"go-mod",owner:"RunDevelopment"},gradle:{title:"Gradle",require:"clike",owner:"zeabdelkhalek-badido18"},graphql:{title:"GraphQL",optional:"markdown",owner:"Golmote"},groovy:{title:"Groovy",require:"clike",owner:"robfletcher"},haml:{title:"Haml",require:"ruby",optional:["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],owner:"Golmote"},handlebars:{title:"Handlebars",require:"markup-templating",alias:["hbs","mustache"],aliasTitles:{mustache:"Mustache"},owner:"Golmote"},haskell:{title:"Haskell",alias:"hs",owner:"bholst"},haxe:{title:"Haxe",require:"clike",optional:"regex",owner:"Golmote"},hcl:{title:"HCL",owner:"outsideris"},hlsl:{title:"HLSL",require:"c",owner:"RunDevelopment"},hoon:{title:"Hoon",owner:"matildepark"},http:{title:"HTTP",optional:["csp","css","hpkp","hsts","javascript","json","markup","uri"],owner:"danielgtaylor"},hpkp:{title:"HTTP Public-Key-Pins",owner:"ScottHelme"},hsts:{title:"HTTP Strict-Transport-Security",owner:"ScottHelme"},ichigojam:{title:"IchigoJam",owner:"BlueCocoa"},icon:{title:"Icon",owner:"Golmote"},"icu-message-format":{title:"ICU Message Format",owner:"RunDevelopment"},idris:{title:"Idris",alias:"idr",owner:"KeenS",require:"haskell"},ignore:{title:".ignore",owner:"osipxd",alias:["gitignore","hgignore","npmignore"],aliasTitles:{gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore"}},inform7:{title:"Inform 7",owner:"Golmote"},ini:{title:"Ini",owner:"aviaryan"},io:{title:"Io",owner:"AlesTsurko"},j:{title:"J",owner:"Golmote"},java:{title:"Java",require:"clike",owner:"sherblot"},javadoc:{title:"JavaDoc",require:["markup","java","javadoclike"],modify:"java",optional:"scala",owner:"RunDevelopment"},javadoclike:{title:"JavaDoc-like",modify:["java","javascript","php"],owner:"RunDevelopment"},javastacktrace:{title:"Java stack trace",owner:"RunDevelopment"},jexl:{title:"Jexl",owner:"czosel"},jolie:{title:"Jolie",require:"clike",owner:"thesave"},jq:{title:"JQ",owner:"RunDevelopment"},jsdoc:{title:"JSDoc",require:["javascript","javadoclike","typescript"],modify:"javascript",optional:["actionscript","coffeescript"],owner:"RunDevelopment"},"js-extras":{title:"JS Extras",require:"javascript",modify:"javascript",optional:["actionscript","coffeescript","flow","n4js","typescript"],owner:"RunDevelopment"},json:{title:"JSON",alias:"webmanifest",aliasTitles:{webmanifest:"Web App Manifest"},owner:"CupOfTea696"},json5:{title:"JSON5",require:"json",owner:"RunDevelopment"},jsonp:{title:"JSONP",require:"json",owner:"RunDevelopment"},jsstacktrace:{title:"JS stack trace",owner:"sbrl"},"js-templates":{title:"JS Templates",require:"javascript",modify:"javascript",optional:["css","css-extras","graphql","markdown","markup","sql"],owner:"RunDevelopment"},julia:{title:"Julia",owner:"cdagnino"},keepalived:{title:"Keepalived Configure",owner:"dev-itsheng"},keyman:{title:"Keyman",owner:"mcdurdin"},kotlin:{title:"Kotlin",alias:["kt","kts"],aliasTitles:{kts:"Kotlin Script"},require:"clike",owner:"Golmote"},kumir:{title:"KuMir (\u041a\u0443\u041c\u0438\u0440)",alias:"kum",owner:"edukisto"},kusto:{title:"Kusto",owner:"RunDevelopment"},latex:{title:"LaTeX",alias:["tex","context"],aliasTitles:{tex:"TeX",context:"ConTeXt"},owner:"japborst"},latte:{title:"Latte",require:["clike","markup-templating","php"],owner:"nette"},less:{title:"Less",require:"css",optional:"css-extras",owner:"Golmote"},lilypond:{title:"LilyPond",require:"scheme",alias:"ly",owner:"RunDevelopment"},liquid:{title:"Liquid",require:"markup-templating",owner:"cinhtau"},lisp:{title:"Lisp",alias:["emacs","elisp","emacs-lisp"],owner:"JuanCaicedo"},livescript:{title:"LiveScript",owner:"Golmote"},llvm:{title:"LLVM IR",owner:"porglezomp"},log:{title:"Log file",optional:"javastacktrace",owner:"RunDevelopment"},lolcode:{title:"LOLCODE",owner:"Golmote"},lua:{title:"Lua",owner:"Golmote"},magma:{title:"Magma (CAS)",owner:"RunDevelopment"},makefile:{title:"Makefile",owner:"Golmote"},markdown:{title:"Markdown",require:"markup",optional:"yaml",alias:"md",owner:"Golmote"},"markup-templating":{title:"Markup templating",require:"markup",owner:"Golmote"},mata:{title:"Mata",owner:"RunDevelopment"},matlab:{title:"MATLAB",owner:"Golmote"},maxscript:{title:"MAXScript",owner:"RunDevelopment"},mel:{title:"MEL",owner:"Golmote"},mermaid:{title:"Mermaid",owner:"RunDevelopment"},metafont:{title:"METAFONT",owner:"LaeriExNihilo"},mizar:{title:"Mizar",owner:"Golmote"},mongodb:{title:"MongoDB",owner:"airs0urce",require:"javascript"},monkey:{title:"Monkey",owner:"Golmote"},moonscript:{title:"MoonScript",alias:"moon",owner:"RunDevelopment"},n1ql:{title:"N1QL",owner:"TMWilds"},n4js:{title:"N4JS",require:"javascript",optional:"jsdoc",alias:"n4jsd",owner:"bsmith-n4"},"nand2tetris-hdl":{title:"Nand To Tetris HDL",owner:"stephanmax"},naniscript:{title:"Naninovel Script",owner:"Elringus",alias:"nani"},nasm:{title:"NASM",owner:"rbmj"},neon:{title:"NEON",owner:"nette"},nevod:{title:"Nevod",owner:"nezaboodka"},nginx:{title:"nginx",owner:"volado"},nim:{title:"Nim",owner:"Golmote"},nix:{title:"Nix",owner:"Golmote"},nsis:{title:"NSIS",owner:"idleberg"},objectivec:{title:"Objective-C",require:"c",alias:"objc",owner:"uranusjr"},ocaml:{title:"OCaml",owner:"Golmote"},odin:{title:"Odin",owner:"edukisto"},opencl:{title:"OpenCL",require:"c",modify:["c","cpp"],owner:"Milania1"},openqasm:{title:"OpenQasm",alias:"qasm",owner:"RunDevelopment"},oz:{title:"Oz",owner:"Golmote"},parigp:{title:"PARI/GP",owner:"Golmote"},parser:{title:"Parser",require:"markup",owner:"Golmote"},pascal:{title:"Pascal",alias:"objectpascal",aliasTitles:{objectpascal:"Object Pascal"},owner:"Golmote"},pascaligo:{title:"Pascaligo",owner:"DefinitelyNotAGoat"},psl:{title:"PATROL Scripting Language",owner:"bertysentry"},pcaxis:{title:"PC-Axis",alias:"px",owner:"RunDevelopment"},peoplecode:{title:"PeopleCode",alias:"pcode",owner:"RunDevelopment"},perl:{title:"Perl",owner:"Golmote"},php:{title:"PHP",require:"markup-templating",owner:"milesj"},phpdoc:{title:"PHPDoc",require:["php","javadoclike"],modify:"php",owner:"RunDevelopment"},"php-extras":{title:"PHP Extras",require:"php",modify:"php",owner:"milesj"},"plant-uml":{title:"PlantUML",alias:"plantuml",owner:"RunDevelopment"},plsql:{title:"PL/SQL",require:"sql",owner:"Golmote"},powerquery:{title:"PowerQuery",alias:["pq","mscript"],owner:"peterbud"},powershell:{title:"PowerShell",owner:"nauzilus"},processing:{title:"Processing",require:"clike",owner:"Golmote"},prolog:{title:"Prolog",owner:"Golmote"},promql:{title:"PromQL",owner:"arendjr"},properties:{title:".properties",owner:"Golmote"},protobuf:{title:"Protocol Buffers",require:"clike",owner:"just-boris"},pug:{title:"Pug",require:["markup","javascript"],optional:["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],owner:"Golmote"},puppet:{title:"Puppet",owner:"Golmote"},pure:{title:"Pure",optional:["c","cpp","fortran"],owner:"Golmote"},purebasic:{title:"PureBasic",require:"clike",alias:"pbfasm",owner:"HeX0R101"},purescript:{title:"PureScript",require:"haskell",alias:"purs",owner:"sriharshachilakapati"},python:{title:"Python",alias:"py",owner:"multipetros"},qsharp:{title:"Q#",require:"clike",alias:"qs",owner:"fedonman"},q:{title:"Q (kdb+ database)",owner:"Golmote"},qml:{title:"QML",require:"javascript",owner:"RunDevelopment"},qore:{title:"Qore",require:"clike",owner:"temnroegg"},r:{title:"R",owner:"Golmote"},racket:{title:"Racket",require:"scheme",alias:"rkt",owner:"RunDevelopment"},cshtml:{title:"Razor C#",alias:"razor",require:["markup","csharp"],optional:["css","css-extras","javascript","js-extras"],owner:"RunDevelopment"},jsx:{title:"React JSX",require:["markup","javascript"],optional:["jsdoc","js-extras","js-templates"],owner:"vkbansal"},tsx:{title:"React TSX",require:["jsx","typescript"]},reason:{title:"Reason",require:"clike",owner:"Golmote"},regex:{title:"Regex",owner:"RunDevelopment"},rego:{title:"Rego",owner:"JordanSh"},renpy:{title:"Ren'py",alias:"rpy",owner:"HyuchiaDiego"},rescript:{title:"ReScript",alias:"res",owner:"vmarcosp"},rest:{title:"reST (reStructuredText)",owner:"Golmote"},rip:{title:"Rip",owner:"ravinggenius"},roboconf:{title:"Roboconf",owner:"Golmote"},robotframework:{title:"Robot Framework",alias:"robot",owner:"RunDevelopment"},ruby:{title:"Ruby",require:"clike",alias:"rb",owner:"samflores"},rust:{title:"Rust",owner:"Golmote"},sas:{title:"SAS",optional:["groovy","lua","sql"],owner:"Golmote"},sass:{title:"Sass (Sass)",require:"css",optional:"css-extras",owner:"Golmote"},scss:{title:"Sass (SCSS)",require:"css",optional:"css-extras",owner:"MoOx"},scala:{title:"Scala",require:"java",owner:"jozic"},scheme:{title:"Scheme",owner:"bacchus123"},"shell-session":{title:"Shell session",require:"bash",alias:["sh-session","shellsession"],owner:"RunDevelopment"},smali:{title:"Smali",owner:"RunDevelopment"},smalltalk:{title:"Smalltalk",owner:"Golmote"},smarty:{title:"Smarty",require:"markup-templating",optional:"php",owner:"Golmote"},sml:{title:"SML",alias:"smlnj",aliasTitles:{smlnj:"SML/NJ"},owner:"RunDevelopment"},solidity:{title:"Solidity (Ethereum)",alias:"sol",require:"clike",owner:"glachaud"},"solution-file":{title:"Solution file",alias:"sln",owner:"RunDevelopment"},soy:{title:"Soy (Closure Template)",require:"markup-templating",owner:"Golmote"},sparql:{title:"SPARQL",require:"turtle",owner:"Triply-Dev",alias:"rq"},"splunk-spl":{title:"Splunk SPL",owner:"RunDevelopment"},sqf:{title:"SQF: Status Quo Function (Arma 3)",require:"clike",owner:"RunDevelopment"},sql:{title:"SQL",owner:"multipetros"},squirrel:{title:"Squirrel",require:"clike",owner:"RunDevelopment"},stan:{title:"Stan",owner:"RunDevelopment"},stata:{title:"Stata Ado",require:["mata","java","python"],owner:"RunDevelopment"},iecst:{title:"Structured Text (IEC 61131-3)",owner:"serhioromano"},stylus:{title:"Stylus",owner:"vkbansal"},supercollider:{title:"SuperCollider",alias:"sclang",owner:"RunDevelopment"},swift:{title:"Swift",owner:"chrischares"},systemd:{title:"Systemd configuration file",owner:"RunDevelopment"},"t4-templating":{title:"T4 templating",owner:"RunDevelopment"},"t4-cs":{title:"T4 Text Templates (C#)",require:["t4-templating","csharp"],alias:"t4",owner:"RunDevelopment"},"t4-vb":{title:"T4 Text Templates (VB)",require:["t4-templating","vbnet"],owner:"RunDevelopment"},tap:{title:"TAP",owner:"isaacs",require:"yaml"},tcl:{title:"Tcl",owner:"PeterChaplin"},tt2:{title:"Template Toolkit 2",require:["clike","markup-templating"],owner:"gflohr"},textile:{title:"Textile",require:"markup",optional:"css",owner:"Golmote"},toml:{title:"TOML",owner:"RunDevelopment"},tremor:{title:"Tremor",alias:["trickle","troy"],owner:"darach",aliasTitles:{trickle:"trickle",troy:"troy"}},turtle:{title:"Turtle",alias:"trig",aliasTitles:{trig:"TriG"},owner:"jakubklimek"},twig:{title:"Twig",require:"markup-templating",owner:"brandonkelly"},typescript:{title:"TypeScript",require:"javascript",optional:"js-templates",alias:"ts",owner:"vkbansal"},typoscript:{title:"TypoScript",alias:"tsconfig",aliasTitles:{tsconfig:"TSConfig"},owner:"dkern"},unrealscript:{title:"UnrealScript",alias:["uscript","uc"],owner:"RunDevelopment"},uorazor:{title:"UO Razor Script",owner:"jaseowns"},uri:{title:"URI",alias:"url",aliasTitles:{url:"URL"},owner:"RunDevelopment"},v:{title:"V",require:"clike",owner:"taggon"},vala:{title:"Vala",require:"clike",optional:"regex",owner:"TemplarVolk"},vbnet:{title:"VB.Net",require:"basic",owner:"Bigsby"},velocity:{title:"Velocity",require:"markup",owner:"Golmote"},verilog:{title:"Verilog",owner:"a-rey"},vhdl:{title:"VHDL",owner:"a-rey"},vim:{title:"vim",owner:"westonganger"},"visual-basic":{title:"Visual Basic",alias:["vb","vba"],aliasTitles:{vba:"VBA"},owner:"Golmote"},warpscript:{title:"WarpScript",owner:"RunDevelopment"},wasm:{title:"WebAssembly",owner:"Golmote"},"web-idl":{title:"Web IDL",alias:"webidl",owner:"RunDevelopment"},wgsl:{title:"WGSL",owner:"Dr4gonthree"},wiki:{title:"Wiki markup",require:"markup",owner:"Golmote"},wolfram:{title:"Wolfram language",alias:["mathematica","nb","wl"],aliasTitles:{mathematica:"Mathematica",nb:"Mathematica Notebook"},owner:"msollami"},wren:{title:"Wren",owner:"clsource"},xeora:{title:"Xeora",require:"markup",alias:"xeoracube",aliasTitles:{xeoracube:"XeoraCube"},owner:"freakmaxi"},"xml-doc":{title:"XML doc (.net)",require:"markup",modify:["csharp","fsharp","vbnet"],owner:"RunDevelopment"},xojo:{title:"Xojo (REALbasic)",owner:"Golmote"},xquery:{title:"XQuery",require:"markup",owner:"Golmote"},yaml:{title:"YAML",alias:"yml",owner:"hason"},yang:{title:"YANG",owner:"RunDevelopment"},zig:{title:"Zig",owner:"RunDevelopment"}},plugins:{meta:{path:"plugins/{id}/prism-{id}",link:"plugins/{id}/"},"line-highlight":{title:"Line Highlight",description:"Highlights specific lines and/or line ranges."},"line-numbers":{title:"Line Numbers",description:"Line number at the beginning of code lines.",owner:"kuba-kubula"},"show-invisibles":{title:"Show Invisibles",description:"Show hidden characters such as tabs and line breaks.",optional:["autolinker","data-uri-highlight"]},autolinker:{title:"Autolinker",description:"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},wpd:{title:"WebPlatform Docs",description:'Makes tokens link to WebPlatform.org documentation. The links open in a new tab.'},"custom-class":{title:"Custom Class",description:"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.",owner:"dvkndn",noCSS:!0},"file-highlight":{title:"File Highlight",description:"Fetch external files and highlight them with Prism. Used on the Prism website itself.",noCSS:!0},"show-language":{title:"Show Language",description:"Display the highlighted language in code blocks (inline code does not show the label).",owner:"nauzilus",noCSS:!0,require:"toolbar"},"jsonp-highlight":{title:"JSONP Highlight",description:"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).",noCSS:!0,owner:"nauzilus"},"highlight-keywords":{title:"Highlight Keywords",description:"Adds special CSS classes for each keyword for fine-grained highlighting.",owner:"vkbansal",noCSS:!0},"remove-initial-line-feed":{title:"Remove initial line feed",description:"Removes the initial line feed in code blocks.",owner:"Golmote",noCSS:!0},"inline-color":{title:"Inline color",description:"Adds a small inline preview for colors in style sheets.",require:"css-extras",owner:"RunDevelopment"},previewers:{title:"Previewers",description:"Previewers for angles, colors, gradients, easing and time.",require:"css-extras",owner:"Golmote"},autoloader:{title:"Autoloader",description:"Automatically loads the needed languages to highlight the code blocks.",owner:"Golmote",noCSS:!0},"keep-markup":{title:"Keep Markup",description:"Prevents custom markup from being dropped out during highlighting.",owner:"Golmote",optional:"normalize-whitespace",noCSS:!0},"command-line":{title:"Command Line",description:"Display a command line with a prompt and, optionally, the output/response from the commands.",owner:"chriswells0"},"unescaped-markup":{title:"Unescaped Markup",description:"Write markup without having to escape anything."},"normalize-whitespace":{title:"Normalize Whitespace",description:"Supports multiple operations to normalize whitespace in code blocks.",owner:"zeitgeist87",optional:"unescaped-markup",noCSS:!0},"data-uri-highlight":{title:"Data-URI Highlight",description:"Highlights data-URI contents.",owner:"Golmote",noCSS:!0},toolbar:{title:"Toolbar",description:"Attach a toolbar for plugins to easily register buttons on the top of a code block.",owner:"mAAdhaTTah"},"copy-to-clipboard":{title:"Copy to Clipboard Button",description:"Add a button that copies the code block to the clipboard when clicked.",owner:"mAAdhaTTah",require:"toolbar",noCSS:!0},"download-button":{title:"Download Button",description:"A button in the toolbar of a code block adding a convenient way to download a code file.",owner:"Golmote",require:"toolbar",noCSS:!0},"match-braces":{title:"Match braces",description:"Highlights matching braces.",owner:"RunDevelopment"},"diff-highlight":{title:"Diff Highlight",description:"Highlights the code inside diff blocks.",owner:"RunDevelopment",require:"diff"},"filter-highlight-all":{title:"Filter highlightAll",description:"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.",owner:"RunDevelopment",noCSS:!0},treeview:{title:"Treeview",description:"A language with special styles to highlight file system tree structures.",owner:"Golmote"}}})},2885:(e,t,n)=>{const r=n(9901),a=n(9642),o=new Set;function i(e){void 0===e?e=Object.keys(r.languages).filter((e=>"meta"!=e)):Array.isArray(e)||(e=[e]);const t=[...o,...Object.keys(Prism.languages)];a(r,e,t).load((e=>{if(!(e in r.languages))return void(i.silent||console.warn("Language does not exist: "+e));const t="./prism-"+e;delete n.c[n(6500).resolve(t)],delete Prism.languages[e],n(6500)(t),o.add(e)}))}i.silent=!1,e.exports=i},6854:()=>{!function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,a,o){if(n.language===r){var i=n.tokenStack=[];n.code=n.code.replace(a,(function(e){if("function"==typeof o&&!o(e))return e;for(var a,l=i.length;-1!==n.code.indexOf(a=t(r,l));)++l;return i[l]=e,a})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var a=0,o=Object.keys(n.tokenStack);!function i(l){for(var s=0;s=o.length);s++){var c=l[s];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[a],d=n.tokenStack[u],p="string"==typeof c?c:c.content,f=t(r,u),m=p.indexOf(f);if(m>-1){++a;var h=p.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=p.substring(m+f.length),y=[];h&&y.push.apply(y,i([h])),y.push(g),b&&y.push.apply(y,i([b])),"string"==typeof c?l.splice.apply(l,[s,1].concat(y)):c.content=y}}else c.content&&i(c.content)}return l}(n.tokens)}}}})}(Prism)},6726:(e,t,n)=>{var r={"./":2885};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=6726},6500:(e,t,n)=>{var r={"./":2885};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=6500},9642:e=>{"use strict";var t=function(){var e=function(){};function t(e,t){Array.isArray(e)?e.forEach(t):null!=e&&t(e,0)}function n(e){for(var t={},n=0,r=e.length;n "));var l={},s=e[r];if(s){function c(t){if(!(t in e))throw new Error(r+" depends on an unknown component "+t);if(!(t in l))for(var i in a(t,o),l[t]=!0,n[t])l[i]=!0}t(s.require,c),t(s.optional,c),t(s.modify,c)}n[r]=l,o.pop()}}return function(e){var t=n[e];return t||(a(e,r),t=n[e]),t}}function a(e){for(var t in e)return!0;return!1}return function(o,i,l){var s=function(e){var t={};for(var n in e){var r=e[n];for(var a in r)if("meta"!=a){var o=r[a];t[a]="string"==typeof o?{title:o}:o}}return t}(o),c=function(e){var n;return function(r){if(r in e)return r;if(!n)for(var a in n={},e){var o=e[a];t(o&&o.alias,(function(t){if(t in n)throw new Error(t+" cannot be alias for both "+a+" and "+n[t]);if(t in e)throw new Error(t+" cannot be alias of "+a+" because it is a component.");n[t]=a}))}return n[r]||r}}(s);i=i.map(c),l=(l||[]).map(c);var u=n(i),d=n(l);i.forEach((function e(n){var r=s[n];t(r&&r.require,(function(t){t in d||(u[t]=!0,e(t))}))}));for(var p,f=r(s),m=u;a(m);){for(var h in p={},m){var g=s[h];t(g&&g.modify,(function(e){e in d&&(p[e]=!0)}))}for(var b in d)if(!(b in u))for(var y in f(b))if(y in u){p[b]=!0;break}for(var v in m=p)u[v]=!0}var w={getIds:function(){var e=[];return w.load((function(t){e.push(t)})),e},load:function(t,n){return function(t,n,r,a){var o=a?a.series:void 0,i=a?a.parallel:e,l={},s={};function c(e){if(e in l)return l[e];s[e]=!0;var a,u=[];for(var d in t(e))d in n&&u.push(d);if(0===u.length)a=r(e);else{var p=i(u.map((function(e){var t=c(e);return delete s[e],t})));o?a=o(p,(function(){return r(e)})):r(e)}return l[e]=a}for(var u in n)c(u);var d=[];for(var p in s)d.push(l[p]);return i(d)}(f,u,t,n)}};return w}}();e.exports=t},2703:(e,t,n)=>{"use strict";var r=n(414);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:a};return n.PropTypes=n,n}},5697:(e,t,n)=>{e.exports=n(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4448:(e,t,n)=>{"use strict";var r=n(7294),a=n(3840);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n