diff --git a/.github/workflows/test-trigger.yml b/.github/workflows/test-trigger.yml index fabd95657..f31f215a1 100644 --- a/.github/workflows/test-trigger.yml +++ b/.github/workflows/test-trigger.yml @@ -6,11 +6,10 @@ name: Trigger E2E tests on: push: - branches: [ staging, 2025.9-rc, 2025.9-test ] + branches: [ staging, 2025.12-rc, 2025.12-test ] jobs: trigger-tests: - if: github.ref_name == 'staging' runs-on: ubuntu-latest steps: - name: Trigger E2E test run (local) @@ -19,9 +18,9 @@ jobs: if [ "$branch" = "staging" ]; then event_type="trigger-e2e-tests-staging" - elif [ "$branch" = "2025.9-rc" ]; then + elif [ "$branch" = "2025.12-rc" ]; then event_type="trigger-e2e-tests-rc" - elif [ "$branch" = "2025.9-test" ]; then + elif [ "$branch" = "2025.12-test" ]; then event_type="trigger-e2e-tests-test" fi diff --git a/.gitignore b/.gitignore index 78212683a..e8f53fd48 100644 --- a/.gitignore +++ b/.gitignore @@ -101,6 +101,9 @@ tags # ---> VisualStudioCode .vscode/* +# ---> Intellij +.idea/* + # Local History for Visual Studio Code .history/ diff --git a/CHANGELOG.md b/CHANGELOG.md index cf35668a0..259def9ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,106 @@ SPDX-License-Identifier: AGPL-3.0-or-later --> +# ❄️ Winter release (2026.2.0) + +## Goals + +This release upgrades our office applications with OnlyOffice 9 as well as the same history browsing feature as our other applications (history was limited until now). We also include a redesigned folder tree in the drive, and many other improvements and fixes as detailed below. + +## Features + +- Upgrade Office applications to OnlyOffice v9.2.0.119 +- OnlyOffice history browsing [#2134](https://github.com/cryptpad/cryptpad/pull/2134) +- Update drive tree UI [#2102](https://github.com/cryptpad/cryptpad/pull/2102) + +## Improvements + +- Integration API improvements [#2139](https://github.com/cryptpad/cryptpad/pull/2139) +- Integration API: Allow client download [#2114](https://github.com/cryptpad/cryptpad/pull/2114) +- Let the user close the old password error modal, without having to refresh the login page [#2125](https://github.com/cryptpad/cryptpad/pull/2125) +- Add support for required poll questions in forms [#2092](https://github.com/cryptpad/cryptpad/pull/2092) +- Improve support & moderation UI [#2082](https://github.com/cryptpad/cryptpad/pull/2082) +- Enable Dutch language [#2148](https://github.com/cryptpad/cryptpad/pull/2148) + +## Fixes + +- Account, Profile and Contacts + - Fix incorrect error message for invalid credentials [#2163](https://github.com/cryptpad/cryptpad/pull/2163) + - Delete 2FA data when archiving account [#2177](https://github.com/cryptpad/cryptpad/pull/2177) + - Fix padding for profile action buttons [#2081](https://github.com/cryptpad/cryptpad/pull/2081) + - Fix contact page name overflow [#2084](https://github.com/cryptpad/cryptpad/pull/2084) + - Fix: Profile description editor now shows saved value without requiring focus [#2100](https://github.com/cryptpad/cryptpad/pull/2100) +- Drives + - Fix rtChannel not always stored and pinned [#2168](https://github.com/cryptpad/cryptpad/pull/2168) + - Preserve drive list sorting order across reloads [#2115](https://github.com/cryptpad/cryptpad/pull/2115) + - Fix: Removed avatars are no longer shown in team roster [#2087](https://github.com/cryptpad/cryptpad/pull/2087) + - Fix text overflow issues on Ctrl+E (New document) modal [#2117](https://github.com/cryptpad/cryptpad/pull/2117) + - Fix: Context menu new document options now respect selected type [#2124](https://github.com/cryptpad/cryptpad/pull/2124) +- Apps + - Hide History button if history disabled [#2104](https://github.com/cryptpad/cryptpad/pull/2104) + - Disable dragging when selecting text inside title and items for Kanban cards [#2088](https://github.com/cryptpad/cryptpad/pull/2088) + - Add missing margin to elements in Form [#2083](https://github.com/cryptpad/cryptpad/pull/2083) + - CKEditor undo stack cleared on refresh [#2121](https://github.com/cryptpad/cryptpad/pull/2121) + - change code-pad to code [#2160](https://github.com/cryptpad/cryptpad/pull/2160) @achf01 +- Office apps + - Do not delete last checkpoint on 5xx error [#2166](https://github.com/cryptpad/cryptpad/pull/2166) + - OnlyOffice tab notifications [#2110](https://github.com/cryptpad/cryptpad/pull/2110) + - install-onlyoffice.sh: fix --check for new install_version function [#2097](https://github.com/cryptpad/cryptpad/pull/2097) @martinetd +- Typos + - Fix some typos [#2126](https://github.com/cryptpad/cryptpad/pull/2126) @josep11 + - doc: typo [#2116](https://github.com/cryptpad/cryptpad/pull/2116) @thiswillbeyourgithub + - Fix translation key errors in admin panel and installation page [#2138](https://github.com/cryptpad/cryptpad/pull/2138) +- Other + - File upload base64 caused by base64 conversion [#2181](https://github.com/cryptpad/cryptpad/pull/2181) + - Calendar export fixes [#2151](https://github.com/cryptpad/cryptpad/pull/2151) + - Fix UI overflow when loading a PDF file [#2118](https://github.com/cryptpad/cryptpad/pull/2118) + - Icon fixes [#2096](https://github.com/cryptpad/cryptpad/pull/2096) + - moderator setting on by default [#2144](https://github.com/cryptpad/cryptpad/pull/2144) + + +## Dependencies + +- Minor upgrades + - body-parser from ^1.20.2 to ^1.20.4 + - express from ~4.21.2 to ~4.22.1 + - jsonwebtoken from ^9.0.0 to ^9.0.3 + + +## Deployment and Development + +- Do not deploy Draw.io's JAR files [#2120](https://github.com/cryptpad/cryptpad/pull/2120) +- Switch to docker alpine image [#2119](https://github.com/cryptpad/cryptpad/pull/2119) +- Update triggers for end-to-end test suite [#2060](https://github.com/cryptpad/cryptpad/pull/2060) +- add Intellij directory to ignored git files [#2122](https://github.com/cryptpad/cryptpad/pull/2122) @josep11 + + +## Upgrade notes + +If you are upgrading from a version older than `2025.9.0` please read the upgrade notes of all versions between yours and `2026.2.0` to avoid configuration issues. + +To upgrade: + +1. Stop your server +2. Get the latest code with git + +```bash +git fetch --depth 1 origin tag 2026.2.0 +git checkout 2026.2.0 +npm ci +npm run install:components +./install-onlyoffice.sh +``` + +3. Restart your server +4. Review your instance's checkup page to ensure that you are passing all tests + +## Contributors + +Community: @achf01 @martinetd @josep11 @thiswillbeyourgithub + +CryptPad team: @AAAMON @Chouhartem @dariiing @davidbenque @DianaXWiki @mathilde-cryptpad @wginolas @yflory @zuzanna-maria + + # 🍁 Autumn release (2025.9.0) ## Goals diff --git a/Dockerfile b/Dockerfile index c6d343942..2d02c00c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # Multistage build to reduce image size and increase security -FROM node:lts-slim AS build +FROM node:lts-alpine AS build # Create folder for CryptPad RUN mkdir /cryptpad @@ -20,19 +20,14 @@ RUN npm install --production \ && npm run install:components # Create actual CryptPad image -FROM node:lts-slim -ENV DEBIAN_FRONTEND=noninteractive +FROM node:lts-alpine # Create user and group for CryptPad so it does not run as root -RUN groupadd cryptpad -g 4001 -RUN useradd cryptpad -u 4001 -g 4001 -d /cryptpad +RUN addgroup -S cryptpad -g 4001 && adduser -S cryptpad -G cryptpad --uid 4001 -h /cryptpad # Install curl for healthcheck # Install git, rdfind and unzip for install-onlyoffice.sh -RUN apt-get update && apt-get install --no-install-recommends -y \ - curl ca-certificates git rdfind unzip && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* +RUN apk add --no-cache ca-certificates git rdfind unzip bash curl # Copy cryptpad with installed modules COPY --from=build --chown=cryptpad /cryptpad /cryptpad diff --git a/config/config.example.js b/config/config.example.js index b2da5793a..33d6be783 100644 --- a/config/config.example.js +++ b/config/config.example.js @@ -50,7 +50,7 @@ module.exports = { */ httpUnsafeOrigin: 'http://localhost:3000', -/* httpSafeOrigin is the URL that is used for the 'sandbox' described above. +/* httpSafeOrigin is the URL used for the 'sandbox' described above. * If you're testing or developing with CryptPad on your local machine then * it is appropriate to leave this blank. The default behaviour is to serve * the main domain over port 3000 and to serve the sandbox content over port 3001. @@ -256,8 +256,8 @@ module.exports = { */ archivePath: './data/archive', - /* CryptPad allows logged in users to request that particular documents be - * stored by the server indefinitely. This is called 'pinning'. + /* CryptPad allows logged in users to request that the server + * store particular documents indefinitely. This is called 'pinning'. * Pin requests are stored in a pin-store. The location of this store is * defined here. */ diff --git a/customize.dist/login.js b/customize.dist/login.js index 31567afcb..e9361a6a9 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -151,10 +151,20 @@ define([ break; */ case 'DELETED_USER': - UI.errorLoadingScreen( - UI.getDestroyedPlaceholder(result.reason, true), true, () => { - window.location.reload(); + if (result.reason === 'PASSWORD_CHANGE') { + UI.removeLoadingScreen(function () { + UI.alert(Messages.dph_account_pw, function () { + hashing = false; + $('#password').focus(); + } + ); }); + } else { + UI.errorLoadingScreen( + UI.getDestroyedPlaceholder(result.reason, true), true, () => { + window.location.reload(); + }); + } break; case 'INVAL_PASS': UI.removeLoadingScreen(function () { diff --git a/customize.dist/messages.js b/customize.dist/messages.js index e0284fd64..06268dfd3 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -20,7 +20,7 @@ var map = { 'it': 'Italiano', 'ja': '日本語', 'nb': 'Norwegian Bokmål', - //'nl': 'Nederlands' + 'nl': 'Nederlands', 'pl': 'Polski', 'pt-br': 'Português do Brasil', 'pt-pt': 'Português do Portugal', diff --git a/customize.dist/pages/install.js b/customize.dist/pages/install.js index 17f405d07..97527ffa7 100644 --- a/customize.dist/pages/install.js +++ b/customize.dist/pages/install.js @@ -41,7 +41,7 @@ define([ h('ul.cp-notes-list', [ h('li', [ Icons.get('alert'), - Msg.admin_note + Msg.admin_creation_note ]), h('li', [ Icons.get('alert'), @@ -92,4 +92,3 @@ define([ }; }); - diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index 3328751d6..8044f6cdf 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -82,10 +82,6 @@ } } - .cp-admin-message { - color: @cryptpad_text_col; - } - .cp-inline-alert-text { flex: 1; } diff --git a/customize.dist/src/less2/include/browser.less b/customize.dist/src/less2/include/browser.less index 633417574..5cdd9b070 100644 --- a/customize.dist/src/less2/include/browser.less +++ b/customize.dist/src/less2/include/browser.less @@ -10,6 +10,6 @@ @browser_media-not-big: 800px; @browser_media-not-small: 801px; -@browser_media-short-screen: 450px; +@browser_media-short-screen: 500px; @browser_media-narrow-screen: 400px; @browser_media-medium-screen: 600px; diff --git a/customize.dist/src/less2/include/drive.less b/customize.dist/src/less2/include/drive.less index 1ea26cd98..4982d81ce 100644 --- a/customize.dist/src/less2/include/drive.less +++ b/customize.dist/src/less2/include/drive.less @@ -101,7 +101,6 @@ margin: 8px 0; } svg { - margin: auto; margin: 18px 0; text-align: center; &.listonly { @@ -316,7 +315,7 @@ overflow: auto; width: auto; white-space: nowrap; - max-width: 500px; + max-width: 300px; min-width: 200px; padding: 10px 0px 0px 0px; color: @cp_sidebar-left-fg; @@ -342,13 +341,17 @@ .cp-app-drive-tree-docs { .droppable-tree-element(); margin-top: 15px; - //padding: 0 0 0 20px; - padding: 0; + padding: 5px; background-color: @cp_sidebar-left-item-bg; - border-radius: @variables_radius; + border-radius: @variables_radius_L; cursor: auto; &li, li { - padding: 0; + padding: 0px; + ul { + li { + margin-top: 2px; + } + } &.cp-app-drive-element-collapsed ul { display: none; } @@ -363,17 +366,18 @@ overflow: hidden; text-overflow: ellipsis; .leftside-menu-category_main(); + border-radius: @variables_radius_M; display: flex; align-items: center; cursor: pointer; - margin: 0 0 2px -5px; + margin: 0; .cp-app-drive-element { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; } - &:focus-visible { + &:focus-visible, input:focus-visible { outline: @variables_focus_style; } } @@ -386,7 +390,7 @@ margin: 0; margin-top: 10px; background-color: @cp_sidebar-left-item-bg; - border-radius: @variables_radius; + border-radius: @variables_radius_L; box-shadow: @cryptpad_ui_shadow; .cp-app-drive-tree-root { .droppable-tree-element(); @@ -415,29 +419,19 @@ .cp-app-drive-icon-expcol { font-size: 14px; position: absolute; - left: -17px; - top: 10px; + left: -20px; overflow: hidden; - width: calc(1em - 2px) !important; - height: calc(1em - 2px) !important; - background-color: @cp_sidebar-left-item-bg; padding: 0; margin: 0; z-index: 10; - cursor: default; + cursor: pointer; display: inline-flex; svg { - margin: -1px; - width: 1em; - height: 1em; + margin: 0; } &:focus-visible { - outline: none; - svg { - outline: @variables_focus_style; - border-radius: @variables_radius_S; - margin: 0; - } + outline: @variables_focus_style; + border-radius: @variables_radius; } } .cp-app-drive-tree-docs { @@ -451,9 +445,8 @@ } } .cp-app-drive-tree-root > .cp-app-drive-element-row { - margin-left: 0px; .cp-icon-hidden ~ svg { - margin-left: -21px; + margin-left: -10px; } .cp-app-drive-icon-expcol { top: -1px; @@ -478,38 +471,17 @@ padding-left: 15px; } &> ul { - padding-left: 30px; + padding-left: 20px; } } } // Expand/collapse lines .cp-app-drive-tree-docs ul { - margin: 0px 0px 0px 10px; + margin: 0px 0px 0px 12px; list-style: none; - padding-left: 10px; li { position: relative; - &:before { - position: absolute; - left: -10px; - top: -10px; - content: ''; - display: block; - border-left: 1px solid @cp_drive-tree-branch; - height: ~"calc(1em + 11px)"; - border-bottom: 1px solid @cp_drive-tree-branch; - width: 11px; - } - &:after { - position: absolute; - left: -10px; - bottom: -7px; - content: ''; - display: block; - border-left: 1px solid @cp_drive-tree-branch; - height: 100%; - } &.cp-app-drive-tree-root { margin: 0px 0px 0px -10px; &:before { @@ -551,6 +523,7 @@ -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; + border-left: 1px solid transparent; &:hover { border-left: 1px solid @cryptpad_text_col; } @@ -1062,7 +1035,10 @@ .cp-app-drive-new-name { color: @cp_drive-fg; + overflow: hidden; + text-overflow: ellipsis; white-space: nowrap; + max-width: 100%; } @media screen and (max-width: @browser_media-medium-screen), diff --git a/customize.dist/src/less2/include/leftside-menu.less b/customize.dist/src/less2/include/leftside-menu.less index c3a11cdfd..c7ae7c654 100644 --- a/customize.dist/src/less2/include/leftside-menu.less +++ b/customize.dist/src/less2/include/leftside-menu.less @@ -10,12 +10,12 @@ .leftside-menu-category_main() { .unselectable_make(); - padding: 5px; + padding: 5px 5px 5px 10px; margin: 10px 0; cursor: pointer; height: @variables_bar-height; - border-radius: @variables_radius; background-color: @cp_sidebar-left-item-bg; + border-radius: @variables_radius_L; &:hover { background: @cryptpad_text_col_inv; } diff --git a/customize.dist/src/less2/include/messenger.less b/customize.dist/src/less2/include/messenger.less index 0d67b5398..8efa0b9b1 100644 --- a/customize.dist/src/less2/include/messenger.less +++ b/customize.dist/src/less2/include/messenger.less @@ -109,6 +109,8 @@ min-width: 0; .cp-app-contacts-name { white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } .cp-app-contacts-icons { text-align: right; diff --git a/customize.dist/src/less2/include/modals-ui-elements.less b/customize.dist/src/less2/include/modals-ui-elements.less index d7d50a1a8..ba8ef31b5 100644 --- a/customize.dist/src/less2/include/modals-ui-elements.less +++ b/customize.dist/src/less2/include/modals-ui-elements.less @@ -365,6 +365,13 @@ } } + .alertify .dialog .msg div.cp-admin-message { + color: @cryptpad_text_col; + a { + color: @cryptpad_color_link; + } + } + .cp-userteam-picker { .cp-userteam-filter { margin: 5px 0; diff --git a/customize.dist/src/less2/include/notifications.less b/customize.dist/src/less2/include/notifications.less index 38d698a32..cd794667a 100644 --- a/customize.dist/src/less2/include/notifications.less +++ b/customize.dist/src/less2/include/notifications.less @@ -68,6 +68,9 @@ &.cp-clickable { cursor: pointer; } + a { + color: @cryptpad_color_link; + } } .cp-notification-dismiss { color: @cp_dropdown-fg; diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index 83aae7587..86eab5a38 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -121,6 +121,11 @@ display: flex; flex-flow: column; align-items: baseline; + input, textarea { + &:focus-visible { + outline: @variables_focus_style; + } + } } .cp-usergrid-container { margin-bottom: 0px !important; @@ -219,6 +224,9 @@ border-right: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; + &:focus-visible { + outline: @variables_focus_style; + } } input:invalid { border-color: red; diff --git a/customize.dist/src/less2/include/support.less b/customize.dist/src/less2/include/support.less index c061c1949..8853ba1a6 100644 --- a/customize.dist/src/less2/include/support.less +++ b/customize.dist/src/less2/include/support.less @@ -40,6 +40,14 @@ padding: 10px 15px; height: 300px; } + textarea, input { + &:focus-visible { + outline: @variables_focus_style; + } + } + .cp-support-list-send, .cp-support-reply-cancel { + margin-right: @variables_icon_margin; + } } .cp-support-attachments { display: flex; @@ -58,6 +66,9 @@ .cp-support-recorded-insert { margin-right: @sidebar_base-margin; } + button { + margin-right: @variables_icon_margin; + } } @ticket-padding: 10px; .cp-support-container { @@ -72,7 +83,7 @@ border-radius: @variables_radius; .cp-support-ticket-header { display: flex; - align-items: center; + align-items: flex-start; justify-content: space-between; .cp-support-header-data { display: flex; @@ -82,7 +93,7 @@ min-width: 0; .cp-support-ticket-title { width: 100%; - margin-bottom: @sidebar_base-margin; + margin-bottom: 1rem; word-break: break-word; } .cp-tags-list { @@ -91,10 +102,15 @@ } margin-top: @sidebar_base-margin; width: 100%; + span { + margin-bottom: 0.3rem; + } } } .cp-support-title-buttons { margin-left: 1em; + display: inline-flex; + gap: @variables_icon_margin; svg { margin: 0; } @@ -103,6 +119,7 @@ .cp-support-ticket-tags { .cp-tokenfield-form button.cp-token-close { border-radius: @variables_radius !important; + margin-left: 0.5rem; } } &.cp-filtered { @@ -186,6 +203,7 @@ } .cp-support-list-actions { display: flex; + gap: @variables_icon_margin; order: 3; margin-top: 5px; .cp-support-hide { diff --git a/customize.dist/src/less2/include/tokenfield.less b/customize.dist/src/less2/include/tokenfield.less index 943fc2edd..e0f28f97d 100644 --- a/customize.dist/src/less2/include/tokenfield.less +++ b/customize.dist/src/less2/include/tokenfield.less @@ -43,6 +43,9 @@ input { flex: 1; min-width: 0 !important; + &:focus-visible { + outline: @variables_focus_style; + } } button { // no radius in input + button combo @@ -174,9 +177,6 @@ margin-right: @tokens_margin; } .tools_unselectable(); - i { - margin-right: 5px; - } } .cp-tags-list { em { @@ -186,6 +186,7 @@ span { cursor: pointer; font-size: 14px; + margin-bottom: 0.3rem; .tools_unselectable(); &.active { background-color: @cp_kanban-fg; diff --git a/customize.dist/src/less2/include/toolbar-history.less b/customize.dist/src/less2/include/toolbar-history.less index 464634d66..b68bbf11e 100644 --- a/customize.dist/src/less2/include/toolbar-history.less +++ b/customize.dist/src/less2/include/toolbar-history.less @@ -56,6 +56,12 @@ font-size: 12px; margin-right: 10px; } + + .cp-toolbar-history-previous, .cp-toolbar-history-next { + display: inline-flex; + align-items: center; + justify-content: center; + } } .cp-toolbar-history-actions { display: flex; @@ -129,9 +135,7 @@ } &.cp-smallpatch { .cp-history-snapshot { - border: none !important; - width: 2px !important; - background: @pos-color; + border: 2px solid !important; } .cp-history-timeline-pos { border-right: none; @@ -145,6 +149,7 @@ height: 20px !important; .cp-history-timeline-pos { height: 20px !important; + margin-left: 100%; } } .cp-history-timeline-actions { @@ -179,10 +184,25 @@ background-color: @history_lineBg; height: 39px; } + .cp-oohistory-bar-el { + background-color: @history_userBg2; + display: block; + height: 100%; + } + .cp-history-patch { + height: 100%; + position: relative; + display: flex; + justify-content: center; + box-sizing: border-box; + &:nth-child(odd) { + background-color: @history_userBg1 + } + } + .cp-history-timeline-bar { display: flex; flex-flow: column; - padding: 1px; & > span { height: 18px; display: flex; @@ -207,19 +227,29 @@ .cp-history-snapshots { position: absolute; left: 1px; - right: 1px; - top: 1px; + right: 0px; + top: 0px; bottom: 1px; cursor: pointer; .cp-history-snapshot { position: absolute; border: 2px solid @cryptpad_text_col; - height: 100%; + height: 98%; display: flex; - align-items: center; + align-items: center !important; justify-content: center; } } + + .cp-history-snapshots-oo { + top: 0px; + bottom: 0px; + margin-left: -1px; + width: 100%; + .cp-history-snapshot { + height: 100%; + } + } } } .cp-history-timeline-actions { @@ -260,6 +290,17 @@ } } + .cp-history-oo-timeline-pos { + border: 2px solid @cryptpad_text_col; + height: 37px; + svg { + position: absolute; + left: 50%; + bottom: 70%; + transform: translateX(-50%) + } + } + .cp-history-timeline-pos { //width: 2px; border: 2px solid @cryptpad_text_col; diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index cde1ea1d7..3d4e5b13d 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -514,7 +514,7 @@ } @media screen and (max-width: @browser_media-medium-screen), - screen and (max-height: 500px) { + screen and (max-height: @browser_media-short-screen) { flex-wrap: wrap; height: @toolbar_line-height; .cp-toolbar-top-filler { @@ -873,8 +873,8 @@ // width: 100%; // } } - @media screen and (max-height: @browser_media-medium-screen), - screen and (max-width: @browser_media-medium-screen) { + @media screen and (max-width: @browser_media-medium-screen), + screen and (max-height: @browser_media-short-screen) { a.cp-toolbar-link-logo { svg { width: @variables_icon_width; diff --git a/customize.dist/src/less2/include/variables.less b/customize.dist/src/less2/include/variables.less index bf832fb87..92a5d1d4a 100644 --- a/customize.dist/src/less2/include/variables.less +++ b/customize.dist/src/less2/include/variables.less @@ -21,6 +21,7 @@ // Rounded corners @variables_radius_S: 3px; @variables_radius: 5px; +@variables_radius_M: 7.5px; @variables_radius_L: 10px; @variables_focus_style: @cryptpad_color_brand solid 2px; diff --git a/customize.dist/template.js b/customize.dist/template.js index b71136e71..de72a7c9c 100644 --- a/customize.dist/template.js +++ b/customize.dist/template.js @@ -6,12 +6,18 @@ define([ 'jquery', '/common/hyperscript.js', '/customize/pages.js', + '/customize/application_config.js', '/components/nthen/index.js', -], function ($, h, Pages, nThen) { +], function ($, h, Pages, AppConfig, nThen) { // we consider that there is no valid reason to load any of the info pages // in an iframe. abort everything if you detect that you are embedded. if (window.top !== window) { return; } + if (AppConfig.integrationOnly) { + window.location.href = '/customize/404.html'; + return; + } + $(function () { var $body = $('body'); var pathname = location.pathname; diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 4d64af583..f9200716a 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later So you want to write a realtime collaborative application? -This guide will focus on applications which require **multiple clients** to **collaboratively construct a single authoratative document**. +This guide will focus on applications which require **multiple clients** to **collaboratively construct a single authoritative document**. [XWiki-Labs](https://labs.xwiki.com/) has published an open source suite (called [CryptPad](https://github.com/cryptpad/cryptpad)) of collaborative editors which employ end to end encryption. This guide will refer to the techniques used in the prototypes developed therein. @@ -82,7 +82,7 @@ Chainpad can handle out of order messages, but it performs best when its message By architecting your system such that all clients send to a server which then relays to other clients, you guarantee that a particular chain of patches is consistent between the participants of your session. CryptPad is capable of using a variety of data stores. -Which data store your instance employs can be [easily configured](https://github.com/cryptpad/cryptpad/blob/master/config.example.js). +Which data store your instance uses can be [easily configured](https://github.com/cryptpad/cryptpad/blob/master/config.example.js). You simply need to write an adaptor which conforms to a simple API. The documentation for writing such an adaptor, and the complete list of implemented adaptors, is available [here](https://github.com/cryptpad/cryptpad/tree/master/storage). @@ -133,7 +133,7 @@ It is the application developers' responsibility to infer from the new content w In the process of developing its [Realtime CKEditor](https://cryptpad.fr) XWiki Labs discovered that many of the [existing Javascript libraries](https://github.com/Matt-Esch/virtual-dom) for updating a **DOM** are very destructive, and replace elements completely once a difference is detected within the tree (when scanning left to right). After testing several options, we ended up using a patched version of [**DiffDOM**](https://github.com/fiduswriter/diffDOM). -Its diffing algorithm is _mostly correct_, but it lacks a move operation, namely, it determine that when the text of a paragraph gets bolded, that the textNode within the P should be moved into a STRONG element, with that STRONG element placed within the P. +Its diffing algorithm is _mostly correct_, but it lacks a move operation, namely, it determines that when the text of a paragraph gets bolded, that the textNode within the P should be moved into a STRONG element, with that STRONG element placed within the P. As such, there are difficulties with applying styles to large portions of the document while someone is editing within that section. On the whole, however, contentEditable documents avoid many of the problems that a text editor faces with its rendering cycle. diff --git a/install-onlyoffice.sh b/install-onlyoffice.sh index 757be5437..511ed8865 100755 --- a/install-onlyoffice.sh +++ b/install-onlyoffice.sh @@ -27,17 +27,17 @@ main() { ask_for_license - # Check if 'oldest_needed_version' is already set, if not, set it to v8 + # Check if 'oldest_needed_version' is already set, if not, set it to v9 if [ -z "${PROPS['oldest_needed_version']+set}" ]; then - echo "'oldest_needed_version' is not set. Setting it to v8." - set_prop "oldest_needed_version" "v8" + echo "'oldest_needed_version' is not set. Setting it to v9." + set_prop "oldest_needed_version" "v9" else echo "'oldest_needed_version' is already set to ${PROPS['oldest_needed_version']}. No changes made." fi mkdir -p "$OO_DIR" - available_versions=(v1 v2b v4 v5 v6 v7 v8 x2t) + available_versions=(v1 v2b v4 v5 v6 v7 v8 v9 x2t) start_installing=false for version in "${available_versions[@]}"; do @@ -92,7 +92,13 @@ main() { # From all the older versions only v7 has 'dictionaries', we remove it for the same reasons rm -rf "$OO_DIR/v7/dictionaries/" ;; - v8) install_version v8 v8.3.3.23+5 de5056c12e1d91b054251b50a2326d5705ccd0c529b20b936ea1dc08d9d9458e99206de1fc52076af85df9352f1961c8ba9474c864f76bea59bce19b0595dd72 ;; + v8) install_version v8 v8.3.3.23+5 de5056c12e1d91b054251b50a2326d5705ccd0c529b20b936ea1dc08d9d9458e99206de1fc52076af85df9352f1961c8ba9474c864f76bea59bce19b0595dd72 + rm -rf "$OO_DIR/v8/web-apps/apps/documenteditor/main/resources/help" + rm -rf "$OO_DIR/v8/web-apps/apps/presentationeditor/main/resources/help" + rm -rf "$OO_DIR/v8/web-apps/apps/spreadsheeteditor/main/resources/help" + rm -rf "$OO_DIR/v8/web-apps/apps/common/main/resources/help/" + ;; + v9) install_version v9 v9.2.0.119+3 e18b76c2f2e3021840e716b59049752d98b30790926af187302533d9851fe5be0ff3be402751dd33664241409f4638824f5c7dbab63b37695099194765b0542a ;; x2t) install_x2t v7.3+1 ab0c05b0e4c81071acea83f0c6a8e75f5870c360ec4abc4af09105dd9b52264af9711ec0b7020e87095193ac9b6e20305e446f2321a541f743626a598e5318c1 ;; *) echo "Unknown version: $version" @@ -271,17 +277,27 @@ install_old_version() { } install_version() { - ensure_command_available curl - ensure_command_available sha512sum - ensure_command_available unzip - local DIR=$1 local VERSION=$2 local HASH=$3 local FULL_DIR=$OO_DIR/$DIR local LAST_DIR=$(pwd) - if [ ! -e "$FULL_DIR"/.version ] || [ "$(cat "$FULL_DIR"/.version)" != "$VERSION" ]; then + local ACTUAL_VERSION="not installed" + if [ -e "$FULL_DIR"/.version ]; then + ACTUAL_VERSION="$(cat "$FULL_DIR"/.version)" + fi + + if [ "$ACTUAL_VERSION" != "$VERSION" ]; then + if [ ${CHECK+x} ]; then + echo "Wrong version in $FULL_DIR. Expected: $VERSION. Found: $ACTUAL_VERSION" + exit 1 + fi + + ensure_command_available sha512sum + ensure_command_available curl + ensure_command_available unzip + rm -rf "$FULL_DIR" mkdir -p "$FULL_DIR" @@ -289,7 +305,7 @@ install_version() { curl "https://github.com/cryptpad/onlyoffice-editor/releases/download/$VERSION/onlyoffice-editor.zip" --location --output "onlyoffice-editor.zip" echo "$HASH onlyoffice-editor.zip" >onlyoffice-editor.zip.sha512 - if ! sha512sum --check onlyoffice-editor.zip.sha512; then + if ! sha512sum -c onlyoffice-editor.zip.sha512; then echo "onlyoffice-editor.zip does not match expected checksum" exit 1 fi @@ -332,7 +348,7 @@ install_x2t() { ensure_command_available unzip curl "https://github.com/cryptpad/onlyoffice-x2t-wasm/releases/download/$VERSION/x2t.zip" --location --output x2t.zip echo "$HASH x2t.zip" >x2t.zip.sha512 - if ! sha512sum --check x2t.zip.sha512; then + if ! sha512sum -c x2t.zip.sha512; then echo "x2t.zip does not match expected checksum" exit 1 fi diff --git a/lib/api.js b/lib/api.js index eec25ea35..416175f49 100644 --- a/lib/api.js +++ b/lib/api.js @@ -173,16 +173,16 @@ nThen(function (w) { let oldUsers = Env.maxConcurrentRegUsers || 0; let stats = Server.getSessionStats(); let chans = Server.getActiveChannelCount(); - let reg = 0; - let regKeys = []; - Object.keys(Env.netfluxUsers).forEach(id => { - let keys = Env.netfluxUsers[id]; - let key = Object.keys(keys || {})[0]; - if (!key) { return; } - if (regKeys.includes(key)) { return; } - reg++; - regKeys.push(key); - }); + + const map = Env.netfluxUsers; + // Extract public key from each ws connection + let regKeys = Object.keys(map).map(id => { + return Object.keys(map[id] || {})[0]; + }).filter(Boolean); + // Convert to set to get only unique values + let regSet = new Set(regKeys); + const reg = regSet.size; + Env.maxConcurrentWs = Math.max(oldWs, stats.total); Env.maxConcurrentUniqueWs = Math.max(oldUniqueWs, stats.unique); Env.maxConcurrentRegUsers = Math.max(oldUsers, reg); @@ -194,9 +194,10 @@ nThen(function (w) { try { let users = Env.netfluxUsers || {}; let online = Server.getOnlineUsers() || []; + let onlineSet = new Set(online); let removed = 0; Object.keys(users).forEach(id => { - if (!online.includes(id)) { + if (!onlineSet.has(id)) { delete users[id]; removed++; } @@ -209,15 +210,16 @@ nThen(function (w) { let HK = require('./hk-utils'); let chans = Env.channel_cache || {}; let active = Server.getActiveChannels() || []; + let activeSet = new Set(active); let removed = 0; Object.keys(chans).forEach(id => { - if (!active.includes(id)) { + if (!activeSet.has(id)) { HK.dropChannel(Env, id); removed++; } }); if (Env.store) { - Env.store.closeInactiveChannels(active); + Env.store.closeInactiveChannels(activeSet); } if (removed) { Env.Log.info("CLEANED_ACTIVE_CHANNELS_MAP", {removed}); diff --git a/lib/archive-account.js b/lib/archive-account.js index 44928f6be..222b2421f 100644 --- a/lib/archive-account.js +++ b/lib/archive-account.js @@ -14,6 +14,7 @@ const Meta = require("./metadata"); const Logger = require("./log"); const plugins = require("./plugin-manager"); const HK = require('./hk-util'); +const MFA = require("./storage/mfa"); let SSOUtils = plugins.SSO && plugins.SSO.utils; @@ -212,6 +213,7 @@ COMMANDS.start = (edPublic, blockId, reason) => { } Log.info('MODERATION_ACCOUNT_BLOCK', safeKey, waitFor()); })); + MFA.delete(Env, blockId, waitFor()); if (!SSOUtils) { return; } SSOUtils.deleteAccount(Env, blockId, waitFor((err) => { if (err) { diff --git a/lib/commands/pin-rpc.js b/lib/commands/pin-rpc.js index f537f27c2..78c360d9c 100644 --- a/lib/commands/pin-rpc.js +++ b/lib/commands/pin-rpc.js @@ -82,12 +82,7 @@ Pinning.getTotalSize = function (Env, safeKey, cb) { var batchKey = (limit && Array.isArray(limit.users)) ? limit.users.join('') : safeKey; Env.batchTotalSize(batchKey, cb, function (done) { - var channels = []; - - var addUnique = function (channel) { - if (channels.indexOf(channel) !== -1) { return; } - channels.push(channel); - }; + let channels = new Set(); nThen(function (waitFor) { // Get the channels list for our user account @@ -96,7 +91,10 @@ Pinning.getTotalSize = function (Env, safeKey, cb) { waitFor.abort(); return done('INVALID_PIN_LIST'); } - _channels.forEach(addUnique); + + for (let channel of _channels) { + channels.add(channel); + } })); // Get the channels list for users sharing our quota if (limit && Array.isArray(limit.users) && limit.users.length > 1) { @@ -104,12 +102,14 @@ Pinning.getTotalSize = function (Env, safeKey, cb) { if (key === unsafeKey) { return; } // Don't count ourselves twice getChannelList(Env, key, waitFor(function (_channels) { if (!_channels) { return; } // Broken user, don't count their quota - _channels.forEach(addUnique); + for (let channel of _channels) { + channels.add(channel); + } })); }); } }).nThen(function () { - Env.getTotalSize(channels, done); + Env.getTotalSize(Array.from(channels), done); }); }); }; diff --git a/lib/http-worker.js b/lib/http-worker.js index fb9bc2f24..b1768016f 100644 --- a/lib/http-worker.js +++ b/lib/http-worker.js @@ -444,6 +444,25 @@ app.use('/block/', function (req, res, next) { w.abort(); next(); } + }).nThen(function (w) { + // Block is protected with 2FA or SSO, make sure it still exists + const url = req.url; + if (typeof(url) !== "string") { return; } + const s = url.split('/'); + const id = s[2]; + if (!(s[1]?.length === 2 && BlockStore.isValidKey(id))) { return; } + BlockStore.isAvailable(Env, id, w((err, val) => { + if (err) { return; } + if (val !== false) { return; } + // Block doesn't exist, send the placeholder + w.abort(); + return BlockStore.readPlaceholder(Env, id, reason => { + res.status(404).json({ + reason, + code: 404 + }); + }); + })); }).nThen(function (w) { // We should only be able to reach this logic // if we successfully loaded and parsed some JSON diff --git a/lib/storage/file.js b/lib/storage/file.js index b6b42a1c1..76563d1e2 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -286,9 +286,9 @@ var closeChannel = function (env, channelName, cb) { } }; -var closeInactiveChannels = function (env, schedule, active) { +var closeInactiveChannels = function (env, schedule, activeSet) { Object.keys(env.channels).forEach(channelName => { - if (!active.includes(channelName)) { + if (!activeSet.has(channelName)) { schedule.ordered(channelName, function (next) { closeChannel(env, channelName, next); }); @@ -1473,8 +1473,8 @@ module.exports.create = function (conf, _cb) { closeChannel(env, channelName, Util.both(cb, next)); }); }, - closeInactiveChannels: function (active) { - closeInactiveChannels(env, schedule, active); + closeInactiveChannels: function (activeSet) { + closeInactiveChannels(env, schedule, activeSet); }, // write to a log file log: function (channelName, content, cb) { diff --git a/package-lock.json b/package-lock.json index e2d2c6117..16aa238b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "cryptpad", - "version": "2025.9.0", + "version": "2026.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cryptpad", - "version": "2025.9.0", + "version": "2026.2.0", "license": "AGPL-3.0+", "dependencies": { "@mcrowe/minibloom": "^0.2.0", "@node-saml/node-saml": "^5.1.0", "alertify.js": "1.0.11", - "body-parser": "^1.20.2", + "body-parser": "^1.20.4", "bootstrap": "^4.0.0", "bootstrap-tokenfield": "^0.12.0", "chainpad": "^5.2.6", @@ -26,8 +26,8 @@ "cookie-parser": "^1.4.7", "croppie": "^2.5.0", "dragula": "3.7.2", - "drawio": "github:cryptpad/drawio-npm#npm-21.8.2+5", - "express": "~4.21.2", + "drawio": "github:cryptpad/drawio-npm#npm-21.8.2+6", + "express": "~4.22.1", "file-saver": "1.3.1", "fs-extra": "^7.0.0", "get-folder-size": "^2.0.1", @@ -36,7 +36,7 @@ "hyper-json": "~1.4.0", "jquery": "3.6.0", "json.sortify": "github:cryptpad/JSON.sortify", - "jsonwebtoken": "^9.0.0", + "jsonwebtoken": "^9.0.3", "jszip": "3.10.1", "localforage": "^1.5.2", "marked": "^4.3.0", @@ -84,8 +84,6 @@ }, "node_modules/@babel/code-frame": { "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", - "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", "dev": true, "license": "MIT", "dependencies": { @@ -98,19 +96,66 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", - "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "version": "7.28.5", "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" } }, + "node_modules/@cacheable/memory": { + "version": "2.0.6", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.3.2", + "@keyv/bigmap": "^1.3.0", + "hookified": "^1.13.0", + "keyv": "^5.5.4" + } + }, + "node_modules/@cacheable/memory/node_modules/@keyv/bigmap": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.2.0", + "hookified": "^1.13.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.5.4" + } + }, + "node_modules/@cacheable/memory/node_modules/keyv": { + "version": "5.5.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.1" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.2.0", + "keyv": "^5.5.4" + } + }, + "node_modules/@cacheable/utils/node_modules/keyv": { + "version": "5.5.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.1" + } + }, "node_modules/@csstools/css-parser-algorithms": { "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz", - "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==", "dev": true, "funding": [ { @@ -123,7 +168,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" }, @@ -131,10 +175,26 @@ "@csstools/css-tokenizer": "^3.0.4" } }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.0.20", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=18" + } + }, "node_modules/@csstools/css-tokenizer": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz", - "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==", "dev": true, "funding": [ { @@ -147,15 +207,12 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" } }, "node_modules/@csstools/media-query-list-parser": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@csstools/media-query-list-parser/-/media-query-list-parser-4.0.3.tgz", - "integrity": "sha512-HAYH7d3TLRHDOUQK4mZKf9k9Ph/m8Akstg66ywKR4SFAigjs3yBiUeZtFxywiTm5moZMAp/5W/ZuFnNXXYLuuQ==", "dev": true, "funding": [ { @@ -178,8 +235,6 @@ }, "node_modules/@csstools/selector-specificity": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-5.0.0.tgz", - "integrity": "sha512-PCqQV3c4CoVm3kdPhyeZ07VmBRdH2EpMFA/pd9OASpOEC3aXNGoqPDAZ80D0cLpMBxnmk0+yNhGsEx31hq7Gtw==", "dev": true, "funding": [ { @@ -200,20 +255,16 @@ } }, "node_modules/@dual-bundle/import-meta-resolve": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@dual-bundle/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", - "integrity": "sha512-+nxncfwHM5SgAtrVzgpzJOI1ol0PkumhVo469KCf9lUi21IGcY90G98VuHm9VRrUypmAzawAHO9bs6hqeADaVg==", + "version": "4.2.1", "dev": true, "license": "MIT", "funding": { "type": "github", - "url": "https://github.com/sponsors/wooorm" + "url": "https://github.com/sponsors/JounQin" } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", - "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "version": "4.9.1", "dev": true, "license": "MIT", "dependencies": { @@ -231,8 +282,6 @@ }, "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "license": "Apache-2.0", "engines": { @@ -243,9 +292,7 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", - "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "version": "4.12.2", "dev": true, "license": "MIT", "engines": { @@ -253,13 +300,11 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.20.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.20.1.tgz", - "integrity": "sha512-OL0RJzC/CBzli0DrrR31qzj6d6i6Mm3HByuhflhl4LOBiWxN+3i6/t/ZQQNii4tjksXi8r2CRW1wMpWA2ULUEw==", + "version": "0.21.1", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^2.1.6", + "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", "minimatch": "^3.1.2" }, @@ -268,19 +313,18 @@ } }, "node_modules/@eslint/config-helpers": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.2.3.tgz", - "integrity": "sha512-u180qk2Um1le4yf0ruXH3PYFeEZeYC3p/4wCTKrr2U1CmGdzGi3KtY0nuPDH48UJxlKCC5RDzbcbh4X0XlqgHg==", + "version": "0.4.2", "dev": true, "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@eslint/core": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz", - "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "version": "0.17.0", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -291,9 +335,7 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", - "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", + "version": "3.3.3", "dev": true, "license": "MIT", "dependencies": { @@ -303,7 +345,7 @@ "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", + "js-yaml": "^4.1.1", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" }, @@ -315,9 +357,7 @@ } }, "node_modules/@eslint/js": { - "version": "9.29.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.29.0.tgz", - "integrity": "sha512-3PIF4cBw/y+1u2EazflInpV+lYsSG0aByVIQzAgb1m1MhHFSbqTyNqtBKHgWf/9Ykud+DhILS9EGkmekVhbKoQ==", + "version": "9.39.2", "dev": true, "license": "MIT", "engines": { @@ -328,9 +368,7 @@ } }, "node_modules/@eslint/object-schema": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", - "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "version": "2.1.7", "dev": true, "license": "Apache-2.0", "engines": { @@ -338,36 +376,19 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.5.tgz", - "integrity": "sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==", + "version": "0.4.1", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^0.15.2", + "@eslint/core": "^0.17.0", "levn": "^0.4.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.2.tgz", - "integrity": "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@humanfs/core": { "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -375,37 +396,19 @@ } }, "node_modules/@humanfs/node": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", - "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "version": "0.16.7", "dev": true, "license": "Apache-2.0", "dependencies": { "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.3.0" + "@humanwhocodes/retry": "^0.4.0" }, "engines": { "node": ">=18.18.0" } }, - "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -418,8 +421,6 @@ }, "node_modules/@humanwhocodes/retry": { "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", - "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", "dev": true, "license": "Apache-2.0", "engines": { @@ -431,34 +432,16 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", - "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "version": "0.3.13", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "license": "MIT", "engines": { @@ -466,9 +449,7 @@ } }, "node_modules/@jridgewell/source-map": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", - "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "version": "0.3.11", "dev": true, "license": "MIT", "dependencies": { @@ -477,16 +458,12 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "version": "1.5.5", "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "version": "0.3.31", "dev": true, "license": "MIT", "dependencies": { @@ -495,32 +472,21 @@ } }, "node_modules/@keyv/serialize": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.0.3.tgz", - "integrity": "sha512-qnEovoOp5Np2JDGonIDL6Ayihw0RhnRh6vxPuHo4RDn1UOzwEo4AeIfpL6UGIrsceWrCMiVPgwRjbHu4vYFc3g==", + "version": "1.1.1", "dev": true, - "license": "MIT", - "dependencies": { - "buffer": "^6.0.3" - } + "license": "MIT" }, "node_modules/@mcrowe/minibloom": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@mcrowe/minibloom/-/minibloom-0.2.0.tgz", - "integrity": "sha512-hce9MTbEkVIutibAkXAQddXCU9gMP/3OfcRaNo2V0v485iEzBRlniJG0ZTKumL8RbUA/fhpIGvrURiEZc+Crrg==", "license": "ISC" }, "node_modules/@mdn/browser-compat-data": { "version": "5.7.6", - "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-5.7.6.tgz", - "integrity": "sha512-7xdrMX0Wk7grrTZQwAoy1GkvPMFoizStUoL+VmtUkAxegbCCec+3FKwOM6yc/uGU5+BEczQHXAlWiqvM8JeENg==", "dev": true, "license": "CC0-1.0" }, "node_modules/@node-saml/node-saml": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@node-saml/node-saml/-/node-saml-5.1.0.tgz", - "integrity": "sha512-t3cJnZ4aC7HhPZ6MGylGZULvUtBOZ6FzuUndaHGXjmIZHXnLfC/7L8a57O9Q9V7AxJGKAiRM5zu2wNm9EsvQpw==", "license": "MIT", "dependencies": { "@types/debug": "^4.1.12", @@ -542,8 +508,6 @@ }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, "license": "MIT", "dependencies": { @@ -556,8 +520,6 @@ }, "node_modules/@nodelib/fs.stat": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, "license": "MIT", "engines": { @@ -566,8 +528,6 @@ }, "node_modules/@nodelib/fs.walk": { "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, "license": "MIT", "dependencies": { @@ -579,9 +539,7 @@ } }, "node_modules/@rollup/plugin-commonjs": { - "version": "28.0.6", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.6.tgz", - "integrity": "sha512-XSQB1K7FUU5QP+3lOQmVCE3I0FcbbNvmNT4VJSj93iUjayaARrTQeoRdiYQoftAJBLrR9t2agwAd3ekaTgHNlw==", + "version": "28.0.9", "dev": true, "license": "MIT", "dependencies": { @@ -607,8 +565,6 @@ }, "node_modules/@rollup/plugin-json": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz", - "integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==", "dev": true, "license": "MIT", "dependencies": { @@ -628,8 +584,6 @@ }, "node_modules/@rollup/plugin-node-resolve": { "version": "15.3.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz", - "integrity": "sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA==", "dev": true, "license": "MIT", "dependencies": { @@ -653,8 +607,6 @@ }, "node_modules/@rollup/plugin-terser": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", - "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", "dev": true, "license": "MIT", "dependencies": { @@ -675,9 +627,7 @@ } }, "node_modules/@rollup/plugin-typescript": { - "version": "12.1.3", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.3.tgz", - "integrity": "sha512-gAx0AYwkyjqOw4JrZV34N/abvAobLhczyLkZ7FVL2UXPrO4zv8oqTfYT3DLBRan1EXasp4SUuEJXqPTk0gnJzw==", + "version": "12.3.0", "dev": true, "license": "MIT", "dependencies": { @@ -702,9 +652,7 @@ } }, "node_modules/@rollup/pluginutils": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.2.0.tgz", - "integrity": "sha512-qWJ2ZTbmumwiLFomfzTyt5Kng4hwPi9rwCYN4SHb6eaRU1KNO4ccxINHr/VhH4GgPlt1XfSTLX2LBTme8ne4Zw==", + "version": "5.3.0", "dev": true, "license": "MIT", "dependencies": { @@ -725,9 +673,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.44.0.tgz", - "integrity": "sha512-xEiEE5oDW6tK4jXCAyliuntGR+amEMO7HLtdSshVuhFnKTYoeYMyXQK7pLouAJJj5KHdwdn87bfHAR2nSdNAUA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz", + "integrity": "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==", "cpu": [ "arm" ], @@ -739,9 +687,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.44.0.tgz", - "integrity": "sha512-uNSk/TgvMbskcHxXYHzqwiyBlJ/lGcv8DaUfcnNwict8ba9GTTNxfn3/FAoFZYgkaXXAdrAA+SLyKplyi349Jw==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.3.tgz", + "integrity": "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w==", "cpu": [ "arm64" ], @@ -753,9 +701,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.44.0.tgz", - "integrity": "sha512-VGF3wy0Eq1gcEIkSCr8Ke03CWT+Pm2yveKLaDvq51pPpZza3JX/ClxXOCmTYYq3us5MvEuNRTaeyFThCKRQhOA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz", + "integrity": "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==", "cpu": [ "arm64" ], @@ -767,9 +715,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.44.0.tgz", - "integrity": "sha512-fBkyrDhwquRvrTxSGH/qqt3/T0w5Rg0L7ZIDypvBPc1/gzjJle6acCpZ36blwuwcKD/u6oCE/sRWlUAcxLWQbQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz", + "integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==", "cpu": [ "x64" ], @@ -781,9 +729,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.44.0.tgz", - "integrity": "sha512-u5AZzdQJYJXByB8giQ+r4VyfZP+walV+xHWdaFx/1VxsOn6eWJhK2Vl2eElvDJFKQBo/hcYIBg/jaKS8ZmKeNQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.3.tgz", + "integrity": "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w==", "cpu": [ "arm64" ], @@ -795,9 +743,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.44.0.tgz", - "integrity": "sha512-qC0kS48c/s3EtdArkimctY7h3nHicQeEUdjJzYVJYR3ct3kWSafmn6jkNCA8InbUdge6PVx6keqjk5lVGJf99g==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.3.tgz", + "integrity": "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q==", "cpu": [ "x64" ], @@ -809,9 +757,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.44.0.tgz", - "integrity": "sha512-x+e/Z9H0RAWckn4V2OZZl6EmV0L2diuX3QB0uM1r6BvhUIv6xBPL5mrAX2E3e8N8rEHVPwFfz/ETUbV4oW9+lQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.3.tgz", + "integrity": "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==", "cpu": [ "arm" ], @@ -823,9 +771,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.44.0.tgz", - "integrity": "sha512-1exwiBFf4PU/8HvI8s80icyCcnAIB86MCBdst51fwFmH5dyeoWVPVgmQPcKrMtBQ0W5pAs7jBCWuRXgEpRzSCg==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.3.tgz", + "integrity": "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==", "cpu": [ "arm" ], @@ -837,9 +785,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.44.0.tgz", - "integrity": "sha512-ZTR2mxBHb4tK4wGf9b8SYg0Y6KQPjGpR4UWwTFdnmjB4qRtoATZ5dWn3KsDwGa5Z2ZBOE7K52L36J9LueKBdOQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz", + "integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==", "cpu": [ "arm64" ], @@ -851,9 +799,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.44.0.tgz", - "integrity": "sha512-GFWfAhVhWGd4r6UxmnKRTBwP1qmModHtd5gkraeW2G490BpFOZkFtem8yuX2NyafIP/mGpRJgTJ2PwohQkUY/Q==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.3.tgz", + "integrity": "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==", "cpu": [ "arm64" ], @@ -864,10 +812,10 @@ "linux" ] }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.44.0.tgz", - "integrity": "sha512-xw+FTGcov/ejdusVOqKgMGW3c4+AgqrfvzWEVXcNP6zq2ue+lsYUgJ+5Rtn/OTJf7e2CbgTFvzLW2j0YAtj0Gg==", + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.3.tgz", + "integrity": "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==", "cpu": [ "loong64" ], @@ -878,10 +826,10 @@ "linux" ] }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.44.0.tgz", - "integrity": "sha512-bKGibTr9IdF0zr21kMvkZT4K6NV+jjRnBoVMt2uNMG0BYWm3qOVmYnXKzx7UhwrviKnmK46IKMByMgvpdQlyJQ==", + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.3.tgz", + "integrity": "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==", "cpu": [ "ppc64" ], @@ -893,9 +841,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.44.0.tgz", - "integrity": "sha512-vV3cL48U5kDaKZtXrti12YRa7TyxgKAIDoYdqSIOMOFBXqFj2XbChHAtXquEn2+n78ciFgr4KIqEbydEGPxXgA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.3.tgz", + "integrity": "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==", "cpu": [ "riscv64" ], @@ -907,9 +855,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.44.0.tgz", - "integrity": "sha512-TDKO8KlHJuvTEdfw5YYFBjhFts2TR0VpZsnLLSYmB7AaohJhM8ctDSdDnUGq77hUh4m/djRafw+9zQpkOanE2Q==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.3.tgz", + "integrity": "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==", "cpu": [ "riscv64" ], @@ -921,9 +869,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.44.0.tgz", - "integrity": "sha512-8541GEyktXaw4lvnGp9m84KENcxInhAt6vPWJ9RodsB/iGjHoMB2Pp5MVBCiKIRxrxzJhGCxmNzdu+oDQ7kwRA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.3.tgz", + "integrity": "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==", "cpu": [ "s390x" ], @@ -935,9 +883,7 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.44.0.tgz", - "integrity": "sha512-iUVJc3c0o8l9Sa/qlDL2Z9UP92UZZW1+EmQ4xfjTc1akr0iUFZNfxrXJ/R1T90h/ILm9iXEY6+iPrmYB3pXKjw==", + "version": "4.53.3", "cpu": [ "x64" ], @@ -949,9 +895,7 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.44.0.tgz", - "integrity": "sha512-PQUobbhLTQT5yz/SPg116VJBgz+XOtXt8D1ck+sfJJhuEsMj2jSej5yTdp8CvWBSceu+WW+ibVL6dm0ptG5fcA==", + "version": "4.53.3", "cpu": [ "x64" ], @@ -962,10 +906,24 @@ "linux" ] }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.3.tgz", + "integrity": "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.44.0.tgz", - "integrity": "sha512-M0CpcHf8TWn+4oTxJfh7LQuTuaYeXGbk0eageVjQCKzYLsajWS/lFC94qlRqOlyC2KvRT90ZrfXULYmukeIy7w==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.3.tgz", + "integrity": "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw==", "cpu": [ "arm64" ], @@ -977,9 +935,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.44.0.tgz", - "integrity": "sha512-3XJ0NQtMAXTWFW8FqZKcw3gOQwBtVWP/u8TpHP3CRPXD7Pd6s8lLdH3sHWh8vqKCyyiI8xW5ltJScQmBU9j7WA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.3.tgz", + "integrity": "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA==", "cpu": [ "ia32" ], @@ -990,10 +948,24 @@ "win32" ] }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.3.tgz", + "integrity": "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.44.0.tgz", - "integrity": "sha512-Q2Mgwt+D8hd5FIPUuPDsvPR7Bguza6yTkJxspDGkZj7tBRn2y4KSWYuIXpftFSjBra76TbKerCV7rgFPQrn+wQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz", + "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==", "cpu": [ "x64" ], @@ -1006,8 +978,6 @@ }, "node_modules/@types/debug": { "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", "license": "MIT", "dependencies": { "@types/ms": "*" @@ -1015,15 +985,11 @@ }, "node_modules/@types/estree": { "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true, "license": "MIT" }, "node_modules/@types/http-proxy": { - "version": "1.17.16", - "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.16.tgz", - "integrity": "sha512-sdWoUajOB1cd0A8cRRQ1cfyWNbmFKLAqBB89Y8x5iYyG/mkJHc0YUH8pdWBy2omi9qtCpiIgGjuwO0dQST2l5w==", + "version": "1.17.17", "license": "MIT", "dependencies": { "@types/node": "*" @@ -1031,43 +997,31 @@ }, "node_modules/@types/json-schema": { "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true, "license": "MIT" }, "node_modules/@types/ms": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", - "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, "node_modules/@types/node": { - "version": "24.0.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.3.tgz", - "integrity": "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg==", + "version": "24.10.1", "license": "MIT", "dependencies": { - "undici-types": "~7.8.0" + "undici-types": "~7.16.0" } }, "node_modules/@types/qs": { "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", - "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", "license": "MIT" }, "node_modules/@types/resolve": { "version": "1.20.2", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", - "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", "dev": true, "license": "MIT" }, "node_modules/@types/xml-encryption": { "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@types/xml-encryption/-/xml-encryption-1.2.4.tgz", - "integrity": "sha512-I69K/WW1Dv7j6O3jh13z0X8sLWJRXbu5xnHDl9yHzUNDUBtUoBY058eb5s+x/WG6yZC1h8aKdI2EoyEPjyEh+Q==", "license": "MIT", "dependencies": { "@types/node": "*" @@ -1075,8 +1029,6 @@ }, "node_modules/@types/xml2js": { "version": "0.4.14", - "resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.14.tgz", - "integrity": "sha512-4YnrRemBShWRO2QjvUin8ESA41rH+9nQGLUGZV/1IDhi3SL9OhdpNC/MrulTWuptXKwhx/aDxE7toV0f/ypIXQ==", "license": "MIT", "dependencies": { "@types/node": "*" @@ -1084,17 +1036,13 @@ }, "node_modules/@xmldom/is-dom-node": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@xmldom/is-dom-node/-/is-dom-node-1.0.1.tgz", - "integrity": "sha512-CJDxIgE5I0FH+ttq/Fxy6nRpxP70+e2O048EPe85J2use3XKdatVM7dDVvFNjQudd9B49NPoZ+8PG49zj4Er8Q==", "license": "MIT", "engines": { "node": ">= 16" } }, "node_modules/@xmldom/xmldom": { - "version": "0.8.10", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", - "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "version": "0.8.11", "license": "MIT", "engines": { "node": ">=10.0.0" @@ -1102,8 +1050,6 @@ }, "node_modules/accepts": { "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "license": "MIT", "dependencies": { "mime-types": "~2.1.34", @@ -1115,8 +1061,6 @@ }, "node_modules/accepts/node_modules/mime-db": { "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -1124,8 +1068,6 @@ }, "node_modules/accepts/node_modules/mime-types": { "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "license": "MIT", "dependencies": { "mime-db": "1.52.0" @@ -1136,11 +1078,8 @@ }, "node_modules/acorn": { "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1150,8 +1089,6 @@ }, "node_modules/acorn-jsx": { "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "license": "MIT", "peerDependencies": { @@ -1160,8 +1097,6 @@ }, "node_modules/ajv": { "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", "dependencies": { @@ -1177,31 +1112,31 @@ }, "node_modules/alertify.js": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/alertify.js/-/alertify.js-1.0.11.tgz", - "integrity": "sha512-sNnALmmoiEO6cGI2nCCxSaHDFPUW6SkvDGuf4yW83Xog07LvDJtyvPtIBemOJ+EqqtxmPDreqzVvkqKAXkHLcA==", "license": "MIT" }, "node_modules/amd-resolve": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/amd-resolve/-/amd-resolve-0.1.1.tgz", - "integrity": "sha512-NyZL3M2Ebru5CAkH3NYxJmxPQnMiM++waHLUakbH2RCAkcop/1JlieF1HTw5oYqImKdYT3YXZCE2xb0GWKoDIg==", "engines": { "node": ">= 0.4.0" } }, "node_modules/amdetective": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/amdetective/-/amdetective-0.0.1.tgz", - "integrity": "sha512-z8+f9qhA7k3GTHUPbWOnOQyUaUBzgsI6EspAEQ0Iow/89pGCPPPnYjIe2JKH0ZMCJVkXqx8OT2d2js1ABuYCqg==", "license": "BSD", "dependencies": { "esprima": "~1.0.4" } }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/ansi-styles": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "license": "MIT", "dependencies": { @@ -1216,21 +1151,15 @@ }, "node_modules/argparse": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, "license": "Python-2.0" }, "node_modules/array-flatten": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", "license": "MIT" }, "node_modules/array-union": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, "license": "MIT", "engines": { @@ -1239,8 +1168,6 @@ }, "node_modules/ast-metadata-inferer": { "version": "0.8.1", - "resolved": "https://registry.npmjs.org/ast-metadata-inferer/-/ast-metadata-inferer-0.8.1.tgz", - "integrity": "sha512-ht3Dm6Zr7SXv6t1Ra6gFo0+kLDglHGrEbYihTkcycrbHw7WCcuhBzPlJYHEsIpycaUwzsJHje+vUcxXUX4ztTA==", "dev": true, "license": "MIT", "dependencies": { @@ -1249,8 +1176,6 @@ }, "node_modules/astral-regex": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, "license": "MIT", "engines": { @@ -1259,64 +1184,45 @@ }, "node_modules/atoa": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/atoa/-/atoa-1.0.0.tgz", - "integrity": "sha512-VVE1H6cc4ai+ZXo/CRWoJiHXrA1qfA31DPnx6D20+kSI547hQN5Greh51LQ1baMRMfxO5K5M4ImMtZbZt2DODQ==", "license": "MIT" }, "node_modules/balanced-match": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "license": "MIT" }, "node_modules/base64-arraybuffer": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", - "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", "license": "MIT", "engines": { "node": ">= 0.6.0" } }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "node_modules/baseline-browser-mapping": { + "version": "2.9.19", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz", + "integrity": "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } }, "node_modules/body-parser": { - "version": "1.20.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", - "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "version": "1.20.4", "license": "MIT", "dependencies": { - "bytes": "3.1.2", + "bytes": "~3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.13.0", - "raw-body": "2.5.2", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.14.0", + "raw-body": "~2.5.3", "type-is": "~1.6.18", - "unpipe": "1.0.0" + "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8", @@ -1325,23 +1231,42 @@ }, "node_modules/body-parser/node_modules/debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "license": "MIT", "dependencies": { "ms": "2.0.0" } }, + "node_modules/body-parser/node_modules/http-errors": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/body-parser/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, + "node_modules/body-parser/node_modules/statuses": { + "version": "2.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/bootstrap": { "version": "4.6.2", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz", - "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==", "funding": [ { "type": "github", @@ -1360,16 +1285,12 @@ }, "node_modules/bootstrap-tokenfield": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/bootstrap-tokenfield/-/bootstrap-tokenfield-0.12.0.tgz", - "integrity": "sha512-OgLQEQ1V3s69wgvjpWvPESNTv1RUZKtwpRQd3o5AQYdan47iUAL7ajSMjXMlSxWywrLTntF1l84aE7N1DvUlVw==", "dependencies": { "jquery": "^2.1.0" } }, "node_modules/brace-expansion": { "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -1378,8 +1299,6 @@ }, "node_modules/braces": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "license": "MIT", "dependencies": { "fill-range": "^7.1.1" @@ -1390,8 +1309,6 @@ }, "node_modules/browser-resolve": { "version": "1.2.4", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.2.4.tgz", - "integrity": "sha512-z8CRZZEv/MVAuJ9u9/LwzAcGswFtWbdAHh8f8ZkHgThUb88rBZbpwoxYZaQnmbAxvCoOA1gFIONrspStOhldkg==", "license": "MIT", "dependencies": { "resolve": "0.6.3" @@ -1399,14 +1316,10 @@ }, "node_modules/browser-resolve/node_modules/resolve": { "version": "0.6.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-0.6.3.tgz", - "integrity": "sha512-UHBY3viPlJKf85YijDUcikKX6tmF4SokIDp518ZDVT92JNDcG5uKIthaT/owt3Sar0lwtOafsQuwrg22/v2Dwg==", "license": "MIT" }, "node_modules/browserslist": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.0.tgz", - "integrity": "sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA==", + "version": "4.28.0", "dev": true, "funding": [ { @@ -1423,12 +1336,12 @@ } ], "license": "MIT", - "peer": true, "dependencies": { - "caniuse-lite": "^1.0.30001718", - "electron-to-chromium": "^1.5.160", - "node-releases": "^2.0.19", - "update-browserslist-db": "^1.1.3" + "baseline-browser-mapping": "^2.8.25", + "caniuse-lite": "^1.0.30001754", + "electron-to-chromium": "^1.5.249", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.1.4" }, "bin": { "browserslist": "cli.js" @@ -1437,78 +1350,44 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/buffer-equal-constant-time": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", "license": "BSD-3-Clause" }, "node_modules/buffer-from": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true, "license": "MIT" }, "node_modules/bytes": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/cacheable": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-1.10.0.tgz", - "integrity": "sha512-SSgQTAnhd7WlJXnGlIi4jJJOiHzgnM5wRMEPaXAU4kECTAMpBoYKoZ9i5zHmclIEZbxcu3j7yY/CF8DTmwIsHg==", + "version": "2.3.0", "dev": true, "license": "MIT", "dependencies": { - "hookified": "^1.8.2", - "keyv": "^5.3.3" + "@cacheable/memory": "^2.0.6", + "@cacheable/utils": "^2.3.2", + "hookified": "^1.13.0", + "keyv": "^5.5.4", + "qified": "^0.5.2" } }, "node_modules/cacheable/node_modules/keyv": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.3.4.tgz", - "integrity": "sha512-ypEvQvInNpUe+u+w8BIcPkQvEqXquyyibWE/1NB5T2BTzIpS5cGEV1LZskDzPSTvNAaT4+5FutvzlvnkxOSKlw==", + "version": "5.5.4", "dev": true, "license": "MIT", "dependencies": { - "@keyv/serialize": "^1.0.3" + "@keyv/serialize": "^1.1.1" } }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0", @@ -1520,8 +1399,6 @@ }, "node_modules/call-bound": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", @@ -1536,8 +1413,6 @@ }, "node_modules/callsites": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, "license": "MIT", "engines": { @@ -1545,9 +1420,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001724", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001724.tgz", - "integrity": "sha512-WqJo7p0TbHDOythNTqYujmaJTvtYRZrjpP8TCvH6Vb9CYJerJNKamKzIWOM4BkQatWj9H2lYulpdAQNBe7QhNA==", + "version": "1.0.30001766", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001766.tgz", + "integrity": "sha512-4C0lfJ0/YPjJQHagaE9x2Elb69CIqEPZeG0anQt9SIvIoOH4a4uaRl73IavyO+0qZh6MDLH//DrXThEYKHkmYA==", "dev": true, "funding": [ { @@ -1567,8 +1442,6 @@ }, "node_modules/chainpad": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chainpad/-/chainpad-5.3.0.tgz", - "integrity": "sha512-S8ctJfd3XqRW6t7GsNcN6ldXmXfIlbFLqA6mukSPhXWo0DueiOF1bT3lAHIvJEwkI9ax5adJmpA50GfW95YKBA==", "license": "LGPL-2.1", "dependencies": { "fast-diff": "^1.1.2", @@ -1580,8 +1453,6 @@ }, "node_modules/chainpad-crypto": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/chainpad-crypto/-/chainpad-crypto-0.3.0.tgz", - "integrity": "sha512-L6gUiE8m/ZrUE3eVMju6qzG92Mis3M4T1xCuxVF3eqwa9+46fl9OFwt/TiSmi+oVHSIBmgDTcnOEF/JSxnxYxw==", "license": "AGPL-3.0+", "dependencies": { "tweetnacl": "^1.0.3", @@ -1590,8 +1461,6 @@ }, "node_modules/chainpad-listmap": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/chainpad-listmap/-/chainpad-listmap-1.2.0.tgz", - "integrity": "sha512-PI7iwk/yKzEb1iaVmLKvMJYXjCjvIgUWzI07LeDGVvZPScnYbEzMso9YMQyxzjqrp8cyQxsL7sA8c/hZAz01cw==", "license": "AGPL-3.0+", "dependencies": { "chainpad-netflux": "^1.3.0", @@ -1600,17 +1469,13 @@ }, "node_modules/chainpad-listmap/node_modules/json.sortify": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/json.sortify/-/json.sortify-2.1.0.tgz", - "integrity": "sha512-otSldRQcu9PaQJJDeB1qGZUIoL7C4nxZunUVHieWPUMJvvVxIUhsMQUhR+r4OUZBwA1McnbS7sqDf5dYHzJsbw==", "license": "Apache-2.0", "engines": { "node": ">=0.10.0" } }, "node_modules/chainpad-netflux": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/chainpad-netflux/-/chainpad-netflux-1.3.0.tgz", - "integrity": "sha512-oc47vLt78a/Fp7acQJvLNuX1JRrH9oOWAbzo+yOO1asCWDuI4oesPY81wHzVySKpo58GGfNpZN7CSTI8EZjYrQ==", + "version": "1.3.1", "license": "LGPL-2.1", "dependencies": { "netflux-websocket": "^1.2.0", @@ -1619,14 +1484,10 @@ } }, "node_modules/chainpad-server": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/chainpad-server/-/chainpad-server-5.2.4.tgz", - "integrity": "sha512-f4eErhcmIE67vfN9Dkfh0hX/IZDWERmfjdcfPEesXIHKu441jA84H0autvTAFsMTSPimlil7eeGnx4GLBVrR5Q==" + "version": "5.2.4" }, "node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "license": "MIT", "dependencies": { @@ -1643,20 +1504,14 @@ "node_modules/ckeditor": { "name": "ckeditor4", "version": "4.22.1", - "resolved": "https://registry.npmjs.org/ckeditor4/-/ckeditor4-4.22.1.tgz", - "integrity": "sha512-Yj4vTHX5YxHwc48gNqUqTm+KLkRr9tuyb4O2VIABu4oKHWRNVIdLdy6vUNe/XNx+RiTavMejfA1MVOU/MxLjqQ==", "license": "(GPL-2.0 OR LGPL-2.1 OR MPL-1.1)" }, "node_modules/codemirror": { - "version": "5.65.19", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.65.19.tgz", - "integrity": "sha512-+aFkvqhaAVr1gferNMuN8vkTSrWIFvzlMV9I2KBLCWS2WpZ2+UAkZjlMZmEuT+gcXTi6RrGQCkWq1/bDtGqhIA==", + "version": "5.65.20", "license": "MIT" }, "node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1668,42 +1523,30 @@ }, "node_modules/color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true, "license": "MIT" }, "node_modules/colord": { "version": "2.9.3", - "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", - "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", "dev": true, "license": "MIT" }, "node_modules/commander": { "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true, "license": "MIT" }, "node_modules/commondir": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true, "license": "MIT" }, "node_modules/concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "license": "MIT" }, "node_modules/connect-gzip-static": { "version": "4.2.2", - "resolved": "https://registry.npmjs.org/connect-gzip-static/-/connect-gzip-static-4.2.2.tgz", - "integrity": "sha512-9mfCKkVhSC+GHY/nWTkeSGxqDHvMYW06VSeKD9zsrpoE8QXgPtRRvhGbk1gSNmY0d+jZEgm5FXew/dxmb2OByQ==", "license": "MIT", "dependencies": { "debug": "~2||~3||~4", @@ -1718,8 +1561,6 @@ }, "node_modules/content-disposition": { "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "license": "MIT", "dependencies": { "safe-buffer": "5.2.1" @@ -1730,8 +1571,6 @@ }, "node_modules/content-type": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -1739,8 +1578,6 @@ }, "node_modules/contra": { "version": "1.9.4", - "resolved": "https://registry.npmjs.org/contra/-/contra-1.9.4.tgz", - "integrity": "sha512-N9ArHAqwR/lhPq4OdIAwH4e1btn6EIZMAz4TazjnzCiVECcWUPTma+dRAM38ERImEJBh8NiCCpjoQruSZ+agYg==", "license": "MIT", "dependencies": { "atoa": "1.0.0", @@ -1749,8 +1586,6 @@ }, "node_modules/cookie": { "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -1758,8 +1593,6 @@ }, "node_modules/cookie-parser": { "version": "1.4.7", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz", - "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==", "license": "MIT", "dependencies": { "cookie": "0.7.2", @@ -1771,20 +1604,14 @@ }, "node_modules/cookie-signature": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", "license": "MIT" }, "node_modules/core-util-is": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "license": "MIT" }, "node_modules/cosmiconfig": { "version": "9.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", - "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "dev": true, "license": "MIT", "dependencies": { @@ -1810,14 +1637,10 @@ }, "node_modules/croppie": { "version": "2.6.5", - "resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz", - "integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ==", "license": "MIT" }, "node_modules/cross-spawn": { "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", "dependencies": { @@ -1831,8 +1654,6 @@ }, "node_modules/crossvent": { "version": "1.5.4", - "resolved": "https://registry.npmjs.org/crossvent/-/crossvent-1.5.4.tgz", - "integrity": "sha512-b6gEmNAh3kemyfNJ0LQzA/29A+YeGwevlSkNp2x0TzLOMYc0b85qRAD06OUuLWLQpR7HdJHNZQTlD1cfwoTrzg==", "license": "MIT", "dependencies": { "custom-event": "1.0.0" @@ -1840,8 +1661,6 @@ }, "node_modules/css-functions-list": { "version": "3.2.3", - "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.2.3.tgz", - "integrity": "sha512-IQOkD3hbR5KrN93MtcYuad6YPuTSUhntLHDuLEbFWE+ff2/XSZNdZG+LcbbIW5AXKg/WFIfYItIzVoHngHXZzA==", "dev": true, "license": "MIT", "engines": { @@ -1850,8 +1669,6 @@ }, "node_modules/css-line-break": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", - "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", "license": "MIT", "dependencies": { "utrie": "^1.0.2" @@ -1859,8 +1676,6 @@ }, "node_modules/css-tree": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.1.0.tgz", - "integrity": "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==", "dev": true, "license": "MIT", "dependencies": { @@ -1873,8 +1688,6 @@ }, "node_modules/cssesc": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true, "license": "MIT", "bin": { @@ -1886,14 +1699,10 @@ }, "node_modules/custom-event": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.0.tgz", - "integrity": "sha512-6nOXX3UitrmdvSJWoVR2dlzhbX5bEUqmqsMUyx1ypCLZkHHkcuYtdpW3p94RGvcFkTV7DkLo+Ilbwnlwi8L+jw==", "license": "MIT" }, "node_modules/debug": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", - "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "version": "4.4.3", "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -1909,9 +1718,6 @@ }, "node_modules/debuglog": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-0.0.2.tgz", - "integrity": "sha512-R6Bl6JxzWVrquXohdoHkyGMgaL8esUXhSzB6WUfSX1N+1dFg30Yo9gshTu7ExV6ntKN4VoJFw8zVdPsVVYGmKg==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", "license": "MIT", "optional": true, "engines": { @@ -1920,15 +1726,11 @@ }, "node_modules/deep-is": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true, "license": "MIT" }, "node_modules/deepmerge": { "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true, "license": "MIT", "engines": { @@ -1937,8 +1739,6 @@ }, "node_modules/defined": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", - "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1946,8 +1746,6 @@ }, "node_modules/depd": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -1955,8 +1753,6 @@ }, "node_modules/destroy": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "license": "MIT", "engines": { "node": ">= 0.8", @@ -1965,8 +1761,6 @@ }, "node_modules/detective": { "version": "4.3.2", - "resolved": "https://registry.npmjs.org/detective/-/detective-4.3.2.tgz", - "integrity": "sha512-a1rssac1j40ueg2uKcyxfK21OwCQW5sOIXF2Ceela1u2IIjOOF2FhN+mTrQ1arYQTSk3DQHkh/w68aikgpLV9w==", "license": "MIT", "dependencies": { "acorn": "^3.1.0", @@ -1975,8 +1769,6 @@ }, "node_modules/detective/node_modules/acorn": { "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha512-OLUyIIZ7mF5oaAUT1w0TFqQS81q3saT46x8t7ukpPjMNk+nbs4ZHhs7ToV8EWnLYLepjETXd4XaCE4uxkMeqUw==", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -1987,8 +1779,6 @@ }, "node_modules/dir-glob": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, "license": "MIT", "dependencies": { @@ -2000,8 +1790,6 @@ }, "node_modules/dragula": { "version": "3.7.2", - "resolved": "https://registry.npmjs.org/dragula/-/dragula-3.7.2.tgz", - "integrity": "sha512-iDPdNTPZY7P/l0CQ800QiX+PNA2XF9iC3ePLWfGxeb/j8iPPedRuQdfSOfZrazgSpmaShYvYQ/jx7keWb4YNzA==", "license": "MIT", "dependencies": { "contra": "1.9.4", @@ -2009,13 +1797,11 @@ } }, "node_modules/drawio": { - "version": "21.8.2+5", - "resolved": "git+ssh://git@github.com/cryptpad/drawio-npm.git#62293580fc6211bc5576ed1cbcfa125d5deba70e" + "version": "21.8.2+6", + "resolved": "git+ssh://git@github.com/cryptpad/drawio-npm.git#61699f777690d23aab727461ff58b60e198ab0e4" }, "node_modules/dunder-proto": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.1", @@ -2028,8 +1814,6 @@ }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", "license": "Apache-2.0", "dependencies": { "safe-buffer": "^5.0.1" @@ -2037,28 +1821,20 @@ }, "node_modules/ee-first": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.171", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.171.tgz", - "integrity": "sha512-scWpzXEJEMrGJa4Y6m/tVotb0WuvNmasv3wWVzUAeCgKU0ToFOhUW6Z+xWnRQANMYGxN4ngJXIThgBJOqzVPCQ==", + "version": "1.5.262", "dev": true, "license": "ISC" }, "node_modules/emoji-regex": { "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true, "license": "MIT" }, "node_modules/encodeurl": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -2066,8 +1842,6 @@ }, "node_modules/env-paths": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", - "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", "dev": true, "license": "MIT", "engines": { @@ -2075,9 +1849,7 @@ } }, "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "version": "1.3.4", "dev": true, "license": "MIT", "dependencies": { @@ -2086,8 +1858,6 @@ }, "node_modules/es-define-property": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -2095,8 +1865,6 @@ }, "node_modules/es-errors": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -2104,8 +1872,6 @@ }, "node_modules/es-object-atoms": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0" @@ -2116,8 +1882,6 @@ }, "node_modules/escalade": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "license": "MIT", "engines": { @@ -2126,14 +1890,10 @@ }, "node_modules/escape-html": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "license": "MIT" }, "node_modules/escape-string-regexp": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "license": "MIT", "engines": { @@ -2144,26 +1904,22 @@ } }, "node_modules/eslint": { - "version": "9.29.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.29.0.tgz", - "integrity": "sha512-GsGizj2Y1rCWDu6XoEekL3RLilp0voSePurjZIkxL3wlm5o5EC9VpgaP7lrCvjnkuLvzFBQWB3vWB3K5KQTveQ==", + "version": "9.39.2", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.20.1", - "@eslint/config-helpers": "^0.2.1", - "@eslint/core": "^0.14.0", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.29.0", - "@eslint/plugin-kit": "^0.3.1", + "@eslint/js": "9.39.2", + "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", @@ -2207,8 +1963,6 @@ }, "node_modules/eslint-plugin-compat": { "version": "6.0.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-compat/-/eslint-plugin-compat-6.0.2.tgz", - "integrity": "sha512-1ME+YfJjmOz1blH0nPZpHgjMGK4kjgEeoYqGCqoBPQ/mGu/dJzdoP0f1C8H2jcWZjzhZjAMccbM/VdXhPORIfA==", "dev": true, "license": "MIT", "dependencies": { @@ -2230,8 +1984,6 @@ }, "node_modules/eslint-plugin-compat/node_modules/globals": { "version": "15.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", - "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", "dev": true, "license": "MIT", "engines": { @@ -2243,8 +1995,6 @@ }, "node_modules/eslint-scope": { "version": "8.4.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", - "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -2260,8 +2010,6 @@ }, "node_modules/eslint-visitor-keys": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", - "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, "license": "Apache-2.0", "engines": { @@ -2273,8 +2021,6 @@ }, "node_modules/espree": { "version": "10.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", - "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -2291,8 +2037,6 @@ }, "node_modules/esprima": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha512-rp5dMKN8zEs9dfi9g0X1ClLmV//WRyk/R15mppFNICIFRG5P92VP7Z04p8pk++gABo9W2tY+kHyu6P1mEHgmTA==", "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -2303,8 +2047,6 @@ }, "node_modules/esquery": { "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -2316,8 +2058,6 @@ }, "node_modules/esrecurse": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -2329,8 +2069,6 @@ }, "node_modules/estraverse": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "license": "BSD-2-Clause", "engines": { @@ -2339,15 +2077,11 @@ }, "node_modules/estree-walker": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "dev": true, "license": "MIT" }, "node_modules/esutils": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, "license": "BSD-2-Clause", "engines": { @@ -2356,8 +2090,6 @@ }, "node_modules/etag": { "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -2365,44 +2097,40 @@ }, "node_modules/eventemitter3": { "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "license": "MIT" }, "node_modules/express": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", - "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "version": "4.22.1", "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.3", - "content-disposition": "0.5.4", + "body-parser": "~1.20.3", + "content-disposition": "~0.5.4", "content-type": "~1.0.4", - "cookie": "0.7.1", - "cookie-signature": "1.0.6", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", "debug": "2.6.9", "depd": "2.0.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.3.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", "merge-descriptors": "1.0.3", "methods": "~1.1.2", - "on-finished": "2.4.1", + "on-finished": "~2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.12", + "path-to-regexp": "~0.1.12", "proxy-addr": "~2.0.7", - "qs": "6.13.0", + "qs": "~6.14.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.19.0", - "serve-static": "1.16.2", + "send": "~0.19.0", + "serve-static": "~1.16.2", "setprototypeof": "1.2.0", - "statuses": "2.0.1", + "statuses": "~2.0.1", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" @@ -2415,19 +2143,8 @@ "url": "https://opencollective.com/express" } }, - "node_modules/express/node_modules/cookie": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", - "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/express/node_modules/debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "license": "MIT", "dependencies": { "ms": "2.0.0" @@ -2435,14 +2152,10 @@ }, "node_modules/express/node_modules/debug/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, "node_modules/express/node_modules/send": { "version": "0.19.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", - "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "license": "MIT", "dependencies": { "debug": "2.6.9", @@ -2465,8 +2178,6 @@ }, "node_modules/express/node_modules/send/node_modules/encodeurl": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -2474,8 +2185,6 @@ }, "node_modules/express/node_modules/serve-static": { "version": "1.16.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", - "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "license": "MIT", "dependencies": { "encodeurl": "~2.0.0", @@ -2489,21 +2198,15 @@ }, "node_modules/fast-deep-equal": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true, "license": "MIT" }, "node_modules/fast-diff": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", - "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", "license": "Apache-2.0" }, "node_modules/fast-glob": { "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", "dev": true, "license": "MIT", "dependencies": { @@ -2519,8 +2222,6 @@ }, "node_modules/fast-glob/node_modules/glob-parent": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "license": "ISC", "dependencies": { @@ -2532,22 +2233,16 @@ }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true, "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true, "license": "MIT" }, "node_modules/fast-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", - "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", + "version": "3.1.0", "dev": true, "funding": [ { @@ -2563,8 +2258,6 @@ }, "node_modules/fastest-levenshtein": { "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", "dev": true, "license": "MIT", "engines": { @@ -2573,8 +2266,6 @@ }, "node_modules/fastq": { "version": "1.19.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", - "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", "dev": true, "license": "ISC", "dependencies": { @@ -2582,11 +2273,12 @@ } }, "node_modules/fdir": { - "version": "6.4.6", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", - "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "version": "6.5.0", "dev": true, "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, "peerDependencies": { "picomatch": "^3 || ^4" }, @@ -2598,8 +2290,6 @@ }, "node_modules/file-entry-cache": { "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2611,14 +2301,10 @@ }, "node_modules/file-saver": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-1.3.1.tgz", - "integrity": "sha512-RRTE4zhfibKpfVS233QDawwPhQIaEyxm6Zp6AcLoAy/qIx8MlEgNyQuGoTryZb+toizwSMeB/GhIzw/eWXTePw==", "license": "MIT" }, "node_modules/fill-range": { "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" @@ -2629,8 +2315,6 @@ }, "node_modules/finalhandler": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", - "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "license": "MIT", "dependencies": { "debug": "2.6.9", @@ -2647,8 +2331,6 @@ }, "node_modules/finalhandler/node_modules/debug": { "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "license": "MIT", "dependencies": { "ms": "2.0.0" @@ -2656,14 +2338,10 @@ }, "node_modules/finalhandler/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, "node_modules/find-up": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "license": "MIT", "dependencies": { @@ -2679,8 +2357,6 @@ }, "node_modules/flat-cache": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "license": "MIT", "dependencies": { @@ -2693,15 +2369,11 @@ }, "node_modules/flatted": { "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true, "license": "ISC" }, "node_modules/follow-redirects": { - "version": "1.15.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", - "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "version": "1.15.11", "funding": [ { "type": "individual", @@ -2720,8 +2392,6 @@ }, "node_modules/forwarded": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -2729,8 +2399,6 @@ }, "node_modules/fresh": { "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -2738,8 +2406,6 @@ }, "node_modules/fs-extra": { "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "license": "MIT", "dependencies": { "graceful-fs": "^4.1.2", @@ -2767,8 +2433,6 @@ }, "node_modules/function-bind": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2776,15 +2440,10 @@ }, "node_modules/gar": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/gar/-/gar-1.0.4.tgz", - "integrity": "sha512-w4n9cPWyP7aHxKxYHFQMegj7WIAsL/YX/C4Bs5Rr8s1H9M1rNtRWRsw+ovYMkXDQ5S4ZbYHsHAPmevPjPgw44w==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", "license": "MIT" }, "node_modules/get-folder-size": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/get-folder-size/-/get-folder-size-2.0.1.tgz", - "integrity": "sha512-+CEb+GDCM7tkOS2wdMKTn9vU7DgnKUTuDlehkNJKNSovdCOVxs14OfKCk4cvSaR3za4gj+OBdl9opPN9xrJ0zA==", "license": "MIT", "dependencies": { "gar": "^1.0.4", @@ -2796,8 +2455,6 @@ }, "node_modules/get-intrinsic": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", @@ -2820,8 +2477,6 @@ }, "node_modules/get-proto": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", "license": "MIT", "dependencies": { "dunder-proto": "^1.0.1", @@ -2833,8 +2488,6 @@ }, "node_modules/glob-parent": { "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "license": "ISC", "dependencies": { @@ -2846,8 +2499,6 @@ }, "node_modules/global-modules": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", - "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", "dev": true, "license": "MIT", "dependencies": { @@ -2859,8 +2510,6 @@ }, "node_modules/global-prefix": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", - "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", "dev": true, "license": "MIT", "dependencies": { @@ -2872,20 +2521,8 @@ "node": ">=6" } }, - "node_modules/global-prefix/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/global-prefix/node_modules/which": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "license": "ISC", "dependencies": { @@ -2897,8 +2534,6 @@ }, "node_modules/globals": { "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, "license": "MIT", "engines": { @@ -2910,8 +2545,6 @@ }, "node_modules/globby": { "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "license": "MIT", "dependencies": { @@ -2931,15 +2564,11 @@ }, "node_modules/globjoin": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz", - "integrity": "sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==", "dev": true, "license": "MIT" }, "node_modules/gluejs": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/gluejs/-/gluejs-2.4.0.tgz", - "integrity": "sha512-ONu5oMBNppp7ybu5PvrnCDh7nv6B6YHKiCrvU9KHFv/ML94Kw18kLilc1z+VucPUeprqrHKMBwNq0nnxWbn1qg==", "license": "BSD-3-Clause", "dependencies": { "amd-resolve": "~0.1.1", @@ -2961,20 +2590,14 @@ }, "node_modules/gluejs/node_modules/bytes": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-2.2.0.tgz", - "integrity": "sha512-zGRpnr2l5w/s8PxkrquUJoVeR06KvqPelrYqiSyQV7QEBqCYivpb6UzXYWC6JDBVtNFOT0rzJRFhkfJgxzmILA==", "license": "MIT" }, "node_modules/gluejs/node_modules/resolve": { "version": "0.6.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-0.6.3.tgz", - "integrity": "sha512-UHBY3viPlJKf85YijDUcikKX6tmF4SokIDp518ZDVT92JNDcG5uKIthaT/owt3Sar0lwtOafsQuwrg22/v2Dwg==", "license": "MIT" }, "node_modules/gopd": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -2985,14 +2608,10 @@ }, "node_modules/graceful-fs": { "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, "node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, "license": "MIT", "engines": { @@ -3001,8 +2620,6 @@ }, "node_modules/has-symbols": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -3011,10 +2628,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hashery": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.13.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/hasown": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -3024,16 +2650,12 @@ } }, "node_modules/hookified": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.9.1.tgz", - "integrity": "sha512-u3pxtGhKjcSXnGm1CX6aXS9xew535j3lkOCegbA6jdyh0BaAjTbXI4aslKstCr6zUNtoCxFGFKwjbSHdGrMB8g==", + "version": "1.13.0", "dev": true, "license": "MIT" }, "node_modules/html-tags": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.3.1.tgz", - "integrity": "sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ==", "dev": true, "license": "MIT", "engines": { @@ -3045,8 +2667,6 @@ }, "node_modules/html2canvas": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", - "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", "license": "MIT", "dependencies": { "css-line-break": "^2.1.0", @@ -3058,8 +2678,6 @@ }, "node_modules/http-errors": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "license": "MIT", "dependencies": { "depd": "2.0.0", @@ -3074,8 +2692,6 @@ }, "node_modules/http-proxy": { "version": "1.18.1", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", - "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "license": "MIT", "dependencies": { "eventemitter3": "^4.0.0", @@ -3088,8 +2704,6 @@ }, "node_modules/http-proxy-middleware": { "version": "3.0.5", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-3.0.5.tgz", - "integrity": "sha512-GLZZm1X38BPY4lkXA01jhwxvDoOkkXqjgVyUzVxiEK4iuRu03PZoYHhHRwxnfhQMDuaxi3vVri0YgSro/1oWqg==", "license": "MIT", "dependencies": { "@types/http-proxy": "^1.17.15", @@ -3105,14 +2719,10 @@ }, "node_modules/hyper-json": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/hyper-json/-/hyper-json-1.4.0.tgz", - "integrity": "sha512-QQq/hSN8X7m+rirYZmJ3RxCanXEdKyC7iGXEnJcg3jJ6/qorDDywBJoP6tt9+LEfJvNHaXwoE2wjDAZtJVeLew==", "license": "AGPL" }, "node_modules/iconv-lite": { "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" @@ -3121,31 +2731,8 @@ "node": ">=0.10.0" } }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, "node_modules/ignore": { "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, "license": "MIT", "engines": { @@ -3154,14 +2741,10 @@ }, "node_modules/immediate": { "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", "license": "MIT" }, "node_modules/import-fresh": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3177,8 +2760,6 @@ }, "node_modules/imurmurhash": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, "license": "MIT", "engines": { @@ -3187,21 +2768,15 @@ }, "node_modules/inherits": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, "node_modules/ini": { "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true, "license": "ISC" }, "node_modules/ipaddr.js": { "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", "license": "MIT", "engines": { "node": ">= 0.10" @@ -3209,15 +2784,11 @@ }, "node_modules/is-arrayish": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true, "license": "MIT" }, "node_modules/is-core-module": { "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "dev": true, "license": "MIT", "dependencies": { @@ -3232,17 +2803,21 @@ }, "node_modules/is-extglob": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-glob": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" @@ -3253,15 +2828,18 @@ }, "node_modules/is-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", "dev": true, "license": "MIT" }, + "node_modules/is-number": { + "version": "7.0.0", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-plain-object": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", "license": "MIT", "engines": { "node": ">=0.10.0" @@ -3269,8 +2847,6 @@ }, "node_modules/is-reference": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3279,21 +2855,15 @@ }, "node_modules/isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "license": "MIT" }, "node_modules/isexe": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true, "license": "ISC" }, "node_modules/jose": { "version": "4.15.9", - "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.9.tgz", - "integrity": "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/panva" @@ -3301,22 +2871,15 @@ }, "node_modules/jquery": { "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", - "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/js-tokens": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true, "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "version": "4.1.1", "dev": true, "license": "MIT", "dependencies": { @@ -3328,29 +2891,21 @@ }, "node_modules/json-buffer": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true, "license": "MIT" }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true, "license": "MIT" }, "node_modules/json-schema-traverse": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, "license": "MIT" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true, "license": "MIT" }, @@ -3365,20 +2920,16 @@ }, "node_modules/jsonfile": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", "license": "MIT", "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "node_modules/jsonwebtoken": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", - "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "version": "9.0.3", "license": "MIT", "dependencies": { - "jws": "^3.2.2", + "jws": "^4.0.1", "lodash.includes": "^4.3.0", "lodash.isboolean": "^3.0.3", "lodash.isinteger": "^4.0.4", @@ -3396,8 +2947,6 @@ }, "node_modules/jszip": { "version": "3.10.1", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", - "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", "license": "(MIT OR GPL-3.0-or-later)", "dependencies": { "lie": "~3.3.0", @@ -3408,14 +2957,10 @@ }, "node_modules/jszip/node_modules/pako": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", "license": "(MIT AND Zlib)" }, "node_modules/jszip/node_modules/readable-stream": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", @@ -3429,14 +2974,10 @@ }, "node_modules/jszip/node_modules/safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "license": "MIT" }, "node_modules/jwa": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.2.tgz", - "integrity": "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==", + "version": "2.0.1", "license": "MIT", "dependencies": { "buffer-equal-constant-time": "^1.0.1", @@ -3445,36 +2986,36 @@ } }, "node_modules/jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "version": "4.0.1", "license": "MIT", "dependencies": { - "jwa": "^1.4.1", + "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, "node_modules/keyv": { "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, "license": "MIT", "dependencies": { "json-buffer": "3.0.1" } }, + "node_modules/kind-of": { + "version": "6.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/known-css-properties": { "version": "0.37.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.37.0.tgz", - "integrity": "sha512-JCDrsP4Z1Sb9JwG0aJ8Eo2r7k4Ou5MwmThS/6lcIe1ICyb7UBJKGRIUUdqc2ASdE/42lgz6zFUnzAIhtXnBVrQ==", "dev": true, "license": "MIT" }, "node_modules/levn": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3486,15 +3027,10 @@ } }, "node_modules/lex": { - "version": "1.7.9", - "resolved": "https://registry.npmjs.org/lex/-/lex-1.7.9.tgz", - "integrity": "sha512-vzaalVBmFLnMaedq0QAsBAaXsWahzRpvnIBdBjj7y+7EKTS6lnziU2y/PsU2c6rV5qYj2B5IDw0uNJ9peXD0vw==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + "version": "1.7.9" }, "node_modules/lie": { "version": "3.3.0", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", - "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", "license": "MIT", "dependencies": { "immediate": "~3.0.5" @@ -3502,15 +3038,11 @@ }, "node_modules/lines-and-columns": { "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true, "license": "MIT" }, "node_modules/localforage": { "version": "1.10.0", - "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", - "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", "license": "Apache-2.0", "dependencies": { "lie": "3.1.1" @@ -3518,8 +3050,6 @@ }, "node_modules/localforage/node_modules/lie": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", - "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", "license": "MIT", "dependencies": { "immediate": "~3.0.5" @@ -3527,8 +3057,6 @@ }, "node_modules/locate-path": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "license": "MIT", "dependencies": { @@ -3543,77 +3071,53 @@ }, "node_modules/lodash.includes": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", "license": "MIT" }, "node_modules/lodash.isboolean": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", "license": "MIT" }, "node_modules/lodash.isinteger": { "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", "license": "MIT" }, "node_modules/lodash.isnumber": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", "license": "MIT" }, "node_modules/lodash.isplainobject": { "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", "license": "MIT" }, "node_modules/lodash.isstring": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", "license": "MIT" }, "node_modules/lodash.memoize": { "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", "dev": true, "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true, "license": "MIT" }, "node_modules/lodash.once": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", "license": "MIT" }, "node_modules/lodash.truncate": { "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", "dev": true, "license": "MIT" }, "node_modules/looper": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/looper/-/looper-3.0.0.tgz", - "integrity": "sha512-LJ9wplN/uSn72oJRsXTx+snxPet5c8XiZmOKCm906NVYu+ag6SB6vUcnJcWxgnl2NfbIyeobAn7Bwv6xRj2XJg==", "license": "MIT" }, "node_modules/lru-cache": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -3623,19 +3127,15 @@ } }, "node_modules/magic-string": { - "version": "0.30.17", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", - "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "version": "0.30.21", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" + "@jridgewell/sourcemap-codec": "^1.5.5" } }, "node_modules/marked": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", "license": "MIT", "bin": { "marked": "bin/marked.js" @@ -3646,8 +3146,6 @@ }, "node_modules/math-intrinsics": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -3655,14 +3153,10 @@ }, "node_modules/mathjax": { "version": "3.0.5", - "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-3.0.5.tgz", - "integrity": "sha512-9M7VulhltkD8sIebWutK/VfAD+m+6BIFqfpjDh9Pz/etoKUtjO6UMnOhUcDmNl6iApE8C9xrUmaMyNZkZAlrMw==", "license": "Apache-2.0" }, "node_modules/mathml-tag-names": { "version": "2.1.3", - "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", - "integrity": "sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==", "dev": true, "license": "MIT", "funding": { @@ -3672,15 +3166,11 @@ }, "node_modules/mdn-data": { "version": "2.12.2", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.12.2.tgz", - "integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==", "dev": true, "license": "CC0-1.0" }, "node_modules/media-typer": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -3688,8 +3178,6 @@ }, "node_modules/meow": { "version": "13.2.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", - "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", "dev": true, "license": "MIT", "engines": { @@ -3701,8 +3189,6 @@ }, "node_modules/merge-descriptors": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", - "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3710,8 +3196,6 @@ }, "node_modules/merge2": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, "license": "MIT", "engines": { @@ -3720,22 +3204,16 @@ }, "node_modules/methods": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/microee": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/microee/-/microee-0.0.2.tgz", - "integrity": "sha512-YtNUgIojy1brPWluzA/lE+vf21Tf4qgfs9vqbgY0tFZTsLqKkc+P/UHjf1UrLjB0RSqmPbNm3dihC/HvkqZnTg==" + "version": "0.0.2" }, "node_modules/micromatch": { "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "license": "MIT", "dependencies": { "braces": "^3.0.3", @@ -3747,8 +3225,6 @@ }, "node_modules/micromatch/node_modules/picomatch": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "license": "MIT", "engines": { "node": ">=8.6" @@ -3759,8 +3235,6 @@ }, "node_modules/mime": { "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "license": "MIT", "bin": { "mime": "cli.js" @@ -3771,39 +3245,34 @@ }, "node_modules/mime-db": { "version": "1.54.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", - "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", - "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", + "version": "3.0.2", "license": "MIT", "dependencies": { "mime-db": "^1.54.0" }, "engines": { - "node": ">= 0.6" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/minilog": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/minilog/-/minilog-2.1.0.tgz", - "integrity": "sha512-UPg2RLmS2JteQ8bn5xA69skwi7evHYcHgRULQIGnNsuXheOHUsFyWitMkqpa3Q9ezSpbDC7vaYKxYCLryCV4og==", "license": "MIT", - "peer": true, "dependencies": { "microee": "0.0.2" } }, "node_modules/minimatch": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -3814,8 +3283,6 @@ }, "node_modules/minimist": { "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3823,8 +3290,6 @@ }, "node_modules/miniq": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/miniq/-/miniq-0.1.2.tgz", - "integrity": "sha512-RrLjyiUep4m+ynM6viqtnh20qAdBzfjrmxTIcXU0oschLaEAqUKTxEhYq2Gm3V3IsgzOICG7PMkxuio+I6X6Rw==", "license": "BSD", "dependencies": { "microee": "~0.0.5" @@ -3832,14 +3297,10 @@ }, "node_modules/miniq/node_modules/microee": { "version": "0.0.6", - "resolved": "https://registry.npmjs.org/microee/-/microee-0.0.6.tgz", - "integrity": "sha512-/LdL3jiBWDJ3oQIRLgRhfeCZNE3patM1LiwCC124+/HHn10sI/G2OAyiMfTNzH5oYWoZBk0tRZADAUOv+0Wt0A==", "license": "BSD" }, "node_modules/minitask": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/minitask/-/minitask-0.2.3.tgz", - "integrity": "sha512-Ka6EQ9R2XsLc80vr3rdh4C56guoKq5tItG50etoNxJ8wV/0p59og2BdGBtqnNhkWchI/B4W4GTQ/Fvdy5N2rng==", "license": "BSD", "dependencies": { "miniq": "~0.1.1", @@ -3851,8 +3312,6 @@ }, "node_modules/mkdirp": { "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "license": "MIT", "dependencies": { "minimist": "^1.2.6" @@ -3863,14 +3322,10 @@ }, "node_modules/ms": { "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, "node_modules/nanoid": { "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "dev": true, "funding": [ { @@ -3888,15 +3343,11 @@ }, "node_modules/natural-compare": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true, "license": "MIT" }, "node_modules/negotiator": { "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -3904,21 +3355,15 @@ }, "node_modules/netflux-websocket": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/netflux-websocket/-/netflux-websocket-1.3.0.tgz", - "integrity": "sha512-0kYbegEUJcK+T74g4JYa/hkE5KsHRbm7nZv0ToLt/7JY+J90xig/3aBEDg/NWb+UuWpCPlcrMQPjrFHQjUApow==", "license": "LGPL-2.1" }, "node_modules/node-releases": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", - "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "version": "2.0.27", "dev": true, "license": "MIT" }, "node_modules/normalize-path": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "license": "MIT", "engines": { @@ -3927,22 +3372,16 @@ }, "node_modules/notp": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/notp/-/notp-2.0.3.tgz", - "integrity": "sha512-oBig/2uqkjQ5AkBuw4QJYwkEWa/q+zHxI5/I5z6IeP2NT0alpJFsP/trrfCC+9xOAgQSZXssNi962kp5KBmypQ==", "engines": { "node": "> v0.6.0" } }, "node_modules/nthen": { "version": "0.1.8", - "resolved": "https://registry.npmjs.org/nthen/-/nthen-0.1.8.tgz", - "integrity": "sha512-Oh2CwIbhj+wUT94lQV7LKmmgw3UYAGGd8oLIqp6btQN3Bz3PuWp4BuvtUo35H3rqDknjPfKx5P6mt7v+aJNjcw==", "license": "MIT" }, "node_modules/object-hash": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz", - "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==", "license": "MIT", "engines": { "node": ">= 6" @@ -3950,8 +3389,6 @@ }, "node_modules/object-inspect": { "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -3961,9 +3398,7 @@ } }, "node_modules/oidc-token-hash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.1.0.tgz", - "integrity": "sha512-y0W+X7Ppo7oZX6eovsRkuzcSM40Bicg2JEJkDJ4irIt1wsYAP5MLSNv+QAogO8xivMffw/9OvV3um1pxXgt1uA==", + "version": "5.2.0", "license": "MIT", "engines": { "node": "^10.13.0 || >=12.0.0" @@ -3971,8 +3406,6 @@ }, "node_modules/on-finished": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "license": "MIT", "dependencies": { "ee-first": "1.1.1" @@ -3983,14 +3416,10 @@ }, "node_modules/open-sans-fontface": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/open-sans-fontface/-/open-sans-fontface-1.4.0.tgz", - "integrity": "sha512-d1VXrt1qPScsZnDHbZTOf1SmUnanr3KQgQM6+ye6KoFgrLo8a8mkX/J/ZJ2+w7vf0sCC02lRia5SAiaz0JPEog==", "license": "Apache License version 2.0" }, "node_modules/openid-client": { "version": "5.7.1", - "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.7.1.tgz", - "integrity": "sha512-jDBPgSVfTnkIh71Hg9pRvtJc6wTwqjRkN88+gCFtYWrlP4Yx2Dsrow8uPi3qLr/aeymPF3o2+dS+wOpglK04ew==", "license": "MIT", "dependencies": { "jose": "^4.15.9", @@ -4004,8 +3433,6 @@ }, "node_modules/optimist": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", "license": "MIT/X11", "dependencies": { "minimist": "~0.0.1", @@ -4014,8 +3441,6 @@ }, "node_modules/optionator": { "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "license": "MIT", "dependencies": { @@ -4032,8 +3457,6 @@ }, "node_modules/p-limit": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4048,8 +3471,6 @@ }, "node_modules/p-locate": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "license": "MIT", "dependencies": { @@ -4064,14 +3485,10 @@ }, "node_modules/pako": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", "license": "(MIT AND Zlib)" }, "node_modules/parent-module": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, "license": "MIT", "dependencies": { @@ -4083,8 +3500,6 @@ }, "node_modules/parse-json": { "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "license": "MIT", "dependencies": { @@ -4102,8 +3517,6 @@ }, "node_modules/parseurl": { "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -4111,8 +3524,6 @@ }, "node_modules/path-exists": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "license": "MIT", "engines": { @@ -4121,8 +3532,6 @@ }, "node_modules/path-key": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, "license": "MIT", "engines": { @@ -4131,21 +3540,15 @@ }, "node_modules/path-parse": { "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true, "license": "MIT" }, "node_modules/path-to-regexp": { "version": "0.1.12", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", - "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "license": "MIT" }, "node_modules/path-type": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, "license": "MIT", "engines": { @@ -4154,18 +3557,13 @@ }, "node_modules/picocolors": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true, "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "version": "4.0.3", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -4175,9 +3573,6 @@ }, "node_modules/popper.js": { "version": "1.16.1", - "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz", - "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==", - "deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1", "license": "MIT", "peer": true, "funding": { @@ -4187,8 +3582,6 @@ }, "node_modules/postcss": { "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", "dev": true, "funding": [ { @@ -4205,7 +3598,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -4217,8 +3609,6 @@ }, "node_modules/postcss-less": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/postcss-less/-/postcss-less-6.0.0.tgz", - "integrity": "sha512-FPX16mQLyEjLzEuuJtxA8X3ejDLNGGEG503d2YGZR5Ask1SpDN8KmZUMpzCvyalWRywAn1n1VOA5dcqfCLo5rg==", "dev": true, "license": "MIT", "engines": { @@ -4230,15 +3620,11 @@ }, "node_modules/postcss-resolve-nested-selector": { "version": "0.1.6", - "resolved": "https://registry.npmjs.org/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.6.tgz", - "integrity": "sha512-0sglIs9Wmkzbr8lQwEyIzlDOOC9bGmfVKcJTaxv3vMmd3uo4o4DerC3En0bnmgceeql9BfC8hRkp7cg0fjdVqw==", "dev": true, "license": "MIT" }, "node_modules/postcss-safe-parser": { "version": "7.0.1", - "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-7.0.1.tgz", - "integrity": "sha512-0AioNCJZ2DPYz5ABT6bddIqlhgwhpHZ/l65YAYo0BCIn0xiDpsnTHz0gnoTGk0OXZW0JRs+cDwL8u/teRdz+8A==", "dev": true, "funding": [ { @@ -4263,12 +3649,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", - "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", + "version": "7.1.1", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -4279,15 +3662,11 @@ }, "node_modules/postcss-value-parser": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true, "license": "MIT" }, "node_modules/prelude-ls": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, "license": "MIT", "engines": { @@ -4296,22 +3675,16 @@ }, "node_modules/process-nextick-args": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "license": "MIT" }, "node_modules/progress": { "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha512-UdA8mJ4weIkUBO224tIarHzuHs4HuYiJvsuGT7j/SPQiUJVjYvNDBIPa0hAorduOfjGohB/qHWRa/lrrWX/mXw==", "engines": { "node": ">=0.4.0" } }, "node_modules/proxy-addr": { "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", "license": "MIT", "dependencies": { "forwarded": "0.2.0", @@ -4323,27 +3696,32 @@ }, "node_modules/pull-stream": { "version": "3.7.0", - "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.7.0.tgz", - "integrity": "sha512-Eco+/R004UaCK2qEDE8vGklcTG2OeZSVm1kTUQNrykEjDwcFXDZhygFDsW49DbXyJMEhHeRL3z5cRVqPAhXlIw==", "license": "MIT" }, "node_modules/punycode": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "license": "MIT", "engines": { "node": ">=6" } }, + "node_modules/qified": { + "version": "0.5.2", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.13.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/qs": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", - "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "version": "6.14.1", "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.6" + "side-channel": "^1.1.0" }, "engines": { "node": ">=0.6" @@ -4354,8 +3732,6 @@ }, "node_modules/queue-microtask": { "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true, "funding": [ { @@ -4375,8 +3751,6 @@ }, "node_modules/randombytes": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4385,32 +3759,51 @@ }, "node_modules/range-parser": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "version": "2.5.3", "license": "MIT", "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" }, "engines": { "node": ">= 0.8" } }, + "node_modules/raw-body/node_modules/http-errors": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/raw-body/node_modules/statuses": { + "version": "2.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/readable-stream": { "version": "1.1.9", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.9.tgz", - "integrity": "sha512-Xz7W+ck1vQnTauU5Uo2zYK/Ae8Ou5mRJrKkGFDZX+VF921HwsjL6lz3ga+vT8jQa6HT/0ZbamKffh9OE7xJ4vQ==", "license": "MIT", "dependencies": { "core-util-is": "~1.0.0" @@ -4420,14 +3813,10 @@ } }, "node_modules/require-css": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/require-css/-/require-css-0.1.10.tgz", - "integrity": "sha512-v9XczgOfDKMkHdndAwuEDEasYNJPbL3aVDTM9tbRoAefjLm3kUZdt/Fg6Xi+0HJzliL21gGPWTXDV87XuOwCIQ==" + "version": "0.1.10" }, "node_modules/require-from-string": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, "license": "MIT", "engines": { @@ -4436,8 +3825,6 @@ }, "node_modules/requirejs": { "version": "2.3.7", - "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.7.tgz", - "integrity": "sha512-DouTG8T1WanGok6Qjg2SXuCMzszOo0eHeH9hDZ5Y4x8Je+9JB38HdTLT4/VA8OaUhBa0JPVHJ0pyBkM1z+pDsw==", "license": "MIT", "bin": { "r_js": "bin/r.js", @@ -4449,24 +3836,18 @@ }, "node_modules/requirejs-plugins": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/requirejs-plugins/-/requirejs-plugins-1.0.2.tgz", - "integrity": "sha512-bX1vGnjDd1iIod3hst47oM/Nv9JiYw4qodWNKgyeQw5ahzSvPI3j1K6hMcK0HtiGRKxebCf+QUrtWzbrZtzQog==", "license": "ISC" }, "node_modules/requires-port": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", "license": "MIT" }, "node_modules/resolve": { - "version": "1.22.10", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", - "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "version": "1.22.11", "dev": true, "license": "MIT", "dependencies": { - "is-core-module": "^2.16.0", + "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -4482,8 +3863,6 @@ }, "node_modules/resolve-from": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, "license": "MIT", "engines": { @@ -4492,8 +3871,6 @@ }, "node_modules/reusify": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", "dev": true, "license": "MIT", "engines": { @@ -4502,12 +3879,9 @@ } }, "node_modules/rollup": { - "version": "4.44.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.44.0.tgz", - "integrity": "sha512-qHcdEzLCiktQIfwBq420pn2dP+30uzqYxv9ETm91wdt2R9AFcWfjNAmje4NWlnCIQ5RMTzVf0ZyisOKqHR6RwA==", + "version": "4.53.3", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -4519,33 +3893,33 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.44.0", - "@rollup/rollup-android-arm64": "4.44.0", - "@rollup/rollup-darwin-arm64": "4.44.0", - "@rollup/rollup-darwin-x64": "4.44.0", - "@rollup/rollup-freebsd-arm64": "4.44.0", - "@rollup/rollup-freebsd-x64": "4.44.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.44.0", - "@rollup/rollup-linux-arm-musleabihf": "4.44.0", - "@rollup/rollup-linux-arm64-gnu": "4.44.0", - "@rollup/rollup-linux-arm64-musl": "4.44.0", - "@rollup/rollup-linux-loongarch64-gnu": "4.44.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.44.0", - "@rollup/rollup-linux-riscv64-gnu": "4.44.0", - "@rollup/rollup-linux-riscv64-musl": "4.44.0", - "@rollup/rollup-linux-s390x-gnu": "4.44.0", - "@rollup/rollup-linux-x64-gnu": "4.44.0", - "@rollup/rollup-linux-x64-musl": "4.44.0", - "@rollup/rollup-win32-arm64-msvc": "4.44.0", - "@rollup/rollup-win32-ia32-msvc": "4.44.0", - "@rollup/rollup-win32-x64-msvc": "4.44.0", + "@rollup/rollup-android-arm-eabi": "4.53.3", + "@rollup/rollup-android-arm64": "4.53.3", + "@rollup/rollup-darwin-arm64": "4.53.3", + "@rollup/rollup-darwin-x64": "4.53.3", + "@rollup/rollup-freebsd-arm64": "4.53.3", + "@rollup/rollup-freebsd-x64": "4.53.3", + "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", + "@rollup/rollup-linux-arm-musleabihf": "4.53.3", + "@rollup/rollup-linux-arm64-gnu": "4.53.3", + "@rollup/rollup-linux-arm64-musl": "4.53.3", + "@rollup/rollup-linux-loong64-gnu": "4.53.3", + "@rollup/rollup-linux-ppc64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-musl": "4.53.3", + "@rollup/rollup-linux-s390x-gnu": "4.53.3", + "@rollup/rollup-linux-x64-gnu": "4.53.3", + "@rollup/rollup-linux-x64-musl": "4.53.3", + "@rollup/rollup-openharmony-arm64": "4.53.3", + "@rollup/rollup-win32-arm64-msvc": "4.53.3", + "@rollup/rollup-win32-ia32-msvc": "4.53.3", + "@rollup/rollup-win32-x64-gnu": "4.53.3", + "@rollup/rollup-win32-x64-msvc": "4.53.3", "fsevents": "~2.3.2" } }, "node_modules/run-parallel": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, "funding": [ { @@ -4568,8 +3942,6 @@ }, "node_modules/safe-buffer": { "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "funding": [ { "type": "github", @@ -4588,32 +3960,22 @@ }, "node_modules/safer-buffer": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "license": "MIT" }, "node_modules/saferphore": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/saferphore/-/saferphore-0.0.1.tgz", - "integrity": "sha512-/KaXQyumYbALQwhl4/Qov6voayHwtBD12AWRI3zxYBW7cY3Mjtkk7PLttZPq+25nyfu/k3APHUptPLZI9A7yHA==", "license": "MIT" }, "node_modules/sax": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", - "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", - "license": "ISC" + "version": "1.4.3", + "license": "BlueOak-1.0.0" }, "node_modules/scrypt-async": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/scrypt-async/-/scrypt-async-1.2.0.tgz", - "integrity": "sha512-BtT7+xPLdoeXsh6wOblaq6sRy/AsffFXgcwBNGtQJXeNgm9UD3HM3nWEmAERjdCNfE6jWglAtRbAPZ7rc2WtsQ==", "license": "BSD" }, "node_modules/semver": { - "version": "7.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", - "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "version": "7.7.3", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4624,8 +3986,6 @@ }, "node_modules/send": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", - "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", "license": "MIT", "dependencies": { "debug": "^4.3.5", @@ -4646,8 +4006,6 @@ }, "node_modules/send/node_modules/fresh": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", - "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -4655,8 +4013,6 @@ }, "node_modules/serialize-javascript": { "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -4665,8 +4021,6 @@ }, "node_modules/serve-static": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", - "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", "license": "MIT", "dependencies": { "encodeurl": "^2.0.0", @@ -4680,20 +4034,14 @@ }, "node_modules/setimmediate": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", "license": "MIT" }, "node_modules/setprototypeof": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "license": "ISC" }, "node_modules/shebang-command": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, "license": "MIT", "dependencies": { @@ -4705,8 +4053,6 @@ }, "node_modules/shebang-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, "license": "MIT", "engines": { @@ -4715,8 +4061,6 @@ }, "node_modules/side-channel": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0", @@ -4734,8 +4078,6 @@ }, "node_modules/side-channel-list": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0", @@ -4750,8 +4092,6 @@ }, "node_modules/side-channel-map": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", "license": "MIT", "dependencies": { "call-bound": "^1.0.2", @@ -4768,8 +4108,6 @@ }, "node_modules/side-channel-weakmap": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", "license": "MIT", "dependencies": { "call-bound": "^1.0.2", @@ -4787,8 +4125,6 @@ }, "node_modules/signal-exit": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, "license": "ISC", "engines": { @@ -4800,8 +4136,6 @@ }, "node_modules/slash": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", "engines": { @@ -4810,8 +4144,6 @@ }, "node_modules/slice-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4826,33 +4158,17 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/smob": { "version": "1.5.0", - "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", - "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", "dev": true, "license": "MIT" }, "node_modules/sortablejs": { "version": "1.15.6", - "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.6.tgz", - "integrity": "sha512-aNfiuwMEpfBM/CN6LY0ibyhxPfPbyFeBTYJKCvzkJ2GkUpazIt3H+QIPAMHwqQ7tMKaHz1Qj+rJJCqljnf4p3A==", "license": "MIT" }, "node_modules/sortify": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/sortify/-/sortify-1.0.4.tgz", - "integrity": "sha512-q+jgY7dx4fmB47wEz3Sq5ok+ibO4caQLplk/U/JXtlt0uvqDNHHZZYYfGB6oEBRbXAb345hbYjOMN5zl8yGYXA==", "license": "MIT", "dependencies": { "lex": "^1.7.9" @@ -4860,8 +4176,6 @@ }, "node_modules/source-map": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -4870,8 +4184,6 @@ }, "node_modules/source-map-js": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -4880,8 +4192,6 @@ }, "node_modules/source-map-support": { "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, "license": "MIT", "dependencies": { @@ -4891,8 +4201,6 @@ }, "node_modules/statuses": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -4900,8 +4208,6 @@ }, "node_modules/stream-to-pull-stream": { "version": "1.7.3", - "resolved": "https://registry.npmjs.org/stream-to-pull-stream/-/stream-to-pull-stream-1.7.3.tgz", - "integrity": "sha512-6sNyqJpr5dIOQdgNy/xcDWwDuzAsAwVzhzrWlAPAQ7Lkjx/rv0wgvxEyKwTq6FmNd5rjTrELt/CLmaSw7crMGg==", "license": "MIT", "dependencies": { "looper": "^3.0.0", @@ -4910,8 +4216,6 @@ }, "node_modules/string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" @@ -4919,14 +4223,34 @@ }, "node_modules/string_decoder/node_modules/safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "license": "MIT" }, + "node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, "license": "MIT", "engines": { @@ -4937,9 +4261,7 @@ } }, "node_modules/stylelint": { - "version": "16.21.0", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.21.0.tgz", - "integrity": "sha512-ki3PpJGG7xhm3WtINoWGnlvqAmbqSexoRMbEMJzlwewSIOqPRKPlq452c22xAdEJISVi80r+I7KL9GPUiwFgbg==", + "version": "16.26.1", "dev": true, "funding": [ { @@ -4952,22 +4274,22 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-syntax-patches-for-csstree": "^1.0.19", "@csstools/css-tokenizer": "^3.0.4", "@csstools/media-query-list-parser": "^4.0.3", "@csstools/selector-specificity": "^5.0.0", - "@dual-bundle/import-meta-resolve": "^4.1.0", + "@dual-bundle/import-meta-resolve": "^4.2.1", "balanced-match": "^2.0.0", "colord": "^2.9.3", "cosmiconfig": "^9.0.0", "css-functions-list": "^3.2.3", "css-tree": "^3.1.0", - "debug": "^4.4.1", + "debug": "^4.4.3", "fast-glob": "^3.3.3", "fastest-levenshtein": "^1.0.16", - "file-entry-cache": "^10.1.1", + "file-entry-cache": "^11.1.1", "global-modules": "^2.0.0", "globby": "^11.1.0", "globjoin": "^0.1.4", @@ -4981,7 +4303,7 @@ "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "picocolors": "^1.1.1", - "postcss": "^8.5.5", + "postcss": "^8.5.6", "postcss-resolve-nested-selector": "^0.1.6", "postcss-safe-parser": "^7.0.1", "postcss-selector-parser": "^7.1.0", @@ -5002,8 +4324,6 @@ }, "node_modules/stylelint-config-recommended": { "version": "14.0.1", - "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-14.0.1.tgz", - "integrity": "sha512-bLvc1WOz/14aPImu/cufKAZYfXs/A/owZfSMZ4N+16WGXLoX5lOir53M6odBxvhgmgdxCVnNySJmZKx73T93cg==", "dev": true, "funding": [ { @@ -5025,8 +4345,6 @@ }, "node_modules/stylelint-config-recommended-less": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/stylelint-config-recommended-less/-/stylelint-config-recommended-less-3.0.1.tgz", - "integrity": "sha512-4vp9Z+W0KwxgPL4L3WxXtlMurfen0NXKFFxPHzDYn2s6WVS26Gg7jt3FIO4ZLM1x8WalCR02nwK2h0TH/mafBg==", "dev": true, "license": "MIT", "dependencies": { @@ -5046,8 +4364,6 @@ }, "node_modules/stylelint-config-standard": { "version": "35.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-35.0.0.tgz", - "integrity": "sha512-JyQrNZk2BZwVKFauGGxW2U6RuhIfQ4XoHHo+rBzMHcAkLnwI/knpszwXjzxiMgSfcxbZBckM7Vq4LHoANTR85g==", "dev": true, "license": "MIT", "dependencies": { @@ -5062,8 +4378,6 @@ }, "node_modules/stylelint-config-standard-less": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/stylelint-config-standard-less/-/stylelint-config-standard-less-3.0.1.tgz", - "integrity": "sha512-l6UrXbfy37hWbeOCYrJqnKzhiy5+rkxHNGNufvyhH2K1KpEWO+lO8YrLzoOTx0VyGMatPQlpR8EXrnLRcEcvhg==", "dev": true, "license": "MIT", "dependencies": { @@ -5082,8 +4396,6 @@ }, "node_modules/stylelint-less": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/stylelint-less/-/stylelint-less-3.0.1.tgz", - "integrity": "sha512-6GkZ4jhmReXxX61IiNaniZFuyTzYTTC4HvRLNNok883d1ux/wUodM1uik+iAHZM1VSCwNASaj0Th6ZX46WZLMw==", "dev": true, "license": "MIT", "dependencies": { @@ -5095,16 +4407,6 @@ "stylelint": "^16.0.2" } }, - "node_modules/stylelint/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/stylelint/node_modules/balanced-match": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", @@ -5113,25 +4415,21 @@ "license": "MIT" }, "node_modules/stylelint/node_modules/file-entry-cache": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-10.1.1.tgz", - "integrity": "sha512-zcmsHjg2B2zjuBgjdnB+9q0+cWcgWfykIcsDkWDB4GTPtl1eXUA+gTI6sO0u01AqK3cliHryTU55/b2Ow1hfZg==", + "version": "11.1.1", "dev": true, "license": "MIT", "dependencies": { - "flat-cache": "^6.1.10" + "flat-cache": "^6.1.19" } }, "node_modules/stylelint/node_modules/flat-cache": { - "version": "6.1.10", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.10.tgz", - "integrity": "sha512-B6/v1f0NwjxzmeOhzfXPGWpKBVA207LS7lehaVKQnFrVktcFRfkzjZZ2gwj2i1TkEUMQht7ZMJbABUT5N+V1Nw==", + "version": "6.1.19", "dev": true, "license": "MIT", "dependencies": { - "cacheable": "^1.10.0", + "cacheable": "^2.2.0", "flatted": "^3.3.3", - "hookified": "^1.9.1" + "hookified": "^1.13.0" } }, "node_modules/stylelint/node_modules/ignore": { @@ -5144,16 +4442,6 @@ "node": ">= 4" } }, - "node_modules/stylelint/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/stylelint/node_modules/resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", @@ -5164,38 +4452,8 @@ "node": ">=8" } }, - "node_modules/stylelint/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/stylelint/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "license": "MIT", "dependencies": { @@ -5207,8 +4465,6 @@ }, "node_modules/supports-hyperlinks": { "version": "3.2.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz", - "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==", "dev": true, "license": "MIT", "dependencies": { @@ -5224,8 +4480,6 @@ }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, "license": "MIT", "engines": { @@ -5237,14 +4491,10 @@ }, "node_modules/svg-tags": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz", - "integrity": "sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==", "dev": true }, "node_modules/table": { "version": "6.9.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.9.0.tgz", - "integrity": "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -5260,8 +4510,6 @@ }, "node_modules/table/node_modules/ajv": { "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", "dependencies": { @@ -5275,70 +4523,18 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/table/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/table/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/table/node_modules/json-schema-traverse": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true, "license": "MIT" }, - "node_modules/table/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/table/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/terser": { - "version": "5.43.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz", - "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==", + "version": "5.44.1", "dev": true, "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.14.0", + "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, @@ -5351,8 +4547,6 @@ }, "node_modules/text-segmentation": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", - "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", "license": "MIT", "dependencies": { "utrie": "^1.0.2" @@ -5360,28 +4554,20 @@ }, "node_modules/thirty-two": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-1.0.2.tgz", - "integrity": "sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA==", "engines": { "node": ">=0.2.6" } }, "node_modules/ticky": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ticky/-/ticky-1.0.1.tgz", - "integrity": "sha512-RX35iq/D+lrsqhcPWIazM9ELkjOe30MSeoBHQHSsRwd1YuhJO5ui1K1/R0r7N3mFvbLBs33idw+eR6j+w6i/DA==", "license": "MIT" }, "node_modules/tiny-each-async": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/tiny-each-async/-/tiny-each-async-2.0.3.tgz", - "integrity": "sha512-5ROII7nElnAirvFn8g7H7MtpfV1daMcyfTGQwsn/x2VtyV+VPiO5CjReCJtWLvoKTDEDmZocf3cNPraiMnBXLA==", "license": "MIT" }, "node_modules/to-regex-range": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "license": "MIT", "dependencies": { "is-number": "^7.0.0" @@ -5390,19 +4576,8 @@ "node": ">=8.0" } }, - "node_modules/to-regex-range/node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/toidentifier": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "license": "MIT", "engines": { "node": ">=0.6" @@ -5410,28 +4585,19 @@ }, "node_modules/tslib": { "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, - "license": "0BSD", - "peer": true + "license": "0BSD" }, "node_modules/tweetnacl": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", "license": "Unlicense" }, "node_modules/tweetnacl-util": { "version": "0.15.1", - "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", - "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==", "license": "Unlicense" }, "node_modules/type-check": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, "license": "MIT", "dependencies": { @@ -5443,8 +4609,6 @@ }, "node_modules/type-is": { "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "license": "MIT", "dependencies": { "media-typer": "0.3.0", @@ -5456,8 +4620,6 @@ }, "node_modules/type-is/node_modules/mime-db": { "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -5465,8 +4627,6 @@ }, "node_modules/type-is/node_modules/mime-types": { "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "license": "MIT", "dependencies": { "mime-db": "1.52.0" @@ -5476,12 +4636,9 @@ } }, "node_modules/typescript": { - "version": "5.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", - "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "version": "5.9.3", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -5492,22 +4649,16 @@ }, "node_modules/ulimit": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/ulimit/-/ulimit-0.0.2.tgz", - "integrity": "sha512-8dLT7c9RKRjXkMZM/I+evcS8lam0ZfypijS7KfMlmlbgYeGQFabu1OOAeFcm6uQH204KiRnT270uvNXzepoJ5g==", "engines": { "node": ">= v0.4" } }, "node_modules/undici-types": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", - "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", + "version": "7.16.0", "license": "MIT" }, "node_modules/universalify": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "license": "MIT", "engines": { "node": ">= 4.0.0" @@ -5515,17 +4666,13 @@ }, "node_modules/unpipe": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/update-browserslist-db": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", - "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "version": "1.1.4", "dev": true, "funding": [ { @@ -5555,8 +4702,6 @@ }, "node_modules/uri-js": { "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -5565,14 +4710,10 @@ }, "node_modules/util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "license": "MIT" }, "node_modules/utils-merge": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", "license": "MIT", "engines": { "node": ">= 0.4.0" @@ -5580,8 +4721,6 @@ }, "node_modules/utrie": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", - "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", "license": "MIT", "dependencies": { "base64-arraybuffer": "^1.0.2" @@ -5589,8 +4728,6 @@ }, "node_modules/vary": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -5598,8 +4735,6 @@ }, "node_modules/which": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "license": "ISC", "dependencies": { @@ -5614,8 +4749,6 @@ }, "node_modules/word-wrap": { "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, "license": "MIT", "engines": { @@ -5624,8 +4757,6 @@ }, "node_modules/wordwrap": { "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==", "license": "MIT", "engines": { "node": ">=0.4.0" @@ -5633,8 +4764,6 @@ }, "node_modules/write-file-atomic": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", - "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", "dev": true, "license": "ISC", "dependencies": { @@ -5646,9 +4775,7 @@ } }, "node_modules/ws": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz", - "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==", + "version": "8.18.3", "license": "MIT", "engines": { "node": ">=10.0.0" @@ -5668,8 +4795,6 @@ }, "node_modules/x2js": { "version": "3.4.4", - "resolved": "https://registry.npmjs.org/x2js/-/x2js-3.4.4.tgz", - "integrity": "sha512-yG/ThaBCgnsa3aoMPAe7QwDpcyU4D70hjXC4Y1lZSfD/Tgd0MpE19FnZZRAjekryw0c8cffpOt9zsPEiqktO6Q==", "license": "Apache-2.0", "dependencies": { "@xmldom/xmldom": "^0.8.3" @@ -5677,16 +4802,12 @@ }, "node_modules/xmhell": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/xmhell/-/xmhell-0.1.2.tgz", - "integrity": "sha512-9JF9o/dM1PHifwtc7KE/Pcc8pp2Jfj7462TakZFPXNzVPBNglePITwj7bQj94aAaQ6ZGokIb3BFu4nToPYuoeA==", "engines": { "node": "*" } }, "node_modules/xml-crypto": { "version": "6.1.2", - "resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-6.1.2.tgz", - "integrity": "sha512-leBOVQdVi8FvPJrMYoum7Ici9qyxfE4kVi+AkpUoYCSXaQF4IlBm1cneTK9oAxR61LpYxTx7lNcsnBIeRpGW2w==", "license": "MIT", "dependencies": { "@xmldom/is-dom-node": "^1.0.1", @@ -5699,8 +4820,6 @@ }, "node_modules/xml-crypto/node_modules/xpath": { "version": "0.0.33", - "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.33.tgz", - "integrity": "sha512-NNXnzrkDrAzalLhIUc01jO2mOzXGXh1JwPgkihcLLzw98c0WgYDmmjSh1Kl3wzaxSVWMuA+fe0WTWOBDWCBmNA==", "license": "MIT", "engines": { "node": ">=0.6.0" @@ -5708,8 +4827,6 @@ }, "node_modules/xml-encryption": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/xml-encryption/-/xml-encryption-3.1.0.tgz", - "integrity": "sha512-PV7qnYpoAMXbf1kvQkqMScLeQpjCMixddAKq9PtqVrho8HnYbBOWNfG0kA4R7zxQDo7w9kiYAyzS/ullAyO55Q==", "license": "MIT", "dependencies": { "@xmldom/xmldom": "^0.8.5", @@ -5719,8 +4836,6 @@ }, "node_modules/xml-encryption/node_modules/xpath": { "version": "0.0.32", - "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.32.tgz", - "integrity": "sha512-rxMJhSIoiO8vXcWvSifKqhvV96GjiD5wYb8/QHdoRyQvraTpp4IEv944nhGausZZ3u7dhQXteZuZbaqfpB7uYw==", "license": "MIT", "engines": { "node": ">=0.6.0" @@ -5728,8 +4843,6 @@ }, "node_modules/xml2js": { "version": "0.6.2", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", - "integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==", "license": "MIT", "dependencies": { "sax": ">=0.6.0", @@ -5741,8 +4854,6 @@ }, "node_modules/xml2js/node_modules/xmlbuilder": { "version": "11.0.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", - "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", "license": "MIT", "engines": { "node": ">=4.0" @@ -5750,8 +4861,6 @@ }, "node_modules/xmlbuilder": { "version": "15.1.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", - "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", "license": "MIT", "engines": { "node": ">=8.0" @@ -5759,8 +4868,6 @@ }, "node_modules/xpath": { "version": "0.0.34", - "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.34.tgz", - "integrity": "sha512-FxF6+rkr1rNSQrhUNYrAFJpRXNzlDoMxeXN5qI84939ylEv3qqPFKa85Oxr6tDaJKqwW6KKyo2v26TSv3k6LeA==", "license": "MIT", "engines": { "node": ">=0.6.0" @@ -5768,14 +4875,10 @@ }, "node_modules/yallist": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "license": "ISC" }, "node_modules/yocto-queue": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index add3da096..f10a82942 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cryptpad", "description": "a collaborative office suite that is end-to-end encrypted and open-source", - "version": "2025.9.0", + "version": "2026.2.0", "license": "AGPL-3.0+", "repository": { "type": "git", @@ -15,7 +15,7 @@ "@mcrowe/minibloom": "^0.2.0", "@node-saml/node-saml": "^5.1.0", "alertify.js": "1.0.11", - "body-parser": "^1.20.2", + "body-parser": "^1.20.4", "bootstrap": "^4.0.0", "bootstrap-tokenfield": "^0.12.0", "chainpad": "^5.2.6", @@ -29,8 +29,8 @@ "cookie-parser": "^1.4.7", "croppie": "^2.5.0", "dragula": "3.7.2", - "drawio": "github:cryptpad/drawio-npm#npm-21.8.2+5", - "express": "~4.21.2", + "drawio": "github:cryptpad/drawio-npm#npm-21.8.2+6", + "express": "~4.22.1", "file-saver": "1.3.1", "fs-extra": "^7.0.0", "get-folder-size": "^2.0.1", @@ -39,7 +39,7 @@ "hyper-json": "~1.4.0", "jquery": "3.6.0", "json.sortify": "github:cryptpad/JSON.sortify", - "jsonwebtoken": "^9.0.0", + "jsonwebtoken": "^9.0.3", "jszip": "3.10.1", "localforage": "^1.5.2", "marked": "^4.3.0", diff --git a/src/common/common-util.js b/src/common/common-util.js index c48bf809f..cbed9207f 100644 --- a/src/common/common-util.js +++ b/src/common/common-util.js @@ -10,8 +10,16 @@ const factory = (NaclUtil) => { window.atob = window.atob || function (str) { return Buffer.from(str, 'base64').toString('binary'); }; window.btoa = window.btoa || function (str) { return Buffer.from(str, 'binary').toString('base64'); }; - Util.encodeBase64 = NaclUtil.encodeBase64; + Util.encodeBase64 = u8 => { + if (typeof (u8?.toBase64) === "function") { + return u8.toBase64(); + } + return NaclUtil.encodeBase64(u8); + }; Util.decodeBase64 = str => { + if (typeof(Uint8Array?.fromBase64) === "function") { + return Uint8Array.fromBase64(str); + } let i = str.length % 4; if (i) { str += '='.repeat(4-i); } return NaclUtil.decodeBase64(str); @@ -23,18 +31,6 @@ const factory = (NaclUtil) => { return Array.prototype.slice.call(A, start, end); }; - Util.u8ToBase64 = (u8, cb) => { - const reader = new FileReader(); - reader.onload = () => { - let res = reader.result; - let trim = res.slice(res.indexOf(',') + 1); - cb(trim); - }; - reader.readAsDataURL(new Blob([u8])); - }; - - - Util.shuffleArray = function (a) { for (var i = a.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); @@ -314,13 +310,7 @@ const factory = (NaclUtil) => { }; Util.deduplicateString = function (array) { - var a = array.slice(); - for(var i=0; i { const factory = () => { - const version = 8; + const version = 9; return { currentVersionNumber: version, currentVersion: 'v' + version diff --git a/src/common/proxy-manager.js b/src/common/proxy-manager.js index 4439db254..be2d75189 100644 --- a/src/common/proxy-manager.js +++ b/src/common/proxy-manager.js @@ -430,7 +430,9 @@ const factory = (UserObject, Util, Hash, paths.forEach(function (path, idx) { var el = userObject.find(path); var files = []; - var key = path[path.length - 1]; + // For trash paths, the name is at index 1, not the last element + var isTrashPath = userObject.isPathIn && userObject.isPathIn(path, [userObject.TRASH]); + var key = isTrashPath && path.length >= 2 ? path[1] : path[path.length - 1]; // Get the files ID from the current path (file or folder) if (userObject.isFile(el)) { @@ -510,12 +512,17 @@ const factory = (UserObject, Util, Hash, if (!newResolved.userObject.isFolder(newResolved.path)) { return void cb(); } + var moveError = null; nThen(function (waitFor) { if (resolved.main.length) { // Move from the main drive if (!newResolved.id) { // Move from the main drive to the main drive - Env.user.userObject.move(resolved.main, newResolved.path, waitFor()); + Env.user.userObject.move(resolved.main, newResolved.path, waitFor(function (err) { + if (err && !moveError) { + moveError = err; + } + })); } else { // Move from the main drive to a shared folder @@ -523,12 +530,18 @@ const factory = (UserObject, Util, Hash, var toCopy = _getCopyFromPaths(Env, resolved.main, Env.user.userObject); var newUserObject = newResolved.userObject; toCopy.forEach(function (obj) { - newUserObject.copyFromOtherDrive(newResolved.path, obj.el, obj.data, obj.key); + try { + newUserObject.copyFromOtherDrive(newResolved.path, obj.el, obj.data, obj.key); + } catch (err) { + if (!moveError) { + moveError = err; + } + } }); if (copy) { return; } - if (resolved.main.length) { + if (resolved.main.length && !moveError) { // Remove the elements from the old location (without unpinning) Env.user.userObject.delete(resolved.main, waitFor()); // FIXME waitFor() is called synchronously } @@ -542,7 +555,11 @@ const factory = (UserObject, Util, Hash, var paths = resolved.folders[fId]; if (newResolved.id === fId) { // Move to the same shared folder - newResolved.userObject.move(paths, newResolved.path, waitFor()); + newResolved.userObject.move(paths, newResolved.path, waitFor(function (err) { + if (err && !moveError) { + moveError = err; + } + })); } else { // Move to a different shared folder or to main drive var uoFrom = Env.folders[fId].userObject; @@ -551,17 +568,28 @@ const factory = (UserObject, Util, Hash, // Copy the elements to the new location var toCopy = _getCopyFromPaths(Env, paths, uoFrom); toCopy.forEach(function (obj) { - uoTo.copyFromOtherDrive(newResolved.path, obj.el, obj.data, obj.key); + try { + uoTo.copyFromOtherDrive(newResolved.path, obj.el, obj.data, obj.key); + } catch (err) { + if (!moveError) { + moveError = err; + } + } }); if (copy) { return; } // Remove the elements from the old location (without unpinning) - uoFrom.delete(paths, waitFor()); // FIXME waitFor() is called synchronously + if (!moveError) { + uoFrom.delete(paths, waitFor()); // FIXME waitFor() is called synchronously + } } }); } }).nThen(function () { + if (moveError) { + return void cb(moveError); + } cb(); }); }; @@ -1407,6 +1435,17 @@ const factory = (UserObject, Util, Hash, }); }; + const getMissingRtChannel = (Env) => { + const userObjects = _getUserObjects(Env); + const all = []; + userObjects.forEach(function (uo) { + const missing = uo.getMissingRtChannel(); + if (!missing) { return; } + all.push(missing); + }); + return all; + }; + var create = function (proxy, data, uoConfig) { var Env = { pinPads: data.pin, @@ -1473,7 +1512,9 @@ const factory = (UserObject, Util, Hash, findFile: callWithEnv(findFile), getEditHash: callWithEnv(getEditHash), user: Env.user, - folders: Env.folders + folders: Env.folders, + // Fix rtChannel + getMissingRtChannel: callWithEnv(getMissingRtChannel) }; }; @@ -1490,7 +1531,12 @@ const factory = (UserObject, Util, Hash, path: path, newName: newName } - }, cb); + }, function (err, responseData) { + if (err || responseData?.error) { + return void cb(err || responseData); + } + cb(); + }); }; var moveInner = function (Env, paths, newPath, cb, copy) { return void Env.sframeChan.query("Q_DRIVE_USEROBJECT", { @@ -1500,7 +1546,12 @@ const factory = (UserObject, Util, Hash, newPath: newPath, copy: copy } - }, cb); + }, function (err, responseData) { + if (err || responseData?.error) { + return void cb(err || responseData); + } + cb(); + }); }; var emptyTrashInner = function (Env, deleteOwned, cb) { return void Env.sframeChan.query("Q_DRIVE_USEROBJECT", { diff --git a/src/common/user-object-setter.js b/src/common/user-object-setter.js index 1223815a5..96c1ff55e 100644 --- a/src/common/user-object-setter.js +++ b/src/common/user-object-setter.js @@ -34,6 +34,8 @@ const factory = (Util, Hash, Realtime) => { var debug = exp.debug; + let missingRtChannel = {}; + exp._setReadOnly = function (state) { readOnly = state; if (!readOnly) { exp.fixFiles(); } @@ -314,6 +316,14 @@ const factory = (Util, Hash, Realtime) => { // Copy file or folder var newParent = exp.find(path); var tempName = exp.isFile(element) ? Hash.createChannelId() : key; + if (exp.isFolder(element) && tempName !== Messages.fm_newFolder && + typeof(newParent[tempName]) !== "undefined") { + throw { + error: 'E_DUPLICATE_FOLDER_NAME', + folderName: tempName, + message: Messages.fo_unavailableName + }; + } var newName = exp.getAvailableName(newParent, tempName); if (Array.isArray(newParent)) { newParent.push(element); @@ -375,8 +385,11 @@ const factory = (Util, Hash, Realtime) => { elementPath[1] : elementPath.pop(); if (typeof(newParent[newName]) !== "undefined") { - exp.log(Messages.fo_unavailableName); - return; + return { + error: 'E_DUPLICATE_FOLDER_NAME', + folderName: newName, + message: Messages.fo_unavailableName + }; } newParent[newName] = element; return true; @@ -872,6 +885,10 @@ const factory = (Util, Hash, Realtime) => { // toClean.push(id); } + if (['sheet', 'doc', 'presentation'].includes(parsed.type) && !el.rtChannel) { + missingRtChannel[el.channel] = el; + } + if ((loggedIn || config.testMode) && rootFiles.indexOf(id) === -1) { debug("An element in filesData was not in ROOT, TEMPLATE or TRASH.", id, el); var newName = Hash.createChannelId(); @@ -980,6 +997,14 @@ const factory = (Util, Hash, Realtime) => { debug("File system was clean.", ms); }; + exp.getMissingRtChannel = () => { + const channels = missingRtChannel; + missingRtChannel = {}; + if (readOnly) { return; } + if (!Object.keys(channels).length) { return; } + return channels; + }; + return exp; }; diff --git a/src/common/user-object.js b/src/common/user-object.js index 5a6ec3c73..652c4a9ef 100644 --- a/src/common/user-object.js +++ b/src/common/user-object.js @@ -826,6 +826,7 @@ const factory = (Util, Hash, } // Copy the elements to their new location var toRemove = []; + var duplicateError = null; paths.forEach(function (p) { var parentPath = p.slice(); parentPath.pop(); @@ -835,11 +836,21 @@ const factory = (Util, Hash, return; } // Try to copy, and if success, remove the element from the old location - if (exp.copyElement(p.slice(), newPath)) { + var result = exp.copyElement(p.slice(), newPath); + if (result === true) { toRemove.push(p); + } else if (result && result.error === 'E_DUPLICATE_FOLDER_NAME') { + if (!duplicateError) { + duplicateError = result; + } } }); - exp.delete(toRemove, cb); + exp.delete(toRemove, function (err) { + if (err || duplicateError) { + return void cb(err || duplicateError); + } + if (typeof(cb) === "function") { cb(); } + }); }; exp.restore = function (path, cb) { if (sframeChan) { @@ -870,7 +881,16 @@ const factory = (Util, Hash, }, cb); } var parentEl = find(folderPath); - var folderName = getAvailableName(parentEl, name || NEW_FOLDER_NAME); + var requestedName = name || NEW_FOLDER_NAME; + var defaultFolderName = NEW_FOLDER_NAME; + if (requestedName !== defaultFolderName && typeof(parentEl[requestedName]) !== "undefined") { + return void cb({ + error: 'E_DUPLICATE_FOLDER_NAME', + folderName: requestedName, + message: Messages.fo_unavailableName + }); + } + var folderName = getAvailableName(parentEl, requestedName); parentEl[folderName] = {}; var newPath = folderPath.slice(); newPath.push(folderName); @@ -940,7 +960,13 @@ const factory = (Util, Hash, if (!newName || !newName.trim() || oldName === newName) { return; } var parentEl = find(parentPath); if (typeof(parentEl[newName]) !== "undefined") { - log(Messages.fo_existingNameError); + if (typeof cb === "function") { + return void cb({ + error: 'E_DUPLICATE_FOLDER_NAME', + folderName: newName, + message: Messages.fo_unavailableName + }); + } return; } parentEl[newName] = element; diff --git a/src/worker/async-store.js b/src/worker/async-store.js index 2cfd521e4..24e4e5808 100644 --- a/src/worker/async-store.js +++ b/src/worker/async-store.js @@ -4,7 +4,7 @@ const factory = (Sortify, UserObject, ProxyManager, Migrate, Hash, Util, Constants, Feedback, - Realtime, Messaging, Pinpad, Rpc, Cache, + Realtime, Messaging, Pinpad, Rpc, Cryptget, Cache, SF, AccountTS, DriveTS, PadTS, Cursor, Support, Integration, OnlyOffice, Mailbox, Profile, Team, Messenger, History, @@ -2231,6 +2231,72 @@ const factory = (Sortify, UserObject, ProxyManager, /////////////////////// Init ///////////////////////////////////// ////////////////////////////////////////////////////////////////// + Store.fixMissingRtChannel = (cb) => { + const all = {}; + const addMissing = (missing) => { + missing.forEach(obj => { + Object.keys(obj).forEach(chan => { + let proxy = obj[chan]; + let href = proxy.roHref || proxy.href; + all[chan] ||= { + href, + password: proxy.password, + list: [] + }; + all[chan].list.push(proxy); + }); + }); + }; + + try { + const mine = store.manager.getMissingRtChannel(); + addMissing(mine); + } catch (e) { + Feedback.send('MISSING_RT_CHANNEL_ERROR', true); + return setTimeout(cb); + } + const teamsId = store.modules?.team?.getTeams() || []; + teamsId.forEach(id => { + const team = store.modules.team.getTeam(id); + try { + const teamMissing = team.manager.getMissingRtChannel(); + addMissing(teamMissing); + } catch (e) { + Feedback.send('MISSING_RT_CHANNEL_ERROR', true); + return setTimeout(cb); + } + }); + + if (Object.keys(all).length) { + Feedback.send('MISSING_RT_CHANNEL', true); + } + + let n = nThen; + const opts = { + network: store.network + }; + Object.keys(all).forEach(chan => { + n = n(waitFor => { + const data = all[chan]; + const href = data.href; + opts.password = data.password; + const parsed = Hash.parsePadUrl(href); + Cryptget.get(parsed.hash, waitFor((err, content) => { + if (err) { return; } + const p = Util.tryParse(content); + const rtChannel = p?.content?.channel; + if (!rtChannel) { return; } + data.list.forEach(proxy => { + proxy.rtChannel = rtChannel; + }); + }), opts); + }).nThen; + }); + n(() => { + setTimeout(cb); + }); + }; + Store.refreshDriveUI = function () { getAllStores().forEach(function (_s) { var send = _s.id ? _s.sendEvent : sendDriveEvent; @@ -2384,6 +2450,8 @@ const factory = (Sortify, UserObject, ProxyManager, // Make teams non-blocking if (store.modules['team']) { store.modules['team'].onReady(waitFor); } }); + }).nThen(function (waitFor) { + Store.fixMissingRtChannel(waitFor()); }).nThen(function () { var requestLogin = function () { broadcast([], "REQUEST_LOGIN"); @@ -2721,7 +2789,7 @@ const factory = (Sortify, UserObject, ProxyManager, const start = (clientId, data, cb) => { // Don't create a drive if the user only wants to // open an existing pad - const noDrive = data.neverDrive || (data.noDrive && !data.userHash && !data.anonHash); + let noDrive = data.neverDrive || (data.noDrive && !data.userHash && !data.anonHash); if (noDrive) { if (data.neverDrive) { store.neverCache = true; } return void onNoDrive(clientId, obj => { @@ -2983,6 +3051,7 @@ module.exports = factory( require('./components/messaging'), require('../common/pinpad'), require('../common/rpc'), + require('../common/cryptget'), require('../common/cache-store'), require('./components/sharedfolder'), require('./components/account'), // .ts diff --git a/src/worker/components/pad.ts b/src/worker/components/pad.ts index d6abb221c..f8de9ca2e 100644 --- a/src/worker/components/pad.ts +++ b/src/worker/components/pad.ts @@ -93,7 +93,7 @@ const _setMetadata: Callback = (ctx, clientId, data, cb) => { otherChannels.forEach(chan => { var _d = Util.clone(data); _d.channel = chan; - Store.setPadMetadata(clientId, _d, () => {}); + s.rpc.setMetadata(_d, () => { }); }); } }; diff --git a/src/worker/modules/mailbox.js b/src/worker/modules/mailbox.js index 1c0a5e10b..0789fb920 100644 --- a/src/worker/modules/mailbox.js +++ b/src/worker/modules/mailbox.js @@ -14,7 +14,7 @@ const factory = (Util, Hash, var TYPES = [ 'notifications', 'supportteam', - 'broadcast' + //'broadcast' ]; var BLOCKING_TYPES = [ ]; diff --git a/src/worker/modules/profile.js b/src/worker/modules/profile.js index 41d509449..e9c14b8b7 100644 --- a/src/worker/modules/profile.js +++ b/src/worker/modules/profile.js @@ -119,6 +119,14 @@ const factory = (Util, Hash, Constants, Realtime, Messaging.updateMyData(ctx.store); ctx.updateMetadata(); }); + } else if (key === 'avatar') { + ctx.Store.set(null, { + key: ['profile', 'avatar'], + value: value || "" + }, () => { + Messaging.updateMyData(ctx.store); + ctx.updateMetadata(); + }); } cb(ctx.listmap.proxy); }); diff --git a/www/admin/inner.js b/www/admin/inner.js index 0940103df..00765e344 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -568,7 +568,7 @@ define([ row(Messages.admin_planName, data.plan || Messages.ui_none); // plan note - row(Messages.admin_creation_note, data.note || Messages.ui_none); + row(Messages.admin_note, data.note || Messages.ui_none); // storage limit if (data.limit) { row(Messages.admin_planlimit, getPrettySize(data.limit)); } @@ -1415,6 +1415,7 @@ define([ }); var getBlockId = (val) => { + if (val.length === 44) { return val; } var url; try { url = new URL(val, ApiConfig.httpUnsafeOrigin); diff --git a/www/calendar/export.js b/www/calendar/export.js index e6662eee0..09f262756 100644 --- a/www/calendar/export.js +++ b/www/calendar/export.js @@ -52,7 +52,7 @@ define([ module.main = function (userDoc) { - var content = userDoc.content; + var content = userDoc.content || {}; var ICS = [ 'BEGIN:VCALENDAR', @@ -227,7 +227,7 @@ define([ if (ud.from) { // "From" updates are not supported by ICS: make a new event var _new = Util.clone(prev); - r.until = getICSDate(d - 1); // Stop previous recursion + r.until = d - 1; // Stop previous recursion delete r.count; addEvent(ICS, prev, null); // Add previous event Array.prototype.push.apply(ICS, toAdd); // Add individual updates diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index 9012ac5e1..d74378505 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -233,6 +233,11 @@ const factory = () => { // NOTE: this is only enforced client-side and will not prevent malicious clients from storing data AppConfig.disableAnonymousPadCreation = false; + // If your application is meant to be used exclusively with the + // integration API, you can disable the direct access to the app by + // setting integrationOnly to true + AppConfig.integrationOnly = false; + // Hide the usage bar in settings and drive //AppConfig.hideUsageBar = true; diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 12928d062..ed0bbe38f 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -282,7 +282,7 @@ define([ ]); }; - UI.tokenField = function (target, autocomplete) { + UI.tokenField = function (target, autocomplete, close = null) { var t = { element: target || h('input'), }; @@ -350,6 +350,9 @@ define([ }); $form.append($input); $form.append($button); + if (close) { + $form.append(close); + } if (isEdit) { $button.find('span').text(Messages.tag_edit); } else { $button.find('span').text(Messages.add); } $container.append($form); diff --git a/www/common/common-login.js b/www/common/common-login.js index 66ce9c034..141e25621 100644 --- a/www/common/common-login.js +++ b/www/common/common-login.js @@ -123,7 +123,12 @@ define([ var legacyLogin = function (opt, isRegister, cb, res) { res = res || {}; loadUserObject(opt, function (err, rt) { - if (err) { return void cb(err); } + if (err) { + // If the channel is empty, it probably means the credentials + // are invalid + console.error(err); + return void cb('NO_SUCH_USER'); + } // if a proxy is marked as deprecated, it is because someone had a non-owned drive // but changed their password, and couldn't delete their old data. @@ -316,6 +321,13 @@ define([ res.opt = allocateBytes(bytes); res.blockHash = res.opt.blockHash; blockKeys = res.opt.blockKeys; + if (window.location.hash === '#debug') { + alert(JSON.stringify({ + blockId: Util.encodeBase64(blockKeys.sign.publicKey) + }, 0, 2)); + waitFor.abort(); + return; + } if (ssoAuth && ssoAuth.name) { uname = res.uname = ssoAuth.name; } })); }).nThen(function (waitFor) { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 781643ba9..a559d7fc5 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -896,10 +896,6 @@ define([ button = makeButton('print', 'cp-toolbar-icon-print', Messages.printButtonTitle2, Messages.printText); break; case 'history': - if (!AppConfig.enableHistory) { - button = $(''); - break; - } button = makeButton('history', 'cp-toolbar-icon-history', Messages.historyButton, Messages.historyText, Messages.historyButton); if (data.histConfig) { button.click(common.prepareFeedback(type)).on('click', function () { @@ -907,6 +903,9 @@ define([ UI.clearTooltipsDelay(); }); } + if (!AppConfig.enableHistory) { + button.css('display', 'none'); + } break; case 'mediatag': button = $(h('button.cp-toolbar-mediatag', { @@ -1378,7 +1377,7 @@ define([ var apps = { pad: 'richtext', - code: 'code-pad', + code: 'code', slide: 'slides', sheet: 'sheets', poll: 'poll', @@ -4523,6 +4522,259 @@ define([ observer.start(); }; + var lexicographicCompare = function(a, b) { + if (!Array.isArray(a)) { + a = [a]; + } + if (!Array.isArray(b)) { + b = [b]; + } + + if (a.length === 0 && b.length === 0) { + return 0; + } else if (a.length === 0) { + return -1; + } else if (b.length === 0) { + return 1; + } else if (typeof (a[0]) !== typeof (b[0])) { + return String(a[0]) < String(b[0]) ? -1 : 1; + } else { + if (a[0] < b[0]) { + return -1; + } else if (a[0] > b[0]) { + return 1; + } else { + return lexicographicCompare(a.slice(1), b.slice(1)); + } + } + }; + + var splitStringToTextAndNumbers = function(s) { + var textOrDigitsRe = /(?\D+)?(?\d+)?/g; + var split = []; + + for (var match of s.matchAll(textOrDigitsRe)) { + if (match.groups.text !== undefined) { + split.push(match.groups.text); + } + if (match.groups.digits !== undefined) { + split.push(parseInt(match.groups.digits)); + } + } + + return split; + }; + + var naturalSort = function(a, b) { + if (typeof(a) === "string") { + a = splitStringToTextAndNumbers(a); + } + if (typeof(b) === "string") { + b = splitStringToTextAndNumbers(b); + } + + var comp = lexicographicCompare(a, b); + return comp; + }; + + var isSubpath = function(child, parentPath) { + if (!child || !parentPath || child.length <= parentPath.length) { return false; } + for (var i = 0; i < parentPath.length; i++) { + if (child[i] !== parentPath[i]) { return false; } + } + return true; + }; + + var shouldBeOpened = function(path, openFolders, currentPath) { + if (openFolders && openFolders.length) { + for (var i = 0; i < openFolders.length; i++) { + var openPath = openFolders[i]; + if (JSON.stringify(openPath) === JSON.stringify(path)) { + return true; + } + } + } + // Auto-expand parent folders of current path + if (currentPath && isSubpath(currentPath, path) && path.length < currentPath.length) { + if (currentPath.length > 0 && currentPath.length - path.length > 1) { // only auto-expand if currentPath is at least 2 levels deeper than the folder path + return true; + } + } + return false; + }; + + UIElements.createTreeElement = function (name, $icon, path, draggable, droppable, collapsable, active, events, openFolders, currentPath, cb) { + events = events || {}; + openFolders = openFolders || []; + currentPath = currentPath || null; + cb = cb || {}; + var $expandIcon = $(Icons.get('chevron-right')); + var $expandedIcon = $(Icons.get('chevron-down')); + + var $name = $('', { 'class': 'cp-app-drive-element' }).text(name); + var $collapse; + if (collapsable) { + $collapse = $('').attr('tabindex', 0).attr('class', 'cp-app-drive-icon-expcol').append($expandIcon.clone()); + } + var $elementRow = $('', { + 'class': 'cp-app-drive-element-row cp-app-drive-element-folder', + 'tabindex': 0 + }).append($collapse).append($icon).append($name).on('click keypress', function (e) { + if (e.type === 'keypress' && e.which !== 13) { + return; + } + e.stopPropagation(); + if (events.onFolderClicked) { + events.onFolderClicked(path, e); + } + }); + + if (events.onContextMenu) { + $elementRow.on('contextmenu', function(e) { + e.preventDefault(); + e.stopPropagation(); + events.onContextMenu(path, e); + }); + } + + var $element = $('
  • ').append($elementRow); + if (draggable) { + $elementRow.attr('draggable', true); + } + if (collapsable) { + $element.addClass('cp-app-drive-element-collapsed'); + $collapse.attr({ + 'aria-expanded': 'false', + 'role': 'button', + 'aria-label': Messages.ui_expand + }); + $collapse.on('click keypress', function(e) { + if (e.type === 'keypress' && e.which !== 13) { + return; + } + e.stopPropagation(); + if ($element.hasClass('cp-app-drive-element-collapsed')) { + $element.removeClass('cp-app-drive-element-collapsed'); + $collapse.empty().append($expandedIcon.clone()); + $collapse.attr('aria-expanded', 'true'); + $collapse.attr('aria-label', Messages.ui_collapse); + if (events.onFolderExpanded) { + events.onFolderExpanded(path, true); + } + } else { + $element.addClass('cp-app-drive-element-collapsed'); + $collapse.empty().append($expandIcon.clone()); + $collapse.attr('aria-expanded', 'false'); + $collapse.attr('aria-label', Messages.ui_expand); + if (events.onFolderExpanded) { + events.onFolderExpanded(path, false); + } + } + }); + // Auto-expand if explicitly marked as opened + var shouldExpand = shouldBeOpened(path, openFolders, currentPath); + + if (shouldExpand) { + $element.removeClass('cp-app-drive-element-collapsed'); + $collapse.empty().append($expandedIcon.clone()); + $collapse.attr('aria-expanded', 'true'); + $collapse.attr('aria-label', Messages.ui_collapse); + } + } + $elementRow.data('path', path); + if (typeof cb.addDragAndDropHandlers === 'function') { + cb.addDragAndDropHandlers($elementRow, path, true, droppable); + } + if (active) { + $elementRow.addClass('cp-app-drive-element-active cp-leftside-active'); + } + return $element; + }; + + UIElements.getTree = function (data, config) { + config = config || {}; + config.events = config.events || {}; + config.cb = config.cb || {}; + config.openFolders = config.openFolders || []; + config.currentPath = config.currentPath || null; + + var $folderIcon = $(Icons.get('folder')); + var $folderOpenedIcon = $(Icons.get('folder-open')); + + + var createTree = function ($container, folderData, path) { + if (!folderData || !folderData.content) { return; } + + var $list = $('
      ').appendTo($container); + var keys = Object.keys(folderData.content).sort(function (a, b) { + var nameA = folderData.content[a].name || a; + var nameB = folderData.content[b].name || b; + return naturalSort(nameA, nameB); + }); + + keys.forEach(function (key) { + var item = folderData.content[key]; + if (!item) { return; } + + var name = item.name || key; + var newPath; + if (item.navPath) { + newPath = item.navPath; + } else { + // Fallback: reconstruct from parent path (for backwards compatibility) + var p = path.slice(); + p.push(key); + newPath = p; + } + var $icon; + if (item.icon) { + if (typeof item.icon === 'string') { + $icon = $(Icons.get(item.icon)); + } else { + $icon = $(item.icon); + } + } else { + var shouldShowOpened = shouldBeOpened(newPath, config.openFolders, config.currentPath); + $icon = shouldShowOpened ? $folderOpenedIcon.clone() : $folderIcon.clone(); + } + + var hasSubfolder = item.content && Object.keys(item.content).length > 0; + var isActive = item.isActive !== undefined ? item.isActive : (config.currentPath && JSON.stringify(newPath) === JSON.stringify(config.currentPath)); + var $element = UIElements.createTreeElement(name, $icon.clone(), newPath, true, true, hasSubfolder, isActive, config.events, config.openFolders, config.currentPath, config.cb); + $element.appendTo($list); + + if (hasSubfolder) { + createTree($element, item, newPath); + } + }); + }; + var content = []; + var rootKey = Object.keys(data)[0]; + var rootData = data[rootKey]; + + if (rootData) { + var rootName = rootData.name || Messages.fm_rootName; + var $rootIcon = rootData.icon ? + (typeof rootData.icon === 'string' ? $(Icons.get(rootData.icon)) : $(rootData.icon)) : + $(Icons.get('drive')); + + var hasContent = rootData.content && Object.keys(rootData.content).length > 0; + var isRootActive = config.currentPath && JSON.stringify([rootKey]) === JSON.stringify(config.currentPath); + var $rootElement = UIElements.createTreeElement(rootName, $rootIcon, [rootKey], false, true, hasContent, isRootActive, config.events, config.openFolders, config.currentPath, config.cb); + $rootElement.addClass('cp-app-drive-tree-root'); + + if (!hasContent) { + $rootElement.find('.cp-app-drive-icon-expcol').addClass('cp-icon-hidden').attr('tabindex','-1'); + } + var $rootList = $('
        ', {'class': 'cp-app-drive-tree-docs'}).append($rootElement); + content.push($rootList[0]); + + if (hasContent) { + createTree($rootElement, rootData, [rootKey]); + } + } + return h('div.cp-drive-tree', content); + }; return UIElements; diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 79285a4a7..df57d82db 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -915,6 +915,7 @@ define([ href: href, title: data.title, owners: optsPut.owners, + attributes: common?.otherPadAttrs || {}, path: ['template'] }, function (obj) { if (obj && obj.error) { return void cb(obj.error); } @@ -1170,7 +1171,7 @@ define([ // Make sure we also store additionnal data to pin all the channels // (OO and forms) - data.attributes = {}; + data.attributes ||= {}; Object.keys(common?.otherPadAttrs || {}).forEach(k => { data.attributes[k] = common.otherPadAttrs[k]; }); @@ -1197,7 +1198,7 @@ define([ return; } - let attributes = {}; + let attributes = data.attributes || {}; nThen(function (waitFor) { if (parsed.hashData.type !== 'pad') { return; } // Set the correct owner and expiration time if we can find them diff --git a/www/common/diffMarked.js b/www/common/diffMarked.js index ff13b95e0..02a9782b0 100644 --- a/www/common/diffMarked.js +++ b/www/common/diffMarked.js @@ -447,11 +447,17 @@ define([ if (restrictedTags.indexOf(root.nodeName.toUpperCase()) === -1) { return true; } return root.getAttribute && /^(blob\:|\/lib\/pdfjs)/.test(root.getAttribute('src')); }; + // Remove any iframe with srcdoc attribute + var checkSrcDoc = function (root) { + if (restrictedTags.indexOf(root.nodeName.toUpperCase()) === -1) { return true; } + return !(root.getAttribute && root.getAttribute('srcdoc')); + }; var removeForbiddenTags = function (root) { if (!root) { return; } if (forbiddenTags.indexOf(root.nodeName.toUpperCase()) !== -1) { removeNode(root); } - if (!checkSrc(root)) { removeNode(root); } + if (!checkSrc(root)) { removeNode(root); } + if (!checkSrcDoc(root)) { removeNode(root); } slice(root.children).forEach(removeForbiddenTags); }; diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 0466f4e3b..0df7ce3d1 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -115,7 +115,7 @@ define([ var $folderIcon = $(Icons.get(folder,{"class": "cp-app-drive-icon-folder cp-app-drive-content-icon"})); var $fileMenuIcon = $(Icons.get('ellipsis-horizontal')); var $folderEmptyIcon = $folderIcon.clone(); - var $folderOpenedIcon = $(Icons.get('folder-open')); + var $folderOpenedIcon = $(Icons.get('folder-open', {"class": "cp-app-drive-icon-folder cp-app-drive-content-icon"})); var $folderOpenedEmptyIcon = $folderOpenedIcon.clone(); var $sharedFolderIcon = $(Icons.get('drive-shared-folder', {"class": "cp-app-drive-icon-folder"})); var $sharedFolderOpenedIcon = $(Icons.get('folder-open', {"class": "cp-app-drive-icon-folder"})); @@ -124,8 +124,6 @@ define([ var $recentIcon = $(Icons.get('drive-recent')); var $trashIcon = $(Icons.get('trash-full')); var $trashEmptyIcon = $(Icons.get('trash-empty')); - var $expandIcon = $(Icons.get('expand')); - var $expandedIcon = $(Icons.get('collapse')); var $sortAscIcon = $(Icons.get('sort-asc', {'class': 'sortasc'})); var $sortDescIcon = $(Icons.get('sort-desc', {'class': 'sortdesc'})); var $closeIcon = $(Icons.get('close')); @@ -194,6 +192,18 @@ define([ var stored = JSON.parse(APP.store[LS_OPENED] || '[]'); return stored.indexOf(JSON.stringify(path)) !== -1; }; + LS.getOpenedFolders = function () { + var stored = JSON.parse(APP.store[LS_OPENED] || '[]'); + return stored.map(function(s) { + try { + return JSON.parse(s); + } catch (e) { + return null; + } + }).filter(function(p) { + return p !== null; + }); + }; LS.setFolderOpened = function (path, opened) { var s = JSON.stringify(path); var stored = JSON.parse(APP.store[LS_OPENED] || '[]'); @@ -501,6 +511,7 @@ define([ h("ul.dropdown-menu", getNewPadTypes().map(function (app) { return isAppEnabled(app) ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable' + (restricted[app] === 0 ? '.cp-app-disabled' : ''), { 'tabindex': '-1', + 'data-type': app, },[ Icons.get(AppConfig.applicationsIcon[app] || 'file'), Messages.type[app] @@ -930,7 +941,13 @@ define([ var removeInput = function (cancel) { if (!cancel && $('.cp-app-drive-element-row > input').length === 1) { var $input = $('.cp-app-drive-element-row > input'); - manager.rename($input.data('path'), $input.val(), APP.refresh); + manager.rename($input.data('path'), $input.val(), function (err) { + if (err && err.error === 'E_DUPLICATE_FOLDER_NAME') { + UI.alert(err.message || Messages.fo_unavailableName); + return; + } + APP.refresh(); + }); } $('.cp-app-drive-element-row > input').remove(); $('.cp-app-drive-element-row > span:hidden').removeAttr('style'); @@ -945,7 +962,7 @@ define([ // Replace a file/folder name by an input to change its value var displayRenameInput = function ($element, path) { // NOTE: setTimeout(f, 0) otherwise the "rename" button in the toolbar is not working - window.setTimeout(function () { + var renameInput = function () { if (!APP.editable) { return; } if (!path || path.length < 2) { logError("Renaming a top level element (root, trash or filesData) is forbidden."); @@ -978,7 +995,11 @@ define([ removeInput(true); var newName = $input.val(); if (JSON.stringify(path) === JSON.stringify(currentPath)) { - manager.rename(path, $input.val(), function () { + manager.rename(path, $input.val(), function (err) { + if (err && err.error === 'E_DUPLICATE_FOLDER_NAME') { + UI.alert(err.message || Messages.fo_unavailableName); + return; + } if (isFolder) { LS.renameFoldersOpened(path, newName); path[path.length - 1] = newName; @@ -987,7 +1008,11 @@ define([ }); } else { - manager.rename(path, $input.val(), function () { + manager.rename(path, $input.val(), function (err) { + if (err && err.error === 'E_DUPLICATE_FOLDER_NAME') { + UI.alert(err.message || Messages.fo_unavailableName); + return; + } if (isFolder) { LS.renameFoldersOpened(path, newName); unselectElement($element); @@ -1032,7 +1057,12 @@ define([ e.stopPropagation(); $input.parents('.cp-app-drive-element-row').attr("draggable", true); }); - },0); + }; + if (APP.mobile()) { + renameInput(); + } else { + window.setTimeout(renameInput, 0); + } }; @@ -1851,7 +1881,15 @@ define([ if (manager.isPathIn(newPath, [TRASH]) && paths.length && paths[0][0] === TRASH) { return; } - var newCb = function () { + var newCb = function (err) { + if (err && err.error === 'E_DUPLICATE_FOLDER_NAME') { + UI.alert(err.message || Messages.fo_unavailableName); + paths.forEach(function (path) { + LS.moveFoldersOpened(path, newPath); + }); + cb(); + return; + } paths.forEach(function (path) { LS.moveFoldersOpened(path, newPath); }); @@ -1888,10 +1926,17 @@ define([ var onDrag = function (ev, path) { var paths = []; var $element = findDataHolder($(ev.target)); + var getRefPath = function(navPath) { + if (navPath && navPath.length > 1 && navPath[navPath.length - 1] === ROOT) { + return navPath.slice(0, -1); + } + return navPath; + }; if ($element.hasClass('cp-app-drive-element-selected')) { var $selected = findSelectedElements(); $selected.each(function (idx, elmt) { - var ePath = $(elmt).data('path'); + var navPath = $(elmt).data('path'); + var ePath = getRefPath(navPath); if (ePath) { var val = manager.find(ePath); if (!val) { return; } // Error? A ".selected" element is not in the object @@ -1907,12 +1952,13 @@ define([ } else { removeSelected(); selectElement($element); - var val = manager.find(path); + var dragPath = getRefPath(path); + var val = manager.find(dragPath); if (!val) { return; } // The element is not in the object paths = [{ - path: path, + path: dragPath, value: { - name: getElementName(path), + name: getElementName(dragPath), el: val } }]; @@ -2074,6 +2120,18 @@ define([ return void UI.warn(Messages.fm_forbidden); } + if (newPath[0] === TEMPLATE) { + var oldPaths = data && JSON.parse(data).path; + if (oldPaths && oldPaths.length) { + var hasFolder = oldPaths.some(function(p) { + var el = manager.find(p.path); + return manager.isFolder(el); + }); + if (hasFolder) { + return void UI.warn(Messages.fo_moveUnsortedError); + } + } + } var fileDrop = ev.dataTransfer.items; if (fileDrop.length) { // Filter out all the folders and use the correct function to upload them @@ -2106,26 +2164,46 @@ define([ } } - var oldPaths = data && JSON.parse(data).path; + oldPaths = data && JSON.parse(data).path; if (!oldPaths) { return; } // A moved element should be removed from its previous location var movedPaths = []; var sharedF = false; + var draggedSharedFolder = false; + var folderContainsSharedFolder = false; oldPaths.forEach(function (p) { movedPaths.push(p.path); if (!sharedF && manager.isInSharedFolder(p.path)) { sharedF = true; } + if (!draggedSharedFolder && p.value && p.value.el && manager.isSharedFolder(p.value.el)) { + draggedSharedFolder = true; + } + if (!folderContainsSharedFolder && p.value && p.value.el && manager.hasSubSharedFolder(p.value.el)) { + folderContainsSharedFolder = true; + } }); + if (draggedSharedFolder && manager.isInSharedFolder(newPath)) { + return void UI.warn(Messages.fo_sharedFolder_move_error); + } + if (manager.isPathIn(newPath, [SHARED_FOLDER])) { + return void UI.warn(Messages.fo_sharedFolder_move_error); + } if (sharedF && manager.isPathIn(newPath, [TRASH])) { // TODO create a key here? // You can't move to YOUR trash documents stored in a shared folder // TODO or keep deletePaths: trigger the "Remove from cryptdrive" modal - return void UI.warn(Messages.error); + return void UI.warn(Messages.fo_trash_move_error); //return void deletePaths(null, movedPaths); } + if (folderContainsSharedFolder) { + var destEl = manager.find(newPath); + if (manager.isInSharedFolder(newPath) || (destEl && manager.hasSubSharedFolder(destEl))) { + return void UI.warn(Messages.fo_sharedFolder_move_error); + } + } var copy = false; if (ev.ctrlKey || (ev.metaKey && APP.isMac)) { @@ -3357,13 +3435,11 @@ define([ var SORT_FILE_BY = 'sortFilesBy'; var SORT_FILE_DESC = 'sortFilesDesc'; - var getSortFolderDesc = function () { // this way the icon change is triggered - var v = APP.store[SORT_FOLDER_DESC]; - return v === true; - }; var getSortFileDesc = function () { - var v = APP.store[SORT_FILE_DESC]; - return v === true; + return APP.store[SORT_FILE_DESC]+"" === "true"; + }; + var getSortFolderDesc = function () { + return APP.store[SORT_FOLDER_DESC]+"" === "true"; }; var onSortByClick = function () { @@ -4349,7 +4425,9 @@ define([ if (!root) { return; } } if (!isVirtual && typeof(root) === "undefined") { - log(Messages.fm_unknownFolderError); + if (!force) { + log(Messages.fm_unknownFolderError); + } debug("Unable to locate the selected directory: ", path); if (path.length === 1 && path[0] === ROOT) { // Somehow we can't display ROOT. We should abort now because we'll @@ -4516,7 +4594,7 @@ define([ appStatus.ready(true); }; - var displayDirectory = APP.displayDirectory = function (path, force, cb, opt) { + APP.displayDirectory = function (path, force, cb, opt) { cb = Util.once(cb || function () {}); if (APP.closed || (APP.$content && !$.contains(document.documentElement, APP.$content[0]))) { return; } if (history.isHistoryMode) { @@ -4540,8 +4618,9 @@ define([ let fpath = currentPath; if (opt?.init && !manager.isInSharedFolder(fpath) && !priv.anonSFHref) { fixTags(); - _displayDirectory(path, force); - cb(); + // Wait for shared folder metadata + // _displayDirectory(path, force); + // cb(); } updateSharedFolders(sframeChan, manager, files, folders, function () { _displayDirectory(path, force); @@ -4551,75 +4630,58 @@ define([ }); }; - var createTreeElement = function (name, $icon, path, draggable, droppable, collapsable, active, isSharedFolder) { - var $name = $('', { 'class': 'cp-app-drive-element' }).text(name); - $icon.css("color", isSharedFolder ? getFolderColor(path.slice(0, -1)) : getFolderColor(path)); - var $collapse; - if (collapsable) { - $collapse = $('').attr('tabindex', 0).attr('class', 'cp-app-drive-icon-expcol').append($expandIcon.clone()); - } - var $elementRow = $('', { - 'class': 'cp-app-drive-element-row cp-app-drive-element-folder', - 'tabindex': 0 - }).append($collapse).append($icon).append($name).on('click keypress', function (e) { - if (e.type === 'keypress' && e.which !== 13) { - return; + // Build tree data recursively + var buildTreeData = function (root, path, currentPath) { + var data = { content: {} }; + var keys = Object.keys(root); + keys.forEach(function (key) { + // Do not display files in the menu + if (!manager.isFolder(root[key])) { return; } + var newPath = path.slice(); + newPath.push(key); + var isSharedFolder = manager.isSharedFolder(root[key]) && root[key]; + var sfId = manager.isInSharedFolder(newPath) || (isSharedFolder && root[key]); + var $icon, isCurrentFolder, subfolder, folderName = key; + var randomKey = Util.uid(); + var navPath = newPath.slice(); + if (isSharedFolder) { + // Fix path + newPath.push(manager.user.userObject.ROOT); + isCurrentFolder = manager.comparePath(newPath, currentPath); + // Subfolders? + var newRoot = Util.find(manager, ['folders', sfId, 'proxy', manager.user.userObject.ROOT]) || {}; + subfolder = manager.hasSubfolder(newRoot); + // Fix name + var sfData = manager.getSharedFolderData(sfId); + folderName = sfData.title || sfData.lastTitle || Messages.fm_deletedFolder; + // Fix icon + $icon = isCurrentFolder ? $sharedFolderOpenedIcon : $sharedFolderIcon; + isSharedFolder = sfId; + } else { + var isEmpty = manager.isFolderEmpty(root[key]); + subfolder = manager.hasSubfolder(root[key]); + isCurrentFolder = manager.comparePath(newPath, currentPath); + $icon = isEmpty ? + (isCurrentFolder ? $folderOpenedEmptyIcon : $folderEmptyIcon) : + (isCurrentFolder ? $folderOpenedIcon : $folderIcon); } - e.stopPropagation(); - if (isSharedFolder && !manager.folders[isSharedFolder]) { - UI.warn(Messages.fm_deletedFolder); - return; - } - if (files.restrictedFolders[isSharedFolder]) { - UI.warn(Messages.fm_restricted); - return; - } - APP.displayDirectory(path); - }); - if (files.restrictedFolders[isSharedFolder]) { - $elementRow.addClass('cp-app-drive-element-restricted'); - } - if (isSharedFolder) { - var sfData = manager.getSharedFolderData(isSharedFolder); - _addOwnership($elementRow, $(), sfData); - } - var $element = $('
      • ').append($elementRow); - if (draggable) { $elementRow.attr('draggable', true); } - if (collapsable) { - $element.addClass('cp-app-drive-element-collapsed'); - $collapse.on('click keypress', function(e) { - if (e.type === 'keypress' && e.which !== 13) { - return; + data.content[randomKey] = { + name: folderName, + icon: $icon, + navPath: navPath, + isActive: isCurrentFolder, + content: {} + }; + if (subfolder) { + var subRoot = isSharedFolder ? + Util.find(manager, ['folders', sfId, 'proxy', ROOT]) : + root[key]; + if (subRoot) { + data.content[randomKey].content = buildTreeData(subRoot, newPath, currentPath).content; } - e.stopPropagation(); - if ($element.hasClass('cp-app-drive-element-collapsed')) { - // It is closed, open it - $element.removeClass('cp-app-drive-element-collapsed'); - LS.setFolderOpened(path, true); - $collapse.empty().append($expandedIcon.clone()); - } else { - // Collapse the folder - $element.addClass('cp-app-drive-element-collapsed'); - LS.setFolderOpened(path, false); - $collapse.empty().append($expandIcon.clone()); - // Change the current opened folder if it was collapsed - if (manager.isSubpath(currentPath, path)) { - displayDirectory(path); - } - } - }); - if (LS.wasFolderOpened(path) || - (manager.isSubpath(currentPath, path) && path.length < currentPath.length)) { - $collapse.click(); } - } - var dataPath = isSharedFolder ? path.slice(0, -1) : path; - $elementRow.data('path', dataPath); - addDragAndDropHandlers($elementRow, dataPath, true, droppable); - if (active) { - $elementRow.addClass('cp-app-drive-element-active cp-leftside-active'); - } - return $element; + }); + return data; }; var createTree = function ($container, path) { @@ -4636,93 +4698,112 @@ define([ rootName = manager.getSharedFolderData(APP.newSharedFolder).title; } } - + // don't try to display what doesn't exist if (!root) { return; } - - // Display the root element in the tree - if (isRoot) { - var isRootOpened = manager.comparePath(path.slice(), currentPath); - var $rootIcon = manager.isFolderEmpty(files[ROOT]) ? - (isRootOpened ? $folderOpenedEmptyIcon : $folderEmptyIcon) : - (isRootOpened ? $folderOpenedIcon : $folderIcon); - var $rootElement = createTreeElement(rootName, $rootIcon.clone(), path.slice(), false, true, true, isRootOpened); - if (!manager.hasSubfolder(root)) { - $rootElement.find('.cp-app-drive-icon-expcol').addClass('cp-icon-hidden').attr('tabindex','-1'); + + // build tree data structure + var treeData = buildTreeData(root, path, currentPath); + var data = { + root: { + name: rootName, + icon: $(Icons.get('drive')), + content: treeData.content } - $rootElement.addClass('cp-app-drive-tree-root'); - $rootElement.find('>.cp-app-drive-element-row') - .contextmenu(openContextMenu('tree')); - $('
          ', {'class': 'cp-app-drive-tree-docs'}) - .append($rootElement).appendTo($container); - $container = $rootElement; - } else if (manager.isFolderEmpty(root)) { return; } - - // Display root content - var $list = $('
            ').appendTo($container); - var keys = Object.keys(root).sort(function (a, b) { - var newA = manager.isSharedFolder(root[a]) ? - manager.getSharedFolderData(root[a]).title : a; - var newB = manager.isSharedFolder(root[b]) ? - manager.getSharedFolderData(root[b]).title : b; - return naturalSort(newA, newB); + }; + var openFolders = LS.getOpenedFolders(); + var treeElement = UIElements.getTree(data, { + currentPath: currentPath, + cb: { + addDragAndDropHandlers: addDragAndDropHandlers + }, + events: { + onFolderClicked: function (clickedPath) { + // Check for shared folder restrictions + var sfId = manager.isInSharedFolder(clickedPath); + if (sfId) { + if (!manager.folders[sfId]) { + UI.warn(Messages.fm_deletedFolder); + return; + } + if (files.restrictedFolders[sfId]) { + UI.warn(Messages.fm_restricted); + return; + } + } + APP.displayDirectory(clickedPath); + }, + onContextMenu: function (clickedPath, event) { + openContextMenu('tree')(event, clickedPath); + }, + onFolderExpanded: function (clickedPath, isOpen) { + LS.setFolderOpened(clickedPath, isOpen); + } + }, + openFolders: openFolders }); - keys.forEach(function (key) { - // Do not display files in the menu - if (!manager.isFolder(root[key])) { return; } - var newPath = path.slice(); - newPath.push(key); - var isSharedFolder = manager.isSharedFolder(root[key]) && root[key]; - var sfId = manager.isInSharedFolder(newPath) || (isSharedFolder && root[key]); - var $icon, isCurrentFolder, subfolder; + + var $treeElement = $(treeElement); + // Drive specific features + $treeElement.find('.cp-app-drive-element-row').each(function() { + var $row = $(this); + var elPath = $row.data('path'); + if (!elPath || elPath.length === 0) { return; } + var pathToCheck = elPath[0] === ROOT ? elPath : [ROOT].concat(elPath); + var isSharedFolderPath = pathToCheck.length > 1 && pathToCheck[pathToCheck.length - 1] === ROOT; + $row.find('.cp-app-drive-icon-folder').css("color", isSharedFolderPath ? getFolderColor(pathToCheck.slice(0, -1)) : getFolderColor(pathToCheck)); + + var element = manager.find(elPath); + var isSharedFolder = element && manager.isSharedFolder(element); + var sfId = manager.isInSharedFolder(elPath); + var f = null; + var droppable = true; if (isSharedFolder) { - // Fix path - newPath.push(manager.user.userObject.ROOT); - isCurrentFolder = manager.comparePath(newPath, currentPath); - // Subfolders? - var newRoot = Util.find(manager, ['folders', sfId, 'proxy', manager.user.userObject.ROOT]) || {}; - subfolder = manager.hasSubfolder(newRoot); - // Fix name + sfId = element; + f = folders[sfId]; + var editable = !(f && f.readOnly); + droppable = editable; + + $row.addClass('cp-app-drive-element-sharedf'); + if (!editable) { + $row.closest('li').attr('data-ro', true); + } var sfData = manager.getSharedFolderData(sfId); - key = sfData.title || sfData.lastTitle || Messages.fm_deletedFolder; - // Fix icon - $icon = isCurrentFolder ? $sharedFolderOpenedIcon : $sharedFolderIcon; - isSharedFolder = sfId; - } else { - var isEmpty = manager.isFolderEmpty(root[key]); - subfolder = manager.hasSubfolder(root[key]); - isCurrentFolder = manager.comparePath(newPath, currentPath); - $icon = isEmpty ? - (isCurrentFolder ? $folderOpenedEmptyIcon : $folderEmptyIcon) : - (isCurrentFolder ? $folderOpenedIcon : $folderIcon); + _addOwnership($row, $(), sfData); + if (files.restrictedFolders[sfId]) { + $row.addClass('cp-app-drive-element-restricted'); + } + // Update drag/drop handlers if droppable changed for shared folder + $row.off('dragover drop dragenter dragleave'); + addDragAndDropHandlers($row, elPath, true, droppable); + } else if (sfId) { + f = folders[sfId]; + editable = !(f && f.readOnly); + droppable = editable; + if (!editable) { + $row.closest('li').attr('data-ro', true); + } + $row.off('dragover drop dragenter dragleave'); + addDragAndDropHandlers($row, elPath, true, droppable); } - var f = folders[sfId]; - var editable = !(f && f.readOnly); - var $element = createTreeElement(key, $icon.clone(), newPath, true, editable, - subfolder, isCurrentFolder, isSharedFolder); - $element.appendTo($list); - $element.find('>.cp-app-drive-element-row').contextmenu(openContextMenu('tree')); - if (isSharedFolder) { - $element.find('>.cp-app-drive-element-row') - .addClass('cp-app-drive-element-sharedf'); - } - if (sfId && !editable) { - $element.attr('data-ro', true); - } - if (!subfolder) { return; } - createTree($element, newPath); }); + $treeElement.find('.cp-app-drive-element-row').first().removeAttr('draggable'); + $container.append($treeElement); }; var createTrash = function ($container, path) { var $icon = manager.isFolderEmpty(files[TRASH]) ? $trashEmptyIcon.clone() : $trashIcon.clone(); var isOpened = manager.comparePath(path, currentPath); - var $trashElement = createTreeElement(TRASH_NAME, $icon, [TRASH], false, true, false, isOpened); + var $trashElement = UIElements.createTreeElement(TRASH_NAME, $icon, [TRASH], false, true, false, isOpened, { + onFolderClicked: function (clickedPath) { + APP.displayDirectory(clickedPath); + }, + onContextMenu: function (clickedPath, event) { + openContextMenu('trashtree')(event, clickedPath); + } + }, [], currentPath, { addDragAndDropHandlers: addDragAndDropHandlers }); $trashElement.addClass('cp-app-drive-tree-root'); - $trashElement.find('>.cp-app-drive-element-row') - .contextmenu(openContextMenu('trashtree')); - var $trashList = $('
              ', { 'class': 'cp-app-drive-tree-category' }) - .append($trashElement); + var $trashList = $('
                ', { 'class': 'cp-app-drive-tree-category' }).append($trashElement); $container.append($trashList); }; @@ -4756,7 +4837,11 @@ define([ var options = categories[cat]; var $icon = options.$icon.clone(); var isOpened = manager.comparePath([cat], currentPath); - var $element = createTreeElement(options.name, $icon, [cat], options.draggable, options.droppable, false, isOpened); + var $element = UIElements.createTreeElement(options.name, $icon, [cat], false, options.droppable, false, isOpened, { + onFolderClicked: function (clickedPath) { + APP.displayDirectory(clickedPath); + } + }, [], currentPath, { addDragAndDropHandlers: addDragAndDropHandlers }); $element.addClass('cp-app-drive-tree-root'); var $list = $('
                  ', { 'class': 'cp-app-drive-tree-category' }).append($element); $container.append($list); @@ -4865,6 +4950,12 @@ define([ opts.noExpiration = true; } + let attr = opts.attributes = {}; + if (data.rtChannel) { attr.rtChannel = data.rtChannel; } + if (data.lastVersion) { attr.lastVersion = data.lastVersion; } + if (data.lastCpHash) { attr.lastCpHash = data.lastCpHash; } + if (data.answersChannel) { attr.answersChannel = data.answersChannel; } + Access.getAccessModal(common, opts, cb); }; @@ -5055,9 +5146,15 @@ define([ $this.hasClass('cp-app-drive-context-collapseall')) { if (paths.length !== 1) { return; } var opened = $this.hasClass('cp-app-drive-context-expandall'); + var collapsedPath = paths[0].path; var openRecursive = function (path) { LS.setFolderOpened(path, opened); var folderContent = manager.find(path); + if (folderContent && manager.isSharedFolder(folderContent)) { + path = path.concat(manager.user.userObject.ROOT); + folderContent = manager.find(path); + } + if (!folderContent) { return; } var subfolders = []; for (var k in folderContent) { if (manager.isFolder(folderContent[k])) { @@ -5071,11 +5168,19 @@ define([ } subfolders.forEach(function (p) { var subPath = path.concat(p); + if (Array.isArray(p) && p.length > 1 && p[p.length - 1] === ROOT) { + var sharedFolderPath = subPath.slice(0, -1); + LS.setFolderOpened(sharedFolderPath, opened); + } openRecursive(subPath); }); }; - openRecursive(paths[0].path); - refresh(); + openRecursive(collapsedPath); + if (!opened && currentPath && manager.isSubpath(currentPath, collapsedPath)) { + APP.displayDirectory(collapsedPath); + } else { + refresh(); + } } else if ($this.hasClass('cp-app-drive-context-download')) { diff --git a/www/common/inner/access.js b/www/common/inner/access.js index 78177f252..76ab167da 100644 --- a/www/common/inner/access.js +++ b/www/common/inner/access.js @@ -18,6 +18,25 @@ define([ Messages, nThen, Icons) { var Access = {}; + const getOtherChans = (priv, opts) => { + // "attributes" contains the additional channels that the other user + // has to store (rtChannel, answersChannels, lastVersion, lastCpHash) + // - opts.attributes when access modal is created from the drive + // - liveAttr when access modal is created from the document + let liveAttr = Util.clone(priv.propChannels || {}); + delete liveAttr.channel; + let attributes = opts.attributes || liveAttr; + + // "otherChan" contains the list of channels that should also receive + // the ownership changes + let otherChan = []; + if (attributes?.answersChannel) { otherChan.push(attributes.answersChannel); } + if (attributes?.rtChannel) { otherChan.push(attributes.rtChannel); } + if (!otherChan.length) { otherChan = undefined; } + + return { otherChan, attributes }; + }; + var getOwnersTab = function (Env, data, opts, _cb) { var cb = Util.once(Util.mkAsync(_cb)); var common = Env.common; @@ -37,13 +56,10 @@ define([ var teamOwner = data.teamId; var title = opts.title; - var p = priv.propChannels; - var otherChan; - if (p && p.answersChannel) { - otherChan = [p.answersChannel]; - } - opts = opts || {}; + + const { attributes, otherChan } = getOtherChans(priv, opts); + var redrawAll = function () {}; var addBtn = h('button.btn.btn-primary.cp-access-add', [Icons.get('arrow-left'), Icons.get('arrow-up')]); @@ -337,6 +353,7 @@ define([ : Messages.error; return void UI.warn(text); } + data.attributes = attributes; sframeChan.query('Q_ACCEPT_OWNERSHIP', data, function (err, res) { if (err || (res && res.error)) { return void console.error(err || res.error); @@ -354,6 +371,7 @@ define([ if (!friend) { return; } common.mailbox.sendTo("ADD_OWNER", { channel: data.channel || priv.channel, + attributes, channels: otherChan, href: href, calendar: opts.calendar, @@ -440,11 +458,7 @@ define([ var allowed = data.allowed || []; var teamOwner = data.teamId; - var p = priv.propChannels; - var otherChan; - if (p && p.answersChannel) { - otherChan = [p.answersChannel]; - } + const { otherChan } = getOtherChans(priv, opts); var redrawAll = function () {}; @@ -854,6 +868,8 @@ define([ var metadataMgr = common.getMetadataMgr(); var priv = metadataMgr.getPrivateData(); + const { otherChan } = getOtherChans(priv, opts); + var $div = $(h('div.cp-share-columns')); if (priv.offline) { @@ -1069,13 +1085,15 @@ define([ if (err || (obj && obj.error)) { UI.warn(Messages.error); } }); - // If this is a form wiht a answer channel, delete it too - var p = priv.propChannels; - if (p && p.answersChannel) { - sframeChan.query('Q_DELETE_OWNED', { - teamId: typeof(owned) !== "boolean" ? owned : undefined, - channel: p.answersChannel - }, function () {}); + // If this is a form with an answer channel or an office + // doc with an rt channel, delete it too + if (otherChan) { + otherChan.forEach(chan => { + sframeChan.query('Q_DELETE_OWNED', { + teamId: typeof(owned) !== "boolean" ? owned : undefined, + channel: chan + }, function () {}); + }); } }); if (!opts.noEditPassword) { $d.append(h('br')); } diff --git a/www/common/jscolor.js b/www/common/jscolor.js index b1ac6ed8e..a14df6313 100644 --- a/www/common/jscolor.js +++ b/www/common/jscolor.js @@ -14,6 +14,8 @@ * See usage examples at http://jscolor.com/examples/ */ +// NOTE: custom changes for CryptPad: +// - "new Function" code has been commented out for security reasons "use strict"; @@ -62,6 +64,7 @@ var jsc = { } var opts = {}; +/* if (optsStr) { try { opts = (new Function ('return (' + optsStr + ')'))(); @@ -69,6 +72,7 @@ var jsc = { jsc.warn('Error parsing jscolor options: ' + eParseError + ':\n' + optsStr); } } +*/ targetElm.jscolor = new jsc.jscolor(targetElm, opts); } } @@ -685,11 +689,11 @@ var jsc = { dispatchFineChange : function (thisObj) { if (thisObj.onFineChange) { var callback; - if (typeof thisObj.onFineChange === 'string') { - callback = new Function(thisObj.onFineChange); - } else { +// if (typeof thisObj.onFineChange === 'string') { +// callback = new Function(thisObj.onFineChange); +// } else { callback = thisObj.onFineChange; - } +// } callback(thisObj); } }, diff --git a/www/common/metadata-manager.js b/www/common/metadata-manager.js index aa925101f..58d5bb3a8 100644 --- a/www/common/metadata-manager.js +++ b/www/common/metadata-manager.js @@ -85,19 +85,19 @@ define(['json.sortify'], function (Sortify) { dirty = false; if (lazy || lazyUserStr !== Sortify(meta.user)) { metadataLazyObj = JSON.parse(JSON.stringify(metadataObj)); - lazyChangeHandlers.forEach(function (f) { f(); }); + lazyChangeHandlers.slice().forEach(function (f) { f(); }); } else { metadataLazyObj.users = JSON.parse(JSON.stringify(mdo)); } if (metadataObj.title !== rememberedTitle) { rememberedTitle = metadataObj.title; - titleChangeHandlers.forEach(function (f) { + titleChangeHandlers.slice().forEach(function (f) { f(metadataObj.title, metadataObj.defaultTitle); }); } - changeHandlers.forEach(function (f) { f(); }); + changeHandlers.slice().forEach(function (f) { f(); }); }; var change = function (lazy) { dirty = true; @@ -136,7 +136,7 @@ define(['json.sortify'], function (Sortify) { members.push(ev); if (!meta.user) { return; } change(false); - syncHandlers.forEach(function (f) { f(); }); + syncHandlers.slice().forEach(function (f) { f(); }); }); sframeChan.on('EV_RT_LEAVE', function (ev) { var idx = members.indexOf(ev); diff --git a/www/common/notifications.js b/www/common/notifications.js index 30a8d83f6..8b8b6ec4f 100644 --- a/www/common/notifications.js +++ b/www/common/notifications.js @@ -10,14 +10,21 @@ define([ '/common/common-ui-elements.js', '/common/common-util.js', '/common/common-constants.js', + '/components/marked/marked.min.js', '/customize/messages.js', '/customize/pages.js', '/common/common-icons.js', 'tui-date-picker' -], function($, h, Hash, UI, UIElements, Util, Constants, Messages, Pages, Icons, DatePicker) { +], function($, h, Hash, UI, UIElements, Util, Constants, Marked, Messages, Pages, Icons, DatePicker) { var handlers = {}; + var renderer = new Marked.Renderer(); + Marked.setOptions({ + renderer: renderer, + sanitize: true + }); + var defaultDismiss = function(common, data) { return function(e) { if (e) { @@ -531,12 +538,33 @@ define([ var toShow = text[myLang]; // Otherwise, fallback to the default language if it exists if (!toShow && defaultL) { toShow = text[defaultL]; } + toShow ||= text['default']; // No translation available, dismiss if (!toShow) { return defaultDismiss(common, data)(); } var slice = toShow.length > 200; var unsafe = toShow; - toShow = Util.fixHTML(toShow); + + if (content.markdown === true) { + toShow = Marked.parse(toShow); + slice = false; + content.handler = function () { + var content = h('div', [ + h('h4', Messages.broadcast_newCustom), + UI.setHTML(h('div.cp-admin-message'), toShow) + ]); + $(content).find('a').click(e => { + e.preventDefault(); + e.stopPropagation(); + const href = e.target.href || ''; + if (!/^(http|\/)/.test(href)) { return; } + common.openURL(e.target.href); + }); + UI.alert(content); + }; + } else { + toShow = Util.fixHTML(toShow); + } content.getFormatText = function () { if (slice) { @@ -553,7 +581,9 @@ define([ UI.alert(content); }; } - if (!content.archived) { + if (content.dismiss) { + content.dismissHandler = content.dismiss; + } else if (!content.archived) { content.dismissHandler = defaultDismiss(common, data); } }; diff --git a/www/common/onlyoffice/history.js b/www/common/onlyoffice/history.js index cd16adcd7..68a542ec2 100644 --- a/www/common/onlyoffice/history.js +++ b/www/common/onlyoffice/history.js @@ -7,8 +7,9 @@ define([ '/common/common-interface.js', '/common/hyperscript.js', '/common/common-icons.js', + '/common/common-util.js', -], function ($, UI, h, Icons) { +], function ($, UI, h, Icons, Util) { //var ChainPad = window.ChainPad; var History = {}; @@ -27,94 +28,62 @@ define([ var cpIndex = -1; var msgIndex = -1; var ooMessages = {}; + var msgs; var loading = false; - var update = function () {}; var currentTime; + //Defining position here means it can be passed to the showVersion and share functions + var position; + //Defining patch here means it can be passed to the snapshot function + var patch; + var currentVersion; + var forward; + var revertCheckpoint; // Get an array of the checkpoint IDs sorted their patch index var hashes = config.onlyoffice.hashes; - var sortedCp = Object.keys(hashes).map(Number).sort(function (a, b) { - return hashes[a].index - hashes[b].index; - }); + var id; + var sortedCp = Object.keys(hashes).map(Number); + + var getId = function () { + var cps = sortedCp.length; + id = sortedCp[cps -1] || -1; + return id; + }; var endWithCp = sortedCp.length && config.onlyoffice.lastHash === hashes[sortedCp[sortedCp.length - 1]].hash; - var fillOO = function (id, messages) { - if (!id) { return; } - if (ooMessages[id]) { return; } + var fillOO = function (messages) { + ooMessages = {}; ooMessages[id] = messages; - update(); }; if (endWithCp) { cpIndex = 0; } - var $version, $time, $share; + var $version, $share; var $hist = $toolbar.find('.cp-toolbar-history'); $hist.addClass('cp-smallpatch'); $hist.addClass('cp-history-oo'); var $bottom = $toolbar.find('.cp-toolbar-bottom'); var Messages = common.Messages; - var getVersion = function () { - var major = sortedCp.length - cpIndex; - return major + '.' + (msgIndex+1); - }; - var showVersion = function (initial) { - var v = getVersion(); - if (initial) { - v = Messages.oo_version_latest; + var getVersion = function (position, initial, revert) { + let version = (id === -1 || id === 0) ? 0 : id; + if (!Object.keys(ooMessages).length) { + return '0.0'; } - $version.text(Messages.oo_version + v); - - var $pos = $hist.find('.cp-history-timeline-pos'); - var cps = sortedCp.length; - var id = sortedCp[cps - cpIndex -1] || -1; - if (!ooMessages[id]) { return; } - var msgs = ooMessages[id]; - var p = 100*((msgIndex+1) / (msgs.length)); - $pos.css('margin-left', p+'%'); - - var time = msgs[msgIndex] && msgs[msgIndex].time; - currentTime = time; - if (time) { $time.text(new Date(time).toLocaleString()); } - else { $time.text(''); } + if (typeof(position) === "undefined" || position === -1) { + position = ooMessages[id]?.length || 0; + } else if (msgs?.length === position && + id !== parseInt(Object.keys(hashes)[Object.keys(hashes).length-1]) && + !initial && !revert && $(`[data^="${id+1},"][data*=","]`).length > 1) { + version = id+1; + position = 0; + } + return version + '.' + position; }; - // We want to load a checkpoint (or initial state) - var loadMoreOOHistory = function () { - if (!Array.isArray(sortedCp)) { return void console.error("Wrong type"); } - - var cp = {}; - - // Get the checkpoint ID - var id = -1; - if (cpIndex < sortedCp.length) { - id = sortedCp[sortedCp.length - 1 - cpIndex]; - cp = hashes[id]; - } - var nextId = sortedCp[sortedCp.length - cpIndex]; - - // Get the history between "toHash" and "fromHash". This function is using - // "getOlderHistory", that's why we start from the more recent hash - // and we go back in time to an older hash - - // We need to get all the patches between the current cp hash and the next cp hash - - // Current cp or initial hash (invalid hash ==> initial hash) - var toHash = cp.hash || 'NONE'; - // Next cp or last hash - var fromHash = nextId ? hashes[nextId].hash : config.onlyoffice.lastHash; - - msgIndex = -1; - - showVersion(); - if (ooMessages[id]) { - // Cp already loaded: reload OO - loading = false; - return void config.onCheckpoint(cp); - } - + var getMessages = function(fromHash, toHash, callback) { sframeChan.query('Q_GET_HISTORY_RANGE', { channel: config.onlyoffice.channel, lastKnownHash: fromHash, @@ -123,20 +92,77 @@ define([ if (err) { return void console.error(err); } if (!Array.isArray(data.messages)) { return void console.error('Not an array!'); } - // The first "cp" in history is the empty doc. It doesn't include the first patch - // of the history - var initialCp = cpIndex === sortedCp.length || !cp.hash; + var isEmptyPatch = function(msg) { + return msg?.changes?.length === 2 && + msg.changes.some(c => c.change.includes('64;AgAAA')) && + msg.changes.some(c => c.change.includes('18;BgAAA') || c.change.includes('23;BgAAAD')); + }; - var messages = (data.messages || []).slice(initialCp ? 0 : 1); + var messages; + if (data.messages[0] && hashes[id]?.index > JSON.parse(data.messages?.[0]?.msg).changesIndex+1 ) { + messages = []; + } else if (config.docType() === 'spreadsheet' && toHash === 'NONE') { + messages = (data.messages || []); + } else { + messages = (data.messages || []).slice(1); + } + + if (messages[0] && isEmptyPatch(JSON.parse(messages[0].msg))) { + revertCheckpoint = true; + messages.splice(0, 1); + } else if (messages[1] && isEmptyPatch(JSON.parse(messages[1].msg))) { + revertCheckpoint = true; + messages.splice(1, 1); + } else { + revertCheckpoint = false; + } if (config.debug) { console.log(data.messages); } - fillOO(id, messages); + id = typeof(id) !== "undefined" ? id : getId(); + + fillOO(messages); loading = false; - config.onCheckpoint(cp); - $share.show(); + callback(null, messages); }); }; + // We want to load a checkpoint (or initial state) + var loadMoreOOHistory = function () { + return new Promise((resolve, reject) => { + if (!Array.isArray(sortedCp)) { + console.error("Wrong type"); + return reject(); + } + + // Get the checkpoint ID + id = typeof(id) !== "undefined" ? id : getId(); + var cp = hashes[id]; + + // Get the history between "toHash" and "fromHash". This function is using + // "getOlderHistory", that's why we start from the more recent hash + // and we go back in time to an older hash + + // We need to get all the patches between the current cp hash and the next cp hash + + var nextId = hashes[id+1] ? hashes[id+1] : undefined; + // Current cp or initial hash (invalid hash ==> initial hash) + var fromHash = cp?.hash || 'NONE'; + // Next cp or last hash + var toHash = nextId ? nextId.hash : config.onlyoffice.lastHash; + + getMessages(toHash, fromHash, function (err) { + if (err) { + console.error(err); + reject(err); + return; + } + resolve(); + }); + }); + }; + + loadMoreOOHistory(); + var onClose = function () { config.setHistory(false); }; var onRevert = function () { config.onRevert(); @@ -147,51 +173,341 @@ define([ $hist.html('').css('display', 'flex'); $bottom.hide(); - var spinner = UI.makeSpinner($hist); - spinner.spin(); + // UI.spinner($hist).get().show(); - var $fastPrev, $fastNext, $next; + var $fastPrev, $fastNext, $next, $prev; - var getId = function () { - var cps = sortedCp.length; - return sortedCp[cps - cpIndex -1] || -1; - }; - - update = function () { - var cps = sortedCp.length; + var updateButtons = function () { $fastPrev.show(); $next.show(); + $prev.show(); $fastNext.show(); $hist.find('.cp-toolbar-history-next, .cp-toolbar-history-previous') .prop('disabled', ''); - if (cpIndex >= cps && msgIndex === 0) { + + if ((id === -1 || id === 0) && (ooMessages[id]?.length+1 === Math.abs(msgIndex) || !ooMessages[id]?.length && id === 0)){ + $prev.prop('disabled', 'disabled'); $fastPrev.prop('disabled', 'disabled'); } - if (cpIndex === 0) { - $fastNext.prop('disabled', 'disabled'); - } - var id = getId(); - var msgs = (ooMessages[id] || []).length; - if (msgIndex >= (msgs-1)) { + var version = currentVersion.split('.'); + var hashesLength = Object.keys(hashes).length; + + if (currentVersion === Messages.oo_version_latest || hashesLength === parseInt(version[0]) && ooMessages[id]?.length === parseInt(version[1]) || + hashesLength+1 === id && (msgIndex === -1) && forward || + hashes[hashesLength-1] === id && !ooMessages[id].length && msgIndex === 0) { $next.prop('disabled', 'disabled'); + $fastNext.prop('disabled', 'disabled'); } }; - var next = function () { - var id = getId(); - if (!ooMessages[id]) { loading = false; return; } - var msgs = ooMessages[id]; - msgIndex++; - var patch = msgs[msgIndex]; - if (!patch) { loading = false; return; } - config.onPatch(patch); - showVersion(); + var loadingFalse = function () { setTimeout(function () { $('iframe').blur(); loading = false; }, 200); }; + var showVersion = function (initial, revert, empty) { + $('.cp-history-timeline-pos-oo').remove(); + $('.cp-history-oo-timeline-pos').removeClass('cp-history-oo-timeline-pos'); + + var currentPatch; + if (initial) { + currentPatch = $('.cp-history-patch').last(); + currentVersion = getVersion(position, initial); + } else if (empty) { + currentPatch = $(`[data="${id},0"]`); + currentVersion = getVersion(position, initial); + } else if ($(`[data="${id},${position}"]`).length) { + currentPatch = $(`[data="${id},${position}"]`); + currentVersion = getVersion(position, initial, true); + } else if (msgs?.length === position && + id !== parseInt(Object.keys(hashes)[Object.keys(hashes).length-1]) ) { + currentPatch = $(`[data="${id+1},0"]`); + currentVersion = getVersion(position, initial); + } + + if (initial || position === msgs?.length && (id === -1 || + id === Object.keys(hashes)[Object.keys(hashes).length-1])) { + currentVersion = Messages.oo_version_latest; + } + + var patchTime = patch ? new Date(patch.time).toLocaleString() : ''; + $version.text(Messages.oo_version + currentVersion + ' ' + patchTime); + var pos = Icons.get('chevron-down', {'class': 'cp-history-timeline-pos-oo'}); + $(currentPatch).addClass('cp-history-oo-timeline-pos').append(pos); + + updateButtons(); + loadingFalse(); + }; + + var displayCheckpointTimeline = function(initial) { + var bar = $hist.find('.cp-history-timeline-container'); + $(bar).addClass('cp-history-timeline-bar').addClass('cp-oohistory-bar-el'); + + msgs = ooMessages[id]; + if (initial) { + var snapshotsEl = []; + var msgsRev = msgs; + } else { + snapshotsEl = Array.from($hist.find('.cp-history-snapshots')[0].childNodes); + msgsRev = msgs.slice().reverse(); + } + + var cpNfInner = common.startRealtime(config); + var md = Util.clone(cpNfInner.metadataMgr.getMetadata()); + var snapshots = md.snapshots; + + var patchWidth; + var patchDiv; + var firstCp = (id === 0) ? true : false; + for (var i = 0; i < msgsRev.length; i++) { + var msg = msgs[i]; + if (initial || id === -1) { + patchWidth = (1/msgs?.length)*100; + } else { + patchWidth = (1/(msgs?.length+Array.from($hist.find('.cp-history-snapshots')[0].childNodes).length))*100; + } + + patchDiv = h('div.cp-history-patch', { + style: 'width:'+patchWidth+'%;', + title: new Date(msgsRev[i].time).toLocaleString(), + data: [id, msgsRev.indexOf(msg)] + }); + if (initial) { + snapshotsEl.push(patchDiv); + } else { + snapshotsEl.unshift(patchDiv); + } + if (snapshots) { + var match = Object.values(snapshots).find(item => item.time === msg.time); + if (match) { $(patchDiv).addClass('cp-history-snapshot').append(Icons.get('snapshot', {title: match.title})); } + } + } + + var finalpatchDiv = h('div.cp-history-patch', { + style: 'width:'+patchWidth+'%; height: 100%; position: relative', + title: new Date().toLocaleString(), + data: [id, msgs?.length] + }); + if (initial) { + snapshotsEl.push(finalpatchDiv); + } else { + firstCp ? snapshotsEl.splice(msgs?.length, 0, finalpatchDiv) : snapshotsEl.splice(msgs?.length-1, 0, finalpatchDiv); + } + + if (!msgsRev.length && !Object.keys(hashes).length || initial && !msgs?.length) { + $(finalpatchDiv).css('width', '100%'); + } else { + $(finalpatchDiv).css('width', `${($(snapshotsEl[snapshotsEl.indexOf(finalpatchDiv)+1])?.width()/ $(snapshotsEl[snapshotsEl.indexOf(finalpatchDiv)+1])?.parent().width())*100}%`); + patchWidth = ($(snapshotsEl[snapshotsEl.indexOf(finalpatchDiv)+1])?.width()/ $(snapshotsEl[snapshotsEl.indexOf(finalpatchDiv)+1])?.parent().width())*100; + } + + var pos = Icons.get('chevron-down', {'class': 'cp-history-timeline-pos-oo'}); + + var patches = h('div.cp-history-snapshots.cp-history-snapshots-oo', [ + snapshotsEl + ]); + $(patches).css('height', '100%'); + $(patches).css('display', 'flex'); + + bar.html('').append([ + patches + ]); + + if (snapshotsEl.length === 1) { + $('.cp-history-patch').css('width', '100%'); + } + if (!initial) { + var finalPatchWidth = patchWidth ? patchWidth : 100/$hist.find('.cp-history-snapshots')[0].childNodes.length; + Array.from($hist.find('.cp-history-snapshots')[0].childNodes).forEach(function(patch) { + $(patch).css('width', `${finalPatchWidth}%`); + }); + } + if (initial) { + $('.cp-history-patch').last().addClass('cp-history-oo-timeline-pos').append(pos); + } + + $('.cp-history-patch').on('click', function(e) { + var patchData = $(e.target).attr('data').split(','); + + var cpNo = parseInt(patchData[0]); + var patchNo = parseInt(patchData[1]); + id = cpNo; + + loadMoreOOHistory().then(() => { + msgs = ooMessages[id]; + if (cpNo === -1) { + var q = msgs.slice(0, patchNo); + config.onPatchBack({}, q); + patch = msgs[patchNo]; + position = (patchNo === msgs?.length) ? msgs?.length : msgs.indexOf(patch); + msgIndex = position === -1 ? -1 : position - msgs?.length-1; + showVersion(false, true); + updateButtons(); + return; + } else if (cpNo === 0 && patchNo === 0) { + config.onPatchBack({}); + patch = msgs[0]; + } else if (!msgs?.length ) { + q = msgs.slice(0, patchNo); + config.onPatchBack(hashes[cpNo], q); + patch = msgs[msgs?.length-1]; + position = patch ? msgs.indexOf(patch)+1 : 0; + msgIndex = position === -1 ? -1 : position - msgs?.length-1; + showVersion(false, false, true); + updateButtons(); + return; + } else if (patchNo === msgs?.length && msgs?.length < $(`[data^="${id},"][data*=","]`).length) { + q = msgs.slice(0, patchNo); + config.onPatchBack(hashes[cpNo], q); + patch = msgs[msgs?.length-1]; + position = patch ? msgs.indexOf(patch)+1 : 0; + msgIndex = position === -1 ? -1 : position - msgs?.length-1; + showVersion(false, true); + updateButtons(); + return; + } else { + q = msgs.slice(0, patchNo); + config.onPatchBack(hashes[cpNo], q); + patch = msgs[patchNo]; + } + position = patch ? msgs.indexOf(patch) : 0; + msgIndex = position === -1 ? -1 : position - msgs?.length-1; + showVersion(false); + updateButtons(); + }); + }); + }; + + var restore; + + var next = async function () { + forward = true; + msgIndex++; + msgs = ooMessages[id]; + var hasHashes = Object.keys(hashes).length; + + if (hasHashes) { + // /Check if the end of the checkpoint has been reached and the next one should be loaded + if (msgIndex === 0) { + id++; + await loadMoreOOHistory(); + msgs = ooMessages[id]; + + // Empty checkpoint (checkpoint created/history restored with no further changes) + if (!msgs?.length) { + config.loadHistoryCp(hashes[id]); + msgs = ooMessages[id]; + msgIndex = -msgs?.length; + patch = msgs[0]; + position = 0; + showVersion(false); + return; + } + //Is the checkpoint the result of restoring history? If yes, we need to load an extra patch + if (revertCheckpoint ) { + msgIndex = -msgs?.length; + config.onPatchBack(hashes[id], [msgs[0]]); + position = 1; + showVersion(false); + } else { + msgIndex = -msgs?.length - 1; + config.loadHistoryCp(hashes[id]); + position = 0; + showVersion(false, true); + } + return; + } + + if (!msgs?.length) { + position = 0; + msgIndex = -1; + id++; + showVersion(false); + return config.loadHistoryCp(hashes[id]); + } + // Adjust msgIndex after fastPrev + if (Math.abs(msgIndex) > msgs?.length) { msgIndex = -msgs?.length; } + } + else if (msgs?.length + msgIndex === -1) { msgIndex++; } + + patch = msgs[msgs?.length + msgIndex]; + position = msgs.indexOf(patch) + 1; + config.onPatch?.(patch); + msgIndex === -1 + ? showVersion(false, true) + : showVersion(false); + }; + + var prev = function () { + forward = false; + msgs = ooMessages[id]; + let hasHashes = Object.keys(hashes).length; + let cp = hasHashes ? hashes[id] : {}; + let loadPrevCp = (!msgs?.length) || + (msgs?.length + 1 === Math.abs(msgIndex) && id !== 0) || + (msgs?.length - Math.abs(msgIndex) === -2); + var isRevert = revertCheckpoint; + + //Check if the end of the checkpoint has been reached and the previous one should be loaded + if (hasHashes && loadPrevCp) { + id--; + msgIndex = -1; + return loadMoreOOHistory().then(() => { + msgs = ooMessages[id]; + //Empty checkpoint - checkpoint saved with no further changes + if (!msgs?.length) { + msgs = ooMessages[id]; + config.onPatchBack(hashes[id], msgs.slice(0, msgIndex)); + msgIndex--; + patch = msgs[msgs?.length-1]; + position = msgs.indexOf(patch); + if (!$(`[data="${id},0"]`).length) { + displayCheckpointTimeline(); + } + showVersion(false, false, true); + return; + } + cp = hashes[id]; + var q = msgs.slice(0, msgIndex); + patch = msgs[msgs?.length-1]; + + //Is the checkpoint the result of restoring history? If yes, we need to load an extra patch + if (isRevert) { + config.onPatchBack(cp, q); + msgIndex--; + } else { + restore = true; + if (!$(`[data="${id},${position}"]`).length) { + displayCheckpointTimeline(false, true); + } + config.onPatchBack(cp, msgs); + patch = msgs[msgs?.length-1]; + position = msgs?.length; + } + + //Check if this checkpoint has already been added to the timeline + if (!$(`[data="${id},0"]`).length) { + displayCheckpointTimeline(); + } + showVersion(false, restore); + restore = false; + }); + } + var q = msgs.slice(0, msgIndex); + config.onPatchBack(cp, q); + patch = msgs[msgs?.length + msgIndex]; + msgIndex--; + position = msgs.indexOf(patch); + showVersion(false); + + }; + + setTimeout(() => { + displayCheckpointTimeline(true); + showVersion(true); + }, "1000"); // Create the history toolbar var display = function () { @@ -206,23 +522,25 @@ define([ var _next = h('button.cp-toolbar-history-next', { title: Messages.history_next }, [ Icons.get('history-next'), ]); + var _prev = h('button.cp-toolbar-history-previous', { title: Messages.history_prev }, [ + Icons.get('history-prev') + ]); $fastPrev = $(fastPrev); + $prev = $(_prev); $fastNext = $(fastNext).prop('disabled', 'disabled'); $next = $(_next).prop('disabled', 'disabled'); - var pos = Icons.get('chevron-down', {'class': 'cp-history-timeline-pos'}); var time = h('div.cp-history-timeline-time'); var version = h('div.cp-history-timeline-version'); - $time = $(time); $version = $(version); - var bar; var timeline = h('div.cp-toolbar-history-timeline', [ h('div.cp-history-timeline-line', [ - bar = h('span.cp-history-timeline-container') + h('span.cp-history-timeline-container') ]), h('div.cp-history-timeline-actions', [ h('span.cp-history-timeline-prev', [ fastPrev, + _prev ]), time, version, @@ -270,7 +588,6 @@ define([ $share = $(share); $hist.append([timeline, actions]); - $(bar).append(pos); var onKeyDown, onKeyUp; var closeUI = function () { @@ -286,25 +603,69 @@ define([ if (loading) { return; } loading = true; next(); - update(); }); - // Go to previous checkpoint + $prev.click(function () { + if (loading) { return; } + loading = true; + prev(); + }); + + // Go to next checkpoint $fastNext.click(function () { if (loading) { return; } loading = true; - cpIndex--; - loadMoreOOHistory(); - update(); + var msgs = ooMessages[id]; + if (id < Object.keys(hashes).length && id !== -1) { + if (id === -1) { + id = 1; + } else { + id++; + } + loadMoreOOHistory().then(() => { + var cp = hashes[id]; + config.loadHistoryCp(cp); + var msgs = ooMessages[id]; + msgIndex = -msgs?.length-1; + position = 0; + showVersion(false); + loadingFalse(); + return; + }); + } + else { + var cp = hashes[id]; + msgs = ooMessages[id]; + msgIndex = -1; + config.onPatchBack(cp, msgs); + } + loadingFalse(); + position = msgs?.length; + showVersion(false); }); - // Go to next checkpoint + + // Go to previous checkpoint $fastPrev.click(function () { if (loading) { return; } loading = true; - if (msgIndex === -1) { - cpIndex++; - } - loadMoreOOHistory(); - update(); + if (!ooMessages[id].length || ooMessages[id].length+1 === Math.abs(msgIndex)) { + id--; + } + var cp = hashes[id]; + config.loadHistoryCp(cp); + loadMoreOOHistory().then(() => { + var msgs = ooMessages[id]; + msgIndex = -msgs?.length-1; + if (!$(`[data="${id},0"]`).length) { + displayCheckpointTimeline(); + } + patch = msgs[msgs?.length-1]; + position = 0; + + showVersion(false); + updateButtons(true); + }); + + loadingFalse(); }); onKeyDown = function (e) { var p = function () { e.preventDefault(); }; @@ -319,7 +680,7 @@ define([ // Versioned link $share.click(function () { common.getSframeChannel().event('EV_SHARE_OPEN', { - versionHash: getVersion() + versionHash: getVersion(position) }); }); $(snapshot).click(function () { @@ -345,13 +706,14 @@ define([ onClick: function () { var val = $input.val(); if (!val) { return true; } + msgs = ooMessages[id]; config.makeSnapshot(val, function (err) { if (err) { return; } $input.val(''); UI.log(Messages.saved); }, { - hash: getVersion(), - time: currentTime || 0 + hash: getVersion(position), + time: currentTime || patch && patch.time || 0 }); }, keys: [13], @@ -382,8 +744,6 @@ define([ display(); - showVersion(true); - //return void loadMoreOOHistory(); }; return History; diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 1251c5439..bb81114d9 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -15,6 +15,7 @@ define([ '/common/common-feedback.js', '/common/hyperscript.js', '/api/config', + '/customize/application_config.js', '/customize/messages.js', '/components/chainpad/chainpad.dist.js', '/file/file-crypto.js', @@ -44,6 +45,7 @@ define([ Feedback, h, ApiConfig, + AppConfig, Messages, ChainPad, FileCrypto, @@ -562,19 +564,7 @@ define([ } myUniqueOOId = undefined; setMyId(); - var editor = getEditor(); - if (editor) { - var app = common.getMetadataMgr().getPrivateData().ooType; - var d; - if (app === 'doc') { - d = editor.GetDocument().Document; - } else if (app === 'presentation') { - d = editor.GetPresentation().Presentation; - } - if (d) { - APP.oldCursor = d.GetSelectionState(); - } - } + if (APP.docEditor) { APP.docEditor.destroyEditor(); } // Kill the old editor $('iframe[name="frameEditor"]').after(h('div#cp-app-oo-placeholder-a')).remove(); ooLoaded = false; @@ -606,7 +596,8 @@ define([ blob.name = title || (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type; var data = { hash: (APP.history || APP.template) ? ooChannel.historyLastHash : ooChannel.lastHash, - index: (APP.history || APP.template) ? ooChannel.currentIndex : ooChannel.cpIndex + index: (APP.history || APP.template) ? ooChannel.currentIndex : ooChannel.cpIndex, + time: new Date() }; fixSheets(); @@ -732,7 +723,7 @@ define([ if (window.sendCredentials) { xhr.withCredentials = true; } xhr.responseType = 'arraybuffer'; xhr.onload = function () { - if (/^4/.test('' + this.status)) { + if (/^[45]/.test('' + this.status)) { reject(this.status); return void console.error('XHR error', this.status); } @@ -798,6 +789,7 @@ define([ return hashes[a].index - hashes[b].index; }); var s = version.split('.'); + var v = parseInt(s[1]); if (s.length !== 2) { return UI.errorLoadingScreen(Messages.error); } var major = Number(s[0]); @@ -825,8 +817,7 @@ define([ // The first "cp" in history is the empty doc. It doesn't include the first patch // of the history - var initialCp = major === 0 || !cp.hash; - var messages = (data.messages || []).slice(initialCp ? 0 : 1, minor); + var messages = data.messages; messages.forEach(function (obj) { try { obj.msg = JSON.parse(obj.msg); } catch (e) { console.error(e); } @@ -859,7 +850,7 @@ define([ loadLastDocument(cp) .then(({blob, fileType}) => { - ooChannel.queue = messages; + ooChannel.queue = messages.slice(1, minor+1); resetData(blob, fileType); UI.removeLoadingScreen(); }) @@ -875,7 +866,7 @@ define([ var type = common.getMetadataMgr().getPrivateData().ooType; if (APP.downloadType) { type = APP.downloadType; } var blob = loadInitDocument(type, true); - ooChannel.queue = messages; + ooChannel.queue = file.doc === 'spreadsheet' ? messages.slice(0, v) : messages.slice(0, v+1); resetData(blob, file); UI.removeLoadingScreen(); }); @@ -930,6 +921,7 @@ define([ ooChannel.send(obj.data.msg); ooChannel.lastHash = obj.data.hash; ooChannel.cpIndex++; + common.notify(); } else { ooChannel.queue.push(obj.data); } @@ -1910,6 +1902,9 @@ define([ mediasData: mediasData }, function (err, obj) { if (err || !obj || !obj.data) { + if (integrationChannel) { + integrationChannel.event('EV_INTEGRATION_ERROR', 'X2T_ERROR'); + } UI.alert(Messages.oo_couldNotConvertDocument, cb); return; } @@ -1966,6 +1961,9 @@ define([ const onError = function() { console.error(arguments); + if (integrationChannel) { + integrationChannel.event('EV_INTEGRATION_ERROR', 'DOCUMENT_ERROR'); + } if (APP.isDownload) { var sframeChan = common.getSframeChannel(); sframeChan.event('EV_OOIFRAME_DONE', ''); @@ -2056,24 +2054,8 @@ define([ getEditor().asc_setDefaultLanguage(l); } - if (APP.oldCursor) { - var app = common.getMetadataMgr().getPrivateData().ooType; - var d; - if (app === 'doc') { - d = getEditor().GetDocument().Document; - } else if (app === 'presentation') { - d = getEditor().GetPresentation().Presentation; - } - if (d) { - d.SetSelectionState(APP.oldCursor); - d.UpdateSelection(); - } - delete APP.oldCursor; - } if (integrationChannel) { - APP.onDocumentUnlock = () => { - integrationChannel.event('EV_INTEGRATION_READY'); - }; + integrationChannel.event('EV_INTEGRATION_READY'); } } delete APP.startNew; @@ -2379,7 +2361,7 @@ define([ if (ec.editorConfig?.customization?.goback) { c.goback.blank = true; } - if (!privateData?.integrationConfig?.autosave) { + if (typeof(privateData?.integrationConfig?.autosave) !== "number") { c.forcesave = true; } } @@ -2942,6 +2924,12 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null } }; + var loadHistoryCp = function (cp, keepQueue) { + APP.history = true; + APP.stopHistory = false; + loadCp(cp, keepQueue); + }; + var loadTemplate = function (href, pw, parsed) { APP.history = true; APP.template = true; @@ -3151,6 +3139,8 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null // flag only when the checkpoint is ready. APP.stopHistory = true; makeCheckpoint(true); + toolbar.setHistory(false); + }; var onPatch = function (patch) { // Patch on the current cp @@ -3158,14 +3148,43 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null }; var onCheckpoint = function (cp) { // We want to load a checkpoint: - loadCp(cp); + loadCp(cp, true); + }; + var onPatchBack = function (cp, msgs) { + APP.history = true; + APP.stopHistory = false; + if (msgs) { + var msgsFormatted = []; + msgs.forEach(function(msg) { + var parsedMsg = JSON.parse(msg.msg); + + var formattedMsg = { + msg: parsedMsg, + hash: msg.serverHash, + author: msg.author, + time: msg.time + }; + msgsFormatted.push(formattedMsg); + }); + ooChannel.queue = msgsFormatted; + setTimeout(function () { + loadCp(cp, true); + }, 200); + } else { + loadCp(cp); + } + }; + var docType = function() { + return APP.ooconfig.documentType; }; var setHistoryMode = function (bool) { if (bool) { APP.history = true; + toolbar.setHistory(true); try { getEditor().asc_setRestriction(true); } catch (e) {} return; } + toolbar.setHistory(false); // Cancel button: redraw from lastCp APP.history = false; ooChannel.queue = []; @@ -3219,6 +3238,9 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null text: Messages.historyText, tippy: Messages.historyButton }); + if (!AppConfig.enableHistory) { + $historyButton.css('display', 'none'); + } $historyButton.click(function () { ooChannel.historyLastHash = ooChannel.lastHash; @@ -3226,6 +3248,10 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null Feedback.send('OO_HISTORY'); var histConfig = { onPatch: onPatch, + onPatchBack: onPatchBack, + docType: docType, + loadCp: loadCp, + loadHistoryCp: loadHistoryCp, onCheckpoint: onCheckpoint, onRevert: commit, setHistory: setHistoryMode, @@ -3515,6 +3541,22 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null } readOnly = true; } + } else if (content && content.version <= 8) { + version = 'v8/'; + APP.migrate = true; + // Registedred ~~users~~ editors can start the migration + if (common.isLoggedIn() && !readOnly) { + content.migration = true; + APP.onLocal(); + } else { + msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor); + if (APP.helpMenu) { + $(APP.helpMenu.menu).after(msg); + } else { + $('#cp-app-oo-editor').prepend(msg); + } + readOnly = true; + } } // If the sheet is locked by an offline user, remove it @@ -3700,6 +3742,11 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null cb(); }); }); + integrationChannel.on('EV_INTEGRATION_MANUAL_SAVE', function () { + integrationSave(function () { + console.log('Integration manual save'); + }); + }); /* test button if (!cfg.autosave) { diff --git a/www/common/onlyoffice/main.js b/www/common/onlyoffice/main.js index fe934af93..9291c2a16 100644 --- a/www/common/onlyoffice/main.js +++ b/www/common/onlyoffice/main.js @@ -74,9 +74,9 @@ define([ Cryptpad.getPadAttribute('rtChannel', function (err, res) { // If already stored, don't pin it again + channels.rtChannel = data.channel; if (res && res === data.channel) { return; } Cryptpad.pinPads([data.channel], function () { - channels.rtChannel = data.channel; Cryptpad.setPadAttribute('rtChannel', data.channel, function () {}); }); }); diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 5e900c951..edea3e002 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -662,6 +662,11 @@ define([ cb(); }); }); + integrationChannel.on('EV_INTEGRATION_MANUAL_SAVE', function () { + integrationSave(function () { + console.log('Integration manual save'); + }); + }); } } diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index 8f1ef6bf1..f85f0e5b8 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -33,7 +33,7 @@ define([ module.uploadFile = function (common, data, cb) { var sframeChan = common.getSframeChannel(); - sframeChan.query('Q_UPLOAD_FILE', data, cb); + sframeChan.query('Q_UPLOAD_FILE', data, cb, {raw: true}); }; module.create = function (common, config) { @@ -220,14 +220,13 @@ define([ file.noStore = config.noStore; try { - Util.u8ToBase64(u8, b64 => { - file.blob = b64; - file.teamId = teamId; - common.uploadFile(file, function () { - console.log('Upload started...'); - }); + file.blob = u8; + file.teamId = teamId; + common.uploadFile(file, function () { + console.log('Upload started...'); }); } catch (e) { + console.error(e); UI.alert(Messages.upload_serverError); } }; diff --git a/www/common/sframe-common-mailbox.js b/www/common/sframe-common-mailbox.js index bb3fb7708..ca5250256 100644 --- a/www/common/sframe-common-mailbox.js +++ b/www/common/sframe-common-mailbox.js @@ -10,9 +10,10 @@ define([ '/common/common-ui-elements.js', '/common/notifications.js', '/common/hyperscript.js', + '/customize/application_config.js', '/customize/messages.js', '/common/common-icons.js', -], function ($, Util, Hash, UI, UIElements, Notifications, h, Messages, Icons) { +], function ($, Util, Hash, UI, UIElements, Notifications, h, AppConfig, Messages, Icons) { var Mailbox = {}; Mailbox.create = function (Common) { @@ -116,6 +117,13 @@ define([ } if (typeof(data.content.getFormatText) === "function") { $(notif).find('.cp-notification-content p').html(data.content.getFormatText()); + $(notif).find('a').click(e => { + e.preventDefault(); + e.stopPropagation(); + const href = e.target.href || ''; + if (!/^(http|\/)/.test(href)) { return; } + Common.openURL(e.target.href); + }); if (data.content.autorefresh) { var it = setInterval(function () { if (!data.content.autorefresh) { @@ -227,6 +235,45 @@ define([ history[data.type].push(data.content); }; + const custom = AppConfig.customBroadcast; + if (Array.isArray(custom)) { + Common.onAccountOnline(metadataMgr => { + const priv = metadataMgr.getPrivateData(); + const dismissed = priv.settings?.broadcast?.viewed || []; + custom.forEach(obj => { + const viewed = dismissed.includes(obj.id); + if (!obj.filter(metadataMgr)) { return; } + if (viewed) { return; } + const data = { + type: 'broadcast', + content: { + hash: obj.id, + markdown: true, + dismiss: () => { + let $notif = $(`.cp-notification[data-hash^="${obj.id}"]`); + if ($notif.length) { $notif.remove(); } + if (!dismissed.includes(obj.id)) { + dismissed.push(obj.id); + } + Common.setAttribute(['broadcast', 'viewed'], + dismissed); + return true; + }, + msg: { + type: 'BROADCAST_CUSTOM', + content: { + content: obj.msg + } + } + } + }; + mailbox.onMessage(data, () => {}); + }); + }); + } + + + mailbox.dismiss = function (data, cb) { var dataObj = { hash: data.content.hash, diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 5b5362dbb..89fae9535 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -837,6 +837,10 @@ define([ !Utils.PadTypes.isAvailable(parsed.type)) { additionalPriv.disabledApp = true; } + if (AppConfig.integrationOnly && !cfg.integration) { + additionalPriv.disabledApp = true; + } + if (!Utils.LocalStore.isLoggedIn() && AppConfig.registeredOnlyTypes.indexOf(parsed.type) !== -1 && parsed.type !== "file") { @@ -1113,6 +1117,7 @@ define([ href: data.href, channel: data.channel, title: data.title, + attributes: data.attributes, owners: data.metadata ? data.metadata.owners : data.owners, expire: data.metadata ? data.metadata.expire : data.expire, forceSave: true @@ -1695,7 +1700,6 @@ define([ } }); }; - data.blob = Utils.Util.decodeBase64(data.blob); Files.upload(data, data.noStore, Cryptpad, updateProgress, onComplete, onError, onPending); cb(); }); @@ -2122,6 +2126,11 @@ define([ cfg.integrationUtils.onHasUnsavedChanges(obj, cb); } }); + sframeChan.on('Q_INTEGRATION_ERROR', function (obj) { + if (cfg.integrationUtils && cfg.integrationUtils.onError) { + cfg.integrationUtils.onError(obj); + } + }); sframeChan.on('Q_INTEGRATION_ON_INSERT_IMAGE', function (data, cb) { if (cfg.integrationUtils && cfg.integrationUtils.onInsertImage) { cfg.integrationUtils.onInsertImage(data, cb); @@ -2136,6 +2145,11 @@ define([ cfg.integrationUtils.setDownloadAs(format => { sframeChan.event('EV_INTEGRATION_DOWNLOADAS', format); }); + if (cfg.integrationUtils.setSave) { + cfg.integrationUtils.setSave(() => { + sframeChan.event('EV_INTEGRATION_MANUAL_SAVE'); + }); + } } } diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index c3013b35d..320140d9c 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -92,6 +92,19 @@ define([ funcs.getSframeChannel = function () { return ctx.sframeChan; }; funcs.getAppConfig = function () { return AppConfig; }; + funcs.onAccountOnline = function (f) { + const metadataMgr = ctx.metadataMgr; + const cb = Util.once(f); + const todo = () => { + const priv = metadataMgr.getPrivateData(); + if (priv.offline !== false) { return; } + cb(metadataMgr); + metadataMgr.off('change', todo); + }; + metadataMgr.onChange(todo); + todo(); + }; + funcs.isLoggedIn = function () { return ctx.metadataMgr.getPrivateData().loggedIn; }; diff --git a/www/common/translations/messages.bg.json b/www/common/translations/messages.bg.json index 2a214042a..dbdd942b0 100644 --- a/www/common/translations/messages.bg.json +++ b/www/common/translations/messages.bg.json @@ -665,8 +665,8 @@ "friendRequest_notification": "{0} ви изпрати заявка за контакт", "notifications_empty": "Няма налични известия", "profile_addDescription": "Добавяне на описание", - "profile_editDescription": "Редактиране на вашето описание", - "profile_addLink": "Добавяне на връзка към сайта си", + "profile_editDescription": "Описание на профила", + "profile_addLink": "Връзка към вашия сайт", "profile_friendRequestSent": "Изчакваща заявка за контакт...", "isContact": "{0} е един от вашите контакти", "isNotContact": "{0} is not един от вашите контакти", @@ -735,21 +735,21 @@ "team_inviteButton": "Покани участници", "team_owner": "Собственици", "team_admins": "Администратори", - "team_members": "членове", + "team_members": "Членове", "sent": "Съобщението е изпратено", "team_pending": "Поканен", - "team_deleteButton": "Изтрий", + "team_deleteButton": "Изтриване", "team_createLabel": "Създай своя нов екип", "team_rosterKick": "Изгони от екипа", "team_leaveButton": "Напусни този екип", "team_nameTitle": "Име на екипа", - "team_nameHint": "Задайте име на екипа", + "team_nameHint": "Задаване име на екипа", "team_avatarTitle": "Аватар на екипа", "team_listTitle": "Вашите екипи", "team_listSlot": "Свободен слот за екип", "owner_team_add": "{0} желае вие да бъдете собственик на екип {1}. Приемате ли?", "team_deleteTitle": "Изтриване на екип", - "team_deleteHint": "Изтрий екипа и всички документи, притежавани ексклузивно от него.", + "team_deleteHint": "Изтриване на екипа и всички документи, които са негови.", "team_invitedToTeam": "{0} Ви покани да се присъедините към техния екип: {1}", "team_cat_general": "Относно", "team_cat_list": "Екипи", @@ -767,17 +767,17 @@ "teams_table": "Роли", "teams_table_generic": "Роли и разрешения", "teams_table_specific": "Изключения", - "teams_table_admins": "Управлявай членове", - "teams_table_owners": "Управлявай екип", + "teams_table_admins": "Управляване на членове", + "teams_table_owners": "Управляване на екип", "teams_table_role": "Роля", "pad_wordCount": "Думи: {0}", - "share_copyProfileLink": "Копирай линк за профила", + "share_copyProfileLink": "Копиране на връзката към профила", "admin_documentMetadataTitle": "Информация за документа", "admin_documentType": "Тип на документа", "admin_documentSize": "Размер на документа", "admin_documentMetadata": "Текущи метаданни", "admin_documentCreationTime": "Създаден", - "admin_currentlyOpen": "В момента оторени", + "admin_currentlyOpen": "Отворени в момента", "admin_channelAvailable": "Наличен", "admin_channelArchived": "Архивиран", "admin_documentMetadataPlaceholder": "URL на документа или id", @@ -785,14 +785,14 @@ "admin_reportContent": "Докладвай съдържание", "og_teamDrive": "Екипен диск", "og_login": "Вход във {0}", - "admin_documentConflict": "Архивирай/възстанови", + "admin_documentConflict": "Архивиране/възстановяване", "fm_filterBy": "Филтър", - "fm_rmFilter": "Премахни филтър", + "fm_rmFilter": "Премахване на филтъра", "calendar_rec": "Повтори", "calendar_rec_no": "Веднъж", "calendar_rec_daily": "Дневно", - "calendar_rec_edit_all": "Редактирай всички събития", - "calendar_rec_edit_from": "Редактирай бъдещи събития", + "calendar_rec_edit_all": "Редактиране на всички събития", + "calendar_rec_edit_from": "Редактиране на бъдещи събития", "calendar_rec_weekend": "Всекидневно през уикенда", "calendar_rec_edit": "Това е повтарящо се събитие", "calendar_str_filter_day": "Дни: {0}", @@ -803,7 +803,7 @@ "calendar_str_until": "до {0}", "calendar_rec_freq_monthly": "месеци", "calendar_rec_freq_yearly": "години", - "calendar_str_monthday": "на", + "calendar_str_monthday": "на {0}", "calendar_rec_until_date": "На", "calendar_rec_until_count": "След", "calendar_rec_until_count2": "пъти", @@ -820,14 +820,14 @@ "calendar_rec_monthly_nth": "Всеки {0} {1} от месеца", "calendar_nth_last": "последен", "calendar_nth_5": "пети", - "calendar_removeNotification": "Премахни напомняне", + "calendar_removeNotification": "Премахване на напомнянето", "team_inviteRole": "Първоначална роля", "form_exportJSON": "Експортиране в JSON", "team_cat_members": "Членове", "team_maxTeams": "Всеки потребителски акаунт може да бъде член на {0} екипа.", - "team_deleteConfirm": "На път сте да изтриете цялата информация на екипа. Това може да повлияе на достъпа на други членове на екипа до техните данни. Това не може да бъде отменено. Сигурен ли сте, че искате да продължите?", - "passwordFaqLink": "Прочети повече за пароли", - "admin_documentModifiedTime": "Последно модифициран", + "team_deleteConfirm": "На път сте да изтриете цялата информация на екипа. Това може да повлияе на достъпа на другите членове на екипа до данните им. Това не може да бъде отменено. Сигурен ли сте, че искате да продължите?", + "passwordFaqLink": "Прочети повече за паролите", + "admin_documentModifiedTime": "Последна промяна", "calendar_rec_stop": "Спиране на повтарянето", "calendar_rec_freq_weekly": "седмици", "team_avatarHint": "максимален размер от 500 kB (png, jpg, jpeg, gif)", @@ -840,15 +840,15 @@ "team_quota": "Лимит на съхранение на твоя екип", "admin_fileCount": "Брой файлове", "admin_planlimit": "Лимит на съхранение", - "calendar_rec_yearly_nth": "Всеки {0} {1} от {0}", + "calendar_rec_yearly_nth": "Всеки {0} {1} от {2}", "support_notification": "Администратор е отговорил на Вашия сигнал за поддръжка", "team_declineInvitation": "{0} е отказал вашата оферта да се присъедини към екипа: {1}", "properties_passwordSuccessFile": "Паролата бе успешно променена.", "admin_getRawMetadata": "История на метаданните", "calendar_rec_until_no": "Никога", - "share_noContactsNotLoggedIn": "Влез или се регистрирай, за да видиш свойте контакти и да добавиш нови.", + "share_noContactsNotLoggedIn": "Влез или се регистрирай, за да видиш контактите си и да добавиш нови.", "admin_accountMetadataTitle": "Информация за акаунта", - "calendar_rec_edit_one": "Редактирай само това събитие", + "calendar_rec_edit_one": "Редактиране само на това събитие", "calendar_list_end": "{0} или {1}", "notifications_cat_all": "Всички", "notifications_cat_friends": "Заявки за контакт", @@ -884,5 +884,49 @@ "teams_table_generic_edit": "Редактиране: създаване, промяна и изтриване на папки и документи.", "teams_table_specificHint": "Това са стари споделени папки, където преглеждащите, все още, имат разрешение да редактират съществуващи документи. Документите, създадени или копирани в тези папки, ще имат стандартни разрешения.", "teams_table_generic_own": "Управление на екипа: промяна на името и аватара на екипа, добавяне или премахване на собственици, промяна на абонамента за екипа, изтриване на екип.", - "share_contactPasswordAlert": "Този елемент е защитен с парола. Тъй като го споделяте с контакт от CryptPad, получателят няма да е необходимо да въвежда паролата." + "share_contactPasswordAlert": "Този елемент е защитен с парола. Тъй като го споделяте с контакт от CryptPad, получателят няма да е необходимо да въвежда паролата.", + "contacts_mute": "Спри известията от контактите", + "contacts_unmute": "Възстанови известията от контактите", + "contacts_manageMuted": "Управление на спирането на известията", + "contacts_mutedUsers": "Заглушени акаунти", + "contacts_muteInfo": "Няма да получавате никакви известия или съобщения от заглушени потребители.
                  Те няма да знаят, че сте ги изключили.. ", + "team_inviteLinkTitle": "Създаване на персонализирана покана за този екип", + "team_inviteLinkTempName": "Временно име (видимо в списъка с чакащи покани)", + "team_inviteLinkSetPassword": "Защитаване на връзката с парола (препоръчително)", + "team_inviteLinkNote": "Добавяне на лично съобщение", + "team_inviteLinkNoteMsg": "Това съобщение ще се покаже, преди получателят да реши дали да се присъедини към този екип.", + "team_inviteLinkLoading": "Създаване на вашата връзка", + "team_inviteLinkWarning": "Хората, които имат достъп до тази връзка, ще могат да се присъединят към този екип и да виждат неговото съдържание. Споделяйте я внимателно.", + "team_inviteLinkErrorName": "Моля, добавете име на лицето, което каните. Те могат да го променят по-късно. ", + "team_inviteLinkCreate": "Създаване на връзка", + "team_inviteLinkCopy": "Копиране на връзка", + "team_inviteFrom": "От:", + "team_inviteFromMsg": "{0} ви е поканил да се присъедините към екипа {1}", + "team_invitePleaseLogin": "Моля, влезте в системата или се регистрирайте, за да приемете тази покана.", + "team_inviteEnterPassword": "Моля, въведете паролата за поканата, за да продължите.", + "team_invitePasswordLoading": "Проверка на паролата за поканата", + "team_inviteJoin": "Присъединяване към екипа", + "team_inviteTitle": "Покана за присъединяване към екип", + "team_inviteGetData": "Зареждане на данни за екипа", + "team_cat_link": "Връзка за покана", + "team_links": "Връзки за покани", + "team_inviteInvalidLinkError": "Тази връзка за покана не е валидна.", + "team_inviteLinkError": "Възникна грешка при създаването на връзката.", + "burnAfterReading_linkBurnAfterReading": "Преглед и автоматично изтриване след това", + "burnAfterReading_warningLink": "Вие сте задали този документ да се самоизтрива. След като получателят посети тази връзка, той ще може да прегледа документа веднъж, преди той да бъде окончателно изтрит.", + "burnAfterReading_generateLink": "Натиснете бутона по-долу, за да създадете връзка.", + "burnAfterReading_warningAccess": "Този документ ще се самоунищожи. Когато натиснете бутона по-долу, ще видите съдържанието веднъж, преди да бъде изтрито за постоянно. Когато затворите този прозорец, няма да имате достъп до него отново. Ако не сте готови да продължите, можете да затворите този прозорец и да се върнете по-късно.", + "burnAfterReading_proceed": "преглеждане и изтриване", + "burnAfterReading_warningDeleted": "Този документ е изтрит завинаги. След като затворите този прозорец, няма да имате достъп до него отново.", + "oo_invalidFormat": "Този файл не може да бъде импортиран", + "oo_importInProgress": "Импортирането е в ход", + "oo_exportInProgress": "Експортирането е в ход", + "oo_sheetMigration_loading": "Документът ви се актуализира до най-новата версия. Моля, изчакайте приблизително 1 минута.", + "oo_sheetMigration_complete": "Налична е актуализирана версия, натиснете OK, за да презаредите.", + "oo_sheetMigration_anonymousEditor": "Този документ изисква обновление. Редактирането е забранено за гости, докато не го отвори регистриран потребител.", + "imprint": "Правно известие", + "settings_cat_security": "Сигурност и поверителност", + "settings_safeLinksTitle": "Безопасни връзки", + "settings_safeLinksCheckbox": "Активиране на безопасни връзки", + "safeLinks_error": "Тази връзка е копирана от адресната лента на браузъра и не предоставя достъп до документа. Моля, използвайте менюто Споделяне, за да споделите директно с контактите си или копирайте връзката. Прочетете повече за функцията Безопасни връзки." } diff --git a/www/common/translations/messages.ca.json b/www/common/translations/messages.ca.json index e61b115a2..669725b5e 100644 --- a/www/common/translations/messages.ca.json +++ b/www/common/translations/messages.ca.json @@ -325,7 +325,7 @@ "login_invalUser": "Cal introduir el nom d'usuari", "login_invalPass": "Cal introduir la contrasenya", "login_unhandledError": "Hi ha hagut un error inesperat :(", - "register_importRecent": "Importeu documents de la sessió de convidat", + "register_importRecent": "Importa els documents de la sessió de convidat", "register_acceptTerms": "Accepto les condicions del servei", "register_passwordsDontMatch": "Les contrasenyes no coincideixen!", "register_passwordTooShort": "Les contrasenyes han de tenir, com a mínim, {0} caràcters.", @@ -904,7 +904,7 @@ "settings_colortheme_dark": "Fosc", "settings_colortheme_light": "Clar", "settings_colortheme_default": "Valor per defecte del sistema ({0})", - "settings_colorthemeHint": "Canvia els colors de CryptPad en aquest dispositiu.", + "settings_colorthemeHint": "Canvia els colors del CryptPad en aquest dispositiu.", "settings_colorthemeTitle": "Tema de color", "pad_settings_info": "Paràmetres per defecte per a aquest document. S'aplicaran quan els nous usuaris visitin aquest document.", "pad_settings_width_small": "Mode de pàgina", @@ -1146,8 +1146,8 @@ "friendRequest_notification": "{0} us ha enviat una sol·licitud de contacte", "notifications_empty": "No hi ha notificacions disponibles", "profile_addDescription": "Afegiu una descripció", - "profile_editDescription": "Editeu la descripció", - "profile_addLink": "Afegiu un enllaç al vostre lloc web", + "profile_editDescription": "Descripció del perfil", + "profile_addLink": "Enllaç al vostre lloc web", "profile_info": "Altres usuaris poden trobar el vostre perfil a través del vostre avatar a les llistes d'usuaris de documents.", "profile_friendRequestSent": "Sol·licitud de contacte pendent...", "notification_folderShared": "{0} us ha compartit una carpeta: {1}", @@ -1350,7 +1350,7 @@ "team_exportButton": "Baixa", "admin_limitUser": "Clau pública de l'usuari", "fm_deletedFolder": "S'ha suprimit la carpeta", - "access_destroyPad": "Esborra aquest document o carpeta permanentment", + "access_destroyPad": "Destrueix aquest document o carpeta permanentment", "fm_shareFolderPassword": "Protegeix aquesta carpeta amb una contrasenya (opcional)", "loading_state_0": "Interfície de construcció", "loading_state_1": "Carrega la unitat", @@ -1816,5 +1816,49 @@ "toggleArrows": "Botons de fletxa per a moure elements", "profile_remove_avatar": "Elimina aquest avatar", "moveItemLeft": "Mou l'element a l'esquerra", - "admin_logoSize_error": "La mida del logotip és massa gran" + "admin_logoSize_error": "La mida del logotip és massa gran", + "oo_couldNotConvertDocument": "Ha fallat la conversió del document. Tingueu en compte que els formats que donen els millors resultats en importar i exportar són els de Microsoft Office (.docx, .xlsx, .pptx).", + "oo_unstableMigrationWarning": "La importació o exportació d'alguns formats d'OpenDocument (.odt, .odp) és inestable, actualment. Recomanem fer servir altres formats si és possible. El CryptPad provarà ara de fer la millor conversió possible.", + "badges_admin": "Administració", + "badges_moderator": "Moderació i assistència", + "badges_premium": "Subscriptor", + "badges_error": "Error de validació", + "profile_badges": "Distintiu", + "show_password": "Mostra la contrasenya", + "hide_password": "Amaga la contrasenya", + "page_previous": "Pàgina anterior", + "page_next": "Pàgina posterior", + "settings_profileHeaderHint": "Trieu què veuen els altres sobre el vostre compte", + "contact_mastodon": "Mastodon", + "contact_forum": "Fòrum", + "settings_profileAvatarLabel": "Avatar", + "settings_profileHeaderTitle": "Informació del perfil", + "toolbar_text_tools": "Eines de text", + "toolbar_show_text_tools": "Mostra les eines de text", + "toolbar_hide_text_tools": "Amaga les eines de text", + "help_close_button": "Tanca la notificació d'ajuda", + "fc_open_formaud": "Obre (com a revisor)", + "admin_documentsDeletionTitle": "Arxiva diversos documents", + "admin_documentsDeletionHint": "Arxiveu una llista de documents fent servir la seva ID (una ID per línia)", + "password_note1": "La contrasenya és la clau secreta que xifra tots els vostres documents.", + "password_note2": "Si la perdeu, no hi haurà cap manera de recuperar les dades.", + "password_note3": "La contrasenya és la clau secreta que xifra tots els vostres documents i els privilegis d'administració d'aquesta instància.", + "computer_note": "Si utilitzeu un equip compartit, {0]recordeu tancar la sessió{1} en acabar. Si només tanqueu el navegador, deixareu el vostre compte exposat.", + "import_note": "Per a mantenir els documents que heu creat i/o emmagatzemat sense iniciar la sessió, activeu «Importa els documents de la sessió de convidat».", + "admin_creation_note": "Creeu el vostre primer compte d'administració en aquesta pàgina. Els administradors gestionen la configuració de la instància, incloent-hi les quotes d'emmagatzematge, i tenen accés a les eines de moderació.", + "forms_switchHorizontalAxe": "Canvia a la disposició horitzontal", + "forms_switchVerticalAxe": "Canvia a la disposició vertical", + "forms_pollOptionNo": "No", + "forms_pollOptionYes": "Sí", + "forms_pollOptionMaybe": "Potser", + "color0": "Cap color", + "color1": "Vermell", + "color2": "Taronja", + "color3": "Groc", + "color4": "Verd", + "color5": "Verd fosc", + "color6": "Turquesa", + "color7": "Blau", + "color8": "Porpra", + "loading_encrypted": "xifrat d'extrem a extrem" } diff --git a/www/common/translations/messages.de.json b/www/common/translations/messages.de.json index 8b3e5f8d7..4c9c2f82e 100644 --- a/www/common/translations/messages.de.json +++ b/www/common/translations/messages.de.json @@ -1860,5 +1860,8 @@ "password_note3": "Dein Passwort ist der geheime Schlüssel, der alle deine Dokumente und Administratorrechte auf dieser Instanz verschlüsselt.", "computer_note": "Wenn du einen gemeinsam genutzten Computer verwendest, {0}denke daran, dich abzumelden{1}, wenn du fertig bist. Durch bloßes Schließen des Browserfensters bleibt das Konto ungeschützt.", "import_note": "Um die Dokumente zu behalten, die du erstellt und/oder gespeichert hast, ohne eingeloggt zu sein, setze einen Haken bei \"Dokumente aus deiner Gast-Sitzung importieren\".", - "admin_creation_note": "Erstelle auf dieser Seite deinen ersten Administrator-Account. Administratoren verwalten die Einstellungen der Instanz einschließlich der Speicherplatzkontingente und haben Zugriff auf die Moderationswerkzeuge." + "admin_creation_note": "Erstelle auf dieser Seite deinen ersten Administrator-Account. Administratoren verwalten die Einstellungen der Instanz einschließlich der Speicherplatzkontingente und haben Zugriff auf die Moderationswerkzeuge.", + "fo_sharedFolder_move_error": "Geteilte Ordner können nicht in andere geteilte Ordner verschoben werden.", + "fo_trash_move_error": "Der Inhalt von geteilten Ordnern kann nicht in den Papierkorb verschoben werden. Verwende stattdessen \"Entfernen\".", + "form_poll_required_hint": "Die Beantwortung dieser Umfrage ist erforderlich, du musst mit mindestens einer Option interagieren." } diff --git a/www/common/translations/messages.eu.json b/www/common/translations/messages.eu.json index e2a8bcd9d..b6386f74a 100644 --- a/www/common/translations/messages.eu.json +++ b/www/common/translations/messages.eu.json @@ -1839,5 +1839,26 @@ "toolbar_text_tools": "Testu-tresnak", "oo_couldNotConvertDocument": "Dokumentuaren bihurtzeak huts egin du. Kontuan izan Microsoft Office formatuak (.docx, .xlsx, .pptx) direla une honetan inportazio-esportazio emaitzarik onenak ematen dutenak.", "oo_unstableMigrationWarning": "OpenDocument formatuen (.odt, .odp) inportazio-esportazioak une onetan ezegonkorrak dira. Posible bada, beste formatuak erabiltzea gomendatzen dugu. Cryptpad-ek ahalegin onenaren bihurketa egingo du orain.", - "admin_documentsDeletionHint": "Artxibatu dokumentu zerrenda bat haien IDa erabiliz (dokumentu ID bakarra lerroko)" + "admin_documentsDeletionHint": "Artxibatu dokumentu zerrenda bat haien IDa erabiliz (dokumentu ID bakarra lerroko)", + "password_note1": "Zure pasahitza zure dokumentu guztiak zifratzen dituen gako sekretua da.", + "password_note2": "Galtzen baduzu ez dago modurik zure datuak berreskuratzeko.", + "password_note3": "Zure pasahitza instantzia honetako zure dokumentu eta administratzaile-pribilegio guztiak zifratzen dituen gako sekretua da.", + "computer_note": "Sare bateko ordenagailu bat erabiltzen ari bazara, {0}gogoratu saioa amaitzen {1} bukatzean. Nabigatzailearen leihoa ixte hutsak zure kontua agerian uzten du.", + "import_note": "Saioa hasi gabe sortu edota gorde dituzun dokumentuak mantentzeko, egin klik \"Inportatu dokumentuak zure gonbidatu saiotik\" botoian.", + "admin_creation_note": "Sortu zure lehen administratzaile kontua orrialde honetan. Administratzaileek instantziaren ezarpenak kudeatzen dituzte biltegiratze-kuotak barne, eta moderazio-tresnetarako sarbidea dute.", + "forms_switchHorizontalAxe": "Aldatu diseinu horizontalera", + "forms_switchVerticalAxe": "Aldatu diseinu bertikalera", + "forms_pollOptionNo": "Ez", + "forms_pollOptionYes": "Bai", + "forms_pollOptionMaybe": "Agian", + "color0": "Kolorerik gabe", + "color1": "Gorria", + "color2": "Laranja", + "color3": "Horia", + "color4": "Berdea", + "color5": "Berde iluna", + "color6": "Turkesa", + "color7": "Urdina", + "color8": "Morea", + "loading_encrypted": "muturretik muturrerako zifratzea" } diff --git a/www/common/translations/messages.fr.json b/www/common/translations/messages.fr.json index cbf6e7c9e..be8d746fd 100644 --- a/www/common/translations/messages.fr.json +++ b/www/common/translations/messages.fr.json @@ -1860,5 +1860,8 @@ "color6": "Turquoise", "color7": "Bleu", "color8": "Violet", - "loading_encrypted": "chiffré de bout en bout" + "loading_encrypted": "chiffré de bout en bout", + "form_poll_required_hint": "Ce sondage est requis, vous devez interagir avec au moins une option.", + "fo_trash_move_error": "Le contenu d'un dossier partagé ne peut pas être déplacé dans la corbeille. Veuillez utiliser \"Supprimer\".", + "fo_sharedFolder_move_error": "Un dossier partagé ne peut pas être déplacé dans un autre dossier partagé." } diff --git a/www/common/translations/messages.it.json b/www/common/translations/messages.it.json index ce0d80ec9..7c6f16deb 100644 --- a/www/common/translations/messages.it.json +++ b/www/common/translations/messages.it.json @@ -5,7 +5,7 @@ "code": "Codice", "poll": "Sondaggio", "kanban": "Kanban", - "slide": "Presentazione in Markdown", + "slide": "Presentazione Markdown", "drive": "CryptDrive", "whiteboard": "Lavagna", "file": "File", @@ -108,7 +108,7 @@ "printText": "Stampa", "printButton": "Stampa (Invio)", "printButtonTitle2": "Stampa il tuo documento o esportalo in formato PDF", - "printOptions": "Opzioni di layout", + "printOptions": "Opzioni di impaginazione", "printSlideNumber": "Visualizza il numero della diapositiva", "printDate": "Visualizza la data", "printTitle": "Visualizza il titolo del documento", @@ -494,12 +494,12 @@ "features_f_apps": "Accedi a tutte le applicazioni", "features": "Funzionalità", "terms": "Termini di servizio", - "main_catch_phrase": "Suite di collaborazione
                  criptata end-to-end ed open source", + "main_catch_phrase": "Suite di collaborazione
                  criptata end-to-end e open source", "mdToolbar_check": "Elenco delle attività", "mdToolbar_heading": "Titolo", "mdToolbar_strikethrough": "Barrato", "mdToolbar_defaultText": "Inserisci qui il tuo testo", - "mdToolbar_button": "Mostra o nascondi la barra degli strumenti di Markdown", + "mdToolbar_button": "Mostra o nascondi la barra degli strumenti Markdown", "todo_removeTaskTitle": "Rimuovi questa attività dalla tua lista di cose da fare", "todo_markAsIncompleteTitle": "Contrassegna questa attività come non completata", "todo_markAsCompleteTitle": "Contrassegna questa attività come completata", @@ -1824,5 +1824,30 @@ "admin_addAdminsAdd": "Promuovi un contatto ad amministratore/trice", "toggleArrows": "Pulsanti freccia per spostare gli elementi", "oo_unstableMigrationWarning": "L'importazione e l'esportazione di alcuni formati OpenDocument (.odt, .odp) è attualmente instabile. Si consiglia di utilizzare altri formati quando possibile. CryptPad tenterà ora una conversione.", - "settings_profileHeaderTitle": "Informazioni del profilo" + "settings_profileHeaderTitle": "Informazioni del profilo", + "skipLink": "Vai al contenuto principale", + "fc_open_formaud": "Apri (come revisore/a)", + "admin_documentsDeletionTitle": "Archivia più documenti", + "admin_documentsDeletionHint": "Archivia un elenco di documenti usando il loro codice identificativo (un codice identificativo per riga)", + "password_note1": "La tua password è la chiave segreta che cripta tutti i tuoi documenti.", + "password_note2": "Se la perdi non c'è modo di recuperare i tuoi dati.", + "password_note3": "La tua password è la chiave segreta che cripta tutti i tuoi documenti e i privilegi di amministrazione di questa istanza.", + "computer_note": "Se stai usando un computer condiviso, {0}ricorda di disconnetterti{1} quando hai finito. Chiudere solo la finestra del browser espone il tuo account a rischi di sicurezza.", + "import_note": "Per mantenere i documenti creati e/o salvati senza aver effettuato l'accesso, spunta \"Importa i documenti dalla tua sessione ospite\".", + "loading_encrypted": "criptato end-to-end", + "forms_switchHorizontalAxe": "Passa all'impaginazione orizzontale", + "forms_switchVerticalAxe": "Passa all'impaginazione verticale", + "forms_pollOptionNo": "No", + "forms_pollOptionYes": "Sì", + "forms_pollOptionMaybe": "Forse", + "color1": "Rosso", + "color2": "Arancione", + "color3": "Giallo", + "color4": "Verde", + "color5": "Verde scuro", + "color6": "Turchese", + "color7": "Blu", + "color8": "Viola", + "admin_creation_note": "Crea il tuo primo account di amministrazione su questa pagina. Gli amministratori e le amministratrici gestiscono le impostazioni dell'istanza, incluso lo spazio di archiviazione, e hanno accesso agli strumenti di moderazione.", + "color0": "Senza colore" } diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 1dd561c46..6ecc0b5c8 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -1860,5 +1860,8 @@ "color6": "Turquoise", "color7": "Blue", "color8": "Purple", - "loading_encrypted": "end-to-end encrypted" + "loading_encrypted": "end-to-end encrypted", + "form_poll_required_hint": "This poll is required, you must interact with at least one option.", + "fo_trash_move_error": "Shared folder contents cannot be moved to trash. Use \"Remove\" instead.", + "fo_sharedFolder_move_error": "Shared folders cannot be moved inside other shared folders." } diff --git a/www/common/translations/messages.ka.json b/www/common/translations/messages.ka.json index 81da4beab..9048f514e 100644 --- a/www/common/translations/messages.ka.json +++ b/www/common/translations/messages.ka.json @@ -429,5 +429,8 @@ "upgradeAccount": "სატარიფო გეგმის აწევა", "templateSaved": "შაბლონი შენახულია!", "uploadButton": "ფაილების ატვირთვა", - "uploadFolderButton": "ატვირთვის საქაღალდე" + "uploadFolderButton": "ატვირთვის საქაღალდე", + "badges_admin": "ადმინისტრატორი", + "badges_premium": "გამომწერი", + "profile_badges": "სამკერდე ნიშანი" } diff --git a/www/common/translations/messages.lt.json b/www/common/translations/messages.lt.json index 62e36ce28..4643d4d2e 100644 --- a/www/common/translations/messages.lt.json +++ b/www/common/translations/messages.lt.json @@ -30,19 +30,19 @@ "user_displayName": "Rodomas pavadinimas", "user_rename": "Keisti rodomą pavadinimą", "exportPrompt": "Kaip norėtumėte pavadinti savo failą?", - "exportButtonTitle": "Eksportuokite padą į vietinį failą", + "exportButtonTitle": "Eksportuokite dokumeną į vietinį failą", "exportButton": "Eksportuoti", "importButton": "Importuoti", - "importButtonTitle": "Importuokite padą iš vietinio failo", - "pinLimitDrive": "Pasiekėte saugyklos limitą.
                  Negalite sukurti naujų padų.", - "pinLimitNotPinned": "Pasiekėte saugyklos limitą.
                  Šis padas nėra saugomas jūsų „CryptDrive“.", + "importButtonTitle": "Importuokite dokumentą iš vietinio failo", + "pinLimitDrive": "Pasiekėte saugyklos limitą.
                  Negalite sukurti naujų dokumentų.", + "pinLimitNotPinned": "Pasiekėte saugyklos limitą.
                  Šis dokumentas nėra saugomas jūsų „CryptDrive“.", "pinLimitReachedAlertNoAccounts": "Pasiekėte saugyklos limitą", - "pinLimitReachedAlert": "Pasiekėte saugyklos limitą. Nauji padai nebus saugomi jūsų „CryptDrive“.
                  Norėdami padidinti savo limitą, galite pašalinti padus iš savo „CryptDrive“ arba užsiprenumeruoti premium sąskaitą.", + "pinLimitReachedAlert": "Pasiekėte saugyklos limitą. Nauji dokumentai nebus saugomi jūsų „CryptDrive“.
                  Norėdami padidinti savo limitą, galite pašalinti dokumentus iš savo „CryptDrive“ arba užsiprenumeruoti premium sąskaitą.", "pinLimitReached": "Pasiekėte saugyklos limitą", - "formattedKB": "{0} KB", + "formattedKB": "{0} kB", "formattedGB": "{0} GB", "formattedMB": "{0} MB", - "KB": "KB", + "KB": "kB", "GB": "GB", "MB": "MB", "storageStatus": "Saugykla:
                  {0} sunaudota iš {1} ", @@ -54,7 +54,7 @@ "viewers": "žiūrovai", "viewer": "žiūrovas", "users": "Vartotojai", - "anonymous": "Anoniminis", + "anonymous": "Sviečias", "readonly": "Tik skaityti", "errorState": "Kritinė klaida: {0}", "forgotten": "Perkeltas į šiukšliadėžę", diff --git a/www/common/translations/messages.nl.json b/www/common/translations/messages.nl.json index 671725eee..53812f006 100644 --- a/www/common/translations/messages.nl.json +++ b/www/common/translations/messages.nl.json @@ -11,14 +11,14 @@ "media": "Media", "file": "Bestand", "whiteboard": "Whiteboard", - "slide": "Markdown dia", + "slide": "Presentatie", "code": "Code", "form": "Formulier", "doc": "Document", "presentation": "Presentatie", "diagram": "Diagram" }, - "padNotPinned": "Dit document wordt na 3 maanden gewist als deze niet wordt gebruikt. {0}Log in{1} of {2}registreer{3} om deze te behouden.", + "padNotPinned": "Dit document wordt na 3 maanden gewist als deze niet wordt gebruikt. {0}log in{1} of {2}registreer{3} om deze te behouden.", "onLogout": "U bent uitgelogd. {0}Klik hier{1} om in te loggen
                  of druk op Esc om uw document te openen in alleen-lezen modus.", "typeError": "Dit document kan niet worden gebruikt met het gekozen programma", "common_connectionLost": "Serververbinding verbroken
                  De alleen-lezenmodus is ingeschakeld tot de verbinding hersteld wordt.", @@ -55,7 +55,7 @@ "slide_invalidLess": "Ongeldige aangepaste stijl", "slideOptionsTitle": "Dia's aanpassen", "slideOptionsText": "Opties", - "tags_noentry": "U kunt een verwijderde werkomgeving niet markeren!", + "tags_noentry": "U kunt een verwijderd document niet markeren", "tags_duplicate": "Gedupliceerde markering: {0}", "tags_notShared": "Uw markeringen worden niet gedeeld met andere gebruikers", "tags_add": "Werk de markeringen van de geselecteerde werkomgevingen bij", @@ -618,7 +618,7 @@ "features_f_storage0_note": "Documenten zijn verwijderd na {0} dagen van inactiviteit", "features_registered": "Geregistreerd", "features_f_social": "Sociale functies", - "features_f_file1_note": "Sla bestanden op in uw CryptDrive: afbeeldingen, PDF's, video's, en meer. Deel ze met uw contacten of sluit ze in in uw documenten. (tot {0}MB)", + "features_f_file1_note": "Sla bestanden op in uw CryptDrive: afbeeldingen, PDF's, video's, en meer. Deel ze met uw contacten of sluit ze in uw documenten. (tot {0}MB)", "features_f_storage1_note": "Opgeslagen documenten in uw CryptDrive zijn niet verwijderd door inactiviteit", "features_f_reg_note": "Met aanvullende voordelen", "features_f_storage2_note": "Van 5GB tot 50GB afhankelijk van het abonnement, vergrootte limiet van {0}MB voor bestanduploads", @@ -667,5 +667,1198 @@ "creation_404": "Dit document bestaat niet meer. Gebruik het volgende formulier om een nieuw document te maken.", "feedback_about": "Als je dit leest was je waarschijnlijk nieuwsgierig waarom CryptPad om webpagina's vraagt wanneer je bepaalde acties uitvoert.", "features_f_social_note": "Voeg contacten toe voor veilige samenwerking, creëer een profiel, fijnmazige toegangscontroles", - "feedback_optout": "Als u zich wilt afmelden, ga dan naar uw gebruikersinstellingenpagina, waar u een selectievakje vindt om gebruikersfeedback in of uit te schakelen." + "feedback_optout": "Als u zich wilt afmelden, ga dan naar uw gebruikersinstellingenpagina, waar u een selectievakje vindt om gebruikersfeedback in of uit te schakelen.", + "main_catch_phrase": "Samenwerkingssuite
                  end-to-end gecodeerd en open-source", + "features": "Functies", + "feedback_privacy": "We geven om uw privacy en willen tegelijkertijd dat CryptPad zo gebruiksvriendelijk mogelijk is. We gebruiken dit bestand om te bepalen welke gebruikersinterfacefuncties belangrijk zijn voor onze gebruikers. Dit doen we door het op te vragen, samen met een parameter die aangeeft welke actie is ondernomen.", + "creation_owned1": "Een bezeten item kan worden vernietigd wanneer de eigenaar dat wil. Door een item te vernietigen, wordt het onbeschikbaar op de CryptDrives van andere gebruikers.", + "creation_passwordValue": "Wachtwoord", + "creation_newPadModalDescription": "Klik op een app om een nieuw document te maken. Je kunt ook op Tab drukken om de app te selecteren en op Enter drukken om te bevestigen.", + "password_info": "Het document dat u probeert te openen, bestaat niet meer of is beveiligd met een nieuw wachtwoord. Voer het juiste wachtwoord in om toegang te krijgen tot de inhoud.", + "password_error": "Document niet gevonden
                  Deze fout kan door twee factoren worden veroorzaakt: het wachtwoord is ongeldig of het document is vernietigd.", + "password_placeholder": "Typ hier het wachtwoord...", + "password_submit": "Indienen", + "properties_addPassword": "Voeg een wachtwoord toe", + "properties_changePassword": "Wachtwoord wijzigen", + "properties_confirmNew": "Weet u het zeker? Door een wachtwoord toe te voegen, wordt de URL van dit document gewijzigd en de geschiedenis ervan verwijderd. Gebruikers zonder wachtwoord verliezen toegang tot dit document", + "properties_confirmChange": "Weet u het zeker? Als u het wachtwoord wijzigt, wordt de geschiedenis verwijderd. Gebruikers zonder het nieuwe wachtwoord verliezen de toegang tot dit document", + "properties_passwordSame": "Nieuwe wachtwoorden moeten verschillen van de huidige.", + "properties_passwordError": "Er is een fout opgetreden bij het wijzigen van het wachtwoord. Probeer het opnieuw.", + "properties_passwordWarning": "Het wachtwoord is succesvol gewijzigd, maar we konden uw CryptDrive niet bijwerken met de nieuwe gegevens. Mogelijk moet u de oude versie van het document handmatig verwijderen.
                  Druk op OK om uw toegangsrechten opnieuw te laden en bij te werken.", + "properties_passwordSuccess": "Het wachtwoord is succesvol gewijzigd.
                  Druk op OK om uw toegangsrechten opnieuw te laden en bij te werken.", + "properties_changePasswordButton": "Indienen", + "share_linkCategory": "Koppeling", + "share_linkAccess": "Toegangsrechten", + "share_linkEdit": "Bewerken", + "share_linkView": "Weergave", + "share_linkEmbed": "Insluitmodus (werkbalk en gebruikerslijst verbergen)", + "share_linkPresent": "Presenteren", + "share_linkOpen": "Koppeling openen", + "share_linkCopy": "Koppeling kopiëren", + "share_contactCategory": "Contacten", + "share_embedCategory": "Insluiten", + "share_mediatagCopy": "Mediatag naar klembord kopiëren", + "sharedFolders_forget": "Dit document is alleen opgeslagen in een gedeelde map, dus u kunt het niet naar de prullenbak verplaatsen. U kunt uw CryptDrive gebruiken als u het wilt verwijderen.", + "sharedFolders_duplicate": "Sommige van de documenten die u probeerde te verplaatsen, waren al gedeeld in de doelmap.", + "sharedFolders_create": "Maak een gedeelde map aan", + "sharedFolders_create_name": "Mapnaam", + "sharedFolders_create_owned": "Eigen map", + "sharedFolders_share": "Deel deze koppeling met andere geregistreerde gebruikers om hen toegang te geven tot de gedeelde map. Zodra ze deze koppeling openen, wordt de gedeelde map toegevoegd aan hun CryptDrive.", + "convertFolderToSF_SFParent": "Deze map kan niet worden geconverteerd naar een gedeelde map op de huidige locatie. Verplaats de map naar een andere locatie buiten de gedeelde map om door te gaan.", + "convertFolderToSF_SFChildren": "Deze map kan niet worden omgezet naar een gedeelde map omdat deze al gedeelde mappen bevat. Verplaats die gedeelde mappen naar een andere locatie om door te gaan.", + "convertFolderToSF_confirm": "Deze map moet worden omgezet naar een gedeelde map zodat anderen deze kunnen bekijken. Doorgaan?", + "chrome68": "Het lijkt erop dat u de browser Chrome of Chromium versie 68 gebruikt. Deze bevat een bug waardoor de pagina na enkele seconden volledig wit wordt of niet meer reageert op klikken. Om dit probleem op te lossen, kunt u naar een ander tabblad gaan en terugkomen, of proberen te scrollen op de pagina. Deze bug zou in de volgende versie van uw browser verholpen moeten zijn.", + "autostore_file": "bestand", + "autostore_sf": "Map", + "autostore_pad": "Knop", + "autostore_notstored": "Dit {0} bevindt zich niet in uw CryptDrive. Wilt u het nu opslaan?", + "autostore_settings": "U kunt automatische documentopslag inschakelen op uw pagina Instellingen.", + "autostore_store": "Opslaan", + "autostore_hide": "Niet opslaan", + "autostore_error": "Onverwachte fout: we konden dit document niet opslaan. Probeer het opnieuw.", + "autostore_saved": "Het document is succesvol opgeslagen in uw CryptDrive!", + "autostore_forceSave": "Sla het bestand op in uw CryptDrive", + "autostore_notAvailable": "U moet dit document opslaan in uw CryptDrive voordat u deze functie kunt gebruiken.", + "crowdfunding_button": "Ondersteuning CryptPad", + "crowdfunding_popup_text": "

                  We hebben uw hulp nodig!

                  Om ervoor te zorgen dat CryptPad actief wordt ontwikkeld, kunt u overwegen het project te steunen via de OpenCollective-pagina, waar u onze Routekaart en Financieringsdoelen kunt bekijken.", + "crowdfunding_popup_no": "Niet nu", + "survey": "CryptPad-enquête", + "markdown_toc": "Inhoud", + "fm_expirablePad": "Verloopt: {0}", + "admin_authError": "Alleen beheerders hebben toegang tot deze pagina", + "admin_cat_general": "Algemeen", + "admin_cat_stats": "Statistieken", + "adminPage": "Administratie", + "admin_activeSessionsTitle": "Actieve verbindingen", + "admin_activeSessionsHint": "Aantal actieve websocketverbindingen (en unieke IP-adressen die verbonden zijn)", + "admin_activePadsTitle": "Actieve documenten", + "admin_registeredTitle": "Gebruikers- en teamschijven", + "admin_registeredHint": "Aantal actieve schijven op uw sessie", + "admin_updateLimitTitle": "Gebruikersquota bijwerken", + "admin_updateLimitHint": "Het forceren van een update van de opslaglimieten van gebruikers kan op elk moment worden gedaan, maar is alleen nodig in geval van een fout", + "admin_updateLimitButton": "Quota bijwerken", + "admin_updateLimitDone": "Update succesvol voltooid", + "admin_flushCacheTitle": "HTTP-cache leegmaken", + "admin_flushCacheHint": "Dwing alle gebruikers om de nieuwste assets te downloaden na een wijziging in de aanpassing of configuratie. Voorkomt het opnieuw opstarten van de server, maar zorgt ervoor dat elke actieve gebruiker zijn verbinding opnieuw moet instellen. Gebruik deze optie daarom spaarzaam.", + "admin_flushCacheButton": "Cache leegmaken", + "admin_flushCacheDone": "Cache succesvol geleegd", + "footer_donate": "Doneer", + "contact_admin": "Neem contact op met de beheerders voor: {0}", + "contact_adminHint": "Voor alle kwesties met betrekking tot uw account, opslaglimiet of beschikbaarheid van de dienst.\n", + "contact_dev": "Neem contact op met de ontwikkelaars", + "contact_devHint": "Voor functieverzoeken, verbeteringen in de bruikbaarheid of om bedankt te zeggen.", + "contact_bug": "Bugs melden", + "contact_chat": "Chatten", + "contact_email": "Email", + "timeoutError": "Er is een fout opgetreden waardoor uw verbinding met de server is verbroken.
                  Druk op Esc om de pagina opnieuw te laden.", + "admin_diskUsageTitle": "Schijfgebruik", + "admin_diskUsageHint": "Hoeveel opslagruimte wordt gebruikt door verschillende CryptPad-bronnen", + "admin_diskUsageButton": "Rapport genereren", + "settings_codeSpellcheckTitle": "Spellingscontrole", + "settings_codeSpellcheckLabel": "Spellingscontrole inschakelen in de code-bewerker", + "drive_active1Day": "Afgelopen 24 uur", + "drive_active7Days": "Afgelopen 7 dagen", + "drive_active28Days": "Afgelopen 4 weken", + "drive_activeOld": "Minder recent", + "friendRequest_later": "Beslis later", + "friendRequest_accept": "Accepteren (Enter)", + "friendRequest_decline": "Weiger", + "friendRequest_declined": "{0} heeft uw contactverzoek afgewezen", + "friendRequest_accepted": "{0} heeft uw contactverzoek geaccepteerd", + "friendRequest_received": "{0} wil graag uw contactpersoon zijn", + "friendRequest_notification": "{0} heeft je een contactverzoek gestuurd", + "notifications_empty": "Geen meldingen beschikbaar", + "profile_addDescription": "Een beschrijving toevoegen", + "profile_editDescription": "Profielbeschrijving", + "profile_addLink": "Koppeling naar uw website", + "profile_info": "Andere gebruikers kunnen je profiel vinden via je avatar in documentgebruikerslijsten.", + "profile_friendRequestSent": "Contactverzoek in behandeling...", + "isContact": "{0} is een van uw contactpersonen", + "isNotContact": "{0} is geen van uw contactpersonen", + "notification_padShared": "{0} heeft een document met u gedeeld: {1}", + "notification_fileShared": "{0} heeft een bestand met u gedeeld: {1}", + "notification_folderShared": "{0} heeft een map met je gedeeld: {1}", + "share_filterFriend": "Zoeken op naam", + "share_linkFriends": "Delen met contacten", + "share_withFriends": "Delen", + "notifications_dismiss": "Afwijzen", + "fm_info_sharedFolderHistory": "Dit is alleen de geschiedenis van uw gedeelde map: {0}
                  Uw CryptDrive blijft in de alleen-lezenmodus terwijl u navigeert.", + "supportPage": "Ondersteuning", + "admin_cat_support": "Ondersteuning", + "admin_supportInitHelp": "Uw server is nog niet geconfigureerd voor een ondersteuningsmailbox. Als u een ondersteuningsmailbox wilt om berichten van uw gebruikers te ontvangen, moet u uw serverbeheerder vragen om het script in \"./scripts/generate-admin-keys.js\" uit te voeren, vervolgens de openbare sleutel op te slaan in het bestand \"config.js\" en u de privésleutel te sturen.", + "admin_supportInitPrivate": "Uw CryptPad-instantie is geconfigureerd om een ondersteuningsmailbox te gebruiken, maar uw account heeft niet de juiste privésleutel om toegang te krijgen. Gebruik het volgende formulier om de privésleutel aan uw account toe te voegen of bij te werken.", + "admin_supportAddKey": "Privé sleutel toevoegen", + "admin_supportAddError": "Ongeldige privésleutel", + "admin_supportInitTitle": "Ondersteuning voor initialisatie van mailbox", + "admin_supportInitHint": "U kunt een ondersteuningsmailbox configureren om gebruikers van uw CryptPad-instantie een manier te bieden om veilig contact met u op te nemen als ze een probleem hebben met hun account.", + "admin_supportListTitle": "Ondersteuning mailbox", + "admin_supportListHint": "Hier is de lijst met tickets die door gebruikers naar de ondersteuningsmailbox zijn gestuurd. Alle beheerders kunnen de berichten en hun antwoorden zien. Een gesloten ticket kan niet opnieuw worden geopend. Je kunt gesloten tickets alleen verwijderen (verbergen), en de verwijderde tickets blijven zichtbaar voor andere beheerders.", + "support_disabledTitle": "Ondersteuning is niet ingeschakeld", + "support_disabledHint": "Deze CryptPad-instantie is nog niet geconfigureerd om een ondersteuningsformulier te gebruiken.", + "support_cat_new": "Nieuw ticket", + "support_formTitle": "Nieuw ticket", + "support_formHint": "Gebruik dit formulier om veilig contact op te nemen met de beheerders over problemen en vragen. Houd er rekening mee dat sommige problemen/vragen mogelijk al zijn behandeld in de CryptPad-gebruikershandleiding. Maak geen nieuw ticket aan als u al een open ticket hebt over hetzelfde probleem. Beantwoord in plaats daarvan uw oorspronkelijke bericht met eventuele aanvullende informatie.", + "support_formButton": "Versturen", + "support_formTitleError": "Fout: titel is leeg", + "support_formContentError": "Fout: inhoud is leeg", + "support_formMessage": "Typ uw bericht…", + "support_cat_tickets": "Bestaande tickets", + "support_listTitle": "ondersteuningstickets", + "support_listHint": "Hier is de lijst met tickets die naar de beheerders zijn gestuurd en hun antwoorden. Een gesloten ticket kan niet opnieuw worden geopend, maar u kunt een nieuw ticket aanmaken. U kunt tickets die zijn gesloten verbergen.", + "support_answer": "Beantwoorden", + "support_close": "Sluit het ticket", + "support_remove": "Verwijder het ticket", + "support_showData": "Gebruikersgegevens weergeven/verbergen", + "support_from": "Van: {0}", + "support_closed": "Dit ticket is gesloten", + "fc_noAction": "Geen actie beschikbaar", + "notificationsPage": "Meldingen", + "openNotificationsApp": "Open meldingenpaneel", + "notifications_cat_all": "Alle", + "notifications_cat_friends": "Contactverzoeken", + "notifications_cat_pads": "Met mij gedeeld", + "notifications_cat_archived": "Geschiedenis", + "notifications_dismissAll": "Alles negeren", + "support_notification": "Een beheerder heeft gereageerd op uw ondersteuningsticket", + "requestEdit_button": "Bewerkingsrechten aanvragen", + "requestEdit_confirm": "{1} heeft gevraagd om het document {0} te mogen bewerken. Wilt u hem/haar toegang verlenen?", + "requestEdit_viewPad": "Open het document in een nieuw tabblad", + "later": "Beslis later", + "requestEdit_request": "{1} wil het document {0} bewerken", + "requestEdit_accepted": "{1} heeft u bewerkingsrechten voor het document {0} toegekend", + "requestEdit_sent": "Verzoek verzonden", + "properties_unknownUser": "{0} onbekende gebruiker(s)", + "pricing": "Prijzen", + "homePage": "Startpagina", + "features_noData": "Geen persoonlijke informatie vereist", + "features_pricing": "{0} tot {2}€ per maand", + "features_emailRequired": "E-mailadres vereist", + "owner_removeText": "Eigenaren", + "owner_removePendingText": "In afwachting", + "owner_unknownUser": "onbekend", + "owner_removeConfirm": "Weet u zeker dat u het eigendom voor de geselecteerde gebruikers wilt verwijderen? Zij zullen hiervan op de hoogte worden gesteld.", + "owner_removeMeConfirm": "U staat op het punt uw eigendomsrechten op te geven. U kunt deze actie niet ongedaan maken. Weet u het zeker?", + "owner_addConfirm": "Mede-eigenaren kunnen de inhoud wijzigen en u als eigenaar verwijderen. Weet u het zeker?", + "owner_add": "{0} wil dat u eigenaar wordt van het document {1}. Gaat u hiermee akkoord?", + "owner_request": "{0} wil dat je eigenaar wordt van {1}", + "owner_request_accepted": "{0} heeft uw aanbod om eigenaar te worden van {1} aanvaard", + "owner_request_declined": "{0} heeft uw aanbod om eigenaar te worden van {1} afgewezen", + "owner_removed": "{0} heeft uw eigendom van {1} verwijderd", + "owner_removedPending": "{0} heeft uw eigendomsaanbod voor {1} geannuleerd", + "share_linkTeam": "Toevoegen aan teamschijf", + "team_pickFriends": "Kies welke contactpersonen je wilt uitnodigen voor deze groep", + "team_inviteModalButton": "Uitnodigen", + "team_pcsSelectLabel": "Bewaren in", + "team_pcsSelectHelp": "Door een document aan te maken in de schijf van je team, wordt het eigendom van deze groep.", + "team_invitedToTeam": "{0} heeft je uitgenodigd om lid te worden van deze groep: {1}", + "team_kickedFromTeam": "{0} heeft je uit de groep gezet: {1}", + "team_acceptInvitation": "{0} heeft uw aanbod om lid te worden van de groep aanvaard: {1}", + "team_declineInvitation": "{0} heeft uw aanbod om lid te worden van de groep afgewezen: {1}", + "team_cat_general": "Over", + "team_cat_list": "Groepen", + "team_cat_create": "Nieuw", + "team_cat_back": "Terug naar groepen", + "team_cat_members": "Leden", + "team_cat_chat": "Gesprek", + "team_cat_drive": "Schijf", + "team_cat_admin": "Administratie", + "team_infoLabel": "Over groepen", + "team_createLabel": "Maak een nieuwe groep aan", + "team_createName": "Groepsnaam", + "team_rosterPromote": "Promoten", + "team_rosterDemote": "Degraderen", + "team_rosterKick": "Schop uit de groep", + "team_inviteButton": "Leden uitnodigen", + "team_leaveButton": "Deze groep verlaten", + "team_leaveConfirm": "Als je deze groep verlaat, verlies je de toegang tot deze CryptDrive, chatgeschiedenis en andere inhoud. Weet je het zeker?", + "team_owner": "Eigenaren", + "team_admins": "Beheerders", + "team_members": "Leden", + "team_nameTitle": "Groepsnaam", + "team_nameHint": "Stel de naam van de groep in", + "team_avatarTitle": "Avatar van de groep", + "team_avatarHint": "Maximale grootte 500 kB (png, jpg, jpeg, gif)", + "team_infoContent": "Elke groep heeft zijn eigen CryptDrive, opslagquota, chat en ledenlijst. Groepseigenaren kunnen de hele groep verwijderen, beheerders kunnen leden uitnodigen of eruit gooien, leden kunnen de groep verlaten.", + "team_maxTeams": "Elke gebruikersaccount kan slechts lid zijn van {0} groep/groepen.", + "team_listTitle": "Uw groepen", + "team_listSlot": "Beschikbare groepsplaats", + "owner_team_add": "{0} wil dat je eigenaar wordt van de groep {1}. Ga je akkoord?", + "team_rosterPromoteOwner": "Eigendom aanbieden", + "team_ownerConfirm": "Mede-eigenaren kunnen de groep wijzigen of verwijderen en jou als eigenaar verwijderen. Weet je het zeker?", + "team_kickConfirm": "{0} zal weten dat je ze uit de groep hebt verwijderd. Weet je het zeker?", + "sent": "Bericht verzonden", + "team_pending": "Uitgenodigd", + "team_deleteTitle": "Groepsverwijdering", + "team_deleteHint": "Verwijder de groep en alle documenten die uitsluitend eigendom zijn van de groep.", + "team_deleteButton": "Verwijderen", + "team_deleteConfirm": "U staat op het punt om alle gegevens van een gehele groep te verwijderen. Dit kan gevolgen hebben voor de toegang van andere groepsleden tot hun gegevens. Dit kan niet ongedaan worden gemaakt. Weet u zeker dat u wilt doorgaan?", + "team_pendingOwner": "(in behandeling)", + "team_pendingOwnerTitle": "Deze beheerder heeft het eigendomsaanbod nog niet geaccepteerd.", + "team_demoteMeConfirm": "U staat op het punt uw rechten op te geven. U kunt deze actie niet ongedaan maken. Weet u het zeker?", + "team_title": "Groep: {0}", + "team_quota": "De opslaglimiet van uw groep", + "settings_codeBrackets": "Automatisch sluitende haakjes", + "team_viewers": "Kijkers", + "drive_sfPassword": "Uw gedeelde map {0} is niet langer beschikbaar. Deze is verwijderd door de eigenaar of wordt nu beschermd met een nieuw wachtwoord. U kunt deze map verwijderen uit uw CryptDrive of de toegang herstellen met behulp van het nieuwe wachtwoord.", + "drive_sfPasswordError": "Verkeerd wachtwoord", + "password_error_seed": "Document niet gevonden!
                  Deze fout kan door twee factoren worden veroorzaakt: er is een wachtwoord toegevoegd/gewijzigd, of het document is van de server verwijderd.", + "properties_confirmChangeFile": "Weet u het zeker? Gebruikers zonder het nieuwe wachtwoord verliezen de toegang tot dit bestand.", + "properties_confirmNewFile": "Weet u het zeker? Door een wachtwoord toe te voegen, wordt de URL van dit bestand gewijzigd. Gebruikers zonder het wachtwoord verliezen de toegang tot dit bestand.", + "properties_passwordWarningFile": "Het wachtwoord is succesvol gewijzigd, maar we konden uw CryptDrive niet bijwerken met de nieuwe gegevens. Mogelijk moet u de oude versie van het bestand handmatig verwijderen.", + "properties_passwordSuccessFile": "Het wachtwoord is succesvol gewijzigd.", + "driveOfflineError": "Uw verbinding met CryptPad is verbroken. Wijzigingen aan dit document worden niet opgeslagen in uw CryptDrive. Sluit alle CryptPad-tabbladen en probeer het opnieuw in een nieuw venster. ", + "teams_table": "Rollen", + "teams_table_generic": "Rollen en rechten", + "teams_table_generic_view": "Weergeven: toegang tot mappen en documenten (alleen-lezen).", + "teams_table_generic_edit": "Bewerken: mappen en documenten aanmaken, wijzigen en verwijderen.", + "teams_table_generic_admin": "Leden beheren: leden uitnodigen en herroepen, rollen van leden wijzigen tot aan beheerder.", + "teams_table_generic_own": "Groep beheren: groepsnaam en avatar wijzigen, eigenaren toevoegen of verwijderen, groepsabonnement wijzigen, groep verwijderen.", + "teams_table_specific": "Uitzonderingen", + "teams_table_specificHint": "Dit zijn oude gedeelde mappen waarin kijkers nog steeds toestemming hebben om bestaande documenten te bewerken. Documenten die in deze mappen worden aangemaakt of gekopieerd, krijgen standaardmachtigingen.", + "teams_table_admins": "Leden beheren", + "teams_table_owners": "Groep beheren", + "teams_table_role": "Rol", + "pad_wordCount": "Woorden: {0}", + "share_linkWarning": "Deze koppeling bevat de sleutels tot uw document. Ontvangers krijgen onherroepelijke toegang tot uw inhoud.", + "share_linkPasswordAlert": "Dit item is beveiligd met een wachtwoord. Wanneer u de koppeling verstuurt, moet de ontvanger het wachtwoord invoeren.", + "share_contactPasswordAlert": "Dit item is beveiligd met een wachtwoord. Omdat u het deelt met een CryptPad-contactpersoon, hoeft de ontvanger het wachtwoord niet in te voeren.", + "share_embedPasswordAlert": "Dit item is beveiligd met een wachtwoord. Wanneer u dit document insluit, wordt aan kijkers om het wachtwoord gevraagd.", + "share_noContactsLoggedIn": "Je bent nog niet verbonden met iemand op CryptPad. Deel de koppeling naar je profiel zodat mensen je contactverzoeken kunnen sturen.", + "share_copyProfileLink": "Profiel koppeling kopiëren", + "share_noContactsNotLoggedIn": "Log in of registreer om uw bestaande contacten te bekijken en nieuwe toe te voegen.", + "contacts_mute": "Dempen", + "contacts_unmute": "Dempen opheffen", + "contacts_manageMuted": "Dempen beheren", + "contacts_mutedUsers": "Gedempte accounts", + "contacts_muteInfo": "Je ontvangt geen meldingen of berichten van gedempte gebruikers.
                  Zij zullen niet weten dat je ze hebt gedempt. ", + "team_inviteLinkTitle": "Maak een gepersonaliseerde uitnodiging voor deze groep", + "team_inviteLinkTempName": "Tijdelijke naam (zichtbaar in lijst met in behandeling zijnde uitnodigingen)", + "team_inviteLinkSetPassword": "Beveilig de koppeling met een wachtwoord (aanbevolen)", + "team_inviteLinkNote": "Voeg een persoonlijk bericht toe", + "team_inviteLinkNoteMsg": "Dit bericht wordt getoond voordat de ontvanger besluit om zich bij deze groep aan te sluiten.", + "team_inviteLinkLoading": "Uw koppeling genereren", + "team_inviteLinkWarning": "Mensen die deze koppeling openen, kunnen lid worden van deze groep en de inhoud ervan bekijken. Deel deze koppeling zorgvuldig.", + "team_inviteLinkErrorName": "Voeg een naam toe voor de persoon die je uitnodigt. Deze kan later worden gewijzigd. ", + "team_inviteLinkCreate": "Koppeling aanmaken", + "team_inviteLinkCopy": "Koppeling kopiëren", + "team_inviteFrom": "Van:", + "team_inviteFromMsg": "{0} heeft je uitgenodigd om lid te worden van de groep {1}", + "team_invitePleaseLogin": "Log in of registreer u om deze uitnodiging te accepteren.", + "team_inviteEnterPassword": "Voer het uitnodigingswachtwoord in om door te gaan.", + "team_invitePasswordLoading": "Uitnodiging ontcijferen", + "team_inviteJoin": "Word lid van deze groep", + "team_inviteTitle": "Groepsuitnodiging", + "team_inviteGetData": "Groepsgegevens ophalen", + "team_cat_link": "Uitnodigingskoppeling", + "team_links": "Uitnodigingskoppelingen", + "team_inviteInvalidLinkError": "Deze uitnodigingskoppeling is ongeldig.", + "team_inviteLinkError": "Er is een fout opgetreden tijdens het maken van de koppeling.", + "burnAfterReading_linkBurnAfterReading": "Eenmaal bekijken en zelfvernietiging", + "burnAfterReading_warningLink": "U hebt dit document ingesteld om zichzelf te vernietigen. Zodra een ontvanger deze link bezoekt, kan hij het document één keer bekijken voordat het definitief wordt verwijderd.", + "burnAfterReading_generateLink": "Klik op de onderstaande knop om een koppeling te genereren.", + "burnAfterReading_warningAccess": "Dit document zal zichzelf vernietigen. Wanneer u op de onderstaande knop klikt, kunt u de inhoud één keer bekijken voordat deze definitief wordt verwijderd. Wanneer u dit venster sluit, kunt u het niet meer openen. Als u nog niet klaar bent om door te gaan, kunt u dit venster sluiten en later terugkomen.", + "burnAfterReading_proceed": "bekijken en verwijderen", + "burnAfterReading_warningDeleted": "Dit document is definitief verwijderd. Zodra u dit venster sluit, kunt u het niet meer openen.", + "oo_invalidFormat": "Dit bestand kan niet worden geïmporteerd", + "oo_importInProgress": "Importeren bezig", + "oo_exportInProgress": "Exporteren bezig", + "oo_sheetMigration_loading": "Uw document wordt bijgewerkt naar de nieuwste versie. Even geduld a.u.b., dit duurt ongeveer 1 minuut.", + "oo_sheetMigration_complete": "Er is een bijgewerkte versie beschikbaar. Druk op OK om opnieuw te laden.", + "oo_sheetMigration_anonymousEditor": "Dit document moet worden bijgewerkt. Gasten kunnen het document niet bewerken totdat een geregistreerde gebruiker het opent.", + "imprint": "Juridische kennisgeving", + "settings_cat_security": "Beveiliging en privacy", + "settings_safeLinksTitle": "Veilige koppelingen", + "settings_safeLinksCheckbox": "Veilige koppelingen inschakelen", + "safeLinks_error": "Deze koppeling is gekopieerd uit de adresbalk van de browser en biedt geen toegang tot het document. Gebruik het menu Delen om rechtstreeks te delen met contactpersonen of kopieer de koppeling. Lees meer over de functie Veilige koppelingen.", + "dontShowAgain": "Niet meer weergeven", + "profile_login": "U moet inloggen om deze gebruiker aan uw contacten toe te voegen", + "settings_safeLinksHint": "CryptPad bevat de sleutels om uw documenten te ontsleutelen in hun koppelingen. Iedereen die toegang heeft tot uw browsegeschiedenis kan mogelijk uw gegevens lezen. Dit omvat opdringerige browserextensies en browsers die uw geschiedenis op verschillende apparaten synchroniseren. Door 'veilige koppelingen' in te schakelen, wordt voorkomen dat de sleutels in uw browsegeschiedenis terechtkomen of in uw adresbalk zomaar worden weergegeven. We raden u ten zeerste aan deze functie in te schakelen en het menu {0} Delen te gebruiken om deelbare koppelingen te genereren.", + "areYouSure": "Weet je het zeker?", + "historyTrim_historySize": "Geschiedenis: {0}", + "historyTrim_contentsSize": "Inhoud: {0}", + "trimHistory_button": "Geschiedenis verwijderen", + "trimHistory_getSizeError": "Fout bij het berekenen van de grootte van de geschiedenis van uw schijf", + "trimHistory_error": "Fout bij het verwijderen van de geschiedenis", + "trimHistory_success": "De geschiedenis is gewist", + "trimHistory_needMigration": "Werk uw CryptDrive bij om deze functie in te schakelen.", + "trimHistory_currentSize": "Huidige geschiedenisgrootte: {0}", + "trimHistory_noHistory": "Er kan geen geschiedenis worden verwijderd", + "settings_trimHistoryTitle": "Geschiedenis verwijderen", + "settings_trimHistoryHint": "Bespaar opslagruimte door de geschiedenis van uw schijf en meldingen te verwijderen. Dit heeft geen invloed op de geschiedenis van uw documenten. U kunt de geschiedenis van documenten verwijderen in het dialoogvenster met eigenschappen.", + "makeACopy": "Maak een kopie", + "copy_title": "{0} (kopiëren)", + "access_main": "Toegang", + "access_allow": "Lijst", + "accessButton": "Toegang", + "restrictedError": "U bent niet bevoegd om dit document te openen", + "contacts": "Contactpersonen", + "access_noContact": "Geen ander contact toe te voegen", + "allow_checkbox": "Toegangslijst inschakelen", + "allow_enabled": "ingeschakeld", + "allow_disabled": "Uitgeschakeld", + "allow_label": "Toegangslijst: {0}", + "access_muteRequests": "Toegangsverzoeken voor dit document dempen", + "owner_text": "De eigenaar(s) van een document zijn de enige gebruikers die bevoegd zijn om: eigenaren toe te voegen/te verwijderen, de toegang tot het document te beperken met een toegangslijst of het document te verwijderen.", + "logoutEverywhere": "Overal uitloggen", + "allow_text": "Het gebruik van een toegangslijst betekent dat alleen geselecteerde gebruikers en eigenaren toegang hebben tot dit document.", + "teams": "Groepen", + "kanban_title": "Titel", + "kanban_body": "Inhoud", + "kanban_color": "Kleur", + "kanban_delete": "Verwijderen", + "kanban_tags": "Filter op label", + "kanban_noTags": "Geen labels", + "kanban_conflicts": "Momenteel aan het bewerken:", + "kanban_clearFilter": "Filter wissen", + "kanban_editCard": "Deze kaart bewerken", + "profile_copyKey": "Openbare sleutel kopiëren", + "admin_openFilesTitle": "Open bestanden", + "admin_openFilesHint": "Aantal bestandsbeschrijvingen dat momenteel op de server is geopend.", + "canvas_brush": "Borstel", + "canvas_select": "Selecteer", + "cba_writtenBy": "Geschreven door: {0}", + "cba_properties": "Kleuren van de auteur (experimenteel)", + "cba_hint": "Deze instelling wordt onthouden wanneer u uw volgende document aanmaakt.", + "cba_enable": "Inschakelen", + "cba_disable": "Wissen en uitschakelen", + "cba_show": "Kleuren van auteur weergeven", + "cba_hide": "Kleuren van auteur verbergen", + "oo_login": "Log in of registreer om de prestaties van spreadsheets te verbeteren.", + "cba_title": "Kleuren van de auteur", + "comments_notification": "Reacties op uw opmerking \"{0}\" in {1}", + "comments_deleted": "Commentaar verwijderd door de auteur", + "comments_edited": "Bewerkt", + "comments_reply": "Beantwoorden", + "comments_resolve": "Oplossen", + "comments_comment": "Opmerking", + "settings_padNotifTitle": "Opmerkingenmeldingen", + "settings_padNotifHint": "Negeer meldingen wanneer iemand op een van je opmerkingen reageert", + "settings_padNotifCheckbox": "Meldingen voor reacties uitschakelen", + "comments_error": "Kan hier geen opmerking toevoegen", + "fm_sort": "Sorteren", + "todo_move": "Je takenlijst staat nu in de kanban {0} in je schijf.", + "toolbar_theme": "Thema", + "toolbar_insert": "Invoegen", + "toolbar_savetodrive": "Opslaan als afbeelding", + "toolbar_tools": "Gereedschap", + "drive_treeButton": "Bestanden", + "code_editorTheme": "Thema van de redacteur", + "toolbar_file": "Bestand", + "slide_backCol": "Achtergrondkleur", + "slide_textCol": "Tekstkleur", + "support_languagesPreamble": "Het ondersteuningsteam spreekt de volgende talen:", + "settings_safeLinkDefault": "Veilige koppelingen zijn nu standaard ingeschakeld. Gebruik het menu Delen om koppelingen te kopiëren in plaats van de adresbalk van uw browser.", + "info_imprintFlavour": "Juridische informatie over de beheerders van deze instantie", + "user_about": "Over CryptPad", + "info_privacyFlavour": "Privacybeleid voor deze instantie", + "support_cat_account": "Gebruikersaccount", + "support_cat_data": "Verlies van inhoud", + "support_cat_bug": "Meld een bug", + "support_cat_other": "Andere", + "support_cat_all": "Alle", + "support_attachments": "Bijlagen", + "support_addAttachment": "Bijlage toevoegen", + "notification_padSharedTeam": "{0} heeft een document gedeeld met de groep {2}: {1}", + "notification_fileSharedTeam": "{0} heeft een bestand gedeeld met de groep {2}: {1}", + "notification_folderSharedTeam": "{0} heeft een map gedeeld met de groep {2}: {1}", + "oo_refresh": "Vernieuw", + "support_category": "Kies een categorie", + "support_formCategoryError": "Fout: Categorie is leeg", + "fm_emptyTrashOwned": "Je prullenbak bevat documenten die je bezit. Je kunt ze alleen van je schijf verwijderen of ze voor alle gebruikers vernietigen.", + "fm_restricted": "U hebt geen toegang", + "fm_noResult": "Geen resultaten gevonden", + "pad_tocHide": "Overzicht", + "settings_kanbanTagsTitle": "Labelfilter", + "settings_kanbanTagsHint": "Selecteer de manier waarop de labelfilter te werk gaat bij een selectie van meerdere labels: toon alleen kaarten die alle geselecteerde labels bevatten (EN) of toon kaarten die een van de geselecteerde labels bevatten (OF)", + "share_bar": "Koppeling aanmaken", + "history_cantRestore": "Herstel mislukt. Je bent losgekoppeld.", + "history_shareTitle": "Deel een koppeling naar deze versie", + "share_versionHash": "U staat op het punt om de geselecteerde geschiedenisversie van het document in de alleen-lezenmodus te delen. Hierdoor krijgt u ook weergavetoegang voor alle versies van het document.", + "history_fastPrev": "Vorige bewerkingssessie", + "history_userPrev": "Vorige auteur", + "history_fastNext": "Volgende bewerkingssessie", + "history_userNext": "Volgende auteur", + "history_restoreDriveTitle": "Herstel de geselecteerde versie van CryptDrive", + "history_restoreDrivePrompt": "Weet u zeker dat u de huidige versie van CryptDrive wilt vervangen door de weergegeven versie?", + "history_restoreDriveDone": "CryptDrive hersteld", + "infobar_versionHash": "U bekijkt momenteel een eerdere versie van dit document ({0}).", + "snaphot_title": "Momentopname", + "snapshots_button": "Momentopnames", + "snapshots_new": "Nieuwe momentopname", + "snapshots_placeholder": "Momentopname titel", + "snapshots_open": "Open", + "snapshots_restore": "Herstel", + "snapshots_close": "Sluiten", + "oo_deletedVersion": "Deze versie bestaat niet meer in de geschiedenis.", + "snapshots_delete": "Verwijderen", + "oo_version_latest": "Laatste", + "oo_version": "Versie: ", + "snapshots_ooPickVersion": "U moet een versie selecteren voordat u een momentopname maakt", + "snapshot_error_exists": "Er is al een momentopname van deze versie", + "snapshots_notFound": "Deze momentopname bestaat niet meer omdat de geschiedenis van het document is verwijderd.", + "snapshots_cantMake": "De momentopname kon niet worden gemaakt. Je bent losgekoppeld.", + "admin_registrationHint": "Bezoekers van de instantie kunnen geen accounts aanmaken. Uitnodigingen kunnen worden aangemaakt door beheerders.", + "admin_registrationTitle": "Registratie sluiten", + "admin_defaultlimitHint": "Maximale opslaglimiet voor CryptDrives (gebruikers en groepen) wanneer geen aangepaste regel wordt toegepast", + "admin_defaultlimitTitle": "Opslaglimiet (MB)", + "admin_setlimitButton": "Limiet instellen", + "admin_limit": "Huidige limiet: {0}", + "admin_getlimitsHint": "Geef een overzicht van alle aangepaste opslaglimieten die op uw instantie van toepassing zijn.", + "admin_getlimitsTitle": "Aangepaste limieten", + "admin_limitPlan": "Plan: {0}", + "admin_limitNote": "Opmerking: {0}", + "admin_setlimitHint": "Stel aangepaste limieten in voor gebruikers met behulp van hun openbare sleutel. U kunt een bestaande limiet bijwerken of verwijderen.", + "admin_setlimitTitle": "Pas een aangepaste limiet toe", + "admin_limitMB": "Limiet (in MB)", + "admin_limitSetNote": "Opmerking", + "admin_invalKey": "Ongeldige openbare sleutel", + "admin_invalLimit": "Ongeldige grenswaarde", + "team_exportTitle": "Groepsschijf downloaden", + "team_exportHint": "Download alle documenten in de schijf van deze groep. Documenten worden gedownload in formaten die door andere toepassingen kunnen worden gelezen, indien een dergelijk formaat beschikbaar is. Indien een dergelijk formaat niet beschikbaar is, worden documenten gedownload in een formaat dat door CryptPad kan worden gelezen.", + "team_exportButton": "Downloaden", + "admin_limitUser": "Openbare sleutel van gebruiker", + "loading_state_0": "Interface bouwen", + "loading_state_1": "Laad schijf", + "loading_state_2": "Inhoud bijwerken", + "loading_state_3": "Gedeelde mappen laden", + "loading_state_4": "Groepen laden", + "loading_state_5": "Document reconstrueren", + "tag_add": "Toevoegen", + "tag_edit": "Bewerken", + "error_unhelpfulScriptError": "Scriptfout: zie browserconsole voor meer informatie", + "documentID": "Documentidentificatie", + "unableToDisplay": "Het document kan niet worden weergegeven. Druk op Esc om de pagina opnieuw te laden. Neem contact op met de helpdesk als het probleem zich blijft voordoen.", + "errorPopupBlocked": "CryptPad moet nieuwe tabbladen kunnen openen om te kunnen werken. Sta pop-upvensters toe in de adresbalk van uw browser. Deze vensters worden nooit gebruikt om u reclame te tonen.", + "admin_archiveHint": "Maak een document onbeschikbaar zonder het permanent te verwijderen. Het wordt in een 'archief'-map geplaatst en na een paar dagen verwijderd (instelbaar in het serverconfiguratiebestand).", + "admin_archiveButton": "Archief", + "admin_unarchiveHint": "Een eerder gearchiveerd document herstellen", + "admin_unarchiveButton": "Herstel", + "admin_archiveInput": "Document URL", + "admin_archiveInput2": "Document wachtwoord", + "restoredFromServer": "Document hersteld", + "archivedFromServer": "Document gearchiveerd", + "allowNotifications": "Meldingen toestaan", + "fileTableHeader": "Downloads and uploads", + "download_zip": "ZIP-bestand aan het maken…", + "download_zip_file": "Bestand {0}/{1}", + "Offline": "Offline", + "mediatag_saveButton": "Opslaan", + "pad_mediatagShare": "Bestand delen", + "pad_mediatagOpen": "Bestand openen", + "mediatag_notReady": "Voltooi de download", + "settings_mediatagSizeTitle": "Automatische downloadlimiet", + "settings_mediatagSizeHint": "Maximale grootte in megabytes (MB) voor het automatisch laden van media-elementen (afbeeldingen, video's, pdf's) die in documenten zijn ingesloten. Elementen die groter zijn dan de opgegeven grootte kunnen handmatig worden geladen. Gebruik \"-1\" om de media-elementen altijd automatisch te laden.", + "mediatag_loadButton": "Bijlage laden", + "history_trimPrompt": "Dit document heeft {0} aan geschiedenis verzameld, wat het laden kan vertragen. Overweeg om de geschiedenis te verwijderen als deze niet nodig is.", + "contacts_confirmCancel": "Weet je zeker dat je je contactverzoek met {0} wilt annuleren?", + "admin_support_premium": "Premium tickets:", + "admin_support_normal": "Onbeantwoorde aanvragen:", + "admin_support_answered": "Beantwoorde aanvragen:", + "admin_support_closed": "Gesloten aanvragen:", + "admin_support_open": "Toon", + "admin_support_collapse": "Samenvouwen", + "admin_support_first": "Aangemaakt op: ", + "admin_support_last": "Bijgewerkt op: ", + "access_offline": "Je bent nu offline. Toegangsbeheer is niet beschikbaar.", + "share_noContactsOffline": "Je bent momenteel offline. Contacten zijn niet beschikbaar.", + "offlineError": "De meest recente gegevens kunnen niet worden gesynchroniseerd, waardoor deze pagina momenteel niet kan worden weergegeven. Het laden wordt voortgezet zodra uw verbinding met de service is hersteld.", + "register_notes_title": "Belangrijke notities", + "register_warning_note": "Vanwege de versleutelde aard van CryptPad kunnen de beheerders van de dienst geen gegevens herstellen als u uw gebruikersnaam en/of wachtwoord vergeet. Bewaar deze daarom op een veilige plaats.", + "creation_expiresIn": "Vernietigen in", + "creation_helperText": "Openen in documentatie", + "docs_link": "Documentatie", + "settings_cacheTitle": "Tijdelijke opslag", + "settings_cacheHint": "CryptPad slaat delen van uw documenten op in het geheugen van uw browser om netwerkgebruik te besparen en laadtijden te verbeteren. U kunt de cache uitschakelen als uw apparaat niet veel vrije opslagruimte heeft. Om veiligheidsredenen wordt de cache altijd gewist wanneer u uitlogt, maar u kunt deze ook handmatig wissen als u opslagruimte op uw apparaat wilt vrijmaken.", + "settings_cacheCheckbox": "Cache inschakelen op dit apparaat", + "settings_cacheButton": "Bestaande cache wissen", + "undo": "Maak ongedaan", + "redo": "Opnieuw doen", + "admin_cat_performance": "Prestaties", + "admin_performanceProfilingHint": "Een overzicht van de totale tijd die is besteed aan het uitvoeren van verschillende server-side commando's", + "admin_performanceProfilingTitle": "Prestaties", + "admin_performanceKeyHeading": "Commando", + "admin_performanceTimeHeading": "Tijd (seconden)", + "admin_performancePercentHeading": "Percentage", + "settings_cat_style": "Uiterlijk", + "settings_colortheme_dark": "Donker", + "settings_colortheme_light": "Licht", + "settings_colortheme_default": "Standaardinstelling van het systeem ({0})", + "settings_colorthemeHint": "Wijzig de algemene kleuren van CryptPad op dit apparaat.", + "settings_colorthemeTitle": "Thema kleur", + "pad_settings_title": "Documentinstellingen", + "pad_settings_info": "Standaardinstellingen voor dit document. Deze worden toegepast wanneer nieuwe gebruikers dit document bezoeken.", + "pad_settings_width_small": "Paginamodus", + "pad_settings_width_large": "Volledige breedte", + "pad_settings_outline": "Kies of de inhoudsopgave standaard zichtbaar of verborgen moet zijn.", + "pad_settings_comments": "Kies of de opmerkingen standaard zichtbaar of verborgen moeten zijn.", + "settings_colortheme_custom": "Aangepast", + "oo_lostEdits": "Helaas konden uw recente niet-opgeslagen bewerkingen niet worden hersteld na het synchroniseren van nieuwe inhoud.", + "toolbar_degraded": "Er zijn momenteel meer dan {0} bewerkers aanwezig in dit document. De gebruikerslijst en chat zijn uitgeschakeld om de prestaties te verbeteren.", + "admin_cat_broadcast": "Uitzending", + "admin_maintenanceTitle": "Onderhoud", + "admin_maintenanceHint": "Plan een onderhoudsbeurt voor deze instantie en breng alle gebruikers op de hoogte. Er kan slechts één onderhoudsbeurt tegelijkertijd actief zijn.", + "admin_maintenanceButton": "Plan onderhoud", + "admin_maintenanceCancel": "Onderhoud annuleren", + "broadcast_maintenance": "Er is een onderhoud gepland tussen {0} en {1}. CryptPad is op dat moment mogelijk niet beschikbaar.", + "admin_surveyTitle": "Enquête", + "admin_surveyHint": "Voeg een koppeling naar een externe enquête toe, werk deze bij of verwijder deze. Gebruikers ontvangen een melding en de enquête blijft beschikbaar via het gebruikersmenu.", + "broadcast_newSurvey": "Er is een nieuwe enquête beschikbaar. Klik om te openen.", + "admin_surveyButton": "Enquête opslaan", + "admin_broadcastHint": "Stuur een bericht naar alle gebruikers op deze instantie. Alle bestaande en nieuwe gebruikers zullen het als een melding ontvangen. Bekijk berichten voorafgaand aan het verzenden met \"Voorbeeldmelding\". Voorbeeldmeldingen hebben een rood pictogram en zijn alleen voor jou zichtbaar.", + "broadcast_defaultLanguage": "Terugvallen op deze taal", + "settings_deleteWarning": "Waarschuwing: u bent momenteel geabonneerd op een premium abonnement (betaald of aangeboden door een andere gebruiker). Annuleer uw abonnement voordat u uw account verwijdert, aangezien dit niet mogelijk is zonder contact op te nemen met de klantenservice zodra uw account is verwijderd.", + "footer_roadmap": "Routekaart", + "oo_cantMigrate": "Dit blad overschrijdt de maximale uploadgrootte en is te groot om te worden gemigreerd.", + "pad_goToAnchor": "Ga naar anker", + "calendar_before": "vóór", + "calendar_deleteOwned": "Het blijft zichtbaar voor andere gebruikers met wie het is gedeeld.", + "calendar_errorNoCalendar": "Geen kalender beschikbaar", + "reminder_missed": "{0} vond plaats op {1}", + "reminder_now": "{0} is gestart", + "reminder_inProgress": "{0} is begonnen op {1}", + "reminder_minutes": "{0} begint over {1} minuut(en)", + "reminder_time": "{0} vandaag om {1}", + "reminder_date": "{0} op {1}", + "settings_notifCalendarTitle": "Kalender meldingen", + "settings_notifCalendarHint": "Alle meldingen voor aankomende agenda-afspraken in- of uitschakelen.", + "settings_notifCalendarCheckbox": "Kalender meldingen inschakelen", + "toolbar_storeInDrive": "Opslaan in CryptDrive", + "genericCopySuccess": "Gekopieerd naar klembord", + "oo_conversionSupport": "Uw browser kan geen conversie naar en van Office-formaten uitvoeren. We raden u aan een recente versie van Firefox of Chrome te gebruiken.", + "oo_importBin": "Klik op OK om het interne .bin-formaat van CryptPad te importeren.", + "admin_emailTitle": "E-mailadres beheerder", + "admin_emailHint": "Stel hier het contact-e-mailadres voor uw instantie in", + "admin_supportPrivTitle": "Ondersteuning mailbox privésleutel", + "admin_supportInitGenerate": "Ondersteuningssleutels genereren", + "admin_supportPrivHint": "Geef de privésleutel weer die andere beheerders nodig hebben om supporttickets te bekijken. Een formulier om deze sleutel in te voeren wordt weergegeven op hun beheerderspaneel.", + "admin_supportPrivButton": "Sleutel weergeven", + "share_formEdit": "Auteur", + "share_formAuditor": "Controleur", + "share_formView": "Deelnemer", + "form_invalid": "Ongeldig formulier", + "form_editBlock": "Bewerken", + "form_editMax": "Maximaal selecteerbare opties", + "form_editMaxLength": "Maximaal aantal tekens", + "form_editType": "Type optie", + "form_poll_text": "Tekst", + "form_poll_day": "Dag", + "form_poll_time": "Tijd", + "form_poll_switch": "Bijlen omwisselen", + "form_pollTotal": "Totaal", + "form_pollYourAnswers": "Uw antwoorden", + "form_textType": "Teksttype", + "form_text_text": "Tekst", + "form_text_url": "Koppeling", + "form_text_email": "Email", + "form_text_number": "Nummer", + "form_default": "Uw vraag hier?", + "form_type_input": "Tekst", + "form_type_textarea": "Alinea", + "form_type_radio": "Keuze", + "form_type_multiradio": "Keuzerooster", + "form_type_checkbox": "Selectievakje", + "form_type_multicheck": "Selectievakje Raster", + "form_type_poll": "Peiling", + "form_type_sort": "Geordende lijst", + "form_sort_hint": "Sleep deze items van meest (1) naar minst ({0}) geprefereerd.", + "form_type_md": "Beschrijving", + "form_type_page": "Pagina-einde", + "form_description_default": "Uw tekst hier", + "form_maxOptions": "maximaal {0} antwoord(en)", + "form_maxLength": "Tekstlimiet: {0}/{1}", + "form_submit": "Indienen", + "form_update": "Bijwerken", + "form_reset": "opnieuw instellen", + "form_delete": "Verwijderen", + "form_submitWarning": "Toch indienen", + "form_updateWarning": "Werk toch bij", + "form_cantFindAnswers": "Uw bestaande antwoorden voor dit formulier kunnen niet worden opgehaald.", + "form_answered": "U hebt dit formulier al ingevuld", + "form_results": "Reacties ({0})", + "form_results_empty": "Er zijn geen reacties", + "form_editor": "Redacteur", + "form_showIndividual": "Individuele antwoorden weergeven", + "form_showSummary": "Samenvatting weergeven", + "form_answerAnonymous": "Anonieme antwoord op {0}", + "form_viewButton": "Bekijken", + "form_backButton": "Terug", + "form_answerName": "Antwoord van {0} op {1}", + "form_answerWarning": "Onbevestigde identiteit", + "form_notAnswered": "{0} lege antwoorden", + "form_input_ph_email": "email@voorbeeld.com", + "form_input_ph_url": "https://voorbeeld.com", + "form_invalidWarning": "Er zitten fouten in sommige antwoorden:", + "form_invalidQuestion": "Vraag {0}", + "form_makePublic": "Reacties publiceren", + "form_makePublicWarning": "Weet u zeker dat u de reacties op dit formulier openbaar wilt maken? Eerdere en toekomstige reacties zullen zichtbaar zijn voor deelnemers. Dit kan niet ongedaan worden gemaakt.", + "form_isPublic": "Reacties zijn openbaar", + "form_isPrivate": "Reacties zijn privé", + "form_open": "Open", + "form_setEnd": "Sluitingsdatum instellen", + "form_removeEnd": "Sluitingsdatum verwijderen", + "form_isOpen": "Dit formulier is open", + "form_isClosed": "Dit formulier is gesloten op {0}", + "form_willClose": "Dit formulier sluit op {0}", + "form_anonymous": "Gasttoegang (niet ingelogd)", + "form_anonymous_on": "Toegestaan", + "form_anonymous_off": "Geblokkeerd", + "form_defaultOption": "Optie {0}", + "form_defaultItem": "Artikel {0}", + "form_newOption": "Nieuwe optie", + "form_newItem": "Nieuw artikel", + "form_add_option": "Optie toevoegen", + "form_add_item": "Artikel toevoegen", + "form_anonymous_blocked": "Gastenreacties zijn geblokkeerd voor dit formulier. U moet inloggen of registreren om antwoorden in te dienen.", + "form_addMultiple": "Alles toevoegen", + "form_addMultipleHint": "Meerdere datums en tijden toevoegen", + "form_clear": "Wissen", + "form_page": "Pagina {0}/{1}", + "form_anonymousBox": "Anoniem antwoorden", + "settings_driveRedirectTitle": "Omleiding van de startpagina", + "settings_driveRedirectHint": "Automatische omleiding van de startpagina naar de schijf wanneer u bent ingelogd, is niet langer standaard ingeschakeld. Het oude gedrag kan hieronder worden ingeschakeld.", + "settings_driveRedirect": "Stuur me automatisch door", + "copyToClipboard": "Kopiëren naar klembord", + "restrictedLoginPrompt": "U hebt geen toestemming om dit document te openen. Log in als u denkt dat uw account toegang zou moeten hebben.", + "mdToolbar_embed": "Bestand insluiten", + "admin_cat_network": "Netwerk", + "admin_updateAvailableTitle": "Nieuwe versies", + "admin_updateAvailableHint": "Een nieuwe versie van CryptPad is beschikbaar", + "admin_updateAvailableButton": "Zie release-opmerkingen", + "admin_checkupTitle": "Instantieconfiguratie valideren", + "admin_checkupHint": "CryptPad bevat een pagina die automatisch veelvoorkomende configuratieproblemen diagnosticeert en indien nodig suggesties doet om deze te verhelpen.", + "admin_checkupButton": "Diagnostiek uitvoeren", + "admin_consentToContactTitle": "Toestemming voor contact", + "admin_consentToContactHint": "Servertelemetrie omvat het e-mailadres van de beheerder, zodat de ontwikkelaars u op de hoogte kunnen brengen van ernstige problemen met de software of uw configuratie. Dit adres wordt nooit gedeeld, verkocht of gebruikt voor marketingdoeleinden. Geef toestemming voor contact als u op de hoogte wilt worden gehouden van kritieke problemen met uw server.", + "admin_consentToContactLabel": "Ik ga akkoord", + "admin_listMyInstanceTitle": "Mijn instantie in openbare mappen vermelden", + "admin_listMyInstanceHint": "Als uw instantie geschikt is voor openbaar gebruik, kunt u toestemming geven om in webgidsen te worden opgenomen. Server-telemetrie moet zijn ingeschakeld om dit te laten werken.", + "admin_listMyInstanceLabel": "Vermeld deze instantie", + "admin_removeDonateButtonTitle": "Deelname aan crowdfunding", + "admin_removeDonateButtonHint": "De ontwikkeling van CryptPad wordt gedeeltelijk gefinancierd door publieke subsidies en donaties. Door onze crowdfunding-inspanningen op uw instantie te adverteren, helpt u de ontwikkelaars om het platform voor iedereen te blijven verbeteren, maar u kunt deze mededelingen uitschakelen als u ze ongepast vindt.", + "admin_removeDonateButtonLabel": "Maak geen reclame voor crowdfundingcampagnes", + "admin_blockDailyCheckTitle": "Servertelemetrie", + "admin_blockDailyCheckHint": "CryptPad-instanties sturen een bericht naar de server van de ontwikkelaars wanneer ze worden gestart en daarna één keer per dag. Zo kunnen ze bijhouden hoeveel servers welke versies van de software draaien. U kunt zich hieronder afmelden voor deze meting. De inhoud van dit bericht kunt u terugvinden in het logboek van de applicatieserver.", + "admin_blockDailyCheckLabel": "Server-telemetrie uitschakelen", + "admin_provideAggregateStatisticsTitle": "Statistische aggregatie", + "admin_provideAggregateStatisticsHint": "U kunt ervoor kiezen om aanvullende gebruiksstatistieken aan de ontwikkelaars te verstrekken, zoals het geschatte aantal geregistreerde en dagelijkse gebruikers voor uw instantie.", + "admin_provideAggregateStatisticsLabel": "Verstrek geaggregeerde statistieken", + "form_poll_hint": ": Ja, : Nee, : Aanvaardbaar", + "fc_open_formro": "Open (als deelnemer)", + "resources_imageBlocked": "CryptPad heeft een externe afbeelding geblokkeerd", + "resources_openInNewTab": "Open het in een nieuw tabblad", + "resources_learnWhy": "Ontdek waarom het werd geblokkeerd", + "admin_instancePurposeTitle": "Doel van het exemplaar", + "admin_purpose_noanswer": "Ik zeg het liever niet", + "admin_purpose_experiment": "Om het platform te testen of nieuwe functies te ontwikkelen", + "admin_purpose_personal": "Voor mezelf, familie of vrienden", + "admin_purpose_org": "Voor een non-profitorganisatie of belangenbehartigingsgroep", + "admin_purpose_education": "Voor een school, hogeschool of universiteit", + "admin_purpose_public": "Om een gratis dienst aan het publiek te verlenen", + "admin_purpose_business": "Voor een bedrijf of commerciële organisatie", + "admin_instancePurposeHint": "Waarom draait u deze instantie? Uw antwoord wordt gebruikt om de ontwikkelingsroutekaart te informeren als uw telemetrie is ingeschakeld.", + "team_leaveOwner": "Verwijder jezelf uit de rol van eigenaar voordat je de groep verlaat. Houd er rekening mee dat groepen ten minste één eigenaar moeten hebben. Voeg er een toe voordat je verdergaat als je momenteel de enige eigenaar bent.", + "form_exportCSV": "Exporteren naar CSV", + "notification_openLink": "Je hebt een koppeling {0} ontvangen van {1}:", + "fm_link_name": "Koppelingsnaam", + "notification_linkShared": "{0} heeft een link met je gedeeld: {1}", + "form_anonName": "Uw naam", + "form_answerAs": "Antwoord als", + "fm_link_warning": "Waarschuwing: de URL bevat meer dan 200 tekens", + "fm_link_invalid": "Geef een geldige URL op", + "ui_collapse": "Samenvouwen", + "ui_expand": "Uitbreiden", + "form_totalResponses": "Totaal aantal reacties: {0}", + "support_premiumPriority": "Premiumgebruikers helpen bij het verbeteren van de bruikbaarheid van CryptPad en profiteren van prioritaire reacties op hun ondersteuningsverzoeken.", + "support_premiumLink": "Bekijk abonnementsopties", + "toolbar_collapse": "Werkbalk samenvouwen", + "toolbar_expand": "Werkbalk uitbreiden", + "profile_defaultAlt": "Standaard profielfoto", + "upload_modal_alt": "Alt-tekst", + "upload_addOptionalAlt": "Beschrijvende tekst toevoegen (optioneel)", + "form_template_poll": "Snelle planning- peiling", + "form_preview_button": "Voorbeeld", + "form_alreadyAnswered": "Je hebt gereageerd op dit formulier op {0}", + "form_editAnswer": "Mijn reacties bewerken", + "form_viewAnswer": "Bekijk mijn reacties", + "form_viewAllAnswers": "Bekijk alle reacties ({0})", + "form_anonAnswer": "Reacties op dit formulier zijn geanonimiseerd", + "form_authAnswer": "Dit formulier kan niet anoniem worden ingediend", + "form_requiredWarning": "De volgende vragen moeten beantwoord worden:", + "form_required_answer": "Antwoord: ", + "form_required_on": "Vereist", + "form_required_off": "Optioneel", + "form_preview": "Voorbeeldformulier", + "form_changeTypeConfirm": "Selecteer het nieuwe vraagtype.", + "form_corruptAnswers": "Dit formulier bevat al reacties. Als u dit vraagtype wijzigt, kunnen eerdere reacties ongeldig worden.", + "form_geturl": "Openbare koppeling kopiëren", + "toolbar_preview": "Voorbeeld", + "form_addMsg": "Bericht indienen toevoegen", + "form_responseMsg": "Dit bericht wordt weergegeven nadat deelnemers het formulier hebben ingediend.", + "form_makeAnon": "Reacties anonimiseren", + "form_editable": "Bewerking na indiening", + "form_type_section": "Voorwaardelijke sectie", + "form_condition_q": "Kies een vraag", + "form_condition_v": "Kies een waarde", + "form_condition_is": "is", + "form_condition_isnot": "Is niet", + "form_condition_has": "heeft", + "form_condition_hasnot": "heeft niet", + "form_conditional": "Toon dit gedeelte alleen wanneer:", + "form_conditional_add": "OR-voorwaarde toevoegen", + "form_conditional_addAnd": "Voeg EN-voorwaarde toe", + "userlist_visitProfile": "Bezoek profiel", + "form_colors": "Themakleur", + "form_conditional_hint": "Om dit gedeelte voorwaardelijk te maken, voeg je erboven een keuze- of selectievakjevraag toe", + "creation_new": "Nieuw {0}", + "fc_openIn": "Open in {0}", + "download_step3": "Bezig met converteren...", + "premiumOnly": "Het aanmaken van nieuwe documenten in deze applicatie is momenteel beperkt tot abonnees op {0}. Dit is een experimentele applicatie in vroege toegang voor testdoeleinden. Binnenkort zal deze voor iedereen beschikbaar zijn op {0}.", + "earlyAccessBlocked": "Deze applicatie is nog niet beschikbaar op deze instantie", + "premiumAccess": "Als abonnee op {0} kunt u nieuwe documenten aanmaken in deze applicatie met vroege toegang. Houd er rekening mee dat deze applicatie experimenteel is en nog niet geschikt is voor belangrijke gegevens.", + "form_exportSheet": "Exporteren naar blad", + "form_answerChoice": "Kies hoe u dit formulier wilt beantwoorden:", + "bounce_confirm": "U staat op het punt om {0} te verlaten.\n\nWeet u zeker dat u \"{1}\" wilt bezoeken?", + "bounce_danger": "De link waarop u hebt geklikt, leidt niet naar een webpagina, maar naar code of gegevens die schadelijk kunnen zijn.\n\n(\"{0}\")\n\nCryptPad blokkeert deze om veiligheidsredenen. Als u op OK klikt, wordt dit tabblad gesloten.", + "admin_archiveNote": "Notitie", + "admin_nameTitle": "Naam van de instantie", + "admin_nameHint": "De naam die voor deze instantie wordt weergegeven in de lijst met openbare instanties op cryptpad.org", + "ui_saved": "{0} bewaard", + "admin_descriptionTitle": "Instantieomschrijving", + "admin_descriptionHint": "De beschrijvende tekst die voor deze instantie wordt weergegeven in de lijst met openbare instanties op cryptpad.org", + "admin_jurisdictionTitle": "Hostinglocatie", + "admin_jurisdictionHint": "Het land waar de versleutelde gegevens van deze instantie worden gehost", + "footer_source": "Broncode", + "info_termsFlavour": "Servicevoorwaarden voor deze instantie", + "info_sourceFlavour": "Broncode voor CryptPad", + "support_warning_prompt": "Kies de categorie die het meest relevant is voor uw probleem. Dit helpt beheerders bij het triëren en biedt verdere suggesties voor welke informatie u moet verstrekken", + "support_warning_account": "Houd er rekening mee dat beheerders geen wachtwoorden kunnen resetten. Als u de inloggegevens voor uw account bent kwijtgeraakt, maar nog steeds bent ingelogd, kunt u uw gegevens naar een nieuw account overzetten", + "support_warning_drives": "Houd er rekening mee dat beheerders mappen en documenten niet op naam kunnen identificeren. Voor gedeelde mappen dient u een document-ID op te geven", + "support_warning_document": "Geef aan welk type document het probleem veroorzaakt en vermeld een documentidentificatie of een koppeling", + "support_warning_bug": "Geef aan in welke browser het probleem zich voordoet en of er extensies zijn geïnstalleerd. Geef zoveel mogelijk details over het probleem en de stappen die nodig zijn om het te reproduceren", + "support_warning_abuse": "Meld inhoud die in strijd is met de Servicevoorwaarden. Geef koppelingen naar de betreffende documenten of gebruikersprofielen en beschrijf hoe deze in strijd zijn met de voorwaarden. Alle aanvullende informatie over de context waarin u de inhoud of het gedrag hebt ontdekt, kan beheerders helpen om toekomstige overtredingen te voorkomen", + "support_warning_other": "Wat is de aard van uw vraag? Geef zoveel mogelijk relevante informatie, zodat wij uw vraag snel kunnen beantwoorden", + "support_cat_drives": "Schijf of groep", + "support_cat_document": "Document", + "support_cat_abuse": "Misbruik melden", + "ui_openDirectly": "Deze functionaliteit is niet beschikbaar wanneer CryptPad in een andere site is ingesloten. Dit document in een nieuw tabblad openen?", + "support_cat_debugging": "Foutopsporingsgegevens", + "support_debuggingDataTitle": "Informatie over het opsporen van fouten in accounts", + "support_debuggingDataHint": "De volgende informatie wordt opgenomen in de ondersteuningsaanvragen die u indient. Geen van deze informatie stelt beheerders in staat om toegang te krijgen tot uw documenten of deze te ontsleutelen. Deze informatie is zodanig versleuteld dat alleen beheerders deze kunnen lezen.", + "fivehundred_internalServerError": "Interne serverfout", + "admin_cacheEvictionRequired": "De server is bijgewerkt met de nieuwe instelling. Gebruik de knop Cache leegmaken om ervoor te zorgen dat deze wijziging voor alle gebruikers zichtbaar wordt.", + "admin_reviewCheckupNotice": "Het wordt aanbevolen om de pagina checkup te bekijken om te controleren of deze instantie correct is geconfigureerd.", + "admin_infoNotice1": "Gebruik de volgende velden om uw instantie te beschrijven. Deze informatie wordt gebruikt op de voorpagina van de instantie. Ze wordt ook verzonden als onderdeel van de servertelemetrie als u ervoor kiest om opgenomen te worden in de lijst van openbare CryptPad-instanties.", + "admin_infoNotice2": "Zie het tabblad 'Netwerk' voor meer informatie.", + "admin_enableDiskMeasurementsTitle": "Meet de schijfprestaties", + "admin_enableDiskMeasurementsHint": "Indien ingeschakeld, wordt een JSON API-eindpunt weergegeven onder /api/profiling. Dit houdt een lopende meting bij van schijf-I/O binnen het hieronder ingestelde tijdvenster. Deze instelling kan van invloed zijn op de serverprestaties en kan gevoelige gegevens onthullen. Het wordt aanbevolen om deze instelling uitgeschakeld te laten, tenzij u weet wat u doet.", + "admin_bytesWrittenTitle": "Venster voor het meten van schijfprestaties", + "admin_bytesWrittenHint": "Als u schijfprestatiemetingen hebt ingeschakeld, kunt u hieronder de duur van het venster configureren.", + "admin_setDuration": "Duur instellen", + "ui_ms": "milliseconden", + "admin_enableembedsTitle": "Inbedding op afstand inschakelen", + "admin_enableembedsHint": "Sta toe dat documenten en media van deze instantie worden ingesloten op andere websites. Hierdoor wordt een optie 'Insluiten' toegevoegd aan het menu Delen. Om veiligheidsredenen kunnen applicaties die OnlyOffice gebruiken (Sheets, Document, Presentation) niet worden ingesloten, zelfs als deze instelling actief is.", + "error_embeddingDisabled": "Insluiten is uitgeschakeld voor deze CryptPad-instantie", + "error_embeddingDisabledSpecific": "insluiten is uitgeschakeld voor deze CryptPad-applicatie.", + "error_incorrectAccess": "Deze pagina is alleen toegankelijk via {0}.", + "error_evalPermitted": "Afbreken omdat eval niet toegestaan zou moeten zijn.\n\nDeze foutmelding houdt verband met Content-Security-Policy-headers en kan het gevolg zijn van: een verouderde browser die deze headers niet ondersteunt, browserextensies die de juiste werking ervan verstoren, of een onjuiste configuratie van deze CryptPad-instantie.", + "ui_experimental": "Deze functie wordt als experimenteel beschouwd.", + "admin_noticeTitle": "Kennisgeving op de startpagina", + "admin_noticeHint": "Een optioneel bericht dat op de startpagina kan worden weergegeven", + "footer_website": "Projectwebsite", + "home_location": "Versleutelde gegevens worden gehost in {0}", + "home_morestorage": "Voor meer opslagruimte:", + "login_instance": "Maak verbinding met uw account op {0}", + "register_instance": "Een nieuw account aanmaken op {0}", + "admin_uptimeTitle": "Starttijd", + "admin_uptimeHint": "Datum en tijdstip waarop de server werd gestart", + "admin_cat_database": "Database", + "admin_generatedAt": "Tijdstempel van het rapport", + "ui_true": "Waar", + "ui_false": "Vals", + "ui_undefined": "Onbekend", + "ui_none": "Geen", + "ui_generateReport": "Rapport genereren", + "ui_success": "Succes", + "ui_fetch": "Halen", + "ui_confirm": "Bevestigen", + "ui_archive": "Archief", + "admin_archiveReason": "Geef de reden voor archivering op en bevestig dat u wilt doorgaan", + "admin_restoreReason": "Geef de reden voor het herstel aan en bevestig dat u wilt doorgaan", + "admin_accountMetadataTitle": "Accountgegevens", + "admin_accountMetadataHint": "Voer de openbare sleutel van een gebruiker in om gegevens over zijn account op te halen.", + "admin_documentMetadataTitle": "Documentinformatie", + "admin_documentMetadataHint": "Een document of bestand opvragen via het id of de URL ervan", + "admin_documentSize": "Documentgrootte", + "admin_documentMetadata": "Huidige metadata", + "admin_documentCreationTime": "Gemaakt", + "admin_documentModifiedTime": "Laatst gewijzigd", + "admin_currentlyOpen": "Momenteel open", + "admin_channelAvailable": "Beschikbaar", + "admin_channelArchived": "Gearchiveerd", + "admin_documentMetadataPlaceholder": "Document-URL of id", + "admin_blockMetadataTitle": "Informatie over geblokkeerde aanmeldingen", + "admin_blockMetadataHint": "Het inlogblok zorgt ervoor dat een account kan inloggen op CryptPad met de combinatie van gebruikersnaam + wachtwoord", + "admin_blockMetadataPlaceholder": "Absolute of relatieve blok-URL", + "admin_accountMetadataPlaceholder": "Gebruikers-id (openbare ondertekeningssleutel)", + "admin_firstPinTime": "Eerste pinactiviteitstijd", + "admin_lastPinTime": "Laatste pinactiviteitstijd", + "admin_currentlyOnline": "Is momenteel online", + "admin_planName": "Naam van het plan", + "admin_note": "Opmerking bij het plan", + "admin_storageUsage": "Opgeslagen gegevens", + "admin_channelCount": "Aantal documenten", + "admin_fileCount": "Aantal bestanden", + "admin_pinLogAvailable": "Pinlogboek is beschikbaar", + "admin_pinLogArchived": "Pinlogboek wordt gearchiveerd", + "admin_blockKey": "Openbare sleutel blokkeren", + "admin_blockAvailable": "Block is beschikbaar", + "admin_blockArchived": "Block is gearchiveerd", + "admin_archiveBlock": "Blokkeer archief", + "admin_restoreBlock": "Herstel geblokkeerd archief", + "admin_getPinList": "Huidige pinlijst", + "admin_archiveDocument": "Archiveer document", + "admin_restoreDocument": "Herstel document", + "admin_planlimit": "Opslaglimiet", + "admin_reportContent": "Meld inhoud", + "admin_getRawMetadata": "Metadata-geschiedenis", + "og_teamDrive": "Groepsschijf", + "og_default": "CryptPad: end-to-end versleutelde samenwerkingssuite", + "og_login": "Log in op {0}", + "og_register": "Registreer een account op {0}", + "og_contact": "{0} Contactpersoon", + "og_pricing": "{0} Prijzen", + "og_features": "{0} Functies", + "ui_jsRequired": "JavaScript moet ingeschakeld zijn om versleuteling in uw browser uit te voeren", + "og_encryptedAppType": "Versleuteld {0}", + "admin_documentConflict": "Archiveren/herstellen", + "admin_conflictExplanation": "Er bestaan twee versies van dit document. Als u de gearchiveerde versie herstelt, wordt de live versie overschreven. Als u de live versie archiveert, wordt de gearchiveerde versie overschreven. Beide acties kunnen niet ongedaan worden gemaakt.", + "fm_filterBy": "Filter", + "fm_rmFilter": "Verwijder filter", + "calendar_rec": "Herhaal", + "calendar_rec_no": "Één keer", + "calendar_rec_updated": "Regel bijgewerkt op {0}", + "calendar_rec_daily": "Dagelijks", + "calendar_rec_stop": "Stop herhaling", + "calendar_rec_weekly": "Weekelijks op {0}", + "calendar_rec_edit_all": "Alle evenementen bewerken", + "calendar_rec_monthly": "Maandelijks, dag {1}", + "calendar_rec_edit_from": "Toekomstige evenementen bewerken", + "calendar_rec_yearly": "Jaarlijks op {2}", + "calendar_rec_edit_one": "Alleen dit evenement bewerken", + "calendar_rec_weekend": "Dagelijks op weekenden", + "calendar_rec_edit": "Dit is een terugkerend evenement", + "calendar_str_filter_day": "Dagen: {0}", + "calendar_rec_weekdays": "Dagelijks op weekdagen", + "calendar_str_filter_monthday": "Dagen van de maand: {0}", + "calendar_rec_custom": "Aangepast", + "calendar_str_filter_yearday": "Dagen van het jaar: {0}", + "calendar_str_filter": "Filters:", + "calendar_str_nthdayofmonth": "op de {0} van {1}", + "calendar_str_weekly": "{0} week(en)", + "calendar_rec_monthly_pick": "Op dagen", + "calendar_str_yearly": "{0} jaar/jaren", + "calendar_nth_1": "Eerst", + "team_inviteRole": "Initiële rol", + "team_inviteUses": "Toegestane gebruik(en) voor deze koppeling (0 = geen beperking)", + "form_alreadyAnsweredMult": "U hebt op dit formulier gereageerd op:", + "form_responseNotification": "Nieuwe reacties op het formulier: {0}", + "form_allowNotifications": "Meldingen voor nieuwe reacties", + "form_editable_off": "Eenmalig", + "form_editable_on_del": "Eenmalig en bewerken/verwijderen", + "form_multiple": "Meerdere keren", + "form_multiple_edit": "Meerdere keren en bewerken/verwijderen", + "form_editable_str": "Indiening", + "team_linkUsesInfinite": "(onbeperkt gebruik)", + "team_linkUses": "({0}/{1} resterend)", + "form_anonymized": "De reacties zijn geanonimiseerd", + "form_settingsButton": "Formulierinstellingen", + "form_editable_on": "Eenmalig en bewerken", + "form_showCondorcetMethod": "Condorcet-methode", + "form_condorcetSchulze": "School", + "form_condorcetRanked": "Gerangschikte paren", + "form_showCondorcetWinner": "winnaar: ", + "form_showDetails": "Gegevens", + "form_condorcetExtendedDisplay": "Aantal gewonnen wedstrijden per kandidaat: ", + "form_noCondorcetWinner": "Geen winnaar", + "form_type_date": "Datum", + "settings_mfaTitle": "Twee-Stappen Verificatie (2FA)", + "settings_mfaHint": "Beveilig uw account met een extra verificatiecode die wordt verstrekt door een authenticator-app naar keuze", + "done": "Klaar", + "continue": "Doorgaan", + "mfa_setup_label": "Om 2FA in te schakelen, begint u met het invoeren van uw accountwachtwoord", + "mfa_setup_button": "Begin met het instellen van 2FA", + "mfa_revoke_label": "Om 2FA uit te schakelen, voer eerst het wachtwoord van uw account in", + "mfa_revoke_button": "Bevestig het uitschakelen van 2FA", + "mfa_revoke_code": "Voer uw verificatiecode in", + "mfa_status_on": "2FA is actief op dit account", + "mfa_status_off": "2FA is niet actief op dit account", + "mfa_recovery_title": "Sla deze herstelcode nu op", + "mfa_recovery_hint": "Als u de toegang tot uw authenticator-app kwijtraakt, kunt u worden buitengesloten van uw CryptPad-account. Deze herstelcode kan worden gebruikt om 2FA uit te schakelen en u weer toegang te geven.", + "mfa_recovery_warning": "Deze code wordt niet opnieuw getoond. Bewaar hem nu op een veilige plek en deel hem met niemand.", + "mfa_enable": "2FA inschakelen", + "mfa_disable": "2FA uitschakelen", + "settings_otp_code": "Verificatiecode", + "settings_otp_invalid": "Ongeldige verificatiecode", + "settings_otp_tuto": "Scan deze QR-code met uw authenticator-app en voer de verificatiecode in om te bevestigen.", + "settings_removeOwnedTitle": "Vernietig alle documenten die je in je bezit hebt", + "settings_removeOwnedButton": "Vernietig documenten die je in bezit hebt", + "settings_removeOwnedText": "Even geduld terwijl je documenten worden vernietigd...", + "settings_removeOwnedHint": "Alle documenten waarvan u de enige eigenaar bent, worden definitief vernietigd", + "recovery_header": "2FA herstel", + "recovery_mfa_description": "Als u geen toegang meer hebt tot uw tweefactorauthenticatiemethode, kunt u 2FA voor uw account uitschakelen met behulp van uw herstelcode. Begin met het invoeren van uw gebruikersnaam en wachtwoord:", + "recovery_mfa_secret": "Voer uw herstelcode in om 2FA voor uw account uit te schakelen:", + "recovery_forgot": "Herstelcode vergeten", + "recovery_forgot_text": "Kopieer de volgende informatie en mail deze naar uw instantiebeheerders", + "recovery_mfa_error": "Onbekende fout. Laad de pagina opnieuw en probeer het nog eens.", + "recovery_mfa_disabled": "Meervoudige authenticatie is al uitgeschakeld voor dit account.", + "admin_totpRecoveryTitle": "2FA herstel", + "admin_totpRecoveryHint": "Gebruikers kunnen herstelgegevens kopiëren op de 2FA-herstelpagina /herstel/ en deze per e-mail naar de beheerders van de instantie sturen. Plak de herstelgegevens hieronder om 2FA voor een account uit te schakelen", + "admin_totpEnabled": "2FA is ingeschakeld", + "admin_totpRecoveryMethod": "2FA herstel methode", + "admin_totpFailed": "Handtekeningverificatie mislukt", + "admin_totpCheck": "Handtekeningverificatie geslaagd", + "admin_totpDisable": "2FA voor dit account uitschakelen", + "admin_totpDisableButton": "Uitschakelen", + "register_nameTooLong": "Gebruikersnamen moeten korter zijn dan {0} tekens", + "loading_enter_otp": "Dit account is beveiligd met tweefactorauthenticatie. Voer uw verificatiecode in", + "loading_recover": "Kunt u geen code ontvangen? Herstel uw account", + "recovery_mfa_secret_ph": "Herstelcode", + "label_logo": "Logo van CryptPad", + "login_notFilledUser": "Vul een gebruikersnaam in", + "login_notFilledPass": "Vul een wachtwoord in", + "calendar_settings": "Kalenderinstellingen", + "goLeft": "Links", + "goRight": "Rechts", + "date": "Datum", + "context_menu": "Mapacties", + "label_viewMode": "Weergavemodus wisselen", + "team_nameTooLong": "De groepsnaam is te lang (max. 50 tekens)", + "team_nameAlreadySet": "De groepsnaam is al ingesteld op {0}", + "selectLanguage": "Selecteer een taal", + "dph_reason": "Reden: {0}", + "dph_sf_pw": "De gedeelde map {0} is beveiligd met een nieuw wachtwoord. Voer het nieuwe wachtwoord in om toegang te krijgen tot deze map of om deze map van uw schijf te verwijderen.", + "dph_sf_destroyed": "Gedeelde map {0} is door een eigenaar vernietigd", + "dph_sf_destroyed_team": "Gedeelde map {0} in groepsschijf {1} is vernietigd door een eigenaar", + "admin_archiveAccount": "Dit account archiveren", + "admin_archiveAccountInfo": "Inclusief de documenten die het in eigendom heeft", + "admin_archiveAccountConfirm": "Geef de reden voor archivering op, deze wordt aan de gebruiker getoond.", + "admin_restoreAccount": "Dit account herstellen", + "admin_accountSuspended": "Account gearchiveerd door beheerder", + "admin_accountReport": "Meld accountsarchief", + "admin_accountReportFull": "Gedetailleerd rapport ontvangen", + "admin_channelPlaceholder": "Vernietigd documentbeheer", + "dph_default": "Deze inhoud is niet langer beschikbaar", + "dph_account_destroyed": "Dit account is verwijderd door de eigenaar", + "dph_account_inactive": "Dit account is verwijderd vanwege inactiviteit", + "dph_account_moderated": "Dit account is opgeschort door het moderatiegroep", + "dph_account_pw": "Het wachtwoord voor dit account is gewijzigd", + "dph_pad_destroyed": "Dit document is door een eigenaar vernietigd", + "dph_pad_inactive": "Dit document is verwijderd vanwege inactiviteit", + "dph_pad_moderated": "Dit document is verwijderd door de moderatiegroep", + "dph_pad_moderated_account": "Dit document is verwijderd omdat het behoorde tot een opgeschort account", + "dph_pad_pw": "Dit document is beveiligd met een nieuw wachtwoord", + "dph_tmp_destroyed": "Dit sjabloon is vernietigd door een eigenaar", + "dph_tmp_moderated": "Dit sjabloon is verwijderd door de moderatiegroep", + "dph_tmp_moderated_account": "Dit sjabloon is verwijderd omdat het bij een opgeschort account hoorde", + "dph_tmp_pw": "Dit sjabloon is beveiligd met een nieuw wachtwoord. Open het vanuit uw schijf om het nieuwe wachtwoord in te voeren.", + "access_passwordUsed": "Dit wachtwoord is al gebruikt voor dit document. Het kan niet opnieuw worden gebruikt.", + "status": "Statuspagina", + "admin_diskUsageWarning": "Wees voorzichtig! Afhankelijk van de grootte van de gegevens die op de instantie zijn opgeslagen, kan het genereren van dit rapport al het beschikbare geheugen op de server in beslag nemen en tot een crash leiden.", + "calendar_rec_change_first": "De eerste terugkerende gebeurtenis naar een andere agenda verplaatsen. Alle terugkerende gebeurtenissen worden ook verplaatst.", + "calendar_rec_change": "Een terugkerende gebeurtenis naar een andere agenda verplaatsen. U kunt deze wijziging alleen toepassen op deze gebeurtenis of op alle terugkerende gebeurtenissen.", + "calendar_desc": "Beschrijving", + "calendar_description": "Beschrijving:{0}{1}", + "sso_login_description": "Inloggen met", + "sso_register_description": "Registreer u bij", + "ssoauth_header": "CryptPad wachtwoord", + "ssoauth_form_hint_register": "Voeg een CryptPad-wachtwoord toe voor extra beveiliging of laat het veld leeg en ga verder. Als u geen wachtwoord toevoegt, zijn de sleutels die uw gegevens beveiligen beschikbaar voor de beheerders van de instantie.", + "ssoauth_form_hint_login": "Voer uw CryptPad wachtwoord in", + "duplicate": "Duplicaat", + "kanban_showTags": "Alle labels zien", + "kanban_hideTags": "Minder labels zien", + "admin_forcemfaTitle": "Verplichte Twee-Stappen Verificatie", + "admin_forcemfaHint": "Alle gebruikers op deze instantie zullen worden gevraagd om tweefactorauthenticatie in te stellen om in te loggen op hun account. Houd er rekening mee dat bestaande gebruikers hun account niet kunnen blijven gebruiken zonder een TOTP-applicatie in te stellen.", + "loading_mfa_required": "Twee-Stappen verificatie is vereist voor deze instantie. Werk uw account bij met behulp van een authenticatie-app en het onderstaande formulier.", + "admin_cat_users": "Gebruikerslijst", + "admin_registrationSsoTitle": "Sluit SSO registratie", + "admin_invitationTitle": "Uitnodigings koppelingen", + "admin_invitationCreate": "Uitnodigingskopping aanmaken", + "admin_invitationHint": "Uitnodigingskoppelingen creëren elk één account, zelfs als de registratie gesloten is. De gebruikersnaam en het e-mailadres zijn alleen bedoeld voor identificatiedoeleinden. CryptPad stuurt de uitnodigingskoppeling ( of iets anders) niet per e-mail. Kopieer de koppeling en verstuur deze via een beveiligd kanaal naar keuze.", + "admin_invitationLink": "Uitnodigingskoppeling", + "admin_invitationCopy": "Koppeling kopiëren", + "admin_invitationAlias": "Gebruikersnaam", + "admin_invitationEmail": "E-mailadres van gebruiker", + "admin_invitationDeleteConfirm": "Weet je zeker dat je deze uitnodiging wilt verwijderen?", + "admin_usersTitle": "Gebruikerslijst", + "admin_usersHint": "Lijst met bekende accounts op deze instantie. Selecteer hieronder om accounts automatisch toe te voegen, of voer de informatie handmatig in via het formulier.", + "admin_usersAdd": "Bekende gebruiker toevoegen", + "admin_storeInvitedLabel": "Uitgenodigde gebruikers automatisch opslaan", + "admin_storeSsoLabel": "SSO-gebruikers automatisch opslaan", + "admin_usersBlock": "URL voor gebruikersaanmeldingsblokkering (optioneel)", + "admin_usersRemove": "Verwijderen", + "admin_usersRemoveConfirm": "Weet u zeker dat u deze gebruiker uit de lijst wilt verwijderen? Ze kunnen nog steeds toegang krijgen tot hun account en deze gebruiken.", + "register_invalidToken": "De uitnodigingskoppeling is ongeldig", + "admin_cat_security": "Beveiliging", + "admin_cat_customize": "Aanpassen", + "admin_logoTitle": "Aangepast logo", + "admin_logoHint": "SVG, PNG of JPG, maximale grootte 200 KB", + "admin_logoButton": "Nieuw uploaden", + "admin_colorTitle": "Accentkleur", + "admin_logoRemoveButton": "Standaardinstellingen herstellen", + "admin_colorHint": "Wijzig de accentkleur van uw CryptPad-instantie. Zorg ervoor dat tekst en knoppen goed leesbaar zijn met voldoende contrast in zowel lichte als donkere thema's.", + "admin_colorCurrent": "Huidige accentkleur", + "admin_colorChange": "Kleur wijzigen", + "admin_colorPick": "Kies een kleur", + "admin_colorPreview": "Voorbeeldkleur", + "admin_supportSetupHint": "Maak of werk de ondersteuningssleutels bij.", + "admin_supportSetupTitle": "Ondersteuning initialiseren", + "admin_supportEnabled": "Ondersteuningssysteem is ingeschakeld.", + "admin_supportDisabled": "Het ondersteuningssysteem is uitgeschakeld.", + "admin_supportInit": "Helpdesk op deze instantie initialiseren", + "admin_supportDelete": "Ondersteuning uitschakelen", + "admin_supportConfirm": "Weet je het zeker? Hierdoor worden alle bestaande aanvragen verwijderd en wordt de toegang voor alle moderators geblokkeerd.", + "admin_supportMembers": "Ondersteuningsteam", + "admin_supportAdd": "Voeg een contactpersoon toe aan het ondersteuningsteam", + "admin_supportRotateNotify": "Waarschuwing: er zijn nieuwe sleutels gegenereerd, maar door een onverwachte fout kon het systeem deze niet naar de moderators verzenden. Verwijder alle leden van het ondersteuningsteam en voeg ze opnieuw toe", + "moderationPage": "Klantenservice", + "support_cat_open": "Postvak", + "support_cat_closed": "Gesloten", + "support_cat_search": "Zoeken", + "support_cat_settings": "Instellingen", + "support_cat_legacy": "Legaat", + "support_pending": "Gearchiveerde aanvragen:", + "support_pending_tag": "Gearchiveerd", + "support_active_tag": "Postvak In", + "support_closed_tag": "Gesloten", + "support_privacyTitle": "Anoniem antwoorden", + "support_privacyHint": "Vink deze optie aan om te reageren als 'Het ondersteuningsteam' in plaats van met uw eigen gebruikersnaam", + "support_notificationsTitle": "Meldingen uitschakelen", + "support_notificationsHint": "Vink deze optie aan om meldingen voor nieuwe aanvragen en reacties uit te schakelen", + "support_openTicketTitle": "Open een aanvraag met een gebruiker", + "support_openTicketHint": "Kopieer de gegevens van de ontvanger uit hun profielpagina of een bestaand aanvraag. Zij zullen een CryptPad-melding ontvangen over dit bericht.", + "support_userChannel": "Kanaal-ID voor meldingen van gebruikers", + "support_userKey": "Openbare sleutel van de gebruiker", + "support_invalChan": "Ongeldig meldingenkanaal", + "admin_supportTeamTitle": "Beheer ondersteuningsteam", + "admin_supportTeamHint": "Mensen toevoegen aan en verwijderen uit het ondersteuningsteam van de instantie", + "support_pasteUserData": "Plak hier gebruikersgegevens", + "support_recordedTitle": "Fragmenten", + "support_recordedHint": "Sla veelgebruikte tekst op als snelkoppelingen die u met één klik kunt invoegen in ondersteuningsberichten.", + "support_recordedEmpty": "Geen fragmenten", + "support_recordedId": "Fragment-ID (uniek)", + "support_recordedContent": "Inhoud", + "support_legacyTitle": "Bekijk oude ondersteuningsgegevens", + "support_legacyHint": "Bekijk tickets uit het legaten ondersteuningssysteem en maak ze opnieuw aan in het nieuwe systeem.", + "support_legacyButton": "Krijg actieve aanvragen", + "support_legacyDump": "Alles exporteren", + "support_legacyClear": "Verwijderen voor dit account", + "support_searchLabel": "Zoeken (titel of ticket-ID)", + "support_team": "Het ondersteuningsteam", + "support_answerAs": "Antwoord als {0}", + "support_movePending": "Verplaatsen naar archief", + "support_moveActive": "Verplaats naar actief", + "support_copyUserData": "Gebruikersgegevens kopiëren", + "support_insertRecorded": "Fragment invoegen", + "admin_supportOpen": "Open helpdesk", + "support_userNotification": "Nieuw supportticket of reactie: {0}", + "install_instance": "Maak het eerste beheerdersaccount aan en ga vervolgens verder met het aanpassen van deze instantie", + "install_token": "Installatietoken", + "install_header": "Installatie", + "admin_appSelection": "App configuratie", + "install_launch": "Instantie-instellingen", + "admin_appsTitle": "Instantie toepassingen", + "onboarding_save_error": "Sommige opties konden niet correct worden opgeslagen. Ga naar het beheerpaneel om de waarden te controleren.", + "admin_appsHint": "Kies welke apps u op deze instantie wilt inschakelen.", + "admin_cat_apps": "Toepassingen", + "onboarding_upload": "Logo selecteren", + "admin_onboardingNameTitle": "Welkom bij uw CryptPad-instantie", + "admin_onboardingNameHint": "Kies een titel, beschrijving, accentkleur en logo (allemaal optioneel)", + "admin_onboardingOptionsTitle": "Instantie opties", + "admin_onboardingOptionsHint": "Selecteer de juiste optie voor uw instantie.
                  Deze instellingen kunnen later in het beheerderspaneel worden gewijzigd.", + "admin_onboardingNamePlaceholder": "Titel van de instantie", + "admin_onboardingDescPlaceholder": "Beschrijving tekst van de instantie", + "team_autoTrim": "Geschiedenis van de groepsschijf... Even geduld a.u.b.", + "admin_mfa_confirm_enable": "Weet u zeker dat u meervoudige authenticatie wilt inschakelen?", + "admin_mfa_confirm_disable": "Weet u zeker dat u meervoudige authenticatie wilt uitschakelen?", + "form_passwordWarning": "Houd er rekening mee dat een formulierwachtwoord alleen kan worden ingesteld op het moment van aanmaken en later niet meer kan worden gewijzigd.", + "fm_restoreMultipleDialog": "Weet u zeker dat u {0} bestanden en/of mappen wilt herstellen naar hun vorige locaties?", + "calendar_show": "Kalenders weergeven", + "calendar_hide": "Kalenders verbergen", + "admin_logoSize_error": "Het logo is te groot", + "admin_listAdminsHint": "Beheerders bekijken en verwijderen", + "error_limit": "Voer een geldig nummer in", + "form_answerType_error": "Selecteer hoe u het formulier wilt beantwoorden", + "admin_addKeyLabel": "Voeg een beheerder toe met behulp van hun openbare sleutel", + "error_positiveNumber": "Voer een positief getal in", + "admin_cat_admins": "Beheerders", + "admin_admin": "Beheerder", + "admin_listAdminsTitle": "Huidige beheerders", + "admin_addAdminsAdd": "Een contactpersoon promoten tot beheerder", + "admin_addAdminsTitle": "Beheerders toevoegen", + "admin_errorAddAdmins": "Kies een contactpersoon om te promoveren tot beheerder", + "admin_addAdminsHint": "Voeg beheerders toe op basis van hun openbare sleutel of vanuit uw contactenlijst", + "moveItemLeft": "Item naar links verplaatsen", + "admin_errorAddKeyLabel": "Voeg een geldige openbare sleutel toe", + "skipLink": "Ga naar de hoofdinhoud", + "admin_listName": "Naam beheerder", + "admin_listKey": "Beheerderssleutel", + "moveItemRight": "Item naar rechts verplaatsen", + "admin_listAction": "Beheerdersrechten verwijderen", + "kanban_moveBoardRight": "Verplaats bord naar rechts", + "admin_listHardcoded": "Admin toegevoegd aan config.js. Kan alleen worden verwijderd door het configuratiebestand te bewerken.", + "addItemBottom": "Kaart onderaan het bord toevoegen", + "admin_listConfirm": "Weet u zeker dat u de beheerdersrechten van deze gebruiker wilt verwijderen?", + "addItemTop": "Kaart bovenaan het bord toevoegen", + "kanban_moveBoardLeft": "Verplaats bord naar links", + "toggleDrag": "Sleep om items te verplaatsen", + "moveItemUp": "Item omhoog verplaatsen", + "moveItemDown": "Item naar beneden verplaatsen", + "toggleArrows": "Pijltjestoetsen om items te verplaatsen", + "profile_remove_avatar": "Verwijder deze avatar", + "oo_couldNotConvertDocument": "Het converteren van het document is mislukt. Houd er rekening mee dat Microsoft Office-formaten (.docx, .xlsx, .pptx) momenteel de beste resultaten opleveren voor importeren en exporteren.", + "oo_unstableMigrationWarning": "Het importeren en exporteren van sommige OpenDocument-formaten (.odt, .odp) is momenteel onstabiel. We raden aan om waar mogelijk andere formaten te gebruiken. CryptPad zal nu een zo goed mogelijke conversie uitvoeren.", + "badges_admin": "Beheerder", + "badges_moderator": "Ondersteuning en moderatie", + "badges_premium": "Abonnee", + "badges_error": "Validatiefout", + "profile_badges": "Naamplaatje", + "show_password": "Toon wachtwoord", + "hide_password": "Verberg wachtwoord", + "page_previous": "Vorige pagina", + "page_next": "Volgende pagina", + "settings_profileHeaderHint": "Kies wat anderen zien over je account", + "contact_mastodon": "Mastodon", + "contact_forum": "Forum", + "settings_profileAvatarLabel": "Avatar", + "settings_profileHeaderTitle": "Profiel informatie", + "toolbar_text_tools": "Teksthulpmiddelen", + "toolbar_show_text_tools": "Teksthulpmiddelen weergeven", + "toolbar_hide_text_tools": "Teksthulpmiddelen verbergen", + "help_close_button": "Help-melding sluiten", + "fc_open_formaud": "Open (als auditeur)", + "admin_documentsDeletionTitle": "Meerdere documenten archiveren", + "admin_documentsDeletionHint": "Archiveer een lijst met documenten op basis van hun id (één document-id per regel)", + "password_note1": "Uw wachtwoord is de geheime sleutel die al uw documenten versleutelt.", + "password_note2": "Als u uw gegevens kwijtraakt, kunnen wij ze op geen enkele manier meer herstellen.", + "password_note3": "Uw wachtwoord is de geheime sleutel waarmee al uw documenten en beheerdersrechten op dit exemplaar worden gecodeerd.", + "computer_note": "Als u een gedeelde computer gebruikt, {0}vergeet dan niet uit te loggen{1} wanneer u klaar bent. Alleen als u het browservenster sluit, blijft uw account zichtbaar.", + "import_note": "Als u de documenten die u hebt gemaakt en/of opgeslagen wilt bewaren zonder dat u bent ingelogd, vinkt u 'Documenten importeren uit uw gastsessie' aan.", + "admin_creation_note": "Maak op deze pagina uw eerste beheerdersaccount aan. Beheerders beheren de instellingen van de instantie, waaronder opslagquota, en hebben toegang tot moderatietools.", + "forms_switchHorizontalAxe": "Overschakelen naar horizontale lay-out", + "forms_switchVerticalAxe": "Overschakelen naar verticale lay-out", + "forms_pollOptionNo": "nee", + "forms_pollOptionYes": "Ja", + "forms_pollOptionMaybe": "Misschien", + "color0": "Geen Kleur", + "color1": "Rood", + "color2": "Oranje", + "color3": "Geel", + "color4": "Groen", + "color5": "Donker groen", + "color6": "Turkoois", + "color7": "Blauw", + "color8": "Paars", + "loading_encrypted": "Eind to Eind versleuteld", + "crowdfunding_button2": "Doneer", + "admin_activePadsHint": "Aantal unieke documenten dat momenteel wordt bekeken of bewerkt" } diff --git a/www/common/translations/messages.pl.json b/www/common/translations/messages.pl.json index d53932519..56a8136aa 100644 --- a/www/common/translations/messages.pl.json +++ b/www/common/translations/messages.pl.json @@ -1860,5 +1860,8 @@ "color6": "Turkusowy", "color7": "Niebieski", "color8": "Fioletowy", - "loading_encrypted": "szyfrowane od końca do końca" + "loading_encrypted": "szyfrowane od końca do końca", + "form_poll_required_hint": "Ta ankieta jest obowiązkowa, należy wybrać co najmniej jedną opcję.", + "fo_trash_move_error": "Zawartości folderów współdzielonych nie można przenieść do kosza. Zamiast tego użyj opcji „Usuń”.", + "fo_sharedFolder_move_error": "Folderów współdzielonych nie można przenosić do innych folderów współdzielonych." } diff --git a/www/common/translations/messages.pt-br.json b/www/common/translations/messages.pt-br.json index d9cfda449..d8e1742fd 100644 --- a/www/common/translations/messages.pt-br.json +++ b/www/common/translations/messages.pt-br.json @@ -39,7 +39,7 @@ "upgrade": "Upgrade", "MB": "MB", "GB": "GB", - "KB": "KB", + "KB": "kB", "formattedMB": "{0} MB", "formattedGB": "{0} GB", "formattedKB": "{0} KB", diff --git a/www/common/translations/messages.ro.json b/www/common/translations/messages.ro.json index 7f7c498bf..a82ed0d76 100644 --- a/www/common/translations/messages.ro.json +++ b/www/common/translations/messages.ro.json @@ -1817,5 +1817,51 @@ "admin_listName": "Nume admin", "admin_listHardcoded": "Admin adăugat în config.js. Poate fi șters doar prin modificarea fișierului de configurație.", "profile_remove_avatar": "Șterge acest avatar", - "oo_unstableMigrationWarning": "Funcționalitatea de Import și Export pentru unele formate OpenDocument (.odt, .odp) sunt instabile în momentul de față. Recomandăm utilizarea altor formate dacă este posibil. CryptPad va încerca acum să realizeze conversia." + "oo_unstableMigrationWarning": "Funcționalitatea de Import și Export pentru unele formate OpenDocument (.odt, .odp) sunt instabile în momentul de față. Recomandăm utilizarea altor formate dacă este posibil. CryptPad va încerca acum să realizeze conversia.", + "password_note1": "Parola dumneavoastră este cheia secreta care vă criptează toate documentele.", + "password_note2": "Dacă o pierdeți, nu vă putem recupera datele în nici un fel.", + "password_note3": "Parola dumneavoastră este cheia secretă care vă criptează toate documentele și privilegiile de administrator pe această instanță.", + "computer_note": "Dacă împărțiți computer-ul cu mai multe persoane, {0}țineți minte să vă deconectați{1} când terminați. Dacă doar închideți pagina din browser, contul dumneavoastră rămâne expus.", + "import_note": "Pentru a păstra documentele pe care le-ați creat și/sau salvat fără să fiți înregistrat, bifați \"Importă documente din sesiunea de invitat\".", + "admin_creation_note": "Creați-vă primul cont de administrator pe această pagină. Administratorii gestionează setările instanței inclusiv setează limite pentru spațiul de stocare, și au acces la instrumente de moderare.", + "forms_switchHorizontalAxe": "Schimbă la layout orizontal", + "forms_switchVerticalAxe": "Schimbă la layout vertical", + "forms_pollOptionNo": "Nu", + "forms_pollOptionYes": "Da", + "forms_pollOptionMaybe": "Poate", + "color0": "Fără culoare", + "color1": "Roșu", + "color2": "Portocaliu", + "color3": "Galben", + "color4": "Verde", + "color5": "Verde închis", + "color6": "Turcoaz", + "color7": "Albastru", + "color8": "Mov", + "loading_encrypted": "criptare end-to-end", + "oo_couldNotConvertDocument": "Conversia documentului a eșuat. Momentan, conversia formatelor Microsoft Office (.docx, .xslx, .pptx) produce cele mai bune rezultate la import și export.", + "badges_admin": "Administrator", + "badges_moderator": "Suport și moderare", + "badges_premium": "Abonat", + "badges_error": "Eroare de validare", + "profile_badges": "Insignă", + "show_password": "Arată parola", + "hide_password": "Ascunde parola", + "page_previous": "Pagina anterioară", + "page_next": "Pagina următoare", + "settings_profileHeaderHint": "Alege ceea ce ceilalți văd despre contul tău", + "contact_mastodon": "Mastodon", + "contact_forum": "Forum", + "settings_profileAvatarLabel": "Avatar", + "settings_profileHeaderTitle": "Informații despre profil", + "toolbar_text_tools": "Unelte pentru text", + "toolbar_show_text_tools": "Afișează uneltele pentru text", + "toolbar_hide_text_tools": "Ascunde uneltele pentru text", + "help_close_button": "Închide notificarea de ajutor", + "fc_open_formaud": "Deschide (ca auditor)", + "admin_documentsDeletionTitle": "Arhivează documente multiple", + "admin_documentsDeletionHint": "Arhivează o listă de documente după id (un id per linie)", + "form_poll_required_hint": "Această întrebare este obligatorie, trebuie să interacționați cu cel puțin o opțiune.", + "fo_trash_move_error": "Conținutul unui dosar distribuit nu poate fi mutat la gunoi. În schimb, folosiți funcția \"Elimină\".", + "fo_sharedFolder_move_error": "Dosarele distribuite nu pot fi mutate în alte dosare distribuite." } diff --git a/www/common/translations/messages.ru.json b/www/common/translations/messages.ru.json index be5498a99..b935ecfdd 100644 --- a/www/common/translations/messages.ru.json +++ b/www/common/translations/messages.ru.json @@ -294,7 +294,7 @@ "printCSS": "Пользовательские настройки вида (CSS):", "viewEmbedTag": "Чтобы встроить данный документ, вставьте этот iframe в нужную страницу. Вы можете настроить внешний вид используя CSS или атрибуты HTML.", "fm_ownedPadsName": "Собственный", - "fm_info_anonymous": "Вы не вошли в учетную запись, поэтому срок действия ваших документов истечет через {0} дней. Они хранятся в вашем браузере, поэтому очистка истории может привести к их исчезновению.
                  Зарегистрируйтесь или Войдите чтобы сохранить их. Подробнее о зарегистрированных аккаунтах.", + "fm_info_anonymous": "Вы не вошли в учётную запись, поэтому срок действия Ваших документов истечёт через {0} дней. Они хранятся только в Вашем браузере, поэтому очистка истории браузера может привести к их исчезновению.
                  Зарегистрируйтесь или Войдите чтобы сохранить их. Подробнее о зарегистрированных аккаунтах.", "fm_burnThisDriveButton": "Удалить всю информацию, хранящуюся от CryptPad в браузере", "fm_tags_used": "Количество использований", "fm_restoreDrive": "Восстановление прежнего состояния диска. Для достижения наилучших результатов не вносите изменения в диск, пока этот процесс не будет завершен.", @@ -455,12 +455,12 @@ "settings_driveDuplicateHint": "Когда Вы помещаете свои документы в общую папку, копия сохраняется в Вашем CryptDrive, чтобы удостовериться, что Вы всё ещё имеете контроль над ними. Вы можете скрыть продублированные файлы. Будет отображена только публичная версия документа (если не удалена), иначе будет отображена оригинальная версия и место, где ее последнего расположения.", "settings_driveDuplicateTitle": "Дубликаты собственных документов", "settings_logoutEverywhereConfirm": "Вы уверены? Вам придётся войти в аккаунт на всех устройствах.", - "settings_autostoreHint": "Автоматически Все открытые вами документы будут сохранены в вашем CryptDrive.
                  Вручную (всегда спрашивать) Если вы еще не сохранили документ, вам будет предложено сохранить документ в CryptDrive.
                  Вручную (никогда не спрашивать) Документы не будут автоматически сохраняться в вашем CryptDrive. Кнопка для их сохранения будет скрыта.", + "settings_autostoreHint": "Автоматически Все открытые Вами документы будут сохранены в Вашем CryptDrive.
                  Вручную (всегда спрашивать) Если Вы еще не сохранили документ, Вам будет предложено сохранить документ в CryptDrive.
                  Вручную (никогда не спрашивать) Документы не будут автоматически сохраняться в Вашем CryptDrive. Кнопка для их сохранения будет скрыта.", "register_emailWarning3": "Нажмите OK, если осознанно хотите использовать свою почту в качестве имени пользователя.", "register_emailWarning2": "Восстановить ваш пароль с помощью почты, как на других сайтах, не получится.", "register_emailWarning1": "Вы можете сделать это, если хочется, но на наш сервер это отправлено не будет.", "register_emailWarning0": "Похоже, что ваша почта и имя пользователя совпадают.", - "password_submit": "Задать", + "password_submit": "Готово", "team_pendingOwner": "(ожидание)", "team_deleteButton": "Удалить", "team_pending": "Приглашённые", @@ -498,7 +498,7 @@ "adminPage": "Администрирование", "admin_cat_stats": "Статистика", "admin_cat_general": "Общее", - "autostore_store": "Хранить", + "autostore_store": "Скопировать", "autostore_pad": "документ", "autostore_sf": "папка", "autostore_file": "файл", @@ -598,7 +598,7 @@ "features_f_devices": "Ваши документы на всех устройствах", "features_f_cryptdrive1_note": "Папки, общие папки, шаблоны, теги", "features_f_cryptdrive1": "Полная функциональность CryptDrive", - "features_f_anon_note": "С дополнительными функциями", + "features_f_anon_note": "С дополнительными возможностями", "features_anon": "Гость", "features_f_anon": "Все функции доступные гостю", "features_f_storage0_note": "Документы удаляются после {0} дней бездействия", @@ -706,7 +706,7 @@ "redo": "Повторить", "undo": "Отменить", "settings_cacheHint": "CryptPad хранит части ваших документов в памяти вашего браузера, чтобы сократить использование сети и сократить время загрузки. Вы можете отключить кеш, если на вашем устройстве недостаточно свободного места для хранения. По соображениям безопасности кеш всегда очищается при выходе из системы, но вы можете очистить его вручную, если хотите освободить место для хранения на вашем компьютере.", - "autostore_notstored": "Этот {0} не в вашем CryptDrive. Вы хотите сохранить его сейчас?", + "autostore_notstored": "Этот {0} не в вашем CryptDrive. Хотите скопировать его туда сейчас?", "chrome68": "Похоже, вы используете браузер Chrome или Chromium версии 68. Он содержит ошибку, из-за которой через несколько секунд страница становится полностью белой или страница не реагирует на клики мышью. Чтобы решить эту проблему, вы можете переключиться на другую вкладку и вернуться или попробовать прокрутить страницу. Эта ошибка должна быть исправлена в следующей версии вашего браузера.", "convertFolderToSF_confirm": "Эта папка должна быть преобразована в общую папку, чтобы другие могли ее просматривать. Продолжать?", "convertFolderToSF_SFChildren": "Эту папку нельзя преобразовать в общую папку, поскольку она уже содержит общие папки. Чтобы продолжить, переместите эти общие папки в другое место.", @@ -920,7 +920,7 @@ "contact_bug": "Сообщить об ошибке", "contact_devHint": "Для запросов новых функций, улучшений удобства использования или для того, чтобы поблагодарить.", "contact_dev": "Связаться с разработчиками", - "contact_adminHint": "По любым вопросам, связанным с Вашей учетной записью, лимитом хранилища или доступностью службы.\n", + "contact_adminHint": "По любым вопросам, связанным с Вашей учётной записью, лимитом хранилища или доступностью сервиса.\n", "contact_admin": "Связаться с администраторами: {0}", "admin_flushCacheDone": "Кеш успешно очищен", "admin_flushCacheButton": "Очистить кеш", @@ -943,8 +943,8 @@ "autostore_notAvailable": "Вы должны сохранить этот документ на Вашем CryptDrive, прежде чем сможете использовать эту функцию.", "autostore_forceSave": "Сохраните файл в Вашем CryptDrive", "autostore_saved": "Документ успешно сохранен на вашем CryptDrive!", - "autostore_error": "Неожиданная ошибка: нам не удалось сохранить этот документ, пожалуйста попробуйте еще раз.", - "autostore_hide": "Не хранить", + "autostore_error": "Неожиданная ошибка: нам не удалось скопировать этот документ, пожалуйста попробуйте еще раз.", + "autostore_hide": "Не копировать", "autostore_settings": "Вы можете включить автоматическое хранение документов на странице Настройки.", "areYouSure": "Вы уверены?", "settings_safeLinksHint": "CryptPad указывает ключи для расшифровки Ваших документов в ссылках. Любой, у кого есть доступ к Вашей истории просмотров, потенциально может прочитать Ваши данные. Сюда входят подсматривающие расширения для браузеров и браузеры, которые синхронизируют Вашу историю на разных устройствах. Включение «безопасных ссылок» предотвращает попадание ключей в историю просмотров или отображение в адресной строке везде, где это возможно. Мы настоятельно рекомендуем Вам включить эту функцию и использовать меню {0} Поделиться для создания ссылок общего доступа.", @@ -1116,8 +1116,8 @@ "errorPopupBlocked": "Для работы CryptPad должен иметь возможность открывать новые вкладки. Пожалуйста, разрешите всплывающие окна в адресной строке вашего браузера. Эти окна никогда не будут использоваться для показа рекламы.", "tag_edit": "Изменить", "tag_add": "Добавить", - "loading_state_5": "Восстановить документ", - "loading_state_4": "Загрузить команды", + "loading_state_5": "Восстановление документа", + "loading_state_4": "Загрузка Команд", "team_exportHint": "Скачайте все документы с диска этой команды. Документы будут загружаться в форматах, доступных для чтения другими приложениями, если такой формат доступен. Когда такой формат недоступен, документы будут загружены в формате, доступном для чтения CryptPad.", "team_exportTitle": "Скачать диск команды", "admin_limitSetNote": "Заметка", @@ -1839,5 +1839,29 @@ "help_close_button": "Закрыть уведомление о помощи", "fc_open_formaud": "Открыть (как аудитор)", "admin_documentsDeletionTitle": "Архивировать несколько документов", - "admin_documentsDeletionHint": "Архивировать несколько документов, используя их идентификаторы (по одному идентификатору документа в строке)" + "admin_documentsDeletionHint": "Архивировать несколько документов, используя их идентификаторы (по одному идентификатору документа в строке)", + "password_note1": "Пароль — это секретный ключ, который шифрует все ваши документы.", + "password_note2": "Если Вы потеряете его, мы не сможем восстановить Ваши данные.", + "password_note3": "Ваш пароль — это секретный ключ, который шифрует все Ваши документы и права администратора в этом экземпляре.", + "computer_note": "Если Вы используете общий компьютер, {0}не забудьте выйти из системы{1} когда закончите. Если Вы только закроете окно браузера, Ваш профиль останется незапертым.", + "import_note": "Чтобы сохранить документы, которые Вы создали и/или сохранили не входя в систему, установите флажок «Импортировать документы из гостевого сеанса».", + "admin_creation_note": "На этой странице создайте свой первый аккаунт администратора. Администраторы управляют настройками экземпляров, включая квоты хранилища, и имеют доступ к инструментам модерации.", + "forms_switchHorizontalAxe": "Переключить на горизонтальную компоновку", + "forms_switchVerticalAxe": "Переключить на вертикальную компоновку", + "forms_pollOptionNo": "Нет", + "forms_pollOptionYes": "Да", + "forms_pollOptionMaybe": "Возможно", + "color0": "Без цвета", + "color1": "Красный", + "color2": "Оранжевый", + "color3": "Жёлтый", + "color4": "Зелёный", + "color5": "Тёмно-зелёный", + "color6": "Бирюзовый", + "color7": "Синий", + "color8": "Фиолетовый", + "loading_encrypted": "с сквозным шифрованием", + "form_poll_required_hint": "Этот вопрос обязателен, Вы должны выбрать хотя бы один вариант.", + "fo_trash_move_error": "Содержимое общей папки нельзя переместить в корзину. Вместо этого используйте \"Удалить\".", + "fo_sharedFolder_move_error": "Общие папки нельзя перемещать внутрь других общих папок." } diff --git a/www/common/translations/messages.zh.json b/www/common/translations/messages.zh.json index 0a6f9bdbc..42a430f30 100644 --- a/www/common/translations/messages.zh.json +++ b/www/common/translations/messages.zh.json @@ -351,8 +351,8 @@ "uploadButtonTitle": "将新文件上传到您的 CryptDrive", "uploadFolderButton": "上传文件夹", "uploadButton": "上传文件", - "form_required_on": "必要的", - "form_required_off": "选项", + "form_required_on": "必填", + "form_required_off": "选填", "form_preview": "表格预览", "form_changeTypeConfirm": "选择新的问题类型。", "form_corruptAnswers": "此表单已经有回复。 更改此问题类型可能会使以前的响应数据无效。", @@ -1839,5 +1839,29 @@ "fc_open_formaud": "打开(作为审计者)", "help_close_button": "关闭帮助通知", "admin_documentsDeletionTitle": "归档多个文档", - "admin_documentsDeletionHint": "使用文档 ID 归档文档列表(每行一个文档 ID)" + "admin_documentsDeletionHint": "使用文档 ID 归档文档列表(每行一个文档 ID)", + "forms_pollOptionNo": "否", + "forms_pollOptionYes": "是", + "forms_pollOptionMaybe": "可能", + "color0": "无颜色", + "color1": "红色", + "color2": "橙色", + "color3": "黄色", + "color4": "绿色", + "color5": "深绿色", + "color6": "蓝绿色", + "color7": "蓝色", + "color8": "紫色", + "loading_encrypted": "端到端加密", + "forms_switchHorizontalAxe": "切换到横向布局", + "forms_switchVerticalAxe": "切换到纵向布局", + "password_note1": "您的密码是用于加密所有文档的密钥。", + "password_note2": "如果您丢失了密码,我们将无法恢复您的数据。", + "password_note3": "您的密码是加密此实例上所有文档和管理员权限的密钥。", + "computer_note": "如果您使用的是共享计算机,{0}请记住在操作完成后登出{1}。仅关闭浏览器窗口会导致账号暴露。", + "import_note": "要保留您在未登录的情况下创建和/或存储的文档,请勾选“从访客会话导入文档”。", + "admin_creation_note": "在此页面创建首个管理员账号。管理员可管理实例设置,包括存储配额,并有权使用审核工具。", + "form_poll_required_hint": "此投票为必选项,您必须至少选择一个选项。", + "fo_trash_move_error": "共享文件夹内容无法移至回收站,请改用“移除”。", + "fo_sharedFolder_move_error": "共享文件夹无法移至其他共享文件夹内。" } diff --git a/www/common/worker.bundle.min.js b/www/common/worker.bundle.min.js index 636e109a5..fc5d9040e 100644 --- a/www/common/worker.bundle.min.js +++ b/www/common/worker.bundle.min.js @@ -1 +1 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["cryptpad-worker-min"]={})}(this,function(e){"use strict";function n(e,n){return n.forEach(function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach(function(t){if("default"!==t&&!(t in e)){var r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:function(){return n[t]}})}})}),Object.freeze(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if("function"==typeof n){var t=function e(){var t=!1;try{t=this instanceof e}catch{}return t?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}),t}var a,i={exports:{}},s={exports:{}},c={exports:{}};function u(){return a||(a=1,function(e){var n;n=function(){var e=function(){},n=function(){return(new Date).getTime()},t=function(e,n,t){e.timeouts.push(setTimeout(n,t))},r=function(n,r){n.ws&&(n.ws.onmessage=e,n.ws.onopen=e,n.ws.close(),r?n.ws.onclose({reason:"offline"}):t(n,function(){n.ws&&n.ws.onclose({reason:"forced closed because websocket failed to close"})},1e4))},o=function(e,n){return!!e.ws&&(e.ws.send(JSON.stringify(n)),!0)},a=function(e,n){return function(e,t){var r=n[e];if(!r)throw new Error("no such event "+e);r.push(t)}},i=function(e,n,t,r){var o=r[n];if(!o)throw new Error("no such event "+n);var a=o.indexOf(t);-1!==a&&o.splice(a,1)},s=function(e,t,r){if(e.channels[t])return new Promise(function(n){n(e.channels[t])});var s=e.queues.p2;1===r?s=e.queues.p1:3===r&&(s=e.queues.p3);var c={queue:s,onMessage:[],onJoin:[],onLeave:[],members:[],jSeq:e.seq++},u={message:c.onMessage,join:c.onJoin,leave:c.onLeave},f={_:c,time:n(),id:t,members:c.members,bcast:function(t){return function(e,t,r){var a=e.channels[t],i=e.seq++,s=[i,"MSG",t,r];if(!a)return new Promise(function(e,n){n({type:"NO_SUCH_CHANNEL",message:JSON.stringify(s)})});var c=o(e,s);return new Promise(function(t,r){c?e.requests[i]={channel:a,reject:r,resolve:t,time:n()}:r({type:"DISCONNECTED",message:JSON.stringify(s)})})}(e,f.id,t)},leave:function(t){return function(e,t,r){if(e.channels[t]){if(delete e.channels[t],e.ws&&1===e.ws.readyState){var a=e.seq++;o(e,[a,"LEAVE",t,r]);var i=function(){};e.requests[a]={reject:i,resolve:i,time:n()}}}else console.debug("no such channel",t)}(e,f.id,t)},on:a(0,u),off:function(e,n){i(0,e,n,u)}};e.requests[c.jSeq]=f;var l=[c.jSeq,"JOIN",t],d=o(e,l);return new Promise(function(e,n){d?(f._.resolve=e,f._.reject=n):n({type:"DISCONNECTED",message:JSON.stringify(l)})})},c=function(t){var r={message:t.onMessage,disconnect:t.onDisconnect,reconnect:t.onReconnect},c={webChannels:t.channels,getLag:function(){return function(e){return e.ws?e.pingOutstanding?Math.max(n()-e.timeOfLastPingSent,e.lastObservedLag):e.lastObservedLag:null}(t)},sendto:function(e,r){return function(e,t,r){var a=e.seq++,i=[a,"MSG",t,r],s=o(e,i);return new Promise(function(t,r){s?e.requests[a]={reject:r,resolve:t,time:n()}:r({type:"DISCONNECTED",message:JSON.stringify(i)})})}(t,e,r)},join:function(e,n){return s(t,e,n)},disconnect:function(){return function(n){if(n.ws){var t=n.ws.onclose;n.ws.onclose=e,n.ws.close(),t({reason:"network.disconnect() called"})}n.timeouts.forEach(clearTimeout),n.timeouts=[]}(t)},on:a(0,r),off:function(e,n){i(0,e,n,r)}};return c.__defineGetter__("webChannels",function(){return Object.keys(t.channels).map(function(e){return t.channels[e]})}),c},u=function(e){if(!e.queues.busy){var n=function(){var t=e.queues.p1.shift()||e.queues.p2.shift()||e.queues.p3.shift();if(t){e.queues.busy=!0;var r=t.h,o=t.msg;Promise.resolve().then(()=>{t.resolve?t.resolve():r.forEach(function(e){try{e(o[4],o[1])}catch(e){console.error(e)}})}).then(n)}else e.queues.busy=!1};n()}};return{connect:function(a,i){i=i||function(e){return new globalThis.WebSocket(e)};var s={ws:null,seq:1,uid:null,network:null,channels:{},onMessage:[],onDisconnect:[],onReconnect:[],timeouts:[],requests:{},pingInterval:null,queues:{p1:[],p2:[],p3:[]},timeOfLastPingSent:-1,timeOfLastPingReceived:-1,timeOfLastMsgReceived:-1,lastObservedLag:0,pingOutstanding:0};s.network=c(s);var f=e,l=e;"undefined"!=typeof window&&window.addEventListener("offline",function(){-1===["localhost","127.0.0.1",""].indexOf(window.location.hostname)&&r(s,!0)});var d=function(){var c=s.ws=i(a);s.timeOfLastPingSent=s.timeOfLastPingReceived=n(),s.timeOfLastMsgReceived=n(),c.onmessage=function(e){return function(e,t){var a=void 0;try{a=JSON.parse(t.data)}catch(e){return void console.log(e.stack)}if(e.timeOfLastMsgReceived=n(),0===a[0]){if("IDENT"===a[2])return e.uid=a[3],e.ws._onident(),void(e.pingInterval=setInterval(function(){if(!(n()-e.timeOfLastPingReceived<15e3||(n()-e.timeOfLastMsgReceived>6e4&&r(e),e.pingOutstanding))){var t=e.seq++,a=n();e.timeOfLastPingSent=a,e.pingOutstanding++,e.requests[t]={time:a,ping:a},o(e,[t,"PING"])}},5e3));if(e.uid){if("PING"===a[2])return a[2]="PONG",void o(e,a);if("MSG"===a[2]){var i=void 0,s=e.queues.p2;if(a[3]===e.uid)i=e.onMessage,"number"==typeof a[5]&&(1===a[5]&&(s=e.queues.p1),3===a[5]&&(s=e.queues.p3));else{var c=e.channels[a[3]];if(!c)return void console.log("message to non-existent chan "+JSON.stringify(a));i=c._.onMessage,c._.queue&&(s=c._.queue)}s.push({msg:a,h:i}),u(e)}if("LEAVE"===a[2]){var f=e.channels[a[3]];if(!f)return void(a[1]!==e.uid&&console.log("leaving non-existent chan "+JSON.stringify(a)));var l=f._.members.indexOf(a[1]);-1!==l&&f._.members.splice(l,1),f._.onLeave.forEach(function(e){try{e(a[1],a[4])}catch(e){console.log(e.stack)}})}if("JOIN"===a[2]){var d=e.channels[a[3]];if(!d)return void console.log("ERROR: join to non-existent chan "+JSON.stringify(a));if(-1!==d._.members.indexOf(a[1]))return;var h=-1!==d._.members.indexOf(e.uid);d._.members.push(a[1]),h||a[1]!==e.uid||(d.myID=e.uid,d._.resolve(d)),h&&d._.onJoin.forEach(function(e){try{e(a[1])}catch(e){console.log(e.stack)}})}}}else{var p=e.requests[a[0]];if(!p)return void console.log("error: "+JSON.stringify(a));if(delete e.requests[a[0]],"ACK"===a[1]){if(p.ping)return e.lastObservedLag=n()-Number(p.ping),e.timeOfLastPingReceived=n(),void e.pingOutstanding--;if(p.channel){const n=p.channel;let t=e.queues.p2;return n._.queue&&(t=n._.queue),t.push({msg:a,resolve:p.resolve}),void u(e)}p.resolve()}else if("JACK"===a[1]){if(p._){if(!a[2])throw new Error("wrong type of ACK for channel join");return p.id=a[2],void(e.channels[p.id]=p)}p.resolve()}else if("ERROR"===a[1])if("function"==typeof p.reject)p.reject({type:a[2],message:a[3]});else if(p._&&"function"==typeof p._.reject){if("EJOINED"===a[2]&&!e.channels[a[3]])return p.id=a[3],void(e.channels[p.id]=p);p._.reject({type:a[2],message:a[3]})}else console.error(a);else p.reject({type:"UNKNOWN",message:JSON.stringify(a)})}}(s,e)},c.onclose=function(n){c.onclose=e,clearInterval(s.pingInterval),s.timeouts.forEach(clearTimeout),s.ws=null,s.uid&&(s.uid=null,s.onDisconnect.forEach(function(e){try{e(n.reason)}catch(e){console.log(e.stack)}})),t(s,d,s.uid?0:7e3)},c.onopen=function(){t(s,function(){s.uid||(l({type:"TIMEOUT",message:"waited 30000ms"}),f=l=e,r(s))},3e4)},s.ws._onident=function(){s.timeOfLastPingReceived=n(),s.timeOfLastMsgReceived=n(),s.lastObservedLag=n()-s.timeOfLastPingSent,f!==e?(f(s.network),f=l=e):(s.channels={},s.requests={},s.pingOutstanding=0,s.onReconnect.forEach(function(e){try{e(s.uid)}catch(e){console.log(e.stack)}}))}};return new Promise(function(e,n){f=e,l=n,d()})}}},e.exports?e.exports=n():window.netflux_websocket=n()}(c)),c.exports}function f(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var l,d={exports:{}};function h(){return l||(l=1,function(e){!function(e){var n=function(e){var n,t=new Float64Array(16);if(e)for(n=0;n>24&255,e[n+1]=t>>16&255,e[n+2]=t>>8&255,e[n+3]=255&t,e[n+4]=r>>24&255,e[n+5]=r>>16&255,e[n+6]=r>>8&255,e[n+7]=255&r}function v(e,n,t,r,o){var a,i=0;for(a=0;a>>8)-1}function y(e,n,t,r){return v(e,n,t,r,16)}function m(e,n,t,r){return v(e,n,t,r,32)}function g(e,n,t,r){!function(e,n,t,r){for(var o,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,i=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,s=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,c=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,u=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,f=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,l=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,d=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,p=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,v=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,y=255&t[16]|(255&t[17])<<8|(255&t[18])<<16|(255&t[19])<<24,m=255&t[20]|(255&t[21])<<8|(255&t[22])<<16|(255&t[23])<<24,g=255&t[24]|(255&t[25])<<8|(255&t[26])<<16|(255&t[27])<<24,E=255&t[28]|(255&t[29])<<8|(255&t[30])<<16|(255&t[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,O=a,A=i,w=s,D=c,_=u,T=f,S=l,N=d,I=h,x=p,C=v,R=y,P=m,k=g,M=E,F=b,L=0;L<20;L+=2)O^=(o=(P^=(o=(I^=(o=(_^=(o=O+P|0)<<7|o>>>25)+O|0)<<9|o>>>23)+_|0)<<13|o>>>19)+I|0)<<18|o>>>14,T^=(o=(A^=(o=(k^=(o=(x^=(o=T+A|0)<<7|o>>>25)+T|0)<<9|o>>>23)+x|0)<<13|o>>>19)+k|0)<<18|o>>>14,C^=(o=(S^=(o=(w^=(o=(M^=(o=C+S|0)<<7|o>>>25)+C|0)<<9|o>>>23)+M|0)<<13|o>>>19)+w|0)<<18|o>>>14,F^=(o=(R^=(o=(N^=(o=(D^=(o=F+R|0)<<7|o>>>25)+F|0)<<9|o>>>23)+D|0)<<13|o>>>19)+N|0)<<18|o>>>14,O^=(o=(D^=(o=(w^=(o=(A^=(o=O+D|0)<<7|o>>>25)+O|0)<<9|o>>>23)+A|0)<<13|o>>>19)+w|0)<<18|o>>>14,T^=(o=(_^=(o=(N^=(o=(S^=(o=T+_|0)<<7|o>>>25)+T|0)<<9|o>>>23)+S|0)<<13|o>>>19)+N|0)<<18|o>>>14,C^=(o=(x^=(o=(I^=(o=(R^=(o=C+x|0)<<7|o>>>25)+C|0)<<9|o>>>23)+R|0)<<13|o>>>19)+I|0)<<18|o>>>14,F^=(o=(M^=(o=(k^=(o=(P^=(o=F+M|0)<<7|o>>>25)+F|0)<<9|o>>>23)+P|0)<<13|o>>>19)+k|0)<<18|o>>>14;O=O+a|0,A=A+i|0,w=w+s|0,D=D+c|0,_=_+u|0,T=T+f|0,S=S+l|0,N=N+d|0,I=I+h|0,x=x+p|0,C=C+v|0,R=R+y|0,P=P+m|0,k=k+g|0,M=M+E|0,F=F+b|0,e[0]=O>>>0&255,e[1]=O>>>8&255,e[2]=O>>>16&255,e[3]=O>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=w>>>0&255,e[9]=w>>>8&255,e[10]=w>>>16&255,e[11]=w>>>24&255,e[12]=D>>>0&255,e[13]=D>>>8&255,e[14]=D>>>16&255,e[15]=D>>>24&255,e[16]=_>>>0&255,e[17]=_>>>8&255,e[18]=_>>>16&255,e[19]=_>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=S>>>0&255,e[25]=S>>>8&255,e[26]=S>>>16&255,e[27]=S>>>24&255,e[28]=N>>>0&255,e[29]=N>>>8&255,e[30]=N>>>16&255,e[31]=N>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=x>>>0&255,e[37]=x>>>8&255,e[38]=x>>>16&255,e[39]=x>>>24&255,e[40]=C>>>0&255,e[41]=C>>>8&255,e[42]=C>>>16&255,e[43]=C>>>24&255,e[44]=R>>>0&255,e[45]=R>>>8&255,e[46]=R>>>16&255,e[47]=R>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=k>>>0&255,e[53]=k>>>8&255,e[54]=k>>>16&255,e[55]=k>>>24&255,e[56]=M>>>0&255,e[57]=M>>>8&255,e[58]=M>>>16&255,e[59]=M>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}(e,n,t,r)}function E(e,n,t,r){!function(e,n,t,r){for(var o,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,i=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,s=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,c=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,u=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,f=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,l=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,d=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,p=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,v=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,y=255&t[16]|(255&t[17])<<8|(255&t[18])<<16|(255&t[19])<<24,m=255&t[20]|(255&t[21])<<8|(255&t[22])<<16|(255&t[23])<<24,g=255&t[24]|(255&t[25])<<8|(255&t[26])<<16|(255&t[27])<<24,E=255&t[28]|(255&t[29])<<8|(255&t[30])<<16|(255&t[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,O=0;O<20;O+=2)a^=(o=(m^=(o=(h^=(o=(u^=(o=a+m|0)<<7|o>>>25)+a|0)<<9|o>>>23)+u|0)<<13|o>>>19)+h|0)<<18|o>>>14,f^=(o=(i^=(o=(g^=(o=(p^=(o=f+i|0)<<7|o>>>25)+f|0)<<9|o>>>23)+p|0)<<13|o>>>19)+g|0)<<18|o>>>14,v^=(o=(l^=(o=(s^=(o=(E^=(o=v+l|0)<<7|o>>>25)+v|0)<<9|o>>>23)+E|0)<<13|o>>>19)+s|0)<<18|o>>>14,b^=(o=(y^=(o=(d^=(o=(c^=(o=b+y|0)<<7|o>>>25)+b|0)<<9|o>>>23)+c|0)<<13|o>>>19)+d|0)<<18|o>>>14,a^=(o=(c^=(o=(s^=(o=(i^=(o=a+c|0)<<7|o>>>25)+a|0)<<9|o>>>23)+i|0)<<13|o>>>19)+s|0)<<18|o>>>14,f^=(o=(u^=(o=(d^=(o=(l^=(o=f+u|0)<<7|o>>>25)+f|0)<<9|o>>>23)+l|0)<<13|o>>>19)+d|0)<<18|o>>>14,v^=(o=(p^=(o=(h^=(o=(y^=(o=v+p|0)<<7|o>>>25)+v|0)<<9|o>>>23)+y|0)<<13|o>>>19)+h|0)<<18|o>>>14,b^=(o=(E^=(o=(g^=(o=(m^=(o=b+E|0)<<7|o>>>25)+b|0)<<9|o>>>23)+m|0)<<13|o>>>19)+g|0)<<18|o>>>14;e[0]=a>>>0&255,e[1]=a>>>8&255,e[2]=a>>>16&255,e[3]=a>>>24&255,e[4]=f>>>0&255,e[5]=f>>>8&255,e[6]=f>>>16&255,e[7]=f>>>24&255,e[8]=v>>>0&255,e[9]=v>>>8&255,e[10]=v>>>16&255,e[11]=v>>>24&255,e[12]=b>>>0&255,e[13]=b>>>8&255,e[14]=b>>>16&255,e[15]=b>>>24&255,e[16]=l>>>0&255,e[17]=l>>>8&255,e[18]=l>>>16&255,e[19]=l>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,n,t,r)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function O(e,n,t,r,o,a,i){var s,c,u=new Uint8Array(16),f=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=a[c];for(;o>=64;){for(g(f,u,i,b),c=0;c<64;c++)e[n+c]=t[r+c]^f[c];for(s=1,c=8;c<16;c++)s=s+(255&u[c])|0,u[c]=255&s,s>>>=8;o-=64,n+=64,r+=64}if(o>0)for(g(f,u,i,b),c=0;c=64;){for(g(c,s,o,b),i=0;i<64;i++)e[n+i]=c[i];for(a=1,i=8;i<16;i++)a=a+(255&s[i])|0,s[i]=255&a,a>>>=8;t-=64,n+=64}if(t>0)for(g(c,s,o,b),i=0;i>>13|t<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(t>>>10|r<<6),o=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|o<<9),a=255&e[8]|(255&e[9])<<8,this.r[4]=255&(o>>>4|a<<12),this.r[5]=a>>>1&8190,i=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(a>>>14|i<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(i>>>11|s<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function T(e,n,t,r,o,a){var i=new _(a);return i.update(t,r,o),i.finish(e,n),0}function S(e,n,t,r,o,a){var i=new Uint8Array(16);return T(i,0,t,r,o,a),y(e,n,i,0)}function N(e,n,t,r,o){var a;if(t<32)return-1;for(D(e,0,n,0,t,r,o),T(e,16,e,32,t-32,e),a=0;a<16;a++)e[a]=0;return 0}function I(e,n,t,r,o){var a,i=new Uint8Array(32);if(t<32)return-1;if(w(i,0,32,r,o),0!==S(n,16,n,32,t-32,i))return-1;for(D(e,0,n,0,t,r,o),a=0;a<32;a++)e[a]=0;return 0}function x(e,n){var t;for(t=0;t<16;t++)e[t]=0|n[t]}function C(e){var n,t,r=1;for(n=0;n<16;n++)t=e[n]+r+65535,r=Math.floor(t/65536),e[n]=t-65536*r;e[0]+=r-1+37*(r-1)}function R(e,n,t){for(var r,o=~(t-1),a=0;a<16;a++)r=o&(e[a]^n[a]),e[a]^=r,n[a]^=r}function P(e,t){var r,o,a,i=n(),s=n();for(r=0;r<16;r++)s[r]=t[r];for(C(s),C(s),C(s),o=0;o<2;o++){for(i[0]=s[0]-65517,r=1;r<15;r++)i[r]=s[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=s[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,R(s,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function k(e,n){var t=new Uint8Array(32),r=new Uint8Array(32);return P(t,e),P(r,n),m(t,0,r,0)}function M(e){var n=new Uint8Array(32);return P(n,e),1&n[0]}function F(e,n){var t;for(t=0;t<16;t++)e[t]=n[2*t]+(n[2*t+1]<<8);e[15]&=32767}function L(e,n,t){for(var r=0;r<16;r++)e[r]=n[r]+t[r]}function H(e,n,t){for(var r=0;r<16;r++)e[r]=n[r]-t[r]}function j(e,n,t){var r,o,a=0,i=0,s=0,c=0,u=0,f=0,l=0,d=0,h=0,p=0,v=0,y=0,m=0,g=0,E=0,b=0,O=0,A=0,w=0,D=0,_=0,T=0,S=0,N=0,I=0,x=0,C=0,R=0,P=0,k=0,M=0,F=t[0],L=t[1],H=t[2],j=t[3],K=t[4],U=t[5],B=t[6],V=t[7],Y=t[8],G=t[9],J=t[10],q=t[11],W=t[12],z=t[13],Q=t[14],Z=t[15];a+=(r=n[0])*F,i+=r*L,s+=r*H,c+=r*j,u+=r*K,f+=r*U,l+=r*B,d+=r*V,h+=r*Y,p+=r*G,v+=r*J,y+=r*q,m+=r*W,g+=r*z,E+=r*Q,b+=r*Z,i+=(r=n[1])*F,s+=r*L,c+=r*H,u+=r*j,f+=r*K,l+=r*U,d+=r*B,h+=r*V,p+=r*Y,v+=r*G,y+=r*J,m+=r*q,g+=r*W,E+=r*z,b+=r*Q,O+=r*Z,s+=(r=n[2])*F,c+=r*L,u+=r*H,f+=r*j,l+=r*K,d+=r*U,h+=r*B,p+=r*V,v+=r*Y,y+=r*G,m+=r*J,g+=r*q,E+=r*W,b+=r*z,O+=r*Q,A+=r*Z,c+=(r=n[3])*F,u+=r*L,f+=r*H,l+=r*j,d+=r*K,h+=r*U,p+=r*B,v+=r*V,y+=r*Y,m+=r*G,g+=r*J,E+=r*q,b+=r*W,O+=r*z,A+=r*Q,w+=r*Z,u+=(r=n[4])*F,f+=r*L,l+=r*H,d+=r*j,h+=r*K,p+=r*U,v+=r*B,y+=r*V,m+=r*Y,g+=r*G,E+=r*J,b+=r*q,O+=r*W,A+=r*z,w+=r*Q,D+=r*Z,f+=(r=n[5])*F,l+=r*L,d+=r*H,h+=r*j,p+=r*K,v+=r*U,y+=r*B,m+=r*V,g+=r*Y,E+=r*G,b+=r*J,O+=r*q,A+=r*W,w+=r*z,D+=r*Q,_+=r*Z,l+=(r=n[6])*F,d+=r*L,h+=r*H,p+=r*j,v+=r*K,y+=r*U,m+=r*B,g+=r*V,E+=r*Y,b+=r*G,O+=r*J,A+=r*q,w+=r*W,D+=r*z,_+=r*Q,T+=r*Z,d+=(r=n[7])*F,h+=r*L,p+=r*H,v+=r*j,y+=r*K,m+=r*U,g+=r*B,E+=r*V,b+=r*Y,O+=r*G,A+=r*J,w+=r*q,D+=r*W,_+=r*z,T+=r*Q,S+=r*Z,h+=(r=n[8])*F,p+=r*L,v+=r*H,y+=r*j,m+=r*K,g+=r*U,E+=r*B,b+=r*V,O+=r*Y,A+=r*G,w+=r*J,D+=r*q,_+=r*W,T+=r*z,S+=r*Q,N+=r*Z,p+=(r=n[9])*F,v+=r*L,y+=r*H,m+=r*j,g+=r*K,E+=r*U,b+=r*B,O+=r*V,A+=r*Y,w+=r*G,D+=r*J,_+=r*q,T+=r*W,S+=r*z,N+=r*Q,I+=r*Z,v+=(r=n[10])*F,y+=r*L,m+=r*H,g+=r*j,E+=r*K,b+=r*U,O+=r*B,A+=r*V,w+=r*Y,D+=r*G,_+=r*J,T+=r*q,S+=r*W,N+=r*z,I+=r*Q,x+=r*Z,y+=(r=n[11])*F,m+=r*L,g+=r*H,E+=r*j,b+=r*K,O+=r*U,A+=r*B,w+=r*V,D+=r*Y,_+=r*G,T+=r*J,S+=r*q,N+=r*W,I+=r*z,x+=r*Q,C+=r*Z,m+=(r=n[12])*F,g+=r*L,E+=r*H,b+=r*j,O+=r*K,A+=r*U,w+=r*B,D+=r*V,_+=r*Y,T+=r*G,S+=r*J,N+=r*q,I+=r*W,x+=r*z,C+=r*Q,R+=r*Z,g+=(r=n[13])*F,E+=r*L,b+=r*H,O+=r*j,A+=r*K,w+=r*U,D+=r*B,_+=r*V,T+=r*Y,S+=r*G,N+=r*J,I+=r*q,x+=r*W,C+=r*z,R+=r*Q,P+=r*Z,E+=(r=n[14])*F,b+=r*L,O+=r*H,A+=r*j,w+=r*K,D+=r*U,_+=r*B,T+=r*V,S+=r*Y,N+=r*G,I+=r*J,x+=r*q,C+=r*W,R+=r*z,P+=r*Q,k+=r*Z,b+=(r=n[15])*F,i+=38*(A+=r*H),s+=38*(w+=r*j),c+=38*(D+=r*K),u+=38*(_+=r*U),f+=38*(T+=r*B),l+=38*(S+=r*V),d+=38*(N+=r*Y),h+=38*(I+=r*G),p+=38*(x+=r*J),v+=38*(C+=r*q),y+=38*(R+=r*W),m+=38*(P+=r*z),g+=38*(k+=r*Q),E+=38*(M+=r*Z),a=(r=(a+=38*(O+=r*L))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),i=(r=i+o+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),E=(r=E+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=(a+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),i=(r=i+o+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),E=(r=E+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),a+=o-1+37*(o-1),e[0]=a,e[1]=i,e[2]=s,e[3]=c,e[4]=u,e[5]=f,e[6]=l,e[7]=d,e[8]=h,e[9]=p,e[10]=v,e[11]=y,e[12]=m,e[13]=g,e[14]=E,e[15]=b}function K(e,n){j(e,n,n)}function U(e,t){var r,o=n();for(r=0;r<16;r++)o[r]=t[r];for(r=253;r>=0;r--)K(o,o),2!==r&&4!==r&&j(o,o,t);for(r=0;r<16;r++)e[r]=o[r]}function B(e,t){var r,o=n();for(r=0;r<16;r++)o[r]=t[r];for(r=250;r>=0;r--)K(o,o),1!==r&&j(o,o,t);for(r=0;r<16;r++)e[r]=o[r]}function V(e,t,r){var o,a,i=new Uint8Array(32),c=new Float64Array(80),u=n(),f=n(),l=n(),d=n(),h=n(),p=n();for(a=0;a<31;a++)i[a]=t[a];for(i[31]=127&t[31]|64,i[0]&=248,F(c,r),a=0;a<16;a++)f[a]=c[a],d[a]=u[a]=l[a]=0;for(u[0]=d[0]=1,a=254;a>=0;--a)R(u,f,o=i[a>>>3]>>>(7&a)&1),R(l,d,o),L(h,u,l),H(u,u,l),L(l,f,d),H(f,f,d),K(d,h),K(p,u),j(u,l,u),j(l,f,h),L(h,u,l),H(u,u,l),K(f,u),H(l,d,p),j(u,l,s),L(u,u,d),j(l,l,u),j(u,d,p),j(d,f,c),K(f,h),R(u,f,o),R(l,d,o);for(a=0;a<16;a++)c[a+16]=u[a],c[a+32]=l[a],c[a+48]=f[a],c[a+64]=d[a];var v=c.subarray(32),y=c.subarray(16);return U(v,v),j(y,y,v),P(e,y),0}function Y(e,n){return V(e,n,o)}function G(e,n){return t(n,32),Y(e,n)}function J(e,n,t){var o=new Uint8Array(32);return V(o,t,n),E(e,r,o,b)}_.prototype.blocks=function(e,n,t){for(var r,o,a,i,s,c,u,f,l,d,h,p,v,y,m,g,E,b,O,A=this.fin?0:2048,w=this.h[0],D=this.h[1],_=this.h[2],T=this.h[3],S=this.h[4],N=this.h[5],I=this.h[6],x=this.h[7],C=this.h[8],R=this.h[9],P=this.r[0],k=this.r[1],M=this.r[2],F=this.r[3],L=this.r[4],H=this.r[5],j=this.r[6],K=this.r[7],U=this.r[8],B=this.r[9];t>=16;)d=l=0,d+=(w+=8191&(r=255&e[n+0]|(255&e[n+1])<<8))*P,d+=(D+=8191&(r>>>13|(o=255&e[n+2]|(255&e[n+3])<<8)<<3))*(5*B),d+=(_+=8191&(o>>>10|(a=255&e[n+4]|(255&e[n+5])<<8)<<6))*(5*U),d+=(T+=8191&(a>>>7|(i=255&e[n+6]|(255&e[n+7])<<8)<<9))*(5*K),l=(d+=(S+=8191&(i>>>4|(s=255&e[n+8]|(255&e[n+9])<<8)<<12))*(5*j))>>>13,d&=8191,d+=(N+=s>>>1&8191)*(5*H),d+=(I+=8191&(s>>>14|(c=255&e[n+10]|(255&e[n+11])<<8)<<2))*(5*L),d+=(x+=8191&(c>>>11|(u=255&e[n+12]|(255&e[n+13])<<8)<<5))*(5*F),d+=(C+=8191&(u>>>8|(f=255&e[n+14]|(255&e[n+15])<<8)<<8))*(5*M),h=l+=(d+=(R+=f>>>5|A)*(5*k))>>>13,h+=w*k,h+=D*P,h+=_*(5*B),h+=T*(5*U),l=(h+=S*(5*K))>>>13,h&=8191,h+=N*(5*j),h+=I*(5*H),h+=x*(5*L),h+=C*(5*F),l+=(h+=R*(5*M))>>>13,h&=8191,p=l,p+=w*M,p+=D*k,p+=_*P,p+=T*(5*B),l=(p+=S*(5*U))>>>13,p&=8191,p+=N*(5*K),p+=I*(5*j),p+=x*(5*H),p+=C*(5*L),v=l+=(p+=R*(5*F))>>>13,v+=w*F,v+=D*M,v+=_*k,v+=T*P,l=(v+=S*(5*B))>>>13,v&=8191,v+=N*(5*U),v+=I*(5*K),v+=x*(5*j),v+=C*(5*H),y=l+=(v+=R*(5*L))>>>13,y+=w*L,y+=D*F,y+=_*M,y+=T*k,l=(y+=S*P)>>>13,y&=8191,y+=N*(5*B),y+=I*(5*U),y+=x*(5*K),y+=C*(5*j),m=l+=(y+=R*(5*H))>>>13,m+=w*H,m+=D*L,m+=_*F,m+=T*M,l=(m+=S*k)>>>13,m&=8191,m+=N*P,m+=I*(5*B),m+=x*(5*U),m+=C*(5*K),g=l+=(m+=R*(5*j))>>>13,g+=w*j,g+=D*H,g+=_*L,g+=T*F,l=(g+=S*M)>>>13,g&=8191,g+=N*k,g+=I*P,g+=x*(5*B),g+=C*(5*U),E=l+=(g+=R*(5*K))>>>13,E+=w*K,E+=D*j,E+=_*H,E+=T*L,l=(E+=S*F)>>>13,E&=8191,E+=N*M,E+=I*k,E+=x*P,E+=C*(5*B),b=l+=(E+=R*(5*U))>>>13,b+=w*U,b+=D*K,b+=_*j,b+=T*H,l=(b+=S*L)>>>13,b&=8191,b+=N*F,b+=I*M,b+=x*k,b+=C*P,O=l+=(b+=R*(5*B))>>>13,O+=w*B,O+=D*U,O+=_*K,O+=T*j,l=(O+=S*H)>>>13,O&=8191,O+=N*L,O+=I*F,O+=x*M,O+=C*k,w=d=8191&(l=(l=((l+=(O+=R*P)>>>13)<<2)+l|0)+(d&=8191)|0),D=h+=l>>>=13,_=p&=8191,T=v&=8191,S=y&=8191,N=m&=8191,I=g&=8191,x=E&=8191,C=b&=8191,R=O&=8191,n+=16,t-=16;this.h[0]=w,this.h[1]=D,this.h[2]=_,this.h[3]=T,this.h[4]=S,this.h[5]=N,this.h[6]=I,this.h[7]=x,this.h[8]=C,this.h[9]=R},_.prototype.finish=function(e,n){var t,r,o,a,i=new Uint16Array(10);if(this.leftover){for(a=this.leftover,this.buffer[a++]=1;a<16;a++)this.buffer[a]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(t=this.h[1]>>>13,this.h[1]&=8191,a=2;a<10;a++)this.h[a]+=t,t=this.h[a]>>>13,this.h[a]&=8191;for(this.h[0]+=5*t,t=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=t,t=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=t,i[0]=this.h[0]+5,t=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this.h[a]+t,t=i[a]>>>13,i[a]&=8191;for(i[9]-=8192,r=(1^t)-1,a=0;a<10;a++)i[a]&=r;for(r=~r,a=0;a<10;a++)this.h[a]=this.h[a]&r|i[a];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,a=1;a<8;a++)o=(this.h[a]+this.pad[a]|0)+(o>>>16)|0,this.h[a]=65535&o;e[n+0]=this.h[0]>>>0&255,e[n+1]=this.h[0]>>>8&255,e[n+2]=this.h[1]>>>0&255,e[n+3]=this.h[1]>>>8&255,e[n+4]=this.h[2]>>>0&255,e[n+5]=this.h[2]>>>8&255,e[n+6]=this.h[3]>>>0&255,e[n+7]=this.h[3]>>>8&255,e[n+8]=this.h[4]>>>0&255,e[n+9]=this.h[4]>>>8&255,e[n+10]=this.h[5]>>>0&255,e[n+11]=this.h[5]>>>8&255,e[n+12]=this.h[6]>>>0&255,e[n+13]=this.h[6]>>>8&255,e[n+14]=this.h[7]>>>0&255,e[n+15]=this.h[7]>>>8&255},_.prototype.update=function(e,n,t){var r,o;if(this.leftover){for((o=16-this.leftover)>t&&(o=t),r=0;r=16&&(o=t-t%16,this.blocks(e,n,o),n+=o,t-=o),t){for(r=0;r=128;){for(A=0;A<16;A++)w=8*A+W,x[A]=t[w+0]<<24|t[w+1]<<16|t[w+2]<<8|t[w+3],C[A]=t[w+4]<<24|t[w+5]<<16|t[w+6]<<8|t[w+7];for(A=0;A<80;A++)if(o=R,a=P,i=k,s=M,c=F,u=L,f=H,j,d=K,h=U,p=B,v=V,y=Y,m=G,g=J,q,T=65535&(_=q),S=_>>>16,N=65535&(D=j),I=D>>>16,T+=65535&(_=(Y>>>14|F<<18)^(Y>>>18|F<<14)^(F>>>9|Y<<23)),S+=_>>>16,N+=65535&(D=(F>>>14|Y<<18)^(F>>>18|Y<<14)^(Y>>>9|F<<23)),I+=D>>>16,T+=65535&(_=Y&G^~Y&J),S+=_>>>16,N+=65535&(D=F&L^~F&H),I+=D>>>16,T+=65535&(_=z[2*A+1]),S+=_>>>16,N+=65535&(D=z[2*A]),I+=D>>>16,D=x[A%16],S+=(_=C[A%16])>>>16,N+=65535&D,I+=D>>>16,N+=(S+=(T+=65535&_)>>>16)>>>16,T=65535&(_=O=65535&T|S<<16),S=_>>>16,N=65535&(D=b=65535&N|(I+=N>>>16)<<16),I=D>>>16,T+=65535&(_=(K>>>28|R<<4)^(R>>>2|K<<30)^(R>>>7|K<<25)),S+=_>>>16,N+=65535&(D=(R>>>28|K<<4)^(K>>>2|R<<30)^(K>>>7|R<<25)),I+=D>>>16,S+=(_=K&U^K&B^U&B)>>>16,N+=65535&(D=R&P^R&k^P&k),I+=D>>>16,l=65535&(N+=(S+=(T+=65535&_)>>>16)>>>16)|(I+=N>>>16)<<16,E=65535&T|S<<16,T=65535&(_=v),S=_>>>16,N=65535&(D=s),I=D>>>16,S+=(_=O)>>>16,N+=65535&(D=b),I+=D>>>16,P=o,k=a,M=i,F=s=65535&(N+=(S+=(T+=65535&_)>>>16)>>>16)|(I+=N>>>16)<<16,L=c,H=u,j=f,R=l,U=d,B=h,V=p,Y=v=65535&T|S<<16,G=y,J=m,q=g,K=E,A%16==15)for(w=0;w<16;w++)D=x[w],T=65535&(_=C[w]),S=_>>>16,N=65535&D,I=D>>>16,D=x[(w+9)%16],T+=65535&(_=C[(w+9)%16]),S+=_>>>16,N+=65535&D,I+=D>>>16,b=x[(w+1)%16],T+=65535&(_=((O=C[(w+1)%16])>>>1|b<<31)^(O>>>8|b<<24)^(O>>>7|b<<25)),S+=_>>>16,N+=65535&(D=(b>>>1|O<<31)^(b>>>8|O<<24)^b>>>7),I+=D>>>16,b=x[(w+14)%16],S+=(_=((O=C[(w+14)%16])>>>19|b<<13)^(b>>>29|O<<3)^(O>>>6|b<<26))>>>16,N+=65535&(D=(b>>>19|O<<13)^(O>>>29|b<<3)^b>>>6),I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,x[w]=65535&N|I<<16,C[w]=65535&T|S<<16;T=65535&(_=K),S=_>>>16,N=65535&(D=R),I=D>>>16,D=e[0],S+=(_=n[0])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[0]=R=65535&N|I<<16,n[0]=K=65535&T|S<<16,T=65535&(_=U),S=_>>>16,N=65535&(D=P),I=D>>>16,D=e[1],S+=(_=n[1])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[1]=P=65535&N|I<<16,n[1]=U=65535&T|S<<16,T=65535&(_=B),S=_>>>16,N=65535&(D=k),I=D>>>16,D=e[2],S+=(_=n[2])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[2]=k=65535&N|I<<16,n[2]=B=65535&T|S<<16,T=65535&(_=V),S=_>>>16,N=65535&(D=M),I=D>>>16,D=e[3],S+=(_=n[3])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[3]=M=65535&N|I<<16,n[3]=V=65535&T|S<<16,T=65535&(_=Y),S=_>>>16,N=65535&(D=F),I=D>>>16,D=e[4],S+=(_=n[4])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[4]=F=65535&N|I<<16,n[4]=Y=65535&T|S<<16,T=65535&(_=G),S=_>>>16,N=65535&(D=L),I=D>>>16,D=e[5],S+=(_=n[5])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[5]=L=65535&N|I<<16,n[5]=G=65535&T|S<<16,T=65535&(_=J),S=_>>>16,N=65535&(D=H),I=D>>>16,D=e[6],S+=(_=n[6])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[6]=H=65535&N|I<<16,n[6]=J=65535&T|S<<16,T=65535&(_=q),S=_>>>16,N=65535&(D=j),I=D>>>16,D=e[7],S+=(_=n[7])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[7]=j=65535&N|I<<16,n[7]=q=65535&T|S<<16,W+=128,r-=128}return r}function Z(e,n,t){var r,o=new Int32Array(8),a=new Int32Array(8),i=new Uint8Array(256),s=t;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,Q(o,a,n,t),t%=128,r=0;r=0;--o)$(e,n,r=t[o/8|0]>>(7&o)&1),X(n,e),X(e,e),$(e,n,r)}function te(e,t){var r=[n(),n(),n(),n()];x(r[0],l),x(r[1],d),x(r[2],i),j(r[3],l,d),ne(e,r,t)}function re(e,r,o){var a,i=new Uint8Array(64),s=[n(),n(),n(),n()];for(o||t(r,32),Z(i,r,32),i[0]&=248,i[31]&=127,i[31]|=64,te(s,i),ee(e,s),a=0;a<32;a++)r[a+32]=e[a];return 0}var oe=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ae(e,n){var t,r,o,a;for(r=63;r>=32;--r){for(t=0,o=r-32,a=r-12;o>4)*oe[o],t=n[o]>>8,n[o]&=255;for(o=0;o<32;o++)n[o]-=t*oe[o];for(r=0;r<32;r++)n[r+1]+=n[r]>>8,e[r]=255&n[r]}function ie(e){var n,t=new Float64Array(64);for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;ae(e,t)}function se(e,t,r,o){var a,i,s=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),f=new Float64Array(64),l=[n(),n(),n(),n()];Z(s,o,32),s[0]&=248,s[31]&=127,s[31]|=64;var d=r+64;for(a=0;a>7&&H(e[0],a,e[0]),j(e[3],e[0],e[1]),0)}(d,o))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(le),n=new Uint8Array(de);return re(e,n),{publicKey:e,secretKey:n}},e.sign.keyPair.fromSecretKey=function(e){if(pe(e),e.length!==de)throw new Error("bad secret key size");for(var n=new Uint8Array(le),t=0;t{if(Array.isArray(n))return n.map(e);if(n instanceof Object){let t=[],r=[];return Object.keys(n).forEach(e=>{/^(0|[1-9][0-9]*)$/.test(e)?t.push(+e):r.push(e)}),t.sort(function(e,n){return e-n}).concat(r.sort()).reduce((t,r)=>(t[r]=e(n[r]),t),{})}return n},n=JSON.stringify.bind(JSON);return y=(t,r,o)=>{let a=n(t,r,0);if(!a||"{"!==a[0]&&"["!==a[0])return a;let i=JSON.parse(a);return n(e(i),null,o)}}())}function T(){return b||(b=1,function(e){e.exports&&(e.exports=function(e,n){const t=globalThis;var r,o={},a=void 0===t.Proxy,i=o.DeepProxy=function(){var e={},r=e.isArray=Array.isArray||function(e){return"[object Array]"===Object.toString(e)},o=e.type=function(e){return null===e?"null":r(e)?"array":typeof e},i=e.isProxyable=function(e,n){return(void 0!==n||!a)&&-1!==["object","array"].indexOf(o(e))},s=e.set=function(n){return function(t,r,o){if("on"===r)throw new Error("'on' is a reserved attribute name for realtime lists and maps");return i(o)?t[r]=e.create(o,n):t[r]=o,n(),t[r]||!0}},c=e.pathMatches=function(e,n){return!n.some(function(n,t){return n!==e[t]})},u=function(e,n){return n.pattern.length-e.pattern.length},f=function(e){return function(n,t,r){switch(n){case"change":t="array"===o(t)?t:[t],e.change.push({cb:function(e,n,o,a){if(c(o,t))return r(e,n,o,a)},pattern:t}),e.change.sort(u);break;case"remove":t="array"===o(t)?t:[t],e.remove.push({cb:function(e,n,o){if(c(n,t))return r(e,n,o)},pattern:t}),e.remove.sort(u);break;case"ready":e.ready.push({cb:function(e){t(e)}});break;case"cacheready":e.cacheready.push({cb:function(e){t(e)}});break;case"disconnect":e.disconnect.push({cb:function(e){t(e)}});break;case"reconnect":e.reconnect.push({cb:function(e){t(e)}});break;case"create":e.create.push({cb:function(e){t(e)}});break;case"error":e.error.push({cb:function(e){t(e)}})}return this}},l=e.get=function(){var e={cacheready:[],disconnect:[],reconnect:[],change:[],ready:[],remove:[],create:[],error:[]};return function(n,t){return"on"===t?f(e):"_isProxy"===t||("_events"===t?e:n[t])}},d=e.delete=function(e){return function(n,t){return void 0===n[t]||(delete n[t],e()),!0}},h=e.handlers=function(e,n){return n?{set:s(e),get:l(e),deleteProperty:d(e)}:{set:s(e),get:function(e,n){return"_isProxy"===n||e[n]},deleteProperty:d(e)}},p=e.remoteChangeFlag=!1,v=e.stringifyFakeProxy=function(e){var t=JSON.parse(n(e));return delete t._events,delete t._isProxy,n(t)};e.checkLocalChange=function(n,r){if(a&&!e.interval){var o=v(n);e.interval=t.setInterval(function(){var e=v(n);e!==o&&(o=e,p?p=!1:r())},300)}};var y=e.create=function(e,n,r){var s="function"===o(n)?h(n,r):n;switch(o(e)){case"object":Object.keys(e).forEach(function(t){i(e[t])&&!e[t]._isProxy&&(e[t]=y(e[t],n))});break;case"array":e.forEach(function(t,r){i(t)&&!t._isProxy&&(e[r]=y(e[r],n))});break;default:throw new Error("attempted to make a proxy of an unproxyable object")}if(!a)return e._isProxy?e:new t.Proxy(e,s);var c=JSON.parse(JSON.stringify(e));if(r){var u={cacheready:[],disconnect:[],reconnect:[],change:[],ready:[],remove:[],create:[],error:[]};c.on=f(u),c._events=u}return c},m=function(e,n,t,r,o){var a=e.slice(0);a.push(n),t._events.change.some(function(e){return!1===e.cb(r,o,a,t)})},g=e.find=function(e,n){for(var t=n.length,r=0;rs)for(var c,u=s;u<=s;u++)c=e[u],E(r,u,a,c,!0);e.length=s}};return e.update=function(e,n,t){var r=o(e),a=o(n);if(r!==a)throw new Error("Proxy updates can't result in type changes");switch(a){case"array":O.call(e,e,n,function(e){return y(e,t)},[],e);break;case"object":b.call(e,e,n,function(e){return y(e,t)},[],e);break;default:throw new Error("unsupported realtime datatype:"+a)}},e}();return o.create=function(o){if(!i.isProxyable(o.data,!0))throw new Error("unsupported datatype: "+i.type(o.data));if("function"!=typeof(r=o.ChainPad||t.ChainPad).SmartJSONTransformer)throw new Error("Please update ChainPad");o.classic&&!o.crypto&&(console.error("[chainpad-listmap] no crypto module provided. messages will not be encrypted"),o.crypto={encrypt:function(e){return e},decrypt:function(e){return e}});var s=o.readOnly,c={initialState:n(o.data),patchTransformer:r.SmartJSONTransformer,validateContent:o.validateContent||function(e){try{return JSON.parse(e),!0}catch(n){return console.log(e),console.error("Failed to parse, rejecting patch"),!1}},readOnly:o.readOnly,userName:o.userName||"listmap",Cache:o.Cache,logLevel:void 0===o.logLevel?0:o.logLevel};o.classic&&(c.channel=o.channel,c.crypto=o.crypto,c.network=o.network,c.websocketURL=o.websocketURL,c.metadata=o.metadata||{validateKey:o.validateKey,owners:o.owners,expire:o.expire},c.onRejected=o.onRejected);var u,f,l,d={metadata:{}},h=!0,p=!1,v=a?i.stringifyFakeProxy:n,y=function(){var e=v(f);try{u.contentUpdate(e)}catch(e){f._events.error.forEach(function(n){n.cb({type:"CHAINPAD",error:e.message})})}o.onLocal&&o.onLocal()},m=c.onLocal=function(e){h||s||(clearTimeout(l),e?y():l=setTimeout(y))},g=function(){i.remoteChangeFlag||m()};f=i.create(o.data,g,!0),c.onInit=function(e){f._events.create.forEach(function(n){n.cb(e)})},c.onCacheReady=function(e){u&&u===e.realtime||(u=d.realtime=e.realtime);var n=u.getUserDoc(),t=JSON.parse(n);i.update(f,t,g),i.checkLocalChange(f,m),p||f._events.cacheready.forEach(function(n){n.cb(e)})};var E=0;c.onReady=function(e){if(E=-1,p)return h=!1,c.onRemote(),void f._events.reconnect.forEach(function(n){n.cb(e)});u&&u===e.realtime||(u=d.realtime=e.realtime),d.metadata=e.metadata;var n=u.getUserDoc(),t=JSON.parse(n);i.update(f,t,g),i.checkLocalChange(f,m),h=!1,p=!0,f._events.ready.forEach(function(n){n.cb(e)})},c.onRemote=function(){if(!h){var e=u.getUserDoc(),n=JSON.parse(e);i.remoteChangeFlag=!0,i.update(f,n,g),i.remoteChangeFlag=!1}},c.onMessage=function(){-1!==E&&o.updateProgress&&o.updateProgress({progress:E++})},c.onAbort=function(e){f._events.disconnect.forEach(function(n){n.cb(e)})},c.onConnectionChange=function(e){e.state?h=!0:f._events.disconnect.forEach(function(n){n.cb(e)})},c.onMetadataUpdate=function(e){d.metadata=e,"function"==typeof o.onMetadataUpdate&&o.onMetadataUpdate(e)},c.onError=function(e){f._events.error.forEach(function(n){n.cb(e)})},c.onChannelError=function(e){f._events.error.forEach(function(n){n.cb(e)})},o.common&&"function"==typeof o.common.startRealtime?u=d.cpCnInner=o.common.startRealtime(c):d=e.start(c),d.proxy=f,d.realtime=u;var b=d.setReadOnly;return d.setReadOnly=function(e,n){s=e,b&&b(e,n)},d},o}(D(),_()))}(i)),i.exports}var S,N=T(),I={exports:{}};function x(){return S||(S=1,function(e){var n,r,o,a;a=function(){var e=f,n=function(t,r,o){r||(r=0);var a=n.resolve(t,r),i=n.m[r][a];if(!i&&e){if(i=e(a))return i}else if(i&&i.c&&(r=i.c,a=i.m,!(i=n.m[r][i.m])))throw new Error('failed to require "'+a+'" from '+r);if(!i)throw new Error('failed to require "'+t+'" from '+o);return i.exports||(i.exports={},i.call(i.exports,i,i.exports,n.relative(a,r))),i.exports};return n.resolve=function(e,t){var r=e,o=e+".js",a=e+"/index.js";return n.m[t][o]&&o?o:n.m[t][a]&&a?a:r},n.relative=function(e,t){return function(r){if("."!=r.charAt(0))return n(r,t,e);var o=e.split("/"),a=r.split("/");o.pop();for(var i=0;i=0;t--)o.check(e.operations[t],n),t>0&&r.assert(!o.shouldMerge(e.operations[t],e.operations[t-1])),"number"==typeof n&&(n+=o.lengthChange(e.operations[t]));return e.isCheckpoint&&(r.assert(1===e.operations.length),r.assert(0===e.operations[0].offset),"number"==typeof n&&r.assert(!n||e.operations[0].toRemove===n)),e};i.toObj=function(e){r.PARANOIA&&c(e);var n,t=new Array(e.operations.length+1);for(n=0;n0);var t,i=s(a.check(e[e.length-1]),n);for(t=0;t=0;t--)f(e,n.operations[t]);return e},i.apply=function(e,n){r.PARANOIA&&(c(e),r.assert("string"==typeof n),r.assert(a.hex_sha256(n)===e.parentHash));for(var t=n,i=e.operations.length-1;i>=0;i--)t=o.apply(e.operations[i],t);return t},i.lengthChange=function(e){r.PARANOIA&&c(e);for(var n=0,t=0;t=0;u--)i[u]=o.invert(e.operations[u],t),t=o.apply(e.operations[u],t);var f=new Array(e.operations.length);!function(){for(var e=i.length-1;e>=0;e--){f[e]=i[e].offset;for(var n=e-1;n>=0;n--)f[e]+=i[n].toRemove-i[n].toInsert.length}}();var l=s(a.hex_sha256(t),e.isCheckpoint);l.operations.splice(0,l.operations.length);for(var d=0;d=0;d--){var h=t(e.operations[d],u,o.simplify);h&&(u=o.apply(h,u),f[l++]=h)}return Array.prototype.push.apply(i.operations,f.reverse()),i.operations[0]||i.operations.shift(),r.PARANOIA&&c(i),i},i.equals=function(e,n){if(e.operations.length!==n.operations.length)return!1;for(var t=0;t0;){var u=o.random(i);i+=o.lengthChange(u),f(t,u)}return c(t),t},Object.freeze(e.exports)},"SHA256.js":function(e,n,t){!function(){function n(e,n){var t=(65535&e)+(65535&n);return(e>>16)+(n>>16)+(t>>16)<<16|65535&t}function t(e,n){return e>>>n|e<<32-n}function r(e,n){return e>>>n}function o(e,n,t){return e&n^~e&t}function a(e,n,t){return e&n^e&t^n&t}function i(e){return t(e,2)^t(e,13)^t(e,22)}function s(e){return t(e,6)^t(e,11)^t(e,25)}function c(e){return t(e,7)^t(e,18)^r(e,3)}function u(e){return t(e,17)^t(e,19)^r(e,10)}e.exports.hex_sha256=function(e){return function(e){for(var n="0123456789abcdef",t="",r=0;r<4*e.length;r++)t+=n.charAt(e[r>>2]>>8*(3-r%4)+4&15)+n.charAt(e[r>>2]>>8*(3-r%4)&15);return t}(function(e,t){var r,f,l,d,h,p,v,y,m,g,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],O=function(e){for(var n=[];e>0;e--)n.push(void 0);return n}(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var A=0;A>5]|=(255&e.charCodeAt(t/8))<<24-t%32;return n}(e),8*e.length))}}()},"Common.js":function(e,n,r){e.exports.global=function(){if("undefined"!=typeof self)return self;if(void 0!==t)return t;if("undefined"!=typeof window)return window;throw new Error("no self, nor global, nor window")}();var o=function(n){return"undefined"!=typeof localStorage&&localStorage[n]?localStorage[n]:e.exports.global[n]},a=e.exports.PARANOIA=o("ChainPad_PARANOIA");e.exports.VALIDATE_ENTIRE_CHAIN_EACH_MSG=o("ChainPad_VALIDATE_ENTIRE_CHAIN_EACH_MSG"),e.exports.TESTING=o("ChainPad_TESTING"),e.exports.assert=function(e){if(!e)throw new Error("Failed assertion")},e.exports.isUint=function(e){return"number"==typeof e&&Math.floor(e)===e&&e>=0},e.exports.randomASCII=function(e){for(var n=[],t=0;tn?1:-1},Object.freeze(e.exports)},"sha256.js":function(e,n,t){var r=t("./sha256/exports.js"),o=t("./SHA256.js"),a=t("./Common");e.exports.check=function(e){if("string"!=typeof e)throw new Error;if(!/[a-f0-9]{64}/.test(e))throw new Error;return e},e.exports.hex_sha256=function(e){e+="";var n=r.hex(function(e){for(var n=new Uint8Array(e.length),t=0;t1&&console.log("["+e.userName+"] "+n)},d=function(e,n){e.logLevel>0&&console.error("["+e.userName+"] "+n)},h=function(e,n,t){if(!e.aborted){t||(t=Math.floor(2*Math.random()*e.config.avgSyncMilliseconds));var r=setTimeout(function(){e.schedules.splice(e.schedules.indexOf(r),1),n()},t);return e.schedules.push(r),r}},p=function(e,n){var t=e.schedules.indexOf(n);t>-1&&e.schedules.splice(t,1),clearTimeout(n)},v=function(e,n,t,o){var a=i.toStr(n);if(function(e,n,t){e.messageHandlers.length||t("no onMessage() handler registered");try{e.messageHandlers.forEach(function(e){e(n,function(){t.apply(null,arguments),t=function(){}})})}catch(e){t(e.stack)}}(e,a,function(t){if(t)l(e,"Posting to server failed ["+t+"]"),e.pending=null,e.syncSchedule=h(e,function(){g(e)});else{var o=e.pending;if(e.pending=null,!o)throw new Error;r.assert(o.hash===n.hashOf),R(e,a,!0)?(e.timeOfLastSuccess=+new Date,e.lag=+new Date-o.timeSent):l(e,"Our message ["+n.hashOf+"] failed validation"),o.callback()}}),e.pending)throw new Error("there is already a pending message");-1===e.timeOfLastSuccess&&(e.timeOfLastSuccess=+new Date),e.pending={hash:n.hashOf,timeSent:+new Date,callback:function(){e.syncSchedule=h(e,function(){g(e)},0),t()}},r.PARANOIA&&A(e)},y=function(e){var n=e.onSettle;e.onSettle=[],n.forEach(function(n){try{n()}catch(n){d(e,"Error in onSettle handler ["+n.stack+"]")}})},m=function(e){if(!e.mut.inverseOf)throw new Error;return e.mut.inverseOf},g=function(e,n){if(r.PARANOIA&&A(e),e.syncSchedule&&!e.pending){if(p(e,e.syncSchedule),e.syncSchedule=null,e.uncommitted=a.simplify(e.uncommitted,e.authDoc,e.config.operationSimplify),0===e.uncommitted.operations.length)return y(e),e.timeOfLastSuccess=+new Date,void(e.syncSchedule=h(e,function(){g(e)}));var t=_(e,e.best)+1;if(t%e.config.checkpointInterval!==0){var o;o=e.setContentPatch?e.setContentPatch:i.create(i.PATCH,e.uncommitted,e.best.hashOf),v(e,o,function(){e.setContentPatch&&(l(e,"initial Ack received ["+o.hashOf+"]"),e.setContentPatch=null)})}else{var s=e.best;if(l(e,"Sending checkpoint (interval ["+e.config.checkpointInterval+"]) patch no ["+t+"]"),l(e,_(e,e.best)),!s||!s.content||!m(s.content))throw new Error;var c=a.createCheckpoint(e.authDoc,e.authDoc,m(s.content).parentHash),u=i.create(i.CHECKPOINT,c,s.hashOf);v(e,u,function(){l(e,"Checkpoint sent and accepted")})}}},E=function(e,n){r.assert(n.lastMsgHash),r.assert(n.hashOf),e.messages[n.hashOf]=n,(e.messagesByParent[n.lastMsgHash]=e.messagesByParent[n.lastMsgHash]||[]).push(n)},b=function(e,n){r.assert(n.lastMsgHash),r.assert(n.hashOf),delete e.messages[n.hashOf];var t=e.messagesByParent[n.lastMsgHash];r.assert(t.indexOf(n)>-1),t.splice(t.indexOf(n),1),0===t.length&&delete e.messagesByParent[n.lastMsgHash];var o=e.messagesByParent[n.hashOf];if(o)for(var a=0;a_(e,t)&&(t=o)}),t},N=function(e,n){n.operations.length&&(e.patchHandlers.forEach(function(e){e(n)}),e.changeHandlers.forEach(function(e){n.operations.forEach(function(n){e(n.offset,n.toRemove,n.toInsert)})}))},I=function(e,n){try{return e.config.validateContent(n())}catch(n){d(e,"Error in content validator ["+n.stack+"]")}return!1},x=function(e,n,t){for(var r=O(e,n);r;r=O(e,r))if(!1===t(r))return},C=function(e,n){e.mut.inverseOf||((e.mut.inverseOf=a.invert(e,n)).mut.inverseOf=e)},R=function(e,n,t){r.PARANOIA&&A(e);var c=i.fromString(n);if(l(e,JSON.stringify([c.hashOf,c.content.operations])),e.messages[c.hashOf]){if(e.setContentPatch&&e.setContentPatch.hashOf===c.hashOf)e.setContentPatch=null;else{if(c.content.isCheckpoint)return l(e,"["+(t?"our":"their")+"] Checkpoint ["+c.hashOf+"] is already known"),!0;l(e,"Patch ["+c.hashOf+"] is already known")}r.PARANOIA&&A(e)}else if(!c.content.isCheckpoint||I(e,function(){return c.content.operations[0].toInsert})){if(E(e,c),!D(e,e.rootMessage,c)){if(c.content.isCheckpoint&&e.best.mut.isInitialMessage){l(e,"applying checkpoint ["+c.hashOf+"]");var u=a.apply(e.uncommitted,e.authDoc);r.assert(!r.PARANOIA||e.userInterfaceContent===u);var f=a.invert(e.uncommitted,e.authDoc);return a.addOperation(f,o.create(0,e.authDoc.length,c.content.operations[0].toInsert)),f=a.simplify(f,u,e.config.operationSimplify),c.mut.parentCount=0,e.rootMessage=e.best=c,e.authDoc=c.content.operations[0].toInsert,e.uncommitted=a.create(s.hex_sha256(e.authDoc)),N(e,f),r.PARANOIA&&(e.userInterfaceContent=e.authDoc),!0}return l(e,"Patch ["+c.hashOf+"] not connected to root (parent: ["+c.lastMsgHash+"])"),void(r.PARANOIA&&A(e))}(c=S(e,c)).mut.isFromMe=t;var d=c.content,h=[],p=e.best;if(!D(e,e.best,c)){var v=_(e,e.best),g=_(e,c);if(!(v0))return l(e,"Patch ["+c.hashOf+"] chain is ["+g+"] best chain is ["+v+"]"),r.PARANOIA&&A(e),!0;for(;p&&!D(e,p,c);)h.push(p),p=O(e,p);r.assert(p),l(e,"Patch ["+c.hashOf+"] better than best chain, switching")}var R=[],P=c;do{R.unshift(P),P=O(e,P),r.assert(P)}while(P!==p);var k=e.authDoc;h.forEach(function(e){k=a.apply(m(e.content),k)}),R.forEach(function(e,n){n!==R.length-1&&(C(e.content,k),k=a.apply(e.content,k))});var M=e.best;if(R.length>1?(M=R[R.length-2],r.assert(M)):h.length&&(M=O(e,h[h.length-1]),r.assert(M)),r.assert(m(M.content).parentHash),r.assert(!r.PARANOIA||m(M.content).parentHash===s.hex_sha256(k)),m(M.content).parentHash===d.parentHash){if(d.isCheckpoint&&e.config.noPrune);else if(d.isCheckpoint){var F;if(x(e,c,function(e){if(e.content.isCheckpoint){if(F)return F=e,!1;F=e}}),F&&F!==e.rootMessage){var L=_(e,F);if(e.config.strictCheckpointValidation&&L%e.config.checkpointInterval!==0){if(l(e,"checkpoint ["+c.hashOf+"] at invalid point ["+L+"]"),r.PARANOIA&&A(e),r.TESTING)throw new Error;return void b(e,c)}l(e,"checkpoint ["+c.hashOf+"]"),x(e,F,function(n){l(e,"pruning ["+n.hashOf+"]"),b(e,n)}),e.rootMessage=F}}else{var H=a.simplify(d,k,e.config.operationSimplify);if(!a.equals(H,d)){if(l(e,"patch ["+c.hashOf+"] can be simplified"),r.PARANOIA&&A(e),r.TESTING)throw new Error;return void b(e,c)}if(!I(e,function(){return a.apply(d,k)}))return void l(e,"Patch ["+c.hashOf+"] failed content validation")}C(d,k),e.uncommitted=a.simplify(e.uncommitted,e.authDoc,e.config.operationSimplify);var j=a.apply(e.uncommitted,e.authDoc);r.PARANOIA&&r.assert(j===e.userInterfaceContent);var K=a.invert(e.uncommitted,e.authDoc);if(h.forEach(function(n){l(e,"reverting ["+n.hashOf+"]"),n.mut.isFromMe&&l(e,"reverting patch 'from me' ["+JSON.stringify(n.content.operations)+"]"),K=a.merge(K,m(n.content)),function(e,n,t){T(e,n,m(t))}(e,n.mut.isFromMe,n.content)}),R.forEach(function(n){l(e,"applying ["+n.hashOf+"]"),K=a.merge(K,n.content),T(e,n.mut.isFromMe,n.content)}),K=a.merge(K,e.uncommitted),K=a.simplify(K,j,e.config.operationSimplify),e.best=c,r.PARANOIA){var U=a.apply(K,j);r.assert(e.userInterfaceContent.length===w(e)),r.assert(U===e.userInterfaceContent)}return N(e,K),e.uncommitted.operations.length||y(e),r.PARANOIA&&A(e),!0}if(l(e,"patch ["+c.hashOf+"] parentHash is not valid"),r.PARANOIA&&A(e),r.TESTING)throw new Error;b(e,c)}else l(e,"Checkpoint ["+c.hashOf+"] failed content validation")},P=function(e,n){return Object.freeze({type:"Block",hashOf:n.hashOf,lastMsgHash:n.lastMsgHash,isCheckpoint:!!n.content.isCheckpoint,isFromMe:n.mut&&n.mut.isFromMe,author:n.mut&&n.mut.author,serverHash:n.mut&&n.mut.serverHash,time:n.mut&&n.mut.time,getParent:function(){var t=O(e,n);if(t)return P(e,t)},getContent:function(){return function(e,n){for(var t=[n];t[0]!==e.rootMessage;){var o=O(e,t[0]);if(!o)return{error:"not connected to root",doc:void 0};t.unshift(o)}var i="";e.rootMessage.content.operations.length&&(r.assert(1===e.rootMessage.content.operations.length),i=e.rootMessage.content.operations[0].toInsert);for(var s=1;s=0;t--)n=s(e[t],n);return n};var c=o.invert=function(e,n){return r.PARANOIA&&(a(e),r.assert("string"==typeof n),r.assert(e.offset+e.toRemove<=n.length)),i(e.offset,e.toInsert.length,(" "+n.substring(e.offset,e.offset+e.toRemove)).slice(1))},u=/[\uD800-\uDBFF]|[\uDC00-\uDFFF]/,f=o.hasSurrogate=function(e){return u.test(e)};o.simplify=function(e,n){r.PARANOIA&&(a(e),r.assert("string"==typeof n),r.assert(e.offset+e.toRemove<=n.length));for(var t=c(e,n),o=Math.min(e.toInsert.length,t.toInsert.length),s=0;s=0&&h[s]===d[s];s--);d=d.substring(0,s+1),l=s+1}return 0===l&&0===d.length?null:i(u,l,d)},o.equals=function(e,n){return e.toRemove===n.toRemove&&e.toInsert===n.toInsert&&e.offset===n.offset},o.lengthChange=function(e){return r.PARANOIA&&a(e),e.toInsert.length-e.toRemove},o.merge=function(e,n){r.PARANOIA&&(a(n),a(e));var t=e.offset,o=e.toRemove,s=e.toInsert,c=n.offset,u=n.toRemove,f=n.toInsert,l=c-t;if(u>0){var d=s;s=s.substring(0,l)+s.substring(l+u),(u-=d.length-s.length)<0&&(u=0),o+=u,u=0}if(l<0)t+=l,s=f+s;else if(s.length===l)s+=f;else{if(!(s.length>l))throw new Error("should never happen\n"+JSON.stringify([e,n],null," "));s=s.substring(0,l)+f+s.substring(l)}return""===s&&0===o?null:i(t,o,s)},o.shouldMerge=function(e,n){return r.PARANOIA&&(a(e),a(n)),n.offset0;)a+=c=r._heap_write(t,o+a,e,i,s),i+=c,s-=c,o+=c=n.process(o,a),(a-=c)||(o=0);return this.pos=o,this.len=a,this},e.exports.hash_finish=function(){if(null!==this.result)throw new IllegalStateError("state must be reset before processing new data");return this.asm.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(this.heap.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this}},"sha256/utils.js":function(e,n,t){var r=e.exports.string_to_bytes=function(e,n){n=!!n;for(var t=e.length,r=new Uint8Array(n?4*t:t),o=0,a=0;o=t)throw new Error("Malformed string, low surrogate expected at position "+o);i=(55296^i)<<10|65536|56320^e.charCodeAt(o)}else if(!n&&i>>>8)throw new Error("Wide characters are not allowed.");!n||i<=127?r[a++]=i:i<=2047?(r[a++]=192|i>>6,r[a++]=128|63&i):i<=65535?(r[a++]=224|i>>12,r[a++]=128|i>>6&63,r[a++]=128|63&i):(r[a++]=240|i>>18,r[a++]=128|i>>12&63,r[a++]=128|i>>6&63,r[a++]=128|63&i)}return r.subarray(0,a)};e.exports.hex_to_bytes=function(e){var n=e.length;1&n&&(e="0"+e,n++);for(var t=new Uint8Array(n>>1),r=0;r>1]=parseInt(e.substr(r,2),16);return t},e.exports.base64_to_bytes=function(e){return r(atob(e))};var o=e.exports.bytes_to_string=function(e,n){n=!!n;for(var t=e.length,r=new Array(t),o=0,a=0;o=192&&i<224&&o+1=224&&i<240&&o+2=240&&i<248&&o+3>10,r[a++]=56320|1023&s)}}for(var c="",u=16384,f=0;f>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+=1},e.exports.is_number=function(e){return"number"==typeof e},e.exports.is_string=function(e){return"string"==typeof e},e.exports.is_buffer=function(e){return e instanceof ArrayBuffer},e.exports.is_bytes=function(e){return e instanceof Uint8Array},e.exports.is_typed_array=function(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array},e.exports._heap_init=function(e,n){var t=n.heap,r=t?t.byteLength:n.heapSize||65536;if(4095&r||r<=0)throw new Error("heap size must be a positive integer and a multiple of 4096");return t=t||new e(new ArrayBuffer(r))},e.exports._heap_write=function(e,n,t,r,o){var a=e.length-n,i=a>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x428a2f98|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=n+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x71374491|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=t+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xb5c0fbcf|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=l+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xe9b5dba5|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=d+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x3956c25b|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=h+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x59f111f1|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=p+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x923f82a4|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=v+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xab1c5ed5|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=y+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xd807aa98|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=m+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x12835b01|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=g+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x243185be|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=E+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x550c7dc3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=b+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x72be5d74|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=O+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x80deb1fe|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=A+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x9bdc06a7|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=w+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc19bf174|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;e=R=(n>>>7^n>>>18^n>>>3^n<<25^n<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+e+m|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xe49b69c1|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;n=R=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+n+g|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xefbe4786|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;t=R=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+t+E|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x0fc19dc6|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;l=R=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(n>>>17^n>>>19^n>>>10^n<<15^n<<13)+l+b|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x240ca1cc|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;d=R=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+O|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x2de92c6f|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;h=R=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+h+A|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x4a7484aa|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;p=R=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+p+w|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x5cb0a9dc|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;v=R=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+v+e|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x76f988da|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;y=R=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+n|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x983e5152|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;m=R=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+m+t|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xa831c66d|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;g=R=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+g+l|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xb00327c8|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;E=R=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+E+d|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xbf597fc7|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;b=R=(O>>>7^O>>>18^O>>>3^O<<25^O<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+b+h|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc6e00bf3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;O=R=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+O+p|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xd5a79147|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;A=R=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+A+v|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x06ca6351|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;w=R=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(O>>>17^O>>>19^O>>>10^O<<15^O<<13)+w+y|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x14292967|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;e=R=(n>>>7^n>>>18^n>>>3^n<<25^n<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+e+m|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x27b70a85|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;n=R=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+n+g|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x2e1b2138|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;t=R=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+t+E|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x4d2c6dfc|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;l=R=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(n>>>17^n>>>19^n>>>10^n<<15^n<<13)+l+b|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x53380d13|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;d=R=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+O|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x650a7354|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;h=R=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+h+A|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x766a0abb|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;p=R=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+p+w|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x81c2c92e|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;v=R=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+v+e|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x92722c85|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;y=R=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+n|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xa2bfe8a1|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;m=R=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+m+t|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xa81a664b|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;g=R=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+g+l|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc24b8b70|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;E=R=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+E+d|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc76c51a3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;b=R=(O>>>7^O>>>18^O>>>3^O<<25^O<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+b+h|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xd192e819|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;O=R=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+O+p|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xd6990624|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;A=R=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+A+v|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xf40e3585|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;w=R=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(O>>>17^O>>>19^O>>>10^O<<15^O<<13)+w+y|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x106aa070|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;e=R=(n>>>7^n>>>18^n>>>3^n<<25^n<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+e+m|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x19a4c116|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;n=R=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+n+g|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x1e376c08|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;t=R=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+t+E|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x2748774c|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;l=R=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(n>>>17^n>>>19^n>>>10^n<<15^n<<13)+l+b|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x34b0bcb5|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;d=R=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+O|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x391c0cb3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;h=R=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+h+A|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x4ed8aa4a|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;p=R=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+p+w|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x5b9cca4f|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;v=R=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+v+e|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x682e6ff3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;y=R=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+n|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x748f82ee|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;m=R=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+m+t|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x78a5636f|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;g=R=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+g+l|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x84c87814|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;E=R=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+E+d|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x8cc70208|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;b=R=(O>>>7^O>>>18^O>>>3^O<<25^O<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+b+h|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x90befffa|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;O=R=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+O+p|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xa4506ceb|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;A=R=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+A+v|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xbef9a3f7|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;w=R=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(O>>>17^O>>>19^O>>>10^O<<15^O<<13)+w+y|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc67178f2|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;r=r+D|0;o=o+_|0;a=a+T|0;i=i+S|0;s=s+N|0;c=c+I|0;u=u+x|0;f=f+C|0}function C(e){e=e|0;x(I[e|0]<<24|I[e|1]<<16|I[e|2]<<8|I[e|3],I[e|4]<<24|I[e|5]<<16|I[e|6]<<8|I[e|7],I[e|8]<<24|I[e|9]<<16|I[e|10]<<8|I[e|11],I[e|12]<<24|I[e|13]<<16|I[e|14]<<8|I[e|15],I[e|16]<<24|I[e|17]<<16|I[e|18]<<8|I[e|19],I[e|20]<<24|I[e|21]<<16|I[e|22]<<8|I[e|23],I[e|24]<<24|I[e|25]<<16|I[e|26]<<8|I[e|27],I[e|28]<<24|I[e|29]<<16|I[e|30]<<8|I[e|31],I[e|32]<<24|I[e|33]<<16|I[e|34]<<8|I[e|35],I[e|36]<<24|I[e|37]<<16|I[e|38]<<8|I[e|39],I[e|40]<<24|I[e|41]<<16|I[e|42]<<8|I[e|43],I[e|44]<<24|I[e|45]<<16|I[e|46]<<8|I[e|47],I[e|48]<<24|I[e|49]<<16|I[e|50]<<8|I[e|51],I[e|52]<<24|I[e|53]<<16|I[e|54]<<8|I[e|55],I[e|56]<<24|I[e|57]<<16|I[e|58]<<8|I[e|59],I[e|60]<<24|I[e|61]<<16|I[e|62]<<8|I[e|63])}function R(e){e=e|0;I[e|0]=r>>>24;I[e|1]=r>>>16&255;I[e|2]=r>>>8&255;I[e|3]=r&255;I[e|4]=o>>>24;I[e|5]=o>>>16&255;I[e|6]=o>>>8&255;I[e|7]=o&255;I[e|8]=a>>>24;I[e|9]=a>>>16&255;I[e|10]=a>>>8&255;I[e|11]=a&255;I[e|12]=i>>>24;I[e|13]=i>>>16&255;I[e|14]=i>>>8&255;I[e|15]=i&255;I[e|16]=s>>>24;I[e|17]=s>>>16&255;I[e|18]=s>>>8&255;I[e|19]=s&255;I[e|20]=c>>>24;I[e|21]=c>>>16&255;I[e|22]=c>>>8&255;I[e|23]=c&255;I[e|24]=u>>>24;I[e|25]=u>>>16&255;I[e|26]=u>>>8&255;I[e|27]=u&255;I[e|28]=f>>>24;I[e|29]=f>>>16&255;I[e|30]=f>>>8&255;I[e|31]=f&255}function P(){r=0x6a09e667;o=0xbb67ae85;a=0x3c6ef372;i=0xa54ff53a;s=0x510e527f;c=0x9b05688c;u=0x1f83d9ab;f=0x5be0cd19;l=d=0}function k(e,n,t,h,p,v,y,m,g,E){e=e|0;n=n|0;t=t|0;h=h|0;p=p|0;v=v|0;y=y|0;m=m|0;g=g|0;E=E|0;r=e;o=n;a=t;i=h;s=p;c=v;u=y;f=m;l=g;d=E}function M(e,n){e=e|0;n=n|0;var t=0;if(e&63)return-1;while((n|0)>=64){C(e);e=e+64|0;n=n-64|0;t=t+64|0}l=l+t|0;if(l>>>0>>0)d=d+1|0;return t|0}function F(e,n,t){e=e|0;n=n|0;t=t|0;var r=0,o=0;if(e&63)return-1;if(~t)if(t&31)return-1;if((n|0)>=64){r=M(e,n)|0;if((r|0)==-1)return-1;e=e+r|0;n=n-r|0}r=r+n|0;l=l+n|0;if(l>>>0>>0)d=d+1|0;I[e|n]=0x80;if((n|0)>=56){for(o=n+1|0;(o|0)<64;o=o+1|0)I[e|o]=0x00;C(e);n=0;I[e|0]=0}for(o=n+1|0;(o|0)<59;o=o+1|0)I[e|o]=0;I[e|56]=d>>>21&255;I[e|57]=d>>>13&255;I[e|58]=d>>>5&255;I[e|59]=d<<3&255|l>>>29;I[e|60]=l>>>21&255;I[e|61]=l>>>13&255;I[e|62]=l>>>5&255;I[e|63]=l<<3&255;C(e);if(~t)R(t);return r|0}function L(){r=h;o=p;a=v;i=y;s=m;c=g;u=E;f=b;l=64;d=0}function H(){r=O;o=A;a=w;i=D;s=_;c=T;u=S;f=N;l=64;d=0}function j(e,n,t,I,C,R,k,M,F,L,H,j,K,U,B,V){e=e|0;n=n|0;t=t|0;I=I|0;C=C|0;R=R|0;k=k|0;M=M|0;F=F|0;L=L|0;H=H|0;j=j|0;K=K|0;U=U|0;B=B|0;V=V|0;P();x(e^0x5c5c5c5c,n^0x5c5c5c5c,t^0x5c5c5c5c,I^0x5c5c5c5c,C^0x5c5c5c5c,R^0x5c5c5c5c,k^0x5c5c5c5c,M^0x5c5c5c5c,F^0x5c5c5c5c,L^0x5c5c5c5c,H^0x5c5c5c5c,j^0x5c5c5c5c,K^0x5c5c5c5c,U^0x5c5c5c5c,B^0x5c5c5c5c,V^0x5c5c5c5c);O=r;A=o;w=a;D=i;_=s;T=c;S=u;N=f;P();x(e^0x36363636,n^0x36363636,t^0x36363636,I^0x36363636,C^0x36363636,R^0x36363636,k^0x36363636,M^0x36363636,F^0x36363636,L^0x36363636,H^0x36363636,j^0x36363636,K^0x36363636,U^0x36363636,B^0x36363636,V^0x36363636);h=r;p=o;v=a;y=i;m=s;g=c;E=u;b=f;l=64;d=0}function K(e,n,t){e=e|0;n=n|0;t=t|0;var l=0,d=0,h=0,p=0,v=0,y=0,m=0,g=0,E=0;if(e&63)return-1;if(~t)if(t&31)return-1;E=F(e,n,-1)|0;l=r,d=o,h=a,p=i,v=s,y=c,m=u,g=f;H();x(l,d,h,p,v,y,m,g,0x80000000,0,0,0,0,0,0,768);if(~t)R(t);return E|0}function U(e,n,t,l,d){e=e|0;n=n|0;t=t|0;l=l|0;d=d|0;var h=0,p=0,v=0,y=0,m=0,g=0,E=0,b=0,O=0,A=0,w=0,D=0,_=0,T=0,S=0,N=0;if(e&63)return-1;if(~d)if(d&31)return-1;I[e+n|0]=t>>>24;I[e+n+1|0]=t>>>16&255;I[e+n+2|0]=t>>>8&255;I[e+n+3|0]=t&255;K(e,n+4|0,-1)|0;h=O=r,p=A=o,v=w=a,y=D=i,m=_=s,g=T=c,E=S=u,b=N=f;l=l-1|0;while((l|0)>0){L();x(O,A,w,D,_,T,S,N,0x80000000,0,0,0,0,0,0,768);O=r,A=o,w=a,D=i,_=s,T=c,S=u,N=f;H();x(O,A,w,D,_,T,S,N,0x80000000,0,0,0,0,0,0,768);O=r,A=o,w=a,D=i,_=s,T=c,S=u,N=f;h=h^r;p=p^o;v=v^a;y=y^i;m=m^s;g=g^c;E=E^u;b=b^f;l=l-1|0}r=h;o=p;a=v;i=y;s=m;c=g;u=E;f=b;if(~d)R(d);return 0}return{reset:P,init:k,process:M,finish:F,hmac_reset:L,hmac_init:j,hmac_finish:K,pbkdf2_generate_block:U}}},"transform/TextTransformer.js":function(e,n,t){var r=t("../Operation"),o=t("../Common"),a=function(e,n){o.PARANOIA&&(r.check(e),r.check(n));var t=function(e,n){if(e.offset>n.offset){if(e.offset>n.offset+n.toRemove)return r.create(e.offset-n.toRemove+n.toInsert.length,e.toRemove,e.toInsert);var t=e.toRemove-(n.offset+n.toRemove-e.offset);return t<0&&(t=0),0===t&&0===e.toInsert.length?null:r.create(n.offset+n.toInsert.length,t,e.toInsert)}if(e.offset+e.toRemove=0;i--)s=r.apply(n[i],s);var c=[];for(i=e.length-1;i>=0;i--){for(var u=e[i],f=n.length-1;f>=0;f--){try{u=a(u,n[f])}catch(e){return console.error("The pluggable transform function threw an error, failing operational transformation"),console.error(e.stack),[]}if(!u)break}u&&(o.PARANOIA&&r.check(u,s.length),c.unshift(u))}return c}},"transform/NaiveJSONTransformer.js":function(e,n,t){var r=t("./TextTransformer"),o=t("../Operation"),a=t("../Common");e.exports=function(e,n,t){var i,s,c,u=a.global.REALTIME_DEBUG=a.global.REALTIME_DEBUG||{};try{i=r(e,n,t),s=o.applyMulti(n,t),c=o.applyMulti(i,s);try{return JSON.parse(c),i}catch(r){console.error(r),u.ot_parseError={type:"resultParseError",resultOps:i,toTransform:e,transformBy:n,text1:t,text2:s,text3:c,error:r},console.log("Debugging info available at `window.REALTIME_DEBUG.ot_parseError`")}}catch(r){console.error(r),u.ot_applyError={type:"resultParseError",resultOps:i,toTransform:e,transformBy:n,text1:t,text2:s,text3:c,error:r},console.log("Debugging info available at `window.REALTIME_DEBUG.ot_applyError`")}return[]}},"transform/SmartJSONTransformer.js":function(e,n,t){var r,o,a,i=t("json.sortify"),s=t("../Diff"),c=t("../Operation"),u=t("./TextTransformer"),f=function(e){return null===e?"null":(n=e,"[object Array]"===Object.prototype.toString.call(n)?"array":typeof e);var n},l=function(e,n){for(var t=n.length,r=0;r1)return!0})&&("splice"!==n.type||!e.some(function(e){if("splice"===e.type&&y(e.path,n.path)&&e.path.length-n.path.length<0){if(!e.removals)return;for(var t=e.offset,r=e.offset+e.removals;te.offset+n.removals)return void(n.offset+=e.value.length-e.removals);if(n.offseti)){var d=n.slice(0,l);if((y=n.slice(l))===u){var p=Math.min(s,l);if((g=c.slice(0,p))===(b=d.slice(0,p)))return h(g,c.slice(p),d.slice(p),u)}}if(null===f||f===s){var v=s,y=(d=n.slice(0,v),n.slice(v));if(d===c){var m=Math.min(a-v,i-v);if((E=u.slice(u.length-m))===(O=y.slice(y.length-m)))return h(c,u.slice(0,u.length-m),y.slice(0,y.length-m),E)}}}if(r.length>0&&o&&0===o.length){var g=e.slice(0,r.index),E=e.slice(r.index+r.length);if(!(i<(p=g.length)+(m=E.length))){var b=n.slice(0,p),O=n.slice(i-m);if(g===b&&E===O)return h(g,e.slice(p,a-m),n.slice(p,i-m),E)}}return null}(e,n,t);if(f)return f}var l=i(e,n),d=e.substring(0,l);l=s(e=e.substring(l),n=n.substring(l));var p=e.substring(e.length-l),v=function(e,n){var t;if(!e)return[[1,n]];if(!n)return[[r,e]];var c=e.length>n.length?e:n,u=e.length>n.length?n:e,f=c.indexOf(u);if(-1!==f)return t=[[1,c.substring(0,f)],[0,u],[1,c.substring(f+u.length)]],e.length>n.length&&(t[0][0]=t[2][0]=r),t;if(1===u.length)return[[r,e],[1,n]];var l=function(e,n){var t=e.length>n.length?e:n,r=e.length>n.length?n:e;if(t.length<4||2*r.length=e.length?[r,o,a,c,l]:null}var a,c,u,f,l,d=o(t,r,Math.ceil(t.length/4)),h=o(t,r,Math.ceil(t.length/2));if(!d&&!h)return null;a=h?d&&d[4].length>h[4].length?d:h:d,e.length>n.length?(c=a[0],u=a[1],f=a[2],l=a[3]):(f=a[0],l=a[1],c=a[2],u=a[3]);var p=a[4];return[c,u,f,l,p]}(e,n);if(l){var d=l[0],h=l[1],p=l[2],v=l[3],y=l[4],m=o(d,p),g=o(h,v);return m.concat([[0,y]],g)}return function(e,n){for(var t=e.length,o=n.length,i=Math.ceil((t+o)/2),s=i,c=2*i,u=new Array(c),f=new Array(c),l=0;lt)v+=2;else if(O>o)p+=2;else if(h&&(D=s+d-E)>=0&&D=(w=t-f[D]))return a(e,n,T,O)}for(var A=-g+y;A<=g-m;A+=2){for(var w,D=s+A,_=(w=A===-g||A!==g&&f[D-1]t)m+=2;else if(_>o)y+=2;else if(!h){var T;if((b=s+d-A)>=0&&b=(w=t-w))return a(e,n,T,O)}}}return[[r,e],[1,n]]}(e,n)}(e=e.substring(0,e.length-l),n=n.substring(0,n.length-l));return d&&v.unshift([0,d]),p&&v.push([0,p]),c(v,u),v}function a(e,n,t,r){var a=e.substring(0,t),i=n.substring(0,r),s=e.substring(t),c=n.substring(r),u=o(a,i),f=o(s,c);return u.concat(f)}function i(e,n){if(!e||!n||e.charAt(0)!==n.charAt(0))return 0;for(var t=0,r=Math.min(e.length,n.length),o=r,a=0;t=0&&d(e[p][1])){var v=e[p][1].slice(-1);if(e[p][1]=e[p][1].slice(0,-1),f=v+f,h=v+h,!e[p][1]){e.splice(p,1),o--;var y=p-1;e[y]&&1===e[y][0]&&(u++,h=e[y][1]+h,y--),e[y]&&e[y][0]===r&&(a++,f=e[y][1]+f,y--),p=y}}l(e[o][1])&&(v=e[o][1].charAt(0),e[o][1]=e[o][1].slice(1),f+=v,h+=v)}if(o0||h.length>0){f.length>0&&h.length>0&&(0!==(t=i(h,f))&&(p>=0?e[p][1]+=h.substring(0,t):(e.splice(0,0,[0,h.substring(0,t)]),o++),h=h.substring(t),f=f.substring(t)),0!==(t=s(h,f))&&(e[o][1]=h.substring(h.length-t)+e[o][1],h=h.substring(0,h.length-t),f=f.substring(0,f.length-t)));var m=u+a;0===f.length&&0===h.length?(e.splice(o-m,m),o-=m):0===f.length?(e.splice(o-m,m,[1,h]),o=o-m+1):0===h.length?(e.splice(o-m,m,[r,f]),o=o-m+1):(e.splice(o-m,m,[r,f],[1,h]),o=o-m+2)}0!==o&&0===e[o-1][0]?(e[o-1][1]+=e[o][1],e.splice(o,1)):o++,u=0,a=0,f="",h=""}""===e[e.length-1][1]&&e.pop();var g=!1;for(o=1;o=55296&&e<=56319}function f(e){return e>=56320&&e<=57343}function l(e){return f(e.charCodeAt(0))}function d(e){return u(e.charCodeAt(e.length-1))}function h(e,n,t,o){return d(e)||l(o)?null:function(e){for(var n=[],t=0;t0&&n.push(e[t]);return n}([[0,e],[r,n],[1,t],[0,o]])}function p(e,n,t){return o(e,n,t,!0)}p.INSERT=1,p.DELETE=r,p.EQUAL=0,e.exports=p}},n=a("ChainPad.js"),r="ChainPad",e.exports=n,"undefined"!=typeof window?o=window:void 0!==t?o=t:"undefined"!=typeof self&&(o=self),o[r]=n}(I)),I.exports}var C,R=x(),P=n({__proto__:null,default:r(R)},[R]),k={exports:{}};function M(){return C||(C=1,function(e){var n;n=function(e,n){var t={Nacl:e},r=n.encodeBase64,o=e=>{let t;return(t=e.length%4)&&(e+="=".repeat(4-t)),n.decodeBase64(e)},a=n.decodeUTF8,i=n.encodeUTF8,s=function(e){for(var n="",t=0;t{var n={setCustomize:n=>{e=n.ApiConfig},getWebsocketURL:function(n){var t=e.websocketPath||"/cryptpad_websocket";if(/^ws{1,2}:\/\//.test(t))return t;var r=new URL(n||globalThis?.location?.href||e.httpUnsafeOrigin);return n&&(r.href=n),r.protocol.replace(/http/,"ws")+"//"+r.host+t}};return n})())}(H)),H.exports}var K,U=j(),B=n({__proto__:null,default:r(U)},[U]),V={exports:{}};function Y(){return K||(K=1,function(e){e.exports&&(e.exports=function(e={}){return{setCustomize:n=>{e=n.AppConfig},userHashKey:"User_hash",userNameKey:"User_name",blockHashKey:"Block_hash",fileHashKey:"FS_hash",sessionJWT:"Session_JWT",ssoSeed:"SSO_seed",displayNameKey:"cryptpad.username",oldStorageKey:"CryptPad_RECENTPADS",storageKey:"filesData",tokenKey:"loginToken",prefersDriveRedirectKey:"prefersDriveRedirect",isPremiumKey:"isPremiumUser",displayPadCreationScreen:"displayPadCreationScreen",deprecatedKey:"deprecated",MAX_TEAMS_SLOTS:e.maxTeamsSlots||5,MAX_TEAMS_OWNED:e.maxOwnedTeams||5,MAX_PREMIUM_TEAMS_SLOTS:Math.max(e.maxTeamsSlots||0,e.maxPremiumTeamsSlots||0)||5,MAX_PREMIUM_TEAMS_OWNED:Math.max(e.maxOwnedTeams||0,e.maxPremiumTeamsOwned||0)||5,criticalApps:["profile","settings","debug","admin","support","notifications","calendar","moderation"],earlyAccessApps:[]}}(void 0))}(V)),V.exports}var G,J=Y(),q=n({__proto__:null,default:r(J)},[J]),W={exports:{}},z={exports:{}},Q=z.exports;function Z(){return G||(G=1,function(e){!function(n){const t=e=>{var t=n.CryptPad_Util={};n.atob=n.atob||function(e){return Buffer.from(e,"base64").toString("binary")},n.btoa=n.btoa||function(e){return Buffer.from(e,"binary").toString("base64")},t.encodeBase64=e.encodeBase64,t.decodeBase64=n=>{let t=n.length%4;return t&&(n+="=".repeat(4-t)),e.decodeBase64(n)},t.encodeUTF8=e.encodeUTF8,t.decodeUTF8=e.decodeUTF8,t.slice=function(e,n,t){return Array.prototype.slice.call(e,n,t)},t.u8ToBase64=(e,n)=>{const t=new FileReader;t.onload=()=>{let e=t.result,r=e.slice(e.indexOf(",")+1);n(r)},t.readAsDataURL(new Blob([e]))},t.shuffleArray=function(e){for(var n=e.length-1;n>0;n--){var t=Math.floor(Math.random()*(n+1)),r=e[n];e[n]=e[t],e[t]=r}},t.bake=function(e,n){return void 0===n&&(n=[]),Array.isArray(n)||(n=[n]),function(){return e.apply(null,n)}},t.both=function(e,n){if("function"!=typeof e)throw new Error("INVALID_USAGE");return"function"!=typeof n&&(n=function(e){return e}),function(){return e.apply(null,arguments),n.apply(null,arguments)}},t.clone=function(e){return null==e?e:JSON.parse(JSON.stringify(e))},t.serializeError=function(e){if(!(e instanceof Error))return e;var n={};return Object.getOwnPropertyNames(e).forEach(function(t){n[t]=e[t]}),n},t.tryParse=function(e){try{return JSON.parse(e)}catch(e){return}},t.mkAsync=function(e,n){if("function"!=typeof e)throw new Error("EXPECTED_FUNCTION");return function(){var t=Array.prototype.slice.call(arguments);setTimeout(function(){e.apply(null,t)},n)}},t.mkEvent=function(e){var n=[],t=!1;let r;return{reg:function(r){e&&t?setTimeout(r):n.push(r)},unreg:function(e){-1!==n.indexOf(e)?n.splice(n.indexOf(e),1):console.log("event handler was already unregistered")},fire:function(){if(!e||!t){var o=Array.prototype.slice.call(arguments);t||r.apply(null,o),t=!0,n.forEach(function(e){e.apply(null,o)})}},promise:new Promise(e=>{r=e})}},t.mkTimeout=function(e,n){n=n||0;var r=t.once(e),o=setTimeout(function(){r("TIMEOUT")},n);return t.both(r,function(){clearTimeout(o)})},t.onClickEnter=function(e,n,t){e.on("click keydown",function(e){var r="click"===e.type,o="keydown"===e.type&&13===e.which,a="keydown"===e.type&&32===e.which&&t&&t.space;(r||o||a)&&("keydown"===e.type&&e.preventDefault(),n(e))})},t.response=function(e){var n={},t={};"function"!=typeof e&&(e=function(e){throw new Error(e)});var r=function(e){clearTimeout(t[e]),delete t[e],delete n[e]};return{clear:r,expected:function(e){return Boolean(n[e])},expectation:function(e){return n[e]},expect:function(o,a,i){"string"!=typeof o&&e("EXPECTED_STRING"),"function"!=typeof a&&e("EXPECTED_CALLBACK"),n[o]=a,"number"==typeof i&&i&&(t[o]=setTimeout(function(){"function"==typeof n[o]&&n[o]("TIMEOUT"),r(o)},i))},handle:function(t,o){var a=n[t];if("function"==typeof a){try{a.apply(null,Array.isArray(o)?o:[o])}catch(n){e("HANDLER_ERROR",{error:n,id:t,args:o})}r(t)}else e("MISSING_CALLBACK",{id:t,args:o})},_pending:n}},t.inc=function(e,n,t){e[n]=(e[n]||0)+("number"==typeof t?t:1)},t.values=function(e){return Object.keys(e).map(function(n){return e[n]})},t.find=function(e,n){for(var t=n.length,r=0;r&"']/g,function(e){return{"<":"<",">":">","&":"&",'"':""","'":"'"}[e]}):""},t.hexToBase64=function(e){var t=e.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" "),r=String.fromCharCode.apply(null,t);return n.btoa(r).replace(/\//g,"-").replace(/=+$/,"")},t.base64ToHex=function(e){var t=[];return n.atob(e.replace(/-/g,"/")).split("").forEach(function(e){var n=e.charCodeAt(0).toString(16);1===n.length&&(n="0"+n),t.push(n)}),t.join("")},t.uint8ArrayToHex=function(e){for(var n="",t=0;t=o?"GB":e>=r?"MB":"KB"};t.getBlock=function(e,n,r){var o=t.once(t.mkAsync(r)),a={};"string"==typeof n.bearer&&n.bearer&&(a.authorization=`Bearer ${n.bearer}`),fetch(e,{method:"GET",credentials:"include",headers:a}).then(e=>{e.ok?o(void 0,e):401!==e.status&&404!==e.status?o(e.status,e):e.json().then(n=>{o(e.status,n)}).catch(()=>{o(e.status)})}).catch(e=>{o(e)})},t.fetchApi=function(e,n,t,r){const o=new URL(e);o.pathname=`api/${n}`;let a=o.href+(t?"?"+ +new Date:"");if("undefined"!=typeof self&&self.crypto)fetch(a).then(e=>{if(!e.ok)throw new Error(`Fetch error: ${e.status}`);return e.text()}).then(e=>{r(JSON.parse(e.slice(27,-5)))}).catch(e=>{console.error(e.message),r({})});else if(void 0!==f){("http:"===o.protocol?require("node:http"):require("node:https")).get(o.href,e=>{let n="";e.on("data",e=>{n+=e}),e.on("end",()=>{try{r(JSON.parse(n.slice(27,-5)))}catch(e){console.error(e),r({})}})})}},t.fetch=function(e,n,r,o){var a,i=t.once(t.mkAsync(n)),s=function(e){var n=e.replace(/(\/)*$/,""),t=n.lastIndexOf("/"),r=n.slice(t+1);return/^[a-f0-9]{48}$/.test(r)||(r=void 0),r}(e),c=function(){(a=new XMLHttpRequest).open("GET",e,!0),r&&a.addEventListener("progress",function(e){if(e.lengthComputable){var n=e.loaded/e.total;r(n)}},!1),a.responseType="arraybuffer",a.onerror=function(e){i(e)},a.onload=function(){if(/^4/.test(""+this.status))return i("XHR_ERROR");var e=a.response;if(e){var n=new Uint8Array(e);return s?void function(e,n,t){o&&"function"==typeof o.setBlobCache?o.setBlobCache(e,n,t):t("EINVAL")}(s,n,function(){i(null,n)}):void i(void 0,n)}i("ENOENT")},a.send(null)};if(s)return function(e,n){o&&"function"==typeof o.getBlobCache?o.getBlobCache(e,n):n("EINVAL")}(s,function(e,n){!e&&n?i(void 0,n):c()}),{cancel:function(){a&&a.abort&&a.abort()}};c()},t.dataURIToBlob=function(e){for(var n=atob(e.split(",")[1]),t=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(n.length),o=new Uint8Array(r),a=0;aparseInt(e,10).toString(16).padStart(2,"0")).join("")}`},t.isSmallScreen=function(){return n.innerHeight<800||n.innerWidth<800},t.stripTags=function(e){var n=document.createElement("div");return n.innerHTML=e,n.innerText},t.parseFilename=function(e){if(!e||!e.trim())return{};var n=/^(\.?.+?)(\.[^.]+)?$/.exec(e)||[];return{name:n[1],ext:n[2]}},t.isPlainTextFile=function(e,n){if(e&&0===e.indexOf("text/"))return!0;var r=t.parseFilename(n);return!(e||!n||r.ext)||("application/x-javascript"===e||"application/xml"===e)},t.isSpreadsheet=function(e,n){return e&&("application/vnd.oasis.opendocument.spreadsheet"===e||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"===e)||n&&(n.endsWith(".xlsx")||n.endsWith(".ods"))},t.isOfficeDoc=function(e,n){return e&&("application/vnd.oasis.opendocument.text"===e||"application/vnd.openxmlformats-officedocument.wordprocessingml.document"===e)||n&&(n.endsWith(".docx")||n.endsWith(".odt"))},t.isPresentation=function(e,n){return e&&("application/vnd.oasis.opendocument.presentation"===e||"application/vnd.openxmlformats-officedocument.presentationml.presentation"===e)||n&&(n.endsWith(".pptx")||n.endsWith(".odp"))},t.isValidURL=function(e){return!!new RegExp("^(https?:\\/\\/)((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?").test(e)};var a=/([\uD800-\uDBFF][\uDC00-\uDFFF])/;t.getFirstCharacter=function(e){if(!e||!e.trim())return"?";var n=function(e){for(var n=e.split(a),t=[],r=0;r{let n=/ver=([0-9.]+)(-[0-9]*)?/.exec(e);return Array.isArray(n)&&n[1]||void 0},t.Saferphore={create:e=>{var n,t=[];return n=function(){if(e<0)throw new Error("(resourceCount < 0) should never happen");var r;0!==e&&0!==t.length&&(e--,t.shift()((r=0,function(t){if(r++)throw new Error("returnAfter() called multiple times");var o=0;return function(){if(o++)throw new Error("returnAfter wrapped callback called multiple times");t&&t.apply(null,arguments),e++,n()}})))},{take:function(e){t.push(e),n()}}}},t};e.exports&&(e.exports=t(w()))}("undefined"!=typeof self?self:Q)}(z)),z.exports}var X,$,ee={exports:{}};function ne(){return X||(X=1,function(e){e.exports&&(e.exports=function(){var e={},n=function(e){return e.replace(/-/g,"/")};return e.parseUser=function(e){var t,r,o,a=function(e){if(/^\[.*?@.*\]$/.test(e)){var t,r=e.slice(1,-1);if(r=r.replace(/\/([a-zA-Z0-9+-]{43}=)$/,function(e,r){return t=n(r),""}),t){var o=r.lastIndexOf("@");if(!(o<1))return{domain:r.slice(o+1),user:r.slice(0,o),pubkey:t}}}}(e);if(function(e){if(e&&e.domain&&e.user&&e.pubkey)return!0}(a))return a;if(e.replace(/^https*:\/\/([^\/]+)\/user\/#\/1\/([^\/]+)\/([a-zA-Z0-9+-]{43}=)$/,function(e,a,i,s){return t=a,r=i,o=n(s),""}),!t)throw new Error("Could not parse user id ["+e+"]");return{domain:t,user:r,pubkey:o}},e.serialize=function(e,n,t){return"["+n+"@"+e.replace(/https*:\/\//,"")+"/"+t.replace(/\//g,"-")+"]"},e.canonicalize=function(t){if("string"==typeof t){if(44===t.length)return n(t);try{return e.parseUser(t).pubkey}catch(e){return}}},e}())}(ee)),ee.exports}function te(){return $||($=1,function(e){!function(n){e.exports&&(e.exports=function(e,t,r,o){var a=n.CryptPad_Hash={},i=e.uint8ArrayToHex,s=e.hexToBase64,c=e.base64ToHex;a.encodeBase64=e.encodeBase64,a.decodeBase64=e.decodeBase64,a.hashChannelList=function(n){return e.encodeBase64(o.hash(e.decodeUTF8(JSON.stringify(n))))},a.generateSignPair=function(){var e=o.sign.keyPair(),n=function(e){return t.b64RemoveSlashes(e).replace(/=+$/g,"")};return{validateKey:a.encodeBase64(e.publicKey),signKey:a.encodeBase64(e.secretKey),safeValidateKey:n(a.encodeBase64(e.publicKey)),safeSignKey:n(a.encodeBase64(e.secretKey))}},a.getSignPublicFromPrivate=function(n){var r=t.b64AddSlashes(n),a=e.decodeBase64(r),i=o.sign.keyPair.fromSecretKey(a);return e.encodeBase64(i.publicKey)},a.getCurvePublicFromPrivate=function(n){var r=t.b64AddSlashes(n),a=e.decodeBase64(r),i=o.box.keyPair.fromSecretKey(a);return e.encodeBase64(i.publicKey)};var u=a.getEditHashFromKeys=function(e){var n=e.version,r=e.keys;if(0===n)return e.channel+e.key;if(1===n){if(!r.editKeyStr)return;return"/1/edit/"+s(e.channel)+"/"+t.b64RemoveSlashes(r.editKeyStr)+"/"}if(2===n){if(!r.editKeyStr)return;var o=e.password?"p/":"";return"/2/"+e.type+"/edit/"+t.b64RemoveSlashes(r.editKeyStr)+"/"+o}},f=a.getViewHashFromKeys=function(e){var n=e.version,r=e.keys;if(0!==n){if(1===n){if(!r.viewKeyStr)return;return"/1/view/"+s(e.channel)+"/"+t.b64RemoveSlashes(r.viewKeyStr)+"/"}if(2===n){if(!r.viewKeyStr)return;var o=e.password?"p/":"";return"/2/"+e.type+"/view/"+t.b64RemoveSlashes(r.viewKeyStr)+"/"+o}}};a.getHiddenHashFromKeys=function(e,n,t){t=t||{};var r=n.keys&&n.keys.editKeyStr||n.key,o=!t.view&&r?"edit/":"view/",i=n.password?"p/":"";n.keys&&n.keys.fileKeyStr&&(o="");var s="/3/"+e+"/"+o+n.channel+"/"+i,c=a.parseTypeHash(e,s);return c&&c.getHash?c.getHash(t||{}):s};var l=a.getFileHashFromKeys=function(e){var n=e.version,r=e.keys;if(0!==n){if(1===n)return"/1/"+s(e.channel)+"/"+t.b64RemoveSlashes(r.fileKeyStr)+"/";if(2===n){if(!r.fileKeyStr)return;var o=e.password?"p/":"";return"/2/"+e.type+"/"+t.b64RemoveSlashes(r.fileKeyStr)+"/"+o}}};a.getPublicSigningKeyString=r.serialize,a.ephemeralChannelLength=34,a.createChannelId=function(e){var n=i(t.Nacl.randomBytes(e?17:16));if(-1===[32,34].indexOf(n.length)||/[^a-f0-9]/.test(n))throw new Error("channel ids must consist of 32 hex characters");return n},a.getChannelIdFromKey=function(e){if(e)return i(a.decodeBase64(e).subarray(0,16))},a.getBoxPublicFromSecret=function(e){if(e){var n=a.decodeBase64(e),t=o.box.keyPair.fromSecretKey(n);return a.encodeBase64(t.publicKey)}},a.checkBoxKeyPair=function(e,n){if(!n||!e)return!1;var t=a.decodeBase64(e),r=o.box.keyPair.fromSecretKey(t);return n===a.encodeBase64(r.publicKey)},a.createRandomHash=function(e,n){var r;return"file"===e?(r=t.createFileCryptor2(void 0,n),l({password:Boolean(n),version:2,type:e,keys:r})):(r=t.createEditCryptor2(void 0,void 0,n),u({password:Boolean(n),version:2,type:e,keys:r}))};var d=a.parseTypeHash=function(e,n){if(n){var r,o=[],a={},i=(r=n,r.replace(/\/+/g,"/")).split("/"),s=function(){a.password=-1!==o.indexOf("p"),a.present=-1!==o.indexOf("present"),a.embed=-1!==o.indexOf("embed"),a.versionHash=function(e){var n;return e.some(function(e){if(/^hash=/.test(e))return n=e.slice(5),!0}),n?t.b64AddSlashes(n):""}(o),a.auditorKey=function(e){var n;return e.some(function(e){if(/^auditor=/.test(e))return n=e.slice(8),!0}),n?t.b64AddSlashes(n):""}(o),a.newPadOpts=function(e){var n;return e.some(function(e){if(/^newpad=/.test(e))return n=e.slice(7),!0}),n||""}(o),a.loginOpts=function(e){var n;return e.some(function(e){if(/^login=/.test(e))return n=e.slice(6),!0}),n||""}(o),a.ownerKey=function(e){var n;return e.some(function(e){if(86===e.length)return n=e,!0}),n}(o)};return i[1]&&"4"===i[1]?(a.getHash=function(n){if(!n||!Object.keys(n).length)return"";var t="/4/"+e+"/";return n.newPadOpts&&(t+="newpad="+n.newPadOpts+"/"),n.loginOpts&&(t+="login="+n.loginOpts+"/"),t},a.getOptions=function(){var e={};return a.newPadOpts&&(e.newPadOpts=a.newPadOpts),a.loginOpts&&(e.loginOpts=a.loginOpts),e},a.version=4,a.app=i[2],o=i.slice(3),s(),a):-1===["media","file","user","invite"].indexOf(e)?(a.type="pad",a.getHash=function(){return n},a.getOptions=function(){return{embed:a.embed,present:a.present,ownerKey:a.ownerKey,versionHash:a.versionHash,auditorKey:a.auditorKey,newPadOpts:a.newPadOpts,loginOpts:a.loginOpts,password:a.password}},"/"!==n.slice(0,1)&&n.length>=56?(a.channel=n.slice(0,32),a.key=n.slice(32,56),a.version=0,a):(a.getHash=function(e){var n=i.slice(0,5).join("/")+"/",r=void 0!==e.ownerKey?e.ownerKey:a.ownerKey;r&&(n+=r+"/"),(a.password||e.password)&&(n+="p/"),e.embed&&(n+="embed/"),e.present&&(n+="present/");var o=void 0!==e.versionHash?e.versionHash:a.versionHash;o&&(n+="hash="+t.b64RemoveSlashes(o)+"/");var s=void 0!==e.auditorKey?e.auditorKey:a.auditorKey;return s&&(n+="auditor="+t.b64RemoveSlashes(s)+"/"),e.newPadOpts&&(n+="newpad="+e.newPadOpts+"/"),e.loginOpts&&(n+="login="+e.loginOpts+"/"),n},i[1]&&"1"===i[1]?(a.version=1,a.mode=i[2],a.channel=i[3],a.key=t.b64AddSlashes(i[4]),o=i.slice(5),s(),a):i[1]&&"2"===i[1]?(a.version=2,a.app=i[2],a.mode=i[3],a.key=i[4],o=i.slice(5),s(),a):i[1]&&"3"===i[1]?(a.version=3,a.app=i[2],a.mode=i[3],a.channel=i[4],o=i.slice(5),s(),a):a)):(a.getHash=function(){return i.join("/")},-1!==["media","file"].indexOf(e)?(a.type="file",a.getOptions=function(){return{embed:a.embed,present:a.present,ownerKey:a.ownerKey,newPadOpts:a.newPadOpts,loginOpts:a.loginOpts,password:a.password}},a.getHash=function(e){var n=i.slice(0,4).join("/")+"/",t=void 0!==e.ownerKey?e.ownerKey:a.ownerKey;return t&&(n+=t+"/"),(a.password||e.password)&&(n+="p/"),e.embed&&(n+="embed/"),e.present&&(n+="present/"),e.newPadOpts&&(n+="newpad="+e.newPadOpts+"/"),e.loginOpts&&(n+="login="+e.loginOpts+"/"),n},i[1]&&"1"===i[1]?(a.version=1,a.channel=i[2].replace(/-/g,"/"),a.key=i[3].replace(/-/g,"/"),o=i.slice(4),s(),a):i[1]&&"2"===i[1]?(a.version=2,a.app=i[2],a.key=i[3],o=i.slice(4),s(),a):i[1]&&"3"===i[1]?(a.version=3,a.app=i[2],a.channel=i[3],o=i.slice(4),s(),a):a):-1!==["user"].indexOf(e)?(a.type="user",i[1]&&"1"===i[1]?(a.version=1,a.user=i[2],a.pubkey=i[3].replace(/-/g,"/"),a):a):-1!==["invite"].indexOf(e)?(a.type="invite",i[1]&&"2"===i[1]?(a.version=2,a.app=i[2],a.mode=i[3],a.key=i[4],o=i.slice(5),a.password=-1!==o.indexOf("p"),a):a):void 0)}},h=a.parsePadUrl=function(e){var n,t={};return e?("/"!==e.slice(-1)&&"#"!==e.slice(-1)&&(e+="/"),e=e.replace(/\/\?[^#]+#/,"/#"),t.getUrl=function(e){e=e||{};var n="/";return t.type?(n+=t.type+"/",!t.hashData&&e&&Object.keys(e).length?n+"#"+function(e){if(!e||!Object.keys(e).length)return"";var n="/4/"+t.type+"/";return e.newPadOpts&&(n+="newpad="+e.newPadOpts+"/"),e.loginOpts&&(n+="login="+e.loginOpts+"/"),n}(e):t.hashData?n+="#"+t.hashData.getHash(e):n):n},t.getOptions=function(){return t.hashData&&t.hashData.getOptions?t.hashData.getOptions():{}},/^https*:\/\//.test(e)?(e.replace(/^https*:\/\/([^\/]*)\/(.*?)\//i,function(e,n,r){return t.domain=n,t.type=r,""}),-1===(n=e.indexOf("/#"))||(t.hash=e.slice(n+2),t.hashData=d(t.type,t.hash)),t):/^\/($|[^\/])/.test(e)?(n=e.indexOf("/#"),t.type=e.slice(1,n),-1===n||(t.hash=e.slice(n+2),t.hashData=d(t.type,t.hash)),t):t):t};return a.hashToHref=function(e,n){return"/"+n+"/#"+e},a.hrefToHash=function(e){return a.parsePadUrl(e).hash},a.getRelativeHref=function(e){if(e&&-1!==e.indexOf("#")){var n=h(e);return"/"+n.type+"/#"+n.hash}},a.getSecrets=function(n,r,o){var a,i,s={},u=function(){s.keys=t.createEditCryptor2(void 0,void 0,o),s.channel=c(s.keys.chanId),s.version=2,s.type=n};if(!r)return u(),s;if(r){if(!n)throw new Error("getSecrets with a hash requires a type parameter");a=d(n,r),i=r}if(0===i.length)return u(),s;if(0===a.version)s.channel=a.channel,s.key=a.key,s.version=0;else if(1===a.version){if(s.version=1,"pad"===a.type){if(s.channel=c(a.channel),"edit"===a.mode){if(s.keys=t.createEditCryptor(a.key),s.key=s.keys.editKeyStr,32!==s.channel.length||24!==s.key.length)throw new Error("The channel key and/or the encryption key is invalid")}else if("view"===a.mode&&(s.keys=t.createViewCryptor(a.key),32!==s.channel.length))throw new Error("The channel key is invalid")}else if("file"===a.type)s.channel=c(a.channel),s.keys={fileKeyStr:a.key,cryptKey:e.decodeBase64(a.key)};else if("user"===a.type)throw new Error("User hashes can't be opened (yet)")}else if(2===a.version)if(s.version=2,s.type=n,s.password=o,"pad"===a.type){if("edit"===a.mode){if(s.keys=t.createEditCryptor2(a.key,void 0,o),s.channel=c(s.keys.chanId),s.key=s.keys.editKeyStr,32!==s.channel.length||24!==s.key.length)throw new Error("The channel key and/or the encryption key is invalid")}else if("view"===a.mode&&(s.keys=t.createViewCryptor2(a.key,o),s.channel=c(s.keys.chanId),32!==s.channel.length))throw new Error("The channel key is invalid")}else if("file"===a.type){if(s.keys=t.createFileCryptor2(a.key,o),s.channel=c(s.keys.chanId),s.key=s.keys.fileKeyStr,48!==s.channel.length||24!==s.key.length)throw new Error("The channel key and/or the encryption key is invalid")}else if("user"===a.type)throw new Error("User hashes can't be opened (yet)");return s},a.getHashes=function(e){var n={};return(e=JSON.parse(JSON.stringify(e))).keys||e.key?(e.keys||(e.keys={}),(e.keys.editKeyStr||0===e.version&&e.key)&&(n.editHash=u(e)),e.keys.viewKeyStr&&(n.viewHash=f(e)),e.keys.fileKeyStr&&(n.fileHash=l(e)),n):n},a.getFormData=function(n,t,r){var i=(n=n||a.getSecrets("form",t,r))&&n.keys,s=i&&i.secondaryKey;if(s){var c=o.box.keyPair.fromSecretKey(e.decodeUTF8(s).slice(0,32)),u={};u.form_public=e.encodeBase64(c.publicKey);var f=u.form_private=e.encodeBase64(c.secretKey),l=a.getViewHashFromKeys({version:1,channel:n.channel,keys:{viewKeyStr:e.encodeBase64(i.cryptKey)}}),d=a.parseTypeHash("pad",l);return u.form_auditorHash=d.getHash({auditorKey:f}),u}},a.hrefToHexChannelId=function(e,n){var t=a.parsePadUrl(e);if(t&&t.hash)return a.getSecrets(t.type,t.hash,n).channel},a.getBlobPathFromHex=function(e){return"/blob/"+e.slice(0,2)+"/"+e},a.serializeHash=function(e){return e&&"/"!==e.slice(-1)&&(e+="/"),e},a.createInviteUrl=function(e,t){return t=t||a.createChannelId(),n.location.origin+"/invite/#/1/"+t+"/"+e.replace(/\//g,"-")+"/"},a.isValidChannel=function(e){return/^[a-zA-Z0-9]{32,48}$/.test(e)},a.isValidHref=function(e){if(e){var n=a.parsePadUrl(e);if(n&&n.type){if(n.hash){if(!n.hashData)return;if(void 0===n.hashData.version)return;if("pad"===n.hashData.type||"file"===n.hashData.type){if(!n.hashData.key&&!n.hashData.channel)return;if(n.hashData.key&&!/^[a-zA-Z0-9+-/=]+$/.test(n.hashData.key))return}}return n}}},a.decodeDataOptions=function(n){var t=decodeURIComponent(n),r=e.encodeUTF8(e.decodeBase64(t));return e.tryParse(r)||{}},a.encodeDataOptions=function(n){var t=JSON.stringify(n),r=e.encodeBase64(e.decodeUTF8(t));return encodeURIComponent(r)},a.getNewPadURL=function(e,n){var t=a.parsePadUrl(e),r=t.getOptions();return r.newPadOpts=a.encodeDataOptions(n),t.getUrl(r)},a.getLoginURL=function(e,n){var t=a.parsePadUrl(e),r=t.getOptions();return r.loginOpts=a.encodeDataOptions(n),t.getUrl(r)},a}(Z(),M(),ne(),h()))}("undefined"!=typeof window?window:{})}(W)),W.exports}var re,oe,ae=te(),ie=Z(),se={exports:{}},ce={exports:{}};function ue(){return re||(re=1,function(e){e.exports=function e(n,t,r){function o(i,s){if(!t[i]){if(!n[i]){if(!s&&f)return f(i);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=t[i]={exports:{}};n[i][0].call(u.exports,function(e){var t=n[i][1][e];return o(t||e)},u,u.exports,e,n,t,r)}return t[i].exports}for(var a=f,i=0;i=43)}}).catch(function(){return!1})}function A(e){return"boolean"==typeof v?u.resolve(v):O(e).then(function(e){return v=e})}function w(e){var n=y[e.name],t={};t.promise=new u(function(e,n){t.resolve=e,t.reject=n}),n.deferredOperations.push(t),n.dbReady?n.dbReady=n.dbReady.then(function(){return t.promise}):n.dbReady=t.promise}function D(e){var n=y[e.name].deferredOperations.pop();if(n)return n.resolve(),n.promise}function _(e,n){var t=y[e.name].deferredOperations.pop();if(t)return t.reject(n),t.promise}function T(e,n){return new u(function(t,r){if(y[e.name]=y[e.name]||F(),e.db){if(!n)return t(e.db);w(e),e.db.close()}var o=[e.name];n&&o.push(e.version);var a=i.open.apply(i,o);n&&(a.onupgradeneeded=function(n){var t=a.result;try{t.createObjectStore(e.storeName),n.oldVersion<=1&&t.createObjectStore(p)}catch(t){if("ConstraintError"!==t.name)throw t;console.warn('The database "'+e.name+'" has been upgraded from version '+n.oldVersion+" to version "+n.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){var n=a.result;n.onversionchange=function(e){e.target.close()},t(n),D(e)}})}function S(e){return T(e,!1)}function N(e){return T(e,!0)}function I(e,n){if(!e.db)return!0;var t=!e.db.objectStoreNames.contains(e.storeName),r=e.versione.db.version;if(r&&(e.version!==n&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||t){if(t){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function x(e){return new u(function(n,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");n({__local_forage_encoded_blob:!0,data:r,type:e.type})},r.readAsBinaryString(e)})}function C(e){return c([b(atob(e.data))],{type:e.type})}function R(e){return e&&e.__local_forage_encoded_blob}function P(e){var n=this,t=n._initReady().then(function(){var e=y[n._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return l(t,e,e),t}function k(e){w(e);for(var n=y[e.name],t=n.forages,r=0;r0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return u.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),N(e)}).then(function(){return k(e).then(function(){M(e,n,t,r-1)})}).catch(t);t(o)}}function F(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function L(e){var n=this,t={db:null};if(e)for(var r in e)t[r]=e[r];var o=y[t.name];o||(o=F(),y[t.name]=o),o.forages.push(n),n._initReady||(n._initReady=n.ready,n.ready=P);var a=[];function i(){return u.resolve()}for(var s=0;s>4,f[c++]=(15&r)<<4|o>>2,f[c++]=(3&o)<<6|63&a;return u}function pe(e){var n,t=new Uint8Array(e),r="";for(n=0;n>2],r+=z[(3&t[n])<<4|t[n+1]>>4],r+=z[(15&t[n+1])<<2|t[n+2]>>6],r+=z[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function ve(e,n){var t="";if(e&&(t=de.call(e)),e&&("[object ArrayBuffer]"===t||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var r,o=X;e instanceof ArrayBuffer?(r=e,o+=ee):(r=e.buffer,"[object Int8Array]"===t?o+=te:"[object Uint8Array]"===t?o+=re:"[object Uint8ClampedArray]"===t?o+=oe:"[object Int16Array]"===t?o+=ae:"[object Uint16Array]"===t?o+=se:"[object Int32Array]"===t?o+=ie:"[object Uint32Array]"===t?o+=ce:"[object Float32Array]"===t?o+=ue:"[object Float64Array]"===t?o+=fe:n(new Error("Failed to get type for BinaryArray"))),n(o+pe(r))}else if("[object Blob]"===t){var a=new FileReader;a.onload=function(){var t=Q+e.type+"~"+pe(this.result);n(X+ne+t)},a.readAsArrayBuffer(e)}else try{n(JSON.stringify(e))}catch(t){console.error("Couldn't convert value into a JSON string: ",e),n(null,t)}}function ye(e){if(e.substring(0,$)!==X)return JSON.parse(e);var n,t=e.substring(le),r=e.substring($,le);if(r===ne&&Z.test(t)){var o=t.match(Z);n=o[1],t=t.substring(o[0].length)}var a=he(t);switch(r){case ee:return a;case ne:return c([a],{type:n});case te:return new Int8Array(a);case re:return new Uint8Array(a);case oe:return new Uint8ClampedArray(a);case ae:return new Int16Array(a);case se:return new Uint16Array(a);case ie:return new Int32Array(a);case ce:return new Uint32Array(a);case ue:return new Float32Array(a);case fe:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}}var me={serialize:ve,deserialize:ye,stringToBuffer:he,bufferToString:pe};function ge(e,n,t,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+n.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],t,r)}function Ee(e){var n=this,t={db:null};if(e)for(var r in e)t[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new u(function(e,r){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size)}catch(e){return r(e)}t.db.transaction(function(o){ge(o,t,function(){n._dbInfo=t,e()},function(e,n){r(n)})},r)});return t.serializer=me,o}function be(e,n,t,r,o,a){e.executeSql(t,r,o,function(e,i){i.code===i.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[n.storeName],function(e,s){s.rows.length?a(e,i):ge(e,n,function(){e.executeSql(t,r,o,a)},a)},a):a(e,i)},a)}function Oe(e,n){var t=this;e=d(e);var r=new u(function(n,r){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){be(t,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,t){var r=t.rows.length?t.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),n(r)},function(e,n){r(n)})})}).catch(r)});return f(r,n),r}function Ae(e,n){var t=this,r=new u(function(n,r){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){be(t,o,"SELECT * FROM "+o.storeName,[],function(t,r){for(var a=r.rows,i=a.length,s=0;s0)return void a(we.apply(o,[e,s,t,r-1]));i(n)}})})}).catch(i)});return f(a,t),a}function De(e,n,t){return we.apply(this,[e,n,t,1])}function _e(e,n){var t=this;e=d(e);var r=new u(function(n,r){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){be(t,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){n()},function(e,n){r(n)})})}).catch(r)});return f(r,n),r}function Te(e){var n=this,t=new u(function(e,t){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){be(n,r,"DELETE FROM "+r.storeName,[],function(){e()},function(e,n){t(n)})})}).catch(t)});return f(t,e),t}function Se(e){var n=this,t=new u(function(e,t){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){be(n,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],function(n,t){var r=t.rows.item(0).c;e(r)},function(e,n){t(n)})})}).catch(t)});return f(t,e),t}function Ne(e,n){var t=this,r=new u(function(n,r){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){be(t,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,t){var r=t.rows.length?t.rows.item(0).key:null;n(r)},function(e,n){r(n)})})}).catch(r)});return f(r,n),r}function Ie(e){var n=this,t=new u(function(e,t){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){be(n,r,"SELECT key FROM "+r.storeName,[],function(n,t){for(var r=[],o=0;o '__WebKitDatabaseInfoTable__'",[],function(t,r){for(var o=[],a=0;a0}function Le(e){var n=this,t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=ke(e,n._defaultConfig),Fe()?(n._dbInfo=t,t.serializer=me,u.resolve()):u.reject()}function He(e){var n=this,t=n.ready().then(function(){for(var e=n._dbInfo.keyPrefix,t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}});return f(t,e),t}function je(e,n){var t=this;e=d(e);var r=t.ready().then(function(){var n=t._dbInfo,r=localStorage.getItem(n.keyPrefix+e);return r&&(r=n.serializer.deserialize(r)),r});return f(r,n),r}function Ke(e,n){var t=this,r=t.ready().then(function(){for(var n=t._dbInfo,r=n.keyPrefix,o=r.length,a=localStorage.length,i=1,s=0;s=0;n--){var t=localStorage.key(n);0===t.indexOf(e)&&localStorage.removeItem(t)}}):u.reject("Invalid arguments"),f(r,n),r}var qe={_driver:"localStorageWrapper",_initStorage:Le,_support:Pe(),iterate:Ke,getItem:je,setItem:Ge,removeItem:Ye,clear:He,length:Ve,key:Ue,keys:Be,dropInstance:Je},We=function(e,n){return e===n||"number"==typeof e&&"number"==typeof n&&isNaN(e)&&isNaN(n)},ze=function(e,n){for(var t=e.length,r=0;r{const n=(e,n)=>{let t=globalThis,r=globalThis;var o=t.CryptPad_Cache={},a=e.mkEvent(!0),i=!1,s=!1,c=!1;try{var u=t.indexedDB.open("test_db",1);u.onsuccess=function(){i=(c=!0)&&!s,a.fire()},u.onerror=function(){a.fire()}}catch(e){a.fire()}o.enable=function(){s=!1,i=c&&!s},o.disable=function(){s=!0,i=c&&!s},o.isEnabled=()=>i;var f=n.createInstance({driver:n.INDEXEDDB,name:"cp_cache"});o.getBlobCache=function(n,t){t=e.once(e.mkAsync(t||function(){})),a.reg(function(){i?f.getItem(n,function(r,o){!r&&o&&o.c?(t(null,o.c),o.t=+new Date,f.setItem(n,o,function(e){e&&console.error(e)})):t(e.serializeError(r||"EINVAL"))}):t("NOCACHE")})},o.setBlobCache=function(n,t,r){r=e.once(e.mkAsync(r||function(){})),a.reg(function(){i?t?f.setItem(n,{c:t,t:+new Date},function(n){r(e.serializeError(n))}):r("EINVAL"):r("NOCACHE")})},o.getChannelCache=function(n,t){t=e.once(e.mkAsync(t||function(){})),a.reg(function(){i?f.getItem(n,function(r,o){!r&&o&&Array.isArray(o.c)?(t(null,o),o.t=+new Date,f.setItem(n,o,function(e){e&&console.error(e)})):t(e.serializeError(r||"EINVAL"))}):t("NOCACHE")})};var l={};return o.storeCache=function(n,t,r,o){o=e.once(e.mkAsync(o||function(){})),a.reg(function(){l[n]=l[n]||e.throttle(function(t,r,o){var a,s;i?Array.isArray(r)&&t?(a=r,Array.isArray(a)&&(a.length>100&&a.splice(0,a.length-100),a.some(function(e,n){if(e.isCheckpoint)return s=n,!0}),a.splice(0,s)),f.setItem(n,{k:t,c:r,t:+new Date},function(n){n&&o(e.serializeError(n))})):o("EINVAL"):o("NOCACHE")},50),l[n](t,r,o)})},o.leaveChannel=function(e){delete l[e]},o.clearChannel=function(n,t){t=e.once(e.mkAsync(t||function(){})),a.reg(function(){i?f.removeItem(n,function(){t()}):t("NOCACHE")})},o.clear=function(n){n=e.once(e.mkAsync(n||function(){})),a.reg(function(){i?f.clear(n):n("NOCACHE")})},o.getKeys=function(n){n=e.once(e.mkAsync(n||function(){})),a.reg(function(){i?f.keys().then(function(e){n(null,e)}).catch(function(e){n(e)}):n("NOCACHE")})},o.getTime=function(n,t){t=e.once(e.mkAsync(t||function(){})),a.reg(function(){i?f.getItem(n,function(n,r){!n&&r&&r.c?t(null,r.t):t(e.serializeError(n||"EINVAL"))}):t("NOCACHE")})},r.CryptPad_clearIndexedDB=o.clear,o};e.exports&&(e.exports=n(Z(),ue()))})()}(se)),se.exports}var le=fe(),de=n({__proto__:null,default:r(le)},[le]);const he=ie.mkEvent(!0),pe=ie.mkEvent(!0),ve=ie.mkEvent(),ye=ie.mkEvent();let me={};const ge={setCustomize:e=>{me=e.ApiConfig},init:e=>{var n,t,r;const{broadcast:o,userHash:a,anonHash:i}=e,s=a||i||ae.createRandomHash("drive"),c=e.store,u=ae.getSecrets("drive",s),f=(null===(n=e.store)||void 0===n?void 0:n.network)||(null===(t=e.store)||void 0===t?void 0:t.networkPromise),l={data:{},websocketURL:U.getWebsocketURL(),network:f,channel:u.channel,readOnly:!1,validateKey:(null===(r=u.keys)||void 0===r?void 0:r.validateKey)||void 0,crypto:L.createEncryptor(u.keys),Cache:de,userName:"fs",logLevel:1,ChainPad:P,updateProgress:function(e){e.type="drive",o([],"LOADING_DRIVE",e)},classic:!0},d=globalThis.CP_account_rt=N.create(l);c.driveSecret=u,c.proxy=d.proxy,c.onRpcReadyEvt=ie.mkEvent(!0),c.loggedIn=void 0!==e.userHash;const h={loggedIn:c.loggedIn};return d.proxy.on("create",function(e){c.realtime=e.realtime,c.network=e.network,c.loggedIn||(h.anonHash=ae.getEditHashFromKeys(u))}).on("cacheready",function(n){c.realtime=n.realtime,c.offline=!0;const t=!!c.networkPromise;if(c.networkPromise||(c.networkPromise=n.networkPromise),c.cacheReturned=h,c.networkPromise&&c.networkPromise.then&&!t){const e=setTimeout(function(){c.networkTimeout=!0,o([],"LOADING_DRIVE",{type:"offline"})},5e3);c.networkPromise.then(function(n){c.network||(c.network=n),clearTimeout(e)},function(n){console.error(n),clearTimeout(e)})}e.cache&&(h.edPublic=d.proxy.edPublic,he.fire(h))}).on("ready",function(n){delete c.networkTimeout,c.ready||(c.driveMetadata=n.metadata,d.proxy.drive||(d.proxy.drive={}),!d.proxy[J.displayNameKey]&&c.noDriveName&&(d.proxy[J.displayNameKey]=c.noDriveName),!d.proxy.uid&&c.noDriveUid&&(d.proxy.uid=c.noDriveUid),!d.proxy.form_seed&&e.form_seed&&(d.proxy.form_seed=e.form_seed),d.proxy.edPublic&&Array.isArray(me.adminKeys)&&-1!==me.adminKeys.indexOf(d.proxy.edPublic)&&(c.isAdmin=!0),h.edPublic=d.proxy.edPublic,pe.fire(h))}).on("error",function(e){"EDELETED"===e.error&&(c.ownDeletion||(c.isDeleted=!0,o([],"DRIVE_DELETED",e.message)))}).on("disconnect",function(){c.offline=!0,ve.fire(),o([],"UPDATE_METADATA")}).on("reconnect",function(){c.offline=!1,ye.fire(),o([],"UPDATE_METADATA")}),{channel:u.channel,onAccountCacheReady:he.reg,onAccountReady:pe.reg,onDisconnect:ve.reg,onReconnect:ye.reg}}};var Ee,be=Object.freeze({__proto__:null,Account:ge}),Oe={exports:{}};function Ae(){return Ee||(Ee=1,function(e){(()=>{const n=(e={},n={})=>{var t={setCustomize:t=>{n=t.Messages,e=t.AppConfig},init:function(e){t.state=e}};return t.send=function(n,r,o){("function"!=typeof o&&(o=function(){}),e.disableFeedback)?o():n&&(!0===r||t.state)?function(e,n){var t=new XMLHttpRequest;t.open("HEAD",e),t.onreadystatechange=function(){this.readyState===this.DONE&&n&&n()},t.send()}("/common/feedback.html?"+n+"="+Math.random().toString(16).replace(/0./,""),o):o()},t.reportAppUsage=function(){var e=window.location.pathname.split("/").filter(function(e){return e}).join(".");/^#\/1\/view\//.test(window.location.hash)?t.send(e+"_VIEW"):t.send(e)},t.reportScreenDimensions=function(){var e=window.innerHeight,n=window.innerWidth;t.send("DIMENSIONS:"+e+"x"+n)},t.reportLanguage=function(){n&&t.send("LANG_"+n._languageUsed)},t};e.exports&&(e.exports=n(void 0,void 0))})()}(Oe)),Oe.exports}var we,De,_e=Ae(),Te=n({__proto__:null,default:r(_e)},[_e]),Se={exports:{}},Ne={exports:{}};function Ie(){return De||(De=1,function(e){e.exports&&(e.exports=function(e={},n){var t={setCustomize:n=>{e=n.AppConfig}};t.MINIMUM_PASSWORD_LENGTH="number"==typeof e.minimumPasswordLength?e.minimumPasswordLength:8,t.MINIMUM_NAME_LENGTH=1,t.MAXIMUM_NAME_LENGTH=64,t.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())},t.isLongEnoughPassword=function(e){return e.length>=t.MINIMUM_PASSWORD_LENGTH};var r=t.isString=function(e){return"string"==typeof e};return t.isValidUsername=function(e){return!!(r(e)&&e.length>=t.MINIMUM_NAME_LENGTH)},t.isValidPassword=function(e){return!(!e||!r(e))},t.passwordsMatch=function(e,n){return r(e)&&r(n)&&e===n},t.customSalt=function(){return"string"==typeof e.loginSalt?e.loginSalt:""},t.deriveFromPassphrase=function(e,r,o,a){n(r,e+t.customSalt(),8,1024,o||128,200,a,void 0)},t.dispenser=function(e){var n={used:0};return function(t){if(n.used+t>e.length)throw new Error("exceeded available entropy");if("number"!=typeof t)throw new Error("expected a number");if(t<=0)throw new Error("expected to consume a positive number of bytes");var r;return r=e.slice?e.slice(n.used,n.used+t):e.subarray(n.used,n.used+t),n.used+=t,r}},t}(void 0,(we||(we=1,function(e){e.exports=function(e,n,t,r,o,a,i,s){function c(e){var n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],t=1779033703,r=3144134277,o=1013904242,a=2773480762,i=1359893119,s=2600822924,c=528734635,u=1541459225,f=new Array(64);function l(e){for(var l=0,d=e.length;d>=64;){var h,p,v,y,m,g=t,E=r,b=o,O=a,A=i,w=s,D=c,_=u;for(p=0;p<16;p++)v=l+4*p,f[p]=(255&e[v])<<24|(255&e[v+1])<<16|(255&e[v+2])<<8|255&e[v+3];for(p=16;p<64;p++)y=((h=f[p-2])>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,m=((h=f[p-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,f[p]=(y+f[p-7]|0)+(m+f[p-16]|0)|0;for(p=0;p<64;p++)y=(((A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7))+(A&w^~A&D)|0)+(_+(n[p]+f[p]|0)|0)|0,m=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&E^g&b^E&b)|0,_=D,D=w,w=A,A=O+y|0,O=b,b=E,E=g,g=y+m|0;t=t+g|0,r=r+E|0,o=o+b|0,a=a+O|0,i=i+A|0,s=s+w|0,c=c+D|0,u=u+_|0,l+=64,d-=64}}l(e);var d,h=e.length%64,p=e.length/536870912|0,v=e.length<<3,y=h<56?56:120,m=e.slice(e.length-h,e.length);for(m.push(128),d=h+1;d>>24&255),m.push(p>>>16&255),m.push(p>>>8&255),m.push(p>>>0&255),m.push(v>>>24&255),m.push(v>>>16&255),m.push(v>>>8&255),m.push(v>>>0&255),l(m),[t>>>24&255,t>>>16&255,t>>>8&255,t>>>0&255,r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function u(e,n,t){e=e.length<=64?e:c(e);var r,o=64+n.length+4,a=new Array(o),i=new Array(64),s=[];for(r=0;r<64;r++)a[r]=54;for(r=0;r=o-4;e--){if(a[e]++,a[e]<=255)return;a[e]=0}}for(;t>=32;)u(),s=s.concat(c(i.concat(c(a)))),t-=32;return t>0&&(u(),s=s.concat(c(i.concat(c(a))).slice(0,t))),s}function f(e,n,t,r){var o,a,i=e[0]^n[t++],s=e[1]^n[t++],c=e[2]^n[t++],u=e[3]^n[t++],f=e[4]^n[t++],l=e[5]^n[t++],d=e[6]^n[t++],h=e[7]^n[t++],p=e[8]^n[t++],v=e[9]^n[t++],y=e[10]^n[t++],m=e[11]^n[t++],g=e[12]^n[t++],E=e[13]^n[t++],b=e[14]^n[t++],O=e[15]^n[t++],A=i,w=s,D=c,_=u,T=f,S=l,N=d,I=h,x=p,C=v,R=y,P=m,k=g,M=E,F=b,L=O;for(a=0;a<8;a+=2)A^=(o=(k^=(o=(x^=(o=(T^=(o=A+k)<<7|o>>>25)+A)<<9|o>>>23)+T)<<13|o>>>19)+x)<<18|o>>>14,S^=(o=(w^=(o=(M^=(o=(C^=(o=S+w)<<7|o>>>25)+S)<<9|o>>>23)+C)<<13|o>>>19)+M)<<18|o>>>14,R^=(o=(N^=(o=(D^=(o=(F^=(o=R+N)<<7|o>>>25)+R)<<9|o>>>23)+F)<<13|o>>>19)+D)<<18|o>>>14,L^=(o=(P^=(o=(I^=(o=(_^=(o=L+P)<<7|o>>>25)+L)<<9|o>>>23)+_)<<13|o>>>19)+I)<<18|o>>>14,A^=(o=(_^=(o=(D^=(o=(w^=(o=A+_)<<7|o>>>25)+A)<<9|o>>>23)+w)<<13|o>>>19)+D)<<18|o>>>14,S^=(o=(T^=(o=(I^=(o=(N^=(o=S+T)<<7|o>>>25)+S)<<9|o>>>23)+N)<<13|o>>>19)+I)<<18|o>>>14,R^=(o=(C^=(o=(x^=(o=(P^=(o=R+C)<<7|o>>>25)+R)<<9|o>>>23)+P)<<13|o>>>19)+x)<<18|o>>>14,L^=(o=(F^=(o=(M^=(o=(k^=(o=L+F)<<7|o>>>25)+L)<<9|o>>>23)+k)<<13|o>>>19)+M)<<18|o>>>14;n[r++]=e[0]=A+i|0,n[r++]=e[1]=w+s|0,n[r++]=e[2]=D+c|0,n[r++]=e[3]=_+u|0,n[r++]=e[4]=T+f|0,n[r++]=e[5]=S+l|0,n[r++]=e[6]=N+d|0,n[r++]=e[7]=I+h|0,n[r++]=e[8]=x+p|0,n[r++]=e[9]=C+v|0,n[r++]=e[10]=R+y|0,n[r++]=e[11]=P+m|0,n[r++]=e[12]=k+g|0,n[r++]=e[13]=M+E|0,n[r++]=e[14]=F+b|0,n[r++]=e[15]=L+O|0}function l(e,n,t,r,o){for(;o--;)e[n++]=t[r++]}function d(e,n,t,r,o){for(;o--;)e[n++]^=t[r++]}function h(e,n,t,r,o){l(e,0,n,t+16*(2*o-1),16);for(var a=0;a<2*o;a+=2)f(e,n,t+16*a,r+8*a),f(e,n,t+16*a+16,r+8*a+16*o)}function p(e,n,t){return e[n+16*(2*t-1)]}function v(e){for(var n=[],t=0;t127&&r<2048?(n.push(r>>6|192),n.push(63&r|128)):(n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128))}return n}if(t<1||t>31)throw new Error("scrypt: logN not be between 1 and 31");var y,m,g,E,b=1<>>0;if(1*r>=1<<30||r>16777216||r>8388608||b>16777216/r)throw new Error("scrypt: parameters are too large");"string"==typeof e&&(e=v(e)),"string"==typeof n&&(n=v(n)),"undefined"!=typeof Int32Array?(y=new Int32Array(64*r),m=new Int32Array(32*b*r),E=new Int32Array(16)):(y=[],m=[],E=new Array(16)),g=u(e,n,128*r);var O=32*r;function A(){for(var e=0;e<32*r;e++){var n=4*e;y[0+e]=(255&g[n+3])<<24|(255&g[n+2])<<16|(255&g[n+1])<<8|255&g[n+0]}}function w(e,n){for(var t=e;t>>0&255,g[4*e+1]=n>>>8&255,g[4*e+2]=n>>>16&255,g[4*e+3]=n>>>24&255}}var T="undefined"!=typeof setImmediate?setImmediate:setTimeout;function S(e,n,t,r,o){!function a(){T(function(){r(e,e+t>>18&63]),o.push(t[n>>>12&63]),o.push(t[n>>>6&63]),o.push(t[n>>>0&63]);return r%3>0&&(o[o.length-1]="=",r%3==1&&(o[o.length-2]="=")),o.join("")}(t):"hex"===n?function(e){for(var n="0123456789abcdef".split(""),t=e.length,r=[],o=0;o>>4&15]),r.push(n[e[o]>>>0&15]);return r.join("")}(t):t}"function"==typeof a&&(s=i,i=a,a=1e3),a<=0?(A(),w(0,b),D(0,b),_(),i(N(s))):(A(),S(0,b,2*a,w,function(){S(0,b,2*a,D,function(){_(),i(N(s))})}))}}(Ne)),Ne.exports)))}(Se)),Se.exports}var xe,Ce,Re,Pe=Ie(),ke=n({__proto__:null,default:r(Pe)},[Pe]),Me={exports:{}},Fe={exports:{}},Le={exports:{}},He={exports:{}};function je(){return xe||(xe=1,function(e){e.exports&&(e.exports={whenRealtimeSyncs:function(e,n){"function"==typeof e.getAuthDoc?setTimeout(function(){e.getAuthDoc()!==e.getUserDoc()?e.onSettle(n):n()},0):console.error("improper use of this function")}})}(He)),He.exports}function Ke(){return Ce||(Ce=1,function(e){(()=>{const n=(e,n,t)=>{let r=globalThis;var o={setCustomize:()=>{}},a=function(e){try{return JSON.parse(JSON.stringify(e))}catch(e){return}};return o.init=function(o,i,s){var c=o.loggedIn,u=o.sharedFolder,f=o.readOnly,l=o.Messages||{},d=i.ROOT,h=i.FILES_DATA,p=i.STATIC_DATA,v=i.OLD_FILES_DATA,y=i.UNSORTED,m=i.TRASH,g=i.TEMPLATE,E=i.SHARED_FOLDERS,b=i.SHARED_FOLDERS_TEMP,O=i.debug;i._setReadOnly=function(e){(f=e)||i.fixFiles()},i.setHref=function(e,t,r){(t||e)&&(f||(t?[t]:i.findChannels([e])).forEach(function(e){var t=i.getFileData(e,!0);if(i.getHref(t)===r)return;t.href=i.cryptor.encrypt(r);const o=n.parsePadUrl(r);if("form"!==o.type)return;const a=n.getSecrets(o.type,o.hash,t.password);t.roHref="/"+o.type+"/#"+n.getViewHashFromKeys(a)}))},i.setPadAttribute=function(e,n,t,r){if(r=r||function(){},f)r("EFORBIDDEN");else{var o=i.getIdFromHref(e);if(o)if(n&&n.trim()){var s=i.getFileData(o,!0);"href"===n?i.setHref(null,o,t):s[n]=a(t),r(null)}else r("E_INVAL_ATTR");else r("E_INVAL_HREF")}},i.getPadAttribute=function(e,n,t){t=t||function(){};var r=i.getIdFromHref(e);if(r){var o=i.getFileData(r);t(null,a(o[n]))}else t(null,void 0)},i.pushData=function(n,t){if("function"!=typeof t&&(t=function(){}),f)t("EFORBIDDEN");else{var r=e.createRandomInteger(),o=a(n);o.href&&-1!==o.href.indexOf("#")&&(o.href=i.cryptor.encrypt(o.href)),s[h][r]=o,t(null,r)}},i.pushLink=function(n,t){if("function"!=typeof t&&(t=function(){}),f)t("EFORBIDDEN");else{var r=e.createRandomInteger(),o=a(n);s[p][r]=o,t(null,r)}},i.pushSharedFolder=function(n,t){if("function"!=typeof t&&(t=function(){}),f)t("EFORBIDDEN");else{var r,u=a(n);if(Object.keys(s[E]).some(function(e){if(s[E][e].channel===u.channel)return u.href&&!s[E][e].href&&(s[E][e].href=u.href),r=e,!0}))t("EEXISTS",r);else if(c&&!o.testMode){var l=e.createRandomInteger();u.href&&-1!==u.href.indexOf("#")&&(u.href=i.cryptor.encrypt(u.href)),s[E][l]=u,t(null,l)}else t("EAUTH")}},i.deprecateSharedFolder=function(e,n){if(!f){var t=s[E][e];if(t){if(!(!t.href||-1===i.cryptor.decrypt(t.href).indexOf("#")))(s[b][e]=JSON.parse(JSON.stringify(t))).legacy="PASSWORD_CHANGE"!==n;var r=i.findFile(Number(e));i.delete(r,null,!0),delete s[E][e]}}};var A=function(e){f||delete s[h][e]};i.checkDeletedFiles=function(e){if(c||o.testMode)if(f)e("EFORBIDDEN");else{var t=i.getFiles([d,"hrefArray",m]),r=[];i.getFiles([h,E,p]).forEach(function(e){if(-1===t.indexOf(e)){var a=i.isSharedFolder(e)?s[E][e]:i.getFileData(e),c=a.channel;a.lastVersion&&r.push(n.hrefToHexChannelId(a.lastVersion)),a.rtChannel&&r.push(a.rtChannel),c&&r.push(c),i.isSharedFolder(e)?(delete s[E][e],o.removeProxy&&o.removeProxy(e)):s[p][e]?delete s[p][e]:A(e)}}),r.length?e(null,r):e()}else e()};i.deleteMultiplePermanently=function(e,n,t){if(f)t("EFORBIDDEN");else{var r=e.filter(function(e){return i.isPathIn(e,[h])});if(!c&&!o.testMode)return r.forEach(function(e){var n=e[1];n&&A(n)}),void t();var a=e.filter(function(e){return i.isPathIn(e,["hrefArray"])}),u=e.filter(function(e){return i.isPathIn(e,[d])}),l=e.filter(function(e){return i.isPathIn(e,[m])}),p=[];a.forEach(function(e){var n=i.find(e);p.push({root:e[0],id:n})}),function(e){f||e.forEach(function(e){var n=s[e.root].indexOf(e.id);s[e.root].splice(n,1)})}(p),u.forEach(function(e){var n=e.slice(),t=n.pop();delete i.find(n)[t]});var v,y=[];l.forEach(function(e){var n=e.slice(),t=n.pop(),r=i.find(n);4!==e.length?delete r[t]:y.push({name:e[1],el:r})}),v=y,f||v.forEach(function(e){var n=s[m][e.name].indexOf(e.el);s[m][e.name].splice(n,1)}),n?t():i.checkDeletedFiles(t)}},i.copyFromOtherDrive=function(e,t,r,o){if(!f){var a=[];if(Object.keys(r).forEach(function(e){e=Number(e);var n=r[e];if(n.static)return delete n.static,void(s[p][e]=n);n.href&&(n.href=i.cryptor.encrypt(n.href));var t=!1;for(var o in s[h])if(s[h][o].channel===n.channel){s[h][o].href||(s[h][o].href=n.href),t=!0;break}t?a.push(e):s[h][e]=n}),i.isFile(t)&&-1!==a.indexOf(t))i.log(l.sharedFolders_duplicate);else{if(i.isFolder(t)){var c=function(e){for(var n in e)i.isFile(e[n])?-1!==a.indexOf(e[n])&&(i.log(l.sharedFolders_duplicate),delete e[n]):i.isFolder(e[n])&&c(e[n])};c(t)}var u=i.find(e),d=i.isFile(t)?n.createChannelId():o,v=i.getAvailableName(u,d);Array.isArray(u)?u.push(t):u[v]=t}}};i.copyElement=function(e,t){if(!f&&!i.comparePath(e,t)){var r=i.find(e),o=i.find(t);if(i.isPathIn(t,[m])){if(!e||e.length<2||e[0]===m)return void O("Can't move an element from the trash to the trash: ",e);var a=e[e.length-1],c=i.isPathIn(e,["hrefArray"])?i.getTitle(r):a,u=e.slice();return u.pop(),function(e,n,t){if(!f){var r=s[m];void 0===r[e]&&(r[e]=[]);var o={element:n,path:t};r[e].push(o)}}(c,r,u),!0}if(i.isPathIn(t,["hrefArray"])){if(i.isFolder(r))return void i.log(l.fo_moveUnsortedError);if(e[0]===t[0])return;var d=t[0];return-1===s[d].indexOf(r)&&s[d].push(r),!0}var h=i.isFile(r)?i.getAvailableName(o,n.createChannelId()):i.isInTrashRoot(e)?e[1]:e.pop();if(void 0===o[h])return o[h]=r,!0;i.log(l.fo_unavailableName)}},i.forget=function(e){if(!f){var n=i.getIdFromHref(e);if(n){if(!c&&!o.testMode)return A(n),!0;var t=i.findFile(n);return i.move(t,[m]),!0}}},i.restoreHref=function(e){if(!f){var n=i.getIdFromHref(e);if(n&&i.isFile(n)){var t=i.findFile(n),r=!0;t.forEach(function(e){e[0]!==m?r=!1:i.delete(e,null,!0)}),r&&i.add(n)}}},i.add=function(e,t){if(!f&&(c||o.testMode)){e=Number(e);var r=s[h][e]||s[p][e]||s[E][e];if(r&&"object"==typeof r){var a,u=t;if(t&&!Array.isArray(t)&&(u=decodeURIComponent(t).split(",")),t&&i.isPathIn(u,["hrefArray"]))(a=i.find(u)).push(e);else if(-1!==i.getFiles([d,m,"hrefArray"]).indexOf(e)||u||(u=[d]),t&&i.isPathIn(u,[d])){if(a=i.find(u)){var l=i.getAvailableName(a,n.createChannelId());return void(a[l]=e)}a=i.find([d]),u.slice(1).forEach(function(e){a=a[e]=a[e]||{}}),a[n.createChannelId()]=e}}}},i.setFolderData=function(e,t,r,o){if(!f){var a=i.find(e);if(i.isFolder(a)&&!i.isSharedFolder(a)){if(!i.hasFolderData(a))a["000"+n.createChannelId().slice(0,-3)]={metadata:!0};i.getFolderData(a)[t]=r,o()}}};var w=function(e){i.rt?(i.rt.sync(),t.whenRealtimeSyncs(i.rt,e)):r.setTimeout(e,1e3)};return i.migrateReadOnly=function(e){if(!f&&o.editKey)if(s.version>=2)e();else{s.migrateRo=1;w(function(){var n=JSON.parse(JSON.stringify(s));i.reencrypt(o.editKey,o.editKey,n),setTimeout(function(){s.version>=2?e():(Object.keys(n).forEach(function(e){s[e]=n[e]}),s.version=2,delete s.migrateRo,w(e))},1e3)})}else e({error:"EFORBIDDEN"})},i.migrate=function(t){if(f)t();else{!function(){if(s[y]&&s[v]){O("UNSORTED still exists in the object, removing it...");var e=s[y];0!==e.length?(e.forEach(function(e){"string"==typeof e&&(0===s[v].filter(function(n){return n.href===e}).length&&s[v].push({href:e}))}),delete s[y]):delete s[y]}}(),function(t){if(s[v])try{O("Migrating file system..."),s.migrate=1;w(function(){var r=s[v].slice();s[h]||(s[h]={});var o=s[h];r.forEach(function(t){if(t&&t.href){var r=t.href,a=e.createRandomInteger(),s=i.findFile(r),c=t,u=n.createChannelId();o[a]=c||{href:r},s.forEach(function(e){var n=e.slice(),t=n.pop(),r=i.find(n);if(i.isInTrashRoot(e))return r.element=a,void(o[a].filename=e[1]);i.isPathIn(e,["hrefArray"])?r[t]=a:(r[u]=a,o[a].filename=t,delete r[t])})}}),delete s[v],delete s.migrate,t()})}catch(e){console.error(e),t()}else t()}(t)}},i.fixFiles=function(t){if(!f){t&&(O=function(){});var r=+new Date;O("Cleaning file system...");var a=JSON.stringify(s),l=function(t){"object"!=typeof s[d]&&(O("ROOT was not an object"),s[d]={});var r=t||s[d];if(!r)return console.error("Invalid element in root");var o,a=0,c=s[p],u=s[h];for(var f in r)if(null!==(o=r[f]))if(i.isFolderData(o))0!==a&&(O("Multiple metadata files in folder"),delete r[f]),a++;else if(i.isFile(o,!0)||i.isFolder(o))if(i.isFolder(o))l(o);else{if("string"==typeof o){var v=e.createRandomInteger(),y=n.createChannelId();u[v]={href:i.cryptor.encrypt(o),filename:f},r[y]=v,delete r[f]}if("number"==typeof o)u[o]||c[o]||(O("An element in ROOT doesn't have associated data",o,f),delete r[f])}else O("An element in ROOT was not a folder nor a file. ",o),delete r[f];else console.error("element[%s] is null",f),delete r[f]};e.isObject(s[p])||(O("STATIC_DATA was not an object"),s[p]={}),l(),function(){if(!u){"object"!=typeof s[m]&&(O("TRASH was not an object"),s[m]={});var n,t=s[m],r=function(t,r,o){if("object"==typeof t){if(!i.isSharedFolder(t.element))if(i.isFile(t.element,!0)||i.isFolder(t.element))if(Array.isArray(t.path)){if("string"==typeof t.element){var a=e.createRandomInteger();s[h][a]={href:i.cryptor.encrypt(t.element),filename:o},t.element=a}if(i.isFolder(t.element)&&l(t.element),"number"==typeof t.element)s[h][t.element]||s[p][t.element]||(O("An element in TRASH doesn't have associated data",t.element,o),n.push(r))}else n.push(r);else n.push(r)}else n.push(r)};for(var o in t)if(Array.isArray(t[o]))if(0===t[o].length)O("Empty array in TRASH root. ",t[o]),delete t[o];else{n=[];for(var a=0;a=0;c--)t[o].splice(n[c],1)}else O("An element in TRASH root is not an array. ",t[o]),delete t[o]}}(),function(){if(!u){Array.isArray(s[g])||(O("TEMPLATE was not an array"),s[g]=[]);var n=e.deduplicateString(s[g]);n.length!==s[g].length&&(s[g]=n);var t=s[g],r=i.getFiles([d]),o=[];t.forEach(function(n,a){if(i.isFile(n,!0)&&-1===r.indexOf(n)){if("string"==typeof n){var c=e.createRandomInteger();return s[h][c]={href:i.cryptor.encrypt(n)},void(t[a]=c)}if("number"==typeof n)s[h][n]||(O("An element in TEMPLATE doesn't have associated data",n),o.push(n))}else o.push(n)}),o.forEach(function(e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)})}}(),function(){"object"!=typeof s[h]&&(O("FILES_DATA was not an object"),s[h]={});var e=s[h],t=i.getFiles([d,m,"hrefArray"]),r=i.find([d]),a=[];for(var u in e)if(String(u)===String(Number(u))){var l=e[u=Number(u)];if(l&&"object"==typeof l)if(l.href||l.roHref){var v;try{v=l.href&&(-1!==l.href.indexOf("#")?l.href:i.cryptor.decrypt(l.href))}catch(e){}if(!v||-1!==v.indexOf("#")){var y,g=n.parsePadUrl(v||l.roHref);if(g.hash)if(g.type){if(v&&"pad"===g.hashData.type&&g.hashData.version)if("view"===g.hashData.mode)l.roHref=v,delete l.href;else if(l.roHref){var E=n.parsePadUrl(l.roHref);E.hash&&E.type||(y=n.getSecrets(g.type,g.hash,l.password),l.roHref="/"+g.type+"/#"+n.getViewHashFromKeys(y))}else y=n.getSecrets(g.type,g.hash,l.password),l.roHref="/"+g.type+"/#"+n.getViewHashFromKeys(y);if(0===g.hashData.version&&delete l.roHref,v&&"/"!==v.slice(0,1)&&(l.href=i.cryptor.encrypt(n.getRelativeHref(v))),l.ctime||(l.ctime=l.atime),l.title||(l.title=i.getDefaultName(g)),!l.channel)try{y||(y=n.getSecrets(g.type,g.hash,l.password)),l.channel=y.channel,console.log(l),O("Adding missing channel in filesData ",l.channel)}catch(e){console.error(e)}if(n.isValidChannel(l.channel)||console.error("Remove invalid channel",l.channel,l),!c&&!o.testMode||-1!==t.indexOf(u));else O("An element in filesData was not in ROOT, TEMPLATE or TRASH.",u,l),r[n.createChannelId()]=u}else O("Removing an element in filesData with a invalid type.",l),a.push(u);else O("Removing an element in filesData with a invalid href.",l),a.push(u)}}else O("Removing an element in filesData with a missing href.",l),a.push(u);else O("An element in filesData was not an object.",l),a.push(u)}else O("Invalid file ID in filesData.",u),a.push(u);a.forEach(function(e){A(e)});var b=s[p],w=[];for(var D in b){var _=b[D=Number(D)];_&&"object"==typeof _&&_.href?!c&&!o.testMode||-1!==t.indexOf(D)||w.push(D):w.push(D)}w.forEach(function(e){f||delete s[p][e]})}(),Object.keys(s).forEach(function(e){"/"===e.slice(0,1)&&delete s[e]}),function(){if(!u){"object"!=typeof s[E]&&(O("SHARED_FOLDER was not an object"),s[E]={});var e,t,r=s[E],o=i.getFiles([d,m]),a=i.find([d]);for(var c in r){var f;t=r[c],c=Number(c);try{f=t.href&&(-1!==t.href.indexOf("#")?t.href:i.cryptor.decrypt(t.href))}catch(e){}if((e=n.parsePadUrl(f||t.roHref))&&e.hash&&"undefined"!==e.hash){if(-1===o.indexOf(c))console.log("missing"+c),a[n.createChannelId()]=c}else delete r[c]}}}(),function(){if(!u){"object"!=typeof s[b]&&(O("SHARED_FOLDER_TEMP was not an object"),s[b]={});var e=s[b],n=s[E];for(var t in e)n[t]&&delete e[t]}}();var v=+new Date-r+"ms";JSON.stringify(s)===a?O("File system was clean.",v):O("Your file system was corrupted. It has been cleaned so that the pads you visit can be stored safely.",v)}},i},o};e.exports&&(e.exports=n(Z(),te(),je()))})()}(Le)),Le.exports}function Ue(){return Re||(Re=1,function(e){(()=>{const n=(e,n,t,r,o,a={})=>{let i=globalThis;var s={setCustomize:e=>{a=e.Messages,r.setCustomize(e)}},c=s.ROOT="root",u=s.UNSORTED="unsorted",f=s.TRASH="trash",l=s.TEMPLATE="template",d=s.SHARED_FOLDERS="sharedFolders",h=s.SHARED_FOLDERS_TEMP="sharedFoldersTemp",p=s.FILES_DATA=t.storageKey,v=s.OLD_FILES_DATA=t.oldStorageKey,y=s.STATIC_DATA="static";s.getDefaultName=function(e){var n=e.type;return a.type[n]+" - "+function(){if(i.Intl&&i.Intl.DateTimeFormat)return new i.Intl.DateTimeFormat(void 0,{weekday:"short",year:"numeric",month:"long",day:"numeric"}).format(new Date);return(new Date).toString().split(" ").slice(0,4).join(" ")}()};var m=s.createCryptor=function(e){var n={};if(!e)return n.encrypt=function(e){return e},n.decrypt=function(e){return e},n;try{var t=o.createEncryptor(e);n.encrypt=function(e){try{return"/file/#"===e.slice(0,7)?e:t.encrypt(e)}catch(e){return}},n.decrypt=function(e){try{return t.decrypt(e)}catch(e){return}}}catch(e){console.error(e)}return n};return s.getHref=function(e,n){if(e.href&&-1!==e.href.indexOf("#"))return e.href;if(e.href&&n){var t=n.decrypt(e.href);if(t&&-1!==t.indexOf("#"))return t}return e.roHref},s.reencrypt=function(e,n,t){if(t){var r=m(e),o=m(n);Object.keys(t[p]).forEach(function(e){var n=t[p][e]||{};if(n.href&&n.roHref&&!n.fileType){var a=n.href&&-1===n.href.indexOf("#")?r.decrypt(n.href):n.href;if(!a)return;n.href=o.encrypt(a)}}),Object.keys(t[d]||{}).forEach(function(e){var n=t[d][e]||{};if(n.href){var a=n.href&&-1===n.href.indexOf("#")?r.decrypt(n.href):n.href;if(!a)return;n.href=o.encrypt(a)}}),Object.keys(t[h]||{}).forEach(function(e){var n=t[h][e]||{};if(n.href){var a=n.href&&-1===n.href.indexOf("#")?r.decrypt(n.href):n.href;if(!a)return;n.href=o.encrypt(a)}})}else console.error("Nothing to reencrypt")},s.init=function(t,o){var i={};i.cryptor=m(o.editKey),i.setReadOnly=function(e,n){o.editKey=n,i.cryptor=m(n),i.cryptor.k=Math.random(),i.readOnly=e,i._setReadOnly&&i._setReadOnly(e)},i.readOnly=o.readOnly,i.reencrypt=s.reencrypt,i.getDefaultName=s.getDefaultName;var g=o.sframeChan,E=a.fm_newFolder||"New folder",b=a.fm_newFile||"New file";i.ROOT=c,i.STATIC_DATA=y,i.UNSORTED=u,i.TRASH=f,i.TEMPLATE=l,i.SHARED_FOLDERS=d,i.SHARED_FOLDERS_TEMP=h,i.FILES_DATA=p,i.OLD_FILES_DATA=v;var O=i.sharedFolder=o.sharedFolder;i.id=o.id;var A=function(){console.debug.apply(console,arguments)},w=i.log=o.log||A,D=o.logError||A,_=i.debug=o.debug||A;i.fixFiles=function(){};var T=i.error=function(){g?g.query("Q_DRIVE_USEROBJECT",{cmd:"fixFiles",data:{}},function(){}):("function"==typeof i.fixFiles&&i.fixFiles(),console.error.apply(console,arguments),i.fixFiles())};o.outer&&r.init(o,i,t),i.getStructure=function(){var e={};return e[c]={},e[f]={},e[p]={},e[l]=[],e[d]={},e};var S=i.getHref=function(e){return s.getHref(e,i.cryptor)},N=function(e){return null===e?"null":Array.isArray(e)?"array":typeof e};i.isValidDrive=function(e){var n=i.getStructure();return"object"==typeof e&&Object.keys(n).every(function(t){return e[t]&&N(n[t])===N(e[t])})};var I=function(){return[l]},x=function(e,n){return e===n},C=i.isSharedFolder=function(e){return!O&&Boolean(t[d]&&t[d][e])},R=i.isFile=function(e,n){return!C(e)&&("number"==typeof e||(void 0!==t[v]||n)&&"string"==typeof e)},P=i.isFolderData=function(e){return"object"==typeof e&&!0===e.metadata};i.isReadOnlyFile=function(e){if(!R(e))return!1;var n=i.getFileData(e);return n.roHref?Boolean(n.roHref&&!n.href):void 0},i.isStaticFile=function(e){return Boolean(t[y]&&t[y][e])};var k=i.isFolder=function(e){return!P(e)&&("object"==typeof e&&!e.channel||C(e))};i.isFolderEmpty=function(e){return!!k(e)&&(0===Object.keys(e).length||!(1!==Object.keys(e).length||!P(e[Object.keys(e)[0]])))},i.hasSubfolder=function(e,n){if(!k(e))return!1;var t=0,r=function(e){t+=k(e.element)?1:0};for(var o in e)n?Array.isArray(e[o])&&e[o].forEach(r):t+=k(e[o])?1:0;return t},i.hasFile=function(e,n){if(!k(e))return!1;var t=0,r=function(e){t+=R(e.element)?1:0};for(var o in e)n?Array.isArray(e[o])&&e[o].forEach(r):t+=R(e[o])?1:0;return t},i.hasFolderData=function(e){for(var n in e)if(P(e[n]))return!0};var M=i.hasSubSharedFolder=function(e){for(var n in e){if(C(e[n]))return!0;if(k(e[n])&&M(e[n]))return!0}return!1},F=i.getFileData=function(n,r){if(n){var a,s;try{a=(t[y]||{})[n]}catch(e){console.error(e)}if(a){var c=r?a:e.clone(a);return r||(c.static=!0),c}try{s=t[p][n]||{}}catch(e){console.error(e),s={}}if(!r&&(s=JSON.parse(JSON.stringify(s))).href&&-1===s.href.indexOf("#"))if(o.editKey)try{s.href=i.cryptor.decrypt(s.href)}catch(e){delete s.href}else delete s.href;return s}};i.getFolderData=function(e){for(var n in e)if(P(e[n]))return e[n];return{}};var L=i.getTitle=function(e,n){if(C(e))return"??";var t=F(e);if(t){if(t.static)return t.name;if(e&&(t.href||t.roHref))return"title"===n?t.title:"name"===n?t.filename:t.filename||t.title||b;T("getTitle called with a non-existing file id: ",e,t)}else T("unable to retrieve data about the requested file: ",e,t)},H=i.comparePath=function(e,n){if(!(e&&n&&Array.isArray(e)&&Array.isArray(n)))return!1;if(e.length!==n.length)return!1;for(var t=!0,r=e.length-1;t&&r>=0;)t=e[r]===n[r],r--;return t},j=i.isSubpath=function(e,n){var t=n.slice(),r=e.slice(0,t.length);return H(t,r)},K=i.isPathIn=function(e,n){if(n){var t=n.indexOf("hrefArray");return-1!==t&&(n.splice(t,1),n=n.concat(I())),n.some(function(n){return Array.isArray(e)&&e[0]===n})}},U=i.isInTrashRoot=function(e){return e[0]===f&&4===e.length},B=function(e,n){if(n){if(0===n.length)return e;var t=n.slice(),r=t.shift();if(void 0!==e[r])return B(e[r],t);_("Unable to find the key '"+r+"' in the root object provided:",e)}else T("Invalid path:\n",n,"\nin root\n",e)},V=i.find=function(e){return B(t,e)},Y=i.getFilesRecursively=function(e,n){for(var t in n=n||[],e)R(e[t])||C(e[t])?-1===n.indexOf(e[t])&&n.push(e[t]):P(e[t])||Y(e[t],n);return n},G={array:function(e){return t[e]||(t[e]=[]),t[e].slice()}};I().forEach(function(e){G[e]=function(){return G.array(e)}}),G.hrefArray=function(){var n=[];return O?n:(I().forEach(function(e){n=n.concat(G[e]())}),e.deduplicateString(n))},G[c]=function(){var e=[];return Y(t[c],e),e},G[f]=function(){var e=t[f],n=[],r=function(e){R(e.element)||C(e.element)?-1===n.indexOf(e.element)&&n.push(e.element):Y(e.element,n)};for(var o in e){if(!Array.isArray(e[o]))return void T("Trash contains a non-array element");e[o].forEach(r)}return n},G[v]=function(){var e=[];return t[v]?(t[v].forEach(function(n){n.href&&-1===e.indexOf(n.href)&&e.push(n.href)}),e):e},G[y]=function(){return t[y]?Object.keys(t[y]).map(Number).filter(Boolean):[]},G[p]=function(){return t[p]?Object.keys(t[p]).map(Number).filter(Boolean):[]},G[d]=function(){return t[d]?Object.keys(t[d]).map(Number).filter(Boolean):[]};var J=i.getFiles=function(n){var t=[];return n&&n.length||(n=[c,"hrefArray",f,v,p,d]),n.forEach(function(e){"function"==typeof G[e]&&(t=t.concat(G[e]()))}),e.deduplicateString(t)},q=i.getIdFromHref=function(e){var r,o=function(e){if(e)return n.parsePadUrl(e).getUrl().replace(/\/p\/?/,"/")},a=o(e);return J([p]).some(function(e){if(o(S(t[p][e]))===a||o(t[p][e].roHref)===a)return r=e,!0}),r};i.getSFIdFromHref=function(e){var r,o=function(e){if(e)return n.parsePadUrl(e).getUrl().replace(/\/p\/?/,"/")},a=o(e);return J([d]).some(function(e){if(o(S(t[d][e]))===a||o(t[d][e].roHref)===a)return r=e,!0}),r};var W=function(e,n){if(!K(e,[c,f]))return[];n=Array.isArray(n)?n:[n];var t={},r=V(e),o=function(e){Object.keys(e).forEach(n=>{t[n]||=[],Array.prototype.push.apply(t[n],e[n])})};if(R(r)||C(r))return n.some(n=>{x(n,r)&&(t[n]||=[],t[n].push(e))}),t;if(k(r))for(var a in r){let t=e.slice();t.push(a),o(W(t,n))}return t},z=function(e,n){if(O)return{};if(!t[e])return{};var r=t[e].slice(),o={},a=-1;return n.forEach(n=>{for(;-1!==(a=r.indexOf(n,a+1));)o[n]||=[],o[n].push([e,a])}),o},Q=function(e,n){if(O)return[];var t=V(e),r={},o=function(e){Object.keys(e).forEach(n=>{r[n]||=[],Array.prototype.push.apply(r[n],e[n])})};if(1===e.length&&"object"==typeof t&&Object.keys(t).forEach(function(r){var a=t[r];if(Array.isArray(a)){var i=e.slice();i.push(r),o(Q(i,n))}}),2===e.length){if(!Array.isArray(t))return[];t.forEach(function(t,a){var i=e.slice();i.push(a),i.push("element"),R(t.element)?n.some(e=>{x(e,t.element)&&(r[e]||=[],r[e].push(i))}):o(Q(i,n))})}return e.length>=4&&o(W(e,n)),r},Z=i.findFiles=function(e){var n=W([c],e),t=z(l,e),r=Q([f],e);let o={};return e.forEach(e=>{o[e]=[]}),[n,t,r].forEach(e=>{Object.keys(e).forEach(n=>{o[n]||=[],Array.prototype.push.apply(o[n],e[n])})}),o},X=i.findFile=function(e){return Z([e])[e]||[]};i.findChannels=function(e,n){var r=t[p],o=t[d],a=[p];return n&&a.push(d),J(a).filter(function(n){var t=r[n]||o[n]||{};return-1!==e.indexOf(t.channel)})},i.search=function(r){if("string"!=typeof r)return[];r=r.trim();var o,a=[],s=t[p],u=t[d],f=r.toLowerCase();/^#/.test(f)&&(o=[f.slice(1).trim()]);J([p,d]).forEach(function(e){var n=s[e]||u[e];if(n)if(Array.isArray(n.tags)&&(t=n.tags,o&&t.length&&(t=t.map(function(e){return e.toLowerCase()}),o.some(function(e){return t.some(function(n){return n===e})}))))a.push(e);else{var t,r=n.title||n.lastTitle;(r&&-1!==r.toLowerCase().indexOf(f)||n.filename&&-1!==n.filename.toLowerCase().indexOf(f))&&a.push(e)}});var l=n.getRelativeHref(r);if(l){var h=q(l);h&&a.push(h)}a=e.deduplicateString(a);var v=[];a.forEach(function(e){v.push({id:e,paths:X(e),data:i.getFileData(e)})});var y=[],m=function(e,n){for(var t in e)k(e[t])&&!C(e[t])&&(-1!==t.toLowerCase().indexOf(f)&&y.push({id:null,paths:[n.concat(t)],data:{title:t}}),m(e[t],n.concat(t)))};return m(t[c],[c]),y=y.sort(function(e,n){return e.data.title.toLowerCase()>n.data.title.toLowerCase()}),v=y.concat(v)},i.getRecentPads=function(){var e=t[p];return Object.keys(e).filter(function(n){return e[n]}).sort(function(n,t){return e[t].atime-e[n].atime}).map(function(e){return Number(e)})},i.getOwnedPads=function(e){var n=t[p];return Object.keys(n).filter(function(t){return n[t].owners&&-1!==n[t].owners.indexOf(e)}).map(function(e){return Number(e)})};var $=i.getAvailableName=function(e,n){if(void 0===e[n])return n;for(var t=n,r=1;void 0!==e[t];)t=n+"_"+r,r++;return t},ee=i.move=function(e,n,t){if(g)g.query("Q_DRIVE_USEROBJECT",{cmd:"move",data:{paths:e,newPath:n}},t);else{var r=[];e.forEach(function(e){var t=e.slice();t.pop(),H(t,n)||(j(n,e)?w(a.fo_moveFolderToChildError):i.copyElement(e.slice(),n)&&r.push(e))}),i.delete(r,t)}};return i.restore=function(e,n){if(g)g.query("Q_DRIVE_USEROBJECT",{cmd:"restore",data:{path:e}},n);else if(U(e)){var t=e.slice();t.pop();var r=V(t).path;ee([e],r,n)}},i.addFolder=function(e,n,t){if(g)g.query("Q_DRIVE_USEROBJECT",{cmd:"addFolder",data:{path:e,name:n}},t);else{var r=V(e),o=$(r,n||E);r[o]={};var a=e.slice();a.push(o),t({newPath:a})}},i.delete=function(e,n,t){g?g.query("Q_DRIVE_USEROBJECT",{cmd:"delete",data:{paths:e,nocheck:t}},n):(n=n||function(){},i.deleteMultiplePermanently(e,t,n))},i.emptyTrash=function(e){e=e||function(){},g?g.query("Q_DRIVE_USEROBJECT",{cmd:"emptyTrash"},e):(t[f]={},i.checkDeletedFiles(e))},i.ownedInTrash=function(e){return J([f]).map(function(n){var r=C(n)?t[d][n]:i.getFileData(n);if(r)return e(r.owners)?r.channel:void 0}).filter(Boolean)},i.rename=function(e,n,r){if(r=r||function(){},g)g.query("Q_DRIVE_USEROBJECT",{cmd:"rename",data:{path:e,newName:n}},r);else if(e.length<=1)D("Renaming `root` is forbidden");else{var o,i=V(e);if(k(i)&&!C(i)){var s=e.slice(),c=s.pop();if(!n||!n.trim()||c===n)return;var u=V(s);return void 0!==u[n]?void w(a.fo_existingNameError):(u[n]=i,delete u[c],void("function"==typeof r&&r()))}if(o=C(i)?t[d][i]:t[p][i]||t[y][i])return t[y][i]?n&&n.trim()?(o.name=n,void r()):void r():n&&""!==n.trim()?void(L(i,"name")!==n&&(o.filename=n,"function"==typeof r&&r())):(delete o.filename,void("function"==typeof r&&r()))}},i.getTagsList=function(){var e,n={},r=function(e){n[e]=n[e]?++n[e]:1};for(var o in t[p])(e=t[p][o]).tags&&Array.isArray(e.tags)&&e.tags.forEach(r);return n},i},s};e.exports&&(e.exports=n(Z(),te(),Y(),Ke(),M(),void 0))})()}(Fe)),Fe.exports}var Be,Ve,Ye,Ge,Je={exports:{}};function qe(){return Be||(Be=1,function(e){e.exports=function(e){var n,t=[],r=[],o=0,a=function(e){return o++,function(){for(e&&e.apply(null,arguments),o=(o||1)-1;!o&&t.length&&!n;)t.shift()(a)}};a.abort=function(){r.forEach(clearTimeout),n=1};var i={nThen:function(e){return n||(o?t.push(e):e(a)),i},orTimeout:function(e,s){if(n)return i;if(!s)throw Error("Must specify milliseconds to orTimeout()");var c,u=setTimeout(function(){for(;t.shift()!==c;);for(e(a),o=(o||1)-1;!o&&t.length;)t.shift()(a)},s);return t.push(c=function(){var e=r.indexOf(u);if(e>-1)return r.splice(e,1),void clearTimeout(u);throw new Error("timeout not listed in array")}),r.push(u),i}};return i.nThen(e)}}(Je)),Je.exports}function We(){if(Ye)return Ve;Ye=1;return Ve=((e,n,t,r,o,a,i,s)=>{var c={},u={};return c.checkMigration=function(e,t,r,o){var a=n.once(n.mkAsync(o));if(t)if(e)if(t.version>=2)a();else if(t.migrateRo){var i,s=!1,c=setInterval(function(){if(t.version>=2)return s=!0,clearTimeout(i),clearInterval(c),void a()},100);i=setTimeout(function(){clearInterval(c),r.migrateReadOnly(function(){s=!0,a()})},2e4);t.on("change",["version"],function(){s||t.version>=2&&(s=!0,clearTimeout(i),clearInterval(c),a())})}else r.migrateReadOnly(a);else a();else a()},c.migrate=function(e){var t=u[e];if(t){var r=t.teams;if(Array.isArray(r)&&r.length){var o=r[0];if(o.secondaryKey){var a=n.find(o,["store","manager","folders",o.id]);a&&a.proxy&&!a.proxy.version&&a.userObject.migrateReadOnly(function(){r.forEach(function(e){n.find(e,["store","manager","folders",e.id,"userObject"]).setReadOnly(!1,e.secondarykey)})})}}}},c.load=function(t,f,l,d){var h=n.once(n.mkAsync(d)),p=t.network,v=t.store,y=t.isNew,m=t.isNewChannel,g=v.id,E=v.handleSharedFolder,b=v.manager.user.userObject.getHref(l),O=e.parsePadUrl(b),A=e.getSecrets("drive",O.hash,l.password);if(!A.keys)return v.manager.deprecateProxy(f),void h(null);var w=A.keys.secondaryKey;o(function(e){t.cache&&r.getChannelCache(A.channel,e(function(n){if("EINVAL"===n)return e.abort(),v.manager.restrictedProxy(f,A.channel),void h(null)}))}).nThen(function(e){m(null,{channel:A.channel},e(function(n){if(n.isNew&&!y)return v.manager.deprecateProxy(f,A.channel,n.reason),e.abort(),void h(null)}))}).nThen(function(){var e=u[A.channel];if(e&&e.readOnly&&w&&c.upgrade(A.channel,A),e&&e.ready&&e.rt)return setTimeout(function(){v.manager.addProxy(f,e.rt,function(){c.leave(A.channel,g)},w),h(e.rt)}),e.teams.push({cb:h,store:v,id:f}),void(E&&E(f,e.rt));if(e&&!e.ready&&e.rt)return e.teams.push({cb:h,store:v,secondaryKey:w,id:f}),void(E&&E(f,e.rt));e=u[A.channel]={teams:[{cb:h,store:v,secondaryKey:w,id:f}],readOnly:!Boolean(w)};var n=l.owners,o={data:{},channel:A.channel,readOnly:!Boolean(w),crypto:a.createEncryptor(A.keys),userName:"sharedFolder",logLevel:1,ChainPad:s,classic:!0,network:p,Cache:r,metadata:{validateKey:A.keys.validateKey||void 0,owners:n},onRejected:t.Store&&t.Store.onRejected},d=e.rt=i.create(o);d.proxy.on("cacheready",function(){e.teams&&(e.teams.forEach(function(n){d.cache=!0,n.store.manager.addProxy(n.id,d,function(){c.leave(A.channel,n.store.id)},n.secondaryKey,t.updatePassword),t.updatePassword=!1,n.cb(e.rt)}),e.ready=!0)}),d.proxy.on("ready",function(){y&&!Object.keys(d.proxy).length&&(d.proxy.version=2),e.teams&&(e.teams.forEach(function(n){d.cache=!1,n.store.manager.addProxy(n.id,d,function(){c.leave(A.channel,n.store.id)},n.secondaryKey,t.updatePassword),n.cb(e.rt)}),e.ready=!0)}),d.proxy.on("error",function(n){if(n&&n.error){if("EDELETED"===n.error){try{e.teams.forEach(function(e){e.store.manager.deprecateProxy(e.id,A.channel,n.message),e.store.handleSharedFolder&&e.store.handleSharedFolder(e.id,null),e.cb()})}catch(e){}return delete u[A.channel],void h()}if("ERESTRICTED"===n.error)return e.teams.forEach(function(e){e.store.manager.restrictedProxy(e.id,A.channel),e.cb()}),delete u[A.channel],void h()}}),E&&E(f,d)})},c.upgrade=function(e,n){var t=u[e];if(t&&t.readOnly&&t.rt.setReadOnly&&n.keys&&n.keys.editKeyStr){var r=a.createEncryptor(n.keys);t.readOnly=!1,t.rt.setReadOnly(!1,r)}},c.leave=function(e,n){var t=u[e];if(t){var r,o=t.teams;if(Array.isArray(o))o.some(function(e,t){if(e.store.id===n)return e.store.handleSharedFolder&&e.store.handleSharedFolder(e.id,null),r=t,!0}),void 0!==r&&(o.splice(r,1),o.length||t.rt&&t.rt.stop&&t.rt.stop())}},c.updatePassword=function(r,a,i,s){var f=a.oldChannel,l=a.href,d=a.password,h=e.parsePadUrl(l),p=e.getSecrets(h.type,h.hash,d),v=u[f];if(v){if(v.rt&&v.rt.stop)try{v.rt.stop()}catch(e){}var y=o;v.teams.forEach(function(e){y=y(function(o){var a=e.store,s=e.id,u=n.find(a.proxy,["drive",t.SHARED_FOLDERS])||{};if(s&&u[s]){var l=JSON.parse(JSON.stringify(u[s]));l.password=d,c.load({network:i,store:a,updatePassword:!0,Store:r,isNewChannel:r.isNewChannel},s,l,o()),a.rpc&&(a.rpc.unpin([f],o()),a.rpc.pin([p.channel],o()))}}).nThen}),y(function(){s()})}else s({error:"ENOTFOUND"})},c.loadSharedFolders=function(e,n,r,a,i,s,u,f){var l=a[t.SHARED_FOLDERS]||{},d=Object.keys(l).length,h=1,p=s();u=u||function(){},o(function(t){Object.keys(l).forEach(function(o){var a=l[o];c.load({network:n,store:r,Store:e,cache:f,isNewChannel:e.isNewChannel},o,a,t(function(){u({progress:h,max:d}),h++}))})}).nThen(function(){setTimeout(p)})},c.isSharedFolderChannel=function(e){return Object.keys(u).includes(e)},c})(te(),Z(),Ue(),fe(),qe(),M(),T(),x()),Ve}function ze(){return Ge||(Ge=1,function(e){(()=>{const n=(e,n,t,r={},o,a,i={})=>{var s=function(n,t,r,o,a,i){if(!n.folders[t]||i||n.folders[t].restricted){var s=function(e){var n={};for(var t in e.cfg)n[t]=e.cfg[t];return n}(n);s.sharedFolder=!0,s.id=t,s.editKey=a,s.rt=r.realtime,s.readOnly=Boolean(!a);var c=e.init(r.proxy,s);c.fixFiles&&c.fixFiles();var u=r.proxy;if(u.metadata&&u.metadata.title){var f=n.user.proxy[e.SHARED_FOLDERS][t];f&&(f.lastTitle=u.metadata.title)}return n.folders[t]={proxy:r.proxy,userObject:c,leave:o,restricted:u.restricted,offline:Boolean(r.cache)},u.on&&(u.on("disconnect",function(){n.folders[t].offline=!0}),u.on("reconnect",function(){n.folders[t].offline=!1})),c}n.folders[t].offline&&!r.cache&&n.Store&&(n.folders[t].offline=!1,n.folders[t].userObject.fixFiles&&n.folders[t].userObject.fixFiles(),n.Store.refreshDriveUI())},c=function(e,n){var t=e.folders[n];t&&(t.leave(),delete e.folders[n])},u=function(t,r,o,a){if(!t.folders[r]||!t.folders[r].deleting){if(t.user.userObject.readOnly){return c(t,r),s(t,r,{proxy:{deprecated:!0}},function(){}),void t.Store.refreshDriveUI()}if(o&&t.unpinPads([o],function(){}),a&&"PASSWORD_CHANGE"!==a){let o=n.find(t,["user","proxy",e.SHARED_FOLDERS]),a=o[r]&&o[r].lastTitle;return a&&((e,n,t)=>{var r=e.store.mailbox;if(r){var o,a=e.cfg.teamId;o=a?e.store.modules.team.getTeamsData()[a]:e.Store.getMetadata(null,null,()=>{}).user,r.sendTo("SF_DELETED",{sfId:n,team:a,title:t},{curvePublic:o.curvePublic,channel:o.notifications},e=>{console.error(e)})}})(t,r,a),delete o[r],void(t.Store&&t.Store.refreshDriveUI&&t.Store.refreshDriveUI())}t.user.userObject.deprecateSharedFolder(r,a),c(t,r),t.Store&&t.Store.refreshDriveUI&&t.Store.refreshDriveUI()}},f=function(e,n){c(e,n),s(e,n,{proxy:{restricted:!0,root:{},filesData:{}}},function(){}),e.Store.refreshDriveUI()},l=function(e,n){return Array.isArray(n)&&-1!==n.indexOf(e.edPublic)},d=function(e){var n=[e.user.userObject],t=Object.keys(e.folders).map(function(n){return e.folders[n].userObject});return Array.prototype.push.apply(n,t),n},h=function(e,n){var t=d(e),r=e.user.userObject;return t.some(function(e){if(Object.keys(e.getFileData(n)).length)return r=e,!0}),r},p=function(e,n){var t=Number(n.id);if(t)return e.user.userObject.findFile(t)[0]},v=function(n,t,r){var o=[];return n.user.userObject.findChannels([t],!0).forEach(function(t){var a=n.user.proxy[e.SHARED_FOLDERS][t];a&&!r&&(a=JSON.parse(JSON.stringify(a))),a||(a=n.user.userObject.getFileData(t,r)),o.push({id:t,data:a,userObject:n.user.userObject})}),Object.keys(n.folders).forEach(function(e){n.folders[e].userObject.findChannels([t]).forEach(function(t){o.push({id:t,fId:e,data:n.folders[e].userObject.getFileData(t,r),userObject:n.folders[e].userObject})})}),o},y=function(e,n){var t=[],r=e.user.userObject.getIdFromHref(n);return r&&t.push({data:e.user.userObject.getFileData(r),userObject:e.user.userObject}),Object.keys(e.folders).forEach(function(r){var o=e.folders[r].userObject.getIdFromHref(n);o&&t.push({fId:r,data:e.folders[r].userObject.getFileData(o),userObject:e.folders[r].userObject})}),t},m=function(e,n){var t=[],r=d(e);let o={};return r.forEach(function(e){var a=Number(e.id);let i;if(a){i=e.findFile(n);let t=(o[a]||[])[0];if(!t)return;i.forEach(function(e){Array.prototype.unshift.apply(e,t)})}else{let t=[n],a=r.map(e=>+e.id).filter(Boolean);Array.prototype.push.apply(t,a),o=e.findFiles(t),i=o[n]}Array.prototype.push.apply(t,i)}),t},g=function(e,n){var t={},r=d(e);let o={};return r.forEach(function(e){var a=Number(e.id);if(!e.id){let e=r.map(e=>+e.id).filter(Boolean);Array.prototype.push.apply(n,e)}var i=e.findFiles(n);if(e.id||(o=i),a){let e=(o[a]||[])[0];if(!e)return;Object.keys(i).forEach(n=>{i[n].forEach(n=>{Array.prototype.unshift.apply(n,e)})})}Object.keys(i).forEach(e=>{t[e]||=[],Array.prototype.push.apply(t[e],i[e])})}),t},E=function(e,t,r){if(r)return e.user.userObject.findChannels(t);var o=[];return d(e).forEach(function(e){var n=e.findChannels(t);Array.prototype.push.apply(o,n)}),o=n.deduplicateString(o)},b=function(e,n,t){var r=d(e),o={};return r.some(function(e){if((o=e.getFileData(n,t))&&Object.keys(o).length)return!0}),o},O=function(t,r){var o;if(t.isHistoryMode&&!t.folders[r])o=!0;else if(!t.folders[r])return{};var a=o?{}:t.folders[r].proxy;Object.keys(a.metadata||{}).length>1&&(a.metadata={title:a.metadata.title});var i=n.clone(a.metadata||{});for(var s in t.user.proxy[e.SHARED_FOLDERS][r]||{})if(void 0!==t.user.proxy[e.SHARED_FOLDERS][r][s]){var c=n.clone(t.user.proxy[e.SHARED_FOLDERS][r][s]);if("href"===s&&-1===c.indexOf("#"))try{c=t.user.userObject.cryptor.decrypt(c)}catch(e){}"href"===s&&-1===c.indexOf("#")&&(c=void 0),i[s]=c}return i},A=function(e,n){var t,r={id:null,userObject:e.user.userObject,path:n};if(!Array.isArray(n)||n.length<=1)return r;for(var o=e.user.userObject,a=2;a{r=n.Messages,e.setCustomize(n)},create:function(n,t,r){var o={pinPads:t.pin,unpinPads:t.unpin,onSync:t.onSync,Store:t.Store,store:t.store,removeOwnedChannel:t.removeOwnedChannel,loadSharedFolder:t.loadSharedFolder,cfg:r,edPublic:t.edPublic,settings:t.settings,user:{proxy:n},folders:{}};r.removeProxy=function(e){c(o,e)},o.user.userObject=e.init(n,r);var a=function(e){return function(){return[].unshift.call(arguments,o),e.apply(null,arguments)}};return{addProxy:a(s),removeProxy:a(c),deprecateProxy:a(u),restrictedProxy:a(f),addSharedFolder:a(I),addPin:function(e,n){o.pinPads=e,o.unpinPads=n},removePin:function(){delete o.pinPads,delete o.unpinPads},command:a(P),getPadAttribute:a(M),setPadAttribute:a(k),getTagsList:a(F),getSecureFilesList:a(L),getSharedFolderData:a(O),getChannelsList:a(j),addPad:a(K),delete:a(x),deleteOwned:a(C),findChannel:a(v),findHref:a(y),findFile:a(m),getEditHash:a(S),user:o.user,folders:o.folders}},createInner:function(n,t,r,o){var a={cfg:o,sframeChan:t,edPublic:r,user:{proxy:n,userObject:e.init(n,o)},folders:{}},i=function(e){return function(){return[].unshift.call(arguments,a),e.apply(null,arguments)}};return{addProxy:i(s),removeProxy:i(c),setHistoryMode:i(le),rename:i(U),move:i(B),emptyTrash:i(V),addFolder:i(Y),addSharedFolder:i(G),addLink:i(J),restoreSharedFolder:i(q),convertFolderToSharedFolder:i(W),delete:i(z),deleteOwned:i(Q),restore:i(Z),setFolderData:i(X),updateStaticAccess:i($),getFileData:i(ne),find:i(re),getTitle:i(oe),isReadOnlyFile:i(ie),isStaticFile:i(ae),getFiles:i(se),search:i(ce),getRecentPads:i(ue),getOwnedPads:i(fe),getTagsList:i(F),findFile:i(m),findFiles:i(g),findChannels:i(ee),getSharedFolderData:i(O),getFolderData:i(de),isInSharedFolder:i(he),getUserObjectPath:i(te),isDuplicateOwned:i(Se),ownedInTrash:i(Te),isValidDrive:i(pe),isFile:i(ve),isFolder:i(ye),isSharedFolder:i(me),isFolderEmpty:i(ge),isPathIn:i(Ee),isSubpath:i(be),isInTrashRoot:i(Oe),comparePath:i(Ae),hasSubfolder:i(we),hasSubSharedFolder:i(De),hasFile:i(_e),user:a.user,folders:a.folders}}}};e.exports&&(e.exports=n(Ue(),Z(),te(),void 0,Ae(),qe(),We()))})()}(Me)),Me.exports}var Qe,Ze,Xe=ze(),$e=n({__proto__:null,default:r(Xe)},[Xe]),en=Ue(),nn=n({__proto__:null,default:r(en)},[en]),tn={exports:{}},rn={exports:{}};function on(){return Ze||(Ze=1,function(e){e.exports&&(e.exports=((e={},n={},t)=>{let r=[];const o=["sheet","doc","presentation"],a=a=>{e=a.AppConfig;const i=(n=a.ApiConfig).onlyOffice&&n.onlyOffice.availableVersions.includes(t.currentVersion);r=e.availablePadTypes.filter(e=>i||!o.includes(e))};Object.keys(e).length&&a({AppConfig:e,ApiConfig:n});const i={OO_APPS:o,setCustomize:a};return i.__defineGetter__("availableTypes",function(){return n.appsToDisable?r.filter(e=>!n.appsToDisable.includes(e)):r}),i.__defineGetter__("appsToSelect",function(){return r.filter(e=>!["drive","teams","file","contacts","convert"].includes(e))}),i.isAvailable=e=>Array.isArray(i.availableTypes)&&i.availableTypes.includes(e),i})(void 0,void 0,(Qe||(Qe=1,function(e){e.exports&&(e.exports={currentVersionNumber:8,currentVersion:"v8"})}(rn)),rn.exports)))}(tn)),tn.exports}var an,sn,cn=on(),un=n({__proto__:null,default:r(cn)},[cn]),fn={exports:{}},ln={exports:{}};function dn(){return an||(an=1,function(e){(()=>{const n=(e,n,t={},r)=>{const o=function(){if(Object.keys(t).length){var e,n=new URL(t.httpUnsafeOrigin);try{return(e=new URL(t.websocketPath,t.httpUnsafeOrigin)).protocol=n.protocol,e.origin}catch(e){return console.error(e),t.httpUnsafeOrigin}}};var a=o();var i=e=>JSON.parse(JSON.stringify(e)),s=function(e,t,r){var o=n.once(n.mkAsync(r));fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>{e.ok?e.text().then(e=>{o(void 0,n.tryParse(e))}):e.json().then().then(n=>{o(e.status,n)})}).catch(e=>{o(e)})},c=function(t,o,c){var u=i(o);u.publicKey=n.encodeBase64(t.publicKey),u.nonce=n.encodeBase64(r.randomBytes(24));var f,l,d=new URL("/api/auth/",a);e(function(e){s(d,u,e((n,t)=>n?(e.abort(),console.error(n),t&&console.error(t),void c(n)):t.date&&t.txid?(f=t.txid,void(l=t.date)):(e.abort(),void c("REQUEST_REJECTED"))))}).nThen(function(e){var o=i(u);o.txid=f,o.date=l;var a=n.decodeUTF8(JSON.stringify(o)),h=r.sign.detached(a,t.secretKey),p=n.encodeBase64(h);s(d,{sig:p,txid:f},e((n,t)=>{if(n)return e.abort(),console.error(n),t&&console.error(t),void c("RESPONSE_REJECTED",t);c(void 0,t)}))})};return c.setCustomize=e=>{t=e.ApiConfig,a=o()},c};e.exports&&(e.exports=n(qe(),Z(),void 0,h()))})()}(ln)),ln.exports}function hn(){return sn||(sn=1,function(e){e.exports&&(e.exports=((e,n={},t,r)=>{var o={setCustomize:e=>{n=e.ApiConfig,t.setCustomize(e)}};o.join=e.uint8ArrayJoin,o.seed=function(){return r.hash(e.decodeUTF8("pewpewpew"))},o.genkeys=function(e){if(!(e instanceof Uint8Array))throw new Error("INVALID_SEED_FORMAT");if(!e||"number"!=typeof e.length||e.length<64)throw new Error("INVALID_SEED_LENGTH");var n=e.subarray(0,r.sign.seedLength),t=e.subarray(r.sign.seedLength,r.sign.seedLength+r.secretbox.keyLength);return{sign:r.sign.keyPair.fromSeed(n),symmetric:t}},o.keysToRPCFormat=function(n){try{var t=n.sign;return{edPrivate:e.encodeBase64(t.secretKey),edPublic:e.encodeBase64(t.publicKey)}}catch(e){return void console.error(e)}},o.encrypt=function(n,t,a){var i=e.decodeUTF8(t),s=r.randomBytes(r.secretbox.nonceLength);return o.join([[0],s,r.secretbox(i,s,a.symmetric)])},o.decrypt=function(n,t){var o=n.subarray(1,1+r.secretbox.nonceLength),a=n.subarray(1+r.secretbox.nonceLength),i=r.secretbox.open(a,o,t.symmetric);try{return JSON.parse(e.encodeUTF8(i))}catch(e){return void console.error(e)}},o.sign=function(e,n){return r.sign.detached(r.hash(e),n.sign.secretKey)},o.serialize=function(n,t){var r=o.encrypt(0,n,t),a=o.sign(r,t);return{publicKey:e.encodeBase64(t.sign.publicKey),signature:e.encodeBase64(a),ciphertext:e.encodeBase64(r)}},o.proveAncestor=function(n){var t=e.find(n,["sign","publicKey"]),o=e.find(n,["sign","secretKey"]);try{var a=r.sign.detached(t,o);return JSON.stringify([t,a].map(e.encodeBase64))}catch(e){return void console.error(e)}};var a=function(n){return e.encodeBase64(n).replace(/\//g,"-")};o.getBlockUrl=function(e){var t=a(e.sign.publicKey);return(n.fileHost||n.httpUnsafeOrigin||window.location.origin)+"/block/"+t.slice(0,2)+"/"+t},o.getBlockHash=function(e){return o.getBlockUrl(e)+"#"+a(e.symmetric)};var i=function(n){try{return e.decodeBase64(n.replace(/\-/g,"/"))}catch(e){return void console.error(e)}};return o.parseBlockHash=function(e){if("string"==typeof e){var n=e.split("#");if(2===n.length)try{return{href:n[0],keys:{symmetric:i(n[1])}}}catch(e){return void console.error(e)}}},o.checkRights=function(n,r){const o=e.mkAsync(r),{blockKeys:a,auth:i}=n;var s="MFA_CHECK";i&&i.type&&(s=`${i.type.toUpperCase()}_`+s),t(a.sign,{command:s,auth:i&&i.data},o)},o.writeLoginBlock=function(e,n){const{content:r,blockKeys:a,oldBlockKeys:i,auth:s,pw:c,session:u,token:f,userData:l}=e;var d="WRITE_BLOCK";s&&s.type&&(d=`${s.type.toUpperCase()}_`+d);var h=o.serialize(JSON.stringify(r),a);h.auth=s&&s.data,h.hasPassword=c,h.registrationProof=i&&o.proveAncestor(i),f&&(h.inviteToken=f),l&&(h.userData=l),t(a.sign,{command:d,content:h,session:u},n)},o.removeLoginBlock=function(e,n){const{reason:r,blockKeys:o,auth:a,edPublic:i}=e;var s="REMOVE_BLOCK";a&&a.type&&(s=`${a.type.toUpperCase()}_`+s),t(o.sign,{command:s,auth:a&&a.data,edPublic:i,reason:r},n)},o.updateSSOBlock=function(e,n){const{blockKeys:r,oldBlockKeys:a}=e;var i=a&&o.proveAncestor(a);t(r.sign,{command:"SSO_UPDATE_BLOCK",ancestorProof:i},n)},o})(Z(),void 0,dn(),h()))}(fn)),fn.exports}var pn,vn,yn,mn=hn(),gn=n({__proto__:null,default:r(mn)},[mn]),En={exports:{}};function bn(){return pn||(pn=1,function(e){var n;n=function(){var e=function(n){if(Array.isArray(n))return n.map(e);if(n instanceof Object){var t=[],r=[];return Object.keys(n).forEach(function(e){/^(0|[1-9][0-9]*)$/.test(e)?t.push(+e):r.push(e)}),t.sort(function(e,n){return e-n}).concat(r.sort()).reduce(function(t,r){return t[r]=e(n[r]),t},{})}return n},n=JSON.stringify.bind(JSON);return function(t,r,o){var a=n(t,r,0);if(!a||"{"!==a[0]&&"["!==a[0])return a;var i=JSON.parse(a);return n(e(i),null,o)}},e.exports?e.exports=n():JSON.sortify=n()}(En)),En.exports}function On(){if(yn)return vn;yn=1;var e,n,t,r,o,a,i,s;return M(),e=te(),n=Z(),Y(),t=je(),o=(r={}).createData=function(t,r){var o={channel:r||e.createChannelId(),displayName:t["cryptpad.username"],profile:t.profile&&t.profile.view,edPublic:t.edPublic,curvePublic:t.curvePublic,notifications:n.find(t,["mailboxes","notifications","channel"]),avatar:t.profile&&t.profile.avatar,badge:t.profile&&t.profile.badge,uid:t.uid};return!1===r&&delete o.channel,o},a=r.getFriend=function(e,n){if(n){if(n===e.curvePublic){var t=o(e);return delete t.channel,t}return e.friends?e.friends[n]:void 0}},i=r.getFriendList=function(e){return e.friends||(e.friends={}),e.friends},s=function(e,n){Object.keys(e).forEach(function(t){"me"!==t&&n(e[t],t,e)})},r.getFriendChannelsList=function(e){var n=[];return s(e.friends,function(e){n.push(e.channel)}),n},r.declineFriendRequest=function(e,n,t){e.mailbox.sendTo("DECLINE_FRIEND_REQUEST",{},{channel:n.notifications,curvePublic:n.curvePublic},function(e){t(e)})},r.acceptFriendRequest=function(e,n,t){var r=a(e.proxy,n.curvePublic)||{},i=o(e.proxy,r.channel||n.channel);e.mailbox.sendTo("ACCEPT_FRIEND_REQUEST",{user:i},{channel:n.notifications,curvePublic:n.curvePublic},function(e){t(e)})},r.addToFriendList=function(e,n,r){var o=e.proxy,a=i(o),s=n.curvePublic;s!==o.curvePublic?(a[s]=n,t.whenRealtimeSyncs(e.realtime,function(){r(),e.pinPads([n.channel],function(e){e.error&&console.error(e.error)})})):r("E_MYKEY")},r.updateMyData=function(e,t){var r=o(e.proxy,!1);e.proxy.friends&&(e.proxy.friends.me=n.clone(r),delete e.proxy.friends.me.channel),e.modules.team&&e.modules.team.updateMyData(r);var i=function(n){n&&n.notifications&&(delete n.user,r.channel=n.channel,e.mailbox.sendTo("UPDATE_DATA",r,{channel:n.notifications,curvePublic:n.curvePublic},function(e){e&&e.error&&console.error(e)}))};t?i(a(e.proxy,t)):s(e.proxy.friends||{},i)},r.removeFriend=function(e,n,r){var o=e.proxy,a=o.friends[n];a?a.notifications?e.mailbox.sendTo("UNFRIEND",{curvePublic:o.curvePublic},{channel:a.notifications,curvePublic:a.curvePublic},function(i){i&&i.error?r(i):(e.messenger.onFriendRemoved(n,a.channel),delete o.friends[n],t.whenRealtimeSyncs(e.realtime,function(){r(i)}))}):r({error:"EINVAL"}):r({error:"ENOENT"})},vn=r}var An,wn,Dn,_n={exports:{}},Tn={exports:{}},Sn={exports:{}};function Nn(){return An||(An=1,function(e){var n,t,r,o,a,i,s,c,u,f,l,d;e.exports&&(e.exports=(n=Z(),t=h(),r=n.uid,o=n.tryParse,a=function(e,r){var o=n.decodeUTF8(JSON.stringify(e));return n.encodeBase64(t.sign.detached(o,r))},i=function(e,n,t){if("function"!=typeof t)throw new Error("expected callback");var o=e.network,a=o.historyKeeper;if("string"==typeof a){var i=r(),s=e.pending[i]=function(e,n){t(e,n)};return s.data=n,s.called=0,o.sendto(a,JSON.stringify([i,n]))}t("NO_HISTORY_KEEPER")},s=[],c=[],u=function(e){var n={network:e,connected:!0,anon:void 0,authenticated:[]};return s.push(e),c.push(n),e.on("message",function(t,r){r===e.historyKeeper&&function(e,n){"string"!=typeof n&&console.error("received non-string message [%s]",n);var t=o(n);if(t){if(Array.isArray(t)&&!/(FULL_HISTORY|HISTORY_RANGE)/.test(t[0])){var r=t[0];"string"==typeof r&&(function(e,n){return!!e.anon&&"function"==typeof e.anon.pending[n]}(e,r)?function(e,n,t){var r=e.pending[n];"ERROR"===t[0]?r(t[1]):r(void 0,t.slice(1)),delete e.pending[n]}(e.anon,r,t.slice(1)):e.authenticated.some(function(e){var n=e.pending[r];return"function"==typeof n&&("ERROR"!==t[1]?(/\|/.test(t[1])&&e.cookie!==t[1]&&(e.cookie=t[1]),n(void 0,t.slice(2)),delete e.pending[r],!0):"NO_COOKIE"===t[2]?(e.send("COOKIE","",function(t){if(t)return console.error(t),void n(t);e.resend(r)&&delete e.pending[r]}),!0):(n(t[2]),delete e.pending[r],!0))})||console.error("UNHANDLED RPC MESSAGE",n))}}else console.error(new Error("could not parse message: %s",n))}(n,t)}),e.on("disconnect",function(){n.connected=!1,n.anon&&(n.anon.connected=!1),n.authenticated.forEach(function(e){e.connected=!1})}),e.on("reconnect",function(){n.anon&&(n.anon.connected=!0),n.authenticated.forEach(function(e){e.connected=!0})}),n},f=function(e){var n;return s.some(function(t,r){return e===t&&(n=r,!0)}),c[n]?c[n]:u(e)},l=function(e,t){if(!e)throw new Error("expected network context");var o,s=t.publicKeyString;return e.authenticated.some(function(e,n){return e.publicKey===s&&(o=n,!0)}),e.authenticated[o]?e.authenticated[o]:function(e,t){var o={network:e.network,publicKey:t.publicKeyString,timeouts:{},pending:{},cookie:null,connected:!0},s=o.send=function(e,r,s){var c=n.mkAsync(s);if(o.connected||"COOKIE"===e){var u=[e,r];o.cookie&&o.cookie.join?u.unshift(o.cookie.join("|")):u.unshift(o.cookie);var f=a(u,t.signKey);return u.unshift(t.publicKeyString),u.unshift(f),i(o,u,c)}c("DISCONNECTED")};return o.resend=function(e){var n=o.pending[e];if(n.called)return console.error("[%s] called too many times",e),!0;n.called++,n.data[2]=o.cookie,n.data[0]=a(n.data.slice(2),t.signKey);var i=r();o.pending[i]=n,delete o.pending[e];try{return o.network.sendto(o.network.historyKeeper,JSON.stringify([i,n.data]))}catch(e){console.log("failed to resend"),console.error(e)}},s.unauthenticated=function(e,r,a){var s=n.mkAsync(a);if(o.connected){var c=[null,t.publicKeyString,null,e,r];return o.cookie&&o.cookie.join?c[2]=o.cookie.join("|"):c[2]=o.cookie,i(o,c,s)}s("DISCONNECTED")},o.destroy=function(){Object.keys(o.timeouts).forEach(function(e){clearTimeout(e)}),o.send("DESTROY","",function(){});var n=e.authenticated.indexOf(o);-1!==n&&e.authenticated.splice(n,1)},e.authenticated.push(o),o}(e,t)},d=function(e){return e.anon||function(e){var t={network:e.network,timeouts:{},pending:{},connected:!0};return e.anon=t,t.send=function(e,r,o){var a=n.mkAsync(o);if(t.connected)return i(t,[e,r],a);a("DISCONNECTED")},t.resend=function(e){var n=t.pending[e];if(n.called)return console.error("[%s] called too many times",e),!0;n.called++;try{return t.network.sendto(t.network.historyKeeper,JSON.stringify([e,n.data]))}catch(e){console.log("failed to resend"),console.error(e)}},t.destroy=function(){Object.keys(t.timeouts).forEach(function(e){clearTimeout(e)}),e.anon=void 0},t}(e)},{create:function(e,t,r,o){if("function"!=typeof o)throw new Error("expected callback");var a,i=n.mkAsync(o);try{if(64!==(a=n.decodeBase64(t)).length)throw new Error("private key did not match expected length of 64")}catch(e){return void i(e)}try{if(32!==n.decodeBase64(r).length)return void i("expected public key to be 32 uint")}catch(e){return void i(e)}if(e){var s=f(e),c=l(s,{publicKeyString:r,signKey:a});c.send("COOKIE","",function(e){e?i(e):i(void 0,{send:c.send,destroy:c.destroy})})}else i("NO_NETWORK")},createAnonymous:function(e,t){var r=n.mkAsync(t);if("function"!=typeof r)throw new Error("expected callback");if(e){var o=d(f(e));r(void 0,{send:o.send,destroy:o.destroy})}else r("NO_NETWORK")}}))}(Sn)),Sn.exports}function In(){return wn||(wn=1,function(e){var n,t;e.exports&&(e.exports=(n=Z(),t=Nn(),{create:function(e,r,o,a){if("function"!=typeof o)throw new Error("Expected callback");var i=n.once(n.mkAsync(o));if(e)if(r){var s=r.edPrivate,c=r.edPublic;s&&c?t.create(e,s,c,function(e,t){if(e)i(e);else{var r={};r.destroy=t.destroy,r.publicKey=c,r.send=t.send,r.pin=function(e,r){var o=n.once(n.mkAsync(r));Array.isArray(e)?t.send("PIN",e,o):o("[TypeError] pin expects an array")},r.unpin=function(e,r){var o=n.once(n.mkAsync(r));Array.isArray(e)?t.send("UNPIN",e,o):o("[TypeError] pin expects an array")},r.adminRpc=function(e,n){if(e.cmd){var r=[e.cmd,e.data];t.send("ADMIN",r,n)}else setTimeout(function(){n("[TypeError] admin rpc expects a command")})},r.getServerHash=function(e){t.send("GET_HASH",c,function(n,t){t&&t[0]?e(n,Array.isArray(t)&&t[0]||void 0):e("NO_HASH_RETURNED")})},r.reset=function(e,r){var o=n.once(n.mkAsync(r));Array.isArray(e)?t.send("RESET",e,o):o("[TypeError] pin expects an array")},r.getFileListSize=function(e){t.send("GET_TOTAL_SIZE",void 0,function(n,t){n?e(n):t&&t.length&&"number"==typeof t[0]?e(void 0,t[0]):e("INVALID_RESPONSE")})},r.getLimit=function(e){t.send("GET_LIMIT",void 0,function(n,t){n?e(n):t&&t.length&&"number"==typeof t[0]?e(void 0,t[0],t[1],t[2]):e("INVALID_RESPONSE")})},r.trimHistory=function(e,r){var o=n.once(n.mkAsync(r));"object"==typeof e&&e.channel&&e.hash?t.send("TRIM_HISTORY",e,function(e){if(e)return o(e);o()}):o("INVALID_ARGUMENTS")},r.clearOwnedChannel=function(e,n){"string"==typeof e&&32===e.length?t.send("CLEAR_OWNED_CHANNEL",e,function(e){if(e)return n(e);n()}):n("INVALID_ARGUMENTS")},r.removeOwnedChannel=function(e,n,r){if("string"!=typeof e||-1===[32,48].indexOf(e.length))return console.error("invalid channel to remove",e),void n("INVALID_ARGUMENTS");t.send("REMOVE_OWNED_CHANNEL",{channel:e,reason:r},function(t,r){t?n(t):r&&r.length&&"OK"===r[0]?(n(),a&&a.clearChannel&&a.clearChannel(e)):n("INVALID_RESPONSE")})},r.removePins=function(e){t.send("REMOVE_PINS",void 0,function(n,t){n?e(n):t&&t.length&&"OK"===t[0]?e():e("INVALID_RESPONSE")})},r.uploadComplete=function(e,n){t.send("UPLOAD_COMPLETE",e,function(e,t){if(e)n(e);else{var r=t[0];"string"==typeof r?n(void 0,r):n("INVALID_ID")}})},r.ownedUploadComplete=function(e,n){t.send("OWNED_UPLOAD_COMPLETE",e,function(e,t){if(e)n(e);else{var r=t[0];"string"==typeof r?n(void 0,r):n("INVALID_ID")}})},r.uploadStatus=function(e,n){"number"==typeof e?.size?t.send("UPLOAD_STATUS",e,function(e,t){if(e)n(e);else{var r=t[0];"boolean"==typeof r?n(void 0,r):n("INVALID_RESPONSE")}}):setTimeout(function(){n("INVALID_SIZE")})},r.uploadCancel=function(e,n){t.send("UPLOAD_CANCEL",e,function(e){e?n(e):n()})},r.setMetadata=function(e,n){t.send("SET_METADATA",{channel:e.channel,command:e.command,value:e.value},n)},i(e,r)}}):i("INVALID_KEYS")}else i("INVALID_PROXY");else i("INVALID_NETWORK")}}))}(Tn)),Tn.exports}function xn(){return Dn||(Dn=1,function(e){(()=>{const n=(e,n,t,r,o,a,i,s,c,u)=>{var f=function(e,n,t){if(!e.done){if(e.cb(n&&n.error,t,n),e.done=!0,!e.hasNetwork){var o=r.find(e,["network","disconnect"]);"function"==typeof o&&o()}if(e.realtime&&e.realtime.stop)try{e.realtime.stop()}catch(e){console.error(e)}var a=r.find(e,["session","realtime","abort"]);"function"==typeof a&&(e.session.realtime.sync(),a())}},l=function(e,r){u(function(n){var o,a;e.hasNetwork||(o=n(function(e,n){e||(r.network=n)}),a=i.getWebsocketURL(),t.connect(a).then(function(e){o(null,e)},function(e){o(e)}))}).nThen(function(){e.realtime=n.start(r)})},d=function(e,n,t,r){Array.isArray(t)&&t.length&&16===t[0].length&&Array.isArray(n.accessKeys)?(e.network.historyKeeper=t[0],u(function(t){n.accessKeys.forEach(function(n){c.create(e.network,n,t(function(e){console.log("done",n),e&&console.error(e)}))})}).nThen(function(){r()})):r(!0)},h=function(n,t){var r;return"string"==typeof n?r=o.getSecrets("pad",n,t.password):"object"==typeof n&&(r=n),r.keys||(r.keys=r.key),{websocketURL:i.getWebsocketURL(t.origin),channel:r.channel,validateKey:r.keys.validateKey||void 0,crypto:e.createEncryptor(r.keys),logLevel:0,initialState:t.initialState,Cache:s}},p=function(e){return"object"==typeof e},v=function(e,n){p(e)&&p(n)&&Object.keys(n).forEach(function(t){e[t]=n[t]})};return{get:function(e,n,t,r){if("function"!=typeof n)throw new Error("Cryptget expects a callback");r=r||function(){};var o=h(e,t=t||{}),a={cb:n,accessKeys:t.accessKeys,hasNetwork:Boolean(t.network)};o.onRejected=function(e,n){d(o,a,e,n)},o.onReady=function(e){var n=a.session=e.realtime;a.network=e.network,r(1),f(a,void 0,n.getUserDoc())},o.onError=function(e){console.warn(e),f(a,e)},o.onChannelError=function(e){console.error(e),f(a,e)},o.onCacheReady=t.onCacheReady;var i=0;o.onMessage=function(){i++,r(Math.min(.99,i/100))},v(o,t),l(a,o)},put:function(e,n,t,r){if("function"!=typeof t)throw new Error("Cryptput expects a callback");var o=h(e,r=r||{}),i={cb:t,accessKeys:r.accessKeys,hasNetwork:Boolean(r.network)};o.onRejected=function(e,n){d(o,i,e,n)},o.onReady=function(e){var r=i.session=e.realtime;i.network=e.network,r.contentUpdate(n);var o=setTimeout(function(){t(new Error("Timeout"))},15e3);a.whenRealtimeSyncs(r,function(){clearTimeout(o);var e=r.getAuthDoc();r.abort(),f(i,void 0,e)})},o.onChannelError=function(e){f(i,e)},v(o,r),l(i,o)}}};e.exports&&(e.exports=n(M(),D(),u(),Z(),te(),je(),j(),fe(),In(),qe(),x()))})()}(_n)),_n.exports}var Cn,Rn,Pn,kn,Mn,Fn,Ln,Hn={exports:{}};function jn(){if(Mn)return kn;Mn=1;return kn=((e,n,t,r,o,a,i,s)=>{const c={};let u={};c.setCustomize=e=>{u=e.Broadcast};var f=["notifications","supportteam","broadcast"],l=[],d="000000000000000000000000000000000",h=function(e,n,t,r,o){e.emit("MESSAGE",{type:n,content:t},r?[r]:e.clients,o)},p=function(e,n,t,r){e.emit("VIEWED",{type:n,hash:t},r||e.clients)},v=function(e){var n=e.store&&e.store.proxy;if(n.curvePrivate&&n.curvePublic)return{curvePrivate:n.curvePrivate,curvePublic:n.curvePublic}},y=c.sendTo=function(n,t,o,a,i){a=a||{};var c=i||function(e){e&&e.error&&console.error(e.error)};if(s.Mailbox){var u=e.find(n,["store","anon_rpc"]);if(u){var f={encrypt:function(e){return e}},l=d,h={uid:e.uid(),type:t,content:o};if(!/^BROADCAST/.test(t)){var p=v(n);if(!p)return void c({error:"missing asymmetric encryption keys"});if(!a||!a.channel||!a.curvePublic)return void c({error:"no notification channel"});if(l=a.channel,f=s.Mailbox.createEncryptor(p),"object"==typeof o&&!o.user){var y=r.createData(n.store.proxy,!1);o.user=y}h={type:t,content:o}}var m=JSON.stringify(h),g=f.encrypt(m,a.curvePublic);if(a.viewed){var E=e.find(n,["store","proxy","teams",a.viewed]);if(E){var b=g.slice(0,64),O=e.find(E,["keys","mailbox","viewed"]);Array.isArray(O)&&O.push(b)}}u.send("WRITE_PRIVATE_MESSAGE",[l,g],function(e){c(e?{error:e}:{hash:g.slice(0,64)})})}else c({error:"anonymous rpc session not ready"})}else c({error:"chainpad-crypto is outdated and doesn't support mailboxes."})};c.sendToAnon=function(n,t,r,o,a){var i=s.Nacl,c=i.randomBytes(32),u=i.box.keyPair.fromSecretKey(new Uint8Array(c)),f=e.encodeBase64(u.secretKey),l=e.encodeBase64(u.publicKey);y({store:{anon_rpc:n,proxy:{curvePrivate:f,curvePublic:l}}},t,r,o,a)};var m=function(n,r,o,i){var s=r.type,c=r.hash;if(/^REMINDER\|/.test(c)){i(),delete n.boxes.reminders.content[c],p(n,s,c,n.clients.filter(function(e){return e!==o}));var u=c.slice(9).split("-")[0],f=e.find(n,["store","proxy","hideReminders",u]);if(!f){var l=n.store.proxy.hideReminders=n.store.proxy.hideReminders||{};f=l[u]=l[u]||[]}var d=c.split("-")[1];d&&!f.includes(d)&&f.push(Number(d))}else{var h=n.boxes[s];if(h){var v,y,m=h.data||{},g=h.history.indexOf(c);-1!==g&&(0===g?(m.lastKnownHash=c,h.history.shift()):-1===m.viewed.indexOf(c)&&m.viewed.push(c));var E=[];h.history.some(function(e,n){if(-1===m.viewed.indexOf(e))return!0;v=n+1,E.push(e),y=e}),m.viewed=m.viewed.filter(function(e){return-1===E.indexOf(e)}),v&&(h.history=h.history.slice(v),m.lastKnownHash=y),Object.keys(h.content).forEach(function(e){-1!==h.history.indexOf(e)&&-1===m.viewed.indexOf(e)||(a.remove(n,h,h.content[e],e),delete h.content[e])}),t.whenRealtimeSyncs(n.store.realtime,function(){i(),p(n,s,c,n.clients.filter(function(e){return e!==o}))})}else i({error:"NOT_LOADED"})}},g=function(e,n,t,c,u){u=u||{};var f=e.boxes[n]={channel:t.channel,type:n,queue:[],history:[],content:{},sendMessage:function(n){if("object"==typeof n&&!n.user){var t=r.createData(e.store.proxy,!1);n.user=t}try{n=JSON.stringify(n)}catch(e){console.error(e)}f.queue.push(n)},data:t};if(s.Mailbox){var l=t.keys||v(e);if(l||t.decrypted){var d=t.decrypted?{encrypt:function(e){return e},decrypt:function(e){return e}}:s.Mailbox.createEncryptor(l);f.encryptor=d;var y,g={network:e.store.network,channel:t.channel,noChainPad:!0,crypto:d,owners:"broadcast"===n?[]:u.owners||[e.store.proxy.edPublic],lastKnownHash:t.lastKnownHash};g.onConnectionChange=function(){},g.onConnect=function(t,r){f.sendMessage=function(t,o){var a;o=o||function(){};try{a=JSON.stringify(t)}catch(e){console.error(e)}r(a,function(r,a){r?console.error(r):(f.history.push(a),t.ctime=+new Date,f.content[a]=t,h(e,n,{msg:t,hash:a}),o(a))},l.curvePublic)},f.queue.forEach(function(e){f.sendMessage(e)}),f.queue=[]},f.onMessage=g.onMessage=function(r,i,s,c,l,d,p){if(l!==t.lastKnownHash&&l!==y){var v=p&&p.time;y=l;try{r=JSON.parse(r)}catch(e){console.error(e)}if(d&&(r.author=d),f.history.push(l),function(e,n){return-1===(n.viewed||[]).indexOf(e)&&e!==n.lastKnownHash}(l,t)){var g={msg:r,hash:l,time:v},E=f.ready;a.add(e,f,g,function(t,a,i){a&&m(e,a,"",function(){console.log("Notification handled automatically")}),i||t?m(e,{type:n,hash:l},"",function(){console.log("Notification handled automatically")}):(r.ctime=v||0,f.content[l]=r,u.dump||h(e,n,g,null,function(e){e&&e.msg&&E&&o.system(void 0,e.msg)}))})}else if(0===Object.keys(f.content).length){t.lastKnownHash=l,f.history=[];var b=t.viewed.indexOf(l);-1!==b&&t.viewed.splice(b,1)}}},g.onReady=function(){var r=[];t.viewed.forEach(function(e,n){-1===f.history.indexOf(e)&&r.push(n)});for(var o=r.length-1;o>=0;o--)t.viewed.splice(r[o],1);var i=function(t){a.remove(e,f,f.content[t],t),delete f.content[t],p(e,n,t)};e.store.proxy.on("change",["mailboxes",n],function(e,n,t){var r;"lastKnownHash"===t[2]&&(f.history.some(function(e,t){if(r=t+1,i(e),e===n)return!0}),f.history=f.history.slice(r));"viewed"===t[2]&&i(n)}),f.ready=!0,c(f.content)},f.cpNf=i.start(g)}else console.error("missing asymmetric encryption keys")}else console.error("chainpad-crypto is outdated and doesn't support mailboxes.")};return c.init=function(t,r,i){var s={},c=t.store,v=c.proxy.mailboxes=c.proxy.mailboxes||{},E={Store:t.Store,store:c,pinPads:t.pinPads,updateMetadata:t.updateMetadata,updateDrive:t.updateDrive,mailboxes:v,emit:i,clients:[],boxes:{},req:{},loggedIn:c.loggedIn&&c.proxy.edPublic};return function(e,t){!t.notifications&&e.loggedIn&&(t.notifications={channel:n.createChannelId(),lastKnownHash:"",viewed:[]},e.pinPads([t.notifications.channel],function(e){e.error&&console.error(e)})),t.support&&delete t.support,t.broadcast||(t.broadcast={channel:d,lastKnownHash:u.lastBroadcastHash,decrypted:!0,viewed:[]})}(E,v),E.loggedIn&&function(n){var t=n.store.network;t.on("message",function(r,o){if(o===t.historyKeeper){var a=JSON.parse(r);if(/HISTORY_RANGE/.test(a[0])){var i=a[1],s=n.req[i];if(s){var c=a[0],u=a[2],f=s.box;if("HISTORY_RANGE"===c){if(!Array.isArray(u))return;var l;if("broadcast"===s.box.type)l=e.tryParse(u[4]);else try{var d=f.encryptor.decrypt(u[4]);(l=JSON.parse(d.content)).author=d.author}catch(e){console.log(e)}var h=u[4].slice(0,64);n.emit("HISTORY",{txid:i,time:u[5],message:l,hash:h},[s.cId])}else"HISTORY_RANGE_END"===c&&(n.emit("HISTORY",{txid:i,complete:!0},[s.cId]),delete n.req[i])}}}})}(E),E.boxes.reminders={content:{}},Object.keys(v).forEach(function(e){if(-1!==f.indexOf(e)){var n=v[e];-1===l.indexOf(e)?g(E,e,n,function(){}):g(E,e,n,r(function(){}))}}),E.loggedIn&&Object.keys(c.proxy.teams||{}).forEach(function(n){var t=c.proxy.teams[n];if(t){var r=t.keys.mailbox||{};if(r.channel){var o={owners:[e.find(t,["keys","drive","edPublic"])]};g(E,"team-"+n,r,function(){},o)}}}),s.post=function(e,n,t){var r=E.boxes[e];r&&r.sendMessage({type:n,content:t,sender:c.proxy.curvePublic})},s.hideMessage=function(e,n){p(E,e,n.hash,E.clients)},s.showMessage=function(e,n,t,r){"reminders"===e&&n&&(E.boxes.reminders.content[n.hash]=n.msg,E.clients.length||(E.boxes.reminders.content[n.hash].requiresNotif=!0),p(E,e,n.hash,E.clients)),h(E,e,n,t,function(e){o.system(void 0,e.msg),r&&r()})},s.open=function(e,n,t,r,o){(-1!==f.indexOf(e)||r)&&g(E,e,n,t,o)},s.close=function(e,n){!function(e,n,t){t=t||function(){};var r=e.boxes[n];r?r.cpNf&&"function"==typeof r.cpNf.stop?(r.cpNf.stop(),Object.keys(r.content).forEach(function(t){a.remove(e,r,r.content[t],t),p(e,n,t,e.clients)}),delete e.boxes[n]):t("EINVAL"):t()}(E,e,n)},s.dismiss=function(e,n){m(E,e,"",n)},s.sendTo=function(e,n,t,r){E.loggedIn?y(E,e,n,t,r):r({error:"NOT_LOGGED_IN"})},s.removeClient=function(e){!function(e,n){var t=e.clients.indexOf(n);e.clients.splice(t,1)}(E,e)},s.execCommand=function(e,n,t){var r=n.cmd,a=n.data;"SUBSCRIBE"!==r?"DISMISS"!==r?"SENDTO"!==r?"LOAD_HISTORY"!==r||function(e,n,t,r){var o=e.boxes[t.type];if(o){var a=["GET_HISTORY_RANGE",o.channel,{from:t.lastKnownHash,count:t.count,txid:t.txid}];"broadcast"===t.type&&(a=["GET_HISTORY_RANGE",o.channel,{to:t.lastKnownHash,txid:t.txid}]),e.req[t.txid]={cId:n,box:o};var i=e.store.network;i.sendto(i.historyKeeper,JSON.stringify(a)).then(function(){},function(e){console.error(e)})}else r({error:"ENOENT"})}(E,e,a,t):y(E,a.type,a.msg,a.user,t):m(E,a,e,t):function(e,n,t,r){Object.keys(e.boxes).forEach(function(n){Object.keys(e.boxes[n].content).forEach(function(r){var a={msg:e.boxes[n].content[r],hash:r};h(e,n,a,t,function(e){e.error||a.msg&&a.msg.requiresNotif&&(o.system(void 0,e.msg),delete a.msg.requiresNotif)})})}),-1===e.clients.indexOf(t)&&e.clients.push(t),r()}(E,0,e,t)},s},c})(Z(),te(),je(),On(),(Cn||(Cn=1,function(e){(()=>{const n=(e={})=>{let n=globalThis;var t={};e.requireConf=e.requireConf||{},t.setCustomize=n=>{e=n.ApiConfig};var r=n.location&&n.location.pathname.slice(1,-1),o=-1!==["code","slide","pad","kanban","whiteboard","diagram","sheet","poll","teams","form","doc","presentation"].indexOf(r)?"-"+r:"",a="/customize/favicon/main-favicon"+o+".png?"+e.requireConf.urlArgs,i="/customize/favicon/alt-favicon"+o+".png?"+e.requireConf.urlArgs,s="/customize/favicon/main-favicon"+o+".ico?"+e.requireConf.urlArgs,c="/customize/favicon/alt-favicon"+o+".ico?"+e.requireConf.urlArgs,u=n.document,f=t.isSupported=function(){return"function"==typeof n.Notification&&n.isSecureContext},l=t.hasPermission=function(){return"granted"===Notification.permission},d=t.getPermission=function(e){e=e||function(){},Notification&&"function"==typeof Notification.requestPermission?Notification.requestPermission(function(n){e("granted"===n)}):e(!1)},h=t.create=function(e,t,r){u&&!r?r=u.getElementById("favicon").getAttribute("data-main-favicon")||i:r||(r=i);var o=new Notification(t,{icon:r,body:e});return o.onclick=function(){if(u)try{parent.focus(),n.focus(),this.close()}catch(e){}},o};return t.system=function(e,n,t){if(f())return l()?h(e,n,t):void("denied"!==Notification.permission&&d(function(r){r&&h(e,n,t)}))},u&&!u.getElementById("favicon")&&function(){if(u){console.debug("creating favicon");var e={id:"favicon",type:"image/png",rel:"icon","data-main-favicon":a,"data-alt-favicon":i,href:a};if(!u.getElementById("favicon")){var n=u.createElement("link");Object.keys(e).forEach(function(t){n.setAttribute(t,e[t])}),u.head.appendChild(n)}if(!u.getElementById("favicon-ico")){var t=u.createElement("link");e.href=e.href.replace(/\.png/g,".ico"),e.id="favicon-ico",e.type="image/x-icon",Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])}),u.head.appendChild(t)}}else console.error("document is not available in this context")}(),t.tab=function(e,r){if(u){var o="_pendingTabNotification",f=u.getElementById("favicon"),l=u.getElementById("favicon-ico"),d=a,h=i,p=s,v=c;f&&(d=f.getAttribute("data-main-favicon")||a,h=f.getAttribute("data-alt-favicon")||i,f.setAttribute("href",d)),l&&(p=l.getAttribute("data-main-favicon")||s,v=l.getAttribute("data-alt-favicon")||c,l.setAttribute("href",p));var y=function(e){return!!t[o]&&(n.clearInterval(t[o]),f&&f.setAttribute("href",e?h:d),l&&l.setAttribute("href",e?v:p),!0)};y();var m=function(){f&&f.setAttribute("href",f.getAttribute("href")===d?h:d),l&&l.setAttribute("href",l.getAttribute("href")===p?v:p),--r};return t[o]=n.setInterval(function(){if(r>0)return m();y(!0)},e),m(),{cancel:y}}console.error("document is not available in this context")},t};e.exports&&(e.exports=n(void 0))})()}(Hn)),Hn.exports),(Pn||(Pn=1,Rn=((e,n,t,r,o)=>{var a=function(e){var n=e.store.realtime.getLag().lag||0;return 20*(Math.max(0,n)+300)*(.5+Math.random())},i={},s={},c=function(e,n){var r=e.store.proxy.mutedUsers||{},o=t.find(n,["msg","author"]);return!!o&&Boolean(r[o])},u={};i.FRIEND_REQUEST=function(n,t,r,o){var a=r.msg.content.user||r.msg.content;if(c(n,r))o(!0);else if(u[r.msg.author])o(!0);else{if(u[r.msg.author]={type:t.type,hash:r.hash},e.getFriend(n.store.proxy,r.msg.author)||n.store.proxy.friends_pending[r.msg.author])return delete n.store.proxy.friends_pending[r.msg.author],void e.acceptFriendRequest(n.store,a,function(t){t&&t.error?o():e.addToFriendList({proxy:n.store.proxy,realtime:n.store.realtime,pinPads:n.pinPads},a,function(e){if(e)return console.error(e),void o(!0);n.store.messenger&&n.store.messenger.onFriendAdded(a),n.updateMetadata(),o(!0)})});o()}},s.FRIEND_REQUEST=function(e,n,t){var r=t.content.user||t.content;u[r.curvePublic]&&delete u[r.curvePublic]};var f={},l={};i.DECLINE_FRIEND_REQUEST=function(e,n,t,r){var o=t.msg.content.user||t.msg.content;o.curvePublic||(o.curvePublic=t.msg.author),setTimeout(function(){r(!0),e.store.proxy.friends_pending[t.msg.author]&&(delete e.store.proxy.friends_pending[t.msg.author],e.updateMetadata(),f[t.msg.author]||n.sendMessage({type:"FRIEND_REQUEST_DECLINED",content:{user:o}},function(e){f[t.msg.author]={type:n.type,hash:e}}))},a(e))},i.FRIEND_REQUEST_DECLINED=function(e,n,t,r){e.updateMetadata();var o=t.msg.content.user.curvePublic||t.msg.content.user,a=l[o];delete l[o],f[o]?r(!0,a):(f[o]={type:n.type,hash:t.hash},r(!1,a))},s.FRIEND_REQUEST_DECLINED=function(e,n,t){var r=t.content.user.curvePublic||t.content.user;f[r]&&delete f[r]},i.ACCEPT_FRIEND_REQUEST=function(n,t,r,o){var i=r.msg.content.user||r.msg.content;setTimeout(function(){o(!0),n.store.proxy.friends_pending[r.msg.author]&&(delete n.store.proxy.friends_pending[r.msg.author],e.addToFriendList({proxy:n.store.proxy,realtime:n.store.realtime,pinPads:n.pinPads},i,function(e){e?console.error(e):(n.store.messenger&&n.store.messenger.onFriendAdded(i),n.updateMetadata(),n.store.modules.profile&&n.store.modules.profile.update(),l[r.msg.author]||t.sendMessage({type:"FRIEND_REQUEST_ACCEPTED",content:{user:i}},function(e){l[r.msg.author]={type:t.type,hash:e}}))}))},a(n))},i.FRIEND_REQUEST_ACCEPTED=function(e,n,t,r){e.updateMetadata();var o=t.msg.content.user.curvePublic||t.msg.content.user,a=f[o];delete f[o],l[o]?r(!0,a):(l[o]={type:n.type,hash:t.hash},r(!1,a))},s.FRIEND_REQUEST_ACCEPTED=function(e,n,t){var r=t.content.user.curvePublic||t.content.user;l[r]&&delete l[r]},i.CANCEL_FRIEND_REQUEST=function(e,n,t,r){var o=u[t.msg.author];o?r(!0,o):r(!0)},i.UNFRIEND=function(n,t,r,o){var a=r.msg.author,i=e.getFriend(n.store.proxy,a);i?(delete n.store.proxy.friends[a],delete n.store.proxy.friends_pending[a],n.store.messenger&&n.store.messenger.onFriendRemoved(a,i.channel),n.updateMetadata(),o(!0)):o(!0)},i.UPDATE_DATA=function(e,n,t,r){var o=t.msg,a=o.author,i=e.store.proxy.friends&&e.store.proxy.friends[a];if(!i||"object"!=typeof o.content)return void r(!0);const s=o.content.edPublic,c=()=>{Object.keys(o.content).forEach(function(e){i[e]=o.content[e]}),e.store.messenger&&e.store.messenger.onFriendUpdate(a),e.updateMetadata(),r(!0)};if(o.content.badge&&e.store.modules.badge)return e.store.modules.badge.listBadges({edPublic:s},e=>{e.includes(o.content.badge)||delete o.content.badge,c()});c()};var d=function(e,n){let t=e.store.data.blockHash,a=o.parseBlockHash(t).keys.symmetric;return r.encrypt(n,a)},h={};i.SHARE_PAD=function(e,t,r,o){var a=r.msg,i=r.hash,s=a.content;if(c(e,r))o(!0);else{var u,f=s.isStatic?s.href:n.hrefToHexChannelId(s.href,s.password),l=n.parsePadUrl(s.href),p=l.hashData&&l.hashData.mode||"n/a",v=h[f];if(v){if("edit"===v.mode&&"view"===p)return void o(!0);u=v.data}s.password&&(s.password=d(e,s.password)),h[f]={mode:p,data:{type:t.type,hash:i}},o(!1,u)}},s.SHARE_PAD=function(e,t,r,o){var a=r.content,i=n.hrefToHexChannelId(a.href,a.password),s=h[i];s&&s.data&&s.data.hash===o&&delete h[i]};var p=!1;i.SUPPORT_MESSAGE=function(e,n,t,r){p?r(!0):(p=!0,r())},s.SUPPORT_MESSAGE=function(){p=!1},i.REQUEST_PAD_ACCESS=function(e,n,t,r){var o=t.msg.content;if(c(e,t))r(!0);else{var a=o.channel,i=e.store.manager.findChannel(a);if(i.length){var s,u,f=e.store.proxy.edPublic;i.some(function(e){if(e.data&&Array.isArray(e.data.owners)&&-1!==e.data.owners.indexOf(f)&&e.data.href)return u=e.data.href,s=e.data.filename||e.data.title,!0})?(o.title=s,o.href=u,r(!1)):r(!0)}else r(!0)}},i.GIVE_PAD_ACCESS=function(e,n,t,r){var o,a=t.msg.content,i=a.channel;e.store.manager.findChannel(i,!0).forEach(function(e){e.data&&!e.data.href&&(o||(o=e.data.filename||e.data.title),e.userObject.setHref(i,null,a.href))}),a.title=o||a.title,r(!1)},i.ADD_TO_ACCESS_LIST=function(e,n,t,r){var o=t.msg.content.channel;e.Store.getAllStores().forEach(function(n){var t=n.manager.findChannel(o);if(t.length){var r=t[0].data,a=t[0].id,i=n.id;e.Store.loadSharedFolder(i,a,r,function(){},!1)}}),r(!0)};var v={};i.ADD_OWNER=function(e,n,t,r){var o=t.msg.content;if(c(e,t))r(!0);else{if(!(o.teamChannel||o.href&&o.title&&o.channel))return console.log("Remove invalid notification"),void r(!0);var a=o.channel||o.teamChannel;o.password&&(o.pw=o.password,o.password=d(e,o.password)),v[a]?r(!0):(v[a]={type:n.type,hash:t.hash},r(!1))}},s.ADD_OWNER=function(e,n,t){var r=t.content.channel||t.content.teamChannel;v[r]&&delete v[r]},i.RM_OWNER=function(e,n,t,r){var o=t.msg.content;if(!o.channel&&!o.teamChannel)return console.log("Remove invalid notification"),void r(!0);var a=o.channel||o.teamChannel;if(o.teamChannel){var i=e.store.proxy.teams||{};Object.keys(i).some(function(e){if(i[e].channel===a)return i[e].owner=!1,!0})}v[a]&&o.pending?r(!1,v[a]):r(!1)};var y={};i.INVITE_TO_TEAM=function(e,n,r,o){var a=r.msg.content;if(c(e,r))o(!0);else{if(!a.team)return console.log("Remove invalid notification"),void o(!0);var i=y[a.team.channel];if(i)return console.log("removing old invitation"),o(!1,i),void(y[a.team.channel]={type:n.type,hash:r.hash});var s=t.find(e,["store","proxy","teams"])||{};Object.keys(s).some(function(e){return s[e].channel===a.team.channel})?o(!0):(y[a.team.channel]={type:n.type,hash:r.hash},o(!1))}},s.INVITE_TO_TEAM=function(e,n,r){var o=t.find(r,["content","team","channel"]);delete y[o]},i.KICKED_FROM_TEAM=function(e,n,t,r){var o=t.msg.content;if(!o.teamChannel)return console.log("Remove invalid notification"),void r(!0);y[o.teamChannel]&&o.pending?r(!0,y[o.teamChannel]):r(!1)},i.INVITE_TO_TEAM_ANSWER=function(e,n,r,o){var a=r.msg,i=a.content;if(!i.teamChannel)return console.log("Remove invalid notification"),void o(!0);var s,c,u=t.find(e,["store","proxy","teams"])||{};if(Object.keys(u).some(function(e){var n=u[e];if(n.channel===i.teamChannel)return s=e,c=n,!0}),s){if(i.team=c,!i.answer)try{e.store.modules.team.removeFromTeam(s,a.author,!0)}catch(e){console.error(e)}var f=i.user||i;n.sendMessage({type:"INVITE_TO_TEAM_ANSWERED",content:{user:f,team:c,answer:i.answer}},function(){}),o(!0)}else o(!0)},i.TEAM_EDIT_RIGHTS=function(e,n,r,o){var a=r.msg.content;if(!a.teamData)return console.log("Remove invalid notification"),void o(!0);var i,s=t.find(e,["store","proxy","teams"])||{};if(Object.keys(s).some(function(e){if(s[e].channel===a.teamData.channel)return i=e,!0}),i)try{e.store.modules.team.changeMyRights(i,a.state,a.teamData,function(e){e||console.error("Can't update team rights"),o(!0)})}catch(e){console.error(e)}else o(!0)},i.OWNED_PAD_REMOVED=function(e,n,t,r){var o=t.msg.content;if(!o.channel)return console.log("Remove invalid notification"),void r(!0);var a=o.channel;e.store.manager.findChannel(a).forEach(function(n){var t=e.store.manager.findFile(n.id);e.store.manager.delete({paths:t},function(){e.updateDrive()})}),r(!0)},i.MOVE_TODO=function(e,n,t,r){var o=e.store.proxy.curvePublic;t.msg.author===o?r():r(!0)},i.SAFE_LINKS_DEFAULT=function(e,n,t,r){var o=e.store.proxy.curvePublic;t.msg.author===o?r():r(!0)};var m={};i.FORM_RESPONSE=function(e,n,t,r){var o,a,i=t.msg,s=t.hash,c=i.content,u=c.channel;if(u)if(function(e,n){return(e.store.proxy.mutedChannels||[]).includes(n)}(e,u))r(!0);else if(e.Store.getAllStores().some(function(e){return e.manager.findChannel(u).some(function(e){if(e.data&&(!a||e.data.href))return a=e.data.href||e.data.roHref,o=e.data.filename||e.data.title,!!e.data.href||void 0})}),a){c.href=a,c.title=o;var f=m[u],l=f?f.data:void 0;m[u]={data:{type:n.type,hash:s}},r(!1,l)}else r(!0);else r(!0)},s.FORM_RESPONSE=function(e,n,t,r){var o=t.content.channel,a=m[o];a&&a.data&&a.data.hash===r&&delete m[o]};var g={};i.COMMENT_REPLY=function(e,n,r,o){var a=r.msg,i=r.hash,s=a.content;if(t.find(e.store.proxy,["settings","pad","disableNotif"]))o(!0);else{var c,u,f=s.channel;if(f)if(e.Store.getAllStores().some(function(e){return e.manager.findChannel(f).some(function(e){if(e.data&&(!u||e.data.href))return u=e.data.href||e.data.roHref,c=e.data.filename||e.data.title,!!e.data.href||void 0})}),u){s.href=u,s.title=c;var l=g[f],d=l?l.data:void 0;g[f]={data:{type:n.type,hash:i}},o(!1,d)}else o(!0);else o(!0)}},s.COMMENT_REPLY=function(e,n,t,r){var o=t.content.channel,a=g[o];a&&a.data&&a.data.hash===r&&delete g[o]};var E,b,O={};i.MENTION=function(e,n,t,r){var o=t.msg,a=t.hash,i=o.content;if(c(e,t))r(!0);else{var s=i.channel;if(s){var u,f;e.Store.getAllStores().some(function(e){return e.manager.findChannel(s).some(function(e){if(e.data&&(!f||e.data.href))return f=e.data.href||e.data.roHref,u=e.data.filename||e.data.title,!!e.data.href||void 0})}),i.href=f,i.title=u;var l=O[s],d=l?l.data:void 0;O[s]={data:{type:n.type,hash:a}},r(!1,d)}else r(!0)}},s.MENTION=function(e,n,t,r){var o=t.content.channel,a=O[o];a&&a.data&&a.data.hash===r&&delete O[o]},i.BROADCAST_MAINTENANCE=function(e,n,t,r){var o=t.msg.uid;e.Store.onMaintenanceUpdate(o),r(!0)},i.BROADCAST_SURVEY=function(e,n,t,r){var o=t.msg,a=o.content,i=o.uid,s=E;E={type:n.type,hash:t.hash},e.Store.onSurveyUpdate(i),r(!a.url,s)},i.BROADCAST_CUSTOM=function(e,n,t,r){var o=t.msg.uid,a=b;b={uid:o,type:n.type,hash:t.hash},r(!1,a)},i.BROADCAST_DELETE=function(e,n,t,r){var o=t.msg.content.uid;if(b&&b.uid===o)return r(!0,b),void(b=void 0);r(!0)};var A,w,D={};return i.SF_DELETED=function(e,n,t,r){var o=t.msg.content,a=o.team,i=o.sfId;if(D[i])r(!0);else if(D[i]=1,a){var s=e.store.proxy.teams[a];s?(o.teamName=s.metadata&&s.metadata.name,r(!1)):r(!1)}else r(!1)},s.SF_DELETED=function(e,n,t){var r=t.content.sfId;delete D[r]},i.NEW_TICKET=function(e,n,r,o){var a=r.msg.content;a.time||(a.time=r.time);var i=t.find(e,["store","modules","support"]);a.isAdmin&&i.addUserTicket(a,o),i.addAdminTicket(a,o)},i.NOTIF_TICKET=function(e,n,r,o){var a=r.msg.content;a.time||(a.time=r.time);var i=t.find(e,["store","modules","support"]);if(a.isAdmin)return t.find(e,["store","proxy","support",a.channel])?(i.updateUserTicket(a),A?void o(!1,A):(A={channel:a.channel,type:n.type,hash:r.hash},void o(!1))):void o(!0);i.checkAdminTicket(a,s=>{s?(i.updateAdminTicket(a),t.find(e.store.proxy,["settings","general","disableSupportNotif"])?o(!0):w?o(!1,w):(w={channel:a.channel,type:n.type,hash:r.hash},o(!1))):o(!0)})},s.NOTIF_TICKET=function(e,n,t){var r=t.content.channel;A&&A.channel===r&&(A=void 0),w&&w.channel===r&&(w=void 0)},i.ADD_MODERATOR=function(e,n,r,o){var a=r.msg.content;t.find(e,["store","modules","support"]).updateAdminKey(a,o)},i.MODERATOR_NEW_KEY=function(e,n,r,o){var a=r.msg.content;t.find(e,["store","modules","support"]).updateAdminKey(a,function(){o(!0)})},{add:function(e,n,r,o){if(r.msg){var a=t.find(e,["store","proxy","curvePublic"]),s=t.find(r,["msg","content","user","curvePublic"])||t.find(r,["msg","content","curvePublic"]);if(s&&r.msg.author!==s&&r.msg.author!==a)return console.error("blocked"),void o(null,null,!0);var c=r.msg.type;if(i[c])try{i[c](e,n,r,o)}catch(e){console.error(e),o()}else o()}else o(null,null,!0)},remove:function(e,n,t,r){if(t){var o=t.type;if(s[o])try{s[o](e,n,t,r)}catch(e){console.error(e)}}}}})(On(),te(),Z(),M(),hn())),Rn),D(),M()),kn}function Kn(){if(Ln)return Fn;Ln=1;return Fn=((e,n,t,r,o,a,i,s,c)=>{let u={};let f=function(f,l,d,h){var p=f.version||0;s(function(){}).nThen(function(){var n,t,r,o,a;p<2&&(n="cryptpad.userlist-drawer",t="cryptpad.hide_poll_text",r="cryptpad.indentUnit",o="cryptpad.indentWithTabs",a=f.settings=f.settings||{},void 0!==f[r]&&(a.codemirror=a.codemirror||{},a.codemirror.indentUnit=f[r],delete f[r]),void 0!==f[o]&&(a.codemirror=a.codemirror||{},a.codemirror.indentWithTabs=f[o],delete f[o]),void 0!==f[n]&&(a.toolbar=a.toolbar||{},a.toolbar["userlist-drawer"]=f[n],delete f[n]),void 0!==f[t]&&(a.poll=a.poll||{},a.poll["hide-text"]=f[t],delete f[t]),e.send("Migrate-2",!0),f.version=p=2)}).nThen(function(){p<3&&(!function(){if(localStorage.CRYPTPAD_LANG){var e=localStorage.CRYPTPAD_LANG;f.settings.language=e}}(),e.send("Migrate-3",!0),f.version=p=3)}).nThen(function(){var n;p<4&&(n=f.settings=f.settings||{},void 0!==f.allowUserFeedback&&(n.general=n.general||{},n.general.allowUserFeedback=f.allowUserFeedback,delete f.allowUserFeedback),e.send("Migrate-4",!0),f.version=p=4)}).nThen(function(){p<5&&(!function(){var e=f.drive&&f.drive.filesData;if(e)for(var n in e)"number"!=typeof e[n].ctime&&(e[n].ctime=+new Date(e[n].ctime)),"number"!=typeof e[n].atime&&(e[n].atime=+new Date(e[n].atime))}(),e.send("Migrate-5",!0),f.version=p=5)}).nThen(function(t){var r,o,a,i,c;p<6&&(a=f.drive.filesData||{},i=s(function(){}),c=Object.keys(a).length,Object.keys(a).forEach(function(e,t){i=i.nThen(function(i){setTimeout(i(function(){if(r=a[e],o=n.parsePadUrl(r.href),r.href&&!r.channel){var i=n.getSecrets(o.type,o.hash,r.password);r.channel=i.channel,d(6,Math.round(100*t/c)),console.log("Adding missing channel in filesData ",r.channel)}}))})}),i.nThen(t(function(){e.send("Migrate-6",!0),f.version=p=6})))}).nThen(function(t){var r,o,a,i,c;p<7&&(a=f.drive.filesData,i=s(function(){}),c=Object.keys(a).length,Object.keys(a).forEach(function(e,t){i=i.nThen(function(i){setTimeout(i(function(){if((r=a[e]).href)if(-1!==r.href.indexOf("#"))if("pad"===(o=n.parsePadUrl(r.href)).hashData.type){if("view"===o.hashData.mode)r.roHref=r.href,delete r.href,console.log("Move href to roHref in filesData ",r.roHref);else{var i=n.getSecrets(o.type,o.hash,r.password),s=n.getViewHashFromKeys(i);s&&(r.roHref="/"+o.type+"/#"+s,console.log("Adding missing roHref in filesData ",r.href))}d(6,Math.round(100*t/c))}else d(7,Math.round(100*t/c));else d(7,Math.round(100*t/c));else d(7,Math.round(100*t/c))}))})}),i.nThen(t(function(){e.send("Migrate-7",!0),f.version=p=7})))}).nThen(function(){p<8&&(f.FS_hashes=t.deduplicateString(f.FS_hashes||[]),e.send("Migrate-8",!0),f.version=p=8)}).nThen(function(){p<9&&(!function(){var e=h.network,n={},t={store:h},o=r.createData(f),i=function(e){var t=n[e];if(t){try{t.wc.leave()}catch(e){}delete n[e]}};e.on("message",function(r,s){try{!function(r,s){if(s===e.historyKeeper){var c=JSON.parse(r);if(!c.validateKey&&!c.owners||!c.channel){if(c.channel&&n[c.channel]){if(c.error&&"EINVAL"===c.error){var u=["GET_HISTORY",c.channel,{}];return void e.sendto(e.historyKeeper,JSON.stringify(u)).then(function(){},function(){})}if(c.state&&1===c.state){o.channel=c.channel;var f=["UPDATE",o.curvePublic,+new Date,o],l=n[c.channel].encrypt(JSON.stringify(f));return n[c.channel].wc.bcast(l).then(function(){},function(e){console.error("Can't migrate this friend",n[c.channel].friend,e)}),void i(c.channel)}}else if(c.channel)return;var d=c[3];if(d&&n[d]){var h=n[d],p=h.decrypt(c[4]),v=JSON.parse(p);if("UPDATE"===v[0]){if(v[1]===o.curvePublic)return;var y=v[3];if(!y.notifications)return;h.friend.notifications=y.notifications,o.channel=d,a.sendTo(t,"UPDATE_DATA",o,{channel:y.notifications,curvePublic:y.curvePublic},function(e){e&&e.error?console.error(e):console.log("friend migrated",h.friend)}),i(d)}}}}}(r,s)}catch(e){console.error(e)}});var s=f.friends||{};Object.keys(s).forEach(function(t){if(44===t.length){var r=s[t];r.notifications||e.join(r.channel).then(function(t){var o=c.Curve.deriveKeys(r.curvePublic,f.curvePrivate),a=c.Curve.createEncryptor(o);n[r.channel]={wc:t,friend:r,decrypt:a.decrypt,encrypt:a.encrypt};var i={lastKnownHash:r.lastKnownHash},s=["GET_HISTORY",r.channel,i];e.sendto(e.historyKeeper,JSON.stringify(s)).then(function(){},function(e){console.error("Can't migrate this friend",r,e)})},function(e){console.error("Can't migrate this friend",r,e)})}})}(),e.send("Migrate-9",!0),f.version=p=9)}).nThen(function(t){p<10&&function(){var i=h.proxy.todo;if(i){var c,l=t(function(){e.send("Migrate-10",!0),f.version=p=10}),d={network:h.network,initialState:"{}",metadata:{owners:h.proxy.edPublic?[h.proxy.edPublic]:[]}};s(function(e){o.get(i,e(function(n,t){if(n||!t)return e.abort(),void l();try{c=JSON.parse(t)}catch(e){}}),d)}).nThen(function(e){if(!c||"object"!=typeof c)return e.abort(),void l();var t={content:{data:{1:{id:"1",color:"color6",item:[],title:u.kanban_todo},2:{id:"2",color:"color3",item:[],title:u.kanban_working},3:{id:"3",color:"color5",item:[],title:u.kanban_done}},items:{},list:[1,2,3]},metadata:{title:u.type.todo,defaultTitle:u.type.todo,type:"kanban"}},s=4,p=!1;if((c.order||[]).forEach(function(e){var n=c.data[e];if(n&&n.task){p=!0;var r=n.state?"3":"1";t.content.data[r].item.push(s),t.content.items[s]={id:s,title:n.task},s++}}),!p)return e.abort(),void l();var v=n.createRandomHash("kanban"),y=n.getSecrets("kanban",v),m=n.getSecrets("todo",i);o.put(v,JSON.stringify(t),e(function(t){if(t)return e.abort(),void l();h.rpc&&(h.rpc.pin([y.channel],function(){}),h.rpc.unpin([m.channel],function(){}));var o=n.hashToHref(v,"kanban");h.manager.addPad(["root"],{title:u.type.todo,owners:d.metadata.owners,channel:y.channel,href:o,roHref:n.hashToHref(n.getViewHashFromKeys(y),"kanban"),atime:+new Date,ctime:+new Date},e(function(e){if(e)console.error(e);else{delete h.proxy.todo;var n=r.createData(f),t={store:h};a.sendTo(t,"MOVE_TODO",{user:n,href:o},{channel:n.notifications,curvePublic:n.curvePublic},function(e){e&&e.error&&console.error(e)})}}))}),d)}).nThen(function(){l()})}}()}).nThen(function(n){if(!(p>=11)){var o=function(){e.send("Migrate-11",!0),f.version=p=11};if(void 0===t.find(f,["settings","security","unsafeLinks"])){var i={store:h},s=r.createData(f);s.curvePublic?a.sendTo(i,"SAFE_LINKS_DEFAULT",{user:s},{channel:s.notifications,curvePublic:s.curvePublic},n(function(e){e&&e.error?console.error(e):o()})):o()}else o()}}).nThen(function(){i.whenRealtimeSyncs(h.realtime,t.mkAsync(t.bake(l)))})};return f.setCustomize=e=>{u=e.Messages},f})(Ae(),te(),Z(),On(),xn(),jn(),je(),qe(),M()),Fn}var Un,Bn,Vn=o(be);var Yn,Gn,Jn,qn,Wn=Bn?Un:(Bn=1,Yn=xn(),Gn=Ue(),te(),Jn=je(),qn={anonDriveIntoUser:function(e,n,t){n&&e.loggedIn||"function"!=typeof t?Yn.get(n,function(r,o){var a;if(r)console.error("Cannot migrate recent pads",r);else if(o){try{a=JSON.parse(o)}catch(e){return"function"==typeof t&&t(),void console.error("Cannot parsed recent pads",e)}if(a){var i=e.proxy,s=Gn.init(a.drive,{readOnly:!1,loggedIn:!0,outer:!0}),c=function(){s.fixFiles(!0);var r=e.manager;s.getFiles([s.FILES_DATA]).forEach(function(e){var n=s.getFileData(e),t=n.channel,o=r.findChannel(t);if(0===o.length)n&&r.addPad(null,n,function(e){e&&console.error("Cannot import file:",n,e)});else{if(!n.href)return;o.forEach(function(e){e.data&&!e.data.href&&e.userObject.setHref(t,null,n.href)})}}),i.FS_hashes&&Array.isArray(i.FS_hashes)||(i.FS_hashes=[]),-1===i.FS_hashes.indexOf(n)&&i.FS_hashes.push(n),"function"==typeof t&&Jn.whenRealtimeSyncs(e.realtime,t)};s&&"function"==typeof s.migrate?s.migrate(c):(console.log("oldFo.migrate is not a function"),c())}else"function"==typeof t&&t()}else"function"==typeof t&&t()}):t()}},Un=qn);const zn=ie.mkEvent(!0),Qn=ie.mkEvent(!0),Zn=ie.mkEvent(),Xn=ie.mkEvent(),$n=(e,n)=>{var t,r;const o=e.store,a=e.Store;let i;if(n){const e=a.getStore(n);i=null===(r=null==e?void 0:e.proxy)||void 0===r?void 0:r.drive}else i=null===(t=o.drive)||void 0===t?void 0:t.proxy;return i},et={init:e=>{var n;const{broadcast:t,store:r,Store:o,account:a}=e,i=r.drive||(r.drive={});let s=null===(n=r.proxy)||void 0===n?void 0:n.drive;if((null==s?void 0:s.hash)||ae.createRandomHash("drive"),!s.hash)return i.proxy=s,a.onAccountCacheReady(()=>{zn.fire()}),a.onAccountReady(()=>{Qn.fire()}),{channel:"",onDriveCacheReady:zn.reg,onDriveReady:Qn.reg,onDisconnect:Zn.reg,onReconnect:Xn.reg};throw new Error("NOT IMPLEMENTED")},initAPI:e=>{const{broadcast:n,store:t,Store:r,account:o}=e,a={store:t,Store:r};return{exists:(e,n,r)=>{r({state:Boolean(t.proxy)})},get:(e,n,t)=>{let r=$n(a,n.teamId);t(r?{drive:r}:{error:"ENOTFOUND"})},set:(e,n,t)=>{let o=$n(a,n.teamId);var i,s;o?(i=o,s=n.value,Object.keys(i).forEach(e=>{delete i[e]}),Object.keys(s).forEach(e=>{i[e]=ie.clone(s[e])}),r.onSync(n.teamId,t)):t({error:"ENOTFOUND"})},migrateAnon:(e,n,r)=>{Wn.anonDriveIntoUser(t,n.anonHash,r)}}}};var nt=o(Object.freeze({__proto__:null,Drive:et})),tt=D(),rt=r(qe()),ot=r(bn()),at=We();const it=ie.mkEvent(!0),st=ie.mkEvent(!0),ct=(e,n,t,r)=>{const o=ie.once(ie.mkAsync(r)),{store:a,Store:i}=e;!a.offline&&a.anon_rpc?t.channel?32===t.channel.length&&ae.isValidChannel(t.channel)?a.anon_rpc.send("GET_METADATA",t.channel,(e,n)=>{if(e)return void o({error:e});const r=n&&n[0]||{};o(r),r.rejected||i.getAllStores().forEach(e=>{const n=e.manager.findChannel(t.channel,!0);let o=!1;(n.forEach(e=>{ot(e.data.owners)!==ot(r.owners)&&(o=!0),e.data.owners=r.owners,e.data.atime=+new Date,r.expire&&(e.data.expire=+r.expire)}),o)&&(e.sendEvent||a.sendDriveEvent)("DRIVE_CHANGE",{path:["drive",en.FILES_DATA]})})}):o({error:"EINVAL"}):o({error:"ENOTFOUND"}):o({error:"OFFLINE"})},ut=(e,n,t)=>{if(t.versionHash)return((e,n,t)=>{let r;const{Store:o,store:a,postMessage:i}=e,s=t.channel,c=t.versionHash,u=ae.createChannelId();rt(t=>{ct(e,0,{channel:s},t(e=>{if(e&&e.rejected)return i(n,"PAD_ERROR",{type:"ERESTRICTED"}),void t.abort();r=e.validateKey}))}).nThen(()=>{o.getHistoryRange(n,{cpCount:1,channel:s,lastKnownHash:c},e=>{var t,o;if(e&&e.error)return i(n,"PAD_ERROR",e.error);const f=e.messages||[];if((null===(t=f[f.length-1])||void 0===t?void 0:t.serverHash)!==c)return i(n,"PAD_ERROR",{type:"HASH_NOT_FOUND"});i(n,"PAD_CONNECT",{myID:u,id:s,members:[u]}),(e.messages||[]).forEach(e=>{i(n,"PAD_MESSAGE",{msg:e.msg,time:e.time,user:u.slice(0,16)})}),r&&(null===(o=null==a?void 0:a.messenger)||void 0===o||o.storeValidateKey(s,r)),i(n,"PAD_READY")})})})(e,n,t);const{channels:r,store:o,Store:a,myDeletions:i,postMessage:s}=e,c=t.channel;if(!ae.isValidChannel(c))return s(n,"PAD_ERROR","INVALID_CHAN");const u=void 0===r[c],f=r[c]||(r[c]={queue:[],data:{},clients:[],bcast:(e,n,t)=>{f.clients.forEach(function(r){r!==t&&s(r,e,n)})},history:[],pushHistory:(e,n)=>{if(n){let n;for(f.history.push("cp|"+e),n=f.history.length-101;n>0&&!/^cp\|/.test(f.history[n]);n--);return void(f.history=f.history.slice(n))}f.history.push(e)}});if(-1===f.clients.indexOf(n)&&f.clients.push(n),!u&&f.wc)return s(n,"PAD_CONNECT",{myID:f.wc.myID,id:f.wc.id,members:f.wc.members}),f.wc.members.forEach(e=>{s(n,"PAD_JOIN",e)}),f.history.forEach(e=>{s(n,"PAD_MESSAGE",{msg:tt.removeCp(e),user:f.wc.myID,validateKey:f.data.validateKey})}),void s(n,"PAD_READY");const l=n=>{const r=null==n?void 0:n.type;"EDELETED"===r&&i[c]&&(delete i[c],n.ownDeletion=!0),f.bcast("PAD_ERROR",n),"EDELETED"===r&&(null==de?void 0:le.clearChannel)&&le.clearChannel(c),["EDELETED","EEXPIRED","ERESTRICTED"].includes(r)&&e.leavePad(null,t,function(){})},d={Cache:o.neverCache?void 0:de,priority:1,onCacheStart:()=>{s(n,"PAD_CACHE")},onCacheReady:()=>{s(n,"PAD_CACHE_READY"),st.fire()},onReady:e=>{const t=e.metadata||{};f.data=t,(null==t?void 0:t.validateKey)&&o.messenger&&o.messenger.storeValidateKey(c,t.validateKey),s(n,"PAD_READY",e.noCache)},onMessage:function(e,n,t,r,o){f.lastHash=o,f.pushHistory(e,r),f.bcast("PAD_MESSAGE",{user:n,msg:e,validateKey:t})},onJoin:function(e){f.bcast("PAD_JOIN",e)},onLeave:function(e){f.bcast("PAD_LEAVE",e)},onError:l,onChannelError:l,onRejected:a.onRejected,onConnectionChange:e=>{e.state||f.bcast("PAD_DISCONNECT")},onMetadataUpdate:e=>{f.data=e||{},a.getAllStores().forEach(n=>{n.manager.findChannel(c,!0).forEach(n=>{n.data.owners=e.owners,n.data.atime=+new Date,e.expire&&(n.data.expire=+e.expire)});(n.sendEvent||o.sendDriveEvent)("DRIVE_CHANGE",{path:["drive",en.FILES_DATA]})}),f.bcast("PAD_METADATA",e)},crypto:{encrypt:function(e){return e},decrypt:function(e){return e}},noChainPad:!0,channel:c,metadata:t.metadata,network:o.network||o.networkPromise,websocketURL:U.getWebsocketURL(),onInit:function(){it.fire()},onConnect:(e,t)=>{f.sendMessage=(n,r,o)=>{t(n,t=>{t?o({error:t}):(f.lastHash=n.slice(0,64),f.pushHistory(tt.removeCp(n),/^cp\|/.test(n)),f.bcast("PAD_MESSAGE",{user:e.myID,msg:tt.removeCp(n),validateKey:f.data.validateKey},r),o())})},f.wc=e,f.queue.forEach(function(e){f.sendMessage(e.message,n)}),f.queue=[],f.bcast("PAD_CONNECT",{myID:e.myID,id:e.id,members:e.members})}};f.cpNf=tt.start(d)},ft=(e,n)=>{var t,r,o,a,i,s;const c=e.store;if(null===(r=null===(t=c.messenger)||void 0===t?void 0:t.leavePad)||void 0===r||r.call(t,n),null===(a=null===(o=c.onlyoffice)||void 0===o?void 0:o.leavePad)||void 0===a||a.call(o,n),Object.keys(c.modules).forEach(e=>{var t,r;null===(r=null===(t=c.modules[e])||void 0===t?void 0:t.leavePad)||void 0===r||r.call(t,n)}),!((e,n)=>{const{store:t}=e;if(!t)return!1;if(t.driveChannel===n)return!0;if(at.isSharedFolderChannel(n))return!0;if(ie.find(t,["proxy","teams"])){var r=ie.find(t,["proxy","teams"])||{};return Object.keys(r).some(e=>r[e].channel===n)}if(ie.find(t,["proxy","profile","href"])){let e=ie.find(t,["proxy","profile","href"]);return ae.hrefToHexChannelId(e)===n}})(e,n)){try{le.leaveChannel(n)}catch(e){console.error(e)}null===(s=null===(i=e.channels[n])||void 0===i?void 0:i.cpNf)||void 0===s||s.stop()}delete e.channels[n]},lt={init:e=>{const{broadcast:n,postMessage:t,store:r,Store:o}=e,a={channels:[],postMessage:t,store:r,Store:o,myDeletions:[],leavePad:(e,n,t)=>{}},i=(e,n,t)=>{const r=a.channels[n.channel];(null==r?void 0:r.cpNf)?(ft(a,n.channel),t()):t({error:"EINVAL"})};a.leavePad=i;return{join:(e,n,t)=>{ut(a,e,n)},destroy:(e,n,t)=>{((e,n,t,r)=>{const{store:o,Store:a,channels:i,myDeletions:s}=e;let c,u,f=t,l=!1;if(t&&"object"==typeof t&&({channel:f,force:l,teamId:c,reason:u}=t),f===o.driveChannel&&!l)return void r({error:"User drive removal blocked!"});const d=a.getStore(c);d?d.rpc?(i[f]&&(s[f]=!0),d.rpc.removeOwnedChannel(f,e=>{e&&delete s[f],r({error:e})},u)):r({error:"RPC_NOT_READY"}):r({error:"ENOTFOUND"})})(a,0,n,t)},clear:(e,n,t)=>{((e,n,t,r)=>{const{Store:o}=e,a=o.getStore(t&&t.teamId);a.rpc?a.rpc.clearOwnedChannel(t.channel,e=>{r({error:e})}):r({error:"RPC_NOT_READY"})})(a,0,n,t)},setMetadata:(e,n,t)=>{((e,n,t,r)=>{if(!t.channel)return void r({error:"ENOTFOUND"});if(!t.command)return void r({error:"EINVAL"});const{Store:o}=e,a=o.getStore(t.teamId);if(!a)return void r({error:"ENOTFOUND"});const i=t.channels;delete t.channels,a.rpc.setMetadata(t,(e,n)=>{e?r({error:e}):Array.isArray(n)&&n.length?r(n[0]):r({})}),Array.isArray(i)&&i.forEach(e=>{var r=ie.clone(t);r.channel=e,o.setPadMetadata(n,r,()=>{})})})(a,e,n,t)},getMetadata:(e,n,t)=>{ct(a,0,n,t)},sendMessage:(e,n,t)=>{((e,n,t,r)=>{var o=t.msg,a=e.channels[t.channel];if(a)a.wc?a.sendMessage(o,n,r):(a.queue.push(o),r())})(a,e,n,t)},onCorruptedCache:(e,n,t)=>{((e,n,t)=>{var r=e.channels[t];r&&r.cpNf&&(le.clearChannel(t),r.cpNf.resetCache&&r.cpNf.resetCache())})(a,0,n)},getLastHash:(e,n,t)=>{((e,n,t,r)=>{var o=e.channels[t.channel];o?o.lastHash?r({hash:o.lastHash}):r({error:"EINVAL"}):r({error:"ENOCHAN"})})(a,0,n,t)},leave:i,removeClient:e=>{Object.keys(a.channels).forEach(n=>{let t=a.channels[n].clients.indexOf(e);-1!==t&&a.channels[n].clients.splice(t,1),0===a.channels[n].clients.length&&ft(a,n)})},onJoined:it.reg,onCacheReady:st.reg,getChannels:()=>a.channels}}};var dt,ht,pt,vt,yt,mt,gt,Et,bt,Ot,At,wt,Dt,_t,Tt,St,Nt,It,xt,Ct,Rt=o(Object.freeze({__proto__:null,Pad:lt}));function Pt(){if(ht)return dt;ht=1;return dt=((e,n,t)=>{const r={};let o={},a={};r.setCustomize=e=>{o=e.Messages,a=e.AppConfig};var i=function(e,n){n.degraded||n.clients.forEach(function(t){var r=e.clients[t];if(r){var o={id:r.id,cursor:r.cursor};n.sendMsg(JSON.stringify(o))}})},s=function(e,n,t){var r=n.members,o=a.degradedLimit||8;t.degraded=r.length-1>=o,e.emit("DEGRADED",{degraded:t.degraded},t.clients)},c=function(e,n,r,o){var a=n.channel,c=n.secret;c.keys.cryptKey&&(c.keys.cryptKey=function(e){for(var n=Object.keys(e).length,t=new Uint8Array(n),r=0;r{const f={};let l={};f.setCustomize=e=>{l=e.ApiConfig};var d=i.Nacl,h=function(e,n,t,r){let o=Object.keys(e.clients).filter(t=>Boolean(e.clients[t].admin)===n);o.length&&e.emit(t,{channel:r},[o])},p=function(n,t,r,o){var a=e.mkAsync(o);if(t&&!n.adminRdyEvt)return void a("EFORBIDDEN");let i=l.httpUnsafeOrigin;e.fetchApi(i,"config",!0,o=>{n.moderatorKeys=o.moderatorKeys,n.adminKeys=o.adminKeys;var i=o.supportMailboxKey;if(i){if(!t||e.find(n.store.proxy,["mailboxes","supportteam","keys","curvePublic"])===i)return t?n.adminRdyEvt.reg(()=>{a(null,{supportKey:i,myCurve:r.adminCurvePrivate||e.find(n.store.proxy,["mailboxes","supportteam","keys","curvePrivate"]),theirPublic:r.curvePublic,notifKey:r.curvePublic})}):void a(null,{supportKey:i,myCurve:n.store.proxy.curvePrivate,theirPublic:r.curvePublic||i,notifKey:i});a("EFORBIDDEN")}else a("E_NOT_INIT")})},v=function(n,t,r,o){var s,c,f=e.once(e.mkAsync(o));a(e=>{p(n,r,t,e((n,t)=>{if(n)return e.abort(),void f({error:n});s=t.theirPublic,c=t.myCurve}))}).nThen(()=>{var r,o=i.Curve.deriveKeys(s,c),a=i.Curve.createEncryptor(o),l={network:n.store.network,channel:t.channel,noChainPad:!0,crypto:a,owners:[]},d=[];f=e.both(function(){r&&"function"==typeof r.stop&&r.stop()},f),l.onMessage=function(e,n,t,r,o,a,i){var s=i&&i.time;try{e=JSON.parse(e)}catch(e){return void console.error(e)}e.time=s,a&&(e.author=a),d.push(e)},l.onError=f,l.onChannelError=f,l.onReady=function(){f(null,d)},r=u.start(l)})},y=function(t,r,o,s){var c=e.find(t,["store","mailbox"]),u=e.find(t,["store","anon_rpc"]);if(c)if(u){var f,l,d,h=r.channel,v=r.title,y=r.ticket,m=+new Date;a(e=>{p(t,o,r,e((n,t)=>{if(n)return e.abort(),void s({error:n});f=t.supportKey,l=t.theirPublic,d=t.myCurve}))}).nThen(e=>{var n=i.Curve.deriveKeys(l,d),t=i.Curve.createEncryptor(n),r=JSON.stringify(y),o=t.encrypt(r);u.send("WRITE_PRIVATE_MESSAGE",[h,o],e((n,t)=>{if(n)return e.abort(),void s({error:n});m=t&&t[0]}))}).nThen(e=>{if(o){var n=t.adminDoc.proxy.tickets.active;if(n[h])return e.abort(),void s({error:"EEXISTS"});n[h]={title:y.title,restored:y.legacy,premium:!1,time:m,author:r.name,supportKey:f,lastAdmin:!0,authorKey:r.curvePublic,notifications:r.notifications}}}).nThen(e=>{o||(t.supportData[h]={time:+new Date,title:v,curvePublic:f},t.Store.onSync(null,e()))}).nThen(()=>{var a=o?r.notifications:n.getChannelIdFromKey(f);c.sendTo("NEW_TICKET",{title:v,channel:h,time:m,isAdmin:o,supportKey:f,premium:o?"":e.find(t,["store","account","plan"]),user:e.find(r.ticket,["sender","curvePublic"])?void 0:{supportTeam:!0}},{channel:a,curvePublic:l},e=>{console.error(e),e&&e.error&&delete t.supportData[h],s(e)}),c.sendTo("NOTIF_TICKET",{title:v,channel:h,time:m,isAdmin:o,isNewTicket:!0,user:e.find(r.ticket,["sender","curvePublic"])?void 0:{supportTeam:!0}},{channel:a,curvePublic:l},()=>{})})}else s({error:"anonymous rpc session not ready"});else s({error:"E_NOT_READY"})},m=function(t,r,o,s){var c,u,f,l,d=e.find(t,["store","mailbox"]),h=e.find(t,["store","anon_rpc"]);d?h?r?.ticket?a(e=>{p(t,o,r,e((n,t)=>{if(n)return e.abort(),void s(n);c=t.theirPublic,u=t.myCurve,f=t.notifKey}))}).nThen(e=>{var n=i.Curve.deriveKeys(c,u),t=i.Curve.createEncryptor(n),o=JSON.stringify(r.ticket),a=t.encrypt(o);h.send("WRITE_PRIVATE_MESSAGE",[r.channel,a],e((n,t)=>{if(n)return e.abort(),void s(n);l=t&&t[0],s(void 0,l)}))}).nThen(()=>{var t=o?r.notifChannel:n.getChannelIdFromKey(f);t&&d.sendTo("NOTIF_TICKET",{isAdmin:o,title:r.ticket.title,isClose:r.ticket.close,channel:r.channel,time:l,user:e.find(r.ticket,["sender","curvePublic"])?void 0:{supportTeam:!0}},{channel:t,curvePublic:f},()=>{})}):s("E_NO_DATA"):s("anonymous rpc session not ready"):s("E_NOT_READY")},g=function(t,r,o){var a=n.getSecrets("support",r),u={data:{},channel:a.channel,crypto:i.createEncryptor(a.keys),userName:"support",ChainPad:c,classic:!0,network:t.store.network,metadata:{validateKey:a.keys.validateKey||void 0}},f=t.adminDoc=s.create(u);f.proxy.on("ready",function(){var r=f.proxy;if(r.tickets=r.tickets||{},r.tickets.active=r.tickets.active||{},r.tickets.closed=r.tickets.closed||{},r.tickets.pending=r.tickets.pending||{},t.adminRdyEvt.fire(),o(),!t.supportRpc)return;let a=function(n){if(!n.adminDoc||!n.supportRpc)return;let t=n.adminDoc.metadata&&n.adminDoc.metadata.channel,r=n.adminDoc.proxy.tickets,o=[t,...Object.keys(r.active),...Object.keys(r.pending),...Object.keys(r.closed)];return e.deduplicateString(o).sort()}(t),i=n.hashChannelList(a);t.supportRpc.getServerHash(function(e,n){e?console.warn(e):n!==i&&t.supportRpc.reset(a,function(e){e&&console.warn(e)})})}),f.proxy.on("change",["recorded"],function(){h(t,!0,"RECORDED_CHANGE","")}),f.proxy.on("remove",["recorded"],function(){h(t,!0,"RECORDED_CHANGE","")})},E=function(t,o,i){let s=i(),c=t.store.proxy,u=e.find(c,["mailboxes","supportteam","keys","curvePublic"]),f=e.find(c,["mailboxes","supportteam","keys","curvePrivate"]);o||(t.adminRdyEvt=e.mkEvent(!0)),a(e=>{p(t,!1,{},e((n,r)=>{if(setTimeout(s),n)e.abort();else if(r.theirPublic!==u){try{delete c.mailboxes.supportteam,t.store.mailbox.close("supportteam")}catch(e){}return delete t.adminRdyEvt,void e.abort()}}))}).nThen(n=>{!function(n,t){let o,a,i=e.mkAsync(t),s=n.store.proxy,c=e.find(s,["mailboxes","supportteam","keys","curvePrivate"]);if(c){try{let n=d.sign.keyPair.fromSeed(e.decodeBase64(c));o=e.encodeBase64(n.secretKey),a=e.encodeBase64(n.publicKey)}catch(e){return void i(e)}r.create(n.store.network,{edPublic:a,edPrivate:o},(e,t)=>{e?i(e):(console.log("Support RPC ready, public key is ",a),n.supportRpc=t,i())})}else i("EFORBIDDEN")}(t,n(e=>{e&&console.error("Support RPC not ready",e)}))}).nThen(e=>{let r=f.slice(0,24),o=n.getEditHashFromKeys({version:2,type:"support",keys:{editKeyStr:r}});g(t,o,e())}).nThen(()=>{console.log("Support admin loaded")})};var b=function(n,t,r,o){let a=n.store.proxy,i=e.find(a,["mailboxes","supportadmin"]);i?n.store.mailbox.open("supportadmin",i,function(t){n.store.mailbox.close("supportadmin",function(){});let r=e.clone(t||{}),a=[];Object.keys(r).forEach(e=>{let t=r[e];if("CLOSE"===t.type)return void(a.includes(t.content.id)||a.push(t.content.id));let o=t.author,i=t.content&&t.content.title;((e,n,t)=>{let r=e.adminDoc.proxy;return["active","pending","closed"].some(e=>{let o=r.tickets[e];return Object.keys(o).some(e=>{let r=o[e];return r.authorKey===n&&r.title===t&&r.restored})})})(n,o,i)&&(a.includes(t.content.id)||a.push(t.content.id))}),Object.keys(r).forEach(e=>{let n=r[e];n.content&&a.includes(n.content.id)&&delete r[e]}),o(r)},!0,{dump:!0}):o({error:"ENOENT"})};let O=(n,t,r,o)=>{let a;try{let n=d.sign.keyPair.fromSeed(e.decodeBase64(r));a=e.encodeBase64(n.publicKey)}catch(e){return void o(e)}n.Store.adminRpc(null,{cmd:"ADMIN_DECREE",data:["SET_SUPPORT_KEYS",[t,a]]},o)},A=(e,n,t,r)=>{e.Store.adminRpc(null,{cmd:"GET_MODERATORS",data:{}},r)};return f.init=function(r,i,s){var c={};if(r.store&&r.store.modules&&r.store.modules.support)return r.store.modules.support;var u=r.store,f=u.proxy.support=u.proxy.support||{},g={moderatorKeys:l.moderatorKeys,adminKeys:l.adminKeys,supportData:f,store:r.store,Store:r.Store,emit:s,clients:{}};return e.find(u,["proxy","mailboxes","supportteam"])&&E(g,!1,i),c.ctx=g,c.removeClient=function(e){delete g.clients[e]},c.leavePad=function(){},c.addAdminTicket=function(e,n){!function(e,n,r){e.adminRdyEvt?e.adminRdyEvt.reg(()=>{let o;a(t=>{p(e,!0,n,t((e,n)=>{if(e)return t.abort(),void r(!0);o=n.supportKey}))}).nThen(()=>{var a=Math.floor(2e3*Math.random());setTimeout(()=>{var a=e.adminDoc.proxy;a.tickets.active[n.channel]||a.tickets.closed[n.channel]||a.tickets.pending[n.channel]?r(!0):(a.tickets.active[n.channel]={title:n.title,premium:n.premium,time:n.time,author:n.user&&n.user.displayName,supportKey:n.supportKey||o,authorKey:n.user&&n.user.curvePublic},t.whenRealtimeSyncs(e.adminDoc.realtime,function(){r(!0)}),h(e,!0,"NEW_TICKET",n.channel),e.supportRpc&&e.supportRpc.pin([n.channel],()=>{}))},a)})}):r(!0)}(g,e,n)},c.updateAdminTicket=function(e){!function(e,n){e.adminRdyEvt&&e.adminRdyEvt.reg(()=>{var t=Math.floor(2e3*Math.random());setTimeout(()=>{var t=e.adminDoc.proxy;let r=t.tickets.active[n.channel]||t.tickets.pending[n.channel];r&&(n.time<=r.time||(n.isClose&&(t.tickets.closed[n.channel]=r,delete t.tickets.active[n.channel],delete t.tickets.pending[n.channel]),r.time=n.time,r.lastAdmin=!1,h(e,!0,"UPDATE_TICKET",n.channel)))},t)})}(g,e)},c.updateAdminKey=function(t,r){((t,r,o)=>{let i=r.supportKey,s=n.getBoxPublicFromSecret(i),c=t.store.proxy;const u=e.find(c,["mailboxes","supportteam","keys","curvePrivate"]),f=e.find(c,["mailboxes","supportteam","keys","curvePublic"]);p(t,!1,{},(n,r)=>{if(n)return void o(!0);if(s!==r.theirPublic)return void o(!0);if(u===i||f===s)return void o(!0);let c=e.find(t,["store","mailbox"]);try{t.adminDoc&&t.adminDoc.stop(),c&&c.close("supportteam"),t.supportRpc&&t.supportRpc.destroy(),t.adminRdyEvt=e.mkEvent(!0)}catch(e){console.error(e)}t.Store.addAdminMailbox(null,{version:2,priv:i},e=>{e&&e.error?o(!0):a(e=>{E(t,!0,e),t.adminRdyEvt.reg(()=>{h(t,!0,"UPDATE_RIGHTS"),o(!1)})})})})})(g,t,r)},c.checkAdminTicket=function(e,n){!function(e,n,t){e.adminRdyEvt?e.adminRdyEvt.reg(()=>{let r=e.adminDoc.proxy,o=r.tickets.active[n.channel]||r.tickets.pending[n.channel];t(o)}):t(!0)}(g,e,n)},c.addUserTicket=function(e,n){!function(e,n,t){if(!e.supportData)return void t(!0);let r=n.channel;e.supportData[r]={time:n.time,title:n.title,curvePublic:n.supportKey},e.Store.onSync(null,function(){t(!0)})}(g,e,n)},c.updateUserTicket=function(e){!function(e,n){if(h(e,!1,"UPDATE_TICKET",n.channel),n.isClose){let t=e.supportData[n.channel];if(!t)return;t.closed=!0}}(g,e)},c.execCommand=function(r,i,s){var c=i.cmd,u=i.data;"MAKE_TICKET"!==c?"GET_MY_TICKETS"!==c?"REPLY_TICKET"!==c?"CLOSE_TICKET"!==c?"DELETE_TICKET"!==c?"MAKE_TICKET_ADMIN"!==c?"LIST_TICKETS_ADMIN"!==c?"LOAD_TICKET_ADMIN"!==c?"REPLY_TICKET_ADMIN"!==c?"CLOSE_TICKET_ADMIN"!==c?"MOVE_TICKET_ADMIN"!==c?"GET_RECORDED"!==c?"SET_RECORDED"!==c?"USE_RECORDED"!==c?"SEARCH_ADMIN"!==c?"FILTER_TAGS_ADMIN"!==c?"SET_TAGS_ADMIN"!==c?"GET_LEGACY"!==c?"DUMP_LEGACY"!==c?"CLEAR_LEGACY"!==c?"RESTORE_LEGACY"!==c?"GET_PRIVATE_KEY"!==c?"DISABLE_SUPPORT"!==c?"ROTATE_KEYS"!==c?"ADD_MODERATOR"!==c?s({error:"NOT_SUPPORTED"}):function(n,t,r,o){let a=n.store.proxy;var i=e.find(n,["store","mailbox"]);let s=e.find(a,["mailboxes","supportteam","keys","curvePublic"]),c=e.find(a,["mailboxes","supportteam","keys","curvePrivate"]),u=e.find(a,["mailboxes","supportteam","lastKnownHash"]),f=a.edPublic;p(n,!1,{},(e,r)=>{e?o({error:e}):r.theirPublic===s&&n.moderatorKeys.includes(f)?i.sendTo("ADD_MODERATOR",{supportKey:c,lastKnownHash:u},{channel:t.mailbox,curvePublic:t.curvePublic},()=>{o()}):o({error:"EFORBIDDEN"})})}(g,u,0,s):function(t,r,i,s){let c,u=e.once(e.mkAsync(s)),f=t.store.proxy,l=f.edPublic;const h=d.box.keyPair(),v=e.encodeBase64(h.publicKey),y=e.encodeBase64(h.secretKey),m=e.find(f,["mailboxes","supportteam","keys","curvePrivate"]),g=e.find(f,["mailboxes","supportteam","keys","curvePublic"]);if(!y||!v)return void u({error:"INVALID_KEY"});let b;a(e=>{p(t,!1,{},e((n,t)=>{if("E_NOT_INIT"!==n)return n?(u({error:n}),void e.abort()):void(c=t.theirPublic)}))}).nThen(e=>{if(!t.adminKeys.includes(l))return e.abort(),void u({error:"EFORBIDDEN"})}).nThen(e=>{if(c)return t.moderatorKeys.includes(l)?g!==c?(e.abort(),void u({error:"EFORBIDDEN"})):void 0:(e.abort(),void u({error:"EINVAL"}))}).nThen(e=>{c&&t.adminRdyEvt.reg(()=>{let r=t.adminDoc.proxy;b=t.adminDoc.metadata&&t.adminDoc.metadata.channel;let a=y.slice(0,24),i=n.getEditHashFromKeys({version:2,type:"support",keys:{editKeyStr:a}}),s={network:t.store.network,initialState:"{}"};(r.oldKeys=r.oldKeys||{})[g]={curvePrivate:m,rotatedOn:+new Date,rotatedBy:l},o.put(i,JSON.stringify(r),e(n=>{if(n)return e.abort(),void u({error:n})}),s)})}).nThen(e=>{O(t,v,y,e(n=>{if(n&&n.error)return e.abort(),void u(n)}))}).nThen(()=>{if(!c)return;t.adminDoc&&t.adminDoc.stop();let n=e.find(t,["store","mailbox"]);n&&n.close("supportteam"),t.supportRpc&&t.supportRpc.destroy(),t.adminRdyEvt=e.mkEvent(!0)}).nThen(e=>{t.Store.addAdminMailbox(null,{version:2,priv:y},e(n=>{if(n&&n.error)return e.abort(),c?O(t,g,m,()=>{u(n)}):void u(n)}))}).nThen(n=>{if(!c)return;let r=e.find(t,["store","mailbox"]);A(t,0,0,n(e=>{if(e&&e.error)return void u({success:!0,noNotify:!0});let n=e&&e[0];Object.keys(n||{}).forEach(e=>{let t=n[e];r.sendTo("MODERATOR_NEW_KEY",{supportKey:y},{channel:t.mailbox,curvePublic:t.curvePublic},()=>{})})}))}).nThen(e=>{E(t,!0,e)}).nThen(e=>{b&&t.Store.adminRpc(null,{cmd:"ARCHIVE_DOCUMENT",data:{id:b,reason:"Deprecated support pad"}},e())}).nThen(()=>{u({success:!0})})}(g,0,0,s):function(n,t,r,o){let i,s=e.once(e.mkAsync(o)),c=n.store.proxy.edPublic;a(e=>{p(n,!1,{},e(n=>{if(n)return s({error:n}),void e.abort()}))}).nThen(e=>{if(!n.adminKeys.includes(c))return e.abort(),void s({error:"EFORBIDDEN"})}).nThen(e=>{n.Store.adminRpc(null,{cmd:"ARCHIVE_SUPPORT",data:{}},e(n=>{if(n&&n.error)return e.abort(),void s(n)}))}).nThen(e=>{n.Store.adminRpc(null,{cmd:"ADMIN_DECREE",data:["SET_SUPPORT_KEYS",["",""]]},e(function(n){if(n&&n.error)return e.abort(),void s(n)}))}).nThen(e=>{A(n,0,0,e(n=>{if(!n||n.error)return e.abort(),void s();i=n[0]||{}}))}).nThen(()=>{let e=a;Object.keys(i).forEach(t=>{e=e(e=>{n.Store.adminRpc(null,{cmd:"REMOVE_MODERATOR",data:t},e(e=>{e&&e.error&&console.error("Error removing moderator data",t,e.error)}))}).nThen}),e(()=>{s()})})}(g,0,0,s):function(n,t,r,o){let a=n.store.proxy,i=e.find(a,["mailboxes","supportteam","keys","curvePublic"]),s=e.find(a,["mailboxes","supportteam","keys","curvePrivate"]);p(n,!1,{},(e,n)=>{e?o({error:e}):(i&&n.theirPublic!==i&&(s=void 0),o({curvePrivate:s,curvePublic:n.theirPublic}))})}(g,0,0,s):function(t,r,o,a){let i=t.store.proxy,s=e.find(i,["mailboxes","supportadmin"]);if(!s)return void a({error:"ENOENT"});if(!t.adminRdyEvt)return void a({error:"EFORBIDDEN"});let c=r.messages,u=r.hashes,f=c[0],l=c[c.length-1];f?t.adminRdyEvt.reg(()=>{let r={name:e.find(f,["sender","name"]),notifications:e.find(f,["sender","notifications"]),curvePublic:e.find(f,["sender","curvePublic"]),channel:n.createChannelId(),title:f.title,time:l.time,ticket:{legacy:!0,title:f.title,sender:f.sender,messages:c}};y(t,r,!0,e=>{e&&e.error?a(e):(u.forEach(e=>{s.viewed.push(e)}),t.Store.onSync(null,function(){a({done:!0})}))})}):a({error:"EINVAL"})}(g,u,0,s):function(e,n,t,r){let o=e.store.proxy;e.store.mailbox.close("supportadmin",function(){delete o.mailboxes.supportadmin,e.Store.onSync(null,function(){r({done:!0})})})}(g,0,0,s):function(n,t,r,o){let a=n.store.proxy,i=e.find(a,["mailboxes","supportadmin"]);if(!i)return void o({error:"ENOENT"});let s=e.clone(i);s.lastKnownHash=void 0,s.viewed=[],n.store.mailbox.open("supportadmin",s,function(e){n.store.mailbox.close("supportadmin",function(){}),o(e)},!0,{dump:!0})}(g,0,0,s):b(g,0,0,s):((e,n,r,o)=>{e.adminRdyEvt?e.adminRdyEvt.reg(()=>{let r=e.adminDoc.proxy.tickets,a=n.channel;(r.active[a]||r.pending[a]||r.closed[a]).tags=n.tags||[],t.whenRealtimeSyncs(e.adminDoc.realtime,function(){let e=[];["active","pending","closed"].forEach(n=>{let t=r[n];Object.keys(t).forEach(n=>{(t[n].tags||[]).forEach(n=>{e.includes(n)||e.push(n)})})}),o({done:!0,allTags:e})})}):o({error:"EFORBIDDEN"})})(g,u,0,s):((e,n,t,r)=>{if(!e.adminRdyEvt)return void r({error:"EFORBIDDEN"});let o=n.tags||[];e.adminRdyEvt.reg(()=>{let n=e.adminDoc.proxy.tickets;if(!o.length)return void r({all:!0});let t=[];["active","pending","closed"].forEach(e=>{let r=n[e];Object.keys(r).forEach(e=>{(r[e].tags||[]).some(e=>o.includes(e))||t.push(e)})}),r({tickets:t})})})(g,u,0,s):((n,t,r,o)=>{if(!n.adminRdyEvt)return void o({error:"EFORBIDDEN"});let a=t.tags||[],i=(t.text||"").toLowerCase();n.adminRdyEvt.reg(()=>{let t=n.adminDoc.proxy.tickets,r={},s=(n,t,o)=>{let a=e.clone(t);a.category=o,r[n]=a};["active","pending","closed"].some(n=>{let o=t[n];return Object.keys(o).some(t=>{let c=o[t];if(a.length&&!(c.tags||[]).some(e=>a.includes(e)))return;let u=e.hexToBase64(t).slice(0,10);if(i===u)return r={},s(t,c,n),!0;(!i||c.title.toLowerCase().includes(i))&&s(t,c,n)})}),o({tickets:r})})})(g,u,0,s):function(e,n,t,r){if(!e.adminRdyEvt)return void r({error:"EFORBIDDEN"});let o=n.id;e.adminRdyEvt.reg(()=>{let n=e.adminDoc.proxy,t=(n.recorded=n.recorded||{})[o];t&&(t.count=(t.count||0)+1),r()})}(g,u,0,s):function(e,n,r,o){if(!e.adminRdyEvt)return void o({error:"EFORBIDDEN"});let a=n.id,i=n.content,s=Boolean(n.remove);e.adminRdyEvt.reg(()=>{let n=e.adminDoc.proxy,r=n.recorded=n.recorded||{};s?delete r[a]:r[a]={content:i,count:0},t.whenRealtimeSyncs(e.adminDoc.realtime,function(){o({done:!0})})})}(g,u,0,s):function(n,t,r,o){n.adminRdyEvt?n.adminRdyEvt.reg(()=>{let t=n.adminDoc.proxy,r=t.recorded=t.recorded||{};o({messages:e.clone(r)})}):o({error:"EFORBIDDEN"})}(g,0,0,s):function(e,n,r,o){if(!e.adminRdyEvt)return void o({error:"EFORBIDDEN"});let a=n.channel,i=n.from,s=n.to;e.adminRdyEvt.reg(()=>{let n=e.adminDoc.proxy,r=n.tickets[i],c=n.tickets[s];if(!i||!s)return void o({error:"EINVAL"});let u=r[a];u&&!c[a]?(c[a]=u,delete r[a],t.whenRealtimeSyncs(e.adminDoc.realtime,function(){o({moved:!0})})):o({error:"CANT_MOVE"})})}(g,u,0,s):function(e,n,r,o){if(!e.adminRdyEvt)return void o({error:"EFORBIDDEN"});let a=n.supportKey;e.adminRdyEvt.reg(()=>{let r=e.adminDoc.proxy;r.oldKeys&&r.oldKeys[a]&&(n.adminCurvePrivate=r.oldKeys[a].curvePrivate),m(e,n,!0,r=>{if(r)o({error:r});else{var a=e.adminDoc.proxy,i=a.tickets.active[n.channel]||a.tickets.pending[n.channel];i.time=+new Date,i.lastAdmin=!0,a.tickets.closed[n.channel]=i,delete a.tickets.active[n.channel],delete a.tickets.pending[n.channel],t.whenRealtimeSyncs(e.adminDoc.realtime,function(){o({closed:!0})})}})})}(g,u,0,s):function(e,n,t,r){if(!e.adminRdyEvt)return void r({error:"EFORBIDDEN"});let o=n.supportKey;e.adminRdyEvt.reg(()=>{let t=e.adminDoc.proxy;t.oldKeys&&t.oldKeys[o]&&(n.adminCurvePrivate=t.oldKeys[o].curvePrivate),m(e,n,!0,(t,o)=>{if(t)r({error:t});else{var a=e.adminDoc.proxy,i=a.tickets.active[n.channel]||a.tickets.pending[n.channel];i.time=o,i.lastAdmin=!0,r({sent:!0})}})})}(g,u,0,s):function(n,t,r,o){let a=t.supportKey;n.adminRdyEvt.reg(()=>{let r=n.adminDoc.proxy;r.oldKeys&&r.oldKeys[a]&&(t.adminCurvePrivate=r.oldKeys[a].curvePrivate),v(n,t,!0,function(r,a){if(r)return void o({error:r});var i=n.adminDoc.proxy;if(!Array.isArray(a)||!a.length)return void o(a);a.sort((e,n)=>e.time-n.time);let s=a[a.length-1],c=a.some(n=>{let r=e.find(n,["sender","curvePublic"]);if(t.curvePublic===r)return e.find(n,["sender","quota","plan"])});var u=i.tickets.active[t.channel];u&&(s.legacy&&(s=Array.isArray(s.messages)&&s.messages[s.messages.length-1]),u.time=s.time,u.premium=c,s.sender&&(u.lastAdmin=!s.sender.blockLocation),s.close&&(i.tickets.closed[t.channel]=u,delete i.tickets.active[t.channel],h(n,!0,"UPDATE_TICKET",t.channel))),o(a)})})}(g,u,0,s):function(n,t,r,o){n.adminRdyEvt?(n.clients[r]||(n.clients[r]={admin:!0}),n.adminRdyEvt.reg(()=>{var r=n.adminDoc.proxy;return"pending"===t.type?o(e.clone(r.tickets.pending)):"closed"===t.type?o(e.clone(r.tickets.closed)):void o(e.clone(r.tickets.active))})):o({error:"EFORBIDDEN"})}(g,u,r,s):function(e,n,t,r){e.adminRdyEvt?e.adminRdyEvt.reg(()=>{y(e,n,!0,r)}):r({error:"EFORBIDDEN"})}(g,u,0,s):function(e,n,t,r){let o=e.supportData,a=n.channel;o[a]&&o[a].closed?(delete o[a],r({deleted:!0})):r({error:"ENOTCLOSED"})}(g,u,0,s):function(e,n,t,r){m(e,n,!1,e=>{r(e?{error:e}:{closed:!0})})}(g,u,0,s):function(e,n,t,r){m(e,n,!1,e=>{r(e?{error:e}:{sent:!0})})}(g,u,0,s):function(n,t,r,o){var i=[],s=a;n.clients[r]||(n.clients[r]={admin:!1}),Object.keys(n.supportData).forEach(function(t){s=s(r=>{var o=e.clone(n.supportData[t]);v(n,{channel:t,curvePublic:o.curvePublic},!1,r((e,r)=>{if(e){if("EDELETED"===e.type)return void delete n.supportData[t];o.error=e}else o.messages=r,r.length&&r[r.length-1].close&&(n.supportData[t].closed=!0,o.closed=!0);o.id=t,i.push(o)}))}).nThen}),s(()=>{i.sort((e,n)=>e.closed&&n.closed?e.time-n.time:e.closed?1:n.closed?-1:e.time-n.time),o({tickets:i})})}(g,0,r,s):function(e,n,t,r){y(e,n,!1,r)}(g,u,0,s)},c},f})(Z(),te(),je(),In(),xn(),qe(),M(),T(),x(),D()),pt}function Mt(){if(mt)return yt;mt=1;var e,n,t;return e=M(),t=function(n,t,r,o){var a=t.channel,i=t.secret;i.keys.cryptKey&&(i.keys.cryptKey=function(e){for(var n=Object.keys(e).length,t=new Uint8Array(n),r=0;r{e.pending[n.uid]?(delete e.pending[n.uid],r(t)):setTimeout(r,1e3)}),e.emit("MESSAGE",i,a.clients.filter(function(e){return e!==t}))}else r({error:"NO_CHAN"})}else r({error:"NO_CLIENT"})}(a,i,e,r):t(a,i,e,r)},o},yt=n}function Ft(){if(Et)return gt;Et=1;var e,n;return n=function(e,n,t){var r=e.clients[n];if(r){var o=e.channels[r.channel];o?(t(),o.history.forEach(function(t){e.emit("MESSAGE",{msg:t,validateKey:o.validateKey},[n])}),e.emit("HISTORY_SYNCED",{},[n])):t({error:"ENOCHAN"})}else t({error:"ENOENT"})},(e={}).init=function(e,t){var r={},o={store:e,emit:t,channels:{},clients:{}};return r.removeClient=function(e){!function(e,n){var t,r=function(e){return e!==n};for(var o in e.channels)(t=e.channels[o]).clients=t.clients.filter(r),0===t.clients.length&&(t.wc&&t.wc.leave(),delete e.channels[o]);if(e.clients[n]){var a=e.clients[n].channel,i=e.channels[a];i&&e.emit("LEAVE",{id:n},[i.clients[0]]),delete e.clients[n]}}(o,e)},r.leavePad=function(e){!function(e,n){Object.keys(e.channels).some(function(t){var r=e.channels[t];if(r.padChan===n)return r.wc&&r.wc.leave(),delete e.channels[t],!0})}(o,e)},r.execCommand=function(e,t,r){var a=t.cmd,i=t.data;"SEND_MESSAGE"!==a?"UPDATE_HASH"!==a?"OPEN_CHANNEL"!==a?"GET_HISTORY"!==a?"REENCRYPT"!==a||function(e,n,t,r){var o=n.channel,a=e.store.network,i=function(e){var t=a.historyKeeper,o={metadata:n.metadata},i=["GET_HISTORY",e.id,o];a.sendto(t,JSON.stringify(i)),n.msgs.forEach(function(n){e.bcast(n)}),e.leave(),r()};e.store.anon_rpc.send("IS_NEW_CHANNEL",o,function(e,n){var t;e?r({error:e}):(n&&n.length&&"object"==typeof n[0]?t=n[0].isNew:r({error:"INVALID_RESPONSE"}),t?a.join(o).then(i,function(e){r({error:e})}):r({error:"EEXISTS"}))})}(o,i,0,r):n(o,e,r):function(e,t,r,o){var a=t.channel,i=t.padChan,s=e.store.network,c=!0,u=e.clients[r];if(u)o();else{u=e.clients[r]={channel:a};var f=e.channels[a];if(f)return u.id||(u.id=f.wc.myID+"-"+r),n(e,r,function(){e.emit("READY",f.clients,[r])}),f.clients.push(r),void o();var l=Math.floor(1e6*Math.random()),d=function(n){e.channels[a]=e.channels[a]||{history:[],validateKey:t.validateKey},(f=e.channels[a]).padChan=i,u.id||(u.id=n.myID+"-"+r),f.clients&&f.clients.forEach(function(t){e.clients[t]&&(e.clients[t].id=n.myID+"-"+t)}),n.on("join",function(){}),n.on("leave",function(){}),n.on("message",function(n){f.history.push(n),e.emit("MESSAGE",{msg:n,validateKey:f.validateKey},f.clients)}),f.wc=n,f.sendMsg=function(e,t){t=t||function(){};var r=e.slice(0,64);n.bcast(e).then(function(){f.history.push(e),f.lastKnownHash=r,t()},function(e){t({error:e})})},c&&(f.clients=[r],f.lastCpHash=t.lastCpHash,c=!1,o());var d=s.historyKeeper,h={txid:l,lastKnownHash:f.lastKnownHash||f.lastCpHash,metadata:{forcePlaceholder:!0,validateKey:t.validateKey,owners:t.owners,expire:t.expire}},p=["GET_HISTORY",n.id,h];d&&s.sendto(d,JSON.stringify(p)).then(function(){},function(e){console.error(e)})};s.on("message",function(n,t){if(e.channels[a]&&t===s.historyKeeper){var r;try{r=JSON.parse(n)}catch(e){}if(r&&!(r.txid&&r.txid!==l||r.channel&&r.channel!==a))if(r.validateKey&&r.channel)f.validateKey||(f.validateKey=r.validateKey);else if(r.state&&1===r.state&&r.channel)e.emit("READY",f.clients,f.clients);else if(r.error&&r.channel)e.emit("READY",f.clients,f.clients);else if(!(Array.isArray(r)&&r[0]&&r[0]!==l||(n=r[4],r[3]!==a))){var o=n.slice(0,64);o!==f.lastKnownHash&&o!==f.lastCpHash&&(f.lastKnownHash=o,e.emit("MESSAGE",{msg:n},f.clients),f.history.push(n))}}}),s.join(a).then(d,function(e){o({error:e})}),s.on("reconnect",function(){e.channels[a]&&s.join(a).then(d,function(e){console.error(e)})})}}(o,i,e,r):function(e,n,t,r){var o=e.clients[t];if(o){var a=e.channels[o.channel];if(a){var i=n,s=-1;a.history.some(function(e,n){if(e.slice(0,64)===i)return s=n+1,!0}),-1!==s&&(a.history=a.history.slice(s)),r()}else r({error:"INVALID_CHANNEL"})}else r({error:"NOT_IN_CHANNEL"})}(o,i,e,r):function(e,n,t,r){var o=e.clients[t];if(o){var a=e.channels[o.channel];if(a){var i=function(o){o&&o.error?r(o):(e.emit("MESSAGE",{msg:n.msg},a.clients.filter(function(e){return e!==t})),r())};n.isCp?a.sendMsg(n.isCp,i):a.sendMsg(n.msg,i)}else r({error:"INVALID_CHANNEL"})}else r({error:"NOT_IN_CHANNEL"})}(o,i,e,r)},r},gt=e}function Lt(){if(Ot)return bt;Ot=1;return bt=((e,n,t,r,o,a,i,s)=>{var c={};const u=e.mkEvent(!0);return c.init=function(c,f,l){var d={},h=c.store;if(h.loggedIn&&h.proxy.edPublic){var p={Store:c.Store,store:h,pinPads:c.pinPads,updateMetadata:c.updateMetadata,emit:l,onReadyHandlers:[],clients:[]};return p.profile=h.proxy.profile=h.proxy.profile||{},function(e,t){var r=e.profile;if(r.edit&&r.view)setTimeout(t);else{var o=n.createRandomHash("profile"),a=n.getSecrets("profile",o);e.pinPads([a.channel],function(e){e.error?t(e.error):(r.edit=n.getEditHashFromKeys(a),r.view=n.getViewHashFromKeys(a),setTimeout(t))})}}(p,f(function(r){r||function(r){var o=r.profile,c=n.getSecrets("profile",o.edit),f=i.createEncryptor(c.keys),l={data:{},network:r.store.network,channel:c.channel,crypto:f,owners:[r.store.proxy.edPublic],ChainPad:s,validateKey:c.keys.validateKey||void 0,userName:"profile",classic:!0},d=a.create(l);d.proxy.on("create",function(){}).on("ready",function(){if(d.proxy.name=r.store.proxy[t.displayNameKey]||"",r.listmap=d,d.proxy.curvePublic||(d.proxy.curvePublic=r.store.proxy.curvePublic),d.proxy.notifications||(d.proxy.notifications=e.find(r.store.proxy,["mailboxes","notifications","channel"])),d.proxy.edPublic||(d.proxy.edPublic=r.store.proxy.edPublic),!d.proxy.proof){let n=c.channel,t=e.decodeUTF8(n),o=e.decodeBase64(r.store.proxy.edPrivate),a=i.Nacl.sign(t,o),s=e.encodeBase64(a);d.proxy.proof=s}r.onReadyHandlers.length&&(r.onReadyHandlers.forEach(function(e){try{e(d.proxy)}catch(e){console.error(e)}}),r.onReadyHandlers=[]),u.fire()}).on("change",[],function(){r.emit("UPDATE",d.proxy,r.clients)})}(p)})),d.setName=function(e){!function(e,n){e.listmap.proxy.name=n,r.whenRealtimeSyncs(e.listmap.realtime,function(){e.listmap&&e.emit("UPDATE",e.listmap.proxy,e.clients)})}(p,e)},d.removeClient=function(e){!function(e,n){var t=e.clients.indexOf(n);-1!==t&&e.clients.splice(t,1)}(p,e)},d.update=function(){p.listmap&&p.emit("UPDATE",p.listmap.proxy,p.clients)},d.execCommand=function(e,n,t){console.log(n);var a=n.cmd,i=n.data;"SUBSCRIBE"!==a?"SET"!==a||function(e,n,t,a){u.reg(()=>{var i=n.key,s=n.value;i&&(e.listmap.proxy[i]=s,r.whenRealtimeSyncs(e.listmap.realtime,function(){e.emit("UPDATE",e.listmap.proxy,e.clients.filter(function(e){return e!==t})),"badge"===i&&e.Store.set(null,{key:["profile","badge"],value:s||void 0},()=>{o.updateMyData(e.store),e.updateMetadata()}),a(e.listmap.proxy)}))})}(p,i,e,t):function(e,n,t,r){-1===e.clients.indexOf(t)&&e.clients.push(t),e.listmap?r(e.listmap.proxy):e.onReadyHandlers.push(function(e){r(e)})}(p,0,e,t)},d}},c})(Z(),te(),Y(),je(),On(),T(),M(),x()),bt}function Ht(){if(wt)return At;wt=1;return At=function(e,n,t,r,o,a){var i={},s=function(e){return Boolean(e&&"object"==typeof e&&!Array.isArray(e))},c=function(e){return e.slice(0,64)},u=function(n,t){var r=e.find(t,[n,"role"]);return-1!==["OWNER","ADMIN"].indexOf(r)},f=function(n,t,r){var o=e.find(r,[n,"role"]);return!!o&&(!!function(e){return-1!==["OWNER","ADMIN","MEMBER","VIEWER"].indexOf(e)}(t)&&("OWNER"===o||"ADMIN"===o&&-1!==["ADMIN","MEMBER","VIEWER"].indexOf(t)))},l=function(e){return"string"==typeof e&&44===e.length},d=i.commands={};d.ADD=function(e,n,t){if(!s(e))throw new Error("INVALID ARGS");if(!t.internal.initialized)throw new Error("UNITIALIZED");if(void 0===t.state.members)throw new Error("CANNOT_ADD_TO_UNITIALIZED_ROSTER");var r=t.state.members;Object.keys(e).forEach(function(t){if(!l(t))throw console.log(t,t.length),new Error("INVALID_CURVE_KEY");if(!s(e[t]))throw new Error("INVALID_CONTENT");if(r[t])throw new Error("ALREADY_PRESENT");var o=e[t];if("string"!=typeof o.role&&(o.role="MEMBER"),!f(n,o.role,r))throw new Error("INSUFFICIENT_PERMISSIONS");if("string"!=typeof o.displayName)throw new Error("DISPLAYNAME_REQUIRED");if("string"!=typeof o.notifications)throw new Error("NOTIFICATIONS_REQUIRED")});var o=!1;return Object.keys(e).forEach(function(n){o=!0,r[n]=e[n]}),o},d.RM=function(n,t,r){if(!Array.isArray(n))throw new Error("INVALID_ARGS");if(void 0===r.state.members)throw new Error("CANNOT_RM_FROM_UNITIALIZED_ROSTER");var o=r.state.members;n.forEach(function(n){if(!l(n))throw new Error("INVALID_CURVE_KEY");if(n!==t){var r=o[n].role;if(!function(n,t,r){var o=e.find(r,[n,"role"]);return!!o&&("OWNER"===o||"ADMIN"===o&&-1!==["ADMIN","MEMBER","VIEWER"].indexOf(t))}(t,r,o))throw new Error("INSUFFICIENT_PERMISSIONS")}});var a=!1;return n.forEach(function(e){o[e]&&(a=!0,delete o[e])}),a},d.DESCRIBE=function(n,t,o){if(!n||"object"!=typeof n||Array.isArray(n))throw new Error("INVALID_ARGUMENTS");if(void 0===o.state.members)throw new Error("NOT_READY");var a=o.state.members;Object.keys(n).forEach(function(r){if(!l(r))throw new Error("INVALID_ID");if(!a[r])throw new Error("NOT_PRESENT");if(!function(n,t,r){if(!r[t])return!1;if(n===t&&r[t])return!0;var o=e.find(r,[n,"role"]),a=e.find(r,[t,"role"]);return!!o&&("OWNER"===o||"ADMIN"===o&&"OWNER"!==a)}(t,r,a))throw new Error("INSUFFICIENT_PERMISSIONS");var o=n[r];if(!s(o))throw new Error("INVALID_ARGUMENTS");var i=e.clone(a[r]);if("string"==typeof o.role&&!function(n,t,r,o){return!(n!==t||!o[t])&&("MEMBER"===e.find(o,[n,"role"])?"VIEWER"===r:void 0)}(t,r,o.role,a)&&!f(t,o.role,a))throw new Error("INSUFFICIENT_PERMISSIONS");if("string"!=typeof i.displayName&&"string"!=typeof o.displayName)throw new Error("DISPLAYNAME_REQUIRED");if(-1===["undefined","string"].indexOf(typeof o.displayName))throw new Error("INVALID_DISPLAYNAME");if("string"!=typeof i.notifications&&"string"!=typeof o.notifications)throw new Error("NOTIFICATIONS_REQUIRED");if(-1===["undefined","string"].indexOf(typeof o.notifications))throw new Error("INVALID_NOTIFICATIONS")});var i=!1;return Object.keys(n).forEach(function(t){var o=e.clone(a[t]),s=n[t];Object.keys(s).forEach(function(e){void 0===o[e]||null!==s[e]?o[e]=s[e]:delete o[e]}),r(o)!==r(a[t])&&(i=!0,a[t]=o)}),i},d.CHECKPOINT=function(e,n,t){if(!s(e))throw new Error("INVALID_CHECKPOINT_STATE");if(!t.internal.initialized){t.state=e;var o=t.state.metadata=t.state.metadata||{};return o.topic=o.topic||"",o.name=o.name||"",o.avatar=o.avatar||"",t.internal.initialized=!0,!0}if(r(e)!==r(t.state))throw new Error("CHECKPOINT_DOES_NOT_MATCH_PREVIOUS_STATE");if(!u(n,t.state.members))throw new Error("INSUFFICIENT_PERMISSIONS");return t.state=e,!0};var h=["avatar","name","topic"];d.METADATA=function(n,t,r){if(!s(n))throw new Error("INVALID_ARGS");if(!function(n,t){var r=e.find(t,[n,"role"]);return Boolean(r&&-1!==["OWNER","ADMIN"].indexOf(r))}(t,r.state.members))throw new Error("INSUFFICIENT_PERMISSIONS");Object.keys(n).forEach(function(e){if(null===n[e]){if(-1===h.indexOf(e))return;throw new Error("CANNOT_REMOVE_MANDATORY_METADATA")}if("string"!=typeof n[e])throw new Error("INVALID_ARGUMENTS")});var o=!1;return Object.keys(n).forEach(function(e){void 0!==r.state.metadata[e]&&null===n[e]&&(o=!0,delete r.state.metadata[e]),n[e]!==r.state.metadata[e]&&(o=!0,r.state.metadata[e]=n[e])}),o},d.INVITE=function(e,n,t){if(!s(e))throw new Error("INVALID_ARGS");if(!t.internal.initialized)throw new Error("UNINITIALIED");if(void 0===t.state.members)throw new Error("CANNOT+INVITE_TO_UNINITIALIED_ROSTER");var r=t.state.members;Object.keys(e).forEach(function(t){if(!l(t))throw console.log(t,t.length),new Error("INVALID_CURVE_KEY");if(!s(e[t]))throw new Error("INVALID_CONTENT");if(r[t])throw new Error("ARLEADY_PRESENT");var o=e[t];if("string"!=typeof o.role&&(o.role="VIEWER"),void 0===o.pending&&(o.pending=!0),!f(n,o.role,r))throw new Error("INSUFFICIENT_PERMISSIONS");if("string"!=typeof o.displayName||!o.displayName)throw new Error("DISPLAYNAME_REQUIRED")});var o=!1;return Object.keys(e).forEach(function(n){o=!0,r[n]=e[n]}),o},d.ACCEPT=function(n,t,r){if(!r.internal.initialized)throw new Error("UNINITIALIED");if(void 0===r.state.members)throw new Error("CANNOT_ADD_TO_UNINITIALIED_ROSTER");var o=r.state.members;if(!s(o[t]))throw new Error("INSUFFICIENT_PERMISSIONS");if(!o[t].pending)throw new Error("ALREADY_PRESENT");if("string"!=typeof n)throw new Error("INVALID_ARGS");if(!l(n))throw new Error("INVALID_CURVE_KEY");var a=n;if(void 0!==o[a])throw new Error("MEMBER_ALREADY_PRESENT");var i=e.clone(o[t]);delete i.remaining,delete i.totalUses,delete i.inviteChannel,delete i.previewChannel,o[a]=i;var c=o[t].remaining||1;return-1===c||(c>1?o[t].remaining=c-1:delete o[t]),!0};var p=function(e,n,t){if(!Array.isArray(e)||"string"!=typeof n)throw new Error("INVALID ARGUMENTS");var r=e[0];if("function"!=typeof d[r])throw new Error("INVALID_COMMAND");return d[r](e[1],n,t)},v=function(n,t,r){return p(n,t,e.clone(r))};return i.create=function(n,i){if("function"!=typeof i)throw new Error("EXPECTED_CALLBACK");var f=e.once(e.mkAsync(i));if(n.network)if(n.channel&&"string"==typeof n.channel&&32===n.channel.length)if(n.keys&&"object"==typeof n.keys)if(n.store){var d=e.response(function(e,n){console.error("ROSTER_RESPONSE__"+e,n)}),h=n.store,y=n.keys,m=y.myCurvePublic,g=n.channel,E=n.lastKnownHash||-1;n.newTeam&&(E=void 0);var b={state:{members:{},metadata:{}},internal:{initialized:!1,sinceLastCheckpoint:0,lastCheckpointHash:E}},O={},A={change:e.mkEvent(),checkpoint:e.mkEvent()};O.on=function(e,n){if("object"!=typeof A[e])throw new Error("unsupported event");return A[e].reg(n),O},O.off=function(e,n){if("object"!=typeof A[e])throw new Error("unsupported event");return A[e].unreg(n),O},O.once=function(e,n){if("object"!=typeof A[e])throw new Error("unsupported event");var t=function(){n.apply(null,Array.prototype.slice.call(arguments)),A[e].unreg(t)};return A[e].reg(t),O},O.getState=function(){return e.clone(b.state)},O.getLastCheckpointHash=function(){return b.internal.lastCheckpointHash||-1};var w=function(){b.internal.pendingCheckpointId&&(d.clear(b.internal.pendingCheckpointId),delete b.internal.pendingCheckpointId),clearTimeout(b.internal.checkpointTimeout),delete b.internal.checkpointTimeout};O.stop=function(){b.internal.cpNetflux&&"function"==typeof b.internal.cpNetflux.stop?(b.internal.cpNetflux.stop(),w()):console.log("FAILED TO LEAVE")};var D,_,T,S=!1,N=function(){if(n.onCacheReady){var e=b.state;if(Object.keys(e.members||{}).length)n.onCacheReady(O);else{try{b.internal.cpNetflux.resetCache()}catch(e){console.error(e)}n.onCacheReady({error:"CORRUPTED"})}}},I=function(){S=!0,f(void 0,O)},x=function(e){e&&"EUNKNOWN"===e.type||(S?console.error("CHANNEL_ERROR",e):f(e))},C=function(e){e.state||(S=!1)},R=function(){console.log("ROSTER CONNECTED")},P=function(){return Boolean(S&&m)},k=function(n,t,r,o,a,i){D!==a&&b.internal.sinceLastCheckpoint++,D=a;var s=e.tryParse(n);if(s){var f,l;try{f=p(s,i,b)}catch(e){l=e.message}var h=c(a);if(d.expected(h)){if(l)return void d.handle(h,[l]);try{f?d.handle(h,[void 0,O.getState()]):(d.handle(h,["NO_CHANGE"]),console.log(n))}catch(e){console.log("CAUGHT",e)}}if("CHECKPOINT"===s[0]&&f?(P()&&A.checkpoint.fire(a),b.internal.sinceLastCheckpoint=0,b.internal.lastCheckpointHash=a):f&&P()&&A.change.fire(),w(),P()&&function(e,n){if(!u(e,n.state.members))return!1;var t=n.internal.sinceLastCheckpoint;return!(!t||"number"!=typeof t||t<25)}(m,b)){var v=1e3*Math.floor(20*Math.random())+5e3;b.internal.checkpointTimeout=setTimeout(function(){b.internal.pendingCheckpointId=O.checkpoint(function(e){e&&console.error(e)})},v)}}else console.error("could not parse")},M=function(n,t){var r=e.tryParse(n);return"CHECKPOINT"===r[0]&&v(r,t,b)},F=function(e,n){if(P()){var t=h.anon_rpc;if(t){var o=!1;try{o=v(e,y.myCurvePublic,b)}catch(e){return void n(e.message)}if(o){var a=T.encrypt(r(e)),i=c(a);return d.expect(i,function(e,t){e?n(e):n(void 0,t,i)},3e4),t.send("WRITE_PRIVATE_MESSAGE",[g,a],function(e){if(e)return d.handle(i,[e.message||e])}),i}n("NO_CHANGE")}else n("ANON_RPC_NOT_READY")}else n("NOT_READY")};O.init=function(n,t){var r=e.once(e.mkAsync(t));if(b.internal.initialized)r("ALREADY_INITIALIZED");else if(s(n)){var o=e.clone(n);o.role="OWNER";var a={};a[m]=o,F(["CHECKPOINT",{members:a}],r)}else r("INVALID_ARGUMENTS")},O.checkpoint=function(n){var t=e.once(e.mkAsync(n));F(["CHECKPOINT",e.clone(b.state)],t)},O.add=function(n,t){var r=e.once(e.mkAsync(t));if(!b.internal.initialized)return r("UNINITIALIZED");if(s(n)){var o=e.clone(n);Object.keys(o).forEach(function(e){if(!l(e)||s(b.state.members[e]))return delete o[e]}),F(["ADD",o],r)}else r("INVALID_ARGUMENTS")},O.remove=function(n,t){var r=e.once(e.mkAsync(t)),o=b.state;if(!o)return r("UNINITIALIZED");if(Array.isArray(n)){var a=e.clone(n),i=[],s=Object.keys(o.members);a.forEach(function(e){-1!==s.indexOf(e)&&i.push(e)}),F(["RM",i],r)}else r("INVALID_ARGUMENTS")},O.describe=function(n,t){var r=e.once(e.mkAsync(t)),o=b.state;if(!o)return r("UNINITIALIZED");if(s(n)){var a=e.clone(n);Object.keys(a).some(function(e){var n=a[e];if(s(n)||delete a[e],!s(o.members[e]))return!0;Object.keys(n).forEach(function(t){n[t]===o.members[e][t]&&delete n[t]})})?r("INVALID_ARGUMENTS"):F(["DESCRIBE",a],r)}else r("INVALID_ARGUMENTS")},O.metadata=function(n,t){var r=e.once(e.mkAsync(t)),o=b.state.metadata;if(s(n)){var a=e.clone(n);Object.keys(a).forEach(function(e){a[e]===o[e]&&delete a[e]}),F(["METADATA",a],r)}else r("INVALID_ARGUMENTS")},O.invite=function(n,t){var r=e.once(e.mkAsync(t));if(!b.state)return r("UNINITIALIZED");if(!b.internal.initialized)return r("UNINITIALIZED");if(s(n)){var o=e.clone(n);Object.keys(o).forEach(function(e){if(!l(e)||s(b.state.members[e]))return delete o[e]}),F(["INVITE",o],r)}else r("INVALID_ARGUMENTS")},O.accept=function(n,t){var r=e.once(e.mkAsync(t));"string"==typeof n&&l(n)?F(["ACCEPT",n],r):r("INVALID_ARGUMENTS")},o(function(e){h.anon_rpc&&h.anon_rpc.send("GET_METADATA",g,function(n,t){if(n)return e.abort(),void console.error(n);_=b.internal.metadata=t&&t[0]||void 0})}).nThen(function(e){if(!n.keys.teamEdPublic&&_&&_.validateKey&&(n.keys.teamEdPublic=_.validateKey),!n.keys.teamEdPublic)return e.abort(),void f("NO_VALIDATE_KEY");try{T=a.Team.createEncryptor(n.keys)}catch(n){return e.abort(),void f(n)}}).nThen(function(){"string"==typeof E&&console.log("Synchronizing from checkpoint"),b.internal.cpNetflux=t.start({lastKnownHash:E,network:n.network,channel:n.channel,crypto:T,validateKey:n.keys.teamEdPublic,owners:n.owners,Cache:n.Cache,isCacheCheckpoint:M,onCacheReady:N,onChannelError:x,onReady:I,onConnect:R,onConnectionChange:C,onMessage:k,noChainPad:!0})})}else f("EXPECTED_STORE");else f("EXPECTED_CRYPTO_KEYS");else f("EXPECTED_CHANNEL");else f("EXPECTED_NETWORK")},i}(Z(),te(),D(),bn(),qe(),M()),At}function jt(){if(St)return Tt;St=1;return Tt=((e,n,t,r,o,a,i,s,c,u,f,l,d,h,p,v,y,m,g,E)=>{const b={};E=E||"undefined"!=typeof window&&window.nacl;var O=e.mkEvent(!0),A=function(){},w=function(e,t,r,o){t&&(o||(r.on("change",["drive",a.SHARED_FOLDERS],function(o,s,c){if(c.length>3&&"password"===c[3]){var u=c[2],f=r.drive[a.SHARED_FOLDERS][u],l=t.manager.user.userObject.getHref?t.manager.user.userObject.getHref(f):f.href,d=n.parsePadUrl(l),h=n.getSecrets(d.type,d.hash,o);return setTimeout(function(){i.updatePassword(e.Store,{oldChannel:h.channel,password:s,href:l},e.store.network,function(){console.log("Shared folder password changed")})}),!1}}),r.on("disconnect",function(){t.offline=!0,t.sendEvent("NETWORK_DISCONNECT",t.id)}),r.on("reconnect",function(){t.offline=!1,t.sendEvent("NETWORK_RECONNECT",t.id)})),r.on("change",[],function(n,r,i){if(o){if(i[0]===a.FILES_DATA&&"object"==typeof r&&r.channel&&!r.owners){var s=[r.channel];r.rtChannel&&s.push(r.rtChannel),r.lastVersion&&s.push(r.lastVersion),t.pin(s,function(e){e&&e.error&&console.error(e.error)})}if(i[0]===a.FILES_DATA&&"object"==typeof n&&n.channel&&!r){var c=[n.channel];t.manager.findChannel(n.channel).some(function(e){return e.fId!==o})||(n.rtChannel&&c.push(n.rtChannel),n.lastVersion&&c.push(n.lastVersion),t.unpin(c,function(e){e&&e.error&&console.error(e)}))}}n&&!r&&Array.isArray(i)&&(i[0]===a.FILES_DATA||"drive"===i[0]&&i[1]===a.FILES_DATA)&&setTimeout(function(){e.Store.checkDeletedPad(n&&n.channel)}),t.sendEvent("DRIVE_CHANGE",{id:o,old:n,new:r,path:i})}),r.on("remove",[],function(e,n){t.sendEvent("DRIVE_REMOVE",{id:o,old:e,path:n})}))},D=function(e,n){var t=e.teams[n];if(t){try{t.listmap.stop()}catch(e){}try{t.roster.stop()}catch(e){}t.proxy={},t.stopped=!0,t?.rpc?.destroy(),delete e.teams[n],delete e.cache[n],delete e.store.proxy.teams[n],e.emit("LEAVE_TEAM",n,t.clients),e.updateMetadata(),e.store.calendar&&e.store.calendar.closeTeam(n),e.store.mailbox&&e.store.mailbox.close("team-"+n,function(){})}},_=function(e,n,t,r){n.rpc?r():t.edPrivate&&t.edPublic?h.create(e.store.network,t,function(e,t){e?r(e):(n.rpc=t,n&&n.onRpcReadyEvt&&n.onRpcReadyEvt.fire(),r())},d):r("EFORBIDDEN")},T=function(t,r,a,s,c,u,f){var l=e.once(e.mkAsync(f));if(t.cache[r])l();else{var d=a.proxy,h={id:r,proxy:d,listmap:a,clients:[],realtime:a.realtime,handleSharedFolder:function(e,n){!function(e,n,t,r){var o=e.teams[n];o&&(r?(o.sharedFolders[t]=r,w(e,o,r.proxy,t)):delete o.sharedFolders[t])}(t,r,e,n)},sharedFolders:{},roster:s,onRpcReadyEvt:e.mkEvent(!0),offline:!0};t.cache[r]=h,u&&h.clients.push(u),s.on("change",function(){var n=s.getState(),o=e.find(t,["store","proxy","curvePublic"]);if(n.members&&Object.keys(n.members).length)if(n.members[o]){var a=e.find(t,["store","proxy","teams",r]);a&&(a.metadata=n.metadata),t.updateMetadata(),t.emit("ROSTER_CHANGE",r,h.clients)}else D(t,r);else console.error(JSON.stringify(n))}),s.on("checkpoint",function(n){e.find(t,["store","proxy","teams",r,"keys","roster"]).lastKnownHash=n}),h.sendEvent=function(e,n,r){t.emit(e,n,h.clients.filter(function(e){return e!==r}))},h.getChatData=function(){var e=c.chat||{},t=e.edit||e.view;if(!t)return{};var o=n.getSecrets("chat",t);return{teamId:r,channel:o.channel,secret:o,validateKey:e.validateKey}},h.pin=function(e,n){c.drive.edPrivate?h.rpc?("function"!=typeof n&&console.error("expected a callback"),h.rpc.pin(e,function(e,t){n(e?{error:e}:{hash:t})})):n({error:"TEAM_RPC_NOT_READY"}):n({error:"EFORBIDDEN"})},h.unpin=function(e,n){c.drive.edPrivate?h.rpc?("function"!=typeof n&&console.error("expected a callback"),h.rpc.unpin(e,function(e,t){n(e?{error:e}:{hash:t})})):n({error:"TEAM_RPC_NOT_READY"}):n({error:"EFORBIDDEN"})};var p=t.store.proxy.teams[h.id],v=p.hash||p.roHash,y=n.getSecrets("team",v,p.password),m=h.manager=o.create(d.drive,{onSync:function(e){t.Store.onSync(r,e)},edPublic:c.drive.edPublic,pin:h.pin,unpin:h.unpin,loadSharedFolder:function(e,n,r,o){i.load({isNew:o,network:t.store.network||t.store.networkPromise,store:h,isNewChannel:t.Store.isNewChannel,Store:t.Store},e,n,r)},settings:{drive:e.find(t.store,["proxy","settings","drive"])},removeOwnedChannel:function(e,n){var o;"object"==typeof e?(e.teamId=r,o=e):o={channel:e,teamId:r},t.Store.pad.destroy("",o,n)},Store:t.Store,store:t.store},{teamId:h.id,outer:!0,edPublic:c.drive.edPublic,loggedIn:!0,log:function(e){h.sendEvent("DRIVE_LOG",e)},rt:h.realtime,editKey:y.keys.secondaryKey,readOnly:Boolean(!y.keys.secondaryKey)});h.secondaryKey=y&&y.keys.secondaryKey,h.userObject=m.user.userObject,g(function(e){t.teams[r]=h,w(t,h,d);var n=t.store.network||t.store.networkPromise;i.loadSharedFolders(t.Store,n,h,h.proxy.drive,h.userObject,e,function(e){t.progress+=70/(t.numberOfTeams*e.max),t.updateProgress({progress:t.progress})},!0)}).nThen(function(){t.store.modules.calendar&&t.store.modules.calendar.openTeam(r),l()})}},S=function(t,r,o,a,s,c,u){var f,l=a.getState(),d=e.find(t,["store","proxy","teams",r]);d&&(d.metadata=l.metadata),delete t.nocache[r],t.store.proxy.teams[r]&&g(function(e){T(t,r,o,a,s,c,e()),f=t.teams[r]||t.cache[r],s.drive.edPrivate&&_(t,f,s.drive,e(function(){}))}).nThen(function(e){f.userObject.fixFiles(),i.checkMigration(f.secondaryKey,f.proxy?.drive,f.userObject,e()),i.loadSharedFolders(t.Store,t.store.network,f,f.proxy?.drive,f.userObject,e,function(e){t.progress+=70/(t.numberOfTeams*e.max),t.updateProgress({progress:t.progress})})}).nThen(function(){if(f.rpc){var o=function(n,t){var r=n.teams[t];if(!r)return null;var o=r.manager.getChannelsList("pin"),a=n.store.proxy.teams[t];o.push(`${a.channel}#drive`);var i=e.find(a,["keys","chat","channel"]),s=e.find(a,["keys","roster","channel"]),c=e.find(a,["keys","mailbox","channel"]);if(i&&o.push(i),s&&o.push(s),c&&o.push(c),r.proxy.calendars){var u=Object.keys(r.proxy.calendars).map(function(e){return r.proxy.calendars[e].channel});o=o.concat(u)}var f=r.roster.getState();return f.members&&Object.keys(f.members).forEach(function(e){var n=f.members[e];n.inviteChannel&&n.pending&&o.push(n.inviteChannel),n.previewChannel&&n.pending&&o.push(n.previewChannel)}),o.sort(),o}(t,r),a=n.hashChannelList(o);f.rpc.getServerHash(function(e,n){e?console.warn(e):n!==a&&f.rpc.reset(o,function(e){e&&console.warn(e)})})}}).nThen(function(){f.offline=!1,t.onReadyHandlers[r]&&t.onReadyHandlers[r].forEach(function(e){("function"==typeof e.cb&&e.cb(),e.cId)&&(-1===f.clients.indexOf(e.cId)&&f.clients.push(e.cId))}),delete t.onReadyHandlers[r],t.store.modules.calendar&&t.store.modules.calendar.openTeam(r),u()})},N=function(e,n,t,r,o,a){var i=function(){(e.cache[n]||e.teams[n])&&D(e,n),delete e.store.proxy.teams[n],delete e.onReadyHandlers[n],o.abort(),a({error:"ENOENT"})};t&&e.store.anon_rpc.send("IS_NEW_CHANNEL",t,o(function(e,n){n&&n.length&&"object"==typeof n[0]&&n[0].isNew&&i()})),r&&e.store.anon_rpc.send("IS_NEW_CHANNEL",r,o(function(e,n){n&&n.length&&"object"==typeof n[0]&&n[0].isNew&&i()}))},I=function(t,r,o,a,i){var f=e.once(e.mkAsync(a)),l=r.hash||r.roHash,h=n.getSecrets("team",l,r.password),y=v.createEncryptor(h.keys);r.roHash||(r.roHash=n.getViewHashFromKeys(h));var E,b,A=r.keys;if(!A.chat.validateKey&&A.chat.edit){var w=n.getSecrets("chat",A.chat.edit);A.chat.validateKey=w.keys.validateKey}var _={curvePublic:t.store.proxy.curvePublic,curvePrivate:t.store.proxy.curvePrivate},I=A.roster||{},x=I.edit?v.Team.deriveMemberKeys(I.edit,_):v.Team.deriveGuestKeys(I.view||"");g(function(e){if(i)return d.getChannelCache(h.channel,e(function(n,t){t&&t.c||(e.abort(),f({error:"NOCACHE"}))})),void d.getChannelCache(x.channel,e(function(n,t){var r=t&&t.c,o=t&&t.k;o&&!x.teamEdPublic&&(x.teamEdPublic=o),r||(e.abort(),f({error:"NOCACHE"}))}));t.Store.onReadyEvt.reg(()=>{N(t,o,h.channel,x.channel,e,f)})}).nThen(function(n){var a={lm:!1,roster:!1,check:function(){this.lm&&this.roster&&i&&(t.progress+=30/t.numberOfTeams,t.updateProgress({progress:t.progress}),T(t,o,b,E,A,null,n(f)),this.check=function(){})}},u={data:{},readOnly:!Boolean(h.keys.signKey),network:t.store.network||t.store.networkPromise,channel:h.channel,crypto:y,ChainPad:m,Cache:d,metadata:{validateKey:h.keys.validateKey||void 0},userName:"team",classic:!0,onMetadataUpdate:function(){var e=t.teams[o];e&&t.emit("ROSTER_CHANGE",o,e.clients)}};(b=p.create(u)).proxy.on("cacheready",function(){a.lm=!0,a.check()}),b.proxy.on("ready",n()),b.proxy.on("error",function(e){e&&void 0!==e.loaded&&!e.loaded&&f({error:"ECONNECT"}),e&&e.error&&"EDELETED"===e.error&&D(t,o)}),s.create({network:t.store.network||t.store.networkPromise,channel:x.channel,keys:x,store:t.store,lastKnownHash:I.lastKnownHash,onCacheReady:function(e){if(i){if(e&&"CORRUPTED"===e.error)return console.error("Corrupted roster cache, cant load this team offline",r),b&&"function"==typeof b.stop&&b.stop(),n.abort(),void f({error:"CACHE_CORRUPTED_ROSTER"});E=e,a.roster=!0,a.check()}},Cache:d},n(function(r,o){if(r)return n.abort(),console.error(r),void f({error:"ROSTER_ERROR"});E=o,I.lastKnownHash=E.getLastCheckpointHash();var a=E.getState(),i=e.find(t,["store","proxy","curvePublic"]);a.members[i]&&O.reg(function(){if(I.edit){var e={},n=c.createData(t.store.proxy,!1);n.pending=!1,e[t.store.proxy.curvePublic]=n,E.describe(e,function(e){e&&"NO_CHANGE"!==e&&console.error(e)})}})}))}).nThen(function(n){var a=E.getState(),i=e.find(t,["store","proxy","curvePublic"]);if(!a.members||!Object.keys(a.members).length)return b.stop(),E.stop(),b.proxy={},f({error:"EINVAL"}),n.abort(),console.error(JSON.stringify(a)),void u.send("ROSTER_CORRUPTED");if(!a.members[i])return b.stop(),E.stop(),b.proxy={},delete t.store.proxy.teams[o],t.updateMetadata(),f({error:"EFORBIDDEN"}),void n.abort();var s=a.members[i],c=e.find(r,["keys","drive","edPrivate"]);if(r.hash&&c||-1===["ADMIN","MEMBER"].indexOf(s.role))r.hash&&c||"OWNER"!==s.role||u.send("TEAM_RIGHTS_OWNER");else{console.warn("Missing edit rights: demote to viewer");var l={};l[t.store.proxy.curvePublic]={role:"VIEWER"},E.describe(l,function(e){u.send("TEAM_RIGHTS_FIXED"),delete r.hash,delete r.keys.drive.edPrivate,delete r.keys.chat.edit,e&&"NO_CHANGE"!==e&&console.error(e)})}}).nThen(function(){i||(t.progress+=30/t.numberOfTeams,t.updateProgress({progress:t.progress})),S(t,o,b,E,A,null,f)})},x=function(n,t,r,o){var a=t.team;if(!((a.hash||a.roHash)&&a.channel&&a.password&&a.keys&&a.metadata))return void o({error:"EINVAL"});let i=n.store.proxy.teams;if(Object.values(i).some(e=>e.channel===a.channel))o({error:"EEXISTS"});else{var s=e.createRandomInteger();n.store.proxy.teams[s]=a,n.onReadyHandlers[s]=[],I(n,a,s,function(e){e&&e.error||console.debug("Team joined:"+s);var t=n.store.proxy.teams[s];n.store.mailbox.open("team-"+s,t.keys.mailbox,function(){},!0,{owners:t.keys.drive.edPublic}),n.updateMetadata(),o(e)})}},C=function(n,t,r){var o=e.find(n,["store","proxy","teams",t]);if(!o)return{};var a=e.clone(o);return r||(delete a.hash,delete a.keys.drive.edPrivate,delete a.keys.chat.edit),delete a.owner,a},R=function(t,r,o){if(!r)return!0;var a=e.find(t,["store","proxy","teams",r]);if(!a)return!0;var s=t.teams[r];if(!s)return!0;var c=n.getSecrets("team",o||a.roHash,a.password);if(i.upgrade(a.channel,c),s.userObject&&s.userObject.setReadOnly(!c.keys.secondaryKey,c.keys.secondaryKey),c.keys.secondaryKey)try{t.store.modules.calendar.upgradeTeam(r)}catch(e){console.error(e)}!c.keys.secondaryKey&&s.rpc&&s.rpc.destroy();var u=e.find(s,["proxy","drive","sharedFolders"]);Object.keys(u||{}).forEach(function(t){var r=s.manager.getSharedFolderData(t),o=n.parsePadUrl(r.href||r.roHref),a=n.getSecrets(o.type,o.hash,r.password);i.upgrade(a.channel,a);var c=e.find(s,["manager","folders",t,"userObject"]);c&&c.setReadOnly(!a.keys.secondaryKey,a.keys.secondaryKey)}),t.updateMetadata(),t.emit("ROSTER_CHANGE_RIGHTS",r,s.clients)},P=function(t,r,o,a,i){if(r){var s=e.find(t,["store","proxy","teams",r]);if(s){var c=t.onReadyHandlers[r],u=t.teams[r];if(s.channel===a.channel&&s.password===a.password)if(o?(s.hash=a.hash,s.keys.drive.edPrivate=a.keys.drive.edPrivate,s.keys.chat.edit=a.keys.chat.edit):(delete s.hash,delete s.keys.drive.edPrivate,delete s.keys.chat.edit),u||!Array.isArray(c))if(u){if(o){_(t,u,s.keys.drive,function(){u.manager.addPin(u.pin,u.unpin)});var f=n.getSecrets("team",a.hash,s.password);u.secondaryKey=f&&f.keys.secondaryKey;var l=v.createEncryptor(f.keys);u.listmap.setReadOnly(!1,l)}else delete u.secondaryKey,u.rpc&&u.rpc.destroy&&u.rpc.destroy(),u.manager.removePin(),u.listmap.setReadOnly(!0);R(t,r,a.hash),i(!0)}else i(!1);else c.push({cb:function(){P(t,r,o,a,i)}});else i(!1)}else i(!1)}else i(!1)},k=function(n,t,r,o,a){t?e.find(n,["store","proxy","teams",t])&&n.teams[t]?n.store.mailbox.sendTo("TEAM_EDIT_RIGHTS",{state:o,teamData:C(n,t,o)},{channel:r.notifications,curvePublic:r.curvePublic},a):a({error:"ENOENT"}):a({error:"EINVAL"})},M=function(n,t,r,o){var a=t.teamId;if(a){var i=e.find(n,["store","proxy","teams",a]),s=n.teams[a];if(i&&s)if(s.roster)if(t.curvePublic&&t.data){var c,u=s.roster.getState().members[t.curvePublic];g(function(e){n.Store.pad.getMetadata(null,{channel:i.channel},e(function(e){c=e&&e.error?s.listmap.metadata||{}:e}))}).nThen(function(){if(u.pendingOwner=Array.isArray(c.pending_owners)&&-1!==c.pending_owners.indexOf(u.edPublic),"OWNER"!==u.role||"OWNER"===t.data.role){"VIEWER"===u.role&&"VIEWER"!==t.data.role&&k(n,a,u,!0,function(e){o(e)}),"VIEWER"!==u.role&&"VIEWER"===t.data.role&&k(n,a,u,!1,function(e){o(e)});var r={};r[t.curvePublic]=t.data,s.roster.describe(r,function(e){e?o({error:e}):o()})}else!function(n,t,r,o){var a=e.once(o);if(t){var i=e.find(n,["store","proxy","teams",t]);if(i){var s=n.teams[t];if(s){var c=r.pendingOwner;g(function(t){var o=c?"RM_PENDING_OWNERS":"RM_OWNERS",s=function(e){var n=e&&e.error;if(n)return console.error(n),t.abort(),void a(n)},u=function(e){n.Store.pad.setMetadata(null,{channel:e,command:o,value:[r.edPublic]},t(s))};u(i.channel),u(e.find(i,["keys","roster","channel"])),u(e.find(i,["keys","chat","channel"]))}).nThen(function(e){var n={};n[r.curvePublic]={role:"ADMIN",pendingOwner:!1},s.roster.describe(n,e(function(e){e&&console.error(e)}))}).nThen(function(e){n.store.mailbox.sendTo("RM_OWNER",{teamChannel:i.channel,title:i.metadata.name,pending:c},{channel:r.notifications,curvePublic:r.curvePublic},e())}).nThen(function(){a()})}else a({error:"ENOENT"})}else a({error:"ENOENT"})}else a({error:"EINVAL"})}(n,a,u,function(e){e?(console.error(e),o({error:e})):o()})})}else o({error:"MISSING_DATA"});else o({error:"NO_ROSTER"});else o({error:"ENOENT"})}else o({error:"EINVAL"})},F=function(e,n){Object.keys(e.onReadyHandlers).forEach(function(t){var r=-1;e.onReadyHandlers[t].some(function(e,t){if(e.cId===n)return r=t,!0}),-1!==r&&e.onReadyHandlers[t].splice(r,1)}),Object.keys(e.teams).forEach(function(t){var r=e.teams[t].clients,o=r.indexOf(n);-1!==o&&r.splice(o,1)})},L=function(n,t,r,o){var a,i=t.seeds;try{a=f.derivePreviewKeys(i.preview)}catch(e){return void o({error:"INVALID_SEEDS"})}l.get({channel:a.channel,type:"pad",version:2,keys:{cryptKey:a.cryptKey}},function(n,t){if(n)o({error:n});else if(t){var r=e.tryParse(t);o(r||{error:"parseError"})}else o({error:"DELETED"})},{network:n.store.network,initialState:"{}"})},H=function(n,t,r,o){var a,i;g(function(r){!function(n,t,r,o){var a,i=t.bytes64;try{a=f.deriveInviteKeys(i)}catch(e){return void o({error:"INVALID_SEEDS"})}l.get({channel:a.channel,type:"pad",version:2,keys:{cryptKey:a.cryptKey}},function(n,t){if(n)o({error:n});else if(t){var r=e.tryParse(t);o(r||{error:"parseError"})}else o({error:"DELETED"})},{network:n.store.network,initialState:"{}"})}(n,t,0,r(function(e){if(e&&e.error)return r.abort(),void o(e);a=e}))}).nThen(function(t){var r=e.find(a,["teamData","channel"]),u=n.store.proxy.teams||{};if(Object.keys(u).some(function(e){return u[e].channel===r}))return t.abort(),void o({error:"ALREADY_MEMBER"});var f=e.find(a,["teamData","keys","roster"]),l=a.ephemeral;if(!f||!l)return t.abort(),void o({error:"INVALID_INVITE_CONTENT"});var h=v.Team.deriveMemberKeys(f.edit,l);s.create({network:n.store.network||n.store.networkPromise,channel:f.channel,keys:h,store:n.store,Cache:d},t(function(e,r){if(e)return t.abort(),console.error(e),void o({error:"ROSTER_ERROR"});var a=c.createData(n.store.proxy,!1),s=r.getState();i=s.members[l.curvePublic],r.accept(a.curvePublic,t(function(e){if(r.stop(),e)return t.abort(),console.error(e),void o({error:"ACCEPT_ERROR"})}))}))}).nThen(function(){var e={};i.remaining&&1!==i.remaining||_(n,e,a.ephemeral,function(n){if(!n){var t=e.rpc;i.inviteChannel&&t.removeOwnedChannel(i.inviteChannel,function(e){e&&console.error(e)}),i.previewChannel&&t.removeOwnedChannel(i.previewChannel,function(e){e&&console.error(e)})}}),x(n,{team:a.teamData},0,o)})},j=function(n){if(n){if(n.keys&&n.keys.mailbox)return n.keys.mailbox;var t=e.find(n,["keys","roster","edit"]);if(t){var r=E.hash(e.decodeUTF8(t)),o=r.slice(0,32),a=e.uint8ArrayToHex(r.slice(32,48)),i=E.box.keyPair.fromSecretKey(o);return{channel:a,viewed:[],keys:{curvePrivate:e.encodeBase64(i.secretKey),curvePublic:e.encodeBase64(i.publicKey)}}}}};return b.init=function(t,r,o){var a={},i=t.store;if(i.loggedIn&&i.proxy.edPublic&&!i.modules?.team){var h={store:i,Store:t.Store,pinPads:t.pinPads,emit:o,onReadyHandlers:{},teams:{},cache:{},nocache:{},updateMetadata:t.updateMetadata,updateProgress:t.updateLoadingProgress,progress:0};i.proxy.teams||(i.proxy.teams={});var b=i.proxy.teams;h.numberOfTeams=Object.keys(b).length,h.store.proxy.on("change",["teams"],function(e,n,t){"hash"===t[2]&&R(h,t[1],n)}),h.store.proxy.on("remove",["teams"],function(e,n){"hash"===n[2]&&R(h,n[1])});var w=function(n,t){if(!n||!t)return!0;try{var r=e.decodeBase64(n),o=E.sign.keyPair.fromSecretKey(r);return e.encodeBase64(o.publicKey)===t}catch(e){return!1}};Object.keys(b).forEach(function(n){h.onReadyHandlers[n]=[],e.find(b,[n,"keys","mailbox"])||(b[n].keys.mailbox=j(b[n])),I(h,b[n],n,r(function(e){if(e){delete h.onReadyHandlers[n],delete h.cache[n],"NOCACHE"===e?.error&&(h.nocache[n]=!0);var t="string"==typeof e?e:e.type||e.message;return u.send("TEAM_LOADING_ERROR="+t),void console.error(e)}console.debug("Team "+n+" cache ready")}),d.isEnabled())}),a.onReady=function(t){var r;r={},Object.keys(b).forEach(function(t){try{var o=b[t],a=r[o.channel],i=e.find(o,["keys","drive","edPrivate"]),s=e.find(o,["keys","drive","edPublic"]);if(s?i&&s&&!w(i,s)&&(u.send("TEAM_CORRUPTED_EDPRIVATE"),delete b[t].keys.drive.edPrivate,i=void 0):u.send("TEAM_CORRUPTED_EDPUBLIC"),o.hash&&2===n.parseTypeHash("drive",o.hash).version&&40!==o.hash.length&&u.send("TEAM_CORRUPTED_HASH"),!a)return void(r[o.channel]=t);var c=b[a],f=e.find(c,["keys","drive","edPrivate"]),l=e.find(c,["keys","chat","edit"]),d=e.find(o,["keys","chat","edit"]);!c.hash&&o.hash&&(c.hash=o.hash),!f&&i&&(c.keys.drive.edPrivate=i),!l&&d&&(c.keys.chat.edit=d),h.store.proxy.duplicateTeams=h.store.proxy.duplicateTeams||{},h.store.proxy.duplicateTeams[t]=b[t],delete b[t]}catch(e){console.error(e)}});var o=function(e){return!b[e]&&(D(h,e),delete h.onReadyHandlers[e],!0)};Object.keys(h.teams).forEach(o),Object.keys(h.onReadyHandlers).forEach(function(n){if(!o(n)){var r=h.store.proxy.teams[n],a=e.find(r,["keys","roster","channel"]),i=e.once(e.mkAsync(t()));g(function(e){N(h,n,r.channel,a,e,i)}),h.onReadyHandlers[n].push({cb:i})}}),Object.keys(b).forEach(function(n){h.onReadyHandlers[n]||h.teams[n]||(h.onReadyHandlers[n]=[],e.find(b,[n,"keys","mailbox"])||(b[n].keys.mailbox=j(b[n])),I(h,b[n],n,t(function(e){if(e){var t="string"==typeof e?e:e.type||e.message;return u.send("TEAM_LOADING_ERROR="+t),void console.error(e)}console.debug("Team "+n+" ready")})))}),A(),O.fire()},a.getTeam=function(e){return h.teams[e]},a.getTeamsData=function(n){var t={},r=!1;return-1!==["drive","teams","settings"].indexOf(n)&&(r=!0),Object.keys(b).forEach(function(n){if(h.teams[n]){var o=h.teams[n].proxy||{},a=o.drive&&Object.keys(o.drive.filesData||{}).length,i=o.drive&&Object.keys(o.drive.sharedFolders||{}).length;t[n]={owner:b[n].owner,name:b[n].metadata.name,channel:b[n].channel,numberPads:a,numberSf:i,roster:e.find(b[n],["keys","roster","channel"]),edPublic:e.find(b[n],["keys","drive","edPublic"]),avatar:e.find(b[n],["metadata","avatar"]),viewer:!e.find(b[n],["keys","drive","edPrivate"]),notifications:e.find(b[n],["keys","mailbox","channel"]),curvePublic:e.find(b[n],["keys","mailbox","keys","curvePublic"]),validKeys:w(e.find(b[n],["keys","drive","edPrivate"]),e.find(b[n],["keys","drive","edPublic"]))},r&&h.teams[n]&&(t[n].secondaryKey=h.teams[n].secondaryKey),h.teams[n]&&(t[n].hasSecondaryKey=Boolean(h.teams[n].secondaryKey))}}),t},a.getTeams=function(){return Object.keys(h.teams)};a.removeFromTeam=function(e,n,t){if(b[e]&&(!t||function(e,n){var t=h.teams[e];if(t){var r=t.roster&&t.roster.getState();if(r.members)return(r.members[n]||{}).pending}}(e,n)))if(h.onReadyHandlers[e])h.onReadyHandlers[e].push({cb:function(){h.teams[e].roster.remove([n],function(e){e&&"NO_CHANGE"!==e&&console.error(e)})}});else{var r=h.teams[e];r?r.roster.remove([n],function(e){e&&"NO_CHANGE"!==e&&console.error(e)}):console.error("TEAM MODULE ERROR")}},a.changeMyRights=function(e,n,t,r){P(h,e,n,t,r)},a.updateMyData=function(e){Object.keys(h.teams).forEach(function(n){var t=h.teams[n];if(t.roster){var r={};r[e.curvePublic]=e,t.roster.describe(r,function(e){e&&console.error(e)})}})},a.removeClient=function(e){F(h,e)};return a.execCommand=function(t,r,o){var a=r.cmd,i=r.data;if("SUBSCRIBE"!==a)if("LIST_TEAMS"!==a)if("OPEN_TEAM_CHAT"!==a)if("GET_TEAM_ROSTER"!==a)if("GET_TEAM_METADATA"!==a)if("SET_TEAM_METADATA"!==a){if("OFFER_OWNERSHIP"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(n,t,r,o){var a=e.once(o),i=t.teamId;if(i){var s=e.find(n,["store","proxy","teams",i]);if(s){var c=n.teams[i];if(c)if(c.roster)if(t.curvePublic){var u=c.roster.getState().members[t.curvePublic];g(function(t){var r=function(e){var n=e&&e.error;if(n)return console.error(n),t.abort(),void a({error:n})},o=function(e){n.Store.pad.setMetadata(null,{channel:e,command:"ADD_PENDING_OWNERS",value:[u.edPublic]},t(r))};o(s.channel),o(e.find(s,["keys","roster","channel"])),o(e.find(s,["keys","chat","channel"]))}).nThen(function(e){var n={};n[u.curvePublic]={role:"OWNER"},c.roster.describe(n,e(function(e){e&&console.error(e)}))}).nThen(function(t){n.store.mailbox.sendTo("ADD_OWNER",{teamChannel:s.channel,chatChannel:e.find(s,["keys","chat","channel"]),rosterChannel:e.find(s,["keys","roster","channel"]),title:s.metadata.name},{channel:u.notifications,curvePublic:u.curvePublic},t())}).nThen(function(){a()})}else a({error:"MISSING_DATA"});else a({error:"NO_ROSTER"});else a({error:"ENOENT"})}else a({error:"ENOENT"})}else a({error:"EINVAL"})}(h,i,0,o);if("ANSWER_OWNERSHIP"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(n,t,r,o){var a,i=n.store.proxy.teams;if(Object.keys(i).forEach(function(e){if(i[e].channel===t.teamChannel)return a=e,!0}),a){var s=e.find(n,["store","proxy","teams",a]);if(s){var c=n.teams[a];if(c)if(c.roster){var u={};t.answer?s.owner=!0:(u[n.store.proxy.curvePublic]={role:"ADMIN"},c.roster.describe(u,function(e){e?o({error:e}):o()}))}else o({error:"NO_ROSTER"});else o({error:"ENOENT"})}else o({error:"ENOENT"})}else o({error:"EINVAL"})}(h,i,0,o);if("DESCRIBE_USER"!==a){if("INVITE_TO_TEAM"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];if(a)if(a.roster){var i=n.user;if(i&&i.curvePublic&&i.notifications){delete i.channel,delete i.lastKnownHash,i.pending=!0;var s={};s[i.curvePublic]=i,s[i.curvePublic].role="VIEWER",a.roster.add(s,function(n){n&&"NO_CHANGE"!==n?r({error:n}):e.store.mailbox.sendTo("INVITE_TO_TEAM",{team:C(e,o)},{channel:i.notifications,curvePublic:i.curvePublic},function(e){r(e)})})}else r({error:"MISSING_DATA"})}else r({error:"NO_ROSTER"});else r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o);if("LEAVE_TEAM"!==a){if("JOIN_TEAM"===a)return h.store.offline?void o({error:"OFFLINE"}):void x(h,i,0,o);if("REMOVE_USER"!==a){if("DELETE_TEAM"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(n,t,r,o){var a=t.teamId;if(a){var i=n.teams[a],s=e.find(n,["store","proxy","teams",a]);if(i&&s){var c=i.roster.getState(),f=e.find(n,["store","proxy","curvePublic"]),l=c.members[f];if(!l||"OWNER"!==l.role)return o({error:"EFORBIDDEN"});var d=e.find(n,["store","proxy","edPublic"]),h=e.find(s,["keys","drive","edPublic"]);g(function(e){n.Store.anonRpcMsg(null,{msg:"GET_METADATA",data:s.channel},e(function(n){if(n&&n.error)return e.abort(),o({error:n.error});var t=n[0];t&&Array.isArray(t.owners)&&-1!==t.owners.indexOf(d)||(e.abort(),o({error:"EFORBIDDEN"}))}))}).nThen(function(t){i.proxy.delete=!0;var r=i.manager.getChannelsList("owned"),o=e.Saferphore.create(10);r.forEach(function(e){var r=t();o.take(function(t){var o=!1;g(function(r){32===e.length&&n.Store.anonRpcMsg(null,{msg:"GET_METADATA",data:e},r(function(e){if(e&&e.error)return t(),void r.abort();var n=e[0];if(!n||!Array.isArray(n.owners)||-1===n.owners.indexOf(h))return t(),void r.abort();o=n.owners.some(function(e){return e!==h})}))}).nThen(function(t){o?n.Store.pad.setMetadata(null,{channel:e,command:"RM_OWNERS",value:[h]},t()):i.rpc.removeOwnedChannel(e,t(function(e){e&&console.error(e)}))}).nThen(function(){t(),r()})})})}).nThen(function(t){i.rpc.removePins(t(function(e){e&&console.error(e)}));var r=e.find(s,["keys","mailbox","channel"]);i.rpc.removeOwnedChannel(r,t(function(e){e&&console.error(e)}));var o=e.find(s,["keys","roster","channel"]);n.store.rpc.removeOwnedChannel(o,t(function(e){e&&console.error(e)}));var a=e.find(s,["keys","chat","channel"]);n.store.rpc.removeOwnedChannel(a,t(function(e){e&&console.error(e)})),n.store.rpc.removeOwnedChannel(s.channel,t(function(e){e&&console.error(e)}))}).nThen(function(){u.send("TEAM_DELETION"),D(n,a),o()})}else o({error:"ENOENT"})}else o({error:"EINVAL"})}(h,i,0,o);if("CREATE_TEAM"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(t,r,o,a){var i,f=e.once(a),l=n.createChannelId(),h=n.createRandomHash("team",l),b=n.getSecrets("team",h,l),O=n.getViewHashFromKeys(b),A=E.sign.keyPair(),w=E.box.keyPair(),_=v.Team.createSeed(),T=v.Team.deriveMemberKeys(_,{curvePublic:t.store.proxy.curvePublic,curvePrivate:t.store.proxy.curvePrivate}),N=n.getSecrets("chat"),I=n.getHashes(N),x={network:t.store.network,channel:b.channel,data:{},validateKey:b.keys.validateKey,crypto:v.createEncryptor(b.keys),logLevel:1,classic:!0,ChainPad:m,Cache:d,owners:[t.store.proxy.edPublic]};g(function(e){s.create({network:t.store.network||t.store.networkPromise,channel:T.channel,owners:[t.store.proxy.edPublic],keys:T,store:t.store,lastKnownHash:void 0,newTeam:!0,Cache:d},e(function(n,r){if(n)return e.abort(),console.error(n),void f({error:"ROSTER_ERROR"});i=r;var o=c.createData(t.store.proxy);delete o.channel,i.init(o,e(function(n){if(n)return e.abort(),void f({error:"ROSTER_INIT_ERROR"})}))}));var n,r=v.createEncryptor(N.keys),o={network:t.store.network,channel:N.channel,noChainPad:!0,crypto:r,metadata:{validateKey:N.keys.validateKey,owners:[t.store.proxy.edPublic]}},a=e();o.onReady=function(){n&&n.stop(),a()},o.onError=function(){e.abort(),f({error:"CHAT_INIT_ERROR"})},n=y.start(o)}).nThen(function(e){i.metadata({name:r.name},e(function(n){if(n)return e.abort(),void f({error:"ROSTER_INIT_ERROR"})}))}).nThen(function(){var a=e.createRandomInteger();x.onMetadataUpdate=function(){var e=t.teams[a];e&&t.emit("ROSTER_CHANGE",a,e.clients)};var s=p.create(x),c=s.proxy;c.version=2,c.on("ready",function(){var d={mailbox:{channel:n.createChannelId(),viewed:[],keys:{curvePrivate:e.encodeBase64(w.secretKey),curvePublic:e.encodeBase64(w.publicKey)}},drive:{edPrivate:e.encodeBase64(A.secretKey),edPublic:e.encodeBase64(A.publicKey)},chat:{edit:I.editHash,view:I.viewHash,validateKey:N.keys.validateKey,channel:N.channel},roster:{channel:T.channel,edit:_,view:T.viewKeyStr}},p=t.store.proxy.teams[a]={owner:!0,channel:b.channel,hash:h,roHash:O,password:l,keys:d,metadata:{name:r.name}};c.drive={},S(t,a,s,i,d,o,function(){u.send("TEAM_CREATION"),t.store.mailbox.open("team-"+a,p.keys.mailbox,function(){},!0,{owners:p.keys.drive.edPublic}),t.updateMetadata(),f()})}).on("error",function(e){e&&void 0!==e.loaded&&!e.loaded&&f({error:"ECONNECT"}),e&&e.error&&"EDELETED"===e.error&&D(t,a)})})}(h,i,t,o);if("GET_EDITABLE_FOLDERS"!==a)if("CREATE_INVITE_LINK"!==a){if("GET_PREVIEW_CONTENT"!==a)return"ACCEPT_LINK_INVITATION"===a?h.store.offline?void o({error:"OFFLINE"}):void H(h,i,0,o):void 0;L(h,i,0,o)}else!function(n,t,r,o){var a=e.mkAsync(e.once(o)),i=t.teamId,s=n.teams[t.teamId],u=t.seeds,d=t.bytes64;if(i&&s){var h,p=s.roster;try{h=p.getState().metadata.name}catch(e){return void a({error:"TEAM_NAME_ERR"})}var v=t.message,y=t.name,m=t.hash,E=e.find(n,["store","proxy","teams",i]);try{var b=f.encryptHash(m,E.hash)}catch(e){console.error(e)}var O=f.derivePreviewKeys(u.preview),A=f.deriveInviteKeys(d),w=f.generateKeys(),D=t.role||"VIEWER",_=t.uses||1;g(function(e){!function(){var t=f.generateSignPair(),r={initialState:"{}",network:n.store.network,metadata:{owners:[n.store.proxy.edPublic,w.edPublic]}};r.metadata.validateKey=t.validateKey;var o={teamName:h,message:v,author:c.createData(n.store.proxy,!1),displayName:y},i={channel:O.channel,type:"pad",version:2,keys:{cryptKey:O.cryptKey,validateKey:t.validateKey,signKey:t.signKey}};l.put(i,JSON.stringify(o),e(function(n){if(n)return console.error("CRYPTPUT_ERR",n),e.abort(),void a({error:"SET_PREVIEW_CONTENT"})}),r)}(),function(){var t=f.generateSignPair(),r={initialState:"{}",network:n.store.network,metadata:{owners:[n.store.proxy.edPublic,w.edPublic]}};r.metadata.validateKey=t.validateKey;var o={teamData:C(n,i,"MEMBER"===D),ephemeral:{edPublic:w.edPublic,edPrivate:w.edPrivate,curvePublic:w.curvePublic,curvePrivate:w.curvePrivate}},s={channel:A.channel,type:"pad",version:2,keys:{cryptKey:A.cryptKey,validateKey:t.validateKey,signKey:t.signKey}};l.put(s,JSON.stringify(o),e(function(n){if(n)return console.error("CRYPTPUT_ERR",n),e.abort(),void a({error:"SET_PREVIEW_CONTENT"})}),r)}()}).nThen(function(e){s.pin([A.channel,O.channel],function(e){e&&e.error&&console.error(e.error)}),f.createRosterEntry(s.roster,{curvePublic:w.curvePublic,content:{curvePublic:w.curvePublic,displayName:t.name,pending:!0,remaining:_,totalUses:_,role:D,hash:b,inviteChannel:A.channel,previewChannel:O.channel}},e(function(n){n&&(e.abort(),a(n))}))}).nThen(function(){a()})}else a({error:"EINVAL"})}(h,i,0,o);else!function(n,t,r,o){var a=t.teamId;if(a){var i=n.teams[a];if(i){var s=i.manager.folders||{};o(Object.keys(s).filter(function(e){return!s[e].proxy.version}).map(function(n){var t=e.find(i,["user","userObject"]);return{name:e.find(s,[n,"proxy","metadata","title"]),path:t?t.findFile(n)[0]:[]}}))}else o({error:"ENOENT"})}else o({error:"EINVAL"})}(h,i,0,o)}else!function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];if(a)if(a.roster)if(n.curvePublic){var i=a.roster.getState().members[n.curvePublic];a.roster.remove([n.curvePublic],function(t){if(!t)return i&&i.notifications?void e.store.mailbox.sendTo("KICKED_FROM_TEAM",{pending:n.pending,teamChannel:C(e,o).channel,teamName:C(e,o).metadata.name},{channel:i.notifications,curvePublic:i.curvePublic},function(e){r(e)}):r();r({error:t})})}else r({error:"MISSING_DATA"});else r({error:"NO_ROSTER"});else r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o)}else!function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];if(a)if(a.roster){var i=e.store.proxy.curvePublic;a.roster.remove([i],function(n){n?r({error:n}):(D(e,o),r())})}else r({error:"NO_ROSTER"});else r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o)}else M(h,i,0,o)}else!function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];a?a.offline?r({error:"OFFLINE"}):a.roster?(n.metadata&&delete n.metadata.offline,a.roster.metadata(n.metadata,function(t){if(t)r({error:t});else{var a=e.store.proxy.teams[o];a&&(a.metadata=n.metadata),r()}})):r({error:"NO_ROSTER"}):r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o);else!function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];if(a)if(a.roster){var i=(a.roster.getState()||{}).metadata||{};i.offline=a.offline,r(i)}else r({error:"NO_ROSTER"});else r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o);else!function(n,t,r,o){var a=t.teamId;if(a){var i=e.find(n,["store","proxy","teams",a]);if(i){var s=n.teams[a];if(s)if(s.roster){var c,u=(s.roster.getState()||{}).members||{};g(function(e){n.Store.pad.getMetadata(null,{channel:i.channel},e(function(e){c=e&&e.error?s.listmap.metadata||{}:e}))}).nThen(function(){if(n.pending_owners=c.pending_owners,Array.isArray(c.pending_owners)&&c.pending_owners.forEach(function(t){var r;if(Object.keys(u).some(function(e){if(u[e].edPublic===t)return r=u[e],!0}),!r&&i.owner){var o=function(e){n.Store.pad.setMetadata(null,{channel:e,command:"RM_PENDING_OWNERS",value:[t]},function(){})};return o(i.channel),o(e.find(i,["keys","roster","channel"])),void o(e.find(i,["keys","chat","channel"]))}r.pendingOwner=!0}),n.store.messenger){var t=s.getChatData();(n.store.messenger.getOnlineList(t.channel)||[]).forEach(function(e){u[e]&&(u[e].online=!0)})}Object.keys(u).forEach(function(e){var n=u[e];if(n.inviteChannel&&n.hash)if(i.hash)try{n.hash=f.decryptHash(n.hash,i.hash)}catch(e){console.error(e)}else delete n.hash}),o(u)})}else o({error:"NO_ROSTER"});else o({error:"ENOENT"})}else o({error:"ENOENT"})}else o({error:"EINVAL"})}(h,i,0,o);else!function(e,n,t,r){var o=e.teams[n.teamId];if(o){var a=function(){e.emit("ROSTER_CHANGE",n.teamId,o.clients)};e.store.messenger?e.store.messenger.openTeamChat(o.getChatData(),a,t,r):A=function(){e.store.messenger.openTeamChat(o.getChatData(),a,t,r)}}else r({error:"ENOENT"})}(h,i,t,o);else!function(n){var t=e.clone(b);Object.keys(t).forEach(function(e){h.teams[e]?t[e].offline=h.teams[e].offline:(t[e].error=!0,h.nocache[e]&&(t[e].offline=!0))}),n(t)}(o);else!function(e,n,t,r){F(e,t);try{e.store.messenger.removeClient(t)}catch(e){}if(A=function(){},n)if(!e.onReadyHandlers[n]||e.teams[n])if(e.teams[n]){var o=e.teams[n].clients;-1===o.indexOf(t)&&o.push(t),r()}else r({error:"EINVAL"});else-1===e.onReadyHandlers[n].indexOf(t)&&e.onReadyHandlers[n].push({cId:t,cb:r});else r()}(h,i,t,o)},a}},b.anonGetPreviewContent=function(e,n,t){L(e,n,0,t)},b})(Z(),te(),Y(),je(),ze(),Ue(),We(),Ht(),On(),Ae(),(_t||(_t=1,Dt=function(e,n,t,r){var o={},a=e.encodeBase64,i=e.decodeBase64;o.generateKeys=function(){var e=t.sign.keyPair(),n=t.box.keyPair();return{edPublic:a(e.publicKey),edPrivate:a(e.secretKey),curvePublic:a(n.publicKey),curvePrivate:a(n.secretKey)}},o.generateSignPair=function(){var e=t.sign.keyPair();return{validateKey:a(e.publicKey),signKey:a(e.secretKey)}};var s=function(r){var o=n.dispenser(i(r));return{channel:e.uint8ArrayToHex(o(16)),cryptKey:o(t.secretbox.keyLength)}};o.deriveInviteKeys=s,o.derivePreviewKeys=s,o.createRosterEntry=function(e,n,t){var r={};r[n.curvePublic]=n.content,e.invite(r,t)};var c=e.decodeUTF8;return o.encryptHash=function(e,n){var o=c(n),a=t.hash(o).subarray(0,32);return r.encrypt(e,a)},o.decryptHash=function(e,n){var o=c(n),a=t.hash(o).subarray(0,32);return r.decrypt(e,a)},o}(Z(),Ie(),h(),M())),Dt),xn(),fe(),In(),T(),M(),D(),x(),qe(),h()),Tt}function Kt(){if(It)return Nt;It=1;return Nt=((e,n,t,r,o,a,i,s)=>{var c=e.Curve;const u={};let f={};u.setCustomize=e=>{f=e.Messages};var l="MSG",d="UNFRIEND",h="MAP_ID",p="MAP_ID_ACK",v=function(e){return JSON.parse(JSON.stringify(e))},y=function(e){for(var n=Object.keys(e).length,t=new Uint8Array(n),r=0;r{const n=p.store.network||e;n.on("message",function(e,n){I(p,e,n)}),n.on("disconnect",function(){p.emit("DISCONNECT",null,C(p))}),n.on("reconnect",function(){p.emit("RECONNECT",null,C(p))})});return h.networkPromise?.then(b),p.store.network&&b(),u.onFriendUpdate=function(e){var n=g(h.proxy,e);if(n&&n.channel){var t=p.channels[n.channel];t&&p.emit("UPDATE_DATA",{info:v(n),channel:n.channel},t.clients)}},u.onFriendAdded=function(e){if(p.friendsClients.length){var n=g(p.store.proxy,e.curvePublic);if("object"==typeof n)if(n.channel){var t=n.channel;p.channels[t]||P(p,null,n,function(){c("FRIEND",{curvePublic:n.curvePublic},p.friendsClients)})}}},u.onFriendRemoved=function(e,n){x(p,e,n)},u.getOnlineList=function(e){return function(e,n){var t=e.channels[n];if(t){var r=[],o=m(e.store.proxy,!1);return r.push(o.curvePublic),t.wc.members.forEach(function(n){if(n!==e.store.network.historyKeeper){var o=t.mapId[n]||{};o.curvePublic&&-1===r.indexOf(o.curvePublic)&&r.push(o.curvePublic)}}),r}}(p,e)},u.storeValidateKey=function(e,n){p.validateKeys[e]=n},u.leavePad=function(e){delete p.validateKeys[e],Object.keys(p.channels).some(function(n){var t=p.channels[n];if(t.padChan===e){t.wc&&t.wc.leave();var r=p.store.network;return t.onReconnect&&r.off("reconnect",t.onReconnect),t.stopped=!0,delete p.channels[n],!0}})},u.openTeamChat=function(n,r,o,a){!function(n,r,o,a,i){var s=o,c=s.channel,u=s.secret;if(c&&u){var f=t.once(t.mkAsync(function(){n.emit("TEAMCHAT_READY",c,[r]),i({readOnly:"object"==typeof u.keys&&!u.keys.validateKey,channel:c})})),l=n.channels[c];if(l)l.onReady.reg(function(){-1===l.clients.indexOf(r)&&l.clients.push(r),f()});else{u.keys.cryptKey&&(u.keys.cryptKey=y(u.keys.cryptKey));var d=e.createEncryptor(u.keys),h=u.keys&&u.keys.validateKey||s.validateKey,p={teamId:o.teamId,readOnly:"object"==typeof u.keys&&!u.keys.validateKey,encryptor:d,channel:c,isTeamChat:!0,decrypt:function(e){return d.decrypt(e,h)},clients:[r],onUserlistUpdate:a,onReady:f};R(n,p)}}else i({error:"EINVAL"})}(p,o,n,r,a)},u.removeClient=function(e){!function(e,n){var t=e.friendsClients.indexOf(n);-1!==t&&e.friendsClients.splice(t,1),Object.keys(e.channels).forEach(function(t){var r=e.channels[t],o=r.clients,a=o.indexOf(n);if(-1!==a&&o.splice(a,1),0===o.length){r.wc&&r.wc.leave();var i=e.store.network;return r.onReconnect&&i.off("reconnect",r.onReconnect),r.stopped=!0,delete e.channels[t],!0}})}(p,e)},u.execCommand=function(n,r,i){var c=r.cmd,u=r.data;"INIT_FRIENDS"!==c?"GET_ROOMS"!==c?"GET_MUTED_USERS"!==c?"GET_USERLIST"!==c?"OPEN_PAD_CHAT"!==c?"GET_MY_INFO"!==c?"REMOVE_FRIEND"!==c?"CANCEL_FRIEND"!==c?"MUTE_USER"!==c?"UNMUTE_USER"!==c?"GET_STATUS"!==c?"GET_MORE_HISTORY"!==c?"SEND_MESSAGE"!==c?"SET_CHANNEL_HEAD"!==c?"CLEAR_OWNED_CHANNEL"!==c||function(e,n,t){var r=e.channels[n];r?e.store.rpc?e.store.rpc.clearOwnedChannel(n,function(o){t({error:o}),o||(r.messages=[],e.emit("CLEAR_CHANNEL",n,r.clients))}):t({error:"RPC_NOT_READY"}):t({error:"NO_CHANNEL"})}(p,u,i):_(p,u.id,u.sig,i):function(e,n,t,r){var o=e.channels[n];if(o)if(o.readOnly)r({error:"FORBIDDEN"});else if(e.store.network.webChannels.some(function(e){if(e.id===o.wc.id)return!0})){var i=e.store.proxy||{},s=[l,i.curvePublic,+new Date,t];if(!o.isFriendChat){var c=i[a.displayNameKey]||f.anonymous+"#"+(i.uid||e.store.noDriveUid).slice(0,5);s.push(c)}var u=JSON.stringify(s),d=o.encrypt(u);o.wc.bcast(d).then(function(){N(e,o,d),r()},function(e){r({error:e})})}else r({error:"NO_SUCH_CHANNEL"});else r({error:"NO_CHANNEL"})}(p,u.id,u.content,i):function(e,n,r,o,a){if("function"==typeof a)if("string"==typeof r){var i=e.channels[n];if(void 0!==i){var s=t.uid();A(e,s,n,a);var c=["GET_HISTORY_RANGE",i.id,{from:r,count:o,txid:s}],u=e.store.network;u.sendto(u.historyKeeper,JSON.stringify(c)).then(function(){},function(e){console.error(e)})}else console.error("chan is undefined. we're going to have a problem here")}else a([])}(p,u.id,u.sig,u.count,i):function(e,n,t){var r=e.channels[n];if(r){r.onUserlistUpdate&&r.onUserlistUpdate();var o=e.store.proxy||{};t(r.wc.members.some(function(n){if(n!==e.store.network.historyKeeper){var t=r.mapId[n]||void 0;return!!t&&t.curvePublic!==o.curvePublic}}))}else t("NO_SUCH_CHANNEL")}(p,u,i):function(e,n,r){var o=t.once(t.mkAsync(r)),a=e.store.proxy,i=a.mutedUsers=a.mutedUsers||{};delete i[n],e.emit("UPDATE_MUTED",null,C(e)),o(Object.keys(i).length)}(p,u,i):function(e,n,r){var o=t.once(t.mkAsync(r)),a=e.store.proxy,i=a.mutedUsers=a.mutedUsers||{};i[n.curvePublic]||(i[n.curvePublic]=n,e.emit("UPDATE_MUTED",null,C(e))),o()}(p,u,i):function(e,n,r){var o=t.once(r);"function"==typeof o?e.Store.cancelFriendRequest(n,o):console.error("NO_CALLBACK")}(p,u,i):function(e,n,r){var a=t.once(r);if("function"==typeof a){var i=e.store.proxy,s=g(i,n);if(!s)return console.error("friend is not valid"),void a({error:"INVALID_FRIEND"});var c=e.channels[s.channel];if(e.store.mailbox&&s.curvePublic&&s.notifications)o.removeFriend(e.store,n,function(n){n&&n.error?a({error:n.error}):(e.updateMetadata(),a(n))});else if(c)try{var u=[d,i.curvePublic,+new Date],f=JSON.stringify(u),l=c.encrypt(f);c.wc.bcast(l).then(function(){x(e,n,s.channel),S(e,n,function(){a()})},function(t){t?a({error:t}):(x(e,n,s.channel),S(e,n,function(){a()}))})}catch(e){a({error:e})}else a({error:"NO_SUCH_CHANNEL"})}else console.error("NO_CALLBACK")}(p,u,i):function(e,n){var t=e.store.proxy||{};n({curvePublic:t.curvePublic,displayName:t[a.displayNameKey]})}(p,i):function(n,r,o,a){var i=o.channel,s=t.once(t.mkAsync(function(){n.emit("PADCHAT_READY",i,[r]),a()})),c=n.channels[i];if(c)c.onReady.reg(function(){-1===c.clients.indexOf(r)&&c.clients.push(r),s()});else{var u=o.secret;u.keys.cryptKey&&(u.keys.cryptKey=y(u.keys.cryptKey));var f=e.createEncryptor(u.keys),l=u.keys&&u.keys.validateKey||n.validateKeys[u.channel],d={padChan:o.secret&&o.secret.channel,readOnly:"object"==typeof u.keys&&!u.keys.validateKey,encryptor:f,channel:o.channel,isPadChat:!0,decrypt:function(e){return f.decrypt(e,l)},clients:[r],onReady:s};R(n,d)}}(p,n,u,i):function(e,n,t){var r=e.channels[n.id];if(r)if(r.isFriendChat){var o=O(e,n.id);if(!o)return void t({error:"NO_SUCH_FRIEND"});t([o])}else t([]);else t({error:"NO_SUCH_CHANNEL"})}(p,u,i):function(e,n){var t=e.store.proxy;if(!n)return t.mutedUsers||{};n(t.mutedUsers||{})}(p,i):function(e,n,t){var r=e.store.proxy;if(n&&n.curvePublic){var o=n.curvePublic,a=g(r,o);if(!a)return void t({error:"NO_SUCH_FRIEND"});var i=e.channels[a.channel];return i?void t([{id:i.id,isFriendChat:!0,name:a.displayName,lastKnownHash:a.lastKnownHash,curvePublic:a.curvePublic,messages:i.messages}]):void t({error:"NO_SUCH_CHANNEL"})}if(n&&n.padChat){var s=e.channels[n.padChat];return s?void t([{id:s.id,isPadChat:!0,messages:s.messages}]):void t({error:"NO_SUCH_CHANNEL"})}if(n&&n.teamChat){var c=e.channels[n.teamChat];return c?void t([{id:c.id,isTeamChat:!0,messages:c.messages}]):void t({error:"NO_SUCH_CHANNEL"})}var u=Object.keys(e.channels).map(function(n){var t,r,o,a=e.channels[n];if(a.isFriendChat){var i=O(e,n);if(!i)return null;t=i.displayName,r=i.lastKnownHash,o=i.curvePublic}else{if(a.isPadChat)return;if(a.isTeamChat)return}return{id:a.id,isFriendChat:a.isFriendChat,name:t,lastKnownHash:r,curvePublic:o,messages:a.messages}}).filter(function(e){return e});t(u)}(p,u,i):function(e,n,t){var r=E(e.store.proxy);s(function(t){Object.keys(r).forEach(function(o){if("me"!==o){var a=v(r[o]);"object"==typeof a&&a.channel&&P(e,n,a,t())}else delete r.me.channel})}).nThen(function(){-1===e.friendsClients.indexOf(n)&&e.friendsClients.push(n),t()})}(p,n,i)},u},u})(M(),te(),Z(),je(),On(),Y(),on(),qe()),Nt}function Ut(){if(Ct)return xt;Ct=1;return xt=((e,n,t,r)=>{const o={},a={};var i=function(n,t,o,a,i){var s,c=e.once(e.mkAsync(i)),u=function(n,t){if(!t)return e.find(n.store,["proxy","edPublic"]);var r=e.find(n,["store","proxy","teams",t]);return e.find(r,["keys","drive","edPublic"])}(n,a),f=n.Store,l=0,d=0,h=0;r(function(e){f.getFileSize(null,{channel:t},e(function(n){return n&&n.error?(e.abort(),void c(n)):void 0===n.size?(e.abort(),void c({error:"ENOENT"})):void(l=n.size)})),f.getHistory(null,{channel:t,lastKnownHash:o},e(function(n){if(n&&n.error)return e.abort(),void c(n);if(!Array.isArray(n))return e.abort(),void c({error:"EINVAL"});if(n.length){s=n[0].hash;var t=n.map(function(e){return e.msg});d=t.join("\n").length}}),!0),f.pad.getMetadata(null,{channel:t},e(function(n){if((!n||!n.error)&&n&&"object"==typeof n)return h=JSON.stringify(n).length,n&&Array.isArray(n.owners)&&-1!==n.owners.indexOf(u)?void 0:(e.abort(),void c({error:"INSUFFICIENT_PERMISSIONS"}))}))}).nThen(function(){c({size:l-h-d,hash:s})})};return a.GET_HISTORY_SIZE=function(o,a,s,c){if(o.store.loggedIn&&o.store.rpc){var u=a.channels;if(Array.isArray(u)){var f=[];a.account?u=function(r){var o=[],a=e.find(r.store,["proxy","edPublic"]);-1!==(e.find(r.store,["driveMetadata","owners"])||[]).indexOf(a)&&o.push(r.store.driveChannel);var i=r.store.proxy.profile;if(i){var s=i.edit?n.hrefToHexChannelId("/profile/#"+i.edit,null):null;s&&o.push(s)}r.store.proxy.todo&&o.push(n.hrefToHexChannelId("/todo/#"+r.store.proxy.todo,null));var c=r.store.proxy.mailboxes;if(c){var u=Object.keys(c).map(function(e){return{lastKnownHash:c[e].lastKnownHash,channel:c[e].channel}});Array.prototype.push.apply(o,u)}var f=r.store.proxy[t.SHARED_FOLDERS];if(f){var l=Object.keys(f).map(function(e){var n=f[e];if(n&&n.owners&&Array.isArray(n.owners)&&-1!==n.owners.indexOf(a))return n.channel}).filter(Boolean);Array.prototype.push.apply(o,l)}return o}(o):a.team&&(u=function(n,t){let r=e.find(n.store,["proxy","teams",t]);if(!r)return[];let o=[r.channel],a=r.keys.roster;return o.push({channel:a.channel,lastKnownHash:a.lastKnownHash}),o}(o,a.team));var l=0,d=[];r(function(e){u.forEach(function(n){var t,r=n;"object"==typeof n&&n.channel&&(r=n.channel,t=n.lastKnownHash),i(o,r,t,a.teamId,e(function(e){e&&e.error?f.push(e.error):(l+=e.size,e.hash&&d.push({channel:r,hash:e.hash}))}))})}).nThen(function(){c({warning:f.length?f:void 0,channels:d,size:l})})}else c({error:"EINVAL"})}else c({error:"INSUFFICIENT_PERMISSIONS"})},a.TRIM_HISTORY=function(e,n,t,o){if(e.store.loggedIn&&e.store.rpc){var a=n.channels;if(Array.isArray(a)){var i=function(e,n){if(!n)return e.store.rpc;var t=e.store.modules.team;if(t){var r=t.getTeam(n);if(r)return r.rpc}}(e,n.teamId);if(i){var s=[];r(function(e){a.forEach(function(n){i.trimHistory(n,e(function(e){e&&s.push(e)}))})}).nThen(function(){1===a.length&&s.length?o({error:s[0]}):o({warning:s.length?s:void 0})})}else o({error:"ENORPC"})}else o({error:"EINVAL"})}else o({error:"INSUFFICIENT_PERMISSIONS"})},o.init=function(e,n,t){var r={};if(e.store){var o={store:e.store,Store:e.Store,pinPads:e.pinPads,updateMetadata:e.updateMetadata,emit:t};return r.execCommand=function(e,n,t){var r=n.cmd,i=n.data;try{a[r](o,i,e,t)}catch(e){console.error(e)}},r}},o})(Z(),te(),Ue(),qe()),xt}var Bt,Vt={exports:{}};function Yt(){return Bt||(Bt=1,function(e){(()=>{const n=e=>{var n={};const t=globalThis;var r=function(){},o=n.getWeekNo=function(e,n){"number"!=typeof n&&(n=1);var t=new Date(e.getFullYear(),0,1),r=t.getDay()-n;r=r>=0?r:r+7;var o,a=Math.floor((e.getTime()-t.getTime())/864e5)+1;if(r<4){if((o=Math.floor((a+r-1)/7)+1)>52){var i=new Date(e.getFullYear()+1,0,1).getDay()-n;o=(i=i>=0?i:i+7)<4?1:53}}else o=Math.floor((a+r-1)/7);return o},a=function(e){var n=new Date(e.getFullYear(),0,0),t=e-n+60*(n.getTimezoneOffset()-e.getTimezoneOffset())*1e3;return Math.floor(t/864e5)},i=n.DAYORDER=["SU","MO","TU","WE","TH","FR","SA"],s=function(e){var n=Number(e.slice(0,-2)),t=i.indexOf(e.slice(-2));return n?[n,t]:t},c=function(e,n){var t=e.getDay();t>=(n="number"==typeof n?n:1)?e.setDate(e.getDate()-(t-n)):e.setDate(e.getDate()-(7+t-n))},u=function(e){return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()},f={daily:function(e,n){e.setDate(e.getDate()+n)},weekly:function(e,n){e.setDate(e.getDate()+7*n)},monthly:function(e,n){e.setMonth(e.getMonth()+n)},yearly:function(e,n){e.setFullYear(e.getFullYear()+n)}},l={month:function(e,n,t){var r=new Date(n.start),o=(t-(e.getMonth()+1)+12)%12,a=e.getMonth()+o;if(e.setMonth(a),e.setDate(r.getDate()),e.getMonth()===a)return!0},weekno:function(e,n,t,r){var a=r&&r.wkst;"number"!=typeof a&&(a=1);var i=new Date(n.start),s=new Date(e.getFullYear(),11,31),u=o(s,a),f=1===u;1===u&&(u=52);var l=o(e,a);if(!t||t>u)return!1;t<0&&(t=u+t+1);var d=t-l,h=new Date(+e);h.setDate(h.getDate()+7*d),c(h,a);var p="aaaaaaa".split("").map(function(n,t){var r=new Date(+h);if(r.setDate(r.getDate()+t),r.getFullYear()===e.getFullYear())return r.toLocaleDateString()!==i.toLocaleDateString()&&r}).filter(Boolean);return 1===t&&f&&(c(s,a),"aaaaaaa".split("").some(function(n,t){var r=new Date(+s);if(r.setDate(r.getDate()+t),r.toLocaleDateString()!==i.toLocaleDateString())return r.getFullYear()>e.getFullYear()||void p.push(r)})),p.length?p:void 0}};l.yearday=function(e,n,t){var r=e.getFullYear();if(function(e,n){if(!("number"!=typeof n||Math.abs(n)<1||Math.abs(n)>366))return n<0&&(n=a(new Date(e.getFullYear(),11,31))+n+1),e.setMonth(0),e.setDate(n),!0}(e,t)&&e.getFullYear()===r)return!0},l.monthday=function(e,n,t,r){if("number"!=typeof t||Math.abs(t)<1||Math.abs(t)>31)return!1;var o=function(e,n){var t=e.getMonth();n<0&&(n=new Date(e.getFullYear(),e.getMonth()+1,0).getDate()+n+1);return e.setDate(n),e.getMonth()===t};if("monthly"===r.freq)return o(e,t);var a="aaaaaaaaaaaa".split("").map(function(n,r){var a=new Date(e.getFullYear(),r,1);return o(a,t)?a:void 0}).filter(Boolean);return a.length?a:void 0},l.day=function(e,n,t,r){var o,a=s(t);Array.isArray(a)&&(o=a[0],a=a[1]);var i=[];if(![0,1,2,3,4,5,6].includes(a))return!1;var c,u=function(e){if(o){var n=[];"aaaaaaaaaaaa".split("").some(function(t,r){if(void 0===e||r===e){var a,s=i.filter(function(e){return e.getMonth()===r});return a=o<0?s.length+o:o-1,n.push(s[a]),void 0!==e&&r===e}}),i=n.filter(Boolean)}};if("yearly"===r.freq){c=new Date(+e);for(var f=e.getFullYear();c.getDay()!==a;)c.setDate(c.getDate()+1);for(;c.getFullYear()===f;)i.push(new Date(+c)),c.setDate(c.getDate()+7);return u(),i}if("monthly"===r.freq){c=new Date(+e);for(var l=e.getMonth();c.getDay()!==a;)c.setDate(c.getDate()+1);for(;c.getMonth()===l;)i.push(new Date(+c)),c.setDate(c.getDate()+7);return u(l),i}if("weekly"===r.freq)for(;e.getDay()!==a;)e.setDate(e.getDate()+1);return!0};var d={month:function(e,n){return e.filter(function(e){return n.includes(e.getMonth()+1)})},weekno:function(e,n,t){return e.filter(function(e){var r=t&&t.wkst;"number"!=typeof r&&(r=1);var a=new Date(e.getFullYear(),11,31),i=o(a,r);1===i&&(i=52);var s=o(e,r);return n.some(function(e){return e>0?e===s:s===i+e+1})})},yearday:function(e,n){return e.filter(function(e){var t=a(e),r=a(new Date(e.getFullYear(),11,31));return n.some(function(e){return e>0?e===t:t===r+e+1})})},monthday:function(n,t){return n.filter(function(n){var r=e.clone(t);return(r=r.map(function(e){e<0&&(e=new Date(n.getFullYear(),n.getMonth()+1,0).getDate()+e+1);return e})).includes(n.getDate())})},day:function(e,n,t){return e.filter(function(e){var r=e.toLocaleDateString(),o="yearly";return("monthly"===t.freq||"yearly"===t.freq&&t.by&&t.by.month)&&(o="monthly"),n.some(function(n){var t,a=s(n);if(Array.isArray(a)&&(t=a[0],a=a[1]),!t)return e.getDay()===a;var i=new Date(e.getFullYear(),e.getMonth(),1);return"yearly"===o&&i.setMonth(0),l.day(i,{},n,{freq:o}).some(function(e){return e.toLocaleDateString()===r})})})},setpos:function(n,t){var r=n.slice(),o=e.deduplicateString(t.slice().map(function(e){return e>0?e-1:0!==e?r.length+e:void 0}));return n.filter(function(e){var n=r.indexOf(e);return o.includes(n)})}},h=["month","weekno","yearday","monthday","day"],p=["month","monthday","day"];n.getMonthId=function(e){return e.getFullYear()+"-"+e.getMonth()};var v=t.CP_calendar_cache={},y={};n.resetCache=function(){v=t.CP_calendar_cache={},y={}};var m=function(n){if(!n.recUpdate)return[];var t={},r=n.recUpdate.from;return Object.keys(r||{}).forEach(function(e){var n=r[e];n.recurrenceRule&&(t[e]=n.recurrenceRule)}),Object.keys(t).sort(function(e,n){return Number(e)-Number(n)}).map(function(n){var r=e.clone(t[n]);if(f[r.freq]&&!(r.interval&&r.interval<1))return r._start=Number(n),r}).filter(Boolean)};n.getRecurring=function(o,i){t.CP_DEV_MODE&&(r=console.warn);var s=[];return o.forEach(function(t){var o=t.split("-"),g=new Date(o[0],o[1]),E=new Date(+g);E.setMonth(E.getMonth()+1),E.setMilliseconds(-1),r("Compute month",g.toLocaleDateString()),(i||[]).forEach(function(t){var o=new Date(t.start),i=new Date(t.end),b=t,O=t.recurrenceRule;if(O){var A=m(t),w=A.shift();if(!(o>=E)){for(var D=O.until,_=A.slice(),T=w;T&&T._start&&T._startn)){var t;if(n.getFullYear()===e.getFullYear())t=a(n)-a(e);else{var r=new Date(e.getFullYear(),11,31);for(t=a(r)-a(e)+a(n);r.getFullYear()+1=N)){r("Start iteration",i.toLocaleDateString());var m=function(n,t,o){var a=e.clone(t),i=new Date(a.start),s=a.id.split("|")[0],u=o.toLocaleDateString();v[s]=v[s]||{};var y=n.interval||1,m=n.freq,g=[],E=function(e,t){g=d[e](g,t,n)},b=function(e){return function(t){var r=new Date(+o);"yearly"===n.freq?(r.setMonth(0),r.setDate(1)):"monthly"===n.freq?r.setDate(1):"weekly"===n.freq?c(r,n.wkst):n.freq;var s=l[e](r,a,t,n);if(s)if(Array.isArray(s))s=s.filter(function(e){return e.toLocaleDateString()!==i.toLocaleDateString()}),Array.prototype.push.apply(g,s);else{if(r.toLocaleDateString()===i.toLocaleDateString())return;g.push(r)}}},O=e.once(function(){f[m](o,y)}),A=function(){"monthly"===m?o.setDate(15):"yearly"===m&&1===i.getMonth()&&29===i.getDate()&&o.setDate(28),O();var e=new Date(+o);if("monthly"===m||"yearly"===m){if(e.setDate(i.getDate()),e.getDate()!==i.getDate())return;if("yearly"===m&&e.getMonth()!==i.getMonth())return}g.push(e)};if(Array.isArray(v[s][u]))return r("Get cache",s,u),"monthly"===m?o.setDate(15):"yearly"===m&&1===i.getMonth()&&29===i.getDate()&&o.setDate(28),O(),v[s][u];if(n.by&&"yearly"===m){var w=h.slice(),D=!1;(n.by.weekno||n.by.yearday||n.by.monthday||n.by.day)&&(w.shift(),D=!0);var _=!0;w.forEach(function(e){var t=n.by[e];t&&(_?(t.forEach(b(e)),_=!1):"day"===e?n.by.yearday||n.by.monthday||n.by.weekno?E("day",n.by.day):n.by.day.forEach(b("day")):E(e,t))}),n.by.month&&D&&E("month",n.by.month)}n.by&&"monthly"===m&&(n.by.monthday||n.by.day?n.by.monthday?n.by.monthday.forEach(b("monthday")):n.by.day&&n.by.day.forEach(b("day")):A(),n.by.month&&E("month",n.by.month),n.by.day&&n.by.monthday&&E("day",n.by.day)),n.by&&"weekly"===m&&(n.by.day?n.by.day.forEach(b("day")):A(),n.by.month&&E("month",n.by.month)),n.by&&"daily"===m&&(A(),p.forEach(function(e){var t=n.by[e];t&&E(e,t)})),g.sort(function(e,n){return e-n}),n.by&&n.by.setpos&&E("setpos",n.by.setpos),n.by&&Object.keys(n.by).length?O():A();var T=[];return g=g.filter(function(e){var n=new Date(+e).toLocaleDateString();return!T.includes(n)&&(T.push(n),!0)}),r("Set cache",s,u),v[s][u]=g,g}(O,t,i);if(r("Iteration results",JSON.stringify(m.map(function(e){return new Date(e).toLocaleDateString()}))),!m.length)return i.getFullYear()=N)return r(h.toLocaleDateString(),"count"),D=!0,!0;if(h>=E)return r(h.toLocaleDateString(),"endMonth"),D=!0,!0;if(O.until&&h>O.until)return r(h.toLocaleDateString(),"until"),D=!0,!0;if(!(h=E||h=g){if(y[c.id]&&y[c.id].includes(c.start))return;y[c.id]=y[c.id]||[],y[c.id].push(c.start)}if(b.timeZone&&!c.isAllDay){var m=function(e,n,t){var r=function(e,n){let t=e.toLocaleString("en-CA",{timeZone:n,hour12:!1}).replace(", ","T");return t+="."+e.getMilliseconds().toString().padStart(3,"0"),-(new Date(t+"Z")-e)},o=Intl.DateTimeFormat().resolvedOptions().timeZone,a=r(n,e)-r(t,e);return r(n,o)-r(t,o)-a}(b.timeZone,o,h);c.start+=m,c.end+=m}return s.push(c),_?(v(),!0):void 0}r(h.toLocaleDateString(),"start")}),D||x(i)}};x(o),r("Added this month (all events)",s.map(function(e){return new Date(e.start).toLocaleDateString()}))}}}}})}),s},n.getAllOccurrences=function(e){if(!e.recurrenceRule)return[e.start];var t=e.recurrenceRule;if(!t.until&&!t.count)return!1;var r=[e.start],o=new Date(e.start);o.setDate(15);for(var a=[],i=0,s=function(){return t.count?r.length=1e4;)t.setDate(t.getDate()-a),o++;return{d:o*=a,h:(t=new Date(n)).getHours()-r.getHours(),m:t.getMinutes()-r.getMinutes()}};return n.applyUpdates=function(e){return e.forEach(function(e){if(e.raw={start:e.start,end:e.end},e.recUpdate){var n,t=e.recUpdate.from||{},r=e.recUpdate.one||{},o=e.start,a=m(e).filter(function(e){return e._start>o}).shift(),i=function(n,t){var r=n[t],o=new Date(e.raw[t]);o.setDate(o.getDate()+r.d),o.setHours(o.getHours()+r.h),o.setMinutes(o.getMinutes()+r.m),e[t]=+o};(n=t,Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})).forEach(function(n){o",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},o={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},a=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},i=function(e){return!0===e?1:0};function s(e,n){var t;return function(){var r=this;clearTimeout(t),t=setTimeout(function(){return e.apply(r,arguments)},n)}}var c=function(e){return e instanceof Array?e:[e]};function u(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function f(e,n,t){var r=window.document.createElement(e);return n=n||"",t=t||"",r.className=n,void 0!==t&&(r.textContent=t),r}function l(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function d(e,n){return n(e)?e:e.parentNode?d(e.parentNode,n):void 0}function h(e,n){var t=f("div","numInputWrapper"),r=f("input","numInput "+e),o=f("span","arrowUp"),a=f("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?r.type="number":(r.type="text",r.pattern="\\d*"),void 0!==n)for(var i in n)r.setAttribute(i,n[i]);return t.appendChild(r),t.appendChild(o),t.appendChild(a),t}function p(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var v=function(){},y=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},m={D:v,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours(parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*i(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var r=parseInt(n),o=new Date(e.getFullYear(),0,2+7*(r-1),0,0,0,0);return o.setDate(o.getDate()-o.getDay()+t.firstDayOfWeek),o},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours(parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:v,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:v,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},g={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},E={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[E.w(e,n,t)]},F:function(e,n,t){return y(E.n(e,n,t)-1,!1,n)},G:function(e,n,t){return a(E.h(e,n,t))},H:function(e){return a(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[i(e.getHours()>11)]},M:function(e,n){return y(e.getMonth(),!0,n)},S:function(e){return a(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return a(e.getFullYear(),4)},d:function(e){return a(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return a(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return a(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},b=function(e){var n=e.config,t=void 0===n?r:n,a=e.l10n,i=void 0===a?o:a,s=e.isMobile,c=void 0!==s&&s;return function(e,n,r){var o=r||i;return void 0===t.formatDate||c?n.split("").map(function(n,r,a){return E[n]&&"\\"!==a[r-1]?E[n](e,o,t):"\\"!==n?n:""}).join(""):t.formatDate(e,n,o)}},O=function(e){var n=e.config,t=void 0===n?r:n,a=e.l10n,i=void 0===a?o:a;return function(e,n,o,a){if(0===e||e){var s,c=a||i,u=e;if(e instanceof Date)s=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)s=new Date(e);else if("string"==typeof e){var f=n||(t||r).dateFormat,l=String(e).trim();if("today"===l)s=new Date,o=!0;else if(/Z$/.test(l)||/GMT$/.test(l))s=new Date(e);else if(t&&t.parseDate)s=t.parseDate(e,f);else{s=t&&t.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var d=void 0,h=[],p=0,v=0,y="";p=0?new Date:new Date(E.config.minDate.getTime()),t=D(E.config);n.setHours(t.hours,t.minutes,t.seconds,n.getMilliseconds()),E.selectedDates=[n],E.latestSelectedDateObj=n}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var n="keydown"===e.type,t=p(e),r=t;void 0!==E.amPM&&t===E.amPM&&(E.amPM.textContent=E.l10n.amPM[i(E.amPM.textContent===E.l10n.amPM[0])]);var o=parseFloat(r.getAttribute("min")),s=parseFloat(r.getAttribute("max")),c=parseFloat(r.getAttribute("step")),u=parseInt(r.value,10),f=u+c*(e.delta||(n?38===e.which?1:-1:0));if(void 0!==r.value&&2===r.value.length){var l=r===E.hourElement,d=r===E.minuteElement;fs&&(f=r===E.hourElement?f-s-i(!E.amPM):o,d&&L(void 0,1,E.hourElement)),E.amPM&&l&&(1===c?f+u===23:Math.abs(f-u)>c)&&(E.amPM.textContent=E.l10n.amPM[i(E.amPM.textContent===E.l10n.amPM[0])]),r.value=a(f)}}(e);var r=E._input.value;I(),be(),E._input.value!==r&&E._debouncedChange()}function I(){if(void 0!==E.hourElement&&void 0!==E.minuteElement){var e,n,t=(parseInt(E.hourElement.value.slice(-2),10)||0)%24,r=(parseInt(E.minuteElement.value,10)||0)%60,o=void 0!==E.secondElement?(parseInt(E.secondElement.value,10)||0)%60:0;void 0!==E.amPM&&(e=t,n=E.amPM.textContent,t=e%12+12*i(n===E.l10n.amPM[1]));var a=void 0!==E.config.minTime||E.config.minDate&&E.minDateHasTime&&E.latestSelectedDateObj&&0===A(E.latestSelectedDateObj,E.config.minDate,!0);if(void 0!==E.config.maxTime||E.config.maxDate&&E.maxDateHasTime&&E.latestSelectedDateObj&&0===A(E.latestSelectedDateObj,E.config.maxDate,!0)){var s=void 0!==E.config.maxTime?E.config.maxTime:E.config.maxDate;(t=Math.min(t,s.getHours()))===s.getHours()&&(r=Math.min(r,s.getMinutes())),r===s.getMinutes()&&(o=Math.min(o,s.getSeconds()))}if(a){var c=void 0!==E.config.minTime?E.config.minTime:E.config.minDate;(t=Math.max(t,c.getHours()))===c.getHours()&&r=12)]),void 0!==E.secondElement&&(E.secondElement.value=a(t)))}function R(e){var n=p(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&X(t)}function P(e,n,t,r){return n instanceof Array?n.forEach(function(n){return P(e,n,t,r)}):e instanceof Array?e.forEach(function(e){return P(e,n,t,r)}):(e.addEventListener(n,t,r),void E._handlers.push({remove:function(){return e.removeEventListener(n,t)}}))}function k(){ve("onChange")}function M(e,n){var t=void 0!==e?E.parseDate(e):E.latestSelectedDateObj||(E.config.minDate&&E.config.minDate>E.now?E.config.minDate:E.config.maxDate&&E.config.maxDate=0&&A(e,E.selectedDates[1])<=0}(n)&&!me(n)&&a.classList.add("inRange"),E.weekNumbers&&1===E.config.showMonths&&"prevMonthDay"!==e&&t%7==1&&E.weekNumbers.insertAdjacentHTML("beforeend",""+E.config.getWeek(n)+""),ve("onDayCreate",a),a}function j(e){e.focus(),"range"===E.config.mode&&re(e)}function K(e){for(var n=e>0?0:E.config.showMonths-1,t=e>0?E.config.showMonths:-1,r=n;r!=t;r+=e)for(var o=E.daysContainer.children[r],a=e>0?0:o.children.length-1,i=e>0?o.children.length:-1,s=a;s!=i;s+=e){var c=o.children[s];if(-1===c.className.indexOf("hidden")&&$(c.dateObj))return c}}function U(e,n){var t=ee(document.activeElement||document.body),r=void 0!==e?e:t?document.activeElement:void 0!==E.selectedDateElem&&ee(E.selectedDateElem)?E.selectedDateElem:void 0!==E.todayDateElem&&ee(E.todayDateElem)?E.todayDateElem:K(n>0?1:-1);void 0===r?E._input.focus():t?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():E.currentMonth,r=n>0?E.config.showMonths:-1,o=n>0?1:-1,a=t-E.currentMonth;a!=r;a+=o)for(var i=E.daysContainer.children[a],s=t-E.currentMonth===a?e.$i+n:n<0?i.children.length-1:0,c=i.children.length,u=s;u>=0&&u0?c:-1);u+=o){var f=i.children[u];if(-1===f.className.indexOf("hidden")&&$(f.dateObj)&&Math.abs(e.$i-u)>=Math.abs(n))return j(f)}E.changeMonth(o),U(K(o),0)}(r,n):j(r)}function B(e,n){for(var t=(new Date(e,n,1).getDay()-E.l10n.firstDayOfWeek+7)%7,r=E.utils.getDaysInMonth((n-1+12)%12,e),o=E.utils.getDaysInMonth(n,e),a=window.document.createDocumentFragment(),i=E.config.showMonths>1,s=i?"prevMonthDay hidden":"prevMonthDay",c=i?"nextMonthDay hidden":"nextMonthDay",u=r+1-t,l=0;u<=r;u++,l++)a.appendChild(H(s,new Date(e,n-1,u),u,l));for(u=1;u<=o;u++,l++)a.appendChild(H("",new Date(e,n,u),u,l));for(var d=o+1;d<=42-t&&(1===E.config.showMonths||l%7!=0);d++,l++)a.appendChild(H(c,new Date(e,n+1,d%o),d,l));var h=f("div","dayContainer");return h.appendChild(a),h}function V(){if(void 0!==E.daysContainer){l(E.daysContainer),E.weekNumbers&&l(E.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n1||"dropdown"!==E.config.monthSelectorType)){var e=function(e){return!(void 0!==E.config.minDate&&E.currentYear===E.config.minDate.getFullYear()&&eE.config.maxDate.getMonth())};E.monthsDropdownContainer.tabIndex=-1,E.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=f("option","flatpickr-monthDropdown-month");t.value=new Date(E.currentYear,n).getMonth().toString(),t.textContent=y(n,E.config.shorthandCurrentMonth,E.l10n),t.tabIndex=-1,E.currentMonth===n&&(t.selected=!0),E.monthsDropdownContainer.appendChild(t)}}}function G(){var e,n=f("div","flatpickr-month"),t=window.document.createDocumentFragment();E.config.showMonths>1||"static"===E.config.monthSelectorType?e=f("span","cur-month"):(E.monthsDropdownContainer=f("select","flatpickr-monthDropdown-months"),E.monthsDropdownContainer.setAttribute("aria-label",E.l10n.monthAriaLabel),P(E.monthsDropdownContainer,"change",function(e){var n=p(e),t=parseInt(n.value,10);E.changeMonth(t-E.currentMonth),ve("onMonthChange")}),Y(),e=E.monthsDropdownContainer);var r=h("cur-year",{tabindex:"-1"}),o=r.getElementsByTagName("input")[0];o.setAttribute("aria-label",E.l10n.yearAriaLabel),E.config.minDate&&o.setAttribute("min",E.config.minDate.getFullYear().toString()),E.config.maxDate&&(o.setAttribute("max",E.config.maxDate.getFullYear().toString()),o.disabled=!!E.config.minDate&&E.config.minDate.getFullYear()===E.config.maxDate.getFullYear());var a=f("div","flatpickr-current-month");return a.appendChild(e),a.appendChild(r),t.appendChild(a),n.appendChild(t),{container:n,yearElement:o,monthElement:e}}function J(){l(E.monthNav),E.monthNav.appendChild(E.prevMonthNav),E.config.showMonths&&(E.yearElements=[],E.monthElements=[]);for(var e=E.config.showMonths;e--;){var n=G();E.yearElements.push(n.yearElement),E.monthElements.push(n.monthElement),E.monthNav.appendChild(n.container)}E.monthNav.appendChild(E.nextMonthNav)}function q(){E.weekdayContainer?l(E.weekdayContainer):E.weekdayContainer=f("div","flatpickr-weekdays");for(var e=E.config.showMonths;e--;){var n=f("div","flatpickr-weekdaycontainer");E.weekdayContainer.appendChild(n)}return W(),E.weekdayContainer}function W(){if(E.weekdayContainer){var e=E.l10n.firstDayOfWeek,t=n(E.l10n.weekdays.shorthand);e>0&&e\n "+t.join("")+"\n \n "}}function z(e,n){void 0===n&&(n=!0);var t=n?e:e-E.currentMonth;t<0&&!0===E._hidePrevMonthArrow||t>0&&!0===E._hideNextMonthArrow||(E.currentMonth+=t,(E.currentMonth<0||E.currentMonth>11)&&(E.currentYear+=E.currentMonth>11?1:-1,E.currentMonth=(E.currentMonth+12)%12,ve("onYearChange"),Y()),V(),ve("onMonthChange"),ge())}function Q(e){return!(!E.config.appendTo||!E.config.appendTo.contains(e))||E.calendarContainer.contains(e)}function Z(e){if(E.isOpen&&!E.config.inline){var n=p(e),t=Q(n),r=n===E.input||n===E.altInput||E.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(E.input)||~e.path.indexOf(E.altInput)),o="blur"===e.type?r&&e.relatedTarget&&!Q(e.relatedTarget):!r&&!t&&!Q(e.relatedTarget),a=!E.config.ignoredFocusElements.some(function(e){return e.contains(n)});o&&a&&(void 0!==E.timeContainer&&void 0!==E.minuteElement&&void 0!==E.hourElement&&""!==E.input.value&&void 0!==E.input.value&&N(),E.close(),E.config&&"range"===E.config.mode&&1===E.selectedDates.length&&(E.clear(!1),E.redraw()))}}function X(e){if(!(!e||E.config.minDate&&eE.config.maxDate.getFullYear())){var n=e,t=E.currentYear!==n;E.currentYear=n||E.currentYear,E.config.maxDate&&E.currentYear===E.config.maxDate.getFullYear()?E.currentMonth=Math.min(E.config.maxDate.getMonth(),E.currentMonth):E.config.minDate&&E.currentYear===E.config.minDate.getFullYear()&&(E.currentMonth=Math.max(E.config.minDate.getMonth(),E.currentMonth)),t&&(E.redraw(),ve("onYearChange"),Y())}}function $(e,n){var t;void 0===n&&(n=!0);var r=E.parseDate(e,void 0,n);if(E.config.minDate&&r&&A(r,E.config.minDate,void 0!==n?n:!E.minDateHasTime)<0||E.config.maxDate&&r&&A(r,E.config.maxDate,void 0!==n?n:!E.maxDateHasTime)>0)return!1;if(!E.config.enable&&0===E.config.disable.length)return!0;if(void 0===r)return!1;for(var o=!!E.config.enable,a=null!==(t=E.config.enable)&&void 0!==t?t:E.config.disable,i=0,s=void 0;i=s.from.getTime()&&r.getTime()<=s.to.getTime())return o}return!o}function ee(e){return void 0!==E.daysContainer&&-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&E.daysContainer.contains(e)}function ne(e){e.target!==E._input||!(E.selectedDates.length>0||E._input.value.length>0)||e.relatedTarget&&Q(e.relatedTarget)||E.setDate(E._input.value,!0,e.target===E.altInput?E.config.altFormat:E.config.dateFormat)}function te(e){var n=p(e),t=E.config.wrap?v.contains(n):n===E._input,r=E.config.allowInput,o=E.isOpen&&(!r||!t),a=E.config.inline&&t&&!r;if(13===e.keyCode&&t){if(r)return E.setDate(E._input.value,!0,n===E.altInput?E.config.altFormat:E.config.dateFormat),n.blur();E.open()}else if(Q(n)||o||a){var i=!!E.timeContainer&&E.timeContainer.contains(n);switch(e.keyCode){case 13:i?(e.preventDefault(),N(),fe()):le(e);break;case 27:e.preventDefault(),fe();break;case 8:case 46:t&&!E.config.allowInput&&(e.preventDefault(),E.clear());break;case 37:case 39:if(i||t)E.hourElement&&E.hourElement.focus();else if(e.preventDefault(),void 0!==E.daysContainer&&(!1===r||document.activeElement&&ee(document.activeElement))){var s=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),z(s),U(K(1),0)):U(void 0,s)}break;case 38:case 40:e.preventDefault();var c=40===e.keyCode?1:-1;E.daysContainer&&void 0!==n.$i||n===E.input||n===E.altInput?e.ctrlKey?(e.stopPropagation(),X(E.currentYear-c),U(K(1),0)):i||U(void 0,7*c):n===E.currentYearElement?X(E.currentYear-c):E.config.enableTime&&(!i&&E.hourElement&&E.hourElement.focus(),N(e),E._debouncedChange());break;case 9:if(i){var u=[E.hourElement,E.minuteElement,E.secondElement,E.amPM].concat(E.pluginElements).filter(function(e){return e}),f=u.indexOf(n);if(-1!==f){var l=u[f+(e.shiftKey?-1:1)];e.preventDefault(),(l||E._input).focus()}}else!E.config.noCalendar&&E.daysContainer&&E.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),E._input.focus())}}if(void 0!==E.amPM&&n===E.amPM)switch(e.key){case E.l10n.amPM[0].charAt(0):case E.l10n.amPM[0].charAt(0).toLowerCase():E.amPM.textContent=E.l10n.amPM[0],I(),be();break;case E.l10n.amPM[1].charAt(0):case E.l10n.amPM[1].charAt(0).toLowerCase():E.amPM.textContent=E.l10n.amPM[1],I(),be()}(t||Q(n))&&ve("onKeyDown",e)}function re(e){if(1===E.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var n=e?e.dateObj.getTime():E.days.firstElementChild.dateObj.getTime(),t=E.parseDate(E.selectedDates[0],void 0,!0).getTime(),r=Math.min(n,E.selectedDates[0].getTime()),o=Math.max(n,E.selectedDates[0].getTime()),a=!1,i=0,s=0,c=r;cr&&ci)?i=c:c>t&&(!s||c0&&h0&&h>s;return p?(d.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(e){d.classList.remove(e)}),"continue"):a&&!p?"continue":(["startRange","inRange","endRange","notAllowed"].forEach(function(e){d.classList.remove(e)}),void(void 0!==e&&(e.classList.add(n<=E.selectedDates[0].getTime()?"startRange":"endRange"),tn&&h===t&&d.classList.add("endRange"),h>=i&&(0===s||h<=s)&&(u=t,l=n,(c=h)>Math.min(u,l)&&c0||t.getMinutes()>0||t.getSeconds()>0),E.selectedDates&&(E.selectedDates=E.selectedDates.filter(function(e){return $(e)}),E.selectedDates.length||"min"!==e||x(t),be()),E.daysContainer&&(ue(),void 0!==t?E.currentYearElement[e]=t.getFullYear().toString():E.currentYearElement.removeAttribute(e),E.currentYearElement.disabled=!!r&&void 0!==t&&r.getFullYear()===t.getFullYear())}}function ie(){return E.config.wrap?v.querySelector("[data-input]"):v}function se(){"object"!=typeof E.config.locale&&void 0===S.l10ns[E.config.locale]&&E.config.errorHandler(new Error("flatpickr: invalid locale "+E.config.locale)),E.l10n=e(e({},S.l10ns.default),"object"==typeof E.config.locale?E.config.locale:"default"!==E.config.locale?S.l10ns[E.config.locale]:void 0),g.K="("+E.l10n.amPM[0]+"|"+E.l10n.amPM[1]+"|"+E.l10n.amPM[0].toLowerCase()+"|"+E.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},m),JSON.parse(JSON.stringify(v.dataset||{}))).time_24hr&&void 0===S.defaultConfig.time_24hr&&(E.config.time_24hr=E.l10n.time_24hr),E.formatDate=b(E),E.parseDate=O({config:E.config,l10n:E.l10n})}function ce(e){if("function"!=typeof E.config.position){if(void 0!==E.calendarContainer){ve("onPreCalendarPosition");var n=e||E._positionElement,t=Array.prototype.reduce.call(E.calendarContainer.children,function(e,n){return e+n.offsetHeight},0),r=E.calendarContainer.offsetWidth,o=E.config.position.split(" "),a=o[0],i=o.length>1?o[1]:null,s=n.getBoundingClientRect(),c=window.innerHeight-s.bottom,f="above"===a||"below"!==a&&ct,l=window.pageYOffset+s.top+(f?-t-2:n.offsetHeight+2);if(u(E.calendarContainer,"arrowTop",!f),u(E.calendarContainer,"arrowBottom",f),!E.config.inline){var d=window.pageXOffset+s.left,h=!1,p=!1;"center"===i?(d-=(r-s.width)/2,h=!0):"right"===i&&(d-=r-s.width,p=!0),u(E.calendarContainer,"arrowLeft",!h&&!p),u(E.calendarContainer,"arrowCenter",h),u(E.calendarContainer,"arrowRight",p);var v=window.document.body.offsetWidth-(window.pageXOffset+s.right),y=d+r>window.document.body.offsetWidth,m=v+r>window.document.body.offsetWidth;if(u(E.calendarContainer,"rightMost",y),!E.config.static)if(E.calendarContainer.style.top=l+"px",y)if(m){var g=function(){for(var e=null,n=0;nE.currentMonth+E.config.showMonths-1)&&"range"!==E.config.mode;if(E.selectedDateElem=t,"single"===E.config.mode)E.selectedDates=[r];else if("multiple"===E.config.mode){var a=me(r);a?E.selectedDates.splice(parseInt(a),1):E.selectedDates.push(r)}else"range"===E.config.mode&&(2===E.selectedDates.length&&E.clear(!1,!1),E.latestSelectedDateObj=r,E.selectedDates.push(r),0!==A(r,E.selectedDates[0],!0)&&E.selectedDates.sort(function(e,n){return e.getTime()-n.getTime()}));if(I(),o){var i=E.currentYear!==r.getFullYear();E.currentYear=r.getFullYear(),E.currentMonth=r.getMonth(),i&&(ve("onYearChange"),Y()),ve("onMonthChange")}if(ge(),V(),be(),o||"range"===E.config.mode||1!==E.config.showMonths?void 0!==E.selectedDateElem&&void 0===E.hourElement&&E.selectedDateElem&&E.selectedDateElem.focus():j(t),void 0!==E.hourElement&&void 0!==E.hourElement&&E.hourElement.focus(),E.config.closeOnSelect){var s="single"===E.config.mode&&!E.config.enableTime,c="range"===E.config.mode&&2===E.selectedDates.length&&!E.config.enableTime;(s||c)&&fe()}k()}}E.parseDate=O({config:E.config,l10n:E.l10n}),E._handlers=[],E.pluginElements=[],E.loadedPlugins=[],E._bind=P,E._setHoursFromDate=x,E._positionCalendar=ce,E.changeMonth=z,E.changeYear=X,E.clear=function(e,n){if(void 0===e&&(e=!0),void 0===n&&(n=!0),E.input.value="",void 0!==E.altInput&&(E.altInput.value=""),void 0!==E.mobileInput&&(E.mobileInput.value=""),E.selectedDates=[],E.latestSelectedDateObj=void 0,!0===n&&(E.currentYear=E._initialDate.getFullYear(),E.currentMonth=E._initialDate.getMonth()),!0===E.config.enableTime){var t=D(E.config);C(t.hours,t.minutes,t.seconds)}E.redraw(),e&&ve("onChange")},E.close=function(){E.isOpen=!1,E.isMobile||(void 0!==E.calendarContainer&&E.calendarContainer.classList.remove("open"),void 0!==E._input&&E._input.classList.remove("active")),ve("onClose")},E._createElement=f,E.destroy=function(){void 0!==E.config&&ve("onDestroy");for(var e=E._handlers.length;e--;)E._handlers[e].remove();if(E._handlers=[],E.mobileInput)E.mobileInput.parentNode&&E.mobileInput.parentNode.removeChild(E.mobileInput),E.mobileInput=void 0;else if(E.calendarContainer&&E.calendarContainer.parentNode)if(E.config.static&&E.calendarContainer.parentNode){var n=E.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else E.calendarContainer.parentNode.removeChild(E.calendarContainer);E.altInput&&(E.input.type="text",E.altInput.parentNode&&E.altInput.parentNode.removeChild(E.altInput),delete E.altInput),E.input&&(E.input.type=E.input._type,E.input.classList.remove("flatpickr-input"),E.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){try{delete E[e]}catch(e){}})},E.isEnabled=$,E.jumpToDate=M,E.open=function(e,n){if(void 0===n&&(n=E._positionElement),!0===E.isMobile){if(e){e.preventDefault();var t=p(e);t&&t.blur()}return void 0!==E.mobileInput&&(E.mobileInput.focus(),E.mobileInput.click()),void ve("onOpen")}if(!E._input.disabled&&!E.config.inline){var r=E.isOpen;E.isOpen=!0,r||(E.calendarContainer.classList.add("open"),E._input.classList.add("active"),ve("onOpen"),ce(n)),!0===E.config.enableTime&&!0===E.config.noCalendar&&(!1!==E.config.allowInput||void 0!==e&&E.timeContainer.contains(e.relatedTarget)||setTimeout(function(){return E.hourElement.select()},50))}},E.redraw=ue,E.set=function(e,n){if(null!==e&&"object"==typeof e)for(var r in Object.assign(E.config,e),e)void 0!==de[r]&&de[r].forEach(function(e){return e()});else E.config[e]=n,void 0!==de[e]?de[e].forEach(function(e){return e()}):t.indexOf(e)>-1&&(E.config[e]=c(n));E.redraw(),be(!0)},E.setDate=function(e,n,t){if(void 0===n&&(n=!1),void 0===t&&(t=E.config.dateFormat),0!==e&&!e||e instanceof Array&&0===e.length)return E.clear(n);he(e,t),E.latestSelectedDateObj=E.selectedDates[E.selectedDates.length-1],E.redraw(),M(void 0,n),x(),0===E.selectedDates.length&&E.clear(!1),be(n),n&&ve("onChange")},E.toggle=function(e){if(!0===E.isOpen)return E.close();E.open(e)};var de={locale:[se,W],showMonths:[J,T,q],minDate:[M],maxDate:[M],clickOpens:[function(){!0===E.config.clickOpens?(P(E._input,"focus",E.open),P(E._input,"click",E.open)):(E._input.removeEventListener("focus",E.open),E._input.removeEventListener("click",E.open))}]};function he(e,n){var t=[];if(e instanceof Array)t=e.map(function(e){return E.parseDate(e,n)});else if(e instanceof Date||"number"==typeof e)t=[E.parseDate(e,n)];else if("string"==typeof e)switch(E.config.mode){case"single":case"time":t=[E.parseDate(e,n)];break;case"multiple":t=e.split(E.config.conjunction).map(function(e){return E.parseDate(e,n)});break;case"range":t=e.split(E.l10n.rangeSeparator).map(function(e){return E.parseDate(e,n)})}else E.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));E.selectedDates=E.config.allowInvalidPreload?t:t.filter(function(e){return e instanceof Date&&$(e,!1)}),"range"===E.config.mode&&E.selectedDates.sort(function(e,n){return e.getTime()-n.getTime()})}function pe(e){return e.slice().map(function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?E.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:E.parseDate(e.from,void 0),to:E.parseDate(e.to,void 0)}:e}).filter(function(e){return e})}function ve(e,n){if(void 0!==E.config){var t=E.config[e];if(void 0!==t&&t.length>0)for(var r=0;t[r]&&r1||"static"===E.config.monthSelectorType?E.monthElements[n].textContent=y(t.getMonth(),E.config.shorthandCurrentMonth,E.l10n)+" ":E.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()}),E._hidePrevMonthArrow=void 0!==E.config.minDate&&(E.currentYear===E.config.minDate.getFullYear()?E.currentMonth<=E.config.minDate.getMonth():E.currentYearE.config.maxDate.getMonth():E.currentYear>E.config.maxDate.getFullYear()))}function Ee(e){return E.selectedDates.map(function(n){return E.formatDate(n,e)}).filter(function(e,n,t){return"range"!==E.config.mode||E.config.enableTime||t.indexOf(e)===n}).join("range"!==E.config.mode?E.config.conjunction:E.l10n.rangeSeparator)}function be(e){void 0===e&&(e=!0),void 0!==E.mobileInput&&E.mobileFormatStr&&(E.mobileInput.value=void 0!==E.latestSelectedDateObj?E.formatDate(E.latestSelectedDateObj,E.mobileFormatStr):""),E.input.value=Ee(E.config.dateFormat),void 0!==E.altInput&&(E.altInput.value=Ee(E.config.altFormat)),!1!==e&&ve("onValueUpdate")}function Oe(e){var n=p(e),t=E.prevMonthNav.contains(n),r=E.nextMonthNav.contains(n);t||r?z(t?-1:1):E.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?E.changeYear(E.currentYear+1):n.classList.contains("arrowDown")&&E.changeYear(E.currentYear-1)}return function(){E.element=E.input=v,E.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],o=e(e({},JSON.parse(JSON.stringify(v.dataset||{}))),m),a={};E.config.parseDate=o.parseDate,E.config.formatDate=o.formatDate,Object.defineProperty(E.config,"enable",{get:function(){return E.config._enable},set:function(e){E.config._enable=pe(e)}}),Object.defineProperty(E.config,"disable",{get:function(){return E.config._disable},set:function(e){E.config._disable=pe(e)}});var i="time"===o.mode;if(!o.dateFormat&&(o.enableTime||i)){var s=S.defaultConfig.dateFormat||r.dateFormat;a.dateFormat=o.noCalendar||i?"H:i"+(o.enableSeconds?":S":""):s+" H:i"+(o.enableSeconds?":S":"")}if(o.altInput&&(o.enableTime||i)&&!o.altFormat){var u=S.defaultConfig.altFormat||r.altFormat;a.altFormat=o.noCalendar||i?"h:i"+(o.enableSeconds?":S K":" K"):u+" h:i"+(o.enableSeconds?":S":"")+" K"}Object.defineProperty(E.config,"minDate",{get:function(){return E.config._minDate},set:ae("min")}),Object.defineProperty(E.config,"maxDate",{get:function(){return E.config._maxDate},set:ae("max")});var f=function(e){return function(n){E.config["min"===e?"_minTime":"_maxTime"]=E.parseDate(n,"H:i:S")}};Object.defineProperty(E.config,"minTime",{get:function(){return E.config._minTime},set:f("min")}),Object.defineProperty(E.config,"maxTime",{get:function(){return E.config._maxTime},set:f("max")}),"time"===o.mode&&(E.config.noCalendar=!0,E.config.enableTime=!0),Object.assign(E.config,a,o);for(var l=0;l-1?E.config[h]=c(d[h]).map(_).concat(E.config[h]):void 0===o[h]&&(E.config[h]=d[h])}o.altInputClass||(E.config.altInputClass=ie().className+" "+E.config.altInputClass),ve("onParseConfig")}(),se(),E.input=ie(),E.input?(E.input._type=E.input.type,E.input.type="text",E.input.classList.add("flatpickr-input"),E._input=E.input,E.config.altInput&&(E.altInput=f(E.input.nodeName,E.config.altInputClass),E._input=E.altInput,E.altInput.placeholder=E.input.placeholder,E.altInput.disabled=E.input.disabled,E.altInput.required=E.input.required,E.altInput.tabIndex=E.input.tabIndex,E.altInput.type="text",E.input.setAttribute("type","hidden"),!E.config.static&&E.input.parentNode&&E.input.parentNode.insertBefore(E.altInput,E.input.nextSibling)),E.config.allowInput||E._input.setAttribute("readonly","readonly"),E._positionElement=E.config.positionElement||E._input):E.config.errorHandler(new Error("Invalid input element specified")),function(){E.selectedDates=[],E.now=E.parseDate(E.config.now)||new Date;var e=E.config.defaultDate||("INPUT"!==E.input.nodeName&&"TEXTAREA"!==E.input.nodeName||!E.input.placeholder||E.input.value!==E.input.placeholder?E.input.value:null);e&&he(e,E.config.dateFormat),E._initialDate=E.selectedDates.length>0?E.selectedDates[0]:E.config.minDate&&E.config.minDate.getTime()>E.now.getTime()?E.config.minDate:E.config.maxDate&&E.config.maxDate.getTime()0&&(E.latestSelectedDateObj=E.selectedDates[0]),void 0!==E.config.minTime&&(E.config.minTime=E.parseDate(E.config.minTime,"H:i")),void 0!==E.config.maxTime&&(E.config.maxTime=E.parseDate(E.config.maxTime,"H:i")),E.minDateHasTime=!!E.config.minDate&&(E.config.minDate.getHours()>0||E.config.minDate.getMinutes()>0||E.config.minDate.getSeconds()>0),E.maxDateHasTime=!!E.config.maxDate&&(E.config.maxDate.getHours()>0||E.config.maxDate.getMinutes()>0||E.config.maxDate.getSeconds()>0)}(),E.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=E.currentMonth),void 0===n&&(n=E.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:E.l10n.daysInMonth[e]}},E.isMobile||function(){var e=window.document.createDocumentFragment();if(E.calendarContainer=f("div","flatpickr-calendar"),E.calendarContainer.tabIndex=-1,!E.config.noCalendar){if(e.appendChild((E.monthNav=f("div","flatpickr-months"),E.yearElements=[],E.monthElements=[],E.prevMonthNav=f("span","flatpickr-prev-month"),E.prevMonthNav.innerHTML=E.config.prevArrow,E.nextMonthNav=f("span","flatpickr-next-month"),E.nextMonthNav.innerHTML=E.config.nextArrow,J(),Object.defineProperty(E,"_hidePrevMonthArrow",{get:function(){return E.__hidePrevMonthArrow},set:function(e){E.__hidePrevMonthArrow!==e&&(u(E.prevMonthNav,"flatpickr-disabled",e),E.__hidePrevMonthArrow=e)}}),Object.defineProperty(E,"_hideNextMonthArrow",{get:function(){return E.__hideNextMonthArrow},set:function(e){E.__hideNextMonthArrow!==e&&(u(E.nextMonthNav,"flatpickr-disabled",e),E.__hideNextMonthArrow=e)}}),E.currentYearElement=E.yearElements[0],ge(),E.monthNav)),E.innerContainer=f("div","flatpickr-innerContainer"),E.config.weekNumbers){var n=function(){E.calendarContainer.classList.add("hasWeeks");var e=f("div","flatpickr-weekwrapper");e.appendChild(f("span","flatpickr-weekday",E.l10n.weekAbbreviation));var n=f("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,r=n.weekNumbers;E.innerContainer.appendChild(t),E.weekNumbers=r,E.weekWrapper=t}E.rContainer=f("div","flatpickr-rContainer"),E.rContainer.appendChild(q()),E.daysContainer||(E.daysContainer=f("div","flatpickr-days"),E.daysContainer.tabIndex=-1),V(),E.rContainer.appendChild(E.daysContainer),E.innerContainer.appendChild(E.rContainer),e.appendChild(E.innerContainer)}E.config.enableTime&&e.appendChild(function(){E.calendarContainer.classList.add("hasTime"),E.config.noCalendar&&E.calendarContainer.classList.add("noCalendar");var e=D(E.config);E.timeContainer=f("div","flatpickr-time"),E.timeContainer.tabIndex=-1;var n=f("span","flatpickr-time-separator",":"),t=h("flatpickr-hour",{"aria-label":E.l10n.hourAriaLabel});E.hourElement=t.getElementsByTagName("input")[0];var r=h("flatpickr-minute",{"aria-label":E.l10n.minuteAriaLabel});if(E.minuteElement=r.getElementsByTagName("input")[0],E.hourElement.tabIndex=E.minuteElement.tabIndex=-1,E.hourElement.value=a(E.latestSelectedDateObj?E.latestSelectedDateObj.getHours():E.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),E.minuteElement.value=a(E.latestSelectedDateObj?E.latestSelectedDateObj.getMinutes():e.minutes),E.hourElement.setAttribute("step",E.config.hourIncrement.toString()),E.minuteElement.setAttribute("step",E.config.minuteIncrement.toString()),E.hourElement.setAttribute("min",E.config.time_24hr?"0":"1"),E.hourElement.setAttribute("max",E.config.time_24hr?"23":"12"),E.hourElement.setAttribute("maxlength","2"),E.minuteElement.setAttribute("min","0"),E.minuteElement.setAttribute("max","59"),E.minuteElement.setAttribute("maxlength","2"),E.timeContainer.appendChild(t),E.timeContainer.appendChild(n),E.timeContainer.appendChild(r),E.config.time_24hr&&E.timeContainer.classList.add("time24hr"),E.config.enableSeconds){E.timeContainer.classList.add("hasSeconds");var o=h("flatpickr-second");E.secondElement=o.getElementsByTagName("input")[0],E.secondElement.value=a(E.latestSelectedDateObj?E.latestSelectedDateObj.getSeconds():e.seconds),E.secondElement.setAttribute("step",E.minuteElement.getAttribute("step")),E.secondElement.setAttribute("min","0"),E.secondElement.setAttribute("max","59"),E.secondElement.setAttribute("maxlength","2"),E.timeContainer.appendChild(f("span","flatpickr-time-separator",":")),E.timeContainer.appendChild(o)}return E.config.time_24hr||(E.amPM=f("span","flatpickr-am-pm",E.l10n.amPM[i((E.latestSelectedDateObj?E.hourElement.value:E.config.defaultHour)>11)]),E.amPM.title=E.l10n.toggleTitle,E.amPM.tabIndex=-1,E.timeContainer.appendChild(E.amPM)),E.timeContainer}()),u(E.calendarContainer,"rangeMode","range"===E.config.mode),u(E.calendarContainer,"animate",!0===E.config.animate),u(E.calendarContainer,"multiMonth",E.config.showMonths>1),E.calendarContainer.appendChild(e);var o=void 0!==E.config.appendTo&&void 0!==E.config.appendTo.nodeType;if((E.config.inline||E.config.static)&&(E.calendarContainer.classList.add(E.config.inline?"inline":"static"),E.config.inline&&(!o&&E.element.parentNode?E.element.parentNode.insertBefore(E.calendarContainer,E._input.nextSibling):void 0!==E.config.appendTo&&E.config.appendTo.appendChild(E.calendarContainer)),E.config.static)){var s=f("div","flatpickr-wrapper");E.element.parentNode&&E.element.parentNode.insertBefore(s,E.element),s.appendChild(E.element),E.altInput&&s.appendChild(E.altInput),s.appendChild(E.calendarContainer)}E.config.static||E.config.inline||(void 0!==E.config.appendTo?E.config.appendTo:window.document.body).appendChild(E.calendarContainer)}(),function(){if(E.config.wrap&&["open","close","toggle","clear"].forEach(function(e){Array.prototype.forEach.call(E.element.querySelectorAll("[data-"+e+"]"),function(n){return P(n,"click",E[e])})}),E.isMobile)!function(){var e=E.config.enableTime?E.config.noCalendar?"time":"datetime-local":"date";E.mobileInput=f("input",E.input.className+" flatpickr-mobile"),E.mobileInput.tabIndex=1,E.mobileInput.type=e,E.mobileInput.disabled=E.input.disabled,E.mobileInput.required=E.input.required,E.mobileInput.placeholder=E.input.placeholder,E.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",E.selectedDates.length>0&&(E.mobileInput.defaultValue=E.mobileInput.value=E.formatDate(E.selectedDates[0],E.mobileFormatStr)),E.config.minDate&&(E.mobileInput.min=E.formatDate(E.config.minDate,"Y-m-d")),E.config.maxDate&&(E.mobileInput.max=E.formatDate(E.config.maxDate,"Y-m-d")),E.input.getAttribute("step")&&(E.mobileInput.step=String(E.input.getAttribute("step"))),E.input.type="hidden",void 0!==E.altInput&&(E.altInput.type="hidden");try{E.input.parentNode&&E.input.parentNode.insertBefore(E.mobileInput,E.input.nextSibling)}catch(e){}P(E.mobileInput,"change",function(e){E.setDate(p(e).value,!1,E.mobileFormatStr),ve("onChange"),ve("onClose")})}();else{var e=s(oe,50);if(E._debouncedChange=s(k,300),E.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&P(E.daysContainer,"mouseover",function(e){"range"===E.config.mode&&re(p(e))}),P(window.document.body,"keydown",te),E.config.inline||E.config.static||P(window,"resize",e),void 0!==window.ontouchstart?P(window.document,"touchstart",Z):P(window.document,"mousedown",Z),P(window.document,"focus",Z,{capture:!0}),!0===E.config.clickOpens&&(P(E._input,"focus",E.open),P(E._input,"click",E.open)),void 0!==E.daysContainer&&(P(E.monthNav,"click",Oe),P(E.monthNav,["keyup","increment"],R),P(E.daysContainer,"click",le)),void 0!==E.timeContainer&&void 0!==E.minuteElement&&void 0!==E.hourElement){var n=function(e){return p(e).select()};P(E.timeContainer,["increment"],N),P(E.timeContainer,"blur",N,{capture:!0}),P(E.timeContainer,"click",F),P([E.hourElement,E.minuteElement],["focus","click"],n),void 0!==E.secondElement&&P(E.secondElement,"focus",function(){return E.secondElement&&E.secondElement.select()}),void 0!==E.amPM&&P(E.amPM,"click",function(e){N(e),k()})}E.config.allowInput&&P(E._input,"blur",ne)}}(),(E.selectedDates.length||E.config.noCalendar)&&(E.config.enableTime&&x(E.config.noCalendar?E.latestSelectedDateObj:void 0),be(!1)),T();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!E.isMobile&&n&&ce(),ve("onReady")}(),E}function T(e,n){for(var t=Array.prototype.slice.call(e).filter(function(e){return e instanceof HTMLElement}),r=[],o=0;o{var l={setCustomize:()=>{}},d=function(e,n){if(!n||1===n)return e.store;var t=e.store.modules&&e.store.modules.team;return t?t.getTeam(n):void 0},h=function(n,t){n.emit("UPDATE",{teams:t.stores,roTeams:t.roStores,id:t.channel,loading:!t.ready&&!t.cacheready,readOnly:t.readOnly||!t.ready&&t.cacheready||t.offline,offline:t.offline,deleted:!t.stores.length,restricted:t.restricted,owned:n.Store.isOwned(t.owners),content:e.clone(t.proxy),hashes:t.hashes},n.clients)},p=function(e,n){var t=e.calendars[n];t&&t.reminders&&Object.keys(t.reminders).forEach(function(e){Array.isArray(t.reminders[e])&&t.reminders[e].forEach(function(e){clearTimeout(e)})})},v=function(e,n){var t=e.calendars[n];t&&(t.stores.length||(t.lm.stop(),p(e,n),delete e.calendars[n]))},y=function(e,n,t){n.stores.forEach(function(r){var o=d(e,r);if(o&&o.proxy&&o.rpc&&o.proxy.calendars){var a=o.proxy.calendars[n.channel];a&&(a.color!==t.color&&(a.color=t.color),a.title!==t.title&&(a.title=t.title))}})},m=function(n,t,r,o){var a=+new Date,i=e.clone(r),s=i.id;if(Array.isArray(t[s])&&t[s].forEach(function(e){clearTimeout(e)}),t[s]=[],!r.deleted){var u=e.find(n,["store","proxy","hideReminders",s])||[],f=n.store.data.lastVisit;if(i.isAllDay&&(i.startDay&&(i.start=+c.parseDate(i.startDay)),i.endDay)){var l=c.parseDate(i.endDay);l.setHours(23),l.setMinutes(59),l.setSeconds(59),i.end=+l}var d=a-6048e5,h=o&&i.start>f&&i.end<=a&&i.end>d;if(i.end<=a&&!h)return delete t[s],void function(n,t){var r=e.find(n,["store","proxy","hideReminders"])||{};Object.keys(r).filter(function(e){return e===t}).forEach(function(e){delete r[e]})}(n,s);var p=!1,v=function(t){p=!0,n.Store.onReadyEvt.reg(function(){!function(t){if(!e.find(n,["store","proxy","settings","general","calendar","hideNotif"])){var r=i.start<=a?i.start:+new Date;n.store.mailbox.showMessage("reminders",{msg:{ctime:r,type:"REMINDER",missed:Boolean(h),content:i},hash:"REMINDER|"+s+"-"+t},null,function(){})}}(t)})},y=i.reminders||[];y.sort(function(e,n){return e-n}),y.some(function(e){var n=a+6e4*e;if(!u.some(function(n){return e>=n}))return i.start-n>=2147483647||(i.start<=n?(v(e),!0):void t[s].push(setTimeout(function(){v(e)},i.start-n)))}),p||n.Store.onReadyEvt.reg(function(){n.store.mailbox.hideMessage("reminders",{hash:"REMINDER|"+s},null,function(){})})}},g=function(n,t,r,o){var i=function(e){var n=new Date,t=new Date(n.getFullYear(),n.getMonth()-1,15),r=new Date(n.getFullYear(),n.getMonth()+1,15),o=a.getMonthId(t),i=a.getMonthId(n),s=a.getMonthId(r),c=a.getRecurring([o,i,s],[e]),u=[e];return Array.prototype.push.apply(u,c),u}(e.clone(r));i.forEach(function(e){m(n,t,e,o)})},E=function(e,n,t){var r=e.calendars[n];t&&r&&r.reminders&&(1===r.stores.length&&0===r.stores[0]||g(e,r.reminders,t))},b=function(n,t,r){var o=n.calendars[t];if(o&&o.reminders&&!Object.keys(o.reminders).length&&(1!==o.stores.length||0!==o.stores[0])){var a=e.find(o,["proxy","content"]);a&&Object.keys(a).forEach(function(e){g(n,o.reminders,a[e],r)})}},O=function(t,r,a){var c=e.once(e.mkAsync(a||function(){})),l=r.storeId,v=r.data,m=v.channel;if(m){var g=t.calendars[m],O=function(){h(t,g)};if(g){if(g.readOnly&&v.href){var A=n.parsePadUrl(v.href),w=n.getSecrets("calendar",A.hash,v.password),D=u.createEncryptor(w.keys);g.hashes.editHash=n.getEditHashFromKeys(w),g.lm.setReadOnly(!1,D),g.readOnly=!1}else if(0===l)return 1===g.stores.length&&0===g.stores[0]&&g.tempId.length&&r.cId&&g.tempId.push(r.cId),void c();return-1!==g.roStores.indexOf(l)&&v.href&&(g.roStores.splice(g.roStores.indexOf(l),1),-1!==g.stores.indexOf(0)&&g.stores.splice(g.stores.indexOf(0),1),O()),g.stores&&-1!==g.stores.indexOf(l)?void c():(-1!==g.stores.indexOf(0)&&(g.stores.splice(g.stores.indexOf(0),1),g.tempId=[]),g.stores.push(l),v.href||g.roStores.push(l),O(),void c())}g=t.calendars[m]={ready:!1,channel:m,readOnly:!v.href,tempId:[],stores:[l],roStores:v.href?[]:[l],reminders:{},hashes:{}},0===l&&g.tempId.push(r.cId);var _=n.parsePadUrl(v.href||v.roHref),T=n.getSecrets("calendar",_.hash,v.password),S=u.createEncryptor(T.keys);g.hashes.viewHash=n.getViewHashFromKeys(T),v.href&&(g.hashes.editHash=n.getEditHashFromKeys(T)),g.proxy={metadata:{color:v.color,title:v.title}},O();var N=function(){g.stores.forEach(function(e){var n=d(t,e);n&&n.rpc&&n.proxy.calendars&&(delete n.proxy.calendars[m],(n.unpin||t.unpinPads)([m],function(e){e&&e.error&&console.error(e.error)}))}),g.lm&&g.lm.stop(),g.stores=[],h(t,g),p(t,m),delete t.calendars[m]};i(function(e){t.store.network&&!r.isNew&&t.Store.isNewChannel(null,m,e(function(n){if(!n||!n.error)return n&&"boolean"==typeof n.isNew&&n.isNew?(N(),c({error:"EDELETED"}),void e.abort()):void 0}))}).nThen(function(){var e;if(1!==l&&l){var n=t.store.modules.team&&t.store.modules.team.getTeamsData(),a=n&&n[l];e=a?a.edPublic:void 0}else e=t.store.proxy.edPublic;var i={data:{},network:t.store.network||t.store.networkPromise,channel:T.channel,crypto:S,owners:[e],ChainPad:f,validateKey:T.keys.validateKey||void 0,userName:"calendar",Cache:o,classic:!0,onRejected:t.Store&&t.Store.onRejected},u=s.create(i);g.lm=u;var d=g.proxy=u.proxy,h=!1,p=function(){h||(h=!0,setTimeout(function(){h=!1,O()}))};u.proxy.on("cacheready",function(){d.metadata&&(g.cacheready=!0,p(),c&&c(null,u.proxy),b(t,m,r.lastVisitNotif))}).on("ready",function(e){var n=e.metadata;if(g.owners=n.owners||[],g.ready=!0,!d.metadata){if(!r.isNew)return void N();d.metadata={color:v.color,title:v.title}}p(),c&&c(null,u.proxy),b(t,m,r.lastVisitNotif)}).on("change",[],function(){g.ready&&p()}).on("change",["content"],function(e,n,r){2!==r.length||!n||e?2!==r.length||n||!e?(r.length>=3&&["start","reminders","isAllDay"].includes(r[2])||r.length>=6&&["start","reminders","isAllDay"].includes(r[5]))&&setTimeout(function(){E(t,m,d.content[r[1]])}):E(t,m,{id:r[1],start:0}):E(t,m,n)}).on("remove",["content"],function(e,n){p(),(n.length>=3&&"reminders"===n[2]||n.length>=6&&"reminders"===n[5])&&setTimeout(function(){E(t,m,d.content[n[1]])})}).on("change",["metadata"],function(){var e=d.metadata;e&&e.title&&e.color&&y(t,g,e)}).on("disconnect",function(){g.offline=!0,p()}).on("reconnect",function(){g.offline=!1,p()}).on("error",function(e){e&&e.error&&("EDELETED"!==e.error?("ERESTRICTED"===e.error&&(g.restricted=!0,p()),c(e)):N())})})}},A=function(e,n){if(n.href&&-1===n.href.indexOf("#"))if(e.secondaryKey)try{n.href=e.userObject.cryptor.decrypt(n.href)}catch(e){console.error(e),delete n.href}else delete n.href},w=function(n,t){var r=t.proxy.calendars,o=t.id||1;t.proxy.on("change",["calendars"],function(r,a,i){i.length<2||(r&&!a&&function(){var e=i[1],t=n.calendars[e];if(t){var r=t.stores.indexOf(o);if(-1!==r){t.stores.splice(r,1);var a=t.roStores.indexOf(o);-1!==a&&t.roStores.splice(a,1),v(n,e),h(n,t)}}}(),!r&&a&&function(){var r=i[1],a=t.proxy.calendars[r];if(a){var s=e.clone(a);A(t,s),O(n,{storeId:o,data:s})}}())}),Object.keys(r||{}).forEach(function(a){var i=e.clone(r[a]);A(t,i),O(n,{storeId:o,lastVisitNotif:!0,data:i})})},D=function(e,t,o,a){var i=d(e,t.teamId);if(i)if(i.rpc){var s,c,u,f=i.proxy.calendars=i.proxy.calendars||{},l=(s=n.createRandomHash("calendar"),c=n.getSecrets("calendar",s),u=n.getViewHashFromKeys(c),{href:n.hashToHref(s,"calendar"),roHref:n.hashToHref(u,"calendar"),channel:c.channel});l.color=t.color,l.title=t.title,O(e,{storeId:i.id||1,data:l,isNew:!0},function(n){if(n)return console.error(n),void a({error:n.error});var t=e.calendars[l.channel];r.whenRealtimeSyncs(t.lm.realtime,function(){f[l.channel]=l,(i.pin||e.pinPads)([l.channel],function(e){e&&e.error&&console.error(e.error)}),e.Store.onSync(i.id,a)})})}else a({error:"EFORBIDDEN"});else a({error:"NO_STORE"})};return l.init=function(t,o,a){var s={},c=t.store,u={loggedIn:c.loggedIn&&c.proxy.edPublic,store:c,Store:t.Store,pinPads:t.pinPads,unpinPads:t.unpinPads,updateMetadata:t.updateMetadata,emit:a,onReady:e.mkEvent(!0),calendars:{},clients:[]};return function(e,n){var t=e.store.proxy;t.calendars=t.calendars||{},setTimeout(n)}(u,o(function(e){e||function(e){w(e,e.store);var n=e.store.modules.team&&e.store.modules.team.getTeamsData();n&&Object.keys(n).forEach(function(n){var t=d(e,n);w(e,t)})}(u)})),u.store.proxy.on("change",["hideReminders"],function(e,n,t){var r=t[1].split("|")[0];Object.keys(u.calendars).some(function(e){var n=u.calendars[e];if(n&&n.proxy&&n.proxy.content)return n.proxy.content[r]?(setTimeout(function(){E(u,e,n.proxy.content[r])}),!0):void 0})}),s.closeTeam=function(e){Object.keys(u.calendars).forEach(function(n){var t=u.calendars[n],r=t.stores.indexOf(e);if(-1!==r){t.stores.splice(r,1);var o=t.roStores.indexOf(e);-1!==o&&t.roStores.splice(o,1),v(u,n),h(u,t)}})},s.openTeam=function(e){var n=d(u,e);n&&w(u,n)},s.upgradeTeam=function(n){if(n){var t=d(u,n);t&&Object.keys(u.calendars).forEach(function(r){var o=u.calendars[r];if(-1!==o.stores.indexOf(n)){var a=t.proxy.calendars[r],i=e.clone(a);A(t,i),O(u,{storeId:n,data:i}),h(u,o)}})}},s.removeClient=function(e){!function(e,n){var t=e.clients.indexOf(n);-1!==t&&e.clients.splice(t,1),Object.keys(e.calendars).forEach(function(t){var r=e.calendars[t];if(1===r.stores.length&&0===r.stores[0]&&r.tempId.length){var o=r.tempId.indexOf(n);-1!==o&&r.tempId.splice(o,1),r.tempId.length||(r.stores=[],v(e,t))}})}(u,e)},s.execCommand=function(t,o,a){var s=o.cmd,c=o.data;if("SUBSCRIBE"!==s){if("OPEN"!==s)return"IMPORT"===s?u.store.offline?void a({error:"OFFLINE"}):u.loggedIn?void function(t,r,o,a){var i=r.id,s=t.calendars[i];if(s)if(Array.isArray(s.stores)&&-1!==s.stores.indexOf(r.teamId)){var c=t.store,u=c.proxy.calendars=c.proxy.calendars||{},f=s.hashes.editHash,l=s.hashes.viewHash;u[i]={href:f&&n.hashToHref(f,"calendar"),roHref:l&&n.hashToHref(l,"calendar"),channel:i,color:e.find(s,["proxy","metadata","color"])||e.getRandomColor(),title:e.find(s,["proxy","metadata","title"])||"..."},t.Store.onSync(null,a),O(t,{storeId:1,data:{href:u[i].href,toHref:u[i].roHref,channel:i}})}else a({error:"EINVAL"});else a({error:"ENOENT"})}(u,c,0,a):void a({error:"NOT_LOGGED_IN"}):"IMPORT_ICS"===s?u.store.offline?void a({error:"OFFLINE"}):void function(e,n,t,o){var a=n.id,i=e.calendars[a];if(i&&i.proxy){var s=n.json;i.proxy.content=i.proxy.content||{},Object.keys(s).forEach(function(n){i.proxy.content[n]=s[n],E(e,a,s[n])}),r.whenRealtimeSyncs(i.lm.realtime,function(){h(e,i),o()})}else o({error:"ENOENT"})}(u,c,0,a):"ADD"===s?u.store.offline?void a({error:"OFFLINE"}):u.loggedIn?void function(t,r,o,a){var i=d(t,r.teamId);if(i)if(i.rpc){var s=i.proxy.calendars=i.proxy.calendars||{},c=n.parsePadUrl(r.href),u=n.getSecrets(c.type,c.hash,r.password);if(u.channel===r.channel){var f=n.getEditHashFromKeys(u),l=n.getViewHashFromKeys(u),h=f&&n.hashToHref(f,"calendar"),p={href:h,roHref:l&&n.hashToHref(l,"calendar"),color:r.color,title:r.title,channel:r.channel};!s[r.channel]||!s[r.channel].href&&p.href?(p.color=r.color,p.title=r.title,O(t,{storeId:i.id||1,data:e.clone(p)},function(e){if(e)return console.error(e),void a({error:e.error});if(h&&i.id&&i.secondaryKey)try{p.href=i.userObject.cryptor.encrypt(h)}catch(e){console.error(e)}s[p.channel]=p,(i.pin||t.pinPads)([p.channel],function(e){e&&e.error&&console.error(e.error)}),t.Store.onSync(i.id,a)})):a()}else a({error:"EINVAL"})}else a({error:"EFORBIDDEN"});else a({error:"NO_STORE"})}(u,c,0,a):void a({error:"NOT_LOGGED_IN"}):"CREATE"===s?u.loggedIn?c.initialCalendar?void u.Store.onReadyEvt.reg(function(){D(u,c,0,a)}):u.store.offline?void a({error:"OFFLINE"}):void D(u,c,0,a):void a({error:"NOT_LOGGED_IN"}):"UPDATE"===s?u.store.offline?void a({error:"OFFLINE"}):void function(n,t,o,a){var i=t.id,s=n.calendars[i];if(s){var c=e.find(s,["proxy","metadata"]);c?(c.title=t.title,c.color=t.color,r.whenRealtimeSyncs(s.lm.realtime,a),h(n,s),y(n,s,t)):a({error:"EINVAL"})}else a({error:"ENOENT"})}(u,c,0,a):"DELETE"===s?u.store.offline?void a({error:"OFFLINE"}):u.loggedIn?void function(e,n,t,r){var o=d(e,n.teamId);if(o)if(o.rpc){if(o.proxy.calendars){var a=n.id;if(o.proxy.calendars[a]){delete o.proxy.calendars[a],(o.unpin||e.unpinPads)([a],function(e){e&&e.error&&console.error(e.error)});var i=e.calendars[a],s=i.stores.indexOf(o.id||1);i.stores.splice(s,1),v(e,a),e.Store.onSync(o.id,function(){h(e,i),r()})}else r()}}else r({error:"EFORBIDDEN"});else r({error:"NO_STORE"})}(u,c,0,a):void a({error:"NOT_LOGGED_IN"}):"CREATE_EVENT"===s?u.store.offline?void a({error:"OFFLINE"}):void function(e,n,t,o){var a=n.calendarId,i=e.calendars[a];if(i){var s=new Date(n.start),c=new Date(n.end);n.isAllDay?(n.startDay=s.getFullYear()+"-"+(s.getMonth()+1)+"-"+s.getDate(),n.endDay=c.getFullYear()+"-"+(c.getMonth()+1)+"-"+c.getDate()):(delete n.startDay,delete n.endDay),i.proxy.content=i.proxy.content||{},i.proxy.content[n.id]=n,r.whenRealtimeSyncs(i.lm.realtime,function(){E(e,a,n),h(e,i),o()})}else o({error:"ENOENT"})}(u,c,0,a):"UPDATE_EVENT"===s?u.store.offline?void a({error:"OFFLINE"}):void function(n,t,o,a){if(t&&t.ev){var s=t.ev.calendarId,c=n.calendars[s];if(c&&c.proxy&&c.proxy.content){var u=c.proxy.content[t.ev.id];if(u){t.rawData=t.rawData||{};var f,l=t.changes||{},d=t.type||{};if(l.calendarId){if(!(f=n.calendars[l.calendarId])||!f.proxy)return void a({error:"ENOENT"});f.proxy.content=f.proxy.content||{}}var p={one:{},from:{}};["one","from","all"].includes(d.which)&&(u.recUpdate=u.recUpdate||p,u.recUpdate.one||(u.recUpdate.one={}),u.recUpdate.from||(u.recUpdate.from={}));var v=u.recUpdate,y=["calendarId"],m=Object.keys(l).filter(function(e){return!y.includes(e)}),g=function(e){[v.from,v.one].forEach(function(n){Object.keys(n).forEach(function(t){Number(t){const r=[],o=null==Xt?void 0:Xt.httpUnsafeOrigin;ie.fetchApi(o,"config",!0,e=>{var o,a;(null===(o=null==e?void 0:e.adminKeys)||void 0===o?void 0:o.includes(n))&&r.push("admin");(null===(a=null==e?void 0:e.moderatorKeys)||void 0===a?void 0:a.includes(n))&&r.push("moderator"),t(r)})},er=(e,n,t)=>{e.Store.anonRpcMsg("",{msg:"IS_PREMIUM",data:n},e=>{let n=Array.isArray(e)&&e[0];t(n?["premium"]:[])})},nr=(e,n,t,r)=>{var o,a;const i=[];null==Xt||Xt.httpUnsafeOrigin;const s=n.edPublic||(null===(a=null===(o=e.store)||void 0===o?void 0:o.proxy)||void 0===a?void 0:a.edPublic);rt(e=>{$t(0,s,e(e=>{Array.prototype.push.apply(i,e)}))}).nThen(n=>{er(e,s,n(e=>{Array.prototype.push.apply(i,e)}))}).nThen(()=>{r(i)})},tr={admin:$t,moderator:$t,premium:er},rr={init:(e,n,t)=>{const r={store:e.store,Store:e.Store,updateMetadata:e.updateMetadata},o=r.Store;return o.onReadyEvt.reg(()=>{var e;const n=o.getMetadata(void 0,"drive",()=>{}),t=(null===(e=null==n?void 0:n.user)||void 0===e?void 0:e.badge)||"";t&&nr(r,{},0,e=>{var n,o;if(!e.includes(t)){const e=null===(o=null===(n=null==r?void 0:r.store)||void 0===n?void 0:n.modules)||void 0===o?void 0:o.profile;null==e||e.execCommand(void 0,{cmd:"SET",data:{key:"badge",value:""}},()=>{})}})}),{listBadges:(e,n)=>{nr(r,e,0,n)},removeClient:()=>{},execCommand:(e,n,t)=>{const o=n.cmd,a=n.data;"LIST_BADGES"!==o?"CHECK_BADGE"!==o?t():((e,n,t,r)=>{const{badge:o,ed:a,sig:i,nid:s}=n,c=ie.decodeBase64(a),u=ie.decodeBase64(i),f=Zt.sign.open(u,c);if(!f)return void r({verified:!1});if(ie.encodeUTF8(f)!==s)return void r({verified:!1});let l=tr[o];l?l(e,a,e=>{r({verified:e.includes(o),badge:o})}):r({verified:!1,error:"EINVAL"})})(r,a,0,t):nr(r,a,0,t)}}},setCustomize:e=>{Xt=null==e?void 0:e.ApiConfig}};var or,ar,ir=o(Object.freeze({__proto__:null,Badge:rr}));function sr(){if(ar)return or;ar=1;return or=((e,n,t,r,o,a,i,s,c,u,f,l,d,h,p,v,y,m,g,E,b,O,A,w,D,_,T,S,N,I,x,C,R,P,k,M)=>{const F=p.Account,L=v.Drive,H=y.Pad,j=S.Badge,K=globalThis;globalThis.nacl=globalThis.nacl||x.Nacl;let U={},B={};const V=a.Saferphore;var Y=a.mkEvent(!0),G=a.mkEvent(!0),J=a.mkEvent(!0),q=a.mkEvent(!0);var W={drive:{hideDuplicate:!0},pad:{width:!0,spellcheck:!0},security:{unsafeLinks:!1},general:{allowUserFeedback:!0}};return{setCustomize:e=>{U=e.ApiConfig,B=e.AppConfig},create:function(p){var v=K.Cryptpad_Store={};let y=p.query||function(){},S=p.broadcast||function(){};var C=K.CryptPad_AsyncStore={modules:{}};v.onReadyEvt=Y,v.pad=H.init({Store:v,store:C,postMessage:y,broadcast:S}),v.drive=L.initAPI({Store:v,store:C,postMessage:y,broadcast:S});var R=[],P=C.sendDriveEvent=function(e,n,t){R.forEach(function(r){r!==t&&y(r,e,n)})},z=v.getStore=function(e){if(!e)return C;try{var n=C.modules.team.getTeam(e);return n||void console.error("Team not found",e)}catch(n){return console.error(n),void console.error("Team not found",e)}},Q=v.onSync=function(e,n){var t=z(e);t?M(function(e){if(t.realtime&&c.whenRealtimeSyncs(t.realtime,e()),!t.id&&t.drive?.realtime&&c.whenRealtimeSyncs(t.drive.realtime,e()),t.sharedFolders&&"object"==typeof t.sharedFolders)for(var n in t.sharedFolders)t.sharedFolders[n].realtime&&c.whenRealtimeSyncs(t.sharedFolders[n].realtime,e())}).nThen(function(){n()}):n({error:"ENOTFOUND"})};v.get=function(e,n,t){var r=z(n.teamId);r?r.proxy?t(a.find(r.proxy,n.key)):t({error:"ENODRIVE"}):t({error:"ENOTFOUND"})},v.set=function(e,n,t){var r=z(n.teamId);if(r)if(r.proxy){var o=n.key.slice(),i=o.pop(),s=a.find(r.proxy,o);s&&"object"==typeof s?(void 0===n.value?delete s[i]:s[i]=n.value,n.teamId||(S([e],"UPDATE_METADATA"),Array.isArray(o)&&"profile"===o[0]&&C.messenger&&u.updateMyData(C)),Q(n.teamId,t)):t({error:"INVALID_PATH"})}else t({error:"ENODRIVE"});else t({error:"ENOTFOUND"})},v.getSharedFolder=function(e,t,r){var o,i=z(t.teamId),s=t.id;if(i&&i.manager){if(i.manager.folders[s])return(o=a.clone(i.manager.folders[s].proxy)).offline=Boolean(i.manager.folders[s].offline),void r(o);var c=a.find(i.proxy,["drive",n.SHARED_FOLDERS])||{};c[s]?v.loadSharedFolder(t.teamId,s,c[s],function(){r(i.manager.folders[s].proxy)}):r({})}else r({error:"ENOTFOUND"})},v.restoreSharedFolder=function(e,n,t){if(n.sfId&&n.drive){var r=z(n.teamId);r.sharedFolders[n.sfId]&&(Object.keys(n.drive).forEach(function(e){r.sharedFolders[n.sfId].proxy[e]=n.drive[e]}),Object.keys(r.sharedFolders[n.sfId].proxy).forEach(function(e){n.drive[e]||delete r.sharedFolders[n.sfId].proxy[e]})),Q(n.teamId,t)}else t({error:"EINVAL"})},v.hasSigningKeys=function(){if(C.proxy)return"string"==typeof C.proxy.edPrivate&&"string"==typeof C.proxy.edPublic},v.hasCurveKeys=function(){if(C.proxy)return"string"==typeof C.proxy.curvePrivate&&"string"==typeof C.proxy.curvePublic},v.isOwned=function(e){var n=C.proxy.edPublic;if(!n)return!1;if(!Array.isArray(e)||!e.length)return!1;if(-1!==e.indexOf(n))return!0;var t=C.proxy.teams;return!!t&&Object.keys(t).some(function(n){var r=a.find(t[n],["keys","drive","edPublic"]);return r&&-1!==e.indexOf(r)})};var Z=function(e){var n=e?C.manager.getChannelsList("expirable"):function(){var e=`${C.driveChannel}#drive`;if(!e)return null;var n=C.manager.getChannelsList("pin"),t=C.proxy.profile;if(t){var r=t.edit?o.hrefToHexChannelId("/profile/#"+t.edit,null):null;r&&n.push(r);var a=t.avatar?o.hrefToHexChannelId(t.avatar,null):null;a&&n.push(a)}if(C.proxy.todo&&n.push(o.hrefToHexChannelId("/todo/#"+C.proxy.todo,null)),C.proxy.friends){var i=u.getFriendChannelsList(C.proxy);n=n.concat(i)}if(C.proxy.mailboxes){var s=Object.keys(C.proxy.mailboxes).map(function(e){if("broadcast"!==e||C.isAdmin)return C.proxy.mailboxes[e].channel}).filter(Boolean);n=n.concat(s)}if(C.proxy.calendars){var c=Object.keys(C.proxy.calendars).map(function(e){return C.proxy.calendars[e].channel});n=n.concat(c)}return n.push(e),C.data&&C.data.blockId&&n.push(`${C.data.blockId}#block`),n.sort(),n}();return a.deduplicateString(n).sort()};v.pinPads=function(e,n,t){if(n){var r=z(n&&n.teamId);if(r.rpc){"function"!=typeof t&&(console.error("expected a callback"),t=function(){});var o=n.pads||n;r.rpc.pin(o,function(e){t(e?{error:e}:{})})}else t({error:"RPC_NOT_READY"})}else t({error:"EINVAL"})},v.unpinPads=function(e,n,t){if(n){var r=z(n&&n.teamId);if(r.rpc){var o=n.pads||n;r.rpc.unpin(o,function(e){t(e?{error:e}:{})})}else t({error:"RPC_NOT_READY"})}else t({error:"EINVAL"})};var X=C.account={};v.getPinnedUsage=function(e,n,t){var r=z(n&&n.teamId);r&&r.rpc?r.rpc.getFileListSize(function(e,n){r.id||"number"!=typeof n||(X.usage=n),t({bytes:n})}):t({error:"RPC_NOT_READY"})},v.getPinLimit=function(e,n,t){var r=z(n&&n.teamId);r.rpc?r.rpc.getLimit(function(e,n,o,a){if(e)t({error:e});else{var i=r.id?{}:X;i.limit=n,i.plan=o,i.note=a,t(i)}}):t({error:"RPC_NOT_READY"})};v.uploadComplete=function(e,n,t){var r=z(n.teamId);r?r.rpc?n.owned?r.rpc.ownedUploadComplete(n.id,function(e,n){t(e?{error:e}:n)}):r.rpc.uploadComplete(n.id,function(e,n){t(e?{error:e}:n)}):t({error:"RPC_NOT_READY"}):t({error:"ENOTFOUND"})},v.uploadStatus=function(e,n,t){var r=z(n.teamId);r?r.rpc?r.rpc.uploadStatus({id:n.id,size:n.size},function(e,n){t(e?{error:e}:n)}):t({error:"RPC_NOT_READY"}):t({error:"ENOTFOUND"})},v.uploadCancel=function(e,n,t){var r=z(n.teamId);r?r.rpc?r.rpc.uploadCancel({id:n.id,size:n.size},function(e,n){t(e?{error:e}:n)}):t({error:"RPC_NOT_READY"}):t({error:"ENOTFOUND"})},v.uploadChunk=function(e,n,t){var r=z(n.teamId);r?r.rpc?r.rpc.send.unauthenticated("UPLOAD",{chunk:n.chunk,id:n.id},function(e,n){t({error:e,msg:n})}):t({error:"RPC_NOT_READY"}):t({error:"ENOTFOUND"})};v.anonRpcMsg=function(e,n,t){C.anon_rpc?C.anon_rpc.send(n.msg,n.data,function(e,n){t(e?{error:e}:n)}):t({error:"ANON_RPC_NOT_READY"})},v.getFileSize=function(e,n,t){var r=a.once(a.mkAsync(t));if(C.anon_rpc){var i=n.channel||o.hrefToHexChannelId(n.href,n.password);C.anon_rpc.send("GET_FILE_SIZE",i,function(e,n){if(!e)return n&&n.length&&"number"==typeof n[0]?(0===n[0]&&d.clearChannel(i),void r({size:n[0]})):void r({error:"INVALID_RESPONSE"});r({error:e})})}else r({error:"ANON_RPC_NOT_READY"})},v.isNewChannel=function(e,n,t){if(!C.anon_rpc)return void t({error:"ANON_RPC_NOT_READY"});let r="string"==typeof n?n:n.channel||o.hrefToHexChannelId(n.href,n.password);C.anon_rpc.send("IS_NEW_CHANNEL",r,function(e,n){if(!e)return n&&n.length&&"object"==typeof n[0]?(n[0].isNew&&d.clearChannel(r),void t(n[0])):void t({error:"INVALID_RESPONSE"});t({error:e})})},v.getMultipleFileSize=function(e,n,t){C.anon_rpc?Array.isArray(n.files)?C.anon_rpc.send("GET_MULTIPLE_FILE_SIZE",n.files,function(e,n){e?t({error:e}):n&&n.length&&"object"==typeof n[0]?t({size:n[0]}):t({error:"UNEXPECTED_RESPONSE"})}):t({error:"INVALID_FILE_LIST"}):t({error:"ANON_RPC_NOT_READY"})},v.getDeletedPads=function(e,n,t){if(C.anon_rpc){var r=n&&n.list||Z(!0);Array.isArray(r)?C.anon_rpc.send("GET_DELETED_PADS",r,function(e,n){e?t({error:e}):n&&n.length&&Array.isArray(n[0])?t(n[0]):t({error:"UNEXPECTED_RESPONSE"})}):t({error:"INVALID_FILE_LIST"})}else t({error:"ANON_RPC_NOT_READY"})};var $=function(e,n,t){C.anon_rpc?t():l.createAnonymous(C.network,function(e,n){e?t({error:e}):(C.anon_rpc=n,t())})},ee=v.getAllStores=function(){if(!C.proxy||!C.manager)return[];var e=[C],n=C.modules.team;if(n){var t=n.getTeams().map(function(e){return n.getTeam(e)});Array.prototype.push.apply(e,t)}return e};v.getUserColor=function(){var e=a.find(C,["proxy","settings","general","cursor","color"]);return e||(e=a.getRandomColor(!0),v.setAttribute(null,{attr:["general","cursor","color"],value:e},function(){})),e},v.getMetadata=function(e,n,t){var r=C.proxy||{},s=a.find(r,["settings","general","disableThumbnails"]),c=C.modules.team&&C.modules.team.getTeamsData(n)||{};r.uid||(C.noDriveUid=C.noDriveUid||o.createChannelId());var u={user:{name:r[i.displayNameKey]||C.noDriveName||"",uid:r.uid||C.noDriveUid,avatar:a.find(r,["profile","avatar"]),profile:a.find(r,["profile","view"]),color:v.getUserColor(),notifications:a.find(r,["mailboxes","notifications","channel"]),curvePublic:r.curvePublic,edPublic:r.edPublic,netfluxId:C?.network?.webChannels?.[0]?.myID,badge:a.find(r,["profile","badge"])},priv:{clientId:e,edPublic:r.edPublic,edPrivate:r.edPrivate,friends:r.friends||{},settings:r.settings||W,thumbnails:!1===s,isDriveOwned:Boolean(a.find(C,["driveMetadata","owners"])),driveChannel:C.driveChannel,pendingFriends:r.friends_pending||{},supportPrivateKey:a.find(r,["mailboxes","supportadmin","keys","curvePrivate"]),accountName:r.login_name||"",offline:C.proxy&&C.offline,teams:c,plan:C.ready?X.plan||"":void 0,mutedChannels:r.mutedChannels}};return t(JSON.parse(JSON.stringify(u))),u},v.onMaintenanceUpdate=function(){let e=U.httpUnsafeOrigin;a.fetchApi(e,"broadcast",!0,e=>{e&&S([],"UNIVERSAL_EVENT",{type:"broadcast",data:{ev:"MAINTENANCE",data:e.maintenance}})})},v.onSurveyUpdate=function(){let e=U.httpUnsafeOrigin;a.fetchApi(e,"broadcast",!0,e=>{S([],"UNIVERSAL_EVENT",{type:"broadcast",data:{ev:"SURVEY",data:e.surveyURL}})})};v.addPad=function(e,t,r){if(t.href||t.roHref){var a;if(!t.roHref){var i=o.parsePadUrl(t.href);"pad"===i.hashData.type&&(a=o.getSecrets(i.type,i.hash,t.password),t.roHref="/"+i.type+"/#"+o.getViewHashFromKeys(a))}var s,c,u,f,l=(s=t.href,c=t.roHref,u=t.title,f=+new Date,{href:s,roHref:c,atime:f,ctime:f,title:u||n.getDefaultName(o.parsePadUrl(s))});t.owners&&(l.owners=t.owners),t.expire&&(l.expire=t.expire),t.password&&(l.password=t.password),(t.channel||a)&&(l.channel=t.channel||a.channel),t.readme&&(l.readme=1),Object.keys(t.attributes||{}).forEach(e=>{t.attributes[e]&&(l[e]=t.attributes[e])}),-1===t.teamId&&(t.teamId=void 0);var d=z(t.teamId);d&&d.manager?d.manager.addPad(t.path,l,function(o){o?r({error:o}):(ee().forEach(function(t){(t.id?t.sendEvent:P)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]},e)}),Q(t.teamId,r))}):r({error:"ENOTFOUND"})}else r({error:"NO_HREF"})};var ne=function(e,n){var t=a.find(C,["proxy","edPublic"]),r=function(e){var n=[];return e?(C.proxy.todo&&n.push(o.hrefToHexChannelId("/todo/#"+C.proxy.todo,null)),C.proxy.profile&&C.proxy.profile.edit&&n.push(o.hrefToHexChannelId("/profile/#"+C.proxy.profile.edit,null)),C.proxy.mailboxes&&Object.keys(C.proxy.mailboxes||{}).forEach(function(e){if("supportadmin"!==e){var t=C.proxy.mailboxes[e];n.push(t.channel)}})):n=C.manager.getChannelsList("owned"),n.filter(function(e){if("string"==typeof e)return-1!==[32,48].indexOf(e.length)})}(e),i=V.create(10),s=function(n){e||C.manager.findChannel(n).forEach(function(e){var n=C.manager.findFile(e.id);C.manager.delete({paths:n})})};r.forEach(function(e){var r=n();i.take(function(n){var o=!1;M(function(a){32===e.length&&v.anonRpcMsg(null,{msg:"GET_METADATA",data:e},a(function(i){if(i&&i.error)return n(),r(),void a.abort();var c=i[0];return Object.keys(c||{}).length?c&&Array.isArray(c.owners)&&-1!==c.owners.indexOf(t)?void(o=c.owners.some(function(e){return e!==t})):(n(),r(),void a.abort()):(s(e),n(),r(),void a.abort())}))}).nThen(function(n){o?v.pad.setMetadata(null,{channel:e,command:"RM_OWNERS",value:[t]},n()):C.rpc.removeOwnedChannel(e,n(function(n){n?console.error(n):s(e)}))}).nThen(function(){n(),r()})})})};v.removeOwnedPads=function(e,n,t){C.proxy.edPublic?M(function(e){ne(!1,e)}).nThen(t):t({error:"NOT_LOGGED_IN"})},v.deleteAccount=function(n,t,r){var o=C.proxy.edPublic,s=t&&t.keys,c=t&&t.auth;v.anonRpcMsg(n,{msg:"GET_METADATA",data:C.driveChannel},function(t){var u=t[0];if(u&&u.owners&&1===u.owners.length&&-1!==u.owners.indexOf(o))M(function(e){N.checkRights({auth:c,blockKeys:s},e(function(n){if(n)return e.abort(),console.error(n),void r({error:"INVALID_CODE"})}))}).nThen(function(e){globalThis.accountDeletion=n,C.proxy[i.tokenKey]="DELETED",Q(null,e())}).nThen(function(e){C.rpc.removePins(e(function(e){e&&console.error(e)}))}).nThen(function(e){C.ownDeletion=!0,v.pad.destroy(n,{channel:C.driveChannel,force:!0},e())}).nThen(function(e){s&&N.removeLoginBlock({reason:"ARCHIVE_OWNED",auth:c,edPublic:o,blockKeys:s},e(function(e){e&&console.error(e)}))}).nThen(function(e){ne(!0,e)}).nThen(function(){S([n],"DRIVE_DELETED","ARCHIVE_OWNED"),y(n,"DELETE_ACCOUNT","DELETED",function(){}),C.network.disconnect(),r({state:!0})});else{var f={intent:"Please delete my account."};f.drive=C.driveChannel,f.edPublic=o;var l=a.decodeBase64(C.proxy.edPrivate),d=x.Nacl.sign.detached(a.decodeUTF8(e(f)),l);x.Nacl.sign.detached.verify(a.decodeUTF8(e(f)),d,a.decodeBase64(o))||console.error("signed message failed verification");var h=a.encodeBase64(d);r({proof:h,toSign:JSON.parse(e(f))})}})},v.setDisplayName=function(e,n,t){if(!C.proxy)return C.noDriveName=n,S([e],"UPDATE_METADATA"),void t();C.modules.profile&&C.modules.profile.setName(n),C.proxy[i.displayNameKey]=n,S([e],"UPDATE_METADATA"),u.updateMyData(C),Q(null,t)},v.resetDrive=function(e,n,t){M(function(e){ne(e)}).nThen(function(){C.proxy.drive=C.userObject.getStructure(),P("DRIVE_CHANGE",{path:["drive","filesData"]},e),Q(null,t)})},v.setPadAttribute=function(e,t,r){M(function(r){ee().forEach(function(o){o.manager.setPadAttribute(t,r(function(){(o.id?o.sendEvent:P)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]},e),Q(o.id,r())}))})}).nThen(r)},v.getPadAttribute=function(e,n,t){var r={};M(function(e){ee().forEach(function(t){t.manager.getPadAttribute(n,e(function(e,n){e||(n&&"object"==typeof n?(!r.value||r.atime{if(C.loggedIn&&C.proxy.edPublic){var n,r=C.modules.team,o=r&&r.getTeams()||[];-1!==e.indexOf(C.proxy.edPublic)?n=C:o.some(function(t){var o=a.find(C,["proxy","teams",t,"keys","drive","edPublic"]),i=a.find(C,["proxy","teams",t,"keys","drive","edPrivate"]);if(-1===e.indexOf(o))return!1;if(!i)return!1;var s=r.getTeam(t);return n=s,!0});var i=function(){if(n){var e=n.rpc;e?e.send("COOKIE","",function(e){t(e)}):t("ERESTRICTED")}else t("ERESTRICTED")};n&&n.onRpcReadyEvt?n.onRpcReadyEvt.reg(function(){i()}):i()}else t("ERESTRICTED")})):t("ERESTRICTED")},v.changePadPasswordPin=function(e,n,t){var r=n.oldChannel,o=n.channel;M(function(e){ee().forEach(function(n){n.manager.findChannel(o).length&&(n.rpc.unpin([r],e()),n.rpc.pin([o],e()))})}).nThen(t)},v.contactPadOwner=function(e,n,t){var r=n.owners;if(!Array.isArray(r)||!r.length)return t({state:!1});n.send?M(function(e){r.forEach(function(t){!function(e,t,r,o){if(C.mailbox&&!n.anon)return C.mailbox.sendTo(e,t,r,o);O.sendToAnon(C.anon_rpc,e,t,r,o)}(n.query,{channel:n.channel,data:n.msgData},{channel:t.notifications,curvePublic:t.curvePublic},e())})}).nThen(function(){t({state:!0})}):t({state:!0})},v.givePadAccess=function(e,n,t){var r,o,a=C.proxy.edPublic,i=n.channel,s=C.manager.findChannel(i);n.user&&n.user.notifications&&n.user.curvePublic?s.some(function(e){if(e.data&&Array.isArray(e.data.owners)&&-1!==e.data.owners.indexOf(a)&&e.data.href)return r=e.data.href,o=e.data.title,!0})?(C.mailbox.sendTo("GIVE_PAD_ACCESS",{channel:i,href:r,title:o},{channel:n.user.notifications,curvePublic:n.user.curvePublic}),t()):t({error:"ENOTFOUND"}):t({error:"EINVAL"})};v.burnPad=function(e,n){var t=n.channel,r=x.b64AddSlashes(n.ownerKey||"");if(t&&r)try{var a=o.decodeBase64(r),i=x.Nacl.sign.keyPair.fromSecretKey(a);f.create(C.network,{edPublic:o.encodeBase64(i.publicKey),edPrivate:o.encodeBase64(i.secretKey)},function(e,r){e?console.error(e):v.pad.getMetadata(null,{channel:t},function(e){r.removeOwnedChannel(t,function(t){t?console.error(t):function(e,n){var t=e.channel,r=e.href,a=o.parsePadUrl(r),i=o.getSecrets(a.type,a.hash,e.password);if((!n||!n.error)&&n.mailbox){var s,c=x.createEncryptor(i.keys),u=[];try{"string"==typeof n.mailbox?u.push(c.decrypt(n.mailbox,!0,!0)):Object.keys(n.mailbox).forEach(function(e){u.push(c.decrypt(n.mailbox[e],!0,!0))})}catch(e){console.error(e)}try{s=C.proxy.curvePublic}catch(e){return void console.error(e)}u.forEach(function(e){var n=JSON.parse(e);n.curvePublic!==s&&C.mailbox.sendTo("OWNED_PAD_REMOVED",{channel:t},{channel:n.notifications,curvePublic:n.curvePublic},function(){})})}}(n,e)})})})}catch(e){console.error(e)}else console.error("Can't delete BAR pad")},v.deleteMailboxMessage=function(e,n,t){C.anon_rpc?C.anon_rpc.send("DELETE_MAILBOX_MESSAGE",n,function(e){t({error:e})}):t({error:"RPC_NOT_READY"})},v.getFullHistory=function(e,n,t){var r=C.network,o=r.historyKeeper,a=[],i=!1,s=function(e){if(!i){var o=function(e){try{return JSON.parse(e)}catch(e){return null}}(e);if(o)return"FULL_HISTORY_END"===o[0]?(t(a),r.off("message",s),void(i=!0)):void("FULL_HISTORY"===o[0]&&(o[1]&&o[1].validateKey||o[1][3]===n.channel&&(e=o[1][4])&&(e=e.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/,""),n.debug?a.push({serverHash:e.slice(0,64),msg:e,author:o[1][1],time:o[1][5]}):a.push(e))))}};r.on("message",s),r.sendto(o,JSON.stringify(["GET_FULL_HISTORY",n.channel,n.validateKey]))},v.getHistory=function(e,n,t,r){var o=a.once(a.mkAsync(t)),i=C.network,s=i.historyKeeper,c=Math.floor(1e6*Math.random()),u=[],f=!1,l=function(e,t){if(!f&&t===s){var a=function(e){try{return JSON.parse(e)}catch(e){return null}}(e);if(a&&!(a.txid&&a.txid!==c||a.validateKey&&a.channel))if(a.error&&a.channel)a.channel===n.channel&&(i.off("message",l),f=!0,o({error:a.error}));else{if(1===a.state&&a.channel){if(a.channel!==n.channel)return;return o(u),i.off("message",l),void(f=!0)}Array.isArray(a)&&a[0]&&a[0]!==c||a[3]===n.channel&&(a[4]&&r?u.push({msg:e,hash:a[4].slice(0,64)}):(e=a[4])&&(e=e.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/,""),u.push(e)))}}};i.on("message",l);var d={txid:c,lastKnownHash:n.lastKnownHash},h=["GET_HISTORY",n.channel,d];i.sendto(s,JSON.stringify(h))},v.getHistoryRange=function(e,n,t){var r,o=C.network,i=o.historyKeeper,s=[],c=!0,u=!1,f=!1,l=a.uid();o.on("message",function(e){if(!f){var o=function(e){try{return JSON.parse(e)}catch(e){return null}}(e);if(o[1]===l){if("HISTORY_RANGE_ERROR"===o[0]){let e=o[2];return"ENOENT"===e?.code?(f=!0,void t({messages:s,isFull:!0})):void t({error:o[2]})}if("HISTORY_RANGE_END"===o[0])return t({messages:s,isFull:u,lastKnownHash:r}),void(f=!0);"HISTORY_RANGE"===o[0]&&(o[2]&&o[1].validateKey||o[2][3]===n.channel&&(e=o[2][4])&&(c&&(/^cp\|/.test(e)||n.toHash||(u=!0),r=e.slice(0,64),c=!1),e=e.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/,""),s.push({serverHash:e.slice(0,64),msg:e,author:o[2][1],time:o[2][5]})))}else console.log("bad txid")}}),o.sendto(i,JSON.stringify(["GET_HISTORY_RANGE",n.channel,{from:n.lastKnownHash,to:n.toHash,cpCount:n.cpCount||2,txid:l}]))};var oe=function(e,t){e&&(e.deprecated||e.restricted||(t||e.on("change",["drive",n.SHARED_FOLDERS],function(t,r,a){if(a.length>3&&"password"===a[3]){var i=a[2],s=e.drive[n.SHARED_FOLDERS][i],c=C.manager.user.userObject.getHref?C.manager.user.userObject.getHref(s):s.href,u=o.parsePadUrl(c),f=o.getSecrets(u.type,u.hash,t);return h.updatePassword(v,{oldChannel:f.channel,password:r,href:c},C.network,function(){console.log("Shared folder password changed")}),!1}}),e.on("change",[],function(e,r,o){if(t){if(o[0]===n.FILES_DATA&&"object"==typeof r&&r.channel&&!r.owners){var a=[r.channel];r.rtChannel&&a.push(r.rtChannel),r.lastVersion&&a.push(r.lastVersion),v.pinPads(null,a,function(e){console.error(e)})}if(o[0]===n.FILES_DATA&&"object"==typeof e&&e.channel&&!r){var i=[e.channel];C.manager.findChannel(e.channel).some(function(e){return e.fId!==t})||(e.rtChannel&&i.push(e.rtChannel),e.lastVersion&&i.push(e.lastVersion),v.unpinPads(null,i,function(e){console.error(e)}))}}e&&!r&&Array.isArray(o)&&(o[0]===n.FILES_DATA||"drive"===o[0]&&o[1]===n.FILES_DATA)&&setTimeout(function(){v.checkDeletedPad(e&&e.channel)}),P("DRIVE_CHANGE",{id:t,old:e,new:r,path:o})}),e.on("remove",[],function(e,n){P("DRIVE_REMOVE",{id:t,old:e,path:n})})))};v.loadSharedFolder=function(e,n,t,r,a){var i=z(e);if(i){var s=o.parsePadUrl(t.href||t.roHref);s||s.hashData?h.load({isNew:a,network:C.network||C.networkPromise,store:i,Store:v,isNewChannel:v.isNewChannel},n,t,r):r({error:"EINVAL"})}else r({error:"ENOTFOUND"})};var ae=function(e,n,t,r){v.loadSharedFolder(null,e,n,t,r)};v.loadSharedFolderAnon=function(e,n,t){v.loadSharedFolder(null,n.id,n.data,function(e){t({error:e?void 0:"EDELETED"})})},v.addSharedFolder=function(e,t,r){Y.reg(function(){var o=z(t.teamId);o.manager.addSharedFolder(t,function(a){a&&"object"==typeof a&&a.error?r(a):((t.teamId?o.sendEvent:P)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]},e),r(a))})})},v.updateSharedFolderPassword=function(e,n,t){h.updatePassword(v,n,C.network,t)},v.userObjectCommand=function(e,t,r){if(t&&t.cmd){var o=z(t.teamId);if(o.offline)return(o.id?o.sendEvent:P)("NETWORK_DISCONNECT"),void r({error:"OFFLINE"});o.manager.command(t,function(o){ee().forEach(function(t){(t.id?t.sendEvent:P)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]},e)}),Q(t.teamId,function(){r(o)})})}},v._removeClient=function(e){var n=R.indexOf(e);-1!==n&&R.splice(n,1),C.onlyoffice?.removeClient?.(e),C.mailbox?.removeClient?.(e),Object.keys(C.modules).forEach(function(n){C.modules[n]?.removeClient?.(e)}),v.pad?.removeClient?.(e)};v.refreshDriveUI=function(){ee().forEach(function(e){(e.id?e.sendEvent:P)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]})})};var ie=function(e,n){const r=a.mkAsync(n);var o=C.proxy,i=C.drive;if(C.manager)r();else{var s=C.manager=t.create(i.proxy,{onSync:function(e){Q(null,e)},edPublic:o.edPublic,pin:function(e,n){C.loggedIn?v.pinPads(null,e,n):n()},unpin:function(e,n){C.loggedIn?v.unpinPads(null,e,n):n()},loadSharedFolder:ae,settings:o.settings,removeOwnedChannel:function(e,n){v.pad.destroy("",e,n)},store:C,Store:v},{outer:!0,edPublic:C.proxy.edPublic,loggedIn:C.loggedIn,log:function(e){P("DRIVE_LOG",e)},rt:i.realtime}),c=C.userObject=s.user.userObject;M(function(e){C.sharedFolders={},C.handleSharedFolder=function(e,n){n?(C.sharedFolders[e]=n,C.driveEvents&&oe(n.proxy,e)):delete C.sharedFolders[e]},c.migrate(e())}).nThen(function(n){var t=C.network||C.networkPromise;h.loadSharedFolders(v,t,C,i.proxy,c,n,n=>{var t={type:"sf",progress:100*n.progress/n.max};y(e,"LOADING_DRIVE",t)},!0)}).nThen(function(n){re(w,"team",n,e)}).nThen(function(e){re(T,"calendar",e)}).nThen(function(){r()})}};const se=(e=function(){})=>{re(m,"cursor",e),re(E,"integration",e),re(D,"messenger",e),re(_,"history",e),re(j,"badge",e),C.onlyoffice||(C.onlyoffice=b.init(C,function(e,n,t){t.forEach(function(t){y(t,"OO_EVENT",{ev:e,data:n})})})),C&&(C.messenger=C.modules.messenger)},ce=(e,n,t)=>{const r=a.mkAsync(t);ie(e,function(){G.fire(),r(n)})};var ue=function(e,n,t){C.ready=!0;var c=C.proxy,u=C.manager,l=C.userObject;M(function(t){c.settings||(c.settings=W),c.forms||(c.forms={}),c.friends_pending||(c.friends_pending={}),c.form_seed||(c.form_seed=o.createChannelId()),u||(ce(e,n,t()),u=C.manager,l=C.userObject),$(0,0,t()),function(e,n,t){if(!C.loggedIn)return t();C.rpc?t(X):f.create(C.network,C.proxy,function(e,n){e?t({error:e}):(C.rpc=n,C.onRpcReadyEvt.fire(),v.getPinLimit(null,null,function(e){e.error&&console.error(e.error),X.limit=e.limit,X.plan=e.plan,X.note=e.note,t(e)}))},d)}(0,0,t()),y(e,"LOADING_DRIVE",{type:"migrate",progress:0})}).nThen(function(n){void 0===c.version&&(c.version=11),r(c,n(),function(n,t){y(e,"LOADING_DRIVE",{type:"migrate",progress:t})},C)}).nThen(function(n){y(e,"LOADING_DRIVE",{type:"sf",progress:0}),l.fixFiles(),h.loadSharedFolders(v,C.network,C,C.drive.proxy,l,n,n=>{var t={type:"sf",progress:100*n.progress/n.max};y(e,"LOADING_DRIVE",t)}),se(n),re(A,"profile",n),re(T,"calendar",n),re(g,"support",n),M(e=>{C.modules.team&&C.modules.team.onReady(e)})}).nThen(function(){var e,r=function(){S([],"REQUEST_LOGIN")};C.loggedIn&&(function(e){if(C.rpc){var n=Z(!1),t=o.hashChannelList(n);C.rpc.getServerHash(function(n,r){n?e(n):e(null,r===t)})}else e({error:"RPC_NOT_READY"})}(function(e,n){n||function(e){if(C.rpc){var n=Z(!1);C.rpc.reset(n,function(n){e(n||null)})}else e({error:"RPC_NOT_READY"})}(function(e){if(e)return console.error(e);console.log("RESET DONE")})}),"number"!=typeof c.loginToken&&(c[i.tokenKey]=C.data.localToken||Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)),n[i.tokenKey]=c[i.tokenKey],C.data.localToken&&C.data.localToken!==c[i.tokenKey])?r():(n.feedback=a.find(c,["settings","general","allowUserFeedback"]),s.init(n.feedback),C.returned=n,"function"==typeof t&&t(n),C.offline=!1,P("NETWORK_RECONNECT"),S([],"UPDATE_METADATA"),S([],"STORE_READY",n),"string"==typeof c.uid&&32===c.uid.length||(console.log("generating a persistent identifier"),c.uid=o.createChannelId()),!C.loggedIn||v.hasSigningKeys()&&v.hasCurveKeys()?(c.on("change",[i.displayNameKey],function(e,n){"string"==typeof n&&S([],"UPDATE_METADATA")}),c.on("change",["profile"],function(){S([],"UPDATE_METADATA")}),c.on("change",["friends"],function(e,n,t){if(S([],"UPDATE_METADATA"),C.messenger&&void 0===e){var r=t.slice(-1)[0],o=c.friends&&c.friends[r];C.messenger.onFriendAdded(o)}}),c.on("remove",["friends"],function(e,n){if(S([],"UPDATE_METADATA"),C.messenger){var t=n[1];t&&"channel"===n[2]&&C.messenger.onFriendRemoved(t,e)}}),c.on("change",["friends_pending"],function(){S([],"UPDATE_METADATA")}),c.on("remove",["friends_pending"],function(){S([],"UPDATE_METADATA")}),c.on("change",["settings"],function(){S([],"UPDATE_METADATA")}),c.on("change",[i.tokenKey],function(){C.isDeleted||"DELETED"===c[i.tokenKey]||S([],"UPDATE_TOKEN",{token:c[i.tokenKey]})}),C.mailbox=O.init({Store:v,store:C,updateMetadata:function(){S([],"UPDATE_METADATA")},updateDrive:function(){P("DRIVE_CHANGE",{path:["drive","filesData"]})},pinPads:function(e,n){v.pinPads(null,e,n)}},e,function(e,n,t,r){var o=a.once(r||function(){});t.forEach(function(t){y(t,"MAILBOX_EVENT",{ev:e,data:n},o)})}),Y.fire()):r())})};const fe=(e,n,t,r)=>{if(C.accountModule)return C.accountModule;const o=F.init({userHash:n.userHash,anonHash:n.anonHash,cache:n.cache,form_seed:n.form_seed,store:C,broadcast:S,postMessage:y});C.accountModule=o;const{channel:i,onAccountReady:s,onAccountCacheReady:c,onDisconnect:u,onReconnect:f}=o;C.driveChannel=i,c(e=>{C.cacheReturned||=e,t(e)}),s(e=>{C.returned||=e,r(e)}),u(()=>{P("NETWORK_DISCONNECT")}),f(()=>{P("NETWORK_RECONNECT")});return setInterval(function(){var e=[];const n=v.pad.getChannels();Object.keys(n).forEach(function(t){var r=n[t].clients;Array.prototype.push.apply(e,r)}),(e=a.deduplicateString(e)).forEach(function(e){var n=0,t=function(){if(n>=2)return v._removeClient(e),y(e,"TIMEOUT"),void console.error("TIMEOUT",e);n++;var r=setTimeout(t,3e4);y(e,"PING",null,function(e){e&&console.error(e),clearTimeout(r)})};t()})},12e4),o},le=(e,n,t,r)=>{const o=a.once(e=>{const n=L.init({account:e,store:C,broadcast:S,postMessage:y}),{onDriveReady:o,onDriveCacheReady:a,onDisconnect:i,onReconnect:s}=n;a(()=>{t(C.cacheReturned||C.returned)}),o(()=>{J.fire(),r(C.returned)}),i(()=>{}),s(()=>{})}),i=()=>{},s=fe(0,n,i,i);s.onAccountCacheReady(()=>{o(s)}),s.onAccountReady(()=>{o(s)})};v.disableCache=function(e,n,t){n?d.disable():d.enable(),t()};var de=!1;const he=e=>{if(C?.network?.historyKeeper)return setTimeout(e);const n=n=>{C.network||=n;n.join("0000000000000000000000000000000000").then(function(t){let r;t.members.forEach(e=>{16===e.length&&(r=e)}),n.historyKeeper=r,t.leave(),e()},function(n){console.error(n),e({error:"GET_HK"})})};if(C.network)return n(C.network);C.networkPromise?.then(n)};var pe=function(e,n,t){const r=a.once(n);var o=function(){se();let e=()=>{$(0,0,function(){s.send("NO_DRIVE",!0),r({})})};he(n=>{if(!n)return t?((e,n)=>{if(C.rpc)n(C.rpc);else{var t=x.Nacl.sign.keyPair(),r=C.tempKeys={edPublic:a.encodeBase64(t.publicKey),edPrivate:a.encodeBase64(t.secretKey)};f.create(C.network,r,function(e,t){e?n({error:e}):(C.rpc=t,n(t))})}})(0,e):void e()}),C.network||t||r({})};if(!C.network){var i=I.getWebsocketURL();return C.networkPromise=k.connect(i),o(),C.networkPromise.then(e=>{C.network!==e&&(C.network?(e.disconnect(),e=C.network):C.network=e)},function(e){console.error(e),r({error:"OFFLINE"})})}o()};const ve=(e,n,t)=>{C.manager?G.reg(function(){he(r=>{C.network||=r,ue(e,n,()=>{t(n)})})}):ue(e,n,()=>{t(n)})};return v.init=function(e,n,t){var r=a.once(function(r){n.driveEvents&&function(e){G.reg(()=>{-1===R.indexOf(e)&&R.push(e),C.driveEvents||(C.driveEvents=!0,oe(C.proxy),Object.keys(C.manager.folders).forEach(function(e){var n=C.manager.folders[e].proxy;oe(n,e)}))})}(e),t(r)});if(de&&!C.returned&&n.cache)G.reg(function(){r({state:"ALREADY_INIT",returned:C.cacheReturned})});else{if(de)return C.networkTimeout&&y(e,"LOADING_DRIVE",{type:"offline"}),void Y.reg(function(){r({state:"ALREADY_INIT",returned:C.returned})});n.disableCache&&d.disable(),n.noDrive&&!n.requires&&(n.requires="pad"),((e,n,t)=>{if(n.neverDrive||n.noDrive&&!n.userHash&&!n.anonHash)return n.neverDrive&&(C.neverCache=!0),void pe(0,e=>{e?.error&&s.send("NO_DRIVE_ERROR",!0),n.neverDrive&&(e.tempKeys=C?.tempKeys),t(e)},!!n.neverDrive);const r=n.requires,o=!n.noDrive;de=!0,C.data=n;let c=e=>{1===Object.keys(C.proxy).length&&s.send("FIRST_APP_USE",!0),e&&e.error&&(de=!1)};if("pad"===r&&!o)return void pe(0,function(r){if(r&&r.error)return;t(r);let o=a.once(()=>{le(0,n,n=>{ce(e,n,c)},n=>{ve(e,n,c)})});v.pad.onCacheReady(()=>{C.network||o()}),v.pad.onJoined(o),q.reg(o)});if("file"===r&&!o)return void pe(0,function(r){r&&r.error||(t(r),le(0,n,n=>{ce(e,n,c)},n=>{ve(e,n,c)}))});if("team"===r){let r=!1;const o=o=>a=>{r||(r=!0,M(e=>{o||$(0,0,e())}).nThen(n=>{re(w,"team",n,e)}).nThen(e=>{!o&&C.modules.team&&C.modules.team.onReady(e)}).nThen(()=>{t(a),le(0,n,n=>{ce(e,n,c)},n=>{ve(e,n,c)})}))};return void fe(0,n,o(!0),o(!1))}if("drive"===r)return void le(0,n,n=>{t(n),ce(e,n,c)},n=>{t(n),ve(e,n,c)});let u=e=>{c(e);const n=i.prefersDriveRedirectKey,r=a.find(C,["proxy","settings","general",n]);e[n]=r,t(e)};le(0,n,n=>{ce(e,n,u)},n=>{ve(e,n,u)})})(e,n,a.once(e=>{"GET_HK"!==e.error?r(e):r({error:"ERROR"})}))}},Y.reg(function(){var e=+new Date-7776e6;d.getKeys(function(n,t){if(n)console.error(n);else{var r=function(){if(t.length){var n=t.pop();d.getTime(n,function(t,o){t?r():!o||o{const n=(e,n={})=>({create:function(t,r,o){var a,i=[],s=e.mkEvent(!0);t.reg(function(e){if(!a){var n=e.data;if("_READY"===n)return r("_READY"),a=!0,s.fire(),void i.forEach(function(e){t.fire(e)});i.push(n)}});var c={},u={},f={},l=[],d={},h={};h.query=function(e,n,t,o){var a,i=Math.random().toString(16).replace("0.","")+Math.random().toString(16).replace("0.",""),c=(o=o||{}).timeout||3e4;c>0&&(a=setTimeout(function(){delete u[i],t("TIMEOUT")},c)),f[i]=function(e){clearTimeout(a),delete f[i],e&&(delete u[i],t("UNHANDLED"))},u[i]=function(e,n){delete u[i],t(void 0,e.content,n)},s.reg(function(){var t={txid:i,content:n,q:e,raw:o.raw};r(o.raw?t:JSON.stringify(t))})};var p=h.event=function(e,n,t){t=t||{},s.reg(function(){var o={content:n,q:e,raw:t.raw};r(t.raw?o:JSON.stringify(o))})};h.on=function(e,n,t){var o=function(e,t,o){n(e.content,function(n){var t={txid:e.txid,content:n};r(o?t:JSON.stringify(t))},t)};return(c[e]=c[e]||[]).push(o),t||p("EV_REGISTER_HANDLER",e),{stop:function(){var n=c[e].indexOf(o);-1!==n&&c[e].splice(n,1)}}},h.whenReg=function(e,n,t){var r=t;l.indexOf(e)>-1?n():r=!0,r&&(d[e]=d[e]||[]).push(n)},h.onReg=function(e,n){h.whenReg(e,n,!0)},h.on("EV_REGISTER_HANDLER",function(e){d[e]&&(d[e].forEach(function(e){e()}),delete d[e]),l.push(e)});var v=!1;h.onReady=function(e){v?e():"function"==typeof e&&h.on("EV_RPC_READY",function(){v=!0,e()})},h.ready=function(){h.whenReg("EV_RPC_READY",function(){h.event("EV_RPC_READY")})};var y=[""];n.httpUnsafeOrigin?(y.push(n.httpUnsafeOrigin),y.push(n.httpSafeOrigin)):globalThis.location&&y.push(globalThis.location.origin),t.reg(function(e){if(a&&e.data&&"_READY"!==e.data&&y.includes(e.origin)){var n;try{n="object"==typeof e.data?e.data:JSON.parse(e.data)}catch(e){return void console.warn(e)}void 0!==n.ack?f[n.txid]&&f[n.txid](!n.ack):"string"==typeof n.q?c[n.q]?(n.txid&&r(JSON.stringify({txid:n.txid,ack:!0})),c[n.q].forEach(function(t){t(n||JSON.parse(e.data),e,n&&n.raw),n=void 0})):n.txid&&r(JSON.stringify({txid:n.txid,ack:!1})):void 0===n.q&&u[n.txid]&&u[n.txid](n,e)}}),r("_READY"),o(h)}});e.exports&&(e.exports=n(Z()))})()}(mr)),mr.exports}function Er(){if(pr)return hr;pr=1;var e;return hr=((e,n,t)=>{const r={};let o,a,i={},s=()=>{};return r.init=n=>{if(a)return;a=e.create({query:(e,n,t,r)=>{r=r||function(){},i[e].chan.query(n,t,function(e,n){r(e?{error:e}:n)})},broadcast:(e,n,t,r)=>{r=r||function(){},Object.keys(i).forEach(o=>{-1===e.indexOf(+o)&&i[o].chan.query(n,t,(e,n)=>{r(e?{error:e}:n)})})}}),s=n},r.initClient=(e,r)=>{if(!a)return console.error("Not initialized"),void r("NOT_INIT");const{postMsg:c}=e,u=t.mkEvent(),f=Number(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)),l=()=>{a._removeClient(f)};n.create(u,c,function(e){let n=i[f]={chan:e};console.debug("SharedW Channel created"),Object.keys(a.queries).forEach(function(t){"CONNECT"!==t&&"JOIN_PAD"!==t&&"SEND_PAD_MSG"!==t&&"STOPWORKER"!==t&&e.on(t,function(e,r){try{a.queries[t](f,e,r)}catch(n){console.error("Error in webworker when executing query "+t),console.error(n),console.log(e)}"DISCONNECT"===t&&(l(),globalThis.accountDeletion&&globalThis.accountDeletion===n.id&&(a=void 0,o=void 0))})}),e.on("STOPWORKER",function(e,n){s(),a.queries.DISCONNECT(f,e,n)}),e.on("CONNECT",function(e,n){console.debug("Connecting to store..."),a.queries.CONNECT(f,e,function(e){if(e&&"ALREADY_INIT"===e.state)return console.debug("Store already exists!"),o=o||e.returned,void n(e);o=e,n(e)})}),e.on("JOIN_PAD",function(e,t){n.channelId=e.channel;try{a.queries.JOIN_PAD(f,e,t)}catch(n){console.error("Error in webworker when executing query JOIN_PAD"),console.error(n),console.log(e)}}),e.on("SEND_PAD_MSG",function(e,t){var r={msg:e,channel:n.channelId};try{a.queries.SEND_PAD_MSG(f,r,t)}catch(e){console.error("Error in webworker when executing query SEND_PAD_MSG"),console.error(e),console.log(r)}}),r(u,l)},!0)},r})((ur||(ur=1,e=sr(),cr={create:function(n){var t=e.create(n),r={},o=r.queries={CONNECT:t.init,DISCONNECT:t.disconnect,PING:function(e,n,t){t()},CACHE_DISABLE:t.disableCache,GET_PIN_LIMIT:t.getPinLimit,PIN_PADS:t.pinPads,UNPIN_PADS:t.unpinPads,GET_PINNED_USAGE:t.getPinnedUsage,GET_DELETED_PADS:t.getDeletedPads,UPLOAD_CHUNK:t.uploadChunk,UPLOAD_COMPLETE:t.uploadComplete,UPLOAD_STATUS:t.uploadStatus,UPLOAD_CANCEL:t.uploadCancel,ANON_RPC_MESSAGE:t.anonRpcMsg,GET_FILE_SIZE:t.getFileSize,GET_MULTIPLE_FILE_SIZE:t.getMultipleFileSize,GET:t.get,SET:t.set,ADD_PAD:t.addPad,SET_PAD_TITLE:t.setPadTitle,MOVE_TO_TRASH:t.moveToTrash,RESET_DRIVE:t.resetDrive,GET_METADATA:t.getMetadata,IS_ONLY_IN_SHARED_FOLDER:t.isOnlyInSharedFolder,SET_DISPLAY_NAME:t.setDisplayName,SET_PAD_ATTRIBUTE:t.setPadAttribute,GET_PAD_ATTRIBUTE:t.getPadAttribute,SET_ATTRIBUTE:t.setAttribute,GET_ATTRIBUTE:t.getAttribute,LIST_ALL_TAGS:t.listAllTags,GET_TEMPLATES:t.getTemplates,GET_SECURE_FILES_LIST:t.getSecureFilesList,GET_PAD_DATA:t.getPadData,GET_PAD_DATA_FROM_CHANNEL:t.getPadDataFromChannel,GET_STRONGER_HASH:t.getStrongerHash,INCREMENT_TEMPLATE_USE:t.incrementTemplateUse,GET_SHARED_FOLDER:t.getSharedFolder,ADD_SHARED_FOLDER:t.addSharedFolder,LOAD_SHARED_FOLDER:t.loadSharedFolderAnon,RESTORE_SHARED_FOLDER:t.restoreSharedFolder,UPDATE_SHARED_FOLDER_PASSWORD:t.updateSharedFolderPassword,ANSWER_FRIEND_REQUEST:t.answerFriendRequest,SEND_FRIEND_REQUEST:t.sendFriendRequest,ANON_GET_PREVIEW_CONTENT:t.anonGetPreviewContent,OO_COMMAND:t.onlyoffice.execCommand,MAILBOX_COMMAND:t.mailbox.execCommand,UNIVERSAL_COMMAND:t.universal.execCommand,SEND_PAD_MSG:t.pad.sendMessage,JOIN_PAD:t.pad.join,LEAVE_PAD:t.pad.leave,REMOVE_OWNED_CHANNEL:t.pad.destroy,CLEAR_OWNED_CHANNEL:t.pad.clear,CORRUPTED_CACHE:t.pad.onCorruptedCache,GET_LAST_HASH:t.pad.getLastHash,GET_FULL_HISTORY:t.getFullHistory,GET_HISTORY:t.getHistory,GET_HISTORY_RANGE:t.getHistoryRange,IS_NEW_CHANNEL:t.isNewChannel,CONTACT_PAD_OWNER:t.contactPadOwner,GIVE_PAD_ACCESS:t.givePadAccess,BURN_PAD:t.burnPad,GET_PAD_METADATA:t.pad?.getMetadata,SET_PAD_METADATA:t.pad?.setMetadata,CHANGE_PAD_PASSWORD_PIN:t.changePadPasswordPin,GET_SNAPSHOT:t.getSnapshot,DELETE_MAILBOX_MESSAGE:t.deleteMailboxMessage,DRIVE_USEROBJECT:t.userObjectCommand,GET_DRIVE:t.drive.get,SET_DRIVE:t.drive.set,MIGRATE_ANON_DRIVE:t.drive.migrateAnon,HAS_DRIVE:t.drive.exists,DELETE_ACCOUNT:t.deleteAccount,REMOVE_OWNED_PADS:t.removeOwnedPads,ADMIN_RPC:t.adminRpc,ADMIN_ADD_MAILBOX:t.addAdminMailbox};return r.query=function(e,n,t){o[e]?o[e]("0",n,t):console.error("UNHANDLED_STORE_RPC")},r._removeClient=t._removeClient,r}}),cr),gr(),Z()),hr}var br,Or,Ar=function(){if(yr)return vr;yr=1;const e=Er();return vr={start:n=>{let t=!1,r=()=>{globalThis.close()};globalThis.window=globalThis,addEventListener("connect",o=>{console.debug("New SharedWorker client");const a=o.ports[0],i=e=>{a.postMessage(e)};let s,c=!1,u=()=>{};a.onmessage=function(o){if("INIT"===o.data?.type){if((o=>{t||(n(o),e.init(r),t=!0)})(o.data.cfg),c)return;c=!0,e.initClient({postMsg:i},function(e,n){s=e,u=n,i("SW_READY")})}else"CLOSE"===o.data?(console.debug("leave"),u()):s&&s.fire(o)}})}}}();var wr,Dr,_r=function(){if(Or)return br;Or=1;const e=Er();return br={start:n=>{let t,r=!1;const o=()=>{globalThis.close()},a=e=>{postMessage(e)};globalThis.window=globalThis,onmessage=function(i){if("INIT"===i.data?.type){let s=i.data.cfg;if(r)return;return n(s),e.init(o),r=!0,void e.initClient({postMsg:a},function(e){t=e,a("WW_READY")})}t&&t.fire(i)}}}}();var Tr=function(){if(Dr)return wr;Dr=1;const e=Er(),n=Z();return wr={start:t=>{let r,o=!1,a=!1;const i=n.mkEvent(),s=()=>{a=!0},c=e=>{a||i.fire(e)};return{init:n=>{o||(t(n),e.init(s),o=!0,e.initClient({postMsg:c},function(e){r=e,c("STORE_READY")}))},onMessage:e=>{i.reg(n=>{setTimeout(()=>{e(n)})})},query:e=>{r&&!a&&r.fire({data:e,origin:""})}}}}}(),Sr=Kn(),Nr=n({__proto__:null,default:r(Sr)},[Sr]),Ir=jn(),xr=n({__proto__:null,default:r(Ir)},[Ir]),Cr=Pt(),Rr=n({__proto__:null,default:r(Cr)},[Cr]),Pr=kt(),kr=n({__proto__:null,default:r(Pr)},[Pr]),Mr=Kt(),Fr=n({__proto__:null,default:r(Mr)},[Mr]),Lr=Qt(),Hr=n({__proto__:null,default:r(Lr)},[Lr]);let jr=e=>{[Te,nn,q,$e,B,Nr,gn,un,ke,Rr,kr,Hr,lr,ge,xr,Fr,rr].forEach(n=>{"function"==typeof n.setCustomize&&n.setCustomize(e)})},Kr="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,Ur="undefined"!=typeof SharedWorkerGlobalScope&&self instanceof SharedWorkerGlobalScope;e.store={},Ur?Ar.start(jr):Kr?_r.start(jr):("undefined"!=typeof module&&module.exports,e.store=Tr.start(jr)),e.start=jr}); +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["cryptpad-worker-min"]={})}(this,function(e){"use strict";function n(e,n){return n.forEach(function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach(function(t){if("default"!==t&&!(t in e)){var r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:function(){return n[t]}})}})}),Object.freeze(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if("function"==typeof n){var t=function e(){var t=!1;try{t=this instanceof e}catch{}return t?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}),t}var a,i={exports:{}},s={exports:{}},c={exports:{}};function u(){return a||(a=1,function(e){var n;n=function(){var e=function(){},n=function(){return(new Date).getTime()},t=function(e,n,t){e.timeouts.push(setTimeout(n,t))},r=function(n,r){n.ws&&(n.ws.onmessage=e,n.ws.onopen=e,n.ws.close(),r?n.ws.onclose({reason:"offline"}):t(n,function(){n.ws&&n.ws.onclose({reason:"forced closed because websocket failed to close"})},1e4))},o=function(e,n){return!!e.ws&&(e.ws.send(JSON.stringify(n)),!0)},a=function(e,n){return function(e,t){var r=n[e];if(!r)throw new Error("no such event "+e);r.push(t)}},i=function(e,n,t,r){var o=r[n];if(!o)throw new Error("no such event "+n);var a=o.indexOf(t);-1!==a&&o.splice(a,1)},s=function(e,t,r){if(e.channels[t])return new Promise(function(n){n(e.channels[t])});var s=e.queues.p2;1===r?s=e.queues.p1:3===r&&(s=e.queues.p3);var c={queue:s,onMessage:[],onJoin:[],onLeave:[],members:[],jSeq:e.seq++},u={message:c.onMessage,join:c.onJoin,leave:c.onLeave},f={_:c,time:n(),id:t,members:c.members,bcast:function(t){return function(e,t,r){var a=e.channels[t],i=e.seq++,s=[i,"MSG",t,r];if(!a)return new Promise(function(e,n){n({type:"NO_SUCH_CHANNEL",message:JSON.stringify(s)})});var c=o(e,s);return new Promise(function(t,r){c?e.requests[i]={channel:a,reject:r,resolve:t,time:n()}:r({type:"DISCONNECTED",message:JSON.stringify(s)})})}(e,f.id,t)},leave:function(t){return function(e,t,r){if(e.channels[t]){if(delete e.channels[t],e.ws&&1===e.ws.readyState){var a=e.seq++;o(e,[a,"LEAVE",t,r]);var i=function(){};e.requests[a]={reject:i,resolve:i,time:n()}}}else console.debug("no such channel",t)}(e,f.id,t)},on:a(0,u),off:function(e,n){i(0,e,n,u)}};e.requests[c.jSeq]=f;var l=[c.jSeq,"JOIN",t],d=o(e,l);return new Promise(function(e,n){d?(f._.resolve=e,f._.reject=n):n({type:"DISCONNECTED",message:JSON.stringify(l)})})},c=function(t){var r={message:t.onMessage,disconnect:t.onDisconnect,reconnect:t.onReconnect},c={webChannels:t.channels,getLag:function(){return function(e){return e.ws?e.pingOutstanding?Math.max(n()-e.timeOfLastPingSent,e.lastObservedLag):e.lastObservedLag:null}(t)},sendto:function(e,r){return function(e,t,r){var a=e.seq++,i=[a,"MSG",t,r],s=o(e,i);return new Promise(function(t,r){s?e.requests[a]={reject:r,resolve:t,time:n()}:r({type:"DISCONNECTED",message:JSON.stringify(i)})})}(t,e,r)},join:function(e,n){return s(t,e,n)},disconnect:function(){return function(n){if(n.ws){var t=n.ws.onclose;n.ws.onclose=e,n.ws.close(),t({reason:"network.disconnect() called"})}n.timeouts.forEach(clearTimeout),n.timeouts=[]}(t)},on:a(0,r),off:function(e,n){i(0,e,n,r)}};return c.__defineGetter__("webChannels",function(){return Object.keys(t.channels).map(function(e){return t.channels[e]})}),c},u=function(e){if(!e.queues.busy){var n=function(){var t=e.queues.p1.shift()||e.queues.p2.shift()||e.queues.p3.shift();if(t){e.queues.busy=!0;var r=t.h,o=t.msg;Promise.resolve().then(()=>{t.resolve?t.resolve():r.forEach(function(e){try{e(o[4],o[1])}catch(e){console.error(e)}})}).then(n)}else e.queues.busy=!1};n()}};return{connect:function(a,i){i=i||function(e){return new globalThis.WebSocket(e)};var s={ws:null,seq:1,uid:null,network:null,channels:{},onMessage:[],onDisconnect:[],onReconnect:[],timeouts:[],requests:{},pingInterval:null,queues:{p1:[],p2:[],p3:[]},timeOfLastPingSent:-1,timeOfLastPingReceived:-1,timeOfLastMsgReceived:-1,lastObservedLag:0,pingOutstanding:0};s.network=c(s);var f=e,l=e;"undefined"!=typeof window&&window.addEventListener("offline",function(){-1===["localhost","127.0.0.1",""].indexOf(window.location.hostname)&&r(s,!0)});var d=function(){var c=s.ws=i(a);s.timeOfLastPingSent=s.timeOfLastPingReceived=n(),s.timeOfLastMsgReceived=n(),c.onmessage=function(e){return function(e,t){var a=void 0;try{a=JSON.parse(t.data)}catch(e){return void console.log(e.stack)}if(e.timeOfLastMsgReceived=n(),0===a[0]){if("IDENT"===a[2])return e.uid=a[3],e.ws._onident(),void(e.pingInterval=setInterval(function(){if(!(n()-e.timeOfLastPingReceived<15e3||(n()-e.timeOfLastMsgReceived>6e4&&r(e),e.pingOutstanding))){var t=e.seq++,a=n();e.timeOfLastPingSent=a,e.pingOutstanding++,e.requests[t]={time:a,ping:a},o(e,[t,"PING"])}},5e3));if(e.uid){if("PING"===a[2])return a[2]="PONG",void o(e,a);if("MSG"===a[2]){var i=void 0,s=e.queues.p2;if(a[3]===e.uid)i=e.onMessage,"number"==typeof a[5]&&(1===a[5]&&(s=e.queues.p1),3===a[5]&&(s=e.queues.p3));else{var c=e.channels[a[3]];if(!c)return void console.log("message to non-existent chan "+JSON.stringify(a));i=c._.onMessage,c._.queue&&(s=c._.queue)}s.push({msg:a,h:i}),u(e)}if("LEAVE"===a[2]){var f=e.channels[a[3]];if(!f)return void(a[1]!==e.uid&&console.log("leaving non-existent chan "+JSON.stringify(a)));var l=f._.members.indexOf(a[1]);-1!==l&&f._.members.splice(l,1),f._.onLeave.forEach(function(e){try{e(a[1],a[4])}catch(e){console.log(e.stack)}})}if("JOIN"===a[2]){var d=e.channels[a[3]];if(!d)return void console.log("ERROR: join to non-existent chan "+JSON.stringify(a));if(-1!==d._.members.indexOf(a[1]))return;var h=-1!==d._.members.indexOf(e.uid);d._.members.push(a[1]),h||a[1]!==e.uid||(d.myID=e.uid,d._.resolve(d)),h&&d._.onJoin.forEach(function(e){try{e(a[1])}catch(e){console.log(e.stack)}})}}}else{var p=e.requests[a[0]];if(!p)return void console.log("error: "+JSON.stringify(a));if(delete e.requests[a[0]],"ACK"===a[1]){if(p.ping)return e.lastObservedLag=n()-Number(p.ping),e.timeOfLastPingReceived=n(),void e.pingOutstanding--;if(p.channel){const n=p.channel;let t=e.queues.p2;return n._.queue&&(t=n._.queue),t.push({msg:a,resolve:p.resolve}),void u(e)}p.resolve()}else if("JACK"===a[1]){if(p._){if(!a[2])throw new Error("wrong type of ACK for channel join");return p.id=a[2],void(e.channels[p.id]=p)}p.resolve()}else if("ERROR"===a[1])if("function"==typeof p.reject)p.reject({type:a[2],message:a[3]});else if(p._&&"function"==typeof p._.reject){if("EJOINED"===a[2]&&!e.channels[a[3]])return p.id=a[3],void(e.channels[p.id]=p);p._.reject({type:a[2],message:a[3]})}else console.error(a);else p.reject({type:"UNKNOWN",message:JSON.stringify(a)})}}(s,e)},c.onclose=function(n){c.onclose=e,clearInterval(s.pingInterval),s.timeouts.forEach(clearTimeout),s.ws=null,s.uid&&(s.uid=null,s.onDisconnect.forEach(function(e){try{e(n.reason)}catch(e){console.log(e.stack)}})),t(s,d,s.uid?0:7e3)},c.onopen=function(){t(s,function(){s.uid||(l({type:"TIMEOUT",message:"waited 30000ms"}),f=l=e,r(s))},3e4)},s.ws._onident=function(){s.timeOfLastPingReceived=n(),s.timeOfLastMsgReceived=n(),s.lastObservedLag=n()-s.timeOfLastPingSent,f!==e?(f(s.network),f=l=e):(s.channels={},s.requests={},s.pingOutstanding=0,s.onReconnect.forEach(function(e){try{e(s.uid)}catch(e){console.log(e.stack)}}))}};return new Promise(function(e,n){f=e,l=n,d()})}}},e.exports?e.exports=n():window.netflux_websocket=n()}(c)),c.exports}function f(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var l,d={exports:{}};function h(){return l||(l=1,function(e){!function(e){var n=function(e){var n,t=new Float64Array(16);if(e)for(n=0;n>24&255,e[n+1]=t>>16&255,e[n+2]=t>>8&255,e[n+3]=255&t,e[n+4]=r>>24&255,e[n+5]=r>>16&255,e[n+6]=r>>8&255,e[n+7]=255&r}function v(e,n,t,r,o){var a,i=0;for(a=0;a>>8)-1}function y(e,n,t,r){return v(e,n,t,r,16)}function m(e,n,t,r){return v(e,n,t,r,32)}function g(e,n,t,r){!function(e,n,t,r){for(var o,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,i=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,s=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,c=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,u=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,f=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,l=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,d=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,p=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,v=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,y=255&t[16]|(255&t[17])<<8|(255&t[18])<<16|(255&t[19])<<24,m=255&t[20]|(255&t[21])<<8|(255&t[22])<<16|(255&t[23])<<24,g=255&t[24]|(255&t[25])<<8|(255&t[26])<<16|(255&t[27])<<24,E=255&t[28]|(255&t[29])<<8|(255&t[30])<<16|(255&t[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,O=a,A=i,w=s,D=c,_=u,T=f,S=l,N=d,I=h,x=p,C=v,R=y,P=m,k=g,M=E,F=b,L=0;L<20;L+=2)O^=(o=(P^=(o=(I^=(o=(_^=(o=O+P|0)<<7|o>>>25)+O|0)<<9|o>>>23)+_|0)<<13|o>>>19)+I|0)<<18|o>>>14,T^=(o=(A^=(o=(k^=(o=(x^=(o=T+A|0)<<7|o>>>25)+T|0)<<9|o>>>23)+x|0)<<13|o>>>19)+k|0)<<18|o>>>14,C^=(o=(S^=(o=(w^=(o=(M^=(o=C+S|0)<<7|o>>>25)+C|0)<<9|o>>>23)+M|0)<<13|o>>>19)+w|0)<<18|o>>>14,F^=(o=(R^=(o=(N^=(o=(D^=(o=F+R|0)<<7|o>>>25)+F|0)<<9|o>>>23)+D|0)<<13|o>>>19)+N|0)<<18|o>>>14,O^=(o=(D^=(o=(w^=(o=(A^=(o=O+D|0)<<7|o>>>25)+O|0)<<9|o>>>23)+A|0)<<13|o>>>19)+w|0)<<18|o>>>14,T^=(o=(_^=(o=(N^=(o=(S^=(o=T+_|0)<<7|o>>>25)+T|0)<<9|o>>>23)+S|0)<<13|o>>>19)+N|0)<<18|o>>>14,C^=(o=(x^=(o=(I^=(o=(R^=(o=C+x|0)<<7|o>>>25)+C|0)<<9|o>>>23)+R|0)<<13|o>>>19)+I|0)<<18|o>>>14,F^=(o=(M^=(o=(k^=(o=(P^=(o=F+M|0)<<7|o>>>25)+F|0)<<9|o>>>23)+P|0)<<13|o>>>19)+k|0)<<18|o>>>14;O=O+a|0,A=A+i|0,w=w+s|0,D=D+c|0,_=_+u|0,T=T+f|0,S=S+l|0,N=N+d|0,I=I+h|0,x=x+p|0,C=C+v|0,R=R+y|0,P=P+m|0,k=k+g|0,M=M+E|0,F=F+b|0,e[0]=O>>>0&255,e[1]=O>>>8&255,e[2]=O>>>16&255,e[3]=O>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=w>>>0&255,e[9]=w>>>8&255,e[10]=w>>>16&255,e[11]=w>>>24&255,e[12]=D>>>0&255,e[13]=D>>>8&255,e[14]=D>>>16&255,e[15]=D>>>24&255,e[16]=_>>>0&255,e[17]=_>>>8&255,e[18]=_>>>16&255,e[19]=_>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=S>>>0&255,e[25]=S>>>8&255,e[26]=S>>>16&255,e[27]=S>>>24&255,e[28]=N>>>0&255,e[29]=N>>>8&255,e[30]=N>>>16&255,e[31]=N>>>24&255,e[32]=I>>>0&255,e[33]=I>>>8&255,e[34]=I>>>16&255,e[35]=I>>>24&255,e[36]=x>>>0&255,e[37]=x>>>8&255,e[38]=x>>>16&255,e[39]=x>>>24&255,e[40]=C>>>0&255,e[41]=C>>>8&255,e[42]=C>>>16&255,e[43]=C>>>24&255,e[44]=R>>>0&255,e[45]=R>>>8&255,e[46]=R>>>16&255,e[47]=R>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=k>>>0&255,e[53]=k>>>8&255,e[54]=k>>>16&255,e[55]=k>>>24&255,e[56]=M>>>0&255,e[57]=M>>>8&255,e[58]=M>>>16&255,e[59]=M>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}(e,n,t,r)}function E(e,n,t,r){!function(e,n,t,r){for(var o,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,i=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,s=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,c=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,u=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,f=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,l=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,d=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,p=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,v=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,y=255&t[16]|(255&t[17])<<8|(255&t[18])<<16|(255&t[19])<<24,m=255&t[20]|(255&t[21])<<8|(255&t[22])<<16|(255&t[23])<<24,g=255&t[24]|(255&t[25])<<8|(255&t[26])<<16|(255&t[27])<<24,E=255&t[28]|(255&t[29])<<8|(255&t[30])<<16|(255&t[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,O=0;O<20;O+=2)a^=(o=(m^=(o=(h^=(o=(u^=(o=a+m|0)<<7|o>>>25)+a|0)<<9|o>>>23)+u|0)<<13|o>>>19)+h|0)<<18|o>>>14,f^=(o=(i^=(o=(g^=(o=(p^=(o=f+i|0)<<7|o>>>25)+f|0)<<9|o>>>23)+p|0)<<13|o>>>19)+g|0)<<18|o>>>14,v^=(o=(l^=(o=(s^=(o=(E^=(o=v+l|0)<<7|o>>>25)+v|0)<<9|o>>>23)+E|0)<<13|o>>>19)+s|0)<<18|o>>>14,b^=(o=(y^=(o=(d^=(o=(c^=(o=b+y|0)<<7|o>>>25)+b|0)<<9|o>>>23)+c|0)<<13|o>>>19)+d|0)<<18|o>>>14,a^=(o=(c^=(o=(s^=(o=(i^=(o=a+c|0)<<7|o>>>25)+a|0)<<9|o>>>23)+i|0)<<13|o>>>19)+s|0)<<18|o>>>14,f^=(o=(u^=(o=(d^=(o=(l^=(o=f+u|0)<<7|o>>>25)+f|0)<<9|o>>>23)+l|0)<<13|o>>>19)+d|0)<<18|o>>>14,v^=(o=(p^=(o=(h^=(o=(y^=(o=v+p|0)<<7|o>>>25)+v|0)<<9|o>>>23)+y|0)<<13|o>>>19)+h|0)<<18|o>>>14,b^=(o=(E^=(o=(g^=(o=(m^=(o=b+E|0)<<7|o>>>25)+b|0)<<9|o>>>23)+m|0)<<13|o>>>19)+g|0)<<18|o>>>14;e[0]=a>>>0&255,e[1]=a>>>8&255,e[2]=a>>>16&255,e[3]=a>>>24&255,e[4]=f>>>0&255,e[5]=f>>>8&255,e[6]=f>>>16&255,e[7]=f>>>24&255,e[8]=v>>>0&255,e[9]=v>>>8&255,e[10]=v>>>16&255,e[11]=v>>>24&255,e[12]=b>>>0&255,e[13]=b>>>8&255,e[14]=b>>>16&255,e[15]=b>>>24&255,e[16]=l>>>0&255,e[17]=l>>>8&255,e[18]=l>>>16&255,e[19]=l>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,n,t,r)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function O(e,n,t,r,o,a,i){var s,c,u=new Uint8Array(16),f=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=a[c];for(;o>=64;){for(g(f,u,i,b),c=0;c<64;c++)e[n+c]=t[r+c]^f[c];for(s=1,c=8;c<16;c++)s=s+(255&u[c])|0,u[c]=255&s,s>>>=8;o-=64,n+=64,r+=64}if(o>0)for(g(f,u,i,b),c=0;c=64;){for(g(c,s,o,b),i=0;i<64;i++)e[n+i]=c[i];for(a=1,i=8;i<16;i++)a=a+(255&s[i])|0,s[i]=255&a,a>>>=8;t-=64,n+=64}if(t>0)for(g(c,s,o,b),i=0;i>>13|t<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(t>>>10|r<<6),o=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|o<<9),a=255&e[8]|(255&e[9])<<8,this.r[4]=255&(o>>>4|a<<12),this.r[5]=a>>>1&8190,i=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(a>>>14|i<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(i>>>11|s<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function T(e,n,t,r,o,a){var i=new _(a);return i.update(t,r,o),i.finish(e,n),0}function S(e,n,t,r,o,a){var i=new Uint8Array(16);return T(i,0,t,r,o,a),y(e,n,i,0)}function N(e,n,t,r,o){var a;if(t<32)return-1;for(D(e,0,n,0,t,r,o),T(e,16,e,32,t-32,e),a=0;a<16;a++)e[a]=0;return 0}function I(e,n,t,r,o){var a,i=new Uint8Array(32);if(t<32)return-1;if(w(i,0,32,r,o),0!==S(n,16,n,32,t-32,i))return-1;for(D(e,0,n,0,t,r,o),a=0;a<32;a++)e[a]=0;return 0}function x(e,n){var t;for(t=0;t<16;t++)e[t]=0|n[t]}function C(e){var n,t,r=1;for(n=0;n<16;n++)t=e[n]+r+65535,r=Math.floor(t/65536),e[n]=t-65536*r;e[0]+=r-1+37*(r-1)}function R(e,n,t){for(var r,o=~(t-1),a=0;a<16;a++)r=o&(e[a]^n[a]),e[a]^=r,n[a]^=r}function P(e,t){var r,o,a,i=n(),s=n();for(r=0;r<16;r++)s[r]=t[r];for(C(s),C(s),C(s),o=0;o<2;o++){for(i[0]=s[0]-65517,r=1;r<15;r++)i[r]=s[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=s[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,R(s,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function k(e,n){var t=new Uint8Array(32),r=new Uint8Array(32);return P(t,e),P(r,n),m(t,0,r,0)}function M(e){var n=new Uint8Array(32);return P(n,e),1&n[0]}function F(e,n){var t;for(t=0;t<16;t++)e[t]=n[2*t]+(n[2*t+1]<<8);e[15]&=32767}function L(e,n,t){for(var r=0;r<16;r++)e[r]=n[r]+t[r]}function H(e,n,t){for(var r=0;r<16;r++)e[r]=n[r]-t[r]}function j(e,n,t){var r,o,a=0,i=0,s=0,c=0,u=0,f=0,l=0,d=0,h=0,p=0,v=0,y=0,m=0,g=0,E=0,b=0,O=0,A=0,w=0,D=0,_=0,T=0,S=0,N=0,I=0,x=0,C=0,R=0,P=0,k=0,M=0,F=t[0],L=t[1],H=t[2],j=t[3],K=t[4],U=t[5],B=t[6],V=t[7],Y=t[8],G=t[9],J=t[10],q=t[11],W=t[12],z=t[13],Q=t[14],Z=t[15];a+=(r=n[0])*F,i+=r*L,s+=r*H,c+=r*j,u+=r*K,f+=r*U,l+=r*B,d+=r*V,h+=r*Y,p+=r*G,v+=r*J,y+=r*q,m+=r*W,g+=r*z,E+=r*Q,b+=r*Z,i+=(r=n[1])*F,s+=r*L,c+=r*H,u+=r*j,f+=r*K,l+=r*U,d+=r*B,h+=r*V,p+=r*Y,v+=r*G,y+=r*J,m+=r*q,g+=r*W,E+=r*z,b+=r*Q,O+=r*Z,s+=(r=n[2])*F,c+=r*L,u+=r*H,f+=r*j,l+=r*K,d+=r*U,h+=r*B,p+=r*V,v+=r*Y,y+=r*G,m+=r*J,g+=r*q,E+=r*W,b+=r*z,O+=r*Q,A+=r*Z,c+=(r=n[3])*F,u+=r*L,f+=r*H,l+=r*j,d+=r*K,h+=r*U,p+=r*B,v+=r*V,y+=r*Y,m+=r*G,g+=r*J,E+=r*q,b+=r*W,O+=r*z,A+=r*Q,w+=r*Z,u+=(r=n[4])*F,f+=r*L,l+=r*H,d+=r*j,h+=r*K,p+=r*U,v+=r*B,y+=r*V,m+=r*Y,g+=r*G,E+=r*J,b+=r*q,O+=r*W,A+=r*z,w+=r*Q,D+=r*Z,f+=(r=n[5])*F,l+=r*L,d+=r*H,h+=r*j,p+=r*K,v+=r*U,y+=r*B,m+=r*V,g+=r*Y,E+=r*G,b+=r*J,O+=r*q,A+=r*W,w+=r*z,D+=r*Q,_+=r*Z,l+=(r=n[6])*F,d+=r*L,h+=r*H,p+=r*j,v+=r*K,y+=r*U,m+=r*B,g+=r*V,E+=r*Y,b+=r*G,O+=r*J,A+=r*q,w+=r*W,D+=r*z,_+=r*Q,T+=r*Z,d+=(r=n[7])*F,h+=r*L,p+=r*H,v+=r*j,y+=r*K,m+=r*U,g+=r*B,E+=r*V,b+=r*Y,O+=r*G,A+=r*J,w+=r*q,D+=r*W,_+=r*z,T+=r*Q,S+=r*Z,h+=(r=n[8])*F,p+=r*L,v+=r*H,y+=r*j,m+=r*K,g+=r*U,E+=r*B,b+=r*V,O+=r*Y,A+=r*G,w+=r*J,D+=r*q,_+=r*W,T+=r*z,S+=r*Q,N+=r*Z,p+=(r=n[9])*F,v+=r*L,y+=r*H,m+=r*j,g+=r*K,E+=r*U,b+=r*B,O+=r*V,A+=r*Y,w+=r*G,D+=r*J,_+=r*q,T+=r*W,S+=r*z,N+=r*Q,I+=r*Z,v+=(r=n[10])*F,y+=r*L,m+=r*H,g+=r*j,E+=r*K,b+=r*U,O+=r*B,A+=r*V,w+=r*Y,D+=r*G,_+=r*J,T+=r*q,S+=r*W,N+=r*z,I+=r*Q,x+=r*Z,y+=(r=n[11])*F,m+=r*L,g+=r*H,E+=r*j,b+=r*K,O+=r*U,A+=r*B,w+=r*V,D+=r*Y,_+=r*G,T+=r*J,S+=r*q,N+=r*W,I+=r*z,x+=r*Q,C+=r*Z,m+=(r=n[12])*F,g+=r*L,E+=r*H,b+=r*j,O+=r*K,A+=r*U,w+=r*B,D+=r*V,_+=r*Y,T+=r*G,S+=r*J,N+=r*q,I+=r*W,x+=r*z,C+=r*Q,R+=r*Z,g+=(r=n[13])*F,E+=r*L,b+=r*H,O+=r*j,A+=r*K,w+=r*U,D+=r*B,_+=r*V,T+=r*Y,S+=r*G,N+=r*J,I+=r*q,x+=r*W,C+=r*z,R+=r*Q,P+=r*Z,E+=(r=n[14])*F,b+=r*L,O+=r*H,A+=r*j,w+=r*K,D+=r*U,_+=r*B,T+=r*V,S+=r*Y,N+=r*G,I+=r*J,x+=r*q,C+=r*W,R+=r*z,P+=r*Q,k+=r*Z,b+=(r=n[15])*F,i+=38*(A+=r*H),s+=38*(w+=r*j),c+=38*(D+=r*K),u+=38*(_+=r*U),f+=38*(T+=r*B),l+=38*(S+=r*V),d+=38*(N+=r*Y),h+=38*(I+=r*G),p+=38*(x+=r*J),v+=38*(C+=r*q),y+=38*(R+=r*W),m+=38*(P+=r*z),g+=38*(k+=r*Q),E+=38*(M+=r*Z),a=(r=(a+=38*(O+=r*L))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),i=(r=i+o+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),E=(r=E+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=(a+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),i=(r=i+o+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),E=(r=E+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),a+=o-1+37*(o-1),e[0]=a,e[1]=i,e[2]=s,e[3]=c,e[4]=u,e[5]=f,e[6]=l,e[7]=d,e[8]=h,e[9]=p,e[10]=v,e[11]=y,e[12]=m,e[13]=g,e[14]=E,e[15]=b}function K(e,n){j(e,n,n)}function U(e,t){var r,o=n();for(r=0;r<16;r++)o[r]=t[r];for(r=253;r>=0;r--)K(o,o),2!==r&&4!==r&&j(o,o,t);for(r=0;r<16;r++)e[r]=o[r]}function B(e,t){var r,o=n();for(r=0;r<16;r++)o[r]=t[r];for(r=250;r>=0;r--)K(o,o),1!==r&&j(o,o,t);for(r=0;r<16;r++)e[r]=o[r]}function V(e,t,r){var o,a,i=new Uint8Array(32),c=new Float64Array(80),u=n(),f=n(),l=n(),d=n(),h=n(),p=n();for(a=0;a<31;a++)i[a]=t[a];for(i[31]=127&t[31]|64,i[0]&=248,F(c,r),a=0;a<16;a++)f[a]=c[a],d[a]=u[a]=l[a]=0;for(u[0]=d[0]=1,a=254;a>=0;--a)R(u,f,o=i[a>>>3]>>>(7&a)&1),R(l,d,o),L(h,u,l),H(u,u,l),L(l,f,d),H(f,f,d),K(d,h),K(p,u),j(u,l,u),j(l,f,h),L(h,u,l),H(u,u,l),K(f,u),H(l,d,p),j(u,l,s),L(u,u,d),j(l,l,u),j(u,d,p),j(d,f,c),K(f,h),R(u,f,o),R(l,d,o);for(a=0;a<16;a++)c[a+16]=u[a],c[a+32]=l[a],c[a+48]=f[a],c[a+64]=d[a];var v=c.subarray(32),y=c.subarray(16);return U(v,v),j(y,y,v),P(e,y),0}function Y(e,n){return V(e,n,o)}function G(e,n){return t(n,32),Y(e,n)}function J(e,n,t){var o=new Uint8Array(32);return V(o,t,n),E(e,r,o,b)}_.prototype.blocks=function(e,n,t){for(var r,o,a,i,s,c,u,f,l,d,h,p,v,y,m,g,E,b,O,A=this.fin?0:2048,w=this.h[0],D=this.h[1],_=this.h[2],T=this.h[3],S=this.h[4],N=this.h[5],I=this.h[6],x=this.h[7],C=this.h[8],R=this.h[9],P=this.r[0],k=this.r[1],M=this.r[2],F=this.r[3],L=this.r[4],H=this.r[5],j=this.r[6],K=this.r[7],U=this.r[8],B=this.r[9];t>=16;)d=l=0,d+=(w+=8191&(r=255&e[n+0]|(255&e[n+1])<<8))*P,d+=(D+=8191&(r>>>13|(o=255&e[n+2]|(255&e[n+3])<<8)<<3))*(5*B),d+=(_+=8191&(o>>>10|(a=255&e[n+4]|(255&e[n+5])<<8)<<6))*(5*U),d+=(T+=8191&(a>>>7|(i=255&e[n+6]|(255&e[n+7])<<8)<<9))*(5*K),l=(d+=(S+=8191&(i>>>4|(s=255&e[n+8]|(255&e[n+9])<<8)<<12))*(5*j))>>>13,d&=8191,d+=(N+=s>>>1&8191)*(5*H),d+=(I+=8191&(s>>>14|(c=255&e[n+10]|(255&e[n+11])<<8)<<2))*(5*L),d+=(x+=8191&(c>>>11|(u=255&e[n+12]|(255&e[n+13])<<8)<<5))*(5*F),d+=(C+=8191&(u>>>8|(f=255&e[n+14]|(255&e[n+15])<<8)<<8))*(5*M),h=l+=(d+=(R+=f>>>5|A)*(5*k))>>>13,h+=w*k,h+=D*P,h+=_*(5*B),h+=T*(5*U),l=(h+=S*(5*K))>>>13,h&=8191,h+=N*(5*j),h+=I*(5*H),h+=x*(5*L),h+=C*(5*F),l+=(h+=R*(5*M))>>>13,h&=8191,p=l,p+=w*M,p+=D*k,p+=_*P,p+=T*(5*B),l=(p+=S*(5*U))>>>13,p&=8191,p+=N*(5*K),p+=I*(5*j),p+=x*(5*H),p+=C*(5*L),v=l+=(p+=R*(5*F))>>>13,v+=w*F,v+=D*M,v+=_*k,v+=T*P,l=(v+=S*(5*B))>>>13,v&=8191,v+=N*(5*U),v+=I*(5*K),v+=x*(5*j),v+=C*(5*H),y=l+=(v+=R*(5*L))>>>13,y+=w*L,y+=D*F,y+=_*M,y+=T*k,l=(y+=S*P)>>>13,y&=8191,y+=N*(5*B),y+=I*(5*U),y+=x*(5*K),y+=C*(5*j),m=l+=(y+=R*(5*H))>>>13,m+=w*H,m+=D*L,m+=_*F,m+=T*M,l=(m+=S*k)>>>13,m&=8191,m+=N*P,m+=I*(5*B),m+=x*(5*U),m+=C*(5*K),g=l+=(m+=R*(5*j))>>>13,g+=w*j,g+=D*H,g+=_*L,g+=T*F,l=(g+=S*M)>>>13,g&=8191,g+=N*k,g+=I*P,g+=x*(5*B),g+=C*(5*U),E=l+=(g+=R*(5*K))>>>13,E+=w*K,E+=D*j,E+=_*H,E+=T*L,l=(E+=S*F)>>>13,E&=8191,E+=N*M,E+=I*k,E+=x*P,E+=C*(5*B),b=l+=(E+=R*(5*U))>>>13,b+=w*U,b+=D*K,b+=_*j,b+=T*H,l=(b+=S*L)>>>13,b&=8191,b+=N*F,b+=I*M,b+=x*k,b+=C*P,O=l+=(b+=R*(5*B))>>>13,O+=w*B,O+=D*U,O+=_*K,O+=T*j,l=(O+=S*H)>>>13,O&=8191,O+=N*L,O+=I*F,O+=x*M,O+=C*k,w=d=8191&(l=(l=((l+=(O+=R*P)>>>13)<<2)+l|0)+(d&=8191)|0),D=h+=l>>>=13,_=p&=8191,T=v&=8191,S=y&=8191,N=m&=8191,I=g&=8191,x=E&=8191,C=b&=8191,R=O&=8191,n+=16,t-=16;this.h[0]=w,this.h[1]=D,this.h[2]=_,this.h[3]=T,this.h[4]=S,this.h[5]=N,this.h[6]=I,this.h[7]=x,this.h[8]=C,this.h[9]=R},_.prototype.finish=function(e,n){var t,r,o,a,i=new Uint16Array(10);if(this.leftover){for(a=this.leftover,this.buffer[a++]=1;a<16;a++)this.buffer[a]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(t=this.h[1]>>>13,this.h[1]&=8191,a=2;a<10;a++)this.h[a]+=t,t=this.h[a]>>>13,this.h[a]&=8191;for(this.h[0]+=5*t,t=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=t,t=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=t,i[0]=this.h[0]+5,t=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this.h[a]+t,t=i[a]>>>13,i[a]&=8191;for(i[9]-=8192,r=(1^t)-1,a=0;a<10;a++)i[a]&=r;for(r=~r,a=0;a<10;a++)this.h[a]=this.h[a]&r|i[a];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,a=1;a<8;a++)o=(this.h[a]+this.pad[a]|0)+(o>>>16)|0,this.h[a]=65535&o;e[n+0]=this.h[0]>>>0&255,e[n+1]=this.h[0]>>>8&255,e[n+2]=this.h[1]>>>0&255,e[n+3]=this.h[1]>>>8&255,e[n+4]=this.h[2]>>>0&255,e[n+5]=this.h[2]>>>8&255,e[n+6]=this.h[3]>>>0&255,e[n+7]=this.h[3]>>>8&255,e[n+8]=this.h[4]>>>0&255,e[n+9]=this.h[4]>>>8&255,e[n+10]=this.h[5]>>>0&255,e[n+11]=this.h[5]>>>8&255,e[n+12]=this.h[6]>>>0&255,e[n+13]=this.h[6]>>>8&255,e[n+14]=this.h[7]>>>0&255,e[n+15]=this.h[7]>>>8&255},_.prototype.update=function(e,n,t){var r,o;if(this.leftover){for((o=16-this.leftover)>t&&(o=t),r=0;r=16&&(o=t-t%16,this.blocks(e,n,o),n+=o,t-=o),t){for(r=0;r=128;){for(A=0;A<16;A++)w=8*A+W,x[A]=t[w+0]<<24|t[w+1]<<16|t[w+2]<<8|t[w+3],C[A]=t[w+4]<<24|t[w+5]<<16|t[w+6]<<8|t[w+7];for(A=0;A<80;A++)if(o=R,a=P,i=k,s=M,c=F,u=L,f=H,j,d=K,h=U,p=B,v=V,y=Y,m=G,g=J,q,T=65535&(_=q),S=_>>>16,N=65535&(D=j),I=D>>>16,T+=65535&(_=(Y>>>14|F<<18)^(Y>>>18|F<<14)^(F>>>9|Y<<23)),S+=_>>>16,N+=65535&(D=(F>>>14|Y<<18)^(F>>>18|Y<<14)^(Y>>>9|F<<23)),I+=D>>>16,T+=65535&(_=Y&G^~Y&J),S+=_>>>16,N+=65535&(D=F&L^~F&H),I+=D>>>16,T+=65535&(_=z[2*A+1]),S+=_>>>16,N+=65535&(D=z[2*A]),I+=D>>>16,D=x[A%16],S+=(_=C[A%16])>>>16,N+=65535&D,I+=D>>>16,N+=(S+=(T+=65535&_)>>>16)>>>16,T=65535&(_=O=65535&T|S<<16),S=_>>>16,N=65535&(D=b=65535&N|(I+=N>>>16)<<16),I=D>>>16,T+=65535&(_=(K>>>28|R<<4)^(R>>>2|K<<30)^(R>>>7|K<<25)),S+=_>>>16,N+=65535&(D=(R>>>28|K<<4)^(K>>>2|R<<30)^(K>>>7|R<<25)),I+=D>>>16,S+=(_=K&U^K&B^U&B)>>>16,N+=65535&(D=R&P^R&k^P&k),I+=D>>>16,l=65535&(N+=(S+=(T+=65535&_)>>>16)>>>16)|(I+=N>>>16)<<16,E=65535&T|S<<16,T=65535&(_=v),S=_>>>16,N=65535&(D=s),I=D>>>16,S+=(_=O)>>>16,N+=65535&(D=b),I+=D>>>16,P=o,k=a,M=i,F=s=65535&(N+=(S+=(T+=65535&_)>>>16)>>>16)|(I+=N>>>16)<<16,L=c,H=u,j=f,R=l,U=d,B=h,V=p,Y=v=65535&T|S<<16,G=y,J=m,q=g,K=E,A%16==15)for(w=0;w<16;w++)D=x[w],T=65535&(_=C[w]),S=_>>>16,N=65535&D,I=D>>>16,D=x[(w+9)%16],T+=65535&(_=C[(w+9)%16]),S+=_>>>16,N+=65535&D,I+=D>>>16,b=x[(w+1)%16],T+=65535&(_=((O=C[(w+1)%16])>>>1|b<<31)^(O>>>8|b<<24)^(O>>>7|b<<25)),S+=_>>>16,N+=65535&(D=(b>>>1|O<<31)^(b>>>8|O<<24)^b>>>7),I+=D>>>16,b=x[(w+14)%16],S+=(_=((O=C[(w+14)%16])>>>19|b<<13)^(b>>>29|O<<3)^(O>>>6|b<<26))>>>16,N+=65535&(D=(b>>>19|O<<13)^(O>>>29|b<<3)^b>>>6),I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,x[w]=65535&N|I<<16,C[w]=65535&T|S<<16;T=65535&(_=K),S=_>>>16,N=65535&(D=R),I=D>>>16,D=e[0],S+=(_=n[0])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[0]=R=65535&N|I<<16,n[0]=K=65535&T|S<<16,T=65535&(_=U),S=_>>>16,N=65535&(D=P),I=D>>>16,D=e[1],S+=(_=n[1])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[1]=P=65535&N|I<<16,n[1]=U=65535&T|S<<16,T=65535&(_=B),S=_>>>16,N=65535&(D=k),I=D>>>16,D=e[2],S+=(_=n[2])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[2]=k=65535&N|I<<16,n[2]=B=65535&T|S<<16,T=65535&(_=V),S=_>>>16,N=65535&(D=M),I=D>>>16,D=e[3],S+=(_=n[3])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[3]=M=65535&N|I<<16,n[3]=V=65535&T|S<<16,T=65535&(_=Y),S=_>>>16,N=65535&(D=F),I=D>>>16,D=e[4],S+=(_=n[4])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[4]=F=65535&N|I<<16,n[4]=Y=65535&T|S<<16,T=65535&(_=G),S=_>>>16,N=65535&(D=L),I=D>>>16,D=e[5],S+=(_=n[5])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[5]=L=65535&N|I<<16,n[5]=G=65535&T|S<<16,T=65535&(_=J),S=_>>>16,N=65535&(D=H),I=D>>>16,D=e[6],S+=(_=n[6])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[6]=H=65535&N|I<<16,n[6]=J=65535&T|S<<16,T=65535&(_=q),S=_>>>16,N=65535&(D=j),I=D>>>16,D=e[7],S+=(_=n[7])>>>16,N+=65535&D,I+=D>>>16,I+=(N+=(S+=(T+=65535&_)>>>16)>>>16)>>>16,e[7]=j=65535&N|I<<16,n[7]=q=65535&T|S<<16,W+=128,r-=128}return r}function Z(e,n,t){var r,o=new Int32Array(8),a=new Int32Array(8),i=new Uint8Array(256),s=t;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,Q(o,a,n,t),t%=128,r=0;r=0;--o)$(e,n,r=t[o/8|0]>>(7&o)&1),X(n,e),X(e,e),$(e,n,r)}function te(e,t){var r=[n(),n(),n(),n()];x(r[0],l),x(r[1],d),x(r[2],i),j(r[3],l,d),ne(e,r,t)}function re(e,r,o){var a,i=new Uint8Array(64),s=[n(),n(),n(),n()];for(o||t(r,32),Z(i,r,32),i[0]&=248,i[31]&=127,i[31]|=64,te(s,i),ee(e,s),a=0;a<32;a++)r[a+32]=e[a];return 0}var oe=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ae(e,n){var t,r,o,a;for(r=63;r>=32;--r){for(t=0,o=r-32,a=r-12;o>4)*oe[o],t=n[o]>>8,n[o]&=255;for(o=0;o<32;o++)n[o]-=t*oe[o];for(r=0;r<32;r++)n[r+1]+=n[r]>>8,e[r]=255&n[r]}function ie(e){var n,t=new Float64Array(64);for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;ae(e,t)}function se(e,t,r,o){var a,i,s=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),f=new Float64Array(64),l=[n(),n(),n(),n()];Z(s,o,32),s[0]&=248,s[31]&=127,s[31]|=64;var d=r+64;for(a=0;a>7&&H(e[0],a,e[0]),j(e[3],e[0],e[1]),0)}(d,o))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(le),n=new Uint8Array(de);return re(e,n),{publicKey:e,secretKey:n}},e.sign.keyPair.fromSecretKey=function(e){if(pe(e),e.length!==de)throw new Error("bad secret key size");for(var n=new Uint8Array(le),t=0;t{if(Array.isArray(n))return n.map(e);if(n instanceof Object){let t=[],r=[];return Object.keys(n).forEach(e=>{/^(0|[1-9][0-9]*)$/.test(e)?t.push(+e):r.push(e)}),t.sort(function(e,n){return e-n}).concat(r.sort()).reduce((t,r)=>(t[r]=e(n[r]),t),{})}return n},n=JSON.stringify.bind(JSON);return y=(t,r,o)=>{let a=n(t,r,0);if(!a||"{"!==a[0]&&"["!==a[0])return a;let i=JSON.parse(a);return n(e(i),null,o)}}())}function T(){return b||(b=1,function(e){e.exports&&(e.exports=function(e,n){const t=globalThis;var r,o={},a=void 0===t.Proxy,i=o.DeepProxy=function(){var e={},r=e.isArray=Array.isArray||function(e){return"[object Array]"===Object.toString(e)},o=e.type=function(e){return null===e?"null":r(e)?"array":typeof e},i=e.isProxyable=function(e,n){return(void 0!==n||!a)&&-1!==["object","array"].indexOf(o(e))},s=e.set=function(n){return function(t,r,o){if("on"===r)throw new Error("'on' is a reserved attribute name for realtime lists and maps");return i(o)?t[r]=e.create(o,n):t[r]=o,n(),t[r]||!0}},c=e.pathMatches=function(e,n){return!n.some(function(n,t){return n!==e[t]})},u=function(e,n){return n.pattern.length-e.pattern.length},f=function(e){return function(n,t,r){switch(n){case"change":t="array"===o(t)?t:[t],e.change.push({cb:function(e,n,o,a){if(c(o,t))return r(e,n,o,a)},pattern:t}),e.change.sort(u);break;case"remove":t="array"===o(t)?t:[t],e.remove.push({cb:function(e,n,o){if(c(n,t))return r(e,n,o)},pattern:t}),e.remove.sort(u);break;case"ready":e.ready.push({cb:function(e){t(e)}});break;case"cacheready":e.cacheready.push({cb:function(e){t(e)}});break;case"disconnect":e.disconnect.push({cb:function(e){t(e)}});break;case"reconnect":e.reconnect.push({cb:function(e){t(e)}});break;case"create":e.create.push({cb:function(e){t(e)}});break;case"error":e.error.push({cb:function(e){t(e)}})}return this}},l=e.get=function(){var e={cacheready:[],disconnect:[],reconnect:[],change:[],ready:[],remove:[],create:[],error:[]};return function(n,t){return"on"===t?f(e):"_isProxy"===t||("_events"===t?e:n[t])}},d=e.delete=function(e){return function(n,t){return void 0===n[t]||(delete n[t],e()),!0}},h=e.handlers=function(e,n){return n?{set:s(e),get:l(e),deleteProperty:d(e)}:{set:s(e),get:function(e,n){return"_isProxy"===n||e[n]},deleteProperty:d(e)}},p=e.remoteChangeFlag=!1,v=e.stringifyFakeProxy=function(e){var t=JSON.parse(n(e));return delete t._events,delete t._isProxy,n(t)};e.checkLocalChange=function(n,r){if(a&&!e.interval){var o=v(n);e.interval=t.setInterval(function(){var e=v(n);e!==o&&(o=e,p?p=!1:r())},300)}};var y=e.create=function(e,n,r){var s="function"===o(n)?h(n,r):n;switch(o(e)){case"object":Object.keys(e).forEach(function(t){i(e[t])&&!e[t]._isProxy&&(e[t]=y(e[t],n))});break;case"array":e.forEach(function(t,r){i(t)&&!t._isProxy&&(e[r]=y(e[r],n))});break;default:throw new Error("attempted to make a proxy of an unproxyable object")}if(!a)return e._isProxy?e:new t.Proxy(e,s);var c=JSON.parse(JSON.stringify(e));if(r){var u={cacheready:[],disconnect:[],reconnect:[],change:[],ready:[],remove:[],create:[],error:[]};c.on=f(u),c._events=u}return c},m=function(e,n,t,r,o){var a=e.slice(0);a.push(n),t._events.change.some(function(e){return!1===e.cb(r,o,a,t)})},g=e.find=function(e,n){for(var t=n.length,r=0;rs)for(var c,u=s;u<=s;u++)c=e[u],E(r,u,a,c,!0);e.length=s}};return e.update=function(e,n,t){var r=o(e),a=o(n);if(r!==a)throw new Error("Proxy updates can't result in type changes");switch(a){case"array":O.call(e,e,n,function(e){return y(e,t)},[],e);break;case"object":b.call(e,e,n,function(e){return y(e,t)},[],e);break;default:throw new Error("unsupported realtime datatype:"+a)}},e}();return o.create=function(o){if(!i.isProxyable(o.data,!0))throw new Error("unsupported datatype: "+i.type(o.data));if("function"!=typeof(r=o.ChainPad||t.ChainPad).SmartJSONTransformer)throw new Error("Please update ChainPad");o.classic&&!o.crypto&&(console.error("[chainpad-listmap] no crypto module provided. messages will not be encrypted"),o.crypto={encrypt:function(e){return e},decrypt:function(e){return e}});var s=o.readOnly,c={initialState:n(o.data),patchTransformer:r.SmartJSONTransformer,validateContent:o.validateContent||function(e){try{return JSON.parse(e),!0}catch(n){return console.log(e),console.error("Failed to parse, rejecting patch"),!1}},readOnly:o.readOnly,userName:o.userName||"listmap",Cache:o.Cache,logLevel:void 0===o.logLevel?0:o.logLevel};o.classic&&(c.channel=o.channel,c.crypto=o.crypto,c.network=o.network,c.websocketURL=o.websocketURL,c.metadata=o.metadata||{validateKey:o.validateKey,owners:o.owners,expire:o.expire},c.onRejected=o.onRejected);var u,f,l,d={metadata:{}},h=!0,p=!1,v=a?i.stringifyFakeProxy:n,y=function(){var e=v(f);try{u.contentUpdate(e)}catch(e){f._events.error.forEach(function(n){n.cb({type:"CHAINPAD",error:e.message})})}o.onLocal&&o.onLocal()},m=c.onLocal=function(e){h||s||(clearTimeout(l),e?y():l=setTimeout(y))},g=function(){i.remoteChangeFlag||m()};f=i.create(o.data,g,!0),c.onInit=function(e){f._events.create.forEach(function(n){n.cb(e)})},c.onCacheReady=function(e){u&&u===e.realtime||(u=d.realtime=e.realtime);var n=u.getUserDoc(),t=JSON.parse(n);i.update(f,t,g),i.checkLocalChange(f,m),p||f._events.cacheready.forEach(function(n){n.cb(e)})};var E=0;c.onReady=function(e){if(E=-1,p)return h=!1,c.onRemote(),void f._events.reconnect.forEach(function(n){n.cb(e)});u&&u===e.realtime||(u=d.realtime=e.realtime),d.metadata=e.metadata;var n=u.getUserDoc(),t=JSON.parse(n);i.update(f,t,g),i.checkLocalChange(f,m),h=!1,p=!0,f._events.ready.forEach(function(n){n.cb(e)})},c.onRemote=function(){if(!h){var e=u.getUserDoc(),n=JSON.parse(e);i.remoteChangeFlag=!0,i.update(f,n,g),i.remoteChangeFlag=!1}},c.onMessage=function(){-1!==E&&o.updateProgress&&o.updateProgress({progress:E++})},c.onAbort=function(e){f._events.disconnect.forEach(function(n){n.cb(e)})},c.onConnectionChange=function(e){e.state?h=!0:f._events.disconnect.forEach(function(n){n.cb(e)})},c.onMetadataUpdate=function(e){d.metadata=e,"function"==typeof o.onMetadataUpdate&&o.onMetadataUpdate(e)},c.onError=function(e){f._events.error.forEach(function(n){n.cb(e)})},c.onChannelError=function(e){f._events.error.forEach(function(n){n.cb(e)})},o.common&&"function"==typeof o.common.startRealtime?u=d.cpCnInner=o.common.startRealtime(c):d=e.start(c),d.proxy=f,d.realtime=u;var b=d.setReadOnly;return d.setReadOnly=function(e,n){s=e,b&&b(e,n)},d},o}(D(),_()))}(i)),i.exports}var S,N=T(),I={exports:{}};function x(){return S||(S=1,function(e){var n,r,o,a;a=function(){var e=f,n=function(t,r,o){r||(r=0);var a=n.resolve(t,r),i=n.m[r][a];if(!i&&e){if(i=e(a))return i}else if(i&&i.c&&(r=i.c,a=i.m,!(i=n.m[r][i.m])))throw new Error('failed to require "'+a+'" from '+r);if(!i)throw new Error('failed to require "'+t+'" from '+o);return i.exports||(i.exports={},i.call(i.exports,i,i.exports,n.relative(a,r))),i.exports};return n.resolve=function(e,t){var r=e,o=e+".js",a=e+"/index.js";return n.m[t][o]&&o?o:n.m[t][a]&&a?a:r},n.relative=function(e,t){return function(r){if("."!=r.charAt(0))return n(r,t,e);var o=e.split("/"),a=r.split("/");o.pop();for(var i=0;i=0;t--)o.check(e.operations[t],n),t>0&&r.assert(!o.shouldMerge(e.operations[t],e.operations[t-1])),"number"==typeof n&&(n+=o.lengthChange(e.operations[t]));return e.isCheckpoint&&(r.assert(1===e.operations.length),r.assert(0===e.operations[0].offset),"number"==typeof n&&r.assert(!n||e.operations[0].toRemove===n)),e};i.toObj=function(e){r.PARANOIA&&c(e);var n,t=new Array(e.operations.length+1);for(n=0;n0);var t,i=s(a.check(e[e.length-1]),n);for(t=0;t=0;t--)f(e,n.operations[t]);return e},i.apply=function(e,n){r.PARANOIA&&(c(e),r.assert("string"==typeof n),r.assert(a.hex_sha256(n)===e.parentHash));for(var t=n,i=e.operations.length-1;i>=0;i--)t=o.apply(e.operations[i],t);return t},i.lengthChange=function(e){r.PARANOIA&&c(e);for(var n=0,t=0;t=0;u--)i[u]=o.invert(e.operations[u],t),t=o.apply(e.operations[u],t);var f=new Array(e.operations.length);!function(){for(var e=i.length-1;e>=0;e--){f[e]=i[e].offset;for(var n=e-1;n>=0;n--)f[e]+=i[n].toRemove-i[n].toInsert.length}}();var l=s(a.hex_sha256(t),e.isCheckpoint);l.operations.splice(0,l.operations.length);for(var d=0;d=0;d--){var h=t(e.operations[d],u,o.simplify);h&&(u=o.apply(h,u),f[l++]=h)}return Array.prototype.push.apply(i.operations,f.reverse()),i.operations[0]||i.operations.shift(),r.PARANOIA&&c(i),i},i.equals=function(e,n){if(e.operations.length!==n.operations.length)return!1;for(var t=0;t0;){var u=o.random(i);i+=o.lengthChange(u),f(t,u)}return c(t),t},Object.freeze(e.exports)},"SHA256.js":function(e,n,t){!function(){function n(e,n){var t=(65535&e)+(65535&n);return(e>>16)+(n>>16)+(t>>16)<<16|65535&t}function t(e,n){return e>>>n|e<<32-n}function r(e,n){return e>>>n}function o(e,n,t){return e&n^~e&t}function a(e,n,t){return e&n^e&t^n&t}function i(e){return t(e,2)^t(e,13)^t(e,22)}function s(e){return t(e,6)^t(e,11)^t(e,25)}function c(e){return t(e,7)^t(e,18)^r(e,3)}function u(e){return t(e,17)^t(e,19)^r(e,10)}e.exports.hex_sha256=function(e){return function(e){for(var n="0123456789abcdef",t="",r=0;r<4*e.length;r++)t+=n.charAt(e[r>>2]>>8*(3-r%4)+4&15)+n.charAt(e[r>>2]>>8*(3-r%4)&15);return t}(function(e,t){var r,f,l,d,h,p,v,y,m,g,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],O=function(e){for(var n=[];e>0;e--)n.push(void 0);return n}(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var A=0;A>5]|=(255&e.charCodeAt(t/8))<<24-t%32;return n}(e),8*e.length))}}()},"Common.js":function(e,n,r){e.exports.global=function(){if("undefined"!=typeof self)return self;if(void 0!==t)return t;if("undefined"!=typeof window)return window;throw new Error("no self, nor global, nor window")}();var o=function(n){return"undefined"!=typeof localStorage&&localStorage[n]?localStorage[n]:e.exports.global[n]},a=e.exports.PARANOIA=o("ChainPad_PARANOIA");e.exports.VALIDATE_ENTIRE_CHAIN_EACH_MSG=o("ChainPad_VALIDATE_ENTIRE_CHAIN_EACH_MSG"),e.exports.TESTING=o("ChainPad_TESTING"),e.exports.assert=function(e){if(!e)throw new Error("Failed assertion")},e.exports.isUint=function(e){return"number"==typeof e&&Math.floor(e)===e&&e>=0},e.exports.randomASCII=function(e){for(var n=[],t=0;tn?1:-1},Object.freeze(e.exports)},"sha256.js":function(e,n,t){var r=t("./sha256/exports.js"),o=t("./SHA256.js"),a=t("./Common");e.exports.check=function(e){if("string"!=typeof e)throw new Error;if(!/[a-f0-9]{64}/.test(e))throw new Error;return e},e.exports.hex_sha256=function(e){e+="";var n=r.hex(function(e){for(var n=new Uint8Array(e.length),t=0;t1&&console.log("["+e.userName+"] "+n)},d=function(e,n){e.logLevel>0&&console.error("["+e.userName+"] "+n)},h=function(e,n,t){if(!e.aborted){t||(t=Math.floor(2*Math.random()*e.config.avgSyncMilliseconds));var r=setTimeout(function(){e.schedules.splice(e.schedules.indexOf(r),1),n()},t);return e.schedules.push(r),r}},p=function(e,n){var t=e.schedules.indexOf(n);t>-1&&e.schedules.splice(t,1),clearTimeout(n)},v=function(e,n,t,o){var a=i.toStr(n);if(function(e,n,t){e.messageHandlers.length||t("no onMessage() handler registered");try{e.messageHandlers.forEach(function(e){e(n,function(){t.apply(null,arguments),t=function(){}})})}catch(e){t(e.stack)}}(e,a,function(t){if(t)l(e,"Posting to server failed ["+t+"]"),e.pending=null,e.syncSchedule=h(e,function(){g(e)});else{var o=e.pending;if(e.pending=null,!o)throw new Error;r.assert(o.hash===n.hashOf),R(e,a,!0)?(e.timeOfLastSuccess=+new Date,e.lag=+new Date-o.timeSent):l(e,"Our message ["+n.hashOf+"] failed validation"),o.callback()}}),e.pending)throw new Error("there is already a pending message");-1===e.timeOfLastSuccess&&(e.timeOfLastSuccess=+new Date),e.pending={hash:n.hashOf,timeSent:+new Date,callback:function(){e.syncSchedule=h(e,function(){g(e)},0),t()}},r.PARANOIA&&A(e)},y=function(e){var n=e.onSettle;e.onSettle=[],n.forEach(function(n){try{n()}catch(n){d(e,"Error in onSettle handler ["+n.stack+"]")}})},m=function(e){if(!e.mut.inverseOf)throw new Error;return e.mut.inverseOf},g=function(e,n){if(r.PARANOIA&&A(e),e.syncSchedule&&!e.pending){if(p(e,e.syncSchedule),e.syncSchedule=null,e.uncommitted=a.simplify(e.uncommitted,e.authDoc,e.config.operationSimplify),0===e.uncommitted.operations.length)return y(e),e.timeOfLastSuccess=+new Date,void(e.syncSchedule=h(e,function(){g(e)}));var t=_(e,e.best)+1;if(t%e.config.checkpointInterval!==0){var o;o=e.setContentPatch?e.setContentPatch:i.create(i.PATCH,e.uncommitted,e.best.hashOf),v(e,o,function(){e.setContentPatch&&(l(e,"initial Ack received ["+o.hashOf+"]"),e.setContentPatch=null)})}else{var s=e.best;if(l(e,"Sending checkpoint (interval ["+e.config.checkpointInterval+"]) patch no ["+t+"]"),l(e,_(e,e.best)),!s||!s.content||!m(s.content))throw new Error;var c=a.createCheckpoint(e.authDoc,e.authDoc,m(s.content).parentHash),u=i.create(i.CHECKPOINT,c,s.hashOf);v(e,u,function(){l(e,"Checkpoint sent and accepted")})}}},E=function(e,n){r.assert(n.lastMsgHash),r.assert(n.hashOf),e.messages[n.hashOf]=n,(e.messagesByParent[n.lastMsgHash]=e.messagesByParent[n.lastMsgHash]||[]).push(n)},b=function(e,n){r.assert(n.lastMsgHash),r.assert(n.hashOf),delete e.messages[n.hashOf];var t=e.messagesByParent[n.lastMsgHash];r.assert(t.indexOf(n)>-1),t.splice(t.indexOf(n),1),0===t.length&&delete e.messagesByParent[n.lastMsgHash];var o=e.messagesByParent[n.hashOf];if(o)for(var a=0;a_(e,t)&&(t=o)}),t},N=function(e,n){n.operations.length&&(e.patchHandlers.forEach(function(e){e(n)}),e.changeHandlers.forEach(function(e){n.operations.forEach(function(n){e(n.offset,n.toRemove,n.toInsert)})}))},I=function(e,n){try{return e.config.validateContent(n())}catch(n){d(e,"Error in content validator ["+n.stack+"]")}return!1},x=function(e,n,t){for(var r=O(e,n);r;r=O(e,r))if(!1===t(r))return},C=function(e,n){e.mut.inverseOf||((e.mut.inverseOf=a.invert(e,n)).mut.inverseOf=e)},R=function(e,n,t){r.PARANOIA&&A(e);var c=i.fromString(n);if(l(e,JSON.stringify([c.hashOf,c.content.operations])),e.messages[c.hashOf]){if(e.setContentPatch&&e.setContentPatch.hashOf===c.hashOf)e.setContentPatch=null;else{if(c.content.isCheckpoint)return l(e,"["+(t?"our":"their")+"] Checkpoint ["+c.hashOf+"] is already known"),!0;l(e,"Patch ["+c.hashOf+"] is already known")}r.PARANOIA&&A(e)}else if(!c.content.isCheckpoint||I(e,function(){return c.content.operations[0].toInsert})){if(E(e,c),!D(e,e.rootMessage,c)){if(c.content.isCheckpoint&&e.best.mut.isInitialMessage){l(e,"applying checkpoint ["+c.hashOf+"]");var u=a.apply(e.uncommitted,e.authDoc);r.assert(!r.PARANOIA||e.userInterfaceContent===u);var f=a.invert(e.uncommitted,e.authDoc);return a.addOperation(f,o.create(0,e.authDoc.length,c.content.operations[0].toInsert)),f=a.simplify(f,u,e.config.operationSimplify),c.mut.parentCount=0,e.rootMessage=e.best=c,e.authDoc=c.content.operations[0].toInsert,e.uncommitted=a.create(s.hex_sha256(e.authDoc)),N(e,f),r.PARANOIA&&(e.userInterfaceContent=e.authDoc),!0}return l(e,"Patch ["+c.hashOf+"] not connected to root (parent: ["+c.lastMsgHash+"])"),void(r.PARANOIA&&A(e))}(c=S(e,c)).mut.isFromMe=t;var d=c.content,h=[],p=e.best;if(!D(e,e.best,c)){var v=_(e,e.best),g=_(e,c);if(!(v0))return l(e,"Patch ["+c.hashOf+"] chain is ["+g+"] best chain is ["+v+"]"),r.PARANOIA&&A(e),!0;for(;p&&!D(e,p,c);)h.push(p),p=O(e,p);r.assert(p),l(e,"Patch ["+c.hashOf+"] better than best chain, switching")}var R=[],P=c;do{R.unshift(P),P=O(e,P),r.assert(P)}while(P!==p);var k=e.authDoc;h.forEach(function(e){k=a.apply(m(e.content),k)}),R.forEach(function(e,n){n!==R.length-1&&(C(e.content,k),k=a.apply(e.content,k))});var M=e.best;if(R.length>1?(M=R[R.length-2],r.assert(M)):h.length&&(M=O(e,h[h.length-1]),r.assert(M)),r.assert(m(M.content).parentHash),r.assert(!r.PARANOIA||m(M.content).parentHash===s.hex_sha256(k)),m(M.content).parentHash===d.parentHash){if(d.isCheckpoint&&e.config.noPrune);else if(d.isCheckpoint){var F;if(x(e,c,function(e){if(e.content.isCheckpoint){if(F)return F=e,!1;F=e}}),F&&F!==e.rootMessage){var L=_(e,F);if(e.config.strictCheckpointValidation&&L%e.config.checkpointInterval!==0){if(l(e,"checkpoint ["+c.hashOf+"] at invalid point ["+L+"]"),r.PARANOIA&&A(e),r.TESTING)throw new Error;return void b(e,c)}l(e,"checkpoint ["+c.hashOf+"]"),x(e,F,function(n){l(e,"pruning ["+n.hashOf+"]"),b(e,n)}),e.rootMessage=F}}else{var H=a.simplify(d,k,e.config.operationSimplify);if(!a.equals(H,d)){if(l(e,"patch ["+c.hashOf+"] can be simplified"),r.PARANOIA&&A(e),r.TESTING)throw new Error;return void b(e,c)}if(!I(e,function(){return a.apply(d,k)}))return void l(e,"Patch ["+c.hashOf+"] failed content validation")}C(d,k),e.uncommitted=a.simplify(e.uncommitted,e.authDoc,e.config.operationSimplify);var j=a.apply(e.uncommitted,e.authDoc);r.PARANOIA&&r.assert(j===e.userInterfaceContent);var K=a.invert(e.uncommitted,e.authDoc);if(h.forEach(function(n){l(e,"reverting ["+n.hashOf+"]"),n.mut.isFromMe&&l(e,"reverting patch 'from me' ["+JSON.stringify(n.content.operations)+"]"),K=a.merge(K,m(n.content)),function(e,n,t){T(e,n,m(t))}(e,n.mut.isFromMe,n.content)}),R.forEach(function(n){l(e,"applying ["+n.hashOf+"]"),K=a.merge(K,n.content),T(e,n.mut.isFromMe,n.content)}),K=a.merge(K,e.uncommitted),K=a.simplify(K,j,e.config.operationSimplify),e.best=c,r.PARANOIA){var U=a.apply(K,j);r.assert(e.userInterfaceContent.length===w(e)),r.assert(U===e.userInterfaceContent)}return N(e,K),e.uncommitted.operations.length||y(e),r.PARANOIA&&A(e),!0}if(l(e,"patch ["+c.hashOf+"] parentHash is not valid"),r.PARANOIA&&A(e),r.TESTING)throw new Error;b(e,c)}else l(e,"Checkpoint ["+c.hashOf+"] failed content validation")},P=function(e,n){return Object.freeze({type:"Block",hashOf:n.hashOf,lastMsgHash:n.lastMsgHash,isCheckpoint:!!n.content.isCheckpoint,isFromMe:n.mut&&n.mut.isFromMe,author:n.mut&&n.mut.author,serverHash:n.mut&&n.mut.serverHash,time:n.mut&&n.mut.time,getParent:function(){var t=O(e,n);if(t)return P(e,t)},getContent:function(){return function(e,n){for(var t=[n];t[0]!==e.rootMessage;){var o=O(e,t[0]);if(!o)return{error:"not connected to root",doc:void 0};t.unshift(o)}var i="";e.rootMessage.content.operations.length&&(r.assert(1===e.rootMessage.content.operations.length),i=e.rootMessage.content.operations[0].toInsert);for(var s=1;s=0;t--)n=s(e[t],n);return n};var c=o.invert=function(e,n){return r.PARANOIA&&(a(e),r.assert("string"==typeof n),r.assert(e.offset+e.toRemove<=n.length)),i(e.offset,e.toInsert.length,(" "+n.substring(e.offset,e.offset+e.toRemove)).slice(1))},u=/[\uD800-\uDBFF]|[\uDC00-\uDFFF]/,f=o.hasSurrogate=function(e){return u.test(e)};o.simplify=function(e,n){r.PARANOIA&&(a(e),r.assert("string"==typeof n),r.assert(e.offset+e.toRemove<=n.length));for(var t=c(e,n),o=Math.min(e.toInsert.length,t.toInsert.length),s=0;s=0&&h[s]===d[s];s--);d=d.substring(0,s+1),l=s+1}return 0===l&&0===d.length?null:i(u,l,d)},o.equals=function(e,n){return e.toRemove===n.toRemove&&e.toInsert===n.toInsert&&e.offset===n.offset},o.lengthChange=function(e){return r.PARANOIA&&a(e),e.toInsert.length-e.toRemove},o.merge=function(e,n){r.PARANOIA&&(a(n),a(e));var t=e.offset,o=e.toRemove,s=e.toInsert,c=n.offset,u=n.toRemove,f=n.toInsert,l=c-t;if(u>0){var d=s;s=s.substring(0,l)+s.substring(l+u),(u-=d.length-s.length)<0&&(u=0),o+=u,u=0}if(l<0)t+=l,s=f+s;else if(s.length===l)s+=f;else{if(!(s.length>l))throw new Error("should never happen\n"+JSON.stringify([e,n],null," "));s=s.substring(0,l)+f+s.substring(l)}return""===s&&0===o?null:i(t,o,s)},o.shouldMerge=function(e,n){return r.PARANOIA&&(a(e),a(n)),n.offset0;)a+=c=r._heap_write(t,o+a,e,i,s),i+=c,s-=c,o+=c=n.process(o,a),(a-=c)||(o=0);return this.pos=o,this.len=a,this},e.exports.hash_finish=function(){if(null!==this.result)throw new IllegalStateError("state must be reset before processing new data");return this.asm.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(this.heap.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this}},"sha256/utils.js":function(e,n,t){var r=e.exports.string_to_bytes=function(e,n){n=!!n;for(var t=e.length,r=new Uint8Array(n?4*t:t),o=0,a=0;o=t)throw new Error("Malformed string, low surrogate expected at position "+o);i=(55296^i)<<10|65536|56320^e.charCodeAt(o)}else if(!n&&i>>>8)throw new Error("Wide characters are not allowed.");!n||i<=127?r[a++]=i:i<=2047?(r[a++]=192|i>>6,r[a++]=128|63&i):i<=65535?(r[a++]=224|i>>12,r[a++]=128|i>>6&63,r[a++]=128|63&i):(r[a++]=240|i>>18,r[a++]=128|i>>12&63,r[a++]=128|i>>6&63,r[a++]=128|63&i)}return r.subarray(0,a)};e.exports.hex_to_bytes=function(e){var n=e.length;1&n&&(e="0"+e,n++);for(var t=new Uint8Array(n>>1),r=0;r>1]=parseInt(e.substr(r,2),16);return t},e.exports.base64_to_bytes=function(e){return r(atob(e))};var o=e.exports.bytes_to_string=function(e,n){n=!!n;for(var t=e.length,r=new Array(t),o=0,a=0;o=192&&i<224&&o+1=224&&i<240&&o+2=240&&i<248&&o+3>10,r[a++]=56320|1023&s)}}for(var c="",u=16384,f=0;f>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+=1},e.exports.is_number=function(e){return"number"==typeof e},e.exports.is_string=function(e){return"string"==typeof e},e.exports.is_buffer=function(e){return e instanceof ArrayBuffer},e.exports.is_bytes=function(e){return e instanceof Uint8Array},e.exports.is_typed_array=function(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array},e.exports._heap_init=function(e,n){var t=n.heap,r=t?t.byteLength:n.heapSize||65536;if(4095&r||r<=0)throw new Error("heap size must be a positive integer and a multiple of 4096");return t=t||new e(new ArrayBuffer(r))},e.exports._heap_write=function(e,n,t,r,o){var a=e.length-n,i=a>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x428a2f98|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=n+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x71374491|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=t+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xb5c0fbcf|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=l+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xe9b5dba5|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=d+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x3956c25b|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=h+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x59f111f1|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=p+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x923f82a4|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=v+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xab1c5ed5|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=y+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xd807aa98|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=m+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x12835b01|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=g+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x243185be|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=E+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x550c7dc3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=b+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x72be5d74|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=O+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x80deb1fe|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=A+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x9bdc06a7|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;R=w+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc19bf174|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;e=R=(n>>>7^n>>>18^n>>>3^n<<25^n<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+e+m|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xe49b69c1|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;n=R=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+n+g|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xefbe4786|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;t=R=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+t+E|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x0fc19dc6|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;l=R=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(n>>>17^n>>>19^n>>>10^n<<15^n<<13)+l+b|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x240ca1cc|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;d=R=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+O|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x2de92c6f|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;h=R=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+h+A|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x4a7484aa|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;p=R=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+p+w|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x5cb0a9dc|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;v=R=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+v+e|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x76f988da|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;y=R=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+n|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x983e5152|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;m=R=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+m+t|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xa831c66d|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;g=R=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+g+l|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xb00327c8|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;E=R=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+E+d|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xbf597fc7|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;b=R=(O>>>7^O>>>18^O>>>3^O<<25^O<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+b+h|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc6e00bf3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;O=R=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+O+p|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xd5a79147|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;A=R=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+A+v|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x06ca6351|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;w=R=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(O>>>17^O>>>19^O>>>10^O<<15^O<<13)+w+y|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x14292967|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;e=R=(n>>>7^n>>>18^n>>>3^n<<25^n<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+e+m|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x27b70a85|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;n=R=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+n+g|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x2e1b2138|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;t=R=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+t+E|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x4d2c6dfc|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;l=R=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(n>>>17^n>>>19^n>>>10^n<<15^n<<13)+l+b|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x53380d13|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;d=R=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+O|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x650a7354|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;h=R=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+h+A|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x766a0abb|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;p=R=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+p+w|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x81c2c92e|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;v=R=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+v+e|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x92722c85|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;y=R=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+n|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xa2bfe8a1|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;m=R=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+m+t|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xa81a664b|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;g=R=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+g+l|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc24b8b70|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;E=R=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+E+d|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc76c51a3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;b=R=(O>>>7^O>>>18^O>>>3^O<<25^O<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+b+h|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xd192e819|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;O=R=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+O+p|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xd6990624|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;A=R=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+A+v|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xf40e3585|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;w=R=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(O>>>17^O>>>19^O>>>10^O<<15^O<<13)+w+y|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x106aa070|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;e=R=(n>>>7^n>>>18^n>>>3^n<<25^n<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+e+m|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x19a4c116|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;n=R=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+n+g|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x1e376c08|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;t=R=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+t+E|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x2748774c|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;l=R=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(n>>>17^n>>>19^n>>>10^n<<15^n<<13)+l+b|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x34b0bcb5|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;d=R=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+O|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x391c0cb3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;h=R=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+h+A|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x4ed8aa4a|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;p=R=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+p+w|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x5b9cca4f|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;v=R=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+v+e|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x682e6ff3|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;y=R=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+y+n|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x748f82ee|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;m=R=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+m+t|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x78a5636f|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;g=R=(E>>>7^E>>>18^E>>>3^E<<25^E<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+g+l|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x84c87814|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;E=R=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+E+d|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x8cc70208|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;b=R=(O>>>7^O>>>18^O>>>3^O<<25^O<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+b+h|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0x90befffa|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;O=R=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(E>>>17^E>>>19^E>>>10^E<<15^E<<13)+O+p|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xa4506ceb|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;A=R=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+A+v|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xbef9a3f7|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;w=R=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(O>>>17^O>>>19^O>>>10^O<<15^O<<13)+w+y|0;R=R+C+(N>>>6^N>>>11^N>>>25^N<<26^N<<21^N<<7)+(x^N&(I^x))+0xc67178f2|0;C=x;x=I;I=N;N=S+R|0;S=T;T=_;_=D;D=R+(_&T^S&(_^T))+(_>>>2^_>>>13^_>>>22^_<<30^_<<19^_<<10)|0;r=r+D|0;o=o+_|0;a=a+T|0;i=i+S|0;s=s+N|0;c=c+I|0;u=u+x|0;f=f+C|0}function C(e){e=e|0;x(I[e|0]<<24|I[e|1]<<16|I[e|2]<<8|I[e|3],I[e|4]<<24|I[e|5]<<16|I[e|6]<<8|I[e|7],I[e|8]<<24|I[e|9]<<16|I[e|10]<<8|I[e|11],I[e|12]<<24|I[e|13]<<16|I[e|14]<<8|I[e|15],I[e|16]<<24|I[e|17]<<16|I[e|18]<<8|I[e|19],I[e|20]<<24|I[e|21]<<16|I[e|22]<<8|I[e|23],I[e|24]<<24|I[e|25]<<16|I[e|26]<<8|I[e|27],I[e|28]<<24|I[e|29]<<16|I[e|30]<<8|I[e|31],I[e|32]<<24|I[e|33]<<16|I[e|34]<<8|I[e|35],I[e|36]<<24|I[e|37]<<16|I[e|38]<<8|I[e|39],I[e|40]<<24|I[e|41]<<16|I[e|42]<<8|I[e|43],I[e|44]<<24|I[e|45]<<16|I[e|46]<<8|I[e|47],I[e|48]<<24|I[e|49]<<16|I[e|50]<<8|I[e|51],I[e|52]<<24|I[e|53]<<16|I[e|54]<<8|I[e|55],I[e|56]<<24|I[e|57]<<16|I[e|58]<<8|I[e|59],I[e|60]<<24|I[e|61]<<16|I[e|62]<<8|I[e|63])}function R(e){e=e|0;I[e|0]=r>>>24;I[e|1]=r>>>16&255;I[e|2]=r>>>8&255;I[e|3]=r&255;I[e|4]=o>>>24;I[e|5]=o>>>16&255;I[e|6]=o>>>8&255;I[e|7]=o&255;I[e|8]=a>>>24;I[e|9]=a>>>16&255;I[e|10]=a>>>8&255;I[e|11]=a&255;I[e|12]=i>>>24;I[e|13]=i>>>16&255;I[e|14]=i>>>8&255;I[e|15]=i&255;I[e|16]=s>>>24;I[e|17]=s>>>16&255;I[e|18]=s>>>8&255;I[e|19]=s&255;I[e|20]=c>>>24;I[e|21]=c>>>16&255;I[e|22]=c>>>8&255;I[e|23]=c&255;I[e|24]=u>>>24;I[e|25]=u>>>16&255;I[e|26]=u>>>8&255;I[e|27]=u&255;I[e|28]=f>>>24;I[e|29]=f>>>16&255;I[e|30]=f>>>8&255;I[e|31]=f&255}function P(){r=0x6a09e667;o=0xbb67ae85;a=0x3c6ef372;i=0xa54ff53a;s=0x510e527f;c=0x9b05688c;u=0x1f83d9ab;f=0x5be0cd19;l=d=0}function k(e,n,t,h,p,v,y,m,g,E){e=e|0;n=n|0;t=t|0;h=h|0;p=p|0;v=v|0;y=y|0;m=m|0;g=g|0;E=E|0;r=e;o=n;a=t;i=h;s=p;c=v;u=y;f=m;l=g;d=E}function M(e,n){e=e|0;n=n|0;var t=0;if(e&63)return-1;while((n|0)>=64){C(e);e=e+64|0;n=n-64|0;t=t+64|0}l=l+t|0;if(l>>>0>>0)d=d+1|0;return t|0}function F(e,n,t){e=e|0;n=n|0;t=t|0;var r=0,o=0;if(e&63)return-1;if(~t)if(t&31)return-1;if((n|0)>=64){r=M(e,n)|0;if((r|0)==-1)return-1;e=e+r|0;n=n-r|0}r=r+n|0;l=l+n|0;if(l>>>0>>0)d=d+1|0;I[e|n]=0x80;if((n|0)>=56){for(o=n+1|0;(o|0)<64;o=o+1|0)I[e|o]=0x00;C(e);n=0;I[e|0]=0}for(o=n+1|0;(o|0)<59;o=o+1|0)I[e|o]=0;I[e|56]=d>>>21&255;I[e|57]=d>>>13&255;I[e|58]=d>>>5&255;I[e|59]=d<<3&255|l>>>29;I[e|60]=l>>>21&255;I[e|61]=l>>>13&255;I[e|62]=l>>>5&255;I[e|63]=l<<3&255;C(e);if(~t)R(t);return r|0}function L(){r=h;o=p;a=v;i=y;s=m;c=g;u=E;f=b;l=64;d=0}function H(){r=O;o=A;a=w;i=D;s=_;c=T;u=S;f=N;l=64;d=0}function j(e,n,t,I,C,R,k,M,F,L,H,j,K,U,B,V){e=e|0;n=n|0;t=t|0;I=I|0;C=C|0;R=R|0;k=k|0;M=M|0;F=F|0;L=L|0;H=H|0;j=j|0;K=K|0;U=U|0;B=B|0;V=V|0;P();x(e^0x5c5c5c5c,n^0x5c5c5c5c,t^0x5c5c5c5c,I^0x5c5c5c5c,C^0x5c5c5c5c,R^0x5c5c5c5c,k^0x5c5c5c5c,M^0x5c5c5c5c,F^0x5c5c5c5c,L^0x5c5c5c5c,H^0x5c5c5c5c,j^0x5c5c5c5c,K^0x5c5c5c5c,U^0x5c5c5c5c,B^0x5c5c5c5c,V^0x5c5c5c5c);O=r;A=o;w=a;D=i;_=s;T=c;S=u;N=f;P();x(e^0x36363636,n^0x36363636,t^0x36363636,I^0x36363636,C^0x36363636,R^0x36363636,k^0x36363636,M^0x36363636,F^0x36363636,L^0x36363636,H^0x36363636,j^0x36363636,K^0x36363636,U^0x36363636,B^0x36363636,V^0x36363636);h=r;p=o;v=a;y=i;m=s;g=c;E=u;b=f;l=64;d=0}function K(e,n,t){e=e|0;n=n|0;t=t|0;var l=0,d=0,h=0,p=0,v=0,y=0,m=0,g=0,E=0;if(e&63)return-1;if(~t)if(t&31)return-1;E=F(e,n,-1)|0;l=r,d=o,h=a,p=i,v=s,y=c,m=u,g=f;H();x(l,d,h,p,v,y,m,g,0x80000000,0,0,0,0,0,0,768);if(~t)R(t);return E|0}function U(e,n,t,l,d){e=e|0;n=n|0;t=t|0;l=l|0;d=d|0;var h=0,p=0,v=0,y=0,m=0,g=0,E=0,b=0,O=0,A=0,w=0,D=0,_=0,T=0,S=0,N=0;if(e&63)return-1;if(~d)if(d&31)return-1;I[e+n|0]=t>>>24;I[e+n+1|0]=t>>>16&255;I[e+n+2|0]=t>>>8&255;I[e+n+3|0]=t&255;K(e,n+4|0,-1)|0;h=O=r,p=A=o,v=w=a,y=D=i,m=_=s,g=T=c,E=S=u,b=N=f;l=l-1|0;while((l|0)>0){L();x(O,A,w,D,_,T,S,N,0x80000000,0,0,0,0,0,0,768);O=r,A=o,w=a,D=i,_=s,T=c,S=u,N=f;H();x(O,A,w,D,_,T,S,N,0x80000000,0,0,0,0,0,0,768);O=r,A=o,w=a,D=i,_=s,T=c,S=u,N=f;h=h^r;p=p^o;v=v^a;y=y^i;m=m^s;g=g^c;E=E^u;b=b^f;l=l-1|0}r=h;o=p;a=v;i=y;s=m;c=g;u=E;f=b;if(~d)R(d);return 0}return{reset:P,init:k,process:M,finish:F,hmac_reset:L,hmac_init:j,hmac_finish:K,pbkdf2_generate_block:U}}},"transform/TextTransformer.js":function(e,n,t){var r=t("../Operation"),o=t("../Common"),a=function(e,n){o.PARANOIA&&(r.check(e),r.check(n));var t=function(e,n){if(e.offset>n.offset){if(e.offset>n.offset+n.toRemove)return r.create(e.offset-n.toRemove+n.toInsert.length,e.toRemove,e.toInsert);var t=e.toRemove-(n.offset+n.toRemove-e.offset);return t<0&&(t=0),0===t&&0===e.toInsert.length?null:r.create(n.offset+n.toInsert.length,t,e.toInsert)}if(e.offset+e.toRemove=0;i--)s=r.apply(n[i],s);var c=[];for(i=e.length-1;i>=0;i--){for(var u=e[i],f=n.length-1;f>=0;f--){try{u=a(u,n[f])}catch(e){return console.error("The pluggable transform function threw an error, failing operational transformation"),console.error(e.stack),[]}if(!u)break}u&&(o.PARANOIA&&r.check(u,s.length),c.unshift(u))}return c}},"transform/NaiveJSONTransformer.js":function(e,n,t){var r=t("./TextTransformer"),o=t("../Operation"),a=t("../Common");e.exports=function(e,n,t){var i,s,c,u=a.global.REALTIME_DEBUG=a.global.REALTIME_DEBUG||{};try{i=r(e,n,t),s=o.applyMulti(n,t),c=o.applyMulti(i,s);try{return JSON.parse(c),i}catch(r){console.error(r),u.ot_parseError={type:"resultParseError",resultOps:i,toTransform:e,transformBy:n,text1:t,text2:s,text3:c,error:r},console.log("Debugging info available at `window.REALTIME_DEBUG.ot_parseError`")}}catch(r){console.error(r),u.ot_applyError={type:"resultParseError",resultOps:i,toTransform:e,transformBy:n,text1:t,text2:s,text3:c,error:r},console.log("Debugging info available at `window.REALTIME_DEBUG.ot_applyError`")}return[]}},"transform/SmartJSONTransformer.js":function(e,n,t){var r,o,a,i=t("json.sortify"),s=t("../Diff"),c=t("../Operation"),u=t("./TextTransformer"),f=function(e){return null===e?"null":(n=e,"[object Array]"===Object.prototype.toString.call(n)?"array":typeof e);var n},l=function(e,n){for(var t=n.length,r=0;r1)return!0})&&("splice"!==n.type||!e.some(function(e){if("splice"===e.type&&y(e.path,n.path)&&e.path.length-n.path.length<0){if(!e.removals)return;for(var t=e.offset,r=e.offset+e.removals;te.offset+n.removals)return void(n.offset+=e.value.length-e.removals);if(n.offseti)){var d=n.slice(0,l);if((y=n.slice(l))===u){var p=Math.min(s,l);if((g=c.slice(0,p))===(b=d.slice(0,p)))return h(g,c.slice(p),d.slice(p),u)}}if(null===f||f===s){var v=s,y=(d=n.slice(0,v),n.slice(v));if(d===c){var m=Math.min(a-v,i-v);if((E=u.slice(u.length-m))===(O=y.slice(y.length-m)))return h(c,u.slice(0,u.length-m),y.slice(0,y.length-m),E)}}}if(r.length>0&&o&&0===o.length){var g=e.slice(0,r.index),E=e.slice(r.index+r.length);if(!(i<(p=g.length)+(m=E.length))){var b=n.slice(0,p),O=n.slice(i-m);if(g===b&&E===O)return h(g,e.slice(p,a-m),n.slice(p,i-m),E)}}return null}(e,n,t);if(f)return f}var l=i(e,n),d=e.substring(0,l);l=s(e=e.substring(l),n=n.substring(l));var p=e.substring(e.length-l),v=function(e,n){var t;if(!e)return[[1,n]];if(!n)return[[r,e]];var c=e.length>n.length?e:n,u=e.length>n.length?n:e,f=c.indexOf(u);if(-1!==f)return t=[[1,c.substring(0,f)],[0,u],[1,c.substring(f+u.length)]],e.length>n.length&&(t[0][0]=t[2][0]=r),t;if(1===u.length)return[[r,e],[1,n]];var l=function(e,n){var t=e.length>n.length?e:n,r=e.length>n.length?n:e;if(t.length<4||2*r.length=e.length?[r,o,a,c,l]:null}var a,c,u,f,l,d=o(t,r,Math.ceil(t.length/4)),h=o(t,r,Math.ceil(t.length/2));if(!d&&!h)return null;a=h?d&&d[4].length>h[4].length?d:h:d,e.length>n.length?(c=a[0],u=a[1],f=a[2],l=a[3]):(f=a[0],l=a[1],c=a[2],u=a[3]);var p=a[4];return[c,u,f,l,p]}(e,n);if(l){var d=l[0],h=l[1],p=l[2],v=l[3],y=l[4],m=o(d,p),g=o(h,v);return m.concat([[0,y]],g)}return function(e,n){for(var t=e.length,o=n.length,i=Math.ceil((t+o)/2),s=i,c=2*i,u=new Array(c),f=new Array(c),l=0;lt)v+=2;else if(O>o)p+=2;else if(h&&(D=s+d-E)>=0&&D=(w=t-f[D]))return a(e,n,T,O)}for(var A=-g+y;A<=g-m;A+=2){for(var w,D=s+A,_=(w=A===-g||A!==g&&f[D-1]t)m+=2;else if(_>o)y+=2;else if(!h){var T;if((b=s+d-A)>=0&&b=(w=t-w))return a(e,n,T,O)}}}return[[r,e],[1,n]]}(e,n)}(e=e.substring(0,e.length-l),n=n.substring(0,n.length-l));return d&&v.unshift([0,d]),p&&v.push([0,p]),c(v,u),v}function a(e,n,t,r){var a=e.substring(0,t),i=n.substring(0,r),s=e.substring(t),c=n.substring(r),u=o(a,i),f=o(s,c);return u.concat(f)}function i(e,n){if(!e||!n||e.charAt(0)!==n.charAt(0))return 0;for(var t=0,r=Math.min(e.length,n.length),o=r,a=0;t=0&&d(e[p][1])){var v=e[p][1].slice(-1);if(e[p][1]=e[p][1].slice(0,-1),f=v+f,h=v+h,!e[p][1]){e.splice(p,1),o--;var y=p-1;e[y]&&1===e[y][0]&&(u++,h=e[y][1]+h,y--),e[y]&&e[y][0]===r&&(a++,f=e[y][1]+f,y--),p=y}}l(e[o][1])&&(v=e[o][1].charAt(0),e[o][1]=e[o][1].slice(1),f+=v,h+=v)}if(o0||h.length>0){f.length>0&&h.length>0&&(0!==(t=i(h,f))&&(p>=0?e[p][1]+=h.substring(0,t):(e.splice(0,0,[0,h.substring(0,t)]),o++),h=h.substring(t),f=f.substring(t)),0!==(t=s(h,f))&&(e[o][1]=h.substring(h.length-t)+e[o][1],h=h.substring(0,h.length-t),f=f.substring(0,f.length-t)));var m=u+a;0===f.length&&0===h.length?(e.splice(o-m,m),o-=m):0===f.length?(e.splice(o-m,m,[1,h]),o=o-m+1):0===h.length?(e.splice(o-m,m,[r,f]),o=o-m+1):(e.splice(o-m,m,[r,f],[1,h]),o=o-m+2)}0!==o&&0===e[o-1][0]?(e[o-1][1]+=e[o][1],e.splice(o,1)):o++,u=0,a=0,f="",h=""}""===e[e.length-1][1]&&e.pop();var g=!1;for(o=1;o=55296&&e<=56319}function f(e){return e>=56320&&e<=57343}function l(e){return f(e.charCodeAt(0))}function d(e){return u(e.charCodeAt(e.length-1))}function h(e,n,t,o){return d(e)||l(o)?null:function(e){for(var n=[],t=0;t0&&n.push(e[t]);return n}([[0,e],[r,n],[1,t],[0,o]])}function p(e,n,t){return o(e,n,t,!0)}p.INSERT=1,p.DELETE=r,p.EQUAL=0,e.exports=p}},n=a("ChainPad.js"),r="ChainPad",e.exports=n,"undefined"!=typeof window?o=window:void 0!==t?o=t:"undefined"!=typeof self&&(o=self),o[r]=n}(I)),I.exports}var C,R=x(),P=n({__proto__:null,default:r(R)},[R]),k={exports:{}};function M(){return C||(C=1,function(e){var n;n=function(e,n){var t={Nacl:e},r=n.encodeBase64,o=e=>{let t;return(t=e.length%4)&&(e+="=".repeat(4-t)),n.decodeBase64(e)},a=n.decodeUTF8,i=n.encodeUTF8,s=function(e){for(var n="",t=0;t{var n={setCustomize:n=>{e=n.ApiConfig},getWebsocketURL:function(n){var t=e.websocketPath||"/cryptpad_websocket";if(/^ws{1,2}:\/\//.test(t))return t;var r=new URL(n||globalThis?.location?.href||e.httpUnsafeOrigin);return n&&(r.href=n),r.protocol.replace(/http/,"ws")+"//"+r.host+t}};return n})())}(H)),H.exports}var K,U=j(),B=n({__proto__:null,default:r(U)},[U]),V={exports:{}};function Y(){return K||(K=1,function(e){e.exports&&(e.exports=function(e={}){return{setCustomize:n=>{e=n.AppConfig},userHashKey:"User_hash",userNameKey:"User_name",blockHashKey:"Block_hash",fileHashKey:"FS_hash",sessionJWT:"Session_JWT",ssoSeed:"SSO_seed",displayNameKey:"cryptpad.username",oldStorageKey:"CryptPad_RECENTPADS",storageKey:"filesData",tokenKey:"loginToken",prefersDriveRedirectKey:"prefersDriveRedirect",isPremiumKey:"isPremiumUser",displayPadCreationScreen:"displayPadCreationScreen",deprecatedKey:"deprecated",MAX_TEAMS_SLOTS:e.maxTeamsSlots||5,MAX_TEAMS_OWNED:e.maxOwnedTeams||5,MAX_PREMIUM_TEAMS_SLOTS:Math.max(e.maxTeamsSlots||0,e.maxPremiumTeamsSlots||0)||5,MAX_PREMIUM_TEAMS_OWNED:Math.max(e.maxOwnedTeams||0,e.maxPremiumTeamsOwned||0)||5,criticalApps:["profile","settings","debug","admin","support","notifications","calendar","moderation"],earlyAccessApps:[]}}(void 0))}(V)),V.exports}var G,J=Y(),q=n({__proto__:null,default:r(J)},[J]),W={exports:{}},z={exports:{}},Q=z.exports;function Z(){return G||(G=1,function(e){!function(n){const t=e=>{var t=n.CryptPad_Util={};n.atob=n.atob||function(e){return Buffer.from(e,"base64").toString("binary")},n.btoa=n.btoa||function(e){return Buffer.from(e,"binary").toString("base64")},t.encodeBase64=n=>"function"==typeof n?.toBase64?n.toBase64():e.encodeBase64(n),t.decodeBase64=n=>{if("function"==typeof Uint8Array?.fromBase64)return Uint8Array.fromBase64(n);let t=n.length%4;return t&&(n+="=".repeat(4-t)),e.decodeBase64(n)},t.encodeUTF8=e.encodeUTF8,t.decodeUTF8=e.decodeUTF8,t.slice=function(e,n,t){return Array.prototype.slice.call(e,n,t)},t.shuffleArray=function(e){for(var n=e.length-1;n>0;n--){var t=Math.floor(Math.random()*(n+1)),r=e[n];e[n]=e[t],e[t]=r}},t.bake=function(e,n){return void 0===n&&(n=[]),Array.isArray(n)||(n=[n]),function(){return e.apply(null,n)}},t.both=function(e,n){if("function"!=typeof e)throw new Error("INVALID_USAGE");return"function"!=typeof n&&(n=function(e){return e}),function(){return e.apply(null,arguments),n.apply(null,arguments)}},t.clone=function(e){return null==e?e:JSON.parse(JSON.stringify(e))},t.serializeError=function(e){if(!(e instanceof Error))return e;var n={};return Object.getOwnPropertyNames(e).forEach(function(t){n[t]=e[t]}),n},t.tryParse=function(e){try{return JSON.parse(e)}catch(e){return}},t.mkAsync=function(e,n){if("function"!=typeof e)throw new Error("EXPECTED_FUNCTION");return function(){var t=Array.prototype.slice.call(arguments);setTimeout(function(){e.apply(null,t)},n)}},t.mkEvent=function(e){var n=[],t=!1;let r;return{reg:function(r){e&&t?setTimeout(r):n.push(r)},unreg:function(e){-1!==n.indexOf(e)?n.splice(n.indexOf(e),1):console.log("event handler was already unregistered")},fire:function(){if(!e||!t){var o=Array.prototype.slice.call(arguments);t||r.apply(null,o),t=!0,n.forEach(function(e){e.apply(null,o)})}},promise:new Promise(e=>{r=e})}},t.mkTimeout=function(e,n){n=n||0;var r=t.once(e),o=setTimeout(function(){r("TIMEOUT")},n);return t.both(r,function(){clearTimeout(o)})},t.onClickEnter=function(e,n,t){e.on("click keydown",function(e){var r="click"===e.type,o="keydown"===e.type&&13===e.which,a="keydown"===e.type&&32===e.which&&t&&t.space;(r||o||a)&&("keydown"===e.type&&e.preventDefault(),n(e))})},t.response=function(e){var n={},t={};"function"!=typeof e&&(e=function(e){throw new Error(e)});var r=function(e){clearTimeout(t[e]),delete t[e],delete n[e]};return{clear:r,expected:function(e){return Boolean(n[e])},expectation:function(e){return n[e]},expect:function(o,a,i){"string"!=typeof o&&e("EXPECTED_STRING"),"function"!=typeof a&&e("EXPECTED_CALLBACK"),n[o]=a,"number"==typeof i&&i&&(t[o]=setTimeout(function(){"function"==typeof n[o]&&n[o]("TIMEOUT"),r(o)},i))},handle:function(t,o){var a=n[t];if("function"==typeof a){try{a.apply(null,Array.isArray(o)?o:[o])}catch(n){e("HANDLER_ERROR",{error:n,id:t,args:o})}r(t)}else e("MISSING_CALLBACK",{id:t,args:o})},_pending:n}},t.inc=function(e,n,t){e[n]=(e[n]||0)+("number"==typeof t?t:1)},t.values=function(e){return Object.keys(e).map(function(n){return e[n]})},t.find=function(e,n){for(var t=n.length,r=0;r&"']/g,function(e){return{"<":"<",">":">","&":"&",'"':""","'":"'"}[e]}):""},t.hexToBase64=function(e){var t=e.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" "),r=String.fromCharCode.apply(null,t);return n.btoa(r).replace(/\//g,"-").replace(/=+$/,"")},t.base64ToHex=function(e){var t=[];return n.atob(e.replace(/-/g,"/")).split("").forEach(function(e){var n=e.charCodeAt(0).toString(16);1===n.length&&(n="0"+n),t.push(n)}),t.join("")},t.uint8ArrayToHex=function(e){for(var n="",t=0;t=o?"GB":e>=r?"MB":"KB"};t.getBlock=function(e,n,r){var o=t.once(t.mkAsync(r)),a={};"string"==typeof n.bearer&&n.bearer&&(a.authorization=`Bearer ${n.bearer}`),fetch(e,{method:"GET",credentials:"include",headers:a}).then(e=>{e.ok?o(void 0,e):401!==e.status&&404!==e.status?o(e.status,e):e.json().then(n=>{o(e.status,n)}).catch(()=>{o(e.status)})}).catch(e=>{o(e)})},t.fetchApi=function(e,n,t,r){const o=new URL(e);o.pathname=`api/${n}`;let a=o.href+(t?"?"+ +new Date:"");if("undefined"!=typeof self&&self.crypto)fetch(a).then(e=>{if(!e.ok)throw new Error(`Fetch error: ${e.status}`);return e.text()}).then(e=>{r(JSON.parse(e.slice(27,-5)))}).catch(e=>{console.error(e.message),r({})});else if(void 0!==f){("http:"===o.protocol?require("node:http"):require("node:https")).get(o.href,e=>{let n="";e.on("data",e=>{n+=e}),e.on("end",()=>{try{r(JSON.parse(n.slice(27,-5)))}catch(e){console.error(e),r({})}})})}},t.fetch=function(e,n,r,o){var a,i=t.once(t.mkAsync(n)),s=function(e){var n=e.replace(/(\/)*$/,""),t=n.lastIndexOf("/"),r=n.slice(t+1);return/^[a-f0-9]{48}$/.test(r)||(r=void 0),r}(e),c=function(){(a=new XMLHttpRequest).open("GET",e,!0),r&&a.addEventListener("progress",function(e){if(e.lengthComputable){var n=e.loaded/e.total;r(n)}},!1),a.responseType="arraybuffer",a.onerror=function(e){i(e)},a.onload=function(){if(/^4/.test(""+this.status))return i("XHR_ERROR");var e=a.response;if(e){var n=new Uint8Array(e);return s?void function(e,n,t){o&&"function"==typeof o.setBlobCache?o.setBlobCache(e,n,t):t("EINVAL")}(s,n,function(){i(null,n)}):void i(void 0,n)}i("ENOENT")},a.send(null)};if(s)return function(e,n){o&&"function"==typeof o.getBlobCache?o.getBlobCache(e,n):n("EINVAL")}(s,function(e,n){!e&&n?i(void 0,n):c()}),{cancel:function(){a&&a.abort&&a.abort()}};c()},t.dataURIToBlob=function(e){for(var n=atob(e.split(",")[1]),t=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(n.length),o=new Uint8Array(r),a=0;aparseInt(e,10).toString(16).padStart(2,"0")).join("")}`},t.isSmallScreen=function(){return n.innerHeight<800||n.innerWidth<800},t.stripTags=function(e){var n=document.createElement("div");return n.innerHTML=e,n.innerText},t.parseFilename=function(e){if(!e||!e.trim())return{};var n=/^(\.?.+?)(\.[^.]+)?$/.exec(e)||[];return{name:n[1],ext:n[2]}},t.isPlainTextFile=function(e,n){if(e&&0===e.indexOf("text/"))return!0;var r=t.parseFilename(n);return!(e||!n||r.ext)||("application/x-javascript"===e||"application/xml"===e)},t.isSpreadsheet=function(e,n){return e&&("application/vnd.oasis.opendocument.spreadsheet"===e||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"===e)||n&&(n.endsWith(".xlsx")||n.endsWith(".ods"))},t.isOfficeDoc=function(e,n){return e&&("application/vnd.oasis.opendocument.text"===e||"application/vnd.openxmlformats-officedocument.wordprocessingml.document"===e)||n&&(n.endsWith(".docx")||n.endsWith(".odt"))},t.isPresentation=function(e,n){return e&&("application/vnd.oasis.opendocument.presentation"===e||"application/vnd.openxmlformats-officedocument.presentationml.presentation"===e)||n&&(n.endsWith(".pptx")||n.endsWith(".odp"))},t.isValidURL=function(e){return!!new RegExp("^(https?:\\/\\/)((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?").test(e)};var a=/([\uD800-\uDBFF][\uDC00-\uDFFF])/;t.getFirstCharacter=function(e){if(!e||!e.trim())return"?";var n=function(e){for(var n=e.split(a),t=[],r=0;r{let n=/ver=([0-9.]+)(-[0-9]*)?/.exec(e);return Array.isArray(n)&&n[1]||void 0},t.Saferphore={create:e=>{var n,t=[];return n=function(){if(e<0)throw new Error("(resourceCount < 0) should never happen");var r;0!==e&&0!==t.length&&(e--,t.shift()((r=0,function(t){if(r++)throw new Error("returnAfter() called multiple times");var o=0;return function(){if(o++)throw new Error("returnAfter wrapped callback called multiple times");t&&t.apply(null,arguments),e++,n()}})))},{take:function(e){t.push(e),n()}}}},t};e.exports&&(e.exports=t(w()))}("undefined"!=typeof self?self:Q)}(z)),z.exports}var X,$,ee={exports:{}};function ne(){return X||(X=1,function(e){e.exports&&(e.exports=function(){var e={},n=function(e){return e.replace(/-/g,"/")};return e.parseUser=function(e){var t,r,o,a=function(e){if(/^\[.*?@.*\]$/.test(e)){var t,r=e.slice(1,-1);if(r=r.replace(/\/([a-zA-Z0-9+-]{43}=)$/,function(e,r){return t=n(r),""}),t){var o=r.lastIndexOf("@");if(!(o<1))return{domain:r.slice(o+1),user:r.slice(0,o),pubkey:t}}}}(e);if(function(e){if(e&&e.domain&&e.user&&e.pubkey)return!0}(a))return a;if(e.replace(/^https*:\/\/([^\/]+)\/user\/#\/1\/([^\/]+)\/([a-zA-Z0-9+-]{43}=)$/,function(e,a,i,s){return t=a,r=i,o=n(s),""}),!t)throw new Error("Could not parse user id ["+e+"]");return{domain:t,user:r,pubkey:o}},e.serialize=function(e,n,t){return"["+n+"@"+e.replace(/https*:\/\//,"")+"/"+t.replace(/\//g,"-")+"]"},e.canonicalize=function(t){if("string"==typeof t){if(44===t.length)return n(t);try{return e.parseUser(t).pubkey}catch(e){return}}},e}())}(ee)),ee.exports}function te(){return $||($=1,function(e){!function(n){e.exports&&(e.exports=function(e,t,r,o){var a=n.CryptPad_Hash={},i=e.uint8ArrayToHex,s=e.hexToBase64,c=e.base64ToHex;a.encodeBase64=e.encodeBase64,a.decodeBase64=e.decodeBase64,a.hashChannelList=function(n){return e.encodeBase64(o.hash(e.decodeUTF8(JSON.stringify(n))))},a.generateSignPair=function(){var e=o.sign.keyPair(),n=function(e){return t.b64RemoveSlashes(e).replace(/=+$/g,"")};return{validateKey:a.encodeBase64(e.publicKey),signKey:a.encodeBase64(e.secretKey),safeValidateKey:n(a.encodeBase64(e.publicKey)),safeSignKey:n(a.encodeBase64(e.secretKey))}},a.getSignPublicFromPrivate=function(n){var r=t.b64AddSlashes(n),a=e.decodeBase64(r),i=o.sign.keyPair.fromSecretKey(a);return e.encodeBase64(i.publicKey)},a.getCurvePublicFromPrivate=function(n){var r=t.b64AddSlashes(n),a=e.decodeBase64(r),i=o.box.keyPair.fromSecretKey(a);return e.encodeBase64(i.publicKey)};var u=a.getEditHashFromKeys=function(e){var n=e.version,r=e.keys;if(0===n)return e.channel+e.key;if(1===n){if(!r.editKeyStr)return;return"/1/edit/"+s(e.channel)+"/"+t.b64RemoveSlashes(r.editKeyStr)+"/"}if(2===n){if(!r.editKeyStr)return;var o=e.password?"p/":"";return"/2/"+e.type+"/edit/"+t.b64RemoveSlashes(r.editKeyStr)+"/"+o}},f=a.getViewHashFromKeys=function(e){var n=e.version,r=e.keys;if(0!==n){if(1===n){if(!r.viewKeyStr)return;return"/1/view/"+s(e.channel)+"/"+t.b64RemoveSlashes(r.viewKeyStr)+"/"}if(2===n){if(!r.viewKeyStr)return;var o=e.password?"p/":"";return"/2/"+e.type+"/view/"+t.b64RemoveSlashes(r.viewKeyStr)+"/"+o}}};a.getHiddenHashFromKeys=function(e,n,t){t=t||{};var r=n.keys&&n.keys.editKeyStr||n.key,o=!t.view&&r?"edit/":"view/",i=n.password?"p/":"";n.keys&&n.keys.fileKeyStr&&(o="");var s="/3/"+e+"/"+o+n.channel+"/"+i,c=a.parseTypeHash(e,s);return c&&c.getHash?c.getHash(t||{}):s};var l=a.getFileHashFromKeys=function(e){var n=e.version,r=e.keys;if(0!==n){if(1===n)return"/1/"+s(e.channel)+"/"+t.b64RemoveSlashes(r.fileKeyStr)+"/";if(2===n){if(!r.fileKeyStr)return;var o=e.password?"p/":"";return"/2/"+e.type+"/"+t.b64RemoveSlashes(r.fileKeyStr)+"/"+o}}};a.getPublicSigningKeyString=r.serialize,a.ephemeralChannelLength=34,a.createChannelId=function(e){var n=i(t.Nacl.randomBytes(e?17:16));if(-1===[32,34].indexOf(n.length)||/[^a-f0-9]/.test(n))throw new Error("channel ids must consist of 32 hex characters");return n},a.getChannelIdFromKey=function(e){if(e)return i(a.decodeBase64(e).subarray(0,16))},a.getBoxPublicFromSecret=function(e){if(e){var n=a.decodeBase64(e),t=o.box.keyPair.fromSecretKey(n);return a.encodeBase64(t.publicKey)}},a.checkBoxKeyPair=function(e,n){if(!n||!e)return!1;var t=a.decodeBase64(e),r=o.box.keyPair.fromSecretKey(t);return n===a.encodeBase64(r.publicKey)},a.createRandomHash=function(e,n){var r;return"file"===e?(r=t.createFileCryptor2(void 0,n),l({password:Boolean(n),version:2,type:e,keys:r})):(r=t.createEditCryptor2(void 0,void 0,n),u({password:Boolean(n),version:2,type:e,keys:r}))};var d=a.parseTypeHash=function(e,n){if(n){var r,o=[],a={},i=(r=n,r.replace(/\/+/g,"/")).split("/"),s=function(){a.password=-1!==o.indexOf("p"),a.present=-1!==o.indexOf("present"),a.embed=-1!==o.indexOf("embed"),a.versionHash=function(e){var n;return e.some(function(e){if(/^hash=/.test(e))return n=e.slice(5),!0}),n?t.b64AddSlashes(n):""}(o),a.auditorKey=function(e){var n;return e.some(function(e){if(/^auditor=/.test(e))return n=e.slice(8),!0}),n?t.b64AddSlashes(n):""}(o),a.newPadOpts=function(e){var n;return e.some(function(e){if(/^newpad=/.test(e))return n=e.slice(7),!0}),n||""}(o),a.loginOpts=function(e){var n;return e.some(function(e){if(/^login=/.test(e))return n=e.slice(6),!0}),n||""}(o),a.ownerKey=function(e){var n;return e.some(function(e){if(86===e.length)return n=e,!0}),n}(o)};return i[1]&&"4"===i[1]?(a.getHash=function(n){if(!n||!Object.keys(n).length)return"";var t="/4/"+e+"/";return n.newPadOpts&&(t+="newpad="+n.newPadOpts+"/"),n.loginOpts&&(t+="login="+n.loginOpts+"/"),t},a.getOptions=function(){var e={};return a.newPadOpts&&(e.newPadOpts=a.newPadOpts),a.loginOpts&&(e.loginOpts=a.loginOpts),e},a.version=4,a.app=i[2],o=i.slice(3),s(),a):-1===["media","file","user","invite"].indexOf(e)?(a.type="pad",a.getHash=function(){return n},a.getOptions=function(){return{embed:a.embed,present:a.present,ownerKey:a.ownerKey,versionHash:a.versionHash,auditorKey:a.auditorKey,newPadOpts:a.newPadOpts,loginOpts:a.loginOpts,password:a.password}},"/"!==n.slice(0,1)&&n.length>=56?(a.channel=n.slice(0,32),a.key=n.slice(32,56),a.version=0,a):(a.getHash=function(e){var n=i.slice(0,5).join("/")+"/",r=void 0!==e.ownerKey?e.ownerKey:a.ownerKey;r&&(n+=r+"/"),(a.password||e.password)&&(n+="p/"),e.embed&&(n+="embed/"),e.present&&(n+="present/");var o=void 0!==e.versionHash?e.versionHash:a.versionHash;o&&(n+="hash="+t.b64RemoveSlashes(o)+"/");var s=void 0!==e.auditorKey?e.auditorKey:a.auditorKey;return s&&(n+="auditor="+t.b64RemoveSlashes(s)+"/"),e.newPadOpts&&(n+="newpad="+e.newPadOpts+"/"),e.loginOpts&&(n+="login="+e.loginOpts+"/"),n},i[1]&&"1"===i[1]?(a.version=1,a.mode=i[2],a.channel=i[3],a.key=t.b64AddSlashes(i[4]),o=i.slice(5),s(),a):i[1]&&"2"===i[1]?(a.version=2,a.app=i[2],a.mode=i[3],a.key=i[4],o=i.slice(5),s(),a):i[1]&&"3"===i[1]?(a.version=3,a.app=i[2],a.mode=i[3],a.channel=i[4],o=i.slice(5),s(),a):a)):(a.getHash=function(){return i.join("/")},-1!==["media","file"].indexOf(e)?(a.type="file",a.getOptions=function(){return{embed:a.embed,present:a.present,ownerKey:a.ownerKey,newPadOpts:a.newPadOpts,loginOpts:a.loginOpts,password:a.password}},a.getHash=function(e){var n=i.slice(0,4).join("/")+"/",t=void 0!==e.ownerKey?e.ownerKey:a.ownerKey;return t&&(n+=t+"/"),(a.password||e.password)&&(n+="p/"),e.embed&&(n+="embed/"),e.present&&(n+="present/"),e.newPadOpts&&(n+="newpad="+e.newPadOpts+"/"),e.loginOpts&&(n+="login="+e.loginOpts+"/"),n},i[1]&&"1"===i[1]?(a.version=1,a.channel=i[2].replace(/-/g,"/"),a.key=i[3].replace(/-/g,"/"),o=i.slice(4),s(),a):i[1]&&"2"===i[1]?(a.version=2,a.app=i[2],a.key=i[3],o=i.slice(4),s(),a):i[1]&&"3"===i[1]?(a.version=3,a.app=i[2],a.channel=i[3],o=i.slice(4),s(),a):a):-1!==["user"].indexOf(e)?(a.type="user",i[1]&&"1"===i[1]?(a.version=1,a.user=i[2],a.pubkey=i[3].replace(/-/g,"/"),a):a):-1!==["invite"].indexOf(e)?(a.type="invite",i[1]&&"2"===i[1]?(a.version=2,a.app=i[2],a.mode=i[3],a.key=i[4],o=i.slice(5),a.password=-1!==o.indexOf("p"),a):a):void 0)}},h=a.parsePadUrl=function(e){var n,t={};return e?("/"!==e.slice(-1)&&"#"!==e.slice(-1)&&(e+="/"),e=e.replace(/\/\?[^#]+#/,"/#"),t.getUrl=function(e){e=e||{};var n="/";return t.type?(n+=t.type+"/",!t.hashData&&e&&Object.keys(e).length?n+"#"+function(e){if(!e||!Object.keys(e).length)return"";var n="/4/"+t.type+"/";return e.newPadOpts&&(n+="newpad="+e.newPadOpts+"/"),e.loginOpts&&(n+="login="+e.loginOpts+"/"),n}(e):t.hashData?n+="#"+t.hashData.getHash(e):n):n},t.getOptions=function(){return t.hashData&&t.hashData.getOptions?t.hashData.getOptions():{}},/^https*:\/\//.test(e)?(e.replace(/^https*:\/\/([^\/]*)\/(.*?)\//i,function(e,n,r){return t.domain=n,t.type=r,""}),-1===(n=e.indexOf("/#"))||(t.hash=e.slice(n+2),t.hashData=d(t.type,t.hash)),t):/^\/($|[^\/])/.test(e)?(n=e.indexOf("/#"),t.type=e.slice(1,n),-1===n||(t.hash=e.slice(n+2),t.hashData=d(t.type,t.hash)),t):t):t};return a.hashToHref=function(e,n){return"/"+n+"/#"+e},a.hrefToHash=function(e){return a.parsePadUrl(e).hash},a.getRelativeHref=function(e){if(e&&-1!==e.indexOf("#")){var n=h(e);return"/"+n.type+"/#"+n.hash}},a.getSecrets=function(n,r,o){var a,i,s={},u=function(){s.keys=t.createEditCryptor2(void 0,void 0,o),s.channel=c(s.keys.chanId),s.version=2,s.type=n};if(!r)return u(),s;if(r){if(!n)throw new Error("getSecrets with a hash requires a type parameter");a=d(n,r),i=r}if(0===i.length)return u(),s;if(0===a.version)s.channel=a.channel,s.key=a.key,s.version=0;else if(1===a.version){if(s.version=1,"pad"===a.type){if(s.channel=c(a.channel),"edit"===a.mode){if(s.keys=t.createEditCryptor(a.key),s.key=s.keys.editKeyStr,32!==s.channel.length||24!==s.key.length)throw new Error("The channel key and/or the encryption key is invalid")}else if("view"===a.mode&&(s.keys=t.createViewCryptor(a.key),32!==s.channel.length))throw new Error("The channel key is invalid")}else if("file"===a.type)s.channel=c(a.channel),s.keys={fileKeyStr:a.key,cryptKey:e.decodeBase64(a.key)};else if("user"===a.type)throw new Error("User hashes can't be opened (yet)")}else if(2===a.version)if(s.version=2,s.type=n,s.password=o,"pad"===a.type){if("edit"===a.mode){if(s.keys=t.createEditCryptor2(a.key,void 0,o),s.channel=c(s.keys.chanId),s.key=s.keys.editKeyStr,32!==s.channel.length||24!==s.key.length)throw new Error("The channel key and/or the encryption key is invalid")}else if("view"===a.mode&&(s.keys=t.createViewCryptor2(a.key,o),s.channel=c(s.keys.chanId),32!==s.channel.length))throw new Error("The channel key is invalid")}else if("file"===a.type){if(s.keys=t.createFileCryptor2(a.key,o),s.channel=c(s.keys.chanId),s.key=s.keys.fileKeyStr,48!==s.channel.length||24!==s.key.length)throw new Error("The channel key and/or the encryption key is invalid")}else if("user"===a.type)throw new Error("User hashes can't be opened (yet)");return s},a.getHashes=function(e){var n={};return(e=JSON.parse(JSON.stringify(e))).keys||e.key?(e.keys||(e.keys={}),(e.keys.editKeyStr||0===e.version&&e.key)&&(n.editHash=u(e)),e.keys.viewKeyStr&&(n.viewHash=f(e)),e.keys.fileKeyStr&&(n.fileHash=l(e)),n):n},a.getFormData=function(n,t,r){var i=(n=n||a.getSecrets("form",t,r))&&n.keys,s=i&&i.secondaryKey;if(s){var c=o.box.keyPair.fromSecretKey(e.decodeUTF8(s).slice(0,32)),u={};u.form_public=e.encodeBase64(c.publicKey);var f=u.form_private=e.encodeBase64(c.secretKey),l=a.getViewHashFromKeys({version:1,channel:n.channel,keys:{viewKeyStr:e.encodeBase64(i.cryptKey)}}),d=a.parseTypeHash("pad",l);return u.form_auditorHash=d.getHash({auditorKey:f}),u}},a.hrefToHexChannelId=function(e,n){var t=a.parsePadUrl(e);if(t&&t.hash)return a.getSecrets(t.type,t.hash,n).channel},a.getBlobPathFromHex=function(e){return"/blob/"+e.slice(0,2)+"/"+e},a.serializeHash=function(e){return e&&"/"!==e.slice(-1)&&(e+="/"),e},a.createInviteUrl=function(e,t){return t=t||a.createChannelId(),n.location.origin+"/invite/#/1/"+t+"/"+e.replace(/\//g,"-")+"/"},a.isValidChannel=function(e){return/^[a-zA-Z0-9]{32,48}$/.test(e)},a.isValidHref=function(e){if(e){var n=a.parsePadUrl(e);if(n&&n.type){if(n.hash){if(!n.hashData)return;if(void 0===n.hashData.version)return;if("pad"===n.hashData.type||"file"===n.hashData.type){if(!n.hashData.key&&!n.hashData.channel)return;if(n.hashData.key&&!/^[a-zA-Z0-9+-/=]+$/.test(n.hashData.key))return}}return n}}},a.decodeDataOptions=function(n){var t=decodeURIComponent(n),r=e.encodeUTF8(e.decodeBase64(t));return e.tryParse(r)||{}},a.encodeDataOptions=function(n){var t=JSON.stringify(n),r=e.encodeBase64(e.decodeUTF8(t));return encodeURIComponent(r)},a.getNewPadURL=function(e,n){var t=a.parsePadUrl(e),r=t.getOptions();return r.newPadOpts=a.encodeDataOptions(n),t.getUrl(r)},a.getLoginURL=function(e,n){var t=a.parsePadUrl(e),r=t.getOptions();return r.loginOpts=a.encodeDataOptions(n),t.getUrl(r)},a}(Z(),M(),ne(),h()))}("undefined"!=typeof window?window:{})}(W)),W.exports}var re,oe,ae=te(),ie=Z(),se={exports:{}},ce={exports:{}};function ue(){return re||(re=1,function(e){e.exports=function e(n,t,r){function o(i,s){if(!t[i]){if(!n[i]){if(!s&&f)return f(i);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=t[i]={exports:{}};n[i][0].call(u.exports,function(e){var t=n[i][1][e];return o(t||e)},u,u.exports,e,n,t,r)}return t[i].exports}for(var a=f,i=0;i=43)}}).catch(function(){return!1})}function A(e){return"boolean"==typeof v?u.resolve(v):O(e).then(function(e){return v=e})}function w(e){var n=y[e.name],t={};t.promise=new u(function(e,n){t.resolve=e,t.reject=n}),n.deferredOperations.push(t),n.dbReady?n.dbReady=n.dbReady.then(function(){return t.promise}):n.dbReady=t.promise}function D(e){var n=y[e.name].deferredOperations.pop();if(n)return n.resolve(),n.promise}function _(e,n){var t=y[e.name].deferredOperations.pop();if(t)return t.reject(n),t.promise}function T(e,n){return new u(function(t,r){if(y[e.name]=y[e.name]||F(),e.db){if(!n)return t(e.db);w(e),e.db.close()}var o=[e.name];n&&o.push(e.version);var a=i.open.apply(i,o);n&&(a.onupgradeneeded=function(n){var t=a.result;try{t.createObjectStore(e.storeName),n.oldVersion<=1&&t.createObjectStore(p)}catch(t){if("ConstraintError"!==t.name)throw t;console.warn('The database "'+e.name+'" has been upgraded from version '+n.oldVersion+" to version "+n.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){var n=a.result;n.onversionchange=function(e){e.target.close()},t(n),D(e)}})}function S(e){return T(e,!1)}function N(e){return T(e,!0)}function I(e,n){if(!e.db)return!0;var t=!e.db.objectStoreNames.contains(e.storeName),r=e.versione.db.version;if(r&&(e.version!==n&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||t){if(t){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function x(e){return new u(function(n,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");n({__local_forage_encoded_blob:!0,data:r,type:e.type})},r.readAsBinaryString(e)})}function C(e){return c([b(atob(e.data))],{type:e.type})}function R(e){return e&&e.__local_forage_encoded_blob}function P(e){var n=this,t=n._initReady().then(function(){var e=y[n._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return l(t,e,e),t}function k(e){w(e);for(var n=y[e.name],t=n.forages,r=0;r0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return u.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),N(e)}).then(function(){return k(e).then(function(){M(e,n,t,r-1)})}).catch(t);t(o)}}function F(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function L(e){var n=this,t={db:null};if(e)for(var r in e)t[r]=e[r];var o=y[t.name];o||(o=F(),y[t.name]=o),o.forages.push(n),n._initReady||(n._initReady=n.ready,n.ready=P);var a=[];function i(){return u.resolve()}for(var s=0;s>4,f[c++]=(15&r)<<4|o>>2,f[c++]=(3&o)<<6|63&a;return u}function pe(e){var n,t=new Uint8Array(e),r="";for(n=0;n>2],r+=z[(3&t[n])<<4|t[n+1]>>4],r+=z[(15&t[n+1])<<2|t[n+2]>>6],r+=z[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function ve(e,n){var t="";if(e&&(t=de.call(e)),e&&("[object ArrayBuffer]"===t||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var r,o=X;e instanceof ArrayBuffer?(r=e,o+=ee):(r=e.buffer,"[object Int8Array]"===t?o+=te:"[object Uint8Array]"===t?o+=re:"[object Uint8ClampedArray]"===t?o+=oe:"[object Int16Array]"===t?o+=ae:"[object Uint16Array]"===t?o+=se:"[object Int32Array]"===t?o+=ie:"[object Uint32Array]"===t?o+=ce:"[object Float32Array]"===t?o+=ue:"[object Float64Array]"===t?o+=fe:n(new Error("Failed to get type for BinaryArray"))),n(o+pe(r))}else if("[object Blob]"===t){var a=new FileReader;a.onload=function(){var t=Q+e.type+"~"+pe(this.result);n(X+ne+t)},a.readAsArrayBuffer(e)}else try{n(JSON.stringify(e))}catch(t){console.error("Couldn't convert value into a JSON string: ",e),n(null,t)}}function ye(e){if(e.substring(0,$)!==X)return JSON.parse(e);var n,t=e.substring(le),r=e.substring($,le);if(r===ne&&Z.test(t)){var o=t.match(Z);n=o[1],t=t.substring(o[0].length)}var a=he(t);switch(r){case ee:return a;case ne:return c([a],{type:n});case te:return new Int8Array(a);case re:return new Uint8Array(a);case oe:return new Uint8ClampedArray(a);case ae:return new Int16Array(a);case se:return new Uint16Array(a);case ie:return new Int32Array(a);case ce:return new Uint32Array(a);case ue:return new Float32Array(a);case fe:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}}var me={serialize:ve,deserialize:ye,stringToBuffer:he,bufferToString:pe};function ge(e,n,t,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+n.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],t,r)}function Ee(e){var n=this,t={db:null};if(e)for(var r in e)t[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new u(function(e,r){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size)}catch(e){return r(e)}t.db.transaction(function(o){ge(o,t,function(){n._dbInfo=t,e()},function(e,n){r(n)})},r)});return t.serializer=me,o}function be(e,n,t,r,o,a){e.executeSql(t,r,o,function(e,i){i.code===i.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[n.storeName],function(e,s){s.rows.length?a(e,i):ge(e,n,function(){e.executeSql(t,r,o,a)},a)},a):a(e,i)},a)}function Oe(e,n){var t=this;e=d(e);var r=new u(function(n,r){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){be(t,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,t){var r=t.rows.length?t.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),n(r)},function(e,n){r(n)})})}).catch(r)});return f(r,n),r}function Ae(e,n){var t=this,r=new u(function(n,r){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){be(t,o,"SELECT * FROM "+o.storeName,[],function(t,r){for(var a=r.rows,i=a.length,s=0;s0)return void a(we.apply(o,[e,s,t,r-1]));i(n)}})})}).catch(i)});return f(a,t),a}function De(e,n,t){return we.apply(this,[e,n,t,1])}function _e(e,n){var t=this;e=d(e);var r=new u(function(n,r){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){be(t,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){n()},function(e,n){r(n)})})}).catch(r)});return f(r,n),r}function Te(e){var n=this,t=new u(function(e,t){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){be(n,r,"DELETE FROM "+r.storeName,[],function(){e()},function(e,n){t(n)})})}).catch(t)});return f(t,e),t}function Se(e){var n=this,t=new u(function(e,t){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){be(n,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],function(n,t){var r=t.rows.item(0).c;e(r)},function(e,n){t(n)})})}).catch(t)});return f(t,e),t}function Ne(e,n){var t=this,r=new u(function(n,r){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){be(t,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,t){var r=t.rows.length?t.rows.item(0).key:null;n(r)},function(e,n){r(n)})})}).catch(r)});return f(r,n),r}function Ie(e){var n=this,t=new u(function(e,t){n.ready().then(function(){var r=n._dbInfo;r.db.transaction(function(n){be(n,r,"SELECT key FROM "+r.storeName,[],function(n,t){for(var r=[],o=0;o '__WebKitDatabaseInfoTable__'",[],function(t,r){for(var o=[],a=0;a0}function Le(e){var n=this,t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=ke(e,n._defaultConfig),Fe()?(n._dbInfo=t,t.serializer=me,u.resolve()):u.reject()}function He(e){var n=this,t=n.ready().then(function(){for(var e=n._dbInfo.keyPrefix,t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}});return f(t,e),t}function je(e,n){var t=this;e=d(e);var r=t.ready().then(function(){var n=t._dbInfo,r=localStorage.getItem(n.keyPrefix+e);return r&&(r=n.serializer.deserialize(r)),r});return f(r,n),r}function Ke(e,n){var t=this,r=t.ready().then(function(){for(var n=t._dbInfo,r=n.keyPrefix,o=r.length,a=localStorage.length,i=1,s=0;s=0;n--){var t=localStorage.key(n);0===t.indexOf(e)&&localStorage.removeItem(t)}}):u.reject("Invalid arguments"),f(r,n),r}var qe={_driver:"localStorageWrapper",_initStorage:Le,_support:Pe(),iterate:Ke,getItem:je,setItem:Ge,removeItem:Ye,clear:He,length:Ve,key:Ue,keys:Be,dropInstance:Je},We=function(e,n){return e===n||"number"==typeof e&&"number"==typeof n&&isNaN(e)&&isNaN(n)},ze=function(e,n){for(var t=e.length,r=0;r{const n=(e,n)=>{let t=globalThis,r=globalThis;var o=t.CryptPad_Cache={},a=e.mkEvent(!0),i=!1,s=!1,c=!1;try{var u=t.indexedDB.open("test_db",1);u.onsuccess=function(){i=(c=!0)&&!s,a.fire()},u.onerror=function(){a.fire()}}catch(e){a.fire()}o.enable=function(){s=!1,i=c&&!s},o.disable=function(){s=!0,i=c&&!s},o.isEnabled=()=>i;var f=n.createInstance({driver:n.INDEXEDDB,name:"cp_cache"});o.getBlobCache=function(n,t){t=e.once(e.mkAsync(t||function(){})),a.reg(function(){i?f.getItem(n,function(r,o){!r&&o&&o.c?(t(null,o.c),o.t=+new Date,f.setItem(n,o,function(e){e&&console.error(e)})):t(e.serializeError(r||"EINVAL"))}):t("NOCACHE")})},o.setBlobCache=function(n,t,r){r=e.once(e.mkAsync(r||function(){})),a.reg(function(){i?t?f.setItem(n,{c:t,t:+new Date},function(n){r(e.serializeError(n))}):r("EINVAL"):r("NOCACHE")})},o.getChannelCache=function(n,t){t=e.once(e.mkAsync(t||function(){})),a.reg(function(){i?f.getItem(n,function(r,o){!r&&o&&Array.isArray(o.c)?(t(null,o),o.t=+new Date,f.setItem(n,o,function(e){e&&console.error(e)})):t(e.serializeError(r||"EINVAL"))}):t("NOCACHE")})};var l={};return o.storeCache=function(n,t,r,o){o=e.once(e.mkAsync(o||function(){})),a.reg(function(){l[n]=l[n]||e.throttle(function(t,r,o){var a,s;i?Array.isArray(r)&&t?(a=r,Array.isArray(a)&&(a.length>100&&a.splice(0,a.length-100),a.some(function(e,n){if(e.isCheckpoint)return s=n,!0}),a.splice(0,s)),f.setItem(n,{k:t,c:r,t:+new Date},function(n){n&&o(e.serializeError(n))})):o("EINVAL"):o("NOCACHE")},50),l[n](t,r,o)})},o.leaveChannel=function(e){delete l[e]},o.clearChannel=function(n,t){t=e.once(e.mkAsync(t||function(){})),a.reg(function(){i?f.removeItem(n,function(){t()}):t("NOCACHE")})},o.clear=function(n){n=e.once(e.mkAsync(n||function(){})),a.reg(function(){i?f.clear(n):n("NOCACHE")})},o.getKeys=function(n){n=e.once(e.mkAsync(n||function(){})),a.reg(function(){i?f.keys().then(function(e){n(null,e)}).catch(function(e){n(e)}):n("NOCACHE")})},o.getTime=function(n,t){t=e.once(e.mkAsync(t||function(){})),a.reg(function(){i?f.getItem(n,function(n,r){!n&&r&&r.c?t(null,r.t):t(e.serializeError(n||"EINVAL"))}):t("NOCACHE")})},r.CryptPad_clearIndexedDB=o.clear,o};e.exports&&(e.exports=n(Z(),ue()))})()}(se)),se.exports}var le=fe(),de=n({__proto__:null,default:r(le)},[le]);const he=ie.mkEvent(!0),pe=ie.mkEvent(!0),ve=ie.mkEvent(),ye=ie.mkEvent();let me={};const ge={setCustomize:e=>{me=e.ApiConfig},init:e=>{var n,t,r;const{broadcast:o,userHash:a,anonHash:i}=e,s=a||i||ae.createRandomHash("drive"),c=e.store,u=ae.getSecrets("drive",s),f=(null===(n=e.store)||void 0===n?void 0:n.network)||(null===(t=e.store)||void 0===t?void 0:t.networkPromise),l={data:{},websocketURL:U.getWebsocketURL(),network:f,channel:u.channel,readOnly:!1,validateKey:(null===(r=u.keys)||void 0===r?void 0:r.validateKey)||void 0,crypto:L.createEncryptor(u.keys),Cache:de,userName:"fs",logLevel:1,ChainPad:P,updateProgress:function(e){e.type="drive",o([],"LOADING_DRIVE",e)},classic:!0},d=globalThis.CP_account_rt=N.create(l);c.driveSecret=u,c.proxy=d.proxy,c.onRpcReadyEvt=ie.mkEvent(!0),c.loggedIn=void 0!==e.userHash;const h={loggedIn:c.loggedIn};return d.proxy.on("create",function(e){c.realtime=e.realtime,c.network=e.network,c.loggedIn||(h.anonHash=ae.getEditHashFromKeys(u))}).on("cacheready",function(n){c.realtime=n.realtime,c.offline=!0;const t=!!c.networkPromise;if(c.networkPromise||(c.networkPromise=n.networkPromise),c.cacheReturned=h,c.networkPromise&&c.networkPromise.then&&!t){const e=setTimeout(function(){c.networkTimeout=!0,o([],"LOADING_DRIVE",{type:"offline"})},5e3);c.networkPromise.then(function(n){c.network||(c.network=n),clearTimeout(e)},function(n){console.error(n),clearTimeout(e)})}e.cache&&(h.edPublic=d.proxy.edPublic,he.fire(h))}).on("ready",function(n){delete c.networkTimeout,c.ready||(c.driveMetadata=n.metadata,d.proxy.drive||(d.proxy.drive={}),!d.proxy[J.displayNameKey]&&c.noDriveName&&(d.proxy[J.displayNameKey]=c.noDriveName),!d.proxy.uid&&c.noDriveUid&&(d.proxy.uid=c.noDriveUid),!d.proxy.form_seed&&e.form_seed&&(d.proxy.form_seed=e.form_seed),d.proxy.edPublic&&Array.isArray(me.adminKeys)&&-1!==me.adminKeys.indexOf(d.proxy.edPublic)&&(c.isAdmin=!0),h.edPublic=d.proxy.edPublic,pe.fire(h))}).on("error",function(e){"EDELETED"===e.error&&(c.ownDeletion||(c.isDeleted=!0,o([],"DRIVE_DELETED",e.message)))}).on("disconnect",function(){c.offline=!0,ve.fire(),o([],"UPDATE_METADATA")}).on("reconnect",function(){c.offline=!1,ye.fire(),o([],"UPDATE_METADATA")}),{channel:u.channel,onAccountCacheReady:he.reg,onAccountReady:pe.reg,onDisconnect:ve.reg,onReconnect:ye.reg}}};var Ee,be=Object.freeze({__proto__:null,Account:ge}),Oe={exports:{}};function Ae(){return Ee||(Ee=1,function(e){(()=>{const n=(e={},n={})=>{var t={setCustomize:t=>{n=t.Messages,e=t.AppConfig},init:function(e){t.state=e}};return t.send=function(n,r,o){("function"!=typeof o&&(o=function(){}),e.disableFeedback)?o():n&&(!0===r||t.state)?function(e,n){var t=new XMLHttpRequest;t.open("HEAD",e),t.onreadystatechange=function(){this.readyState===this.DONE&&n&&n()},t.send()}("/common/feedback.html?"+n+"="+Math.random().toString(16).replace(/0./,""),o):o()},t.reportAppUsage=function(){var e=window.location.pathname.split("/").filter(function(e){return e}).join(".");/^#\/1\/view\//.test(window.location.hash)?t.send(e+"_VIEW"):t.send(e)},t.reportScreenDimensions=function(){var e=window.innerHeight,n=window.innerWidth;t.send("DIMENSIONS:"+e+"x"+n)},t.reportLanguage=function(){n&&t.send("LANG_"+n._languageUsed)},t};e.exports&&(e.exports=n(void 0,void 0))})()}(Oe)),Oe.exports}var we,De,_e=Ae(),Te=n({__proto__:null,default:r(_e)},[_e]),Se={exports:{}},Ne={exports:{}};function Ie(){return De||(De=1,function(e){e.exports&&(e.exports=function(e={},n){var t={setCustomize:n=>{e=n.AppConfig}};t.MINIMUM_PASSWORD_LENGTH="number"==typeof e.minimumPasswordLength?e.minimumPasswordLength:8,t.MINIMUM_NAME_LENGTH=1,t.MAXIMUM_NAME_LENGTH=64,t.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())},t.isLongEnoughPassword=function(e){return e.length>=t.MINIMUM_PASSWORD_LENGTH};var r=t.isString=function(e){return"string"==typeof e};return t.isValidUsername=function(e){return!!(r(e)&&e.length>=t.MINIMUM_NAME_LENGTH)},t.isValidPassword=function(e){return!(!e||!r(e))},t.passwordsMatch=function(e,n){return r(e)&&r(n)&&e===n},t.customSalt=function(){return"string"==typeof e.loginSalt?e.loginSalt:""},t.deriveFromPassphrase=function(e,r,o,a){n(r,e+t.customSalt(),8,1024,o||128,200,a,void 0)},t.dispenser=function(e){var n={used:0};return function(t){if(n.used+t>e.length)throw new Error("exceeded available entropy");if("number"!=typeof t)throw new Error("expected a number");if(t<=0)throw new Error("expected to consume a positive number of bytes");var r;return r=e.slice?e.slice(n.used,n.used+t):e.subarray(n.used,n.used+t),n.used+=t,r}},t}(void 0,(we||(we=1,function(e){e.exports=function(e,n,t,r,o,a,i,s){function c(e){var n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],t=1779033703,r=3144134277,o=1013904242,a=2773480762,i=1359893119,s=2600822924,c=528734635,u=1541459225,f=new Array(64);function l(e){for(var l=0,d=e.length;d>=64;){var h,p,v,y,m,g=t,E=r,b=o,O=a,A=i,w=s,D=c,_=u;for(p=0;p<16;p++)v=l+4*p,f[p]=(255&e[v])<<24|(255&e[v+1])<<16|(255&e[v+2])<<8|255&e[v+3];for(p=16;p<64;p++)y=((h=f[p-2])>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,m=((h=f[p-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,f[p]=(y+f[p-7]|0)+(m+f[p-16]|0)|0;for(p=0;p<64;p++)y=(((A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7))+(A&w^~A&D)|0)+(_+(n[p]+f[p]|0)|0)|0,m=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&E^g&b^E&b)|0,_=D,D=w,w=A,A=O+y|0,O=b,b=E,E=g,g=y+m|0;t=t+g|0,r=r+E|0,o=o+b|0,a=a+O|0,i=i+A|0,s=s+w|0,c=c+D|0,u=u+_|0,l+=64,d-=64}}l(e);var d,h=e.length%64,p=e.length/536870912|0,v=e.length<<3,y=h<56?56:120,m=e.slice(e.length-h,e.length);for(m.push(128),d=h+1;d>>24&255),m.push(p>>>16&255),m.push(p>>>8&255),m.push(p>>>0&255),m.push(v>>>24&255),m.push(v>>>16&255),m.push(v>>>8&255),m.push(v>>>0&255),l(m),[t>>>24&255,t>>>16&255,t>>>8&255,t>>>0&255,r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function u(e,n,t){e=e.length<=64?e:c(e);var r,o=64+n.length+4,a=new Array(o),i=new Array(64),s=[];for(r=0;r<64;r++)a[r]=54;for(r=0;r=o-4;e--){if(a[e]++,a[e]<=255)return;a[e]=0}}for(;t>=32;)u(),s=s.concat(c(i.concat(c(a)))),t-=32;return t>0&&(u(),s=s.concat(c(i.concat(c(a))).slice(0,t))),s}function f(e,n,t,r){var o,a,i=e[0]^n[t++],s=e[1]^n[t++],c=e[2]^n[t++],u=e[3]^n[t++],f=e[4]^n[t++],l=e[5]^n[t++],d=e[6]^n[t++],h=e[7]^n[t++],p=e[8]^n[t++],v=e[9]^n[t++],y=e[10]^n[t++],m=e[11]^n[t++],g=e[12]^n[t++],E=e[13]^n[t++],b=e[14]^n[t++],O=e[15]^n[t++],A=i,w=s,D=c,_=u,T=f,S=l,N=d,I=h,x=p,C=v,R=y,P=m,k=g,M=E,F=b,L=O;for(a=0;a<8;a+=2)A^=(o=(k^=(o=(x^=(o=(T^=(o=A+k)<<7|o>>>25)+A)<<9|o>>>23)+T)<<13|o>>>19)+x)<<18|o>>>14,S^=(o=(w^=(o=(M^=(o=(C^=(o=S+w)<<7|o>>>25)+S)<<9|o>>>23)+C)<<13|o>>>19)+M)<<18|o>>>14,R^=(o=(N^=(o=(D^=(o=(F^=(o=R+N)<<7|o>>>25)+R)<<9|o>>>23)+F)<<13|o>>>19)+D)<<18|o>>>14,L^=(o=(P^=(o=(I^=(o=(_^=(o=L+P)<<7|o>>>25)+L)<<9|o>>>23)+_)<<13|o>>>19)+I)<<18|o>>>14,A^=(o=(_^=(o=(D^=(o=(w^=(o=A+_)<<7|o>>>25)+A)<<9|o>>>23)+w)<<13|o>>>19)+D)<<18|o>>>14,S^=(o=(T^=(o=(I^=(o=(N^=(o=S+T)<<7|o>>>25)+S)<<9|o>>>23)+N)<<13|o>>>19)+I)<<18|o>>>14,R^=(o=(C^=(o=(x^=(o=(P^=(o=R+C)<<7|o>>>25)+R)<<9|o>>>23)+P)<<13|o>>>19)+x)<<18|o>>>14,L^=(o=(F^=(o=(M^=(o=(k^=(o=L+F)<<7|o>>>25)+L)<<9|o>>>23)+k)<<13|o>>>19)+M)<<18|o>>>14;n[r++]=e[0]=A+i|0,n[r++]=e[1]=w+s|0,n[r++]=e[2]=D+c|0,n[r++]=e[3]=_+u|0,n[r++]=e[4]=T+f|0,n[r++]=e[5]=S+l|0,n[r++]=e[6]=N+d|0,n[r++]=e[7]=I+h|0,n[r++]=e[8]=x+p|0,n[r++]=e[9]=C+v|0,n[r++]=e[10]=R+y|0,n[r++]=e[11]=P+m|0,n[r++]=e[12]=k+g|0,n[r++]=e[13]=M+E|0,n[r++]=e[14]=F+b|0,n[r++]=e[15]=L+O|0}function l(e,n,t,r,o){for(;o--;)e[n++]=t[r++]}function d(e,n,t,r,o){for(;o--;)e[n++]^=t[r++]}function h(e,n,t,r,o){l(e,0,n,t+16*(2*o-1),16);for(var a=0;a<2*o;a+=2)f(e,n,t+16*a,r+8*a),f(e,n,t+16*a+16,r+8*a+16*o)}function p(e,n,t){return e[n+16*(2*t-1)]}function v(e){for(var n=[],t=0;t127&&r<2048?(n.push(r>>6|192),n.push(63&r|128)):(n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128))}return n}if(t<1||t>31)throw new Error("scrypt: logN not be between 1 and 31");var y,m,g,E,b=1<>>0;if(1*r>=1<<30||r>16777216||r>8388608||b>16777216/r)throw new Error("scrypt: parameters are too large");"string"==typeof e&&(e=v(e)),"string"==typeof n&&(n=v(n)),"undefined"!=typeof Int32Array?(y=new Int32Array(64*r),m=new Int32Array(32*b*r),E=new Int32Array(16)):(y=[],m=[],E=new Array(16)),g=u(e,n,128*r);var O=32*r;function A(){for(var e=0;e<32*r;e++){var n=4*e;y[0+e]=(255&g[n+3])<<24|(255&g[n+2])<<16|(255&g[n+1])<<8|255&g[n+0]}}function w(e,n){for(var t=e;t>>0&255,g[4*e+1]=n>>>8&255,g[4*e+2]=n>>>16&255,g[4*e+3]=n>>>24&255}}var T="undefined"!=typeof setImmediate?setImmediate:setTimeout;function S(e,n,t,r,o){!function a(){T(function(){r(e,e+t>>18&63]),o.push(t[n>>>12&63]),o.push(t[n>>>6&63]),o.push(t[n>>>0&63]);return r%3>0&&(o[o.length-1]="=",r%3==1&&(o[o.length-2]="=")),o.join("")}(t):"hex"===n?function(e){for(var n="0123456789abcdef".split(""),t=e.length,r=[],o=0;o>>4&15]),r.push(n[e[o]>>>0&15]);return r.join("")}(t):t}"function"==typeof a&&(s=i,i=a,a=1e3),a<=0?(A(),w(0,b),D(0,b),_(),i(N(s))):(A(),S(0,b,2*a,w,function(){S(0,b,2*a,D,function(){_(),i(N(s))})}))}}(Ne)),Ne.exports)))}(Se)),Se.exports}var xe,Ce,Re,Pe=Ie(),ke=n({__proto__:null,default:r(Pe)},[Pe]),Me={exports:{}},Fe={exports:{}},Le={exports:{}},He={exports:{}};function je(){return xe||(xe=1,function(e){e.exports&&(e.exports={whenRealtimeSyncs:function(e,n){"function"==typeof e.getAuthDoc?setTimeout(function(){e.getAuthDoc()!==e.getUserDoc()?e.onSettle(n):n()},0):console.error("improper use of this function")}})}(He)),He.exports}function Ke(){return Ce||(Ce=1,function(e){(()=>{const n=(e,n,t)=>{let r=globalThis;var o={setCustomize:()=>{}},a=function(e){try{return JSON.parse(JSON.stringify(e))}catch(e){return}};return o.init=function(o,i,s){var c=o.loggedIn,u=o.sharedFolder,f=o.readOnly,l=o.Messages||{},d=i.ROOT,h=i.FILES_DATA,p=i.STATIC_DATA,v=i.OLD_FILES_DATA,y=i.UNSORTED,m=i.TRASH,g=i.TEMPLATE,E=i.SHARED_FOLDERS,b=i.SHARED_FOLDERS_TEMP,O=i.debug;let A={};i._setReadOnly=function(e){(f=e)||i.fixFiles()},i.setHref=function(e,t,r){(t||e)&&(f||(t?[t]:i.findChannels([e])).forEach(function(e){var t=i.getFileData(e,!0);if(i.getHref(t)===r)return;t.href=i.cryptor.encrypt(r);const o=n.parsePadUrl(r);if("form"!==o.type)return;const a=n.getSecrets(o.type,o.hash,t.password);t.roHref="/"+o.type+"/#"+n.getViewHashFromKeys(a)}))},i.setPadAttribute=function(e,n,t,r){if(r=r||function(){},f)r("EFORBIDDEN");else{var o=i.getIdFromHref(e);if(o)if(n&&n.trim()){var s=i.getFileData(o,!0);"href"===n?i.setHref(null,o,t):s[n]=a(t),r(null)}else r("E_INVAL_ATTR");else r("E_INVAL_HREF")}},i.getPadAttribute=function(e,n,t){t=t||function(){};var r=i.getIdFromHref(e);if(r){var o=i.getFileData(r);t(null,a(o[n]))}else t(null,void 0)},i.pushData=function(n,t){if("function"!=typeof t&&(t=function(){}),f)t("EFORBIDDEN");else{var r=e.createRandomInteger(),o=a(n);o.href&&-1!==o.href.indexOf("#")&&(o.href=i.cryptor.encrypt(o.href)),s[h][r]=o,t(null,r)}},i.pushLink=function(n,t){if("function"!=typeof t&&(t=function(){}),f)t("EFORBIDDEN");else{var r=e.createRandomInteger(),o=a(n);s[p][r]=o,t(null,r)}},i.pushSharedFolder=function(n,t){if("function"!=typeof t&&(t=function(){}),f)t("EFORBIDDEN");else{var r,u=a(n);if(Object.keys(s[E]).some(function(e){if(s[E][e].channel===u.channel)return u.href&&!s[E][e].href&&(s[E][e].href=u.href),r=e,!0}))t("EEXISTS",r);else if(c&&!o.testMode){var l=e.createRandomInteger();u.href&&-1!==u.href.indexOf("#")&&(u.href=i.cryptor.encrypt(u.href)),s[E][l]=u,t(null,l)}else t("EAUTH")}},i.deprecateSharedFolder=function(e,n){if(!f){var t=s[E][e];if(t){if(!(!t.href||-1===i.cryptor.decrypt(t.href).indexOf("#")))(s[b][e]=JSON.parse(JSON.stringify(t))).legacy="PASSWORD_CHANGE"!==n;var r=i.findFile(Number(e));i.delete(r,null,!0),delete s[E][e]}}};var w=function(e){f||delete s[h][e]};i.checkDeletedFiles=function(e){if(c||o.testMode)if(f)e("EFORBIDDEN");else{var t=i.getFiles([d,"hrefArray",m]),r=[];i.getFiles([h,E,p]).forEach(function(e){if(-1===t.indexOf(e)){var a=i.isSharedFolder(e)?s[E][e]:i.getFileData(e),c=a.channel;a.lastVersion&&r.push(n.hrefToHexChannelId(a.lastVersion)),a.rtChannel&&r.push(a.rtChannel),c&&r.push(c),i.isSharedFolder(e)?(delete s[E][e],o.removeProxy&&o.removeProxy(e)):s[p][e]?delete s[p][e]:w(e)}}),r.length?e(null,r):e()}else e()};i.deleteMultiplePermanently=function(e,n,t){if(f)t("EFORBIDDEN");else{var r=e.filter(function(e){return i.isPathIn(e,[h])});if(!c&&!o.testMode)return r.forEach(function(e){var n=e[1];n&&w(n)}),void t();var a=e.filter(function(e){return i.isPathIn(e,["hrefArray"])}),u=e.filter(function(e){return i.isPathIn(e,[d])}),l=e.filter(function(e){return i.isPathIn(e,[m])}),p=[];a.forEach(function(e){var n=i.find(e);p.push({root:e[0],id:n})}),function(e){f||e.forEach(function(e){var n=s[e.root].indexOf(e.id);s[e.root].splice(n,1)})}(p),u.forEach(function(e){var n=e.slice(),t=n.pop();delete i.find(n)[t]});var v,y=[];l.forEach(function(e){var n=e.slice(),t=n.pop(),r=i.find(n);4!==e.length?delete r[t]:y.push({name:e[1],el:r})}),v=y,f||v.forEach(function(e){var n=s[m][e.name].indexOf(e.el);s[m][e.name].splice(n,1)}),n?t():i.checkDeletedFiles(t)}},i.copyFromOtherDrive=function(e,t,r,o){if(!f){var a=[];if(Object.keys(r).forEach(function(e){e=Number(e);var n=r[e];if(n.static)return delete n.static,void(s[p][e]=n);n.href&&(n.href=i.cryptor.encrypt(n.href));var t=!1;for(var o in s[h])if(s[h][o].channel===n.channel){s[h][o].href||(s[h][o].href=n.href),t=!0;break}t?a.push(e):s[h][e]=n}),i.isFile(t)&&-1!==a.indexOf(t))i.log(l.sharedFolders_duplicate);else{if(i.isFolder(t)){var c=function(e){for(var n in e)i.isFile(e[n])?-1!==a.indexOf(e[n])&&(i.log(l.sharedFolders_duplicate),delete e[n]):i.isFolder(e[n])&&c(e[n])};c(t)}var u=i.find(e),d=i.isFile(t)?n.createChannelId():o;if(i.isFolder(t)&&d!==l.fm_newFolder&&void 0!==u[d])throw{error:"E_DUPLICATE_FOLDER_NAME",folderName:d,message:l.fo_unavailableName};var v=i.getAvailableName(u,d);Array.isArray(u)?u.push(t):u[v]=t}}};i.copyElement=function(e,t){if(!f&&!i.comparePath(e,t)){var r=i.find(e),o=i.find(t);if(i.isPathIn(t,[m])){if(!e||e.length<2||e[0]===m)return void O("Can't move an element from the trash to the trash: ",e);var a=e[e.length-1],c=i.isPathIn(e,["hrefArray"])?i.getTitle(r):a,u=e.slice();return u.pop(),function(e,n,t){if(!f){var r=s[m];void 0===r[e]&&(r[e]=[]);var o={element:n,path:t};r[e].push(o)}}(c,r,u),!0}if(i.isPathIn(t,["hrefArray"])){if(i.isFolder(r))return void i.log(l.fo_moveUnsortedError);if(e[0]===t[0])return;var d=t[0];return-1===s[d].indexOf(r)&&s[d].push(r),!0}var h=i.isFile(r)?i.getAvailableName(o,n.createChannelId()):i.isInTrashRoot(e)?e[1]:e.pop();return void 0!==o[h]?{error:"E_DUPLICATE_FOLDER_NAME",folderName:h,message:l.fo_unavailableName}:(o[h]=r,!0)}},i.forget=function(e){if(!f){var n=i.getIdFromHref(e);if(n){if(!c&&!o.testMode)return w(n),!0;var t=i.findFile(n);return i.move(t,[m]),!0}}},i.restoreHref=function(e){if(!f){var n=i.getIdFromHref(e);if(n&&i.isFile(n)){var t=i.findFile(n),r=!0;t.forEach(function(e){e[0]!==m?r=!1:i.delete(e,null,!0)}),r&&i.add(n)}}},i.add=function(e,t){if(!f&&(c||o.testMode)){e=Number(e);var r=s[h][e]||s[p][e]||s[E][e];if(r&&"object"==typeof r){var a,u=t;if(t&&!Array.isArray(t)&&(u=decodeURIComponent(t).split(",")),t&&i.isPathIn(u,["hrefArray"]))(a=i.find(u)).push(e);else if(-1!==i.getFiles([d,m,"hrefArray"]).indexOf(e)||u||(u=[d]),t&&i.isPathIn(u,[d])){if(a=i.find(u)){var l=i.getAvailableName(a,n.createChannelId());return void(a[l]=e)}a=i.find([d]),u.slice(1).forEach(function(e){a=a[e]=a[e]||{}}),a[n.createChannelId()]=e}}}},i.setFolderData=function(e,t,r,o){if(!f){var a=i.find(e);if(i.isFolder(a)&&!i.isSharedFolder(a)){if(!i.hasFolderData(a))a["000"+n.createChannelId().slice(0,-3)]={metadata:!0};i.getFolderData(a)[t]=r,o()}}};var D=function(e){i.rt?(i.rt.sync(),t.whenRealtimeSyncs(i.rt,e)):r.setTimeout(e,1e3)};return i.migrateReadOnly=function(e){if(!f&&o.editKey)if(s.version>=2)e();else{s.migrateRo=1;D(function(){var n=JSON.parse(JSON.stringify(s));i.reencrypt(o.editKey,o.editKey,n),setTimeout(function(){s.version>=2?e():(Object.keys(n).forEach(function(e){s[e]=n[e]}),s.version=2,delete s.migrateRo,D(e))},1e3)})}else e({error:"EFORBIDDEN"})},i.migrate=function(t){if(f)t();else{!function(){if(s[y]&&s[v]){O("UNSORTED still exists in the object, removing it...");var e=s[y];0!==e.length?(e.forEach(function(e){"string"==typeof e&&(0===s[v].filter(function(n){return n.href===e}).length&&s[v].push({href:e}))}),delete s[y]):delete s[y]}}(),function(t){if(s[v])try{O("Migrating file system..."),s.migrate=1;D(function(){var r=s[v].slice();s[h]||(s[h]={});var o=s[h];r.forEach(function(t){if(t&&t.href){var r=t.href,a=e.createRandomInteger(),s=i.findFile(r),c=t,u=n.createChannelId();o[a]=c||{href:r},s.forEach(function(e){var n=e.slice(),t=n.pop(),r=i.find(n);if(i.isInTrashRoot(e))return r.element=a,void(o[a].filename=e[1]);i.isPathIn(e,["hrefArray"])?r[t]=a:(r[u]=a,o[a].filename=t,delete r[t])})}}),delete s[v],delete s.migrate,t()})}catch(e){console.error(e),t()}else t()}(t)}},i.fixFiles=function(t){if(!f){t&&(O=function(){});var r=+new Date;O("Cleaning file system...");var a=JSON.stringify(s),l=function(t){"object"!=typeof s[d]&&(O("ROOT was not an object"),s[d]={});var r=t||s[d];if(!r)return console.error("Invalid element in root");var o,a=0,c=s[p],u=s[h];for(var f in r)if(null!==(o=r[f]))if(i.isFolderData(o))0!==a&&(O("Multiple metadata files in folder"),delete r[f]),a++;else if(i.isFile(o,!0)||i.isFolder(o))if(i.isFolder(o))l(o);else{if("string"==typeof o){var v=e.createRandomInteger(),y=n.createChannelId();u[v]={href:i.cryptor.encrypt(o),filename:f},r[y]=v,delete r[f]}if("number"==typeof o)u[o]||c[o]||(O("An element in ROOT doesn't have associated data",o,f),delete r[f])}else O("An element in ROOT was not a folder nor a file. ",o),delete r[f];else console.error("element[%s] is null",f),delete r[f]};e.isObject(s[p])||(O("STATIC_DATA was not an object"),s[p]={}),l(),function(){if(!u){"object"!=typeof s[m]&&(O("TRASH was not an object"),s[m]={});var n,t=s[m],r=function(t,r,o){if("object"==typeof t){if(!i.isSharedFolder(t.element))if(i.isFile(t.element,!0)||i.isFolder(t.element))if(Array.isArray(t.path)){if("string"==typeof t.element){var a=e.createRandomInteger();s[h][a]={href:i.cryptor.encrypt(t.element),filename:o},t.element=a}if(i.isFolder(t.element)&&l(t.element),"number"==typeof t.element)s[h][t.element]||s[p][t.element]||(O("An element in TRASH doesn't have associated data",t.element,o),n.push(r))}else n.push(r);else n.push(r)}else n.push(r)};for(var o in t)if(Array.isArray(t[o]))if(0===t[o].length)O("Empty array in TRASH root. ",t[o]),delete t[o];else{n=[];for(var a=0;a=0;c--)t[o].splice(n[c],1)}else O("An element in TRASH root is not an array. ",t[o]),delete t[o]}}(),function(){if(!u){Array.isArray(s[g])||(O("TEMPLATE was not an array"),s[g]=[]);var n=e.deduplicateString(s[g]);n.length!==s[g].length&&(s[g]=n);var t=s[g],r=i.getFiles([d]),o=[];t.forEach(function(n,a){if(i.isFile(n,!0)&&-1===r.indexOf(n)){if("string"==typeof n){var c=e.createRandomInteger();return s[h][c]={href:i.cryptor.encrypt(n)},void(t[a]=c)}if("number"==typeof n)s[h][n]||(O("An element in TEMPLATE doesn't have associated data",n),o.push(n))}else o.push(n)}),o.forEach(function(e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)})}}(),function(){"object"!=typeof s[h]&&(O("FILES_DATA was not an object"),s[h]={});var e=s[h],t=i.getFiles([d,m,"hrefArray"]),r=i.find([d]),a=[];for(var u in e)if(String(u)===String(Number(u))){var l=e[u=Number(u)];if(l&&"object"==typeof l)if(l.href||l.roHref){var v;try{v=l.href&&(-1!==l.href.indexOf("#")?l.href:i.cryptor.decrypt(l.href))}catch(e){}if(!v||-1!==v.indexOf("#")){var y,g=n.parsePadUrl(v||l.roHref);if(g.hash)if(g.type){if(v&&"pad"===g.hashData.type&&g.hashData.version)if("view"===g.hashData.mode)l.roHref=v,delete l.href;else if(l.roHref){var E=n.parsePadUrl(l.roHref);E.hash&&E.type||(y=n.getSecrets(g.type,g.hash,l.password),l.roHref="/"+g.type+"/#"+n.getViewHashFromKeys(y))}else y=n.getSecrets(g.type,g.hash,l.password),l.roHref="/"+g.type+"/#"+n.getViewHashFromKeys(y);if(0===g.hashData.version&&delete l.roHref,v&&"/"!==v.slice(0,1)&&(l.href=i.cryptor.encrypt(n.getRelativeHref(v))),l.ctime||(l.ctime=l.atime),l.title||(l.title=i.getDefaultName(g)),!l.channel)try{y||(y=n.getSecrets(g.type,g.hash,l.password)),l.channel=y.channel,console.log(l),O("Adding missing channel in filesData ",l.channel)}catch(e){console.error(e)}if(n.isValidChannel(l.channel)||console.error("Remove invalid channel",l.channel,l),["sheet","doc","presentation"].includes(g.type)&&!l.rtChannel&&(A[l.channel]=l),!c&&!o.testMode||-1!==t.indexOf(u));else O("An element in filesData was not in ROOT, TEMPLATE or TRASH.",u,l),r[n.createChannelId()]=u}else O("Removing an element in filesData with a invalid type.",l),a.push(u);else O("Removing an element in filesData with a invalid href.",l),a.push(u)}}else O("Removing an element in filesData with a missing href.",l),a.push(u);else O("An element in filesData was not an object.",l),a.push(u)}else O("Invalid file ID in filesData.",u),a.push(u);a.forEach(function(e){w(e)});var b=s[p],D=[];for(var _ in b){var T=b[_=Number(_)];T&&"object"==typeof T&&T.href?!c&&!o.testMode||-1!==t.indexOf(_)||D.push(_):D.push(_)}D.forEach(function(e){f||delete s[p][e]})}(),Object.keys(s).forEach(function(e){"/"===e.slice(0,1)&&delete s[e]}),function(){if(!u){"object"!=typeof s[E]&&(O("SHARED_FOLDER was not an object"),s[E]={});var e,t,r=s[E],o=i.getFiles([d,m]),a=i.find([d]);for(var c in r){var f;t=r[c],c=Number(c);try{f=t.href&&(-1!==t.href.indexOf("#")?t.href:i.cryptor.decrypt(t.href))}catch(e){}if((e=n.parsePadUrl(f||t.roHref))&&e.hash&&"undefined"!==e.hash){if(-1===o.indexOf(c))console.log("missing"+c),a[n.createChannelId()]=c}else delete r[c]}}}(),function(){if(!u){"object"!=typeof s[b]&&(O("SHARED_FOLDER_TEMP was not an object"),s[b]={});var e=s[b],n=s[E];for(var t in e)n[t]&&delete e[t]}}();var v=+new Date-r+"ms";JSON.stringify(s)===a?O("File system was clean.",v):O("Your file system was corrupted. It has been cleaned so that the pads you visit can be stored safely.",v)}},i.getMissingRtChannel=()=>{const e=A;if(A={},!f&&Object.keys(e).length)return e},i},o};e.exports&&(e.exports=n(Z(),te(),je()))})()}(Le)),Le.exports}function Ue(){return Re||(Re=1,function(e){(()=>{const n=(e,n,t,r,o,a={})=>{let i=globalThis;var s={setCustomize:e=>{a=e.Messages,r.setCustomize(e)}},c=s.ROOT="root",u=s.UNSORTED="unsorted",f=s.TRASH="trash",l=s.TEMPLATE="template",d=s.SHARED_FOLDERS="sharedFolders",h=s.SHARED_FOLDERS_TEMP="sharedFoldersTemp",p=s.FILES_DATA=t.storageKey,v=s.OLD_FILES_DATA=t.oldStorageKey,y=s.STATIC_DATA="static";s.getDefaultName=function(e){var n=e.type;return a.type[n]+" - "+function(){if(i.Intl&&i.Intl.DateTimeFormat)return new i.Intl.DateTimeFormat(void 0,{weekday:"short",year:"numeric",month:"long",day:"numeric"}).format(new Date);return(new Date).toString().split(" ").slice(0,4).join(" ")}()};var m=s.createCryptor=function(e){var n={};if(!e)return n.encrypt=function(e){return e},n.decrypt=function(e){return e},n;try{var t=o.createEncryptor(e);n.encrypt=function(e){try{return"/file/#"===e.slice(0,7)?e:t.encrypt(e)}catch(e){return}},n.decrypt=function(e){try{return t.decrypt(e)}catch(e){return}}}catch(e){console.error(e)}return n};return s.getHref=function(e,n){if(e.href&&-1!==e.href.indexOf("#"))return e.href;if(e.href&&n){var t=n.decrypt(e.href);if(t&&-1!==t.indexOf("#"))return t}return e.roHref},s.reencrypt=function(e,n,t){if(t){var r=m(e),o=m(n);Object.keys(t[p]).forEach(function(e){var n=t[p][e]||{};if(n.href&&n.roHref&&!n.fileType){var a=n.href&&-1===n.href.indexOf("#")?r.decrypt(n.href):n.href;if(!a)return;n.href=o.encrypt(a)}}),Object.keys(t[d]||{}).forEach(function(e){var n=t[d][e]||{};if(n.href){var a=n.href&&-1===n.href.indexOf("#")?r.decrypt(n.href):n.href;if(!a)return;n.href=o.encrypt(a)}}),Object.keys(t[h]||{}).forEach(function(e){var n=t[h][e]||{};if(n.href){var a=n.href&&-1===n.href.indexOf("#")?r.decrypt(n.href):n.href;if(!a)return;n.href=o.encrypt(a)}})}else console.error("Nothing to reencrypt")},s.init=function(t,o){var i={};i.cryptor=m(o.editKey),i.setReadOnly=function(e,n){o.editKey=n,i.cryptor=m(n),i.cryptor.k=Math.random(),i.readOnly=e,i._setReadOnly&&i._setReadOnly(e)},i.readOnly=o.readOnly,i.reencrypt=s.reencrypt,i.getDefaultName=s.getDefaultName;var g=o.sframeChan,E=a.fm_newFolder||"New folder",b=a.fm_newFile||"New file";i.ROOT=c,i.STATIC_DATA=y,i.UNSORTED=u,i.TRASH=f,i.TEMPLATE=l,i.SHARED_FOLDERS=d,i.SHARED_FOLDERS_TEMP=h,i.FILES_DATA=p,i.OLD_FILES_DATA=v;var O=i.sharedFolder=o.sharedFolder;i.id=o.id;var A=function(){console.debug.apply(console,arguments)},w=i.log=o.log||A,D=o.logError||A,_=i.debug=o.debug||A;i.fixFiles=function(){};var T=i.error=function(){g?g.query("Q_DRIVE_USEROBJECT",{cmd:"fixFiles",data:{}},function(){}):("function"==typeof i.fixFiles&&i.fixFiles(),console.error.apply(console,arguments),i.fixFiles())};o.outer&&r.init(o,i,t),i.getStructure=function(){var e={};return e[c]={},e[f]={},e[p]={},e[l]=[],e[d]={},e};var S=i.getHref=function(e){return s.getHref(e,i.cryptor)},N=function(e){return null===e?"null":Array.isArray(e)?"array":typeof e};i.isValidDrive=function(e){var n=i.getStructure();return"object"==typeof e&&Object.keys(n).every(function(t){return e[t]&&N(n[t])===N(e[t])})};var I=function(){return[l]},x=function(e,n){return e===n},C=i.isSharedFolder=function(e){return!O&&Boolean(t[d]&&t[d][e])},R=i.isFile=function(e,n){return!C(e)&&("number"==typeof e||(void 0!==t[v]||n)&&"string"==typeof e)},P=i.isFolderData=function(e){return"object"==typeof e&&!0===e.metadata};i.isReadOnlyFile=function(e){if(!R(e))return!1;var n=i.getFileData(e);return n.roHref?Boolean(n.roHref&&!n.href):void 0},i.isStaticFile=function(e){return Boolean(t[y]&&t[y][e])};var k=i.isFolder=function(e){return!P(e)&&("object"==typeof e&&!e.channel||C(e))};i.isFolderEmpty=function(e){return!!k(e)&&(0===Object.keys(e).length||!(1!==Object.keys(e).length||!P(e[Object.keys(e)[0]])))},i.hasSubfolder=function(e,n){if(!k(e))return!1;var t=0,r=function(e){t+=k(e.element)?1:0};for(var o in e)n?Array.isArray(e[o])&&e[o].forEach(r):t+=k(e[o])?1:0;return t},i.hasFile=function(e,n){if(!k(e))return!1;var t=0,r=function(e){t+=R(e.element)?1:0};for(var o in e)n?Array.isArray(e[o])&&e[o].forEach(r):t+=R(e[o])?1:0;return t},i.hasFolderData=function(e){for(var n in e)if(P(e[n]))return!0};var M=i.hasSubSharedFolder=function(e){for(var n in e){if(C(e[n]))return!0;if(k(e[n])&&M(e[n]))return!0}return!1},F=i.getFileData=function(n,r){if(n){var a,s;try{a=(t[y]||{})[n]}catch(e){console.error(e)}if(a){var c=r?a:e.clone(a);return r||(c.static=!0),c}try{s=t[p][n]||{}}catch(e){console.error(e),s={}}if(!r&&(s=JSON.parse(JSON.stringify(s))).href&&-1===s.href.indexOf("#"))if(o.editKey)try{s.href=i.cryptor.decrypt(s.href)}catch(e){delete s.href}else delete s.href;return s}};i.getFolderData=function(e){for(var n in e)if(P(e[n]))return e[n];return{}};var L=i.getTitle=function(e,n){if(C(e))return"??";var t=F(e);if(t){if(t.static)return t.name;if(e&&(t.href||t.roHref))return"title"===n?t.title:"name"===n?t.filename:t.filename||t.title||b;T("getTitle called with a non-existing file id: ",e,t)}else T("unable to retrieve data about the requested file: ",e,t)},H=i.comparePath=function(e,n){if(!(e&&n&&Array.isArray(e)&&Array.isArray(n)))return!1;if(e.length!==n.length)return!1;for(var t=!0,r=e.length-1;t&&r>=0;)t=e[r]===n[r],r--;return t},j=i.isSubpath=function(e,n){var t=n.slice(),r=e.slice(0,t.length);return H(t,r)},K=i.isPathIn=function(e,n){if(n){var t=n.indexOf("hrefArray");return-1!==t&&(n.splice(t,1),n=n.concat(I())),n.some(function(n){return Array.isArray(e)&&e[0]===n})}},U=i.isInTrashRoot=function(e){return e[0]===f&&4===e.length},B=function(e,n){if(n){if(0===n.length)return e;var t=n.slice(),r=t.shift();if(void 0!==e[r])return B(e[r],t);_("Unable to find the key '"+r+"' in the root object provided:",e)}else T("Invalid path:\n",n,"\nin root\n",e)},V=i.find=function(e){return B(t,e)},Y=i.getFilesRecursively=function(e,n){for(var t in n=n||[],e)R(e[t])||C(e[t])?-1===n.indexOf(e[t])&&n.push(e[t]):P(e[t])||Y(e[t],n);return n},G={array:function(e){return t[e]||(t[e]=[]),t[e].slice()}};I().forEach(function(e){G[e]=function(){return G.array(e)}}),G.hrefArray=function(){var n=[];return O?n:(I().forEach(function(e){n=n.concat(G[e]())}),e.deduplicateString(n))},G[c]=function(){var e=[];return Y(t[c],e),e},G[f]=function(){var e=t[f],n=[],r=function(e){R(e.element)||C(e.element)?-1===n.indexOf(e.element)&&n.push(e.element):Y(e.element,n)};for(var o in e){if(!Array.isArray(e[o]))return void T("Trash contains a non-array element");e[o].forEach(r)}return n},G[v]=function(){var e=[];return t[v]?(t[v].forEach(function(n){n.href&&-1===e.indexOf(n.href)&&e.push(n.href)}),e):e},G[y]=function(){return t[y]?Object.keys(t[y]).map(Number).filter(Boolean):[]},G[p]=function(){return t[p]?Object.keys(t[p]).map(Number).filter(Boolean):[]},G[d]=function(){return t[d]?Object.keys(t[d]).map(Number).filter(Boolean):[]};var J=i.getFiles=function(n){var t=[];return n&&n.length||(n=[c,"hrefArray",f,v,p,d]),n.forEach(function(e){"function"==typeof G[e]&&(t=t.concat(G[e]()))}),e.deduplicateString(t)},q=i.getIdFromHref=function(e){var r,o=function(e){if(e)return n.parsePadUrl(e).getUrl().replace(/\/p\/?/,"/")},a=o(e);return J([p]).some(function(e){if(o(S(t[p][e]))===a||o(t[p][e].roHref)===a)return r=e,!0}),r};i.getSFIdFromHref=function(e){var r,o=function(e){if(e)return n.parsePadUrl(e).getUrl().replace(/\/p\/?/,"/")},a=o(e);return J([d]).some(function(e){if(o(S(t[d][e]))===a||o(t[d][e].roHref)===a)return r=e,!0}),r};var W=function(e,n){if(!K(e,[c,f]))return[];n=Array.isArray(n)?n:[n];var t={},r=V(e),o=function(e){Object.keys(e).forEach(n=>{t[n]||=[],Array.prototype.push.apply(t[n],e[n])})};if(R(r)||C(r))return n.some(n=>{x(n,r)&&(t[n]||=[],t[n].push(e))}),t;if(k(r))for(var a in r){let t=e.slice();t.push(a),o(W(t,n))}return t},z=function(e,n){if(O)return{};if(!t[e])return{};var r=t[e].slice(),o={},a=-1;return n.forEach(n=>{for(;-1!==(a=r.indexOf(n,a+1));)o[n]||=[],o[n].push([e,a])}),o},Q=function(e,n){if(O)return[];var t=V(e),r={},o=function(e){Object.keys(e).forEach(n=>{r[n]||=[],Array.prototype.push.apply(r[n],e[n])})};if(1===e.length&&"object"==typeof t&&Object.keys(t).forEach(function(r){var a=t[r];if(Array.isArray(a)){var i=e.slice();i.push(r),o(Q(i,n))}}),2===e.length){if(!Array.isArray(t))return[];t.forEach(function(t,a){var i=e.slice();i.push(a),i.push("element"),R(t.element)?n.some(e=>{x(e,t.element)&&(r[e]||=[],r[e].push(i))}):o(Q(i,n))})}return e.length>=4&&o(W(e,n)),r},Z=i.findFiles=function(e){var n=W([c],e),t=z(l,e),r=Q([f],e);let o={};return e.forEach(e=>{o[e]=[]}),[n,t,r].forEach(e=>{Object.keys(e).forEach(n=>{o[n]||=[],Array.prototype.push.apply(o[n],e[n])})}),o},X=i.findFile=function(e){return Z([e])[e]||[]};i.findChannels=function(e,n){var r=t[p],o=t[d],a=[p];return n&&a.push(d),J(a).filter(function(n){var t=r[n]||o[n]||{};return-1!==e.indexOf(t.channel)})},i.search=function(r){if("string"!=typeof r)return[];r=r.trim();var o,a=[],s=t[p],u=t[d],f=r.toLowerCase();/^#/.test(f)&&(o=[f.slice(1).trim()]);J([p,d]).forEach(function(e){var n=s[e]||u[e];if(n)if(Array.isArray(n.tags)&&(t=n.tags,o&&t.length&&(t=t.map(function(e){return e.toLowerCase()}),o.some(function(e){return t.some(function(n){return n===e})}))))a.push(e);else{var t,r=n.title||n.lastTitle;(r&&-1!==r.toLowerCase().indexOf(f)||n.filename&&-1!==n.filename.toLowerCase().indexOf(f))&&a.push(e)}});var l=n.getRelativeHref(r);if(l){var h=q(l);h&&a.push(h)}a=e.deduplicateString(a);var v=[];a.forEach(function(e){v.push({id:e,paths:X(e),data:i.getFileData(e)})});var y=[],m=function(e,n){for(var t in e)k(e[t])&&!C(e[t])&&(-1!==t.toLowerCase().indexOf(f)&&y.push({id:null,paths:[n.concat(t)],data:{title:t}}),m(e[t],n.concat(t)))};return m(t[c],[c]),y=y.sort(function(e,n){return e.data.title.toLowerCase()>n.data.title.toLowerCase()}),v=y.concat(v)},i.getRecentPads=function(){var e=t[p];return Object.keys(e).filter(function(n){return e[n]}).sort(function(n,t){return e[t].atime-e[n].atime}).map(function(e){return Number(e)})},i.getOwnedPads=function(e){var n=t[p];return Object.keys(n).filter(function(t){return n[t].owners&&-1!==n[t].owners.indexOf(e)}).map(function(e){return Number(e)})};var $=i.getAvailableName=function(e,n){if(void 0===e[n])return n;for(var t=n,r=1;void 0!==e[t];)t=n+"_"+r,r++;return t},ee=i.move=function(e,n,t){if(g)g.query("Q_DRIVE_USEROBJECT",{cmd:"move",data:{paths:e,newPath:n}},t);else{var r=[],o=null;e.forEach(function(e){var t=e.slice();if(t.pop(),!H(t,n))if(j(n,e))w(a.fo_moveFolderToChildError);else{var s=i.copyElement(e.slice(),n);!0===s?r.push(e):s&&"E_DUPLICATE_FOLDER_NAME"===s.error&&(o||(o=s))}}),i.delete(r,function(e){e||o?t(e||o):"function"==typeof t&&t()})}};return i.restore=function(e,n){if(g)g.query("Q_DRIVE_USEROBJECT",{cmd:"restore",data:{path:e}},n);else if(U(e)){var t=e.slice();t.pop();var r=V(t).path;ee([e],r,n)}},i.addFolder=function(e,n,t){if(g)g.query("Q_DRIVE_USEROBJECT",{cmd:"addFolder",data:{path:e,name:n}},t);else{var r=V(e),o=n||E;if(o===E||void 0===r[o]){var i=$(r,o);r[i]={};var s=e.slice();s.push(i),t({newPath:s})}else t({error:"E_DUPLICATE_FOLDER_NAME",folderName:o,message:a.fo_unavailableName})}},i.delete=function(e,n,t){g?g.query("Q_DRIVE_USEROBJECT",{cmd:"delete",data:{paths:e,nocheck:t}},n):(n=n||function(){},i.deleteMultiplePermanently(e,t,n))},i.emptyTrash=function(e){e=e||function(){},g?g.query("Q_DRIVE_USEROBJECT",{cmd:"emptyTrash"},e):(t[f]={},i.checkDeletedFiles(e))},i.ownedInTrash=function(e){return J([f]).map(function(n){var r=C(n)?t[d][n]:i.getFileData(n);if(r)return e(r.owners)?r.channel:void 0}).filter(Boolean)},i.rename=function(e,n,r){if(r=r||function(){},g)g.query("Q_DRIVE_USEROBJECT",{cmd:"rename",data:{path:e,newName:n}},r);else if(e.length<=1)D("Renaming `root` is forbidden");else{var o,i=V(e);if(k(i)&&!C(i)){var s=e.slice(),c=s.pop();if(!n||!n.trim()||c===n)return;var u=V(s);return void 0!==u[n]?"function"==typeof r?void r({error:"E_DUPLICATE_FOLDER_NAME",folderName:n,message:a.fo_unavailableName}):void 0:(u[n]=i,delete u[c],void("function"==typeof r&&r()))}if(o=C(i)?t[d][i]:t[p][i]||t[y][i])return t[y][i]?n&&n.trim()?(o.name=n,void r()):void r():n&&""!==n.trim()?void(L(i,"name")!==n&&(o.filename=n,"function"==typeof r&&r())):(delete o.filename,void("function"==typeof r&&r()))}},i.getTagsList=function(){var e,n={},r=function(e){n[e]=n[e]?++n[e]:1};for(var o in t[p])(e=t[p][o]).tags&&Array.isArray(e.tags)&&e.tags.forEach(r);return n},i},s};e.exports&&(e.exports=n(Z(),te(),Y(),Ke(),M(),void 0))})()}(Fe)),Fe.exports}var Be,Ve,Ye,Ge,Je={exports:{}};function qe(){return Be||(Be=1,function(e){e.exports=function(e){var n,t=[],r=[],o=0,a=function(e){return o++,function(){for(e&&e.apply(null,arguments),o=(o||1)-1;!o&&t.length&&!n;)t.shift()(a)}};a.abort=function(){r.forEach(clearTimeout),n=1};var i={nThen:function(e){return n||(o?t.push(e):e(a)),i},orTimeout:function(e,s){if(n)return i;if(!s)throw Error("Must specify milliseconds to orTimeout()");var c,u=setTimeout(function(){for(;t.shift()!==c;);for(e(a),o=(o||1)-1;!o&&t.length;)t.shift()(a)},s);return t.push(c=function(){var e=r.indexOf(u);if(e>-1)return r.splice(e,1),void clearTimeout(u);throw new Error("timeout not listed in array")}),r.push(u),i}};return i.nThen(e)}}(Je)),Je.exports}function We(){if(Ye)return Ve;Ye=1;return Ve=((e,n,t,r,o,a,i,s)=>{var c={},u={};return c.checkMigration=function(e,t,r,o){var a=n.once(n.mkAsync(o));if(t)if(e)if(t.version>=2)a();else if(t.migrateRo){var i,s=!1,c=setInterval(function(){if(t.version>=2)return s=!0,clearTimeout(i),clearInterval(c),void a()},100);i=setTimeout(function(){clearInterval(c),r.migrateReadOnly(function(){s=!0,a()})},2e4);t.on("change",["version"],function(){s||t.version>=2&&(s=!0,clearTimeout(i),clearInterval(c),a())})}else r.migrateReadOnly(a);else a();else a()},c.migrate=function(e){var t=u[e];if(t){var r=t.teams;if(Array.isArray(r)&&r.length){var o=r[0];if(o.secondaryKey){var a=n.find(o,["store","manager","folders",o.id]);a&&a.proxy&&!a.proxy.version&&a.userObject.migrateReadOnly(function(){r.forEach(function(e){n.find(e,["store","manager","folders",e.id,"userObject"]).setReadOnly(!1,e.secondarykey)})})}}}},c.load=function(t,f,l,d){var h=n.once(n.mkAsync(d)),p=t.network,v=t.store,y=t.isNew,m=t.isNewChannel,g=v.id,E=v.handleSharedFolder,b=v.manager.user.userObject.getHref(l),O=e.parsePadUrl(b),A=e.getSecrets("drive",O.hash,l.password);if(!A.keys)return v.manager.deprecateProxy(f),void h(null);var w=A.keys.secondaryKey;o(function(e){t.cache&&r.getChannelCache(A.channel,e(function(n){if("EINVAL"===n)return e.abort(),v.manager.restrictedProxy(f,A.channel),void h(null)}))}).nThen(function(e){m(null,{channel:A.channel},e(function(n){if(n.isNew&&!y)return v.manager.deprecateProxy(f,A.channel,n.reason),e.abort(),void h(null)}))}).nThen(function(){var e=u[A.channel];if(e&&e.readOnly&&w&&c.upgrade(A.channel,A),e&&e.ready&&e.rt)return setTimeout(function(){v.manager.addProxy(f,e.rt,function(){c.leave(A.channel,g)},w),h(e.rt)}),e.teams.push({cb:h,store:v,id:f}),void(E&&E(f,e.rt));if(e&&!e.ready&&e.rt)return e.teams.push({cb:h,store:v,secondaryKey:w,id:f}),void(E&&E(f,e.rt));e=u[A.channel]={teams:[{cb:h,store:v,secondaryKey:w,id:f}],readOnly:!Boolean(w)};var n=l.owners,o={data:{},channel:A.channel,readOnly:!Boolean(w),crypto:a.createEncryptor(A.keys),userName:"sharedFolder",logLevel:1,ChainPad:s,classic:!0,network:p,Cache:r,metadata:{validateKey:A.keys.validateKey||void 0,owners:n},onRejected:t.Store&&t.Store.onRejected},d=e.rt=i.create(o);d.proxy.on("cacheready",function(){e.teams&&(e.teams.forEach(function(n){d.cache=!0,n.store.manager.addProxy(n.id,d,function(){c.leave(A.channel,n.store.id)},n.secondaryKey,t.updatePassword),t.updatePassword=!1,n.cb(e.rt)}),e.ready=!0)}),d.proxy.on("ready",function(){y&&!Object.keys(d.proxy).length&&(d.proxy.version=2),e.teams&&(e.teams.forEach(function(n){d.cache=!1,n.store.manager.addProxy(n.id,d,function(){c.leave(A.channel,n.store.id)},n.secondaryKey,t.updatePassword),n.cb(e.rt)}),e.ready=!0)}),d.proxy.on("error",function(n){if(n&&n.error){if("EDELETED"===n.error){try{e.teams.forEach(function(e){e.store.manager.deprecateProxy(e.id,A.channel,n.message),e.store.handleSharedFolder&&e.store.handleSharedFolder(e.id,null),e.cb()})}catch(e){}return delete u[A.channel],void h()}if("ERESTRICTED"===n.error)return e.teams.forEach(function(e){e.store.manager.restrictedProxy(e.id,A.channel),e.cb()}),delete u[A.channel],void h()}}),E&&E(f,d)})},c.upgrade=function(e,n){var t=u[e];if(t&&t.readOnly&&t.rt.setReadOnly&&n.keys&&n.keys.editKeyStr){var r=a.createEncryptor(n.keys);t.readOnly=!1,t.rt.setReadOnly(!1,r)}},c.leave=function(e,n){var t=u[e];if(t){var r,o=t.teams;if(Array.isArray(o))o.some(function(e,t){if(e.store.id===n)return e.store.handleSharedFolder&&e.store.handleSharedFolder(e.id,null),r=t,!0}),void 0!==r&&(o.splice(r,1),o.length||t.rt&&t.rt.stop&&t.rt.stop())}},c.updatePassword=function(r,a,i,s){var f=a.oldChannel,l=a.href,d=a.password,h=e.parsePadUrl(l),p=e.getSecrets(h.type,h.hash,d),v=u[f];if(v){if(v.rt&&v.rt.stop)try{v.rt.stop()}catch(e){}var y=o;v.teams.forEach(function(e){y=y(function(o){var a=e.store,s=e.id,u=n.find(a.proxy,["drive",t.SHARED_FOLDERS])||{};if(s&&u[s]){var l=JSON.parse(JSON.stringify(u[s]));l.password=d,c.load({network:i,store:a,updatePassword:!0,Store:r,isNewChannel:r.isNewChannel},s,l,o()),a.rpc&&(a.rpc.unpin([f],o()),a.rpc.pin([p.channel],o()))}}).nThen}),y(function(){s()})}else s({error:"ENOTFOUND"})},c.loadSharedFolders=function(e,n,r,a,i,s,u,f){var l=a[t.SHARED_FOLDERS]||{},d=Object.keys(l).length,h=1,p=s();u=u||function(){},o(function(t){Object.keys(l).forEach(function(o){var a=l[o];c.load({network:n,store:r,Store:e,cache:f,isNewChannel:e.isNewChannel},o,a,t(function(){u({progress:h,max:d}),h++}))})}).nThen(function(){setTimeout(p)})},c.isSharedFolderChannel=function(e){return Object.keys(u).includes(e)},c})(te(),Z(),Ue(),fe(),qe(),M(),T(),x()),Ve}function ze(){return Ge||(Ge=1,function(e){(()=>{const n=(e,n,t,r={},o,a,i={})=>{var s=function(n,t,r,o,a,i){if(!n.folders[t]||i||n.folders[t].restricted){var s=function(e){var n={};for(var t in e.cfg)n[t]=e.cfg[t];return n}(n);s.sharedFolder=!0,s.id=t,s.editKey=a,s.rt=r.realtime,s.readOnly=Boolean(!a);var c=e.init(r.proxy,s);c.fixFiles&&c.fixFiles();var u=r.proxy;if(u.metadata&&u.metadata.title){var f=n.user.proxy[e.SHARED_FOLDERS][t];f&&(f.lastTitle=u.metadata.title)}return n.folders[t]={proxy:r.proxy,userObject:c,leave:o,restricted:u.restricted,offline:Boolean(r.cache)},u.on&&(u.on("disconnect",function(){n.folders[t].offline=!0}),u.on("reconnect",function(){n.folders[t].offline=!1})),c}n.folders[t].offline&&!r.cache&&n.Store&&(n.folders[t].offline=!1,n.folders[t].userObject.fixFiles&&n.folders[t].userObject.fixFiles(),n.Store.refreshDriveUI())},c=function(e,n){var t=e.folders[n];t&&(t.leave(),delete e.folders[n])},u=function(t,r,o,a){if(!t.folders[r]||!t.folders[r].deleting){if(t.user.userObject.readOnly){return c(t,r),s(t,r,{proxy:{deprecated:!0}},function(){}),void t.Store.refreshDriveUI()}if(o&&t.unpinPads([o],function(){}),a&&"PASSWORD_CHANGE"!==a){let o=n.find(t,["user","proxy",e.SHARED_FOLDERS]),a=o[r]&&o[r].lastTitle;return a&&((e,n,t)=>{var r=e.store.mailbox;if(r){var o,a=e.cfg.teamId;o=a?e.store.modules.team.getTeamsData()[a]:e.Store.getMetadata(null,null,()=>{}).user,r.sendTo("SF_DELETED",{sfId:n,team:a,title:t},{curvePublic:o.curvePublic,channel:o.notifications},e=>{console.error(e)})}})(t,r,a),delete o[r],void(t.Store&&t.Store.refreshDriveUI&&t.Store.refreshDriveUI())}t.user.userObject.deprecateSharedFolder(r,a),c(t,r),t.Store&&t.Store.refreshDriveUI&&t.Store.refreshDriveUI()}},f=function(e,n){c(e,n),s(e,n,{proxy:{restricted:!0,root:{},filesData:{}}},function(){}),e.Store.refreshDriveUI()},l=function(e,n){return Array.isArray(n)&&-1!==n.indexOf(e.edPublic)},d=function(e){var n=[e.user.userObject],t=Object.keys(e.folders).map(function(n){return e.folders[n].userObject});return Array.prototype.push.apply(n,t),n},h=function(e,n){var t=d(e),r=e.user.userObject;return t.some(function(e){if(Object.keys(e.getFileData(n)).length)return r=e,!0}),r},p=function(e,n){var t=Number(n.id);if(t)return e.user.userObject.findFile(t)[0]},v=function(n,t,r){var o=[];return n.user.userObject.findChannels([t],!0).forEach(function(t){var a=n.user.proxy[e.SHARED_FOLDERS][t];a&&!r&&(a=JSON.parse(JSON.stringify(a))),a||(a=n.user.userObject.getFileData(t,r)),o.push({id:t,data:a,userObject:n.user.userObject})}),Object.keys(n.folders).forEach(function(e){n.folders[e].userObject.findChannels([t]).forEach(function(t){o.push({id:t,fId:e,data:n.folders[e].userObject.getFileData(t,r),userObject:n.folders[e].userObject})})}),o},y=function(e,n){var t=[],r=e.user.userObject.getIdFromHref(n);return r&&t.push({data:e.user.userObject.getFileData(r),userObject:e.user.userObject}),Object.keys(e.folders).forEach(function(r){var o=e.folders[r].userObject.getIdFromHref(n);o&&t.push({fId:r,data:e.folders[r].userObject.getFileData(o),userObject:e.folders[r].userObject})}),t},m=function(e,n){var t=[],r=d(e);let o={};return r.forEach(function(e){var a=Number(e.id);let i;if(a){i=e.findFile(n);let t=(o[a]||[])[0];if(!t)return;i.forEach(function(e){Array.prototype.unshift.apply(e,t)})}else{let t=[n],a=r.map(e=>+e.id).filter(Boolean);Array.prototype.push.apply(t,a),o=e.findFiles(t),i=o[n]}Array.prototype.push.apply(t,i)}),t},g=function(e,n){var t={},r=d(e);let o={};return r.forEach(function(e){var a=Number(e.id);if(!e.id){let e=r.map(e=>+e.id).filter(Boolean);Array.prototype.push.apply(n,e)}var i=e.findFiles(n);if(e.id||(o=i),a){let e=(o[a]||[])[0];if(!e)return;Object.keys(i).forEach(n=>{i[n].forEach(n=>{Array.prototype.unshift.apply(n,e)})})}Object.keys(i).forEach(e=>{t[e]||=[],Array.prototype.push.apply(t[e],i[e])})}),t},E=function(e,t,r){if(r)return e.user.userObject.findChannels(t);var o=[];return d(e).forEach(function(e){var n=e.findChannels(t);Array.prototype.push.apply(o,n)}),o=n.deduplicateString(o)},b=function(e,n,t){var r=d(e),o={};return r.some(function(e){if((o=e.getFileData(n,t))&&Object.keys(o).length)return!0}),o},O=function(t,r){var o;if(t.isHistoryMode&&!t.folders[r])o=!0;else if(!t.folders[r])return{};var a=o?{}:t.folders[r].proxy;Object.keys(a.metadata||{}).length>1&&(a.metadata={title:a.metadata.title});var i=n.clone(a.metadata||{});for(var s in t.user.proxy[e.SHARED_FOLDERS][r]||{})if(void 0!==t.user.proxy[e.SHARED_FOLDERS][r][s]){var c=n.clone(t.user.proxy[e.SHARED_FOLDERS][r][s]);if("href"===s&&-1===c.indexOf("#"))try{c=t.user.userObject.cryptor.decrypt(c)}catch(e){}"href"===s&&-1===c.indexOf("#")&&(c=void 0),i[s]=c}return i},A=function(e,n){var t,r={id:null,userObject:e.user.userObject,path:n};if(!Array.isArray(n)||n.length<=1)return r;for(var o=e.user.userObject,a=2;a=2?t[1]:t[t.length-1];if(o.isFile(c))u.push(c);else if(o.isSharedFolder(c)){u.push(c);var l=e.folders[c].proxy.metadata||{};l&&(f=l.title)}else{try{c=JSON.parse(JSON.stringify(c))}catch(e){return}o.getFilesRecursively(c,u)}if(u.some(function(e){return o.isSharedFolder(e)}))return e.cfg&&e.cfg.log&&e.cfg.log(r._getKey("fm_moveNestedSF",[f])),void i.unshift(s);u=n.deduplicateString(u);var d={};u.forEach(function(e){d[e]=o.getFileData(e)}),a.push({el:c,data:d,key:f})}),i.forEach(function(e){t.splice(e,1)}),a},S=function(e,n){var r;return v(e,n).some(function(e){if(e&&e.data&&e.data.href){var n=t.parsePadUrl(e.data.href),o=n.hashData;if(o&&"view"!==o.mode)return r=n.hash,!0}}),r},N=function(e,n,t){var r=w(e,n.paths),o=A(e,n.newPath),i=n.copy;if(o.userObject.isFolder(o.path)){var s=null;a(function(n){if(r.main.length)if(o.id){var t=T(e,r.main,e.user.userObject),a=o.userObject;if(t.forEach(function(e){try{a.copyFromOtherDrive(o.path,e.el,e.data,e.key)}catch(e){s||(s=e)}}),i)return;r.main.length&&!s&&e.user.userObject.delete(r.main,n())}else e.user.userObject.move(r.main,o.path,n(function(e){e&&!s&&(s=e)}));var c=Object.keys(r.folders);c.length&&c.forEach(function(t){var a=Number(t),c=r.folders[a];if(o.id===a)o.userObject.move(c,o.path,n(function(e){e&&!s&&(s=e)}));else{var u=e.folders[a].userObject,f=o.userObject;if(T(e,c,u).forEach(function(e){try{f.copyFromOtherDrive(o.path,e.el,e.data,e.key)}catch(e){s||(s=e)}}),i)return;s||u.delete(c,n())}})}).nThen(function(){s?t(s):t()})}else t()},I=function(n,o,s){var c=A(n,(o=o||{}).path);if(c&&c.userObject)if(c.id)s({error:"EINVAL"});else if(n.pinPads){var u,f=o.folderData||{};a(function(){if(!o.folderData){var e=t.createRandomHash("drive",o.password),r=t.getSecrets("drive",e,o.password),a=t.getHashes(r);f={href:"/drive/#"+a.editHash,roHref:"/drive/#"+a.viewHash,channel:r.channel,lastTitle:o.name,ctime:+new Date},o.password&&(f.password=o.password),o.owned&&(f.owners=[n.edPublic])}}).nThen(function(e){n.Store.pad.getMetadata(null,{channel:f.channel},e(function(n){if(n&&(n.error||n.rejected))return e.abort(),void s({error:n.error||"ERESTRICTED"})}))}).nThen(function(e){n.pinPads([f.channel],e())}).nThen(function(e){n.user.userObject.pushSharedFolder(f,e(function(r,o){if("EEXISTS"===r&&f.href&&o){var a=t.parsePadUrl(f.href),c=t.getSecrets("drive",a.hash,f.password);return i.upgrade(c.channel,c),n.folders[o]&&n.folders[o].userObject.setReadOnly(!1,c.keys.secondaryKey),e.abort(),void s(o)}return"EEXISTS"===r&&o?(e.abort(),void s(o)):r?(e.abort(),void s(r)):void(u=o)}))}).nThen(function(t){n.user.userObject.add(u,c.path),n.loadSharedFolder(u,f,t(function(a){if(!a)return t.abort(),void s({error:"EDELETED"});a.proxy.metadata||(a.proxy.metadata={title:o.name||r.fm_newFolder}),o.folderData&&n.Store.pad.getMetadata(null,{channel:f.channel},function(t){var r=n.user.proxy[e.SHARED_FOLDERS][u];t.owners&&(r.owners=t.owners),t.expire&&(r.expire=+t.expire)})}),!Boolean(o.folderData))}).nThen(function(){n.onSync(function(){s(u)})})}else s({error:"EAUTH"});else s({error:"E_NOTFOUND"})},x=function(r,o,i){var s=(o=o||{}).resolved||w(r,o.paths);if(s.main.length||Object.keys(s.folders).length){if(o.paths&&1===o.paths.length&&o.paths[0][0]===e.SHARED_FOLDERS_TEMP)return delete n.find(r,["user","proxy",e.SHARED_FOLDERS_TEMP])[o.paths[0][1]],void r.onSync(i);var c=[];a(function(t){if(s.main.length){var o=r.user.userObject;n.find(r.settings,["drive","hideDuplicate"])&&s.main.forEach(function(n){var t=o.find(n);if(n[0]!==e.FILES_DATA&&!o.isFile(t)&&!o.isSharedFolder(t)){var a=[];o.getFilesRecursively(t,a),a.forEach(function(n){_(r,null,n)&&r.user.userObject.add(Number(n),[e.ROOT])})}}),o.delete(s.main,t(function(e,n){r.unpinPads&&n&&Array.prototype.push.apply(c,n)}))}}).nThen(function(e){Object.keys(s.folders).forEach(function(n){r.folders[n].userObject.delete(s.folders[n],e(function(e,n){r.unpinPads&&n&&Array.prototype.push.apply(c,n)}))})}).nThen(function(e){if(r.unpinPads){c=n.deduplicateString(c);var o=[];E(r,c).forEach(function(e){var n=b(r,e),a=[n.channel];n.answersChannel&&a.push(n.answersChannel),n.rtChannel&&a.push(n.rtChannel),n.lastVersion&&a.push(t.hrefToHexChannelId(n.lastVersion)),Array.prototype.push.apply(o,a)});var a=[];c.forEach(function(e){-1===o.indexOf(e)&&(a.push(e),r.Store.checkDeletedPad(e))}),r.unpinPads(a,e(function(e){if(e&&e.error)return console.error(e.error)}))}}).nThen(function(){i()})}else i({error:"E_NOTFOUND"})},C=function(t,r,i){var s=w(t,(r=r||{}).paths||[]);if(r.channel||s.main.length||Object.keys(s.folders).length){var c={main:[],folders:{}},u=function(r,a,i,s){var u,f=n.once(n.mkAsync(s)),l=r;if(!l&&a){var d=a.find(i);if(!a.isFile(d)&&!a.isSharedFolder(d))return;var h=a.isFile(d)?a.getFileData(d):O(t,d);l=h.channel}Object.keys(t.user.proxy[e.SHARED_FOLDERS]||{}).some(function(n){if((t.user.proxy[e.SHARED_FOLDERS][n]||{}).channel===l)return u=Number(n),t.folders[n].deleting=!0,!0}),t.removeOwnedChannel(l,function(e){if(e&&e.error&&"ENOENT"!==e.error)return u&&t.folders[u]&&t.folders[u].deleting&&delete t.folders[u].deleting,o.send("ERROR_DELETING_OWNED_PAD="+l+"|"+e.error,!0),void f();var n=E(t,[l]);if(u&&n.push(u),!n.length)return c=void 0,void f();n.forEach(function(e){var n=m(t,e),r=w(t,n);Array.prototype.push.apply(c.main,r.main),Object.keys(r.folders).forEach(function(e){c.folders[e]?Array.prototype.push.apply(c.folders[e],r.folders[e]):c.folders[e]=r.folders[e]})}),f()})};a(function(e){r.channel&&u(r.channel,null,null,e()),s.main.forEach(function(n){u(null,t.user.userObject,n,e())}),Object.keys(s.folders).forEach(function(n){var r=t.folders[n].userObject;s.folders[n].forEach(function(n){u(null,r,n,e())})})}).nThen(function(){c?x(t,{resolved:c},i):i(),r.channel&&t.Store.refreshDriveUI()})}else i({error:"E_NOTFOUND"})},R={move:N,restore:function(e,n,t){n=n||{},e.user.userObject.restore(n.path,t)},addFolder:function(e,n,t){var r=A(e,(n=n||{}).path);r&&r.userObject?r.userObject.addFolder(r.path,n.name,function(n){if(n.newPath&&r.id){var o=p(e,r.userObject);o&&Array.prototype.unshift.apply(n.newPath,o)}t(n)}):t({error:"E_NOTFOUND"})},addSharedFolder:I,addLink:function(e,n,t){var r=A(e,(n=n||{}).path);if(r&&r.userObject){var o=r.userObject,a=+new Date;o.pushLink({name:n.name,href:n.href,atime:a,ctime:a},function(n,a){n?t({error:n}):(o.add(a,r.path),e.onSync(t))})}else t({error:"E_NOTFOUND"})},restoreSharedFolder:function(r,o,i){var s=o.id,c=o.password,u=n.find(r,["user","proxy",e.SHARED_FOLDERS_TEMP]),f=u&&u[s];if(f)if(r.Store){var l=r.user.userObject.getHref?r.user.userObject.getHref(f):f.href,d=!1;a(function(e){r.Store.isNewChannel(null,{href:l,password:c},e(function(e){d=!(!e||e.error)&&e.isNew}))}).nThen(function(){if(d)i({error:"ENOTFOUND"});else{var e=n.clone(f),o=t.parsePadUrl(l),a=t.getSecrets(o.type,o.hash,c);e.password=c,e.channel=a.channel,a.keys.editKeyStr&&(e.href="/drive/#"+t.getEditHashFromKeys(a)),e.roHref="/drive/#"+t.getViewHashFromKeys(a),delete e.legacy,I(r,{path:["root"],folderData:e},function(){delete u[s],r.onSync(i)})}})}else i({error:"ESTORE"});else i({error:"EINVAL"})},convertFolderToSharedFolder:function(n,t,r){var o=t.path,i=n.user.userObject.find(o);if(o.length<=1||o[0]!==e.ROOT)r({error:"E_INVAL_PATH"});else if(D(n,o))r({error:"E_INVAL_NESTING"});else if(n.user.userObject.hasSubSharedFolder(i))r({error:"E_INVAL_NESTING"});else{var s,c=o.slice(0,-1),u=n.user.userObject.find(c),f=o[o.length-1];a(function(e){I(n,{path:c,name:f,owned:t.owned,password:t.password||""},e(function(n){if("object"==typeof n&&n&&n.error)return e.abort(),void r(n);s=n}))}).nThen(function(t){if(!s)return t.abort(),void r({error:"E_NO_ID"});var a,f=[];for(var l in i)(n.user.userObject.isFolder(i[l])||n.user.userObject.isFile(i[l]))&&f.push(o.concat(l));if(Object.keys(u).some(function(e){if(u[e]===s)return a=e,!0}),!a)return t.abort(),void r({error:"E_NO_KEY"});var d=c.concat(a).concat(e.ROOT);N(n,{paths:f,newPath:d,copy:!1},t())}).nThen(function(t){var r=[];Object.keys(i).forEach(function(e){if(n.user.userObject.isFile(i[e])){var t=n.user.userObject.getFileData(i[e]);t&&l(n,t.owners)&&r.push(o.concat(e))}}),N(n,{paths:r,newPath:[e.ROOT],copy:!1},t())}).nThen(function(){var t=n.user.proxy[e.SHARED_FOLDERS][s],a=n.user.userObject.getFolderData(i);for(var c in a)"metadata"!==c&&(t[c]=a[c]);n.user.userObject.delete([o],function(){r({fId:s})})})}},delete:x,deleteOwned:C,emptyTrash:function(e,t,r){a(function(r){if(t&&t.deleteOwned){var i=e.user.userObject.ownedInTrash(function(n){return l(e,n)}),s=a;i.forEach(function(n){s=s(function(t){e.removeOwnedChannel(n,t(function(e){setTimeout(t(),50),e&&e.error&&"ENOENT"!==e.error&&(console.error(e.error,n),o.send("ERROR_EMPTYTRASH_OWNED="+n+"|"+e.error,!0)),console.warn("DELETED",n)}))}).nThen}),s(r())}e.user.userObject.emptyTrash(r(function(t,o){var i=a;setTimeout(r(function(){if(Array.isArray(o)){var t=r(),a=n.deduplicateString(o),s=[];a.forEach(function(n){i=i(function(t){v(e,n,!0).length||s.push(n),e.Store.checkDeletedPad(n,t())}).nThen}),i(function(){e.unpinPads(s,function(){t()})})}}))}))}).nThen(r)},rename:function(n,t,o){var a=A(n,(t=t||{}).path);if(a&&a.userObject){if(!a.id){var i=n.user.userObject.find(a.path);if(n.user.userObject.isSharedFolder(i)&&n.folders[i])return n.folders[i].proxy.metadata.title=t.newName||r.fm_folder,n.user.proxy[e.SHARED_FOLDERS][i].lastTitle=t.newName||r.fm_folder,void o()}a.userObject.rename(a.path,t.newName,o)}else o({error:"E_NOTFOUND"})},setFolderData:function(n,t,r){var o=A(n,(t=t||{}).path);if(o&&o.userObject){if(!o.id){var a=n.user.userObject.find(o.path);if(n.user.userObject.isSharedFolder(a)&&n.folders[a])return n.user.proxy[e.SHARED_FOLDERS][a][t.key]=t.value,void n.onSync(r)}o.userObject.setFolderData(o.path,t.key,t.value,function(){n.onSync(r)})}else r({error:"E_NOTFOUND"})},updateStaticAccess:function(e,n,t){h(e,n).getFileData(n,!0).atime=+new Date,e.onSync(t)}},P=function(e,n,t){var r=n.cmd,o=n.data||{},a=R[r];"function"!=typeof a?t():a(e,o,t)},k=function(n,t,r){if(r=r||function(){},t.attr&&t.attr.trim()){var o=n.user.userObject.getSFIdFromHref(t.href);o&&("href"===t.attr&&(t.value=n.user.userObject.cryptor.encrypt(t.value)),n.user.proxy[e.SHARED_FOLDERS][o][t.attr]=t.value);var i=y(n,t.href),s=a;i.forEach(function(e){s=s(function(n){e.userObject.setPadAttribute(t.href,t.attr,t.value,n())}).nThen}),s(function(){r()})}else r("E_INVAL_ATTR")},M=function(e,n,t){t=t||function(){};var r=e.user.userObject.getSFIdFromHref(n.href);if(r){var o=O(e,r),a=n.attr?o[n.attr]:JSON.parse(JSON.stringify(o));setTimeout(function(){t(null,{value:a,atime:1})})}else{var i=y(e,n.href),s={};i.forEach(function(e){var t=e.data.atime,r=n.attr?e.data[n.attr]:JSON.parse(JSON.stringify(e.data));(!s.value||s.atime{const n=d(e),t=[];return n.forEach(function(e){const n=e.getMissingRtChannel();n&&t.push(n)}),t};var B=function(e,n,t,r){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"rename",data:{path:n,newName:t}},function(e,n){e||n?.error?r(e||n):r()})},V=function(e,n,t,r,o){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"move",data:{paths:n,newPath:t,copy:o}},function(e,n){e||n?.error?r(e||n):r()})},Y=function(e,n,t){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"emptyTrash",data:{deleteOwned:n}},t)},G=function(e,n,t,r){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"addFolder",data:{path:n,name:t}},r)},J=function(e,n,t,r){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"addSharedFolder",data:{path:n,name:t.name,owned:t.owned,password:t.password}},r)},q=function(e,n,t,r){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"addLink",data:{path:n,name:t.name,href:t.url}},r)},W=function(e,n,t,r){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"restoreSharedFolder",data:{id:n,password:t}},r)},z=function(e,n,t,r,o){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"convertFolderToSharedFolder",data:{path:n,owned:t,password:r}},o)},Q=function(e,n,t){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"delete",data:{paths:n}},t)},Z=function(e,n,t){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"deleteOwned",data:{paths:n}},t)},X=function(e,n,t){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"restore",data:{path:n}},t)},$=function(e,n,t){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"setFolderData",data:n},t)},ee=function(e,n,t){e.sframeChan.query("Q_DRIVE_USEROBJECT",{cmd:"updateStaticAccess",data:n},t)},ne=E,te=b,re=p,oe=function(e,n,t){if(t)return e.folders[t].userObject.find(n);var r=A(e,n);return r.userObject.find(r.path)},ae=function(e,n,t){var r=h(e,n);return String(r.getTitle(n,t))},ie=function(e,n){return h(e,n).isStaticFile(n)},se=function(e,n){return h(e,n).isReadOnlyFile(n)},ce=function(e,t){var r=[];return d(e).forEach(function(e){Array.prototype.push.apply(r,e.getFiles(t))}),r=n.deduplicateString(r)},ue=function(e,n){var t=[];return d(e).forEach(function(r){var o=p(e,r),a=r.search(n);a.length&&(o&&a.forEach(function(e){e.inSharedFolder=!0,e.paths.forEach(function(e){Array.prototype.unshift.apply(e,o)})}),Array.prototype.push.apply(t,a))}),t},fe=function(n){var t=[];return d(n).forEach(function(n){var r=n.getFiles([e.FILES_DATA,e.STATIC_DATA]).map(function(e){return[Number(e),n.getFileData(e)]});Array.prototype.push.apply(t,r)}),t.filter(function(e){return e[1].atime}).sort(function(e,n){return n[1].atime-e[1].atime})},le=function(e){return e.user.userObject.getOwnedPads(e.edPublic)},de=function(e,n){e.isHistoryMode=Boolean(n)},he=function(e,n){var t=A(e,n);if(!t||!t.userObject)return{};if(!t.id){var r=e.user.userObject.find(t.path);if(e.user.userObject.isSharedFolder(r))return O(e,r)}var o=t.userObject.find(t.path);return t.userObject.getFolderData(o)},pe=D,ve=function(e,n){return e.user.userObject.isValidDrive(n)},ye=function(e,n,t){return e.user.userObject.isFile(n,t)},me=function(e,n){return e.user.userObject.isFolder(n)},ge=function(e,n){return e.user.userObject.isSharedFolder(n)},Ee=function(e,n){if(e.folders[n]){var t=e.folders[n].userObject;return t.isFolderEmpty(t.find[t.ROOT])}return e.user.userObject.isFolderEmpty(n)},be=function(e,n,t){return e.user.userObject.isPathIn(n,t)},Oe=function(e,n,t){return e.user.userObject.isSubpath(n,t)},Ae=function(e,n){return e.user.userObject.isInTrashRoot(n)},we=function(e,n,t){return e.user.userObject.comparePath(n,t)},De=function(e,n,t){if(e.folders[n]){var r=e.folders[n].userObject;return r.hasSubfolder(r.find[r.ROOT])}return e.user.userObject.hasSubfolder(n,t)},_e=function(e,n){return e.user.userObject.hasSubSharedFolder(n)},Te=function(e,n,t){if(e.folders[n]){var r=e.folders[n].userObject;return r.hasFile(r.find[r.ROOT])}return e.user.userObject.hasFile(n,t)},Se=function(e){return e.user.userObject.ownedInTrash(function(n){return l(e,n)})},Ne=_;return{setCustomize:n=>{r=n.Messages,e.setCustomize(n)},create:function(n,t,r){var o={pinPads:t.pin,unpinPads:t.unpin,onSync:t.onSync,Store:t.Store,store:t.store,removeOwnedChannel:t.removeOwnedChannel,loadSharedFolder:t.loadSharedFolder,cfg:r,edPublic:t.edPublic,settings:t.settings,user:{proxy:n},folders:{}};r.removeProxy=function(e){c(o,e)},o.user.userObject=e.init(n,r);var a=function(e){return function(){return[].unshift.call(arguments,o),e.apply(null,arguments)}};return{addProxy:a(s),removeProxy:a(c),deprecateProxy:a(u),restrictedProxy:a(f),addSharedFolder:a(I),addPin:function(e,n){o.pinPads=e,o.unpinPads=n},removePin:function(){delete o.pinPads,delete o.unpinPads},command:a(P),getPadAttribute:a(M),setPadAttribute:a(k),getTagsList:a(F),getSecureFilesList:a(L),getSharedFolderData:a(O),getChannelsList:a(j),addPad:a(K),delete:a(x),deleteOwned:a(C),findChannel:a(v),findHref:a(y),findFile:a(m),getEditHash:a(S),user:o.user,folders:o.folders,getMissingRtChannel:a(U)}},createInner:function(n,t,r,o){var a={cfg:o,sframeChan:t,edPublic:r,user:{proxy:n,userObject:e.init(n,o)},folders:{}},i=function(e){return function(){return[].unshift.call(arguments,a),e.apply(null,arguments)}};return{addProxy:i(s),removeProxy:i(c),setHistoryMode:i(de),rename:i(B),move:i(V),emptyTrash:i(Y),addFolder:i(G),addSharedFolder:i(J),addLink:i(q),restoreSharedFolder:i(W),convertFolderToSharedFolder:i(z),delete:i(Q),deleteOwned:i(Z),restore:i(X),setFolderData:i($),updateStaticAccess:i(ee),getFileData:i(te),find:i(oe),getTitle:i(ae),isReadOnlyFile:i(se),isStaticFile:i(ie),getFiles:i(ce),search:i(ue),getRecentPads:i(fe),getOwnedPads:i(le),getTagsList:i(F),findFile:i(m),findFiles:i(g),findChannels:i(ne),getSharedFolderData:i(O),getFolderData:i(he),isInSharedFolder:i(pe),getUserObjectPath:i(re),isDuplicateOwned:i(Ne),ownedInTrash:i(Se),isValidDrive:i(ve),isFile:i(ye),isFolder:i(me),isSharedFolder:i(ge),isFolderEmpty:i(Ee),isPathIn:i(be),isSubpath:i(Oe),isInTrashRoot:i(Ae),comparePath:i(we),hasSubfolder:i(De),hasSubSharedFolder:i(_e),hasFile:i(Te),user:a.user,folders:a.folders}}}};e.exports&&(e.exports=n(Ue(),Z(),te(),void 0,Ae(),qe(),We()))})()}(Me)),Me.exports}var Qe,Ze,Xe=ze(),$e=n({__proto__:null,default:r(Xe)},[Xe]),en=Ue(),nn=n({__proto__:null,default:r(en)},[en]),tn={exports:{}},rn={exports:{}};function on(){return Ze||(Ze=1,function(e){e.exports&&(e.exports=((e={},n={},t)=>{let r=[];const o=["sheet","doc","presentation"],a=a=>{e=a.AppConfig;const i=(n=a.ApiConfig).onlyOffice&&n.onlyOffice.availableVersions.includes(t.currentVersion);r=e.availablePadTypes.filter(e=>i||!o.includes(e))};Object.keys(e).length&&a({AppConfig:e,ApiConfig:n});const i={OO_APPS:o,setCustomize:a};return i.__defineGetter__("availableTypes",function(){return n.appsToDisable?r.filter(e=>!n.appsToDisable.includes(e)):r}),i.__defineGetter__("appsToSelect",function(){return r.filter(e=>!["drive","teams","file","contacts","convert"].includes(e))}),i.isAvailable=e=>Array.isArray(i.availableTypes)&&i.availableTypes.includes(e),i})(void 0,void 0,(Qe||(Qe=1,function(e){e.exports&&(e.exports={currentVersionNumber:9,currentVersion:"v9"})}(rn)),rn.exports)))}(tn)),tn.exports}var an,sn,cn=on(),un=n({__proto__:null,default:r(cn)},[cn]),fn={exports:{}},ln={exports:{}};function dn(){return an||(an=1,function(e){(()=>{const n=(e,n,t={},r)=>{const o=function(){if(Object.keys(t).length){var e,n=new URL(t.httpUnsafeOrigin);try{return(e=new URL(t.websocketPath,t.httpUnsafeOrigin)).protocol=n.protocol,e.origin}catch(e){return console.error(e),t.httpUnsafeOrigin}}};var a=o();var i=e=>JSON.parse(JSON.stringify(e)),s=function(e,t,r){var o=n.once(n.mkAsync(r));fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>{e.ok?e.text().then(e=>{o(void 0,n.tryParse(e))}):e.json().then().then(n=>{o(e.status,n)})}).catch(e=>{o(e)})},c=function(t,o,c){var u=i(o);u.publicKey=n.encodeBase64(t.publicKey),u.nonce=n.encodeBase64(r.randomBytes(24));var f,l,d=new URL("/api/auth/",a);e(function(e){s(d,u,e((n,t)=>n?(e.abort(),console.error(n),t&&console.error(t),void c(n)):t.date&&t.txid?(f=t.txid,void(l=t.date)):(e.abort(),void c("REQUEST_REJECTED"))))}).nThen(function(e){var o=i(u);o.txid=f,o.date=l;var a=n.decodeUTF8(JSON.stringify(o)),h=r.sign.detached(a,t.secretKey),p=n.encodeBase64(h);s(d,{sig:p,txid:f},e((n,t)=>{if(n)return e.abort(),console.error(n),t&&console.error(t),void c("RESPONSE_REJECTED",t);c(void 0,t)}))})};return c.setCustomize=e=>{t=e.ApiConfig,a=o()},c};e.exports&&(e.exports=n(qe(),Z(),void 0,h()))})()}(ln)),ln.exports}function hn(){return sn||(sn=1,function(e){e.exports&&(e.exports=((e,n={},t,r)=>{var o={setCustomize:e=>{n=e.ApiConfig,t.setCustomize(e)}};o.join=e.uint8ArrayJoin,o.seed=function(){return r.hash(e.decodeUTF8("pewpewpew"))},o.genkeys=function(e){if(!(e instanceof Uint8Array))throw new Error("INVALID_SEED_FORMAT");if(!e||"number"!=typeof e.length||e.length<64)throw new Error("INVALID_SEED_LENGTH");var n=e.subarray(0,r.sign.seedLength),t=e.subarray(r.sign.seedLength,r.sign.seedLength+r.secretbox.keyLength);return{sign:r.sign.keyPair.fromSeed(n),symmetric:t}},o.keysToRPCFormat=function(n){try{var t=n.sign;return{edPrivate:e.encodeBase64(t.secretKey),edPublic:e.encodeBase64(t.publicKey)}}catch(e){return void console.error(e)}},o.encrypt=function(n,t,a){var i=e.decodeUTF8(t),s=r.randomBytes(r.secretbox.nonceLength);return o.join([[0],s,r.secretbox(i,s,a.symmetric)])},o.decrypt=function(n,t){var o=n.subarray(1,1+r.secretbox.nonceLength),a=n.subarray(1+r.secretbox.nonceLength),i=r.secretbox.open(a,o,t.symmetric);try{return JSON.parse(e.encodeUTF8(i))}catch(e){return void console.error(e)}},o.sign=function(e,n){return r.sign.detached(r.hash(e),n.sign.secretKey)},o.serialize=function(n,t){var r=o.encrypt(0,n,t),a=o.sign(r,t);return{publicKey:e.encodeBase64(t.sign.publicKey),signature:e.encodeBase64(a),ciphertext:e.encodeBase64(r)}},o.proveAncestor=function(n){var t=e.find(n,["sign","publicKey"]),o=e.find(n,["sign","secretKey"]);try{var a=r.sign.detached(t,o);return JSON.stringify([t,a].map(e.encodeBase64))}catch(e){return void console.error(e)}};var a=function(n){return e.encodeBase64(n).replace(/\//g,"-")};o.getBlockUrl=function(e){var t=a(e.sign.publicKey);return(n.fileHost||n.httpUnsafeOrigin||window.location.origin)+"/block/"+t.slice(0,2)+"/"+t},o.getBlockHash=function(e){return o.getBlockUrl(e)+"#"+a(e.symmetric)};var i=function(n){try{return e.decodeBase64(n.replace(/\-/g,"/"))}catch(e){return void console.error(e)}};return o.parseBlockHash=function(e){if("string"==typeof e){var n=e.split("#");if(2===n.length)try{return{href:n[0],keys:{symmetric:i(n[1])}}}catch(e){return void console.error(e)}}},o.checkRights=function(n,r){const o=e.mkAsync(r),{blockKeys:a,auth:i}=n;var s="MFA_CHECK";i&&i.type&&(s=`${i.type.toUpperCase()}_`+s),t(a.sign,{command:s,auth:i&&i.data},o)},o.writeLoginBlock=function(e,n){const{content:r,blockKeys:a,oldBlockKeys:i,auth:s,pw:c,session:u,token:f,userData:l}=e;var d="WRITE_BLOCK";s&&s.type&&(d=`${s.type.toUpperCase()}_`+d);var h=o.serialize(JSON.stringify(r),a);h.auth=s&&s.data,h.hasPassword=c,h.registrationProof=i&&o.proveAncestor(i),f&&(h.inviteToken=f),l&&(h.userData=l),t(a.sign,{command:d,content:h,session:u},n)},o.removeLoginBlock=function(e,n){const{reason:r,blockKeys:o,auth:a,edPublic:i}=e;var s="REMOVE_BLOCK";a&&a.type&&(s=`${a.type.toUpperCase()}_`+s),t(o.sign,{command:s,auth:a&&a.data,edPublic:i,reason:r},n)},o.updateSSOBlock=function(e,n){const{blockKeys:r,oldBlockKeys:a}=e;var i=a&&o.proveAncestor(a);t(r.sign,{command:"SSO_UPDATE_BLOCK",ancestorProof:i},n)},o})(Z(),void 0,dn(),h()))}(fn)),fn.exports}var pn,vn,yn,mn=hn(),gn=n({__proto__:null,default:r(mn)},[mn]),En={exports:{}};function bn(){return pn||(pn=1,function(e){var n;n=function(){var e=function(n){if(Array.isArray(n))return n.map(e);if(n instanceof Object){var t=[],r=[];return Object.keys(n).forEach(function(e){/^(0|[1-9][0-9]*)$/.test(e)?t.push(+e):r.push(e)}),t.sort(function(e,n){return e-n}).concat(r.sort()).reduce(function(t,r){return t[r]=e(n[r]),t},{})}return n},n=JSON.stringify.bind(JSON);return function(t,r,o){var a=n(t,r,0);if(!a||"{"!==a[0]&&"["!==a[0])return a;var i=JSON.parse(a);return n(e(i),null,o)}},e.exports?e.exports=n():JSON.sortify=n()}(En)),En.exports}function On(){if(yn)return vn;yn=1;var e,n,t,r,o,a,i,s;return M(),e=te(),n=Z(),Y(),t=je(),o=(r={}).createData=function(t,r){var o={channel:r||e.createChannelId(),displayName:t["cryptpad.username"],profile:t.profile&&t.profile.view,edPublic:t.edPublic,curvePublic:t.curvePublic,notifications:n.find(t,["mailboxes","notifications","channel"]),avatar:t.profile&&t.profile.avatar,badge:t.profile&&t.profile.badge,uid:t.uid};return!1===r&&delete o.channel,o},a=r.getFriend=function(e,n){if(n){if(n===e.curvePublic){var t=o(e);return delete t.channel,t}return e.friends?e.friends[n]:void 0}},i=r.getFriendList=function(e){return e.friends||(e.friends={}),e.friends},s=function(e,n){Object.keys(e).forEach(function(t){"me"!==t&&n(e[t],t,e)})},r.getFriendChannelsList=function(e){var n=[];return s(e.friends,function(e){n.push(e.channel)}),n},r.declineFriendRequest=function(e,n,t){e.mailbox.sendTo("DECLINE_FRIEND_REQUEST",{},{channel:n.notifications,curvePublic:n.curvePublic},function(e){t(e)})},r.acceptFriendRequest=function(e,n,t){var r=a(e.proxy,n.curvePublic)||{},i=o(e.proxy,r.channel||n.channel);e.mailbox.sendTo("ACCEPT_FRIEND_REQUEST",{user:i},{channel:n.notifications,curvePublic:n.curvePublic},function(e){t(e)})},r.addToFriendList=function(e,n,r){var o=e.proxy,a=i(o),s=n.curvePublic;s!==o.curvePublic?(a[s]=n,t.whenRealtimeSyncs(e.realtime,function(){r(),e.pinPads([n.channel],function(e){e.error&&console.error(e.error)})})):r("E_MYKEY")},r.updateMyData=function(e,t){var r=o(e.proxy,!1);e.proxy.friends&&(e.proxy.friends.me=n.clone(r),delete e.proxy.friends.me.channel),e.modules.team&&e.modules.team.updateMyData(r);var i=function(n){n&&n.notifications&&(delete n.user,r.channel=n.channel,e.mailbox.sendTo("UPDATE_DATA",r,{channel:n.notifications,curvePublic:n.curvePublic},function(e){e&&e.error&&console.error(e)}))};t?i(a(e.proxy,t)):s(e.proxy.friends||{},i)},r.removeFriend=function(e,n,r){var o=e.proxy,a=o.friends[n];a?a.notifications?e.mailbox.sendTo("UNFRIEND",{curvePublic:o.curvePublic},{channel:a.notifications,curvePublic:a.curvePublic},function(i){i&&i.error?r(i):(e.messenger.onFriendRemoved(n,a.channel),delete o.friends[n],t.whenRealtimeSyncs(e.realtime,function(){r(i)}))}):r({error:"EINVAL"}):r({error:"ENOENT"})},vn=r}var An,wn,Dn,_n={exports:{}},Tn={exports:{}},Sn={exports:{}};function Nn(){return An||(An=1,function(e){var n,t,r,o,a,i,s,c,u,f,l,d;e.exports&&(e.exports=(n=Z(),t=h(),r=n.uid,o=n.tryParse,a=function(e,r){var o=n.decodeUTF8(JSON.stringify(e));return n.encodeBase64(t.sign.detached(o,r))},i=function(e,n,t){if("function"!=typeof t)throw new Error("expected callback");var o=e.network,a=o.historyKeeper;if("string"==typeof a){var i=r(),s=e.pending[i]=function(e,n){t(e,n)};return s.data=n,s.called=0,o.sendto(a,JSON.stringify([i,n]))}t("NO_HISTORY_KEEPER")},s=[],c=[],u=function(e){var n={network:e,connected:!0,anon:void 0,authenticated:[]};return s.push(e),c.push(n),e.on("message",function(t,r){r===e.historyKeeper&&function(e,n){"string"!=typeof n&&console.error("received non-string message [%s]",n);var t=o(n);if(t){if(Array.isArray(t)&&!/(FULL_HISTORY|HISTORY_RANGE)/.test(t[0])){var r=t[0];"string"==typeof r&&(function(e,n){return!!e.anon&&"function"==typeof e.anon.pending[n]}(e,r)?function(e,n,t){var r=e.pending[n];"ERROR"===t[0]?r(t[1]):r(void 0,t.slice(1)),delete e.pending[n]}(e.anon,r,t.slice(1)):e.authenticated.some(function(e){var n=e.pending[r];return"function"==typeof n&&("ERROR"!==t[1]?(/\|/.test(t[1])&&e.cookie!==t[1]&&(e.cookie=t[1]),n(void 0,t.slice(2)),delete e.pending[r],!0):"NO_COOKIE"===t[2]?(e.send("COOKIE","",function(t){if(t)return console.error(t),void n(t);e.resend(r)&&delete e.pending[r]}),!0):(n(t[2]),delete e.pending[r],!0))})||console.error("UNHANDLED RPC MESSAGE",n))}}else console.error(new Error("could not parse message: %s",n))}(n,t)}),e.on("disconnect",function(){n.connected=!1,n.anon&&(n.anon.connected=!1),n.authenticated.forEach(function(e){e.connected=!1})}),e.on("reconnect",function(){n.anon&&(n.anon.connected=!0),n.authenticated.forEach(function(e){e.connected=!0})}),n},f=function(e){var n;return s.some(function(t,r){return e===t&&(n=r,!0)}),c[n]?c[n]:u(e)},l=function(e,t){if(!e)throw new Error("expected network context");var o,s=t.publicKeyString;return e.authenticated.some(function(e,n){return e.publicKey===s&&(o=n,!0)}),e.authenticated[o]?e.authenticated[o]:function(e,t){var o={network:e.network,publicKey:t.publicKeyString,timeouts:{},pending:{},cookie:null,connected:!0},s=o.send=function(e,r,s){var c=n.mkAsync(s);if(o.connected||"COOKIE"===e){var u=[e,r];o.cookie&&o.cookie.join?u.unshift(o.cookie.join("|")):u.unshift(o.cookie);var f=a(u,t.signKey);return u.unshift(t.publicKeyString),u.unshift(f),i(o,u,c)}c("DISCONNECTED")};return o.resend=function(e){var n=o.pending[e];if(n.called)return console.error("[%s] called too many times",e),!0;n.called++,n.data[2]=o.cookie,n.data[0]=a(n.data.slice(2),t.signKey);var i=r();o.pending[i]=n,delete o.pending[e];try{return o.network.sendto(o.network.historyKeeper,JSON.stringify([i,n.data]))}catch(e){console.log("failed to resend"),console.error(e)}},s.unauthenticated=function(e,r,a){var s=n.mkAsync(a);if(o.connected){var c=[null,t.publicKeyString,null,e,r];return o.cookie&&o.cookie.join?c[2]=o.cookie.join("|"):c[2]=o.cookie,i(o,c,s)}s("DISCONNECTED")},o.destroy=function(){Object.keys(o.timeouts).forEach(function(e){clearTimeout(e)}),o.send("DESTROY","",function(){});var n=e.authenticated.indexOf(o);-1!==n&&e.authenticated.splice(n,1)},e.authenticated.push(o),o}(e,t)},d=function(e){return e.anon||function(e){var t={network:e.network,timeouts:{},pending:{},connected:!0};return e.anon=t,t.send=function(e,r,o){var a=n.mkAsync(o);if(t.connected)return i(t,[e,r],a);a("DISCONNECTED")},t.resend=function(e){var n=t.pending[e];if(n.called)return console.error("[%s] called too many times",e),!0;n.called++;try{return t.network.sendto(t.network.historyKeeper,JSON.stringify([e,n.data]))}catch(e){console.log("failed to resend"),console.error(e)}},t.destroy=function(){Object.keys(t.timeouts).forEach(function(e){clearTimeout(e)}),e.anon=void 0},t}(e)},{create:function(e,t,r,o){if("function"!=typeof o)throw new Error("expected callback");var a,i=n.mkAsync(o);try{if(64!==(a=n.decodeBase64(t)).length)throw new Error("private key did not match expected length of 64")}catch(e){return void i(e)}try{if(32!==n.decodeBase64(r).length)return void i("expected public key to be 32 uint")}catch(e){return void i(e)}if(e){var s=f(e),c=l(s,{publicKeyString:r,signKey:a});c.send("COOKIE","",function(e){e?i(e):i(void 0,{send:c.send,destroy:c.destroy})})}else i("NO_NETWORK")},createAnonymous:function(e,t){var r=n.mkAsync(t);if("function"!=typeof r)throw new Error("expected callback");if(e){var o=d(f(e));r(void 0,{send:o.send,destroy:o.destroy})}else r("NO_NETWORK")}}))}(Sn)),Sn.exports}function In(){return wn||(wn=1,function(e){var n,t;e.exports&&(e.exports=(n=Z(),t=Nn(),{create:function(e,r,o,a){if("function"!=typeof o)throw new Error("Expected callback");var i=n.once(n.mkAsync(o));if(e)if(r){var s=r.edPrivate,c=r.edPublic;s&&c?t.create(e,s,c,function(e,t){if(e)i(e);else{var r={};r.destroy=t.destroy,r.publicKey=c,r.send=t.send,r.pin=function(e,r){var o=n.once(n.mkAsync(r));Array.isArray(e)?t.send("PIN",e,o):o("[TypeError] pin expects an array")},r.unpin=function(e,r){var o=n.once(n.mkAsync(r));Array.isArray(e)?t.send("UNPIN",e,o):o("[TypeError] pin expects an array")},r.adminRpc=function(e,n){if(e.cmd){var r=[e.cmd,e.data];t.send("ADMIN",r,n)}else setTimeout(function(){n("[TypeError] admin rpc expects a command")})},r.getServerHash=function(e){t.send("GET_HASH",c,function(n,t){t&&t[0]?e(n,Array.isArray(t)&&t[0]||void 0):e("NO_HASH_RETURNED")})},r.reset=function(e,r){var o=n.once(n.mkAsync(r));Array.isArray(e)?t.send("RESET",e,o):o("[TypeError] pin expects an array")},r.getFileListSize=function(e){t.send("GET_TOTAL_SIZE",void 0,function(n,t){n?e(n):t&&t.length&&"number"==typeof t[0]?e(void 0,t[0]):e("INVALID_RESPONSE")})},r.getLimit=function(e){t.send("GET_LIMIT",void 0,function(n,t){n?e(n):t&&t.length&&"number"==typeof t[0]?e(void 0,t[0],t[1],t[2]):e("INVALID_RESPONSE")})},r.trimHistory=function(e,r){var o=n.once(n.mkAsync(r));"object"==typeof e&&e.channel&&e.hash?t.send("TRIM_HISTORY",e,function(e){if(e)return o(e);o()}):o("INVALID_ARGUMENTS")},r.clearOwnedChannel=function(e,n){"string"==typeof e&&32===e.length?t.send("CLEAR_OWNED_CHANNEL",e,function(e){if(e)return n(e);n()}):n("INVALID_ARGUMENTS")},r.removeOwnedChannel=function(e,n,r){if("string"!=typeof e||-1===[32,48].indexOf(e.length))return console.error("invalid channel to remove",e),void n("INVALID_ARGUMENTS");t.send("REMOVE_OWNED_CHANNEL",{channel:e,reason:r},function(t,r){t?n(t):r&&r.length&&"OK"===r[0]?(n(),a&&a.clearChannel&&a.clearChannel(e)):n("INVALID_RESPONSE")})},r.removePins=function(e){t.send("REMOVE_PINS",void 0,function(n,t){n?e(n):t&&t.length&&"OK"===t[0]?e():e("INVALID_RESPONSE")})},r.uploadComplete=function(e,n){t.send("UPLOAD_COMPLETE",e,function(e,t){if(e)n(e);else{var r=t[0];"string"==typeof r?n(void 0,r):n("INVALID_ID")}})},r.ownedUploadComplete=function(e,n){t.send("OWNED_UPLOAD_COMPLETE",e,function(e,t){if(e)n(e);else{var r=t[0];"string"==typeof r?n(void 0,r):n("INVALID_ID")}})},r.uploadStatus=function(e,n){"number"==typeof e?.size?t.send("UPLOAD_STATUS",e,function(e,t){if(e)n(e);else{var r=t[0];"boolean"==typeof r?n(void 0,r):n("INVALID_RESPONSE")}}):setTimeout(function(){n("INVALID_SIZE")})},r.uploadCancel=function(e,n){t.send("UPLOAD_CANCEL",e,function(e){e?n(e):n()})},r.setMetadata=function(e,n){t.send("SET_METADATA",{channel:e.channel,command:e.command,value:e.value},n)},i(e,r)}}):i("INVALID_KEYS")}else i("INVALID_PROXY");else i("INVALID_NETWORK")}}))}(Tn)),Tn.exports}function xn(){return Dn||(Dn=1,function(e){(()=>{const n=(e,n,t,r,o,a,i,s,c,u)=>{var f=function(e,n,t){if(!e.done){if(e.cb(n&&n.error,t,n),e.done=!0,!e.hasNetwork){var o=r.find(e,["network","disconnect"]);"function"==typeof o&&o()}if(e.realtime&&e.realtime.stop)try{e.realtime.stop()}catch(e){console.error(e)}var a=r.find(e,["session","realtime","abort"]);"function"==typeof a&&(e.session.realtime.sync(),a())}},l=function(e,r){u(function(n){var o,a;e.hasNetwork||(o=n(function(e,n){e||(r.network=n)}),a=i.getWebsocketURL(),t.connect(a).then(function(e){o(null,e)},function(e){o(e)}))}).nThen(function(){e.realtime=n.start(r)})},d=function(e,n,t,r){Array.isArray(t)&&t.length&&16===t[0].length&&Array.isArray(n.accessKeys)?(e.network.historyKeeper=t[0],u(function(t){n.accessKeys.forEach(function(n){c.create(e.network,n,t(function(e){console.log("done",n),e&&console.error(e)}))})}).nThen(function(){r()})):r(!0)},h=function(n,t){var r;return"string"==typeof n?r=o.getSecrets("pad",n,t.password):"object"==typeof n&&(r=n),r.keys||(r.keys=r.key),{websocketURL:i.getWebsocketURL(t.origin),channel:r.channel,validateKey:r.keys.validateKey||void 0,crypto:e.createEncryptor(r.keys),logLevel:0,initialState:t.initialState,Cache:s}},p=function(e){return"object"==typeof e},v=function(e,n){p(e)&&p(n)&&Object.keys(n).forEach(function(t){e[t]=n[t]})};return{get:function(e,n,t,r){if("function"!=typeof n)throw new Error("Cryptget expects a callback");r=r||function(){};var o=h(e,t=t||{}),a={cb:n,accessKeys:t.accessKeys,hasNetwork:Boolean(t.network)};o.onRejected=function(e,n){d(o,a,e,n)},o.onReady=function(e){var n=a.session=e.realtime;a.network=e.network,r(1),f(a,void 0,n.getUserDoc())},o.onError=function(e){console.warn(e),f(a,e)},o.onChannelError=function(e){console.error(e),f(a,e)},o.onCacheReady=t.onCacheReady;var i=0;o.onMessage=function(){i++,r(Math.min(.99,i/100))},v(o,t),l(a,o)},put:function(e,n,t,r){if("function"!=typeof t)throw new Error("Cryptput expects a callback");var o=h(e,r=r||{}),i={cb:t,accessKeys:r.accessKeys,hasNetwork:Boolean(r.network)};o.onRejected=function(e,n){d(o,i,e,n)},o.onReady=function(e){var r=i.session=e.realtime;i.network=e.network,r.contentUpdate(n);var o=setTimeout(function(){t(new Error("Timeout"))},15e3);a.whenRealtimeSyncs(r,function(){clearTimeout(o);var e=r.getAuthDoc();r.abort(),f(i,void 0,e)})},o.onChannelError=function(e){f(i,e)},v(o,r),l(i,o)}}};e.exports&&(e.exports=n(M(),D(),u(),Z(),te(),je(),j(),fe(),In(),qe(),x()))})()}(_n)),_n.exports}var Cn,Rn,Pn,kn,Mn,Fn,Ln,Hn={exports:{}};function jn(){if(Mn)return kn;Mn=1;return kn=((e,n,t,r,o,a,i,s)=>{const c={};let u={};c.setCustomize=e=>{u=e.Broadcast};var f=["notifications","supportteam"],l=[],d="000000000000000000000000000000000",h=function(e,n,t,r,o){e.emit("MESSAGE",{type:n,content:t},r?[r]:e.clients,o)},p=function(e,n,t,r){e.emit("VIEWED",{type:n,hash:t},r||e.clients)},v=function(e){var n=e.store&&e.store.proxy;if(n.curvePrivate&&n.curvePublic)return{curvePrivate:n.curvePrivate,curvePublic:n.curvePublic}},y=c.sendTo=function(n,t,o,a,i){a=a||{};var c=i||function(e){e&&e.error&&console.error(e.error)};if(s.Mailbox){var u=e.find(n,["store","anon_rpc"]);if(u){var f={encrypt:function(e){return e}},l=d,h={uid:e.uid(),type:t,content:o};if(!/^BROADCAST/.test(t)){var p=v(n);if(!p)return void c({error:"missing asymmetric encryption keys"});if(!a||!a.channel||!a.curvePublic)return void c({error:"no notification channel"});if(l=a.channel,f=s.Mailbox.createEncryptor(p),"object"==typeof o&&!o.user){var y=r.createData(n.store.proxy,!1);o.user=y}h={type:t,content:o}}var m=JSON.stringify(h),g=f.encrypt(m,a.curvePublic);if(a.viewed){var E=e.find(n,["store","proxy","teams",a.viewed]);if(E){var b=g.slice(0,64),O=e.find(E,["keys","mailbox","viewed"]);Array.isArray(O)&&O.push(b)}}u.send("WRITE_PRIVATE_MESSAGE",[l,g],function(e){c(e?{error:e}:{hash:g.slice(0,64)})})}else c({error:"anonymous rpc session not ready"})}else c({error:"chainpad-crypto is outdated and doesn't support mailboxes."})};c.sendToAnon=function(n,t,r,o,a){var i=s.Nacl,c=i.randomBytes(32),u=i.box.keyPair.fromSecretKey(new Uint8Array(c)),f=e.encodeBase64(u.secretKey),l=e.encodeBase64(u.publicKey);y({store:{anon_rpc:n,proxy:{curvePrivate:f,curvePublic:l}}},t,r,o,a)};var m=function(n,r,o,i){var s=r.type,c=r.hash;if(/^REMINDER\|/.test(c)){i(),delete n.boxes.reminders.content[c],p(n,s,c,n.clients.filter(function(e){return e!==o}));var u=c.slice(9).split("-")[0],f=e.find(n,["store","proxy","hideReminders",u]);if(!f){var l=n.store.proxy.hideReminders=n.store.proxy.hideReminders||{};f=l[u]=l[u]||[]}var d=c.split("-")[1];d&&!f.includes(d)&&f.push(Number(d))}else{var h=n.boxes[s];if(h){var v,y,m=h.data||{},g=h.history.indexOf(c);-1!==g&&(0===g?(m.lastKnownHash=c,h.history.shift()):-1===m.viewed.indexOf(c)&&m.viewed.push(c));var E=[];h.history.some(function(e,n){if(-1===m.viewed.indexOf(e))return!0;v=n+1,E.push(e),y=e}),m.viewed=m.viewed.filter(function(e){return-1===E.indexOf(e)}),v&&(h.history=h.history.slice(v),m.lastKnownHash=y),Object.keys(h.content).forEach(function(e){-1!==h.history.indexOf(e)&&-1===m.viewed.indexOf(e)||(a.remove(n,h,h.content[e],e),delete h.content[e])}),t.whenRealtimeSyncs(n.store.realtime,function(){i(),p(n,s,c,n.clients.filter(function(e){return e!==o}))})}else i({error:"NOT_LOADED"})}},g=function(e,n,t,c,u){u=u||{};var f=e.boxes[n]={channel:t.channel,type:n,queue:[],history:[],content:{},sendMessage:function(n){if("object"==typeof n&&!n.user){var t=r.createData(e.store.proxy,!1);n.user=t}try{n=JSON.stringify(n)}catch(e){console.error(e)}f.queue.push(n)},data:t};if(s.Mailbox){var l=t.keys||v(e);if(l||t.decrypted){var d=t.decrypted?{encrypt:function(e){return e},decrypt:function(e){return e}}:s.Mailbox.createEncryptor(l);f.encryptor=d;var y,g={network:e.store.network,channel:t.channel,noChainPad:!0,crypto:d,owners:"broadcast"===n?[]:u.owners||[e.store.proxy.edPublic],lastKnownHash:t.lastKnownHash};g.onConnectionChange=function(){},g.onConnect=function(t,r){f.sendMessage=function(t,o){var a;o=o||function(){};try{a=JSON.stringify(t)}catch(e){console.error(e)}r(a,function(r,a){r?console.error(r):(f.history.push(a),t.ctime=+new Date,f.content[a]=t,h(e,n,{msg:t,hash:a}),o(a))},l.curvePublic)},f.queue.forEach(function(e){f.sendMessage(e)}),f.queue=[]},f.onMessage=g.onMessage=function(r,i,s,c,l,d,p){if(l!==t.lastKnownHash&&l!==y){var v=p&&p.time;y=l;try{r=JSON.parse(r)}catch(e){console.error(e)}if(d&&(r.author=d),f.history.push(l),function(e,n){return-1===(n.viewed||[]).indexOf(e)&&e!==n.lastKnownHash}(l,t)){var g={msg:r,hash:l,time:v},E=f.ready;a.add(e,f,g,function(t,a,i){a&&m(e,a,"",function(){console.log("Notification handled automatically")}),i||t?m(e,{type:n,hash:l},"",function(){console.log("Notification handled automatically")}):(r.ctime=v||0,f.content[l]=r,u.dump||h(e,n,g,null,function(e){e&&e.msg&&E&&o.system(void 0,e.msg)}))})}else if(0===Object.keys(f.content).length){t.lastKnownHash=l,f.history=[];var b=t.viewed.indexOf(l);-1!==b&&t.viewed.splice(b,1)}}},g.onReady=function(){var r=[];t.viewed.forEach(function(e,n){-1===f.history.indexOf(e)&&r.push(n)});for(var o=r.length-1;o>=0;o--)t.viewed.splice(r[o],1);var i=function(t){a.remove(e,f,f.content[t],t),delete f.content[t],p(e,n,t)};e.store.proxy.on("change",["mailboxes",n],function(e,n,t){var r;"lastKnownHash"===t[2]&&(f.history.some(function(e,t){if(r=t+1,i(e),e===n)return!0}),f.history=f.history.slice(r));"viewed"===t[2]&&i(n)}),f.ready=!0,c(f.content)},f.cpNf=i.start(g)}else console.error("missing asymmetric encryption keys")}else console.error("chainpad-crypto is outdated and doesn't support mailboxes.")};return c.init=function(t,r,i){var s={},c=t.store,v=c.proxy.mailboxes=c.proxy.mailboxes||{},E={Store:t.Store,store:c,pinPads:t.pinPads,updateMetadata:t.updateMetadata,updateDrive:t.updateDrive,mailboxes:v,emit:i,clients:[],boxes:{},req:{},loggedIn:c.loggedIn&&c.proxy.edPublic};return function(e,t){!t.notifications&&e.loggedIn&&(t.notifications={channel:n.createChannelId(),lastKnownHash:"",viewed:[]},e.pinPads([t.notifications.channel],function(e){e.error&&console.error(e)})),t.support&&delete t.support,t.broadcast||(t.broadcast={channel:d,lastKnownHash:u.lastBroadcastHash,decrypted:!0,viewed:[]})}(E,v),E.loggedIn&&function(n){var t=n.store.network;t.on("message",function(r,o){if(o===t.historyKeeper){var a=JSON.parse(r);if(/HISTORY_RANGE/.test(a[0])){var i=a[1],s=n.req[i];if(s){var c=a[0],u=a[2],f=s.box;if("HISTORY_RANGE"===c){if(!Array.isArray(u))return;var l;if("broadcast"===s.box.type)l=e.tryParse(u[4]);else try{var d=f.encryptor.decrypt(u[4]);(l=JSON.parse(d.content)).author=d.author}catch(e){console.log(e)}var h=u[4].slice(0,64);n.emit("HISTORY",{txid:i,time:u[5],message:l,hash:h},[s.cId])}else"HISTORY_RANGE_END"===c&&(n.emit("HISTORY",{txid:i,complete:!0},[s.cId]),delete n.req[i])}}}})}(E),E.boxes.reminders={content:{}},Object.keys(v).forEach(function(e){if(-1!==f.indexOf(e)){var n=v[e];-1===l.indexOf(e)?g(E,e,n,function(){}):g(E,e,n,r(function(){}))}}),E.loggedIn&&Object.keys(c.proxy.teams||{}).forEach(function(n){var t=c.proxy.teams[n];if(t){var r=t.keys.mailbox||{};if(r.channel){var o={owners:[e.find(t,["keys","drive","edPublic"])]};g(E,"team-"+n,r,function(){},o)}}}),s.post=function(e,n,t){var r=E.boxes[e];r&&r.sendMessage({type:n,content:t,sender:c.proxy.curvePublic})},s.hideMessage=function(e,n){p(E,e,n.hash,E.clients)},s.showMessage=function(e,n,t,r){"reminders"===e&&n&&(E.boxes.reminders.content[n.hash]=n.msg,E.clients.length||(E.boxes.reminders.content[n.hash].requiresNotif=!0),p(E,e,n.hash,E.clients)),h(E,e,n,t,function(e){o.system(void 0,e.msg),r&&r()})},s.open=function(e,n,t,r,o){(-1!==f.indexOf(e)||r)&&g(E,e,n,t,o)},s.close=function(e,n){!function(e,n,t){t=t||function(){};var r=e.boxes[n];r?r.cpNf&&"function"==typeof r.cpNf.stop?(r.cpNf.stop(),Object.keys(r.content).forEach(function(t){a.remove(e,r,r.content[t],t),p(e,n,t,e.clients)}),delete e.boxes[n]):t("EINVAL"):t()}(E,e,n)},s.dismiss=function(e,n){m(E,e,"",n)},s.sendTo=function(e,n,t,r){E.loggedIn?y(E,e,n,t,r):r({error:"NOT_LOGGED_IN"})},s.removeClient=function(e){!function(e,n){var t=e.clients.indexOf(n);e.clients.splice(t,1)}(E,e)},s.execCommand=function(e,n,t){var r=n.cmd,a=n.data;"SUBSCRIBE"!==r?"DISMISS"!==r?"SENDTO"!==r?"LOAD_HISTORY"!==r||function(e,n,t,r){var o=e.boxes[t.type];if(o){var a=["GET_HISTORY_RANGE",o.channel,{from:t.lastKnownHash,count:t.count,txid:t.txid}];"broadcast"===t.type&&(a=["GET_HISTORY_RANGE",o.channel,{to:t.lastKnownHash,txid:t.txid}]),e.req[t.txid]={cId:n,box:o};var i=e.store.network;i.sendto(i.historyKeeper,JSON.stringify(a)).then(function(){},function(e){console.error(e)})}else r({error:"ENOENT"})}(E,e,a,t):y(E,a.type,a.msg,a.user,t):m(E,a,e,t):function(e,n,t,r){Object.keys(e.boxes).forEach(function(n){Object.keys(e.boxes[n].content).forEach(function(r){var a={msg:e.boxes[n].content[r],hash:r};h(e,n,a,t,function(e){e.error||a.msg&&a.msg.requiresNotif&&(o.system(void 0,e.msg),delete a.msg.requiresNotif)})})}),-1===e.clients.indexOf(t)&&e.clients.push(t),r()}(E,0,e,t)},s},c})(Z(),te(),je(),On(),(Cn||(Cn=1,function(e){(()=>{const n=(e={})=>{let n=globalThis;var t={};e.requireConf=e.requireConf||{},t.setCustomize=n=>{e=n.ApiConfig};var r=n.location&&n.location.pathname.slice(1,-1),o=-1!==["code","slide","pad","kanban","whiteboard","diagram","sheet","poll","teams","form","doc","presentation"].indexOf(r)?"-"+r:"",a="/customize/favicon/main-favicon"+o+".png?"+e.requireConf.urlArgs,i="/customize/favicon/alt-favicon"+o+".png?"+e.requireConf.urlArgs,s="/customize/favicon/main-favicon"+o+".ico?"+e.requireConf.urlArgs,c="/customize/favicon/alt-favicon"+o+".ico?"+e.requireConf.urlArgs,u=n.document,f=t.isSupported=function(){return"function"==typeof n.Notification&&n.isSecureContext},l=t.hasPermission=function(){return"granted"===Notification.permission},d=t.getPermission=function(e){e=e||function(){},Notification&&"function"==typeof Notification.requestPermission?Notification.requestPermission(function(n){e("granted"===n)}):e(!1)},h=t.create=function(e,t,r){u&&!r?r=u.getElementById("favicon").getAttribute("data-main-favicon")||i:r||(r=i);var o=new Notification(t,{icon:r,body:e});return o.onclick=function(){if(u)try{parent.focus(),n.focus(),this.close()}catch(e){}},o};return t.system=function(e,n,t){if(f())return l()?h(e,n,t):void("denied"!==Notification.permission&&d(function(r){r&&h(e,n,t)}))},u&&!u.getElementById("favicon")&&function(){if(u){console.debug("creating favicon");var e={id:"favicon",type:"image/png",rel:"icon","data-main-favicon":a,"data-alt-favicon":i,href:a};if(!u.getElementById("favicon")){var n=u.createElement("link");Object.keys(e).forEach(function(t){n.setAttribute(t,e[t])}),u.head.appendChild(n)}if(!u.getElementById("favicon-ico")){var t=u.createElement("link");e.href=e.href.replace(/\.png/g,".ico"),e.id="favicon-ico",e.type="image/x-icon",Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])}),u.head.appendChild(t)}}else console.error("document is not available in this context")}(),t.tab=function(e,r){if(u){var o="_pendingTabNotification",f=u.getElementById("favicon"),l=u.getElementById("favicon-ico"),d=a,h=i,p=s,v=c;f&&(d=f.getAttribute("data-main-favicon")||a,h=f.getAttribute("data-alt-favicon")||i,f.setAttribute("href",d)),l&&(p=l.getAttribute("data-main-favicon")||s,v=l.getAttribute("data-alt-favicon")||c,l.setAttribute("href",p));var y=function(e){return!!t[o]&&(n.clearInterval(t[o]),f&&f.setAttribute("href",e?h:d),l&&l.setAttribute("href",e?v:p),!0)};y();var m=function(){f&&f.setAttribute("href",f.getAttribute("href")===d?h:d),l&&l.setAttribute("href",l.getAttribute("href")===p?v:p),--r};return t[o]=n.setInterval(function(){if(r>0)return m();y(!0)},e),m(),{cancel:y}}console.error("document is not available in this context")},t};e.exports&&(e.exports=n(void 0))})()}(Hn)),Hn.exports),(Pn||(Pn=1,Rn=((e,n,t,r,o)=>{var a=function(e){var n=e.store.realtime.getLag().lag||0;return 20*(Math.max(0,n)+300)*(.5+Math.random())},i={},s={},c=function(e,n){var r=e.store.proxy.mutedUsers||{},o=t.find(n,["msg","author"]);return!!o&&Boolean(r[o])},u={};i.FRIEND_REQUEST=function(n,t,r,o){var a=r.msg.content.user||r.msg.content;if(c(n,r))o(!0);else if(u[r.msg.author])o(!0);else{if(u[r.msg.author]={type:t.type,hash:r.hash},e.getFriend(n.store.proxy,r.msg.author)||n.store.proxy.friends_pending[r.msg.author])return delete n.store.proxy.friends_pending[r.msg.author],void e.acceptFriendRequest(n.store,a,function(t){t&&t.error?o():e.addToFriendList({proxy:n.store.proxy,realtime:n.store.realtime,pinPads:n.pinPads},a,function(e){if(e)return console.error(e),void o(!0);n.store.messenger&&n.store.messenger.onFriendAdded(a),n.updateMetadata(),o(!0)})});o()}},s.FRIEND_REQUEST=function(e,n,t){var r=t.content.user||t.content;u[r.curvePublic]&&delete u[r.curvePublic]};var f={},l={};i.DECLINE_FRIEND_REQUEST=function(e,n,t,r){var o=t.msg.content.user||t.msg.content;o.curvePublic||(o.curvePublic=t.msg.author),setTimeout(function(){r(!0),e.store.proxy.friends_pending[t.msg.author]&&(delete e.store.proxy.friends_pending[t.msg.author],e.updateMetadata(),f[t.msg.author]||n.sendMessage({type:"FRIEND_REQUEST_DECLINED",content:{user:o}},function(e){f[t.msg.author]={type:n.type,hash:e}}))},a(e))},i.FRIEND_REQUEST_DECLINED=function(e,n,t,r){e.updateMetadata();var o=t.msg.content.user.curvePublic||t.msg.content.user,a=l[o];delete l[o],f[o]?r(!0,a):(f[o]={type:n.type,hash:t.hash},r(!1,a))},s.FRIEND_REQUEST_DECLINED=function(e,n,t){var r=t.content.user.curvePublic||t.content.user;f[r]&&delete f[r]},i.ACCEPT_FRIEND_REQUEST=function(n,t,r,o){var i=r.msg.content.user||r.msg.content;setTimeout(function(){o(!0),n.store.proxy.friends_pending[r.msg.author]&&(delete n.store.proxy.friends_pending[r.msg.author],e.addToFriendList({proxy:n.store.proxy,realtime:n.store.realtime,pinPads:n.pinPads},i,function(e){e?console.error(e):(n.store.messenger&&n.store.messenger.onFriendAdded(i),n.updateMetadata(),n.store.modules.profile&&n.store.modules.profile.update(),l[r.msg.author]||t.sendMessage({type:"FRIEND_REQUEST_ACCEPTED",content:{user:i}},function(e){l[r.msg.author]={type:t.type,hash:e}}))}))},a(n))},i.FRIEND_REQUEST_ACCEPTED=function(e,n,t,r){e.updateMetadata();var o=t.msg.content.user.curvePublic||t.msg.content.user,a=f[o];delete f[o],l[o]?r(!0,a):(l[o]={type:n.type,hash:t.hash},r(!1,a))},s.FRIEND_REQUEST_ACCEPTED=function(e,n,t){var r=t.content.user.curvePublic||t.content.user;l[r]&&delete l[r]},i.CANCEL_FRIEND_REQUEST=function(e,n,t,r){var o=u[t.msg.author];o?r(!0,o):r(!0)},i.UNFRIEND=function(n,t,r,o){var a=r.msg.author,i=e.getFriend(n.store.proxy,a);i?(delete n.store.proxy.friends[a],delete n.store.proxy.friends_pending[a],n.store.messenger&&n.store.messenger.onFriendRemoved(a,i.channel),n.updateMetadata(),o(!0)):o(!0)},i.UPDATE_DATA=function(e,n,t,r){var o=t.msg,a=o.author,i=e.store.proxy.friends&&e.store.proxy.friends[a];if(!i||"object"!=typeof o.content)return void r(!0);const s=o.content.edPublic,c=()=>{Object.keys(o.content).forEach(function(e){i[e]=o.content[e]}),e.store.messenger&&e.store.messenger.onFriendUpdate(a),e.updateMetadata(),r(!0)};if(o.content.badge&&e.store.modules.badge)return e.store.modules.badge.listBadges({edPublic:s},e=>{e.includes(o.content.badge)||delete o.content.badge,c()});c()};var d=function(e,n){let t=e.store.data.blockHash,a=o.parseBlockHash(t).keys.symmetric;return r.encrypt(n,a)},h={};i.SHARE_PAD=function(e,t,r,o){var a=r.msg,i=r.hash,s=a.content;if(c(e,r))o(!0);else{var u,f=s.isStatic?s.href:n.hrefToHexChannelId(s.href,s.password),l=n.parsePadUrl(s.href),p=l.hashData&&l.hashData.mode||"n/a",v=h[f];if(v){if("edit"===v.mode&&"view"===p)return void o(!0);u=v.data}s.password&&(s.password=d(e,s.password)),h[f]={mode:p,data:{type:t.type,hash:i}},o(!1,u)}},s.SHARE_PAD=function(e,t,r,o){var a=r.content,i=n.hrefToHexChannelId(a.href,a.password),s=h[i];s&&s.data&&s.data.hash===o&&delete h[i]};var p=!1;i.SUPPORT_MESSAGE=function(e,n,t,r){p?r(!0):(p=!0,r())},s.SUPPORT_MESSAGE=function(){p=!1},i.REQUEST_PAD_ACCESS=function(e,n,t,r){var o=t.msg.content;if(c(e,t))r(!0);else{var a=o.channel,i=e.store.manager.findChannel(a);if(i.length){var s,u,f=e.store.proxy.edPublic;i.some(function(e){if(e.data&&Array.isArray(e.data.owners)&&-1!==e.data.owners.indexOf(f)&&e.data.href)return u=e.data.href,s=e.data.filename||e.data.title,!0})?(o.title=s,o.href=u,r(!1)):r(!0)}else r(!0)}},i.GIVE_PAD_ACCESS=function(e,n,t,r){var o,a=t.msg.content,i=a.channel;e.store.manager.findChannel(i,!0).forEach(function(e){e.data&&!e.data.href&&(o||(o=e.data.filename||e.data.title),e.userObject.setHref(i,null,a.href))}),a.title=o||a.title,r(!1)},i.ADD_TO_ACCESS_LIST=function(e,n,t,r){var o=t.msg.content.channel;e.Store.getAllStores().forEach(function(n){var t=n.manager.findChannel(o);if(t.length){var r=t[0].data,a=t[0].id,i=n.id;e.Store.loadSharedFolder(i,a,r,function(){},!1)}}),r(!0)};var v={};i.ADD_OWNER=function(e,n,t,r){var o=t.msg.content;if(c(e,t))r(!0);else{if(!(o.teamChannel||o.href&&o.title&&o.channel))return console.log("Remove invalid notification"),void r(!0);var a=o.channel||o.teamChannel;o.password&&(o.pw=o.password,o.password=d(e,o.password)),v[a]?r(!0):(v[a]={type:n.type,hash:t.hash},r(!1))}},s.ADD_OWNER=function(e,n,t){var r=t.content.channel||t.content.teamChannel;v[r]&&delete v[r]},i.RM_OWNER=function(e,n,t,r){var o=t.msg.content;if(!o.channel&&!o.teamChannel)return console.log("Remove invalid notification"),void r(!0);var a=o.channel||o.teamChannel;if(o.teamChannel){var i=e.store.proxy.teams||{};Object.keys(i).some(function(e){if(i[e].channel===a)return i[e].owner=!1,!0})}v[a]&&o.pending?r(!1,v[a]):r(!1)};var y={};i.INVITE_TO_TEAM=function(e,n,r,o){var a=r.msg.content;if(c(e,r))o(!0);else{if(!a.team)return console.log("Remove invalid notification"),void o(!0);var i=y[a.team.channel];if(i)return console.log("removing old invitation"),o(!1,i),void(y[a.team.channel]={type:n.type,hash:r.hash});var s=t.find(e,["store","proxy","teams"])||{};Object.keys(s).some(function(e){return s[e].channel===a.team.channel})?o(!0):(y[a.team.channel]={type:n.type,hash:r.hash},o(!1))}},s.INVITE_TO_TEAM=function(e,n,r){var o=t.find(r,["content","team","channel"]);delete y[o]},i.KICKED_FROM_TEAM=function(e,n,t,r){var o=t.msg.content;if(!o.teamChannel)return console.log("Remove invalid notification"),void r(!0);y[o.teamChannel]&&o.pending?r(!0,y[o.teamChannel]):r(!1)},i.INVITE_TO_TEAM_ANSWER=function(e,n,r,o){var a=r.msg,i=a.content;if(!i.teamChannel)return console.log("Remove invalid notification"),void o(!0);var s,c,u=t.find(e,["store","proxy","teams"])||{};if(Object.keys(u).some(function(e){var n=u[e];if(n.channel===i.teamChannel)return s=e,c=n,!0}),s){if(i.team=c,!i.answer)try{e.store.modules.team.removeFromTeam(s,a.author,!0)}catch(e){console.error(e)}var f=i.user||i;n.sendMessage({type:"INVITE_TO_TEAM_ANSWERED",content:{user:f,team:c,answer:i.answer}},function(){}),o(!0)}else o(!0)},i.TEAM_EDIT_RIGHTS=function(e,n,r,o){var a=r.msg.content;if(!a.teamData)return console.log("Remove invalid notification"),void o(!0);var i,s=t.find(e,["store","proxy","teams"])||{};if(Object.keys(s).some(function(e){if(s[e].channel===a.teamData.channel)return i=e,!0}),i)try{e.store.modules.team.changeMyRights(i,a.state,a.teamData,function(e){e||console.error("Can't update team rights"),o(!0)})}catch(e){console.error(e)}else o(!0)},i.OWNED_PAD_REMOVED=function(e,n,t,r){var o=t.msg.content;if(!o.channel)return console.log("Remove invalid notification"),void r(!0);var a=o.channel;e.store.manager.findChannel(a).forEach(function(n){var t=e.store.manager.findFile(n.id);e.store.manager.delete({paths:t},function(){e.updateDrive()})}),r(!0)},i.MOVE_TODO=function(e,n,t,r){var o=e.store.proxy.curvePublic;t.msg.author===o?r():r(!0)},i.SAFE_LINKS_DEFAULT=function(e,n,t,r){var o=e.store.proxy.curvePublic;t.msg.author===o?r():r(!0)};var m={};i.FORM_RESPONSE=function(e,n,t,r){var o,a,i=t.msg,s=t.hash,c=i.content,u=c.channel;if(u)if(function(e,n){return(e.store.proxy.mutedChannels||[]).includes(n)}(e,u))r(!0);else if(e.Store.getAllStores().some(function(e){return e.manager.findChannel(u).some(function(e){if(e.data&&(!a||e.data.href))return a=e.data.href||e.data.roHref,o=e.data.filename||e.data.title,!!e.data.href||void 0})}),a){c.href=a,c.title=o;var f=m[u],l=f?f.data:void 0;m[u]={data:{type:n.type,hash:s}},r(!1,l)}else r(!0);else r(!0)},s.FORM_RESPONSE=function(e,n,t,r){var o=t.content.channel,a=m[o];a&&a.data&&a.data.hash===r&&delete m[o]};var g={};i.COMMENT_REPLY=function(e,n,r,o){var a=r.msg,i=r.hash,s=a.content;if(t.find(e.store.proxy,["settings","pad","disableNotif"]))o(!0);else{var c,u,f=s.channel;if(f)if(e.Store.getAllStores().some(function(e){return e.manager.findChannel(f).some(function(e){if(e.data&&(!u||e.data.href))return u=e.data.href||e.data.roHref,c=e.data.filename||e.data.title,!!e.data.href||void 0})}),u){s.href=u,s.title=c;var l=g[f],d=l?l.data:void 0;g[f]={data:{type:n.type,hash:i}},o(!1,d)}else o(!0);else o(!0)}},s.COMMENT_REPLY=function(e,n,t,r){var o=t.content.channel,a=g[o];a&&a.data&&a.data.hash===r&&delete g[o]};var E,b,O={};i.MENTION=function(e,n,t,r){var o=t.msg,a=t.hash,i=o.content;if(c(e,t))r(!0);else{var s=i.channel;if(s){var u,f;e.Store.getAllStores().some(function(e){return e.manager.findChannel(s).some(function(e){if(e.data&&(!f||e.data.href))return f=e.data.href||e.data.roHref,u=e.data.filename||e.data.title,!!e.data.href||void 0})}),i.href=f,i.title=u;var l=O[s],d=l?l.data:void 0;O[s]={data:{type:n.type,hash:a}},r(!1,d)}else r(!0)}},s.MENTION=function(e,n,t,r){var o=t.content.channel,a=O[o];a&&a.data&&a.data.hash===r&&delete O[o]},i.BROADCAST_MAINTENANCE=function(e,n,t,r){var o=t.msg.uid;e.Store.onMaintenanceUpdate(o),r(!0)},i.BROADCAST_SURVEY=function(e,n,t,r){var o=t.msg,a=o.content,i=o.uid,s=E;E={type:n.type,hash:t.hash},e.Store.onSurveyUpdate(i),r(!a.url,s)},i.BROADCAST_CUSTOM=function(e,n,t,r){var o=t.msg.uid,a=b;b={uid:o,type:n.type,hash:t.hash},r(!1,a)},i.BROADCAST_DELETE=function(e,n,t,r){var o=t.msg.content.uid;if(b&&b.uid===o)return r(!0,b),void(b=void 0);r(!0)};var A,w,D={};return i.SF_DELETED=function(e,n,t,r){var o=t.msg.content,a=o.team,i=o.sfId;if(D[i])r(!0);else if(D[i]=1,a){var s=e.store.proxy.teams[a];s?(o.teamName=s.metadata&&s.metadata.name,r(!1)):r(!1)}else r(!1)},s.SF_DELETED=function(e,n,t){var r=t.content.sfId;delete D[r]},i.NEW_TICKET=function(e,n,r,o){var a=r.msg.content;a.time||(a.time=r.time);var i=t.find(e,["store","modules","support"]);a.isAdmin&&i.addUserTicket(a,o),i.addAdminTicket(a,o)},i.NOTIF_TICKET=function(e,n,r,o){var a=r.msg.content;a.time||(a.time=r.time);var i=t.find(e,["store","modules","support"]);if(a.isAdmin)return t.find(e,["store","proxy","support",a.channel])?(i.updateUserTicket(a),A?void o(!1,A):(A={channel:a.channel,type:n.type,hash:r.hash},void o(!1))):void o(!0);i.checkAdminTicket(a,s=>{s?(i.updateAdminTicket(a),t.find(e.store.proxy,["settings","general","disableSupportNotif"])?o(!0):w?o(!1,w):(w={channel:a.channel,type:n.type,hash:r.hash},o(!1))):o(!0)})},s.NOTIF_TICKET=function(e,n,t){var r=t.content.channel;A&&A.channel===r&&(A=void 0),w&&w.channel===r&&(w=void 0)},i.ADD_MODERATOR=function(e,n,r,o){var a=r.msg.content;t.find(e,["store","modules","support"]).updateAdminKey(a,o)},i.MODERATOR_NEW_KEY=function(e,n,r,o){var a=r.msg.content;t.find(e,["store","modules","support"]).updateAdminKey(a,function(){o(!0)})},{add:function(e,n,r,o){if(r.msg){var a=t.find(e,["store","proxy","curvePublic"]),s=t.find(r,["msg","content","user","curvePublic"])||t.find(r,["msg","content","curvePublic"]);if(s&&r.msg.author!==s&&r.msg.author!==a)return console.error("blocked"),void o(null,null,!0);var c=r.msg.type;if(i[c])try{i[c](e,n,r,o)}catch(e){console.error(e),o()}else o()}else o(null,null,!0)},remove:function(e,n,t,r){if(t){var o=t.type;if(s[o])try{s[o](e,n,t,r)}catch(e){console.error(e)}}}}})(On(),te(),Z(),M(),hn())),Rn),D(),M()),kn}function Kn(){if(Ln)return Fn;Ln=1;return Fn=((e,n,t,r,o,a,i,s,c)=>{let u={};let f=function(f,l,d,h){var p=f.version||0;s(function(){}).nThen(function(){var n,t,r,o,a;p<2&&(n="cryptpad.userlist-drawer",t="cryptpad.hide_poll_text",r="cryptpad.indentUnit",o="cryptpad.indentWithTabs",a=f.settings=f.settings||{},void 0!==f[r]&&(a.codemirror=a.codemirror||{},a.codemirror.indentUnit=f[r],delete f[r]),void 0!==f[o]&&(a.codemirror=a.codemirror||{},a.codemirror.indentWithTabs=f[o],delete f[o]),void 0!==f[n]&&(a.toolbar=a.toolbar||{},a.toolbar["userlist-drawer"]=f[n],delete f[n]),void 0!==f[t]&&(a.poll=a.poll||{},a.poll["hide-text"]=f[t],delete f[t]),e.send("Migrate-2",!0),f.version=p=2)}).nThen(function(){p<3&&(!function(){if(localStorage.CRYPTPAD_LANG){var e=localStorage.CRYPTPAD_LANG;f.settings.language=e}}(),e.send("Migrate-3",!0),f.version=p=3)}).nThen(function(){var n;p<4&&(n=f.settings=f.settings||{},void 0!==f.allowUserFeedback&&(n.general=n.general||{},n.general.allowUserFeedback=f.allowUserFeedback,delete f.allowUserFeedback),e.send("Migrate-4",!0),f.version=p=4)}).nThen(function(){p<5&&(!function(){var e=f.drive&&f.drive.filesData;if(e)for(var n in e)"number"!=typeof e[n].ctime&&(e[n].ctime=+new Date(e[n].ctime)),"number"!=typeof e[n].atime&&(e[n].atime=+new Date(e[n].atime))}(),e.send("Migrate-5",!0),f.version=p=5)}).nThen(function(t){var r,o,a,i,c;p<6&&(a=f.drive.filesData||{},i=s(function(){}),c=Object.keys(a).length,Object.keys(a).forEach(function(e,t){i=i.nThen(function(i){setTimeout(i(function(){if(r=a[e],o=n.parsePadUrl(r.href),r.href&&!r.channel){var i=n.getSecrets(o.type,o.hash,r.password);r.channel=i.channel,d(6,Math.round(100*t/c)),console.log("Adding missing channel in filesData ",r.channel)}}))})}),i.nThen(t(function(){e.send("Migrate-6",!0),f.version=p=6})))}).nThen(function(t){var r,o,a,i,c;p<7&&(a=f.drive.filesData,i=s(function(){}),c=Object.keys(a).length,Object.keys(a).forEach(function(e,t){i=i.nThen(function(i){setTimeout(i(function(){if((r=a[e]).href)if(-1!==r.href.indexOf("#"))if("pad"===(o=n.parsePadUrl(r.href)).hashData.type){if("view"===o.hashData.mode)r.roHref=r.href,delete r.href,console.log("Move href to roHref in filesData ",r.roHref);else{var i=n.getSecrets(o.type,o.hash,r.password),s=n.getViewHashFromKeys(i);s&&(r.roHref="/"+o.type+"/#"+s,console.log("Adding missing roHref in filesData ",r.href))}d(6,Math.round(100*t/c))}else d(7,Math.round(100*t/c));else d(7,Math.round(100*t/c));else d(7,Math.round(100*t/c))}))})}),i.nThen(t(function(){e.send("Migrate-7",!0),f.version=p=7})))}).nThen(function(){p<8&&(f.FS_hashes=t.deduplicateString(f.FS_hashes||[]),e.send("Migrate-8",!0),f.version=p=8)}).nThen(function(){p<9&&(!function(){var e=h.network,n={},t={store:h},o=r.createData(f),i=function(e){var t=n[e];if(t){try{t.wc.leave()}catch(e){}delete n[e]}};e.on("message",function(r,s){try{!function(r,s){if(s===e.historyKeeper){var c=JSON.parse(r);if(!c.validateKey&&!c.owners||!c.channel){if(c.channel&&n[c.channel]){if(c.error&&"EINVAL"===c.error){var u=["GET_HISTORY",c.channel,{}];return void e.sendto(e.historyKeeper,JSON.stringify(u)).then(function(){},function(){})}if(c.state&&1===c.state){o.channel=c.channel;var f=["UPDATE",o.curvePublic,+new Date,o],l=n[c.channel].encrypt(JSON.stringify(f));return n[c.channel].wc.bcast(l).then(function(){},function(e){console.error("Can't migrate this friend",n[c.channel].friend,e)}),void i(c.channel)}}else if(c.channel)return;var d=c[3];if(d&&n[d]){var h=n[d],p=h.decrypt(c[4]),v=JSON.parse(p);if("UPDATE"===v[0]){if(v[1]===o.curvePublic)return;var y=v[3];if(!y.notifications)return;h.friend.notifications=y.notifications,o.channel=d,a.sendTo(t,"UPDATE_DATA",o,{channel:y.notifications,curvePublic:y.curvePublic},function(e){e&&e.error?console.error(e):console.log("friend migrated",h.friend)}),i(d)}}}}}(r,s)}catch(e){console.error(e)}});var s=f.friends||{};Object.keys(s).forEach(function(t){if(44===t.length){var r=s[t];r.notifications||e.join(r.channel).then(function(t){var o=c.Curve.deriveKeys(r.curvePublic,f.curvePrivate),a=c.Curve.createEncryptor(o);n[r.channel]={wc:t,friend:r,decrypt:a.decrypt,encrypt:a.encrypt};var i={lastKnownHash:r.lastKnownHash},s=["GET_HISTORY",r.channel,i];e.sendto(e.historyKeeper,JSON.stringify(s)).then(function(){},function(e){console.error("Can't migrate this friend",r,e)})},function(e){console.error("Can't migrate this friend",r,e)})}})}(),e.send("Migrate-9",!0),f.version=p=9)}).nThen(function(t){p<10&&function(){var i=h.proxy.todo;if(i){var c,l=t(function(){e.send("Migrate-10",!0),f.version=p=10}),d={network:h.network,initialState:"{}",metadata:{owners:h.proxy.edPublic?[h.proxy.edPublic]:[]}};s(function(e){o.get(i,e(function(n,t){if(n||!t)return e.abort(),void l();try{c=JSON.parse(t)}catch(e){}}),d)}).nThen(function(e){if(!c||"object"!=typeof c)return e.abort(),void l();var t={content:{data:{1:{id:"1",color:"color6",item:[],title:u.kanban_todo},2:{id:"2",color:"color3",item:[],title:u.kanban_working},3:{id:"3",color:"color5",item:[],title:u.kanban_done}},items:{},list:[1,2,3]},metadata:{title:u.type.todo,defaultTitle:u.type.todo,type:"kanban"}},s=4,p=!1;if((c.order||[]).forEach(function(e){var n=c.data[e];if(n&&n.task){p=!0;var r=n.state?"3":"1";t.content.data[r].item.push(s),t.content.items[s]={id:s,title:n.task},s++}}),!p)return e.abort(),void l();var v=n.createRandomHash("kanban"),y=n.getSecrets("kanban",v),m=n.getSecrets("todo",i);o.put(v,JSON.stringify(t),e(function(t){if(t)return e.abort(),void l();h.rpc&&(h.rpc.pin([y.channel],function(){}),h.rpc.unpin([m.channel],function(){}));var o=n.hashToHref(v,"kanban");h.manager.addPad(["root"],{title:u.type.todo,owners:d.metadata.owners,channel:y.channel,href:o,roHref:n.hashToHref(n.getViewHashFromKeys(y),"kanban"),atime:+new Date,ctime:+new Date},e(function(e){if(e)console.error(e);else{delete h.proxy.todo;var n=r.createData(f),t={store:h};a.sendTo(t,"MOVE_TODO",{user:n,href:o},{channel:n.notifications,curvePublic:n.curvePublic},function(e){e&&e.error&&console.error(e)})}}))}),d)}).nThen(function(){l()})}}()}).nThen(function(n){if(!(p>=11)){var o=function(){e.send("Migrate-11",!0),f.version=p=11};if(void 0===t.find(f,["settings","security","unsafeLinks"])){var i={store:h},s=r.createData(f);s.curvePublic?a.sendTo(i,"SAFE_LINKS_DEFAULT",{user:s},{channel:s.notifications,curvePublic:s.curvePublic},n(function(e){e&&e.error?console.error(e):o()})):o()}else o()}}).nThen(function(){i.whenRealtimeSyncs(h.realtime,t.mkAsync(t.bake(l)))})};return f.setCustomize=e=>{u=e.Messages},f})(Ae(),te(),Z(),On(),xn(),jn(),je(),qe(),M()),Fn}var Un,Bn,Vn=o(be);var Yn,Gn,Jn,qn,Wn=Bn?Un:(Bn=1,Yn=xn(),Gn=Ue(),te(),Jn=je(),qn={anonDriveIntoUser:function(e,n,t){n&&e.loggedIn||"function"!=typeof t?Yn.get(n,function(r,o){var a;if(r)console.error("Cannot migrate recent pads",r);else if(o){try{a=JSON.parse(o)}catch(e){return"function"==typeof t&&t(),void console.error("Cannot parsed recent pads",e)}if(a){var i=e.proxy,s=Gn.init(a.drive,{readOnly:!1,loggedIn:!0,outer:!0}),c=function(){s.fixFiles(!0);var r=e.manager;s.getFiles([s.FILES_DATA]).forEach(function(e){var n=s.getFileData(e),t=n.channel,o=r.findChannel(t);if(0===o.length)n&&r.addPad(null,n,function(e){e&&console.error("Cannot import file:",n,e)});else{if(!n.href)return;o.forEach(function(e){e.data&&!e.data.href&&e.userObject.setHref(t,null,n.href)})}}),i.FS_hashes&&Array.isArray(i.FS_hashes)||(i.FS_hashes=[]),-1===i.FS_hashes.indexOf(n)&&i.FS_hashes.push(n),"function"==typeof t&&Jn.whenRealtimeSyncs(e.realtime,t)};s&&"function"==typeof s.migrate?s.migrate(c):(console.log("oldFo.migrate is not a function"),c())}else"function"==typeof t&&t()}else"function"==typeof t&&t()}):t()}},Un=qn);const zn=ie.mkEvent(!0),Qn=ie.mkEvent(!0),Zn=ie.mkEvent(),Xn=ie.mkEvent(),$n=(e,n)=>{var t,r;const o=e.store,a=e.Store;let i;if(n){const e=a.getStore(n);i=null===(r=null==e?void 0:e.proxy)||void 0===r?void 0:r.drive}else i=null===(t=o.drive)||void 0===t?void 0:t.proxy;return i},et={init:e=>{var n;const{broadcast:t,store:r,Store:o,account:a}=e,i=r.drive||(r.drive={});let s=null===(n=r.proxy)||void 0===n?void 0:n.drive;if((null==s?void 0:s.hash)||ae.createRandomHash("drive"),!s.hash)return i.proxy=s,a.onAccountCacheReady(()=>{zn.fire()}),a.onAccountReady(()=>{Qn.fire()}),{channel:"",onDriveCacheReady:zn.reg,onDriveReady:Qn.reg,onDisconnect:Zn.reg,onReconnect:Xn.reg};throw new Error("NOT IMPLEMENTED")},initAPI:e=>{const{broadcast:n,store:t,Store:r,account:o}=e,a={store:t,Store:r};return{exists:(e,n,r)=>{r({state:Boolean(t.proxy)})},get:(e,n,t)=>{let r=$n(a,n.teamId);t(r?{drive:r}:{error:"ENOTFOUND"})},set:(e,n,t)=>{let o=$n(a,n.teamId);var i,s;o?(i=o,s=n.value,Object.keys(i).forEach(e=>{delete i[e]}),Object.keys(s).forEach(e=>{i[e]=ie.clone(s[e])}),r.onSync(n.teamId,t)):t({error:"ENOTFOUND"})},migrateAnon:(e,n,r)=>{Wn.anonDriveIntoUser(t,n.anonHash,r)}}}};var nt=o(Object.freeze({__proto__:null,Drive:et})),tt=D(),rt=r(qe()),ot=r(bn()),at=We();const it=ie.mkEvent(!0),st=ie.mkEvent(!0),ct=(e,n,t,r)=>{const o=ie.once(ie.mkAsync(r)),{store:a,Store:i}=e;!a.offline&&a.anon_rpc?t.channel?32===t.channel.length&&ae.isValidChannel(t.channel)?a.anon_rpc.send("GET_METADATA",t.channel,(e,n)=>{if(e)return void o({error:e});const r=n&&n[0]||{};o(r),r.rejected||i.getAllStores().forEach(e=>{const n=e.manager.findChannel(t.channel,!0);let o=!1;(n.forEach(e=>{ot(e.data.owners)!==ot(r.owners)&&(o=!0),e.data.owners=r.owners,e.data.atime=+new Date,r.expire&&(e.data.expire=+r.expire)}),o)&&(e.sendEvent||a.sendDriveEvent)("DRIVE_CHANGE",{path:["drive",en.FILES_DATA]})})}):o({error:"EINVAL"}):o({error:"ENOTFOUND"}):o({error:"OFFLINE"})},ut=(e,n,t)=>{if(t.versionHash)return((e,n,t)=>{let r;const{Store:o,store:a,postMessage:i}=e,s=t.channel,c=t.versionHash,u=ae.createChannelId();rt(t=>{ct(e,0,{channel:s},t(e=>{if(e&&e.rejected)return i(n,"PAD_ERROR",{type:"ERESTRICTED"}),void t.abort();r=e.validateKey}))}).nThen(()=>{o.getHistoryRange(n,{cpCount:1,channel:s,lastKnownHash:c},e=>{var t,o;if(e&&e.error)return i(n,"PAD_ERROR",e.error);const f=e.messages||[];if((null===(t=f[f.length-1])||void 0===t?void 0:t.serverHash)!==c)return i(n,"PAD_ERROR",{type:"HASH_NOT_FOUND"});i(n,"PAD_CONNECT",{myID:u,id:s,members:[u]}),(e.messages||[]).forEach(e=>{i(n,"PAD_MESSAGE",{msg:e.msg,time:e.time,user:u.slice(0,16)})}),r&&(null===(o=null==a?void 0:a.messenger)||void 0===o||o.storeValidateKey(s,r)),i(n,"PAD_READY")})})})(e,n,t);const{channels:r,store:o,Store:a,myDeletions:i,postMessage:s}=e,c=t.channel;if(!ae.isValidChannel(c))return s(n,"PAD_ERROR","INVALID_CHAN");const u=void 0===r[c],f=r[c]||(r[c]={queue:[],data:{},clients:[],bcast:(e,n,t)=>{f.clients.forEach(function(r){r!==t&&s(r,e,n)})},history:[],pushHistory:(e,n)=>{if(n){let n;for(f.history.push("cp|"+e),n=f.history.length-101;n>0&&!/^cp\|/.test(f.history[n]);n--);return void(f.history=f.history.slice(n))}f.history.push(e)}});if(-1===f.clients.indexOf(n)&&f.clients.push(n),!u&&f.wc)return s(n,"PAD_CONNECT",{myID:f.wc.myID,id:f.wc.id,members:f.wc.members}),f.wc.members.forEach(e=>{s(n,"PAD_JOIN",e)}),f.history.forEach(e=>{s(n,"PAD_MESSAGE",{msg:tt.removeCp(e),user:f.wc.myID,validateKey:f.data.validateKey})}),void s(n,"PAD_READY");const l=n=>{const r=null==n?void 0:n.type;"EDELETED"===r&&i[c]&&(delete i[c],n.ownDeletion=!0),f.bcast("PAD_ERROR",n),"EDELETED"===r&&(null==de?void 0:le.clearChannel)&&le.clearChannel(c),["EDELETED","EEXPIRED","ERESTRICTED"].includes(r)&&e.leavePad(null,t,function(){})},d={Cache:o.neverCache?void 0:de,priority:1,onCacheStart:()=>{s(n,"PAD_CACHE")},onCacheReady:()=>{s(n,"PAD_CACHE_READY"),st.fire()},onReady:e=>{const t=e.metadata||{};f.data=t,(null==t?void 0:t.validateKey)&&o.messenger&&o.messenger.storeValidateKey(c,t.validateKey),s(n,"PAD_READY",e.noCache)},onMessage:function(e,n,t,r,o){f.lastHash=o,f.pushHistory(e,r),f.bcast("PAD_MESSAGE",{user:n,msg:e,validateKey:t})},onJoin:function(e){f.bcast("PAD_JOIN",e)},onLeave:function(e){f.bcast("PAD_LEAVE",e)},onError:l,onChannelError:l,onRejected:a.onRejected,onConnectionChange:e=>{e.state||f.bcast("PAD_DISCONNECT")},onMetadataUpdate:e=>{f.data=e||{},a.getAllStores().forEach(n=>{n.manager.findChannel(c,!0).forEach(n=>{n.data.owners=e.owners,n.data.atime=+new Date,e.expire&&(n.data.expire=+e.expire)});(n.sendEvent||o.sendDriveEvent)("DRIVE_CHANGE",{path:["drive",en.FILES_DATA]})}),f.bcast("PAD_METADATA",e)},crypto:{encrypt:function(e){return e},decrypt:function(e){return e}},noChainPad:!0,channel:c,metadata:t.metadata,network:o.network||o.networkPromise,websocketURL:U.getWebsocketURL(),onInit:function(){it.fire()},onConnect:(e,t)=>{f.sendMessage=(n,r,o)=>{t(n,t=>{t?o({error:t}):(f.lastHash=n.slice(0,64),f.pushHistory(tt.removeCp(n),/^cp\|/.test(n)),f.bcast("PAD_MESSAGE",{user:e.myID,msg:tt.removeCp(n),validateKey:f.data.validateKey},r),o())})},f.wc=e,f.queue.forEach(function(e){f.sendMessage(e.message,n)}),f.queue=[],f.bcast("PAD_CONNECT",{myID:e.myID,id:e.id,members:e.members})}};f.cpNf=tt.start(d)},ft=(e,n)=>{var t,r,o,a,i,s;const c=e.store;if(null===(r=null===(t=c.messenger)||void 0===t?void 0:t.leavePad)||void 0===r||r.call(t,n),null===(a=null===(o=c.onlyoffice)||void 0===o?void 0:o.leavePad)||void 0===a||a.call(o,n),Object.keys(c.modules).forEach(e=>{var t,r;null===(r=null===(t=c.modules[e])||void 0===t?void 0:t.leavePad)||void 0===r||r.call(t,n)}),!((e,n)=>{const{store:t}=e;if(!t)return!1;if(t.driveChannel===n)return!0;if(at.isSharedFolderChannel(n))return!0;if(ie.find(t,["proxy","teams"])){var r=ie.find(t,["proxy","teams"])||{};return Object.keys(r).some(e=>r[e].channel===n)}if(ie.find(t,["proxy","profile","href"])){let e=ie.find(t,["proxy","profile","href"]);return ae.hrefToHexChannelId(e)===n}})(e,n)){try{le.leaveChannel(n)}catch(e){console.error(e)}null===(s=null===(i=e.channels[n])||void 0===i?void 0:i.cpNf)||void 0===s||s.stop()}delete e.channels[n]},lt={init:e=>{const{broadcast:n,postMessage:t,store:r,Store:o}=e,a={channels:[],postMessage:t,store:r,Store:o,myDeletions:[],leavePad:(e,n,t)=>{}},i=(e,n,t)=>{const r=a.channels[n.channel];(null==r?void 0:r.cpNf)?(ft(a,n.channel),t()):t({error:"EINVAL"})};a.leavePad=i;return{join:(e,n,t)=>{ut(a,e,n)},destroy:(e,n,t)=>{((e,n,t,r)=>{const{store:o,Store:a,channels:i,myDeletions:s}=e;let c,u,f=t,l=!1;if(t&&"object"==typeof t&&({channel:f,force:l,teamId:c,reason:u}=t),f===o.driveChannel&&!l)return void r({error:"User drive removal blocked!"});const d=a.getStore(c);d?d.rpc?(i[f]&&(s[f]=!0),d.rpc.removeOwnedChannel(f,e=>{e&&delete s[f],r({error:e})},u)):r({error:"RPC_NOT_READY"}):r({error:"ENOTFOUND"})})(a,0,n,t)},clear:(e,n,t)=>{((e,n,t,r)=>{const{Store:o}=e,a=o.getStore(t&&t.teamId);a.rpc?a.rpc.clearOwnedChannel(t.channel,e=>{r({error:e})}):r({error:"RPC_NOT_READY"})})(a,0,n,t)},setMetadata:(e,n,t)=>{((e,n,t,r)=>{if(!t.channel)return void r({error:"ENOTFOUND"});if(!t.command)return void r({error:"EINVAL"});const{Store:o}=e,a=o.getStore(t.teamId);if(!a)return void r({error:"ENOTFOUND"});const i=t.channels;delete t.channels,a.rpc.setMetadata(t,(e,n)=>{e?r({error:e}):Array.isArray(n)&&n.length?r(n[0]):r({})}),Array.isArray(i)&&i.forEach(e=>{var n=ie.clone(t);n.channel=e,a.rpc.setMetadata(n,()=>{})})})(a,0,n,t)},getMetadata:(e,n,t)=>{ct(a,0,n,t)},sendMessage:(e,n,t)=>{((e,n,t,r)=>{var o=t.msg,a=e.channels[t.channel];if(a)a.wc?a.sendMessage(o,n,r):(a.queue.push(o),r())})(a,e,n,t)},onCorruptedCache:(e,n,t)=>{((e,n,t)=>{var r=e.channels[t];r&&r.cpNf&&(le.clearChannel(t),r.cpNf.resetCache&&r.cpNf.resetCache())})(a,0,n)},getLastHash:(e,n,t)=>{((e,n,t,r)=>{var o=e.channels[t.channel];o?o.lastHash?r({hash:o.lastHash}):r({error:"EINVAL"}):r({error:"ENOCHAN"})})(a,0,n,t)},leave:i,removeClient:e=>{Object.keys(a.channels).forEach(n=>{let t=a.channels[n].clients.indexOf(e);-1!==t&&a.channels[n].clients.splice(t,1),0===a.channels[n].clients.length&&ft(a,n)})},onJoined:it.reg,onCacheReady:st.reg,getChannels:()=>a.channels}}};var dt,ht,pt,vt,yt,mt,gt,Et,bt,Ot,At,wt,Dt,_t,Tt,St,Nt,It,xt,Ct,Rt=o(Object.freeze({__proto__:null,Pad:lt}));function Pt(){if(ht)return dt;ht=1;return dt=((e,n,t)=>{const r={};let o={},a={};r.setCustomize=e=>{o=e.Messages,a=e.AppConfig};var i=function(e,n){n.degraded||n.clients.forEach(function(t){var r=e.clients[t];if(r){var o={id:r.id,cursor:r.cursor};n.sendMsg(JSON.stringify(o))}})},s=function(e,n,t){var r=n.members,o=a.degradedLimit||8;t.degraded=r.length-1>=o,e.emit("DEGRADED",{degraded:t.degraded},t.clients)},c=function(e,n,r,o){var a=n.channel,c=n.secret;c.keys.cryptKey&&(c.keys.cryptKey=function(e){for(var n=Object.keys(e).length,t=new Uint8Array(n),r=0;r{const f={};let l={};f.setCustomize=e=>{l=e.ApiConfig};var d=i.Nacl,h=function(e,n,t,r){let o=Object.keys(e.clients).filter(t=>Boolean(e.clients[t].admin)===n);o.length&&e.emit(t,{channel:r},[o])},p=function(n,t,r,o){var a=e.mkAsync(o);if(t&&!n.adminRdyEvt)return void a("EFORBIDDEN");let i=l.httpUnsafeOrigin;e.fetchApi(i,"config",!0,o=>{n.moderatorKeys=o.moderatorKeys,n.adminKeys=o.adminKeys;var i=o.supportMailboxKey;if(i){if(!t||e.find(n.store.proxy,["mailboxes","supportteam","keys","curvePublic"])===i)return t?n.adminRdyEvt.reg(()=>{a(null,{supportKey:i,myCurve:r.adminCurvePrivate||e.find(n.store.proxy,["mailboxes","supportteam","keys","curvePrivate"]),theirPublic:r.curvePublic,notifKey:r.curvePublic})}):void a(null,{supportKey:i,myCurve:n.store.proxy.curvePrivate,theirPublic:r.curvePublic||i,notifKey:i});a("EFORBIDDEN")}else a("E_NOT_INIT")})},v=function(n,t,r,o){var s,c,f=e.once(e.mkAsync(o));a(e=>{p(n,r,t,e((n,t)=>{if(n)return e.abort(),void f({error:n});s=t.theirPublic,c=t.myCurve}))}).nThen(()=>{var r,o=i.Curve.deriveKeys(s,c),a=i.Curve.createEncryptor(o),l={network:n.store.network,channel:t.channel,noChainPad:!0,crypto:a,owners:[]},d=[];f=e.both(function(){r&&"function"==typeof r.stop&&r.stop()},f),l.onMessage=function(e,n,t,r,o,a,i){var s=i&&i.time;try{e=JSON.parse(e)}catch(e){return void console.error(e)}e.time=s,a&&(e.author=a),d.push(e)},l.onError=f,l.onChannelError=f,l.onReady=function(){f(null,d)},r=u.start(l)})},y=function(t,r,o,s){var c=e.find(t,["store","mailbox"]),u=e.find(t,["store","anon_rpc"]);if(c)if(u){var f,l,d,h=r.channel,v=r.title,y=r.ticket,m=+new Date;a(e=>{p(t,o,r,e((n,t)=>{if(n)return e.abort(),void s({error:n});f=t.supportKey,l=t.theirPublic,d=t.myCurve}))}).nThen(e=>{var n=i.Curve.deriveKeys(l,d),t=i.Curve.createEncryptor(n),r=JSON.stringify(y),o=t.encrypt(r);u.send("WRITE_PRIVATE_MESSAGE",[h,o],e((n,t)=>{if(n)return e.abort(),void s({error:n});m=t&&t[0]}))}).nThen(e=>{if(o){var n=t.adminDoc.proxy.tickets.active;if(n[h])return e.abort(),void s({error:"EEXISTS"});n[h]={title:y.title,restored:y.legacy,premium:!1,time:m,author:r.name,supportKey:f,lastAdmin:!0,authorKey:r.curvePublic,notifications:r.notifications}}}).nThen(e=>{o||(t.supportData[h]={time:+new Date,title:v,curvePublic:f},t.Store.onSync(null,e()))}).nThen(()=>{var a=o?r.notifications:n.getChannelIdFromKey(f);c.sendTo("NEW_TICKET",{title:v,channel:h,time:m,isAdmin:o,supportKey:f,premium:o?"":e.find(t,["store","account","plan"]),user:e.find(r.ticket,["sender","curvePublic"])?void 0:{supportTeam:!0}},{channel:a,curvePublic:l},e=>{console.error(e),e&&e.error&&delete t.supportData[h],s(e)}),c.sendTo("NOTIF_TICKET",{title:v,channel:h,time:m,isAdmin:o,isNewTicket:!0,user:e.find(r.ticket,["sender","curvePublic"])?void 0:{supportTeam:!0}},{channel:a,curvePublic:l},()=>{})})}else s({error:"anonymous rpc session not ready"});else s({error:"E_NOT_READY"})},m=function(t,r,o,s){var c,u,f,l,d=e.find(t,["store","mailbox"]),h=e.find(t,["store","anon_rpc"]);d?h?r?.ticket?a(e=>{p(t,o,r,e((n,t)=>{if(n)return e.abort(),void s(n);c=t.theirPublic,u=t.myCurve,f=t.notifKey}))}).nThen(e=>{var n=i.Curve.deriveKeys(c,u),t=i.Curve.createEncryptor(n),o=JSON.stringify(r.ticket),a=t.encrypt(o);h.send("WRITE_PRIVATE_MESSAGE",[r.channel,a],e((n,t)=>{if(n)return e.abort(),void s(n);l=t&&t[0],s(void 0,l)}))}).nThen(()=>{var t=o?r.notifChannel:n.getChannelIdFromKey(f);t&&d.sendTo("NOTIF_TICKET",{isAdmin:o,title:r.ticket.title,isClose:r.ticket.close,channel:r.channel,time:l,user:e.find(r.ticket,["sender","curvePublic"])?void 0:{supportTeam:!0}},{channel:t,curvePublic:f},()=>{})}):s("E_NO_DATA"):s("anonymous rpc session not ready"):s("E_NOT_READY")},g=function(t,r,o){var a=n.getSecrets("support",r),u={data:{},channel:a.channel,crypto:i.createEncryptor(a.keys),userName:"support",ChainPad:c,classic:!0,network:t.store.network,metadata:{validateKey:a.keys.validateKey||void 0}},f=t.adminDoc=s.create(u);f.proxy.on("ready",function(){var r=f.proxy;if(r.tickets=r.tickets||{},r.tickets.active=r.tickets.active||{},r.tickets.closed=r.tickets.closed||{},r.tickets.pending=r.tickets.pending||{},t.adminRdyEvt.fire(),o(),!t.supportRpc)return;let a=function(n){if(!n.adminDoc||!n.supportRpc)return;let t=n.adminDoc.metadata&&n.adminDoc.metadata.channel,r=n.adminDoc.proxy.tickets,o=[t,...Object.keys(r.active),...Object.keys(r.pending),...Object.keys(r.closed)];return e.deduplicateString(o).sort()}(t),i=n.hashChannelList(a);t.supportRpc.getServerHash(function(e,n){e?console.warn(e):n!==i&&t.supportRpc.reset(a,function(e){e&&console.warn(e)})})}),f.proxy.on("change",["recorded"],function(){h(t,!0,"RECORDED_CHANGE","")}),f.proxy.on("remove",["recorded"],function(){h(t,!0,"RECORDED_CHANGE","")})},E=function(t,o,i){let s=i(),c=t.store.proxy,u=e.find(c,["mailboxes","supportteam","keys","curvePublic"]),f=e.find(c,["mailboxes","supportteam","keys","curvePrivate"]);o||(t.adminRdyEvt=e.mkEvent(!0)),a(e=>{p(t,!1,{},e((n,r)=>{if(setTimeout(s),n)e.abort();else if(r.theirPublic!==u){try{delete c.mailboxes.supportteam,t.store.mailbox.close("supportteam")}catch(e){}return delete t.adminRdyEvt,void e.abort()}}))}).nThen(n=>{!function(n,t){let o,a,i=e.mkAsync(t),s=n.store.proxy,c=e.find(s,["mailboxes","supportteam","keys","curvePrivate"]);if(c){try{let n=d.sign.keyPair.fromSeed(e.decodeBase64(c));o=e.encodeBase64(n.secretKey),a=e.encodeBase64(n.publicKey)}catch(e){return void i(e)}r.create(n.store.network,{edPublic:a,edPrivate:o},(e,t)=>{e?i(e):(console.log("Support RPC ready, public key is ",a),n.supportRpc=t,i())})}else i("EFORBIDDEN")}(t,n(e=>{e&&console.error("Support RPC not ready",e)}))}).nThen(e=>{let r=f.slice(0,24),o=n.getEditHashFromKeys({version:2,type:"support",keys:{editKeyStr:r}});g(t,o,e())}).nThen(()=>{console.log("Support admin loaded")})};var b=function(n,t,r,o){let a=n.store.proxy,i=e.find(a,["mailboxes","supportadmin"]);i?n.store.mailbox.open("supportadmin",i,function(t){n.store.mailbox.close("supportadmin",function(){});let r=e.clone(t||{}),a=[];Object.keys(r).forEach(e=>{let t=r[e];if("CLOSE"===t.type)return void(a.includes(t.content.id)||a.push(t.content.id));let o=t.author,i=t.content&&t.content.title;((e,n,t)=>{let r=e.adminDoc.proxy;return["active","pending","closed"].some(e=>{let o=r.tickets[e];return Object.keys(o).some(e=>{let r=o[e];return r.authorKey===n&&r.title===t&&r.restored})})})(n,o,i)&&(a.includes(t.content.id)||a.push(t.content.id))}),Object.keys(r).forEach(e=>{let n=r[e];n.content&&a.includes(n.content.id)&&delete r[e]}),o(r)},!0,{dump:!0}):o({error:"ENOENT"})};let O=(n,t,r,o)=>{let a;try{let n=d.sign.keyPair.fromSeed(e.decodeBase64(r));a=e.encodeBase64(n.publicKey)}catch(e){return void o(e)}n.Store.adminRpc(null,{cmd:"ADMIN_DECREE",data:["SET_SUPPORT_KEYS",[t,a]]},o)},A=(e,n,t,r)=>{e.Store.adminRpc(null,{cmd:"GET_MODERATORS",data:{}},r)};return f.init=function(r,i,s){var c={};if(r.store&&r.store.modules&&r.store.modules.support)return r.store.modules.support;var u=r.store,f=u.proxy.support=u.proxy.support||{},g={moderatorKeys:l.moderatorKeys,adminKeys:l.adminKeys,supportData:f,store:r.store,Store:r.Store,emit:s,clients:{}};return e.find(u,["proxy","mailboxes","supportteam"])&&E(g,!1,i),c.ctx=g,c.removeClient=function(e){delete g.clients[e]},c.leavePad=function(){},c.addAdminTicket=function(e,n){!function(e,n,r){e.adminRdyEvt?e.adminRdyEvt.reg(()=>{let o;a(t=>{p(e,!0,n,t((e,n)=>{if(e)return t.abort(),void r(!0);o=n.supportKey}))}).nThen(()=>{var a=Math.floor(2e3*Math.random());setTimeout(()=>{var a=e.adminDoc.proxy;a.tickets.active[n.channel]||a.tickets.closed[n.channel]||a.tickets.pending[n.channel]?r(!0):(a.tickets.active[n.channel]={title:n.title,premium:n.premium,time:n.time,author:n.user&&n.user.displayName,supportKey:n.supportKey||o,authorKey:n.user&&n.user.curvePublic},t.whenRealtimeSyncs(e.adminDoc.realtime,function(){r(!0)}),h(e,!0,"NEW_TICKET",n.channel),e.supportRpc&&e.supportRpc.pin([n.channel],()=>{}))},a)})}):r(!0)}(g,e,n)},c.updateAdminTicket=function(e){!function(e,n){e.adminRdyEvt&&e.adminRdyEvt.reg(()=>{var t=Math.floor(2e3*Math.random());setTimeout(()=>{var t=e.adminDoc.proxy;let r=t.tickets.active[n.channel]||t.tickets.pending[n.channel];r&&(n.time<=r.time||(n.isClose&&(t.tickets.closed[n.channel]=r,delete t.tickets.active[n.channel],delete t.tickets.pending[n.channel]),r.time=n.time,r.lastAdmin=!1,h(e,!0,"UPDATE_TICKET",n.channel)))},t)})}(g,e)},c.updateAdminKey=function(t,r){((t,r,o)=>{let i=r.supportKey,s=n.getBoxPublicFromSecret(i),c=t.store.proxy;const u=e.find(c,["mailboxes","supportteam","keys","curvePrivate"]),f=e.find(c,["mailboxes","supportteam","keys","curvePublic"]);p(t,!1,{},(n,r)=>{if(n)return void o(!0);if(s!==r.theirPublic)return void o(!0);if(u===i||f===s)return void o(!0);let c=e.find(t,["store","mailbox"]);try{t.adminDoc&&t.adminDoc.stop(),c&&c.close("supportteam"),t.supportRpc&&t.supportRpc.destroy(),t.adminRdyEvt=e.mkEvent(!0)}catch(e){console.error(e)}t.Store.addAdminMailbox(null,{version:2,priv:i},e=>{e&&e.error?o(!0):a(e=>{E(t,!0,e),t.adminRdyEvt.reg(()=>{h(t,!0,"UPDATE_RIGHTS"),o(!1)})})})})})(g,t,r)},c.checkAdminTicket=function(e,n){!function(e,n,t){e.adminRdyEvt?e.adminRdyEvt.reg(()=>{let r=e.adminDoc.proxy,o=r.tickets.active[n.channel]||r.tickets.pending[n.channel];t(o)}):t(!0)}(g,e,n)},c.addUserTicket=function(e,n){!function(e,n,t){if(!e.supportData)return void t(!0);let r=n.channel;e.supportData[r]={time:n.time,title:n.title,curvePublic:n.supportKey},e.Store.onSync(null,function(){t(!0)})}(g,e,n)},c.updateUserTicket=function(e){!function(e,n){if(h(e,!1,"UPDATE_TICKET",n.channel),n.isClose){let t=e.supportData[n.channel];if(!t)return;t.closed=!0}}(g,e)},c.execCommand=function(r,i,s){var c=i.cmd,u=i.data;"MAKE_TICKET"!==c?"GET_MY_TICKETS"!==c?"REPLY_TICKET"!==c?"CLOSE_TICKET"!==c?"DELETE_TICKET"!==c?"MAKE_TICKET_ADMIN"!==c?"LIST_TICKETS_ADMIN"!==c?"LOAD_TICKET_ADMIN"!==c?"REPLY_TICKET_ADMIN"!==c?"CLOSE_TICKET_ADMIN"!==c?"MOVE_TICKET_ADMIN"!==c?"GET_RECORDED"!==c?"SET_RECORDED"!==c?"USE_RECORDED"!==c?"SEARCH_ADMIN"!==c?"FILTER_TAGS_ADMIN"!==c?"SET_TAGS_ADMIN"!==c?"GET_LEGACY"!==c?"DUMP_LEGACY"!==c?"CLEAR_LEGACY"!==c?"RESTORE_LEGACY"!==c?"GET_PRIVATE_KEY"!==c?"DISABLE_SUPPORT"!==c?"ROTATE_KEYS"!==c?"ADD_MODERATOR"!==c?s({error:"NOT_SUPPORTED"}):function(n,t,r,o){let a=n.store.proxy;var i=e.find(n,["store","mailbox"]);let s=e.find(a,["mailboxes","supportteam","keys","curvePublic"]),c=e.find(a,["mailboxes","supportteam","keys","curvePrivate"]),u=e.find(a,["mailboxes","supportteam","lastKnownHash"]),f=a.edPublic;p(n,!1,{},(e,r)=>{e?o({error:e}):r.theirPublic===s&&n.moderatorKeys.includes(f)?i.sendTo("ADD_MODERATOR",{supportKey:c,lastKnownHash:u},{channel:t.mailbox,curvePublic:t.curvePublic},()=>{o()}):o({error:"EFORBIDDEN"})})}(g,u,0,s):function(t,r,i,s){let c,u=e.once(e.mkAsync(s)),f=t.store.proxy,l=f.edPublic;const h=d.box.keyPair(),v=e.encodeBase64(h.publicKey),y=e.encodeBase64(h.secretKey),m=e.find(f,["mailboxes","supportteam","keys","curvePrivate"]),g=e.find(f,["mailboxes","supportteam","keys","curvePublic"]);if(!y||!v)return void u({error:"INVALID_KEY"});let b;a(e=>{p(t,!1,{},e((n,t)=>{if("E_NOT_INIT"!==n)return n?(u({error:n}),void e.abort()):void(c=t.theirPublic)}))}).nThen(e=>{if(!t.adminKeys.includes(l))return e.abort(),void u({error:"EFORBIDDEN"})}).nThen(e=>{if(c)return t.moderatorKeys.includes(l)?g!==c?(e.abort(),void u({error:"EFORBIDDEN"})):void 0:(e.abort(),void u({error:"EINVAL"}))}).nThen(e=>{c&&t.adminRdyEvt.reg(()=>{let r=t.adminDoc.proxy;b=t.adminDoc.metadata&&t.adminDoc.metadata.channel;let a=y.slice(0,24),i=n.getEditHashFromKeys({version:2,type:"support",keys:{editKeyStr:a}}),s={network:t.store.network,initialState:"{}"};(r.oldKeys=r.oldKeys||{})[g]={curvePrivate:m,rotatedOn:+new Date,rotatedBy:l},o.put(i,JSON.stringify(r),e(n=>{if(n)return e.abort(),void u({error:n})}),s)})}).nThen(e=>{O(t,v,y,e(n=>{if(n&&n.error)return e.abort(),void u(n)}))}).nThen(()=>{if(!c)return;t.adminDoc&&t.adminDoc.stop();let n=e.find(t,["store","mailbox"]);n&&n.close("supportteam"),t.supportRpc&&t.supportRpc.destroy(),t.adminRdyEvt=e.mkEvent(!0)}).nThen(e=>{t.Store.addAdminMailbox(null,{version:2,priv:y},e(n=>{if(n&&n.error)return e.abort(),c?O(t,g,m,()=>{u(n)}):void u(n)}))}).nThen(n=>{if(!c)return;let r=e.find(t,["store","mailbox"]);A(t,0,0,n(e=>{if(e&&e.error)return void u({success:!0,noNotify:!0});let n=e&&e[0];Object.keys(n||{}).forEach(e=>{let t=n[e];r.sendTo("MODERATOR_NEW_KEY",{supportKey:y},{channel:t.mailbox,curvePublic:t.curvePublic},()=>{})})}))}).nThen(e=>{E(t,!0,e)}).nThen(e=>{b&&t.Store.adminRpc(null,{cmd:"ARCHIVE_DOCUMENT",data:{id:b,reason:"Deprecated support pad"}},e())}).nThen(()=>{u({success:!0})})}(g,0,0,s):function(n,t,r,o){let i,s=e.once(e.mkAsync(o)),c=n.store.proxy.edPublic;a(e=>{p(n,!1,{},e(n=>{if(n)return s({error:n}),void e.abort()}))}).nThen(e=>{if(!n.adminKeys.includes(c))return e.abort(),void s({error:"EFORBIDDEN"})}).nThen(e=>{n.Store.adminRpc(null,{cmd:"ARCHIVE_SUPPORT",data:{}},e(n=>{if(n&&n.error)return e.abort(),void s(n)}))}).nThen(e=>{n.Store.adminRpc(null,{cmd:"ADMIN_DECREE",data:["SET_SUPPORT_KEYS",["",""]]},e(function(n){if(n&&n.error)return e.abort(),void s(n)}))}).nThen(e=>{A(n,0,0,e(n=>{if(!n||n.error)return e.abort(),void s();i=n[0]||{}}))}).nThen(()=>{let e=a;Object.keys(i).forEach(t=>{e=e(e=>{n.Store.adminRpc(null,{cmd:"REMOVE_MODERATOR",data:t},e(e=>{e&&e.error&&console.error("Error removing moderator data",t,e.error)}))}).nThen}),e(()=>{s()})})}(g,0,0,s):function(n,t,r,o){let a=n.store.proxy,i=e.find(a,["mailboxes","supportteam","keys","curvePublic"]),s=e.find(a,["mailboxes","supportteam","keys","curvePrivate"]);p(n,!1,{},(e,n)=>{e?o({error:e}):(i&&n.theirPublic!==i&&(s=void 0),o({curvePrivate:s,curvePublic:n.theirPublic}))})}(g,0,0,s):function(t,r,o,a){let i=t.store.proxy,s=e.find(i,["mailboxes","supportadmin"]);if(!s)return void a({error:"ENOENT"});if(!t.adminRdyEvt)return void a({error:"EFORBIDDEN"});let c=r.messages,u=r.hashes,f=c[0],l=c[c.length-1];f?t.adminRdyEvt.reg(()=>{let r={name:e.find(f,["sender","name"]),notifications:e.find(f,["sender","notifications"]),curvePublic:e.find(f,["sender","curvePublic"]),channel:n.createChannelId(),title:f.title,time:l.time,ticket:{legacy:!0,title:f.title,sender:f.sender,messages:c}};y(t,r,!0,e=>{e&&e.error?a(e):(u.forEach(e=>{s.viewed.push(e)}),t.Store.onSync(null,function(){a({done:!0})}))})}):a({error:"EINVAL"})}(g,u,0,s):function(e,n,t,r){let o=e.store.proxy;e.store.mailbox.close("supportadmin",function(){delete o.mailboxes.supportadmin,e.Store.onSync(null,function(){r({done:!0})})})}(g,0,0,s):function(n,t,r,o){let a=n.store.proxy,i=e.find(a,["mailboxes","supportadmin"]);if(!i)return void o({error:"ENOENT"});let s=e.clone(i);s.lastKnownHash=void 0,s.viewed=[],n.store.mailbox.open("supportadmin",s,function(e){n.store.mailbox.close("supportadmin",function(){}),o(e)},!0,{dump:!0})}(g,0,0,s):b(g,0,0,s):((e,n,r,o)=>{e.adminRdyEvt?e.adminRdyEvt.reg(()=>{let r=e.adminDoc.proxy.tickets,a=n.channel;(r.active[a]||r.pending[a]||r.closed[a]).tags=n.tags||[],t.whenRealtimeSyncs(e.adminDoc.realtime,function(){let e=[];["active","pending","closed"].forEach(n=>{let t=r[n];Object.keys(t).forEach(n=>{(t[n].tags||[]).forEach(n=>{e.includes(n)||e.push(n)})})}),o({done:!0,allTags:e})})}):o({error:"EFORBIDDEN"})})(g,u,0,s):((e,n,t,r)=>{if(!e.adminRdyEvt)return void r({error:"EFORBIDDEN"});let o=n.tags||[];e.adminRdyEvt.reg(()=>{let n=e.adminDoc.proxy.tickets;if(!o.length)return void r({all:!0});let t=[];["active","pending","closed"].forEach(e=>{let r=n[e];Object.keys(r).forEach(e=>{(r[e].tags||[]).some(e=>o.includes(e))||t.push(e)})}),r({tickets:t})})})(g,u,0,s):((n,t,r,o)=>{if(!n.adminRdyEvt)return void o({error:"EFORBIDDEN"});let a=t.tags||[],i=(t.text||"").toLowerCase();n.adminRdyEvt.reg(()=>{let t=n.adminDoc.proxy.tickets,r={},s=(n,t,o)=>{let a=e.clone(t);a.category=o,r[n]=a};["active","pending","closed"].some(n=>{let o=t[n];return Object.keys(o).some(t=>{let c=o[t];if(a.length&&!(c.tags||[]).some(e=>a.includes(e)))return;let u=e.hexToBase64(t).slice(0,10);if(i===u)return r={},s(t,c,n),!0;(!i||c.title.toLowerCase().includes(i))&&s(t,c,n)})}),o({tickets:r})})})(g,u,0,s):function(e,n,t,r){if(!e.adminRdyEvt)return void r({error:"EFORBIDDEN"});let o=n.id;e.adminRdyEvt.reg(()=>{let n=e.adminDoc.proxy,t=(n.recorded=n.recorded||{})[o];t&&(t.count=(t.count||0)+1),r()})}(g,u,0,s):function(e,n,r,o){if(!e.adminRdyEvt)return void o({error:"EFORBIDDEN"});let a=n.id,i=n.content,s=Boolean(n.remove);e.adminRdyEvt.reg(()=>{let n=e.adminDoc.proxy,r=n.recorded=n.recorded||{};s?delete r[a]:r[a]={content:i,count:0},t.whenRealtimeSyncs(e.adminDoc.realtime,function(){o({done:!0})})})}(g,u,0,s):function(n,t,r,o){n.adminRdyEvt?n.adminRdyEvt.reg(()=>{let t=n.adminDoc.proxy,r=t.recorded=t.recorded||{};o({messages:e.clone(r)})}):o({error:"EFORBIDDEN"})}(g,0,0,s):function(e,n,r,o){if(!e.adminRdyEvt)return void o({error:"EFORBIDDEN"});let a=n.channel,i=n.from,s=n.to;e.adminRdyEvt.reg(()=>{let n=e.adminDoc.proxy,r=n.tickets[i],c=n.tickets[s];if(!i||!s)return void o({error:"EINVAL"});let u=r[a];u&&!c[a]?(c[a]=u,delete r[a],t.whenRealtimeSyncs(e.adminDoc.realtime,function(){o({moved:!0})})):o({error:"CANT_MOVE"})})}(g,u,0,s):function(e,n,r,o){if(!e.adminRdyEvt)return void o({error:"EFORBIDDEN"});let a=n.supportKey;e.adminRdyEvt.reg(()=>{let r=e.adminDoc.proxy;r.oldKeys&&r.oldKeys[a]&&(n.adminCurvePrivate=r.oldKeys[a].curvePrivate),m(e,n,!0,r=>{if(r)o({error:r});else{var a=e.adminDoc.proxy,i=a.tickets.active[n.channel]||a.tickets.pending[n.channel];i.time=+new Date,i.lastAdmin=!0,a.tickets.closed[n.channel]=i,delete a.tickets.active[n.channel],delete a.tickets.pending[n.channel],t.whenRealtimeSyncs(e.adminDoc.realtime,function(){o({closed:!0})})}})})}(g,u,0,s):function(e,n,t,r){if(!e.adminRdyEvt)return void r({error:"EFORBIDDEN"});let o=n.supportKey;e.adminRdyEvt.reg(()=>{let t=e.adminDoc.proxy;t.oldKeys&&t.oldKeys[o]&&(n.adminCurvePrivate=t.oldKeys[o].curvePrivate),m(e,n,!0,(t,o)=>{if(t)r({error:t});else{var a=e.adminDoc.proxy,i=a.tickets.active[n.channel]||a.tickets.pending[n.channel];i.time=o,i.lastAdmin=!0,r({sent:!0})}})})}(g,u,0,s):function(n,t,r,o){let a=t.supportKey;n.adminRdyEvt.reg(()=>{let r=n.adminDoc.proxy;r.oldKeys&&r.oldKeys[a]&&(t.adminCurvePrivate=r.oldKeys[a].curvePrivate),v(n,t,!0,function(r,a){if(r)return void o({error:r});var i=n.adminDoc.proxy;if(!Array.isArray(a)||!a.length)return void o(a);a.sort((e,n)=>e.time-n.time);let s=a[a.length-1],c=a.some(n=>{let r=e.find(n,["sender","curvePublic"]);if(t.curvePublic===r)return e.find(n,["sender","quota","plan"])});var u=i.tickets.active[t.channel];u&&(s.legacy&&(s=Array.isArray(s.messages)&&s.messages[s.messages.length-1]),u.time=s.time,u.premium=c,s.sender&&(u.lastAdmin=!s.sender.blockLocation),s.close&&(i.tickets.closed[t.channel]=u,delete i.tickets.active[t.channel],h(n,!0,"UPDATE_TICKET",t.channel))),o(a)})})}(g,u,0,s):function(n,t,r,o){n.adminRdyEvt?(n.clients[r]||(n.clients[r]={admin:!0}),n.adminRdyEvt.reg(()=>{var r=n.adminDoc.proxy;return"pending"===t.type?o(e.clone(r.tickets.pending)):"closed"===t.type?o(e.clone(r.tickets.closed)):void o(e.clone(r.tickets.active))})):o({error:"EFORBIDDEN"})}(g,u,r,s):function(e,n,t,r){e.adminRdyEvt?e.adminRdyEvt.reg(()=>{y(e,n,!0,r)}):r({error:"EFORBIDDEN"})}(g,u,0,s):function(e,n,t,r){let o=e.supportData,a=n.channel;o[a]&&o[a].closed?(delete o[a],r({deleted:!0})):r({error:"ENOTCLOSED"})}(g,u,0,s):function(e,n,t,r){m(e,n,!1,e=>{r(e?{error:e}:{closed:!0})})}(g,u,0,s):function(e,n,t,r){m(e,n,!1,e=>{r(e?{error:e}:{sent:!0})})}(g,u,0,s):function(n,t,r,o){var i=[],s=a;n.clients[r]||(n.clients[r]={admin:!1}),Object.keys(n.supportData).forEach(function(t){s=s(r=>{var o=e.clone(n.supportData[t]);v(n,{channel:t,curvePublic:o.curvePublic},!1,r((e,r)=>{if(e){if("EDELETED"===e.type)return void delete n.supportData[t];o.error=e}else o.messages=r,r.length&&r[r.length-1].close&&(n.supportData[t].closed=!0,o.closed=!0);o.id=t,i.push(o)}))}).nThen}),s(()=>{i.sort((e,n)=>e.closed&&n.closed?e.time-n.time:e.closed?1:n.closed?-1:e.time-n.time),o({tickets:i})})}(g,0,r,s):function(e,n,t,r){y(e,n,!1,r)}(g,u,0,s)},c},f})(Z(),te(),je(),In(),xn(),qe(),M(),T(),x(),D()),pt}function Mt(){if(mt)return yt;mt=1;var e,n,t;return e=M(),t=function(n,t,r,o){var a=t.channel,i=t.secret;i.keys.cryptKey&&(i.keys.cryptKey=function(e){for(var n=Object.keys(e).length,t=new Uint8Array(n),r=0;r{e.pending[n.uid]?(delete e.pending[n.uid],r(t)):setTimeout(r,1e3)}),e.emit("MESSAGE",i,a.clients.filter(function(e){return e!==t}))}else r({error:"NO_CHAN"})}else r({error:"NO_CLIENT"})}(a,i,e,r):t(a,i,e,r)},o},yt=n}function Ft(){if(Et)return gt;Et=1;var e,n;return n=function(e,n,t){var r=e.clients[n];if(r){var o=e.channels[r.channel];o?(t(),o.history.forEach(function(t){e.emit("MESSAGE",{msg:t,validateKey:o.validateKey},[n])}),e.emit("HISTORY_SYNCED",{},[n])):t({error:"ENOCHAN"})}else t({error:"ENOENT"})},(e={}).init=function(e,t){var r={},o={store:e,emit:t,channels:{},clients:{}};return r.removeClient=function(e){!function(e,n){var t,r=function(e){return e!==n};for(var o in e.channels)(t=e.channels[o]).clients=t.clients.filter(r),0===t.clients.length&&(t.wc&&t.wc.leave(),delete e.channels[o]);if(e.clients[n]){var a=e.clients[n].channel,i=e.channels[a];i&&e.emit("LEAVE",{id:n},[i.clients[0]]),delete e.clients[n]}}(o,e)},r.leavePad=function(e){!function(e,n){Object.keys(e.channels).some(function(t){var r=e.channels[t];if(r.padChan===n)return r.wc&&r.wc.leave(),delete e.channels[t],!0})}(o,e)},r.execCommand=function(e,t,r){var a=t.cmd,i=t.data;"SEND_MESSAGE"!==a?"UPDATE_HASH"!==a?"OPEN_CHANNEL"!==a?"GET_HISTORY"!==a?"REENCRYPT"!==a||function(e,n,t,r){var o=n.channel,a=e.store.network,i=function(e){var t=a.historyKeeper,o={metadata:n.metadata},i=["GET_HISTORY",e.id,o];a.sendto(t,JSON.stringify(i)),n.msgs.forEach(function(n){e.bcast(n)}),e.leave(),r()};e.store.anon_rpc.send("IS_NEW_CHANNEL",o,function(e,n){var t;e?r({error:e}):(n&&n.length&&"object"==typeof n[0]?t=n[0].isNew:r({error:"INVALID_RESPONSE"}),t?a.join(o).then(i,function(e){r({error:e})}):r({error:"EEXISTS"}))})}(o,i,0,r):n(o,e,r):function(e,t,r,o){var a=t.channel,i=t.padChan,s=e.store.network,c=!0,u=e.clients[r];if(u)o();else{u=e.clients[r]={channel:a};var f=e.channels[a];if(f)return u.id||(u.id=f.wc.myID+"-"+r),n(e,r,function(){e.emit("READY",f.clients,[r])}),f.clients.push(r),void o();var l=Math.floor(1e6*Math.random()),d=function(n){e.channels[a]=e.channels[a]||{history:[],validateKey:t.validateKey},(f=e.channels[a]).padChan=i,u.id||(u.id=n.myID+"-"+r),f.clients&&f.clients.forEach(function(t){e.clients[t]&&(e.clients[t].id=n.myID+"-"+t)}),n.on("join",function(){}),n.on("leave",function(){}),n.on("message",function(n){f.history.push(n),e.emit("MESSAGE",{msg:n,validateKey:f.validateKey},f.clients)}),f.wc=n,f.sendMsg=function(e,t){t=t||function(){};var r=e.slice(0,64);n.bcast(e).then(function(){f.history.push(e),f.lastKnownHash=r,t()},function(e){t({error:e})})},c&&(f.clients=[r],f.lastCpHash=t.lastCpHash,c=!1,o());var d=s.historyKeeper,h={txid:l,lastKnownHash:f.lastKnownHash||f.lastCpHash,metadata:{forcePlaceholder:!0,validateKey:t.validateKey,owners:t.owners,expire:t.expire}},p=["GET_HISTORY",n.id,h];d&&s.sendto(d,JSON.stringify(p)).then(function(){},function(e){console.error(e)})};s.on("message",function(n,t){if(e.channels[a]&&t===s.historyKeeper){var r;try{r=JSON.parse(n)}catch(e){}if(r&&!(r.txid&&r.txid!==l||r.channel&&r.channel!==a))if(r.validateKey&&r.channel)f.validateKey||(f.validateKey=r.validateKey);else if(r.state&&1===r.state&&r.channel)e.emit("READY",f.clients,f.clients);else if(r.error&&r.channel)e.emit("READY",f.clients,f.clients);else if(!(Array.isArray(r)&&r[0]&&r[0]!==l||(n=r[4],r[3]!==a))){var o=n.slice(0,64);o!==f.lastKnownHash&&o!==f.lastCpHash&&(f.lastKnownHash=o,e.emit("MESSAGE",{msg:n},f.clients),f.history.push(n))}}}),s.join(a).then(d,function(e){o({error:e})}),s.on("reconnect",function(){e.channels[a]&&s.join(a).then(d,function(e){console.error(e)})})}}(o,i,e,r):function(e,n,t,r){var o=e.clients[t];if(o){var a=e.channels[o.channel];if(a){var i=n,s=-1;a.history.some(function(e,n){if(e.slice(0,64)===i)return s=n+1,!0}),-1!==s&&(a.history=a.history.slice(s)),r()}else r({error:"INVALID_CHANNEL"})}else r({error:"NOT_IN_CHANNEL"})}(o,i,e,r):function(e,n,t,r){var o=e.clients[t];if(o){var a=e.channels[o.channel];if(a){var i=function(o){o&&o.error?r(o):(e.emit("MESSAGE",{msg:n.msg},a.clients.filter(function(e){return e!==t})),r())};n.isCp?a.sendMsg(n.isCp,i):a.sendMsg(n.msg,i)}else r({error:"INVALID_CHANNEL"})}else r({error:"NOT_IN_CHANNEL"})}(o,i,e,r)},r},gt=e}function Lt(){if(Ot)return bt;Ot=1;return bt=((e,n,t,r,o,a,i,s)=>{var c={};const u=e.mkEvent(!0);return c.init=function(c,f,l){var d={},h=c.store;if(h.loggedIn&&h.proxy.edPublic){var p={Store:c.Store,store:h,pinPads:c.pinPads,updateMetadata:c.updateMetadata,emit:l,onReadyHandlers:[],clients:[]};return p.profile=h.proxy.profile=h.proxy.profile||{},function(e,t){var r=e.profile;if(r.edit&&r.view)setTimeout(t);else{var o=n.createRandomHash("profile"),a=n.getSecrets("profile",o);e.pinPads([a.channel],function(e){e.error?t(e.error):(r.edit=n.getEditHashFromKeys(a),r.view=n.getViewHashFromKeys(a),setTimeout(t))})}}(p,f(function(r){r||function(r){var o=r.profile,c=n.getSecrets("profile",o.edit),f=i.createEncryptor(c.keys),l={data:{},network:r.store.network,channel:c.channel,crypto:f,owners:[r.store.proxy.edPublic],ChainPad:s,validateKey:c.keys.validateKey||void 0,userName:"profile",classic:!0},d=a.create(l);d.proxy.on("create",function(){}).on("ready",function(){if(d.proxy.name=r.store.proxy[t.displayNameKey]||"",r.listmap=d,d.proxy.curvePublic||(d.proxy.curvePublic=r.store.proxy.curvePublic),d.proxy.notifications||(d.proxy.notifications=e.find(r.store.proxy,["mailboxes","notifications","channel"])),d.proxy.edPublic||(d.proxy.edPublic=r.store.proxy.edPublic),!d.proxy.proof){let n=c.channel,t=e.decodeUTF8(n),o=e.decodeBase64(r.store.proxy.edPrivate),a=i.Nacl.sign(t,o),s=e.encodeBase64(a);d.proxy.proof=s}r.onReadyHandlers.length&&(r.onReadyHandlers.forEach(function(e){try{e(d.proxy)}catch(e){console.error(e)}}),r.onReadyHandlers=[]),u.fire()}).on("change",[],function(){r.emit("UPDATE",d.proxy,r.clients)})}(p)})),d.setName=function(e){!function(e,n){e.listmap.proxy.name=n,r.whenRealtimeSyncs(e.listmap.realtime,function(){e.listmap&&e.emit("UPDATE",e.listmap.proxy,e.clients)})}(p,e)},d.removeClient=function(e){!function(e,n){var t=e.clients.indexOf(n);-1!==t&&e.clients.splice(t,1)}(p,e)},d.update=function(){p.listmap&&p.emit("UPDATE",p.listmap.proxy,p.clients)},d.execCommand=function(e,n,t){console.log(n);var a=n.cmd,i=n.data;"SUBSCRIBE"!==a?"SET"!==a||function(e,n,t,a){u.reg(()=>{var i=n.key,s=n.value;i&&(e.listmap.proxy[i]=s,r.whenRealtimeSyncs(e.listmap.realtime,function(){e.emit("UPDATE",e.listmap.proxy,e.clients.filter(function(e){return e!==t})),"badge"===i?e.Store.set(null,{key:["profile","badge"],value:s||void 0},()=>{o.updateMyData(e.store),e.updateMetadata()}):"avatar"===i&&e.Store.set(null,{key:["profile","avatar"],value:s||""},()=>{o.updateMyData(e.store),e.updateMetadata()}),a(e.listmap.proxy)}))})}(p,i,e,t):function(e,n,t,r){-1===e.clients.indexOf(t)&&e.clients.push(t),e.listmap?r(e.listmap.proxy):e.onReadyHandlers.push(function(e){r(e)})}(p,0,e,t)},d}},c})(Z(),te(),Y(),je(),On(),T(),M(),x()),bt}function Ht(){if(wt)return At;wt=1;return At=function(e,n,t,r,o,a){var i={},s=function(e){return Boolean(e&&"object"==typeof e&&!Array.isArray(e))},c=function(e){return e.slice(0,64)},u=function(n,t){var r=e.find(t,[n,"role"]);return-1!==["OWNER","ADMIN"].indexOf(r)},f=function(n,t,r){var o=e.find(r,[n,"role"]);return!!o&&(!!function(e){return-1!==["OWNER","ADMIN","MEMBER","VIEWER"].indexOf(e)}(t)&&("OWNER"===o||"ADMIN"===o&&-1!==["ADMIN","MEMBER","VIEWER"].indexOf(t)))},l=function(e){return"string"==typeof e&&44===e.length},d=i.commands={};d.ADD=function(e,n,t){if(!s(e))throw new Error("INVALID ARGS");if(!t.internal.initialized)throw new Error("UNITIALIZED");if(void 0===t.state.members)throw new Error("CANNOT_ADD_TO_UNITIALIZED_ROSTER");var r=t.state.members;Object.keys(e).forEach(function(t){if(!l(t))throw console.log(t,t.length),new Error("INVALID_CURVE_KEY");if(!s(e[t]))throw new Error("INVALID_CONTENT");if(r[t])throw new Error("ALREADY_PRESENT");var o=e[t];if("string"!=typeof o.role&&(o.role="MEMBER"),!f(n,o.role,r))throw new Error("INSUFFICIENT_PERMISSIONS");if("string"!=typeof o.displayName)throw new Error("DISPLAYNAME_REQUIRED");if("string"!=typeof o.notifications)throw new Error("NOTIFICATIONS_REQUIRED")});var o=!1;return Object.keys(e).forEach(function(n){o=!0,r[n]=e[n]}),o},d.RM=function(n,t,r){if(!Array.isArray(n))throw new Error("INVALID_ARGS");if(void 0===r.state.members)throw new Error("CANNOT_RM_FROM_UNITIALIZED_ROSTER");var o=r.state.members;n.forEach(function(n){if(!l(n))throw new Error("INVALID_CURVE_KEY");if(n!==t){var r=o[n].role;if(!function(n,t,r){var o=e.find(r,[n,"role"]);return!!o&&("OWNER"===o||"ADMIN"===o&&-1!==["ADMIN","MEMBER","VIEWER"].indexOf(t))}(t,r,o))throw new Error("INSUFFICIENT_PERMISSIONS")}});var a=!1;return n.forEach(function(e){o[e]&&(a=!0,delete o[e])}),a},d.DESCRIBE=function(n,t,o){if(!n||"object"!=typeof n||Array.isArray(n))throw new Error("INVALID_ARGUMENTS");if(void 0===o.state.members)throw new Error("NOT_READY");var a=o.state.members;Object.keys(n).forEach(function(r){if(!l(r))throw new Error("INVALID_ID");if(!a[r])throw new Error("NOT_PRESENT");if(!function(n,t,r){if(!r[t])return!1;if(n===t&&r[t])return!0;var o=e.find(r,[n,"role"]),a=e.find(r,[t,"role"]);return!!o&&("OWNER"===o||"ADMIN"===o&&"OWNER"!==a)}(t,r,a))throw new Error("INSUFFICIENT_PERMISSIONS");var o=n[r];if(!s(o))throw new Error("INVALID_ARGUMENTS");var i=e.clone(a[r]);if("string"==typeof o.role&&!function(n,t,r,o){return!(n!==t||!o[t])&&("MEMBER"===e.find(o,[n,"role"])?"VIEWER"===r:void 0)}(t,r,o.role,a)&&!f(t,o.role,a))throw new Error("INSUFFICIENT_PERMISSIONS");if("string"!=typeof i.displayName&&"string"!=typeof o.displayName)throw new Error("DISPLAYNAME_REQUIRED");if(-1===["undefined","string"].indexOf(typeof o.displayName))throw new Error("INVALID_DISPLAYNAME");if("string"!=typeof i.notifications&&"string"!=typeof o.notifications)throw new Error("NOTIFICATIONS_REQUIRED");if(-1===["undefined","string"].indexOf(typeof o.notifications))throw new Error("INVALID_NOTIFICATIONS")});var i=!1;return Object.keys(n).forEach(function(t){var o=e.clone(a[t]),s=n[t];Object.keys(s).forEach(function(e){void 0===o[e]||null!==s[e]?o[e]=s[e]:delete o[e]}),r(o)!==r(a[t])&&(i=!0,a[t]=o)}),i},d.CHECKPOINT=function(e,n,t){if(!s(e))throw new Error("INVALID_CHECKPOINT_STATE");if(!t.internal.initialized){t.state=e;var o=t.state.metadata=t.state.metadata||{};return o.topic=o.topic||"",o.name=o.name||"",o.avatar=o.avatar||"",t.internal.initialized=!0,!0}if(r(e)!==r(t.state))throw new Error("CHECKPOINT_DOES_NOT_MATCH_PREVIOUS_STATE");if(!u(n,t.state.members))throw new Error("INSUFFICIENT_PERMISSIONS");return t.state=e,!0};var h=["avatar","name","topic"];d.METADATA=function(n,t,r){if(!s(n))throw new Error("INVALID_ARGS");if(!function(n,t){var r=e.find(t,[n,"role"]);return Boolean(r&&-1!==["OWNER","ADMIN"].indexOf(r))}(t,r.state.members))throw new Error("INSUFFICIENT_PERMISSIONS");Object.keys(n).forEach(function(e){if(null===n[e]){if(-1===h.indexOf(e))return;throw new Error("CANNOT_REMOVE_MANDATORY_METADATA")}if("string"!=typeof n[e])throw new Error("INVALID_ARGUMENTS")});var o=!1;return Object.keys(n).forEach(function(e){void 0!==r.state.metadata[e]&&null===n[e]&&(o=!0,delete r.state.metadata[e]),n[e]!==r.state.metadata[e]&&(o=!0,r.state.metadata[e]=n[e])}),o},d.INVITE=function(e,n,t){if(!s(e))throw new Error("INVALID_ARGS");if(!t.internal.initialized)throw new Error("UNINITIALIED");if(void 0===t.state.members)throw new Error("CANNOT+INVITE_TO_UNINITIALIED_ROSTER");var r=t.state.members;Object.keys(e).forEach(function(t){if(!l(t))throw console.log(t,t.length),new Error("INVALID_CURVE_KEY");if(!s(e[t]))throw new Error("INVALID_CONTENT");if(r[t])throw new Error("ARLEADY_PRESENT");var o=e[t];if("string"!=typeof o.role&&(o.role="VIEWER"),void 0===o.pending&&(o.pending=!0),!f(n,o.role,r))throw new Error("INSUFFICIENT_PERMISSIONS");if("string"!=typeof o.displayName||!o.displayName)throw new Error("DISPLAYNAME_REQUIRED")});var o=!1;return Object.keys(e).forEach(function(n){o=!0,r[n]=e[n]}),o},d.ACCEPT=function(n,t,r){if(!r.internal.initialized)throw new Error("UNINITIALIED");if(void 0===r.state.members)throw new Error("CANNOT_ADD_TO_UNINITIALIED_ROSTER");var o=r.state.members;if(!s(o[t]))throw new Error("INSUFFICIENT_PERMISSIONS");if(!o[t].pending)throw new Error("ALREADY_PRESENT");if("string"!=typeof n)throw new Error("INVALID_ARGS");if(!l(n))throw new Error("INVALID_CURVE_KEY");var a=n;if(void 0!==o[a])throw new Error("MEMBER_ALREADY_PRESENT");var i=e.clone(o[t]);delete i.remaining,delete i.totalUses,delete i.inviteChannel,delete i.previewChannel,o[a]=i;var c=o[t].remaining||1;return-1===c||(c>1?o[t].remaining=c-1:delete o[t]),!0};var p=function(e,n,t){if(!Array.isArray(e)||"string"!=typeof n)throw new Error("INVALID ARGUMENTS");var r=e[0];if("function"!=typeof d[r])throw new Error("INVALID_COMMAND");return d[r](e[1],n,t)},v=function(n,t,r){return p(n,t,e.clone(r))};return i.create=function(n,i){if("function"!=typeof i)throw new Error("EXPECTED_CALLBACK");var f=e.once(e.mkAsync(i));if(n.network)if(n.channel&&"string"==typeof n.channel&&32===n.channel.length)if(n.keys&&"object"==typeof n.keys)if(n.store){var d=e.response(function(e,n){console.error("ROSTER_RESPONSE__"+e,n)}),h=n.store,y=n.keys,m=y.myCurvePublic,g=n.channel,E=n.lastKnownHash||-1;n.newTeam&&(E=void 0);var b={state:{members:{},metadata:{}},internal:{initialized:!1,sinceLastCheckpoint:0,lastCheckpointHash:E}},O={},A={change:e.mkEvent(),checkpoint:e.mkEvent()};O.on=function(e,n){if("object"!=typeof A[e])throw new Error("unsupported event");return A[e].reg(n),O},O.off=function(e,n){if("object"!=typeof A[e])throw new Error("unsupported event");return A[e].unreg(n),O},O.once=function(e,n){if("object"!=typeof A[e])throw new Error("unsupported event");var t=function(){n.apply(null,Array.prototype.slice.call(arguments)),A[e].unreg(t)};return A[e].reg(t),O},O.getState=function(){return e.clone(b.state)},O.getLastCheckpointHash=function(){return b.internal.lastCheckpointHash||-1};var w=function(){b.internal.pendingCheckpointId&&(d.clear(b.internal.pendingCheckpointId),delete b.internal.pendingCheckpointId),clearTimeout(b.internal.checkpointTimeout),delete b.internal.checkpointTimeout};O.stop=function(){b.internal.cpNetflux&&"function"==typeof b.internal.cpNetflux.stop?(b.internal.cpNetflux.stop(),w()):console.log("FAILED TO LEAVE")};var D,_,T,S=!1,N=function(){if(n.onCacheReady){var e=b.state;if(Object.keys(e.members||{}).length)n.onCacheReady(O);else{try{b.internal.cpNetflux.resetCache()}catch(e){console.error(e)}n.onCacheReady({error:"CORRUPTED"})}}},I=function(){S=!0,f(void 0,O)},x=function(e){e&&"EUNKNOWN"===e.type||(S?console.error("CHANNEL_ERROR",e):f(e))},C=function(e){e.state||(S=!1)},R=function(){console.log("ROSTER CONNECTED")},P=function(){return Boolean(S&&m)},k=function(n,t,r,o,a,i){D!==a&&b.internal.sinceLastCheckpoint++,D=a;var s=e.tryParse(n);if(s){var f,l;try{f=p(s,i,b)}catch(e){l=e.message}var h=c(a);if(d.expected(h)){if(l)return void d.handle(h,[l]);try{f?d.handle(h,[void 0,O.getState()]):(d.handle(h,["NO_CHANGE"]),console.log(n))}catch(e){console.log("CAUGHT",e)}}if("CHECKPOINT"===s[0]&&f?(P()&&A.checkpoint.fire(a),b.internal.sinceLastCheckpoint=0,b.internal.lastCheckpointHash=a):f&&P()&&A.change.fire(),w(),P()&&function(e,n){if(!u(e,n.state.members))return!1;var t=n.internal.sinceLastCheckpoint;return!(!t||"number"!=typeof t||t<25)}(m,b)){var v=1e3*Math.floor(20*Math.random())+5e3;b.internal.checkpointTimeout=setTimeout(function(){b.internal.pendingCheckpointId=O.checkpoint(function(e){e&&console.error(e)})},v)}}else console.error("could not parse")},M=function(n,t){var r=e.tryParse(n);return"CHECKPOINT"===r[0]&&v(r,t,b)},F=function(e,n){if(P()){var t=h.anon_rpc;if(t){var o=!1;try{o=v(e,y.myCurvePublic,b)}catch(e){return void n(e.message)}if(o){var a=T.encrypt(r(e)),i=c(a);return d.expect(i,function(e,t){e?n(e):n(void 0,t,i)},3e4),t.send("WRITE_PRIVATE_MESSAGE",[g,a],function(e){if(e)return d.handle(i,[e.message||e])}),i}n("NO_CHANGE")}else n("ANON_RPC_NOT_READY")}else n("NOT_READY")};O.init=function(n,t){var r=e.once(e.mkAsync(t));if(b.internal.initialized)r("ALREADY_INITIALIZED");else if(s(n)){var o=e.clone(n);o.role="OWNER";var a={};a[m]=o,F(["CHECKPOINT",{members:a}],r)}else r("INVALID_ARGUMENTS")},O.checkpoint=function(n){var t=e.once(e.mkAsync(n));F(["CHECKPOINT",e.clone(b.state)],t)},O.add=function(n,t){var r=e.once(e.mkAsync(t));if(!b.internal.initialized)return r("UNINITIALIZED");if(s(n)){var o=e.clone(n);Object.keys(o).forEach(function(e){if(!l(e)||s(b.state.members[e]))return delete o[e]}),F(["ADD",o],r)}else r("INVALID_ARGUMENTS")},O.remove=function(n,t){var r=e.once(e.mkAsync(t)),o=b.state;if(!o)return r("UNINITIALIZED");if(Array.isArray(n)){var a=e.clone(n),i=[],s=Object.keys(o.members);a.forEach(function(e){-1!==s.indexOf(e)&&i.push(e)}),F(["RM",i],r)}else r("INVALID_ARGUMENTS")},O.describe=function(n,t){var r=e.once(e.mkAsync(t)),o=b.state;if(!o)return r("UNINITIALIZED");if(s(n)){var a=e.clone(n);Object.keys(a).some(function(e){var n=a[e];if(s(n)||delete a[e],!s(o.members[e]))return!0;Object.keys(n).forEach(function(t){n[t]===o.members[e][t]&&delete n[t]})})?r("INVALID_ARGUMENTS"):F(["DESCRIBE",a],r)}else r("INVALID_ARGUMENTS")},O.metadata=function(n,t){var r=e.once(e.mkAsync(t)),o=b.state.metadata;if(s(n)){var a=e.clone(n);Object.keys(a).forEach(function(e){a[e]===o[e]&&delete a[e]}),F(["METADATA",a],r)}else r("INVALID_ARGUMENTS")},O.invite=function(n,t){var r=e.once(e.mkAsync(t));if(!b.state)return r("UNINITIALIZED");if(!b.internal.initialized)return r("UNINITIALIZED");if(s(n)){var o=e.clone(n);Object.keys(o).forEach(function(e){if(!l(e)||s(b.state.members[e]))return delete o[e]}),F(["INVITE",o],r)}else r("INVALID_ARGUMENTS")},O.accept=function(n,t){var r=e.once(e.mkAsync(t));"string"==typeof n&&l(n)?F(["ACCEPT",n],r):r("INVALID_ARGUMENTS")},o(function(e){h.anon_rpc&&h.anon_rpc.send("GET_METADATA",g,function(n,t){if(n)return e.abort(),void console.error(n);_=b.internal.metadata=t&&t[0]||void 0})}).nThen(function(e){if(!n.keys.teamEdPublic&&_&&_.validateKey&&(n.keys.teamEdPublic=_.validateKey),!n.keys.teamEdPublic)return e.abort(),void f("NO_VALIDATE_KEY");try{T=a.Team.createEncryptor(n.keys)}catch(n){return e.abort(),void f(n)}}).nThen(function(){"string"==typeof E&&console.log("Synchronizing from checkpoint"),b.internal.cpNetflux=t.start({lastKnownHash:E,network:n.network,channel:n.channel,crypto:T,validateKey:n.keys.teamEdPublic,owners:n.owners,Cache:n.Cache,isCacheCheckpoint:M,onCacheReady:N,onChannelError:x,onReady:I,onConnect:R,onConnectionChange:C,onMessage:k,noChainPad:!0})})}else f("EXPECTED_STORE");else f("EXPECTED_CRYPTO_KEYS");else f("EXPECTED_CHANNEL");else f("EXPECTED_NETWORK")},i}(Z(),te(),D(),bn(),qe(),M()),At}function jt(){if(St)return Tt;St=1;return Tt=((e,n,t,r,o,a,i,s,c,u,f,l,d,h,p,v,y,m,g,E)=>{const b={};E=E||"undefined"!=typeof window&&window.nacl;var O=e.mkEvent(!0),A=function(){},w=function(e,t,r,o){t&&(o||(r.on("change",["drive",a.SHARED_FOLDERS],function(o,s,c){if(c.length>3&&"password"===c[3]){var u=c[2],f=r.drive[a.SHARED_FOLDERS][u],l=t.manager.user.userObject.getHref?t.manager.user.userObject.getHref(f):f.href,d=n.parsePadUrl(l),h=n.getSecrets(d.type,d.hash,o);return setTimeout(function(){i.updatePassword(e.Store,{oldChannel:h.channel,password:s,href:l},e.store.network,function(){console.log("Shared folder password changed")})}),!1}}),r.on("disconnect",function(){t.offline=!0,t.sendEvent("NETWORK_DISCONNECT",t.id)}),r.on("reconnect",function(){t.offline=!1,t.sendEvent("NETWORK_RECONNECT",t.id)})),r.on("change",[],function(n,r,i){if(o){if(i[0]===a.FILES_DATA&&"object"==typeof r&&r.channel&&!r.owners){var s=[r.channel];r.rtChannel&&s.push(r.rtChannel),r.lastVersion&&s.push(r.lastVersion),t.pin(s,function(e){e&&e.error&&console.error(e.error)})}if(i[0]===a.FILES_DATA&&"object"==typeof n&&n.channel&&!r){var c=[n.channel];t.manager.findChannel(n.channel).some(function(e){return e.fId!==o})||(n.rtChannel&&c.push(n.rtChannel),n.lastVersion&&c.push(n.lastVersion),t.unpin(c,function(e){e&&e.error&&console.error(e)}))}}n&&!r&&Array.isArray(i)&&(i[0]===a.FILES_DATA||"drive"===i[0]&&i[1]===a.FILES_DATA)&&setTimeout(function(){e.Store.checkDeletedPad(n&&n.channel)}),t.sendEvent("DRIVE_CHANGE",{id:o,old:n,new:r,path:i})}),r.on("remove",[],function(e,n){t.sendEvent("DRIVE_REMOVE",{id:o,old:e,path:n})}))},D=function(e,n){var t=e.teams[n];if(t){try{t.listmap.stop()}catch(e){}try{t.roster.stop()}catch(e){}t.proxy={},t.stopped=!0,t?.rpc?.destroy(),delete e.teams[n],delete e.cache[n],delete e.store.proxy.teams[n],e.emit("LEAVE_TEAM",n,t.clients),e.updateMetadata(),e.store.calendar&&e.store.calendar.closeTeam(n),e.store.mailbox&&e.store.mailbox.close("team-"+n,function(){})}},_=function(e,n,t,r){n.rpc?r():t.edPrivate&&t.edPublic?h.create(e.store.network,t,function(e,t){e?r(e):(n.rpc=t,n&&n.onRpcReadyEvt&&n.onRpcReadyEvt.fire(),r())},d):r("EFORBIDDEN")},T=function(t,r,a,s,c,u,f){var l=e.once(e.mkAsync(f));if(t.cache[r])l();else{var d=a.proxy,h={id:r,proxy:d,listmap:a,clients:[],realtime:a.realtime,handleSharedFolder:function(e,n){!function(e,n,t,r){var o=e.teams[n];o&&(r?(o.sharedFolders[t]=r,w(e,o,r.proxy,t)):delete o.sharedFolders[t])}(t,r,e,n)},sharedFolders:{},roster:s,onRpcReadyEvt:e.mkEvent(!0),offline:!0};t.cache[r]=h,u&&h.clients.push(u),s.on("change",function(){var n=s.getState(),o=e.find(t,["store","proxy","curvePublic"]);if(n.members&&Object.keys(n.members).length)if(n.members[o]){var a=e.find(t,["store","proxy","teams",r]);a&&(a.metadata=n.metadata),t.updateMetadata(),t.emit("ROSTER_CHANGE",r,h.clients)}else D(t,r);else console.error(JSON.stringify(n))}),s.on("checkpoint",function(n){e.find(t,["store","proxy","teams",r,"keys","roster"]).lastKnownHash=n}),h.sendEvent=function(e,n,r){t.emit(e,n,h.clients.filter(function(e){return e!==r}))},h.getChatData=function(){var e=c.chat||{},t=e.edit||e.view;if(!t)return{};var o=n.getSecrets("chat",t);return{teamId:r,channel:o.channel,secret:o,validateKey:e.validateKey}},h.pin=function(e,n){c.drive.edPrivate?h.rpc?("function"!=typeof n&&console.error("expected a callback"),h.rpc.pin(e,function(e,t){n(e?{error:e}:{hash:t})})):n({error:"TEAM_RPC_NOT_READY"}):n({error:"EFORBIDDEN"})},h.unpin=function(e,n){c.drive.edPrivate?h.rpc?("function"!=typeof n&&console.error("expected a callback"),h.rpc.unpin(e,function(e,t){n(e?{error:e}:{hash:t})})):n({error:"TEAM_RPC_NOT_READY"}):n({error:"EFORBIDDEN"})};var p=t.store.proxy.teams[h.id],v=p.hash||p.roHash,y=n.getSecrets("team",v,p.password),m=h.manager=o.create(d.drive,{onSync:function(e){t.Store.onSync(r,e)},edPublic:c.drive.edPublic,pin:h.pin,unpin:h.unpin,loadSharedFolder:function(e,n,r,o){i.load({isNew:o,network:t.store.network||t.store.networkPromise,store:h,isNewChannel:t.Store.isNewChannel,Store:t.Store},e,n,r)},settings:{drive:e.find(t.store,["proxy","settings","drive"])},removeOwnedChannel:function(e,n){var o;"object"==typeof e?(e.teamId=r,o=e):o={channel:e,teamId:r},t.Store.pad.destroy("",o,n)},Store:t.Store,store:t.store},{teamId:h.id,outer:!0,edPublic:c.drive.edPublic,loggedIn:!0,log:function(e){h.sendEvent("DRIVE_LOG",e)},rt:h.realtime,editKey:y.keys.secondaryKey,readOnly:Boolean(!y.keys.secondaryKey)});h.secondaryKey=y&&y.keys.secondaryKey,h.userObject=m.user.userObject,g(function(e){t.teams[r]=h,w(t,h,d);var n=t.store.network||t.store.networkPromise;i.loadSharedFolders(t.Store,n,h,h.proxy.drive,h.userObject,e,function(e){t.progress+=70/(t.numberOfTeams*e.max),t.updateProgress({progress:t.progress})},!0)}).nThen(function(){t.store.modules.calendar&&t.store.modules.calendar.openTeam(r),l()})}},S=function(t,r,o,a,s,c,u){var f,l=a.getState(),d=e.find(t,["store","proxy","teams",r]);d&&(d.metadata=l.metadata),delete t.nocache[r],t.store.proxy.teams[r]&&g(function(e){T(t,r,o,a,s,c,e()),f=t.teams[r]||t.cache[r],s.drive.edPrivate&&_(t,f,s.drive,e(function(){}))}).nThen(function(e){f.userObject.fixFiles(),i.checkMigration(f.secondaryKey,f.proxy?.drive,f.userObject,e()),i.loadSharedFolders(t.Store,t.store.network,f,f.proxy?.drive,f.userObject,e,function(e){t.progress+=70/(t.numberOfTeams*e.max),t.updateProgress({progress:t.progress})})}).nThen(function(){if(f.rpc){var o=function(n,t){var r=n.teams[t];if(!r)return null;var o=r.manager.getChannelsList("pin"),a=n.store.proxy.teams[t];o.push(`${a.channel}#drive`);var i=e.find(a,["keys","chat","channel"]),s=e.find(a,["keys","roster","channel"]),c=e.find(a,["keys","mailbox","channel"]);if(i&&o.push(i),s&&o.push(s),c&&o.push(c),r.proxy.calendars){var u=Object.keys(r.proxy.calendars).map(function(e){return r.proxy.calendars[e].channel});o=o.concat(u)}var f=r.roster.getState();return f.members&&Object.keys(f.members).forEach(function(e){var n=f.members[e];n.inviteChannel&&n.pending&&o.push(n.inviteChannel),n.previewChannel&&n.pending&&o.push(n.previewChannel)}),o.sort(),o}(t,r),a=n.hashChannelList(o);f.rpc.getServerHash(function(e,n){e?console.warn(e):n!==a&&f.rpc.reset(o,function(e){e&&console.warn(e)})})}}).nThen(function(){f.offline=!1,t.onReadyHandlers[r]&&t.onReadyHandlers[r].forEach(function(e){("function"==typeof e.cb&&e.cb(),e.cId)&&(-1===f.clients.indexOf(e.cId)&&f.clients.push(e.cId))}),delete t.onReadyHandlers[r],t.store.modules.calendar&&t.store.modules.calendar.openTeam(r),u()})},N=function(e,n,t,r,o,a){var i=function(){(e.cache[n]||e.teams[n])&&D(e,n),delete e.store.proxy.teams[n],delete e.onReadyHandlers[n],o.abort(),a({error:"ENOENT"})};t&&e.store.anon_rpc.send("IS_NEW_CHANNEL",t,o(function(e,n){n&&n.length&&"object"==typeof n[0]&&n[0].isNew&&i()})),r&&e.store.anon_rpc.send("IS_NEW_CHANNEL",r,o(function(e,n){n&&n.length&&"object"==typeof n[0]&&n[0].isNew&&i()}))},I=function(t,r,o,a,i){var f=e.once(e.mkAsync(a)),l=r.hash||r.roHash,h=n.getSecrets("team",l,r.password),y=v.createEncryptor(h.keys);r.roHash||(r.roHash=n.getViewHashFromKeys(h));var E,b,A=r.keys;if(!A.chat.validateKey&&A.chat.edit){var w=n.getSecrets("chat",A.chat.edit);A.chat.validateKey=w.keys.validateKey}var _={curvePublic:t.store.proxy.curvePublic,curvePrivate:t.store.proxy.curvePrivate},I=A.roster||{},x=I.edit?v.Team.deriveMemberKeys(I.edit,_):v.Team.deriveGuestKeys(I.view||"");g(function(e){if(i)return d.getChannelCache(h.channel,e(function(n,t){t&&t.c||(e.abort(),f({error:"NOCACHE"}))})),void d.getChannelCache(x.channel,e(function(n,t){var r=t&&t.c,o=t&&t.k;o&&!x.teamEdPublic&&(x.teamEdPublic=o),r||(e.abort(),f({error:"NOCACHE"}))}));t.Store.onReadyEvt.reg(()=>{N(t,o,h.channel,x.channel,e,f)})}).nThen(function(n){var a={lm:!1,roster:!1,check:function(){this.lm&&this.roster&&i&&(t.progress+=30/t.numberOfTeams,t.updateProgress({progress:t.progress}),T(t,o,b,E,A,null,n(f)),this.check=function(){})}},u={data:{},readOnly:!Boolean(h.keys.signKey),network:t.store.network||t.store.networkPromise,channel:h.channel,crypto:y,ChainPad:m,Cache:d,metadata:{validateKey:h.keys.validateKey||void 0},userName:"team",classic:!0,onMetadataUpdate:function(){var e=t.teams[o];e&&t.emit("ROSTER_CHANGE",o,e.clients)}};(b=p.create(u)).proxy.on("cacheready",function(){a.lm=!0,a.check()}),b.proxy.on("ready",n()),b.proxy.on("error",function(e){e&&void 0!==e.loaded&&!e.loaded&&f({error:"ECONNECT"}),e&&e.error&&"EDELETED"===e.error&&D(t,o)}),s.create({network:t.store.network||t.store.networkPromise,channel:x.channel,keys:x,store:t.store,lastKnownHash:I.lastKnownHash,onCacheReady:function(e){if(i){if(e&&"CORRUPTED"===e.error)return console.error("Corrupted roster cache, cant load this team offline",r),b&&"function"==typeof b.stop&&b.stop(),n.abort(),void f({error:"CACHE_CORRUPTED_ROSTER"});E=e,a.roster=!0,a.check()}},Cache:d},n(function(r,o){if(r)return n.abort(),console.error(r),void f({error:"ROSTER_ERROR"});E=o,I.lastKnownHash=E.getLastCheckpointHash();var a=E.getState(),i=e.find(t,["store","proxy","curvePublic"]);a.members[i]&&O.reg(function(){if(I.edit){var e={},n=c.createData(t.store.proxy,!1);n.pending=!1,e[t.store.proxy.curvePublic]=n,E.describe(e,function(e){e&&"NO_CHANGE"!==e&&console.error(e)})}})}))}).nThen(function(n){var a=E.getState(),i=e.find(t,["store","proxy","curvePublic"]);if(!a.members||!Object.keys(a.members).length)return b.stop(),E.stop(),b.proxy={},f({error:"EINVAL"}),n.abort(),console.error(JSON.stringify(a)),void u.send("ROSTER_CORRUPTED");if(!a.members[i])return b.stop(),E.stop(),b.proxy={},delete t.store.proxy.teams[o],t.updateMetadata(),f({error:"EFORBIDDEN"}),void n.abort();var s=a.members[i],c=e.find(r,["keys","drive","edPrivate"]);if(r.hash&&c||-1===["ADMIN","MEMBER"].indexOf(s.role))r.hash&&c||"OWNER"!==s.role||u.send("TEAM_RIGHTS_OWNER");else{console.warn("Missing edit rights: demote to viewer");var l={};l[t.store.proxy.curvePublic]={role:"VIEWER"},E.describe(l,function(e){u.send("TEAM_RIGHTS_FIXED"),delete r.hash,delete r.keys.drive.edPrivate,delete r.keys.chat.edit,e&&"NO_CHANGE"!==e&&console.error(e)})}}).nThen(function(){i||(t.progress+=30/t.numberOfTeams,t.updateProgress({progress:t.progress})),S(t,o,b,E,A,null,f)})},x=function(n,t,r,o){var a=t.team;if(!((a.hash||a.roHash)&&a.channel&&a.password&&a.keys&&a.metadata))return void o({error:"EINVAL"});let i=n.store.proxy.teams;if(Object.values(i).some(e=>e.channel===a.channel))o({error:"EEXISTS"});else{var s=e.createRandomInteger();n.store.proxy.teams[s]=a,n.onReadyHandlers[s]=[],I(n,a,s,function(e){e&&e.error||console.debug("Team joined:"+s);var t=n.store.proxy.teams[s];n.store.mailbox.open("team-"+s,t.keys.mailbox,function(){},!0,{owners:t.keys.drive.edPublic}),n.updateMetadata(),o(e)})}},C=function(n,t,r){var o=e.find(n,["store","proxy","teams",t]);if(!o)return{};var a=e.clone(o);return r||(delete a.hash,delete a.keys.drive.edPrivate,delete a.keys.chat.edit),delete a.owner,a},R=function(t,r,o){if(!r)return!0;var a=e.find(t,["store","proxy","teams",r]);if(!a)return!0;var s=t.teams[r];if(!s)return!0;var c=n.getSecrets("team",o||a.roHash,a.password);if(i.upgrade(a.channel,c),s.userObject&&s.userObject.setReadOnly(!c.keys.secondaryKey,c.keys.secondaryKey),c.keys.secondaryKey)try{t.store.modules.calendar.upgradeTeam(r)}catch(e){console.error(e)}!c.keys.secondaryKey&&s.rpc&&s.rpc.destroy();var u=e.find(s,["proxy","drive","sharedFolders"]);Object.keys(u||{}).forEach(function(t){var r=s.manager.getSharedFolderData(t),o=n.parsePadUrl(r.href||r.roHref),a=n.getSecrets(o.type,o.hash,r.password);i.upgrade(a.channel,a);var c=e.find(s,["manager","folders",t,"userObject"]);c&&c.setReadOnly(!a.keys.secondaryKey,a.keys.secondaryKey)}),t.updateMetadata(),t.emit("ROSTER_CHANGE_RIGHTS",r,s.clients)},P=function(t,r,o,a,i){if(r){var s=e.find(t,["store","proxy","teams",r]);if(s){var c=t.onReadyHandlers[r],u=t.teams[r];if(s.channel===a.channel&&s.password===a.password)if(o?(s.hash=a.hash,s.keys.drive.edPrivate=a.keys.drive.edPrivate,s.keys.chat.edit=a.keys.chat.edit):(delete s.hash,delete s.keys.drive.edPrivate,delete s.keys.chat.edit),u||!Array.isArray(c))if(u){if(o){_(t,u,s.keys.drive,function(){u.manager.addPin(u.pin,u.unpin)});var f=n.getSecrets("team",a.hash,s.password);u.secondaryKey=f&&f.keys.secondaryKey;var l=v.createEncryptor(f.keys);u.listmap.setReadOnly(!1,l)}else delete u.secondaryKey,u.rpc&&u.rpc.destroy&&u.rpc.destroy(),u.manager.removePin(),u.listmap.setReadOnly(!0);R(t,r,a.hash),i(!0)}else i(!1);else c.push({cb:function(){P(t,r,o,a,i)}});else i(!1)}else i(!1)}else i(!1)},k=function(n,t,r,o,a){t?e.find(n,["store","proxy","teams",t])&&n.teams[t]?n.store.mailbox.sendTo("TEAM_EDIT_RIGHTS",{state:o,teamData:C(n,t,o)},{channel:r.notifications,curvePublic:r.curvePublic},a):a({error:"ENOENT"}):a({error:"EINVAL"})},M=function(n,t,r,o){var a=t.teamId;if(a){var i=e.find(n,["store","proxy","teams",a]),s=n.teams[a];if(i&&s)if(s.roster)if(t.curvePublic&&t.data){var c,u=s.roster.getState().members[t.curvePublic];g(function(e){n.Store.pad.getMetadata(null,{channel:i.channel},e(function(e){c=e&&e.error?s.listmap.metadata||{}:e}))}).nThen(function(){if(u.pendingOwner=Array.isArray(c.pending_owners)&&-1!==c.pending_owners.indexOf(u.edPublic),"OWNER"!==u.role||"OWNER"===t.data.role){"VIEWER"===u.role&&"VIEWER"!==t.data.role&&k(n,a,u,!0,function(e){o(e)}),"VIEWER"!==u.role&&"VIEWER"===t.data.role&&k(n,a,u,!1,function(e){o(e)});var r={};r[t.curvePublic]=t.data,s.roster.describe(r,function(e){e?o({error:e}):o()})}else!function(n,t,r,o){var a=e.once(o);if(t){var i=e.find(n,["store","proxy","teams",t]);if(i){var s=n.teams[t];if(s){var c=r.pendingOwner;g(function(t){var o=c?"RM_PENDING_OWNERS":"RM_OWNERS",s=function(e){var n=e&&e.error;if(n)return console.error(n),t.abort(),void a(n)},u=function(e){n.Store.pad.setMetadata(null,{channel:e,command:o,value:[r.edPublic]},t(s))};u(i.channel),u(e.find(i,["keys","roster","channel"])),u(e.find(i,["keys","chat","channel"]))}).nThen(function(e){var n={};n[r.curvePublic]={role:"ADMIN",pendingOwner:!1},s.roster.describe(n,e(function(e){e&&console.error(e)}))}).nThen(function(e){n.store.mailbox.sendTo("RM_OWNER",{teamChannel:i.channel,title:i.metadata.name,pending:c},{channel:r.notifications,curvePublic:r.curvePublic},e())}).nThen(function(){a()})}else a({error:"ENOENT"})}else a({error:"ENOENT"})}else a({error:"EINVAL"})}(n,a,u,function(e){e?(console.error(e),o({error:e})):o()})})}else o({error:"MISSING_DATA"});else o({error:"NO_ROSTER"});else o({error:"ENOENT"})}else o({error:"EINVAL"})},F=function(e,n){Object.keys(e.onReadyHandlers).forEach(function(t){var r=-1;e.onReadyHandlers[t].some(function(e,t){if(e.cId===n)return r=t,!0}),-1!==r&&e.onReadyHandlers[t].splice(r,1)}),Object.keys(e.teams).forEach(function(t){var r=e.teams[t].clients,o=r.indexOf(n);-1!==o&&r.splice(o,1)})},L=function(n,t,r,o){var a,i=t.seeds;try{a=f.derivePreviewKeys(i.preview)}catch(e){return void o({error:"INVALID_SEEDS"})}l.get({channel:a.channel,type:"pad",version:2,keys:{cryptKey:a.cryptKey}},function(n,t){if(n)o({error:n});else if(t){var r=e.tryParse(t);o(r||{error:"parseError"})}else o({error:"DELETED"})},{network:n.store.network,initialState:"{}"})},H=function(n,t,r,o){var a,i;g(function(r){!function(n,t,r,o){var a,i=t.bytes64;try{a=f.deriveInviteKeys(i)}catch(e){return void o({error:"INVALID_SEEDS"})}l.get({channel:a.channel,type:"pad",version:2,keys:{cryptKey:a.cryptKey}},function(n,t){if(n)o({error:n});else if(t){var r=e.tryParse(t);o(r||{error:"parseError"})}else o({error:"DELETED"})},{network:n.store.network,initialState:"{}"})}(n,t,0,r(function(e){if(e&&e.error)return r.abort(),void o(e);a=e}))}).nThen(function(t){var r=e.find(a,["teamData","channel"]),u=n.store.proxy.teams||{};if(Object.keys(u).some(function(e){return u[e].channel===r}))return t.abort(),void o({error:"ALREADY_MEMBER"});var f=e.find(a,["teamData","keys","roster"]),l=a.ephemeral;if(!f||!l)return t.abort(),void o({error:"INVALID_INVITE_CONTENT"});var h=v.Team.deriveMemberKeys(f.edit,l);s.create({network:n.store.network||n.store.networkPromise,channel:f.channel,keys:h,store:n.store,Cache:d},t(function(e,r){if(e)return t.abort(),console.error(e),void o({error:"ROSTER_ERROR"});var a=c.createData(n.store.proxy,!1),s=r.getState();i=s.members[l.curvePublic],r.accept(a.curvePublic,t(function(e){if(r.stop(),e)return t.abort(),console.error(e),void o({error:"ACCEPT_ERROR"})}))}))}).nThen(function(){var e={};i.remaining&&1!==i.remaining||_(n,e,a.ephemeral,function(n){if(!n){var t=e.rpc;i.inviteChannel&&t.removeOwnedChannel(i.inviteChannel,function(e){e&&console.error(e)}),i.previewChannel&&t.removeOwnedChannel(i.previewChannel,function(e){e&&console.error(e)})}}),x(n,{team:a.teamData},0,o)})},j=function(n){if(n){if(n.keys&&n.keys.mailbox)return n.keys.mailbox;var t=e.find(n,["keys","roster","edit"]);if(t){var r=E.hash(e.decodeUTF8(t)),o=r.slice(0,32),a=e.uint8ArrayToHex(r.slice(32,48)),i=E.box.keyPair.fromSecretKey(o);return{channel:a,viewed:[],keys:{curvePrivate:e.encodeBase64(i.secretKey),curvePublic:e.encodeBase64(i.publicKey)}}}}};return b.init=function(t,r,o){var a={},i=t.store;if(i.loggedIn&&i.proxy.edPublic&&!i.modules?.team){var h={store:i,Store:t.Store,pinPads:t.pinPads,emit:o,onReadyHandlers:{},teams:{},cache:{},nocache:{},updateMetadata:t.updateMetadata,updateProgress:t.updateLoadingProgress,progress:0};i.proxy.teams||(i.proxy.teams={});var b=i.proxy.teams;h.numberOfTeams=Object.keys(b).length,h.store.proxy.on("change",["teams"],function(e,n,t){"hash"===t[2]&&R(h,t[1],n)}),h.store.proxy.on("remove",["teams"],function(e,n){"hash"===n[2]&&R(h,n[1])});var w=function(n,t){if(!n||!t)return!0;try{var r=e.decodeBase64(n),o=E.sign.keyPair.fromSecretKey(r);return e.encodeBase64(o.publicKey)===t}catch(e){return!1}};Object.keys(b).forEach(function(n){h.onReadyHandlers[n]=[],e.find(b,[n,"keys","mailbox"])||(b[n].keys.mailbox=j(b[n])),I(h,b[n],n,r(function(e){if(e){delete h.onReadyHandlers[n],delete h.cache[n],"NOCACHE"===e?.error&&(h.nocache[n]=!0);var t="string"==typeof e?e:e.type||e.message;return u.send("TEAM_LOADING_ERROR="+t),void console.error(e)}console.debug("Team "+n+" cache ready")}),d.isEnabled())}),a.onReady=function(t){var r;r={},Object.keys(b).forEach(function(t){try{var o=b[t],a=r[o.channel],i=e.find(o,["keys","drive","edPrivate"]),s=e.find(o,["keys","drive","edPublic"]);if(s?i&&s&&!w(i,s)&&(u.send("TEAM_CORRUPTED_EDPRIVATE"),delete b[t].keys.drive.edPrivate,i=void 0):u.send("TEAM_CORRUPTED_EDPUBLIC"),o.hash&&2===n.parseTypeHash("drive",o.hash).version&&40!==o.hash.length&&u.send("TEAM_CORRUPTED_HASH"),!a)return void(r[o.channel]=t);var c=b[a],f=e.find(c,["keys","drive","edPrivate"]),l=e.find(c,["keys","chat","edit"]),d=e.find(o,["keys","chat","edit"]);!c.hash&&o.hash&&(c.hash=o.hash),!f&&i&&(c.keys.drive.edPrivate=i),!l&&d&&(c.keys.chat.edit=d),h.store.proxy.duplicateTeams=h.store.proxy.duplicateTeams||{},h.store.proxy.duplicateTeams[t]=b[t],delete b[t]}catch(e){console.error(e)}});var o=function(e){return!b[e]&&(D(h,e),delete h.onReadyHandlers[e],!0)};Object.keys(h.teams).forEach(o),Object.keys(h.onReadyHandlers).forEach(function(n){if(!o(n)){var r=h.store.proxy.teams[n],a=e.find(r,["keys","roster","channel"]),i=e.once(e.mkAsync(t()));g(function(e){N(h,n,r.channel,a,e,i)}),h.onReadyHandlers[n].push({cb:i})}}),Object.keys(b).forEach(function(n){h.onReadyHandlers[n]||h.teams[n]||(h.onReadyHandlers[n]=[],e.find(b,[n,"keys","mailbox"])||(b[n].keys.mailbox=j(b[n])),I(h,b[n],n,t(function(e){if(e){var t="string"==typeof e?e:e.type||e.message;return u.send("TEAM_LOADING_ERROR="+t),void console.error(e)}console.debug("Team "+n+" ready")})))}),A(),O.fire()},a.getTeam=function(e){return h.teams[e]},a.getTeamsData=function(n){var t={},r=!1;return-1!==["drive","teams","settings"].indexOf(n)&&(r=!0),Object.keys(b).forEach(function(n){if(h.teams[n]){var o=h.teams[n].proxy||{},a=o.drive&&Object.keys(o.drive.filesData||{}).length,i=o.drive&&Object.keys(o.drive.sharedFolders||{}).length;t[n]={owner:b[n].owner,name:b[n].metadata.name,channel:b[n].channel,numberPads:a,numberSf:i,roster:e.find(b[n],["keys","roster","channel"]),edPublic:e.find(b[n],["keys","drive","edPublic"]),avatar:e.find(b[n],["metadata","avatar"]),viewer:!e.find(b[n],["keys","drive","edPrivate"]),notifications:e.find(b[n],["keys","mailbox","channel"]),curvePublic:e.find(b[n],["keys","mailbox","keys","curvePublic"]),validKeys:w(e.find(b[n],["keys","drive","edPrivate"]),e.find(b[n],["keys","drive","edPublic"]))},r&&h.teams[n]&&(t[n].secondaryKey=h.teams[n].secondaryKey),h.teams[n]&&(t[n].hasSecondaryKey=Boolean(h.teams[n].secondaryKey))}}),t},a.getTeams=function(){return Object.keys(h.teams)};a.removeFromTeam=function(e,n,t){if(b[e]&&(!t||function(e,n){var t=h.teams[e];if(t){var r=t.roster&&t.roster.getState();if(r.members)return(r.members[n]||{}).pending}}(e,n)))if(h.onReadyHandlers[e])h.onReadyHandlers[e].push({cb:function(){h.teams[e].roster.remove([n],function(e){e&&"NO_CHANGE"!==e&&console.error(e)})}});else{var r=h.teams[e];r?r.roster.remove([n],function(e){e&&"NO_CHANGE"!==e&&console.error(e)}):console.error("TEAM MODULE ERROR")}},a.changeMyRights=function(e,n,t,r){P(h,e,n,t,r)},a.updateMyData=function(e){Object.keys(h.teams).forEach(function(n){var t=h.teams[n];if(t.roster){var r={};r[e.curvePublic]=e,t.roster.describe(r,function(e){e&&console.error(e)})}})},a.removeClient=function(e){F(h,e)};return a.execCommand=function(t,r,o){var a=r.cmd,i=r.data;if("SUBSCRIBE"!==a)if("LIST_TEAMS"!==a)if("OPEN_TEAM_CHAT"!==a)if("GET_TEAM_ROSTER"!==a)if("GET_TEAM_METADATA"!==a)if("SET_TEAM_METADATA"!==a){if("OFFER_OWNERSHIP"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(n,t,r,o){var a=e.once(o),i=t.teamId;if(i){var s=e.find(n,["store","proxy","teams",i]);if(s){var c=n.teams[i];if(c)if(c.roster)if(t.curvePublic){var u=c.roster.getState().members[t.curvePublic];g(function(t){var r=function(e){var n=e&&e.error;if(n)return console.error(n),t.abort(),void a({error:n})},o=function(e){n.Store.pad.setMetadata(null,{channel:e,command:"ADD_PENDING_OWNERS",value:[u.edPublic]},t(r))};o(s.channel),o(e.find(s,["keys","roster","channel"])),o(e.find(s,["keys","chat","channel"]))}).nThen(function(e){var n={};n[u.curvePublic]={role:"OWNER"},c.roster.describe(n,e(function(e){e&&console.error(e)}))}).nThen(function(t){n.store.mailbox.sendTo("ADD_OWNER",{teamChannel:s.channel,chatChannel:e.find(s,["keys","chat","channel"]),rosterChannel:e.find(s,["keys","roster","channel"]),title:s.metadata.name},{channel:u.notifications,curvePublic:u.curvePublic},t())}).nThen(function(){a()})}else a({error:"MISSING_DATA"});else a({error:"NO_ROSTER"});else a({error:"ENOENT"})}else a({error:"ENOENT"})}else a({error:"EINVAL"})}(h,i,0,o);if("ANSWER_OWNERSHIP"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(n,t,r,o){var a,i=n.store.proxy.teams;if(Object.keys(i).forEach(function(e){if(i[e].channel===t.teamChannel)return a=e,!0}),a){var s=e.find(n,["store","proxy","teams",a]);if(s){var c=n.teams[a];if(c)if(c.roster){var u={};t.answer?s.owner=!0:(u[n.store.proxy.curvePublic]={role:"ADMIN"},c.roster.describe(u,function(e){e?o({error:e}):o()}))}else o({error:"NO_ROSTER"});else o({error:"ENOENT"})}else o({error:"ENOENT"})}else o({error:"EINVAL"})}(h,i,0,o);if("DESCRIBE_USER"!==a){if("INVITE_TO_TEAM"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];if(a)if(a.roster){var i=n.user;if(i&&i.curvePublic&&i.notifications){delete i.channel,delete i.lastKnownHash,i.pending=!0;var s={};s[i.curvePublic]=i,s[i.curvePublic].role="VIEWER",a.roster.add(s,function(n){n&&"NO_CHANGE"!==n?r({error:n}):e.store.mailbox.sendTo("INVITE_TO_TEAM",{team:C(e,o)},{channel:i.notifications,curvePublic:i.curvePublic},function(e){r(e)})})}else r({error:"MISSING_DATA"})}else r({error:"NO_ROSTER"});else r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o);if("LEAVE_TEAM"!==a){if("JOIN_TEAM"===a)return h.store.offline?void o({error:"OFFLINE"}):void x(h,i,0,o);if("REMOVE_USER"!==a){if("DELETE_TEAM"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(n,t,r,o){var a=t.teamId;if(a){var i=n.teams[a],s=e.find(n,["store","proxy","teams",a]);if(i&&s){var c=i.roster.getState(),f=e.find(n,["store","proxy","curvePublic"]),l=c.members[f];if(!l||"OWNER"!==l.role)return o({error:"EFORBIDDEN"});var d=e.find(n,["store","proxy","edPublic"]),h=e.find(s,["keys","drive","edPublic"]);g(function(e){n.Store.anonRpcMsg(null,{msg:"GET_METADATA",data:s.channel},e(function(n){if(n&&n.error)return e.abort(),o({error:n.error});var t=n[0];t&&Array.isArray(t.owners)&&-1!==t.owners.indexOf(d)||(e.abort(),o({error:"EFORBIDDEN"}))}))}).nThen(function(t){i.proxy.delete=!0;var r=i.manager.getChannelsList("owned"),o=e.Saferphore.create(10);r.forEach(function(e){var r=t();o.take(function(t){var o=!1;g(function(r){32===e.length&&n.Store.anonRpcMsg(null,{msg:"GET_METADATA",data:e},r(function(e){if(e&&e.error)return t(),void r.abort();var n=e[0];if(!n||!Array.isArray(n.owners)||-1===n.owners.indexOf(h))return t(),void r.abort();o=n.owners.some(function(e){return e!==h})}))}).nThen(function(t){o?n.Store.pad.setMetadata(null,{channel:e,command:"RM_OWNERS",value:[h]},t()):i.rpc.removeOwnedChannel(e,t(function(e){e&&console.error(e)}))}).nThen(function(){t(),r()})})})}).nThen(function(t){i.rpc.removePins(t(function(e){e&&console.error(e)}));var r=e.find(s,["keys","mailbox","channel"]);i.rpc.removeOwnedChannel(r,t(function(e){e&&console.error(e)}));var o=e.find(s,["keys","roster","channel"]);n.store.rpc.removeOwnedChannel(o,t(function(e){e&&console.error(e)}));var a=e.find(s,["keys","chat","channel"]);n.store.rpc.removeOwnedChannel(a,t(function(e){e&&console.error(e)})),n.store.rpc.removeOwnedChannel(s.channel,t(function(e){e&&console.error(e)}))}).nThen(function(){u.send("TEAM_DELETION"),D(n,a),o()})}else o({error:"ENOENT"})}else o({error:"EINVAL"})}(h,i,0,o);if("CREATE_TEAM"===a)return h.store.offline?void o({error:"OFFLINE"}):void function(t,r,o,a){var i,f=e.once(a),l=n.createChannelId(),h=n.createRandomHash("team",l),b=n.getSecrets("team",h,l),O=n.getViewHashFromKeys(b),A=E.sign.keyPair(),w=E.box.keyPair(),_=v.Team.createSeed(),T=v.Team.deriveMemberKeys(_,{curvePublic:t.store.proxy.curvePublic,curvePrivate:t.store.proxy.curvePrivate}),N=n.getSecrets("chat"),I=n.getHashes(N),x={network:t.store.network,channel:b.channel,data:{},validateKey:b.keys.validateKey,crypto:v.createEncryptor(b.keys),logLevel:1,classic:!0,ChainPad:m,Cache:d,owners:[t.store.proxy.edPublic]};g(function(e){s.create({network:t.store.network||t.store.networkPromise,channel:T.channel,owners:[t.store.proxy.edPublic],keys:T,store:t.store,lastKnownHash:void 0,newTeam:!0,Cache:d},e(function(n,r){if(n)return e.abort(),console.error(n),void f({error:"ROSTER_ERROR"});i=r;var o=c.createData(t.store.proxy);delete o.channel,i.init(o,e(function(n){if(n)return e.abort(),void f({error:"ROSTER_INIT_ERROR"})}))}));var n,r=v.createEncryptor(N.keys),o={network:t.store.network,channel:N.channel,noChainPad:!0,crypto:r,metadata:{validateKey:N.keys.validateKey,owners:[t.store.proxy.edPublic]}},a=e();o.onReady=function(){n&&n.stop(),a()},o.onError=function(){e.abort(),f({error:"CHAT_INIT_ERROR"})},n=y.start(o)}).nThen(function(e){i.metadata({name:r.name},e(function(n){if(n)return e.abort(),void f({error:"ROSTER_INIT_ERROR"})}))}).nThen(function(){var a=e.createRandomInteger();x.onMetadataUpdate=function(){var e=t.teams[a];e&&t.emit("ROSTER_CHANGE",a,e.clients)};var s=p.create(x),c=s.proxy;c.version=2,c.on("ready",function(){var d={mailbox:{channel:n.createChannelId(),viewed:[],keys:{curvePrivate:e.encodeBase64(w.secretKey),curvePublic:e.encodeBase64(w.publicKey)}},drive:{edPrivate:e.encodeBase64(A.secretKey),edPublic:e.encodeBase64(A.publicKey)},chat:{edit:I.editHash,view:I.viewHash,validateKey:N.keys.validateKey,channel:N.channel},roster:{channel:T.channel,edit:_,view:T.viewKeyStr}},p=t.store.proxy.teams[a]={owner:!0,channel:b.channel,hash:h,roHash:O,password:l,keys:d,metadata:{name:r.name}};c.drive={},S(t,a,s,i,d,o,function(){u.send("TEAM_CREATION"),t.store.mailbox.open("team-"+a,p.keys.mailbox,function(){},!0,{owners:p.keys.drive.edPublic}),t.updateMetadata(),f()})}).on("error",function(e){e&&void 0!==e.loaded&&!e.loaded&&f({error:"ECONNECT"}),e&&e.error&&"EDELETED"===e.error&&D(t,a)})})}(h,i,t,o);if("GET_EDITABLE_FOLDERS"!==a)if("CREATE_INVITE_LINK"!==a){if("GET_PREVIEW_CONTENT"!==a)return"ACCEPT_LINK_INVITATION"===a?h.store.offline?void o({error:"OFFLINE"}):void H(h,i,0,o):void 0;L(h,i,0,o)}else!function(n,t,r,o){var a=e.mkAsync(e.once(o)),i=t.teamId,s=n.teams[t.teamId],u=t.seeds,d=t.bytes64;if(i&&s){var h,p=s.roster;try{h=p.getState().metadata.name}catch(e){return void a({error:"TEAM_NAME_ERR"})}var v=t.message,y=t.name,m=t.hash,E=e.find(n,["store","proxy","teams",i]);try{var b=f.encryptHash(m,E.hash)}catch(e){console.error(e)}var O=f.derivePreviewKeys(u.preview),A=f.deriveInviteKeys(d),w=f.generateKeys(),D=t.role||"VIEWER",_=t.uses||1;g(function(e){!function(){var t=f.generateSignPair(),r={initialState:"{}",network:n.store.network,metadata:{owners:[n.store.proxy.edPublic,w.edPublic]}};r.metadata.validateKey=t.validateKey;var o={teamName:h,message:v,author:c.createData(n.store.proxy,!1),displayName:y},i={channel:O.channel,type:"pad",version:2,keys:{cryptKey:O.cryptKey,validateKey:t.validateKey,signKey:t.signKey}};l.put(i,JSON.stringify(o),e(function(n){if(n)return console.error("CRYPTPUT_ERR",n),e.abort(),void a({error:"SET_PREVIEW_CONTENT"})}),r)}(),function(){var t=f.generateSignPair(),r={initialState:"{}",network:n.store.network,metadata:{owners:[n.store.proxy.edPublic,w.edPublic]}};r.metadata.validateKey=t.validateKey;var o={teamData:C(n,i,"MEMBER"===D),ephemeral:{edPublic:w.edPublic,edPrivate:w.edPrivate,curvePublic:w.curvePublic,curvePrivate:w.curvePrivate}},s={channel:A.channel,type:"pad",version:2,keys:{cryptKey:A.cryptKey,validateKey:t.validateKey,signKey:t.signKey}};l.put(s,JSON.stringify(o),e(function(n){if(n)return console.error("CRYPTPUT_ERR",n),e.abort(),void a({error:"SET_PREVIEW_CONTENT"})}),r)}()}).nThen(function(e){s.pin([A.channel,O.channel],function(e){e&&e.error&&console.error(e.error)}),f.createRosterEntry(s.roster,{curvePublic:w.curvePublic,content:{curvePublic:w.curvePublic,displayName:t.name,pending:!0,remaining:_,totalUses:_,role:D,hash:b,inviteChannel:A.channel,previewChannel:O.channel}},e(function(n){n&&(e.abort(),a(n))}))}).nThen(function(){a()})}else a({error:"EINVAL"})}(h,i,0,o);else!function(n,t,r,o){var a=t.teamId;if(a){var i=n.teams[a];if(i){var s=i.manager.folders||{};o(Object.keys(s).filter(function(e){return!s[e].proxy.version}).map(function(n){var t=e.find(i,["user","userObject"]);return{name:e.find(s,[n,"proxy","metadata","title"]),path:t?t.findFile(n)[0]:[]}}))}else o({error:"ENOENT"})}else o({error:"EINVAL"})}(h,i,0,o)}else!function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];if(a)if(a.roster)if(n.curvePublic){var i=a.roster.getState().members[n.curvePublic];a.roster.remove([n.curvePublic],function(t){if(!t)return i&&i.notifications?void e.store.mailbox.sendTo("KICKED_FROM_TEAM",{pending:n.pending,teamChannel:C(e,o).channel,teamName:C(e,o).metadata.name},{channel:i.notifications,curvePublic:i.curvePublic},function(e){r(e)}):r();r({error:t})})}else r({error:"MISSING_DATA"});else r({error:"NO_ROSTER"});else r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o)}else!function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];if(a)if(a.roster){var i=e.store.proxy.curvePublic;a.roster.remove([i],function(n){n?r({error:n}):(D(e,o),r())})}else r({error:"NO_ROSTER"});else r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o)}else M(h,i,0,o)}else!function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];a?a.offline?r({error:"OFFLINE"}):a.roster?(n.metadata&&delete n.metadata.offline,a.roster.metadata(n.metadata,function(t){if(t)r({error:t});else{var a=e.store.proxy.teams[o];a&&(a.metadata=n.metadata),r()}})):r({error:"NO_ROSTER"}):r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o);else!function(e,n,t,r){var o=n.teamId;if(o){var a=e.teams[o];if(a)if(a.roster){var i=(a.roster.getState()||{}).metadata||{};i.offline=a.offline,r(i)}else r({error:"NO_ROSTER"});else r({error:"ENOENT"})}else r({error:"EINVAL"})}(h,i,0,o);else!function(n,t,r,o){var a=t.teamId;if(a){var i=e.find(n,["store","proxy","teams",a]);if(i){var s=n.teams[a];if(s)if(s.roster){var c,u=(s.roster.getState()||{}).members||{};g(function(e){n.Store.pad.getMetadata(null,{channel:i.channel},e(function(e){c=e&&e.error?s.listmap.metadata||{}:e}))}).nThen(function(){if(n.pending_owners=c.pending_owners,Array.isArray(c.pending_owners)&&c.pending_owners.forEach(function(t){var r;if(Object.keys(u).some(function(e){if(u[e].edPublic===t)return r=u[e],!0}),!r&&i.owner){var o=function(e){n.Store.pad.setMetadata(null,{channel:e,command:"RM_PENDING_OWNERS",value:[t]},function(){})};return o(i.channel),o(e.find(i,["keys","roster","channel"])),void o(e.find(i,["keys","chat","channel"]))}r.pendingOwner=!0}),n.store.messenger){var t=s.getChatData();(n.store.messenger.getOnlineList(t.channel)||[]).forEach(function(e){u[e]&&(u[e].online=!0)})}Object.keys(u).forEach(function(e){var n=u[e];if(n.inviteChannel&&n.hash)if(i.hash)try{n.hash=f.decryptHash(n.hash,i.hash)}catch(e){console.error(e)}else delete n.hash}),o(u)})}else o({error:"NO_ROSTER"});else o({error:"ENOENT"})}else o({error:"ENOENT"})}else o({error:"EINVAL"})}(h,i,0,o);else!function(e,n,t,r){var o=e.teams[n.teamId];if(o){var a=function(){e.emit("ROSTER_CHANGE",n.teamId,o.clients)};e.store.messenger?e.store.messenger.openTeamChat(o.getChatData(),a,t,r):A=function(){e.store.messenger.openTeamChat(o.getChatData(),a,t,r)}}else r({error:"ENOENT"})}(h,i,t,o);else!function(n){var t=e.clone(b);Object.keys(t).forEach(function(e){h.teams[e]?t[e].offline=h.teams[e].offline:(t[e].error=!0,h.nocache[e]&&(t[e].offline=!0))}),n(t)}(o);else!function(e,n,t,r){F(e,t);try{e.store.messenger.removeClient(t)}catch(e){}if(A=function(){},n)if(!e.onReadyHandlers[n]||e.teams[n])if(e.teams[n]){var o=e.teams[n].clients;-1===o.indexOf(t)&&o.push(t),r()}else r({error:"EINVAL"});else-1===e.onReadyHandlers[n].indexOf(t)&&e.onReadyHandlers[n].push({cId:t,cb:r});else r()}(h,i,t,o)},a}},b.anonGetPreviewContent=function(e,n,t){L(e,n,0,t)},b})(Z(),te(),Y(),je(),ze(),Ue(),We(),Ht(),On(),Ae(),(_t||(_t=1,Dt=function(e,n,t,r){var o={},a=e.encodeBase64,i=e.decodeBase64;o.generateKeys=function(){var e=t.sign.keyPair(),n=t.box.keyPair();return{edPublic:a(e.publicKey),edPrivate:a(e.secretKey),curvePublic:a(n.publicKey),curvePrivate:a(n.secretKey)}},o.generateSignPair=function(){var e=t.sign.keyPair();return{validateKey:a(e.publicKey),signKey:a(e.secretKey)}};var s=function(r){var o=n.dispenser(i(r));return{channel:e.uint8ArrayToHex(o(16)),cryptKey:o(t.secretbox.keyLength)}};o.deriveInviteKeys=s,o.derivePreviewKeys=s,o.createRosterEntry=function(e,n,t){var r={};r[n.curvePublic]=n.content,e.invite(r,t)};var c=e.decodeUTF8;return o.encryptHash=function(e,n){var o=c(n),a=t.hash(o).subarray(0,32);return r.encrypt(e,a)},o.decryptHash=function(e,n){var o=c(n),a=t.hash(o).subarray(0,32);return r.decrypt(e,a)},o}(Z(),Ie(),h(),M())),Dt),xn(),fe(),In(),T(),M(),D(),x(),qe(),h()),Tt}function Kt(){if(It)return Nt;It=1;return Nt=((e,n,t,r,o,a,i,s)=>{var c=e.Curve;const u={};let f={};u.setCustomize=e=>{f=e.Messages};var l="MSG",d="UNFRIEND",h="MAP_ID",p="MAP_ID_ACK",v=function(e){return JSON.parse(JSON.stringify(e))},y=function(e){for(var n=Object.keys(e).length,t=new Uint8Array(n),r=0;r{const n=p.store.network||e;n.on("message",function(e,n){I(p,e,n)}),n.on("disconnect",function(){p.emit("DISCONNECT",null,C(p))}),n.on("reconnect",function(){p.emit("RECONNECT",null,C(p))})});return h.networkPromise?.then(b),p.store.network&&b(),u.onFriendUpdate=function(e){var n=g(h.proxy,e);if(n&&n.channel){var t=p.channels[n.channel];t&&p.emit("UPDATE_DATA",{info:v(n),channel:n.channel},t.clients)}},u.onFriendAdded=function(e){if(p.friendsClients.length){var n=g(p.store.proxy,e.curvePublic);if("object"==typeof n)if(n.channel){var t=n.channel;p.channels[t]||P(p,null,n,function(){c("FRIEND",{curvePublic:n.curvePublic},p.friendsClients)})}}},u.onFriendRemoved=function(e,n){x(p,e,n)},u.getOnlineList=function(e){return function(e,n){var t=e.channels[n];if(t){var r=[],o=m(e.store.proxy,!1);return r.push(o.curvePublic),t.wc.members.forEach(function(n){if(n!==e.store.network.historyKeeper){var o=t.mapId[n]||{};o.curvePublic&&-1===r.indexOf(o.curvePublic)&&r.push(o.curvePublic)}}),r}}(p,e)},u.storeValidateKey=function(e,n){p.validateKeys[e]=n},u.leavePad=function(e){delete p.validateKeys[e],Object.keys(p.channels).some(function(n){var t=p.channels[n];if(t.padChan===e){t.wc&&t.wc.leave();var r=p.store.network;return t.onReconnect&&r.off("reconnect",t.onReconnect),t.stopped=!0,delete p.channels[n],!0}})},u.openTeamChat=function(n,r,o,a){!function(n,r,o,a,i){var s=o,c=s.channel,u=s.secret;if(c&&u){var f=t.once(t.mkAsync(function(){n.emit("TEAMCHAT_READY",c,[r]),i({readOnly:"object"==typeof u.keys&&!u.keys.validateKey,channel:c})})),l=n.channels[c];if(l)l.onReady.reg(function(){-1===l.clients.indexOf(r)&&l.clients.push(r),f()});else{u.keys.cryptKey&&(u.keys.cryptKey=y(u.keys.cryptKey));var d=e.createEncryptor(u.keys),h=u.keys&&u.keys.validateKey||s.validateKey,p={teamId:o.teamId,readOnly:"object"==typeof u.keys&&!u.keys.validateKey,encryptor:d,channel:c,isTeamChat:!0,decrypt:function(e){return d.decrypt(e,h)},clients:[r],onUserlistUpdate:a,onReady:f};R(n,p)}}else i({error:"EINVAL"})}(p,o,n,r,a)},u.removeClient=function(e){!function(e,n){var t=e.friendsClients.indexOf(n);-1!==t&&e.friendsClients.splice(t,1),Object.keys(e.channels).forEach(function(t){var r=e.channels[t],o=r.clients,a=o.indexOf(n);if(-1!==a&&o.splice(a,1),0===o.length){r.wc&&r.wc.leave();var i=e.store.network;return r.onReconnect&&i.off("reconnect",r.onReconnect),r.stopped=!0,delete e.channels[t],!0}})}(p,e)},u.execCommand=function(n,r,i){var c=r.cmd,u=r.data;"INIT_FRIENDS"!==c?"GET_ROOMS"!==c?"GET_MUTED_USERS"!==c?"GET_USERLIST"!==c?"OPEN_PAD_CHAT"!==c?"GET_MY_INFO"!==c?"REMOVE_FRIEND"!==c?"CANCEL_FRIEND"!==c?"MUTE_USER"!==c?"UNMUTE_USER"!==c?"GET_STATUS"!==c?"GET_MORE_HISTORY"!==c?"SEND_MESSAGE"!==c?"SET_CHANNEL_HEAD"!==c?"CLEAR_OWNED_CHANNEL"!==c||function(e,n,t){var r=e.channels[n];r?e.store.rpc?e.store.rpc.clearOwnedChannel(n,function(o){t({error:o}),o||(r.messages=[],e.emit("CLEAR_CHANNEL",n,r.clients))}):t({error:"RPC_NOT_READY"}):t({error:"NO_CHANNEL"})}(p,u,i):_(p,u.id,u.sig,i):function(e,n,t,r){var o=e.channels[n];if(o)if(o.readOnly)r({error:"FORBIDDEN"});else if(e.store.network.webChannels.some(function(e){if(e.id===o.wc.id)return!0})){var i=e.store.proxy||{},s=[l,i.curvePublic,+new Date,t];if(!o.isFriendChat){var c=i[a.displayNameKey]||f.anonymous+"#"+(i.uid||e.store.noDriveUid).slice(0,5);s.push(c)}var u=JSON.stringify(s),d=o.encrypt(u);o.wc.bcast(d).then(function(){N(e,o,d),r()},function(e){r({error:e})})}else r({error:"NO_SUCH_CHANNEL"});else r({error:"NO_CHANNEL"})}(p,u.id,u.content,i):function(e,n,r,o,a){if("function"==typeof a)if("string"==typeof r){var i=e.channels[n];if(void 0!==i){var s=t.uid();A(e,s,n,a);var c=["GET_HISTORY_RANGE",i.id,{from:r,count:o,txid:s}],u=e.store.network;u.sendto(u.historyKeeper,JSON.stringify(c)).then(function(){},function(e){console.error(e)})}else console.error("chan is undefined. we're going to have a problem here")}else a([])}(p,u.id,u.sig,u.count,i):function(e,n,t){var r=e.channels[n];if(r){r.onUserlistUpdate&&r.onUserlistUpdate();var o=e.store.proxy||{};t(r.wc.members.some(function(n){if(n!==e.store.network.historyKeeper){var t=r.mapId[n]||void 0;return!!t&&t.curvePublic!==o.curvePublic}}))}else t("NO_SUCH_CHANNEL")}(p,u,i):function(e,n,r){var o=t.once(t.mkAsync(r)),a=e.store.proxy,i=a.mutedUsers=a.mutedUsers||{};delete i[n],e.emit("UPDATE_MUTED",null,C(e)),o(Object.keys(i).length)}(p,u,i):function(e,n,r){var o=t.once(t.mkAsync(r)),a=e.store.proxy,i=a.mutedUsers=a.mutedUsers||{};i[n.curvePublic]||(i[n.curvePublic]=n,e.emit("UPDATE_MUTED",null,C(e))),o()}(p,u,i):function(e,n,r){var o=t.once(r);"function"==typeof o?e.Store.cancelFriendRequest(n,o):console.error("NO_CALLBACK")}(p,u,i):function(e,n,r){var a=t.once(r);if("function"==typeof a){var i=e.store.proxy,s=g(i,n);if(!s)return console.error("friend is not valid"),void a({error:"INVALID_FRIEND"});var c=e.channels[s.channel];if(e.store.mailbox&&s.curvePublic&&s.notifications)o.removeFriend(e.store,n,function(n){n&&n.error?a({error:n.error}):(e.updateMetadata(),a(n))});else if(c)try{var u=[d,i.curvePublic,+new Date],f=JSON.stringify(u),l=c.encrypt(f);c.wc.bcast(l).then(function(){x(e,n,s.channel),S(e,n,function(){a()})},function(t){t?a({error:t}):(x(e,n,s.channel),S(e,n,function(){a()}))})}catch(e){a({error:e})}else a({error:"NO_SUCH_CHANNEL"})}else console.error("NO_CALLBACK")}(p,u,i):function(e,n){var t=e.store.proxy||{};n({curvePublic:t.curvePublic,displayName:t[a.displayNameKey]})}(p,i):function(n,r,o,a){var i=o.channel,s=t.once(t.mkAsync(function(){n.emit("PADCHAT_READY",i,[r]),a()})),c=n.channels[i];if(c)c.onReady.reg(function(){-1===c.clients.indexOf(r)&&c.clients.push(r),s()});else{var u=o.secret;u.keys.cryptKey&&(u.keys.cryptKey=y(u.keys.cryptKey));var f=e.createEncryptor(u.keys),l=u.keys&&u.keys.validateKey||n.validateKeys[u.channel],d={padChan:o.secret&&o.secret.channel,readOnly:"object"==typeof u.keys&&!u.keys.validateKey,encryptor:f,channel:o.channel,isPadChat:!0,decrypt:function(e){return f.decrypt(e,l)},clients:[r],onReady:s};R(n,d)}}(p,n,u,i):function(e,n,t){var r=e.channels[n.id];if(r)if(r.isFriendChat){var o=O(e,n.id);if(!o)return void t({error:"NO_SUCH_FRIEND"});t([o])}else t([]);else t({error:"NO_SUCH_CHANNEL"})}(p,u,i):function(e,n){var t=e.store.proxy;if(!n)return t.mutedUsers||{};n(t.mutedUsers||{})}(p,i):function(e,n,t){var r=e.store.proxy;if(n&&n.curvePublic){var o=n.curvePublic,a=g(r,o);if(!a)return void t({error:"NO_SUCH_FRIEND"});var i=e.channels[a.channel];return i?void t([{id:i.id,isFriendChat:!0,name:a.displayName,lastKnownHash:a.lastKnownHash,curvePublic:a.curvePublic,messages:i.messages}]):void t({error:"NO_SUCH_CHANNEL"})}if(n&&n.padChat){var s=e.channels[n.padChat];return s?void t([{id:s.id,isPadChat:!0,messages:s.messages}]):void t({error:"NO_SUCH_CHANNEL"})}if(n&&n.teamChat){var c=e.channels[n.teamChat];return c?void t([{id:c.id,isTeamChat:!0,messages:c.messages}]):void t({error:"NO_SUCH_CHANNEL"})}var u=Object.keys(e.channels).map(function(n){var t,r,o,a=e.channels[n];if(a.isFriendChat){var i=O(e,n);if(!i)return null;t=i.displayName,r=i.lastKnownHash,o=i.curvePublic}else{if(a.isPadChat)return;if(a.isTeamChat)return}return{id:a.id,isFriendChat:a.isFriendChat,name:t,lastKnownHash:r,curvePublic:o,messages:a.messages}}).filter(function(e){return e});t(u)}(p,u,i):function(e,n,t){var r=E(e.store.proxy);s(function(t){Object.keys(r).forEach(function(o){if("me"!==o){var a=v(r[o]);"object"==typeof a&&a.channel&&P(e,n,a,t())}else delete r.me.channel})}).nThen(function(){-1===e.friendsClients.indexOf(n)&&e.friendsClients.push(n),t()})}(p,n,i)},u},u})(M(),te(),Z(),je(),On(),Y(),on(),qe()),Nt}function Ut(){if(Ct)return xt;Ct=1;return xt=((e,n,t,r)=>{const o={},a={};var i=function(n,t,o,a,i){var s,c=e.once(e.mkAsync(i)),u=function(n,t){if(!t)return e.find(n.store,["proxy","edPublic"]);var r=e.find(n,["store","proxy","teams",t]);return e.find(r,["keys","drive","edPublic"])}(n,a),f=n.Store,l=0,d=0,h=0;r(function(e){f.getFileSize(null,{channel:t},e(function(n){return n&&n.error?(e.abort(),void c(n)):void 0===n.size?(e.abort(),void c({error:"ENOENT"})):void(l=n.size)})),f.getHistory(null,{channel:t,lastKnownHash:o},e(function(n){if(n&&n.error)return e.abort(),void c(n);if(!Array.isArray(n))return e.abort(),void c({error:"EINVAL"});if(n.length){s=n[0].hash;var t=n.map(function(e){return e.msg});d=t.join("\n").length}}),!0),f.pad.getMetadata(null,{channel:t},e(function(n){if((!n||!n.error)&&n&&"object"==typeof n)return h=JSON.stringify(n).length,n&&Array.isArray(n.owners)&&-1!==n.owners.indexOf(u)?void 0:(e.abort(),void c({error:"INSUFFICIENT_PERMISSIONS"}))}))}).nThen(function(){c({size:l-h-d,hash:s})})};return a.GET_HISTORY_SIZE=function(o,a,s,c){if(o.store.loggedIn&&o.store.rpc){var u=a.channels;if(Array.isArray(u)){var f=[];a.account?u=function(r){var o=[],a=e.find(r.store,["proxy","edPublic"]);-1!==(e.find(r.store,["driveMetadata","owners"])||[]).indexOf(a)&&o.push(r.store.driveChannel);var i=r.store.proxy.profile;if(i){var s=i.edit?n.hrefToHexChannelId("/profile/#"+i.edit,null):null;s&&o.push(s)}r.store.proxy.todo&&o.push(n.hrefToHexChannelId("/todo/#"+r.store.proxy.todo,null));var c=r.store.proxy.mailboxes;if(c){var u=Object.keys(c).map(function(e){return{lastKnownHash:c[e].lastKnownHash,channel:c[e].channel}});Array.prototype.push.apply(o,u)}var f=r.store.proxy[t.SHARED_FOLDERS];if(f){var l=Object.keys(f).map(function(e){var n=f[e];if(n&&n.owners&&Array.isArray(n.owners)&&-1!==n.owners.indexOf(a))return n.channel}).filter(Boolean);Array.prototype.push.apply(o,l)}return o}(o):a.team&&(u=function(n,t){let r=e.find(n.store,["proxy","teams",t]);if(!r)return[];let o=[r.channel],a=r.keys.roster;return o.push({channel:a.channel,lastKnownHash:a.lastKnownHash}),o}(o,a.team));var l=0,d=[];r(function(e){u.forEach(function(n){var t,r=n;"object"==typeof n&&n.channel&&(r=n.channel,t=n.lastKnownHash),i(o,r,t,a.teamId,e(function(e){e&&e.error?f.push(e.error):(l+=e.size,e.hash&&d.push({channel:r,hash:e.hash}))}))})}).nThen(function(){c({warning:f.length?f:void 0,channels:d,size:l})})}else c({error:"EINVAL"})}else c({error:"INSUFFICIENT_PERMISSIONS"})},a.TRIM_HISTORY=function(e,n,t,o){if(e.store.loggedIn&&e.store.rpc){var a=n.channels;if(Array.isArray(a)){var i=function(e,n){if(!n)return e.store.rpc;var t=e.store.modules.team;if(t){var r=t.getTeam(n);if(r)return r.rpc}}(e,n.teamId);if(i){var s=[];r(function(e){a.forEach(function(n){i.trimHistory(n,e(function(e){e&&s.push(e)}))})}).nThen(function(){1===a.length&&s.length?o({error:s[0]}):o({warning:s.length?s:void 0})})}else o({error:"ENORPC"})}else o({error:"EINVAL"})}else o({error:"INSUFFICIENT_PERMISSIONS"})},o.init=function(e,n,t){var r={};if(e.store){var o={store:e.store,Store:e.Store,pinPads:e.pinPads,updateMetadata:e.updateMetadata,emit:t};return r.execCommand=function(e,n,t){var r=n.cmd,i=n.data;try{a[r](o,i,e,t)}catch(e){console.error(e)}},r}},o})(Z(),te(),Ue(),qe()),xt}var Bt,Vt={exports:{}};function Yt(){return Bt||(Bt=1,function(e){(()=>{const n=e=>{var n={};const t=globalThis;var r=function(){},o=n.getWeekNo=function(e,n){"number"!=typeof n&&(n=1);var t=new Date(e.getFullYear(),0,1),r=t.getDay()-n;r=r>=0?r:r+7;var o,a=Math.floor((e.getTime()-t.getTime())/864e5)+1;if(r<4){if((o=Math.floor((a+r-1)/7)+1)>52){var i=new Date(e.getFullYear()+1,0,1).getDay()-n;o=(i=i>=0?i:i+7)<4?1:53}}else o=Math.floor((a+r-1)/7);return o},a=function(e){var n=new Date(e.getFullYear(),0,0),t=e-n+60*(n.getTimezoneOffset()-e.getTimezoneOffset())*1e3;return Math.floor(t/864e5)},i=n.DAYORDER=["SU","MO","TU","WE","TH","FR","SA"],s=function(e){var n=Number(e.slice(0,-2)),t=i.indexOf(e.slice(-2));return n?[n,t]:t},c=function(e,n){var t=e.getDay();t>=(n="number"==typeof n?n:1)?e.setDate(e.getDate()-(t-n)):e.setDate(e.getDate()-(7+t-n))},u=function(e){return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()},f={daily:function(e,n){e.setDate(e.getDate()+n)},weekly:function(e,n){e.setDate(e.getDate()+7*n)},monthly:function(e,n){e.setMonth(e.getMonth()+n)},yearly:function(e,n){e.setFullYear(e.getFullYear()+n)}},l={month:function(e,n,t){var r=new Date(n.start),o=(t-(e.getMonth()+1)+12)%12,a=e.getMonth()+o;if(e.setMonth(a),e.setDate(r.getDate()),e.getMonth()===a)return!0},weekno:function(e,n,t,r){var a=r&&r.wkst;"number"!=typeof a&&(a=1);var i=new Date(n.start),s=new Date(e.getFullYear(),11,31),u=o(s,a),f=1===u;1===u&&(u=52);var l=o(e,a);if(!t||t>u)return!1;t<0&&(t=u+t+1);var d=t-l,h=new Date(+e);h.setDate(h.getDate()+7*d),c(h,a);var p="aaaaaaa".split("").map(function(n,t){var r=new Date(+h);if(r.setDate(r.getDate()+t),r.getFullYear()===e.getFullYear())return r.toLocaleDateString()!==i.toLocaleDateString()&&r}).filter(Boolean);return 1===t&&f&&(c(s,a),"aaaaaaa".split("").some(function(n,t){var r=new Date(+s);if(r.setDate(r.getDate()+t),r.toLocaleDateString()!==i.toLocaleDateString())return r.getFullYear()>e.getFullYear()||void p.push(r)})),p.length?p:void 0}};l.yearday=function(e,n,t){var r=e.getFullYear();if(function(e,n){if(!("number"!=typeof n||Math.abs(n)<1||Math.abs(n)>366))return n<0&&(n=a(new Date(e.getFullYear(),11,31))+n+1),e.setMonth(0),e.setDate(n),!0}(e,t)&&e.getFullYear()===r)return!0},l.monthday=function(e,n,t,r){if("number"!=typeof t||Math.abs(t)<1||Math.abs(t)>31)return!1;var o=function(e,n){var t=e.getMonth();n<0&&(n=new Date(e.getFullYear(),e.getMonth()+1,0).getDate()+n+1);return e.setDate(n),e.getMonth()===t};if("monthly"===r.freq)return o(e,t);var a="aaaaaaaaaaaa".split("").map(function(n,r){var a=new Date(e.getFullYear(),r,1);return o(a,t)?a:void 0}).filter(Boolean);return a.length?a:void 0},l.day=function(e,n,t,r){var o,a=s(t);Array.isArray(a)&&(o=a[0],a=a[1]);var i=[];if(![0,1,2,3,4,5,6].includes(a))return!1;var c,u=function(e){if(o){var n=[];"aaaaaaaaaaaa".split("").some(function(t,r){if(void 0===e||r===e){var a,s=i.filter(function(e){return e.getMonth()===r});return a=o<0?s.length+o:o-1,n.push(s[a]),void 0!==e&&r===e}}),i=n.filter(Boolean)}};if("yearly"===r.freq){c=new Date(+e);for(var f=e.getFullYear();c.getDay()!==a;)c.setDate(c.getDate()+1);for(;c.getFullYear()===f;)i.push(new Date(+c)),c.setDate(c.getDate()+7);return u(),i}if("monthly"===r.freq){c=new Date(+e);for(var l=e.getMonth();c.getDay()!==a;)c.setDate(c.getDate()+1);for(;c.getMonth()===l;)i.push(new Date(+c)),c.setDate(c.getDate()+7);return u(l),i}if("weekly"===r.freq)for(;e.getDay()!==a;)e.setDate(e.getDate()+1);return!0};var d={month:function(e,n){return e.filter(function(e){return n.includes(e.getMonth()+1)})},weekno:function(e,n,t){return e.filter(function(e){var r=t&&t.wkst;"number"!=typeof r&&(r=1);var a=new Date(e.getFullYear(),11,31),i=o(a,r);1===i&&(i=52);var s=o(e,r);return n.some(function(e){return e>0?e===s:s===i+e+1})})},yearday:function(e,n){return e.filter(function(e){var t=a(e),r=a(new Date(e.getFullYear(),11,31));return n.some(function(e){return e>0?e===t:t===r+e+1})})},monthday:function(n,t){return n.filter(function(n){var r=e.clone(t);return(r=r.map(function(e){e<0&&(e=new Date(n.getFullYear(),n.getMonth()+1,0).getDate()+e+1);return e})).includes(n.getDate())})},day:function(e,n,t){return e.filter(function(e){var r=e.toLocaleDateString(),o="yearly";return("monthly"===t.freq||"yearly"===t.freq&&t.by&&t.by.month)&&(o="monthly"),n.some(function(n){var t,a=s(n);if(Array.isArray(a)&&(t=a[0],a=a[1]),!t)return e.getDay()===a;var i=new Date(e.getFullYear(),e.getMonth(),1);return"yearly"===o&&i.setMonth(0),l.day(i,{},n,{freq:o}).some(function(e){return e.toLocaleDateString()===r})})})},setpos:function(n,t){var r=n.slice(),o=e.deduplicateString(t.slice().map(function(e){return e>0?e-1:0!==e?r.length+e:void 0}));return n.filter(function(e){var n=r.indexOf(e);return o.includes(n)})}},h=["month","weekno","yearday","monthday","day"],p=["month","monthday","day"];n.getMonthId=function(e){return e.getFullYear()+"-"+e.getMonth()};var v=t.CP_calendar_cache={},y={};n.resetCache=function(){v=t.CP_calendar_cache={},y={}};var m=function(n){if(!n.recUpdate)return[];var t={},r=n.recUpdate.from;return Object.keys(r||{}).forEach(function(e){var n=r[e];n.recurrenceRule&&(t[e]=n.recurrenceRule)}),Object.keys(t).sort(function(e,n){return Number(e)-Number(n)}).map(function(n){var r=e.clone(t[n]);if(f[r.freq]&&!(r.interval&&r.interval<1))return r._start=Number(n),r}).filter(Boolean)};n.getRecurring=function(o,i){t.CP_DEV_MODE&&(r=console.warn);var s=[];return o.forEach(function(t){var o=t.split("-"),g=new Date(o[0],o[1]),E=new Date(+g);E.setMonth(E.getMonth()+1),E.setMilliseconds(-1),r("Compute month",g.toLocaleDateString()),(i||[]).forEach(function(t){var o=new Date(t.start),i=new Date(t.end),b=t,O=t.recurrenceRule;if(O){var A=m(t),w=A.shift();if(!(o>=E)){for(var D=O.until,_=A.slice(),T=w;T&&T._start&&T._startn)){var t;if(n.getFullYear()===e.getFullYear())t=a(n)-a(e);else{var r=new Date(e.getFullYear(),11,31);for(t=a(r)-a(e)+a(n);r.getFullYear()+1=N)){r("Start iteration",i.toLocaleDateString());var m=function(n,t,o){var a=e.clone(t),i=new Date(a.start),s=a.id.split("|")[0],u=o.toLocaleDateString();v[s]=v[s]||{};var y=n.interval||1,m=n.freq,g=[],E=function(e,t){g=d[e](g,t,n)},b=function(e){return function(t){var r=new Date(+o);"yearly"===n.freq?(r.setMonth(0),r.setDate(1)):"monthly"===n.freq?r.setDate(1):"weekly"===n.freq?c(r,n.wkst):n.freq;var s=l[e](r,a,t,n);if(s)if(Array.isArray(s))s=s.filter(function(e){return e.toLocaleDateString()!==i.toLocaleDateString()}),Array.prototype.push.apply(g,s);else{if(r.toLocaleDateString()===i.toLocaleDateString())return;g.push(r)}}},O=e.once(function(){f[m](o,y)}),A=function(){"monthly"===m?o.setDate(15):"yearly"===m&&1===i.getMonth()&&29===i.getDate()&&o.setDate(28),O();var e=new Date(+o);if("monthly"===m||"yearly"===m){if(e.setDate(i.getDate()),e.getDate()!==i.getDate())return;if("yearly"===m&&e.getMonth()!==i.getMonth())return}g.push(e)};if(Array.isArray(v[s][u]))return r("Get cache",s,u),"monthly"===m?o.setDate(15):"yearly"===m&&1===i.getMonth()&&29===i.getDate()&&o.setDate(28),O(),v[s][u];if(n.by&&"yearly"===m){var w=h.slice(),D=!1;(n.by.weekno||n.by.yearday||n.by.monthday||n.by.day)&&(w.shift(),D=!0);var _=!0;w.forEach(function(e){var t=n.by[e];t&&(_?(t.forEach(b(e)),_=!1):"day"===e?n.by.yearday||n.by.monthday||n.by.weekno?E("day",n.by.day):n.by.day.forEach(b("day")):E(e,t))}),n.by.month&&D&&E("month",n.by.month)}n.by&&"monthly"===m&&(n.by.monthday||n.by.day?n.by.monthday?n.by.monthday.forEach(b("monthday")):n.by.day&&n.by.day.forEach(b("day")):A(),n.by.month&&E("month",n.by.month),n.by.day&&n.by.monthday&&E("day",n.by.day)),n.by&&"weekly"===m&&(n.by.day?n.by.day.forEach(b("day")):A(),n.by.month&&E("month",n.by.month)),n.by&&"daily"===m&&(A(),p.forEach(function(e){var t=n.by[e];t&&E(e,t)})),g.sort(function(e,n){return e-n}),n.by&&n.by.setpos&&E("setpos",n.by.setpos),n.by&&Object.keys(n.by).length?O():A();var T=[];return g=g.filter(function(e){var n=new Date(+e).toLocaleDateString();return!T.includes(n)&&(T.push(n),!0)}),r("Set cache",s,u),v[s][u]=g,g}(O,t,i);if(r("Iteration results",JSON.stringify(m.map(function(e){return new Date(e).toLocaleDateString()}))),!m.length)return i.getFullYear()=N)return r(h.toLocaleDateString(),"count"),D=!0,!0;if(h>=E)return r(h.toLocaleDateString(),"endMonth"),D=!0,!0;if(O.until&&h>O.until)return r(h.toLocaleDateString(),"until"),D=!0,!0;if(!(h=E||h=g){if(y[c.id]&&y[c.id].includes(c.start))return;y[c.id]=y[c.id]||[],y[c.id].push(c.start)}if(b.timeZone&&!c.isAllDay){var m=function(e,n,t){var r=function(e,n){let t=e.toLocaleString("en-CA",{timeZone:n,hour12:!1}).replace(", ","T");return t+="."+e.getMilliseconds().toString().padStart(3,"0"),-(new Date(t+"Z")-e)},o=Intl.DateTimeFormat().resolvedOptions().timeZone,a=r(n,e)-r(t,e);return r(n,o)-r(t,o)-a}(b.timeZone,o,h);c.start+=m,c.end+=m}return s.push(c),_?(v(),!0):void 0}r(h.toLocaleDateString(),"start")}),D||x(i)}};x(o),r("Added this month (all events)",s.map(function(e){return new Date(e.start).toLocaleDateString()}))}}}}})}),s},n.getAllOccurrences=function(e){if(!e.recurrenceRule)return[e.start];var t=e.recurrenceRule;if(!t.until&&!t.count)return!1;var r=[e.start],o=new Date(e.start);o.setDate(15);for(var a=[],i=0,s=function(){return t.count?r.length=1e4;)t.setDate(t.getDate()-a),o++;return{d:o*=a,h:(t=new Date(n)).getHours()-r.getHours(),m:t.getMinutes()-r.getMinutes()}};return n.applyUpdates=function(e){return e.forEach(function(e){if(e.raw={start:e.start,end:e.end},e.recUpdate){var n,t=e.recUpdate.from||{},r=e.recUpdate.one||{},o=e.start,a=m(e).filter(function(e){return e._start>o}).shift(),i=function(n,t){var r=n[t],o=new Date(e.raw[t]);o.setDate(o.getDate()+r.d),o.setHours(o.getHours()+r.h),o.setMinutes(o.getMinutes()+r.m),e[t]=+o};(n=t,Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})).forEach(function(n){o",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},o={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},a=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},i=function(e){return!0===e?1:0};function s(e,n){var t;return function(){var r=this;clearTimeout(t),t=setTimeout(function(){return e.apply(r,arguments)},n)}}var c=function(e){return e instanceof Array?e:[e]};function u(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function f(e,n,t){var r=window.document.createElement(e);return n=n||"",t=t||"",r.className=n,void 0!==t&&(r.textContent=t),r}function l(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function d(e,n){return n(e)?e:e.parentNode?d(e.parentNode,n):void 0}function h(e,n){var t=f("div","numInputWrapper"),r=f("input","numInput "+e),o=f("span","arrowUp"),a=f("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?r.type="number":(r.type="text",r.pattern="\\d*"),void 0!==n)for(var i in n)r.setAttribute(i,n[i]);return t.appendChild(r),t.appendChild(o),t.appendChild(a),t}function p(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var v=function(){},y=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},m={D:v,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours(parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*i(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var r=parseInt(n),o=new Date(e.getFullYear(),0,2+7*(r-1),0,0,0,0);return o.setDate(o.getDate()-o.getDay()+t.firstDayOfWeek),o},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours(parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:v,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:v,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},g={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},E={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[E.w(e,n,t)]},F:function(e,n,t){return y(E.n(e,n,t)-1,!1,n)},G:function(e,n,t){return a(E.h(e,n,t))},H:function(e){return a(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[i(e.getHours()>11)]},M:function(e,n){return y(e.getMonth(),!0,n)},S:function(e){return a(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return a(e.getFullYear(),4)},d:function(e){return a(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return a(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return a(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},b=function(e){var n=e.config,t=void 0===n?r:n,a=e.l10n,i=void 0===a?o:a,s=e.isMobile,c=void 0!==s&&s;return function(e,n,r){var o=r||i;return void 0===t.formatDate||c?n.split("").map(function(n,r,a){return E[n]&&"\\"!==a[r-1]?E[n](e,o,t):"\\"!==n?n:""}).join(""):t.formatDate(e,n,o)}},O=function(e){var n=e.config,t=void 0===n?r:n,a=e.l10n,i=void 0===a?o:a;return function(e,n,o,a){if(0===e||e){var s,c=a||i,u=e;if(e instanceof Date)s=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)s=new Date(e);else if("string"==typeof e){var f=n||(t||r).dateFormat,l=String(e).trim();if("today"===l)s=new Date,o=!0;else if(/Z$/.test(l)||/GMT$/.test(l))s=new Date(e);else if(t&&t.parseDate)s=t.parseDate(e,f);else{s=t&&t.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var d=void 0,h=[],p=0,v=0,y="";p=0?new Date:new Date(E.config.minDate.getTime()),t=D(E.config);n.setHours(t.hours,t.minutes,t.seconds,n.getMilliseconds()),E.selectedDates=[n],E.latestSelectedDateObj=n}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var n="keydown"===e.type,t=p(e),r=t;void 0!==E.amPM&&t===E.amPM&&(E.amPM.textContent=E.l10n.amPM[i(E.amPM.textContent===E.l10n.amPM[0])]);var o=parseFloat(r.getAttribute("min")),s=parseFloat(r.getAttribute("max")),c=parseFloat(r.getAttribute("step")),u=parseInt(r.value,10),f=u+c*(e.delta||(n?38===e.which?1:-1:0));if(void 0!==r.value&&2===r.value.length){var l=r===E.hourElement,d=r===E.minuteElement;fs&&(f=r===E.hourElement?f-s-i(!E.amPM):o,d&&L(void 0,1,E.hourElement)),E.amPM&&l&&(1===c?f+u===23:Math.abs(f-u)>c)&&(E.amPM.textContent=E.l10n.amPM[i(E.amPM.textContent===E.l10n.amPM[0])]),r.value=a(f)}}(e);var r=E._input.value;I(),be(),E._input.value!==r&&E._debouncedChange()}function I(){if(void 0!==E.hourElement&&void 0!==E.minuteElement){var e,n,t=(parseInt(E.hourElement.value.slice(-2),10)||0)%24,r=(parseInt(E.minuteElement.value,10)||0)%60,o=void 0!==E.secondElement?(parseInt(E.secondElement.value,10)||0)%60:0;void 0!==E.amPM&&(e=t,n=E.amPM.textContent,t=e%12+12*i(n===E.l10n.amPM[1]));var a=void 0!==E.config.minTime||E.config.minDate&&E.minDateHasTime&&E.latestSelectedDateObj&&0===A(E.latestSelectedDateObj,E.config.minDate,!0);if(void 0!==E.config.maxTime||E.config.maxDate&&E.maxDateHasTime&&E.latestSelectedDateObj&&0===A(E.latestSelectedDateObj,E.config.maxDate,!0)){var s=void 0!==E.config.maxTime?E.config.maxTime:E.config.maxDate;(t=Math.min(t,s.getHours()))===s.getHours()&&(r=Math.min(r,s.getMinutes())),r===s.getMinutes()&&(o=Math.min(o,s.getSeconds()))}if(a){var c=void 0!==E.config.minTime?E.config.minTime:E.config.minDate;(t=Math.max(t,c.getHours()))===c.getHours()&&r=12)]),void 0!==E.secondElement&&(E.secondElement.value=a(t)))}function R(e){var n=p(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&X(t)}function P(e,n,t,r){return n instanceof Array?n.forEach(function(n){return P(e,n,t,r)}):e instanceof Array?e.forEach(function(e){return P(e,n,t,r)}):(e.addEventListener(n,t,r),void E._handlers.push({remove:function(){return e.removeEventListener(n,t)}}))}function k(){ve("onChange")}function M(e,n){var t=void 0!==e?E.parseDate(e):E.latestSelectedDateObj||(E.config.minDate&&E.config.minDate>E.now?E.config.minDate:E.config.maxDate&&E.config.maxDate=0&&A(e,E.selectedDates[1])<=0}(n)&&!me(n)&&a.classList.add("inRange"),E.weekNumbers&&1===E.config.showMonths&&"prevMonthDay"!==e&&t%7==1&&E.weekNumbers.insertAdjacentHTML("beforeend",""+E.config.getWeek(n)+""),ve("onDayCreate",a),a}function j(e){e.focus(),"range"===E.config.mode&&re(e)}function K(e){for(var n=e>0?0:E.config.showMonths-1,t=e>0?E.config.showMonths:-1,r=n;r!=t;r+=e)for(var o=E.daysContainer.children[r],a=e>0?0:o.children.length-1,i=e>0?o.children.length:-1,s=a;s!=i;s+=e){var c=o.children[s];if(-1===c.className.indexOf("hidden")&&$(c.dateObj))return c}}function U(e,n){var t=ee(document.activeElement||document.body),r=void 0!==e?e:t?document.activeElement:void 0!==E.selectedDateElem&&ee(E.selectedDateElem)?E.selectedDateElem:void 0!==E.todayDateElem&&ee(E.todayDateElem)?E.todayDateElem:K(n>0?1:-1);void 0===r?E._input.focus():t?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():E.currentMonth,r=n>0?E.config.showMonths:-1,o=n>0?1:-1,a=t-E.currentMonth;a!=r;a+=o)for(var i=E.daysContainer.children[a],s=t-E.currentMonth===a?e.$i+n:n<0?i.children.length-1:0,c=i.children.length,u=s;u>=0&&u0?c:-1);u+=o){var f=i.children[u];if(-1===f.className.indexOf("hidden")&&$(f.dateObj)&&Math.abs(e.$i-u)>=Math.abs(n))return j(f)}E.changeMonth(o),U(K(o),0)}(r,n):j(r)}function B(e,n){for(var t=(new Date(e,n,1).getDay()-E.l10n.firstDayOfWeek+7)%7,r=E.utils.getDaysInMonth((n-1+12)%12,e),o=E.utils.getDaysInMonth(n,e),a=window.document.createDocumentFragment(),i=E.config.showMonths>1,s=i?"prevMonthDay hidden":"prevMonthDay",c=i?"nextMonthDay hidden":"nextMonthDay",u=r+1-t,l=0;u<=r;u++,l++)a.appendChild(H(s,new Date(e,n-1,u),u,l));for(u=1;u<=o;u++,l++)a.appendChild(H("",new Date(e,n,u),u,l));for(var d=o+1;d<=42-t&&(1===E.config.showMonths||l%7!=0);d++,l++)a.appendChild(H(c,new Date(e,n+1,d%o),d,l));var h=f("div","dayContainer");return h.appendChild(a),h}function V(){if(void 0!==E.daysContainer){l(E.daysContainer),E.weekNumbers&&l(E.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n1||"dropdown"!==E.config.monthSelectorType)){var e=function(e){return!(void 0!==E.config.minDate&&E.currentYear===E.config.minDate.getFullYear()&&eE.config.maxDate.getMonth())};E.monthsDropdownContainer.tabIndex=-1,E.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=f("option","flatpickr-monthDropdown-month");t.value=new Date(E.currentYear,n).getMonth().toString(),t.textContent=y(n,E.config.shorthandCurrentMonth,E.l10n),t.tabIndex=-1,E.currentMonth===n&&(t.selected=!0),E.monthsDropdownContainer.appendChild(t)}}}function G(){var e,n=f("div","flatpickr-month"),t=window.document.createDocumentFragment();E.config.showMonths>1||"static"===E.config.monthSelectorType?e=f("span","cur-month"):(E.monthsDropdownContainer=f("select","flatpickr-monthDropdown-months"),E.monthsDropdownContainer.setAttribute("aria-label",E.l10n.monthAriaLabel),P(E.monthsDropdownContainer,"change",function(e){var n=p(e),t=parseInt(n.value,10);E.changeMonth(t-E.currentMonth),ve("onMonthChange")}),Y(),e=E.monthsDropdownContainer);var r=h("cur-year",{tabindex:"-1"}),o=r.getElementsByTagName("input")[0];o.setAttribute("aria-label",E.l10n.yearAriaLabel),E.config.minDate&&o.setAttribute("min",E.config.minDate.getFullYear().toString()),E.config.maxDate&&(o.setAttribute("max",E.config.maxDate.getFullYear().toString()),o.disabled=!!E.config.minDate&&E.config.minDate.getFullYear()===E.config.maxDate.getFullYear());var a=f("div","flatpickr-current-month");return a.appendChild(e),a.appendChild(r),t.appendChild(a),n.appendChild(t),{container:n,yearElement:o,monthElement:e}}function J(){l(E.monthNav),E.monthNav.appendChild(E.prevMonthNav),E.config.showMonths&&(E.yearElements=[],E.monthElements=[]);for(var e=E.config.showMonths;e--;){var n=G();E.yearElements.push(n.yearElement),E.monthElements.push(n.monthElement),E.monthNav.appendChild(n.container)}E.monthNav.appendChild(E.nextMonthNav)}function q(){E.weekdayContainer?l(E.weekdayContainer):E.weekdayContainer=f("div","flatpickr-weekdays");for(var e=E.config.showMonths;e--;){var n=f("div","flatpickr-weekdaycontainer");E.weekdayContainer.appendChild(n)}return W(),E.weekdayContainer}function W(){if(E.weekdayContainer){var e=E.l10n.firstDayOfWeek,t=n(E.l10n.weekdays.shorthand);e>0&&e\n "+t.join("")+"\n \n "}}function z(e,n){void 0===n&&(n=!0);var t=n?e:e-E.currentMonth;t<0&&!0===E._hidePrevMonthArrow||t>0&&!0===E._hideNextMonthArrow||(E.currentMonth+=t,(E.currentMonth<0||E.currentMonth>11)&&(E.currentYear+=E.currentMonth>11?1:-1,E.currentMonth=(E.currentMonth+12)%12,ve("onYearChange"),Y()),V(),ve("onMonthChange"),ge())}function Q(e){return!(!E.config.appendTo||!E.config.appendTo.contains(e))||E.calendarContainer.contains(e)}function Z(e){if(E.isOpen&&!E.config.inline){var n=p(e),t=Q(n),r=n===E.input||n===E.altInput||E.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(E.input)||~e.path.indexOf(E.altInput)),o="blur"===e.type?r&&e.relatedTarget&&!Q(e.relatedTarget):!r&&!t&&!Q(e.relatedTarget),a=!E.config.ignoredFocusElements.some(function(e){return e.contains(n)});o&&a&&(void 0!==E.timeContainer&&void 0!==E.minuteElement&&void 0!==E.hourElement&&""!==E.input.value&&void 0!==E.input.value&&N(),E.close(),E.config&&"range"===E.config.mode&&1===E.selectedDates.length&&(E.clear(!1),E.redraw()))}}function X(e){if(!(!e||E.config.minDate&&eE.config.maxDate.getFullYear())){var n=e,t=E.currentYear!==n;E.currentYear=n||E.currentYear,E.config.maxDate&&E.currentYear===E.config.maxDate.getFullYear()?E.currentMonth=Math.min(E.config.maxDate.getMonth(),E.currentMonth):E.config.minDate&&E.currentYear===E.config.minDate.getFullYear()&&(E.currentMonth=Math.max(E.config.minDate.getMonth(),E.currentMonth)),t&&(E.redraw(),ve("onYearChange"),Y())}}function $(e,n){var t;void 0===n&&(n=!0);var r=E.parseDate(e,void 0,n);if(E.config.minDate&&r&&A(r,E.config.minDate,void 0!==n?n:!E.minDateHasTime)<0||E.config.maxDate&&r&&A(r,E.config.maxDate,void 0!==n?n:!E.maxDateHasTime)>0)return!1;if(!E.config.enable&&0===E.config.disable.length)return!0;if(void 0===r)return!1;for(var o=!!E.config.enable,a=null!==(t=E.config.enable)&&void 0!==t?t:E.config.disable,i=0,s=void 0;i=s.from.getTime()&&r.getTime()<=s.to.getTime())return o}return!o}function ee(e){return void 0!==E.daysContainer&&-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&E.daysContainer.contains(e)}function ne(e){e.target!==E._input||!(E.selectedDates.length>0||E._input.value.length>0)||e.relatedTarget&&Q(e.relatedTarget)||E.setDate(E._input.value,!0,e.target===E.altInput?E.config.altFormat:E.config.dateFormat)}function te(e){var n=p(e),t=E.config.wrap?v.contains(n):n===E._input,r=E.config.allowInput,o=E.isOpen&&(!r||!t),a=E.config.inline&&t&&!r;if(13===e.keyCode&&t){if(r)return E.setDate(E._input.value,!0,n===E.altInput?E.config.altFormat:E.config.dateFormat),n.blur();E.open()}else if(Q(n)||o||a){var i=!!E.timeContainer&&E.timeContainer.contains(n);switch(e.keyCode){case 13:i?(e.preventDefault(),N(),fe()):le(e);break;case 27:e.preventDefault(),fe();break;case 8:case 46:t&&!E.config.allowInput&&(e.preventDefault(),E.clear());break;case 37:case 39:if(i||t)E.hourElement&&E.hourElement.focus();else if(e.preventDefault(),void 0!==E.daysContainer&&(!1===r||document.activeElement&&ee(document.activeElement))){var s=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),z(s),U(K(1),0)):U(void 0,s)}break;case 38:case 40:e.preventDefault();var c=40===e.keyCode?1:-1;E.daysContainer&&void 0!==n.$i||n===E.input||n===E.altInput?e.ctrlKey?(e.stopPropagation(),X(E.currentYear-c),U(K(1),0)):i||U(void 0,7*c):n===E.currentYearElement?X(E.currentYear-c):E.config.enableTime&&(!i&&E.hourElement&&E.hourElement.focus(),N(e),E._debouncedChange());break;case 9:if(i){var u=[E.hourElement,E.minuteElement,E.secondElement,E.amPM].concat(E.pluginElements).filter(function(e){return e}),f=u.indexOf(n);if(-1!==f){var l=u[f+(e.shiftKey?-1:1)];e.preventDefault(),(l||E._input).focus()}}else!E.config.noCalendar&&E.daysContainer&&E.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),E._input.focus())}}if(void 0!==E.amPM&&n===E.amPM)switch(e.key){case E.l10n.amPM[0].charAt(0):case E.l10n.amPM[0].charAt(0).toLowerCase():E.amPM.textContent=E.l10n.amPM[0],I(),be();break;case E.l10n.amPM[1].charAt(0):case E.l10n.amPM[1].charAt(0).toLowerCase():E.amPM.textContent=E.l10n.amPM[1],I(),be()}(t||Q(n))&&ve("onKeyDown",e)}function re(e){if(1===E.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var n=e?e.dateObj.getTime():E.days.firstElementChild.dateObj.getTime(),t=E.parseDate(E.selectedDates[0],void 0,!0).getTime(),r=Math.min(n,E.selectedDates[0].getTime()),o=Math.max(n,E.selectedDates[0].getTime()),a=!1,i=0,s=0,c=r;cr&&ci)?i=c:c>t&&(!s||c0&&h0&&h>s;return p?(d.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(e){d.classList.remove(e)}),"continue"):a&&!p?"continue":(["startRange","inRange","endRange","notAllowed"].forEach(function(e){d.classList.remove(e)}),void(void 0!==e&&(e.classList.add(n<=E.selectedDates[0].getTime()?"startRange":"endRange"),tn&&h===t&&d.classList.add("endRange"),h>=i&&(0===s||h<=s)&&(u=t,l=n,(c=h)>Math.min(u,l)&&c0||t.getMinutes()>0||t.getSeconds()>0),E.selectedDates&&(E.selectedDates=E.selectedDates.filter(function(e){return $(e)}),E.selectedDates.length||"min"!==e||x(t),be()),E.daysContainer&&(ue(),void 0!==t?E.currentYearElement[e]=t.getFullYear().toString():E.currentYearElement.removeAttribute(e),E.currentYearElement.disabled=!!r&&void 0!==t&&r.getFullYear()===t.getFullYear())}}function ie(){return E.config.wrap?v.querySelector("[data-input]"):v}function se(){"object"!=typeof E.config.locale&&void 0===S.l10ns[E.config.locale]&&E.config.errorHandler(new Error("flatpickr: invalid locale "+E.config.locale)),E.l10n=e(e({},S.l10ns.default),"object"==typeof E.config.locale?E.config.locale:"default"!==E.config.locale?S.l10ns[E.config.locale]:void 0),g.K="("+E.l10n.amPM[0]+"|"+E.l10n.amPM[1]+"|"+E.l10n.amPM[0].toLowerCase()+"|"+E.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},m),JSON.parse(JSON.stringify(v.dataset||{}))).time_24hr&&void 0===S.defaultConfig.time_24hr&&(E.config.time_24hr=E.l10n.time_24hr),E.formatDate=b(E),E.parseDate=O({config:E.config,l10n:E.l10n})}function ce(e){if("function"!=typeof E.config.position){if(void 0!==E.calendarContainer){ve("onPreCalendarPosition");var n=e||E._positionElement,t=Array.prototype.reduce.call(E.calendarContainer.children,function(e,n){return e+n.offsetHeight},0),r=E.calendarContainer.offsetWidth,o=E.config.position.split(" "),a=o[0],i=o.length>1?o[1]:null,s=n.getBoundingClientRect(),c=window.innerHeight-s.bottom,f="above"===a||"below"!==a&&ct,l=window.pageYOffset+s.top+(f?-t-2:n.offsetHeight+2);if(u(E.calendarContainer,"arrowTop",!f),u(E.calendarContainer,"arrowBottom",f),!E.config.inline){var d=window.pageXOffset+s.left,h=!1,p=!1;"center"===i?(d-=(r-s.width)/2,h=!0):"right"===i&&(d-=r-s.width,p=!0),u(E.calendarContainer,"arrowLeft",!h&&!p),u(E.calendarContainer,"arrowCenter",h),u(E.calendarContainer,"arrowRight",p);var v=window.document.body.offsetWidth-(window.pageXOffset+s.right),y=d+r>window.document.body.offsetWidth,m=v+r>window.document.body.offsetWidth;if(u(E.calendarContainer,"rightMost",y),!E.config.static)if(E.calendarContainer.style.top=l+"px",y)if(m){var g=function(){for(var e=null,n=0;nE.currentMonth+E.config.showMonths-1)&&"range"!==E.config.mode;if(E.selectedDateElem=t,"single"===E.config.mode)E.selectedDates=[r];else if("multiple"===E.config.mode){var a=me(r);a?E.selectedDates.splice(parseInt(a),1):E.selectedDates.push(r)}else"range"===E.config.mode&&(2===E.selectedDates.length&&E.clear(!1,!1),E.latestSelectedDateObj=r,E.selectedDates.push(r),0!==A(r,E.selectedDates[0],!0)&&E.selectedDates.sort(function(e,n){return e.getTime()-n.getTime()}));if(I(),o){var i=E.currentYear!==r.getFullYear();E.currentYear=r.getFullYear(),E.currentMonth=r.getMonth(),i&&(ve("onYearChange"),Y()),ve("onMonthChange")}if(ge(),V(),be(),o||"range"===E.config.mode||1!==E.config.showMonths?void 0!==E.selectedDateElem&&void 0===E.hourElement&&E.selectedDateElem&&E.selectedDateElem.focus():j(t),void 0!==E.hourElement&&void 0!==E.hourElement&&E.hourElement.focus(),E.config.closeOnSelect){var s="single"===E.config.mode&&!E.config.enableTime,c="range"===E.config.mode&&2===E.selectedDates.length&&!E.config.enableTime;(s||c)&&fe()}k()}}E.parseDate=O({config:E.config,l10n:E.l10n}),E._handlers=[],E.pluginElements=[],E.loadedPlugins=[],E._bind=P,E._setHoursFromDate=x,E._positionCalendar=ce,E.changeMonth=z,E.changeYear=X,E.clear=function(e,n){if(void 0===e&&(e=!0),void 0===n&&(n=!0),E.input.value="",void 0!==E.altInput&&(E.altInput.value=""),void 0!==E.mobileInput&&(E.mobileInput.value=""),E.selectedDates=[],E.latestSelectedDateObj=void 0,!0===n&&(E.currentYear=E._initialDate.getFullYear(),E.currentMonth=E._initialDate.getMonth()),!0===E.config.enableTime){var t=D(E.config);C(t.hours,t.minutes,t.seconds)}E.redraw(),e&&ve("onChange")},E.close=function(){E.isOpen=!1,E.isMobile||(void 0!==E.calendarContainer&&E.calendarContainer.classList.remove("open"),void 0!==E._input&&E._input.classList.remove("active")),ve("onClose")},E._createElement=f,E.destroy=function(){void 0!==E.config&&ve("onDestroy");for(var e=E._handlers.length;e--;)E._handlers[e].remove();if(E._handlers=[],E.mobileInput)E.mobileInput.parentNode&&E.mobileInput.parentNode.removeChild(E.mobileInput),E.mobileInput=void 0;else if(E.calendarContainer&&E.calendarContainer.parentNode)if(E.config.static&&E.calendarContainer.parentNode){var n=E.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else E.calendarContainer.parentNode.removeChild(E.calendarContainer);E.altInput&&(E.input.type="text",E.altInput.parentNode&&E.altInput.parentNode.removeChild(E.altInput),delete E.altInput),E.input&&(E.input.type=E.input._type,E.input.classList.remove("flatpickr-input"),E.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){try{delete E[e]}catch(e){}})},E.isEnabled=$,E.jumpToDate=M,E.open=function(e,n){if(void 0===n&&(n=E._positionElement),!0===E.isMobile){if(e){e.preventDefault();var t=p(e);t&&t.blur()}return void 0!==E.mobileInput&&(E.mobileInput.focus(),E.mobileInput.click()),void ve("onOpen")}if(!E._input.disabled&&!E.config.inline){var r=E.isOpen;E.isOpen=!0,r||(E.calendarContainer.classList.add("open"),E._input.classList.add("active"),ve("onOpen"),ce(n)),!0===E.config.enableTime&&!0===E.config.noCalendar&&(!1!==E.config.allowInput||void 0!==e&&E.timeContainer.contains(e.relatedTarget)||setTimeout(function(){return E.hourElement.select()},50))}},E.redraw=ue,E.set=function(e,n){if(null!==e&&"object"==typeof e)for(var r in Object.assign(E.config,e),e)void 0!==de[r]&&de[r].forEach(function(e){return e()});else E.config[e]=n,void 0!==de[e]?de[e].forEach(function(e){return e()}):t.indexOf(e)>-1&&(E.config[e]=c(n));E.redraw(),be(!0)},E.setDate=function(e,n,t){if(void 0===n&&(n=!1),void 0===t&&(t=E.config.dateFormat),0!==e&&!e||e instanceof Array&&0===e.length)return E.clear(n);he(e,t),E.latestSelectedDateObj=E.selectedDates[E.selectedDates.length-1],E.redraw(),M(void 0,n),x(),0===E.selectedDates.length&&E.clear(!1),be(n),n&&ve("onChange")},E.toggle=function(e){if(!0===E.isOpen)return E.close();E.open(e)};var de={locale:[se,W],showMonths:[J,T,q],minDate:[M],maxDate:[M],clickOpens:[function(){!0===E.config.clickOpens?(P(E._input,"focus",E.open),P(E._input,"click",E.open)):(E._input.removeEventListener("focus",E.open),E._input.removeEventListener("click",E.open))}]};function he(e,n){var t=[];if(e instanceof Array)t=e.map(function(e){return E.parseDate(e,n)});else if(e instanceof Date||"number"==typeof e)t=[E.parseDate(e,n)];else if("string"==typeof e)switch(E.config.mode){case"single":case"time":t=[E.parseDate(e,n)];break;case"multiple":t=e.split(E.config.conjunction).map(function(e){return E.parseDate(e,n)});break;case"range":t=e.split(E.l10n.rangeSeparator).map(function(e){return E.parseDate(e,n)})}else E.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));E.selectedDates=E.config.allowInvalidPreload?t:t.filter(function(e){return e instanceof Date&&$(e,!1)}),"range"===E.config.mode&&E.selectedDates.sort(function(e,n){return e.getTime()-n.getTime()})}function pe(e){return e.slice().map(function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?E.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:E.parseDate(e.from,void 0),to:E.parseDate(e.to,void 0)}:e}).filter(function(e){return e})}function ve(e,n){if(void 0!==E.config){var t=E.config[e];if(void 0!==t&&t.length>0)for(var r=0;t[r]&&r1||"static"===E.config.monthSelectorType?E.monthElements[n].textContent=y(t.getMonth(),E.config.shorthandCurrentMonth,E.l10n)+" ":E.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()}),E._hidePrevMonthArrow=void 0!==E.config.minDate&&(E.currentYear===E.config.minDate.getFullYear()?E.currentMonth<=E.config.minDate.getMonth():E.currentYearE.config.maxDate.getMonth():E.currentYear>E.config.maxDate.getFullYear()))}function Ee(e){return E.selectedDates.map(function(n){return E.formatDate(n,e)}).filter(function(e,n,t){return"range"!==E.config.mode||E.config.enableTime||t.indexOf(e)===n}).join("range"!==E.config.mode?E.config.conjunction:E.l10n.rangeSeparator)}function be(e){void 0===e&&(e=!0),void 0!==E.mobileInput&&E.mobileFormatStr&&(E.mobileInput.value=void 0!==E.latestSelectedDateObj?E.formatDate(E.latestSelectedDateObj,E.mobileFormatStr):""),E.input.value=Ee(E.config.dateFormat),void 0!==E.altInput&&(E.altInput.value=Ee(E.config.altFormat)),!1!==e&&ve("onValueUpdate")}function Oe(e){var n=p(e),t=E.prevMonthNav.contains(n),r=E.nextMonthNav.contains(n);t||r?z(t?-1:1):E.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?E.changeYear(E.currentYear+1):n.classList.contains("arrowDown")&&E.changeYear(E.currentYear-1)}return function(){E.element=E.input=v,E.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],o=e(e({},JSON.parse(JSON.stringify(v.dataset||{}))),m),a={};E.config.parseDate=o.parseDate,E.config.formatDate=o.formatDate,Object.defineProperty(E.config,"enable",{get:function(){return E.config._enable},set:function(e){E.config._enable=pe(e)}}),Object.defineProperty(E.config,"disable",{get:function(){return E.config._disable},set:function(e){E.config._disable=pe(e)}});var i="time"===o.mode;if(!o.dateFormat&&(o.enableTime||i)){var s=S.defaultConfig.dateFormat||r.dateFormat;a.dateFormat=o.noCalendar||i?"H:i"+(o.enableSeconds?":S":""):s+" H:i"+(o.enableSeconds?":S":"")}if(o.altInput&&(o.enableTime||i)&&!o.altFormat){var u=S.defaultConfig.altFormat||r.altFormat;a.altFormat=o.noCalendar||i?"h:i"+(o.enableSeconds?":S K":" K"):u+" h:i"+(o.enableSeconds?":S":"")+" K"}Object.defineProperty(E.config,"minDate",{get:function(){return E.config._minDate},set:ae("min")}),Object.defineProperty(E.config,"maxDate",{get:function(){return E.config._maxDate},set:ae("max")});var f=function(e){return function(n){E.config["min"===e?"_minTime":"_maxTime"]=E.parseDate(n,"H:i:S")}};Object.defineProperty(E.config,"minTime",{get:function(){return E.config._minTime},set:f("min")}),Object.defineProperty(E.config,"maxTime",{get:function(){return E.config._maxTime},set:f("max")}),"time"===o.mode&&(E.config.noCalendar=!0,E.config.enableTime=!0),Object.assign(E.config,a,o);for(var l=0;l-1?E.config[h]=c(d[h]).map(_).concat(E.config[h]):void 0===o[h]&&(E.config[h]=d[h])}o.altInputClass||(E.config.altInputClass=ie().className+" "+E.config.altInputClass),ve("onParseConfig")}(),se(),E.input=ie(),E.input?(E.input._type=E.input.type,E.input.type="text",E.input.classList.add("flatpickr-input"),E._input=E.input,E.config.altInput&&(E.altInput=f(E.input.nodeName,E.config.altInputClass),E._input=E.altInput,E.altInput.placeholder=E.input.placeholder,E.altInput.disabled=E.input.disabled,E.altInput.required=E.input.required,E.altInput.tabIndex=E.input.tabIndex,E.altInput.type="text",E.input.setAttribute("type","hidden"),!E.config.static&&E.input.parentNode&&E.input.parentNode.insertBefore(E.altInput,E.input.nextSibling)),E.config.allowInput||E._input.setAttribute("readonly","readonly"),E._positionElement=E.config.positionElement||E._input):E.config.errorHandler(new Error("Invalid input element specified")),function(){E.selectedDates=[],E.now=E.parseDate(E.config.now)||new Date;var e=E.config.defaultDate||("INPUT"!==E.input.nodeName&&"TEXTAREA"!==E.input.nodeName||!E.input.placeholder||E.input.value!==E.input.placeholder?E.input.value:null);e&&he(e,E.config.dateFormat),E._initialDate=E.selectedDates.length>0?E.selectedDates[0]:E.config.minDate&&E.config.minDate.getTime()>E.now.getTime()?E.config.minDate:E.config.maxDate&&E.config.maxDate.getTime()0&&(E.latestSelectedDateObj=E.selectedDates[0]),void 0!==E.config.minTime&&(E.config.minTime=E.parseDate(E.config.minTime,"H:i")),void 0!==E.config.maxTime&&(E.config.maxTime=E.parseDate(E.config.maxTime,"H:i")),E.minDateHasTime=!!E.config.minDate&&(E.config.minDate.getHours()>0||E.config.minDate.getMinutes()>0||E.config.minDate.getSeconds()>0),E.maxDateHasTime=!!E.config.maxDate&&(E.config.maxDate.getHours()>0||E.config.maxDate.getMinutes()>0||E.config.maxDate.getSeconds()>0)}(),E.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=E.currentMonth),void 0===n&&(n=E.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:E.l10n.daysInMonth[e]}},E.isMobile||function(){var e=window.document.createDocumentFragment();if(E.calendarContainer=f("div","flatpickr-calendar"),E.calendarContainer.tabIndex=-1,!E.config.noCalendar){if(e.appendChild((E.monthNav=f("div","flatpickr-months"),E.yearElements=[],E.monthElements=[],E.prevMonthNav=f("span","flatpickr-prev-month"),E.prevMonthNav.innerHTML=E.config.prevArrow,E.nextMonthNav=f("span","flatpickr-next-month"),E.nextMonthNav.innerHTML=E.config.nextArrow,J(),Object.defineProperty(E,"_hidePrevMonthArrow",{get:function(){return E.__hidePrevMonthArrow},set:function(e){E.__hidePrevMonthArrow!==e&&(u(E.prevMonthNav,"flatpickr-disabled",e),E.__hidePrevMonthArrow=e)}}),Object.defineProperty(E,"_hideNextMonthArrow",{get:function(){return E.__hideNextMonthArrow},set:function(e){E.__hideNextMonthArrow!==e&&(u(E.nextMonthNav,"flatpickr-disabled",e),E.__hideNextMonthArrow=e)}}),E.currentYearElement=E.yearElements[0],ge(),E.monthNav)),E.innerContainer=f("div","flatpickr-innerContainer"),E.config.weekNumbers){var n=function(){E.calendarContainer.classList.add("hasWeeks");var e=f("div","flatpickr-weekwrapper");e.appendChild(f("span","flatpickr-weekday",E.l10n.weekAbbreviation));var n=f("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,r=n.weekNumbers;E.innerContainer.appendChild(t),E.weekNumbers=r,E.weekWrapper=t}E.rContainer=f("div","flatpickr-rContainer"),E.rContainer.appendChild(q()),E.daysContainer||(E.daysContainer=f("div","flatpickr-days"),E.daysContainer.tabIndex=-1),V(),E.rContainer.appendChild(E.daysContainer),E.innerContainer.appendChild(E.rContainer),e.appendChild(E.innerContainer)}E.config.enableTime&&e.appendChild(function(){E.calendarContainer.classList.add("hasTime"),E.config.noCalendar&&E.calendarContainer.classList.add("noCalendar");var e=D(E.config);E.timeContainer=f("div","flatpickr-time"),E.timeContainer.tabIndex=-1;var n=f("span","flatpickr-time-separator",":"),t=h("flatpickr-hour",{"aria-label":E.l10n.hourAriaLabel});E.hourElement=t.getElementsByTagName("input")[0];var r=h("flatpickr-minute",{"aria-label":E.l10n.minuteAriaLabel});if(E.minuteElement=r.getElementsByTagName("input")[0],E.hourElement.tabIndex=E.minuteElement.tabIndex=-1,E.hourElement.value=a(E.latestSelectedDateObj?E.latestSelectedDateObj.getHours():E.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),E.minuteElement.value=a(E.latestSelectedDateObj?E.latestSelectedDateObj.getMinutes():e.minutes),E.hourElement.setAttribute("step",E.config.hourIncrement.toString()),E.minuteElement.setAttribute("step",E.config.minuteIncrement.toString()),E.hourElement.setAttribute("min",E.config.time_24hr?"0":"1"),E.hourElement.setAttribute("max",E.config.time_24hr?"23":"12"),E.hourElement.setAttribute("maxlength","2"),E.minuteElement.setAttribute("min","0"),E.minuteElement.setAttribute("max","59"),E.minuteElement.setAttribute("maxlength","2"),E.timeContainer.appendChild(t),E.timeContainer.appendChild(n),E.timeContainer.appendChild(r),E.config.time_24hr&&E.timeContainer.classList.add("time24hr"),E.config.enableSeconds){E.timeContainer.classList.add("hasSeconds");var o=h("flatpickr-second");E.secondElement=o.getElementsByTagName("input")[0],E.secondElement.value=a(E.latestSelectedDateObj?E.latestSelectedDateObj.getSeconds():e.seconds),E.secondElement.setAttribute("step",E.minuteElement.getAttribute("step")),E.secondElement.setAttribute("min","0"),E.secondElement.setAttribute("max","59"),E.secondElement.setAttribute("maxlength","2"),E.timeContainer.appendChild(f("span","flatpickr-time-separator",":")),E.timeContainer.appendChild(o)}return E.config.time_24hr||(E.amPM=f("span","flatpickr-am-pm",E.l10n.amPM[i((E.latestSelectedDateObj?E.hourElement.value:E.config.defaultHour)>11)]),E.amPM.title=E.l10n.toggleTitle,E.amPM.tabIndex=-1,E.timeContainer.appendChild(E.amPM)),E.timeContainer}()),u(E.calendarContainer,"rangeMode","range"===E.config.mode),u(E.calendarContainer,"animate",!0===E.config.animate),u(E.calendarContainer,"multiMonth",E.config.showMonths>1),E.calendarContainer.appendChild(e);var o=void 0!==E.config.appendTo&&void 0!==E.config.appendTo.nodeType;if((E.config.inline||E.config.static)&&(E.calendarContainer.classList.add(E.config.inline?"inline":"static"),E.config.inline&&(!o&&E.element.parentNode?E.element.parentNode.insertBefore(E.calendarContainer,E._input.nextSibling):void 0!==E.config.appendTo&&E.config.appendTo.appendChild(E.calendarContainer)),E.config.static)){var s=f("div","flatpickr-wrapper");E.element.parentNode&&E.element.parentNode.insertBefore(s,E.element),s.appendChild(E.element),E.altInput&&s.appendChild(E.altInput),s.appendChild(E.calendarContainer)}E.config.static||E.config.inline||(void 0!==E.config.appendTo?E.config.appendTo:window.document.body).appendChild(E.calendarContainer)}(),function(){if(E.config.wrap&&["open","close","toggle","clear"].forEach(function(e){Array.prototype.forEach.call(E.element.querySelectorAll("[data-"+e+"]"),function(n){return P(n,"click",E[e])})}),E.isMobile)!function(){var e=E.config.enableTime?E.config.noCalendar?"time":"datetime-local":"date";E.mobileInput=f("input",E.input.className+" flatpickr-mobile"),E.mobileInput.tabIndex=1,E.mobileInput.type=e,E.mobileInput.disabled=E.input.disabled,E.mobileInput.required=E.input.required,E.mobileInput.placeholder=E.input.placeholder,E.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",E.selectedDates.length>0&&(E.mobileInput.defaultValue=E.mobileInput.value=E.formatDate(E.selectedDates[0],E.mobileFormatStr)),E.config.minDate&&(E.mobileInput.min=E.formatDate(E.config.minDate,"Y-m-d")),E.config.maxDate&&(E.mobileInput.max=E.formatDate(E.config.maxDate,"Y-m-d")),E.input.getAttribute("step")&&(E.mobileInput.step=String(E.input.getAttribute("step"))),E.input.type="hidden",void 0!==E.altInput&&(E.altInput.type="hidden");try{E.input.parentNode&&E.input.parentNode.insertBefore(E.mobileInput,E.input.nextSibling)}catch(e){}P(E.mobileInput,"change",function(e){E.setDate(p(e).value,!1,E.mobileFormatStr),ve("onChange"),ve("onClose")})}();else{var e=s(oe,50);if(E._debouncedChange=s(k,300),E.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&P(E.daysContainer,"mouseover",function(e){"range"===E.config.mode&&re(p(e))}),P(window.document.body,"keydown",te),E.config.inline||E.config.static||P(window,"resize",e),void 0!==window.ontouchstart?P(window.document,"touchstart",Z):P(window.document,"mousedown",Z),P(window.document,"focus",Z,{capture:!0}),!0===E.config.clickOpens&&(P(E._input,"focus",E.open),P(E._input,"click",E.open)),void 0!==E.daysContainer&&(P(E.monthNav,"click",Oe),P(E.monthNav,["keyup","increment"],R),P(E.daysContainer,"click",le)),void 0!==E.timeContainer&&void 0!==E.minuteElement&&void 0!==E.hourElement){var n=function(e){return p(e).select()};P(E.timeContainer,["increment"],N),P(E.timeContainer,"blur",N,{capture:!0}),P(E.timeContainer,"click",F),P([E.hourElement,E.minuteElement],["focus","click"],n),void 0!==E.secondElement&&P(E.secondElement,"focus",function(){return E.secondElement&&E.secondElement.select()}),void 0!==E.amPM&&P(E.amPM,"click",function(e){N(e),k()})}E.config.allowInput&&P(E._input,"blur",ne)}}(),(E.selectedDates.length||E.config.noCalendar)&&(E.config.enableTime&&x(E.config.noCalendar?E.latestSelectedDateObj:void 0),be(!1)),T();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!E.isMobile&&n&&ce(),ve("onReady")}(),E}function T(e,n){for(var t=Array.prototype.slice.call(e).filter(function(e){return e instanceof HTMLElement}),r=[],o=0;o{var l={setCustomize:()=>{}},d=function(e,n){if(!n||1===n)return e.store;var t=e.store.modules&&e.store.modules.team;return t?t.getTeam(n):void 0},h=function(n,t){n.emit("UPDATE",{teams:t.stores,roTeams:t.roStores,id:t.channel,loading:!t.ready&&!t.cacheready,readOnly:t.readOnly||!t.ready&&t.cacheready||t.offline,offline:t.offline,deleted:!t.stores.length,restricted:t.restricted,owned:n.Store.isOwned(t.owners),content:e.clone(t.proxy),hashes:t.hashes},n.clients)},p=function(e,n){var t=e.calendars[n];t&&t.reminders&&Object.keys(t.reminders).forEach(function(e){Array.isArray(t.reminders[e])&&t.reminders[e].forEach(function(e){clearTimeout(e)})})},v=function(e,n){var t=e.calendars[n];t&&(t.stores.length||(t.lm.stop(),p(e,n),delete e.calendars[n]))},y=function(e,n,t){n.stores.forEach(function(r){var o=d(e,r);if(o&&o.proxy&&o.rpc&&o.proxy.calendars){var a=o.proxy.calendars[n.channel];a&&(a.color!==t.color&&(a.color=t.color),a.title!==t.title&&(a.title=t.title))}})},m=function(n,t,r,o){var a=+new Date,i=e.clone(r),s=i.id;if(Array.isArray(t[s])&&t[s].forEach(function(e){clearTimeout(e)}),t[s]=[],!r.deleted){var u=e.find(n,["store","proxy","hideReminders",s])||[],f=n.store.data.lastVisit;if(i.isAllDay&&(i.startDay&&(i.start=+c.parseDate(i.startDay)),i.endDay)){var l=c.parseDate(i.endDay);l.setHours(23),l.setMinutes(59),l.setSeconds(59),i.end=+l}var d=a-6048e5,h=o&&i.start>f&&i.end<=a&&i.end>d;if(i.end<=a&&!h)return delete t[s],void function(n,t){var r=e.find(n,["store","proxy","hideReminders"])||{};Object.keys(r).filter(function(e){return e===t}).forEach(function(e){delete r[e]})}(n,s);var p=!1,v=function(t){p=!0,n.Store.onReadyEvt.reg(function(){!function(t){if(!e.find(n,["store","proxy","settings","general","calendar","hideNotif"])){var r=i.start<=a?i.start:+new Date;n.store.mailbox.showMessage("reminders",{msg:{ctime:r,type:"REMINDER",missed:Boolean(h),content:i},hash:"REMINDER|"+s+"-"+t},null,function(){})}}(t)})},y=i.reminders||[];y.sort(function(e,n){return e-n}),y.some(function(e){var n=a+6e4*e;if(!u.some(function(n){return e>=n}))return i.start-n>=2147483647||(i.start<=n?(v(e),!0):void t[s].push(setTimeout(function(){v(e)},i.start-n)))}),p||n.Store.onReadyEvt.reg(function(){n.store.mailbox.hideMessage("reminders",{hash:"REMINDER|"+s},null,function(){})})}},g=function(n,t,r,o){var i=function(e){var n=new Date,t=new Date(n.getFullYear(),n.getMonth()-1,15),r=new Date(n.getFullYear(),n.getMonth()+1,15),o=a.getMonthId(t),i=a.getMonthId(n),s=a.getMonthId(r),c=a.getRecurring([o,i,s],[e]),u=[e];return Array.prototype.push.apply(u,c),u}(e.clone(r));i.forEach(function(e){m(n,t,e,o)})},E=function(e,n,t){var r=e.calendars[n];t&&r&&r.reminders&&(1===r.stores.length&&0===r.stores[0]||g(e,r.reminders,t))},b=function(n,t,r){var o=n.calendars[t];if(o&&o.reminders&&!Object.keys(o.reminders).length&&(1!==o.stores.length||0!==o.stores[0])){var a=e.find(o,["proxy","content"]);a&&Object.keys(a).forEach(function(e){g(n,o.reminders,a[e],r)})}},O=function(t,r,a){var c=e.once(e.mkAsync(a||function(){})),l=r.storeId,v=r.data,m=v.channel;if(m){var g=t.calendars[m],O=function(){h(t,g)};if(g){if(g.readOnly&&v.href){var A=n.parsePadUrl(v.href),w=n.getSecrets("calendar",A.hash,v.password),D=u.createEncryptor(w.keys);g.hashes.editHash=n.getEditHashFromKeys(w),g.lm.setReadOnly(!1,D),g.readOnly=!1}else if(0===l)return 1===g.stores.length&&0===g.stores[0]&&g.tempId.length&&r.cId&&g.tempId.push(r.cId),void c();return-1!==g.roStores.indexOf(l)&&v.href&&(g.roStores.splice(g.roStores.indexOf(l),1),-1!==g.stores.indexOf(0)&&g.stores.splice(g.stores.indexOf(0),1),O()),g.stores&&-1!==g.stores.indexOf(l)?void c():(-1!==g.stores.indexOf(0)&&(g.stores.splice(g.stores.indexOf(0),1),g.tempId=[]),g.stores.push(l),v.href||g.roStores.push(l),O(),void c())}g=t.calendars[m]={ready:!1,channel:m,readOnly:!v.href,tempId:[],stores:[l],roStores:v.href?[]:[l],reminders:{},hashes:{}},0===l&&g.tempId.push(r.cId);var _=n.parsePadUrl(v.href||v.roHref),T=n.getSecrets("calendar",_.hash,v.password),S=u.createEncryptor(T.keys);g.hashes.viewHash=n.getViewHashFromKeys(T),v.href&&(g.hashes.editHash=n.getEditHashFromKeys(T)),g.proxy={metadata:{color:v.color,title:v.title}},O();var N=function(){g.stores.forEach(function(e){var n=d(t,e);n&&n.rpc&&n.proxy.calendars&&(delete n.proxy.calendars[m],(n.unpin||t.unpinPads)([m],function(e){e&&e.error&&console.error(e.error)}))}),g.lm&&g.lm.stop(),g.stores=[],h(t,g),p(t,m),delete t.calendars[m]};i(function(e){t.store.network&&!r.isNew&&t.Store.isNewChannel(null,m,e(function(n){if(!n||!n.error)return n&&"boolean"==typeof n.isNew&&n.isNew?(N(),c({error:"EDELETED"}),void e.abort()):void 0}))}).nThen(function(){var e;if(1!==l&&l){var n=t.store.modules.team&&t.store.modules.team.getTeamsData(),a=n&&n[l];e=a?a.edPublic:void 0}else e=t.store.proxy.edPublic;var i={data:{},network:t.store.network||t.store.networkPromise,channel:T.channel,crypto:S,owners:[e],ChainPad:f,validateKey:T.keys.validateKey||void 0,userName:"calendar",Cache:o,classic:!0,onRejected:t.Store&&t.Store.onRejected},u=s.create(i);g.lm=u;var d=g.proxy=u.proxy,h=!1,p=function(){h||(h=!0,setTimeout(function(){h=!1,O()}))};u.proxy.on("cacheready",function(){d.metadata&&(g.cacheready=!0,p(),c&&c(null,u.proxy),b(t,m,r.lastVisitNotif))}).on("ready",function(e){var n=e.metadata;if(g.owners=n.owners||[],g.ready=!0,!d.metadata){if(!r.isNew)return void N();d.metadata={color:v.color,title:v.title}}p(),c&&c(null,u.proxy),b(t,m,r.lastVisitNotif)}).on("change",[],function(){g.ready&&p()}).on("change",["content"],function(e,n,r){2!==r.length||!n||e?2!==r.length||n||!e?(r.length>=3&&["start","reminders","isAllDay"].includes(r[2])||r.length>=6&&["start","reminders","isAllDay"].includes(r[5]))&&setTimeout(function(){E(t,m,d.content[r[1]])}):E(t,m,{id:r[1],start:0}):E(t,m,n)}).on("remove",["content"],function(e,n){p(),(n.length>=3&&"reminders"===n[2]||n.length>=6&&"reminders"===n[5])&&setTimeout(function(){E(t,m,d.content[n[1]])})}).on("change",["metadata"],function(){var e=d.metadata;e&&e.title&&e.color&&y(t,g,e)}).on("disconnect",function(){g.offline=!0,p()}).on("reconnect",function(){g.offline=!1,p()}).on("error",function(e){e&&e.error&&("EDELETED"!==e.error?("ERESTRICTED"===e.error&&(g.restricted=!0,p()),c(e)):N())})})}},A=function(e,n){if(n.href&&-1===n.href.indexOf("#"))if(e.secondaryKey)try{n.href=e.userObject.cryptor.decrypt(n.href)}catch(e){console.error(e),delete n.href}else delete n.href},w=function(n,t){var r=t.proxy.calendars,o=t.id||1;t.proxy.on("change",["calendars"],function(r,a,i){i.length<2||(r&&!a&&function(){var e=i[1],t=n.calendars[e];if(t){var r=t.stores.indexOf(o);if(-1!==r){t.stores.splice(r,1);var a=t.roStores.indexOf(o);-1!==a&&t.roStores.splice(a,1),v(n,e),h(n,t)}}}(),!r&&a&&function(){var r=i[1],a=t.proxy.calendars[r];if(a){var s=e.clone(a);A(t,s),O(n,{storeId:o,data:s})}}())}),Object.keys(r||{}).forEach(function(a){var i=e.clone(r[a]);A(t,i),O(n,{storeId:o,lastVisitNotif:!0,data:i})})},D=function(e,t,o,a){var i=d(e,t.teamId);if(i)if(i.rpc){var s,c,u,f=i.proxy.calendars=i.proxy.calendars||{},l=(s=n.createRandomHash("calendar"),c=n.getSecrets("calendar",s),u=n.getViewHashFromKeys(c),{href:n.hashToHref(s,"calendar"),roHref:n.hashToHref(u,"calendar"),channel:c.channel});l.color=t.color,l.title=t.title,O(e,{storeId:i.id||1,data:l,isNew:!0},function(n){if(n)return console.error(n),void a({error:n.error});var t=e.calendars[l.channel];r.whenRealtimeSyncs(t.lm.realtime,function(){f[l.channel]=l,(i.pin||e.pinPads)([l.channel],function(e){e&&e.error&&console.error(e.error)}),e.Store.onSync(i.id,a)})})}else a({error:"EFORBIDDEN"});else a({error:"NO_STORE"})};return l.init=function(t,o,a){var s={},c=t.store,u={loggedIn:c.loggedIn&&c.proxy.edPublic,store:c,Store:t.Store,pinPads:t.pinPads,unpinPads:t.unpinPads,updateMetadata:t.updateMetadata,emit:a,onReady:e.mkEvent(!0),calendars:{},clients:[]};return function(e,n){var t=e.store.proxy;t.calendars=t.calendars||{},setTimeout(n)}(u,o(function(e){e||function(e){w(e,e.store);var n=e.store.modules.team&&e.store.modules.team.getTeamsData();n&&Object.keys(n).forEach(function(n){var t=d(e,n);w(e,t)})}(u)})),u.store.proxy.on("change",["hideReminders"],function(e,n,t){var r=t[1].split("|")[0];Object.keys(u.calendars).some(function(e){var n=u.calendars[e];if(n&&n.proxy&&n.proxy.content)return n.proxy.content[r]?(setTimeout(function(){E(u,e,n.proxy.content[r])}),!0):void 0})}),s.closeTeam=function(e){Object.keys(u.calendars).forEach(function(n){var t=u.calendars[n],r=t.stores.indexOf(e);if(-1!==r){t.stores.splice(r,1);var o=t.roStores.indexOf(e);-1!==o&&t.roStores.splice(o,1),v(u,n),h(u,t)}})},s.openTeam=function(e){var n=d(u,e);n&&w(u,n)},s.upgradeTeam=function(n){if(n){var t=d(u,n);t&&Object.keys(u.calendars).forEach(function(r){var o=u.calendars[r];if(-1!==o.stores.indexOf(n)){var a=t.proxy.calendars[r],i=e.clone(a);A(t,i),O(u,{storeId:n,data:i}),h(u,o)}})}},s.removeClient=function(e){!function(e,n){var t=e.clients.indexOf(n);-1!==t&&e.clients.splice(t,1),Object.keys(e.calendars).forEach(function(t){var r=e.calendars[t];if(1===r.stores.length&&0===r.stores[0]&&r.tempId.length){var o=r.tempId.indexOf(n);-1!==o&&r.tempId.splice(o,1),r.tempId.length||(r.stores=[],v(e,t))}})}(u,e)},s.execCommand=function(t,o,a){var s=o.cmd,c=o.data;if("SUBSCRIBE"!==s){if("OPEN"!==s)return"IMPORT"===s?u.store.offline?void a({error:"OFFLINE"}):u.loggedIn?void function(t,r,o,a){var i=r.id,s=t.calendars[i];if(s)if(Array.isArray(s.stores)&&-1!==s.stores.indexOf(r.teamId)){var c=t.store,u=c.proxy.calendars=c.proxy.calendars||{},f=s.hashes.editHash,l=s.hashes.viewHash;u[i]={href:f&&n.hashToHref(f,"calendar"),roHref:l&&n.hashToHref(l,"calendar"),channel:i,color:e.find(s,["proxy","metadata","color"])||e.getRandomColor(),title:e.find(s,["proxy","metadata","title"])||"..."},t.Store.onSync(null,a),O(t,{storeId:1,data:{href:u[i].href,toHref:u[i].roHref,channel:i}})}else a({error:"EINVAL"});else a({error:"ENOENT"})}(u,c,0,a):void a({error:"NOT_LOGGED_IN"}):"IMPORT_ICS"===s?u.store.offline?void a({error:"OFFLINE"}):void function(e,n,t,o){var a=n.id,i=e.calendars[a];if(i&&i.proxy){var s=n.json;i.proxy.content=i.proxy.content||{},Object.keys(s).forEach(function(n){i.proxy.content[n]=s[n],E(e,a,s[n])}),r.whenRealtimeSyncs(i.lm.realtime,function(){h(e,i),o()})}else o({error:"ENOENT"})}(u,c,0,a):"ADD"===s?u.store.offline?void a({error:"OFFLINE"}):u.loggedIn?void function(t,r,o,a){var i=d(t,r.teamId);if(i)if(i.rpc){var s=i.proxy.calendars=i.proxy.calendars||{},c=n.parsePadUrl(r.href),u=n.getSecrets(c.type,c.hash,r.password);if(u.channel===r.channel){var f=n.getEditHashFromKeys(u),l=n.getViewHashFromKeys(u),h=f&&n.hashToHref(f,"calendar"),p={href:h,roHref:l&&n.hashToHref(l,"calendar"),color:r.color,title:r.title,channel:r.channel};!s[r.channel]||!s[r.channel].href&&p.href?(p.color=r.color,p.title=r.title,O(t,{storeId:i.id||1,data:e.clone(p)},function(e){if(e)return console.error(e),void a({error:e.error});if(h&&i.id&&i.secondaryKey)try{p.href=i.userObject.cryptor.encrypt(h)}catch(e){console.error(e)}s[p.channel]=p,(i.pin||t.pinPads)([p.channel],function(e){e&&e.error&&console.error(e.error)}),t.Store.onSync(i.id,a)})):a()}else a({error:"EINVAL"})}else a({error:"EFORBIDDEN"});else a({error:"NO_STORE"})}(u,c,0,a):void a({error:"NOT_LOGGED_IN"}):"CREATE"===s?u.loggedIn?c.initialCalendar?void u.Store.onReadyEvt.reg(function(){D(u,c,0,a)}):u.store.offline?void a({error:"OFFLINE"}):void D(u,c,0,a):void a({error:"NOT_LOGGED_IN"}):"UPDATE"===s?u.store.offline?void a({error:"OFFLINE"}):void function(n,t,o,a){var i=t.id,s=n.calendars[i];if(s){var c=e.find(s,["proxy","metadata"]);c?(c.title=t.title,c.color=t.color,r.whenRealtimeSyncs(s.lm.realtime,a),h(n,s),y(n,s,t)):a({error:"EINVAL"})}else a({error:"ENOENT"})}(u,c,0,a):"DELETE"===s?u.store.offline?void a({error:"OFFLINE"}):u.loggedIn?void function(e,n,t,r){var o=d(e,n.teamId);if(o)if(o.rpc){if(o.proxy.calendars){var a=n.id;if(o.proxy.calendars[a]){delete o.proxy.calendars[a],(o.unpin||e.unpinPads)([a],function(e){e&&e.error&&console.error(e.error)});var i=e.calendars[a],s=i.stores.indexOf(o.id||1);i.stores.splice(s,1),v(e,a),e.Store.onSync(o.id,function(){h(e,i),r()})}else r()}}else r({error:"EFORBIDDEN"});else r({error:"NO_STORE"})}(u,c,0,a):void a({error:"NOT_LOGGED_IN"}):"CREATE_EVENT"===s?u.store.offline?void a({error:"OFFLINE"}):void function(e,n,t,o){var a=n.calendarId,i=e.calendars[a];if(i){var s=new Date(n.start),c=new Date(n.end);n.isAllDay?(n.startDay=s.getFullYear()+"-"+(s.getMonth()+1)+"-"+s.getDate(),n.endDay=c.getFullYear()+"-"+(c.getMonth()+1)+"-"+c.getDate()):(delete n.startDay,delete n.endDay),i.proxy.content=i.proxy.content||{},i.proxy.content[n.id]=n,r.whenRealtimeSyncs(i.lm.realtime,function(){E(e,a,n),h(e,i),o()})}else o({error:"ENOENT"})}(u,c,0,a):"UPDATE_EVENT"===s?u.store.offline?void a({error:"OFFLINE"}):void function(n,t,o,a){if(t&&t.ev){var s=t.ev.calendarId,c=n.calendars[s];if(c&&c.proxy&&c.proxy.content){var u=c.proxy.content[t.ev.id];if(u){t.rawData=t.rawData||{};var f,l=t.changes||{},d=t.type||{};if(l.calendarId){if(!(f=n.calendars[l.calendarId])||!f.proxy)return void a({error:"ENOENT"});f.proxy.content=f.proxy.content||{}}var p={one:{},from:{}};["one","from","all"].includes(d.which)&&(u.recUpdate=u.recUpdate||p,u.recUpdate.one||(u.recUpdate.one={}),u.recUpdate.from||(u.recUpdate.from={}));var v=u.recUpdate,y=["calendarId"],m=Object.keys(l).filter(function(e){return!y.includes(e)}),g=function(e){[v.from,v.one].forEach(function(n){Object.keys(n).forEach(function(t){Number(t){const r=[],o=null==Xt?void 0:Xt.httpUnsafeOrigin;ie.fetchApi(o,"config",!0,e=>{var o,a;(null===(o=null==e?void 0:e.adminKeys)||void 0===o?void 0:o.includes(n))&&r.push("admin");(null===(a=null==e?void 0:e.moderatorKeys)||void 0===a?void 0:a.includes(n))&&r.push("moderator"),t(r)})},er=(e,n,t)=>{e.Store.anonRpcMsg("",{msg:"IS_PREMIUM",data:n},e=>{let n=Array.isArray(e)&&e[0];t(n?["premium"]:[])})},nr=(e,n,t,r)=>{var o,a;const i=[];null==Xt||Xt.httpUnsafeOrigin;const s=n.edPublic||(null===(a=null===(o=e.store)||void 0===o?void 0:o.proxy)||void 0===a?void 0:a.edPublic);rt(e=>{$t(0,s,e(e=>{Array.prototype.push.apply(i,e)}))}).nThen(n=>{er(e,s,n(e=>{Array.prototype.push.apply(i,e)}))}).nThen(()=>{r(i)})},tr={admin:$t,moderator:$t,premium:er},rr={init:(e,n,t)=>{const r={store:e.store,Store:e.Store,updateMetadata:e.updateMetadata},o=r.Store;return o.onReadyEvt.reg(()=>{var e;const n=o.getMetadata(void 0,"drive",()=>{}),t=(null===(e=null==n?void 0:n.user)||void 0===e?void 0:e.badge)||"";t&&nr(r,{},0,e=>{var n,o;if(!e.includes(t)){const e=null===(o=null===(n=null==r?void 0:r.store)||void 0===n?void 0:n.modules)||void 0===o?void 0:o.profile;null==e||e.execCommand(void 0,{cmd:"SET",data:{key:"badge",value:""}},()=>{})}})}),{listBadges:(e,n)=>{nr(r,e,0,n)},removeClient:()=>{},execCommand:(e,n,t)=>{const o=n.cmd,a=n.data;"LIST_BADGES"!==o?"CHECK_BADGE"!==o?t():((e,n,t,r)=>{const{badge:o,ed:a,sig:i,nid:s}=n,c=ie.decodeBase64(a),u=ie.decodeBase64(i),f=Zt.sign.open(u,c);if(!f)return void r({verified:!1});if(ie.encodeUTF8(f)!==s)return void r({verified:!1});let l=tr[o];l?l(e,a,e=>{r({verified:e.includes(o),badge:o})}):r({verified:!1,error:"EINVAL"})})(r,a,0,t):nr(r,a,0,t)}}},setCustomize:e=>{Xt=null==e?void 0:e.ApiConfig}};var or,ar,ir=o(Object.freeze({__proto__:null,Badge:rr}));function sr(){if(ar)return or;ar=1;return or=((e,n,t,r,o,a,i,s,c,u,f,l,d,h,p,v,y,m,g,E,b,O,A,w,D,_,T,S,N,I,x,C,R,P,k,M,F)=>{const L=v.Account,H=y.Drive,j=m.Pad,K=N.Badge,U=globalThis;globalThis.nacl=globalThis.nacl||C.Nacl;let B={},V={};const Y=a.Saferphore;var G=a.mkEvent(!0),J=a.mkEvent(!0),q=a.mkEvent(!0),W=a.mkEvent(!0);var z={drive:{hideDuplicate:!0},pad:{width:!0,spellcheck:!0},security:{unsafeLinks:!1},general:{allowUserFeedback:!0}};return{setCustomize:e=>{B=e.ApiConfig,V=e.AppConfig},create:function(v){var y=U.Cryptpad_Store={};let m=v.query||function(){},N=v.broadcast||function(){};var R=U.CryptPad_AsyncStore={modules:{}};y.onReadyEvt=G,y.pad=j.init({Store:y,store:R,postMessage:m,broadcast:N}),y.drive=H.initAPI({Store:y,store:R,postMessage:m,broadcast:N});var P=[],k=R.sendDriveEvent=function(e,n,t){P.forEach(function(r){r!==t&&m(r,e,n)})},Q=y.getStore=function(e){if(!e)return R;try{var n=R.modules.team.getTeam(e);return n||void console.error("Team not found",e)}catch(n){return console.error(n),void console.error("Team not found",e)}},Z=y.onSync=function(e,n){var t=Q(e);t?F(function(e){if(t.realtime&&c.whenRealtimeSyncs(t.realtime,e()),!t.id&&t.drive?.realtime&&c.whenRealtimeSyncs(t.drive.realtime,e()),t.sharedFolders&&"object"==typeof t.sharedFolders)for(var n in t.sharedFolders)t.sharedFolders[n].realtime&&c.whenRealtimeSyncs(t.sharedFolders[n].realtime,e())}).nThen(function(){n()}):n({error:"ENOTFOUND"})};y.get=function(e,n,t){var r=Q(n.teamId);r?r.proxy?t(a.find(r.proxy,n.key)):t({error:"ENODRIVE"}):t({error:"ENOTFOUND"})},y.set=function(e,n,t){var r=Q(n.teamId);if(r)if(r.proxy){var o=n.key.slice(),i=o.pop(),s=a.find(r.proxy,o);s&&"object"==typeof s?(void 0===n.value?delete s[i]:s[i]=n.value,n.teamId||(N([e],"UPDATE_METADATA"),Array.isArray(o)&&"profile"===o[0]&&R.messenger&&u.updateMyData(R)),Z(n.teamId,t)):t({error:"INVALID_PATH"})}else t({error:"ENODRIVE"});else t({error:"ENOTFOUND"})},y.getSharedFolder=function(e,t,r){var o,i=Q(t.teamId),s=t.id;if(i&&i.manager){if(i.manager.folders[s])return(o=a.clone(i.manager.folders[s].proxy)).offline=Boolean(i.manager.folders[s].offline),void r(o);var c=a.find(i.proxy,["drive",n.SHARED_FOLDERS])||{};c[s]?y.loadSharedFolder(t.teamId,s,c[s],function(){r(i.manager.folders[s].proxy)}):r({})}else r({error:"ENOTFOUND"})},y.restoreSharedFolder=function(e,n,t){if(n.sfId&&n.drive){var r=Q(n.teamId);r.sharedFolders[n.sfId]&&(Object.keys(n.drive).forEach(function(e){r.sharedFolders[n.sfId].proxy[e]=n.drive[e]}),Object.keys(r.sharedFolders[n.sfId].proxy).forEach(function(e){n.drive[e]||delete r.sharedFolders[n.sfId].proxy[e]})),Z(n.teamId,t)}else t({error:"EINVAL"})},y.hasSigningKeys=function(){if(R.proxy)return"string"==typeof R.proxy.edPrivate&&"string"==typeof R.proxy.edPublic},y.hasCurveKeys=function(){if(R.proxy)return"string"==typeof R.proxy.curvePrivate&&"string"==typeof R.proxy.curvePublic},y.isOwned=function(e){var n=R.proxy.edPublic;if(!n)return!1;if(!Array.isArray(e)||!e.length)return!1;if(-1!==e.indexOf(n))return!0;var t=R.proxy.teams;return!!t&&Object.keys(t).some(function(n){var r=a.find(t[n],["keys","drive","edPublic"]);return r&&-1!==e.indexOf(r)})};var X=function(e){var n=e?R.manager.getChannelsList("expirable"):function(){var e=`${R.driveChannel}#drive`;if(!e)return null;var n=R.manager.getChannelsList("pin"),t=R.proxy.profile;if(t){var r=t.edit?o.hrefToHexChannelId("/profile/#"+t.edit,null):null;r&&n.push(r);var a=t.avatar?o.hrefToHexChannelId(t.avatar,null):null;a&&n.push(a)}if(R.proxy.todo&&n.push(o.hrefToHexChannelId("/todo/#"+R.proxy.todo,null)),R.proxy.friends){var i=u.getFriendChannelsList(R.proxy);n=n.concat(i)}if(R.proxy.mailboxes){var s=Object.keys(R.proxy.mailboxes).map(function(e){if("broadcast"!==e||R.isAdmin)return R.proxy.mailboxes[e].channel}).filter(Boolean);n=n.concat(s)}if(R.proxy.calendars){var c=Object.keys(R.proxy.calendars).map(function(e){return R.proxy.calendars[e].channel});n=n.concat(c)}return n.push(e),R.data&&R.data.blockId&&n.push(`${R.data.blockId}#block`),n.sort(),n}();return a.deduplicateString(n).sort()};y.pinPads=function(e,n,t){if(n){var r=Q(n&&n.teamId);if(r.rpc){"function"!=typeof t&&(console.error("expected a callback"),t=function(){});var o=n.pads||n;r.rpc.pin(o,function(e){t(e?{error:e}:{})})}else t({error:"RPC_NOT_READY"})}else t({error:"EINVAL"})},y.unpinPads=function(e,n,t){if(n){var r=Q(n&&n.teamId);if(r.rpc){var o=n.pads||n;r.rpc.unpin(o,function(e){t(e?{error:e}:{})})}else t({error:"RPC_NOT_READY"})}else t({error:"EINVAL"})};var $=R.account={};y.getPinnedUsage=function(e,n,t){var r=Q(n&&n.teamId);r&&r.rpc?r.rpc.getFileListSize(function(e,n){r.id||"number"!=typeof n||($.usage=n),t({bytes:n})}):t({error:"RPC_NOT_READY"})},y.getPinLimit=function(e,n,t){var r=Q(n&&n.teamId);r.rpc?r.rpc.getLimit(function(e,n,o,a){if(e)t({error:e});else{var i=r.id?{}:$;i.limit=n,i.plan=o,i.note=a,t(i)}}):t({error:"RPC_NOT_READY"})};y.uploadComplete=function(e,n,t){var r=Q(n.teamId);r?r.rpc?n.owned?r.rpc.ownedUploadComplete(n.id,function(e,n){t(e?{error:e}:n)}):r.rpc.uploadComplete(n.id,function(e,n){t(e?{error:e}:n)}):t({error:"RPC_NOT_READY"}):t({error:"ENOTFOUND"})},y.uploadStatus=function(e,n,t){var r=Q(n.teamId);r?r.rpc?r.rpc.uploadStatus({id:n.id,size:n.size},function(e,n){t(e?{error:e}:n)}):t({error:"RPC_NOT_READY"}):t({error:"ENOTFOUND"})},y.uploadCancel=function(e,n,t){var r=Q(n.teamId);r?r.rpc?r.rpc.uploadCancel({id:n.id,size:n.size},function(e,n){t(e?{error:e}:n)}):t({error:"RPC_NOT_READY"}):t({error:"ENOTFOUND"})},y.uploadChunk=function(e,n,t){var r=Q(n.teamId);r?r.rpc?r.rpc.send.unauthenticated("UPLOAD",{chunk:n.chunk,id:n.id},function(e,n){t({error:e,msg:n})}):t({error:"RPC_NOT_READY"}):t({error:"ENOTFOUND"})};y.anonRpcMsg=function(e,n,t){R.anon_rpc?R.anon_rpc.send(n.msg,n.data,function(e,n){t(e?{error:e}:n)}):t({error:"ANON_RPC_NOT_READY"})},y.getFileSize=function(e,n,t){var r=a.once(a.mkAsync(t));if(R.anon_rpc){var i=n.channel||o.hrefToHexChannelId(n.href,n.password);R.anon_rpc.send("GET_FILE_SIZE",i,function(e,n){if(!e)return n&&n.length&&"number"==typeof n[0]?(0===n[0]&&h.clearChannel(i),void r({size:n[0]})):void r({error:"INVALID_RESPONSE"});r({error:e})})}else r({error:"ANON_RPC_NOT_READY"})},y.isNewChannel=function(e,n,t){if(!R.anon_rpc)return void t({error:"ANON_RPC_NOT_READY"});let r="string"==typeof n?n:n.channel||o.hrefToHexChannelId(n.href,n.password);R.anon_rpc.send("IS_NEW_CHANNEL",r,function(e,n){if(!e)return n&&n.length&&"object"==typeof n[0]?(n[0].isNew&&h.clearChannel(r),void t(n[0])):void t({error:"INVALID_RESPONSE"});t({error:e})})},y.getMultipleFileSize=function(e,n,t){R.anon_rpc?Array.isArray(n.files)?R.anon_rpc.send("GET_MULTIPLE_FILE_SIZE",n.files,function(e,n){e?t({error:e}):n&&n.length&&"object"==typeof n[0]?t({size:n[0]}):t({error:"UNEXPECTED_RESPONSE"})}):t({error:"INVALID_FILE_LIST"}):t({error:"ANON_RPC_NOT_READY"})},y.getDeletedPads=function(e,n,t){if(R.anon_rpc){var r=n&&n.list||X(!0);Array.isArray(r)?R.anon_rpc.send("GET_DELETED_PADS",r,function(e,n){e?t({error:e}):n&&n.length&&Array.isArray(n[0])?t(n[0]):t({error:"UNEXPECTED_RESPONSE"})}):t({error:"INVALID_FILE_LIST"})}else t({error:"ANON_RPC_NOT_READY"})};var ee=function(e,n,t){R.anon_rpc?t():l.createAnonymous(R.network,function(e,n){e?t({error:e}):(R.anon_rpc=n,t())})},ne=y.getAllStores=function(){if(!R.proxy||!R.manager)return[];var e=[R],n=R.modules.team;if(n){var t=n.getTeams().map(function(e){return n.getTeam(e)});Array.prototype.push.apply(e,t)}return e};y.getUserColor=function(){var e=a.find(R,["proxy","settings","general","cursor","color"]);return e||(e=a.getRandomColor(!0),y.setAttribute(null,{attr:["general","cursor","color"],value:e},function(){})),e},y.getMetadata=function(e,n,t){var r=R.proxy||{},s=a.find(r,["settings","general","disableThumbnails"]),c=R.modules.team&&R.modules.team.getTeamsData(n)||{};r.uid||(R.noDriveUid=R.noDriveUid||o.createChannelId());var u={user:{name:r[i.displayNameKey]||R.noDriveName||"",uid:r.uid||R.noDriveUid,avatar:a.find(r,["profile","avatar"]),profile:a.find(r,["profile","view"]),color:y.getUserColor(),notifications:a.find(r,["mailboxes","notifications","channel"]),curvePublic:r.curvePublic,edPublic:r.edPublic,netfluxId:R?.network?.webChannels?.[0]?.myID,badge:a.find(r,["profile","badge"])},priv:{clientId:e,edPublic:r.edPublic,edPrivate:r.edPrivate,friends:r.friends||{},settings:r.settings||z,thumbnails:!1===s,isDriveOwned:Boolean(a.find(R,["driveMetadata","owners"])),driveChannel:R.driveChannel,pendingFriends:r.friends_pending||{},supportPrivateKey:a.find(r,["mailboxes","supportadmin","keys","curvePrivate"]),accountName:r.login_name||"",offline:R.proxy&&R.offline,teams:c,plan:R.ready?$.plan||"":void 0,mutedChannels:r.mutedChannels}};return t(JSON.parse(JSON.stringify(u))),u},y.onMaintenanceUpdate=function(){let e=B.httpUnsafeOrigin;a.fetchApi(e,"broadcast",!0,e=>{e&&N([],"UNIVERSAL_EVENT",{type:"broadcast",data:{ev:"MAINTENANCE",data:e.maintenance}})})},y.onSurveyUpdate=function(){let e=B.httpUnsafeOrigin;a.fetchApi(e,"broadcast",!0,e=>{N([],"UNIVERSAL_EVENT",{type:"broadcast",data:{ev:"SURVEY",data:e.surveyURL}})})};y.addPad=function(e,t,r){if(t.href||t.roHref){var a;if(!t.roHref){var i=o.parsePadUrl(t.href);"pad"===i.hashData.type&&(a=o.getSecrets(i.type,i.hash,t.password),t.roHref="/"+i.type+"/#"+o.getViewHashFromKeys(a))}var s,c,u,f,l=(s=t.href,c=t.roHref,u=t.title,f=+new Date,{href:s,roHref:c,atime:f,ctime:f,title:u||n.getDefaultName(o.parsePadUrl(s))});t.owners&&(l.owners=t.owners),t.expire&&(l.expire=t.expire),t.password&&(l.password=t.password),(t.channel||a)&&(l.channel=t.channel||a.channel),t.readme&&(l.readme=1),Object.keys(t.attributes||{}).forEach(e=>{t.attributes[e]&&(l[e]=t.attributes[e])}),-1===t.teamId&&(t.teamId=void 0);var d=Q(t.teamId);d&&d.manager?d.manager.addPad(t.path,l,function(o){o?r({error:o}):(ne().forEach(function(t){(t.id?t.sendEvent:k)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]},e)}),Z(t.teamId,r))}):r({error:"ENOTFOUND"})}else r({error:"NO_HREF"})};var te=function(e,n){var t=a.find(R,["proxy","edPublic"]),r=function(e){var n=[];return e?(R.proxy.todo&&n.push(o.hrefToHexChannelId("/todo/#"+R.proxy.todo,null)),R.proxy.profile&&R.proxy.profile.edit&&n.push(o.hrefToHexChannelId("/profile/#"+R.proxy.profile.edit,null)),R.proxy.mailboxes&&Object.keys(R.proxy.mailboxes||{}).forEach(function(e){if("supportadmin"!==e){var t=R.proxy.mailboxes[e];n.push(t.channel)}})):n=R.manager.getChannelsList("owned"),n.filter(function(e){if("string"==typeof e)return-1!==[32,48].indexOf(e.length)})}(e),i=Y.create(10),s=function(n){e||R.manager.findChannel(n).forEach(function(e){var n=R.manager.findFile(e.id);R.manager.delete({paths:n})})};r.forEach(function(e){var r=n();i.take(function(n){var o=!1;F(function(a){32===e.length&&y.anonRpcMsg(null,{msg:"GET_METADATA",data:e},a(function(i){if(i&&i.error)return n(),r(),void a.abort();var c=i[0];return Object.keys(c||{}).length?c&&Array.isArray(c.owners)&&-1!==c.owners.indexOf(t)?void(o=c.owners.some(function(e){return e!==t})):(n(),r(),void a.abort()):(s(e),n(),r(),void a.abort())}))}).nThen(function(n){o?y.pad.setMetadata(null,{channel:e,command:"RM_OWNERS",value:[t]},n()):R.rpc.removeOwnedChannel(e,n(function(n){n?console.error(n):s(e)}))}).nThen(function(){n(),r()})})})};y.removeOwnedPads=function(e,n,t){R.proxy.edPublic?F(function(e){te(!1,e)}).nThen(t):t({error:"NOT_LOGGED_IN"})},y.deleteAccount=function(n,t,r){var o=R.proxy.edPublic,s=t&&t.keys,c=t&&t.auth;y.anonRpcMsg(n,{msg:"GET_METADATA",data:R.driveChannel},function(t){var u=t[0];if(u&&u.owners&&1===u.owners.length&&-1!==u.owners.indexOf(o))F(function(e){I.checkRights({auth:c,blockKeys:s},e(function(n){if(n)return e.abort(),console.error(n),void r({error:"INVALID_CODE"})}))}).nThen(function(e){globalThis.accountDeletion=n,R.proxy[i.tokenKey]="DELETED",Z(null,e())}).nThen(function(e){R.rpc.removePins(e(function(e){e&&console.error(e)}))}).nThen(function(e){R.ownDeletion=!0,y.pad.destroy(n,{channel:R.driveChannel,force:!0},e())}).nThen(function(e){s&&I.removeLoginBlock({reason:"ARCHIVE_OWNED",auth:c,edPublic:o,blockKeys:s},e(function(e){e&&console.error(e)}))}).nThen(function(e){te(!0,e)}).nThen(function(){N([n],"DRIVE_DELETED","ARCHIVE_OWNED"),m(n,"DELETE_ACCOUNT","DELETED",function(){}),R.network.disconnect(),r({state:!0})});else{var f={intent:"Please delete my account."};f.drive=R.driveChannel,f.edPublic=o;var l=a.decodeBase64(R.proxy.edPrivate),d=C.Nacl.sign.detached(a.decodeUTF8(e(f)),l);C.Nacl.sign.detached.verify(a.decodeUTF8(e(f)),d,a.decodeBase64(o))||console.error("signed message failed verification");var h=a.encodeBase64(d);r({proof:h,toSign:JSON.parse(e(f))})}})},y.setDisplayName=function(e,n,t){if(!R.proxy)return R.noDriveName=n,N([e],"UPDATE_METADATA"),void t();R.modules.profile&&R.modules.profile.setName(n),R.proxy[i.displayNameKey]=n,N([e],"UPDATE_METADATA"),u.updateMyData(R),Z(null,t)},y.resetDrive=function(e,n,t){F(function(e){te(e)}).nThen(function(){R.proxy.drive=R.userObject.getStructure(),k("DRIVE_CHANGE",{path:["drive","filesData"]},e),Z(null,t)})},y.setPadAttribute=function(e,t,r){F(function(r){ne().forEach(function(o){o.manager.setPadAttribute(t,r(function(){(o.id?o.sendEvent:k)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]},e),Z(o.id,r())}))})}).nThen(r)},y.getPadAttribute=function(e,n,t){var r={};F(function(e){ne().forEach(function(t){t.manager.getPadAttribute(n,e(function(e,n){e||(n&&"object"==typeof n?(!r.value||r.atime{if(R.loggedIn&&R.proxy.edPublic){var n,r=R.modules.team,o=r&&r.getTeams()||[];-1!==e.indexOf(R.proxy.edPublic)?n=R:o.some(function(t){var o=a.find(R,["proxy","teams",t,"keys","drive","edPublic"]),i=a.find(R,["proxy","teams",t,"keys","drive","edPrivate"]);if(-1===e.indexOf(o))return!1;if(!i)return!1;var s=r.getTeam(t);return n=s,!0});var i=function(){if(n){var e=n.rpc;e?e.send("COOKIE","",function(e){t(e)}):t("ERESTRICTED")}else t("ERESTRICTED")};n&&n.onRpcReadyEvt?n.onRpcReadyEvt.reg(function(){i()}):i()}else t("ERESTRICTED")})):t("ERESTRICTED")},y.changePadPasswordPin=function(e,n,t){var r=n.oldChannel,o=n.channel;F(function(e){ne().forEach(function(n){n.manager.findChannel(o).length&&(n.rpc.unpin([r],e()),n.rpc.pin([o],e()))})}).nThen(t)},y.contactPadOwner=function(e,n,t){var r=n.owners;if(!Array.isArray(r)||!r.length)return t({state:!1});n.send?F(function(e){r.forEach(function(t){!function(e,t,r,o){if(R.mailbox&&!n.anon)return R.mailbox.sendTo(e,t,r,o);A.sendToAnon(R.anon_rpc,e,t,r,o)}(n.query,{channel:n.channel,data:n.msgData},{channel:t.notifications,curvePublic:t.curvePublic},e())})}).nThen(function(){t({state:!0})}):t({state:!0})},y.givePadAccess=function(e,n,t){var r,o,a=R.proxy.edPublic,i=n.channel,s=R.manager.findChannel(i);n.user&&n.user.notifications&&n.user.curvePublic?s.some(function(e){if(e.data&&Array.isArray(e.data.owners)&&-1!==e.data.owners.indexOf(a)&&e.data.href)return r=e.data.href,o=e.data.title,!0})?(R.mailbox.sendTo("GIVE_PAD_ACCESS",{channel:i,href:r,title:o},{channel:n.user.notifications,curvePublic:n.user.curvePublic}),t()):t({error:"ENOTFOUND"}):t({error:"EINVAL"})};y.burnPad=function(e,n){var t=n.channel,r=C.b64AddSlashes(n.ownerKey||"");if(t&&r)try{var a=o.decodeBase64(r),i=C.Nacl.sign.keyPair.fromSecretKey(a);f.create(R.network,{edPublic:o.encodeBase64(i.publicKey),edPrivate:o.encodeBase64(i.secretKey)},function(e,r){e?console.error(e):y.pad.getMetadata(null,{channel:t},function(e){r.removeOwnedChannel(t,function(t){t?console.error(t):function(e,n){var t=e.channel,r=e.href,a=o.parsePadUrl(r),i=o.getSecrets(a.type,a.hash,e.password);if((!n||!n.error)&&n.mailbox){var s,c=C.createEncryptor(i.keys),u=[];try{"string"==typeof n.mailbox?u.push(c.decrypt(n.mailbox,!0,!0)):Object.keys(n.mailbox).forEach(function(e){u.push(c.decrypt(n.mailbox[e],!0,!0))})}catch(e){console.error(e)}try{s=R.proxy.curvePublic}catch(e){return void console.error(e)}u.forEach(function(e){var n=JSON.parse(e);n.curvePublic!==s&&R.mailbox.sendTo("OWNED_PAD_REMOVED",{channel:t},{channel:n.notifications,curvePublic:n.curvePublic},function(){})})}}(n,e)})})})}catch(e){console.error(e)}else console.error("Can't delete BAR pad")},y.deleteMailboxMessage=function(e,n,t){R.anon_rpc?R.anon_rpc.send("DELETE_MAILBOX_MESSAGE",n,function(e){t({error:e})}):t({error:"RPC_NOT_READY"})},y.getFullHistory=function(e,n,t){var r=R.network,o=r.historyKeeper,a=[],i=!1,s=function(e){if(!i){var o=function(e){try{return JSON.parse(e)}catch(e){return null}}(e);if(o)return"FULL_HISTORY_END"===o[0]?(t(a),r.off("message",s),void(i=!0)):void("FULL_HISTORY"===o[0]&&(o[1]&&o[1].validateKey||o[1][3]===n.channel&&(e=o[1][4])&&(e=e.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/,""),n.debug?a.push({serverHash:e.slice(0,64),msg:e,author:o[1][1],time:o[1][5]}):a.push(e))))}};r.on("message",s),r.sendto(o,JSON.stringify(["GET_FULL_HISTORY",n.channel,n.validateKey]))},y.getHistory=function(e,n,t,r){var o=a.once(a.mkAsync(t)),i=R.network,s=i.historyKeeper,c=Math.floor(1e6*Math.random()),u=[],f=!1,l=function(e,t){if(!f&&t===s){var a=function(e){try{return JSON.parse(e)}catch(e){return null}}(e);if(a&&!(a.txid&&a.txid!==c||a.validateKey&&a.channel))if(a.error&&a.channel)a.channel===n.channel&&(i.off("message",l),f=!0,o({error:a.error}));else{if(1===a.state&&a.channel){if(a.channel!==n.channel)return;return o(u),i.off("message",l),void(f=!0)}Array.isArray(a)&&a[0]&&a[0]!==c||a[3]===n.channel&&(a[4]&&r?u.push({msg:e,hash:a[4].slice(0,64)}):(e=a[4])&&(e=e.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/,""),u.push(e)))}}};i.on("message",l);var d={txid:c,lastKnownHash:n.lastKnownHash},h=["GET_HISTORY",n.channel,d];i.sendto(s,JSON.stringify(h))},y.getHistoryRange=function(e,n,t){var r,o=R.network,i=o.historyKeeper,s=[],c=!0,u=!1,f=!1,l=a.uid();o.on("message",function(e){if(!f){var o=function(e){try{return JSON.parse(e)}catch(e){return null}}(e);if(o[1]===l){if("HISTORY_RANGE_ERROR"===o[0]){let e=o[2];return"ENOENT"===e?.code?(f=!0,void t({messages:s,isFull:!0})):void t({error:o[2]})}if("HISTORY_RANGE_END"===o[0])return t({messages:s,isFull:u,lastKnownHash:r}),void(f=!0);"HISTORY_RANGE"===o[0]&&(o[2]&&o[1].validateKey||o[2][3]===n.channel&&(e=o[2][4])&&(c&&(/^cp\|/.test(e)||n.toHash||(u=!0),r=e.slice(0,64),c=!1),e=e.replace(/cp\|(([A-Za-z0-9+\/=]+)\|)?/,""),s.push({serverHash:e.slice(0,64),msg:e,author:o[2][1],time:o[2][5]})))}else console.log("bad txid")}}),o.sendto(i,JSON.stringify(["GET_HISTORY_RANGE",n.channel,{from:n.lastKnownHash,to:n.toHash,cpCount:n.cpCount||2,txid:l}]))};var ae=function(e,t){e&&(e.deprecated||e.restricted||(t||e.on("change",["drive",n.SHARED_FOLDERS],function(t,r,a){if(a.length>3&&"password"===a[3]){var i=a[2],s=e.drive[n.SHARED_FOLDERS][i],c=R.manager.user.userObject.getHref?R.manager.user.userObject.getHref(s):s.href,u=o.parsePadUrl(c),f=o.getSecrets(u.type,u.hash,t);return p.updatePassword(y,{oldChannel:f.channel,password:r,href:c},R.network,function(){console.log("Shared folder password changed")}),!1}}),e.on("change",[],function(e,r,o){if(t){if(o[0]===n.FILES_DATA&&"object"==typeof r&&r.channel&&!r.owners){var a=[r.channel];r.rtChannel&&a.push(r.rtChannel),r.lastVersion&&a.push(r.lastVersion),y.pinPads(null,a,function(e){console.error(e)})}if(o[0]===n.FILES_DATA&&"object"==typeof e&&e.channel&&!r){var i=[e.channel];R.manager.findChannel(e.channel).some(function(e){return e.fId!==t})||(e.rtChannel&&i.push(e.rtChannel),e.lastVersion&&i.push(e.lastVersion),y.unpinPads(null,i,function(e){console.error(e)}))}}e&&!r&&Array.isArray(o)&&(o[0]===n.FILES_DATA||"drive"===o[0]&&o[1]===n.FILES_DATA)&&setTimeout(function(){y.checkDeletedPad(e&&e.channel)}),k("DRIVE_CHANGE",{id:t,old:e,new:r,path:o})}),e.on("remove",[],function(e,n){k("DRIVE_REMOVE",{id:t,old:e,path:n})})))};y.loadSharedFolder=function(e,n,t,r,a){var i=Q(e);if(i){var s=o.parsePadUrl(t.href||t.roHref);s||s.hashData?p.load({isNew:a,network:R.network||R.networkPromise,store:i,Store:y,isNewChannel:y.isNewChannel},n,t,r):r({error:"EINVAL"})}else r({error:"ENOTFOUND"})};var ie=function(e,n,t,r){y.loadSharedFolder(null,e,n,t,r)};y.loadSharedFolderAnon=function(e,n,t){y.loadSharedFolder(null,n.id,n.data,function(e){t({error:e?void 0:"EDELETED"})})},y.addSharedFolder=function(e,t,r){G.reg(function(){var o=Q(t.teamId);o.manager.addSharedFolder(t,function(a){a&&"object"==typeof a&&a.error?r(a):((t.teamId?o.sendEvent:k)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]},e),r(a))})})},y.updateSharedFolderPassword=function(e,n,t){p.updatePassword(y,n,R.network,t)},y.userObjectCommand=function(e,t,r){if(t&&t.cmd){var o=Q(t.teamId);if(o.offline)return(o.id?o.sendEvent:k)("NETWORK_DISCONNECT"),void r({error:"OFFLINE"});o.manager.command(t,function(o){ne().forEach(function(t){(t.id?t.sendEvent:k)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]},e)}),Z(t.teamId,function(){r(o)})})}},y._removeClient=function(e){var n=P.indexOf(e);-1!==n&&P.splice(n,1),R.onlyoffice?.removeClient?.(e),R.mailbox?.removeClient?.(e),Object.keys(R.modules).forEach(function(n){R.modules[n]?.removeClient?.(e)}),y.pad?.removeClient?.(e)};y.fixMissingRtChannel=e=>{const n={},t=e=>{e.forEach(e=>{Object.keys(e).forEach(t=>{let r=e[t],o=r.roHref||r.href;n[t]||={href:o,password:r.password,list:[]},n[t].list.push(r)})})};try{const e=R.manager.getMissingRtChannel();t(e)}catch(n){return s.send("MISSING_RT_CHANNEL_ERROR",!0),setTimeout(e)}(R.modules?.team?.getTeams()||[]).forEach(n=>{const r=R.modules.team.getTeam(n);try{const e=r.manager.getMissingRtChannel();t(e)}catch(n){return s.send("MISSING_RT_CHANNEL_ERROR",!0),setTimeout(e)}}),Object.keys(n).length&&s.send("MISSING_RT_CHANNEL",!0);let r=F;const i={network:R.network};Object.keys(n).forEach(e=>{r=r(t=>{const r=n[e],s=r.href;i.password=r.password;const c=o.parsePadUrl(s);d.get(c.hash,t((e,n)=>{if(e)return;const t=a.tryParse(n),o=t?.content?.channel;o&&r.list.forEach(e=>{e.rtChannel=o})}),i)}).nThen}),r(()=>{setTimeout(e)})},y.refreshDriveUI=function(){ne().forEach(function(e){(e.id?e.sendEvent:k)("DRIVE_CHANGE",{path:["drive",n.FILES_DATA]})})};var se=function(e,n){const r=a.mkAsync(n);var o=R.proxy,i=R.drive;if(R.manager)r();else{var s=R.manager=t.create(i.proxy,{onSync:function(e){Z(null,e)},edPublic:o.edPublic,pin:function(e,n){R.loggedIn?y.pinPads(null,e,n):n()},unpin:function(e,n){R.loggedIn?y.unpinPads(null,e,n):n()},loadSharedFolder:ie,settings:o.settings,removeOwnedChannel:function(e,n){y.pad.destroy("",e,n)},store:R,Store:y},{outer:!0,edPublic:R.proxy.edPublic,loggedIn:R.loggedIn,log:function(e){k("DRIVE_LOG",e)},rt:i.realtime}),c=R.userObject=s.user.userObject;F(function(e){R.sharedFolders={},R.handleSharedFolder=function(e,n){n?(R.sharedFolders[e]=n,R.driveEvents&&ae(n.proxy,e)):delete R.sharedFolders[e]},c.migrate(e())}).nThen(function(n){var t=R.network||R.networkPromise;p.loadSharedFolders(y,t,R,i.proxy,c,n,n=>{var t={type:"sf",progress:100*n.progress/n.max};m(e,"LOADING_DRIVE",t)},!0)}).nThen(function(n){oe(D,"team",n,e)}).nThen(function(e){oe(S,"calendar",e)}).nThen(function(){r()})}};const ce=(e=function(){})=>{oe(g,"cursor",e),oe(b,"integration",e),oe(_,"messenger",e),oe(T,"history",e),oe(K,"badge",e),R.onlyoffice||(R.onlyoffice=O.init(R,function(e,n,t){t.forEach(function(t){m(t,"OO_EVENT",{ev:e,data:n})})})),R&&(R.messenger=R.modules.messenger)},ue=(e,n,t)=>{const r=a.mkAsync(t);se(e,function(){J.fire(),r(n)})};var fe=function(e,n,t){R.ready=!0;var c=R.proxy,u=R.manager,l=R.userObject;F(function(t){c.settings||(c.settings=z),c.forms||(c.forms={}),c.friends_pending||(c.friends_pending={}),c.form_seed||(c.form_seed=o.createChannelId()),u||(ue(e,n,t()),u=R.manager,l=R.userObject),ee(0,0,t()),function(e,n,t){if(!R.loggedIn)return t();R.rpc?t($):f.create(R.network,R.proxy,function(e,n){e?t({error:e}):(R.rpc=n,R.onRpcReadyEvt.fire(),y.getPinLimit(null,null,function(e){e.error&&console.error(e.error),$.limit=e.limit,$.plan=e.plan,$.note=e.note,t(e)}))},h)}(0,0,t()),m(e,"LOADING_DRIVE",{type:"migrate",progress:0})}).nThen(function(n){void 0===c.version&&(c.version=11),r(c,n(),function(n,t){m(e,"LOADING_DRIVE",{type:"migrate",progress:t})},R)}).nThen(function(n){m(e,"LOADING_DRIVE",{type:"sf",progress:0}),l.fixFiles(),p.loadSharedFolders(y,R.network,R,R.drive.proxy,l,n,n=>{var t={type:"sf",progress:100*n.progress/n.max};m(e,"LOADING_DRIVE",t)}),ce(n),oe(w,"profile",n),oe(S,"calendar",n),oe(E,"support",n),F(e=>{R.modules.team&&R.modules.team.onReady(e)})}).nThen(function(e){y.fixMissingRtChannel(e())}).nThen(function(){var e,r=function(){N([],"REQUEST_LOGIN")};R.loggedIn&&(function(e){if(R.rpc){var n=X(!1),t=o.hashChannelList(n);R.rpc.getServerHash(function(n,r){n?e(n):e(null,r===t)})}else e({error:"RPC_NOT_READY"})}(function(e,n){n||function(e){if(R.rpc){var n=X(!1);R.rpc.reset(n,function(n){e(n||null)})}else e({error:"RPC_NOT_READY"})}(function(e){if(e)return console.error(e);console.log("RESET DONE")})}),"number"!=typeof c.loginToken&&(c[i.tokenKey]=R.data.localToken||Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)),n[i.tokenKey]=c[i.tokenKey],R.data.localToken&&R.data.localToken!==c[i.tokenKey])?r():(n.feedback=a.find(c,["settings","general","allowUserFeedback"]),s.init(n.feedback),R.returned=n,"function"==typeof t&&t(n),R.offline=!1,k("NETWORK_RECONNECT"),N([],"UPDATE_METADATA"),N([],"STORE_READY",n),"string"==typeof c.uid&&32===c.uid.length||(console.log("generating a persistent identifier"),c.uid=o.createChannelId()),!R.loggedIn||y.hasSigningKeys()&&y.hasCurveKeys()?(c.on("change",[i.displayNameKey],function(e,n){"string"==typeof n&&N([],"UPDATE_METADATA")}),c.on("change",["profile"],function(){N([],"UPDATE_METADATA")}),c.on("change",["friends"],function(e,n,t){if(N([],"UPDATE_METADATA"),R.messenger&&void 0===e){var r=t.slice(-1)[0],o=c.friends&&c.friends[r];R.messenger.onFriendAdded(o)}}),c.on("remove",["friends"],function(e,n){if(N([],"UPDATE_METADATA"),R.messenger){var t=n[1];t&&"channel"===n[2]&&R.messenger.onFriendRemoved(t,e)}}),c.on("change",["friends_pending"],function(){N([],"UPDATE_METADATA")}),c.on("remove",["friends_pending"],function(){N([],"UPDATE_METADATA")}),c.on("change",["settings"],function(){N([],"UPDATE_METADATA")}),c.on("change",[i.tokenKey],function(){R.isDeleted||"DELETED"===c[i.tokenKey]||N([],"UPDATE_TOKEN",{token:c[i.tokenKey]})}),R.mailbox=A.init({Store:y,store:R,updateMetadata:function(){N([],"UPDATE_METADATA")},updateDrive:function(){k("DRIVE_CHANGE",{path:["drive","filesData"]})},pinPads:function(e,n){y.pinPads(null,e,n)}},e,function(e,n,t,r){var o=a.once(r||function(){});t.forEach(function(t){m(t,"MAILBOX_EVENT",{ev:e,data:n},o)})}),G.fire()):r())})};const le=(e,n,t,r)=>{if(R.accountModule)return R.accountModule;const o=L.init({userHash:n.userHash,anonHash:n.anonHash,cache:n.cache,form_seed:n.form_seed,store:R,broadcast:N,postMessage:m});R.accountModule=o;const{channel:i,onAccountReady:s,onAccountCacheReady:c,onDisconnect:u,onReconnect:f}=o;R.driveChannel=i,c(e=>{R.cacheReturned||=e,t(e)}),s(e=>{R.returned||=e,r(e)}),u(()=>{k("NETWORK_DISCONNECT")}),f(()=>{k("NETWORK_RECONNECT")});return setInterval(function(){var e=[];const n=y.pad.getChannels();Object.keys(n).forEach(function(t){var r=n[t].clients;Array.prototype.push.apply(e,r)}),(e=a.deduplicateString(e)).forEach(function(e){var n=0,t=function(){if(n>=2)return y._removeClient(e),m(e,"TIMEOUT"),void console.error("TIMEOUT",e);n++;var r=setTimeout(t,3e4);m(e,"PING",null,function(e){e&&console.error(e),clearTimeout(r)})};t()})},12e4),o},de=(e,n,t,r)=>{const o=a.once(e=>{const n=H.init({account:e,store:R,broadcast:N,postMessage:m}),{onDriveReady:o,onDriveCacheReady:a,onDisconnect:i,onReconnect:s}=n;a(()=>{t(R.cacheReturned||R.returned)}),o(()=>{q.fire(),r(R.returned)}),i(()=>{}),s(()=>{})}),i=()=>{},s=le(0,n,i,i);s.onAccountCacheReady(()=>{o(s)}),s.onAccountReady(()=>{o(s)})};y.disableCache=function(e,n,t){n?h.disable():h.enable(),t()};var he=!1;const pe=e=>{if(R?.network?.historyKeeper)return setTimeout(e);const n=n=>{R.network||=n;n.join("0000000000000000000000000000000000").then(function(t){let r;t.members.forEach(e=>{16===e.length&&(r=e)}),n.historyKeeper=r,t.leave(),e()},function(n){console.error(n),e({error:"GET_HK"})})};if(R.network)return n(R.network);R.networkPromise?.then(n)};var ve=function(e,n,t){const r=a.once(n);var o=function(){ce();let e=()=>{ee(0,0,function(){s.send("NO_DRIVE",!0),r({})})};pe(n=>{if(!n)return t?((e,n)=>{if(R.rpc)n(R.rpc);else{var t=C.Nacl.sign.keyPair(),r=R.tempKeys={edPublic:a.encodeBase64(t.publicKey),edPrivate:a.encodeBase64(t.secretKey)};f.create(R.network,r,function(e,t){e?n({error:e}):(R.rpc=t,n(t))})}})(0,e):void e()}),R.network||t||r({})};if(!R.network){var i=x.getWebsocketURL();return R.networkPromise=M.connect(i),o(),R.networkPromise.then(e=>{R.network!==e&&(R.network?(e.disconnect(),e=R.network):R.network=e)},function(e){console.error(e),r({error:"OFFLINE"})})}o()};const ye=(e,n,t)=>{R.manager?J.reg(function(){pe(r=>{R.network||=r,fe(e,n,()=>{t(n)})})}):fe(e,n,()=>{t(n)})};return y.init=function(e,n,t){var r=a.once(function(r){n.driveEvents&&function(e){J.reg(()=>{-1===P.indexOf(e)&&P.push(e),R.driveEvents||(R.driveEvents=!0,ae(R.proxy),Object.keys(R.manager.folders).forEach(function(e){var n=R.manager.folders[e].proxy;ae(n,e)}))})}(e),t(r)});if(he&&!R.returned&&n.cache)J.reg(function(){r({state:"ALREADY_INIT",returned:R.cacheReturned})});else{if(he)return R.networkTimeout&&m(e,"LOADING_DRIVE",{type:"offline"}),void G.reg(function(){r({state:"ALREADY_INIT",returned:R.returned})});n.disableCache&&h.disable(),n.noDrive&&!n.requires&&(n.requires="pad"),((e,n,t)=>{if(n.neverDrive||n.noDrive&&!n.userHash&&!n.anonHash)return n.neverDrive&&(R.neverCache=!0),void ve(0,e=>{e?.error&&s.send("NO_DRIVE_ERROR",!0),n.neverDrive&&(e.tempKeys=R?.tempKeys),t(e)},!!n.neverDrive);const r=n.requires,o=!n.noDrive;he=!0,R.data=n;let c=e=>{1===Object.keys(R.proxy).length&&s.send("FIRST_APP_USE",!0),e&&e.error&&(he=!1)};if("pad"===r&&!o)return void ve(0,function(r){if(r&&r.error)return;t(r);let o=a.once(()=>{de(0,n,n=>{ue(e,n,c)},n=>{ye(e,n,c)})});y.pad.onCacheReady(()=>{R.network||o()}),y.pad.onJoined(o),W.reg(o)});if("file"===r&&!o)return void ve(0,function(r){r&&r.error||(t(r),de(0,n,n=>{ue(e,n,c)},n=>{ye(e,n,c)}))});if("team"===r){let r=!1;const o=o=>a=>{r||(r=!0,F(e=>{o||ee(0,0,e())}).nThen(n=>{oe(D,"team",n,e)}).nThen(e=>{!o&&R.modules.team&&R.modules.team.onReady(e)}).nThen(()=>{t(a),de(0,n,n=>{ue(e,n,c)},n=>{ye(e,n,c)})}))};return void le(0,n,o(!0),o(!1))}if("drive"===r)return void de(0,n,n=>{t(n),ue(e,n,c)},n=>{t(n),ye(e,n,c)});let u=e=>{c(e);const n=i.prefersDriveRedirectKey,r=a.find(R,["proxy","settings","general",n]);e[n]=r,t(e)};de(0,n,n=>{ue(e,n,u)},n=>{ye(e,n,u)})})(e,n,a.once(e=>{"GET_HK"!==e.error?r(e):r({error:"ERROR"})}))}},G.reg(function(){var e=+new Date-7776e6;h.getKeys(function(n,t){if(n)console.error(n);else{var r=function(){if(t.length){var n=t.pop();h.getTime(n,function(t,o){t?r():!o||o{const n=(e,n={})=>({create:function(t,r,o){var a,i=[],s=e.mkEvent(!0);t.reg(function(e){if(!a){var n=e.data;if("_READY"===n)return r("_READY"),a=!0,s.fire(),void i.forEach(function(e){t.fire(e)});i.push(n)}});var c={},u={},f={},l=[],d={},h={};h.query=function(e,n,t,o){var a,i=Math.random().toString(16).replace("0.","")+Math.random().toString(16).replace("0.",""),c=(o=o||{}).timeout||3e4;c>0&&(a=setTimeout(function(){delete u[i],t("TIMEOUT")},c)),f[i]=function(e){clearTimeout(a),delete f[i],e&&(delete u[i],t("UNHANDLED"))},u[i]=function(e,n){delete u[i],t(void 0,e.content,n)},s.reg(function(){var t={txid:i,content:n,q:e,raw:o.raw};r(o.raw?t:JSON.stringify(t))})};var p=h.event=function(e,n,t){t=t||{},s.reg(function(){var o={content:n,q:e,raw:t.raw};r(t.raw?o:JSON.stringify(o))})};h.on=function(e,n,t){var o=function(e,t,o){n(e.content,function(n){var t={txid:e.txid,content:n};r(o?t:JSON.stringify(t))},t)};return(c[e]=c[e]||[]).push(o),t||p("EV_REGISTER_HANDLER",e),{stop:function(){var n=c[e].indexOf(o);-1!==n&&c[e].splice(n,1)}}},h.whenReg=function(e,n,t){var r=t;l.indexOf(e)>-1?n():r=!0,r&&(d[e]=d[e]||[]).push(n)},h.onReg=function(e,n){h.whenReg(e,n,!0)},h.on("EV_REGISTER_HANDLER",function(e){d[e]&&(d[e].forEach(function(e){e()}),delete d[e]),l.push(e)});var v=!1;h.onReady=function(e){v?e():"function"==typeof e&&h.on("EV_RPC_READY",function(){v=!0,e()})},h.ready=function(){h.whenReg("EV_RPC_READY",function(){h.event("EV_RPC_READY")})};var y=[""];n.httpUnsafeOrigin?(y.push(n.httpUnsafeOrigin),y.push(n.httpSafeOrigin)):globalThis.location&&y.push(globalThis.location.origin),t.reg(function(e){if(a&&e.data&&"_READY"!==e.data&&y.includes(e.origin)){var n;try{n="object"==typeof e.data?e.data:JSON.parse(e.data)}catch(e){return void console.warn(e)}void 0!==n.ack?f[n.txid]&&f[n.txid](!n.ack):"string"==typeof n.q?c[n.q]?(n.txid&&r(JSON.stringify({txid:n.txid,ack:!0})),c[n.q].forEach(function(t){t(n||JSON.parse(e.data),e,n&&n.raw),n=void 0})):n.txid&&r(JSON.stringify({txid:n.txid,ack:!1})):void 0===n.q&&u[n.txid]&&u[n.txid](n,e)}}),r("_READY"),o(h)}});e.exports&&(e.exports=n(Z()))})()}(mr)),mr.exports}function Er(){if(pr)return hr;pr=1;var e;return hr=((e,n,t)=>{const r={};let o,a,i={},s=()=>{};return r.init=n=>{if(a)return;a=e.create({query:(e,n,t,r)=>{r=r||function(){},i[e].chan.query(n,t,function(e,n){r(e?{error:e}:n)})},broadcast:(e,n,t,r)=>{r=r||function(){},Object.keys(i).forEach(o=>{-1===e.indexOf(+o)&&i[o].chan.query(n,t,(e,n)=>{r(e?{error:e}:n)})})}}),s=n},r.initClient=(e,r)=>{if(!a)return console.error("Not initialized"),void r("NOT_INIT");const{postMsg:c}=e,u=t.mkEvent(),f=Number(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)),l=()=>{a._removeClient(f)};n.create(u,c,function(e){let n=i[f]={chan:e};console.debug("SharedW Channel created"),Object.keys(a.queries).forEach(function(t){"CONNECT"!==t&&"JOIN_PAD"!==t&&"SEND_PAD_MSG"!==t&&"STOPWORKER"!==t&&e.on(t,function(e,r){try{a.queries[t](f,e,r)}catch(n){console.error("Error in webworker when executing query "+t),console.error(n),console.log(e)}"DISCONNECT"===t&&(l(),globalThis.accountDeletion&&globalThis.accountDeletion===n.id&&(a=void 0,o=void 0))})}),e.on("STOPWORKER",function(e,n){s(),a.queries.DISCONNECT(f,e,n)}),e.on("CONNECT",function(e,n){console.debug("Connecting to store..."),a.queries.CONNECT(f,e,function(e){if(e&&"ALREADY_INIT"===e.state)return console.debug("Store already exists!"),o=o||e.returned,void n(e);o=e,n(e)})}),e.on("JOIN_PAD",function(e,t){n.channelId=e.channel;try{a.queries.JOIN_PAD(f,e,t)}catch(n){console.error("Error in webworker when executing query JOIN_PAD"),console.error(n),console.log(e)}}),e.on("SEND_PAD_MSG",function(e,t){var r={msg:e,channel:n.channelId};try{a.queries.SEND_PAD_MSG(f,r,t)}catch(e){console.error("Error in webworker when executing query SEND_PAD_MSG"),console.error(e),console.log(r)}}),r(u,l)},!0)},r})((ur||(ur=1,e=sr(),cr={create:function(n){var t=e.create(n),r={},o=r.queries={CONNECT:t.init,DISCONNECT:t.disconnect,PING:function(e,n,t){t()},CACHE_DISABLE:t.disableCache,GET_PIN_LIMIT:t.getPinLimit,PIN_PADS:t.pinPads,UNPIN_PADS:t.unpinPads,GET_PINNED_USAGE:t.getPinnedUsage,GET_DELETED_PADS:t.getDeletedPads,UPLOAD_CHUNK:t.uploadChunk,UPLOAD_COMPLETE:t.uploadComplete,UPLOAD_STATUS:t.uploadStatus,UPLOAD_CANCEL:t.uploadCancel,ANON_RPC_MESSAGE:t.anonRpcMsg,GET_FILE_SIZE:t.getFileSize,GET_MULTIPLE_FILE_SIZE:t.getMultipleFileSize,GET:t.get,SET:t.set,ADD_PAD:t.addPad,SET_PAD_TITLE:t.setPadTitle,MOVE_TO_TRASH:t.moveToTrash,RESET_DRIVE:t.resetDrive,GET_METADATA:t.getMetadata,IS_ONLY_IN_SHARED_FOLDER:t.isOnlyInSharedFolder,SET_DISPLAY_NAME:t.setDisplayName,SET_PAD_ATTRIBUTE:t.setPadAttribute,GET_PAD_ATTRIBUTE:t.getPadAttribute,SET_ATTRIBUTE:t.setAttribute,GET_ATTRIBUTE:t.getAttribute,LIST_ALL_TAGS:t.listAllTags,GET_TEMPLATES:t.getTemplates,GET_SECURE_FILES_LIST:t.getSecureFilesList,GET_PAD_DATA:t.getPadData,GET_PAD_DATA_FROM_CHANNEL:t.getPadDataFromChannel,GET_STRONGER_HASH:t.getStrongerHash,INCREMENT_TEMPLATE_USE:t.incrementTemplateUse,GET_SHARED_FOLDER:t.getSharedFolder,ADD_SHARED_FOLDER:t.addSharedFolder,LOAD_SHARED_FOLDER:t.loadSharedFolderAnon,RESTORE_SHARED_FOLDER:t.restoreSharedFolder,UPDATE_SHARED_FOLDER_PASSWORD:t.updateSharedFolderPassword,ANSWER_FRIEND_REQUEST:t.answerFriendRequest,SEND_FRIEND_REQUEST:t.sendFriendRequest,ANON_GET_PREVIEW_CONTENT:t.anonGetPreviewContent,OO_COMMAND:t.onlyoffice.execCommand,MAILBOX_COMMAND:t.mailbox.execCommand,UNIVERSAL_COMMAND:t.universal.execCommand,SEND_PAD_MSG:t.pad.sendMessage,JOIN_PAD:t.pad.join,LEAVE_PAD:t.pad.leave,REMOVE_OWNED_CHANNEL:t.pad.destroy,CLEAR_OWNED_CHANNEL:t.pad.clear,CORRUPTED_CACHE:t.pad.onCorruptedCache,GET_LAST_HASH:t.pad.getLastHash,GET_FULL_HISTORY:t.getFullHistory,GET_HISTORY:t.getHistory,GET_HISTORY_RANGE:t.getHistoryRange,IS_NEW_CHANNEL:t.isNewChannel,CONTACT_PAD_OWNER:t.contactPadOwner,GIVE_PAD_ACCESS:t.givePadAccess,BURN_PAD:t.burnPad,GET_PAD_METADATA:t.pad?.getMetadata,SET_PAD_METADATA:t.pad?.setMetadata,CHANGE_PAD_PASSWORD_PIN:t.changePadPasswordPin,GET_SNAPSHOT:t.getSnapshot,DELETE_MAILBOX_MESSAGE:t.deleteMailboxMessage,DRIVE_USEROBJECT:t.userObjectCommand,GET_DRIVE:t.drive.get,SET_DRIVE:t.drive.set,MIGRATE_ANON_DRIVE:t.drive.migrateAnon,HAS_DRIVE:t.drive.exists,DELETE_ACCOUNT:t.deleteAccount,REMOVE_OWNED_PADS:t.removeOwnedPads,ADMIN_RPC:t.adminRpc,ADMIN_ADD_MAILBOX:t.addAdminMailbox};return r.query=function(e,n,t){o[e]?o[e]("0",n,t):console.error("UNHANDLED_STORE_RPC")},r._removeClient=t._removeClient,r}}),cr),gr(),Z()),hr}var br,Or,Ar=function(){if(yr)return vr;yr=1;const e=Er();return vr={start:n=>{let t=!1,r=()=>{globalThis.close()};globalThis.window=globalThis,addEventListener("connect",o=>{console.debug("New SharedWorker client");const a=o.ports[0],i=e=>{a.postMessage(e)};let s,c=!1,u=()=>{};a.onmessage=function(o){if("INIT"===o.data?.type){if((o=>{t||(n(o),e.init(r),t=!0)})(o.data.cfg),c)return;c=!0,e.initClient({postMsg:i},function(e,n){s=e,u=n,i("SW_READY")})}else"CLOSE"===o.data?(console.debug("leave"),u()):s&&s.fire(o)}})}}}();var wr,Dr,_r=function(){if(Or)return br;Or=1;const e=Er();return br={start:n=>{let t,r=!1;const o=()=>{globalThis.close()},a=e=>{postMessage(e)};globalThis.window=globalThis,onmessage=function(i){if("INIT"===i.data?.type){let s=i.data.cfg;if(r)return;return n(s),e.init(o),r=!0,void e.initClient({postMsg:a},function(e){t=e,a("WW_READY")})}t&&t.fire(i)}}}}();var Tr=function(){if(Dr)return wr;Dr=1;const e=Er(),n=Z();return wr={start:t=>{let r,o=!1,a=!1;const i=n.mkEvent(),s=()=>{a=!0},c=e=>{a||i.fire(e)};return{init:n=>{o||(t(n),e.init(s),o=!0,e.initClient({postMsg:c},function(e){r=e,c("STORE_READY")}))},onMessage:e=>{i.reg(n=>{setTimeout(()=>{e(n)})})},query:e=>{r&&!a&&r.fire({data:e,origin:""})}}}}}(),Sr=Kn(),Nr=n({__proto__:null,default:r(Sr)},[Sr]),Ir=jn(),xr=n({__proto__:null,default:r(Ir)},[Ir]),Cr=Pt(),Rr=n({__proto__:null,default:r(Cr)},[Cr]),Pr=kt(),kr=n({__proto__:null,default:r(Pr)},[Pr]),Mr=Kt(),Fr=n({__proto__:null,default:r(Mr)},[Mr]),Lr=Qt(),Hr=n({__proto__:null,default:r(Lr)},[Lr]);let jr=e=>{[Te,nn,q,$e,B,Nr,gn,un,ke,Rr,kr,Hr,lr,ge,xr,Fr,rr].forEach(n=>{"function"==typeof n.setCustomize&&n.setCustomize(e)})},Kr="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,Ur="undefined"!=typeof SharedWorkerGlobalScope&&self instanceof SharedWorkerGlobalScope;e.store={},Ur?Ar.start(jr):Kr?_r.start(jr):("undefined"!=typeof module&&module.exports,e.store=Tr.start(jr)),e.start=jr}); diff --git a/www/cryptpad-api.js b/www/cryptpad-api.js index 9a40d291b..d5e5ee288 100644 --- a/www/cryptpad-api.js +++ b/www/cryptpad-api.js @@ -126,6 +126,7 @@ var start = function () { //config.document.key = key; + const autosave = typeof(config.autosave) === "number" ? config.autosave : 10; chan.send('START', { key: key, application: config.documentType, @@ -134,7 +135,7 @@ documentKey: docID, document: blob, ext: config.document.fileType, - autosave: config.events.onSave && (config.autosave || 10), + autosave: config.events.onSave && autosave, readOnly: config.mode === 'view', editorConfig: config.editorConfig || {}, _config: serializedConfig() @@ -216,6 +217,12 @@ }); }); + chan.on('DOCUMENT_ERROR', function (err) { + if (config.events.onError) { + config.events.onError(err); + } + }); + chan.on('ON_DOWNLOADAS', blob => { let url = URL.createObjectURL(blob); if (!config.events.onDownloadAs) { return; } @@ -232,6 +239,11 @@ if (!config.events.onSave) { return void cb(); } config.events.onSave(data, cb); }); + chan.on('GET_BLOB', (data, cb) => { + getBlob((err, blob) => { + cb({error: err, blob}); + }); + }); chan.on('RELOAD', function () { config.document.blob = blob; if (!config.editorConfig) { // Not OnlyOffice shim @@ -378,6 +390,15 @@ chan.send('DOWNLOAD_AS', arg); }; + ret.save = () => { + if (!chan) { + return void onDocumentReady.push(() => { + ret.save(); + }); + } + + chan.send('MANUAL_SAVE'); + }; return ret; }; diff --git a/www/file/inner.js b/www/file/inner.js index 3eaf80d90..898f6505a 100644 --- a/www/file/inner.js +++ b/www/file/inner.js @@ -86,7 +86,6 @@ define([ var $mt = $dlview.find('media-tag'); $mt.attr('src', src); $mt.attr('data-crypto-key', 'cryptpad:'+cryptKey); - $mt.css('transform', 'scale(2)'); var rightsideDisplayed = false; var metadataReceived = false; diff --git a/www/form/app-form.less b/www/form/app-form.less index 19c6a3c59..37cd22686 100644 --- a/www/form/app-form.less +++ b/www/form/app-form.less @@ -29,6 +29,7 @@ font-size: 1rem; &.alert-info { color: @cryptpad_text_col !important; + margin-top: 0.625rem; } } @@ -749,13 +750,24 @@ padding: 5px; margin-top: -10px; margin-right: -10px; + display: inline-flex; + align-items: center; + gap: 5px; + svg.lucide { + margin: 0; + } &.cp-is-empty { height: fit-content; - padding: 3px; border-radius: 0 @variables_radius 0 0; background-color: @cp_alerts-danger-bg; color: @cp_alerts-danger-text; } + .cp-form-poll-required-info { + opacity: 0.7; + &:hover { + opacity: 1; + } + } } } @@ -954,10 +966,10 @@ flex: 1; min-width: 100px; border-color: @cryptpad_text_col; - border-right: 0px; } button { svg { margin: 0 !important; } + margin-left: 0.5rem; } } diff --git a/www/form/inner.js b/www/form/inner.js index 72bc24669..70c9f1cb4 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -2643,6 +2643,7 @@ define([ poll: { defaultOpts: { type: 'text', // Text or Days or Time + required: false, values: [1, 2, 3].map(function (i) { return { uid: Util.uid(), @@ -2659,6 +2660,7 @@ define([ var lines = makePollTable(answers, opts, false); var disabled = false; + var hasInteracted = false; var updateAriaLabel = function ($c, val, index) { const optionLabel = $c.closest('.cp-form-type-poll').find(`.cp-form-poll-option[data-index=${index}] span`).text().trim(); @@ -2681,6 +2683,7 @@ define([ Util.onClickEnter($c, function () { if (disabled) { return; } + hasInteracted = true; val = (val+1)%3; $c.attr('data-value', val); updateAriaLabel($c, val, index); @@ -2717,10 +2720,24 @@ define([ ]); var $tag = $(tag); + if (APP.isEditor) { + $tag[0].addEventListener('click', function (e) { + const target = e.target; + if (target.closest('.cp-form-required-radio')) { + e.stopPropagation(); + } + }); + } var cursorGetter; var setCursorGetter = function (f) { cursorGetter = f; }; return { tag: tag, + isEmpty: function () { + var v = this.getValue(); + if (!v || !v.values) { return true; } + // Poll is considered empty if user hasn't interacted with it + return !hasInteracted; + }, getValue: function () { var res = {}; $tag.find('.cp-form-poll-choice').each(function (i, el) { @@ -2733,6 +2750,7 @@ define([ }, reset: function () { $tag.find('.cp-form-poll-choice').attr('data-value', 0); + hasInteracted = false; }, setEditable: function (state) { disabled = !state; @@ -2747,6 +2765,8 @@ define([ this.reset(); if (!res || !res.values) { return; } var val = res.values; + // If there are saved values, user has interacted + hasInteracted = Object.keys(val).length > 0; $tag.find('.cp-form-poll-choice').each(function (i, el) { if (!el._setValue) { return; } var $el = $(el); @@ -4048,7 +4068,15 @@ define([ var requiredTag; if (block.opts && block.opts.required) { - requiredTag = h('span.cp-form-required-tag', Messages.form_required_on); + var requiredContent = [Messages.form_required_on]; + if (type === 'poll') { + var infoIcon = Icons.get('help', { + class: 'cp-form-poll-required-info', + title: Messages.form_poll_required_hint + }); + requiredContent.push(infoIcon); + } + requiredTag = h('span.cp-form-required-tag', requiredContent); } var dragHandle; diff --git a/www/form/main.js b/www/form/main.js index 4cf26335c..123ba797c 100644 --- a/www/form/main.js +++ b/www/form/main.js @@ -9,7 +9,8 @@ define([ '/common/dom-ready.js', '/common/common-hash.js', '/common/sframe-common-outer.js', -], function (nThen, ApiConfig, DomReady, Hash, SFCommonO) { + '/common/outer/local-store.js' +], function (nThen, ApiConfig, DomReady, Hash, SFCommonO, LocalStore) { var href, hash; // Loaded in load #2 @@ -68,7 +69,7 @@ define([ addData: addData, addRpc: addRpc, //cache: true, - noDrive: parsed?.hashData?.mode !== "view", + noDrive: (parsed?.hashData?.mode !== "view" || !LocalStore.isLoggedIn()), hash: hash, href: href, useCreationScreen: true, diff --git a/www/integration/main.js b/www/integration/main.js index 4046d068c..101bc1fbd 100644 --- a/www/integration/main.js +++ b/www/integration/main.js @@ -138,6 +138,9 @@ define([ var onInsertImage = function (data, cb) { chan.send('ON_INSERT_IMAGE', data, cb); }; + var onError = function (err) { + chan.send('DOCUMENT_ERROR', err); + }; var onReady = function () { chan.send('DOCUMENT_READY', {}); }; @@ -157,10 +160,28 @@ define([ chan.send('ON_DOWNLOADAS', blob); }; + let manualSave; + chan.on('MANUAL_SAVE', function () { + if (typeof(manualSave) !== "function") { + console.error('UNSUPPORTED COMMAND', 'save'); + return; + } + manualSave(); + }); + let setSave = f => { + manualSave = f; + }; + let getInstanceURL = function () { return Config.httpUnsafeOrigin; }; + let getBlobClient = (cb) => { + chan.send('GET_BLOB', obj => { + if (obj?.error) { console.error(obj?.error); } + cb(obj?.blob); + }); + }; let getBlobServer = function (documentURL, cb) { let xhr = new XMLHttpRequest(); let data = encodeURIComponent(documentURL); @@ -174,11 +195,11 @@ define([ // myBlob is now the blob that the object URL pointed to. cb(null, blob); } else { - cb(this.status); + getBlobClient(cb); } }; - xhr.onerror = function (e) { - cb(e.message); + xhr.onerror = function () { + getBlobClient(cb); }; xhr.send(); }; @@ -248,9 +269,11 @@ define([ _: data._config }, utils: { + onError, onReady: onReady, onDownloadAs, setDownloadAs, + setSave, save: save, reload: reload, onHasUnsavedChanges: onHasUnsavedChanges, diff --git a/www/kanban/inner.js b/www/kanban/inner.js index ce41f0ed1..2a47cdf1f 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -1052,6 +1052,19 @@ define([ boards: boards, _boards: Util.clone(boards), }); + // disable dragging when editing + $(document).on('mousedown', '.kanban-item input, .kanban-title-board input', function (e) { + kanban.options.dragItems = false; + e.stopPropagation(); + }); + $(document).on('mouseup', function (e) { + var selectionActive = window.getSelection && window.getSelection().toString().length > 0; + if (!selectionActive) { + var drag = kanban.drag; + kanban.options.dragItems = drag; + } + e.stopPropagation(); + }); framework._.cpNfInner.metadataMgr.onChange(function () { var md = framework._.cpNfInner.metadataMgr.getPrivateData(); diff --git a/www/moderation/app-moderation.less b/www/moderation/app-moderation.less index 4a33358a4..b3031e004 100644 --- a/www/moderation/app-moderation.less +++ b/www/moderation/app-moderation.less @@ -78,6 +78,9 @@ height: 5rem; min-width: 5rem; flex: 1; + &:focus-visible { + outline: @variables_focus_style; + } } .cp-moderation-userdata-inputs { display: flex; @@ -88,6 +91,9 @@ :first-child { margin-top: 0 !important; } + input:focus-visible{ + outline: @variables_focus_style; + } } } diff --git a/www/moderation/inner.js b/www/moderation/inner.js index cc3adcd55..b6e6a3a3c 100644 --- a/www/moderation/inner.js +++ b/www/moderation/inner.js @@ -421,7 +421,7 @@ define([ // Msg.support_privacyHint.support_privacyTitle sidebar.addCheckboxItem({ key: 'privacy', - getState: () => false, + getState: () => true, query: (val, setState) => { APP.support.setAnonymous(val); setState(val); @@ -949,6 +949,7 @@ Attachments:${JSON.stringify(msg.attachments, 0, 2)}`; $container: APP.$toolbar, pageTitle: Messages.moderationPage, metadataMgr: common.getMetadataMgr(), + skipLink: '#cp-sidebarlayout-container' }; APP.toolbar = Toolbar.create(configTb); APP.toolbar.$rightside.hide(); diff --git a/www/pad/inner.js b/www/pad/inner.js index 5125550db..04d81d5d4 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -1083,6 +1083,7 @@ define([ framework.onReady(function(newPad) { editor.focus(); + editor.resetUndo(); if (!module.isMaximized) { module.isMaximized = true; diff --git a/www/profile/app-profile.less b/www/profile/app-profile.less index cf8474521..9d0809ea3 100644 --- a/www/profile/app-profile.less +++ b/www/profile/app-profile.less @@ -140,6 +140,7 @@ .cp-app-profile-displayname { font-weight: bold; font-size: 30px; + word-break: break-word; } .cp-app-profile-link { font-size: 25px; @@ -185,7 +186,21 @@ } .cp-app-profile-friend-request { flex: 0; - margin-top: 10px; + white-space: normal; + margin-bottom: 0.5rem; + svg { + min-width: @variables_icon_width; + } + } + .cp-app-profile-friend-request.btn-success { + margin-right: 0.5rem; + } + #cp-sidebarlayout-container #cp-sidebarlayout-rightside .cp-app-profile-friend-container button.btn.cp-app-profile-friend-request { + height: auto; + > span { + word-break: break-word; + overflow-wrap: anywhere; + } } // I tried using flexbox but messed with how the pencil icon was displayed diff --git a/www/profile/inner.js b/www/profile/inner.js index 98d64fc00..e0a1edefe 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -236,7 +236,7 @@ define([ // If this curve has sent us a friend request, we should not be able to sent it to them var friendRequests = common.getFriendRequests(); if (friendRequests[data.curvePublic]) { - $button.append(Messages._getKey('friendRequest_received', [name || Messages.anonymous])) + $button.append(UI.setHTML(h('span'), Messages._getKey('friendRequest_received', [name || Messages.anonymous]))) .click(function () { UIElements.displayFriendRequestModal(common, friendRequests[data.curvePublic]); }); @@ -276,7 +276,7 @@ define([ return; } // This is not a friend yet: we can send a friend request - $button.text(Messages._getKey('userlist_addAsFriendTitle', [data.name || Messages.anonymous])) + $button.empty().append([Icons.get('add-friend'), h('span', Messages._getKey('userlist_addAsFriendTitle', [data.name || Messages.anonymous]))]) .click(function () { APP.common.sendFriendRequest({ curvePublic: data.curvePublic, diff --git a/www/settings/inner.js b/www/settings/inner.js index 635dd3fc7..4b412600d 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -2031,6 +2031,9 @@ define([ cat.forEach(function(c) { APP.$rightside.find('.' + c).show(); }); + if (APP.editor) { + APP.editor.refresh(); + } }; var SIDEBAR_ICONS = { diff --git a/www/support/app-support.less b/www/support/app-support.less index 25ca71074..f15f11e02 100644 --- a/www/support/app-support.less +++ b/www/support/app-support.less @@ -44,7 +44,7 @@ color: @cryptpad_color_link; text-decoration: underline; } - .alert-info { + .alert-info, .alert-warning { font-size: 16px; margin-top: 15px; margin-bottom: 15px; diff --git a/www/support/inner.js b/www/support/inner.js index 7cf3ae87a..e07c9c139 100644 --- a/www/support/inner.js +++ b/www/support/inner.js @@ -50,6 +50,7 @@ define([ 'cp-support-list', ], 'new': [ // Msg.support_cat_new + 'cp-support-custom', 'cp-support-subscribe', 'cp-support-language', 'cp-support-form', @@ -220,6 +221,18 @@ define([ return $(content); }; + create['custom'] = function () { + const msg = AppConfig.customSupportMsg; + if (!msg) { return $(); } + const lang = Messages._getLanguage(); + const text = msg[lang] || msg['default']; + if (!text) { return $(); } + const div = h('div.cp-support-subscribe.cp-sidebarlayout-element', [ + h('div.alert.alert-warning', text) + ]); + return $(div); + }; + // Create a new tickets create['form'] = function () { var key = 'form'; @@ -293,7 +306,8 @@ define([ Object.keys(categories).forEach(function (key) { var $category = $('
                  ', { 'class': 'cp-sidebarlayout-category', - 'data-category': key + 'data-category': key, + 'tabindex': 0 }).appendTo($categories); var iconClass = icons[key]; if (iconClass) { @@ -303,8 +317,7 @@ define([ if (key === active) { $category.addClass('cp-leftside-active'); } - - $category.click(function () { + Util.onClickEnter($category, function () { if (!Array.isArray(categories[key]) && categories[key].onClick) { categories[key].onClick(); return; @@ -329,6 +342,7 @@ define([ $container: APP.$toolbar, pageTitle: Messages.supportPage, metadataMgr: common.getMetadataMgr(), + skipLink: '#cp-sidebarlayout-container' }; APP.toolbar = Toolbar.create(configTb); APP.toolbar.$rightside.hide(); diff --git a/www/support/ui.js b/www/support/ui.js index a6ec10376..6c5450d7a 100644 --- a/www/support/ui.js +++ b/www/support/ui.js @@ -387,8 +387,8 @@ define([ var privateData = metadataMgr.getPrivateData(); var answer = h('button.btn.btn-primary.cp-support-answer', [Icons.get('reply'), Messages.support_answer]); - var close = h('button.btn.btn-danger.cp-support-close', [Icons.get('close'), Messages.support_close]); - var remove = h('button.btn.btn-danger.cp-support-hide', [Icons.get('close'), Messages.support_remove]); + var close = h('button.btn.btn-danger.cp-support-close', [Messages.support_close]); + var remove = h('button.btn.btn-danger.cp-support-hide', [Icons.get('trash-full'), Messages.support_remove]); var _actions = [answer, close]; if (content.closed && !ctx.isAdmin) { _actions = [remove]; // XXX update key to "Delete permanently" ? @@ -454,7 +454,7 @@ define([ if (onMove && !onMove.disableMove) { let text = onMove.isTicketActive ? Messages.support_movePending : Messages.support_moveActive; - move = h('button.btn.btn-secondary', { title: text }, Icons.get('history')); + move = h('button.btn.btn-secondary', { title: text }, Icons.get('archive')); Util.onClickEnter($(move), function () { onMove(ticket, id, content); }); @@ -481,7 +481,10 @@ define([ let input = UI.dialog.textInput({id: `cp-${Util.uid()}`}); $tags.append(input); let existing = onTag.getAllTags(); - let _field = UI.tokenField(input, existing).preventDuplicates(function (val) { + let close = h('button.btn.btn-secondary.cp-token-close', [ + h('span', Messages.filePicker_close) + ]); + let _field = UI.tokenField(input, existing, close).preventDuplicates(function (val) { UI.warn(Messages._getKey('tags_duplicate', [val])); }); _field.setTokens(content.tags || []); @@ -508,17 +511,10 @@ define([ $list.toggle(); $tags.toggle(); }); - let close = h('button.btn.btn-secondary.cp-token-close', [ - Icons.get('close'), - h('span', Messages.filePicker_close) - ]); Util.onClickEnter($(close), () => { $list.toggle(true); $tags.toggle(false); }); - setTimeout(() => { - $tags.find('.cp-tokenfield-form').append(close); - }); } adminActions = h('span.cp-support-title-buttons', [ url, move, tag, show ]);