From b3c503d7c3ff6d6c1c2ca4e3b1714ed68fe3c391 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 15:17:01 +0000 Subject: [PATCH] 15.31.1 --- CHANGELOG.md | 5 ++++- dist/cjs/hooks.js | 1 + dist/cjs/hooks.js.map | 2 +- dist/cjs/plugins/attachments/index.js.map | 2 +- dist/cjs/plugins/cleanup/cleanup.js | 5 +++++ dist/cjs/plugins/cleanup/cleanup.js.map | 2 +- dist/cjs/plugins/dev-mode/dev-mode-tracking.js | 13 ++++--------- dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map | 2 +- dist/cjs/plugins/utils/utils-rxdb-version.js | 2 +- dist/cjs/plugins/utils/utils-rxdb-version.js.map | 2 +- dist/cjs/types/rx-plugin.d.js.map | 2 +- dist/esm/hooks.js | 1 + dist/esm/hooks.js.map | 2 +- dist/esm/plugins/attachments/index.js.map | 2 +- dist/esm/plugins/cleanup/cleanup.js | 5 +++++ dist/esm/plugins/cleanup/cleanup.js.map | 2 +- dist/esm/plugins/dev-mode/dev-mode-tracking.js | 13 ++++--------- dist/esm/plugins/dev-mode/dev-mode-tracking.js.map | 2 +- dist/esm/plugins/utils/utils-rxdb-version.js | 2 +- dist/esm/plugins/utils/utils-rxdb-version.js.map | 2 +- dist/esm/types/rx-plugin.d.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/utils/utils-rxdb-version.d.ts | 2 +- dist/types/rx-database.d.ts | 2 +- dist/types/types/rx-plugin.d.ts | 4 ++++ 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 ++-- .../index.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 ++-- .../websockets-sse-polling-webrtc-webtransport.html | 4 ++-- docs/assets/js/8bc82b1f.54c00f42.js | 1 + docs/assets/js/8bc82b1f.cacf983d.js | 1 - docs/assets/js/main.563bd506.js | 2 ++ ....js.LICENSE.txt => main.563bd506.js.LICENSE.txt} | 0 docs/assets/js/main.7c6ff896.js | 2 -- ...me~main.56fb815e.js => runtime~main.f1f634a3.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/consulting/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/errors.html | 4 ++-- docs/index.html | 4 ++-- docs/install.html | 4 ++-- docs/js/analytics.js | 6 +++--- docs/key-compression.html | 4 ++-- docs/leader-election.html | 4 ++-- docs/legal-notice/index.html | 4 ++-- docs/license/index.html | 4 ++-- docs/logger.html | 4 ++-- docs/lunr-index-1723666141762.json | 1 - docs/lunr-index-1724080561176.json | 1 + docs/lunr-index.json | 2 +- docs/markdown-page/index.html | 4 ++-- docs/meeting-paid/index.html | 4 ++-- docs/meeting/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-submitted/index.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/reactivity.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 | 4 ++-- 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-pipeline.html | 7 ++++--- docs/rx-query.html | 4 ++-- docs/rx-schema.html | 4 ++-- docs/rx-server-scaling.html | 4 ++-- docs/rx-server.html | 4 ++-- docs/rx-state.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-mapped.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 | 4 ++-- docs/rx-storage-sqlite.html | 4 ++-- docs/rx-storage-worker.html | 4 ++-- docs/rx-storage.html | 4 ++-- docs/rxdb-tradeoffs.html | 4 ++-- docs/schema-validation.html | 4 ++-- docs/search-doc-1723666141762.json | 1 - docs/search-doc-1724080561176.json | 1 + docs/search-doc.json | 2 +- docs/sem/browser-database/index.html | 4 ++-- docs/sem/electron-database/index.html | 4 ++-- docs/sem/firestore-alternative/index.html | 4 ++-- docs/sem/indexeddb-database/index.html | 4 ++-- docs/sem/localstorage-database/index.html | 4 ++-- docs/sem/nedb-alternative/index.html | 4 ++-- docs/sem/nodejs-database/index.html | 4 ++-- docs/sem/nosql-database/index.html | 4 ++-- docs/sem/pouchdb-alternative/index.html | 4 ++-- docs/sem/react-native-database/index.html | 4 ++-- docs/sem/watermelondb-alternative/index.html | 4 ++-- docs/service-submitted/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 +- 176 files changed, 328 insertions(+), 318 deletions(-) create mode 100644 docs/assets/js/8bc82b1f.54c00f42.js delete mode 100644 docs/assets/js/8bc82b1f.cacf983d.js create mode 100644 docs/assets/js/main.563bd506.js rename docs/assets/js/{main.7c6ff896.js.LICENSE.txt => main.563bd506.js.LICENSE.txt} (100%) delete mode 100644 docs/assets/js/main.7c6ff896.js rename docs/assets/js/{runtime~main.56fb815e.js => runtime~main.f1f634a3.js} (99%) delete mode 100644 docs/lunr-index-1723666141762.json create mode 100644 docs/lunr-index-1724080561176.json delete mode 100644 docs/search-doc-1723666141762.json create mode 100644 docs/search-doc-1724080561176.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c19f152a84..01bd9499167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ # RxDB Changelog -- ADD `postCleanup` hook. @@ -10,6 +9,10 @@ +### 15.31.1 (19 August 2024) + +- ADD `postCleanup` hook. + ### 15.31.0 (14 August 2024) - ADD [RxPipeline Plugin](https://rxdb.info/rx-pipeline.html). diff --git a/dist/cjs/hooks.js b/dist/cjs/hooks.js index aac429d3ae0..b3b4b0b228c 100644 --- a/dist/cjs/hooks.js +++ b/dist/cjs/hooks.js @@ -90,6 +90,7 @@ var HOOKS = exports.HOOKS = { * @async */ postRemoveRxDatabase: [], + postCleanup: [], /** * runs before the replication writes the rows to master * but before the rows have been modified diff --git a/dist/cjs/hooks.js.map b/dist/cjs/hooks.js.map index 28c3e53131d..811b33098b7 100644 --- a/dist/cjs/hooks.js.map +++ b/dist/cjs/hooks.js.map @@ -1 +1 @@ -{"version":3,"file":"hooks.js","names":["HOOKS","exports","preAddRxPlugin","preCreateRxDatabase","createRxDatabase","preCreateRxCollection","createRxCollection","createRxState","postDestroyRxCollection","postRemoveRxCollection","preCreateRxSchema","createRxSchema","preCreateRxQuery","prePrepareQuery","createRxDocument","postCreateRxDocument","preCreateRxStorageInstance","preStorageWrite","preMigrateDocument","postMigrateDocument","preDestroyRxDatabase","postRemoveRxDatabase","preReplicationMasterWrite","preReplicationMasterWriteDocumentsHandle","runPluginHooks","hookKey","obj","length","forEach","fun","runAsyncPluginHooks","Promise","all","map","_clearHook","type","filter","h"],"sources":["../../src/hooks.ts"],"sourcesContent":["\n/**\n * hook-functions that can be extended by the plugin\n */\nexport const HOOKS: { [k: string]: any[]; } = {\n /**\n * Runs before a plugin is added.\n * Use this to block the usage of non-compatible plugins.\n */\n preAddRxPlugin: [],\n /**\n * functions that run before the database is created\n */\n preCreateRxDatabase: [],\n /**\n * runs after the database is created and prepared\n * but before the instance is returned to the user\n * @async\n */\n createRxDatabase: [],\n preCreateRxCollection: [],\n createRxCollection: [],\n createRxState: [],\n /**\n * runs at the end of the destroy-process of a collection\n * @async\n */\n postDestroyRxCollection: [],\n /**\n * Runs after a collection is removed.\n * @async\n */\n postRemoveRxCollection: [],\n /**\n * functions that get the json-schema as input\n * to do additionally checks/manipulation\n */\n preCreateRxSchema: [],\n /**\n * functions that run after the RxSchema is created\n * gets RxSchema as attribute\n */\n createRxSchema: [],\n preCreateRxQuery: [],\n /**\n * Runs before a query is send to the\n * prepareQuery function of the storage engine.\n */\n prePrepareQuery: [],\n createRxDocument: [],\n /**\n * runs after a RxDocument is created,\n * cannot be async\n */\n postCreateRxDocument: [],\n /**\n * Runs before a RxStorageInstance is created\n * gets the params of createStorageInstance()\n * as attribute so you can manipulate them.\n * Notice that you have to clone stuff before mutating the inputs.\n */\n preCreateRxStorageInstance: [],\n preStorageWrite: [],\n /**\n * runs on the document-data before the document is migrated\n * {\n * doc: Object, // original doc-data\n * migrated: // migrated doc-data after run through migration-strategies\n * }\n */\n preMigrateDocument: [],\n /**\n * runs after the migration of a document has been done\n */\n postMigrateDocument: [],\n /**\n * runs at the beginning of the destroy-process of a database\n */\n preDestroyRxDatabase: [],\n /**\n * runs after a database has been removed\n * @async\n */\n postRemoveRxDatabase: [],\n\n /**\n * runs before the replication writes the rows to master\n * but before the rows have been modified\n * @async\n */\n preReplicationMasterWrite: [],\n\n /**\n * runs after the replication has been sent to the server\n * but before the new documents have been handled\n * @async\n */\n preReplicationMasterWriteDocumentsHandle: [],\n};\n\nexport function runPluginHooks(hookKey: string, obj: any) {\n if (HOOKS[hookKey].length > 0) {\n HOOKS[hookKey].forEach(fun => fun(obj));\n }\n}\n\n\n/**\n * TODO\n * we should not run the hooks in parallel\n * this makes stuff unpredictable.\n */\nexport function runAsyncPluginHooks(hookKey: string, obj: any): Promise {\n return Promise.all(\n HOOKS[hookKey].map(fun => fun(obj))\n );\n}\n\n/**\n * used in tests to remove hooks\n */\nexport function _clearHook(type: string, fun: Function) {\n HOOKS[type] = HOOKS[type].filter(h => h !== fun);\n}\n"],"mappings":";;;;;;;;;AACA;AACA;AACA;AACO,IAAMA,KAA8B,GAAAC,OAAA,CAAAD,KAAA,GAAG;EAC1C;AACJ;AACA;AACA;EACIE,cAAc,EAAE,EAAE;EAClB;AACJ;AACA;EACIC,mBAAmB,EAAE,EAAE;EACvB;AACJ;AACA;AACA;AACA;EACIC,gBAAgB,EAAE,EAAE;EACpBC,qBAAqB,EAAE,EAAE;EACzBC,kBAAkB,EAAE,EAAE;EACtBC,aAAa,EAAE,EAAE;EACjB;AACJ;AACA;AACA;EACIC,uBAAuB,EAAE,EAAE;EAC3B;AACJ;AACA;AACA;EACIC,sBAAsB,EAAE,EAAE;EAC1B;AACJ;AACA;AACA;EACIC,iBAAiB,EAAE,EAAE;EACrB;AACJ;AACA;AACA;EACIC,cAAc,EAAE,EAAE;EAClBC,gBAAgB,EAAE,EAAE;EACpB;AACJ;AACA;AACA;EACIC,eAAe,EAAE,EAAE;EACnBC,gBAAgB,EAAE,EAAE;EACpB;AACJ;AACA;AACA;EACIC,oBAAoB,EAAE,EAAE;EACxB;AACJ;AACA;AACA;AACA;AACA;EACIC,0BAA0B,EAAE,EAAE;EAC9BC,eAAe,EAAE,EAAE;EACnB;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,kBAAkB,EAAE,EAAE;EACtB;AACJ;AACA;EACIC,mBAAmB,EAAE,EAAE;EACvB;AACJ;AACA;EACIC,oBAAoB,EAAE,EAAE;EACxB;AACJ;AACA;AACA;EACIC,oBAAoB,EAAE,EAAE;EAExB;AACJ;AACA;AACA;AACA;EACIC,yBAAyB,EAAE,EAAE;EAE7B;AACJ;AACA;AACA;AACA;EACIC,wCAAwC,EAAE;AAC9C,CAAC;AAEM,SAASC,cAAcA,CAACC,OAAe,EAAEC,GAAQ,EAAE;EACtD,IAAI1B,KAAK,CAACyB,OAAO,CAAC,CAACE,MAAM,GAAG,CAAC,EAAE;IAC3B3B,KAAK,CAACyB,OAAO,CAAC,CAACG,OAAO,CAACC,GAAG,IAAIA,GAAG,CAACH,GAAG,CAAC,CAAC;EAC3C;AACJ;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASI,mBAAmBA,CAACL,OAAe,EAAEC,GAAQ,EAAgB;EACzE,OAAOK,OAAO,CAACC,GAAG,CACdhC,KAAK,CAACyB,OAAO,CAAC,CAACQ,GAAG,CAACJ,GAAG,IAAIA,GAAG,CAACH,GAAG,CAAC,CACtC,CAAC;AACL;;AAEA;AACA;AACA;AACO,SAASQ,UAAUA,CAACC,IAAY,EAAEN,GAAa,EAAE;EACpD7B,KAAK,CAACmC,IAAI,CAAC,GAAGnC,KAAK,CAACmC,IAAI,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKR,GAAG,CAAC;AACpD","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"hooks.js","names":["HOOKS","exports","preAddRxPlugin","preCreateRxDatabase","createRxDatabase","preCreateRxCollection","createRxCollection","createRxState","postDestroyRxCollection","postRemoveRxCollection","preCreateRxSchema","createRxSchema","preCreateRxQuery","prePrepareQuery","createRxDocument","postCreateRxDocument","preCreateRxStorageInstance","preStorageWrite","preMigrateDocument","postMigrateDocument","preDestroyRxDatabase","postRemoveRxDatabase","postCleanup","preReplicationMasterWrite","preReplicationMasterWriteDocumentsHandle","runPluginHooks","hookKey","obj","length","forEach","fun","runAsyncPluginHooks","Promise","all","map","_clearHook","type","filter","h"],"sources":["../../src/hooks.ts"],"sourcesContent":["\n/**\n * hook-functions that can be extended by the plugin\n */\nexport const HOOKS: { [k: string]: any[]; } = {\n /**\n * Runs before a plugin is added.\n * Use this to block the usage of non-compatible plugins.\n */\n preAddRxPlugin: [],\n /**\n * functions that run before the database is created\n */\n preCreateRxDatabase: [],\n /**\n * runs after the database is created and prepared\n * but before the instance is returned to the user\n * @async\n */\n createRxDatabase: [],\n preCreateRxCollection: [],\n createRxCollection: [],\n createRxState: [],\n /**\n * runs at the end of the destroy-process of a collection\n * @async\n */\n postDestroyRxCollection: [],\n /**\n * Runs after a collection is removed.\n * @async\n */\n postRemoveRxCollection: [],\n /**\n * functions that get the json-schema as input\n * to do additionally checks/manipulation\n */\n preCreateRxSchema: [],\n /**\n * functions that run after the RxSchema is created\n * gets RxSchema as attribute\n */\n createRxSchema: [],\n preCreateRxQuery: [],\n /**\n * Runs before a query is send to the\n * prepareQuery function of the storage engine.\n */\n prePrepareQuery: [],\n createRxDocument: [],\n /**\n * runs after a RxDocument is created,\n * cannot be async\n */\n postCreateRxDocument: [],\n /**\n * Runs before a RxStorageInstance is created\n * gets the params of createStorageInstance()\n * as attribute so you can manipulate them.\n * Notice that you have to clone stuff before mutating the inputs.\n */\n preCreateRxStorageInstance: [],\n preStorageWrite: [],\n /**\n * runs on the document-data before the document is migrated\n * {\n * doc: Object, // original doc-data\n * migrated: // migrated doc-data after run through migration-strategies\n * }\n */\n preMigrateDocument: [],\n /**\n * runs after the migration of a document has been done\n */\n postMigrateDocument: [],\n /**\n * runs at the beginning of the destroy-process of a database\n */\n preDestroyRxDatabase: [],\n /**\n * runs after a database has been removed\n * @async\n */\n postRemoveRxDatabase: [],\n\n\n postCleanup: [],\n\n /**\n * runs before the replication writes the rows to master\n * but before the rows have been modified\n * @async\n */\n preReplicationMasterWrite: [],\n\n /**\n * runs after the replication has been sent to the server\n * but before the new documents have been handled\n * @async\n */\n preReplicationMasterWriteDocumentsHandle: [],\n};\n\nexport function runPluginHooks(hookKey: string, obj: any) {\n if (HOOKS[hookKey].length > 0) {\n HOOKS[hookKey].forEach(fun => fun(obj));\n }\n}\n\n\n/**\n * TODO\n * we should not run the hooks in parallel\n * this makes stuff unpredictable.\n */\nexport function runAsyncPluginHooks(hookKey: string, obj: any): Promise {\n return Promise.all(\n HOOKS[hookKey].map(fun => fun(obj))\n );\n}\n\n/**\n * used in tests to remove hooks\n */\nexport function _clearHook(type: string, fun: Function) {\n HOOKS[type] = HOOKS[type].filter(h => h !== fun);\n}\n"],"mappings":";;;;;;;;;AACA;AACA;AACA;AACO,IAAMA,KAA8B,GAAAC,OAAA,CAAAD,KAAA,GAAG;EAC1C;AACJ;AACA;AACA;EACIE,cAAc,EAAE,EAAE;EAClB;AACJ;AACA;EACIC,mBAAmB,EAAE,EAAE;EACvB;AACJ;AACA;AACA;AACA;EACIC,gBAAgB,EAAE,EAAE;EACpBC,qBAAqB,EAAE,EAAE;EACzBC,kBAAkB,EAAE,EAAE;EACtBC,aAAa,EAAE,EAAE;EACjB;AACJ;AACA;AACA;EACIC,uBAAuB,EAAE,EAAE;EAC3B;AACJ;AACA;AACA;EACIC,sBAAsB,EAAE,EAAE;EAC1B;AACJ;AACA;AACA;EACIC,iBAAiB,EAAE,EAAE;EACrB;AACJ;AACA;AACA;EACIC,cAAc,EAAE,EAAE;EAClBC,gBAAgB,EAAE,EAAE;EACpB;AACJ;AACA;AACA;EACIC,eAAe,EAAE,EAAE;EACnBC,gBAAgB,EAAE,EAAE;EACpB;AACJ;AACA;AACA;EACIC,oBAAoB,EAAE,EAAE;EACxB;AACJ;AACA;AACA;AACA;AACA;EACIC,0BAA0B,EAAE,EAAE;EAC9BC,eAAe,EAAE,EAAE;EACnB;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,kBAAkB,EAAE,EAAE;EACtB;AACJ;AACA;EACIC,mBAAmB,EAAE,EAAE;EACvB;AACJ;AACA;EACIC,oBAAoB,EAAE,EAAE;EACxB;AACJ;AACA;AACA;EACIC,oBAAoB,EAAE,EAAE;EAGxBC,WAAW,EAAE,EAAE;EAEf;AACJ;AACA;AACA;AACA;EACIC,yBAAyB,EAAE,EAAE;EAE7B;AACJ;AACA;AACA;AACA;EACIC,wCAAwC,EAAE;AAC9C,CAAC;AAEM,SAASC,cAAcA,CAACC,OAAe,EAAEC,GAAQ,EAAE;EACtD,IAAI3B,KAAK,CAAC0B,OAAO,CAAC,CAACE,MAAM,GAAG,CAAC,EAAE;IAC3B5B,KAAK,CAAC0B,OAAO,CAAC,CAACG,OAAO,CAACC,GAAG,IAAIA,GAAG,CAACH,GAAG,CAAC,CAAC;EAC3C;AACJ;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASI,mBAAmBA,CAACL,OAAe,EAAEC,GAAQ,EAAgB;EACzE,OAAOK,OAAO,CAACC,GAAG,CACdjC,KAAK,CAAC0B,OAAO,CAAC,CAACQ,GAAG,CAACJ,GAAG,IAAIA,GAAG,CAACH,GAAG,CAAC,CACtC,CAAC;AACL;;AAEA;AACA;AACA;AACO,SAASQ,UAAUA,CAACC,IAAY,EAAEN,GAAa,EAAE;EACpD9B,KAAK,CAACoC,IAAI,CAAC,GAAGpC,KAAK,CAACoC,IAAI,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKR,GAAG,CAAC;AACpD","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/attachments/index.js.map b/dist/cjs/plugins/attachments/index.js.map index 63c0705835d..f7e40f52b01 100644 --- a/dist/cjs/plugins/attachments/index.js.map +++ b/dist/cjs/plugins/attachments/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["_rxjs","require","_index","_attachmentsUtils","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","RxAttachment","doc","id","type","length","digest","assignMethodsToAttachment","_proto","remove","collection","incrementalWriteQueue","addWrite","_data","docWriteData","_attachments","then","getData","plainDataBase64","storageInstance","getAttachmentData","primary","ret","createBlobFromBase64","getStringData","data","asString","blobToString","fromStorageInstanceResult","attachmentData","rxDocument","putAttachment","ensureSchemaSupportsAttachments","dataSize","getBlobSize","dataString","blobToBase64String","database","hashFunction","flatClone","writeResult","newDocument","_docCache","getCachedRxDocument","attachmentDataOfId","attachment","getAttachment","docData","allAttachments","map","preMigrateDocument","attachments","newAttachments","Promise","all","attachmentId","docPrimary","oldCollection","schema","primaryPath","rawAttachmentData","postMigrateDocument","_action","PROMISE_RESOLVE_VOID","RxDBAttachmentsPlugin","name","rxdb","prototypes","RxDocument","proto","allAttachments$","$","pipe","entries","toJSON","overwritable","hooks","after"],"sources":["../../../../src/plugins/attachments/index.ts"],"sourcesContent":["import {\n map\n} from 'rxjs';\n\nimport {\n blobToBase64String,\n blobToString,\n createBlobFromBase64,\n flatClone,\n getBlobSize,\n PROMISE_RESOLVE_VOID\n} from '../../plugins/utils/index.ts';\nimport type {\n RxDocument,\n RxPlugin,\n RxDocumentWriteData,\n RxAttachmentData,\n RxDocumentData,\n RxAttachmentCreator,\n RxAttachmentWriteData\n} from '../../types/index.ts';\nimport { assignMethodsToAttachment, ensureSchemaSupportsAttachments } from './attachments-utils.ts';\n\n\n\n/**\n * an RxAttachment is basically just the attachment-stub\n * wrapped so that you can access the attachment-data\n */\nexport class RxAttachment {\n public doc: RxDocument;\n public id: string;\n public type: string;\n public length: number;\n public digest: string;\n constructor({\n doc,\n id,\n type,\n length,\n digest\n }: any) {\n this.doc = doc;\n this.id = id;\n this.type = type;\n this.length = length;\n this.digest = digest;\n\n assignMethodsToAttachment(this);\n }\n\n remove(): Promise {\n return this.doc.collection.incrementalWriteQueue.addWrite(\n this.doc._data,\n docWriteData => {\n delete docWriteData._attachments[this.id];\n return docWriteData;\n }\n ).then(() => { });\n }\n\n /**\n * returns the data for the attachment\n */\n async getData(): Promise {\n const plainDataBase64 = await this.doc.collection.storageInstance.getAttachmentData(\n this.doc.primary,\n this.id,\n this.digest\n );\n const ret = await createBlobFromBase64(\n plainDataBase64,\n this.type as any\n );\n return ret;\n }\n\n async getStringData(): Promise {\n const data = await this.getData();\n const asString = await blobToString(data);\n return asString;\n }\n}\n\nexport function fromStorageInstanceResult(\n id: string,\n attachmentData: RxAttachmentData,\n rxDocument: RxDocument\n) {\n return new RxAttachment({\n doc: rxDocument,\n id,\n type: attachmentData.type,\n length: attachmentData.length,\n digest: attachmentData.digest\n });\n}\n\n\n\nexport async function putAttachment(\n this: RxDocument,\n attachmentData: RxAttachmentCreator\n): Promise {\n ensureSchemaSupportsAttachments(this);\n\n const dataSize = getBlobSize(attachmentData.data);\n const dataString = await blobToBase64String(attachmentData.data);\n const digest = await this.collection.database.hashFunction(dataString);\n\n const id = attachmentData.id;\n const type = attachmentData.type;\n const data = dataString;\n\n return this.collection.incrementalWriteQueue.addWrite(\n this._data,\n (docWriteData: RxDocumentWriteData) => {\n docWriteData = flatClone(docWriteData);\n docWriteData._attachments = flatClone(docWriteData._attachments);\n docWriteData._attachments[id] = {\n length: dataSize,\n type,\n data,\n digest\n };\n return docWriteData;\n }).then(writeResult => {\n const newDocument = this.collection._docCache.getCachedRxDocument(writeResult);\n const attachmentDataOfId = writeResult._attachments[id];\n const attachment = fromStorageInstanceResult(\n id,\n attachmentDataOfId,\n newDocument\n );\n return attachment;\n });\n}\n\n/**\n * get an attachment of the document by its id\n */\nexport function getAttachment(\n this: RxDocument,\n id: string\n): RxAttachment | null {\n ensureSchemaSupportsAttachments(this);\n const docData: any = this._data;\n if (!docData._attachments || !docData._attachments[id])\n return null;\n\n const attachmentData = docData._attachments[id];\n const attachment = fromStorageInstanceResult(\n id,\n attachmentData,\n this\n );\n return attachment;\n}\n\n/**\n * returns all attachments of the document\n */\nexport function allAttachments(\n this: RxDocument\n): RxAttachment[] {\n ensureSchemaSupportsAttachments(this);\n const docData: any = this._data;\n\n // if there are no attachments, the field is missing\n if (!docData._attachments) {\n return [];\n }\n return Object.keys(docData._attachments)\n .map(id => {\n return fromStorageInstanceResult(\n id,\n docData._attachments[id],\n this\n );\n });\n}\n\nexport async function preMigrateDocument(\n data: {\n docData: RxDocumentData;\n oldCollection: any; // TODO\n }\n): Promise {\n const attachments = data.docData._attachments;\n if (attachments) {\n const newAttachments: { [attachmentId: string]: RxAttachmentWriteData; } = {};\n await Promise.all(\n Object.keys(attachments).map(async (attachmentId) => {\n const attachment: RxAttachmentData = attachments[attachmentId];\n const docPrimary: string = (data.docData as any)[data.oldCollection.schema.primaryPath];\n const rawAttachmentData = await data.oldCollection.storageInstance.getAttachmentData(\n docPrimary,\n attachmentId,\n attachment.digest\n );\n const digest = await data.oldCollection.database.hashFunction(rawAttachmentData);\n newAttachments[attachmentId] = {\n length: attachment.length,\n type: attachment.type,\n data: rawAttachmentData,\n digest\n };\n })\n );\n\n /**\n * Hooks mutate the input\n * instead of returning stuff\n */\n (data.docData as RxDocumentWriteData)._attachments = newAttachments;\n }\n}\n\nexport function postMigrateDocument(_action: any): Promise {\n /**\n * No longer needed because\n * we store the attachments data buffers directly in the document.\n */\n return PROMISE_RESOLVE_VOID;\n}\n\nexport const RxDBAttachmentsPlugin: RxPlugin = {\n name: 'attachments',\n rxdb: true,\n prototypes: {\n RxDocument: (proto: any) => {\n proto.putAttachment = putAttachment;\n proto.getAttachment = getAttachment;\n proto.allAttachments = allAttachments;\n Object.defineProperty(proto, 'allAttachments$', {\n get: function allAttachments$(this: RxDocument) {\n return this.$\n .pipe(\n map(rxDocument => Object.entries(\n rxDocument.toJSON(true)._attachments\n )),\n map(entries => {\n return (entries as any)\n .map(([id, attachmentData]: any) => {\n return fromStorageInstanceResult(\n id,\n attachmentData,\n this\n );\n });\n })\n );\n }\n });\n }\n },\n overwritable: {},\n hooks: {\n preMigrateDocument: {\n after: preMigrateDocument\n },\n postMigrateDocument: {\n after: postMigrateDocument\n }\n }\n};\n\n\nexport * from './attachments-utils.ts';\n"],"mappings":"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","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["_rxjs","require","_index","_attachmentsUtils","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","RxAttachment","doc","id","type","length","digest","assignMethodsToAttachment","_proto","remove","collection","incrementalWriteQueue","addWrite","_data","docWriteData","_attachments","then","getData","plainDataBase64","storageInstance","getAttachmentData","primary","ret","createBlobFromBase64","getStringData","data","asString","blobToString","fromStorageInstanceResult","attachmentData","rxDocument","putAttachment","ensureSchemaSupportsAttachments","dataSize","getBlobSize","dataString","blobToBase64String","database","hashFunction","flatClone","writeResult","newDocument","_docCache","getCachedRxDocument","attachmentDataOfId","attachment","getAttachment","docData","allAttachments","map","preMigrateDocument","attachments","newAttachments","Promise","all","attachmentId","docPrimary","oldCollection","schema","primaryPath","rawAttachmentData","postMigrateDocument","_action","PROMISE_RESOLVE_VOID","RxDBAttachmentsPlugin","name","rxdb","prototypes","RxDocument","proto","allAttachments$","$","pipe","entries","toJSON","overwritable","hooks","after"],"sources":["../../../../src/plugins/attachments/index.ts"],"sourcesContent":["import {\n map\n} from 'rxjs';\n\nimport {\n blobToBase64String,\n blobToString,\n createBlobFromBase64,\n flatClone,\n getBlobSize,\n PROMISE_RESOLVE_VOID\n} from '../../plugins/utils/index.ts';\nimport type {\n RxDocument,\n RxPlugin,\n RxDocumentWriteData,\n RxAttachmentData,\n RxDocumentData,\n RxAttachmentCreator,\n RxAttachmentWriteData\n} from '../../types/index.ts';\nimport {\n assignMethodsToAttachment,\n ensureSchemaSupportsAttachments\n} from './attachments-utils.ts';\n\n\n\n/**\n * an RxAttachment is basically just the attachment-stub\n * wrapped so that you can access the attachment-data\n */\nexport class RxAttachment {\n public doc: RxDocument;\n public id: string;\n public type: string;\n public length: number;\n public digest: string;\n constructor({\n doc,\n id,\n type,\n length,\n digest\n }: any) {\n this.doc = doc;\n this.id = id;\n this.type = type;\n this.length = length;\n this.digest = digest;\n\n assignMethodsToAttachment(this);\n }\n\n remove(): Promise {\n return this.doc.collection.incrementalWriteQueue.addWrite(\n this.doc._data,\n docWriteData => {\n delete docWriteData._attachments[this.id];\n return docWriteData;\n }\n ).then(() => { });\n }\n\n /**\n * returns the data for the attachment\n */\n async getData(): Promise {\n const plainDataBase64 = await this.doc.collection.storageInstance.getAttachmentData(\n this.doc.primary,\n this.id,\n this.digest\n );\n const ret = await createBlobFromBase64(\n plainDataBase64,\n this.type as any\n );\n return ret;\n }\n\n async getStringData(): Promise {\n const data = await this.getData();\n const asString = await blobToString(data);\n return asString;\n }\n}\n\nexport function fromStorageInstanceResult(\n id: string,\n attachmentData: RxAttachmentData,\n rxDocument: RxDocument\n) {\n return new RxAttachment({\n doc: rxDocument,\n id,\n type: attachmentData.type,\n length: attachmentData.length,\n digest: attachmentData.digest\n });\n}\n\n\n\nexport async function putAttachment(\n this: RxDocument,\n attachmentData: RxAttachmentCreator\n): Promise {\n ensureSchemaSupportsAttachments(this);\n\n const dataSize = getBlobSize(attachmentData.data);\n const dataString = await blobToBase64String(attachmentData.data);\n const digest = await this.collection.database.hashFunction(dataString);\n\n const id = attachmentData.id;\n const type = attachmentData.type;\n const data = dataString;\n\n return this.collection.incrementalWriteQueue.addWrite(\n this._data,\n (docWriteData: RxDocumentWriteData) => {\n docWriteData = flatClone(docWriteData);\n docWriteData._attachments = flatClone(docWriteData._attachments);\n docWriteData._attachments[id] = {\n length: dataSize,\n type,\n data,\n digest\n };\n return docWriteData;\n }).then(writeResult => {\n const newDocument = this.collection._docCache.getCachedRxDocument(writeResult);\n const attachmentDataOfId = writeResult._attachments[id];\n const attachment = fromStorageInstanceResult(\n id,\n attachmentDataOfId,\n newDocument\n );\n return attachment;\n });\n}\n\n/**\n * get an attachment of the document by its id\n */\nexport function getAttachment(\n this: RxDocument,\n id: string\n): RxAttachment | null {\n ensureSchemaSupportsAttachments(this);\n const docData: any = this._data;\n if (!docData._attachments || !docData._attachments[id])\n return null;\n\n const attachmentData = docData._attachments[id];\n const attachment = fromStorageInstanceResult(\n id,\n attachmentData,\n this\n );\n return attachment;\n}\n\n/**\n * returns all attachments of the document\n */\nexport function allAttachments(\n this: RxDocument\n): RxAttachment[] {\n ensureSchemaSupportsAttachments(this);\n const docData: any = this._data;\n\n // if there are no attachments, the field is missing\n if (!docData._attachments) {\n return [];\n }\n return Object.keys(docData._attachments)\n .map(id => {\n return fromStorageInstanceResult(\n id,\n docData._attachments[id],\n this\n );\n });\n}\n\nexport async function preMigrateDocument(\n data: {\n docData: RxDocumentData;\n oldCollection: any; // TODO\n }\n): Promise {\n const attachments = data.docData._attachments;\n if (attachments) {\n const newAttachments: { [attachmentId: string]: RxAttachmentWriteData; } = {};\n await Promise.all(\n Object.keys(attachments).map(async (attachmentId) => {\n const attachment: RxAttachmentData = attachments[attachmentId];\n const docPrimary: string = (data.docData as any)[data.oldCollection.schema.primaryPath];\n const rawAttachmentData = await data.oldCollection.storageInstance.getAttachmentData(\n docPrimary,\n attachmentId,\n attachment.digest\n );\n const digest = await data.oldCollection.database.hashFunction(rawAttachmentData);\n newAttachments[attachmentId] = {\n length: attachment.length,\n type: attachment.type,\n data: rawAttachmentData,\n digest\n };\n })\n );\n\n /**\n * Hooks mutate the input\n * instead of returning stuff\n */\n (data.docData as RxDocumentWriteData)._attachments = newAttachments;\n }\n}\n\nexport function postMigrateDocument(_action: any): Promise {\n /**\n * No longer needed because\n * we store the attachments data buffers directly in the document.\n */\n return PROMISE_RESOLVE_VOID;\n}\n\nexport const RxDBAttachmentsPlugin: RxPlugin = {\n name: 'attachments',\n rxdb: true,\n prototypes: {\n RxDocument: (proto: any) => {\n proto.putAttachment = putAttachment;\n proto.getAttachment = getAttachment;\n proto.allAttachments = allAttachments;\n Object.defineProperty(proto, 'allAttachments$', {\n get: function allAttachments$(this: RxDocument) {\n return this.$\n .pipe(\n map(rxDocument => Object.entries(\n rxDocument.toJSON(true)._attachments\n )),\n map(entries => {\n return (entries as any)\n .map(([id, attachmentData]: any) => {\n return fromStorageInstanceResult(\n id,\n attachmentData,\n this\n );\n });\n })\n );\n }\n });\n }\n },\n overwritable: {},\n hooks: {\n preMigrateDocument: {\n after: preMigrateDocument\n },\n postMigrateDocument: {\n after: postMigrateDocument\n }\n }\n};\n\n\nexport * from './attachments-utils.ts';\n"],"mappings":"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","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/cleanup/cleanup.js b/dist/cjs/plugins/cleanup/cleanup.js index f46ee28acab..a36d2992555 100644 --- a/dist/cjs/plugins/cleanup/cleanup.js +++ b/dist/cjs/plugins/cleanup/cleanup.js @@ -10,6 +10,7 @@ exports.startCleanupForRxCollection = startCleanupForRxCollection; var _index = require("../../plugins/utils/index.js"); var _index2 = require("../replication/index.js"); var _cleanupHelper = require("./cleanup-helper.js"); +var _hooks = require("../../hooks.js"); /** * Even on multiple databases, * the calls to RxStorage().cleanup() @@ -82,6 +83,10 @@ async function cleanupRxCollection(rxCollection, cleanupPolicy) { }); isDone = await RXSTORAGE_CLEANUP_QUEUE; } + await (0, _hooks.runAsyncPluginHooks)('postCleanup', { + collectionName: rxCollection.name, + databaseName: rxDatabase.name + }); } /** diff --git a/dist/cjs/plugins/cleanup/cleanup.js.map b/dist/cjs/plugins/cleanup/cleanup.js.map index cdc6b0ebd14..9b3669156d1 100644 --- a/dist/cjs/plugins/cleanup/cleanup.js.map +++ b/dist/cjs/plugins/cleanup/cleanup.js.map @@ -1 +1 @@ -{"version":3,"file":"cleanup.js","names":["_index","require","_index2","_cleanupHelper","RXSTORAGE_CLEANUP_QUEUE","PROMISE_RESOLVE_TRUE","startCleanupForRxCollection","rxCollection","rxDatabase","database","cleanupPolicy","Object","assign","DEFAULT_CLEANUP_POLICY","initialCleanupWait","destroyed","cleanupRxCollection","runCleanupAfterDelete","collection","promiseWait","minimumCollectionAge","waitForLeadership","storageInstance","isDone","awaitReplicationsInSync","replicationStates","REPLICATION_STATE_BY_COLLECTION","get","Promise","all","map","replicationState","isStopped","awaitInSync","then","requestIdlePromise","cleanup","minimumDeletedTime","runEach"],"sources":["../../../../src/plugins/cleanup/cleanup.ts"],"sourcesContent":["import type { RxCleanupPolicy, RxCollection } from '../../types/index.d.ts';\nimport { PROMISE_RESOLVE_TRUE } from '../../plugins/utils/index.ts';\nimport { REPLICATION_STATE_BY_COLLECTION } from '../replication/index.ts';\nimport { DEFAULT_CLEANUP_POLICY } from './cleanup-helper.ts';\n\n/**\n * Even on multiple databases,\n * the calls to RxStorage().cleanup()\n * must never run in parallel.\n * The cleanup is a background task which should\n * not affect the performance of other, more important tasks.\n */\nlet RXSTORAGE_CLEANUP_QUEUE: Promise = PROMISE_RESOLVE_TRUE;\n\nexport async function startCleanupForRxCollection(\n rxCollection: RxCollection\n) {\n const rxDatabase = rxCollection.database;\n const cleanupPolicy = Object.assign(\n {},\n DEFAULT_CLEANUP_POLICY,\n rxDatabase.cleanupPolicy ? rxDatabase.cleanupPolicy : {}\n );\n\n\n await initialCleanupWait(rxCollection, cleanupPolicy);\n if (rxCollection.destroyed) {\n return;\n }\n\n // initially cleanup the collection\n await cleanupRxCollection(rxCollection, cleanupPolicy);\n\n /**\n * Afterwards we listen to deletes\n * and only re-run the cleanup after\n * minimumDeletedTime is reached.\n */\n await runCleanupAfterDelete(rxCollection, cleanupPolicy);\n}\n\n\nexport async function initialCleanupWait(collection: RxCollection, cleanupPolicy: RxCleanupPolicy) {\n /**\n * Wait until minimumDatabaseInstanceAge is reached\n * or collection is destroyed.\n */\n await collection.promiseWait(cleanupPolicy.minimumCollectionAge);\n if (collection.destroyed) {\n return;\n }\n\n if (cleanupPolicy.waitForLeadership) {\n await collection.database.waitForLeadership();\n }\n}\n\n/**\n * Runs the cleanup for a single RxCollection\n */\nexport async function cleanupRxCollection(\n rxCollection: RxCollection,\n cleanupPolicy: RxCleanupPolicy\n) {\n const rxDatabase = rxCollection.database;\n const storageInstance = rxCollection.storageInstance;\n\n // run cleanup() until it returns true\n let isDone = false;\n while (!isDone && !rxCollection.destroyed) {\n if (cleanupPolicy.awaitReplicationsInSync) {\n const replicationStates = REPLICATION_STATE_BY_COLLECTION.get(rxCollection);\n if (replicationStates) {\n await Promise.all(\n replicationStates.map(replicationState => {\n if (!replicationState.isStopped()) {\n return replicationState.awaitInSync();\n }\n })\n );\n }\n }\n if (rxCollection.destroyed) {\n return;\n }\n RXSTORAGE_CLEANUP_QUEUE = RXSTORAGE_CLEANUP_QUEUE\n .then(async () => {\n if (rxCollection.destroyed) {\n return true;\n }\n await rxDatabase.requestIdlePromise();\n return storageInstance.cleanup(cleanupPolicy.minimumDeletedTime);\n });\n isDone = await RXSTORAGE_CLEANUP_QUEUE;\n }\n}\n\n/**\n * TODO this is not waiting for deletes!\n * it just runs on interval.\n */\nexport async function runCleanupAfterDelete(\n rxCollection: RxCollection,\n cleanupPolicy: RxCleanupPolicy\n) {\n while (!rxCollection.destroyed) {\n await rxCollection.promiseWait(cleanupPolicy.runEach);\n if (rxCollection.destroyed) {\n return;\n }\n await cleanupRxCollection(rxCollection, cleanupPolicy);\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIG,uBAAyC,GAAGC,2BAAoB;AAE7D,eAAeC,2BAA2BA,CAC7CC,YAA0B,EAC5B;EACE,IAAMC,UAAU,GAAGD,YAAY,CAACE,QAAQ;EACxC,IAAMC,aAAa,GAAGC,MAAM,CAACC,MAAM,CAC/B,CAAC,CAAC,EACFC,qCAAsB,EACtBL,UAAU,CAACE,aAAa,GAAGF,UAAU,CAACE,aAAa,GAAG,CAAC,CAC3D,CAAC;EAGD,MAAMI,kBAAkB,CAACP,YAAY,EAAEG,aAAa,CAAC;EACrD,IAAIH,YAAY,CAACQ,SAAS,EAAE;IACxB;EACJ;;EAEA;EACA,MAAMC,mBAAmB,CAACT,YAAY,EAAEG,aAAa,CAAC;;EAEtD;AACJ;AACA;AACA;AACA;EACI,MAAMO,qBAAqB,CAACV,YAAY,EAAEG,aAAa,CAAC;AAC5D;AAGO,eAAeI,kBAAkBA,CAACI,UAAwB,EAAER,aAA8B,EAAE;EAC/F;AACJ;AACA;AACA;EACI,MAAMQ,UAAU,CAACC,WAAW,CAACT,aAAa,CAACU,oBAAoB,CAAC;EAChE,IAAIF,UAAU,CAACH,SAAS,EAAE;IACtB;EACJ;EAEA,IAAIL,aAAa,CAACW,iBAAiB,EAAE;IACjC,MAAMH,UAAU,CAACT,QAAQ,CAACY,iBAAiB,CAAC,CAAC;EACjD;AACJ;;AAEA;AACA;AACA;AACO,eAAeL,mBAAmBA,CACrCT,YAA0B,EAC1BG,aAA8B,EAChC;EACE,IAAMF,UAAU,GAAGD,YAAY,CAACE,QAAQ;EACxC,IAAMa,eAAe,GAAGf,YAAY,CAACe,eAAe;;EAEpD;EACA,IAAIC,MAAM,GAAG,KAAK;EAClB,OAAO,CAACA,MAAM,IAAI,CAAChB,YAAY,CAACQ,SAAS,EAAE;IACvC,IAAIL,aAAa,CAACc,uBAAuB,EAAE;MACvC,IAAMC,iBAAiB,GAAGC,uCAA+B,CAACC,GAAG,CAACpB,YAAY,CAAC;MAC3E,IAAIkB,iBAAiB,EAAE;QACnB,MAAMG,OAAO,CAACC,GAAG,CACbJ,iBAAiB,CAACK,GAAG,CAACC,gBAAgB,IAAI;UACtC,IAAI,CAACA,gBAAgB,CAACC,SAAS,CAAC,CAAC,EAAE;YAC/B,OAAOD,gBAAgB,CAACE,WAAW,CAAC,CAAC;UACzC;QACJ,CAAC,CACL,CAAC;MACL;IACJ;IACA,IAAI1B,YAAY,CAACQ,SAAS,EAAE;MACxB;IACJ;IACAX,uBAAuB,GAAGA,uBAAuB,CAC5C8B,IAAI,CAAC,YAAY;MACd,IAAI3B,YAAY,CAACQ,SAAS,EAAE;QACxB,OAAO,IAAI;MACf;MACA,MAAMP,UAAU,CAAC2B,kBAAkB,CAAC,CAAC;MACrC,OAAOb,eAAe,CAACc,OAAO,CAAC1B,aAAa,CAAC2B,kBAAkB,CAAC;IACpE,CAAC,CAAC;IACNd,MAAM,GAAG,MAAMnB,uBAAuB;EAC1C;AACJ;;AAEA;AACA;AACA;AACA;AACO,eAAea,qBAAqBA,CACvCV,YAA0B,EAC1BG,aAA8B,EAChC;EACE,OAAO,CAACH,YAAY,CAACQ,SAAS,EAAE;IAC5B,MAAMR,YAAY,CAACY,WAAW,CAACT,aAAa,CAAC4B,OAAO,CAAC;IACrD,IAAI/B,YAAY,CAACQ,SAAS,EAAE;MACxB;IACJ;IACA,MAAMC,mBAAmB,CAACT,YAAY,EAAEG,aAAa,CAAC;EAC1D;AACJ","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"cleanup.js","names":["_index","require","_index2","_cleanupHelper","_hooks","RXSTORAGE_CLEANUP_QUEUE","PROMISE_RESOLVE_TRUE","startCleanupForRxCollection","rxCollection","rxDatabase","database","cleanupPolicy","Object","assign","DEFAULT_CLEANUP_POLICY","initialCleanupWait","destroyed","cleanupRxCollection","runCleanupAfterDelete","collection","promiseWait","minimumCollectionAge","waitForLeadership","storageInstance","isDone","awaitReplicationsInSync","replicationStates","REPLICATION_STATE_BY_COLLECTION","get","Promise","all","map","replicationState","isStopped","awaitInSync","then","requestIdlePromise","cleanup","minimumDeletedTime","runAsyncPluginHooks","collectionName","name","databaseName","runEach"],"sources":["../../../../src/plugins/cleanup/cleanup.ts"],"sourcesContent":["import type { RxCleanupPolicy, RxCollection } from '../../types/index.d.ts';\nimport { PROMISE_RESOLVE_TRUE } from '../../plugins/utils/index.ts';\nimport { REPLICATION_STATE_BY_COLLECTION } from '../replication/index.ts';\nimport { DEFAULT_CLEANUP_POLICY } from './cleanup-helper.ts';\nimport { runAsyncPluginHooks } from '../../hooks.ts';\n\n/**\n * Even on multiple databases,\n * the calls to RxStorage().cleanup()\n * must never run in parallel.\n * The cleanup is a background task which should\n * not affect the performance of other, more important tasks.\n */\nlet RXSTORAGE_CLEANUP_QUEUE: Promise = PROMISE_RESOLVE_TRUE;\n\nexport async function startCleanupForRxCollection(\n rxCollection: RxCollection\n) {\n const rxDatabase = rxCollection.database;\n const cleanupPolicy = Object.assign(\n {},\n DEFAULT_CLEANUP_POLICY,\n rxDatabase.cleanupPolicy ? rxDatabase.cleanupPolicy : {}\n );\n\n\n await initialCleanupWait(rxCollection, cleanupPolicy);\n if (rxCollection.destroyed) {\n return;\n }\n\n // initially cleanup the collection\n await cleanupRxCollection(rxCollection, cleanupPolicy);\n\n /**\n * Afterwards we listen to deletes\n * and only re-run the cleanup after\n * minimumDeletedTime is reached.\n */\n await runCleanupAfterDelete(rxCollection, cleanupPolicy);\n}\n\n\nexport async function initialCleanupWait(collection: RxCollection, cleanupPolicy: RxCleanupPolicy) {\n /**\n * Wait until minimumDatabaseInstanceAge is reached\n * or collection is destroyed.\n */\n await collection.promiseWait(cleanupPolicy.minimumCollectionAge);\n if (collection.destroyed) {\n return;\n }\n\n if (cleanupPolicy.waitForLeadership) {\n await collection.database.waitForLeadership();\n }\n}\n\n/**\n * Runs the cleanup for a single RxCollection\n */\nexport async function cleanupRxCollection(\n rxCollection: RxCollection,\n cleanupPolicy: RxCleanupPolicy\n) {\n const rxDatabase = rxCollection.database;\n const storageInstance = rxCollection.storageInstance;\n\n // run cleanup() until it returns true\n let isDone = false;\n while (!isDone && !rxCollection.destroyed) {\n if (cleanupPolicy.awaitReplicationsInSync) {\n const replicationStates = REPLICATION_STATE_BY_COLLECTION.get(rxCollection);\n if (replicationStates) {\n await Promise.all(\n replicationStates.map(replicationState => {\n if (!replicationState.isStopped()) {\n return replicationState.awaitInSync();\n }\n })\n );\n }\n }\n if (rxCollection.destroyed) {\n return;\n }\n RXSTORAGE_CLEANUP_QUEUE = RXSTORAGE_CLEANUP_QUEUE\n .then(async () => {\n if (rxCollection.destroyed) {\n return true;\n }\n await rxDatabase.requestIdlePromise();\n return storageInstance.cleanup(cleanupPolicy.minimumDeletedTime);\n });\n isDone = await RXSTORAGE_CLEANUP_QUEUE;\n }\n\n await runAsyncPluginHooks('postCleanup', {\n collectionName: rxCollection.name,\n databaseName: rxDatabase.name\n });\n}\n\n/**\n * TODO this is not waiting for deletes!\n * it just runs on interval.\n */\nexport async function runCleanupAfterDelete(\n rxCollection: RxCollection,\n cleanupPolicy: RxCleanupPolicy\n) {\n while (!rxCollection.destroyed) {\n await rxCollection.promiseWait(cleanupPolicy.runEach);\n if (rxCollection.destroyed) {\n return;\n }\n await cleanupRxCollection(rxCollection, cleanupPolicy);\n }\n}\n"],"mappings":"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","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/plugins/dev-mode/dev-mode-tracking.js b/dist/cjs/plugins/dev-mode/dev-mode-tracking.js index 5b5a7bfa5b0..fb747184794 100644 --- a/dist/cjs/plugins/dev-mode/dev-mode-tracking.js +++ b/dist/cjs/plugins/dev-mode/dev-mode-tracking.js @@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.addDevModeTrackingIframe = addDevModeTrackingIframe; -var _rxDatabase = require("../../rx-database.js"); var _index = require("../utils/index.js"); var iframeShown = false; @@ -16,7 +15,9 @@ async function addDevModeTrackingIframe(db) { * Only run this in browser AND localhost AND dev-mode. * Make sure this is never used in production by someone. */ - if (iframeShown || typeof window === 'undefined' || typeof location === 'undefined' || !isLocalHost()) { + if (iframeShown || typeof window === 'undefined' || typeof location === 'undefined' + // !isLocalHost() + ) { return; } @@ -24,12 +25,6 @@ async function addDevModeTrackingIframe(db) { if (_index.RXDB_UTILS_GLOBAL.premium && typeof _index.RXDB_UTILS_GLOBAL.premium === 'string' && (await (0, _index.defaultHashSha256)(_index.RXDB_UTILS_GLOBAL.premium)) === _index.PREMIUM_FLAG_HASH) { return; } - - // Only run if db was created for the first time. - var isFirstTime = await (0, _rxDatabase.isRxDatabaseFirstTimeInstantiated)(db); - if (!isFirstTime) { - return; - } iframeShown = true; var iframe = document.createElement('iframe'); iframe.style.display = 'none'; @@ -37,7 +32,7 @@ async function addDevModeTrackingIframe(db) { document.body.appendChild(iframe); } function isLocalHost() { - return location.hostname === 'localhost' || location.hostname === '127.0.0.1' || location.hostname === '0.0.0.0' || location.hostname === '[::1]' // IPv6 + return location.hostname === 'localhost' || location.hostname.includes('localhost') || location.hostname === '127.0.0.1' || location.hostname === '0.0.0.0' || location.hostname === '[::1]' // IPv6 ; } //# sourceMappingURL=dev-mode-tracking.js.map \ No newline at end of file diff --git a/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map b/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map index f79af54eb8b..6c50e423ca0 100644 --- a/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map +++ b/dist/cjs/plugins/dev-mode/dev-mode-tracking.js.map @@ -1 +1 @@ -{"version":3,"file":"dev-mode-tracking.js","names":["_rxDatabase","require","_index","iframeShown","addDevModeTrackingIframe","db","window","location","isLocalHost","RXDB_UTILS_GLOBAL","premium","defaultHashSha256","PREMIUM_FLAG_HASH","isFirstTime","isRxDatabaseFirstTimeInstantiated","iframe","document","createElement","style","display","src","RXDB_VERSION","body","appendChild","hostname"],"sources":["../../../../src/plugins/dev-mode/dev-mode-tracking.ts"],"sourcesContent":["import { isRxDatabaseFirstTimeInstantiated } from '../../rx-database.ts';\nimport type { RxDatabase } from '../../types';\nimport {\n PREMIUM_FLAG_HASH,\n RXDB_UTILS_GLOBAL,\n RXDB_VERSION,\n defaultHashSha256\n} from '../utils/index.ts';\n\n\nlet iframeShown = false;\n\n\n/**\n * Adds an iframe to track the results of marketing efforts.\n */\nexport async function addDevModeTrackingIframe(db: RxDatabase) {\n /**\n * Only run this in browser AND localhost AND dev-mode.\n * Make sure this is never used in production by someone.\n */\n if (\n iframeShown ||\n typeof window === 'undefined' ||\n typeof location === 'undefined' ||\n !isLocalHost()\n ) {\n return;\n }\n\n\n // do not show if premium flag is set.\n if (\n RXDB_UTILS_GLOBAL.premium &&\n typeof RXDB_UTILS_GLOBAL.premium === 'string' &&\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) === PREMIUM_FLAG_HASH)\n ) {\n return;\n }\n\n\n // Only run if db was created for the first time.\n const isFirstTime = await isRxDatabaseFirstTimeInstantiated(db);\n if (!isFirstTime) {\n return;\n }\n\n iframeShown = true;\n\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = 'https://rxdb.info/html/dev-mode-iframe.html?version=' + RXDB_VERSION;\n document.body.appendChild(iframe);\n}\n\n\nfunction isLocalHost() {\n return (\n location.hostname === 'localhost' ||\n location.hostname === '127.0.0.1' ||\n location.hostname === '0.0.0.0' ||\n location.hostname === '[::1]' // IPv6\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAIE,WAAW,GAAG,KAAK;;AAGvB;AACA;AACA;AACO,eAAeC,wBAAwBA,CAACC,EAAc,EAAE;EAC3D;AACJ;AACA;AACA;EACI,IACIF,WAAW,IACX,OAAOG,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK,WAAW,IAC/B,CAACC,WAAW,CAAC,CAAC,EAChB;IACE;EACJ;;EAGA;EACA,IACIC,wBAAiB,CAACC,OAAO,IACzB,OAAOD,wBAAiB,CAACC,OAAO,KAAK,QAAQ,IAC5C,OAAM,IAAAC,wBAAiB,EAACF,wBAAiB,CAACC,OAAO,CAAC,MAAKE,wBAAkB,EAC5E;IACE;EACJ;;EAGA;EACA,IAAMC,WAAW,GAAG,MAAM,IAAAC,6CAAiC,EAACT,EAAE,CAAC;EAC/D,IAAI,CAACQ,WAAW,EAAE;IACd;EACJ;EAEAV,WAAW,GAAG,IAAI;EAElB,IAAMY,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/CF,MAAM,CAACG,KAAK,CAACC,OAAO,GAAG,MAAM;EAC7BJ,MAAM,CAACK,GAAG,GAAG,sDAAsD,GAAGC,mBAAY;EAClFL,QAAQ,CAACM,IAAI,CAACC,WAAW,CAACR,MAAM,CAAC;AACrC;AAGA,SAASP,WAAWA,CAAA,EAAG;EACnB,OACID,QAAQ,CAACiB,QAAQ,KAAK,WAAW,IACjCjB,QAAQ,CAACiB,QAAQ,KAAK,WAAW,IACjCjB,QAAQ,CAACiB,QAAQ,KAAK,SAAS,IAC/BjB,QAAQ,CAACiB,QAAQ,KAAK,OAAO,CAAE;EAAA;AAEvC","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"dev-mode-tracking.js","names":["_index","require","iframeShown","addDevModeTrackingIframe","db","window","location","RXDB_UTILS_GLOBAL","premium","defaultHashSha256","PREMIUM_FLAG_HASH","iframe","document","createElement","style","display","src","RXDB_VERSION","body","appendChild","isLocalHost","hostname","includes"],"sources":["../../../../src/plugins/dev-mode/dev-mode-tracking.ts"],"sourcesContent":["import type { RxDatabase } from '../../types';\nimport {\n PREMIUM_FLAG_HASH,\n RXDB_UTILS_GLOBAL,\n RXDB_VERSION,\n defaultHashSha256\n} from '../utils/index.ts';\n\n\nlet iframeShown = false;\n\n\n/**\n * Adds an iframe to track the results of marketing efforts.\n */\nexport async function addDevModeTrackingIframe(db: RxDatabase) {\n /**\n * Only run this in browser AND localhost AND dev-mode.\n * Make sure this is never used in production by someone.\n */\n if (\n iframeShown ||\n typeof window === 'undefined' ||\n typeof location === 'undefined'\n // !isLocalHost()\n ) {\n return;\n }\n\n\n // do not show if premium flag is set.\n if (\n RXDB_UTILS_GLOBAL.premium &&\n typeof RXDB_UTILS_GLOBAL.premium === 'string' &&\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) === PREMIUM_FLAG_HASH)\n ) {\n return;\n }\n\n iframeShown = true;\n\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = 'https://rxdb.info/html/dev-mode-iframe.html?version=' + RXDB_VERSION;\n document.body.appendChild(iframe);\n}\n\n\nfunction isLocalHost() {\n return (\n location.hostname === 'localhost' ||\n location.hostname.includes('localhost') ||\n location.hostname === '127.0.0.1' ||\n location.hostname === '0.0.0.0' ||\n location.hostname === '[::1]' // IPv6\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAIC,WAAW,GAAG,KAAK;;AAGvB;AACA;AACA;AACO,eAAeC,wBAAwBA,CAACC,EAAc,EAAE;EAC3D;AACJ;AACA;AACA;EACI,IACIF,WAAW,IACX,OAAOG,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK;EACpB;EAAA,EACF;IACE;EACJ;;EAGA;EACA,IACIC,wBAAiB,CAACC,OAAO,IACzB,OAAOD,wBAAiB,CAACC,OAAO,KAAK,QAAQ,IAC5C,OAAM,IAAAC,wBAAiB,EAACF,wBAAiB,CAACC,OAAO,CAAC,MAAKE,wBAAkB,EAC5E;IACE;EACJ;EAEAR,WAAW,GAAG,IAAI;EAElB,IAAMS,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/CF,MAAM,CAACG,KAAK,CAACC,OAAO,GAAG,MAAM;EAC7BJ,MAAM,CAACK,GAAG,GAAG,sDAAsD,GAAGC,mBAAY;EAClFL,QAAQ,CAACM,IAAI,CAACC,WAAW,CAACR,MAAM,CAAC;AACrC;AAGA,SAASS,WAAWA,CAAA,EAAG;EACnB,OACId,QAAQ,CAACe,QAAQ,KAAK,WAAW,IACjCf,QAAQ,CAACe,QAAQ,CAACC,QAAQ,CAAC,WAAW,CAAC,IACvChB,QAAQ,CAACe,QAAQ,KAAK,WAAW,IACjCf,QAAQ,CAACe,QAAQ,KAAK,SAAS,IAC/Bf,QAAQ,CAACe,QAAQ,KAAK,OAAO,CAAE;EAAA;AAEvC","ignoreList":[]} \ 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 08e9eb452ca..c9e7fdcaf89 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.31.0'; +var RXDB_VERSION = exports.RXDB_VERSION = '15.31.1'; //# 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 25a068a3d99..846830745a9 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.31.0';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,IAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,SAAS","ignoreList":[]} \ 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.31.1';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,IAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,SAAS","ignoreList":[]} \ No newline at end of file diff --git a/dist/cjs/types/rx-plugin.d.js.map b/dist/cjs/types/rx-plugin.d.js.map index 1625b7a7238..2002aa427e0 100644 --- a/dist/cjs/types/rx-plugin.d.js.map +++ b/dist/cjs/types/rx-plugin.d.js.map @@ -1 +1 @@ -{"version":3,"file":"rx-plugin.d.js","names":[],"sources":["../../../src/types/rx-plugin.d.ts"],"sourcesContent":["import type {\n RxQuery,\n RxQueryOP,\n MangoQuery\n} from './rx-query.d.ts';\nimport type {\n RxCollection,\n RxCollectionCreator\n} from './rx-collection.d.ts';\nimport type {\n RxStorageInstanceCreationParams\n} from './rx-storage.d.ts';\nimport type {\n DeepReadonly,\n FilledMangoQuery,\n RxDatabase,\n RxDatabaseCreator,\n RxDocument,\n RxStorage,\n RxReplicationWriteToMasterRow,\n WithDeleted,\n RxState,\n BulkWriteRow,\n RxStorageInstance\n} from './index.d.ts';\nimport type { RxSchema } from '../rx-schema.d.ts';\n\nexport type RxPluginPreCreateRxQueryArgs = {\n op: RxQueryOP;\n queryObj: MangoQuery;\n collection: RxCollection;\n};\n\nexport type RxPluginPreAddRxPluginArgs = {\n // the plugin that is getting added\n plugin: RxPlugin | any;\n // previous added plugins\n plugins: Set;\n};\n\nexport type RxPluginPrePrepareQueryArgs = {\n rxQuery: RxQuery;\n mangoQuery: FilledMangoQuery;\n};\n\n\n/**\n * Depending on which plugins are used together,\n * it is important that the plugin is able to define if\n * the hooks must be added as first or as last array item.\n * For example the encryption plugin must run encryption\n * before the key-compression changes the fieldnames.\n */\nexport type RxPluginHooks = {\n /**\n * Hook function that is added as first.\n */\n before?: (i: Input) => void;\n /**\n * Hook function that is added as last.\n */\n after?: (i: Input) => void;\n};\n\nexport interface RxPlugin {\n /**\n * A string to uniquely identifies the plugin.\n * Can be used to throw when different versions of the same plugin are used.\n * And also other checks.\n * Use kebab-case.\n */\n readonly name: string;\n\n /**\n * set this to true so RxDB\n * knows that this object in a rxdb plugin\n */\n readonly rxdb: true;\n\n /**\n * Init function where dependent plugins could be added.\n * (optional)\n */\n init?(): any;\n\n prototypes?: {\n RxSchema?: (proto: RxSchema) => void;\n RxDocument?: (proto: RxDocument) => void;\n RxQuery?: (proto: RxQuery) => void;\n RxCollection?: (proto: RxCollection) => void;\n RxDatabase?: (proto: RxDatabase) => void;\n };\n overwritable?: {\n isDevMode?: () => boolean;\n deepFreezeWhenDevMode?: (obj: T) => DeepReadonly;\n validatePassword?: Function;\n checkAdapter?: Function;\n tunnelErrorMessage?: Function;\n };\n hooks?: {\n preAddRxPlugin?: RxPluginHooks;\n preCreateRxDatabase?: RxPluginHooks;\n createRxDatabase?: RxPluginHooks<{\n database: RxDatabase;\n creator: RxDatabaseCreator;\n }>;\n preDestroyRxDatabase?: RxPluginHooks;\n postRemoveRxDatabase?: RxPluginHooks<{\n databaseName: string;\n storage: RxStorage;\n }>;\n createRxCollection?: RxPluginHooks<{\n collection: RxCollection;\n creator: RxCollectionCreator;\n }>;\n createRxState?: RxPluginHooks<{\n collection: RxCollection;\n state: RxState;\n }>;\n preCreateRxCollection?: RxPluginHooks & {\n name: string;\n database: RxDatabase;\n }>;\n postDestroyRxCollection?: RxPluginHooks;\n postRemoveRxCollection?: RxPluginHooks<{\n storage: RxStorage;\n databaseName: string;\n collectionName: string;\n }>;\n preCreateRxSchema?: RxPluginHooks;\n createRxSchema?: RxPluginHooks;\n preCreateRxQuery?: RxPluginHooks;\n prePrepareQuery?: RxPluginHooks;\n createRxQuery?: RxPluginHooks;\n createRxDocument?: RxPluginHooks;\n postCreateRxDocument?: RxPluginHooks;\n preCreateRxStorageInstance?: RxPluginHooks>;\n /**\n * Runs before a write to the storage instance of a RxCollection or RxDatabase.\n */\n preStorageWrite?: RxPluginHooks<{\n storageInstance: RxStorageInstance;\n rows: BulkWriteRow[];\n }>;\n preMigrateDocument?: RxPluginHooks;\n postMigrateDocument?: RxPluginHooks;\n preReplicationMasterWrite?: RxPluginHooks<{\n rows: RxReplicationWriteToMasterRow[];\n collection: RxCollection;\n }>;\n preReplicationMasterWriteDocumentsHandle?: RxPluginHooks<{\n result: WithDeleted[];\n collection: RxCollection;\n }>;\n };\n}\n"],"mappings":"","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"rx-plugin.d.js","names":[],"sources":["../../../src/types/rx-plugin.d.ts"],"sourcesContent":["import type {\n RxQuery,\n RxQueryOP,\n MangoQuery\n} from './rx-query.d.ts';\nimport type {\n RxCollection,\n RxCollectionCreator\n} from './rx-collection.d.ts';\nimport type {\n RxStorageInstanceCreationParams\n} from './rx-storage.d.ts';\nimport type {\n DeepReadonly,\n FilledMangoQuery,\n RxDatabase,\n RxDatabaseCreator,\n RxDocument,\n RxStorage,\n RxReplicationWriteToMasterRow,\n WithDeleted,\n RxState,\n BulkWriteRow,\n RxStorageInstance\n} from './index.d.ts';\nimport type { RxSchema } from '../rx-schema.d.ts';\n\nexport type RxPluginPreCreateRxQueryArgs = {\n op: RxQueryOP;\n queryObj: MangoQuery;\n collection: RxCollection;\n};\n\nexport type RxPluginPreAddRxPluginArgs = {\n // the plugin that is getting added\n plugin: RxPlugin | any;\n // previous added plugins\n plugins: Set;\n};\n\nexport type RxPluginPrePrepareQueryArgs = {\n rxQuery: RxQuery;\n mangoQuery: FilledMangoQuery;\n};\n\n\n/**\n * Depending on which plugins are used together,\n * it is important that the plugin is able to define if\n * the hooks must be added as first or as last array item.\n * For example the encryption plugin must run encryption\n * before the key-compression changes the fieldnames.\n */\nexport type RxPluginHooks = {\n /**\n * Hook function that is added as first.\n */\n before?: (i: Input) => void;\n /**\n * Hook function that is added as last.\n */\n after?: (i: Input) => void;\n};\n\nexport interface RxPlugin {\n /**\n * A string to uniquely identifies the plugin.\n * Can be used to throw when different versions of the same plugin are used.\n * And also other checks.\n * Use kebab-case.\n */\n readonly name: string;\n\n /**\n * set this to true so RxDB\n * knows that this object in a rxdb plugin\n */\n readonly rxdb: true;\n\n /**\n * Init function where dependent plugins could be added.\n * (optional)\n */\n init?(): any;\n\n prototypes?: {\n RxSchema?: (proto: RxSchema) => void;\n RxDocument?: (proto: RxDocument) => void;\n RxQuery?: (proto: RxQuery) => void;\n RxCollection?: (proto: RxCollection) => void;\n RxDatabase?: (proto: RxDatabase) => void;\n };\n overwritable?: {\n isDevMode?: () => boolean;\n deepFreezeWhenDevMode?: (obj: T) => DeepReadonly;\n validatePassword?: Function;\n checkAdapter?: Function;\n tunnelErrorMessage?: Function;\n };\n hooks?: {\n preAddRxPlugin?: RxPluginHooks;\n preCreateRxDatabase?: RxPluginHooks;\n createRxDatabase?: RxPluginHooks<{\n database: RxDatabase;\n creator: RxDatabaseCreator;\n }>;\n preDestroyRxDatabase?: RxPluginHooks;\n postRemoveRxDatabase?: RxPluginHooks<{\n databaseName: string;\n storage: RxStorage;\n }>;\n createRxCollection?: RxPluginHooks<{\n collection: RxCollection;\n creator: RxCollectionCreator;\n }>;\n createRxState?: RxPluginHooks<{\n collection: RxCollection;\n state: RxState;\n }>;\n preCreateRxCollection?: RxPluginHooks & {\n name: string;\n database: RxDatabase;\n }>;\n postDestroyRxCollection?: RxPluginHooks;\n postRemoveRxCollection?: RxPluginHooks<{\n storage: RxStorage;\n databaseName: string;\n collectionName: string;\n }>;\n preCreateRxSchema?: RxPluginHooks;\n createRxSchema?: RxPluginHooks;\n preCreateRxQuery?: RxPluginHooks;\n prePrepareQuery?: RxPluginHooks;\n createRxQuery?: RxPluginHooks;\n createRxDocument?: RxPluginHooks;\n postCreateRxDocument?: RxPluginHooks;\n preCreateRxStorageInstance?: RxPluginHooks>;\n /**\n * Runs before a write to the storage instance of a RxCollection or RxDatabase.\n */\n preStorageWrite?: RxPluginHooks<{\n storageInstance: RxStorageInstance;\n rows: BulkWriteRow[];\n }>;\n preMigrateDocument?: RxPluginHooks;\n postMigrateDocument?: RxPluginHooks;\n postCleanup?: RxPluginHooks<{\n databaseName: string;\n collectionName: string;\n }>;\n preReplicationMasterWrite?: RxPluginHooks<{\n rows: RxReplicationWriteToMasterRow[];\n collection: RxCollection;\n }>;\n preReplicationMasterWriteDocumentsHandle?: RxPluginHooks<{\n result: WithDeleted[];\n collection: RxCollection;\n }>;\n };\n}\n"],"mappings":"","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/hooks.js b/dist/esm/hooks.js index 6e7b96fd059..fb3fd4bbfdd 100644 --- a/dist/esm/hooks.js +++ b/dist/esm/hooks.js @@ -81,6 +81,7 @@ export var HOOKS = { * @async */ postRemoveRxDatabase: [], + postCleanup: [], /** * runs before the replication writes the rows to master * but before the rows have been modified diff --git a/dist/esm/hooks.js.map b/dist/esm/hooks.js.map index 20cd2e1ed07..c940f517e10 100644 --- a/dist/esm/hooks.js.map +++ b/dist/esm/hooks.js.map @@ -1 +1 @@ -{"version":3,"file":"hooks.js","names":["HOOKS","preAddRxPlugin","preCreateRxDatabase","createRxDatabase","preCreateRxCollection","createRxCollection","createRxState","postDestroyRxCollection","postRemoveRxCollection","preCreateRxSchema","createRxSchema","preCreateRxQuery","prePrepareQuery","createRxDocument","postCreateRxDocument","preCreateRxStorageInstance","preStorageWrite","preMigrateDocument","postMigrateDocument","preDestroyRxDatabase","postRemoveRxDatabase","preReplicationMasterWrite","preReplicationMasterWriteDocumentsHandle","runPluginHooks","hookKey","obj","length","forEach","fun","runAsyncPluginHooks","Promise","all","map","_clearHook","type","filter","h"],"sources":["../../src/hooks.ts"],"sourcesContent":["\n/**\n * hook-functions that can be extended by the plugin\n */\nexport const HOOKS: { [k: string]: any[]; } = {\n /**\n * Runs before a plugin is added.\n * Use this to block the usage of non-compatible plugins.\n */\n preAddRxPlugin: [],\n /**\n * functions that run before the database is created\n */\n preCreateRxDatabase: [],\n /**\n * runs after the database is created and prepared\n * but before the instance is returned to the user\n * @async\n */\n createRxDatabase: [],\n preCreateRxCollection: [],\n createRxCollection: [],\n createRxState: [],\n /**\n * runs at the end of the destroy-process of a collection\n * @async\n */\n postDestroyRxCollection: [],\n /**\n * Runs after a collection is removed.\n * @async\n */\n postRemoveRxCollection: [],\n /**\n * functions that get the json-schema as input\n * to do additionally checks/manipulation\n */\n preCreateRxSchema: [],\n /**\n * functions that run after the RxSchema is created\n * gets RxSchema as attribute\n */\n createRxSchema: [],\n preCreateRxQuery: [],\n /**\n * Runs before a query is send to the\n * prepareQuery function of the storage engine.\n */\n prePrepareQuery: [],\n createRxDocument: [],\n /**\n * runs after a RxDocument is created,\n * cannot be async\n */\n postCreateRxDocument: [],\n /**\n * Runs before a RxStorageInstance is created\n * gets the params of createStorageInstance()\n * as attribute so you can manipulate them.\n * Notice that you have to clone stuff before mutating the inputs.\n */\n preCreateRxStorageInstance: [],\n preStorageWrite: [],\n /**\n * runs on the document-data before the document is migrated\n * {\n * doc: Object, // original doc-data\n * migrated: // migrated doc-data after run through migration-strategies\n * }\n */\n preMigrateDocument: [],\n /**\n * runs after the migration of a document has been done\n */\n postMigrateDocument: [],\n /**\n * runs at the beginning of the destroy-process of a database\n */\n preDestroyRxDatabase: [],\n /**\n * runs after a database has been removed\n * @async\n */\n postRemoveRxDatabase: [],\n\n /**\n * runs before the replication writes the rows to master\n * but before the rows have been modified\n * @async\n */\n preReplicationMasterWrite: [],\n\n /**\n * runs after the replication has been sent to the server\n * but before the new documents have been handled\n * @async\n */\n preReplicationMasterWriteDocumentsHandle: [],\n};\n\nexport function runPluginHooks(hookKey: string, obj: any) {\n if (HOOKS[hookKey].length > 0) {\n HOOKS[hookKey].forEach(fun => fun(obj));\n }\n}\n\n\n/**\n * TODO\n * we should not run the hooks in parallel\n * this makes stuff unpredictable.\n */\nexport function runAsyncPluginHooks(hookKey: string, obj: any): Promise {\n return Promise.all(\n HOOKS[hookKey].map(fun => fun(obj))\n );\n}\n\n/**\n * used in tests to remove hooks\n */\nexport function _clearHook(type: string, fun: Function) {\n HOOKS[type] = HOOKS[type].filter(h => h !== fun);\n}\n"],"mappings":"AACA;AACA;AACA;AACA,OAAO,IAAMA,KAA8B,GAAG;EAC1C;AACJ;AACA;AACA;EACIC,cAAc,EAAE,EAAE;EAClB;AACJ;AACA;EACIC,mBAAmB,EAAE,EAAE;EACvB;AACJ;AACA;AACA;AACA;EACIC,gBAAgB,EAAE,EAAE;EACpBC,qBAAqB,EAAE,EAAE;EACzBC,kBAAkB,EAAE,EAAE;EACtBC,aAAa,EAAE,EAAE;EACjB;AACJ;AACA;AACA;EACIC,uBAAuB,EAAE,EAAE;EAC3B;AACJ;AACA;AACA;EACIC,sBAAsB,EAAE,EAAE;EAC1B;AACJ;AACA;AACA;EACIC,iBAAiB,EAAE,EAAE;EACrB;AACJ;AACA;AACA;EACIC,cAAc,EAAE,EAAE;EAClBC,gBAAgB,EAAE,EAAE;EACpB;AACJ;AACA;AACA;EACIC,eAAe,EAAE,EAAE;EACnBC,gBAAgB,EAAE,EAAE;EACpB;AACJ;AACA;AACA;EACIC,oBAAoB,EAAE,EAAE;EACxB;AACJ;AACA;AACA;AACA;AACA;EACIC,0BAA0B,EAAE,EAAE;EAC9BC,eAAe,EAAE,EAAE;EACnB;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,kBAAkB,EAAE,EAAE;EACtB;AACJ;AACA;EACIC,mBAAmB,EAAE,EAAE;EACvB;AACJ;AACA;EACIC,oBAAoB,EAAE,EAAE;EACxB;AACJ;AACA;AACA;EACIC,oBAAoB,EAAE,EAAE;EAExB;AACJ;AACA;AACA;AACA;EACIC,yBAAyB,EAAE,EAAE;EAE7B;AACJ;AACA;AACA;AACA;EACIC,wCAAwC,EAAE;AAC9C,CAAC;AAED,OAAO,SAASC,cAAcA,CAACC,OAAe,EAAEC,GAAQ,EAAE;EACtD,IAAIzB,KAAK,CAACwB,OAAO,CAAC,CAACE,MAAM,GAAG,CAAC,EAAE;IAC3B1B,KAAK,CAACwB,OAAO,CAAC,CAACG,OAAO,CAACC,GAAG,IAAIA,GAAG,CAACH,GAAG,CAAC,CAAC;EAC3C;AACJ;;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,mBAAmBA,CAACL,OAAe,EAAEC,GAAQ,EAAgB;EACzE,OAAOK,OAAO,CAACC,GAAG,CACd/B,KAAK,CAACwB,OAAO,CAAC,CAACQ,GAAG,CAACJ,GAAG,IAAIA,GAAG,CAACH,GAAG,CAAC,CACtC,CAAC;AACL;;AAEA;AACA;AACA;AACA,OAAO,SAASQ,UAAUA,CAACC,IAAY,EAAEN,GAAa,EAAE;EACpD5B,KAAK,CAACkC,IAAI,CAAC,GAAGlC,KAAK,CAACkC,IAAI,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKR,GAAG,CAAC;AACpD","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"hooks.js","names":["HOOKS","preAddRxPlugin","preCreateRxDatabase","createRxDatabase","preCreateRxCollection","createRxCollection","createRxState","postDestroyRxCollection","postRemoveRxCollection","preCreateRxSchema","createRxSchema","preCreateRxQuery","prePrepareQuery","createRxDocument","postCreateRxDocument","preCreateRxStorageInstance","preStorageWrite","preMigrateDocument","postMigrateDocument","preDestroyRxDatabase","postRemoveRxDatabase","postCleanup","preReplicationMasterWrite","preReplicationMasterWriteDocumentsHandle","runPluginHooks","hookKey","obj","length","forEach","fun","runAsyncPluginHooks","Promise","all","map","_clearHook","type","filter","h"],"sources":["../../src/hooks.ts"],"sourcesContent":["\n/**\n * hook-functions that can be extended by the plugin\n */\nexport const HOOKS: { [k: string]: any[]; } = {\n /**\n * Runs before a plugin is added.\n * Use this to block the usage of non-compatible plugins.\n */\n preAddRxPlugin: [],\n /**\n * functions that run before the database is created\n */\n preCreateRxDatabase: [],\n /**\n * runs after the database is created and prepared\n * but before the instance is returned to the user\n * @async\n */\n createRxDatabase: [],\n preCreateRxCollection: [],\n createRxCollection: [],\n createRxState: [],\n /**\n * runs at the end of the destroy-process of a collection\n * @async\n */\n postDestroyRxCollection: [],\n /**\n * Runs after a collection is removed.\n * @async\n */\n postRemoveRxCollection: [],\n /**\n * functions that get the json-schema as input\n * to do additionally checks/manipulation\n */\n preCreateRxSchema: [],\n /**\n * functions that run after the RxSchema is created\n * gets RxSchema as attribute\n */\n createRxSchema: [],\n preCreateRxQuery: [],\n /**\n * Runs before a query is send to the\n * prepareQuery function of the storage engine.\n */\n prePrepareQuery: [],\n createRxDocument: [],\n /**\n * runs after a RxDocument is created,\n * cannot be async\n */\n postCreateRxDocument: [],\n /**\n * Runs before a RxStorageInstance is created\n * gets the params of createStorageInstance()\n * as attribute so you can manipulate them.\n * Notice that you have to clone stuff before mutating the inputs.\n */\n preCreateRxStorageInstance: [],\n preStorageWrite: [],\n /**\n * runs on the document-data before the document is migrated\n * {\n * doc: Object, // original doc-data\n * migrated: // migrated doc-data after run through migration-strategies\n * }\n */\n preMigrateDocument: [],\n /**\n * runs after the migration of a document has been done\n */\n postMigrateDocument: [],\n /**\n * runs at the beginning of the destroy-process of a database\n */\n preDestroyRxDatabase: [],\n /**\n * runs after a database has been removed\n * @async\n */\n postRemoveRxDatabase: [],\n\n\n postCleanup: [],\n\n /**\n * runs before the replication writes the rows to master\n * but before the rows have been modified\n * @async\n */\n preReplicationMasterWrite: [],\n\n /**\n * runs after the replication has been sent to the server\n * but before the new documents have been handled\n * @async\n */\n preReplicationMasterWriteDocumentsHandle: [],\n};\n\nexport function runPluginHooks(hookKey: string, obj: any) {\n if (HOOKS[hookKey].length > 0) {\n HOOKS[hookKey].forEach(fun => fun(obj));\n }\n}\n\n\n/**\n * TODO\n * we should not run the hooks in parallel\n * this makes stuff unpredictable.\n */\nexport function runAsyncPluginHooks(hookKey: string, obj: any): Promise {\n return Promise.all(\n HOOKS[hookKey].map(fun => fun(obj))\n );\n}\n\n/**\n * used in tests to remove hooks\n */\nexport function _clearHook(type: string, fun: Function) {\n HOOKS[type] = HOOKS[type].filter(h => h !== fun);\n}\n"],"mappings":"AACA;AACA;AACA;AACA,OAAO,IAAMA,KAA8B,GAAG;EAC1C;AACJ;AACA;AACA;EACIC,cAAc,EAAE,EAAE;EAClB;AACJ;AACA;EACIC,mBAAmB,EAAE,EAAE;EACvB;AACJ;AACA;AACA;AACA;EACIC,gBAAgB,EAAE,EAAE;EACpBC,qBAAqB,EAAE,EAAE;EACzBC,kBAAkB,EAAE,EAAE;EACtBC,aAAa,EAAE,EAAE;EACjB;AACJ;AACA;AACA;EACIC,uBAAuB,EAAE,EAAE;EAC3B;AACJ;AACA;AACA;EACIC,sBAAsB,EAAE,EAAE;EAC1B;AACJ;AACA;AACA;EACIC,iBAAiB,EAAE,EAAE;EACrB;AACJ;AACA;AACA;EACIC,cAAc,EAAE,EAAE;EAClBC,gBAAgB,EAAE,EAAE;EACpB;AACJ;AACA;AACA;EACIC,eAAe,EAAE,EAAE;EACnBC,gBAAgB,EAAE,EAAE;EACpB;AACJ;AACA;AACA;EACIC,oBAAoB,EAAE,EAAE;EACxB;AACJ;AACA;AACA;AACA;AACA;EACIC,0BAA0B,EAAE,EAAE;EAC9BC,eAAe,EAAE,EAAE;EACnB;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,kBAAkB,EAAE,EAAE;EACtB;AACJ;AACA;EACIC,mBAAmB,EAAE,EAAE;EACvB;AACJ;AACA;EACIC,oBAAoB,EAAE,EAAE;EACxB;AACJ;AACA;AACA;EACIC,oBAAoB,EAAE,EAAE;EAGxBC,WAAW,EAAE,EAAE;EAEf;AACJ;AACA;AACA;AACA;EACIC,yBAAyB,EAAE,EAAE;EAE7B;AACJ;AACA;AACA;AACA;EACIC,wCAAwC,EAAE;AAC9C,CAAC;AAED,OAAO,SAASC,cAAcA,CAACC,OAAe,EAAEC,GAAQ,EAAE;EACtD,IAAI1B,KAAK,CAACyB,OAAO,CAAC,CAACE,MAAM,GAAG,CAAC,EAAE;IAC3B3B,KAAK,CAACyB,OAAO,CAAC,CAACG,OAAO,CAACC,GAAG,IAAIA,GAAG,CAACH,GAAG,CAAC,CAAC;EAC3C;AACJ;;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,mBAAmBA,CAACL,OAAe,EAAEC,GAAQ,EAAgB;EACzE,OAAOK,OAAO,CAACC,GAAG,CACdhC,KAAK,CAACyB,OAAO,CAAC,CAACQ,GAAG,CAACJ,GAAG,IAAIA,GAAG,CAACH,GAAG,CAAC,CACtC,CAAC;AACL;;AAEA;AACA;AACA;AACA,OAAO,SAASQ,UAAUA,CAACC,IAAY,EAAEN,GAAa,EAAE;EACpD7B,KAAK,CAACmC,IAAI,CAAC,GAAGnC,KAAK,CAACmC,IAAI,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKR,GAAG,CAAC;AACpD","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/attachments/index.js.map b/dist/esm/plugins/attachments/index.js.map index 91996e602a4..aba9766f9a0 100644 --- a/dist/esm/plugins/attachments/index.js.map +++ b/dist/esm/plugins/attachments/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["map","blobToBase64String","blobToString","createBlobFromBase64","flatClone","getBlobSize","PROMISE_RESOLVE_VOID","assignMethodsToAttachment","ensureSchemaSupportsAttachments","RxAttachment","doc","id","type","length","digest","_proto","prototype","remove","collection","incrementalWriteQueue","addWrite","_data","docWriteData","_attachments","then","getData","plainDataBase64","storageInstance","getAttachmentData","primary","ret","getStringData","data","asString","fromStorageInstanceResult","attachmentData","rxDocument","putAttachment","dataSize","dataString","database","hashFunction","writeResult","newDocument","_docCache","getCachedRxDocument","attachmentDataOfId","attachment","getAttachment","docData","allAttachments","Object","keys","preMigrateDocument","attachments","newAttachments","Promise","all","attachmentId","docPrimary","oldCollection","schema","primaryPath","rawAttachmentData","postMigrateDocument","_action","RxDBAttachmentsPlugin","name","rxdb","prototypes","RxDocument","proto","defineProperty","get","allAttachments$","$","pipe","entries","toJSON","overwritable","hooks","after"],"sources":["../../../../src/plugins/attachments/index.ts"],"sourcesContent":["import {\n map\n} from 'rxjs';\n\nimport {\n blobToBase64String,\n blobToString,\n createBlobFromBase64,\n flatClone,\n getBlobSize,\n PROMISE_RESOLVE_VOID\n} from '../../plugins/utils/index.ts';\nimport type {\n RxDocument,\n RxPlugin,\n RxDocumentWriteData,\n RxAttachmentData,\n RxDocumentData,\n RxAttachmentCreator,\n RxAttachmentWriteData\n} from '../../types/index.ts';\nimport { assignMethodsToAttachment, ensureSchemaSupportsAttachments } from './attachments-utils.ts';\n\n\n\n/**\n * an RxAttachment is basically just the attachment-stub\n * wrapped so that you can access the attachment-data\n */\nexport class RxAttachment {\n public doc: RxDocument;\n public id: string;\n public type: string;\n public length: number;\n public digest: string;\n constructor({\n doc,\n id,\n type,\n length,\n digest\n }: any) {\n this.doc = doc;\n this.id = id;\n this.type = type;\n this.length = length;\n this.digest = digest;\n\n assignMethodsToAttachment(this);\n }\n\n remove(): Promise {\n return this.doc.collection.incrementalWriteQueue.addWrite(\n this.doc._data,\n docWriteData => {\n delete docWriteData._attachments[this.id];\n return docWriteData;\n }\n ).then(() => { });\n }\n\n /**\n * returns the data for the attachment\n */\n async getData(): Promise {\n const plainDataBase64 = await this.doc.collection.storageInstance.getAttachmentData(\n this.doc.primary,\n this.id,\n this.digest\n );\n const ret = await createBlobFromBase64(\n plainDataBase64,\n this.type as any\n );\n return ret;\n }\n\n async getStringData(): Promise {\n const data = await this.getData();\n const asString = await blobToString(data);\n return asString;\n }\n}\n\nexport function fromStorageInstanceResult(\n id: string,\n attachmentData: RxAttachmentData,\n rxDocument: RxDocument\n) {\n return new RxAttachment({\n doc: rxDocument,\n id,\n type: attachmentData.type,\n length: attachmentData.length,\n digest: attachmentData.digest\n });\n}\n\n\n\nexport async function putAttachment(\n this: RxDocument,\n attachmentData: RxAttachmentCreator\n): Promise {\n ensureSchemaSupportsAttachments(this);\n\n const dataSize = getBlobSize(attachmentData.data);\n const dataString = await blobToBase64String(attachmentData.data);\n const digest = await this.collection.database.hashFunction(dataString);\n\n const id = attachmentData.id;\n const type = attachmentData.type;\n const data = dataString;\n\n return this.collection.incrementalWriteQueue.addWrite(\n this._data,\n (docWriteData: RxDocumentWriteData) => {\n docWriteData = flatClone(docWriteData);\n docWriteData._attachments = flatClone(docWriteData._attachments);\n docWriteData._attachments[id] = {\n length: dataSize,\n type,\n data,\n digest\n };\n return docWriteData;\n }).then(writeResult => {\n const newDocument = this.collection._docCache.getCachedRxDocument(writeResult);\n const attachmentDataOfId = writeResult._attachments[id];\n const attachment = fromStorageInstanceResult(\n id,\n attachmentDataOfId,\n newDocument\n );\n return attachment;\n });\n}\n\n/**\n * get an attachment of the document by its id\n */\nexport function getAttachment(\n this: RxDocument,\n id: string\n): RxAttachment | null {\n ensureSchemaSupportsAttachments(this);\n const docData: any = this._data;\n if (!docData._attachments || !docData._attachments[id])\n return null;\n\n const attachmentData = docData._attachments[id];\n const attachment = fromStorageInstanceResult(\n id,\n attachmentData,\n this\n );\n return attachment;\n}\n\n/**\n * returns all attachments of the document\n */\nexport function allAttachments(\n this: RxDocument\n): RxAttachment[] {\n ensureSchemaSupportsAttachments(this);\n const docData: any = this._data;\n\n // if there are no attachments, the field is missing\n if (!docData._attachments) {\n return [];\n }\n return Object.keys(docData._attachments)\n .map(id => {\n return fromStorageInstanceResult(\n id,\n docData._attachments[id],\n this\n );\n });\n}\n\nexport async function preMigrateDocument(\n data: {\n docData: RxDocumentData;\n oldCollection: any; // TODO\n }\n): Promise {\n const attachments = data.docData._attachments;\n if (attachments) {\n const newAttachments: { [attachmentId: string]: RxAttachmentWriteData; } = {};\n await Promise.all(\n Object.keys(attachments).map(async (attachmentId) => {\n const attachment: RxAttachmentData = attachments[attachmentId];\n const docPrimary: string = (data.docData as any)[data.oldCollection.schema.primaryPath];\n const rawAttachmentData = await data.oldCollection.storageInstance.getAttachmentData(\n docPrimary,\n attachmentId,\n attachment.digest\n );\n const digest = await data.oldCollection.database.hashFunction(rawAttachmentData);\n newAttachments[attachmentId] = {\n length: attachment.length,\n type: attachment.type,\n data: rawAttachmentData,\n digest\n };\n })\n );\n\n /**\n * Hooks mutate the input\n * instead of returning stuff\n */\n (data.docData as RxDocumentWriteData)._attachments = newAttachments;\n }\n}\n\nexport function postMigrateDocument(_action: any): Promise {\n /**\n * No longer needed because\n * we store the attachments data buffers directly in the document.\n */\n return PROMISE_RESOLVE_VOID;\n}\n\nexport const RxDBAttachmentsPlugin: RxPlugin = {\n name: 'attachments',\n rxdb: true,\n prototypes: {\n RxDocument: (proto: any) => {\n proto.putAttachment = putAttachment;\n proto.getAttachment = getAttachment;\n proto.allAttachments = allAttachments;\n Object.defineProperty(proto, 'allAttachments$', {\n get: function allAttachments$(this: RxDocument) {\n return this.$\n .pipe(\n map(rxDocument => Object.entries(\n rxDocument.toJSON(true)._attachments\n )),\n map(entries => {\n return (entries as any)\n .map(([id, attachmentData]: any) => {\n return fromStorageInstanceResult(\n id,\n attachmentData,\n this\n );\n });\n })\n );\n }\n });\n }\n },\n overwritable: {},\n hooks: {\n preMigrateDocument: {\n after: preMigrateDocument\n },\n postMigrateDocument: {\n after: postMigrateDocument\n }\n }\n};\n\n\nexport * from './attachments-utils.ts';\n"],"mappings":"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","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["map","blobToBase64String","blobToString","createBlobFromBase64","flatClone","getBlobSize","PROMISE_RESOLVE_VOID","assignMethodsToAttachment","ensureSchemaSupportsAttachments","RxAttachment","doc","id","type","length","digest","_proto","prototype","remove","collection","incrementalWriteQueue","addWrite","_data","docWriteData","_attachments","then","getData","plainDataBase64","storageInstance","getAttachmentData","primary","ret","getStringData","data","asString","fromStorageInstanceResult","attachmentData","rxDocument","putAttachment","dataSize","dataString","database","hashFunction","writeResult","newDocument","_docCache","getCachedRxDocument","attachmentDataOfId","attachment","getAttachment","docData","allAttachments","Object","keys","preMigrateDocument","attachments","newAttachments","Promise","all","attachmentId","docPrimary","oldCollection","schema","primaryPath","rawAttachmentData","postMigrateDocument","_action","RxDBAttachmentsPlugin","name","rxdb","prototypes","RxDocument","proto","defineProperty","get","allAttachments$","$","pipe","entries","toJSON","overwritable","hooks","after"],"sources":["../../../../src/plugins/attachments/index.ts"],"sourcesContent":["import {\n map\n} from 'rxjs';\n\nimport {\n blobToBase64String,\n blobToString,\n createBlobFromBase64,\n flatClone,\n getBlobSize,\n PROMISE_RESOLVE_VOID\n} from '../../plugins/utils/index.ts';\nimport type {\n RxDocument,\n RxPlugin,\n RxDocumentWriteData,\n RxAttachmentData,\n RxDocumentData,\n RxAttachmentCreator,\n RxAttachmentWriteData\n} from '../../types/index.ts';\nimport {\n assignMethodsToAttachment,\n ensureSchemaSupportsAttachments\n} from './attachments-utils.ts';\n\n\n\n/**\n * an RxAttachment is basically just the attachment-stub\n * wrapped so that you can access the attachment-data\n */\nexport class RxAttachment {\n public doc: RxDocument;\n public id: string;\n public type: string;\n public length: number;\n public digest: string;\n constructor({\n doc,\n id,\n type,\n length,\n digest\n }: any) {\n this.doc = doc;\n this.id = id;\n this.type = type;\n this.length = length;\n this.digest = digest;\n\n assignMethodsToAttachment(this);\n }\n\n remove(): Promise {\n return this.doc.collection.incrementalWriteQueue.addWrite(\n this.doc._data,\n docWriteData => {\n delete docWriteData._attachments[this.id];\n return docWriteData;\n }\n ).then(() => { });\n }\n\n /**\n * returns the data for the attachment\n */\n async getData(): Promise {\n const plainDataBase64 = await this.doc.collection.storageInstance.getAttachmentData(\n this.doc.primary,\n this.id,\n this.digest\n );\n const ret = await createBlobFromBase64(\n plainDataBase64,\n this.type as any\n );\n return ret;\n }\n\n async getStringData(): Promise {\n const data = await this.getData();\n const asString = await blobToString(data);\n return asString;\n }\n}\n\nexport function fromStorageInstanceResult(\n id: string,\n attachmentData: RxAttachmentData,\n rxDocument: RxDocument\n) {\n return new RxAttachment({\n doc: rxDocument,\n id,\n type: attachmentData.type,\n length: attachmentData.length,\n digest: attachmentData.digest\n });\n}\n\n\n\nexport async function putAttachment(\n this: RxDocument,\n attachmentData: RxAttachmentCreator\n): Promise {\n ensureSchemaSupportsAttachments(this);\n\n const dataSize = getBlobSize(attachmentData.data);\n const dataString = await blobToBase64String(attachmentData.data);\n const digest = await this.collection.database.hashFunction(dataString);\n\n const id = attachmentData.id;\n const type = attachmentData.type;\n const data = dataString;\n\n return this.collection.incrementalWriteQueue.addWrite(\n this._data,\n (docWriteData: RxDocumentWriteData) => {\n docWriteData = flatClone(docWriteData);\n docWriteData._attachments = flatClone(docWriteData._attachments);\n docWriteData._attachments[id] = {\n length: dataSize,\n type,\n data,\n digest\n };\n return docWriteData;\n }).then(writeResult => {\n const newDocument = this.collection._docCache.getCachedRxDocument(writeResult);\n const attachmentDataOfId = writeResult._attachments[id];\n const attachment = fromStorageInstanceResult(\n id,\n attachmentDataOfId,\n newDocument\n );\n return attachment;\n });\n}\n\n/**\n * get an attachment of the document by its id\n */\nexport function getAttachment(\n this: RxDocument,\n id: string\n): RxAttachment | null {\n ensureSchemaSupportsAttachments(this);\n const docData: any = this._data;\n if (!docData._attachments || !docData._attachments[id])\n return null;\n\n const attachmentData = docData._attachments[id];\n const attachment = fromStorageInstanceResult(\n id,\n attachmentData,\n this\n );\n return attachment;\n}\n\n/**\n * returns all attachments of the document\n */\nexport function allAttachments(\n this: RxDocument\n): RxAttachment[] {\n ensureSchemaSupportsAttachments(this);\n const docData: any = this._data;\n\n // if there are no attachments, the field is missing\n if (!docData._attachments) {\n return [];\n }\n return Object.keys(docData._attachments)\n .map(id => {\n return fromStorageInstanceResult(\n id,\n docData._attachments[id],\n this\n );\n });\n}\n\nexport async function preMigrateDocument(\n data: {\n docData: RxDocumentData;\n oldCollection: any; // TODO\n }\n): Promise {\n const attachments = data.docData._attachments;\n if (attachments) {\n const newAttachments: { [attachmentId: string]: RxAttachmentWriteData; } = {};\n await Promise.all(\n Object.keys(attachments).map(async (attachmentId) => {\n const attachment: RxAttachmentData = attachments[attachmentId];\n const docPrimary: string = (data.docData as any)[data.oldCollection.schema.primaryPath];\n const rawAttachmentData = await data.oldCollection.storageInstance.getAttachmentData(\n docPrimary,\n attachmentId,\n attachment.digest\n );\n const digest = await data.oldCollection.database.hashFunction(rawAttachmentData);\n newAttachments[attachmentId] = {\n length: attachment.length,\n type: attachment.type,\n data: rawAttachmentData,\n digest\n };\n })\n );\n\n /**\n * Hooks mutate the input\n * instead of returning stuff\n */\n (data.docData as RxDocumentWriteData)._attachments = newAttachments;\n }\n}\n\nexport function postMigrateDocument(_action: any): Promise {\n /**\n * No longer needed because\n * we store the attachments data buffers directly in the document.\n */\n return PROMISE_RESOLVE_VOID;\n}\n\nexport const RxDBAttachmentsPlugin: RxPlugin = {\n name: 'attachments',\n rxdb: true,\n prototypes: {\n RxDocument: (proto: any) => {\n proto.putAttachment = putAttachment;\n proto.getAttachment = getAttachment;\n proto.allAttachments = allAttachments;\n Object.defineProperty(proto, 'allAttachments$', {\n get: function allAttachments$(this: RxDocument) {\n return this.$\n .pipe(\n map(rxDocument => Object.entries(\n rxDocument.toJSON(true)._attachments\n )),\n map(entries => {\n return (entries as any)\n .map(([id, attachmentData]: any) => {\n return fromStorageInstanceResult(\n id,\n attachmentData,\n this\n );\n });\n })\n );\n }\n });\n }\n },\n overwritable: {},\n hooks: {\n preMigrateDocument: {\n after: preMigrateDocument\n },\n postMigrateDocument: {\n after: postMigrateDocument\n }\n }\n};\n\n\nexport * from './attachments-utils.ts';\n"],"mappings":"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","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/cleanup/cleanup.js b/dist/esm/plugins/cleanup/cleanup.js index 806ccfc38ca..afd13e3bf77 100644 --- a/dist/esm/plugins/cleanup/cleanup.js +++ b/dist/esm/plugins/cleanup/cleanup.js @@ -1,6 +1,7 @@ import { PROMISE_RESOLVE_TRUE } from "../../plugins/utils/index.js"; import { REPLICATION_STATE_BY_COLLECTION } from "../replication/index.js"; import { DEFAULT_CLEANUP_POLICY } from "./cleanup-helper.js"; +import { runAsyncPluginHooks } from "../../hooks.js"; /** * Even on multiple databases, @@ -74,6 +75,10 @@ export async function cleanupRxCollection(rxCollection, cleanupPolicy) { }); isDone = await RXSTORAGE_CLEANUP_QUEUE; } + await runAsyncPluginHooks('postCleanup', { + collectionName: rxCollection.name, + databaseName: rxDatabase.name + }); } /** diff --git a/dist/esm/plugins/cleanup/cleanup.js.map b/dist/esm/plugins/cleanup/cleanup.js.map index 505fb318a77..7048c37a1fa 100644 --- a/dist/esm/plugins/cleanup/cleanup.js.map +++ b/dist/esm/plugins/cleanup/cleanup.js.map @@ -1 +1 @@ -{"version":3,"file":"cleanup.js","names":["PROMISE_RESOLVE_TRUE","REPLICATION_STATE_BY_COLLECTION","DEFAULT_CLEANUP_POLICY","RXSTORAGE_CLEANUP_QUEUE","startCleanupForRxCollection","rxCollection","rxDatabase","database","cleanupPolicy","Object","assign","initialCleanupWait","destroyed","cleanupRxCollection","runCleanupAfterDelete","collection","promiseWait","minimumCollectionAge","waitForLeadership","storageInstance","isDone","awaitReplicationsInSync","replicationStates","get","Promise","all","map","replicationState","isStopped","awaitInSync","then","requestIdlePromise","cleanup","minimumDeletedTime","runEach"],"sources":["../../../../src/plugins/cleanup/cleanup.ts"],"sourcesContent":["import type { RxCleanupPolicy, RxCollection } from '../../types/index.d.ts';\nimport { PROMISE_RESOLVE_TRUE } from '../../plugins/utils/index.ts';\nimport { REPLICATION_STATE_BY_COLLECTION } from '../replication/index.ts';\nimport { DEFAULT_CLEANUP_POLICY } from './cleanup-helper.ts';\n\n/**\n * Even on multiple databases,\n * the calls to RxStorage().cleanup()\n * must never run in parallel.\n * The cleanup is a background task which should\n * not affect the performance of other, more important tasks.\n */\nlet RXSTORAGE_CLEANUP_QUEUE: Promise = PROMISE_RESOLVE_TRUE;\n\nexport async function startCleanupForRxCollection(\n rxCollection: RxCollection\n) {\n const rxDatabase = rxCollection.database;\n const cleanupPolicy = Object.assign(\n {},\n DEFAULT_CLEANUP_POLICY,\n rxDatabase.cleanupPolicy ? rxDatabase.cleanupPolicy : {}\n );\n\n\n await initialCleanupWait(rxCollection, cleanupPolicy);\n if (rxCollection.destroyed) {\n return;\n }\n\n // initially cleanup the collection\n await cleanupRxCollection(rxCollection, cleanupPolicy);\n\n /**\n * Afterwards we listen to deletes\n * and only re-run the cleanup after\n * minimumDeletedTime is reached.\n */\n await runCleanupAfterDelete(rxCollection, cleanupPolicy);\n}\n\n\nexport async function initialCleanupWait(collection: RxCollection, cleanupPolicy: RxCleanupPolicy) {\n /**\n * Wait until minimumDatabaseInstanceAge is reached\n * or collection is destroyed.\n */\n await collection.promiseWait(cleanupPolicy.minimumCollectionAge);\n if (collection.destroyed) {\n return;\n }\n\n if (cleanupPolicy.waitForLeadership) {\n await collection.database.waitForLeadership();\n }\n}\n\n/**\n * Runs the cleanup for a single RxCollection\n */\nexport async function cleanupRxCollection(\n rxCollection: RxCollection,\n cleanupPolicy: RxCleanupPolicy\n) {\n const rxDatabase = rxCollection.database;\n const storageInstance = rxCollection.storageInstance;\n\n // run cleanup() until it returns true\n let isDone = false;\n while (!isDone && !rxCollection.destroyed) {\n if (cleanupPolicy.awaitReplicationsInSync) {\n const replicationStates = REPLICATION_STATE_BY_COLLECTION.get(rxCollection);\n if (replicationStates) {\n await Promise.all(\n replicationStates.map(replicationState => {\n if (!replicationState.isStopped()) {\n return replicationState.awaitInSync();\n }\n })\n );\n }\n }\n if (rxCollection.destroyed) {\n return;\n }\n RXSTORAGE_CLEANUP_QUEUE = RXSTORAGE_CLEANUP_QUEUE\n .then(async () => {\n if (rxCollection.destroyed) {\n return true;\n }\n await rxDatabase.requestIdlePromise();\n return storageInstance.cleanup(cleanupPolicy.minimumDeletedTime);\n });\n isDone = await RXSTORAGE_CLEANUP_QUEUE;\n }\n}\n\n/**\n * TODO this is not waiting for deletes!\n * it just runs on interval.\n */\nexport async function runCleanupAfterDelete(\n rxCollection: RxCollection,\n cleanupPolicy: RxCleanupPolicy\n) {\n while (!rxCollection.destroyed) {\n await rxCollection.promiseWait(cleanupPolicy.runEach);\n if (rxCollection.destroyed) {\n return;\n }\n await cleanupRxCollection(rxCollection, cleanupPolicy);\n }\n}\n"],"mappings":"AACA,SAASA,oBAAoB,QAAQ,8BAA8B;AACnE,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,sBAAsB,QAAQ,qBAAqB;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,uBAAyC,GAAGH,oBAAoB;AAEpE,OAAO,eAAeI,2BAA2BA,CAC7CC,YAA0B,EAC5B;EACE,IAAMC,UAAU,GAAGD,YAAY,CAACE,QAAQ;EACxC,IAAMC,aAAa,GAAGC,MAAM,CAACC,MAAM,CAC/B,CAAC,CAAC,EACFR,sBAAsB,EACtBI,UAAU,CAACE,aAAa,GAAGF,UAAU,CAACE,aAAa,GAAG,CAAC,CAC3D,CAAC;EAGD,MAAMG,kBAAkB,CAACN,YAAY,EAAEG,aAAa,CAAC;EACrD,IAAIH,YAAY,CAACO,SAAS,EAAE;IACxB;EACJ;;EAEA;EACA,MAAMC,mBAAmB,CAACR,YAAY,EAAEG,aAAa,CAAC;;EAEtD;AACJ;AACA;AACA;AACA;EACI,MAAMM,qBAAqB,CAACT,YAAY,EAAEG,aAAa,CAAC;AAC5D;AAGA,OAAO,eAAeG,kBAAkBA,CAACI,UAAwB,EAAEP,aAA8B,EAAE;EAC/F;AACJ;AACA;AACA;EACI,MAAMO,UAAU,CAACC,WAAW,CAACR,aAAa,CAACS,oBAAoB,CAAC;EAChE,IAAIF,UAAU,CAACH,SAAS,EAAE;IACtB;EACJ;EAEA,IAAIJ,aAAa,CAACU,iBAAiB,EAAE;IACjC,MAAMH,UAAU,CAACR,QAAQ,CAACW,iBAAiB,CAAC,CAAC;EACjD;AACJ;;AAEA;AACA;AACA;AACA,OAAO,eAAeL,mBAAmBA,CACrCR,YAA0B,EAC1BG,aAA8B,EAChC;EACE,IAAMF,UAAU,GAAGD,YAAY,CAACE,QAAQ;EACxC,IAAMY,eAAe,GAAGd,YAAY,CAACc,eAAe;;EAEpD;EACA,IAAIC,MAAM,GAAG,KAAK;EAClB,OAAO,CAACA,MAAM,IAAI,CAACf,YAAY,CAACO,SAAS,EAAE;IACvC,IAAIJ,aAAa,CAACa,uBAAuB,EAAE;MACvC,IAAMC,iBAAiB,GAAGrB,+BAA+B,CAACsB,GAAG,CAAClB,YAAY,CAAC;MAC3E,IAAIiB,iBAAiB,EAAE;QACnB,MAAME,OAAO,CAACC,GAAG,CACbH,iBAAiB,CAACI,GAAG,CAACC,gBAAgB,IAAI;UACtC,IAAI,CAACA,gBAAgB,CAACC,SAAS,CAAC,CAAC,EAAE;YAC/B,OAAOD,gBAAgB,CAACE,WAAW,CAAC,CAAC;UACzC;QACJ,CAAC,CACL,CAAC;MACL;IACJ;IACA,IAAIxB,YAAY,CAACO,SAAS,EAAE;MACxB;IACJ;IACAT,uBAAuB,GAAGA,uBAAuB,CAC5C2B,IAAI,CAAC,YAAY;MACd,IAAIzB,YAAY,CAACO,SAAS,EAAE;QACxB,OAAO,IAAI;MACf;MACA,MAAMN,UAAU,CAACyB,kBAAkB,CAAC,CAAC;MACrC,OAAOZ,eAAe,CAACa,OAAO,CAACxB,aAAa,CAACyB,kBAAkB,CAAC;IACpE,CAAC,CAAC;IACNb,MAAM,GAAG,MAAMjB,uBAAuB;EAC1C;AACJ;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAeW,qBAAqBA,CACvCT,YAA0B,EAC1BG,aAA8B,EAChC;EACE,OAAO,CAACH,YAAY,CAACO,SAAS,EAAE;IAC5B,MAAMP,YAAY,CAACW,WAAW,CAACR,aAAa,CAAC0B,OAAO,CAAC;IACrD,IAAI7B,YAAY,CAACO,SAAS,EAAE;MACxB;IACJ;IACA,MAAMC,mBAAmB,CAACR,YAAY,EAAEG,aAAa,CAAC;EAC1D;AACJ","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"cleanup.js","names":["PROMISE_RESOLVE_TRUE","REPLICATION_STATE_BY_COLLECTION","DEFAULT_CLEANUP_POLICY","runAsyncPluginHooks","RXSTORAGE_CLEANUP_QUEUE","startCleanupForRxCollection","rxCollection","rxDatabase","database","cleanupPolicy","Object","assign","initialCleanupWait","destroyed","cleanupRxCollection","runCleanupAfterDelete","collection","promiseWait","minimumCollectionAge","waitForLeadership","storageInstance","isDone","awaitReplicationsInSync","replicationStates","get","Promise","all","map","replicationState","isStopped","awaitInSync","then","requestIdlePromise","cleanup","minimumDeletedTime","collectionName","name","databaseName","runEach"],"sources":["../../../../src/plugins/cleanup/cleanup.ts"],"sourcesContent":["import type { RxCleanupPolicy, RxCollection } from '../../types/index.d.ts';\nimport { PROMISE_RESOLVE_TRUE } from '../../plugins/utils/index.ts';\nimport { REPLICATION_STATE_BY_COLLECTION } from '../replication/index.ts';\nimport { DEFAULT_CLEANUP_POLICY } from './cleanup-helper.ts';\nimport { runAsyncPluginHooks } from '../../hooks.ts';\n\n/**\n * Even on multiple databases,\n * the calls to RxStorage().cleanup()\n * must never run in parallel.\n * The cleanup is a background task which should\n * not affect the performance of other, more important tasks.\n */\nlet RXSTORAGE_CLEANUP_QUEUE: Promise = PROMISE_RESOLVE_TRUE;\n\nexport async function startCleanupForRxCollection(\n rxCollection: RxCollection\n) {\n const rxDatabase = rxCollection.database;\n const cleanupPolicy = Object.assign(\n {},\n DEFAULT_CLEANUP_POLICY,\n rxDatabase.cleanupPolicy ? rxDatabase.cleanupPolicy : {}\n );\n\n\n await initialCleanupWait(rxCollection, cleanupPolicy);\n if (rxCollection.destroyed) {\n return;\n }\n\n // initially cleanup the collection\n await cleanupRxCollection(rxCollection, cleanupPolicy);\n\n /**\n * Afterwards we listen to deletes\n * and only re-run the cleanup after\n * minimumDeletedTime is reached.\n */\n await runCleanupAfterDelete(rxCollection, cleanupPolicy);\n}\n\n\nexport async function initialCleanupWait(collection: RxCollection, cleanupPolicy: RxCleanupPolicy) {\n /**\n * Wait until minimumDatabaseInstanceAge is reached\n * or collection is destroyed.\n */\n await collection.promiseWait(cleanupPolicy.minimumCollectionAge);\n if (collection.destroyed) {\n return;\n }\n\n if (cleanupPolicy.waitForLeadership) {\n await collection.database.waitForLeadership();\n }\n}\n\n/**\n * Runs the cleanup for a single RxCollection\n */\nexport async function cleanupRxCollection(\n rxCollection: RxCollection,\n cleanupPolicy: RxCleanupPolicy\n) {\n const rxDatabase = rxCollection.database;\n const storageInstance = rxCollection.storageInstance;\n\n // run cleanup() until it returns true\n let isDone = false;\n while (!isDone && !rxCollection.destroyed) {\n if (cleanupPolicy.awaitReplicationsInSync) {\n const replicationStates = REPLICATION_STATE_BY_COLLECTION.get(rxCollection);\n if (replicationStates) {\n await Promise.all(\n replicationStates.map(replicationState => {\n if (!replicationState.isStopped()) {\n return replicationState.awaitInSync();\n }\n })\n );\n }\n }\n if (rxCollection.destroyed) {\n return;\n }\n RXSTORAGE_CLEANUP_QUEUE = RXSTORAGE_CLEANUP_QUEUE\n .then(async () => {\n if (rxCollection.destroyed) {\n return true;\n }\n await rxDatabase.requestIdlePromise();\n return storageInstance.cleanup(cleanupPolicy.minimumDeletedTime);\n });\n isDone = await RXSTORAGE_CLEANUP_QUEUE;\n }\n\n await runAsyncPluginHooks('postCleanup', {\n collectionName: rxCollection.name,\n databaseName: rxDatabase.name\n });\n}\n\n/**\n * TODO this is not waiting for deletes!\n * it just runs on interval.\n */\nexport async function runCleanupAfterDelete(\n rxCollection: RxCollection,\n cleanupPolicy: RxCleanupPolicy\n) {\n while (!rxCollection.destroyed) {\n await rxCollection.promiseWait(cleanupPolicy.runEach);\n if (rxCollection.destroyed) {\n return;\n }\n await cleanupRxCollection(rxCollection, cleanupPolicy);\n }\n}\n"],"mappings":"AACA,SAASA,oBAAoB,QAAQ,8BAA8B;AACnE,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,mBAAmB,QAAQ,gBAAgB;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,uBAAyC,GAAGJ,oBAAoB;AAEpE,OAAO,eAAeK,2BAA2BA,CAC7CC,YAA0B,EAC5B;EACE,IAAMC,UAAU,GAAGD,YAAY,CAACE,QAAQ;EACxC,IAAMC,aAAa,GAAGC,MAAM,CAACC,MAAM,CAC/B,CAAC,CAAC,EACFT,sBAAsB,EACtBK,UAAU,CAACE,aAAa,GAAGF,UAAU,CAACE,aAAa,GAAG,CAAC,CAC3D,CAAC;EAGD,MAAMG,kBAAkB,CAACN,YAAY,EAAEG,aAAa,CAAC;EACrD,IAAIH,YAAY,CAACO,SAAS,EAAE;IACxB;EACJ;;EAEA;EACA,MAAMC,mBAAmB,CAACR,YAAY,EAAEG,aAAa,CAAC;;EAEtD;AACJ;AACA;AACA;AACA;EACI,MAAMM,qBAAqB,CAACT,YAAY,EAAEG,aAAa,CAAC;AAC5D;AAGA,OAAO,eAAeG,kBAAkBA,CAACI,UAAwB,EAAEP,aAA8B,EAAE;EAC/F;AACJ;AACA;AACA;EACI,MAAMO,UAAU,CAACC,WAAW,CAACR,aAAa,CAACS,oBAAoB,CAAC;EAChE,IAAIF,UAAU,CAACH,SAAS,EAAE;IACtB;EACJ;EAEA,IAAIJ,aAAa,CAACU,iBAAiB,EAAE;IACjC,MAAMH,UAAU,CAACR,QAAQ,CAACW,iBAAiB,CAAC,CAAC;EACjD;AACJ;;AAEA;AACA;AACA;AACA,OAAO,eAAeL,mBAAmBA,CACrCR,YAA0B,EAC1BG,aAA8B,EAChC;EACE,IAAMF,UAAU,GAAGD,YAAY,CAACE,QAAQ;EACxC,IAAMY,eAAe,GAAGd,YAAY,CAACc,eAAe;;EAEpD;EACA,IAAIC,MAAM,GAAG,KAAK;EAClB,OAAO,CAACA,MAAM,IAAI,CAACf,YAAY,CAACO,SAAS,EAAE;IACvC,IAAIJ,aAAa,CAACa,uBAAuB,EAAE;MACvC,IAAMC,iBAAiB,GAAGtB,+BAA+B,CAACuB,GAAG,CAAClB,YAAY,CAAC;MAC3E,IAAIiB,iBAAiB,EAAE;QACnB,MAAME,OAAO,CAACC,GAAG,CACbH,iBAAiB,CAACI,GAAG,CAACC,gBAAgB,IAAI;UACtC,IAAI,CAACA,gBAAgB,CAACC,SAAS,CAAC,CAAC,EAAE;YAC/B,OAAOD,gBAAgB,CAACE,WAAW,CAAC,CAAC;UACzC;QACJ,CAAC,CACL,CAAC;MACL;IACJ;IACA,IAAIxB,YAAY,CAACO,SAAS,EAAE;MACxB;IACJ;IACAT,uBAAuB,GAAGA,uBAAuB,CAC5C2B,IAAI,CAAC,YAAY;MACd,IAAIzB,YAAY,CAACO,SAAS,EAAE;QACxB,OAAO,IAAI;MACf;MACA,MAAMN,UAAU,CAACyB,kBAAkB,CAAC,CAAC;MACrC,OAAOZ,eAAe,CAACa,OAAO,CAACxB,aAAa,CAACyB,kBAAkB,CAAC;IACpE,CAAC,CAAC;IACNb,MAAM,GAAG,MAAMjB,uBAAuB;EAC1C;EAEA,MAAMD,mBAAmB,CAAC,aAAa,EAAE;IACrCgC,cAAc,EAAE7B,YAAY,CAAC8B,IAAI;IACjCC,YAAY,EAAE9B,UAAU,CAAC6B;EAC7B,CAAC,CAAC;AACN;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAerB,qBAAqBA,CACvCT,YAA0B,EAC1BG,aAA8B,EAChC;EACE,OAAO,CAACH,YAAY,CAACO,SAAS,EAAE;IAC5B,MAAMP,YAAY,CAACW,WAAW,CAACR,aAAa,CAAC6B,OAAO,CAAC;IACrD,IAAIhC,YAAY,CAACO,SAAS,EAAE;MACxB;IACJ;IACA,MAAMC,mBAAmB,CAACR,YAAY,EAAEG,aAAa,CAAC;EAC1D;AACJ","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/plugins/dev-mode/dev-mode-tracking.js b/dist/esm/plugins/dev-mode/dev-mode-tracking.js index 55db000dd58..f8dcb765865 100644 --- a/dist/esm/plugins/dev-mode/dev-mode-tracking.js +++ b/dist/esm/plugins/dev-mode/dev-mode-tracking.js @@ -1,4 +1,3 @@ -import { isRxDatabaseFirstTimeInstantiated } from "../../rx-database.js"; import { PREMIUM_FLAG_HASH, RXDB_UTILS_GLOBAL, RXDB_VERSION, defaultHashSha256 } from "../utils/index.js"; var iframeShown = false; @@ -10,7 +9,9 @@ export async function addDevModeTrackingIframe(db) { * Only run this in browser AND localhost AND dev-mode. * Make sure this is never used in production by someone. */ - if (iframeShown || typeof window === 'undefined' || typeof location === 'undefined' || !isLocalHost()) { + if (iframeShown || typeof window === 'undefined' || typeof location === 'undefined' + // !isLocalHost() + ) { return; } @@ -18,12 +19,6 @@ export async function addDevModeTrackingIframe(db) { if (RXDB_UTILS_GLOBAL.premium && typeof RXDB_UTILS_GLOBAL.premium === 'string' && (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium)) === PREMIUM_FLAG_HASH) { return; } - - // Only run if db was created for the first time. - var isFirstTime = await isRxDatabaseFirstTimeInstantiated(db); - if (!isFirstTime) { - return; - } iframeShown = true; var iframe = document.createElement('iframe'); iframe.style.display = 'none'; @@ -31,7 +26,7 @@ export async function addDevModeTrackingIframe(db) { document.body.appendChild(iframe); } function isLocalHost() { - return location.hostname === 'localhost' || location.hostname === '127.0.0.1' || location.hostname === '0.0.0.0' || location.hostname === '[::1]' // IPv6 + return location.hostname === 'localhost' || location.hostname.includes('localhost') || location.hostname === '127.0.0.1' || location.hostname === '0.0.0.0' || location.hostname === '[::1]' // IPv6 ; } //# sourceMappingURL=dev-mode-tracking.js.map \ No newline at end of file diff --git a/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map b/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map index ce7c0b252aa..e2beef3c76e 100644 --- a/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map +++ b/dist/esm/plugins/dev-mode/dev-mode-tracking.js.map @@ -1 +1 @@ -{"version":3,"file":"dev-mode-tracking.js","names":["isRxDatabaseFirstTimeInstantiated","PREMIUM_FLAG_HASH","RXDB_UTILS_GLOBAL","RXDB_VERSION","defaultHashSha256","iframeShown","addDevModeTrackingIframe","db","window","location","isLocalHost","premium","isFirstTime","iframe","document","createElement","style","display","src","body","appendChild","hostname"],"sources":["../../../../src/plugins/dev-mode/dev-mode-tracking.ts"],"sourcesContent":["import { isRxDatabaseFirstTimeInstantiated } from '../../rx-database.ts';\nimport type { RxDatabase } from '../../types';\nimport {\n PREMIUM_FLAG_HASH,\n RXDB_UTILS_GLOBAL,\n RXDB_VERSION,\n defaultHashSha256\n} from '../utils/index.ts';\n\n\nlet iframeShown = false;\n\n\n/**\n * Adds an iframe to track the results of marketing efforts.\n */\nexport async function addDevModeTrackingIframe(db: RxDatabase) {\n /**\n * Only run this in browser AND localhost AND dev-mode.\n * Make sure this is never used in production by someone.\n */\n if (\n iframeShown ||\n typeof window === 'undefined' ||\n typeof location === 'undefined' ||\n !isLocalHost()\n ) {\n return;\n }\n\n\n // do not show if premium flag is set.\n if (\n RXDB_UTILS_GLOBAL.premium &&\n typeof RXDB_UTILS_GLOBAL.premium === 'string' &&\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) === PREMIUM_FLAG_HASH)\n ) {\n return;\n }\n\n\n // Only run if db was created for the first time.\n const isFirstTime = await isRxDatabaseFirstTimeInstantiated(db);\n if (!isFirstTime) {\n return;\n }\n\n iframeShown = true;\n\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = 'https://rxdb.info/html/dev-mode-iframe.html?version=' + RXDB_VERSION;\n document.body.appendChild(iframe);\n}\n\n\nfunction isLocalHost() {\n return (\n location.hostname === 'localhost' ||\n location.hostname === '127.0.0.1' ||\n location.hostname === '0.0.0.0' ||\n location.hostname === '[::1]' // IPv6\n );\n}\n"],"mappings":"AAAA,SAASA,iCAAiC,QAAQ,sBAAsB;AAExE,SACIC,iBAAiB,EACjBC,iBAAiB,EACjBC,YAAY,EACZC,iBAAiB,QACd,mBAAmB;AAG1B,IAAIC,WAAW,GAAG,KAAK;;AAGvB;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAACC,EAAc,EAAE;EAC3D;AACJ;AACA;AACA;EACI,IACIF,WAAW,IACX,OAAOG,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK,WAAW,IAC/B,CAACC,WAAW,CAAC,CAAC,EAChB;IACE;EACJ;;EAGA;EACA,IACIR,iBAAiB,CAACS,OAAO,IACzB,OAAOT,iBAAiB,CAACS,OAAO,KAAK,QAAQ,IAC5C,OAAMP,iBAAiB,CAACF,iBAAiB,CAACS,OAAO,CAAC,MAAKV,iBAAkB,EAC5E;IACE;EACJ;;EAGA;EACA,IAAMW,WAAW,GAAG,MAAMZ,iCAAiC,CAACO,EAAE,CAAC;EAC/D,IAAI,CAACK,WAAW,EAAE;IACd;EACJ;EAEAP,WAAW,GAAG,IAAI;EAElB,IAAMQ,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/CF,MAAM,CAACG,KAAK,CAACC,OAAO,GAAG,MAAM;EAC7BJ,MAAM,CAACK,GAAG,GAAG,sDAAsD,GAAGf,YAAY;EAClFW,QAAQ,CAACK,IAAI,CAACC,WAAW,CAACP,MAAM,CAAC;AACrC;AAGA,SAASH,WAAWA,CAAA,EAAG;EACnB,OACID,QAAQ,CAACY,QAAQ,KAAK,WAAW,IACjCZ,QAAQ,CAACY,QAAQ,KAAK,WAAW,IACjCZ,QAAQ,CAACY,QAAQ,KAAK,SAAS,IAC/BZ,QAAQ,CAACY,QAAQ,KAAK,OAAO,CAAE;EAAA;AAEvC","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"dev-mode-tracking.js","names":["PREMIUM_FLAG_HASH","RXDB_UTILS_GLOBAL","RXDB_VERSION","defaultHashSha256","iframeShown","addDevModeTrackingIframe","db","window","location","premium","iframe","document","createElement","style","display","src","body","appendChild","isLocalHost","hostname","includes"],"sources":["../../../../src/plugins/dev-mode/dev-mode-tracking.ts"],"sourcesContent":["import type { RxDatabase } from '../../types';\nimport {\n PREMIUM_FLAG_HASH,\n RXDB_UTILS_GLOBAL,\n RXDB_VERSION,\n defaultHashSha256\n} from '../utils/index.ts';\n\n\nlet iframeShown = false;\n\n\n/**\n * Adds an iframe to track the results of marketing efforts.\n */\nexport async function addDevModeTrackingIframe(db: RxDatabase) {\n /**\n * Only run this in browser AND localhost AND dev-mode.\n * Make sure this is never used in production by someone.\n */\n if (\n iframeShown ||\n typeof window === 'undefined' ||\n typeof location === 'undefined'\n // !isLocalHost()\n ) {\n return;\n }\n\n\n // do not show if premium flag is set.\n if (\n RXDB_UTILS_GLOBAL.premium &&\n typeof RXDB_UTILS_GLOBAL.premium === 'string' &&\n (await defaultHashSha256(RXDB_UTILS_GLOBAL.premium) === PREMIUM_FLAG_HASH)\n ) {\n return;\n }\n\n iframeShown = true;\n\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = 'https://rxdb.info/html/dev-mode-iframe.html?version=' + RXDB_VERSION;\n document.body.appendChild(iframe);\n}\n\n\nfunction isLocalHost() {\n return (\n location.hostname === 'localhost' ||\n location.hostname.includes('localhost') ||\n location.hostname === '127.0.0.1' ||\n location.hostname === '0.0.0.0' ||\n location.hostname === '[::1]' // IPv6\n );\n}\n"],"mappings":"AACA,SACIA,iBAAiB,EACjBC,iBAAiB,EACjBC,YAAY,EACZC,iBAAiB,QACd,mBAAmB;AAG1B,IAAIC,WAAW,GAAG,KAAK;;AAGvB;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAACC,EAAc,EAAE;EAC3D;AACJ;AACA;AACA;EACI,IACIF,WAAW,IACX,OAAOG,MAAM,KAAK,WAAW,IAC7B,OAAOC,QAAQ,KAAK;EACpB;EAAA,EACF;IACE;EACJ;;EAGA;EACA,IACIP,iBAAiB,CAACQ,OAAO,IACzB,OAAOR,iBAAiB,CAACQ,OAAO,KAAK,QAAQ,IAC5C,OAAMN,iBAAiB,CAACF,iBAAiB,CAACQ,OAAO,CAAC,MAAKT,iBAAkB,EAC5E;IACE;EACJ;EAEAI,WAAW,GAAG,IAAI;EAElB,IAAMM,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/CF,MAAM,CAACG,KAAK,CAACC,OAAO,GAAG,MAAM;EAC7BJ,MAAM,CAACK,GAAG,GAAG,sDAAsD,GAAGb,YAAY;EAClFS,QAAQ,CAACK,IAAI,CAACC,WAAW,CAACP,MAAM,CAAC;AACrC;AAGA,SAASQ,WAAWA,CAAA,EAAG;EACnB,OACIV,QAAQ,CAACW,QAAQ,KAAK,WAAW,IACjCX,QAAQ,CAACW,QAAQ,CAACC,QAAQ,CAAC,WAAW,CAAC,IACvCZ,QAAQ,CAACW,QAAQ,KAAK,WAAW,IACjCX,QAAQ,CAACW,QAAQ,KAAK,SAAS,IAC/BX,QAAQ,CAACW,QAAQ,KAAK,OAAO,CAAE;EAAA;AAEvC","ignoreList":[]} \ 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 8ce4b58134f..df13c3dc3bd 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.31.0'; +export var RXDB_VERSION = '15.31.1'; //# 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 b20a2ae8e43..898d7c69f0a 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.31.0';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,IAAMA,YAAY,GAAG,SAAS","ignoreList":[]} \ 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.31.1';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,IAAMA,YAAY,GAAG,SAAS","ignoreList":[]} \ No newline at end of file diff --git a/dist/esm/types/rx-plugin.d.js.map b/dist/esm/types/rx-plugin.d.js.map index 1625b7a7238..2002aa427e0 100644 --- a/dist/esm/types/rx-plugin.d.js.map +++ b/dist/esm/types/rx-plugin.d.js.map @@ -1 +1 @@ -{"version":3,"file":"rx-plugin.d.js","names":[],"sources":["../../../src/types/rx-plugin.d.ts"],"sourcesContent":["import type {\n RxQuery,\n RxQueryOP,\n MangoQuery\n} from './rx-query.d.ts';\nimport type {\n RxCollection,\n RxCollectionCreator\n} from './rx-collection.d.ts';\nimport type {\n RxStorageInstanceCreationParams\n} from './rx-storage.d.ts';\nimport type {\n DeepReadonly,\n FilledMangoQuery,\n RxDatabase,\n RxDatabaseCreator,\n RxDocument,\n RxStorage,\n RxReplicationWriteToMasterRow,\n WithDeleted,\n RxState,\n BulkWriteRow,\n RxStorageInstance\n} from './index.d.ts';\nimport type { RxSchema } from '../rx-schema.d.ts';\n\nexport type RxPluginPreCreateRxQueryArgs = {\n op: RxQueryOP;\n queryObj: MangoQuery;\n collection: RxCollection;\n};\n\nexport type RxPluginPreAddRxPluginArgs = {\n // the plugin that is getting added\n plugin: RxPlugin | any;\n // previous added plugins\n plugins: Set;\n};\n\nexport type RxPluginPrePrepareQueryArgs = {\n rxQuery: RxQuery;\n mangoQuery: FilledMangoQuery;\n};\n\n\n/**\n * Depending on which plugins are used together,\n * it is important that the plugin is able to define if\n * the hooks must be added as first or as last array item.\n * For example the encryption plugin must run encryption\n * before the key-compression changes the fieldnames.\n */\nexport type RxPluginHooks = {\n /**\n * Hook function that is added as first.\n */\n before?: (i: Input) => void;\n /**\n * Hook function that is added as last.\n */\n after?: (i: Input) => void;\n};\n\nexport interface RxPlugin {\n /**\n * A string to uniquely identifies the plugin.\n * Can be used to throw when different versions of the same plugin are used.\n * And also other checks.\n * Use kebab-case.\n */\n readonly name: string;\n\n /**\n * set this to true so RxDB\n * knows that this object in a rxdb plugin\n */\n readonly rxdb: true;\n\n /**\n * Init function where dependent plugins could be added.\n * (optional)\n */\n init?(): any;\n\n prototypes?: {\n RxSchema?: (proto: RxSchema) => void;\n RxDocument?: (proto: RxDocument) => void;\n RxQuery?: (proto: RxQuery) => void;\n RxCollection?: (proto: RxCollection) => void;\n RxDatabase?: (proto: RxDatabase) => void;\n };\n overwritable?: {\n isDevMode?: () => boolean;\n deepFreezeWhenDevMode?: (obj: T) => DeepReadonly;\n validatePassword?: Function;\n checkAdapter?: Function;\n tunnelErrorMessage?: Function;\n };\n hooks?: {\n preAddRxPlugin?: RxPluginHooks;\n preCreateRxDatabase?: RxPluginHooks;\n createRxDatabase?: RxPluginHooks<{\n database: RxDatabase;\n creator: RxDatabaseCreator;\n }>;\n preDestroyRxDatabase?: RxPluginHooks;\n postRemoveRxDatabase?: RxPluginHooks<{\n databaseName: string;\n storage: RxStorage;\n }>;\n createRxCollection?: RxPluginHooks<{\n collection: RxCollection;\n creator: RxCollectionCreator;\n }>;\n createRxState?: RxPluginHooks<{\n collection: RxCollection;\n state: RxState;\n }>;\n preCreateRxCollection?: RxPluginHooks & {\n name: string;\n database: RxDatabase;\n }>;\n postDestroyRxCollection?: RxPluginHooks;\n postRemoveRxCollection?: RxPluginHooks<{\n storage: RxStorage;\n databaseName: string;\n collectionName: string;\n }>;\n preCreateRxSchema?: RxPluginHooks;\n createRxSchema?: RxPluginHooks;\n preCreateRxQuery?: RxPluginHooks;\n prePrepareQuery?: RxPluginHooks;\n createRxQuery?: RxPluginHooks;\n createRxDocument?: RxPluginHooks;\n postCreateRxDocument?: RxPluginHooks;\n preCreateRxStorageInstance?: RxPluginHooks>;\n /**\n * Runs before a write to the storage instance of a RxCollection or RxDatabase.\n */\n preStorageWrite?: RxPluginHooks<{\n storageInstance: RxStorageInstance;\n rows: BulkWriteRow[];\n }>;\n preMigrateDocument?: RxPluginHooks;\n postMigrateDocument?: RxPluginHooks;\n preReplicationMasterWrite?: RxPluginHooks<{\n rows: RxReplicationWriteToMasterRow[];\n collection: RxCollection;\n }>;\n preReplicationMasterWriteDocumentsHandle?: RxPluginHooks<{\n result: WithDeleted[];\n collection: RxCollection;\n }>;\n };\n}\n"],"mappings":"","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"rx-plugin.d.js","names":[],"sources":["../../../src/types/rx-plugin.d.ts"],"sourcesContent":["import type {\n RxQuery,\n RxQueryOP,\n MangoQuery\n} from './rx-query.d.ts';\nimport type {\n RxCollection,\n RxCollectionCreator\n} from './rx-collection.d.ts';\nimport type {\n RxStorageInstanceCreationParams\n} from './rx-storage.d.ts';\nimport type {\n DeepReadonly,\n FilledMangoQuery,\n RxDatabase,\n RxDatabaseCreator,\n RxDocument,\n RxStorage,\n RxReplicationWriteToMasterRow,\n WithDeleted,\n RxState,\n BulkWriteRow,\n RxStorageInstance\n} from './index.d.ts';\nimport type { RxSchema } from '../rx-schema.d.ts';\n\nexport type RxPluginPreCreateRxQueryArgs = {\n op: RxQueryOP;\n queryObj: MangoQuery;\n collection: RxCollection;\n};\n\nexport type RxPluginPreAddRxPluginArgs = {\n // the plugin that is getting added\n plugin: RxPlugin | any;\n // previous added plugins\n plugins: Set;\n};\n\nexport type RxPluginPrePrepareQueryArgs = {\n rxQuery: RxQuery;\n mangoQuery: FilledMangoQuery;\n};\n\n\n/**\n * Depending on which plugins are used together,\n * it is important that the plugin is able to define if\n * the hooks must be added as first or as last array item.\n * For example the encryption plugin must run encryption\n * before the key-compression changes the fieldnames.\n */\nexport type RxPluginHooks = {\n /**\n * Hook function that is added as first.\n */\n before?: (i: Input) => void;\n /**\n * Hook function that is added as last.\n */\n after?: (i: Input) => void;\n};\n\nexport interface RxPlugin {\n /**\n * A string to uniquely identifies the plugin.\n * Can be used to throw when different versions of the same plugin are used.\n * And also other checks.\n * Use kebab-case.\n */\n readonly name: string;\n\n /**\n * set this to true so RxDB\n * knows that this object in a rxdb plugin\n */\n readonly rxdb: true;\n\n /**\n * Init function where dependent plugins could be added.\n * (optional)\n */\n init?(): any;\n\n prototypes?: {\n RxSchema?: (proto: RxSchema) => void;\n RxDocument?: (proto: RxDocument) => void;\n RxQuery?: (proto: RxQuery) => void;\n RxCollection?: (proto: RxCollection) => void;\n RxDatabase?: (proto: RxDatabase) => void;\n };\n overwritable?: {\n isDevMode?: () => boolean;\n deepFreezeWhenDevMode?: (obj: T) => DeepReadonly;\n validatePassword?: Function;\n checkAdapter?: Function;\n tunnelErrorMessage?: Function;\n };\n hooks?: {\n preAddRxPlugin?: RxPluginHooks;\n preCreateRxDatabase?: RxPluginHooks;\n createRxDatabase?: RxPluginHooks<{\n database: RxDatabase;\n creator: RxDatabaseCreator;\n }>;\n preDestroyRxDatabase?: RxPluginHooks;\n postRemoveRxDatabase?: RxPluginHooks<{\n databaseName: string;\n storage: RxStorage;\n }>;\n createRxCollection?: RxPluginHooks<{\n collection: RxCollection;\n creator: RxCollectionCreator;\n }>;\n createRxState?: RxPluginHooks<{\n collection: RxCollection;\n state: RxState;\n }>;\n preCreateRxCollection?: RxPluginHooks & {\n name: string;\n database: RxDatabase;\n }>;\n postDestroyRxCollection?: RxPluginHooks;\n postRemoveRxCollection?: RxPluginHooks<{\n storage: RxStorage;\n databaseName: string;\n collectionName: string;\n }>;\n preCreateRxSchema?: RxPluginHooks;\n createRxSchema?: RxPluginHooks;\n preCreateRxQuery?: RxPluginHooks;\n prePrepareQuery?: RxPluginHooks;\n createRxQuery?: RxPluginHooks;\n createRxDocument?: RxPluginHooks;\n postCreateRxDocument?: RxPluginHooks;\n preCreateRxStorageInstance?: RxPluginHooks>;\n /**\n * Runs before a write to the storage instance of a RxCollection or RxDatabase.\n */\n preStorageWrite?: RxPluginHooks<{\n storageInstance: RxStorageInstance;\n rows: BulkWriteRow[];\n }>;\n preMigrateDocument?: RxPluginHooks;\n postMigrateDocument?: RxPluginHooks;\n postCleanup?: RxPluginHooks<{\n databaseName: string;\n collectionName: string;\n }>;\n preReplicationMasterWrite?: RxPluginHooks<{\n rows: RxReplicationWriteToMasterRow[];\n collection: RxCollection;\n }>;\n preReplicationMasterWriteDocumentsHandle?: RxPluginHooks<{\n result: WithDeleted[];\n collection: RxCollection;\n }>;\n };\n}\n"],"mappings":"","ignoreList":[]} \ 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 36f2854f928..2be05363795 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.31.0"; + readonly rxdbVersion = "15.31.1"; 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 e0edceeee91..50784f32357 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.31.0"; + readonly rxdbVersion = "15.31.1"; 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 236965132f0..8414b79eaa3 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.31.0"; + readonly rxdbVersion = "15.31.1"; /** * 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 811b782f2c7..df1d7cacb1c 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.31.0"; + readonly rxdbVersion = "15.31.1"; 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 00e82268da9..872653b9b27 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.31.0"; + readonly rxdbVersion = "15.31.1"; private seed; private lastRequestId; messageChannelIfOneMode?: Promise; diff --git a/dist/types/plugins/utils/utils-rxdb-version.d.ts b/dist/types/plugins/utils/utils-rxdb-version.d.ts index 632d9a78638..502335f6e91 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.31.0"; +export declare const RXDB_VERSION = "15.31.1"; diff --git a/dist/types/rx-database.d.ts b/dist/types/rx-database.d.ts index 4bce4bee7fb..52941df36a5 100644 --- a/dist/types/rx-database.d.ts +++ b/dist/types/rx-database.d.ts @@ -29,7 +29,7 @@ export declare class RxDatabaseBase | undefined; readonly idleQueue: IdleQueue; - readonly rxdbVersion = "15.31.0"; + readonly rxdbVersion = "15.31.1"; /** * Contains all known non-closed storage instances * that belong to this database. diff --git a/dist/types/types/rx-plugin.d.ts b/dist/types/types/rx-plugin.d.ts index d6c3fcce5ae..36213a0f976 100644 --- a/dist/types/types/rx-plugin.d.ts +++ b/dist/types/types/rx-plugin.d.ts @@ -144,6 +144,10 @@ export interface RxPlugin { }>; preMigrateDocument?: RxPluginHooks; postMigrateDocument?: RxPluginHooks; + postCleanup?: RxPluginHooks<{ + databaseName: string; + collectionName: string; + }>; preReplicationMasterWrite?: RxPluginHooks<{ rows: RxReplicationWriteToMasterRow[]; collection: RxCollection; diff --git a/docs/404.html b/docs/404.html index 710c80b5af4..83b5b672e1b 100644 --- a/docs/404.html +++ b/docs/404.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/adapters.html b/docs/adapters.html index a6cf42a73ba..699115e3e71 100644 --- a/docs/adapters.html +++ b/docs/adapters.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/alternatives.html b/docs/alternatives.html index 0e927ae3d5e..ba343739112 100644 --- a/docs/alternatives.html +++ b/docs/alternatives.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/angular-database.html b/docs/articles/angular-database.html index cc082c9d475..9619ebca37e 100644 --- a/docs/articles/angular-database.html +++ b/docs/articles/angular-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/browser-database.html b/docs/articles/browser-database.html index 1d32dc74511..4dfee3d030d 100644 --- a/docs/articles/browser-database.html +++ b/docs/articles/browser-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/browser-storage.html b/docs/articles/browser-storage.html index 2bb79745790..beab84632b3 100644 --- a/docs/articles/browser-storage.html +++ b/docs/articles/browser-storage.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/data-base.html b/docs/articles/data-base.html index 573ff645128..12cf7bea642 100644 --- a/docs/articles/data-base.html +++ b/docs/articles/data-base.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/embedded-database.html b/docs/articles/embedded-database.html index 5edbf5829c2..6894e41d72f 100644 --- a/docs/articles/embedded-database.html +++ b/docs/articles/embedded-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/flutter-database.html b/docs/articles/flutter-database.html index 65a81c9a46b..182796d5ed8 100644 --- a/docs/articles/flutter-database.html +++ b/docs/articles/flutter-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/frontend-database.html b/docs/articles/frontend-database.html index 9a25050f0c8..358f61ab4d2 100644 --- a/docs/articles/frontend-database.html +++ b/docs/articles/frontend-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/in-memory-nosql-database.html b/docs/articles/in-memory-nosql-database.html index 47dad97463b..d918e45dfcf 100644 --- a/docs/articles/in-memory-nosql-database.html +++ b/docs/articles/in-memory-nosql-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/ionic-database.html b/docs/articles/ionic-database.html index f7c5b58452f..67cb0153b69 100644 --- a/docs/articles/ionic-database.html +++ b/docs/articles/ionic-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/json-database.html b/docs/articles/json-database.html index f335bd44a55..68aa224bf84 100644 --- a/docs/articles/json-database.html +++ b/docs/articles/json-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm/index.html b/docs/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm/index.html index f173eca9dd8..3e64b26e2a2 100644 --- a/docs/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm/index.html +++ b/docs/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm/index.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/localstorage.html b/docs/articles/localstorage.html index a42bad62d92..c7dca8452a1 100644 --- a/docs/articles/localstorage.html +++ b/docs/articles/localstorage.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/mobile-database.html b/docs/articles/mobile-database.html index 6d40109c924..14b798f52df 100644 --- a/docs/articles/mobile-database.html +++ b/docs/articles/mobile-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/progressive-web-app-database.html b/docs/articles/progressive-web-app-database.html index 9e21d2ed959..a297a513e0e 100644 --- a/docs/articles/progressive-web-app-database.html +++ b/docs/articles/progressive-web-app-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/react-database.html b/docs/articles/react-database.html index b20b08304cb..ca835cf0d23 100644 --- a/docs/articles/react-database.html +++ b/docs/articles/react-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/realtime-database.html b/docs/articles/realtime-database.html index c88fd576245..318886e160c 100644 --- a/docs/articles/realtime-database.html +++ b/docs/articles/realtime-database.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/articles/websockets-sse-polling-webrtc-webtransport.html b/docs/articles/websockets-sse-polling-webrtc-webtransport.html index e59dfc0557b..3205082c0b9 100644 --- a/docs/articles/websockets-sse-polling-webrtc-webtransport.html +++ b/docs/articles/websockets-sse-polling-webrtc-webtransport.html @@ -15,8 +15,8 @@ - - + + diff --git a/docs/assets/js/8bc82b1f.54c00f42.js b/docs/assets/js/8bc82b1f.54c00f42.js new file mode 100644 index 00000000000..a9f41d3c236 --- /dev/null +++ b/docs/assets/js/8bc82b1f.54c00f42.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[9997],{8661:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>r,contentTitle:()=>s,default:()=>h,frontMatter:()=>o,metadata:()=>l,toc:()=>d});var t=i(4848),a=i(8453);const o={title:"Pipelines",slug:"rx-pipeline.html"},s="RxPipeline (beta)",l={id:"rx-pipeline",title:"Pipelines",description:"The RxPipeline plugin enables you to run operations depending on writes to a collection.",source:"@site/docs/rx-pipeline.md",sourceDirName:".",slug:"/rx-pipeline.html",permalink:"/rx-pipeline.html",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"Pipelines",slug:"rx-pipeline.html"},sidebar:"tutorialSidebar",previous:{title:"Attachments",permalink:"/rx-attachment.html"},next:{title:"\u2699\ufe0f Rxstorage Layer",permalink:"/rx-storage.html"}},r={},d=[{value:"Creating a RxPipeline",id:"creating-a-rxpipeline",level:2},{value:"Pipeline handlers must be idempotent",id:"pipeline-handlers-must-be-idempotent",level:2},{value:"Pipeline handlers must not throw",id:"pipeline-handlers-must-not-throw",level:2},{value:"Be careful when doing http requests in the handler",id:"be-careful-when-doing-http-requests-in-the-handler",level:2},{value:"Use Cases for RxPipeline",id:"use-cases-for-rxpipeline",level:2},{value:"UseCase: Re-Index data that comes from replication",id:"usecase-re-index-data-that-comes-from-replication",level:3},{value:"UseCase: Fulltext Search",id:"usecase-fulltext-search",level:3},{value:"UseCase: Download data based on source documents",id:"usecase-download-data-based-on-source-documents",level:3},{value:"RxPipeline method",id:"rxpipeline-method",level:2},{value:"awaitIdle()",id:"awaitidle",level:3},{value:"destroy()",id:"destroy",level:3},{value:"remove()",id:"remove",level:3}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"rxpipeline-beta",children:"RxPipeline (beta)"}),"\n",(0,t.jsx)(n.p,{children:"The RxPipeline plugin enables you to run operations depending on writes to a collection.\nWhenever a write happens on the source collection of a pipeline, a handler is called to process the writes and run operations on another collection."}),"\n",(0,t.jsx)(n.p,{children:"You could have a similar behavior as observing the collection stream and process data on emits:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"mySourceCollection.$.subscribe(event => {/* ...process...*/});\n"})}),"\n",(0,t.jsx)(n.p,{children:"While this could work in some cases, it causes many problems that are fixed by using the pipeline plugin instead:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["In a RxPipeline, only the ",(0,t.jsx)(n.a,{href:"/leader-election.html",children:"Leading Instance"})," runs the operations. For example when you have multiple browser tabs open, only one will run the processing and when that tab is closed, another tab will become elected leader and continue the pipeline processing."]}),"\n",(0,t.jsx)(n.li,{children:"On sudden stops and restarts of the JavaScript process, the processing will continue at the correct checkpoint and not miss out any documents even on unexpected crashes."}),"\n",(0,t.jsx)(n.li,{children:"Reads/Writes on the destination collection are halted while the pipeline is processing. This ensures your queries only return fully processed documents and no partial results. So when you do a query to the destination collection directly after a write to the source collection, you can be sure you query results are up to date and the pipeline has already been run at the moment the query resolved:"}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"await mySourceCollection.insert({/* ... */});\n\n// because our pipeline blocks reads to the destination, we know that the result array\n// contains data created on top of the previously inserted documents.\nconst result = myDestinationCollection.find().exec();\n"})}),"\n",(0,t.jsx)(n.h2,{id:"creating-a-rxpipeline",children:"Creating a RxPipeline"}),"\n",(0,t.jsxs)(n.p,{children:["Pipelines are created on top of a source ",(0,t.jsx)(n.a,{href:"/rx-collection.html",children:"RxCollection"})," and have another ",(0,t.jsx)(n.code,{children:"RxCollection"})," as destination. An identifier is used to identify the state of the pipeline so that different pipelines have a different processing checkpoint state. A plain JavaScript function ",(0,t.jsx)(n.code,{children:"handler"})," is used to process the data of the source collection writes."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const pipeline = await mySourceCollection.addPipeline({\n identifier: 'my-pipeline',\n destination: myDestinationCollection,\n handler: async (docs) => {\n /**\n * Here you can process the documents and to writes to\n * the destination collection.\n */\n for (const doc of docs) {\n await myDestinationCollection.insert({\n id: doc.primary,\n category: doc.category\n });\n }\n }\n});\n"})}),"\n",(0,t.jsx)(n.admonition,{title:"beta",type:"warning",children:(0,t.jsxs)(n.p,{children:["The pipeline plugin is in ",(0,t.jsx)(n.strong,{children:"beta"})," mode and the API might be changed without a major RxDB release."]})}),"\n",(0,t.jsx)(n.h2,{id:"pipeline-handlers-must-be-idempotent",children:"Pipeline handlers must be idempotent"}),"\n",(0,t.jsx)(n.p,{children:"Because a JavaScript process can exit at any time, like when the user closes a browser tab, the pipeline handler function must be idempotent. This means when it only runs partially and is started again with the same input, it should still end up in the correct results."}),"\n",(0,t.jsx)(n.h2,{id:"pipeline-handlers-must-not-throw",children:"Pipeline handlers must not throw"}),"\n",(0,t.jsxs)(n.p,{children:["Pipeline handlers must never throw. If you run operations inside of the handler that might cause errors, you must wrap the handlers code with a ",(0,t.jsx)(n.code,{children:"try catch"})," by yourself and also handle retries."]}),"\n",(0,t.jsx)(n.h2,{id:"be-careful-when-doing-http-requests-in-the-handler",children:"Be careful when doing http requests in the handler"}),"\n",(0,t.jsxs)(n.p,{children:["When you run http requests inside of your handler, you no longer have an ",(0,t.jsx)(n.a,{href:"/offline-first.html",children:"offline first"})," application because reads to the destination collection will be blocked until all handlers have finished. When your client is offline, therefore the collection is blocked for reads and writes."]}),"\n",(0,t.jsx)(n.h2,{id:"use-cases-for-rxpipeline",children:"Use Cases for RxPipeline"}),"\n",(0,t.jsx)(n.p,{children:"The RxPipeline is a handy building block for different features and plugins. You can use it to aggregate data or restructure local data."}),"\n",(0,t.jsx)(n.h3,{id:"usecase-re-index-data-that-comes-from-replication",children:"UseCase: Re-Index data that comes from replication"}),"\n",(0,t.jsxs)(n.p,{children:["Sometimes you want to ",(0,t.jsx)(n.a,{href:"/replication.html",children:"replicate"})," atomic documents over the wire but locally you want to split these documents for better indexing. For example you replicate email documents that have multiple receivers in a string-array. While string-arrays cannot be indexes, locally you need a way to query for all emails of a given receiver.\nTo handle this case you can set up a RxPipeline that writes the mapping into a separate collection:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const pipeline = await emailCollection.addPipeline({\n identifier: 'map-email-receivers',\n destination: emailByReceiverCollection,\n handler: async (docs) => {\n for (const doc of docs) {\n // remove previous mapping\n await emailByReceiverCollection.find({emailId: doc.primary}).remove();\n // add new mapping\n if(!doc.deleted) {\n await emailByReceiverCollection.bulkInsert(\n doc.receivers.map(receiver => ({\n emailId: doc.primary,\n receiver: receiver\n }))\n );\n }\n }\n }\n});\n"})}),"\n",(0,t.jsx)(n.p,{children:'With this you can efficiently query for "all emails that a person received" by running:'}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const mailIds = await emailByReceiverCollection.find({receiver: 'foobar@example.com'}).exec();\n"})}),"\n",(0,t.jsx)(n.h3,{id:"usecase-fulltext-search",children:"UseCase: Fulltext Search"}),"\n",(0,t.jsx)(n.p,{children:"You can utilize the pipeline plugin to index text data for efficient fulltext search."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const pipeline = await emailCollection.addPipeline({\n identifier: 'email-fulltext-search',\n destination: mailByWordCollection,\n handler: async (docs) => {\n for (const doc of docs) {\n // remove previous mapping\n await mailByWordCollection.find({emailId: doc.primary}).remove();\n // add new mapping\n if(!doc.deleted) {\n const words = doc.text.split(' ');\n await mailByWordCollection.bulkInsert(\n words.map(word => ({\n emailId: doc.primary,\n word: word\n }))\n );\n }\n }\n }\n});\n"})}),"\n",(0,t.jsx)(n.p,{children:'With this you can efficiently query for "all emails that contain a given word" by running:'}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const mailIds = await emailByReceiverCollection.find({word: 'foobar'}).exec();\n"})}),"\n",(0,t.jsx)(n.h3,{id:"usecase-download-data-based-on-source-documents",children:"UseCase: Download data based on source documents"}),"\n",(0,t.jsx)(n.p,{children:"When you have to fetch data for each document of a collection from a server, you can use the pipeline to ensure all documents have their data downloaded and no document is missed out."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const pipeline = await emailCollection.addPipeline({\n identifier: 'download-data',\n destination: serverDataCollection,\n handler: async (docs) => {\n for (const doc of docs) {\n const response = await fetch('https://example.com/doc/' + doc.primary);\n const serverData = await response.json();\n await serverDataCollection.upsert({\n id: doc.primary,\n data: serverData\n });\n }\n }\n});\n"})}),"\n",(0,t.jsx)(n.h2,{id:"rxpipeline-method",children:"RxPipeline method"}),"\n",(0,t.jsx)(n.h3,{id:"awaitidle",children:"awaitIdle()"}),"\n",(0,t.jsxs)(n.p,{children:["You can await the idleness of a pipeline with ",(0,t.jsx)(n.code,{children:"await myRxPipeline.awaitIdle()"}),". This will await a promise that resolved when the pipeline has processed all documents and is not running anymore."]}),"\n",(0,t.jsx)(n.h3,{id:"destroy",children:"destroy()"}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"await myRxPipeline.destroy()"})," stops the pipeline so that is no longer doing stuff. This is automatically called when the RxCollection or RxDatabase of the pipeline is destroyed."]}),"\n",(0,t.jsx)(n.h3,{id:"remove",children:"remove()"}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"await myRxPipeline.remove()"})," removes the pipeline and all metadata which it has stored. Recreating the pipeline afterwards will start processing all source document from scratch."]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>s,x:()=>l});var t=i(6540);const a={},o=t.createContext(a);function s(e){const n=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/docs/assets/js/8bc82b1f.cacf983d.js b/docs/assets/js/8bc82b1f.cacf983d.js deleted file mode 100644 index 3056744d0f0..00000000000 --- a/docs/assets/js/8bc82b1f.cacf983d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[9997],{8661:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>r,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>d});var t=i(4848),a=i(8453);const o={title:"Pipelines",slug:"rx-pipeline.html"},l="RxPipeline (beta)",s={id:"rx-pipeline",title:"Pipelines",description:"The RxPipeline plugin enables you to run operations depending on writes to a collection.",source:"@site/docs/rx-pipeline.md",sourceDirName:".",slug:"/rx-pipeline.html",permalink:"/rx-pipeline.html",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{title:"Pipelines",slug:"rx-pipeline.html"},sidebar:"tutorialSidebar",previous:{title:"Attachments",permalink:"/rx-attachment.html"},next:{title:"\u2699\ufe0f Rxstorage Layer",permalink:"/rx-storage.html"}},r={},d=[{value:"Creating a RxPipeline",id:"creating-a-rxpipeline",level:2},{value:"Pipeline handlers must be idempotent",id:"pipeline-handlers-must-be-idempotent",level:2},{value:"Pipeline handlers must not throw",id:"pipeline-handlers-must-not-throw",level:2},{value:"Be careful when doing http requests in the handler",id:"be-careful-when-doing-http-requests-in-the-handler",level:2},{value:"Use Cases for RxPipeline",id:"use-cases-for-rxpipeline",level:2},{value:"UseCase: Re-Index data that comes from replication",id:"usecase-re-index-data-that-comes-from-replication",level:3},{value:"UseCase: Fulltext Search",id:"usecase-fulltext-search",level:3},{value:"UseCase: Download data based on source documents",id:"usecase-download-data-based-on-source-documents",level:3},{value:"RxPipeline method",id:"rxpipeline-method",level:2},{value:"awaitIdle()",id:"awaitidle",level:3},{value:"destroy()",id:"destroy",level:3},{value:"remove()",id:"remove",level:3}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"rxpipeline-beta",children:"RxPipeline (beta)"}),"\n",(0,t.jsx)(n.p,{children:"The RxPipeline plugin enables you to run operations depending on writes to a collection.\nWhenever a write happens on the source collection of a pipeline, a handler is called to process the writes and run operations on another collection."}),"\n",(0,t.jsx)(n.p,{children:"You could have a similar behavior as observing the collection stream and process data on emits:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"mySourceCollection.$.subscribe(event => {/* ...process...*/});\n"})}),"\n",(0,t.jsx)(n.p,{children:"While this could work in some cases, it causes many problems that are fixed by using the pipeline plugin instead:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["In a RxPipeline, only the ",(0,t.jsx)(n.a,{href:"/leader-election.html",children:"Leading Instance"})," runs the operations. For example when you have multiple browser tabs open, only one will run the processing and when that tab is closed, another tab will become elected leader and continue the pipeline processing."]}),"\n",(0,t.jsx)(n.li,{children:"On sudden stops and restarts of the JavaScript process, the processing will continue at the correct checkpoint and not miss out any documents even on unexpected crashes."}),"\n",(0,t.jsx)(n.li,{children:"Reads/Writes on the destination collection are halted while the pipeline is processing. This ensures your queries only return fully processed documents and no partial results."}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"creating-a-rxpipeline",children:"Creating a RxPipeline"}),"\n",(0,t.jsxs)(n.p,{children:["Pipelines are created on top of a source ",(0,t.jsx)(n.a,{href:"/rx-collection.html",children:"RxCollection"})," and have another ",(0,t.jsx)(n.code,{children:"RxCollection"})," as destination. An identifier is used to identify the state of the pipeline so that different pipelines have a different processing checkpoint state. A plain JavaScript function ",(0,t.jsx)(n.code,{children:"handler"})," is used to process the data of the source collection writes."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const pipeline = await mySourceCollection.addPipeline({\n identifier: 'my-pipeline',\n destination: myDestinationCollection,\n handler: async (docs) => {\n /**\n * Here you can process the documents and to writes to\n * the destination collection.\n */\n for (const doc of docs) {\n await myDestinationCollection.insert({\n id: doc.primary,\n category: doc.category\n });\n }\n }\n});\n"})}),"\n",(0,t.jsx)(n.admonition,{title:"beta",type:"warning",children:(0,t.jsxs)(n.p,{children:["The pipeline plugin is in ",(0,t.jsx)(n.strong,{children:"beta"})," mode and the API might be changed without a major RxDB release."]})}),"\n",(0,t.jsx)(n.h2,{id:"pipeline-handlers-must-be-idempotent",children:"Pipeline handlers must be idempotent"}),"\n",(0,t.jsx)(n.p,{children:"Because a JavaScript process can exit at any time, like when the user closes a browser tab, the pipeline handler function must be idempotent. This means when it only runs partially and is started again with the same input, it should still end up in the correct results."}),"\n",(0,t.jsx)(n.h2,{id:"pipeline-handlers-must-not-throw",children:"Pipeline handlers must not throw"}),"\n",(0,t.jsxs)(n.p,{children:["Pipeline handlers must never throw. If you run operations inside of the handler that might cause errors, you must wrap the handlers code with a ",(0,t.jsx)(n.code,{children:"try catch"})," by yourself and also handle retries."]}),"\n",(0,t.jsx)(n.h2,{id:"be-careful-when-doing-http-requests-in-the-handler",children:"Be careful when doing http requests in the handler"}),"\n",(0,t.jsxs)(n.p,{children:["When you run http requests inside of your handler, you no longer have an ",(0,t.jsx)(n.a,{href:"/offline-first.html",children:"offline first"})," application because reads to the destination collection will be blocked until all handlers have finished. When your client is offline, therefore the collection is blocked for reads and writes."]}),"\n",(0,t.jsx)(n.h2,{id:"use-cases-for-rxpipeline",children:"Use Cases for RxPipeline"}),"\n",(0,t.jsx)(n.p,{children:"The RxPipeline is a handy building block for different features and plugins. You can use it to aggregate data or restructure local data."}),"\n",(0,t.jsx)(n.h3,{id:"usecase-re-index-data-that-comes-from-replication",children:"UseCase: Re-Index data that comes from replication"}),"\n",(0,t.jsxs)(n.p,{children:["Sometimes you want to ",(0,t.jsx)(n.a,{href:"/replication.html",children:"replicate"})," atomic documents over the wire but locally you want to split these documents for better indexing. For example you replicate email documents that have multiple receivers in a string-array. While string-arrays cannot be indexes, locally you need a way to query for all emails of a given receiver.\nTo handle this case you can set up a RxPipeline that writes the mapping into a separate collection:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const pipeline = await emailCollection.addPipeline({\n identifier: 'map-email-receivers',\n destination: emailByReceiverCollection,\n handler: async (docs) => {\n for (const doc of docs) {\n // remove previous mapping\n await emailByReceiverCollection.find({emailId: doc.primary}).remove();\n // add new mapping\n if(!doc.deleted) {\n await emailByReceiverCollection.bulkInsert(\n doc.receivers.map(receiver => ({\n emailId: doc.primary,\n receiver: receiver\n }))\n );\n }\n }\n }\n});\n"})}),"\n",(0,t.jsx)(n.p,{children:'With this you can efficiently query for "all emails that a person received" by running:'}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const mailIds = await emailByReceiverCollection.find({receiver: 'foobar@example.com'}).exec();\n"})}),"\n",(0,t.jsx)(n.h3,{id:"usecase-fulltext-search",children:"UseCase: Fulltext Search"}),"\n",(0,t.jsx)(n.p,{children:"You can utilize the pipeline plugin to index text data for efficient fulltext search."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const pipeline = await emailCollection.addPipeline({\n identifier: 'email-fulltext-search',\n destination: mailByWordCollection,\n handler: async (docs) => {\n for (const doc of docs) {\n // remove previous mapping\n await mailByWordCollection.find({emailId: doc.primary}).remove();\n // add new mapping\n if(!doc.deleted) {\n const words = doc.text.split(' ');\n await mailByWordCollection.bulkInsert(\n words.map(word => ({\n emailId: doc.primary,\n word: word\n }))\n );\n }\n }\n }\n});\n"})}),"\n",(0,t.jsx)(n.p,{children:'With this you can efficiently query for "all emails that contain a given word" by running:'}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const mailIds = await emailByReceiverCollection.find({word: 'foobar'}).exec();\n"})}),"\n",(0,t.jsx)(n.h3,{id:"usecase-download-data-based-on-source-documents",children:"UseCase: Download data based on source documents"}),"\n",(0,t.jsx)(n.p,{children:"When you have to fetch data for each document of a collection from a server, you can use the pipeline to ensure all documents have their data downloaded and no document is missed out."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const pipeline = await emailCollection.addPipeline({\n identifier: 'download-data',\n destination: serverDataCollection,\n handler: async (docs) => {\n for (const doc of docs) {\n const response = await fetch('https://example.com/doc/' + doc.primary);\n const serverData = await response.json();\n await serverDataCollection.upsert({\n id: doc.primary,\n data: serverData\n });\n }\n }\n});\n"})}),"\n",(0,t.jsx)(n.h2,{id:"rxpipeline-method",children:"RxPipeline method"}),"\n",(0,t.jsx)(n.h3,{id:"awaitidle",children:"awaitIdle()"}),"\n",(0,t.jsxs)(n.p,{children:["You can await the idleness of a pipeline with ",(0,t.jsx)(n.code,{children:"await myRxPipeline.awaitIdle()"}),". This will await a promise that resolved when the pipeline has processed all documents and is not running anymore."]}),"\n",(0,t.jsx)(n.h3,{id:"destroy",children:"destroy()"}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"await myRxPipeline.destroy()"})," stops the pipeline so that is no longer doing stuff. This is automatically called when the RxCollection or RxDatabase of the pipeline is destroyed."]}),"\n",(0,t.jsx)(n.h3,{id:"remove",children:"remove()"}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"await myRxPipeline.remove()"})," removes the pipeline and all metadata which it has stored. Recreating the pipeline afterwards will start processing all source document from scratch."]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>l,x:()=>s});var t=i(6540);const a={},o=t.createContext(a);function l(e){const n=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:l(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/docs/assets/js/main.563bd506.js b/docs/assets/js/main.563bd506.js new file mode 100644 index 00000000000..5d15b3c33d9 --- /dev/null +++ b/docs/assets/js/main.563bd506.js @@ -0,0 +1,2 @@ +/*! For license information please see main.563bd506.js.LICENSE.txt */ +(self.webpackChunkrxdb=self.webpackChunkrxdb||[]).push([[8792],{8328:(e,t,n)=>{"use strict";n.d(t,{A:()=>f});n(6540);var r=n(3259),a=n.n(r),o=n(4054);const i={"0027230a":[()=>n.e(8382).then(n.bind(n,2081)),"@site/docs/rx-storage-lokijs.md",2081],"01684a0a":[()=>n.e(6616).then(n.bind(n,3395)),"@site/docs/rx-storage-memory-synced.md",3395],"03e37916":[()=>n.e(6465).then(n.bind(n,3184)),"@site/docs/transactions-conflicts-revisions.md",3184],"045bd6f5":[()=>n.e(4475).then(n.bind(n,8201)),"@site/docs/encryption.md",8201],"04b0214f":[()=>n.e(6264).then(n.t.bind(n,4061,19)),"/home/runner/work/rxdb/rxdb/docs-src/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",4061],"0b761dc7":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(2835)]).then(n.bind(n,2796)),"@site/src/pages/sem/localstorage-database.tsx",2796],"0e268d20":[()=>Promise.all([n.e(8316),n.e(6744),n.e(6902),n.e(2584)]).then(n.bind(n,1980)),"@site/src/pages/premium.tsx",1980],"0e945c41":[()=>n.e(9796).then(n.bind(n,9722)),"@site/docs/replication-server.md",9722],"0f6e10f0":[()=>n.e(1475).then(n.bind(n,654)),"@site/docs/articles/progressive-web-app-database.md",654],"118cde4c":[()=>n.e(5272).then(n.bind(n,7245)),"@site/docs/replication-couchdb.md",7245],"13dc6548":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(3483)]).then(n.bind(n,4637)),"@site/src/pages/sem/indexeddb-database.tsx",4637],"14d72841":[()=>n.e(9772).then(n.bind(n,5221)),"@site/src/pages/newsletter.tsx",5221],17896441:[()=>Promise.all([n.e(1869),n.e(1968),n.e(8401)]).then(n.bind(n,242)),"@theme/DocItem",242],"187b985e":[()=>n.e(6866).then(n.bind(n,844)),"@site/docs/replication-webrtc.md",844],"1b0f8c91":[()=>n.e(3129).then(n.bind(n,9642)),"@site/docs/backup.md",9642],"1b238727":[()=>n.e(4013).then(n.bind(n,3721)),"@site/docs/rx-storage-performance.md",3721],"1b5fa8ad":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(9111)]).then(n.bind(n,5347)),"@site/src/pages/sem/nedb-alternative.tsx",5347],"1c0701dd":[()=>n.e(6953).then(n.bind(n,668)),"@site/docs/middleware.md",668],"1da545ff":[()=>n.e(9743).then(n.bind(n,2678)),"@site/docs/releases/9.0.0.md",2678],"1df93b7f":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(4583)]).then(n.bind(n,3516)),"@site/src/pages/index.tsx",3516],"1e0353aa":[()=>n.e(8588).then(n.bind(n,142)),"@site/docs/rx-storage.md",142],"1f391b9e":[()=>Promise.all([n.e(1869),n.e(1968),n.e(6061)]).then(n.bind(n,7973)),"@theme/MDXPage",7973],"21fa2740":[()=>n.e(5694).then(n.bind(n,763)),"@site/docs/releases/15.0.0.md",763],"2456d5e0":[()=>n.e(2966).then(n.bind(n,5654)),"@site/docs/rx-database.md",5654],"25626d15":[()=>n.e(268).then(n.bind(n,7258)),"@site/src/pages/chat.tsx",7258],"2564bf4f":[()=>n.e(6724).then(n.bind(n,5705)),"@site/docs/rxdb-tradeoffs.md",5705],"25a43fd4":[()=>n.e(4812).then(n.bind(n,3917)),"@site/docs/rx-storage-shared-worker.md",3917],"26b8a621":[()=>n.e(2055).then(n.bind(n,3439)),"@site/docs/replication-p2p.md",3439],"280a2389":[()=>n.e(176).then(n.bind(n,8141)),"@site/src/pages/meeting.tsx",8141],"294ac9d5":[()=>n.e(8744).then(n.bind(n,958)),"@site/docs/plugins.md",958],"2efd0200":[()=>n.e(4132).then(n.bind(n,9839)),"@site/docs/tutorials/typescript.md",9839],"2fe9ecb2":[()=>n.e(5101).then(n.bind(n,581)),"@site/docs/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm.md",581],"32667c41":[()=>n.e(8191).then(n.bind(n,6895)),"@site/docs/nosql-performance-tips.md",6895],"326aca46":[()=>n.e(4853).then(n.bind(n,3142)),"@site/docs/offline-first.md",3142],"34f94d1b":[()=>n.e(5832).then(n.bind(n,7746)),"@site/docs/electron-database.md",7746],36715375:[()=>n.e(2076).then(n.bind(n,2323)),"@site/src/pages/code.tsx",2323],"380cc66a":[()=>n.e(2061).then(n.bind(n,5668)),"@site/docs/rx-storage-dexie.md",5668],"38a45a95":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(405)]).then(n.bind(n,4806)),"@site/src/pages/sem/electron-database.tsx",4806],"38bbf12a":[()=>n.e(2078).then(n.bind(n,3762)),"@site/docs/articles/data-base.md",3762],"393be207":[()=>n.e(4134).then(n.bind(n,6602)),"@site/src/pages/markdown-page.md",6602],"39600c95":[()=>n.e(3148).then(n.bind(n,755)),"@site/docs/rx-query.md",755],"401008a8":[()=>n.e(5219).then(n.bind(n,6805)),"@site/docs/nodejs-database.md",6805],"41f941a1":[()=>n.e(5966).then(n.bind(n,3057)),"@site/docs/leader-election.md",3057],"432b83f9":[()=>n.e(4424).then(n.bind(n,9429)),"@site/docs/releases/8.0.0.md",9429],"4616b86a":[()=>n.e(465).then(n.bind(n,81)),"@site/docs/rx-storage-mongodb.md",81],"4777fd9a":[()=>n.e(6386).then(n.bind(n,1600)),"@site/docs/alternatives.md",1600],"4adf80bb":[()=>n.e(9548).then(n.bind(n,4442)),"@site/docs/rx-storage-pouchdb.md",4442],"4af60d2e":[()=>n.e(8545).then(n.bind(n,9249)),"@site/docs/articles/realtime-database.md",9249],"4ba7e5a3":[()=>n.e(9591).then(n.bind(n,8848)),"@site/docs/contribute.md",8848],"4ed9495b":[()=>n.e(1199).then(n.bind(n,1787)),"@site/docs/rx-storage-sqlite.md",1787],"4f17bbdd":[()=>n.e(2373).then(n.bind(n,1206)),"@site/src/pages/meeting-paid.tsx",1206],"502d8946":[()=>n.e(7817).then(n.bind(n,732)),"@site/src/pages/legal-notice.tsx",732],"51014a8a":[()=>n.e(9460).then(n.bind(n,262)),"@site/docs/articles/websockets-sse-polling-webrtc-webtransport.md",262],51038524:[()=>n.e(4889).then(n.bind(n,9262)),"@site/docs/rx-storage-memory-mapped.md",9262],51334108:[()=>n.e(8926).then(n.bind(n,2644)),"@site/docs/articles/mobile-database.md",2644],"55a5b596":[()=>n.e(6717).then(n.bind(n,5536)),"@site/docs/rx-schema.md",5536],"5a273530":[()=>n.e(3881).then(n.bind(n,7589)),"@site/docs/rx-storage-remote.md",7589],"5e95c892":[()=>n.e(9647).then(n.bind(n,7121)),"@theme/DocsRoot",7121],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,4784)),"@generated/docusaurus.config",4784],"60c23941":[()=>n.e(2915).then(n.t.bind(n,1966,19)),"/home/runner/work/rxdb/rxdb/docs-src/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",1966],"6187b59a":[()=>n.e(5866).then(n.bind(n,7409)),"@site/docs/rx-storage-worker.md",7409],"68a466be":[()=>n.e(3997).then(n.bind(n,3923)),"@site/docs/downsides-of-offline-first.md",3923],"6ae3580c":[()=>n.e(5320).then(n.bind(n,5376)),"@site/docs/replication.md",5376],"6bfb0089":[()=>n.e(6422).then(n.bind(n,300)),"@site/docs/adapters.md",300],"6cbff7c2":[()=>n.e(7408).then(n.bind(n,5943)),"@site/docs/rx-storage-opfs.md",5943],"6fa8aa1a":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(1264)]).then(n.bind(n,5379)),"@site/src/pages/sem/pouchdb-alternative.tsx",5379],"6fd28feb":[()=>n.e(4618).then(n.bind(n,9408)),"@site/docs/rx-storage-foundationdb.md",9408],"714575d7":[()=>n.e(3185).then(n.bind(n,4880)),"@site/docs/rx-local-document.md",4880],"77d975e6":[()=>n.e(3949).then(n.bind(n,5707)),"@site/docs/articles/in-memory-nosql-database.md",5707],"7815dd0c":[()=>n.e(5335).then(n.bind(n,5515)),"@site/docs/population.md",5515],"7bbb96fd":[()=>n.e(3495).then(n.bind(n,8435)),"@site/src/pages/service-submitted.tsx",8435],"7f02c700":[()=>n.e(9592).then(n.bind(n,9640)),"@site/docs/replication-firestore.md",9640],"8070e160":[()=>n.e(3822).then(n.bind(n,1685)),"@site/docs/quickstart.md",1685],"8288c265":[()=>n.e(9881).then(n.bind(n,1839)),"@site/docs/releases/11.0.0.md",1839],"84a3af36":[()=>n.e(6861).then(n.bind(n,8160)),"@site/docs/articles/json-database.md",8160],"84ae55a4":[()=>n.e(588).then(n.bind(n,2045)),"@site/docs/replication-nats.md",2045],"86b4e356":[()=>n.e(2786).then(n.bind(n,9278)),"@site/docs/orm.md",9278],"8a22f3a9":[()=>n.e(9257).then(n.bind(n,6224)),"@site/docs/errors.md",6224],"8aa53ed7":[()=>n.e(6723).then(n.bind(n,5870)),"@site/docs/articles/angular-database.md",5870],"8b0a0922":[()=>n.e(4557).then(n.bind(n,767)),"@site/docs/slow-indexeddb.md",767],"8b4bf532":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(4027)]).then(n.bind(n,7507)),"@site/src/pages/sem/nosql-database.tsx",7507],"8bc07e20":[()=>n.e(1850).then(n.bind(n,5054)),"@site/docs/capacitor-database.md",5054],"8bc82b1f":[()=>n.e(9997).then(n.bind(n,8661)),"@site/docs/rx-pipeline.md",8661],"90102fdf":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(2633)]).then(n.bind(n,9935)),"@site/src/pages/sem/nodejs-database.tsx",9935],"91b454ee":[()=>n.e(4202).then(n.bind(n,9107)),"@site/docs/rx-storage-sharding.md",9107],"924d6dd6":[()=>n.e(5122).then(n.bind(n,2414)),"@site/docs/electron.md",2414],"92698a99":[()=>n.e(4166).then(n.bind(n,8568)),"@site/docs/rx-storage-indexeddb.md",8568],"931f4566":[()=>n.e(3595).then(n.bind(n,2439)),"@site/docs/schema-validation.md",2439],"935f2afb":[()=>n.e(8581).then(n.t.bind(n,5610,19)),"~docs/default/version-current-metadata-prop-751.json",5610],98405524:[()=>n.e(5504).then(n.bind(n,1934)),"@site/src/pages/survey.tsx",1934],"9dae6e71":[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(3325)]).then(n.bind(n,2231)),"@site/src/pages/sem/firestore-alternative.tsx",2231],"9dd8ea89":[()=>n.e(1715).then(n.bind(n,7919)),"@site/docs/logger.md",7919],"9e91b6f0":[()=>n.e(3021).then(n.bind(n,1844)),"@site/docs/why-nosql.md",1844],a406dc27:[()=>n.e(1500).then(n.bind(n,8306)),"@site/docs/migration-storage.md",8306],a442adcd:[()=>n.e(8760).then(n.bind(n,188)),"@site/docs/reactivity.md",188],a574e172:[()=>n.e(7149).then(n.bind(n,9329)),"@site/docs/replication-http.md",9329],a69eebfc:[()=>n.e(9408).then(n.bind(n,4120)),"@site/docs/query-optimizer.md",4120],a7bd4aaa:[()=>n.e(7098).then(n.bind(n,4532)),"@theme/DocVersionRoot",4532],a7f10198:[()=>n.e(1098).then(n.bind(n,769)),"@site/docs/data-migration.md",769],a94703ab:[()=>Promise.all([n.e(1869),n.e(9048)]).then(n.bind(n,2559)),"@theme/DocRoot",2559],aa14e6b1:[()=>n.e(9824).then(n.bind(n,3268)),"@site/docs/replication-graphql.md",3268],ab919a1f:[()=>n.e(6491).then(n.bind(n,4760)),"@site/docs/articles/embedded-database.md",4760],ac62b32d:[()=>n.e(9192).then(n.bind(n,9585)),"@site/docs/replication-websocket.md",9585],ad16b3ea:[()=>n.e(8674).then(n.bind(n,2462)),"@site/docs/dev-mode.md",2462],b0889a22:[()=>n.e(1107).then(n.bind(n,1798)),"@site/docs/cleanup.md",1798],b30f4f1f:[()=>n.e(3779).then(n.bind(n,3449)),"@site/docs/rx-attachment.md",3449],b8c49ce4:[()=>n.e(6355).then(n.bind(n,1605)),"@site/docs/releases/13.0.0.md",1605],badcd764:[()=>n.e(8318).then(n.bind(n,6042)),"@site/docs/articles/flutter-database.md",6042],bdd39edd:[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(5852)]).then(n.bind(n,3922)),"@site/src/pages/sem/browser-database.tsx",3922],c3bc9c50:[()=>n.e(9167).then(n.bind(n,4337)),"@site/docs/articles/react-database.md",4337],c44853e1:[()=>n.e(6584).then(n.bind(n,7390)),"@site/docs/rx-state.md",7390],c4de80f8:[()=>n.e(2777).then(n.bind(n,3554)),"@site/docs/install.md",3554],c6349bb6:[()=>n.e(5740).then(n.bind(n,2964)),"@site/docs/releases/14.0.0.md",2964],c6fdd490:[()=>n.e(4141).then(n.bind(n,5008)),"@site/docs/rx-server-scaling.md",5008],c843a053:[()=>n.e(9146).then(n.bind(n,8723)),"@site/docs/third-party-plugins.md",8723],c9c8e0b6:[()=>n.e(7249).then(n.bind(n,7674)),"@site/docs/articles/ionic-database.md",7674],cbbe8f0a:[()=>n.e(3852).then(n.bind(n,8783)),"@site/docs/rx-collection.md",8783],cde77f4f:[()=>Promise.all([n.e(8316),n.e(6744),n.e(6902),n.e(6287)]).then(n.bind(n,6465)),"@site/src/pages/premium-submitted.tsx",6465],d20e74b4:[()=>n.e(5123).then(n.bind(n,2853)),"@site/docs/crdt.md",2853],d2758528:[()=>n.e(2586).then(n.bind(n,7108)),"@site/docs/articles/browser-storage.md",7108],d4da9db3:[()=>n.e(1400).then(n.bind(n,4228)),"@site/docs/rx-storage-memory.md",4228],d622bd51:[()=>n.e(2845).then(n.bind(n,9804)),"@site/docs/migration-schema.md",9804],db34d6b0:[()=>n.e(7320).then(n.bind(n,9891)),"@site/src/pages/license.tsx",9891],dbde2ffe:[()=>n.e(6543).then(n.bind(n,118)),"@site/docs/rx-document.md",118],dc42ba65:[()=>n.e(4962).then(n.bind(n,4494)),"@site/docs/key-compression.md",4494],e24529eb:[()=>n.e(6797).then(n.bind(n,9263)),"@site/docs/rx-storage-localstorage-meta-optimizer.md",9263],e6b4453d:[()=>n.e(2360).then(n.bind(n,9133)),"@site/docs/query-cache.md",9133],e7478ff0:[()=>n.e(5416).then(n.bind(n,1873)),"@site/docs/questions-answers.md",1873],e8a836f3:[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(5265)]).then(n.bind(n,9349)),"@site/src/pages/sem/react-native-database.tsx",9349],eadd9b3c:[()=>n.e(4886).then(n.bind(n,8041)),"@site/docs/rx-storage-filesystem-node.md",8041],ebace26e:[()=>n.e(4028).then(n.bind(n,7016)),"@site/docs/releases/10.0.0.md",7016],ec526260:[()=>n.e(7396).then(n.bind(n,9592)),"@site/docs/articles/browser-database.md",9592],ed2d6610:[()=>n.e(3469).then(n.bind(n,9222)),"@site/docs/releases/12.0.0.md",9222],ee1b9f21:[()=>n.e(6998).then(n.bind(n,3179)),"@site/docs/react-native-database.md",3179],f15938da:[()=>n.e(4630).then(n.bind(n,5674)),"@site/docs/articles/localstorage.md",5674],f43e80a8:[()=>n.e(1558).then(n.bind(n,9544)),"@site/docs/rx-server.md",9544],f44bb875:[()=>n.e(561).then(n.bind(n,46)),"@site/docs/articles/frontend-database.md",46],fe2a63b2:[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(6744),n.e(5351),n.e(1018)]).then(n.bind(n,4324)),"@site/src/pages/consulting.tsx",4324],fe7a07ee:[()=>n.e(2085).then(n.bind(n,9378)),"@site/docs/rx-storage-denokv.md",9378],ff492cda:[()=>Promise.all([n.e(1869),n.e(8316),n.e(4589),n.e(9335),n.e(7722)]).then(n.bind(n,1382)),"@site/src/pages/sem/watermelondb-alternative.tsx",1382]};var s=n(4848);function l(e){let{error:t,retry:n,pastDelay:r}=e;return t?(0,s.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,s.jsx)("p",{children:String(t)}),(0,s.jsx)("div",{children:(0,s.jsx)("button",{type:"button",onClick:n,children:"Retry"})})]}):r?(0,s.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,s.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,s.jsxs)("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2",children:[(0,s.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,s.jsx)("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,s.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,s.jsx)("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,s.jsx)("circle",{cx:"22",cy:"22",r:"8",children:(0,s.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(6921),u=n(3102);function d(e,t){if("*"===e)return a()({loading:l,loader:()=>n.e(9293).then(n.bind(n,9293)),modules:["@theme/NotFound"],webpack:()=>[9293],render(e,t){const n=e.default;return(0,s.jsx)(u.W,{value:{plugin:{name:"native",id:"default"}},children:(0,s.jsx)(n,{...t})})}});const r=o[`${e}-${t}`],d={},f=[],p=[],h=(0,c.A)(r);return Object.entries(h).forEach((e=>{let[t,n]=e;const r=i[n];r&&(d[t]=r[0],f.push(r[1]),p.push(r[2]))})),a().Map({loading:l,loader:d,modules:f,webpack:()=>p,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 s=n.split(".");s.slice(0,-1).forEach((e=>{i=i[e]})),i[s[s.length-1]]=o}));const o=a.__comp;delete a.__comp;const i=a.__context;return delete a.__context,(0,s.jsx)(u.W,{value:i,children:(0,s.jsx)(o,{...a,...n})})}})}const f=[{path:"/chat",component:d("/chat","fd7"),exact:!0},{path:"/code",component:d("/code","8ef"),exact:!0},{path:"/consulting",component:d("/consulting","54c"),exact:!0},{path:"/legal-notice",component:d("/legal-notice","cfc"),exact:!0},{path:"/license",component:d("/license","d06"),exact:!0},{path:"/markdown-page",component:d("/markdown-page","784"),exact:!0},{path:"/meeting",component:d("/meeting","6b0"),exact:!0},{path:"/meeting-paid",component:d("/meeting-paid","e3c"),exact:!0},{path:"/newsletter",component:d("/newsletter","d15"),exact:!0},{path:"/premium",component:d("/premium","d94"),exact:!0},{path:"/premium-submitted",component:d("/premium-submitted","714"),exact:!0},{path:"/sem/browser-database",component:d("/sem/browser-database","0a3"),exact:!0},{path:"/sem/electron-database",component:d("/sem/electron-database","71a"),exact:!0},{path:"/sem/firestore-alternative",component:d("/sem/firestore-alternative","a47"),exact:!0},{path:"/sem/indexeddb-database",component:d("/sem/indexeddb-database","c87"),exact:!0},{path:"/sem/localstorage-database",component:d("/sem/localstorage-database","c8d"),exact:!0},{path:"/sem/nedb-alternative",component:d("/sem/nedb-alternative","201"),exact:!0},{path:"/sem/nodejs-database",component:d("/sem/nodejs-database","8f5"),exact:!0},{path:"/sem/nosql-database",component:d("/sem/nosql-database","09d"),exact:!0},{path:"/sem/pouchdb-alternative",component:d("/sem/pouchdb-alternative","6fe"),exact:!0},{path:"/sem/react-native-database",component:d("/sem/react-native-database","440"),exact:!0},{path:"/sem/watermelondb-alternative",component:d("/sem/watermelondb-alternative","06b"),exact:!0},{path:"/service-submitted",component:d("/service-submitted","368"),exact:!0},{path:"/survey",component:d("/survey","9e0"),exact:!0},{path:"/",component:d("/","d82"),exact:!0},{path:"/",component:d("/","d73"),routes:[{path:"/",component:d("/","adb"),routes:[{path:"/",component:d("/","5ab"),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-indexeddb-cookies-opfs-sqlite-wasm",component:d("/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm","93d"),exact:!0},{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:"/articles/websockets-sse-polling-webrtc-webtransport.html",component:d("/articles/websockets-sse-polling-webrtc-webtransport.html","864"),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:"/errors.html",component:d("/errors.html","07a"),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:"/reactivity.html",component:d("/reactivity.html","4d4"),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","aa6"),exact:!0,sidebar:"tutorialSidebar"},{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-pipeline.html",component:d("/rx-pipeline.html","4b1"),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-server-scaling.html",component:d("/rx-server-scaling.html","da1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-server.html",component:d("/rx-server.html","ed5"),exact:!0,sidebar:"tutorialSidebar"},{path:"/rx-state.html",component:d("/rx-state.html","198"),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-mapped.html",component:d("/rx-storage-memory-mapped.html","16d"),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","b8d"),exact:!0,sidebar:"tutorialSidebar"},{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("*")}]},6125:(e,t,n)=>{"use strict";n.d(t,{o:()=>o,x:()=>i});var r=n(6540),a=n(4848);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})}},8522:(e,t,n)=>{"use strict";var r=n(6540),a=n(5338),o=n(4625),i=n(545),s=n(8193);const l=[n(1911),n(119),n(6134),n(6294),n(1043)];var c=n(8328),u=n(6347),d=n(2831),f=n(2303),p=n(9961),h=n(4848);function m(e){let{children:t}=e;const n=(0,f.A)();return(0,r.useEffect)((()=>{n&&(function(){if(!location.pathname.includes(".html"))return;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"},{text:"Take Part in the",keyword:"User Survey 2024",url:"https://rxdb.info/survey",icon:"\ud83d\udcdd"}];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=6e5,a=Date.now(),o=(a-a%r)/r;console.log("timeslot "+o);const i=o%e.length;console.log("randid: "+i);const s=e[i],l=document.querySelector(".call-to-action");l&&l.parentNode.removeChild(l);const c=document.querySelector(".navbar__items");if(!c)return;const u=document.createElement("div");u.classList.add("call-to-action");const d=document.createElement("a");d.onclick=()=>{window.trigger("call-to-action",.35)},d.classList.add("hover-shadow-top"),d.id=n,d.innerHTML=s.text+' '+s.keyword+''+s.icon+"",d.href=s.url,d.target="_blank",u.append(d),t(c,u)}r()}(),async function(){const e="console-log-click",t=new URLSearchParams(window.location.search);if(!t.has("console"))return;const n=await(0,p.C3)();await n.getLocal(e)?console.log("# already tracked "+e):(window.trigger(e+"_"+t.get("console"),10),await n.upsertLocal(e,{}))}())})),(0,h.jsx)(h.Fragment,{children:t})}var g=n(5260),y=n(4586),b=n(6025),v=n(6342),w=n(1003),x=n(2131),k=n(4090),_=n(2967),S=n(440),E=n(1463);function C(){const{i18n:{currentLocale:e,defaultLocale:t,localeConfigs:n}}=(0,y.A)(),r=(0,x.o)(),a=n[e].htmlLang,o=e=>e.replace("-","_");return(0,h.jsxs)(g.A,{children:[Object.entries(n).map((e=>{let[t,{htmlLang:n}]=e;return(0,h.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:n},t)})),(0,h.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:"x-default"}),(0,h.jsx)("meta",{property:"og:locale",content:o(a)}),Object.values(n).filter((e=>a!==e.htmlLang)).map((e=>(0,h.jsx)("meta",{property:"og:locale:alternate",content:o(e.htmlLang)},`meta-og-${e.htmlLang}`)))]})}function O(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,y.A)(),r=function(){const{siteConfig:{url:e,baseUrl:t,trailingSlash:n}}=(0,y.A)(),{pathname:r}=(0,u.zy)();return e+(0,S.applyTrailingSlash)((0,b.A)(r),{trailingSlash:n,baseUrl:t})}(),a=t?`${n}${t}`:r;return(0,h.jsxs)(g.A,{children:[(0,h.jsx)("meta",{property:"og:url",content:a}),(0,h.jsx)("link",{rel:"canonical",href:a})]})}function T(){const{i18n:{currentLocale:e}}=(0,y.A)(),{metadata:t,image:n}=(0,v.p)();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(g.A,{children:[(0,h.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,h.jsx)("body",{className:k.w})]}),n&&(0,h.jsx)(w.be,{image:n}),(0,h.jsx)(O,{}),(0,h.jsx)(C,{}),(0,h.jsx)(E.A,{tag:_.Cy,locale:e}),(0,h.jsx)(g.A,{children:t.map(((e,t)=>(0,h.jsx)("meta",{...e},t)))})]})}const A=new Map;function j(e){if(A.has(e.pathname))return{...e,pathname:A.get(e.pathname)};if((0,d.u)(c.A,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return A.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return A.set(e.pathname,t),{...e,pathname:t}}var P=n(6125),R=n(6988),D=n(205);function I(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 N=function(e){let{children:t,location:n,previousLocation:r}=e;return(0,D.A)((()=>{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}),I("onRouteDidUpdate",{previousLocation:r,location:n}))}),[r,n]),t};function L(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,d.u)(c.A,e))).flat();return Promise.all(t.map((e=>e.route.component.preload?.())))}class M extends r.Component{previousLocation;routeUpdateCleanupCb;constructor(e){super(e),this.previousLocation=null,this.routeUpdateCleanupCb=s.A.canUseDOM?I("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=I("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),L(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,h.jsx)(N,{previousLocation:this.previousLocation,location:t,children:(0,h.jsx)(u.qh,{location:t,render:()=>e})})}}const F=M,B="__docusaurus-base-url-issue-banner-container",$="__docusaurus-base-url-issue-banner",q="__docusaurus-base-url-issue-banner-suggestion-container";function z(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 = '${B}';\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 Z=n(6921);const J=new Set,X=new Set,ee=()=>navigator.connection?.effectiveType.includes("2g")||navigator.connection?.saveData,te={prefetch(e){if(!(e=>!ee()&&!X.has(e)&&!J.has(e))(e))return!1;J.add(e);const t=(0,d.u)(c.A,e).flatMap((e=>{return t=e.route.path,Object.entries(Q).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,Z.A)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?Y(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!ee()&&!X.has(e))(e)&&(X.add(e),L(e))},ne=Object.freeze(te),re=Boolean(!0);if(s.A.canUseDOM){window.docusaurus=ne;const e=document.getElementById("__docusaurus"),t=(0,h.jsx)(i.vd,{children:(0,h.jsx)(o.Kd,{children:(0,h.jsx)(G,{})})}),n=(e,t)=>{console.error("Docusaurus React Root onRecoverableError:",e,t)},s=()=>{if(re)r.startTransition((()=>{a.hydrateRoot(e,t,{onRecoverableError:n})}));else{const o=a.createRoot(e,{onRecoverableError:n});r.startTransition((()=>{o.render(t)}))}};L(window.location.pathname).then(s)}},6988:(e,t,n)=>{"use strict";n.d(t,{o:()=>d,l:()=>f});var r=n(6540),a=n(4784);const o=JSON.parse('{"docusaurus-lunr-search":{"default":{"fileNames":{"searchDoc":"search-doc-1724080561176.json","lunrIndex":"lunr-index-1724080561176.json"}}},"docusaurus-plugin-google-gtag":{"default":{"trackingID":["G-62D63SY3S0"],"anonymizeIP":false,"id":"default"}},"docusaurus-plugin-google-tag-manager":{"default":{"containerId":"GTM-PL63TR5","id":"default"}},"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/localstorage-indexeddb-cookies-opfs-sqlite-wasm","path":"/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm"},{"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":"articles/websockets-sse-polling-webrtc-webtransport","path":"/articles/websockets-sse-polling-webrtc-webtransport.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":"errors","path":"/errors.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":"reactivity","path":"/reactivity.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","sidebar":"tutorialSidebar"},{"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-pipeline","path":"/rx-pipeline.html","sidebar":"tutorialSidebar"},{"id":"rx-query","path":"/rx-query.html","sidebar":"tutorialSidebar"},{"id":"rx-schema","path":"/rx-schema.html","sidebar":"tutorialSidebar"},{"id":"rx-server","path":"/rx-server.html","sidebar":"tutorialSidebar"},{"id":"rx-server-scaling","path":"/rx-server-scaling.html","sidebar":"tutorialSidebar"},{"id":"rx-state","path":"/rx-state.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-mapped","path":"/rx-storage-memory-mapped.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","sidebar":"tutorialSidebar"},{"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 s=n(2654);const l=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-google-tag-manager":{"type":"package","name":"@docusaurus/plugin-google-tag-manager","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(4848);const u={siteConfig:a.default,siteMetadata:l,globalData:o,i18n:i,codeTranslations:s},d=r.createContext(u);function f(e){let{children:t}=e;return(0,c.jsx)(d.Provider,{value:u,children:t})}},7489:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var r=n(6540),a=n(8193),o=n(5260),i=n(440),s=n(8465),l=n(4848);function c(e){let{error:t,tryAgain:n}=e;return(0,l.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,l.jsx)("h1",{style:{fontSize:"3rem"},children:"This page crashed"}),(0,l.jsx)("button",{type:"button",onClick:n,style:{margin:"1rem 0",fontSize:"2rem",cursor:"pointer",borderRadius:20,padding:"1rem"},children:"Try again"}),(0,l.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,l.jsx)("p",{style:{whiteSpace:"pre-wrap"},children:n})}function d(e){let{error:t,tryAgain:n}=e;return(0,l.jsxs)(p,{fallback:()=>(0,l.jsx)(c,{error:t,tryAgain:n}),children:[(0,l.jsx)(o.A,{children:(0,l.jsx)("title",{children:"Page Error"})}),(0,l.jsx)(s.A,{children:(0,l.jsx)(c,{error:t,tryAgain:n})})]})}const f=e=>(0,l.jsx)(d,{...e});class p extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){a.A.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??f)(e)}return e??null}}},8193:(e,t,n)=>{"use strict";n.d(t,{A:()=>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}},5260:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});n(6540);var r=n(545),a=n(4848);function o(e){return(0,a.jsx)(r.mg,{...e})}},5489:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var r=n(6540),a=n(4625),o=n(440),i=n(4586),s=n(6654),l=n(8193),c=n(4848);const u=r.createContext({collectLink:()=>{}});var d=n(6025);function f(e,t){let{isNavLink:n,to:f,href:p,activeClassName:h,isActive:m,"data-noBrokenLinkCheck":g,autoAddBaseUrl:y=!0,...b}=e;const{siteConfig:{trailingSlash:v,baseUrl:w}}=(0,i.A)(),{withBaseUrl:x}=(0,d.h)(),k=(0,r.useContext)(u),_=(0,r.useRef)(null);(0,r.useImperativeHandle)(t,(()=>_.current));const S=f||p;const E=(0,s.A)(S),C=S?.replace("pathname://","");let O=void 0!==C?(T=C,y&&(e=>e.startsWith("/"))(T)?x(T):T):void 0;var T;O&&E&&(O=(0,o.applyTrailingSlash)(O,{trailingSlash:v,baseUrl:w}));const A=(0,r.useRef)(!1),j=n?a.k2:a.N_,P=l.A.canUseIntersectionObserver,R=(0,r.useRef)(),D=()=>{A.current||null==O||(window.docusaurus.preload(O),A.current=!0)};(0,r.useEffect)((()=>(!P&&E&&null!=O&&window.docusaurus.prefetch(O),()=>{P&&R.current&&R.current.disconnect()})),[R,O,P,E]);const I=O?.startsWith("#")??!1,N=!O||!E||I;return N||g||k.collectLink(O),N?(0,c.jsx)("a",{ref:_,href:O,...S&&!E&&{target:"_blank",rel:"noopener noreferrer"},...b}):(0,c.jsx)(j,{...b,onMouseEnter:D,onTouchStart:D,innerRef:e=>{_.current=e,P&&e&&E&&(R.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(R.current.unobserve(e),R.current.disconnect(),null!=O&&window.docusaurus.prefetch(O))}))})),R.current.observe(e))},to:O,...n&&{isActive:m,activeClassName:h}})}const p=r.forwardRef(f)},1312:(e,t,n)=>{"use strict";n.d(t,{A:()=>c,T:()=>l});var r=n(6540),a=n(4848);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(2654);function s(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 l(e,t){let{message:n,id:r}=e;return o(s({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=s({message:t,id:n});return(0,a.jsx)(a.Fragment,{children:o(i,r)})}},7065:(e,t,n)=>{"use strict";n.d(t,{W:()=>r});const r="default"},6654:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,{A:()=>a,z:()=>r})},6025:(e,t,n)=>{"use strict";n.d(t,{A:()=>s,h:()=>i});var r=n(6540),a=n(4586),o=n(6654);function i(){const{siteConfig:{baseUrl:e,url:t}}=(0,a.A)(),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.z)(n))return n;if(a)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;const s=n.startsWith(t)?n:t+n.replace(/^\//,"");return i?e+s:s}(t,e,n,r)),[t,e]);return{withBaseUrl:n}}function s(e,t){void 0===t&&(t={});const{withBaseUrl:n}=i();return n(e,t)}},4586:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540),a=n(6988);function o(){return(0,r.useContext)(a.o)}},6588:(e,t,n)=>{"use strict";n.d(t,{P_:()=>i,kh:()=>o});var r=n(4586),a=n(7065);function o(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,r.A)();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.W),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}},2303:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540),a=n(6125);function o(){return(0,r.useContext)(a.o)}},205:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(6540);const a=n(8193).A.canUseDOM?r.useLayoutEffect:r.useEffect},6921:(e,t,n)=>{"use strict";n.d(t,{A:()=>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 s=a?`${a}.${o}`:o;r(i)?e(i,s):t[s]=i}))}(e),t}},3102:(e,t,n)=>{"use strict";n.d(t,{W:()=>i,o:()=>o});var r=n(6540),a=n(4848);const o=r.createContext(null);function i(e){let{children:t,value:n}=e;const i=r.useContext(o),s=(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:s,children:t})}},8295:(e,t,n)=>{"use strict";n.d(t,{zK:()=>p,vT:()=>u,Gy:()=>l,HW:()=>h,ht:()=>c,r7:()=>f,jh:()=>d});var r=n(6347),a=n(6588);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.B6)(t,{path:e.path,exact:!1,strict:!1})))}(e,t),a=n?.docs.find((e=>!!(0,r.B6)(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 s={},l=()=>(0,a.kh)("docusaurus-plugin-content-docs")??s,c=e=>(0,a.P_)("docusaurus-plugin-content-docs",e,{failfast:!0});function u(e){void 0===e&&(e={});const t=l(),{pathname:n}=(0,r.zy)();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.B6)(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 f(e){const t=c(e);return o(t)}function p(e){const t=c(e),{pathname:n}=(0,r.zy)();return i(t,n)}function h(e){const t=c(e),{pathname:n}=(0,r.zy)();return function(e,t){const n=o(e);return{latestDocSuggestion:i(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},1911:(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")}))}}},6294:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(5947),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()}}},6134:(e,t,n)=>{"use strict";var r=n(1765),a=n(4784);!function(e){const{themeConfig:{prism:t}}=a.default,{additionalLanguages:r}=t;globalThis.Prism=e,r.forEach((e=>{"php"===e&&n(9700),n(8692)(`./prism-${e}`)})),delete globalThis.Prism}(r.My)},1107:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});n(6540);var r=n(4164),a=n(1312),o=n(6342),i=n(5489);const s={anchorWithStickyNavbar:"anchorWithStickyNavbar_LWe7",anchorWithHideOnScrollNavbar:"anchorWithHideOnScrollNavbar_WYt5"};var l=n(4848);function c(e){let{as:t,id:n,...c}=e;const{navbar:{hideOnScroll:u}}=(0,o.p)();if("h1"===t||!n)return(0,l.jsx)(t,{...c,id:void 0});const d=(0,a.T)({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,l.jsxs)(t,{...c,className:(0,r.A)("anchor",u?s.anchorWithHideOnScrollNavbar:s.anchorWithStickyNavbar,c.className),id:n,children:[c.children,(0,l.jsx)(i.A,{className:"hash-link",to:`#${n}`,"aria-label":d,title:d,children:"\u200b"})]})}},3186:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});n(6540);const r={iconExternalLink:"iconExternalLink_nPIU"};var a=n(4848);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"})})}},8465:(e,t,n)=>{"use strict";n.d(t,{A:()=>rt});var r=n(6540),a=n(4164),o=n(7489),i=n(1003),s=n(6347),l=n(1312),c=n(5062),u=n(4848);const d="__docusaurus_skipToContent_fallback";function f(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function p(){const e=(0,r.useRef)(null),{action:t}=(0,s.W6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(d);t&&f(t)}),[]);return(0,c.$)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&f(e.current)})),{containerRef:e,onClick:n}}const h=(0,l.T)({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 m(e){const t=e.children??h,{containerRef:n,onClick:r}=p();return(0,u.jsx)("div",{ref:n,role:"region","aria-label":h,children:(0,u.jsx)("a",{...e,href:`#${d}`,onClick:r,children:t})})}var g=n(7559),y=n(4090);const b={skipToContent:"skipToContent_fXgn"};function v(){return(0,u.jsx)(m,{className:b.skipToContent})}var w=n(6342),x=n(5041);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 _={closeButton:"closeButton_CVFx"};function S(e){return(0,u.jsx)("button",{type:"button","aria-label":(0,l.T)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"}),...e,className:(0,a.A)("clean-btn close",_.closeButton,e.className),children:(0,u.jsx)(k,{width:14,height:14,strokeWidth:3.1})})}const E={content:"content_knG7"};function C(e){const{announcementBar:t}=(0,w.p)(),{content:n}=t;return(0,u.jsx)("div",{...e,className:(0,a.A)(E.content,e.className),dangerouslySetInnerHTML:{__html:n}})}const O={announcementBar:"announcementBar_mb4j",announcementBarPlaceholder:"announcementBarPlaceholder_vyr4",announcementBarClose:"announcementBarClose_gvF7",announcementBarContent:"announcementBarContent_xLdY"};function T(){const{announcementBar:e}=(0,w.p)(),{isActive:t,close:n}=(0,x.Mj)();if(!t)return null;const{backgroundColor:r,textColor:a,isCloseable:o}=e;return(0,u.jsxs)("div",{className:O.announcementBar,style:{backgroundColor:r,color:a},role:"banner",children:[o&&(0,u.jsx)("div",{className:O.announcementBarPlaceholder}),(0,u.jsx)(C,{className:O.announcementBarContent}),o&&(0,u.jsx)(S,{onClick:n,className:O.announcementBarClose})]})}var A=n(9876),j=n(3104);var P=n(9532),R=n(5600);const D=r.createContext(null);function I(e){let{children:t}=e;const n=function(){const e=(0,A.M)(),t=(0,R.YL)(),[n,a]=(0,r.useState)(!1),o=null!==t.component,i=(0,P.ZC)(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)(D.Provider,{value:n,children:t})}function N(e){if(e.component){const t=e.component;return(0,u.jsx)(t,{...e.props})}}function L(){const e=(0,r.useContext)(D);if(!e)throw new P.dV("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,a=(0,r.useCallback)((()=>n(!1)),[n]),o=(0,R.YL)();return(0,r.useMemo)((()=>({shown:t,hide:a,content:N(o)})),[a,o,t])}function M(e){let{header:t,primaryMenu:n,secondaryMenu:r}=e;const{shown:o}=L();return(0,u.jsxs)("div",{className:"navbar-sidebar",children:[t,(0,u.jsxs)("div",{className:(0,a.A)("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(5293),B=n(2303);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:"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 q(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 z={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function U(e){let{className:t,buttonClassName:n,value:r,onChange:o}=e;const i=(0,B.A)(),s=(0,l.T)({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,l.T)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,l.T)({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.A)(z.toggle,t),children:(0,u.jsxs)("button",{className:(0,a.A)("clean-btn",z.toggleButton,!i&&z.toggleButtonDisabled,n),type:"button",onClick:()=>o("dark"===r?"light":"dark"),disabled:!i,title:s,"aria-label":s,"aria-live":"polite",children:[(0,u.jsx)($,{className:(0,a.A)(z.toggleIcon,z.lightToggleIcon)}),(0,u.jsx)(q,{className:(0,a.A)(z.toggleIcon,z.darkToggleIcon)})]})})}const K=r.memo(U),H={darkNavbarColorModeToggle:"darkNavbarColorModeToggle_X3D1"};function W(e){let{className:t}=e;const n=(0,w.p)().navbar.style,r=(0,w.p)().colorMode.disableSwitch,{colorMode:a,setColorMode:o}=(0,F.G)();return r?null:(0,u.jsx)(K,{className:t,buttonClassName:"dark"===n?H.darkNavbarColorModeToggle:void 0,value:a,onChange:o})}var V=n(9529);function G(){return(0,u.jsx)(V.A,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function Q(){const e=(0,A.M)();return(0,u.jsx)("button",{type:"button","aria-label":(0,l.T)({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)(G,{}),(0,u.jsx)(W,{className:"margin-right--md"}),(0,u.jsx)(Q,{})]})}var Z=n(5489),J=n(6025),X=n(6654);function ee(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}var te=n(3186);function ne(e){let{activeBasePath:t,activeBaseRegex:n,to:r,href:a,label:o,html:i,isDropdownLink:s,prependBaseUrlToHref:l,...c}=e;const d=(0,J.A)(r),f=(0,J.A)(t),p=(0,J.A)(a,{forcePrependBaseUrl:!0}),h=o&&a&&!(0,X.A)(a),m=i?{dangerouslySetInnerHTML:{__html:i}}:{children:(0,u.jsxs)(u.Fragment,{children:[o,h&&(0,u.jsx)(te.A,{...s&&{width:12,height:12}})]})};return a?(0,u.jsx)(Z.A,{href:l?p:a,...c,...m}):(0,u.jsx)(Z.A,{to:d,isNavLink:!0,...(t||n)&&{isActive:(e,t)=>n?ee(n,t.pathname):t.pathname.startsWith(f)},...c,...m})}function re(e){let{className:t,isDropdownItem:n=!1,...r}=e;const o=(0,u.jsx)(ne,{className:(0,a.A)(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.A)("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(1422),se=n(9169),le=n(4586);const ce={dropdownNavbarItemMobile:"dropdownNavbarItemMobile_S0Fm"};function ue(e,t){return e.some((e=>function(e,t){return!!(0,se.ys)(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,...s}=e;const l=(0,r.useRef)(null),[c,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{l.current&&!l.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)}}),[l]),(0,u.jsxs)("div",{ref:l,className:(0,a.A)("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:s.to?void 0:"#",className:(0,a.A)("navbar__link",o),...s,onClick:s.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(!c))},children:s.children??s.label}),(0,u.jsx)("ul",{className:"dropdown__menu",children:t.map(((e,t)=>(0,r.createElement)(Ae,{isDropdownItem:!0,activeClassName:"dropdown__link--active",...e,key:t})))})]})}function fe(e){let{items:t,className:n,position:o,onClick:i,...l}=e;const c=function(){const{siteConfig:{baseUrl:e}}=(0,le.A)(),{pathname:t}=(0,s.zy)();return t.replace(e,"/")}(),d=ue(t,c),{collapsed:f,toggleCollapsed:p,setCollapsed:h}=(0,ie.u)({initialState:()=>!d});return(0,r.useEffect)((()=>{d&&h(!d)}),[c,d,h]),(0,u.jsxs)("li",{className:(0,a.A)("menu__list-item",{"menu__list-item--collapsed":f}),children:[(0,u.jsx)(ne,{role:"button",className:(0,a.A)(ce.dropdownNavbarItemMobile,"menu__link menu__link--sublist menu__link--sublist-caret",n),...l,onClick:e=>{e.preventDefault(),p()},children:l.children??l.label}),(0,u.jsx)(ie.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:f,children:t.map(((e,t)=>(0,r.createElement)(Ae,{mobile:!0,isDropdownItem:!0,onClick:i,activeClassName:"menu__link--active",...e,key:t})))})]})}function pe(e){let{mobile:t=!1,...n}=e;const r=t?fe:de;return(0,u.jsx)(r,{...n})}var he=n(2131);function me(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 ye=n(6588),be=n(689),ve=n.n(be);function we(){const e=(0,s.zy)(),t=(0,s.W6)(),{siteConfig:{baseUrl:n}}=(0,le.A)(),[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,l]=(0,r.useState)(!1),c=(0,s.W6)(),{siteConfig:d={}}=(0,le.A)(),f=(d.plugins||[]).find((e=>Array.isArray(e)&&"string"==typeof e[0]&&e[0].includes("docusaurus-lunr-search"))),p=(0,B.A)(),{baseUrl:h}=d,m=f&&f[1]?.assetUrl||h,g=(0,ye.P_)("docusaurus-lunr-search"),y=()=>{t.current||(Promise.all([fetch(`${m}${g.fileNames.searchDoc}`).then((e=>e.json())),fetch(`${m}${g.fileNames.lunrIndex}`).then((e=>e.json())),Promise.all([n.e(4250),n.e(7443)]).then(n.bind(n,4004)),Promise.all([n.e(1869),n.e(9187)]).then(n.bind(n,9187))]).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:h,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),l(!0))})),t.current=!0)},b=(0,r.useCallback)((t=>{o.current.contains(t.target)||o.current.focus(),e.handleSearchBarToggle&&e.handleSearchBarToggle(!e.isSearchBarExpanded)}),[e.isSearchBarExpanded]);let v;return p&&(y(),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.A)("search-icon",{"search-icon-hidden":e.isSearchBarExpanded}),onClick:b,onKeyDown:b,tabIndex:0}),(0,u.jsx)("input",{id:"search_input_react",type:"search",placeholder:i?v:"Loading...","aria-label":"Search",className:(0,a.A)("navbar__search-input",{"search-bar-expanded":e.isSearchBarExpanded},{"search-bar":!e.isSearchBarExpanded}),onClick:y,onMouseOver:y,onFocus:b,onBlur:b,ref:o,disabled:!i}),(0,u.jsx)(we,{})]},"search-box")},ke={navbarSearchContainer:"navbarSearchContainer_Bca1"};function _e(e){let{children:t,className:n}=e;return(0,u.jsx)("div",{className:(0,a.A)(n,ke.navbarSearchContainer),children:t})}var Se=n(8295),Ee=n(1754);var Ce=n(5597);const Oe=e=>e.docs.find((t=>t.id===e.mainDocId));const Te={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,le.A)(),f=(0,he.o)(),{search:p,hash:h}=(0,s.zy)(),m=[...n,...c.map((e=>{const n=`${`pathname://${f.createUrl({locale:e,fullyQualified:!1})}`}${p}${h}${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,l.T)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):d[i].label;return(0,u.jsx)(pe,{...o,mobile:t,label:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(me,{className:ge}),g]}),items:m})},search:function(e){let{mobile:t,className:n}=e;return t?null:(0,u.jsx)(_e,{className:n,children:(0,u.jsx)(xe,{})})},dropdown:pe,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.A)({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,Se.zK)(r),i=(0,Ee.QB)(t,r),s=o?.path===i?.path;return null===i||i.unlisted&&!s?null:(0,u.jsx)(oe,{exact:!0,...a,isActive:()=>s||!!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,Se.zK)(r),i=(0,Ee.fW)(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,Ee.Vd)(r)[0],i=t??o.label,s=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(o).path;return(0,u.jsx)(oe,{...a,label:i,to:s})},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:r,dropdownItemsBefore:a,dropdownItemsAfter:o,...i}=e;const{search:c,hash:d}=(0,s.zy)(),f=(0,Se.zK)(n),p=(0,Se.jh)(n),{savePreferredVersionName:h}=(0,Ce.g1)(n),m=[...a,...p.map((e=>{const t=f.alternateDocVersions[e.name]??Oe(e);return{label:e.label,to:`${t.path}${c}${d}`,isActive:()=>e===f.activeVersion,onClick:()=>h(e.name)}})),...o],g=(0,Ee.Vd)(n)[0],y=t&&m.length>1?(0,l.T)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):g.label,b=t&&m.length>1?void 0:Oe(g).path;return m.length<=1?(0,u.jsx)(oe,{...i,mobile:t,label:y,to:b,isActive:r?()=>!1:void 0}):(0,u.jsx)(pe,{...i,mobile:t,label:y,to:b,items:m,isActive:r?()=>!1:void 0})}};function Ae(e){let{type:t,...n}=e;const r=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),a=Te[r];if(!a)throw new Error(`No NavbarItem component found for type "${t}".`);return(0,u.jsx)(a,{...n})}function je(){const e=(0,A.M)(),t=(0,w.p)().navbar.items;return(0,u.jsx)("ul",{className:"menu__list",children:t.map(((t,n)=>(0,r.createElement)(Ae,{mobile:!0,...t,onClick:()=>e.toggle(),key:n})))})}function Pe(e){return(0,u.jsx)("button",{...e,type:"button",className:"clean-btn navbar-sidebar__back",children:(0,u.jsx)(l.A,{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 Re(){const e=0===(0,w.p)().navbar.items.length,t=L();return(0,u.jsxs)(u.Fragment,{children:[!e&&(0,u.jsx)(Pe,{onClick:()=>t.hide()}),t.content]})}function De(){const e=(0,A.M)();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)(je,{}),secondaryMenu:(0,u.jsx)(Re,{})}):null}const Ie={navbarHideable:"navbarHideable_m1mJ",navbarHidden:"navbarHidden_jGov"};function Ne(e){return(0,u.jsx)("div",{role:"presentation",...e,className:(0,a.A)("navbar-sidebar__backdrop",e.className)})}function Le(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:o}}=(0,w.p)(),i=(0,A.M)(),{navbarRef:s,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,j.Mq)(((t,r)=>{let{scrollY:i}=t;if(!e)return;if(i=s?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:s,"aria-label":(0,l.T)({id:"theme.NavBar.navAriaLabel",message:"Main",description:"The ARIA label for the main navigation"}),className:(0,a.A)("navbar","navbar--fixed-top",n&&[Ie.navbarHideable,!d&&Ie.navbarHidden],{"navbar--dark":"dark"===o,"navbar--primary":"primary"===o,"navbar-sidebar--show":i.shown}),children:[t,(0,u.jsx)(Ne,{onClick:i.toggle}),(0,u.jsx)(De,{})]})}var Me=n(440);const Fe={errorBoundaryError:"errorBoundaryError_a6uf",errorBoundaryFallback:"errorBoundaryFallback_VBag"};function Be(e){return(0,u.jsx)("button",{type:"button",...e,children:(0,u.jsx)(l.A,{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 $e(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 qe extends r.Component{componentDidCatch(e,t){throw this.props.onError(e,t)}render(){return this.props.children}}const ze="right";function Ue(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 Ke(){const{toggle:e,shown:t}=(0,A.M)();return(0,u.jsx)("button",{onClick:e,"aria-label":(0,l.T)({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)(Ue,{})})}const He={colorModeToggle:"colorModeToggle_DEke"};function We(e){let{items:t}=e;return(0,u.jsx)(u.Fragment,{children:t.map(((e,t)=>(0,u.jsx)(qe,{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)(Ae,{...e})},t)))})}function Ve(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 Ge(){const e=(0,A.M)(),t=(0,w.p)().navbar.items,[n,r]=function(e){function t(e){return"left"===(e.position??ze)}return[e.filter(t),e.filter((e=>!t(e)))]}(t),a=t.find((e=>"search"===e.type));return(0,u.jsx)(Ve,{left:(0,u.jsxs)(u.Fragment,{children:[!e.disabled&&(0,u.jsx)(Ke,{}),(0,u.jsx)(G,{}),(0,u.jsx)(We,{items:n})]}),right:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(We,{items:r}),(0,u.jsx)(W,{className:He.colorModeToggle}),!a&&(0,u.jsx)(_e,{children:(0,u.jsx)(xe,{})})]})})}function Qe(){return(0,u.jsx)(Le,{children:(0,u.jsx)(Ge,{})})}function Ye(e){const[t,n]=(0,r.useState)(0),a=()=>{const e=((document.documentElement.scrollTop+document.body.scrollTop)/(document.documentElement.scrollHeight-document.documentElement.clientHeight)*100).toFixed(2);n(e)};return(0,r.useEffect)((()=>(window.addEventListener("scroll",a,{passive:!0}),()=>{window.removeEventListener("scroll",a)})),[]),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Qe,{...e}),(0,u.jsx)("div",{style:{position:"fixed",display:"block",zIndex:10,height:3,backgroundColor:"var(--color-top)",top:60,borderTopRightRadius:2,borderBottomRightRadius:2,width:t+"%"}})]})}function Ze(){const e={navLinks:[{label:"Pricing",href:"/premium"},{href:"/consulting",label:"Consulting"},{label:"Documentation",href:"/quickstart.html"},{label:"Discord",target:"_blank",href:"/chat"},{label:"Github",target:"_blank",href:"/code"},{label:"Twitter",href:"https://twitter.com/intent/user?screen_name=rxdbjs",target:"_blank"},{label:"LinkedIn",href:"https://www.linkedin.com/company/rxdb",target:"_blank"}],communityLinks:[{label:"Discord",target:"_blank",href:"/chat",logo:"/img/community-links/discord-logo.svg"},{label:"Github",target:"_blank",href:"/code",logo:"/img/community-links/github-logo.svg"},{label:"Twitter",href:"https://twitter.com/intent/user?screen_name=rxdbjs",target:"_blank",logo:"/img/community-links/x-logo.svg"},{label:"LinkedIn",href:"https://www.linkedin.com/company/rxdb",target:"_blank",logo:"/img/community-links/linkedin-logo.svg"},{label:"Stack Overflow",href:"https://stackoverflow.com/questions/tagged/rxdb",target:"_blank",logo:"/img/community-links/stack-overflow-logo.svg"}],policyLinks:[{label:"Legal Notice",target:"_blank",href:"/legal-notice"}]},t=`\xa9 ${(new Date).getFullYear()} RxDB. All rights reserved.`;return(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(u.Fragment,{children:(0,u.jsx)("div",{className:"block footer",children:(0,u.jsxs)("div",{className:"footer-block",children:[(0,u.jsxs)("div",{className:"footer-links",children:[(0,u.jsxs)("span",{children:[(0,u.jsxs)("a",{variant:"text",href:"/",className:"footer-logo-button",children:[(0,u.jsx)("img",{src:"/files/logo/logo.svg",alt:"RxDB"}),(0,u.jsx)("div",{children:"RxDB"})]}),(0,u.jsx)("div",{className:"footer-community-links",children:e.communityLinks.map(((e,t)=>(0,u.jsx)("a",{variant:"text",href:e.href,target:e.target?"_blank":"",children:(0,u.jsx)("img",{src:e.logo,alt:"logo"})},e.href+t)))})]}),(0,u.jsx)("div",{className:"footer-nav-links",children:e.navLinks.map(((e,t)=>(0,u.jsx)("a",{variant:"text",href:e.href,target:e.target?"_blank":"",children:e.label},e.href+t)))})]}),(0,u.jsxs)("div",{className:"footer-policy",children:[(0,u.jsx)("div",{children:e.policyLinks.map(((e,t)=>(0,u.jsx)("a",{variant:"text",href:e.href,target:e.target?"_blank":"",children:e.label},e.href+t)))}),(0,u.jsx)("span",{className:"footer-rights",children:t})]}),(0,u.jsx)("img",{className:"footer-img desktop-img",src:"/img/footer-column.svg",alt:"columns"})]})})})})}const Je=(0,P.fM)([F.a,x.oq,j.Tv,Ce.VQ,i.Jx,function(e){let{children:t}=e;return(0,u.jsx)(R.y_,{children:(0,u.jsx)(A.e,{children:(0,u.jsx)(I,{children:t})})})}]);function Xe(e){let{children:t}=e;return(0,u.jsx)(Je,{children:t})}var et=n(1107);function tt(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)(et.A,{as:"h1",className:"hero__title",children:(0,u.jsx)(l.A,{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)(Be,{onClick:n,className:"button button--primary shadow--lw"})}),(0,u.jsx)("hr",{}),(0,u.jsx)("div",{className:"margin-vert--md",children:(0,u.jsx)($e,{error:t})})]})})})}const nt={mainWrapper:"mainWrapper_z2l0"};function rt(e){const{children:t,noFooter:n,wrapperClassName:r,title:s,description:l}=e;return(0,y.J)(),(0,u.jsxs)(Xe,{children:[(0,u.jsx)(i.be,{title:s,description:l}),(0,u.jsx)(v,{}),(0,u.jsx)(T,{}),(0,u.jsx)(Ye,{}),(0,u.jsx)("div",{id:d,className:(0,a.A)(g.G.wrapper.main,nt.mainWrapper,r),children:(0,u.jsx)(o.A,{fallback:e=>(0,u.jsx)(tt,{...e}),children:t})}),!n&&(0,u.jsx)(Ze,{})]})}},9529:(e,t,n)=>{"use strict";n.d(t,{A:()=>g});var r=n(6540),a=n(5489),o=n(6025),i=n(4586),s=n(6342),l=n(4164),c=n(2303),u=n(5293);const d={themedComponent:"themedComponent_mlkZ","themedComponent--light":"themedComponent--light_NVdE","themedComponent--dark":"themedComponent--dark_xIcU"};var f=n(4848);function p(e){let{className:t,children:n}=e;const a=(0,c.A)(),{colorMode:o}=(0,u.G)();return(0,f.jsx)(f.Fragment,{children:(a?"dark"===o?["dark"]:["light"]:["light","dark"]).map((e=>{const a=n({theme:e,className:(0,l.A)(t,d.themedComponent,d[`themedComponent--${e}`])});return(0,f.jsx)(r.Fragment,{children:a},e)}))})}function h(e){const{sources:t,className:n,alt:r,...a}=e;return(0,f.jsx)(p,{className:n,children:e=>{let{theme:n,className:o}=e;return(0,f.jsx)("img",{src:t[n],alt:r,className:o,...a})}})}function m(e){let{logo:t,alt:n,imageClassName:r}=e;const a={light:(0,o.A)(t.src),dark:(0,o.A)(t.srcDark||t.src)},i=(0,f.jsx)(h,{className:t.className,sources:a,height:t.height,width:t.width,alt:n,style:t.style});return r?(0,f.jsx)("div",{className:r,children:i}):i}function g(e){const{siteConfig:{title:t}}=(0,i.A)(),{navbar:{title:n,logo:r}}=(0,s.p)(),{imageClassName:l,titleClassName:c,...u}=e,d=(0,o.A)(r?.href||"/"),p=n?"":t,h=r?.alt??p;return(0,f.jsxs)(a.A,{to:d,...u,...r?.target&&{target:r.target},children:[r&&(0,f.jsx)(m,{logo:r,alt:h,imageClassName:l}),null!=n&&(0,f.jsx)("b",{className:c,children:n})]})}},1463:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});n(6540);var r=n(5260),a=n(4848);function o(e){let{locale:t,version:n,tag:o}=e;const i=t;return(0,a.jsxs)(r.A,{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})]})}},1422:(e,t,n)=>{"use strict";n.d(t,{N:()=>y,u:()=>c});var r=n(6540),a=n(8193),o=n(205),i=n(3109),s=n(4848);const l="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 f(e,t){const n=t?u:d;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function p(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.O)())return 1;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${a?.easing??l}`,height:`${t}px`}}function s(){const t=r();e.style.transition=t.transition,e.style.height=t.height}if(!o.current)return f(e,n),void(o.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(s(),requestAnimationFrame((()=>{e.style.height=u.height,e.style.overflow=u.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{s()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,a])}function h(e){if(!a.A.canUseDOM)return e?u:d}function m(e){let{as:t="div",collapsed:n,children:a,animation:o,onCollapseTransitionEnd:i,className:l,disableSSRStyle:c}=e;const u=(0,r.useRef)(null);return p({collapsibleRef:u,collapsed:n,animation:o}),(0,s.jsx)(t,{ref:u,style:c?void 0:h(n),onTransitionEnd:e=>{"height"===e.propertyName&&(f(u.current,n),i?.(n))},className:l,children:a})}function g(e){let{collapsed:t,...n}=e;const[a,i]=(0,r.useState)(!t),[l,c]=(0,r.useState)(t);return(0,o.A)((()=>{t||i(!0)}),[t]),(0,o.A)((()=>{a&&c(t)}),[a,t]),a?(0,s.jsx)(m,{...n,collapsed:l}):null}function y(e){let{lazy:t,...n}=e;const r=t?g:m;return(0,s.jsx)(r,{...n})}},5041:(e,t,n)=>{"use strict";n.d(t,{Mj:()=>m,oq:()=>h});var r=n(6540),a=n(2303),o=n(9466),i=n(9532),s=n(6342),l=n(4848);const c=(0,o.Wf)("docusaurus.announcement.dismiss"),u=(0,o.Wf)("docusaurus.announcement.id"),d=()=>"true"===c.get(),f=e=>c.set(String(e)),p=r.createContext(null);function h(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,s.p)(),t=(0,a.A)(),[n,o]=(0,r.useState)((()=>!!t&&d()));(0,r.useEffect)((()=>{o(d())}),[]);const i=(0,r.useCallback)((()=>{f(!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&&f(!1),!r&&d()||o(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:i})),[e,n,i])}();return(0,l.jsx)(p.Provider,{value:n,children:t})}function m(){const e=(0,r.useContext)(p);if(!e)throw new i.dV("AnnouncementBarProvider");return e}},5293:(e,t,n)=>{"use strict";n.d(t,{G:()=>y,a:()=>g});var r=n(6540),a=n(8193),o=n(9532),i=n(9466),s=n(6342),l=n(4848);const c=r.createContext(void 0),u="theme",d=(0,i.Wf)(u),f={light:"light",dark:"dark"},p=e=>e===f.dark?f.dark:f.light,h=e=>a.A.canUseDOM?p(document.documentElement.getAttribute("data-theme")):p(e),m=e=>{d.set(p(e))};function g(e){let{children:t}=e;const n=function(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,s.p)(),[a,o]=(0,r.useState)(h(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&&m(t)):(o(n?window.matchMedia("(prefers-color-scheme: dark)").matches?f.dark:f.light:e),d.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",p(a))}),[a]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==u)return;const t=d.get();null!==t&&i(p(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,i]);const l=(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||l.current?l.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===f.dark},setLightTheme(){i(f.light)},setDarkTheme(){i(f.dark)}})),[a,i])}();return(0,l.jsx)(c.Provider,{value:n,children:t})}function y(){const e=(0,r.useContext)(c);if(null==e)throw new o.dV("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},5597:(e,t,n)=>{"use strict";n.d(t,{VQ:()=>y,g1:()=>v});var r=n(6540),a=n(8295),o=n(7065),i=n(6342),s=n(1754),l=n(9532),c=n(9466),u=n(4848);const d=e=>`docs-preferred-version-${e}`,f={save:(e,t,n)=>{(0,c.Wf)(d(e),{persistence:t}).set(n)},read:(e,t)=>(0,c.Wf)(d(e),{persistence:t}).get(),clear:(e,t)=>{(0,c.Wf)(d(e),{persistence:t}).del()}},p=e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}])));const h=r.createContext(null);function m(){const e=(0,a.Gy)(),t=(0,i.p)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[o,s]=(0,r.useState)((()=>p(n)));(0,r.useEffect)((()=>{s(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function a(e){const t=f.read(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(f.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){f.save(e,t,n),s((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function g(e){let{children:t}=e;const n=m();return(0,u.jsx)(h.Provider,{value:n,children:t})}function y(e){let{children:t}=e;return s.C5?(0,u.jsx)(g,{children:t}):(0,u.jsx)(u.Fragment,{children:t})}function b(){const e=(0,r.useContext)(h);if(!e)throw new l.dV("DocsPreferredVersionContextProvider");return e}function v(e){void 0===e&&(e=o.W);const t=(0,a.ht)(e),[n,i]=b(),{preferredVersionName:s}=n[e];return{preferredVersion:t.versions.find((e=>e.name===s))??null,savePreferredVersionName:(0,r.useCallback)((t=>{i.savePreferredVersion(e,t)}),[i,e])}}},1826:(e,t,n)=>{"use strict";n.d(t,{V:()=>l,t:()=>c});var r=n(6540),a=n(9532),o=n(4848);const i=Symbol("EmptyContext"),s=r.createContext(i);function l(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)(s.Provider,{value:i,children:t})}function c(){const e=(0,r.useContext)(s);if(e===i)throw new a.dV("DocsSidebarProvider");return e}},2252:(e,t,n)=>{"use strict";n.d(t,{n:()=>s,r:()=>l});var r=n(6540),a=n(9532),o=n(4848);const i=r.createContext(null);function s(e){let{children:t,version:n}=e;return(0,o.jsx)(i.Provider,{value:n,children:t})}function l(){const e=(0,r.useContext)(i);if(null===e)throw new a.dV("DocsVersionProvider");return e}},9876:(e,t,n)=>{"use strict";n.d(t,{e:()=>p,M:()=>h});var r=n(6540),a=n(5600),o=n(4581),i=n(6347),s=n(9532);function l(e){!function(e){const t=(0,i.W6)(),n=(0,s._q)(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(6342),u=n(4848);const d=r.createContext(void 0);function f(){const e=function(){const e=(0,a.YL)(),{items:t}=(0,c.p)().navbar;return 0===t.length&&!e.component}(),t=(0,o.l)(),n=!e&&"mobile"===t,[i,s]=(0,r.useState)(!1);l((()=>{if(i)return s(!1),!1}));const u=(0,r.useCallback)((()=>{s((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&s(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:i})),[e,n,u,i])}function p(e){let{children:t}=e;const n=f();return(0,u.jsx)(d.Provider,{value:n,children:t})}function h(){const e=r.useContext(d);if(void 0===e)throw new s.dV("NavbarMobileSidebarProvider");return e}},5600:(e,t,n)=>{"use strict";n.d(t,{GX:()=>c,YL:()=>l,y_:()=>s});var r=n(6540),a=n(9532),o=n(4848);const i=r.createContext(null);function s(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 l(){const e=(0,r.useContext)(i);if(!e)throw new a.dV("NavbarSecondaryMenuContentProvider");return e[0]}function c(e){let{component:t,props:n}=e;const o=(0,r.useContext)(i);if(!o)throw new a.dV("NavbarSecondaryMenuContentProvider");const[,s]=o,l=(0,a.Be)(n);return(0,r.useEffect)((()=>{s({component:t,props:l})}),[s,t,l]),(0,r.useEffect)((()=>()=>s({component:null,props:null})),[s]),null}},4090:(e,t,n)=>{"use strict";n.d(t,{w:()=>a,J:()=>o});var r=n(6540);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)}}),[])}},4581:(e,t,n)=>{"use strict";n.d(t,{l:()=>s});var r=n(6540),a=n(8193);const o={desktop:"desktop",mobile:"mobile",ssr:"ssr"},i=996;function s(){const[e,t]=(0,r.useState)((()=>"ssr"));return(0,r.useEffect)((()=>{function e(){t(function(){if(!a.A.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}},7559:(e,t,n)=>{"use strict";n.d(t,{G:()=>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:{}}},3109:(e,t,n)=>{"use strict";function r(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}n.d(t,{O:()=>r})},1754:(e,t,n)=>{"use strict";n.d(t,{Nr:()=>p,w8:()=>g,C5:()=>f,B5:()=>S,Vd:()=>x,QB:()=>_,fW:()=>k,OF:()=>w,Y:()=>b});var r=n(6540),a=n(6347),o=n(2831),i=n(8295),s=n(5597),l=n(2252),c=n(1826);function u(e){return Array.from(new Set(e))}var d=n(9169);const f=!!i.Gy;function p(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=p(t);if(e)return e}}(e):void 0:e.href}const h=(e,t)=>void 0!==e&&(0,d.ys)(e,t),m=(e,t)=>e.some((e=>g(e,t)));function g(e,t){return"link"===e.type?h(e.href,t):"category"===e.type&&(h(e.href,t)||m(e.items,t))}function y(e,t){switch(e.type){case"category":return g(e,t)||e.items.some((e=>y(e,t)));case"link":return!e.unlisted||g(e,t);default:return!0}}function b(e,t){return(0,r.useMemo)((()=>e.filter((e=>y(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.ys)(o.href,n)||e(o.items))||"link"===o.type&&(0,d.ys)(o.href,n)){return r&&"category"!==o.type||a.unshift(o),!0}return!1}(t),a}function w(){const e=(0,c.t)(),{pathname:t}=(0,a.zy)(),n=(0,i.vT)()?.pluginData.breadcrumbs;return!1!==n&&e?v({sidebarItems:e.items,pathname:t}):null}function x(e){const{activeVersion:t}=(0,i.zK)(e),{preferredVersion:n}=(0,s.g1)(e),a=(0,i.r7)(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 _(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 S(e){let{route:t}=e;const n=(0,a.zy)(),r=(0,l.r)(),i=t.routes,s=i.find((e=>(0,a.B6)(n.pathname,e)));if(!s)return null;const c=s.sidebar,u=c?r.docsSidebars[c]:void 0;return{docElement:(0,o.v)(i),sidebarName:c,sidebarItems:u}}},1003:(e,t,n)=>{"use strict";n.d(t,{e3:()=>p,be:()=>d,Jx:()=>h});var r=n(6540),a=n(4164),o=n(5260),i=n(3102);function s(){const e=r.useContext(i.o);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var l=n(6025),c=n(4586);var u=n(4848);function d(e){let{title:t,description:n,keywords:r,image:a,children:i}=e;const s=function(e){const{siteConfig:t}=(0,c.A)(),{title:n,titleDelimiter:r}=t;return e?.trim().length?`${e.trim()} ${r} ${n}`:n}(t),{withBaseUrl:d}=(0,l.h)(),f=a?d(a,{absolute:!0}):void 0;return(0,u.jsxs)(o.A,{children:[t&&(0,u.jsx)("title",{children:s}),t&&(0,u.jsx)("meta",{property:"og:title",content:s}),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}),f&&(0,u.jsx)("meta",{property:"og:image",content:f}),f&&(0,u.jsx)("meta",{name:"twitter:image",content:f}),i]})}const f=r.createContext(void 0);function p(e){let{className:t,children:n}=e;const i=r.useContext(f),s=(0,a.A)(i,t);return(0,u.jsxs)(f.Provider,{value:s,children:[(0,u.jsx)(o.A,{children:(0,u.jsx)("html",{className:s})}),n]})}function h(e){let{children:t}=e;const n=s(),r=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const o=`plugin-id-${n.plugin.id}`;return(0,u.jsx)(p,{className:(0,a.A)(r,o),children:t})}},9532:(e,t,n)=>{"use strict";n.d(t,{Be:()=>c,ZC:()=>s,_q:()=>i,dV:()=>l,fM:()=>u});var r=n(6540),a=n(205),o=n(4848);function i(e){const t=(0,r.useRef)(e);return(0,a.A)((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function s(e){const t=(0,r.useRef)();return(0,a.A)((()=>{t.current=e})),t.current}class l 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)})}}},9169:(e,t,n)=>{"use strict";n.d(t,{Dt:()=>s,ys:()=>i});var r=n(6540),a=n(8328),o=n(4586);function i(e,t){const n=e=>(!e||e.endsWith("/")?e:`${e}/`)?.toLowerCase();return n(e)===n(t)}function s(){const{baseUrl:e}=(0,o.A)().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.A,baseUrl:e})),[e])}},3104:(e,t,n)=>{"use strict";n.d(t,{Mq:()=>f,Tv:()=>c,gk:()=>p});var r=n(6540),a=n(8193),o=n(2303),i=(n(205),n(9532)),s=n(4848);const l=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,s.jsx)(l.Provider,{value:n,children:t})}function u(){const e=(0,r.useContext)(l);if(null==e)throw new i.dV("ScrollControllerProvider");return e}const d=()=>a.A.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function f(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=u(),a=(0,r.useRef)(d()),o=(0,i._q)(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 p(){const e=(0,r.useRef)(null),t=(0,o.A)()&&"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?.()}}},2967:(e,t,n)=>{"use strict";n.d(t,{Cy:()=>r,tU:()=>a});n(4586);const r="default";function a(e,t){return`docs-${e}-${t}`}},9466:(e,t,n)=>{"use strict";n.d(t,{Wf:()=>l});n(6540);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 s={get:()=>null,set:()=>{},del:()=>{},listen:()=>()=>{}};function l(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?s:{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),()=>{}}}}}},2131:(e,t,n)=>{"use strict";n.d(t,{o:()=>i});var r=n(4586),a=n(6347),o=n(440);function i(){const{siteConfig:{baseUrl:e,url:t,trailingSlash:n},i18n:{defaultLocale:i,currentLocale:s}}=(0,r.A)(),{pathname:l}=(0,a.zy)(),c=(0,o.applyTrailingSlash)(l,{trailingSlash:n,baseUrl:e}),u=s===i?e:e.replace(`/${s}/`,"/"),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}`}}}},5062:(e,t,n)=>{"use strict";n.d(t,{$:()=>i});var r=n(6540),a=n(6347),o=n(9532);function i(e){const t=(0,a.zy)(),n=(0,o.ZC)(t),i=(0,o._q)(e);(0,r.useEffect)((()=>{n&&t!==n&&i({location:t,previousLocation:n})}),[i,t,n])}},6342:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(4586);function a(){return(0,r.A)().siteConfig.themeConfig}},2983:(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)}},253:(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]}},440: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(2983);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return r(a).default}});var o=n(253);Object.defineProperty(t,"getErrorCausalChain",{enumerable:!0,get:function(){return o.getErrorCausalChain}})},9961:(e,t,n)=>{"use strict";n.d(t,{Tj:()=>es,C3:()=>Xi,IA:()=>Ji});var r=n(8900);const a=Symbol.for("Dexie"),o=globalThis[a]||(globalThis[a]=r);if(r.semVer!==o.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${r.semVer} and ${o.semVer}`);const{liveQuery:i,mergeRanges:s,rangesOverlap:l,RangeSet:c,cmp:u,Entity:d,PropModSymbol:f,PropModification:p,replacePrefix:h,add:m,remove:g}=o;function y(e,t){var n=e.get(t);if(void 0===n)throw new Error("missing value from map "+t);return n}function b(e,t,n,r){var a=e.get(t);return void 0===a?(a=n(),e.set(t,a)):r&&r(a),a}function v(e){return Object.assign({},e)}function w(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=>w(e,t)));if("object"==typeof e&&!Array.isArray(e)){var n={};return Object.keys(e).sort(((e,t)=>e.localeCompare(t))).forEach((r=>{n[r]=w(e[r],t)})),n}return e}var x=function e(t){if(!t)return t;if(null===t||"object"!=typeof t)return t;if(Array.isArray(t)){for(var n=new Array(t.length),r=n.length;r--;)n[r]=e(t[r]);return n}var a={};for(var o in t)a[o]=e(t[o]);return a};function k(e,t,n){return Object.defineProperty(e,t,{get:function(){return n}}),n}var _=e=>{var t=typeof e;return null!==e&&("object"===t||"function"===t)},S=new Set(["__proto__","prototype","constructor"]),E=new Set("0123456789");function C(e){var t=[],n="",r="start",a=!1;for(var o of e)switch(o){case"\\":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r)throw new Error("Invalid character after an index");a&&(n+=o),r="property",a=!a;break;case".":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r){r="property";break}if(a){a=!1,n+=o;break}if(S.has(n))return[];t.push(n),n="",r="property";break;case"[":if("index"===r)throw new Error("Invalid character in an index");if("indexEnd"===r){r="index";break}if(a){a=!1,n+=o;break}if("property"===r){if(S.has(n))return[];t.push(n),n=""}r="index";break;case"]":if("index"===r){t.push(Number.parseInt(n,10)),n="",r="indexEnd";break}if("indexEnd"===r)throw new Error("Invalid character after an index");default:if("index"===r&&!E.has(o))throw new Error("Invalid character in an index");if("indexEnd"===r)throw new Error("Invalid character after an index");"start"===r&&(r="property"),a&&(a=!1,n+="\\"),n+=o}switch(a&&(n+="\\"),r){case"property":if(S.has(n))return[];t.push(n);break;case"index":throw new Error("Index was not closed");case"start":t.push("")}return t}function O(e,t){if("number"!=typeof t&&Array.isArray(e)){var n=Number.parseInt(t,10);return Number.isInteger(n)&&e[n]===e[t]}return!1}function T(e,t){if(O(e,t))throw new Error("Cannot use string index")}function A(e,t,n){if(Array.isArray(t)&&(t=t.join(".")),!t.includes(".")&&!t.includes("["))return e[t];if(!_(e)||"string"!=typeof t)return void 0===n?e:n;var r=C(t);if(0===r.length)return n;for(var a=0;a!1,deepFreezeWhenDevMode:e=>e,tunnelErrorMessage:e=>"RxDB Error-Code "+e+".\n Error messages are not included in RxDB core to reduce build size.\n "};function z(e,t,n){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 n="[object Object]";try{n="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(r){}return t+":"+n})).join("\n"),t+="}")}(n)}var U=function(e){function t(t,n,r){var a;void 0===r&&(r={});var o=z(n,t,r);return(a=e.call(this,o)||this).code=t,a.message=o,a.url=H(t),a.parameters=r,a.rxdb=!0,a}return M(t,e),t.prototype.toString=function(){return this.message},N(t,[{key:"name",get:function(){return"RxError ("+this.code+")"}},{key:"typeError",get:function(){return!1}}])}($(Error)),K=function(e){function t(t,n,r){var a;void 0===r&&(r={});var o=z(n,t,r);return(a=e.call(this,o)||this).code=t,a.message=o,a.url=H(t),a.parameters=r,a.rxdb=!0,a}return M(t,e),t.prototype.toString=function(){return this.message},N(t,[{key:"name",get:function(){return"RxTypeError ("+this.code+")"}},{key:"typeError",get:function(){return!0}}])}($(TypeError));function H(e){return"https://rxdb.info/errors.html?console=errors#"+e}function W(e){return"\n You can find out more about this error here: "+H(e)+" "}function V(e,t){return new U(e,q.tunnelErrorMessage(e)+W(e),t)}function G(e,t){return new K(e,q.tunnelErrorMessage(e)+W(e),t)}function Q(e){return!(!e||409!==e.status)&&e}var Y={409:"document write conflict",422:"schema validation error",510:"attachment data missing"};var Z=/\./g,J=n(8342),X=1;function ee(){return{lwt:X}}function te(e,t){var n=t;return n="properties."+(n=n.replace(Z,".properties.")),A(e,n=(0,J.L$)(n))}function ne(e){return"string"==typeof e?e:e.key}function re(e,t){if("string"==typeof e.primaryKey)return t[e.primaryKey];var n=e.primaryKey;return n.fields.map((e=>{var n=A(t,e);if(void 0===n)throw V("DOC18",{args:{field:e,documentData:t}});return n})).join(n.separator)}function ae(e){var t=ne((e=v(e)).primaryKey);e.properties=v(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=oe,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 n=ie(e);(0,P.Hb)(e.required,n),e.required=e.required.filter((e=>!e.includes("."))).filter(((e,t,n)=>n.indexOf(e)===t)),e.version=e.version||0;var r=e.indexes.map((e=>{var n=(0,P.k_)(e)?e.slice(0):[e];return n.includes(t)||n.push(t),"_deleted"!==n[0]&&n.unshift("_deleted"),n}));0===r.length&&r.push(function(e){return["_deleted",e]}(t)),r.push(["_meta.lwt",t]),e.internalIndexes&&e.internalIndexes.map((e=>{r.push(e)}));var a=new Set;return r.filter((e=>{var t=e.join(",");return!a.has(t)&&(a.add(t),!0)})),e.indexes=r,e}var oe={type:"object",properties:{lwt:{type:"number",minimum:X,maximum:1e15,multipleOf:.01}},additionalProperties:!0,required:["lwt"]};function ie(e){var t=Object.keys(e.properties).filter((t=>e.properties[t].final)),n=ne(e.primaryKey);return t.push(n),"string"!=typeof e.primaryKey&&e.primaryKey.fields.forEach((e=>t.push(e))),t}var se="docs",le="changes",ce="attachments",ue="dexie",de=new Map,fe=new Map;var pe="__";function he(e){var t=e.split(".");if(t.length>1)return t.map((e=>he(e))).join(".");if(e.startsWith("|")){var n=e.substring(1);return pe+n}return e}function me(e){var t=e.split(".");return t.length>1?t.map((e=>me(e))).join("."):e.startsWith(pe)?"|"+e.substring(pe.length):e}function ge(e,t){if(!t)return t;var n=v(t);return n=be(n),e.forEach((e=>{var r=A(t,e)?"1":"0",a=he(e);j(n,a,r)})),n}function ye(e,t){return t?(t=ve(t=v(t)),e.forEach((e=>{var n=A(t,e);j(t,e,"1"===n)})),t):t}function be(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>be(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((e=>{let[n,r]=e;"object"==typeof r&&(r=be(r)),t[he(n)]=r})),t}}function ve(e){if(!e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e))return e.map((e=>ve(e)));if("object"==typeof e){var t={};return Object.entries(e).forEach((n=>{let[r,a]=n;("object"==typeof a||Array.isArray(e))&&(a=ve(a)),t[me(r)]=a})),t}}function we(e){var t=[],n=ne(e.primaryKey);t.push([n]),t.push(["_deleted",n]),e.indexes&&e.indexes.forEach((e=>{var n=(0,P.$r)(e);t.push(n)})),t.push(["_meta.lwt",n]),t.push(["_meta.lwt"]);var r=(t=t.map((e=>e.map((e=>he(e)))))).map((e=>1===e.length?e[0]:"["+e.join("+")+"]"));return(r=r.filter(((e,t,n)=>n.indexOf(e)===t))).join(", ")}async function xe(e,t){var n=await e;return(await n.dexieTable.bulkGet(t)).map((e=>ye(n.booleanIndexes,e)))}function ke(e,t){return e+"||"+t}function _e(e){var t=new Set,n=[];return e.indexes?(e.indexes.forEach((r=>{(0,P.$r)(r).forEach((r=>{t.has(r)||(t.add(r),"boolean"===te(e,r).type&&n.push(r))}))})),n.push("_deleted"),(0,P.jw)(n)):n}var Se=n(4629),Ee=n(4134),Ce=n(2258),Oe=(0,n(5383).L)((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Te=n(34),Ae=n(3004),je=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,Se.C6)(t,e),t.prototype.lift=function(e){var t=new Pe(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Oe},t.prototype.next=function(e){var t=this;(0,Ae.Y)((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var a=(0,Se.Ju)(t.currentObservers),o=a.next();!o.done;o=a.next()){o.value.next(e)}}catch(i){n={error:i}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;(0,Ae.Y)((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,Ae.Y)((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,a=n.isStopped,o=n.observers;return r||a?Ce.Kn:(this.currentObservers=null,o.push(e),new Ce.yU((function(){t.currentObservers=null,(0,Te.o)(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,a=t.isStopped;n?e.error(r):a&&e.complete()},t.prototype.asObservable=function(){var e=new Ee.c;return e.source=this,e},t.create=function(e,t){return new Pe(e,t)},t}(Ee.c),Pe=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return(0,Se.C6)(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:Ce.Kn},t}(je),Re=n(5734),De={},Ie=n(1507),Ne=n(3337),Le=String.fromCharCode(65535),Me=Number.MIN_SAFE_INTEGER;function Fe(e,t){var n=t.selector,r=e.indexes?e.indexes.slice(0):[];t.index&&(r=[t.index]);var a=!!t.sort.find((e=>"desc"===Object.values(e)[0])),o=new Set;Object.keys(n).forEach((t=>{var r=te(e,t);r&&"boolean"===r.type&&Object.prototype.hasOwnProperty.call(n[t],"$eq")&&o.add(t)}));var i,s=t.sort.map((e=>Object.keys(e)[0])).filter((e=>!o.has(e))).join(","),l=-1;if(r.forEach((e=>{var r=!0,c=!0,u=e.map((e=>{var t=n[e],a=t?Object.keys(t):[],o={};t&&a.length?a.forEach((e=>{if(Be.has(e)){var n=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]);o=Object.assign(o,n)}})):o={startKey:c?Me:Le,endKey:r?Le:Me,inclusiveStart:!0,inclusiveEnd:!0};return void 0===o.startKey&&(o.startKey=Me),void 0===o.endKey&&(o.endKey=Le),void 0===o.inclusiveStart&&(o.inclusiveStart=!0),void 0===o.inclusiveEnd&&(o.inclusiveEnd=!0),c&&!o.inclusiveStart&&(c=!1),r&&!o.inclusiveEnd&&(r=!1),o})),d=u.map((e=>e.startKey)),f=u.map((e=>e.endKey)),p={index:e,startKeys:d,endKeys:f,inclusiveEnd:r,inclusiveStart:c,sortSatisfiedByIndex:!a&&s===e.filter((e=>!o.has(e))).join(","),selectorSatisfiedByIndex:ze(e,t.selector,d,f)},h=function(e,t,n){var r=0,a=e=>{e>0&&(r+=e)},o=10,i=(0,P.Sd)(n.startKeys,(e=>e!==Me&&e!==Le));a(i*o);var s=(0,P.Sd)(n.startKeys,(e=>e!==Le&&e!==Me));a(s*o);var l=(0,P.Sd)(n.startKeys,((e,t)=>e===n.endKeys[t]));a(l*o*1.5);var c=n.sortSatisfiedByIndex?5:0;return a(c),r}(0,0,p);(h>=l||t.index)&&(l=h,i=p)})),!i)throw V("SNH",{query:t});return i}var Be=new Set(["$eq","$gt","$gte","$lt","$lte"]),$e=new Set(["$eq","$gt","$gte"]),qe=new Set(["$eq","$lt","$lte"]);function ze(e,t,n,r){var a=Object.entries(t).find((t=>{let[n,r]=t;return!e.includes(n)||Object.entries(r).find((e=>{let[t,n]=e;return!Be.has(t)}))}));if(a)return!1;if(t.$and||t.$or)return!1;var o=[],i=new Set;for(var[s,l]of Object.entries(t)){if(!e.includes(s))return!1;var c=Object.keys(l).filter((e=>$e.has(e)));if(c.length>1)return!1;var u=c[0];if(u&&i.add(s),"$eq"!==u){if(o.length>0)return!1;o.push(u)}}var d=[],f=new Set;for(var[p,h]of Object.entries(t)){if(!e.includes(p))return!1;var m=Object.keys(h).filter((e=>qe.has(e)));if(m.length>1)return!1;var g=m[0];if(g&&f.add(p),"$eq"!==g){if(d.length>0)return!1;d.push(g)}}var y=0;for(var b of e){for(var v of[i,f]){if(!v.has(b)&&v.size>0)return!1;v.delete(b)}if(n[y]!==r[y]&&i.size>0&&f.size>0)return!1;y++}return!0}class Ue extends Error{}const Ke=Number.MAX_SAFE_INTEGER,He=Number.MIN_SAFE_INTEGER,We=Symbol("missing"),Ve=Object.freeze(new Error("mingo: cycle detected while processing object/array")),Ge=/^\[object ([a-zA-Z0-9]+)\]$/,Qe=e=>{const t=Tt(e);let n=0,r=t.length;for(;r;)n=(n<<5)-n^t.charCodeAt(--r);return n>>>0},Ye=new Set(["null","undefined","boolean","number","string","date","regexp"]),Ze={null:0,undefined:0,number:1,string:2,object:3,array:4,boolean:5,date:6,regexp:7,function:8},Je=(e,t)=>{e===We&&(e=void 0),t===We&&(t=void 0);const[n,r]=[e,t].map((e=>Ze[et(e).toLowerCase()]));return n!==r?n-r:1===n||2===n||6===n?et?1:0:Ct(e,t)?0:et?1:0};function Xe(e,t){if(!e)throw new Ue(t)}const et=e=>Ge.exec(Object.prototype.toString.call(e))[1],tt=e=>"boolean"==typeof e,nt=e=>"string"==typeof e,rt=e=>!isNaN(e)&&"number"==typeof e,at=Array.isArray,ot=e=>{if(!e)return!1;const t=Object.getPrototypeOf(e);return(t===Object.prototype||null===t)&&"[object Object]"===Object.prototype.toString.call(e)},it=e=>e===Object(e),st=e=>e instanceof Date,lt=e=>e instanceof RegExp,ct=e=>"function"==typeof e,ut=e=>null==e,dt=(e,t)=>e.includes(t),ft=(e,t)=>!dt(e,t),pt=e=>ut(e)||nt(e)&&!e||e instanceof Array&&0===e.length||ot(e)&&0===Object.keys(e).length,ht=e=>e===We,mt=e=>e instanceof Array?e:[e],gt=(e,t)=>!!e&&Object.prototype.hasOwnProperty.call(e,t),yt=e=>"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView(e),bt=[st,lt,yt],vt=(e,t)=>{if(ut(e))return e;if(t.has(e))throw Ve;const n=e.constructor;if(bt.some((t=>t(e))))return new n(e);try{if(t.add(e),at(e))return e.map((e=>vt(e,t)));if(ot(e)){const n={};for(const r in e)n[r]=vt(e[r],t);return n}}finally{t.delete(e)}return e},wt=e=>vt(e,new Set),xt=(e,t)=>ot(e)&&ot(t)||at(e)&&at(t);function kt(e,t,n){if(n=n||{flatten:!1},ht(e)||ut(e))return t;if(ht(t)||ut(t))return e;if(!xt(e,t)){if(n.skipValidation)return t||e;throw Error("mismatched types. must both be array or object")}if(n.skipValidation=!0,at(e)){const r=e,a=t;if(n.flatten){let e=0,o=0;for(;e{const o=At(r,t);n.has(o)?n.get(o).some((t=>Ct(e[t],r)))||n.get(o).push(a):n.set(o,[a])})),n}function St(e,t=Qe){if(e.some((e=>0==e.length)))return[];if(1===e.length)return Array.from(e);const n=function(e,t,n=Je){if(pt(e))return e;const r=new Array,a=new Array;for(let o=0;on(e[0],t[0]))),Rt(a,r.map((e=>e[1])))}(e.map(((e,t)=>[t,e.length])),(e=>e[1])),r=e[n[0][0]],a=_t(r,t),o=new Map,i=new Array;return a.forEach(((t,a)=>{const s=t.map((e=>r[e])),l=s.map((e=>0)),c=s.map((e=>[n[0][0],0]));let u=!1;for(let r=1;rd[e]));u=s.map(((n,i)=>e.some(((e,s)=>{const u=l[i];return Ct(n,e)&&(l[i]++,tt===e.length-1?[s[n],c[n]]:We)).filter((e=>e!==We)))})),i.sort(((e,t)=>{const[n,[r,a]]=e,[o,[i,s]]=t,l=Je(r,i);return 0!==l?l:Je(a,s)})).map((e=>e[0]))}function Et(e,t=0){const n=new Array;return function e(t,r){for(let a=0,o=t.length;a0||r<0)?e(t[a],Math.max(-1,r-1)):n.push(t[a])}(e,t),n}function Ct(e,t){if(e===t||Object.is(e,t))return!0;const n=!!e&&e.constructor||e;if(null===e||null===t||void 0===e||void 0===t||n!==t.constructor||n===Function)return!1;if(n===Array||n===Object){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;if(new Set([...n,...r]).size!=n.length)return!1;for(const a of n)if(!Ct(e[a],t[a]))return!1;return!0}const r=Object.getPrototypeOf(e);return(yt(e)||r!==Object.prototype&&r!==Array.prototype&&Object.prototype.hasOwnProperty.call(r,"toString"))&&e.toString()===t.toString()}const Ot=(e,t)=>{if(null===e)return"null";if(void 0===e)return"undefined";const n=e.constructor;switch(n){case RegExp:case Number:case Boolean:case Function:case Symbol:return e.toString();case String:return JSON.stringify(e);case Date:return e.toISOString()}if(yt(e))return n.name+"["+e.toString()+"]";if(t.has(e))throw Ve;try{if(t.add(e),at(e))return"["+e.map((e=>Ot(e,t))).join(",")+"]";if(n===Object)return"{"+Object.keys(e).sort().map((n=>n+":"+Ot(e[n],t))).join(",")+"}";const r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==Array.prototype&&Object.prototype.hasOwnProperty.call(r,"toString"))return n.name+"("+JSON.stringify(e.toString())+")";const[a,o]=(e=>{let[t,n]=[Object.getPrototypeOf(e),Object.getOwnPropertyNames(e)],r=t;for(;!n.length&&t!==Object.prototype&&t!==Array.prototype;)r=t,n=Object.getOwnPropertyNames(t),t=Object.getPrototypeOf(t);const a={};return n.forEach((t=>a[t]=e[t])),[a,r]})(e);return n.name+Ot(a,t)}finally{t.delete(e)}},Tt=e=>Ot(e,new Set);function At(e,t){return t=t||Qe,ut(e)?null:t(e).toString()}function jt(e,t,n=Qe){if(e.length<1)return new Map;const r=new Map,a=new Map;for(let o=0;oCt(e,s))):null;ut(e)?(a.set(s,[i]),r.has(l)?r.get(l).push(s):r.set(l,[s])):a.get(e).push(i)}}return a}const Pt=5e4;function Rt(e,...t){return e instanceof Array?t.reduce(((e,t)=>{let n=Math.ceil(t.length/Pt),r=0;for(;n-- >0;)Array.prototype.push.apply(e,t.slice(r,r+Pt)),r+=Pt;return e}),e):t.filter(it).reduce(((e,t)=>(Object.assign(e,t),e)),e)}function Dt(e,t){return it(e)?e[t]:void 0}function It(e,t,n){let r=0;const a=Ye.has(et(e).toLowerCase())?e:function e(t,n){let a=t;for(let o=0;o0)break;r+=1;const t=n.slice(o);a=a.reduce(((n,r)=>{const a=e(r,t);return void 0!==a&&n.push(a),n}),[]);break}if(a=Dt(a,t),void 0===a)break}return a}(e,t.split("."));return a instanceof Array&&n?.unwrapArray?function(e,t){if(t<1)return e;for(;t--&&1===e.length;)e=e[0];return e}(a,r):a}function Nt(e,t,n){const r=t.split("."),a=r[0],o=r.slice(1).join("."),i=null!==/^\d+$/.exec(a),s=r.length>1;let l,c;if(e instanceof Array)if(i)l=Dt(e,Number(a)),s&&(l=Nt(l,o,n)),l=[l];else{l=[];for(const r of e)c=Nt(r,t,n),n?.preserveMissing?(void 0===c&&(c=We),l.push(c)):void 0!==c&&l.push(c)}else{if(c=Dt(e,a),s&&(c=Nt(c,o,n)),void 0===c)return;l=n?.preserveKeys?{...e}:{},l[a]=c}return l}function Lt(e){if(e instanceof Array)for(let t=e.length-1;t>=0;t--)e[t]===We?e.splice(t,1):Lt(e[t]);else if(ot(e))for(const t in e)gt(e,t)&&Lt(e[t])}const Mt=/^\d+$/;function Ft(e,t,n,r){const a=t.split("."),o=a[0],i=a.slice(1).join(".");if(1===a.length)(ot(e)||at(e)&&Mt.test(o))&&n(e,o);else{r?.buildGraph&&ut(e[o])&&(e[o]={});const t=e[o];if(!t)return;const s=!!(a.length>1&&Mt.test(a[1]));t instanceof Array&&r?.descendArray&&!s?t.forEach((e=>Ft(e,i,n,r))):Ft(t,i,n,r)}}function Bt(e,t,n){Ft(e,t,((e,t)=>{e[t]=ct(n)?n(e[t]):n}),{buildGraph:!0})}function $t(e,t,n){Ft(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)ot(n)&&delete n[t]}else ot(e)&&delete e[t]}),n)}const qt=/^\$[a-zA-Z0-9_]+$/;function zt(e){return qt.test(e)}function Ut(e){if(Ye.has(et(e).toLowerCase()))return lt(e)?{$regex:e}:{$eq:e};if(it(e)){const t=e;if(!Object.keys(t).some(zt))return{$eq:e};if(gt(e,"$regex")){const t={...e};return t.$regex=new RegExp(e.$regex,e.$options),delete t.$options,t}}return e}var Kt=(e=>(e.CLONE_ALL="CLONE_ALL",e.CLONE_INPUT="CLONE_INPUT",e.CLONE_OUTPUT="CLONE_OUTPUT",e.CLONE_OFF="CLONE_OFF",e))(Kt||{});class Ht{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 Ht?new Ht(e._opts,ut(e.root)?t:e.root,Object.assign({},e.local,n)):new Ht(e,t,n)}update(e,t){return this._root=e,this._local=t?Object.assign({},t,{variables:Object.assign({},this._local?.variables,t?.variables)}):t,this}getOptions(){return Object.freeze({...this._opts,context:Gt.from(this._opts.context)})}get root(){return this._root}get local(){return this._local}get idKey(){return this._opts.idKey}get collation(){return this._opts?.collation}get processingMode(){return this._opts?.processingMode||"CLONE_OFF"}get useStrictMode(){return this._opts?.useStrictMode}get scriptEnabled(){return this._opts?.scriptEnabled}get useGlobalContext(){return this._opts?.useGlobalContext}get hashFunction(){return this._opts?.hashFunction}get collectionResolver(){return this._opts?.collectionResolver}get jsonSchemaValidator(){return this._opts?.jsonSchemaValidator}get variables(){return this._opts?.variables}get context(){return this._opts?.context}}function Wt(e){return e instanceof Ht?e.getOptions():Object.freeze({idKey:"_id",scriptEnabled:!0,useStrictMode:!0,useGlobalContext:!0,processingMode:"CLONE_OFF",...e,context:e?.context?Gt.from(e?.context):Gt.init({})})}var Vt=(e=>(e.ACCUMULATOR="accumulator",e.EXPRESSION="expression",e.PIPELINE="pipeline",e.PROJECTION="projection",e.QUERY="query",e.WINDOW="window",e))(Vt||{});class Gt{constructor(e){this.operators={accumulator:{},expression:{},pipeline:{},projection:{},query:{},window:{}};for(const[t,n]of Object.entries(e))this.addOperators(t,n)}static init(e={}){return new Gt(e)}static from(e){return new Gt(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("accumulator",e)}addExpressionOps(e){return this.addOperators("expression",e)}addQueryOps(e){return this.addOperators("query",e)}addPipelineOps(e){return this.addOperators("pipeline",e)}addProjectionOps(e){return this.addOperators("projection",e)}addWindowOps(e){return this.addOperators("window",e)}getOperator(e,t){return e in this.operators&&this.operators[e][t]||null}}const Qt=Gt.init();function Yt(e,t){for(const[n,r]of Object.entries(t)){Xe(ct(r)&&zt(n),`'${n}' is not a valid operator`);const t=Zt(e,n,null);Xe(!t||r===t,`${n} already exists for '${e}' operators. Cannot change operator function once registered.`)}switch(e){case"accumulator":Qt.addAccumulatorOps(t);break;case"expression":Qt.addExpressionOps(t);break;case"pipeline":Qt.addPipelineOps(t);break;case"projection":Qt.addProjectionOps(t);break;case"query":Qt.addQueryOps(t);break;case"window":Qt.addWindowOps(t)}}function Zt(e,t,n){const{context:r,useGlobalContext:a}=n||{},o=r?r.getOperator(e,t):null;return!o&&a?Qt.getOperator(e,t):o}const Jt={$$ROOT:(e,t,n)=>n.root,$$CURRENT:(e,t,n)=>e,$$REMOVE(e,t,n){},$$NOW:(e,t,n)=>new Date(n.timestamp)},Xt={$$KEEP:(e,t,n)=>e,$$PRUNE(e,t,n){},$$DESCEND(e,t,n){if(!gt(t,"$cond"))return e;let r;for(const[a,o]of Object.entries(e))if(it(o)){if(o instanceof Array){const e=[];for(let r of o)ot(r)&&(r=tn(r,t,n.update(r))),ut(r)||e.push(r);r=e}else r=tn(o,t,n.update(o));ut(r)?delete e[a]:e[a]=r}return e}};function en(e,t,n,r){const a=Ht.init(r,e);if(zt(n=n||"")){const o=Zt("expression",n,r);if(o)return o(e,t,a);const i=Zt("accumulator",n,r);if(i)return e instanceof Array||(e=en(e,t,null,a),t=null),Xe(e instanceof Array,`'${n}' target must be an array.`),i(e,t,a.update(null,a.local));throw new Ue(`operator '${n}' is not registered`)}if(nt(t)&&t.length>0&&"$"===t[0]){if(gt(Xt,t))return t;let n=a.root;const r=t.split(".");if(gt(Jt,r[0]))n=Jt[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},a.local?.variables);const o=r[0].slice(2);Xe(gt(n,o),`Use of undefined variable: ${o}`),t=t.slice(2)}else t=t.slice(1);return""===t?n:It(n,t)}if(at(t))return t.map((t=>en(e,t,null,a)));if(ot(t)){const n={};for(const[o,i]of Object.entries(t))if(n[o]=en(e,i,o,a),["expression","accumulator"].some((e=>!!Zt(e,o,r))))return Xe(1===Object.keys(t).length,"Invalid aggregation expression '"+JSON.stringify(t)+"'"),n[o];return n}return t}function tn(e,t,n){const r=en(e,t,null,n);return gt(Xt,r)?Xt[r](e,t,n):r}function nn(e){return e instanceof on?e:new on(e)}function rn(e,t){const n=e.slice(t+1);e.splice(t),Array.prototype.push.apply(e,n)}const an=new Error;class on{constructor(e){let t;if(this.iteratees=[],this.yieldedValues=[],this.isDone=!1,e instanceof Function&&(e={next:e}),(n=e)&&"object"==typeof n&&n?.next instanceof Function){const n=e;t=()=>{const e=n.next();if(e.done)throw an;return e.value}}else if(e instanceof Array){const n=e,r=n.length;let a=0;t=()=>{if(a0?this.push(2,e):this}drop(e){return e>0?this.push(3,e):this}transform(e){const t=this;let n;return nn((()=>(n||(n=nn(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}}class sn{constructor(e,t){this.pipeline=e,this.options=Wt(t)}stream(e){let t=nn(e);const n=this.options.processingMode;n!=Kt.CLONE_ALL&&n!=Kt.CLONE_INPUT||t.map(wt);const r=new Array;if(!pt(this.pipeline))for(const a of this.pipeline){const e=Object.keys(a),n=e[0],o=Zt(Vt.PIPELINE,n,this.options);Xe(1===e.length&&!!o,`invalid pipeline operator ${n}`),r.push(n),t=o(t,a[n],this.options)}return(n==Kt.CLONE_OUTPUT||n==Kt.CLONE_ALL&&St([["$group","$unwind"],r]).length)&&t.map(wt),t}run(e){return this.stream(e).value()}}class ln{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||(ot(this.projection)&&this.operators.push({$project:this.projection}),this.result=nn(this.source).filter(this.predicate),this.operators.length>0&&(this.result=new sn(this.operators,this.options).stream(this.result))),this.result}fetchAll(){const e=nn([...this.buffer]);return this.buffer=[],function(...e){let t=0;return nn((()=>{for(;t0)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 cn{constructor(e,t){this.condition=e,this.options=Wt(t),this.compiled=[],this.compile()}compile(){Xe(ot(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(dt(["$and","$or","$nor","$expr","$jsonSchema"],t))this.processOperator(t,t,n);else{Xe(!zt(t),`unknown top level operator: ${t}`);for(const[e,r]of Object.entries(Ut(n)))this.processOperator(t,e,r)}e.field&&this.processOperator(e.field,e.field,e.expr)}}processOperator(e,t,n){const r=Zt(Vt.QUERY,t,this.options);if(!r)throw new Ue(`unknown query operator ${t}`);const a=r(e,n,this.options);this.compiled.push(a)}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)),[])}}const un=(e,t,n)=>{if(pt(t)||!ot(t))return e;let r=Je;const a=n.collation;return ot(a)&&nt(a.locale)&&(r=function(e){const t={sensitivity:dn[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(!nt(e)||!nt(t))return Je(e,t);const r=n.compare(e,t);return r<0?-1:r>0?1:0}}(a)),e.transform((e=>{const a=Object.keys(t);for(const o of a.reverse()){const a=jt(e,(e=>It(e,o)),n.hashFunction),i=Array.from(a.keys()).sort(r);-1===t[o]&&i.reverse(),e=[],i.reduce(((e,t)=>Rt(e,a.get(t))),e)}return e}))},dn={1:"base",2:"accent",3:"variant"};function fn(e){const t=(t,n,r)=>{const a={unwrapArray:!0},o=Math.max(1,t.split(".").length-1);return i=>{const s=It(i,t,a);return e(s,n,{...r,depth:o})}};return t.op="query",t}function pn(e){return(t,n,r)=>{const a=en(t,n,null,r);return e(...a)}}function hn(e,t,n){if(Ct(e,t))return!0;if(ut(e)&&ut(t))return!0;if(e instanceof Array){const r=Ct.bind(null,t);return e.some(r)||Et(e,n?.depth).some(r)}return!1}function mn(e,t,n){return!hn(e,t,n)}function gn(e,t,n){return ut(e)?t.some((e=>null===e)):St([mt(e),t],n?.hashFunction).length>0}function yn(e,t,n){return!gn(e,t,n)}function bn(e,t,n){return An(e,t,((e,t)=>Je(e,t)<0))}function vn(e,t,n){return An(e,t,((e,t)=>Je(e,t)<=0))}function wn(e,t,n){return An(e,t,((e,t)=>Je(e,t)>0))}function xn(e,t,n){return An(e,t,((e,t)=>Je(e,t)>=0))}function kn(e){return zt(e)&&-1===["$and","$or","$nor"].indexOf(e)}function _n(e,t,n){if(at(e)&&!pt(e)){let r=e=>e,a=t;Object.keys(t).every(kn)&&(a={temp:t},r=e=>({temp:e}));const o=new cn(a,n);for(let t=0,n=e.length;tnull===e,En=e=>rt(e)&&e>=-2147483648&&e<=2147483647&&-1===e.toString().indexOf("."),Cn=e=>rt(e)&&e>=He&&e<=Ke&&-1===e.toString().indexOf("."),On={array:at,bool:tt,boolean:tt,date:st,decimal:rt,double:rt,int:En,long:Cn,number:rt,null:Sn,object:ot,regex:lt,regexp:lt,string:nt,undefined:ut,function:e=>{throw new Ue("unsupported type key `function`.")},1:rt,2:nt,3:ot,4:at,6:ut,8:tt,9:st,10:Sn,11:lt,16:En,18:Cn,19:rt};function Tn(e,t,n){const r=On[t];return!!r&&r(e)}function An(e,t,n){return mt(e).some((e=>et(e)===et(t)&&n(e,t)))}pn(yn);const jn=(e,t)=>(n,r,a)=>{Xe(at(r),`${e}: expression must be an array.`);const o=en(n,r,null,a);return o.some(ut)?null:(Xe(o.every(rt),`${e}: expression must evalue to array of numbers.`),t(o))};jn("$bitAnd",(e=>e.reduce(((e,t)=>e&t),-1))),jn("$bitOr",(e=>e.reduce(((e,t)=>e|t),0))),jn("$bitXor",(e=>e.reduce(((e,t)=>e^t),0))),pn(hn),pn(wn),pn(xn),pn(bn),pn(vn),pn(mn);const Pn=(e,t)=>{const n={};return e.split("").forEach(((e,r)=>n[e]=t*(r+1))),n};Pn("ABCDEFGHIKLM",1),Pn("NOPQRSTUVWXY",-1);const Rn={undefined:null,null:null,NaN:NaN,Infinity:new Error,"-Infinity":new Error};function Dn(e,t=Rn){const n=Object.assign({},Rn,t),r=new Set(Object.keys(n));return(t,a,o)=>{const i=en(t,a,null,o);if(r.has(`${i}`)){const t=n[`${i}`];if(t instanceof Error)throw new Ue(`cannot apply $${e.name} to -inf, value must in (-inf,inf)`);return t}return e(i)}}Dn(Math.acos,{Infinity:1/0,0:new Error}),Dn(Math.acosh,{Infinity:1/0,0:new Error}),Dn(Math.asin),Dn(Math.asinh,{Infinity:1/0,"-Infinity":-1/0}),Dn(Math.atan),Dn(Math.atanh,{1:1/0,"-1":-1/0}),Dn(Math.cos),Dn(Math.cosh,{"-Infinity":1/0,Infinity:1/0});const In=Math.PI/180,Nn=(Dn((e=>e*In),{Infinity:1/0,"-Infinity":1/0}),180/Math.PI);Dn((e=>e*Nn),{Infinity:1/0,"-Infinity":-1/0}),Dn(Math.sin),Dn(Math.sinh,{"-Infinity":-1/0,Infinity:1/0}),Dn(Math.tan);Error;const Ln=(e,t,n)=>{if(pt(t))return e;let r=Object.keys(t),a=!1;Fn(t,n);const o=n.idKey;if(dt(r,o)){const e=t[o];0!==e&&!1!==e||(r=r.filter(ft.bind(null,[o])),a=0==r.length)}else r.push(o);const i=Ht.init(n);return e.map((e=>Mn(e,t,i.update(e),r,a)))};function Mn(e,t,n,r,a){let o={},i=!1,s=!1;const l=[];a&&l.push(n.idKey);for(const c of r){let r;const a=t[c];if(c!==n.idKey&&dt([0,!1],a)&&(s=!0),c===n.idKey&&pt(a))r=e[c];else if(nt(a))r=en(e,a,c,n);else if(dt([1,!0],a));else if(a instanceof Array)r=a.map((t=>{const r=en(e,t,null,n);return ut(r)?null:r}));else{if(!ot(a)){l.push(c);continue}{const t=a,o=Object.keys(a),s=1==o.length?o[0]:"",l=Zt(Vt.PROJECTION,s,n);if(l)"$slice"===s?mt(t[s]).every(rt)?(r=l(e,t[s],c,n),i=!0):r=en(e,t,c,n):r=l(e,t[s],c,n);else if(zt(s))r=en(e,t[s],s,n);else if(gt(e,c)){Fn(t,n);let a=e[c];a instanceof Array?r=a.map((e=>Mn(e,t,n,o,!1))):(a=ot(a)?a:e,r=Mn(a,t,n,o,!1))}else r=en(e,a,null,n)}}const u=Nt(e,c,{preserveMissing:!0});void 0!==u&&kt(o,u,{flatten:!0}),ft([0,1,!1,!0],a)&&(void 0===r?$t(o,c,{descendArray:!0}):Bt(o,c,r))}if(Lt(o),(i||s||a)&&(o=Rt({},e,o),l.length>0))for(const c of l)$t(o,c,{descendArray:!0});return o}function Fn(e,t){const n=[!1,!1];for(const[r,a]of Object.entries(e)){if(r===t?.idKey)return;0===a||!1===a?n[0]=!0:1!==a&&!0!==a||(n[1]=!0),Xe(!(n[0]&&n[1]),"Projection cannot have a mix of inclusion and exclusion.")}}const Bn=(e,t,n)=>{Xe(at(t),"Invalid expression: $and expects value to be an Array.");const r=t.map((e=>new cn(e,n)));return e=>r.every((t=>t.test(e)))},$n=(e,t,n)=>{Xe(at(t),"Invalid expression. $or expects value to be an Array");const r=t.map((e=>new cn(e,n)));return e=>r.some((t=>t.test(e)))},qn=(e,t,n)=>{Xe(at(t),"Invalid expression. $nor expects value to be an array.");const r=$n("$or",t,n);return e=>!r(e)},zn=(e,t,n)=>{const r={};r[e]=Ut(t);const a=new cn(r,n);return e=>!a.test(e)},Un=fn(hn),Kn=fn(wn),Hn=fn(xn),Wn=fn(gn),Vn=fn(bn),Gn=fn(vn),Qn=fn(mn),Yn=fn(yn);const Zn=fn((function(e,t,n){return mt(e).some((e=>2===t.length&&e%t[0]===t[1]))})),Jn=fn((function(e,t,n){const r=mt(e),a=e=>nt(e)&&((e,t=!0)=>!!e||t&&""===e)(t.exec(e),n?.useStrictMode);return r.some(a)||Et(r,1).some(a)}));fn((function(e,t,n){if(!(at(e)&&at(t)&&e.length&&t.length))return!1;let r=!0;for(const a of t){if(!r)break;r=ot(a)&&dt(Object.keys(a),"$elemMatch")?_n(e,a.$elemMatch,n):a instanceof RegExp?e.some((e=>"string"==typeof e&&a.test(e))):e.some((e=>Ct(a,e)))}return r}));const Xn=fn(_n),er=fn((function(e,t,n){return Array.isArray(e)&&e.length===t})),tr=fn((function(e,t,n){return(!1===t||0===t)&&void 0===e||(!0===t||1===t)&&void 0!==e})),nr=fn((function(e,t,n){return Array.isArray(t)?t.findIndex((t=>Tn(e,t)))>=0:Tn(e,t)}));var rr=!1;function ar(e,t){var n=ne(e.primaryKey);t=v(t);var r=x(t);if("number"!=typeof r.skip&&(r.skip=0),r.selector?(r.selector=r.selector,Object.entries(r.selector).forEach((e=>{let[t,n]=e;"object"==typeof n&&null!==n||(r.selector[t]={$eq:n})}))):r.selector={},r.index){var a=(0,P.$r)(r.index);a.includes(n)||a.push(n),r.index=a}if(r.sort){var o=r.sort.find((e=>{return t=e,Object.keys(t)[0]===n;var t}));o||(r.sort=r.sort.slice(0),r.sort.push({[n]:"asc"}))}else if(r.index)r.sort=r.index.map((e=>({[e]:"asc"})));else{if(e.indexes){var i=new Set;Object.entries(r.selector).forEach((e=>{let[t,n]=e;("object"!=typeof n||null===n||!!Object.keys(n).find((e=>Be.has(e))))&&i.add(t)}));var s,l=-1;e.indexes.forEach((e=>{var t=(0,P.k_)(e)?e:[e],n=t.findIndex((e=>!i.has(e)));n>0&&n>l&&(l=n,s=t)})),s&&(r.sort=s.map((e=>({[e]:"asc"}))))}r.sort||(r.sort=[{[n]:"asc"}])}return r}function or(e,t){if(!t.sort)throw V("SNH",{query:t});var n=[];t.sort.forEach((e=>{var t,r,a,o=Object.keys(e)[0],i=Object.values(e)[0];n.push({key:o,direction:i,getValueFn:(t=o,r=t.split("."),a=r.length,1===a?e=>e[t]:e=>{for(var t=e,n=0;n{for(var r=0;rr.test(e)}async function sr(e,t){var n=await e.exec();return n?Array.isArray(n)?Promise.all(n.map((e=>t(e)))):await t(n):null}function lr(e){return e===Me?-1/0:e}function cr(e,t,n){return e.includes(t)?n===Le||!0===n?"1":"0":n}function ur(e,t,n){if(!n){if("undefined"==typeof window)throw new Error("IDBKeyRange missing");n=window.IDBKeyRange}var r=t.startKeys.map(((n,r)=>{var a=t.index[r];return cr(e,a,n)})).map(lr),a=t.endKeys.map(((n,r)=>{var a=t.index[r];return cr(e,a,n)})).map(lr);return n.bound(r,a,!t.inclusiveStart,!t.inclusiveEnd)}async function dr(e,t){var n=await e.internals,r=t.query,a=r.skip?r.skip:0,o=a+(r.limit?r.limit:1/0),i=t.queryPlan,s=!1;i.selectorSatisfiedByIndex||(s=ir(e.schema,t.query));var l=ur(n.booleanIndexes,i,n.dexieDb._options.IDBKeyRange),c=i.index,u=[];if(await n.dexieDb.transaction("r",n.dexieTable,(async e=>{var t,r=e.idbtrans.objectStore(se);t="["+c.map((e=>he(e))).join("+")+"]";var a=r.index(t).openCursor(l);await new Promise((e=>{a.onsuccess=function(t){var r=t.target.result;if(r){var a=ye(n.booleanIndexes,r.value);s&&!s(a)||u.push(a),i.sortSatisfiedByIndex&&u.length===o?e():r.continue()}else e()}}))})),!i.sortSatisfiedByIndex){var d=or(e.schema,t.query);u=u.sort(d)}return{documents:u=u.slice(a,o)}}function fr(e){for(var t="",n=0;n0&&hr[e].forEach((e=>e(t)))}function gr(e,t){return Promise.all(hr[e].map((e=>e(t))))}var yr="_rxdb_internal";async function br(e,t){var n=(await e.findDocumentsById([t],!1))[0];return n||void 0}async function vr(e,t,n){var r=await e.bulkWrite([t],n);if(r.error.length>0)throw r.error[0];return Cr(ne(e.schema.primaryKey),[t],r)[0]}function wr(e,t,n,r){if(r)throw 409===r.status?V("CONFLICT",{collection:e.name,id:t,writeError:r,data:n}):422===r.status?V("VD2",{collection:e.name,id:t,writeError:r,data:n}):r}function xr(e){return{previous:e.previous,document:kr(e.document)}}function kr(e){if(!e._attachments||0===Object.keys(e._attachments).length)return e;var t=v(e);return t._attachments={},Object.entries(e._attachments).forEach((e=>{let[n,r]=e;var a,o,i;t._attachments[n]=(i=(a=r).data)?{length:(o=i,atob(o).length),digest:a.digest,type:a.type}:a})),t}function _r(e){return Object.assign({},e,{_meta:v(e._meta)})}var Sr=new WeakMap;function Er(e,t,n){q.deepFreezeWhenDevMode(n);var r=ne(t.schema.primaryKey),a={originalStorageInstance:t,schema:t.schema,internals:t.internals,collectionName:t.collectionName,databaseName:t.databaseName,options:t.options,bulkWrite(n,a){for(var o=e.token,i=new Array(n.length),s=(0,Re.t)(),l=0;lt.bulkWrite(i,a))).then((n=>{var o={error:[]},s=Cr(r,i,n);Sr.set(o,s);var l=0===n.error.length?[]:n.error.filter((e=>!(409!==e.status||e.writeRow.previous||e.writeRow.document._deleted||!(0,Ne.ZN)(e.documentInDb)._deleted)||(o.error.push(e),!1)));if(l.length>0){var c=l.map((t=>({previous:t.documentInDb,document:Object.assign({},t.writeRow.document,{_rev:pr(e.token,t.documentInDb)})})));return e.lockedRun((()=>t.bulkWrite(c,a))).then((e=>{(0,P.Hb)(o.error,e.error);var t=Cr(r,c,e);return(0,P.Hb)(s,t),o}))}return o}))},query:n=>e.lockedRun((()=>t.query(n))),count:n=>e.lockedRun((()=>t.count(n))),findDocumentsById:(n,r)=>e.lockedRun((()=>t.findDocumentsById(n,r))),getAttachmentData:(n,r,a)=>e.lockedRun((()=>t.getAttachmentData(n,r,a))),getChangedDocumentsSince:t.getChangedDocumentsSince?(n,r)=>e.lockedRun((()=>t.getChangedDocumentsSince((0,Ne.ZN)(n),r))):void 0,cleanup:n=>e.lockedRun((()=>t.cleanup(n))),remove:()=>(e.storageInstances.delete(a),e.lockedRun((()=>t.remove()))),close:()=>(e.storageInstances.delete(a),e.lockedRun((()=>t.close()))),changeStream:()=>t.changeStream(),conflictResultionTasks:()=>t.conflictResultionTasks(),resolveConflictResultionTask(e){if(e.output.isEqual)return t.resolveConflictResultionTask(e);var n=v(Object.assign({},e.output.documentData,{_meta:ee(),_rev:"",_attachments:{}}));return delete n._meta,delete n._rev,delete n._attachments,t.resolveConflictResultionTask({id:e.id,output:{isEqual:!1,documentData:n}})}};return e.storageInstances.add(a),a}function Cr(e,t,n){var r=Sr.get(n);if(r)return r;var a=[];if(n.error.length>0){for(var o=new Set,i=0;i{this._to=!1,function(e){const t=$r()-e.ttl,n=e.map[Symbol.iterator]();for(;;){const r=n.next().value;if(!r)return;const a=r[0];if(!(r[1]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 zr="pubkey.broadcast-channel-0-",Ur="messages",Kr={durability:"relaxed"};function Hr(){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 Wr(e){e.commit&&e.commit()}function Vr(e,t){var n=e.transaction(Ur,"readonly",Kr),r=n.objectStore(Ur),a=[],o=IDBKeyRange.bound(t+1,1/0);if(r.getAll){var i=r.getAll(o);return new Promise((function(e,t){i.onerror=function(e){return t(e)},i.onsuccess=function(t){e(t.target.result)}}))}return new Promise((function(e,i){var s=function(){try{return o=IDBKeyRange.bound(t+1,1/0),r.openCursor(o)}catch(e){return r.openCursor()}}();s.onerror=function(e){return i(e)},s.onsuccess=function(r){var o=r.target.result;o?o.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 pa(e,t,n){e._addEL[t].push(n),function(e){if(!e._iL&&fa(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 ha(e,t,n){e._addEL[t]=e._addEL[t].filter((function(e){return e!==n})),function(e){if(e._iL&&!fa(e)){e._iL=!1;var t=e.method.microSeconds();e.method.onMessage(e._state,null,t)}}(e)}ua._pubkey=!0,ua.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return da(this,"message",e)},postInternal:function(e){return da(this,"internal",e)},set onmessage(e){var t={time:this.method.microSeconds(),fn:e};ha(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,pa(this,"message",t)):this._onML=null},addEventListener:function(e,t){pa(this,e,{time:this.method.microSeconds(),fn:t})},removeEventListener:function(e,t){ha(this,e,this._addEL[e].find((function(e){return e.fn===t})))},close:function(){var e=this;if(!this.closed){la.delete(this),this.closed=!0;var t=this._prepP?this._prepP:Dr;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}};var ma=new Map;function ga(e,t){var n=ma.get(e);if(n)return n.refs.delete(t),0===n.refs.size?(ma.delete(e),n.bc.close()):void 0}function ya(e,t,n,r){if(t.multiInstance){var a=r||function(e,t,n,r){var a=ma.get(t);return a||(a={bc:new ua(["RxDB:",e,n].join("|")),refs:new Set},ma.set(t,a)),a.refs.add(r),a.bc}(e,t.databaseInstanceToken,n.databaseName,n),o=new je,i=n=>{n.storageName===e&&n.databaseName===t.databaseName&&n.collectionName===t.collectionName&&n.version===t.schema.version&&o.next(n.eventBulk)};a.addEventListener("message",i);var s=n.changeStream(),l=!1,c=s.subscribe((n=>{l||a.postMessage({storageName:e,databaseName:t.databaseName,collectionName:t.collectionName,version:t.schema.version,eventBulk:n})}));n.changeStream=function(){return o.asObservable().pipe(function(){for(var e=[],t=0;t{if(!e.document._rev||e.previous&&!e.previous._rev)throw V("SNH",{args:{row:e}})}));var n=await this.internals,r={error:[]};this.devMode&&(e=e.map((e=>{var t=_r(e.document);return{previous:e.previous,document:t}})));var a,o=e.map((e=>e.document[this.primaryPath]));if(await n.dexieDb.transaction("rw",n.dexieTable,n.dexieAttachmentsTable,(async()=>{var i=new Map;(await xe(this.internals,o)).forEach((e=>{var t=e;return t&&i.set(t[this.primaryPath],t),t})),a=function(e,t,n,r,a,o,i){for(var s,l=!!e.schema.attachments,c=[],u=[],d=[],f={id:(0,J.z3)(10),events:[],checkpoint:null,context:a,startTime:(0,Re.t)(),endTime:0},p=f.events,h=[],m=[],g=[],y=n.size>0,b=r.length,v=function(){var e,a=r[w],f=a.document,b=a.previous,v=f[t],x=f._deleted,k=b&&b._deleted,_=void 0;if(y&&(_=n.get(v)),_){var S=_._rev;if(!b||b&&S!==b._rev){var E={isError:!0,status:409,documentId:v,writeRow:a,documentInDb:_};return d.push(E),1}var C=l?xr(a):a;l&&(x?b&&Object.keys(b._attachments).forEach((e=>{m.push({documentId:v,attachmentId:e,digest:(0,Ne.ZN)(b)._attachments[e].digest})})):(Object.entries(f._attachments).find((t=>{let[n,r]=t;return(b?b._attachments[n]:void 0)||r.data||(e={documentId:v,documentInDb:_,isError:!0,status:510,writeRow:a,attachmentId:n}),!0})),e||Object.entries(f._attachments).forEach((e=>{let[t,n]=e;var r=b?b._attachments[t]:void 0;if(r){var a=C.document._attachments[t].digest;n.data&&r.digest!==a&&g.push({documentId:v,attachmentId:t,attachmentData:n,digest:n.digest})}else h.push({documentId:v,attachmentId:t,attachmentData:n,digest:n.digest})})))),e?d.push(e):(l?(u.push(xr(C)),i&&i(f)):(u.push(C),i&&i(f)),s=C);var O=null,T=null,A=null;if(k&&!x)A="INSERT",O=l?kr(f):f;else if(!b||k||x){if(!x)throw V("SNH",{args:{writeRow:a}});A="DELETE",O=(0,Ne.ZN)(f),T=b}else A="UPDATE",O=l?kr(f):f,T=b;var j={documentId:v,documentData:O,previousDocumentData:T,operation:A};p.push(j)}else{var P=!!x;if(l&&Object.entries(f._attachments).forEach((t=>{let[n,r]=t;r.data?h.push({documentId:v,attachmentId:n,attachmentData:r,digest:r.digest}):(e={documentId:v,isError:!0,status:510,writeRow:a,attachmentId:n},d.push(e))})),e||(l?(c.push(xr(a)),o&&o(f)):(c.push(a),o&&o(f)),s=a),!P){var R={documentId:v,operation:"INSERT",documentData:l?kr(f):f,previousDocumentData:l&&b?kr(b):b};p.push(R)}}},w=0;w{s.push(e.document)})),a.bulkUpdateDocs.forEach((e=>{s.push(e.document)})),(s=s.map((e=>ge(n.booleanIndexes,e)))).length>0&&await n.dexieTable.bulkPut(s);var l=[];a.attachmentsAdd.forEach((e=>{l.push({id:ke(e.documentId,e.attachmentId),data:e.attachmentData.data})})),a.attachmentsUpdate.forEach((e=>{l.push({id:ke(e.documentId,e.attachmentId),data:e.attachmentData.data})})),await n.dexieAttachmentsTable.bulkPut(l),await n.dexieAttachmentsTable.bulkDelete(a.attachmentsRemove.map((e=>ke(e.documentId,e.attachmentId))))})),(a=(0,Ne.ZN)(a)).eventBulk.events.length>0){var i=(0,Ne.ZN)(a.newestRow).document;a.eventBulk.checkpoint={id:i[this.primaryPath],lwt:i._meta.lwt},a.eventBulk.endTime=(0,Re.t)(),this.changes$.next(a.eventBulk)}return r},t.findDocumentsById=async function(e,t){ka(this);var n=await this.internals,r=[];return await n.dexieDb.transaction("r",n.dexieTable,(async()=>{(await xe(this.internals,e)).forEach((e=>{!e||e._deleted&&!t||r.push(e)}))})),r},t.query=function(e){return ka(this),dr(this,e)},t.count=async function(e){if(e.queryPlan.selectorSatisfiedByIndex){var t=await async function(e,t){var n=await e.internals,r=t.queryPlan,a=r.index,o=ur(n.booleanIndexes,r,n.dexieDb._options.IDBKeyRange),i=-1;return await n.dexieDb.transaction("r",n.dexieTable,(async e=>{var t,n=e.idbtrans.objectStore(se);t="["+a.map((e=>he(e))).join("+")+"]";var r=n.index(t).count(o);i=await new Promise(((e,t)=>{r.onsuccess=function(){e(r.result)},r.onerror=e=>t(e)}))})),i}(this,e);return{count:t,mode:"fast"}}return{count:(await dr(this,e)).documents.length,mode:"slow"}},t.changeStream=function(){return ka(this),this.changes$.asObservable()},t.cleanup=async function(e){ka(this);var t=await this.internals;return await t.dexieDb.transaction("rw",t.dexieTable,(async()=>{var n=(0,Re.t)()-e,r=await t.dexieTable.where("_meta.lwt").below(n).toArray(),a=[];r.forEach((e=>{"1"===e._deleted&&a.push(e[this.primaryPath])})),await t.dexieTable.bulkDelete(a)})),!0},t.getAttachmentData=async function(e,t,n){ka(this);var r=await this.internals,a=ke(e,t);return await r.dexieDb.transaction("r",r.dexieAttachmentsTable,(async()=>{var n=await r.dexieAttachmentsTable.get(a);if(n)return n.data;throw new Error("attachment missing documentId: "+e+" attachmentId: "+t)}))},t.remove=async function(){ka(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,n=fe.get(e)-1;0===n?(t.dexieDb.close(),fe.delete(e)):fe.set(e,n)}(this.internals)})()),this.closed},t.conflictResultionTasks=function(){return new je},t.resolveConflictResultionTask=async function(e){},e}();async function xa(e,t,n){var r=function(e,t,n,r){var a="rxdb-dexie-"+e+"--"+r.version+"--"+t,i=b(de,a,(()=>{var e=(async()=>{var e=v(n);e.autoOpen=!1;var t=new o(a,e),i={[se]:we(r),[le]:"++sequence, id",[ce]:"id"};return t.version(1).stores(i),await t.open(),{dexieDb:t,dexieTable:t[se],dexieAttachmentsTable:t[ce],booleanIndexes:_e(r)}})();return de.set(a,i),fe.set(i,0),e}));return i}(t.databaseName,t.collectionName,n,t.schema),a=new wa(e,t.databaseName,t.collectionName,t.schema,r,t.options,n,t.devMode);return await ya(ue,t,a),Promise.resolve(a)}function ka(e){if(e.closed)throw new Error("RxStorageInstanceDexie is closed "+e.databaseName+"-"+e.collectionName)}var _a="15.31.1",Sa=function(){function e(e){this.name=ue,this.rxdbVersion=_a,this.settings=e}return e.prototype.createStorageInstance=function(e){return function(e){if(e.schema.keyCompression)throw V("UT5",{args:{params:e}});if((t=e.schema).encrypted&&t.encrypted.length>0||t.attachments&&t.attachments.encrypted)throw V("UT6",{args:{params:e}});var t;if(e.schema.attachments&&e.schema.attachments.compression)throw V("UT7",{args:{params:e}})}(e),xa(this,e,this.settings)},e}();function Ea(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,r;if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!Ea(e[r],t[r]))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 a=Object.keys(e);if((n=a.length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!=r--;){var o=a[r];if(!Ea(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}var Ca=function(){function e(e,t){this.jsonSchema=e,this.hashFunction=t,this.indexes=function(e){return(e.indexes||[]).map((e=>(0,P.k_)(e)?e:[e]))}(this.jsonSchema),this.primaryPath=ne(this.jsonSchema.primaryKey),this.finalFields=ie(this.jsonSchema)}var t=e.prototype;return t.validateChange=function(e,t){this.finalFields.forEach((n=>{if(!Ea(e[n],t[n]))throw V("DOC9",{dataBefore:e,dataAfter:t,fieldName:n,schema:this.jsonSchema})}))},t.getDocumentPrototype=function(){var e={},t=te(this.jsonSchema,"");return Object.keys(t).forEach((t=>{var n=t;e.__defineGetter__(t,(function(){if(this.get&&"function"==typeof this.get)return this.get(n)})),Object.defineProperty(e,t+"$",{get:function(){return this.get$(n)},enumerable:!1,configurable:!1}),Object.defineProperty(e,t+"$$",{get:function(){return this.get$$(n)},enumerable:!1,configurable:!1}),Object.defineProperty(e,t+"_",{get:function(){return this.populate(n)},enumerable:!1,configurable:!1})})),k(this,"getDocumentPrototype",(()=>e)),e},t.getPrimaryOfDocumentData=function(e){return re(this.jsonSchema,e)},N(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[n,r]=t;return e[n]=r.default})),k(this,"defaultValues",e)}},{key:"hash",get:function(){return k(this,"hash",this.hashFunction(JSON.stringify(this.jsonSchema)))}}])}();function Oa(e,t,n){void 0===n&&(n=!0),n&&mr("preCreateRxSchema",e);var r=ae(e);r=function(e){return w(e,!0)}(r),q.deepFreezeWhenDevMode(r);var a=new Ca(r,t);return mr("createRxSchema",a),a}var Ta=n(7708),Aa=n(4370);function ja(e,t){return(0,Or.N)((function(n,r){var a=0;n.subscribe((0,Aa._)(r,(function(n){return e.call(t,n,a++)&&r.next(n)})))}))}function Pa(){for(var e=[],t=0;t0&&(t=new Ma.Ms({next:function(e){return m.next(e)},error:function(e){u=!0,d(),r=Fa(f,a,e),m.error(e)},complete:function(){c=!0,d(),r=Fa(f,i),m.complete()}}),(0,La.Tg)(e).subscribe(t))}))(e)}}({connector:function(){return new Na(i,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}var $a=n(1753);function qa(e){var t=e.split("-"),n="RxDB";return t.forEach((e=>{n+=(0,J.Z2)(e)})),n+="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 { "+n+" } from 'rxdb/plugins/"+e+"';\n addRxPlugin("+n+");\n ")}function za(e){return e.documentData?e.documentData:e.previousDocumentData}var Ua=function(){function e(e,t,n,r){this.queueByDocId=new Map,this.isRunning=!1,this.storageInstance=e,this.primaryPath=t,this.preWrite=n,this.postWrite=r}var t=e.prototype;return t.addWrite=function(e,t){var n=e[this.primaryPath],r=b(this.queueByDocId,n,(()=>[]));return new Promise(((n,a)=>{var o={lastKnownDocumentState:e,modifier:t,resolve:n,reject:a};(0,Ne.ZN)(r).push(o),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[n,r]=t;var a,o,i,s=(a=r.map((e=>e.lastKnownDocumentState)),o=a[0],i=fr(o._rev),a.forEach((e=>{var t=fr(e._rev);t>i&&(o=e,i=t)})),o),l=s;for(var c of r)try{l=await c.modifier(x(l))}catch(u){c.reject(u),c.reject=()=>{},c.resolve=()=>{}}try{await this.preWrite(l,s)}catch(u){return void r.forEach((e=>e.reject(u)))}e.push({previous:s,document:l})})));var n=e.length>0?await this.storageInstance.bulkWrite(e,"incremental-write"):{error:[]};return await Promise.all(Cr(this.primaryPath,e,n).map((e=>{var n=e[this.primaryPath];this.postWrite(e),y(t,n).forEach((t=>t.resolve(e)))}))),n.error.forEach((e=>{var n,r=e.documentId,a=y(t,r),o=Q(e);if(o){var i=b(this.queueByDocId,r,(()=>[]));a.reverse().forEach((e=>{e.lastKnownDocumentState=(0,Ne.ZN)(o.documentInDb),(0,Ne.ZN)(i).unshift(e)}))}else{var s=V("COL20",{name:Y[(n=e).status],document:n.documentId,writeError:n});a.forEach((e=>e.reject(s)))}})),this.isRunning=!1,this.triggerRun()}},e}();function Ka(e){return async t=>{var n=function(e){return Object.assign({},e,{_meta:void 0,_deleted:void 0,_rev:void 0})}(t);n._deleted=t._deleted;var r=await e(n),a=Object.assign({},r,{_meta:t._meta,_attachments:t._attachments,_rev:t._rev,_deleted:void 0!==r._deleted?r._deleted:t._deleted});return void 0===a._deleted&&(a._deleted=!1),a}}var Ha={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,Ta.T)((e=>e._data._deleted)))},get deleted$$(){var e=this;return e.collection.database.getReactivityFactory().fromObservable(e.deleted$,e.getLatest().deleted,e.collection.database)},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(ja((e=>!e.isLocal)),ja((e=>e.documentId===this.primary)),(0,Ta.T)((e=>za(e))),Ra(this.collection._docCache.getLatestDocumentData(this.primary)),(0,Da.F)(((e,t)=>e._rev===t._rev)),(0,Ta.T)((e=>this.collection._docCache.getCachedRxDocument(e))),Ba(Ne.bz))},get $$(){var e=this;return e.collection.database.getReactivityFactory().fromObservable(e.$,e.getLatest()._data,e.collection.database)},get$(e){if(q.isDevMode()){if(e.includes(".item."))throw V("DOC1",{path:e});if(e===this.primaryPath)throw V("DOC2");if(this.collection.schema.finalFields.includes(e))throw V("DOC3",{path:e});if(!te(this.collection.schema.jsonSchema,e))throw V("DOC4",{path:e})}return this.$.pipe((0,Ta.T)((t=>A(t,e))),(0,Da.F)())},get$$(e){var t=this.get$(e);return this.collection.database.getReactivityFactory().fromObservable(t,this.getLatest().get(e),this.collection.database)},populate(e){var t=te(this.collection.schema.jsonSchema,e),n=this.get(e);if(!n)return $a.$A;if(!t)throw V("DOC5",{path:e});if(!t.ref)throw V("DOC6",{path:e,schemaObj:t});var r=this.collection.database.collections[t.ref];if(!r)throw V("DOC7",{ref:t.ref,path:e,schemaObj:t});return"array"===t.type?r.findByIds(n).exec().then((e=>{var t=e.values();return Array.from(t)})):r.findOne(n).exec()},get(e){return b(this._propertyCache,e,(()=>{var t=A(this._data,e);if("object"!=typeof t||null===t||Array.isArray(t))return q.deepFreezeWhenDevMode(t);var n=this,r=new Proxy(v(t),{get(t,r){if("string"!=typeof r)return t[r];var a=r.charAt(r.length-1);if(r.endsWith("$$")){var o=r.slice(0,-2);return n.get$$((0,J.L$)(e+"."+o))}if("$"===a){var i=r.slice(0,-1);return n.get$((0,J.L$)(e+"."+i))}if("_"===a){var s=r.slice(0,-1);return n.populate((0,J.L$)(e+"."+s))}return n.get((0,J.L$)(e+"."+r))}});return r}))},toJSON(e){if(void 0===e&&(e=!1),e)return q.deepFreezeWhenDevMode(this._data);var t=v(this._data);return delete t._rev,delete t._attachments,delete t._deleted,delete t._meta,q.deepFreezeWhenDevMode(t)},toMutableJSON(e){return void 0===e&&(e=!1),x(this.toJSON(e))},update(e){throw qa("update")},incrementalUpdate(e){throw qa("update")},updateCRDT(e){throw qa("crdt")},putAttachment(){throw qa("attachments")},getAttachment(){throw qa("attachments")},allAttachments(){throw qa("attachments")},get allAttachments$(){throw qa("attachments")},async modify(e,t){var n=this._data,r=await Ka(e)(n);return this._saveData(r,n)},incrementalModify(e,t){return this.collection.incrementalWriteQueue.addWrite(this._data,Ka(e)).then((e=>this.collection._docCache.getCachedRxDocument(e)))},patch(e){var t=this._data,n=x(t);return Object.entries(e).forEach((e=>{let[t,r]=e;n[t]=r})),this._saveData(n,t)},incrementalPatch(e){return this.incrementalModify((t=>(Object.entries(e).forEach((e=>{let[n,r]=e;t[n]=r})),t)))},async _saveData(e,t){if(e=v(e),this._data._deleted)throw V("DOC11",{id:this.primary,document:this});await Va(this.collection,e,t);var n=[{previous:t,document:e}],r=await this.collection.storageInstance.bulkWrite(n,"rx-document-save-data"),a=r.error[0];return wr(this.collection,this.primary,e,a),await this.collection._runHooks("post","save",e,this),this.collection._docCache.getCachedRxDocument(Cr(this.collection.schema.primaryPath,n,r)[0])},remove(){var e=this.collection;if(this.deleted)return Promise.reject(V("DOC13",{document:this,id:this.primary}));var t,n=v(this._data);return e._runHooks("pre","remove",n,this).then((async()=>{n._deleted=!0;var t=[{previous:this._data,document:n}],r=await e.storageInstance.bulkWrite(t,"rx-document-remove"),a=r.error[0];return wr(e,this.primary,n,a),Cr(this.collection.schema.primaryPath,t,r)[0]})).then((e=>(t=e,this.collection._runHooks("post","remove",n,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 V("DOC14")}};function Wa(e){void 0===e&&(e=Ha);var t=function(e,t){this.collection=e,this._data=t,this._propertyCache=new Map,this.isInstanceOfRxDocument=!0};return t.prototype=e,t}function Va(e,t,n){return t._meta=Object.assign({},n._meta,t._meta),q.isDevMode()&&e.schema.validateChange(n,t),e._runHooks("pre","save",t,n)}var Ga=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return(0,Se.C6)(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}(je),Qa=n(4157),Ya=n(2442);const Za=e=>{e.previousResults.unshift(e.changeEvent.doc),e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,e.changeEvent.doc)},Ja=e=>{e.previousResults.push(e.changeEvent.doc),e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,e.changeEvent.doc)},Xa=e=>{const t=e.previousResults.shift();e.keyDocumentMap&&t&&e.keyDocumentMap.delete(t[e.queryParams.primaryKey])},eo=e=>{const t=e.previousResults.pop();e.keyDocumentMap&&t&&e.keyDocumentMap.delete(t[e.queryParams.primaryKey])},to=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 a,o=e.length,i=o-1,s=0;if(0===o)return e.push(t),0;for(;r<=i;)n(a=e[s=r+(i-r>>1)],t)<=0?r=s+1:i=s-1;n(a,t)<=0&&s++,e.splice(s,0,t)}(e.previousResults,n,e.queryParams.sortComparator,0)},ro=["doNothing","insertFirst","insertLast","removeFirstItem","removeLastItem","removeFirstInsertLast","removeLastInsertFirst","removeFirstInsertFirst","removeLastInsertLast","removeExisting","replaceExisting","alwaysWrong","insertAtSortPosition","removeExistingAndInsertAtSortPosition","runFullQueryAgain","unknownAction"],ao={doNothing:e=>{},insertFirst:Za,insertLast:Ja,removeFirstItem:Xa,removeLastItem:eo,removeFirstInsertLast:e=>{Xa(e),Ja(e)},removeLastInsertFirst:e=>{eo(e),Za(e)},removeFirstInsertFirst:e=>{Xa(e),Za(e)},removeLastInsertLast:e=>{eo(e),Ja(e)},removeExisting:to,replaceExisting:e=>{const t=e.changeEvent.doc,n=e.queryParams.primaryKey,r=e.previousResults;for(let a=0;a{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:no,removeExistingAndInsertAtSortPosition:e=>{to(e),no(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,po=e=>1===e.queryParams.limit,ho=e=>!!(e.queryParams.skip&&e.queryParams.skip>0),mo=e=>"DELETE"===e.changeEvent.operation,go=e=>"INSERT"===e.changeEvent.operation,yo=e=>"UPDATE"===e.changeEvent.operation,bo=e=>fo(e)&&e.previousResults.length>=e.queryParams.limit,vo=e=>{const t=e.queryParams.sortFields,n=e.changeEvent.previous,r=e.changeEvent.doc;if(!r)return!1;if(!n)return!0;for(let a=0;a{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)},ko=e=>{const t=lo(e.previousResults);return!(!t||t[e.queryParams.primaryKey]!==e.changeEvent.id)},_o=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},So=e=>{const t=e.changeEvent.previous;if(!t)return!1;const n=lo(e.previousResults);if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)>0},Eo=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},Co=e=>{const t=e.changeEvent.doc;if(!t)return!1;const n=lo(e.previousResults);if(!n)return!1;if(n[e.queryParams.primaryKey]===e.changeEvent.id)return!0;return e.queryParams.sortComparator(t,n)>0},Oo=e=>{const t=e.changeEvent.previous;return!!t&&e.queryParams.queryMatcher(t)},To=e=>{const t=e.changeEvent.doc;if(!t)return!1;return e.queryParams.queryMatcher(t)},Ao=e=>0===e.previousResults.length,jo={0:go,1:yo,2:mo,3:fo,4:po,5:ho,6:Ao,7:bo,8:xo,9:ko,10:vo,11:wo,12:_o,13:So,14:Eo,15:Co,16:Oo,17:To};let Po;function Ro(){return Po||(Po=function(e){const t=new Map,n=2+2*parseInt(e.charAt(0)+e.charAt(1),10),r=oo(e.substring(2,n),2);for(let l=0;lfunction(e,t,n){let r=e,a=e.l;for(;;){if(r=r[t[a](n)?"1":"0"],"number"==typeof r||"string"==typeof r)return r;a=r.l}}(Ro(),jo,e);function Io(e){const t=Do(e);return ro[t]}function No(e,t){return t.sort&&0!==t.sort.length?t.sort.map((e=>Object.keys(e)[0])):[e]}var Lo=new WeakMap;function Mo(e,t){if(!e.collection.database.eventReduce)return{runFullQueryAgain:!0};var n=function(e){return b(Lo,e,(()=>{var t=e.collection,n=ar(t.storageInstance.schema,x(e.mangoQuery)),r=t.schema.primaryPath,a=or(t.schema.jsonSchema,n),o=ir(t.schema.jsonSchema,n);return{primaryKey:e.collection.schema.primaryPath,skip:n.skip,limit:n.limit,sortFields:No(r,n),sortComparator:(t,n)=>{var r={docA:t,docB:n,rxQuery:e};return a(r.docA,r.docB)},queryMatcher:t=>o({doc:t,rxQuery:e}.doc)}}))}(e),r=(0,Ne.ZN)(e._result).docsData.slice(0),a=(0,Ne.ZN)(e._result).docsDataMap,o=!1,i=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:q.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(P.S7).find((e=>{var t=Io({queryParams:n,changeEvent:e,previousResults:r,keyDocumentMap:a});return"runFullQueryAgain"===t||("doNothing"!==t?(o=!0,function(e,t,n,r,a){(0,ao[e])({queryParams:t,changeEvent:n,previousResults:r,keyDocumentMap:a})}(t,n,e,r,a),!1):void 0)}));return i?{runFullQueryAgain:!0}:{runFullQueryAgain:!1,changed:o,newResults:r}}var Fo=function(){function e(){this._map=new Map}return e.prototype.getByQuery=function(e){var t=e.toString();return b(this._map,t,(()=>e))},e}();function Bo(e,t){t.uncached=!0;var n=t.toString();e._map.delete(n)}function $o(e){return e.refCount$.observers.length}var qo,zo,Uo=(qo=100,zo=3e4,(e,t)=>{if(!(t._map.size0||(0===o._lastEnsureEqual&&o._creationTimee._lastEnsureEqual-t._lastEnsureEqual)).slice(0,i).forEach((e=>Bo(t,e)))}}),Ko=new WeakSet;var Ho=function(){function e(e,t,n){this.cacheItemByDocId=new Map,this.tasks=new Set,this.registry="function"==typeof FinalizationRegistry?new FinalizationRegistry((e=>{var t=e.docId,n=this.cacheItemByDocId.get(t);n&&(n[0].delete(e.revisionHeight),0===n[0].size&&this.cacheItemByDocId.delete(t))})):void 0,this.primaryPath=e,this.changes$=t,this.documentCreator=n,t.subscribe((e=>{this.tasks.add((()=>{for(var t=this.cacheItemByDocId,n=0;n{this.processTasks()}))}))}var t=e.prototype;return t.processTasks=function(){0!==this.tasks.size&&(Array.from(this.tasks).forEach((e=>e())),this.tasks.clear())},t.getLatestDocumentData=function(e){return this.processTasks(),y(this.cacheItemByDocId,e)[1]},t.getLatestDocumentDataIfExists=function(e){this.processTasks();var t=this.cacheItemByDocId.get(e);if(t)return t[1]},N(e,[{key:"getCachedRxDocuments",get:function(){return k(this,"getCachedRxDocuments",Wo(this))}},{key:"getCachedRxDocument",get:function(){var e=Wo(this);return k(this,"getCachedRxDocument",(t=>e([t])[0]))}}])}();function Wo(e){var t=e.primaryPath,n=e.cacheItemByDocId,r=e.registry,a=q.deepFreezeWhenDevMode,o=e.documentCreator;return i=>{for(var s=new Array(i.length),l=[],c=0;c0&&r&&(e.tasks.add((()=>{for(var e=0;e{e.processTasks()}))),s}}function Vo(e,t){return(0,e.getCachedRxDocuments)(t)}var Go="function"==typeof WeakRef?function(e){return new WeakRef(e)}:function(e){return{deref:()=>e}};var Qo=function(){function e(e,t,n){this.time=(0,Re.t)(),this.query=e,this.count=n,this.documents=Vo(this.query.collection._docCache,t)}return e.prototype.getValue=function(e){var t=this.query.op;if("count"===t)return this.count;if("findOne"===t){var n=0===this.documents.length?null:this.documents[0];if(!n&&e)throw V("QU10",{collection:this.query.collection.name,query:this.query.mangoQuery,op:t});return n}return"findByIds"===t?this.docsMap:this.documents.slice(0)},N(e,[{key:"docsData",get:function(){return k(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)})),k(this,"docsDataMap",e)}},{key:"docsMap",get:function(){for(var e=new Map,t=this.documents,n=0;n"string"!=typeof e)))return n.$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 Qo(this,e,e.length);this._result=t}else this._result=new Qo(this,[],e)},t._execOverDatabase=async function(){if(this._execOverDatabaseCount=this._execOverDatabaseCount+1,this._lastExecStart=(0,Re.t)(),"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 V("QU14",{collection:this.collection,queryObj:this.mangoQuery})}if("findByIds"===this.op){var n=(0,Ne.ZN)(this.mangoQuery.selector)[this.collection.schema.primaryPath].$in,r=new Map,a=[];if(n.forEach((e=>{var t=this.collection._docCache.getLatestDocumentDataIfExists(e);if(t){if(!t._deleted){var n=this.collection._docCache.getCachedRxDocument(t);r.set(e,n)}}else a.push(e)})),a.length>0)(await this.collection.storageInstance.findDocumentsById(a,!1)).forEach((e=>{var t=this.collection._docCache.getCachedRxDocument(e);r.set(t.primary,t)}));return r}var o=async function(e){var t=[],n=e.collection;if(e.isFindOneByIdQuery)if(Array.isArray(e.isFindOneByIdQuery)){var r=e.isFindOneByIdQuery;if(r=r.filter((n=>{var r=e.collection._docCache.getLatestDocumentDataIfExists(n);return!r||(r._deleted||t.push(r),!1)})),r.length>0){var a=await n.storageInstance.findDocumentsById(r,!1);(0,P.Hb)(t,a)}}else{var o=e.isFindOneByIdQuery,i=e.collection._docCache.getLatestDocumentDataIfExists(o);if(!i){var s=await n.storageInstance.findDocumentsById([o],!1);s[0]&&(i=s[0])}i&&!i._deleted&&t.push(i)}else{var l=e.getPreparedQuery(),c=await n.storageInstance.query(l);t=c.documents}return t}(this);return o.then((e=>(this._lastExecEnd=(0,Re.t)(),e)))},t.exec=async function(e){if(e&&"findOne"!==this.op)throw V("QU9",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return await ei(this),(0,Ne.ZN)(this._result).getValue(e)},t.toString=function(){var e=w({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:ar(this.collection.schema.jsonSchema,this.mangoQuery)};e.mangoQuery.selector._deleted={$eq:!1},e.mangoQuery.index&&e.mangoQuery.index.unshift("_deleted"),mr("prePrepareQuery",e);var t=ti(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.incrementalRemove=function(){return sr(this.asRxQuery,(e=>e.incrementalRemove()))},t.update=function(e){throw qa("update")},t.patch=function(e){return sr(this.asRxQuery,(t=>t.patch(e)))},t.incrementalPatch=function(e){return sr(this.asRxQuery,(t=>t.incrementalPatch(e)))},t.modify=function(e){return sr(this.asRxQuery,(t=>t.modify(e)))},t.incrementalModify=function(e){return sr(this.asRxQuery,(t=>t.incrementalModify(e)))},t.where=function(e){throw qa("query-builder")},t.sort=function(e){throw qa("query-builder")},t.skip=function(e){throw qa("query-builder")},t.limit=function(e){throw qa("query-builder")},N(e,[{key:"$",get:function(){if(!this._$){var e=this.collection.$.pipe(ja((e=>!e.isLocal)),Ra(null),(0,Ya.Z)((()=>ei(this))),(0,Ta.T)((()=>this._result)),Ba(Ne.bz),(0,Da.F)(((e,t)=>!(!e||e.time!==(0,Ne.ZN)(t).time))),ja((e=>!!e)),(0,Ta.T)((e=>(0,Ne.ZN)(e).getValue())));this._$=(0,Qa.h)(e,this.refCount$.pipe(ja((()=>!1))))}return this._$}},{key:"$$",get:function(){return this.collection.database.getReactivityFactory().fromObservable(this.$,void 0,this.collection.database)}},{key:"queryMatcher",get:function(){this.collection.schema.jsonSchema;return k(this,"queryMatcher",ir(0,ar(this.collection.schema.jsonSchema,this.mangoQuery)))}},{key:"asRxQuery",get:function(){return this}}])}();function Jo(e,t,n,r){mr("preCreateRxQuery",{op:e,queryObj:t,collection:n,other:r});var a,o,i=new Zo(e,t,n,r);return i=(a=i).collection._queryCache.getByQuery(a),o=n,Ko.has(o)||(Ko.add(o),(0,$a.dY)().then((()=>(0,$a.Ve)(200))).then((()=>{o.destroyed||o.cacheReplacementPolicy(o,o._queryCache),Ko.delete(o)}))),i}function Xo(e){var t=e.asRxQuery.collection._changeEventBuffer.getCounter();return e._latestChangeEvent>=t}async function ei(e){return e.collection.awaitBeforeReads.size>0&&await Promise.all(Array.from(e.collection.awaitBeforeReads).map((e=>e()))),!e.collection.database.destroyed&&!Xo(e)&&(e._ensureEqualQueue=e._ensureEqualQueue.then((()=>function(e){if(e._lastEnsureEqual=(0,Re.t)(),e.collection.database.destroyed||Xo(e))return $a.Dr;var t=!1,n=!1;-1===e._latestChangeEvent&&(n=!0);if(!n){var r=e.asRxQuery.collection._changeEventBuffer.getFrom(e._latestChangeEvent+1);if(null===r)n=!0;else{e._latestChangeEvent=e.asRxQuery.collection._changeEventBuffer.getCounter();var a=e.asRxQuery.collection._changeEventBuffer.reduceByLastOfDoc(r);if("count"===e.op){var o=(0,Ne.ZN)(e._result).count,i=o;a.forEach((t=>{var n=t.previousDocumentData&&e.doesDocumentDataMatch(t.previousDocumentData),r=e.doesDocumentDataMatch(t.documentData);!n&&r&&i++,n&&!r&&i--})),i!==o&&(t=!0,e._setResultData(i))}else{var s=Mo(e,a);s.runFullQueryAgain?n=!0:s.changed&&(t=!0,e._setResultData(s.newResults))}}}if(n)return e._execOverDatabase().then((n=>(e._latestChangeEvent=e.collection._changeEventBuffer.getCounter(),"number"==typeof n?(e._result&&n===e._result.count||(t=!0,e._setResultData(n)),t):(e._result&&function(e,t,n){if(t.length!==n.length)return!1;for(var r=0,a=t.length;re.data.name===a)),l=[];s.forEach((e=>{l.push({collectionName:e.data.name,schema:e.data.schema,isCollection:!0}),e.data.connectedStorages.forEach((e=>l.push({collectionName:e.collectionName,isCollection:!1,schema:e.schema})))}));var c=new Set;if(l=l.filter((e=>{var t=e.collectionName+"||"+e.schema.version;return!c.has(t)&&(c.add(t),!0)})),await Promise.all(l.map((async t=>{var i=await e.createStorageInstance({collectionName:t.collectionName,databaseInstanceToken:n,databaseName:r,multiInstance:!1,options:{},schema:t.schema,password:o,devMode:q.isDevMode()});await i.remove(),t.isCollection&&await gr("postRemoveRxCollection",{storage:e,databaseName:r,collectionName:a})}))),i){var u=s.map((e=>{var t=_r(e);return t._deleted=!0,t._meta.lwt=(0,Re.t)(),t._rev=pr(n,e),{previous:e,document:t}}));await t.bulkWrite(u,"rx-database-remove-collection-all")}}function fi(e){if(e.destroyed)throw V("COL21",{collection:e.name,version:e.schema.version})}var pi=function(){function e(e){this.subs=[],this.counter=0,this.eventCounterMap=new WeakMap,this.buffer=[],this.limit=100,this.tasks=new Set,this.collection=e,this.subs.push(this.collection.database.eventBulks$.pipe(ja((e=>e.collectionName===this.collection.name)),ja((e=>!e.events[0].isLocal))).subscribe((e=>{this.tasks.add((()=>this._handleChangeEvents(e.events))),this.tasks.size<=1&&(0,$a.vN)().then((()=>{this.processTasks()}))})))}var t=e.prototype;return t.processTasks=function(){0!==this.tasks.size&&(Array.from(this.tasks).forEach((e=>e())),this.tasks.clear())},t._handleChangeEvents=function(e){var t=this.counter;this.counter=this.counter+e.length,e.length>this.limit?this.buffer=e.slice(-1*e.length):((0,P.Hb)(this.buffer,e),this.buffer=this.buffer.slice(-1*this.limit));for(var n=t+1,r=this.eventCounterMap,a=0;at(e)))},t.reduceByLastOfDoc=function(e){return this.processTasks(),e.slice(0)},t.destroy=function(){this.tasks.clear(),this.subs.forEach((e=>e.unsubscribe()))},e}();var hi=new WeakMap;function mi(e){var t=e.schema.getDocumentPrototype(),n=function(e){var t={};return Object.entries(e.methods).forEach((e=>{let[n,r]=e;t[n]=r})),t}(e),r={};return[t,n,Ha].forEach((e=>{Object.getOwnPropertyNames(e).forEach((t=>{var n=Object.getOwnPropertyDescriptor(e,t),a=!0;(t.startsWith("_")||t.endsWith("_")||t.startsWith("$")||t.endsWith("$"))&&(a=!1),"function"==typeof n.value?Object.defineProperty(r,t,{get(){return n.value.bind(this)},enumerable:a,configurable:!1}):(n.enumerable=a,n.configurable=!1,n.writable&&(n.writable=!1),Object.defineProperty(r,t,n))}))})),r}function gi(e,t,n){var r=function(e,t,n){var r=new e(t,n);return mr("createRxDocument",r),r}(t,e,q.deepFreezeWhenDevMode(n));return e._runHooksSync("post","create",n,r),mr("postCreateRxDocument",r),r}var yi=function(e,t){return Ea(kr(e.newDocumentState),kr(e.realMasterState))?Promise.resolve({isEqual:!0}):Promise.resolve({isEqual:!1,documentData:e.realMasterState})};var bi=["pre","post"],vi=["insert","save","remove","create"],wi=!1,xi=function(){function e(e,t,n,r,a,o,i,s,l,c,u,d){void 0===a&&(a={}),void 0===o&&(o={}),void 0===i&&(i={}),void 0===s&&(s={}),void 0===l&&(l={}),void 0===c&&(c=Uo),void 0===u&&(u={}),void 0===d&&(d=yi),this.storageInstance={},this.timeouts=new Set,this.incrementalWriteQueue={},this.awaitBeforeReads=new Set,this._incrementalUpsertQueues=new Map,this.synced=!1,this.hooks={},this._subs=[],this._docCache={},this._queryCache=new Fo,this.$={},this.checkpoint$={},this._changeEventBuffer={},this.onDestroy=[],this.destroyed=!1,this.onRemove=[],this.database=e,this.name=t,this.schema=n,this.internalStorageInstance=r,this.instanceCreationOptions=a,this.migrationStrategies=o,this.methods=i,this.attachments=s,this.options=l,this.cacheReplacementPolicy=c,this.statics=u,this.conflictHandler=d,function(e){if(wi)return;wi=!0;var t=Object.getPrototypeOf(e);vi.forEach((e=>{bi.map((n=>{var r=n+(0,J.Z2)(e);t[r]=function(t,r){return this.addHook(n,e,t,r)}}))}))}(this.asRxCollection)}var t=e.prototype;return t.prepare=async function(){this.storageInstance=Er(this.database,this.internalStorageInstance,this.schema.jsonSchema),this.incrementalWriteQueue=new Ua(this.storageInstance,this.schema.primaryPath,((e,t)=>Va(this,e,t)),(e=>this._runHooks("post","save",e)));var e,t,n=this.database.eventBulks$.pipe(ja((e=>e.collectionName===this.name)));this.$=n.pipe((0,Ya.Z)((e=>e.events))),this.checkpoint$=n.pipe((0,Ta.T)((e=>e.checkpoint))),this._changeEventBuffer=(e=this.asRxCollection,new pi(e)),this._docCache=new Ho(this.schema.primaryPath,this.database.eventBulks$.pipe(ja((e=>e.collectionName===this.name&&!e.events[0].isLocal)),(0,Ta.T)((e=>e.events))),(e=>{var n;return t||(n=this.asRxCollection,t=b(hi,n,(()=>Wa(mi(n))))),gi(this.asRxCollection,t,e)}));var r=this.database.internalStore.changeStream().pipe(ja((e=>{var t=this.name+"-"+this.schema.version;return!!e.events.find((e=>"collection"===e.documentData.context&&e.documentData.key===t&&"DELETE"===e.operation))}))).subscribe((async()=>{await this.destroy(),await Promise.all(this.onRemove.map((e=>e())))}));this._subs.push(r);var a=await this.database.storageToken,o=this.storageInstance.changeStream().subscribe((e=>{for(var t=new Array(e.events.length),n=e.events,r=this.name,o=q.deepFreezeWhenDevMode,i=0;i{this.conflictHandler(e.input,e.context).then((t=>{this.storageInstance.resolveConflictResultionTask({id:e.id,output:t})}))}))),$a.em},t.cleanup=function(e){throw fi(this),qa("cleanup")},t.migrationNeeded=function(){throw qa("migration-schema")},t.getMigrationState=function(){throw qa("migration-schema")},t.startMigration=function(e){return void 0===e&&(e=10),fi(this),this.getMigrationState().startMigration(e)},t.migratePromise=function(e){return void 0===e&&(e=10),this.getMigrationState().migratePromise(e)},t.insert=async function(e){fi(this);var t=await this.bulkInsert([e]),n=t.error[0];return wr(this,e[this.schema.primaryPath],e,n),(0,Ne.ZN)(t.success[0])},t.bulkInsert=async function(e){if(fi(this),0===e.length)return{success:[],error:[]};var t,n=this.schema.primaryPath;if(this.hasHooks("pre","insert"))t=await Promise.all(e.map((e=>{var t=ui(this.schema,e);return this._runHooks("pre","insert",t).then((()=>({document:t})))})));else{t=new Array(e.length);for(var r=this.schema,a=0;a{var t=e.document;u.set(t[n],t)})),await Promise.all(c.success.map((e=>this._runHooks("post","insert",u.get(e.primary),e))))}return c},t.bulkRemove=async function(e){fi(this);var t=this.schema.primaryPath;if(0===e.length)return{success:[],error:[]};var n=await this.findByIds(e).exec(),r=[],a=new Map;Array.from(n.values()).forEach((e=>{var t=e.toMutableJSON(!0);r.push(t),a.set(e.primary,t)})),await Promise.all(r.map((e=>{var t=e[this.schema.primaryPath];return this._runHooks("pre","remove",e,n.get(t))})));var o=r.map((e=>{var t=v(e);return t._deleted=!0,{previous:e,document:t}})),i=await this.storageInstance.bulkWrite(o,"rx-collection-bulk-remove"),s=Cr(this.schema.primaryPath,o,i).map((e=>e[t]));return await Promise.all(s.map((e=>this._runHooks("post","remove",a.get(e),n.get(e))))),{success:s.map((e=>y(n,e))),error:i.error}},t.bulkUpsert=async function(e){fi(this);var t=[],n=new Map;e.forEach((e=>{var r=ui(this.schema,e),a=r[this.schema.primaryPath];if(!a)throw V("COL3",{primaryPath:this.schema.primaryPath,data:r,schema:this.schema.jsonSchema});n.set(a,r),t.push(r)}));var r=await this.bulkInsert(t),a=r.success.slice(0),o=[];return await Promise.all(r.error.map((async e=>{if(409!==e.status)o.push(e);else{var t=e.documentId,r=y(n,t),i=(0,Ne.ZN)(e.documentInDb),s=this._docCache.getCachedRxDocuments([i])[0],l=await s.incrementalModify((()=>r));a.push(l)}}))),{error:o,success:a}},t.upsert=async function(e){fi(this);var t=await this.bulkUpsert([e]);return wr(this.asRxCollection,e[this.schema.primaryPath],e,t.error[0]),t.success[0]},t.incrementalUpsert=function(e){fi(this);var t=ui(this.schema,e),n=t[this.schema.primaryPath];if(!n)throw V("COL4",{data:e});var r=this._incrementalUpsertQueues.get(n);return r||(r=$a.em),r=r.then((()=>function(e,t,n){var r=e._docCache.getLatestDocumentDataIfExists(t);if(r)return Promise.resolve({doc:e._docCache.getCachedRxDocuments([r])[0],inserted:!1});return e.findOne(t).exec().then((t=>t?{doc:t,inserted:!1}:e.insert(n).then((e=>({doc:e,inserted:!0})))))}(this,n,t))).then((e=>e.inserted?e.doc:function(e,t){return e.incrementalModify((e=>t))}(e.doc,t))),this._incrementalUpsertQueues.set(n,r),r},t.find=function(e){if(fi(this),"string"==typeof e)throw V("COL5",{queryObj:e});return e||(e={selector:{}}),Jo("find",e,this)},t.findOne=function(e){if(fi(this),"number"==typeof e||Array.isArray(e))throw G("COL6",{queryObj:e});var t;if("string"==typeof e)t=Jo("findOne",{selector:{[this.schema.primaryPath]:e},limit:1},this);else{if(e||(e={selector:{}}),e.limit)throw V("QU6");(e=v(e)).limit=1,t=Jo("findOne",e,this)}return t},t.count=function(e){return fi(this),e||(e={selector:{}}),Jo("count",e,this)},t.findByIds=function(e){return fi(this),Jo("findByIds",{selector:{[this.schema.primaryPath]:{$in:e.slice(0)}}},this)},t.exportJSON=function(){throw qa("json-dump")},t.importJSON=function(e){throw qa("json-dump")},t.insertCRDT=function(e){throw qa("crdt")},t.addPipeline=function(e){throw qa("pipeline")},t.addHook=function(e,t,n,r){if(void 0===r&&(r=!1),"function"!=typeof n)throw G("COL7",{key:t,when:e});if(!bi.includes(e))throw G("COL8",{key:t,when:e});if(!vi.includes(t))throw V("COL9",{key:t});if("post"===e&&"create"===t&&!0===r)throw V("COL10",{when:e,key:t,parallel:r});var a=n.bind(this),o=r?"parallel":"series";this.hooks[t]=this.hooks[t]||{},this.hooks[t][e]=this.hooks[t][e]||{series:[],parallel:[]},this.hooks[t][e][o].push(a)},t.getHooks=function(e,t){return this.hooks[t]&&this.hooks[t][e]?this.hooks[t][e]:{series:[],parallel:[]}},t.hasHooks=function(e,t){if(!this.hooks[t]||!this.hooks[t][e])return!1;var n=this.getHooks(e,t);return!!n&&(n.series.length>0||n.parallel.length>0)},t._runHooks=function(e,t,n,r){var a=this.getHooks(e,t);if(!a)return $a.em;var o=a.series.map((e=>()=>e(n,r)));return(0,$a.h$)(o).then((()=>Promise.all(a.parallel.map((e=>e(n,r))))))},t._runHooksSync=function(e,t,n,r){if(this.hasHooks(e,t)){var a=this.getHooks(e,t);a&&a.series.forEach((e=>e(n,r)))}},t.promiseWait=function(e){return new Promise((t=>{var n=setTimeout((()=>{this.timeouts.delete(n),t()}),e);this.timeouts.add(n)}))},t.destroy=async function(){return this.destroyed?$a.Dr:(await Promise.all(this.onDestroy.map((e=>e()))),this.destroyed=!0,Array.from(this.timeouts).forEach((e=>clearTimeout(e))),this._changeEventBuffer&&this._changeEventBuffer.destroy(),this.database.requestIdlePromise().then((()=>this.storageInstance.close())).then((()=>(this._subs.forEach((e=>e.unsubscribe())),delete this.database.collections[this.name],gr("postDestroyRxCollection",this).then((()=>!0))))))},t.remove=async function(){await this.destroy(),await Promise.all(this.onRemove.map((e=>e()))),await di(this.database.storage,this.database.internalStore,this.database.token,this.database.name,this.name,this.database.password,this.database.hashFunction)},N(e,[{key:"insert$",get:function(){return this.$.pipe(ja((e=>"INSERT"===e.operation)))}},{key:"update$",get:function(){return this.$.pipe(ja((e=>"UPDATE"===e.operation)))}},{key:"remove$",get:function(){return this.$.pipe(ja((e=>"DELETE"===e.operation)))}},{key:"asRxCollection",get:function(){return this}}])}();var ki=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 _i(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 Si(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 Si(e)}),0))}(e),e._tryIR=!1):e._tryIR=!1}),0):e._tryIR=!1}),0))}ki.prototype={isIdle:function(){return this._qCe.events))),this.storageToken=$a.Dr,this.storageTokenDocument=$a.Dr,this.emittedEventBulkIds=new Br(6e4),this.name=e,this.token=t,this.storage=n,this.instanceCreationOptions=r,this.password=a,this.multiInstance=o,this.eventReduce=i,this.options=s,this.internalStore=l,this.hashFunction=c,this.cleanupPolicy=u,this.allowSlowCount=d,this.reactivity=f,"pseudoInstance"!==this.name&&(this.internalStore=Er(this.asRxDatabase,l,ai),this.storageTokenDocument=async function(e){var t=(0,J.z3)(10),n=e.password?await e.hashFunction(JSON.stringify(e.password)):void 0,r=[{document:{id:li,context:ri,key:si,data:{rxdbVersion:e.rxdbVersion,token:t,instanceToken:e.token,passwordHash:n},_deleted:!1,_meta:ee(),_rev:"",_attachments:{}}}],a=await e.internalStore.bulkWrite(r,"internal-add-storage-token");if(!a.error[0])return Cr("id",r,a)[0];var o=(0,Ne.ZN)(a.error[0]);if(o.isError&&Q(o)){var i=o;if(l=i.documentInDb.data.rxdbVersion,c=e.rxdbVersion,!l||c.includes("beta")&&c!==l||l.split(".")[0]!==c.split(".")[0])throw V("DM5",{args:{database:e.name,databaseStateVersion:i.documentInDb.data.rxdbVersion,codeVersion:e.rxdbVersion}});if(n&&n!==i.documentInDb.data.passwordHash)throw V("DB1",{passwordHash:n,existingPasswordHash:i.documentInDb.data.passwordHash});var s=i.documentInDb;return(0,Ne.ZN)(s)}var l,c;throw o}(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.getReactivityFactory=function(){if(!this.reactivity)throw V("DB14",{database:this.name});return this.reactivity},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 n=await br(this.internalStore,oi(ci(e,t),ni));if(!n)throw V("SNH",{name:e,schema:t});var r=_r(n);r._deleted=!0,await this.internalStore.bulkWrite([{document:r,previous:n}],"rx-database-remove-collection")},t.addCollections=async function(e){var t={},n={},r=[],a={};await Promise.all(Object.entries(e).map((async e=>{let[o,i]=e;var s=o,l=i.schema;t[s]=l;var c=Oa(l,this.hashFunction);if(n[s]=c,this.collections[o])throw V("DB3",{name:o});var u=ci(o,l),d={id:oi(u,ni),key:u,context:ni,data:{name:s,schemaHash:await c.hash,schema:c.jsonSchema,version:c.version,connectedStorages:[]},_deleted:!1,_meta:ee(),_rev:"",_attachments:{}};r.push({document:d});var f=Object.assign({},i,{name:s,schema:c,database:this}),p=v(i);p.database=this,p.name=o,mr("preCreateRxCollection",p),f.conflictHandler=p.conflictHandler,a[s]=f})));var o=await this.internalStore.bulkWrite(r,"rx-database-add-collection");await async function(e){if(await e.storageToken,e.startupErrors[0])throw e.startupErrors[0]}(this),await Promise.all(o.error.map((async e=>{if(409!==e.status)throw V("DB12",{database:this.name,writeError:e});var r=(0,Ne.ZN)(e.documentInDb),a=r.data.name,o=n[a];if(r.data.schemaHash!==await o.hash)throw V("DB6",{database:this.name,collection:a,previousSchemaHash:r.data.schemaHash,schemaHash:await o.hash,previousSchema:r.data.schema,schema:(0,Ne.ZN)(t[a])})})));var i={};return await Promise.all(Object.keys(e).map((async e=>{var t=a[e],n=await function(e){let{database:t,name:n,schema:r,instanceCreationOptions:a={},migrationStrategies:o={},autoMigrate:i=!0,statics:s={},methods:l={},attachments:c={},options:u={},localDocuments:d=!1,cacheReplacementPolicy:f=Uo,conflictHandler:p=yi}=e;var h={databaseInstanceToken:t.token,databaseName:t.name,collectionName:n,schema:r.jsonSchema,options:a,multiInstance:t.multiInstance,password:t.password,devMode:q.isDevMode()};return mr("preCreateRxStorageInstance",h),async function(e,t){return t.multiInstance=e.multiInstance,await e.storage.createStorageInstance(t)}(t,h).then((e=>{var h=new xi(t,n,r,e,a,o,l,c,u,f,s,p);return h.prepare().then((()=>{Object.entries(s).forEach((e=>{let[t,n]=e;Object.defineProperty(h,t,{get:()=>n.bind(h)})}));var e=$a.em;return i&&0!==h.schema.version&&(e=h.migratePromise()),e})).then((()=>(mr("createRxCollection",{collection:h,creator:{name:n,schema:r,storageInstance:e,instanceCreationOptions:a,migrationStrategies:o,methods:l,attachments:c,options:u,cacheReplacementPolicy:f,localDocuments:d,statics:s}}),h))).catch((t=>e.close().then((()=>Promise.reject(t)))))}))}(t);i[e]=n,this.collections[e]=n,this[e]||Object.defineProperty(this,e,{get:()=>this.collections[e]})}))),i},t.lockedRun=function(e){return this.idleQueue.wrapCall(e)},t.requestIdlePromise=function(){return this.idleQueue.requestIdlePromise()},t.exportJSON=function(e){throw qa("json-dump")},t.addState=function(e){throw qa("state")},t.importJSON=function(e){throw qa("json-dump")},t.backup=function(e){throw qa("backup")},t.leaderElector=function(){throw qa("leader-election")},t.isLeader=function(){throw qa("leader-election")},t.waitForLeadership=function(){throw qa("leader-election")},t.migrationStates=function(){throw qa("migration-schema")},t.destroy=async function(){return this.destroyed?$a.Dr:(this.destroyed=!0,await gr("preDestroyRxDatabase",this),this.eventBulks$.complete(),this._subs.map((e=>e.unsubscribe())),"pseudoInstance"===this.name?$a.Dr: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((()=>Ei.delete(this.storage.name+"|"+this.name))).then((()=>!0)))},t.remove=function(){return this.destroy().then((()=>async function(e,t,n){var r=(0,J.z3)(10),a=await Oi(r,t,e,{},!1,n),o=await ii(a),i=new Set;o.forEach((e=>i.add(e.data.name)));var s=Array.from(i);return await Promise.all(s.map((o=>di(t,a,r,e,o,n)))),await gr("postRemoveRxDatabase",{databaseName:e,storage:t}),await a.remove(),s}(this.name,this.storage,this.password)))},N(e,[{key:"$",get:function(){return this.observable$}},{key:"asRxDatabase",get:function(){return this}}])}();async function Oi(e,t,n,r,a,o){return await t.createStorageInstance({databaseInstanceToken:e,databaseName:n,collectionName:yr,schema:ai,options:r,multiInstance:a,password:o,devMode:q.isDevMode()})}function Ti(e){let{storage:t,instanceCreationOptions:n,name:r,password:a,multiInstance:o=!0,eventReduce:i=!0,ignoreDuplicate:s=!1,options:l={},cleanupPolicy:c,allowSlowCount:u=!1,localDocuments:d=!1,hashFunction:f=Ie.V0,reactivity:p}=e;mr("preCreateRxDatabase",{storage:t,instanceCreationOptions:n,name:r,password:a,multiInstance:o,eventReduce:i,ignoreDuplicate:s,options:l,localDocuments:d}),s||function(e,t){var n=t.name+"|"+e;if(Ei.has(n))throw V("DB8",{name:e,storage:t.name,link:"https://rxdb.info/rx-database.html#ignoreduplicate"})}(r,t),Ei.add(t.name+"|"+r);var h=(0,J.z3)(10);return Oi(h,t,r,n,o,a).catch((e=>{throw Ei.delete(t.name+"|"+r),e})).then((e=>{var m=new Ci(r,h,t,n,a,o,i,l,e,f,c,u,p);return gr("createRxDatabase",{database:m,creator:{storage:t,instanceCreationOptions:n,name:r,password:a,multiInstance:o,eventReduce:i,ignoreDuplicate:s,options:l,localDocuments:d}}).then((()=>m))}))}var Ai={RxSchema:Ca.prototype,RxDocument:Ha,RxQuery:Zo.prototype,RxCollection:xi.prototype,RxDatabase:Ci.prototype},ji=new Set,Pi=new Set;var Ri=function(e){function t(t,n,r){var a;return(a=e.call(this,null,n)||this).id=t,a.parent=r,a}return M(t,e),t}(Wa()),Di={get isLocal(){return!0},get allAttachments$(){throw V("LD1",{document:this})},get primaryPath(){return"id"},get primary(){return this.id},get $(){var e=y(Fi,this.parent);return this.parent.$.pipe(ja((e=>e.documentId===this.primary)),ja((e=>e.isLocal)),(0,Ta.T)((e=>za(e))),Ra(e.docCache.getLatestDocumentData(this.primary)),(0,Da.F)(((e,t)=>e._rev===t._rev)),(0,Ta.T)((t=>e.docCache.getCachedRxDocument(t))),Ba(Ne.bz))},get $$(){var e=this,t=Li(e);return t.getReactivityFactory().fromObservable(e.$,e.getLatest()._data,t)},get deleted$$(){var e=this,t=Li(e);return t.getReactivityFactory().fromObservable(e.deleted$,e.getLatest().deleted,t)},getLatest(){var e=y(Fi,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 G("LD2",{objPath:e});var t=A(this._data,e);return t=q.deepFreezeWhenDevMode(t)}},get$(e){if(e="data."+e,q.isDevMode()){if(e.includes(".item."))throw V("LD3",{objPath:e});if(e===this.primaryPath)throw V("LD4")}return this.$.pipe((0,Ta.T)((e=>e._data)),(0,Ta.T)((t=>A(t,e))),(0,Da.F)())},get$$(e){var t=Li(this);return t.getReactivityFactory().fromObservable(this.get$(e),this.getLatest().get(e),t)},async incrementalModify(e){var t=await $i(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[n,r]=e;t[n]=r})),t)))},async _saveData(e){var t=await $i(this.parent),n=this._data;e.id=this.id;var r=[{previous:n,document:e}];return t.storageInstance.bulkWrite(r,"local-document-save-data").then((t=>{if(t.error[0])throw t.error[0];var n=Cr(this.collection.schema.primaryPath,r,t)[0];(e=v(e))._rev=n._rev}))},async remove(){var e=await $i(this.parent),t=v(this._data);return t._deleted=!0,vr(e.storageInstance,{previous:this._data,document:t},"local-document-remove").then((t=>e.docCache.getCachedRxDocument(t)))}},Ii=!1,Ni=()=>{if(!Ii){Ii=!0;var e=Ha;Object.getOwnPropertyNames(e).forEach((t=>{if(!Object.getOwnPropertyDescriptor(Di,t)){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(Di,t,n)}}));["populate","update","putAttachment","getAttachment","allAttachments"].forEach((e=>Di[e]=(e=>()=>{throw V("LD6",{functionName:e})})(e)))}};function Li(e){var t=e.parent;return t instanceof Ci?t:t.database}var Mi=new WeakMap,Fi=new WeakMap;function Bi(e){var t=e.database?e.database:e,n=e.database?e.name:"",r=(async()=>{var r=await qi(t.token,t.storage,t.name,n,t.instanceCreationOptions,t.multiInstance);r=Er(t,r,Hi);var a=new Ho("id",t.eventBulks$.pipe(ja((e=>{var t=!1;return(""===n&&!e.collectionName||""!==n&&e.collectionName===n)&&(t=!0),t&&e.events[0].isLocal})),(0,Ta.T)((e=>e.events))),(t=>function(e,t){Ni();var n=new Ri(e.id,e,t);return Object.setPrototypeOf(n,Di),n.prototype=Di,n}(t,e))),o=new Ua(r,"id",(()=>{}),(()=>{})),i=await t.storageToken,s=r.changeStream().subscribe((n=>{for(var r=new Array(n.events.length),a=n.events,o=e.database?e.name:void 0,s=0;se.storageInstance.close()))}async function Ui(e,t,n){var r=(0,J.z3)(10),a=await qi(r,e,t,n,{},!1);await a.remove()}function Ki(e){return"plugin-local-documents-"+e}var Hi=ae({title:"RxLocalDocument",version:0,primaryKey:"id",type:"object",properties:{id:{type:"string",maxLength:128},data:{type:"object",additionalProperties:!0}},required:["id","data"]});async function Wi(e,t){var n=await $i(this),r={id:e,data:t,_deleted:!1,_meta:ee(),_rev:"",_attachments:{}};return vr(n.storageInstance,{document:r},"local-document-insert").then((e=>n.docCache.getCachedRxDocument(e)))}function Vi(e,t){return this.getLocal(e).then((n=>n?n.incrementalModify((()=>t)):this.insertLocal(e,t)))}async function Gi(e){var t=await $i(this),n=t.docCache,r=n.getLatestDocumentDataIfExists(e);return r?Promise.resolve(n.getCachedRxDocument(r)):br(t.storageInstance,e).then((e=>e?t.docCache.getCachedRxDocument(e):null))}function Qi(e){return this.$.pipe(Ra(null),(0,Ya.Z)((async t=>t?{changeEvent:t}:{doc:await this.getLocal(e)})),(0,Ya.Z)((async t=>{if(t.changeEvent){var n=t.changeEvent;return n.isLocal&&n.documentId===e?{use:!0,doc:await this.getLocal(e)}:{use:!1}}return{use:!0,doc:t.doc}})),ja((e=>e.use)),(0,Ta.T)((e=>e.doc)))}var Yi={name:"local-documents",rxdb:!0,prototypes:{RxCollection:e=>{e.insertLocal=Wi,e.upsertLocal=Vi,e.getLocal=Gi,e.getLocal$=Qi},RxDatabase:e=>{e.insertLocal=Wi,e.upsertLocal=Vi,e.getLocal=Gi,e.getLocal$=Qi}},hooks:{createRxDatabase:{before:e=>{e.creator.localDocuments&&Bi(e.database)}},createRxCollection:{before:e=>{e.creator.localDocuments&&Bi(e.collection)}},preDestroyRxDatabase:{after:e=>zi(e)},postDestroyRxCollection:{after:e=>zi(e)},postRemoveRxDatabase:{after:e=>Ui(e.storage,e.databaseName,"")},postRemoveRxCollection:{after:e=>Ui(e.storage,e.databaseName,e.collectionName)}},overwritable:{}};let Zi;function Ji(){return"undefined"!=typeof window&&window.indexedDB}function Xi(){return Zi||(Zi=(async()=>{!function(e){if(mr("preAddRxPlugin",{plugin:e,plugins:ji}),!ji.has(e)){if(Pi.has(e.name))throw V("PL3",{name:e.name,plugin:e});if(ji.add(e),Pi.add(e.name),!e.rxdb)throw G("PL1",{plugin:e});e.init&&e.init(),e.prototypes&&Object.entries(e.prototypes).forEach((e=>{let[t,n]=e;return n(Ai[t])})),e.overwritable&&Object.assign(q,e.overwritable),e.hooks&&Object.entries(e.hooks).forEach((e=>{let[t,n]=e;n.after&&hr[t].push(n.after),n.before&&hr[t].unshift(n.before)}))}}(Yi);var e;return await Ti({name:"rxdb-landing-v3",localDocuments:!0,storage:(void 0===e&&(e={}),new Sa(e))})})()),Zi}const es=["#e6008d","#8d2089","#5f2688"]},1513:(e,t,n)=>{"use strict";n.d(t,{zR:()=>w,TM:()=>C,yJ:()=>p,sC:()=>T,AO:()=>f});var r=n(8168);function a(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,r=n+1,a=e.length;r=0;f--){var p=i[f];"."===p?o(i,f):".."===p?(o(i,f),d++):d&&(o(i,f),d--)}if(!c)for(;d--;d)i.unshift("..");!c||""===i[0]||i[0]&&a(i[0])||i.unshift("");var h=i.join("/");return n&&"/"!==h.substr(-1)&&(h+="/"),h};var s=n(1561);function l(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 f(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 p(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.A)({},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(s){throw s instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):s}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 h(){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=p(e,t,m(),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(4363),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},s={};function l(e){return r.isMemo(e)?i:s[e.$$typeof]||a}s[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(h){var a=p(n);a&&a!==h&&e(t,a,r)}var i=u(n);d&&(i=i.concat(d(n)));for(var s=l(t),m=l(n),g=0;g{"use strict";e.exports=function(e,t,n,r,a,o,i,s){if(!e){var l;if(void 0===t)l=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,s],u=0;(l=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},4634:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},689: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(s){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"),s=i.length,l=0;i=Array.prototype.slice.call(i);var c=function(){--s<=0&&o(l)};s||c(),i.forEach((function(t){e.matches(t,a.exclude)?c():a.onIframeReady(t,(function(e){n(t)&&(l++,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),s=[],l=[],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,s)}),(function(t){o.createInstanceOnIframe(t).forEachNode(e,(function(e){return l.push(e)}),r)})),l.push(c);l.forEach((function(e){n(e)})),this.iframes&&this.handleOpenIframes(s,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 s=function(){r.iterateThroughNodes(e,o,t,n,(function(){--i<=0&&a()}))};r.iframes?r.waitForIframes(o,s):s()}))}}],[{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),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==i&&""!==s&&(e=e.replace(new RegExp("("+this.escapeStr(i)+"|"+this.escapeStr(s)+")","gm"+n),r+"("+this.processSynomyms(i)+"|"+this.processSynomyms(s)+")"+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,s=parseInt(e.start,10)-i;return(r=(s=s>o?o:s)+parseInt(e.length,10))>o&&(r=o,this.log("End range automatically set to the max value of "+o)),s<0||r-s<0||s>o||r>o?(a=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===n.substring(s,r).replace(/\s+/g,"")&&(a=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:s,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,s){var l=e.nodes[s+1];if(void 0===l||l.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),f=e.value.substr(u+i.start);if(i.node=o.wrapRangeInTextNode(i.node,c,u),e.value=d+f,e.nodes.forEach((function(t,n){n>=s&&(e.nodes[n].start>0&&n!==s&&(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 s=a.index;if(0!==i)for(var l=1;l{"use strict";n.r(t)},1043:(e,t,n)=>{"use strict";n.r(t)},5947: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,s((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),l(c,i(e,u,d)),1===e?(l(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){l(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),s=e?"-100":o(n.status||0),c=document.querySelector(r.parent);return l(i,{transition:"all 0 linear",transform:"translate3d("+s+"%,0,0)"}),r.showSpinner||(a=t.querySelector(r.spinnerSelector))&&p(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&&p(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 s=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),l=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:f(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=f(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=f(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function f(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(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)},5302:(e,t,n)=>{var r=n(4634);e.exports=p,e.exports.parse=o,e.exports.compile=function(e,t){return s(o(e,t),t)},e.exports.tokensToFunction=s,e.exports.tokensToRegExp=f;var a=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function o(e,t){for(var n,r=[],o=0,i=0,s="",u=t&&t.delimiter||"/";null!=(n=a.exec(e));){var d=n[0],f=n[1],p=n.index;if(s+=e.slice(i,p),i=p+d.length,f)s+=f[1];else{var h=e[i],m=n[2],g=n[3],y=n[4],b=n[5],v=n[6],w=n[7];s&&(r.push(s),s="");var x=null!=m&&null!=h&&h!==m,k="+"===v||"*"===v,_="?"===v||"*"===v,S=n[2]||u,E=y||b;r.push({name:g||o++,prefix:m||"",delimiter:S,optional:_,repeat:k,partial:x,asterisk:!!w,pattern:E?c(E):w?".*":"[^"+l(S)+"]+?"})}}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"}}})},8722:(e,t,n)=>{const r=n(6969),a=n(8380),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(3157).resolve(t)],delete Prism.languages[e],n(3157)(t),o.add(e)}))}i.silent=!1,e.exports=i},9700:()=>{!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,s=i.length;-1!==n.code.indexOf(a=t(r,s));)++s;return i[s]=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(s){for(var l=0;l=o.length);l++){var c=s[l];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[a],d=n.tokenStack[u],f="string"==typeof c?c:c.content,p=t(r,u),h=f.indexOf(p);if(h>-1){++a;var m=f.substring(0,h),g=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),y=f.substring(h+p.length),b=[];m&&b.push.apply(b,i([m])),b.push(g),y&&b.push.apply(b,i([y])),"string"==typeof c?s.splice.apply(s,[l,1].concat(b)):c.content=b}}else c.content&&i(c.content)}return s}(n.tokens)}}}})}(Prism)},8692:(e,t,n)=>{var r={"./":8722};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=8692},3157:(e,t,n)=>{var r={"./":8722};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=3157},8380: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 s={},l=e[r];if(l){function c(t){if(!(t in e))throw new Error(r+" depends on an unknown component "+t);if(!(t in s))for(var i in a(t,o),s[t]=!0,n[t])s[i]=!0}t(l.require,c),t(l.optional,c),t(l.modify,c)}n[r]=s,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,s){var l=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}}(l);i=i.map(c),s=(s||[]).map(c);var u=n(i),d=n(s);i.forEach((function e(n){var r=l[n];t(r&&r.require,(function(t){t in d||(u[t]=!0,e(t))}))}));for(var f,p=r(l),h=u;a(h);){for(var m in f={},h){var g=l[m];t(g&&g.modify,(function(e){e in d&&(f[e]=!0)}))}for(var y in d)if(!(y in u))for(var b in p(y))if(b in u){f[y]=!0;break}for(var v in h=f)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,s={},l={};function c(e){if(e in s)return s[e];l[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 f=i(u.map((function(e){var t=c(e);return delete l[e],t})));o?a=o(f,(function(){return r(e)})):r(e)}return s[e]=a}for(var u in n)c(u);var d=[];for(var f in l)d.push(s[f]);return i(d)}(p,u,t,n)}};return w}}();e.exports=t},2694:(e,t,n)=>{"use strict";var r=n(6925);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var s=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 s.name="Invariant Violation",s}}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}},5556:(e,t,n)=>{e.exports=n(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2551:(e,t,n)=>{"use strict";var r=n(6540),a=n(9982);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n