From 804443e5f720c08eb0a304446b80623abcb5f746 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 15 Oct 2020 15:12:12 +0530 Subject: [PATCH 01/43] send basic team info along with support tickets ...and fix a server bug that had broken /api/config.supportMailbox --- server.js | 2 +- www/support/ui.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 0d048d3a5..0e0c2d79e 100644 --- a/server.js +++ b/server.js @@ -189,7 +189,7 @@ var serveConfig = (function () { adminEmail: Env.adminEmail, adminKeys: Env.admins, inactiveTime: Env.inactiveTime, - supportMailbox: Env.supportMailboxPublicKey, + supportMailbox: Env.supportMailbox, maxUploadSize: Env.maxUploadSize, premiumUploadSize: Env.premiumUploadSize, }, null, '\t'), diff --git a/www/support/ui.js b/www/support/ui.js index 0519530da..1cc1ee90e 100644 --- a/www/support/ui.js +++ b/www/support/ui.js @@ -26,7 +26,6 @@ define([ curvePublic: user.curvePublic, edPublic: privateData.edPublic, notifications: user.notifications, - blockLocation: privateData.blockLocation || '', }; if (typeof(ctx.pinUsage) === 'object') { @@ -39,8 +38,19 @@ define([ data.id = id; data.time = +new Date(); + var teams = privateData.teams || {}; if (!ctx.isAdmin) { data.sender.userAgent = window.navigator && window.navigator.userAgent; + data.sender.blockLocation = privateData.blockLocation || ''; + data.sender.teams = Object.keys(teams).map(function (key) { + var team = teams[key]; + if (!teams) { return; } + var ret = {}; + ['edPublic', 'owner', 'viewer', 'hasSecondaryKey'].forEach(function (k) { + ret[k] = team[k]; + }); + return ret; + }).filter(Boolean); } // Send the message to the admin mailbox and to the user mailbox From 179fa06f92c9911702cbc6c1b3eb709d168ff30c Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 15 Oct 2020 13:38:53 +0200 Subject: [PATCH 02/43] Fix drive history with deleted shared folder --- www/common/drive-ui.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index d3c5d0e11..3604bf7b0 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -1957,8 +1957,8 @@ define([ if (manager.isSharedFolder(element)) { var data = manager.getSharedFolderData(element); var fId = element; - key = data.title || data.lastTitle; - element = manager.folders[element].proxy[manager.user.userObject.ROOT]; + key = data.title || data.lastTitle || Messages.fm_deletedFolder; + element = Util.find(manager, ['folders', element, 'proxy', manager.user.userObject.ROOT]) || {}; $span.addClass('cp-app-drive-element-sharedf'); _addOwnership($span, $state, data); @@ -2095,6 +2095,10 @@ define([ UI.warn(Messages.fm_restricted); return; } + if (isSharedFolder && !manager.folders[isSharedFolder]) { + UI.warn(Messages.fm_deletedFolder); + return; + } if (isFolder) { APP.displayDirectory(newPath); return; @@ -3799,6 +3803,7 @@ define([ }); }; +Messages.fm_deletedFolder = "Deleted folder"; // XXX 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)); @@ -3808,6 +3813,10 @@ define([ } var $elementRow = $('', {'class': 'cp-app-drive-element-row'}).append($collapse).append($icon).append($name).click(function (e) { e.stopPropagation(); + if (isSharedFolder && !manager.folders[isSharedFolder]) { + UI.warn(Messages.fm_deletedFolder); + return; + } if (files.restrictedFolders[isSharedFolder]) { UI.warn(Messages.fm_restricted); return; @@ -3907,10 +3916,10 @@ define([ newPath.push(manager.user.userObject.ROOT); isCurrentFolder = manager.comparePath(newPath, currentPath); // Subfolders? - var newRoot = manager.folders[sfId].proxy[manager.user.userObject.ROOT]; + var newRoot = Util.find(manager, ['folders', sfId, 'proxy', manager.user.userObject.ROOT]) || {}; subfolder = manager.hasSubfolder(newRoot); // Fix name - key = manager.getSharedFolderData(sfId).title; + key = manager.getSharedFolderData(sfId).title || Messages.fm_deletedFolder; // Fix icon $icon = isCurrentFolder ? $sharedFolderOpenedIcon : $sharedFolderIcon; isSharedFolder = sfId; @@ -3935,6 +3944,7 @@ define([ if (sfId && !editable) { $element.attr('data-ro', true); } + if (!subfolder) { return; } createTree($element, newPath); }); }; From 0a06f31be3f881328a474cbd8ef5d945fac6e0d7 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 15 Oct 2020 13:48:11 +0200 Subject: [PATCH 03/43] Add missing labels to some owner actions --- www/common/drive-ui.js | 8 ++++++-- www/common/inner/access.js | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 3604bf7b0..dca106066 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -4372,10 +4372,14 @@ Messages.fm_deletedFolder = "Deleted folder"; // XXX } // if folder does not contains SF else { + Messages.fm_shareFolderPassword = "Add a password to this folder? (optional)"; // XXX var convertContent = h('div', [ h('p', Messages.convertFolderToSF_confirm), - h('label', {for: 'cp-upload-password'}, Messages.creation_passwordValue), - UI.passwordInput({id: 'cp-upload-password'}), + h('label', {for: 'cp-upload-password'}, Messages.fm_shareFolderPassword), + UI.passwordInput({ + id: 'cp-upload-password', + placeholder: Messages.creation_passwordValue + }), h('span', { style: 'display:flex;align-items:center;justify-content:space-between' }, [ diff --git a/www/common/inner/access.js b/www/common/inner/access.js index fde29f8fe..3b28344f7 100644 --- a/www/common/inner/access.js +++ b/www/common/inner/access.js @@ -937,7 +937,10 @@ define([ }); }); $d.append(h('br')); + Messages.access_destroyPad = "Destroy permanently this document or folder"; // XXX $d.append(h('div', [ + h('label', Messages.access_destroyPad), + h('br'), deleteOwned, spinner.spinner ])); From cf76bdd0508a3d14abddcd023c9ee0ed91bb39fe Mon Sep 17 00:00:00 2001 From: Weblate Date: Thu, 15 Oct 2020 14:30:11 +0200 Subject: [PATCH 04/43] Translated using Weblate (Romanian) Currently translated at 46.2% (629 of 1360 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ro/ Translated using Weblate (Romanian) Currently translated at 44.8% (610 of 1360 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ro/ Translated using Weblate (Romanian) Currently translated at 42.9% (584 of 1360 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ro/ Translated using Weblate (Romanian) Currently translated at 42.8% (583 of 1360 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ro/ --- www/common/translations/messages.ro.json | 57 +++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.ro.json b/www/common/translations/messages.ro.json index 268c345b3..65f2463c0 100644 --- a/www/common/translations/messages.ro.json +++ b/www/common/translations/messages.ro.json @@ -590,5 +590,60 @@ "settings_disableThumbnailsDescription": "Iconițele sunt create automat și stocate în browserul dvs. atunci când vizitați un nou fișier. Puteți dezactiva această funcționalitate aici.", "settings_disableThumbnailsAction": "Dezactivați crearea de iconițe în CryptDrive", "settings_resetThumbnailsDescription": "Curățați toate iconițele fișierelor stocate în browser.", - "settings_resetThumbnailsAction": "Curăță" + "settings_resetThumbnailsAction": "Curăță", + "settings_templateSkip": "Omiteți modalitatea de selecție a șablonului", + "settings_creationSkipFalse": "Afișează", + "settings_creationSkipTrue": "Omite", + "settings_ownDriveTitle": "Actualizați contul", + "upload_notEnoughSpace": "Nu există suficient spațiu pentru acest fișier în CryptDrive.", + "uploadFolder_modal_forceSave": "Stocați fișiere în CryptDrive-ul propriu", + "uploadFolder_modal_owner": "Posesorul fișierelor", + "uploadFolder_modal_filesPassword": "Parola fișierelor", + "uploadFolder_modal_title": "Opțiuni de încărcare a dosarelor", + "upload_modal_owner": "Posesorul fișierului", + "upload_modal_filename": "Nume fișier (extensia {0} adăugată automat)", + "upload_modal_title": "Opțiuni de încărcare a fișierelor", + "upload_type": "Tip", + "upload_title": "Fișier încărcat", + "settings_cursorShowLabel": "Afișați cursorii", + "settings_cursorShowHint": "Puteți alege dacă doriți să vedeți cursorul celorlalți utilizatori în documentele de colaborare.", + "settings_cursorShowTitle": "Afișează poziția cursorului altor utilizatori", + "settings_cursorShareLabel": "Transmiteți poziția", + "settings_cursorShareHint": "Puteți decide dacă doriți ca alți utilizatori să vă vadă poziția cursorului în documentele colaborative.", + "settings_cursorShareTitle": "Distribuiți poziția cursorului meu", + "settings_cursorColorHint": "Schimbați culoarea asociată cu utilizatorul dumneavoastră în documentele colaborative.", + "settings_cursorColorTitle": "Culoarea cursorului", + "settings_changePasswordNewPasswordSameAsOld": "Noua parolă trebuie să fie diferită de cea actuală.", + "settings_changePasswordPending": "Parola dumneavoastră este în curs de actualizare. Vă rugăm să nu închideți sau să reîncărcați această pagină până la finalizarea procesului.", + "settings_changePasswordError": "A apărut o eroare neașteptată. Dacă nu vă puteți conecta sau schimba parola, contactați administratorii dumneavoastră CryptPad.", + "settings_changePasswordConfirm": "Sigur doriți să vă schimbați parola? Va trebui să vă conectați din nou pe toate dispozitivele dumneavoastră.", + "settings_changePasswordNewConfirm": "Confirmă noua parolă", + "settings_changePasswordNew": "Parolă nouă", + "settings_changePasswordCurrent": "Parola actuală", + "settings_changePasswordButton": "Schimbați parola", + "settings_changePasswordHint": "Pentru a schimba parola contului dumneavoastră, introduceți parola curentă și confirmați noua parolă tastând-o de două ori.
Nu vă putem reseta parola dacă o uitați, așa că fiți foarte atenți!", + "settings_changePasswordTitle": "Schimbați-vă parola", + "settings_ownDrivePending": "Contul dumneavoastră este în curs de actualizare. Vă rugăm să nu închideți sau să reîncărcați această pagină până la finalizarea procesului.", + "settings_ownDriveConfirm": "Actualizarea contului dumneavoastră poate dura ceva timp. Va trebui să vă conectați din nou pe toate dispozitivele dumneavoastră. Doriți să continuați?", + "settings_ownDriveButton": "Actualizați contul dumneavoastră", + "settings_ownDriveHint": "Conturile mai vechi nu au acces la cele mai recente funcții, din motive tehnice. O actualizare gratuită va activa funcțiile actuale și vă va pregăti CryptDrive-ul pentru actualizări viitoare.", + "todo_markAsCompleteTitle": "Marcați această sarcină ca fiind finalizată", + "todo_newTodoNameTitle": "Adăugați această sarcină la lista dumneavoastră cu lucruri de rezolvat", + "todo_newTodoNamePlaceholder": "Descrieți-vă sarcina ...", + "download_step2": "Decriptare", + "download_step1": "Descărcare", + "download_dl": "Descărcați", + "download_resourceNotAvailable": "Resursa solicitată nu este disponibilă... Apăsați Esc pentru a continua.", + "download_mt_button": "Descărcați", + "download_button": "Decriptați și descărcați", + "upload_up": "Încărcați", + "upload_mustLogin": "Trebuie să fiți conectat pentru a încărca fișiere", + "upload_size": "Mărime", + "upload_name": "Numele fișierului", + "upload_cancelled": "Anulat", + "upload_pending": "În așteptare", + "upload_choose": "Alegeți un fișier", + "upload_tooLargeBrief": "Fișier prea mare", + "upload_tooLarge": "Acest fișier depășește dimensiunea maximă de încărcare permisă pentru contul dumneavoastră.", + "upload_notEnoughSpaceBrief": "Spațiu insuficient" } From 7a1def64e3ab0c985af539a81b2cfb54bbd7946d Mon Sep 17 00:00:00 2001 From: Weblate Date: Thu, 15 Oct 2020 15:22:35 +0200 Subject: [PATCH 05/43] Translated using Weblate (English) Currently translated at 100.0% (1363 of 1363 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1362 of 1362 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1361 of 1361 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ --- www/common/translations/messages.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 754bcfdf1..010287444 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -1456,5 +1456,8 @@ "team_exportTitle": "Download team drive", "team_exportHint": "Download all the documents in this team's drive. Documents will be downloaded in formats readable by other applications when such a format is available. When such a format is not available, documents will be downloaded in a format readable by CryptPad.", "team_exportButton": "Download", - "admin_limitUser": "User's public key" + "admin_limitUser": "User's public key", + "fm_deletedFolder": "Deleted folder", + "access_destroyPad": "Destroy this document or folder permanently", + "fm_shareFolderPassword": "Protect this folder with a password (optional)" } From 592f16a943c4834227898d2111652824f91c7b04 Mon Sep 17 00:00:00 2001 From: Weblate Date: Thu, 15 Oct 2020 15:22:36 +0200 Subject: [PATCH 06/43] Translated using Weblate (French) Currently translated at 100.0% (1363 of 1363 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/fr/ --- www/common/translations/messages.fr.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.fr.json b/www/common/translations/messages.fr.json index 41f352247..ce19c96ad 100644 --- a/www/common/translations/messages.fr.json +++ b/www/common/translations/messages.fr.json @@ -1456,5 +1456,8 @@ "admin_registrationHint": "Ne pas autoriser l'enregistrement de nouveaux utilisateurs", "snapshots_cantMake": "La capture n'a pas pu être effectuée. Vous êtes déconnecté.", "snapshots_notFound": "Cette capture n'existe plus car l'historique du document a été supprimé.", - "admin_limitUser": "Clé publique de l'utilisateur" + "admin_limitUser": "Clé publique de l'utilisateur", + "fm_shareFolderPassword": "Protéger ce dossier avec un mot de passe (optionnel)", + "access_destroyPad": "Détruire ce document ou dossier définitivement", + "fm_deletedFolder": "Dossier supprimé" } From a962114e5e03a446ec3a9dbda96c0c9e7795fe7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Thu, 15 Oct 2020 14:25:51 +0100 Subject: [PATCH 07/43] Remove XXXs related to translation keys --- www/common/drive-ui.js | 2 -- www/common/inner/access.js | 1 - 2 files changed, 3 deletions(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index dca106066..6aa6028ad 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -3803,7 +3803,6 @@ define([ }); }; -Messages.fm_deletedFolder = "Deleted folder"; // XXX 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)); @@ -4372,7 +4371,6 @@ Messages.fm_deletedFolder = "Deleted folder"; // XXX } // if folder does not contains SF else { - Messages.fm_shareFolderPassword = "Add a password to this folder? (optional)"; // XXX var convertContent = h('div', [ h('p', Messages.convertFolderToSF_confirm), h('label', {for: 'cp-upload-password'}, Messages.fm_shareFolderPassword), diff --git a/www/common/inner/access.js b/www/common/inner/access.js index 3b28344f7..6967b8834 100644 --- a/www/common/inner/access.js +++ b/www/common/inner/access.js @@ -937,7 +937,6 @@ define([ }); }); $d.append(h('br')); - Messages.access_destroyPad = "Destroy permanently this document or folder"; // XXX $d.append(h('div', [ h('label', Messages.access_destroyPad), h('br'), From ae92614289342222a75a36072814ae119e554f79 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 15 Oct 2020 16:09:09 +0200 Subject: [PATCH 08/43] Refresh ownership in the access modal --- www/common/inner/access.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/www/common/inner/access.js b/www/common/inner/access.js index 3b28344f7..d28b96d0f 100644 --- a/www/common/inner/access.js +++ b/www/common/inner/access.js @@ -349,6 +349,12 @@ define([ if (!reload) { return; } Modal.loadMetadata(Env, data, waitFor, "owner"); }).nThen(function () { + var owned = Modal.isOwned(Env, data); + if (typeof(owned) !== "boolean") { + teamOwner = Number(owned); + } else { + teamOwner = undefined; + } owners = data.owners || []; pending_owners = data.pending_owners || []; $div1.empty(); @@ -667,6 +673,12 @@ define([ if (!reload) { return; } Modal.loadMetadata(Env, data, waitFor, "allow"); }).nThen(function () { + var owned = Modal.isOwned(Env, data); + if (typeof(owned) !== "boolean") { + teamOwner = Number(owned); + } else { + teamOwner = undefined; + } owners = data.owners || []; restricted = data.restricted || false; allowed = data.allowed || []; From 596e240a79769e1ed45f51d53b683fd146319c74 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 16 Oct 2020 00:05:47 +0200 Subject: [PATCH 09/43] Translated using Weblate (German) Currently translated at 100.0% (1363 of 1363 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/de/ --- www/common/translations/messages.de.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.de.json b/www/common/translations/messages.de.json index f7af20555..781c20b65 100644 --- a/www/common/translations/messages.de.json +++ b/www/common/translations/messages.de.json @@ -1456,5 +1456,8 @@ "admin_invalLimit": "Wert für Speicherplatzbegrenzung ist ungültig", "admin_limitSetNote": "Notiz", "admin_setlimitTitle": "Individuelle Begrenzung festlegen", - "admin_setlimitHint": "Lege individuelle Begrenzungen für Benutzer anhand ihrer öffentlichen Schlüssel fest. Du kannst bestehende Regeln aktualisieren oder entfernen." + "admin_setlimitHint": "Lege individuelle Begrenzungen für Benutzer anhand ihrer öffentlichen Schlüssel fest. Du kannst bestehende Regeln aktualisieren oder entfernen.", + "access_destroyPad": "Dokument oder Ordner endgültig zerstören", + "fm_shareFolderPassword": "Diesen Ordner mit einem Passwort schützen (optional)", + "fm_deletedFolder": "Gelöschter Ordner" } From ff8eac3ba4216078f1f7c06c507fe69dff6957d4 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 16 Oct 2020 10:13:28 +0530 Subject: [PATCH 10/43] increment version to 3.23.1 --- customize.dist/pages.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index e1752a461..2bd67b906 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -62,7 +62,7 @@ define([ var imprintUrl = AppConfig.imprint && (typeof(AppConfig.imprint) === "boolean" ? '/imprint.html' : AppConfig.imprint); - Pages.versionString = "CryptPad v3.23.0 (XerusDaamsi)"; + Pages.versionString = "CryptPad v3.23.1 (XerusDaamsi's revenge)"; // used for the about menu Pages.imprintLink = AppConfig.imprint ? footLink(imprintUrl, 'imprint') : undefined; diff --git a/package-lock.json b/package-lock.json index be6616d25..40d00411f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cryptpad", - "version": "3.23.0", + "version": "3.23.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 56bdacf38..6f4fa275e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cryptpad", "description": "realtime collaborative visual editor with zero knowlege server", - "version": "3.23.0", + "version": "3.23.1", "license": "AGPL-3.0+", "repository": { "type": "git", From baf71a3c0475e6553825fe04f520e7541d430edb Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 16 Oct 2020 14:16:09 +0200 Subject: [PATCH 11/43] Check if a team's pinning keys are valid --- www/common/outer/team.js | 12 +++++++++++- www/support/ui.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 2ba4e30ee..16c439315 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -1683,6 +1683,16 @@ define([ team.getTeam = function (id) { return ctx.teams[id]; }; + var checkKeyPair = function (edPrivate, edPublic) { + if (!edPrivate || !edPublic) { return true; } + try { + var secretKey = Nacl.util.decodeBase64(edPrivate); + var pair = Nacl.sign.keyPair.fromSecretKey(secretKey); + return Nacl.util.encodeBase64(pair.publicKey) === edPublic; + } catch (e) { + return false; + } + }; team.getTeamsData = function (app) { var t = {}; var safe = false; @@ -1697,7 +1707,7 @@ define([ viewer: !Util.find(teams[id], ['keys', 'drive', 'edPrivate']), notifications: Util.find(teams[id], ['keys', 'mailbox', 'channel']), curvePublic: Util.find(teams[id], ['keys', 'mailbox', 'keys', 'curvePublic']), - + validKeys: checkKeyPair(Util.find(teams[id], ['keys', 'drive', 'edPrivate']), Util.find(teams[id], ['keys', 'drive', 'edPublic'])) }; if (safe && ctx.teams[id]) { t[id].secondaryKey = ctx.teams[id].secondaryKey; diff --git a/www/support/ui.js b/www/support/ui.js index 1cc1ee90e..9b86d6f20 100644 --- a/www/support/ui.js +++ b/www/support/ui.js @@ -46,7 +46,7 @@ define([ var team = teams[key]; if (!teams) { return; } var ret = {}; - ['edPublic', 'owner', 'viewer', 'hasSecondaryKey'].forEach(function (k) { + ['edPublic', 'owner', 'viewer', 'hasSecondaryKey', 'validKeys'].forEach(function (k) { ret[k] = team[k]; }); return ret; From 01138261abf74944424dec25711a85136374e156 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 16 Oct 2020 14:52:21 +0200 Subject: [PATCH 12/43] Fix shared folders --- www/common/drive-ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 6aa6028ad..6e2b29b7b 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -2095,7 +2095,7 @@ define([ UI.warn(Messages.fm_restricted); return; } - if (isSharedFolder && !manager.folders[isSharedFolder]) { + if (isSharedFolder && !manager.folders[element]) { UI.warn(Messages.fm_deletedFolder); return; } From 7c1e43e22c254a6c765a3fc45f7003af7c764f40 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 16 Oct 2020 18:34:28 +0530 Subject: [PATCH 13/43] 3.23.1 changelog --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfee490ea..746ad365e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,32 @@ +# XerusDaamsi's revenge (3.23.1) + +We discovered a number of minor bugs after deploying 3.23.0. This minor release addresses them. + +Features + +* On instances with a lot of data (like our own) the background process responsible for evicting inactive data could time out. We've increased its permitted duration to a sufficient timeframe. + * This process also aggregates some statistics about your database while it runs. Upon its completion a report is now stored in memory until it is overwritten by the next eviction process. This report will most likely be displayed on the admin panel in a future release. + * We now introduce some artificial delays into this process to prevent it from interfering with instances' normal behaviour. +* Instance administrators may have noticed that support tickets include some basic information about the user account which submitted them. We've been debugging some problems related to teams recently and have included a little bit of non-sensitive data to tickets to help us isolate these problems. +* We've added some additional text to a few places to clarify some ambiguous behavior: + * When creating a shared folder we now indicate that the password field will be used to add a layer of protection to the folder. + * The "destroy" button on the access modal now indicates that it will completely destroy the file or folder in question, rather than its access list or other parameters. + +Bug fixes + +* We received a number of support tickets related to users being unable to open rich text pads and sheets. We determined the issue to have been caused by our deployment of new HTTP headers to enable XLSX export on Firefox. These headers conflicted with the those on some cached files. The issue seemed to affect users randomly and did not occur when we tested the new features. We deployed some one-time cache-busting code to force clients to load the latest versions of these files (and their headers). +* We addressed a regression introduced in 3.23.0 which incorrectly disabled the support ticket panels for users and admins. +* We also fixed some layout issues on the admin panel's new _User storage_ pane. +* Finally, we added a few guards against type errors in the drive which were most commonly triggered when viewing ranges of your drive's history which contained shared folders that had since been deleted. + +To update from 3.23.0 to 3.23.1: + +0. Read the 3.23.0 release notes carefully and apply all configuration changes if you haven't already done so. +1. Stop your server +2. Get the latest code with `git checkout 3.20.1` +3. Install the latest dependencies with `bower update` and `npm i` +4. Restart your server + # XerusDaamsi (3.23.0) ## Goals From 2644e72ad5fd1dc0b064873f53cbf5755b32b54f Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 19 Oct 2020 17:01:10 +0530 Subject: [PATCH 14/43] apply cache-busting to more ckeditor assets --- www/pad/inner.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/www/pad/inner.js b/www/pad/inner.js index b52275b4f..678b674a4 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -8,9 +8,6 @@ require(['/api/config'], function(ApiConfig) { } if (resource[resource.length - 1] !== '/' && resource.indexOf('ver=') === -1) { var args = ApiConfig.requireConf.urlArgs; - if (resource.indexOf('/bower_components/') !== -1) { - args = 'ver=' + window.CKEDITOR.timestamp; - } resource += (resource.indexOf('?') >= 0 ? '&' : '?') + args; } return resource; From 01a8e45307707fb4e8902c932c3ad04e2f9f52fc Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 19 Oct 2020 14:06:05 +0200 Subject: [PATCH 15/43] Fix duplicate team bug --- www/common/common-interface.js | 10 +++++++++- www/common/outer/team.js | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 76dec3dd8..2e6c3a609 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -736,14 +736,20 @@ define([ UI.proposal = function (content, cb) { + var clicked = false; var buttons = [{ name: Messages.friendRequest_later, - onClick: function () {}, + onClick: function () { + if (clicked) { return; } + clicked = true; + }, keys: [27] }, { className: 'primary', name: Messages.friendRequest_accept, onClick: function () { + if (clicked) { return; } + clicked = true; cb(true); }, keys: [13] @@ -751,6 +757,8 @@ define([ className: 'primary', name: Messages.friendRequest_decline, onClick: function () { + if (clicked) { return; } + clicked = true; cb(false); }, keys: [[13, 'ctrl']] diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 2ba4e30ee..4ecfc09b6 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -1668,7 +1668,33 @@ define([ updateMyRights(ctx, p[1]); }); + // Remove duplicate teams + var _teams = {}; + Object.keys(teams).forEach(function (id) { + var t = teams[id]; + var _t = _teams[t.channel]; + + // Not found yet? add to the list + if (!_t) { + _teams[t.channel] = { edit: Boolean(t.hash), id:id }; + return; + } + + // Team already found. If this one has better access rights, keep it. + // Otherwise, delete it + + // No edit right or we already have edit rights? delete + if (!t.hash || _t.edit) { + delete teams[id]; + return; + } + + // We didn't have edit rights and now we have them: replace + delete teams[_t.id]; + _teams[t.channel] = { edit: Boolean(t.hash), id:id }; + }); + // Load teams Object.keys(teams).forEach(function (id) { ctx.onReadyHandlers[id] = []; if (!Util.find(teams, [id, 'keys', 'mailbox'])) { From 79378c536ee92fbaf384c2434830fc56020d61ea Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 19 Oct 2020 14:17:53 +0200 Subject: [PATCH 16/43] Fix duplicate team script to support owners --- www/common/outer/team.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 4ecfc09b6..f340c156e 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -1676,22 +1676,22 @@ define([ // Not found yet? add to the list if (!_t) { - _teams[t.channel] = { edit: Boolean(t.hash), id:id }; + _teams[t.channel] = { edit: Boolean(t.hash), owner: t.owner, id:id }; return; } // Team already found. If this one has better access rights, keep it. // Otherwise, delete it - // No edit right or we already have edit rights? delete - if (!t.hash || _t.edit) { + // No edit right or we already had edit rights? delete + if (!t.hash || (!t.owner && _t.edit) || _t.owner) { delete teams[id]; return; } // We didn't have edit rights and now we have them: replace delete teams[_t.id]; - _teams[t.channel] = { edit: Boolean(t.hash), id:id }; + _teams[t.channel] = { edit: Boolean(t.hash), owner: t.owner, id:id }; }); // Load teams From ab9c7454f50f4d3684ecc72ebd39bbd813ec446b Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 19 Oct 2020 19:32:36 +0530 Subject: [PATCH 17/43] don't bother hiding the button to kick a member from a team --- www/teams/inner.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/teams/inner.js b/www/teams/inner.js index 650117c0b..44734ad85 100644 --- a/www/teams/inner.js +++ b/www/teams/inner.js @@ -724,7 +724,6 @@ define([ title: Messages.team_rosterKick }); $(remove).click(function () { - $(remove).hide(); UI.confirm(Messages._getKey('team_kickConfirm', [Util.fixHTML(data.displayName)]), function (yes) { if (!yes) { return; } APP.module.execCommand('REMOVE_USER', { From abeadb59e1a034bb91657bcedc4bac3b07064c9c Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 19 Oct 2020 16:02:53 +0200 Subject: [PATCH 18/43] Fix a race condition that could break team access rights --- www/common/outer/team.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/www/common/outer/team.js b/www/common/outer/team.js index f340c156e..7370b1589 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -1122,6 +1122,20 @@ define([ var onReady = ctx.onReadyHandlers[teamId]; var team = ctx.teams[teamId]; + if (teamData.channel !== data.channel || teamData.password !== data.password) { return void cb(false); } + + // Update our proxy + if (state) { + teamData.hash = data.hash; + teamData.keys.drive.edPrivate = data.keys.drive.edPrivate; + teamData.keys.chat.edit = data.keys.chat.edit; + } else { + delete teamData.hash; + delete teamData.keys.drive.edPrivate; + delete teamData.keys.chat.edit; + } + + // Team not ready yet: try again onReady if (!team && Array.isArray(onReady)) { onReady.push({ cb: function () { @@ -1131,14 +1145,11 @@ define([ return; } + // No team and not initialized at all... if (!team) { return void cb(false); } - if (teamData.channel !== data.channel || teamData.password !== data.password) { return void cb(false); } - + // Team is initialized and ready: update the loaded elements if (state) { - teamData.hash = data.hash; - teamData.keys.drive.edPrivate = data.keys.drive.edPrivate; - teamData.keys.chat.edit = data.keys.chat.edit; initRpc(ctx, team, teamData.keys.drive, function () { team.manager.addPin(team.pin, team.unpin); }); @@ -1149,9 +1160,6 @@ define([ var crypto = Crypto.createEncryptor(secret.keys); team.listmap.setReadOnly(false, crypto); } else { - delete teamData.hash; - delete teamData.keys.drive.edPrivate; - delete teamData.keys.chat.edit; delete team.secondaryKey; if (team.rpc && team.rpc.destroy) { team.rpc.destroy(); From b4adf65dc8392fdb6049df9c58c554bdb6beaa05 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 20 Oct 2020 16:31:34 +0530 Subject: [PATCH 19/43] guard against a possible typeError in the worker --- www/common/outer/async-store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index df05d8a3e..e849ce20d 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -256,7 +256,7 @@ define([ Store.getPinnedUsage = function (clientId, data, cb) { var s = getStore(data && data.teamId); - if (!s.rpc) { return void cb({error: 'RPC_NOT_READY'}); } + if (!s || !s.rpc) { return void cb({error: 'RPC_NOT_READY'}); } s.rpc.getFileListSize(function (err, bytes) { if (!s.id && typeof(bytes) === 'number') { From 488ec93ecebb02d78f22c004f3b3f73d46afdd33 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 20 Oct 2020 17:07:55 +0530 Subject: [PATCH 20/43] allow expert admins to get and clear cached channel indices --- lib/commands/admin-rpc.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/commands/admin-rpc.js b/lib/commands/admin-rpc.js index e67f75f6c..b7c5dfa52 100644 --- a/lib/commands/admin-rpc.js +++ b/lib/commands/admin-rpc.js @@ -175,6 +175,24 @@ var restoreArchivedDocument = function (Env, Server, cb) { cb("NOT_IMPLEMENTED"); }; +// CryptPad_AsyncStore.rpc.send('ADMIN', ['CLEAR_CHANNEL_INDEX', documentID], console.log) +var clearChannelIndex = function (Env, Server, cb, data) { + var id = Array.isArray(data) && data[1]; + if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); } + delete Env.channel_cache[id]; + cb(); +}; + +// CryptPad_AsyncStore.rpc.send('ADMIN', ['GET_CHANNEL_INDEX', documentID], console.log) +var getChannelIndex = function (Env, Server, cb, data) { + var id = Array.isArray(data) && data[1]; + if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); } + + var index = Util.find(Env, ['channel_cache', id]); + if (!index) { return void cb("ENOENT"); } + cb(void 0, index); +}; + // CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['RESTRICT_REGISTRATION', [true]]], console.log) var adminDecree = function (Env, Server, cb, data, unsafeKey) { var value = data[1]; @@ -269,6 +287,9 @@ var commands = { ARCHIVE_DOCUMENT: archiveDocument, RESTORE_ARCHIVED_DOCUMENT: restoreArchivedDocument, + CLEAR_CHANNEL_INDEX: clearChannelIndex, + GET_CHANNEL_INDEX: getChannelIndex, + ADMIN_DECREE: adminDecree, INSTANCE_STATUS: instanceStatus, GET_LIMITS: getLimits, From fbc9edd795328bb7f7a0dc99210b5aeac4dd13e1 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 20 Oct 2020 17:12:26 +0530 Subject: [PATCH 21/43] rename latest admin commands and implement metadata getter/remover --- lib/commands/admin-rpc.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/commands/admin-rpc.js b/lib/commands/admin-rpc.js index b7c5dfa52..d7f22825d 100644 --- a/lib/commands/admin-rpc.js +++ b/lib/commands/admin-rpc.js @@ -175,7 +175,7 @@ var restoreArchivedDocument = function (Env, Server, cb) { cb("NOT_IMPLEMENTED"); }; -// CryptPad_AsyncStore.rpc.send('ADMIN', ['CLEAR_CHANNEL_INDEX', documentID], console.log) +// CryptPad_AsyncStore.rpc.send('ADMIN', ['CLEAR_CACHED_CHANNEL_INDEX', documentID], console.log) var clearChannelIndex = function (Env, Server, cb, data) { var id = Array.isArray(data) && data[1]; if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); } @@ -183,7 +183,7 @@ var clearChannelIndex = function (Env, Server, cb, data) { cb(); }; -// CryptPad_AsyncStore.rpc.send('ADMIN', ['GET_CHANNEL_INDEX', documentID], console.log) +// CryptPad_AsyncStore.rpc.send('ADMIN', ['GET_CACHED_CHANNEL_INDEX', documentID], console.log) var getChannelIndex = function (Env, Server, cb, data) { var id = Array.isArray(data) && data[1]; if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); } @@ -193,6 +193,24 @@ var getChannelIndex = function (Env, Server, cb, data) { cb(void 0, index); }; +// CryptPad_AsyncStore.rpc.send('ADMIN', ['CLEAR_CACHED_CHANNEL_METADATA', documentID], console.log) +var clearChannelMetadata = function (Env, Server, cb, data) { + var id = Array.isArray(data) && data[1]; + if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); } + delete Env.metadata_cache[id]; + cb(); +}; + +// CryptPad_AsyncStore.rpc.send('ADMIN', ['GET_CACHED_CHANNEL_METADATA', documentID], console.log) +var getChannelMetadata = function (Env, Server, cb, data) { + var id = Array.isArray(data) && data[1]; + if (typeof(id) !== 'string' || id.length < 32) { return void cb("EINVAL"); } + + var index = Util.find(Env, ['metadata_cache', id]); + if (!index) { return void cb("ENOENT"); } + cb(void 0, index); +}; + // CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['RESTRICT_REGISTRATION', [true]]], console.log) var adminDecree = function (Env, Server, cb, data, unsafeKey) { var value = data[1]; @@ -287,8 +305,11 @@ var commands = { ARCHIVE_DOCUMENT: archiveDocument, RESTORE_ARCHIVED_DOCUMENT: restoreArchivedDocument, - CLEAR_CHANNEL_INDEX: clearChannelIndex, - GET_CHANNEL_INDEX: getChannelIndex, + CLEAR_CACHED_CHANNEL_INDEX: clearChannelIndex, + GET_CACHED_CHANNEL_INDEX: getChannelIndex, + + CLEAR_CACHED_CHANNEL_METADATA: clearChannelMetadata, + GET_CACHED_CHANNEL_METADATA: getChannelMetadata, ADMIN_DECREE: adminDecree, INSTANCE_STATUS: instanceStatus, From 98579cfa250a0de13777936b2de88cec9a5c624a Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 20 Oct 2020 14:02:35 +0200 Subject: [PATCH 22/43] Fix team access rights --- www/common/outer/roster.js | 2 ++ www/common/outer/team.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/www/common/outer/roster.js b/www/common/outer/roster.js index 1db1bf5c7..fa3a700e2 100644 --- a/www/common/outer/roster.js +++ b/www/common/outer/roster.js @@ -67,6 +67,8 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) { if (authorRole === 'OWNER') { return true; } // admins can add other admins or members or viewers if (authorRole === "ADMIN") { return ['ADMIN', 'MEMBER', 'VIEWER'].indexOf(role) !== -1; } + // members can demote themselves to viewer (they can only describe themselves) + if (authorRole === "MEMBER") { return role === 'VIEWER'; } // (MEMBER, other) can't add anyone of any role return false; }; diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 7370b1589..2dacca689 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -491,6 +491,7 @@ define([ Feedback.send("ROSTER_CORRUPTED"); return; } + // Kicked from the team if (!state.members[me]) { lm.stop(); roster.stop(); @@ -499,6 +500,25 @@ define([ ctx.updateMetadata(); cb({error: 'EFORBIDDEN'}); waitFor.abort(); + return; + } + // Check access rights + // If we're not a viewer, make sure we have edit rights + var s = state.members[me]; + if (!teamData.hash && ['ADMIN', 'MEMBER'].indexOf(s.role) !== -1) { + console.warn("Missing edit rights: demote to viewer"); + var data = {}; + data[ctx.store.proxy.curvePublic] = { + role: "VIEWER" + }; + roster.describe(data, function (err) { + Feedback.send("TEAM_RIGHTS_FIXED"); + if (!err) { return; } + if (err === 'NO_CHANGE') { return; } + console.error(err); + }); + } else if (!teamData.hash && s.role === "OWNER") { + Feedback.send("TEAM_RIGHTS_OWNER"); } }).nThen(function () { onReady(ctx, id, lm, roster, keys, null, cb); @@ -1690,14 +1710,17 @@ define([ // Team already found. If this one has better access rights, keep it. // Otherwise, delete it + ctx.store.proxy.duplicateTeams = ctx.store.proxy.duplicateTeams || {}; // No edit right or we already had edit rights? delete if (!t.hash || (!t.owner && _t.edit) || _t.owner) { + ctx.store.proxy.duplicateTeams[id] = teams[id]; delete teams[id]; return; } // We didn't have edit rights and now we have them: replace + ctx.store.proxy.duplicateTeams[_t.id] = teams[_t.id]; delete teams[_t.id]; _teams[t.channel] = { edit: Boolean(t.hash), owner: t.owner, id:id }; }); From 7b989784b84504a4fff572d0fd9e58fd89e1e888 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 20 Oct 2020 15:02:36 +0200 Subject: [PATCH 23/43] Make sure team MEMBERS can't invite VIEWERS --- www/common/outer/roster.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/www/common/outer/roster.js b/www/common/outer/roster.js index fa3a700e2..2c2675037 100644 --- a/www/common/outer/roster.js +++ b/www/common/outer/roster.js @@ -56,6 +56,16 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) { return ['OWNER', 'ADMIN', 'MEMBER', 'VIEWER'].indexOf(role) !== -1; }; + var isSelfDowngrade = function (author, curve, role, state) { + // Make sure you want to describe yourself + var selfDescribe = author === curve && state[curve]; + if (!selfDescribe) { return false; } + // ADMIN and OWNER can always update roles + // we only need to allow MEMBER to downgrade themselves to VIEWER + var authorRole = Util.find(state, [author, 'role']); + if (authorRole === "MEMBER") { return role === 'VIEWER'; } + }; + var canAddRole = function (author, role, members) { var authorRole = Util.find(members, [author, 'role']); if (!authorRole) { return false; } @@ -67,8 +77,6 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) { if (authorRole === 'OWNER') { return true; } // admins can add other admins or members or viewers if (authorRole === "ADMIN") { return ['ADMIN', 'MEMBER', 'VIEWER'].indexOf(role) !== -1; } - // members can demote themselves to viewer (they can only describe themselves) - if (authorRole === "MEMBER") { return role === 'VIEWER'; } // (MEMBER, other) can't add anyone of any role return false; }; @@ -246,7 +254,10 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) { if (typeof(data.role) === 'string') { // they're trying to change the role... // throw if they're trying to upgrade to something greater - if (!canAddRole(author, data.role, members)) { throw new Error("INSUFFICIENT_PERMISSIONS"); } + if (!isSelfDowngrade(author, curve, data.role, members) && + !canAddRole(author, data.role, members)) { + throw new Error("INSUFFICIENT_PERMISSIONS"); + } } // DESCRIBE commands must initialize a displayName if it isn't already present if (typeof(current.displayName) !== 'string' && typeof(data.displayName) !== 'string') { From a2523cd3d468955dacee5b4c38b6d7a117a7de96 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 20 Oct 2020 15:44:19 +0200 Subject: [PATCH 24/43] Exclude acconts app from the new pad menu --- www/common/common-ui-elements.js | 3 ++- www/common/drive-ui.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index f4630ae17..8b9415220 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1239,8 +1239,8 @@ define([ } else if (!plan) { // user is logged in and subscriptions are allowed // and they don't have one. show upgrades - makeDonateButton(); makeUpgradeButton(); + makeDonateButton(); } else { // they have a plan. show nothing } @@ -1934,6 +1934,7 @@ define([ if (p === 'contacts') { return; } if (p === 'todo') { return; } if (p === 'file') { return; } + if (p === 'accounts') { return; } if (!common.isLoggedIn() && AppConfig.registeredOnlyTypes && AppConfig.registeredOnlyTypes.indexOf(p) !== -1) { return; } return true; diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 6e2b29b7b..649b5fe86 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -2520,6 +2520,7 @@ define([ if (type === 'contacts') { return; } if (type === 'todo') { return; } if (type === 'file') { return; } + if (type === 'accounts') { return; } if (!APP.loggedIn && AppConfig.registeredOnlyTypes && AppConfig.registeredOnlyTypes.indexOf(type) !== -1) { return; From 19f3222da99abdb083442d0fb01f04f3a9e79cc9 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 20 Oct 2020 15:44:19 +0200 Subject: [PATCH 25/43] Exclude accounts app from the new pad menu --- www/common/common-ui-elements.js | 3 ++- www/common/drive-ui.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index f4630ae17..8b9415220 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1239,8 +1239,8 @@ define([ } else if (!plan) { // user is logged in and subscriptions are allowed // and they don't have one. show upgrades - makeDonateButton(); makeUpgradeButton(); + makeDonateButton(); } else { // they have a plan. show nothing } @@ -1934,6 +1934,7 @@ define([ if (p === 'contacts') { return; } if (p === 'todo') { return; } if (p === 'file') { return; } + if (p === 'accounts') { return; } if (!common.isLoggedIn() && AppConfig.registeredOnlyTypes && AppConfig.registeredOnlyTypes.indexOf(p) !== -1) { return; } return true; diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 6e2b29b7b..649b5fe86 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -2520,6 +2520,7 @@ define([ if (type === 'contacts') { return; } if (type === 'todo') { return; } if (type === 'file') { return; } + if (type === 'accounts') { return; } if (!APP.loggedIn && AppConfig.registeredOnlyTypes && AppConfig.registeredOnlyTypes.indexOf(type) !== -1) { return; From 8c980df660648f2c96008eb5809e1662a75c4afd Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 21 Oct 2020 13:11:29 +0530 Subject: [PATCH 26/43] tell clients not to cache their outer html --- docs/example.nginx.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/example.nginx.conf b/docs/example.nginx.conf index 0c514e1ef..117eb2cc4 100644 --- a/docs/example.nginx.conf +++ b/docs/example.nginx.conf @@ -71,6 +71,9 @@ server { if ($args ~ ver=) { set $cacheControl max-age=31536000; } + if ($uri ~ ^/.*(\/|\.html)$) { + set $cacheControl no-cache; + } # Will not set any header if it is emptystring add_header Cache-Control $cacheControl; From 06e9c818790f3a676f7606de95f0645ded3bc305 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 21 Oct 2020 14:48:47 +0530 Subject: [PATCH 27/43] correct a typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 746ad365e..30661d523 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ To update from 3.23.0 to 3.23.1: 0. Read the 3.23.0 release notes carefully and apply all configuration changes if you haven't already done so. 1. Stop your server -2. Get the latest code with `git checkout 3.20.1` +2. Get the latest code with `git checkout 3.23.1` 3. Install the latest dependencies with `bower update` and `npm i` 4. Restart your server From b74c312f3c53fb0543fbc069defaea12916fa057 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 21 Oct 2020 12:24:59 +0200 Subject: [PATCH 28/43] Use the new public key format in config.example.js #626 --- config/config.example.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config.example.js b/config/config.example.js index f9702b6d0..32bcb20cf 100644 --- a/config/config.example.js +++ b/config/config.example.js @@ -104,13 +104,13 @@ module.exports = { /* * CryptPad contains an administration panel. Its access is restricted to specific * users using the following list. - * To give access to the admin panel to a user account, just add their user id, - * which can be found on the settings page for registered users. + * To give access to the admin panel to a user account, just add their public signing + * key, which can be found on the settings page for registered users. * Entries should be strings separated by a comma. */ /* adminKeys: [ - //"https://my.awesome.website/user/#/1/cryptpad-user1/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=", + //"[cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]", ], */ From d7d25c0a71a62144c443a0f65b02ba1e1ec970da Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 21 Oct 2020 13:41:36 +0200 Subject: [PATCH 29/43] Use correct version string for ckeditor icons --- www/pad/csp.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/www/pad/csp.js b/www/pad/csp.js index 3f401eb8f..02f21f883 100644 --- a/www/pad/csp.js +++ b/www/pad/csp.js @@ -19,6 +19,16 @@ define(['jquery'], function ($) { var $a = $('.cke_toolbox_main').find('.cke_button, .cke_combo_button'); $a.each(function (i, el) { var $el = $(el); + var $icon = $el.find('span.cke_button_icon'); + if ($icon.length) { + try { + var url = $icon[0].style['background-image']; + var bgImg = url.replace(/ !important$/, ''); + if (bgImg) { + $icon[0].style.setProperty('background-image', bgImg, 'important'); + } + catch (e) { console.error(e); } + } $el.on('keydown blur focus click dragstart', function (e) { e.preventDefault(); var attr = $(el).attr('oon'+e.type); From e8428a2a732fe9754acd8f23653c7f1971d8ab83 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 21 Oct 2020 18:13:10 +0530 Subject: [PATCH 30/43] prevent a case of multiple callbacks --- lib/storage/blob.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/storage/blob.js b/lib/storage/blob.js index 21f38a73a..dfbc802b4 100644 --- a/lib/storage/blob.js +++ b/lib/storage/blob.js @@ -378,7 +378,10 @@ var makeWalker = function (n, handleChild, done) { nThen(function (w) { // check if the path is a directory... Fs.stat(path, w(function (err, stats) { - if (err) { return next(); } + if (err) { + w.abort(); + return next(); + } if (!stats.isDirectory()) { w.abort(); return void handleChild(void 0, path, next); From 100b4176462fe93db8daf109b88fe8195c45bac2 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 21 Oct 2020 18:23:59 +0530 Subject: [PATCH 31/43] guard against several serverside typeErrors and warn in cases where they would have occurred --- lib/workers/index.js | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/lib/workers/index.js b/lib/workers/index.js index d0a9a66f5..4ca1996d0 100644 --- a/lib/workers/index.js +++ b/lib/workers/index.js @@ -82,6 +82,13 @@ Workers.initialize = function (Env, config, _cb) { var drained = true; var sendCommand = function (msg, _cb, opt) { + if (!_cb) { + return void Log.error('WORKER_COMMAND_MISSING_CB', { + msg: msg, + opt: opt, + }); + } + opt = opt || {}; var index = getAvailableWorkerIndex(); @@ -95,7 +102,7 @@ Workers.initialize = function (Env, config, _cb) { }); if (drained) { drained = false; - Log.debug('WORKER_QUEUE_BACKLOG', { + Log.error('WORKER_QUEUE_BACKLOG', { workers: workers.length, }); } @@ -103,13 +110,6 @@ Workers.initialize = function (Env, config, _cb) { return; } - const txid = guid(); - msg.txid = txid; - msg.pid = PID; - - // track which worker is doing which jobs - state.tasks[txid] = msg; - var cb = Util.once(Util.mkAsync(Util.both(_cb, function (err /*, value */) { if (err !== 'TIMEOUT') { return; } // in the event of a timeout the user will receive an error @@ -120,6 +120,17 @@ Workers.initialize = function (Env, config, _cb) { delete state.tasks[txid]; }))); + if (!msg) { + return void cb('ESERVERERR'); + } + + const txid = guid(); + msg.txid = txid; + msg.pid = PID; + + // track which worker is doing which jobs + state.tasks[txid] = msg; + // default to timing out affter 180s if no explicit timeout is passed var timeout = typeof(opt.timeout) !== 'undefined'? opt.timeout: 180000; response.expect(txid, cb, timeout); @@ -153,6 +164,13 @@ Workers.initialize = function (Env, config, _cb) { } var nextMsg = queue.shift(); + + if (!nextMsg || !nextMsg.msg) { + return void Log.error('WORKER_QUEUE_EMPTY_MESSAGE', { + item: nextMsg, + }); + } + /* `nextMsg` was at the top of the queue. We know that a job just finished and all of this code is synchronous, so calling `sendCommand` should take the worker @@ -200,7 +218,7 @@ Workers.initialize = function (Env, config, _cb) { const cb = response.expectation(txid); if (typeof(cb) !== 'function') { return; } const task = state.tasks[txid]; - if (!task && task.msg) { return; } + if (!(task && task.msg)) { return; } response.clear(txid); Log.info('DB_WORKER_RESEND', task.msg); sendCommand(task.msg, cb); From 070696c7e35afca7d8cd3eab997e604d22560f80 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 21 Oct 2020 15:29:13 +0200 Subject: [PATCH 32/43] New OO build --- www/common/onlyoffice/inner.js | 3 +- .../onlyoffice/v2b/sdkjs/cell/sdk-all-min.js | 110 +++++++++--------- .../onlyoffice/v2b/sdkjs/cell/sdk-all.js | 4 +- .../onlyoffice/v2b/sdkjs/slide/sdk-all-min.js | 110 +++++++++--------- .../onlyoffice/v2b/sdkjs/slide/sdk-all.js | 4 +- .../onlyoffice/v2b/sdkjs/word/sdk-all-min.js | 110 +++++++++--------- .../onlyoffice/v2b/sdkjs/word/sdk-all.js | 4 +- .../v2b/web-apps/apps/api/documents/api.js | 4 + .../web-apps/apps/documenteditor/main/app.js | 10 +- .../apps/documenteditor/main/index.html | 8 +- .../apps/presentationeditor/main/app.js | 8 +- .../apps/presentationeditor/main/index.html | 8 +- .../apps/spreadsheeteditor/main/app.js | 24 ++-- .../apps/spreadsheeteditor/main/index.html | 9 +- 14 files changed, 220 insertions(+), 196 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index d3d2461a1..103381f62 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -53,7 +53,8 @@ define([ var Nacl = window.nacl; var APP = window.APP = { - $: $ + $: $, + urlArgs: Util.find(ApiConfig, ['requireConf', 'urlArgs']) }; var CHECKPOINT_INTERVAL = 100; diff --git a/www/common/onlyoffice/v2b/sdkjs/cell/sdk-all-min.js b/www/common/onlyoffice/v2b/sdkjs/cell/sdk-all-min.js index 32aeb5823..d4efcfc07 100644 --- a/www/common/onlyoffice/v2b/sdkjs/cell/sdk-all-min.js +++ b/www/common/onlyoffice/v2b/sdkjs/cell/sdk-all-min.js @@ -700,58 +700,58 @@ isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oCo getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264* g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context= {"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;script.onerror=onError;document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess(); -else loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js",onSuccess,onError)}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;ikoef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(file=="")return;var _drawer= -window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64= -"";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj}; -this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"](): -"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false; -return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!Array.isArray(files))files=[files];if(0==files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt== -obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length- -1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError(); -return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})}; -this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param=""+option.asc_getCodePage()+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV=== -idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+ -AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive= -function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY= -false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY? -this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue= -function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd< -0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(kkoef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file= +_file;if(Array.isArray(file))file=file[0];if(file=="")return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas); +delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete, +src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&& +window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false; +if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!Array.isArray(files))files=[files];if(0==files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback= +null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted= +true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}; +this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length- +1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT=== +idOption){var _param=""+option.asc_getCodePage()+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+ +delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY= +0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX; +if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!= +this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector= +CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart= +start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k=_usersCount?true:false; @@ -1200,9 +1200,9 @@ prot.asc_getGroupName;prot["asc_getFormulasArray"]=prot.asc_getFormulasArray;pro window["AscFonts"].onLoadModule=function(){if(window["AscFonts"].isEngineReady)return;++window["AscFonts"].curLoadingIndex;if(window["AscFonts"].curLoadingIndex==window["AscFonts"].maxLoadingIndex){if(window["AscFonts"].api){window["AscFonts"].isEngineReady=true;window["AscFonts"].onSuccess.call(window["AscFonts"].api)}delete window["AscFonts"].curLoadingIndex;delete window["AscFonts"].maxLoadingIndex;delete window["AscFonts"].api;delete window["AscFonts"].onSuccess;delete window["AscFonts"].onError}}; window["AscFonts"].load=function(api,onSuccess,onError){window["AscFonts"].api=api;window["AscFonts"].onSuccess=onSuccess;window["AscFonts"].onError=onError;if(window["NATIVE_EDITOR_ENJINE"]===true||window["IS_NATIVE_EDITOR"]===true||window["Native"]!==undefined){window["AscFonts"].isEngineReady=true;window["AscFonts"].onSuccess.call(window["AscFonts"].api);delete window["AscFonts"].curLoadingIndex;delete window["AscFonts"].maxLoadingIndex;delete window["AscFonts"].api;delete window["AscFonts"].onSuccess; delete window["AscFonts"].onError;return}var url="../../../../sdkjs/common/libfont";var useWasm=false;var webAsmObj=window["WebAssembly"];if(typeof webAsmObj==="object")if(typeof webAsmObj["Memory"]==="function")if(typeof webAsmObj["instantiateStreaming"]==="function"||typeof webAsmObj["instantiate"]==="function")useWasm=true;useWasm?url+="/wasm":url+="/js";if(!useWasm)window["AscFonts"].onLoadModule();var _onSuccess=function(){};var _onError=function(){window["AscFonts"].onError()};if(window["AscNotLoadAllScript"]){AscCommon.loadScript(url+ -"/engine.js",_onSuccess,_onError);AscCommon.loadScript(url+"/file.js",_onSuccess,_onError);AscCommon.loadScript(url+"/manager.js",_onSuccess,_onError)}else AscCommon.loadScript(url+"/fonts.js",_onSuccess,_onError)};function FontStream(data,size){this.data=data;this.size=size}window["AscFonts"].FontStream=FontStream;window["AscFonts"].FT_Common={UintToInt:function(v){return v>2147483647?v-4294967296:v},UShort_To_Short:function(v){return v>32767?v-65536:v},IntToUInt:function(v){return v<0?v+4294967296: -v},Short_To_UShort:function(v){return v<0?v+65536:v},memset:function(d,v,s){for(var i=0;i2147483647?v-4294967296:v},UShort_To_Short:function(v){return v>32767?v-65536:v},IntToUInt:function(v){return v< +0?v+4294967296:v},Short_To_UShort:function(v){return v<0?v+65536:v},memset:function(d,v,s){for(var i=0;i>24&63);result.push(128|code>>18&63);result.push(128|code>>12&63);result.pu 5;while(bitCount>=8){var _del=Math.pow(2,bitCount-8);var _res=buffer/_del&255;result.push(_res);bitCount-=8}}this.GetUTF16_fromUTF8(result)};this.CreateIndexByOctetAndMovePosition=function(obj,currentPosition){var j=0;while(j<8){if(currentPosition>=obj.data.length){obj.index[j++]=-1;continue}if(this.IgnoredSymbol(obj.data.charCodeAt(currentPosition))){currentPosition++;continue}obj.index[j]=obj.data[currentPosition];j++;currentPosition++}return currentPosition};this.IgnoredSymbol=function(checkedSymbol){return checkedSymbol>= 128||this.DecodingTable[checkedSymbol]==255}}var bIsLocalFontsUse=false;function _is_support_cors(){if(window["NATIVE_EDITOR_ENJINE"]===true)return false;var xhrSupported=new XMLHttpRequest;return!!xhrSupported&&"withCredentials"in xhrSupported}var bIsSupportOriginalFormatFonts=_is_support_cors();function postLoadScript(scriptName){window.postMessage({type:"FROM_PAGE_LOAD_SCRIPT",text:scriptName},"*")}function CFontFileLoader(id){this.LoadingCounter=0;this.Id=id;this.Status=-1;this.stream_index=-1; this.callback=null;this.IsNeedAddJSToFontPath=true;this.CanUseOriginalFormat=true;var oThis=this;this.CheckLoaded=function(){return 0==this.Status||1==this.Status};this._callback_font_load=function(){if(!window[oThis.Id]){oThis.LoadingCounter++;if(oThis.LoadingCounter>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264* g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context= {"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;script.onerror=onError;document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess(); -else loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js",onSuccess,onError)}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;ikoef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(file=="")return;var _drawer= -window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64= -"";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj}; -this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"](): -"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false; -return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!Array.isArray(files))files=[files];if(0==files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt== -obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length- -1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError(); -return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})}; -this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param=""+option.asc_getCodePage()+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV=== -idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+ -AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive= -function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY= -false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY? -this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue= -function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd< -0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(kkoef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file= +_file;if(Array.isArray(file))file=file[0];if(file=="")return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas); +delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete, +src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&& +window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false; +if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!Array.isArray(files))files=[files];if(0==files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback= +null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted= +true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}; +this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length- +1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT=== +idOption){var _param=""+option.asc_getCodePage()+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+ +delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY= +0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX; +if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!= +this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector= +CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart= +start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k=_usersCount?true:false; @@ -1198,9 +1198,9 @@ prot.asc_getGroupName;prot["asc_getFormulasArray"]=prot.asc_getFormulasArray;pro window["AscFonts"].onLoadModule=function(){if(window["AscFonts"].isEngineReady)return;++window["AscFonts"].curLoadingIndex;if(window["AscFonts"].curLoadingIndex==window["AscFonts"].maxLoadingIndex){if(window["AscFonts"].api){window["AscFonts"].isEngineReady=true;window["AscFonts"].onSuccess.call(window["AscFonts"].api)}delete window["AscFonts"].curLoadingIndex;delete window["AscFonts"].maxLoadingIndex;delete window["AscFonts"].api;delete window["AscFonts"].onSuccess;delete window["AscFonts"].onError}}; window["AscFonts"].load=function(api,onSuccess,onError){window["AscFonts"].api=api;window["AscFonts"].onSuccess=onSuccess;window["AscFonts"].onError=onError;if(window["NATIVE_EDITOR_ENJINE"]===true||window["IS_NATIVE_EDITOR"]===true||window["Native"]!==undefined){window["AscFonts"].isEngineReady=true;window["AscFonts"].onSuccess.call(window["AscFonts"].api);delete window["AscFonts"].curLoadingIndex;delete window["AscFonts"].maxLoadingIndex;delete window["AscFonts"].api;delete window["AscFonts"].onSuccess; delete window["AscFonts"].onError;return}var url="../../../../sdkjs/common/libfont";var useWasm=false;var webAsmObj=window["WebAssembly"];if(typeof webAsmObj==="object")if(typeof webAsmObj["Memory"]==="function")if(typeof webAsmObj["instantiateStreaming"]==="function"||typeof webAsmObj["instantiate"]==="function")useWasm=true;useWasm?url+="/wasm":url+="/js";if(!useWasm)window["AscFonts"].onLoadModule();var _onSuccess=function(){};var _onError=function(){window["AscFonts"].onError()};if(window["AscNotLoadAllScript"]){AscCommon.loadScript(url+ -"/engine.js",_onSuccess,_onError);AscCommon.loadScript(url+"/file.js",_onSuccess,_onError);AscCommon.loadScript(url+"/manager.js",_onSuccess,_onError)}else AscCommon.loadScript(url+"/fonts.js",_onSuccess,_onError)};function FontStream(data,size){this.data=data;this.size=size}window["AscFonts"].FontStream=FontStream;window["AscFonts"].FT_Common={UintToInt:function(v){return v>2147483647?v-4294967296:v},UShort_To_Short:function(v){return v>32767?v-65536:v},IntToUInt:function(v){return v<0?v+4294967296: -v},Short_To_UShort:function(v){return v<0?v+65536:v},memset:function(d,v,s){for(var i=0;i2147483647?v-4294967296:v},UShort_To_Short:function(v){return v>32767?v-65536:v},IntToUInt:function(v){return v< +0?v+4294967296:v},Short_To_UShort:function(v){return v<0?v+65536:v},memset:function(d,v,s){for(var i=0;i>24&63);result.push(128|code>>18&63);result.push(128|code>>12&63);result.pu 5;while(bitCount>=8){var _del=Math.pow(2,bitCount-8);var _res=buffer/_del&255;result.push(_res);bitCount-=8}}this.GetUTF16_fromUTF8(result)};this.CreateIndexByOctetAndMovePosition=function(obj,currentPosition){var j=0;while(j<8){if(currentPosition>=obj.data.length){obj.index[j++]=-1;continue}if(this.IgnoredSymbol(obj.data.charCodeAt(currentPosition))){currentPosition++;continue}obj.index[j]=obj.data[currentPosition];j++;currentPosition++}return currentPosition};this.IgnoredSymbol=function(checkedSymbol){return checkedSymbol>= 128||this.DecodingTable[checkedSymbol]==255}}var bIsLocalFontsUse=false;function _is_support_cors(){if(window["NATIVE_EDITOR_ENJINE"]===true)return false;var xhrSupported=new XMLHttpRequest;return!!xhrSupported&&"withCredentials"in xhrSupported}var bIsSupportOriginalFormatFonts=_is_support_cors();function postLoadScript(scriptName){window.postMessage({type:"FROM_PAGE_LOAD_SCRIPT",text:scriptName},"*")}function CFontFileLoader(id){this.LoadingCounter=0;this.Id=id;this.Status=-1;this.stream_index=-1; this.callback=null;this.IsNeedAddJSToFontPath=true;this.CanUseOriginalFormat=true;var oThis=this;this.CheckLoaded=function(){return 0==this.Status||1==this.Status};this._callback_font_load=function(){if(!window[oThis.Id]){oThis.LoadingCounter++;if(oThis.LoadingCounter>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264* g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context= {"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;script.onerror=onError;document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess(); -else loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js",onSuccess,onError)}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;ikoef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(file=="")return;var _drawer= -window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64= -"";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj}; -this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"](): -"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false; -return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!Array.isArray(files))files=[files];if(0==files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt== -obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length- -1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError(); -return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})}; -this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param=""+option.asc_getCodePage()+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV=== -idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+ -AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive= -function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY= -false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY? -this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue= -function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd< -0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(kkoef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file= +_file;if(Array.isArray(file))file=file[0];if(file=="")return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas); +delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete, +src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&& +window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false; +if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!Array.isArray(files))files=[files];if(0==files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback= +null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted= +true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}; +this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length- +1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT=== +idOption){var _param=""+option.asc_getCodePage()+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+ +delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY= +0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX; +if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!= +this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector= +CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart= +start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k=_usersCount?true:false; @@ -1198,9 +1198,9 @@ prot.asc_getGroupName;prot["asc_getFormulasArray"]=prot.asc_getFormulasArray;pro window["AscFonts"].onLoadModule=function(){if(window["AscFonts"].isEngineReady)return;++window["AscFonts"].curLoadingIndex;if(window["AscFonts"].curLoadingIndex==window["AscFonts"].maxLoadingIndex){if(window["AscFonts"].api){window["AscFonts"].isEngineReady=true;window["AscFonts"].onSuccess.call(window["AscFonts"].api)}delete window["AscFonts"].curLoadingIndex;delete window["AscFonts"].maxLoadingIndex;delete window["AscFonts"].api;delete window["AscFonts"].onSuccess;delete window["AscFonts"].onError}}; window["AscFonts"].load=function(api,onSuccess,onError){window["AscFonts"].api=api;window["AscFonts"].onSuccess=onSuccess;window["AscFonts"].onError=onError;if(window["NATIVE_EDITOR_ENJINE"]===true||window["IS_NATIVE_EDITOR"]===true||window["Native"]!==undefined){window["AscFonts"].isEngineReady=true;window["AscFonts"].onSuccess.call(window["AscFonts"].api);delete window["AscFonts"].curLoadingIndex;delete window["AscFonts"].maxLoadingIndex;delete window["AscFonts"].api;delete window["AscFonts"].onSuccess; delete window["AscFonts"].onError;return}var url="../../../../sdkjs/common/libfont";var useWasm=false;var webAsmObj=window["WebAssembly"];if(typeof webAsmObj==="object")if(typeof webAsmObj["Memory"]==="function")if(typeof webAsmObj["instantiateStreaming"]==="function"||typeof webAsmObj["instantiate"]==="function")useWasm=true;useWasm?url+="/wasm":url+="/js";if(!useWasm)window["AscFonts"].onLoadModule();var _onSuccess=function(){};var _onError=function(){window["AscFonts"].onError()};if(window["AscNotLoadAllScript"]){AscCommon.loadScript(url+ -"/engine.js",_onSuccess,_onError);AscCommon.loadScript(url+"/file.js",_onSuccess,_onError);AscCommon.loadScript(url+"/manager.js",_onSuccess,_onError)}else AscCommon.loadScript(url+"/fonts.js",_onSuccess,_onError)};function FontStream(data,size){this.data=data;this.size=size}window["AscFonts"].FontStream=FontStream;window["AscFonts"].FT_Common={UintToInt:function(v){return v>2147483647?v-4294967296:v},UShort_To_Short:function(v){return v>32767?v-65536:v},IntToUInt:function(v){return v<0?v+4294967296: -v},Short_To_UShort:function(v){return v<0?v+65536:v},memset:function(d,v,s){for(var i=0;i2147483647?v-4294967296:v},UShort_To_Short:function(v){return v>32767?v-65536:v},IntToUInt:function(v){return v< +0?v+4294967296:v},Short_To_UShort:function(v){return v<0?v+65536:v},memset:function(d,v,s){for(var i=0;i>24&63);result.push(128|code>>18&63);result.push(128|code>>12&63);result.pu 5;while(bitCount>=8){var _del=Math.pow(2,bitCount-8);var _res=buffer/_del&255;result.push(_res);bitCount-=8}}this.GetUTF16_fromUTF8(result)};this.CreateIndexByOctetAndMovePosition=function(obj,currentPosition){var j=0;while(j<8){if(currentPosition>=obj.data.length){obj.index[j++]=-1;continue}if(this.IgnoredSymbol(obj.data.charCodeAt(currentPosition))){currentPosition++;continue}obj.index[j]=obj.data[currentPosition];j++;currentPosition++}return currentPosition};this.IgnoredSymbol=function(checkedSymbol){return checkedSymbol>= 128||this.DecodingTable[checkedSymbol]==255}}var bIsLocalFontsUse=false;function _is_support_cors(){if(window["NATIVE_EDITOR_ENJINE"]===true)return false;var xhrSupported=new XMLHttpRequest;return!!xhrSupported&&"withCredentials"in xhrSupported}var bIsSupportOriginalFormatFonts=_is_support_cors();function postLoadScript(scriptName){window.postMessage({type:"FROM_PAGE_LOAD_SCRIPT",text:scriptName},"*")}function CFontFileLoader(id){this.LoadingCounter=0;this.Id=id;this.Status=-1;this.stream_index=-1; this.callback=null;this.IsNeedAddJSToFontPath=true;this.CanUseOriginalFormat=true;var oThis=this;this.CheckLoaded=function(){return 0==this.Status||1==this.Status};this._callback_font_load=function(){if(!window[oThis.Id]){oThis.LoadingCounter++;if(oThis.LoadingCounter0||Bt.resolveWith(it,[ut]))}}),ut.ready.then=Bt.then,"complete"===it.readyState||"loading"!==it.readyState&&!it.documentElement.doScroll?t.setTimeout(ut.ready):(it.addEventListener("DOMContentLoaded",h),t.addEventListener("load",h));var Ut=function(t,e,i,n,o,s,a){var r=0,l=t.length,c=null==i;if("object"===ut.type(i)){o=!0;for(r in i)Ut(t,e,r,i[r],!0,s,a)}else if(void 0!==n&&(o=!0,ut.isFunction(n)||(a=!0),c&&(a?(e.call(t,n),e=null):(c=e,e=function(t,e,i){return c.call(ut(t),i)})),e))for(;r1,null,!0)},removeData:function(t){return this.each(function(){Dt.remove(this,t)})}}),ut.extend({queue:function(t,e,i){var n;if(t)return e=(e||"fx")+"queue",n=Et.get(t,e),i&&(!n||Array.isArray(i)?n=Et.access(t,e,ut.makeArray(i)):n.push(i)),n||[]},dequeue:function(t,e){e=e||"fx";var i=ut.queue(t,e),n=i.length,o=i.shift(),s=ut._queueHooks(t,e),a=function(){ut.dequeue(t,e)};"inprogress"===o&&(o=i.shift(),n--),o&&("fx"===e&&i.unshift("inprogress"),delete s.stop,o.call(t,a,s)),!n&&s&&s.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return Et.get(t,i)||Et.access(t,i,{empty:ut.Callbacks("once memory").add(function(){Et.remove(t,[e+"queue",i])})})}}),ut.fn.extend({queue:function(t,e){var i=2;return"string"!=typeof t&&(e=t,t="fx",i--),arguments.length\x20\t\r\n\f]+)/i,jt=/^$|\/(?:java|ecma)script/i,qt={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};qt.optgroup=qt.option,qt.tbody=qt.tfoot=qt.colgroup=qt.caption=qt.thead,qt.th=qt.td;var Kt=/<|&#?\w+;/;!function(){var t=it.createDocumentFragment(),e=t.appendChild(it.createElement("div")),i=it.createElement("input");i.setAttribute("type","radio"),i.setAttribute("checked","checked"),i.setAttribute("name","t"),e.appendChild(i),mt.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",mt.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Yt=it.documentElement,Xt=/^key/,Jt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Zt=/^([^.]*)(?:\.(.+)|)/;ut.event={global:{},add:function(t,e,i,n,o){var s,a,r,l,c,d,h,p,m,u,g,b=Et.get(t);if(b)for(i.handler&&(s=i,i=s.handler,o=s.selector),o&&ut.find.matchesSelector(Yt,o),i.guid||(i.guid=ut.guid++),(l=b.events)||(l=b.events={}),(a=b.handle)||(a=b.handle=function(e){return void 0!==ut&&ut.event.triggered!==e.type?ut.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(Pt)||[""],c=e.length;c--;)r=Zt.exec(e[c])||[],m=g=r[1],u=(r[2]||"").split(".").sort(),m&&(h=ut.event.special[m]||{},m=(o?h.delegateType:h.bindType)||m,h=ut.event.special[m]||{},d=ut.extend({type:m,origType:g,data:n,handler:i,guid:i.guid,selector:o,needsContext:o&&ut.expr.match.needsContext.test(o),namespace:u.join(".")},s),(p=l[m])||(p=l[m]=[],p.delegateCount=0,h.setup&&!1!==h.setup.call(t,n,u,a)||t.addEventListener&&t.addEventListener(m,a)),h.add&&(h.add.call(t,d),d.handler.guid||(d.handler.guid=i.guid)),o?p.splice(p.delegateCount++,0,d):p.push(d),ut.event.global[m]=!0)},remove:function(t,e,i,n,o){var s,a,r,l,c,d,h,p,m,u,g,b=Et.hasData(t)&&Et.get(t);if(b&&(l=b.events)){for(e=(e||"").match(Pt)||[""],c=e.length;c--;)if(r=Zt.exec(e[c])||[],m=g=r[1],u=(r[2]||"").split(".").sort(),m){for(h=ut.event.special[m]||{},m=(n?h.delegateType:h.bindType)||m,p=l[m]||[],r=r[2]&&new RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=s=p.length;s--;)d=p[s],!o&&g!==d.origType||i&&i.guid!==d.guid||r&&!r.test(d.namespace)||n&&n!==d.selector&&("**"!==n||!d.selector)||(p.splice(s,1),d.selector&&p.delegateCount--,h.remove&&h.remove.call(t,d));a&&!p.length&&(h.teardown&&!1!==h.teardown.call(t,u,b.handle)||ut.removeEvent(t,m,b.handle),delete l[m])}else for(m in l)ut.event.remove(t,m+e[c],i,n,!0);ut.isEmptyObject(l)&&Et.remove(t,"handle events")}},dispatch:function(t){var e,i,n,o,s,a,r=ut.event.fix(t),l=new Array(arguments.length),c=(Et.get(this,"events")||{})[r.type]||[],d=ut.event.special[r.type]||{};for(l[0]=r,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(s=[],a={},i=0;i-1:ut.find(o,this,null,[c]).length),a[o]&&s.push(n);s.length&&r.push({elem:c,handlers:s})}return c=this,l\x20\t\r\n\f]*)[^>]*)\/>/gi,te=/\s*$/g;ut.extend({htmlPrefilter:function(t){return t.replace(Qt,"<$1>")},clone:function(t,e,i){var n,o,s,a,r=t.cloneNode(!0),l=ut.contains(t.ownerDocument,t);if(!(mt.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||ut.isXMLDoc(t)))for(a=C(r),s=C(t),n=0,o=s.length;n0&&v(a,!l&&C(t,"script")),r},cleanData:function(t){for(var e,i,n,o=ut.event.special,s=0;void 0!==(i=t[s]);s++)if(Vt(i)){if(e=i[Et.expando]){if(e.events)for(n in e.events)o[n]?ut.event.remove(i,n):ut.removeEvent(i,n,e.handle);i[Et.expando]=void 0}i[Dt.expando]&&(i[Dt.expando]=void 0)}}}),ut.fn.extend({detach:function(t){return B(this,t,!0)},remove:function(t){return B(this,t)},text:function(t){return Ut(this,function(t){return void 0===t?ut.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return M(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){A(this,t).appendChild(t)}})},prepend:function(){return M(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=A(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return M(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return M(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(ut.cleanData(C(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return ut.clone(this,t,e)})},html:function(t){return Ut(this,function(t){var e=this[0]||{},i=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!te.test(t)&&!qt[(Gt.exec(t)||["",""])[1].toLowerCase()]){t=ut.htmlPrefilter(t);try{for(;i1)}}),ut.Tween=H,H.prototype={constructor:H,init:function(t,e,i,n,o,s){this.elem=t,this.prop=i,this.easing=o||ut.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=s||(ut.cssNumber[i]?"":"px")},cur:function(){var t=H.propHooks[this.prop];return t&&t.get?t.get(this):H.propHooks._default.get(this)},run:function(t){var e,i=H.propHooks[this.prop];return this.options.duration?this.pos=e=ut.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):H.propHooks._default.set(this),this}},H.prototype.init.prototype=H.prototype,H.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=ut.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){ut.fx.step[t.prop]?ut.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[ut.cssProps[t.prop]]&&!ut.cssHooks[t.prop]?t.elem[t.prop]=t.now:ut.style(t.elem,t.prop,t.now+t.unit)}}},H.propHooks.scrollTop=H.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},ut.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},ut.fx=H.prototype.init,ut.fx.step={};var me,ue,ge=/^(?:toggle|show|hide)$/,be=/queueHooks$/;ut.Animation=ut.extend(j,{tweeners:{"*":[function(t,e){var i=this.createTween(t,e);return g(i.elem,t,Ht.exec(e),i),i}]},tweener:function(t,e){ut.isFunction(t)?(e=t,t=["*"]):t=t.match(Pt);for(var i,n=0,o=t.length;n1)},removeAttr:function(t){return this.each(function(){ut.removeAttr(this,t)})}}),ut.extend({attr:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===t.getAttribute?ut.prop(t,e,i):(1===s&&ut.isXMLDoc(t)||(o=ut.attrHooks[e.toLowerCase()]||(ut.expr.match.bool.test(e)?fe:void 0)),void 0!==i?null===i?void ut.removeAttr(t,e):o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:(t.setAttribute(e,i+""),i):o&&"get"in o&&null!==(n=o.get(t,e))?n:(n=ut.find.attr(t,e),null==n?void 0:n))},attrHooks:{type:{set:function(t,e){if(!mt.radioValue&&"radio"===e&&o(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},removeAttr:function(t,e){var i,n=0,o=e&&e.match(Pt);if(o&&1===t.nodeType)for(;i=o[n++];)t.removeAttribute(i)}}),fe={set:function(t,e,i){return!1===e?ut.removeAttr(t,i):t.setAttribute(i,i),i}},ut.each(ut.expr.match.bool.source.match(/\w+/g),function(t,e){var i=Ce[e]||ut.find.attr;Ce[e]=function(t,e,n){var o,s,a=e.toLowerCase();return n||(s=Ce[a],Ce[a]=o,o=null!=i(t,e,n)?a:null,Ce[a]=s),o}});var ve=/^(?:input|select|textarea|button)$/i,_e=/^(?:a|area)$/i;ut.fn.extend({prop:function(t,e){return Ut(this,ut.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[ut.propFix[t]||t]})}}),ut.extend({prop:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&ut.isXMLDoc(t)||(e=ut.propFix[e]||e,o=ut.propHooks[e]),void 0!==i?o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:t[e]=i:o&&"get"in o&&null!==(n=o.get(t,e))?n:t[e]},propHooks:{tabIndex:{get:function(t){var e=ut.find.attr(t,"tabindex");return e?parseInt(e,10):ve.test(t.nodeName)||_e.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),mt.optSelected||(ut.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),ut.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ut.propFix[this.toLowerCase()]=this}),ut.fn.extend({addClass:function(t){var e,i,n,o,s,a,r,l=0;if(ut.isFunction(t))return this.each(function(e){ut(this).addClass(t.call(this,e,K(this)))});if("string"==typeof t&&t)for(e=t.match(Pt)||[];i=this[l++];)if(o=K(i),n=1===i.nodeType&&" "+q(o)+" "){for(a=0;s=e[a++];)n.indexOf(" "+s+" ")<0&&(n+=s+" ");r=q(n),o!==r&&i.setAttribute("class",r)}return this},removeClass:function(t){var e,i,n,o,s,a,r,l=0;if(ut.isFunction(t))return this.each(function(e){ut(this).removeClass(t.call(this,e,K(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(Pt)||[];i=this[l++];)if(o=K(i),n=1===i.nodeType&&" "+q(o)+" "){for(a=0;s=e[a++];)for(;n.indexOf(" "+s+" ")>-1;)n=n.replace(" "+s+" "," ");r=q(n),o!==r&&i.setAttribute("class",r)}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):ut.isFunction(t)?this.each(function(i){ut(this).toggleClass(t.call(this,i,K(this),e),e)}):this.each(function(){var e,n,o,s;if("string"===i)for(n=0,o=ut(this),s=t.match(Pt)||[];e=s[n++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==i||(e=K(this),e&&Et.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":Et.get(this,"__className__")||""))})},hasClass:function(t){var e,i,n=0;for(e=" "+t+" ";i=this[n++];)if(1===i.nodeType&&(" "+q(K(i))+" ").indexOf(e)>-1)return!0;return!1}});var ye=/\r/g;ut.fn.extend({val:function(t){var e,i,n,o=this[0];{if(arguments.length)return n=ut.isFunction(t),this.each(function(i){var o;1===this.nodeType&&(o=n?t.call(this,i,ut(this).val()):t,null==o?o="":"number"==typeof o?o+="":Array.isArray(o)&&(o=ut.map(o,function(t){return null==t?"":t+""})),(e=ut.valHooks[this.type]||ut.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))});if(o)return(e=ut.valHooks[o.type]||ut.valHooks[o.nodeName.toLowerCase()])&&"get"in e&&void 0!==(i=e.get(o,"value"))?i:(i=o.value,"string"==typeof i?i.replace(ye,""):null==i?"":i)}}}),ut.extend({valHooks:{option:{get:function(t){var e=ut.find.attr(t,"value");return null!=e?e:q(ut.text(t))}},select:{get:function(t){var e,i,n,s=t.options,a=t.selectedIndex,r="select-one"===t.type,l=r?null:[],c=r?a+1:s.length;for(n=a<0?c:r?a:0;n-1)&&(i=!0);return i||(t.selectedIndex=-1),s}}}}),ut.each(["radio","checkbox"],function(){ut.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=ut.inArray(ut(t).val(),e)>-1}},mt.checkOn||(ut.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var we=/^(?:focusinfocus|focusoutblur)$/;ut.extend(ut.event,{trigger:function(e,i,n,o){var s,a,r,l,c,d,h,p=[n||it],m=dt.call(e,"type")?e.type:e,u=dt.call(e,"namespace")?e.namespace.split("."):[];if(a=r=n=n||it,3!==n.nodeType&&8!==n.nodeType&&!we.test(m+ut.event.triggered)&&(m.indexOf(".")>-1&&(u=m.split("."),m=u.shift(),u.sort()),c=m.indexOf(":")<0&&"on"+m,e=e[ut.expando]?e:new ut.Event(m,"object"==typeof e&&e),e.isTrigger=o?2:3,e.namespace=u.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),i=null==i?[e]:ut.makeArray(i,[e]),h=ut.event.special[m]||{},o||!h.trigger||!1!==h.trigger.apply(n,i))){if(!o&&!h.noBubble&&!ut.isWindow(n)){for(l=h.delegateType||m,we.test(l+m)||(a=a.parentNode);a;a=a.parentNode)p.push(a),r=a;r===(n.ownerDocument||it)&&p.push(r.defaultView||r.parentWindow||t)}for(s=0;(a=p[s++])&&!e.isPropagationStopped();)e.type=s>1?l:h.bindType||m,d=(Et.get(a,"events")||{})[e.type]&&Et.get(a,"handle"),d&&d.apply(a,i),(d=c&&a[c])&&d.apply&&Vt(a)&&(e.result=d.apply(a,i),!1===e.result&&e.preventDefault());return e.type=m,o||e.isDefaultPrevented()||h._default&&!1!==h._default.apply(p.pop(),i)||!Vt(n)||c&&ut.isFunction(n[m])&&!ut.isWindow(n)&&(r=n[c],r&&(n[c]=null),ut.event.triggered=m,n[m](),ut.event.triggered=void 0,r&&(n[c]=r)),e.result}},simulate:function(t,e,i){var n=ut.extend(new ut.Event,i,{type:t,isSimulated:!0});ut.event.trigger(n,null,e)}}),ut.fn.extend({trigger:function(t,e){return this.each(function(){ut.event.trigger(t,e,this)})},triggerHandler:function(t,e){var i=this[0];if(i)return ut.event.trigger(t,e,i,!0)}}),ut.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(t,e){ut.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),ut.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),mt.focusin="onfocusin"in t,mt.focusin||ut.each({focus:"focusin",blur:"focusout"},function(t,e){var i=function(t){ut.event.simulate(e,t.target,ut.event.fix(t))};ut.event.special[e]={setup:function(){var n=this.ownerDocument||this,o=Et.access(n,e);o||n.addEventListener(t,i,!0),Et.access(n,e,(o||0)+1)},teardown:function(){var n=this.ownerDocument||this,o=Et.access(n,e)-1;o?Et.access(n,e,o):(n.removeEventListener(t,i,!0),Et.remove(n,e))}}});var xe=t.location,Se=ut.now(),Ae=/\?/;ut.parseXML=function(e){var i;if(!e||"string"!=typeof e)return null;try{i=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){i=void 0}return i&&!i.getElementsByTagName("parsererror").length||ut.error("Invalid XML: "+e),i};var ke=/\[\]$/,Te=/\r?\n/g,Ie=/^(?:submit|button|image|reset|file)$/i,Pe=/^(?:input|select|textarea|keygen)/i;ut.param=function(t,e){var i,n=[],o=function(t,e){var i=ut.isFunction(e)?e():e;n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==i?"":i)};if(Array.isArray(t)||t.jquery&&!ut.isPlainObject(t))ut.each(t,function(){o(this.name,this.value)});else for(i in t)Y(i,t[i],e,o);return n.join("&")},ut.fn.extend({serialize:function(){return ut.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=ut.prop(this,"elements");return t?ut.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!ut(this).is(":disabled")&&Pe.test(this.nodeName)&&!Ie.test(t)&&(this.checked||!Wt.test(t))}).map(function(t,e){var i=ut(this).val();return null==i?null:Array.isArray(i)?ut.map(i,function(t){return{name:e.name,value:t.replace(Te,"\r\n")}}):{name:e.name,value:i.replace(Te,"\r\n")}}).get()}});var Me=/%20/g,Be=/#.*$/,Ue=/([?&])_=[^&]*/,Ve=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ee=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,De=/^(?:GET|HEAD)$/,Re=/^\/\//,Fe={},Le={},He="*/".concat("*"),Ne=it.createElement("a");Ne.href=xe.href,ut.extend({active:0,lastModified:{},etag:{},ajaxSettings:{ url:xe.href,type:"GET",isLocal:Ee.test(xe.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":He,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ut.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?Z(Z(t,ut.ajaxSettings),e):Z(ut.ajaxSettings,t)},ajaxPrefilter:X(Fe),ajaxTransport:X(Le),ajax:function(e,i){function n(e,i,n,r){var c,p,m,_,y,w=i;d||(d=!0,l&&t.clearTimeout(l),o=void 0,a=r||"",x.readyState=e>0?4:0,c=e>=200&&e<300||304===e,n&&(_=Q(u,x,n)),_=tt(u,_,x,c),c?(u.ifModified&&(y=x.getResponseHeader("Last-Modified"),y&&(ut.lastModified[s]=y),(y=x.getResponseHeader("etag"))&&(ut.etag[s]=y)),204===e||"HEAD"===u.type?w="nocontent":304===e?w="notmodified":(w=_.state,p=_.data,m=_.error,c=!m)):(m=w,!e&&w||(w="error",e<0&&(e=0))),x.status=e,x.statusText=(i||w)+"",c?f.resolveWith(g,[p,w,x]):f.rejectWith(g,[x,w,m]),x.statusCode(v),v=void 0,h&&b.trigger(c?"ajaxSuccess":"ajaxError",[x,u,c?p:m]),C.fireWith(g,[x,w]),h&&(b.trigger("ajaxComplete",[x,u]),--ut.active||ut.event.trigger("ajaxStop")))}"object"==typeof e&&(i=e,e=void 0),i=i||{};var o,s,a,r,l,c,d,h,p,m,u=ut.ajaxSetup({},i),g=u.context||u,b=u.context&&(g.nodeType||g.jquery)?ut(g):ut.event,f=ut.Deferred(),C=ut.Callbacks("once memory"),v=u.statusCode||{},_={},y={},w="canceled",x={readyState:0,getResponseHeader:function(t){var e;if(d){if(!r)for(r={};e=Ve.exec(a);)r[e[1].toLowerCase()]=e[2];e=r[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return d?a:null},setRequestHeader:function(t,e){return null==d&&(t=y[t.toLowerCase()]=y[t.toLowerCase()]||t,_[t]=e),this},overrideMimeType:function(t){return null==d&&(u.mimeType=t),this},statusCode:function(t){var e;if(t)if(d)x.always(t[x.status]);else for(e in t)v[e]=[v[e],t[e]];return this},abort:function(t){var e=t||w;return o&&o.abort(e),n(0,e),this}};if(f.promise(x),u.url=((e||u.url||xe.href)+"").replace(Re,xe.protocol+"//"),u.type=i.method||i.type||u.method||u.type,u.dataTypes=(u.dataType||"*").toLowerCase().match(Pt)||[""],null==u.crossDomain){c=it.createElement("a");try{c.href=u.url,c.href=c.href,u.crossDomain=Ne.protocol+"//"+Ne.host!=c.protocol+"//"+c.host}catch(t){u.crossDomain=!0}}if(u.data&&u.processData&&"string"!=typeof u.data&&(u.data=ut.param(u.data,u.traditional)),J(Fe,u,i,x),d)return x;h=ut.event&&u.global,h&&0==ut.active++&&ut.event.trigger("ajaxStart"),u.type=u.type.toUpperCase(),u.hasContent=!De.test(u.type),s=u.url.replace(Be,""),u.hasContent?u.data&&u.processData&&0===(u.contentType||"").indexOf("application/x-www-form-urlencoded")&&(u.data=u.data.replace(Me,"+")):(m=u.url.slice(s.length),u.data&&(s+=(Ae.test(s)?"&":"?")+u.data,delete u.data),!1===u.cache&&(s=s.replace(Ue,"$1"),m=(Ae.test(s)?"&":"?")+"_="+Se+++m),u.url=s+m),u.ifModified&&(ut.lastModified[s]&&x.setRequestHeader("If-Modified-Since",ut.lastModified[s]),ut.etag[s]&&x.setRequestHeader("If-None-Match",ut.etag[s])),(u.data&&u.hasContent&&!1!==u.contentType||i.contentType)&&x.setRequestHeader("Content-Type",u.contentType),x.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+He+"; q=0.01":""):u.accepts["*"]);for(p in u.headers)x.setRequestHeader(p,u.headers[p]);if(u.beforeSend&&(!1===u.beforeSend.call(g,x,u)||d))return x.abort();if(w="abort",C.add(u.complete),x.done(u.success),x.fail(u.error),o=J(Le,u,i,x)){if(x.readyState=1,h&&b.trigger("ajaxSend",[x,u]),d)return x;u.async&&u.timeout>0&&(l=t.setTimeout(function(){x.abort("timeout")},u.timeout));try{d=!1,o.send(_,n)}catch(t){if(d)throw t;n(-1,t)}}else n(-1,"No Transport");return x},getJSON:function(t,e,i){return ut.get(t,e,i,"json")},getScript:function(t,e){return ut.get(t,void 0,e,"script")}}),ut.each(["get","post"],function(t,e){ut[e]=function(t,i,n,o){return ut.isFunction(i)&&(o=o||n,n=i,i=void 0),ut.ajax(ut.extend({url:t,type:e,dataType:o,data:i,success:n},ut.isPlainObject(t)&&t))}}),ut._evalUrl=function(t){return ut.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},ut.fn.extend({wrapAll:function(t){var e;return this[0]&&(ut.isFunction(t)&&(t=t.call(this[0])),e=ut(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return ut.isFunction(t)?this.each(function(e){ut(this).wrapInner(t.call(this,e))}):this.each(function(){var e=ut(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=ut.isFunction(t);return this.each(function(i){ut(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(t){return this.parent(t).not("body").each(function(){ut(this).replaceWith(this.childNodes)}),this}}),ut.expr.pseudos.hidden=function(t){return!ut.expr.pseudos.visible(t)},ut.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},ut.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var Oe={0:200,1223:204},ze=ut.ajaxSettings.xhr();mt.cors=!!ze&&"withCredentials"in ze,mt.ajax=ze=!!ze,ut.ajaxTransport(function(e){var i,n;if(mt.cors||ze&&!e.crossDomain)return{send:function(o,s){var a,r=e.xhr();if(r.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)r[a]=e.xhrFields[a];e.mimeType&&r.overrideMimeType&&r.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(a in o)r.setRequestHeader(a,o[a]);i=function(t){return function(){i&&(i=n=r.onload=r.onerror=r.onabort=r.onreadystatechange=null,"abort"===t?r.abort():"error"===t?"number"!=typeof r.status?s(0,"error"):s(r.status,r.statusText):s(Oe[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=i(),n=r.onerror=i("error"),void 0!==r.onabort?r.onabort=n:r.onreadystatechange=function(){4===r.readyState&&t.setTimeout(function(){i&&n()})},i=i("abort");try{r.send(e.hasContent&&e.data||null)}catch(t){if(i)throw t}},abort:function(){i&&i()}}}),ut.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=!1)}),ut.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return ut.globalEval(t),t}}}),ut.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),ut.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,o){e=ut(" + - \ No newline at end of file + diff --git a/www/common/onlyoffice/v2b/web-apps/apps/presentationeditor/main/app.js b/www/common/onlyoffice/v2b/web-apps/apps/presentationeditor/main/app.js index a8b350817..f5e3ee15c 100644 --- a/www/common/onlyoffice/v2b/web-apps/apps/presentationeditor/main/app.js +++ b/www/common/onlyoffice/v2b/web-apps/apps/presentationeditor/main/app.js @@ -10,7 +10,7 @@ i||Ae.test(t)?n(t,o):Y(t+"["+("object"==typeof o&&null!=o?e:"")+"]",o,i,n)});els t.console&&t.console.warn&&e&&Et.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,i)},mt.readyException=function(e){t.setTimeout(function(){throw e})};var Mt=mt.Deferred();mt.fn.ready=function(t){return Mt.then(t).catch(function(t){mt.readyException(t)}),this},mt.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--mt.readyWait:mt.isReady)||(mt.isReady=!0,!0!==t&&--mt.readyWait>0||Mt.resolveWith(it,[mt]))}}),mt.ready.then=Mt.then,"complete"===it.readyState||"loading"!==it.readyState&&!it.documentElement.doScroll?t.setTimeout(mt.ready):(it.addEventListener("DOMContentLoaded",d),t.addEventListener("load",d));var Ut=function(t,e,i,n,o,s,a){var l=0,r=t.length,c=null==i;if("object"===mt.type(i)){o=!0;for(l in i)Ut(t,e,l,i[l],!0,s,a)}else if(void 0!==n&&(o=!0,mt.isFunction(n)||(a=!0),c&&(a?(e.call(t,n),e=null):(c=e,e=function(t,e,i){return c.call(mt(t),i)})),e))for(;l1,null,!0)},removeData:function(t){return this.each(function(){Bt.remove(this,t)})}}),mt.extend({queue:function(t,e,i){var n;if(t)return e=(e||"fx")+"queue",n=Ft.get(t,e),i&&(!n||Array.isArray(i)?n=Ft.access(t,e,mt.makeArray(i)):n.push(i)),n||[]},dequeue:function(t,e){e=e||"fx";var i=mt.queue(t,e),n=i.length,o=i.shift(),s=mt._queueHooks(t,e),a=function(){mt.dequeue(t,e)};"inprogress"===o&&(o=i.shift(),n--),o&&("fx"===e&&i.unshift("inprogress"),delete s.stop,o.call(t,a,s)),!n&&s&&s.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return Ft.get(t,i)||Ft.access(t,i,{empty:mt.Callbacks("once memory").add(function(){Ft.remove(t,[e+"queue",i])})})}}),mt.fn.extend({queue:function(t,e){var i=2;return"string"!=typeof t&&(e=t,t="fx",i--),arguments.length\x20\t\r\n\f]+)/i,Wt=/^$|\/(?:java|ecma)script/i,qt={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};qt.optgroup=qt.option,qt.tbody=qt.tfoot=qt.colgroup=qt.caption=qt.thead,qt.th=qt.td;var Kt=/<|&#?\w+;/;!function(){var t=it.createDocumentFragment(),e=t.appendChild(it.createElement("div")),i=it.createElement("input");i.setAttribute("type","radio"),i.setAttribute("checked","checked"),i.setAttribute("name","t"),e.appendChild(i),ut.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",ut.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Yt=it.documentElement,Xt=/^key/,Zt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Jt=/^([^.]*)(?:\.(.+)|)/;mt.event={global:{},add:function(t,e,i,n,o){var s,a,l,r,c,h,d,p,u,m,g,f=Ft.get(t);if(f)for(i.handler&&(s=i,i=s.handler,o=s.selector),o&&mt.find.matchesSelector(Yt,o),i.guid||(i.guid=mt.guid++),(r=f.events)||(r=f.events={}),(a=f.handle)||(a=f.handle=function(e){return void 0!==mt&&mt.event.triggered!==e.type?mt.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(Pt)||[""],c=e.length;c--;)l=Jt.exec(e[c])||[],u=g=l[1],m=(l[2]||"").split(".").sort(),u&&(d=mt.event.special[u]||{},u=(o?d.delegateType:d.bindType)||u,d=mt.event.special[u]||{},h=mt.extend({type:u,origType:g,data:n,handler:i,guid:i.guid,selector:o,needsContext:o&&mt.expr.match.needsContext.test(o),namespace:m.join(".")},s),(p=r[u])||(p=r[u]=[],p.delegateCount=0,d.setup&&!1!==d.setup.call(t,n,m,a)||t.addEventListener&&t.addEventListener(u,a)),d.add&&(d.add.call(t,h),h.handler.guid||(h.handler.guid=i.guid)),o?p.splice(p.delegateCount++,0,h):p.push(h),mt.event.global[u]=!0)},remove:function(t,e,i,n,o){var s,a,l,r,c,h,d,p,u,m,g,f=Ft.hasData(t)&&Ft.get(t);if(f&&(r=f.events)){for(e=(e||"").match(Pt)||[""],c=e.length;c--;)if(l=Jt.exec(e[c])||[],u=g=l[1],m=(l[2]||"").split(".").sort(),u){for(d=mt.event.special[u]||{},u=(n?d.delegateType:d.bindType)||u,p=r[u]||[],l=l[2]&&new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=s=p.length;s--;)h=p[s],!o&&g!==h.origType||i&&i.guid!==h.guid||l&&!l.test(h.namespace)||n&&n!==h.selector&&("**"!==n||!h.selector)||(p.splice(s,1),h.selector&&p.delegateCount--,d.remove&&d.remove.call(t,h));a&&!p.length&&(d.teardown&&!1!==d.teardown.call(t,m,f.handle)||mt.removeEvent(t,u,f.handle),delete r[u])}else for(u in r)mt.event.remove(t,u+e[c],i,n,!0);mt.isEmptyObject(r)&&Ft.remove(t,"handle events")}},dispatch:function(t){var e,i,n,o,s,a,l=mt.event.fix(t),r=new Array(arguments.length),c=(Ft.get(this,"events")||{})[l.type]||[],h=mt.event.special[l.type]||{};for(r[0]=l,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(s=[],a={},i=0;i-1:mt.find(o,this,null,[c]).length),a[o]&&s.push(n);s.length&&l.push({elem:c,handlers:s})}return c=this,r\x20\t\r\n\f]*)[^>]*)\/>/gi,te=/\s*$/g;mt.extend({htmlPrefilter:function(t){return t.replace(Qt,"<$1>")},clone:function(t,e,i){var n,o,s,a,l=t.cloneNode(!0),r=mt.contains(t.ownerDocument,t);if(!(ut.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||mt.isXMLDoc(t)))for(a=C(l),s=C(t),n=0,o=s.length;n0&&v(a,!r&&C(t,"script")),l},cleanData:function(t){for(var e,i,n,o=mt.event.special,s=0;void 0!==(i=t[s]);s++)if(Dt(i)){if(e=i[Ft.expando]){if(e.events)for(n in e.events)o[n]?mt.event.remove(i,n):mt.removeEvent(i,n,e.handle);i[Ft.expando]=void 0}i[Bt.expando]&&(i[Bt.expando]=void 0)}}}),mt.fn.extend({detach:function(t){return M(this,t,!0)},remove:function(t){return M(this,t)},text:function(t){return Ut(this,function(t){return void 0===t?mt.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return E(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){T(this,t).appendChild(t)}})},prepend:function(){return E(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=T(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return E(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return E(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(mt.cleanData(C(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return mt.clone(this,t,e)})},html:function(t){return Ut(this,function(t){var e=this[0]||{},i=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!te.test(t)&&!qt[(jt.exec(t)||["",""])[1].toLowerCase()]){t=mt.htmlPrefilter(t);try{for(;i1)}}),mt.Tween=O,O.prototype={constructor:O,init:function(t,e,i,n,o,s){this.elem=t,this.prop=i,this.easing=o||mt.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=s||(mt.cssNumber[i]?"":"px")},cur:function(){var t=O.propHooks[this.prop];return t&&t.get?t.get(this):O.propHooks._default.get(this)},run:function(t){var e,i=O.propHooks[this.prop];return this.options.duration?this.pos=e=mt.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=mt.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){mt.fx.step[t.prop]?mt.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[mt.cssProps[t.prop]]&&!mt.cssHooks[t.prop]?t.elem[t.prop]=t.now:mt.style(t.elem,t.prop,t.now+t.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},mt.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},mt.fx=O.prototype.init,mt.fx.step={};var ue,me,ge=/^(?:toggle|show|hide)$/,fe=/queueHooks$/;mt.Animation=mt.extend(W,{tweeners:{"*":[function(t,e){var i=this.createTween(t,e);return g(i.elem,t,Ot.exec(e),i),i}]},tweener:function(t,e){mt.isFunction(t)?(e=t,t=["*"]):t=t.match(Pt);for(var i,n=0,o=t.length;n1)},removeAttr:function(t){return this.each(function(){mt.removeAttr(this,t)})}}),mt.extend({attr:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===t.getAttribute?mt.prop(t,e,i):(1===s&&mt.isXMLDoc(t)||(o=mt.attrHooks[e.toLowerCase()]||(mt.expr.match.bool.test(e)?be:void 0)),void 0!==i?null===i?void mt.removeAttr(t,e):o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:(t.setAttribute(e,i+""),i):o&&"get"in o&&null!==(n=o.get(t,e))?n:(n=mt.find.attr(t,e),null==n?void 0:n))},attrHooks:{type:{set:function(t,e){if(!ut.radioValue&&"radio"===e&&o(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},removeAttr:function(t,e){var i,n=0,o=e&&e.match(Pt);if(o&&1===t.nodeType)for(;i=o[n++];)t.removeAttribute(i)}}),be={set:function(t,e,i){return!1===e?mt.removeAttr(t,i):t.setAttribute(i,i),i}},mt.each(mt.expr.match.bool.source.match(/\w+/g),function(t,e){var i=Ce[e]||mt.find.attr;Ce[e]=function(t,e,n){var o,s,a=e.toLowerCase();return n||(s=Ce[a],Ce[a]=o,o=null!=i(t,e,n)?a:null,Ce[a]=s),o}});var ve=/^(?:input|select|textarea|button)$/i,_e=/^(?:a|area)$/i;mt.fn.extend({prop:function(t,e){return Ut(this,mt.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[mt.propFix[t]||t]})}}),mt.extend({prop:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&mt.isXMLDoc(t)||(e=mt.propFix[e]||e,o=mt.propHooks[e]),void 0!==i?o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:t[e]=i:o&&"get"in o&&null!==(n=o.get(t,e))?n:t[e]},propHooks:{tabIndex:{get:function(t){var e=mt.find.attr(t,"tabindex");return e?parseInt(e,10):ve.test(t.nodeName)||_e.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),ut.optSelected||(mt.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),mt.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){mt.propFix[this.toLowerCase()]=this}),mt.fn.extend({addClass:function(t){var e,i,n,o,s,a,l,r=0;if(mt.isFunction(t))return this.each(function(e){mt(this).addClass(t.call(this,e,K(this)))});if("string"==typeof t&&t)for(e=t.match(Pt)||[];i=this[r++];)if(o=K(i),n=1===i.nodeType&&" "+q(o)+" "){for(a=0;s=e[a++];)n.indexOf(" "+s+" ")<0&&(n+=s+" ");l=q(n),o!==l&&i.setAttribute("class",l)}return this},removeClass:function(t){var e,i,n,o,s,a,l,r=0;if(mt.isFunction(t))return this.each(function(e){mt(this).removeClass(t.call(this,e,K(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(Pt)||[];i=this[r++];)if(o=K(i),n=1===i.nodeType&&" "+q(o)+" "){for(a=0;s=e[a++];)for(;n.indexOf(" "+s+" ")>-1;)n=n.replace(" "+s+" "," ");l=q(n),o!==l&&i.setAttribute("class",l)}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):mt.isFunction(t)?this.each(function(i){mt(this).toggleClass(t.call(this,i,K(this),e),e)}):this.each(function(){var e,n,o,s;if("string"===i)for(n=0,o=mt(this),s=t.match(Pt)||[];e=s[n++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==i||(e=K(this),e&&Ft.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":Ft.get(this,"__className__")||""))})},hasClass:function(t){var e,i,n=0;for(e=" "+t+" ";i=this[n++];)if(1===i.nodeType&&(" "+q(K(i))+" ").indexOf(e)>-1)return!0;return!1}});var ye=/\r/g;mt.fn.extend({val:function(t){var e,i,n,o=this[0];{if(arguments.length)return n=mt.isFunction(t),this.each(function(i){var o;1===this.nodeType&&(o=n?t.call(this,i,mt(this).val()):t,null==o?o="":"number"==typeof o?o+="":Array.isArray(o)&&(o=mt.map(o,function(t){return null==t?"":t+""})),(e=mt.valHooks[this.type]||mt.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))});if(o)return(e=mt.valHooks[o.type]||mt.valHooks[o.nodeName.toLowerCase()])&&"get"in e&&void 0!==(i=e.get(o,"value"))?i:(i=o.value,"string"==typeof i?i.replace(ye,""):null==i?"":i)}}}),mt.extend({valHooks:{option:{get:function(t){var e=mt.find.attr(t,"value");return null!=e?e:q(mt.text(t))}},select:{get:function(t){var e,i,n,s=t.options,a=t.selectedIndex,l="select-one"===t.type,r=l?null:[],c=l?a+1:s.length;for(n=a<0?c:l?a:0;n-1)&&(i=!0);return i||(t.selectedIndex=-1),s}}}}),mt.each(["radio","checkbox"],function(){mt.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=mt.inArray(mt(t).val(),e)>-1}},ut.checkOn||(mt.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var we=/^(?:focusinfocus|focusoutblur)$/;mt.extend(mt.event,{trigger:function(e,i,n,o){var s,a,l,r,c,h,d,p=[n||it],u=ht.call(e,"type")?e.type:e,m=ht.call(e,"namespace")?e.namespace.split("."):[];if(a=l=n=n||it,3!==n.nodeType&&8!==n.nodeType&&!we.test(u+mt.event.triggered)&&(u.indexOf(".")>-1&&(m=u.split("."),u=m.shift(),m.sort()),c=u.indexOf(":")<0&&"on"+u,e=e[mt.expando]?e:new mt.Event(u,"object"==typeof e&&e),e.isTrigger=o?2:3,e.namespace=m.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),i=null==i?[e]:mt.makeArray(i,[e]),d=mt.event.special[u]||{},o||!d.trigger||!1!==d.trigger.apply(n,i))){if(!o&&!d.noBubble&&!mt.isWindow(n)){for(r=d.delegateType||u,we.test(r+u)||(a=a.parentNode);a;a=a.parentNode)p.push(a),l=a;l===(n.ownerDocument||it)&&p.push(l.defaultView||l.parentWindow||t)}for(s=0;(a=p[s++])&&!e.isPropagationStopped();)e.type=s>1?r:d.bindType||u,h=(Ft.get(a,"events")||{})[e.type]&&Ft.get(a,"handle"),h&&h.apply(a,i),(h=c&&a[c])&&h.apply&&Dt(a)&&(e.result=h.apply(a,i),!1===e.result&&e.preventDefault());return e.type=u,o||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(p.pop(),i)||!Dt(n)||c&&mt.isFunction(n[u])&&!mt.isWindow(n)&&(l=n[c],l&&(n[c]=null),mt.event.triggered=u,n[u](),mt.event.triggered=void 0,l&&(n[c]=l)),e.result}},simulate:function(t,e,i){var n=mt.extend(new mt.Event,i,{type:t,isSimulated:!0});mt.event.trigger(n,null,e)}}),mt.fn.extend({trigger:function(t,e){return this.each(function(){mt.event.trigger(t,e,this)})},triggerHandler:function(t,e){var i=this[0];if(i)return mt.event.trigger(t,e,i,!0)}}),mt.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(t,e){mt.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),mt.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),ut.focusin="onfocusin"in t,ut.focusin||mt.each({focus:"focusin",blur:"focusout"},function(t,e){var i=function(t){mt.event.simulate(e,t.target,mt.event.fix(t))};mt.event.special[e]={setup:function(){var n=this.ownerDocument||this,o=Ft.access(n,e);o||n.addEventListener(t,i,!0),Ft.access(n,e,(o||0)+1)},teardown:function(){var n=this.ownerDocument||this,o=Ft.access(n,e)-1;o?Ft.access(n,e,o):(n.removeEventListener(t,i,!0),Ft.remove(n,e))}}});var xe=t.location,Se=mt.now(),Te=/\?/;mt.parseXML=function(e){var i;if(!e||"string"!=typeof e)return null;try{i=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){i=void 0}return i&&!i.getElementsByTagName("parsererror").length||mt.error("Invalid XML: "+e),i};var Ae=/\[\]$/,ke=/\r?\n/g,Ie=/^(?:submit|button|image|reset|file)$/i,Pe=/^(?:input|select|textarea|keygen)/i;mt.param=function(t,e){var i,n=[],o=function(t,e){var i=mt.isFunction(e)?e():e;n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==i?"":i)};if(Array.isArray(t)||t.jquery&&!mt.isPlainObject(t))mt.each(t,function(){o(this.name,this.value)});else for(i in t)Y(i,t[i],e,o);return n.join("&")},mt.fn.extend({serialize:function(){return mt.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=mt.prop(this,"elements");return t?mt.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!mt(this).is(":disabled")&&Pe.test(this.nodeName)&&!Ie.test(t)&&(this.checked||!Gt.test(t))}).map(function(t,e){var i=mt(this).val();return null==i?null:Array.isArray(i)?mt.map(i,function(t){return{name:e.name,value:t.replace(ke,"\r\n")}}):{name:e.name,value:i.replace(ke,"\r\n")}}).get()}});var Ee=/%20/g,Me=/#.*$/,Ue=/([?&])_=[^&]*/,De=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fe=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Be=/^(?:GET|HEAD)$/,Le=/^\/\//,Ve={},Re={},Oe="*/".concat("*"),Ne=it.createElement("a");Ne.href=xe.href,mt.extend({active:0,lastModified:{},etag:{},ajaxSettings:{ url:xe.href,type:"GET",isLocal:Fe.test(xe.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Oe,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":mt.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?J(J(t,mt.ajaxSettings),e):J(mt.ajaxSettings,t)},ajaxPrefilter:X(Ve),ajaxTransport:X(Re),ajax:function(e,i){function n(e,i,n,l){var c,p,u,_,y,w=i;h||(h=!0,r&&t.clearTimeout(r),o=void 0,a=l||"",x.readyState=e>0?4:0,c=e>=200&&e<300||304===e,n&&(_=Q(m,x,n)),_=tt(m,_,x,c),c?(m.ifModified&&(y=x.getResponseHeader("Last-Modified"),y&&(mt.lastModified[s]=y),(y=x.getResponseHeader("etag"))&&(mt.etag[s]=y)),204===e||"HEAD"===m.type?w="nocontent":304===e?w="notmodified":(w=_.state,p=_.data,u=_.error,c=!u)):(u=w,!e&&w||(w="error",e<0&&(e=0))),x.status=e,x.statusText=(i||w)+"",c?b.resolveWith(g,[p,w,x]):b.rejectWith(g,[x,w,u]),x.statusCode(v),v=void 0,d&&f.trigger(c?"ajaxSuccess":"ajaxError",[x,m,c?p:u]),C.fireWith(g,[x,w]),d&&(f.trigger("ajaxComplete",[x,m]),--mt.active||mt.event.trigger("ajaxStop")))}"object"==typeof e&&(i=e,e=void 0),i=i||{};var o,s,a,l,r,c,h,d,p,u,m=mt.ajaxSetup({},i),g=m.context||m,f=m.context&&(g.nodeType||g.jquery)?mt(g):mt.event,b=mt.Deferred(),C=mt.Callbacks("once memory"),v=m.statusCode||{},_={},y={},w="canceled",x={readyState:0,getResponseHeader:function(t){var e;if(h){if(!l)for(l={};e=De.exec(a);)l[e[1].toLowerCase()]=e[2];e=l[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return h?a:null},setRequestHeader:function(t,e){return null==h&&(t=y[t.toLowerCase()]=y[t.toLowerCase()]||t,_[t]=e),this},overrideMimeType:function(t){return null==h&&(m.mimeType=t),this},statusCode:function(t){var e;if(t)if(h)x.always(t[x.status]);else for(e in t)v[e]=[v[e],t[e]];return this},abort:function(t){var e=t||w;return o&&o.abort(e),n(0,e),this}};if(b.promise(x),m.url=((e||m.url||xe.href)+"").replace(Le,xe.protocol+"//"),m.type=i.method||i.type||m.method||m.type,m.dataTypes=(m.dataType||"*").toLowerCase().match(Pt)||[""],null==m.crossDomain){c=it.createElement("a");try{c.href=m.url,c.href=c.href,m.crossDomain=Ne.protocol+"//"+Ne.host!=c.protocol+"//"+c.host}catch(t){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=mt.param(m.data,m.traditional)),Z(Ve,m,i,x),h)return x;d=mt.event&&m.global,d&&0==mt.active++&&mt.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!Be.test(m.type),s=m.url.replace(Me,""),m.hasContent?m.data&&m.processData&&0===(m.contentType||"").indexOf("application/x-www-form-urlencoded")&&(m.data=m.data.replace(Ee,"+")):(u=m.url.slice(s.length),m.data&&(s+=(Te.test(s)?"&":"?")+m.data,delete m.data),!1===m.cache&&(s=s.replace(Ue,"$1"),u=(Te.test(s)?"&":"?")+"_="+Se+++u),m.url=s+u),m.ifModified&&(mt.lastModified[s]&&x.setRequestHeader("If-Modified-Since",mt.lastModified[s]),mt.etag[s]&&x.setRequestHeader("If-None-Match",mt.etag[s])),(m.data&&m.hasContent&&!1!==m.contentType||i.contentType)&&x.setRequestHeader("Content-Type",m.contentType),x.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+Oe+"; q=0.01":""):m.accepts["*"]);for(p in m.headers)x.setRequestHeader(p,m.headers[p]);if(m.beforeSend&&(!1===m.beforeSend.call(g,x,m)||h))return x.abort();if(w="abort",C.add(m.complete),x.done(m.success),x.fail(m.error),o=Z(Re,m,i,x)){if(x.readyState=1,d&&f.trigger("ajaxSend",[x,m]),h)return x;m.async&&m.timeout>0&&(r=t.setTimeout(function(){x.abort("timeout")},m.timeout));try{h=!1,o.send(_,n)}catch(t){if(h)throw t;n(-1,t)}}else n(-1,"No Transport");return x},getJSON:function(t,e,i){return mt.get(t,e,i,"json")},getScript:function(t,e){return mt.get(t,void 0,e,"script")}}),mt.each(["get","post"],function(t,e){mt[e]=function(t,i,n,o){return mt.isFunction(i)&&(o=o||n,n=i,i=void 0),mt.ajax(mt.extend({url:t,type:e,dataType:o,data:i,success:n},mt.isPlainObject(t)&&t))}}),mt._evalUrl=function(t){return mt.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},mt.fn.extend({wrapAll:function(t){var e;return this[0]&&(mt.isFunction(t)&&(t=t.call(this[0])),e=mt(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return mt.isFunction(t)?this.each(function(e){mt(this).wrapInner(t.call(this,e))}):this.each(function(){var e=mt(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=mt.isFunction(t);return this.each(function(i){mt(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(t){return this.parent(t).not("body").each(function(){mt(this).replaceWith(this.childNodes)}),this}}),mt.expr.pseudos.hidden=function(t){return!mt.expr.pseudos.visible(t)},mt.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},mt.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var He={0:200,1223:204},$e=mt.ajaxSettings.xhr();ut.cors=!!$e&&"withCredentials"in $e,ut.ajax=$e=!!$e,mt.ajaxTransport(function(e){var i,n;if(ut.cors||$e&&!e.crossDomain)return{send:function(o,s){var a,l=e.xhr();if(l.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)l[a]=e.xhrFields[a];e.mimeType&&l.overrideMimeType&&l.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(a in o)l.setRequestHeader(a,o[a]);i=function(t){return function(){i&&(i=n=l.onload=l.onerror=l.onabort=l.onreadystatechange=null,"abort"===t?l.abort():"error"===t?"number"!=typeof l.status?s(0,"error"):s(l.status,l.statusText):s(He[l.status]||l.status,l.statusText,"text"!==(l.responseType||"text")||"string"!=typeof l.responseText?{binary:l.response}:{text:l.responseText},l.getAllResponseHeaders()))}},l.onload=i(),n=l.onerror=i("error"),void 0!==l.onabort?l.onabort=n:l.onreadystatechange=function(){4===l.readyState&&t.setTimeout(function(){i&&n()})},i=i("abort");try{l.send(e.hasContent&&e.data||null)}catch(t){if(i)throw t}},abort:function(){i&&i()}}}),mt.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=!1)}),mt.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return mt.globalEval(t),t}}}),mt.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),mt.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,o){e=mt(" + - \ No newline at end of file + diff --git a/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js b/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js index 8e2af06f9..928c3ab25 100644 --- a/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js +++ b/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js @@ -10,7 +10,7 @@ i||ke.test(t)?n(t,o):Y(t+"["+("object"==typeof o&&null!=o?e:"")+"]",o,i,n)});els t.console&&t.console.warn&&e&&Pt.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,i)},ut.readyException=function(e){t.setTimeout(function(){throw e})};var Mt=ut.Deferred();ut.fn.ready=function(t){return Mt.then(t).catch(function(t){ut.readyException(t)}),this},ut.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--ut.readyWait:ut.isReady)||(ut.isReady=!0,!0!==t&&--ut.readyWait>0||Mt.resolveWith(it,[ut]))}}),ut.ready.then=Mt.then,"complete"===it.readyState||"loading"!==it.readyState&&!it.documentElement.doScroll?t.setTimeout(ut.ready):(it.addEventListener("DOMContentLoaded",d),t.addEventListener("load",d));var Dt=function(t,e,i,n,o,s,a){var l=0,r=t.length,c=null==i;if("object"===ut.type(i)){o=!0;for(l in i)Dt(t,e,l,i[l],!0,s,a)}else if(void 0!==n&&(o=!0,ut.isFunction(n)||(a=!0),c&&(a?(e.call(t,n),e=null):(c=e,e=function(t,e,i){return c.call(ut(t),i)})),e))for(;l1,null,!0)},removeData:function(t){return this.each(function(){Vt.remove(this,t)})}}),ut.extend({queue:function(t,e,i){var n;if(t)return e=(e||"fx")+"queue",n=Ut.get(t,e),i&&(!n||Array.isArray(i)?n=Ut.access(t,e,ut.makeArray(i)):n.push(i)),n||[]},dequeue:function(t,e){e=e||"fx";var i=ut.queue(t,e),n=i.length,o=i.shift(),s=ut._queueHooks(t,e),a=function(){ut.dequeue(t,e)};"inprogress"===o&&(o=i.shift(),n--),o&&("fx"===e&&i.unshift("inprogress"),delete s.stop,o.call(t,a,s)),!n&&s&&s.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return Ut.get(t,i)||Ut.access(t,i,{empty:ut.Callbacks("once memory").add(function(){Ut.remove(t,[e+"queue",i])})})}}),ut.fn.extend({queue:function(t,e){var i=2;return"string"!=typeof t&&(e=t,t="fx",i--),arguments.length\x20\t\r\n\f]+)/i,Wt=/^$|\/(?:java|ecma)script/i,qt={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};qt.optgroup=qt.option,qt.tbody=qt.tfoot=qt.colgroup=qt.caption=qt.thead,qt.th=qt.td;var Kt=/<|&#?\w+;/;!function(){var t=it.createDocumentFragment(),e=t.appendChild(it.createElement("div")),i=it.createElement("input");i.setAttribute("type","radio"),i.setAttribute("checked","checked"),i.setAttribute("name","t"),e.appendChild(i),mt.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",mt.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Yt=it.documentElement,Xt=/^key/,Jt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Zt=/^([^.]*)(?:\.(.+)|)/;ut.event={global:{},add:function(t,e,i,n,o){var s,a,l,r,c,h,d,p,m,u,g,b=Ut.get(t);if(b)for(i.handler&&(s=i,i=s.handler,o=s.selector),o&&ut.find.matchesSelector(Yt,o),i.guid||(i.guid=ut.guid++),(r=b.events)||(r=b.events={}),(a=b.handle)||(a=b.handle=function(e){return void 0!==ut&&ut.event.triggered!==e.type?ut.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(Et)||[""],c=e.length;c--;)l=Zt.exec(e[c])||[],m=g=l[1],u=(l[2]||"").split(".").sort(),m&&(d=ut.event.special[m]||{},m=(o?d.delegateType:d.bindType)||m,d=ut.event.special[m]||{},h=ut.extend({type:m,origType:g,data:n,handler:i,guid:i.guid,selector:o,needsContext:o&&ut.expr.match.needsContext.test(o),namespace:u.join(".")},s),(p=r[m])||(p=r[m]=[],p.delegateCount=0,d.setup&&!1!==d.setup.call(t,n,u,a)||t.addEventListener&&t.addEventListener(m,a)),d.add&&(d.add.call(t,h),h.handler.guid||(h.handler.guid=i.guid)),o?p.splice(p.delegateCount++,0,h):p.push(h),ut.event.global[m]=!0)},remove:function(t,e,i,n,o){var s,a,l,r,c,h,d,p,m,u,g,b=Ut.hasData(t)&&Ut.get(t);if(b&&(r=b.events)){for(e=(e||"").match(Et)||[""],c=e.length;c--;)if(l=Zt.exec(e[c])||[],m=g=l[1],u=(l[2]||"").split(".").sort(),m){for(d=ut.event.special[m]||{},m=(n?d.delegateType:d.bindType)||m,p=r[m]||[],l=l[2]&&new RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=s=p.length;s--;)h=p[s],!o&&g!==h.origType||i&&i.guid!==h.guid||l&&!l.test(h.namespace)||n&&n!==h.selector&&("**"!==n||!h.selector)||(p.splice(s,1),h.selector&&p.delegateCount--,d.remove&&d.remove.call(t,h));a&&!p.length&&(d.teardown&&!1!==d.teardown.call(t,u,b.handle)||ut.removeEvent(t,m,b.handle),delete r[m])}else for(m in r)ut.event.remove(t,m+e[c],i,n,!0);ut.isEmptyObject(r)&&Ut.remove(t,"handle events")}},dispatch:function(t){var e,i,n,o,s,a,l=ut.event.fix(t),r=new Array(arguments.length),c=(Ut.get(this,"events")||{})[l.type]||[],h=ut.event.special[l.type]||{};for(r[0]=l,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(s=[],a={},i=0;i-1:ut.find(o,this,null,[c]).length),a[o]&&s.push(n);s.length&&l.push({elem:c,handlers:s})}return c=this,r\x20\t\r\n\f]*)[^>]*)\/>/gi,te=/\s*$/g;ut.extend({htmlPrefilter:function(t){return t.replace(Qt,"<$1>")},clone:function(t,e,i){var n,o,s,a,l=t.cloneNode(!0),r=ut.contains(t.ownerDocument,t);if(!(mt.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||ut.isXMLDoc(t)))for(a=C(l),s=C(t),n=0,o=s.length;n0&&v(a,!r&&C(t,"script")),l},cleanData:function(t){for(var e,i,n,o=ut.event.special,s=0;void 0!==(i=t[s]);s++)if(Ft(i)){if(e=i[Ut.expando]){if(e.events)for(n in e.events)o[n]?ut.event.remove(i,n):ut.removeEvent(i,n,e.handle);i[Ut.expando]=void 0}i[Vt.expando]&&(i[Vt.expando]=void 0)}}}),ut.fn.extend({detach:function(t){return M(this,t,!0)},remove:function(t){return M(this,t)},text:function(t){return Dt(this,function(t){return void 0===t?ut.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return P(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){A(this,t).appendChild(t)}})},prepend:function(){return P(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=A(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return P(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return P(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(ut.cleanData(C(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return ut.clone(this,t,e)})},html:function(t){return Dt(this,function(t){var e=this[0]||{},i=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!te.test(t)&&!qt[(jt.exec(t)||["",""])[1].toLowerCase()]){t=ut.htmlPrefilter(t);try{for(;i1)}}),ut.Tween=N,N.prototype={constructor:N,init:function(t,e,i,n,o,s){this.elem=t,this.prop=i,this.easing=o||ut.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=s||(ut.cssNumber[i]?"":"px")},cur:function(){var t=N.propHooks[this.prop];return t&&t.get?t.get(this):N.propHooks._default.get(this)},run:function(t){var e,i=N.propHooks[this.prop];return this.options.duration?this.pos=e=ut.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):N.propHooks._default.set(this),this}},N.prototype.init.prototype=N.prototype,N.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=ut.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){ut.fx.step[t.prop]?ut.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[ut.cssProps[t.prop]]&&!ut.cssHooks[t.prop]?t.elem[t.prop]=t.now:ut.style(t.elem,t.prop,t.now+t.unit)}}},N.propHooks.scrollTop=N.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},ut.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},ut.fx=N.prototype.init,ut.fx.step={};var me,ue,ge=/^(?:toggle|show|hide)$/,be=/queueHooks$/;ut.Animation=ut.extend(W,{tweeners:{"*":[function(t,e){var i=this.createTween(t,e);return g(i.elem,t,Nt.exec(e),i),i}]},tweener:function(t,e){ut.isFunction(t)?(e=t,t=["*"]):t=t.match(Et);for(var i,n=0,o=t.length;n1)},removeAttr:function(t){return this.each(function(){ut.removeAttr(this,t)})}}),ut.extend({attr:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===t.getAttribute?ut.prop(t,e,i):(1===s&&ut.isXMLDoc(t)||(o=ut.attrHooks[e.toLowerCase()]||(ut.expr.match.bool.test(e)?fe:void 0)),void 0!==i?null===i?void ut.removeAttr(t,e):o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:(t.setAttribute(e,i+""),i):o&&"get"in o&&null!==(n=o.get(t,e))?n:(n=ut.find.attr(t,e),null==n?void 0:n))},attrHooks:{type:{set:function(t,e){if(!mt.radioValue&&"radio"===e&&o(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},removeAttr:function(t,e){var i,n=0,o=e&&e.match(Et);if(o&&1===t.nodeType)for(;i=o[n++];)t.removeAttribute(i)}}),fe={set:function(t,e,i){return!1===e?ut.removeAttr(t,i):t.setAttribute(i,i),i}},ut.each(ut.expr.match.bool.source.match(/\w+/g),function(t,e){var i=Ce[e]||ut.find.attr;Ce[e]=function(t,e,n){var o,s,a=e.toLowerCase();return n||(s=Ce[a],Ce[a]=o,o=null!=i(t,e,n)?a:null,Ce[a]=s),o}});var ve=/^(?:input|select|textarea|button)$/i,_e=/^(?:a|area)$/i;ut.fn.extend({prop:function(t,e){return Dt(this,ut.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[ut.propFix[t]||t]})}}),ut.extend({prop:function(t,e,i){var n,o,s=t.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&ut.isXMLDoc(t)||(e=ut.propFix[e]||e,o=ut.propHooks[e]),void 0!==i?o&&"set"in o&&void 0!==(n=o.set(t,i,e))?n:t[e]=i:o&&"get"in o&&null!==(n=o.get(t,e))?n:t[e]},propHooks:{tabIndex:{get:function(t){var e=ut.find.attr(t,"tabindex");return e?parseInt(e,10):ve.test(t.nodeName)||_e.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),mt.optSelected||(ut.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),ut.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ut.propFix[this.toLowerCase()]=this}),ut.fn.extend({addClass:function(t){var e,i,n,o,s,a,l,r=0;if(ut.isFunction(t))return this.each(function(e){ut(this).addClass(t.call(this,e,K(this)))});if("string"==typeof t&&t)for(e=t.match(Et)||[];i=this[r++];)if(o=K(i),n=1===i.nodeType&&" "+q(o)+" "){for(a=0;s=e[a++];)n.indexOf(" "+s+" ")<0&&(n+=s+" ");l=q(n),o!==l&&i.setAttribute("class",l)}return this},removeClass:function(t){var e,i,n,o,s,a,l,r=0;if(ut.isFunction(t))return this.each(function(e){ut(this).removeClass(t.call(this,e,K(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(Et)||[];i=this[r++];)if(o=K(i),n=1===i.nodeType&&" "+q(o)+" "){for(a=0;s=e[a++];)for(;n.indexOf(" "+s+" ")>-1;)n=n.replace(" "+s+" "," ");l=q(n),o!==l&&i.setAttribute("class",l)}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):ut.isFunction(t)?this.each(function(i){ut(this).toggleClass(t.call(this,i,K(this),e),e)}):this.each(function(){var e,n,o,s;if("string"===i)for(n=0,o=ut(this),s=t.match(Et)||[];e=s[n++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==i||(e=K(this),e&&Ut.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":Ut.get(this,"__className__")||""))})},hasClass:function(t){var e,i,n=0;for(e=" "+t+" ";i=this[n++];)if(1===i.nodeType&&(" "+q(K(i))+" ").indexOf(e)>-1)return!0;return!1}});var ye=/\r/g;ut.fn.extend({val:function(t){var e,i,n,o=this[0];{if(arguments.length)return n=ut.isFunction(t),this.each(function(i){var o;1===this.nodeType&&(o=n?t.call(this,i,ut(this).val()):t,null==o?o="":"number"==typeof o?o+="":Array.isArray(o)&&(o=ut.map(o,function(t){return null==t?"":t+""})),(e=ut.valHooks[this.type]||ut.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))});if(o)return(e=ut.valHooks[o.type]||ut.valHooks[o.nodeName.toLowerCase()])&&"get"in e&&void 0!==(i=e.get(o,"value"))?i:(i=o.value,"string"==typeof i?i.replace(ye,""):null==i?"":i)}}}),ut.extend({valHooks:{option:{get:function(t){var e=ut.find.attr(t,"value");return null!=e?e:q(ut.text(t))}},select:{get:function(t){var e,i,n,s=t.options,a=t.selectedIndex,l="select-one"===t.type,r=l?null:[],c=l?a+1:s.length;for(n=a<0?c:l?a:0;n-1)&&(i=!0);return i||(t.selectedIndex=-1),s}}}}),ut.each(["radio","checkbox"],function(){ut.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=ut.inArray(ut(t).val(),e)>-1}},mt.checkOn||(ut.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var xe=/^(?:focusinfocus|focusoutblur)$/;ut.extend(ut.event,{trigger:function(e,i,n,o){var s,a,l,r,c,h,d,p=[n||it],m=ht.call(e,"type")?e.type:e,u=ht.call(e,"namespace")?e.namespace.split("."):[];if(a=l=n=n||it,3!==n.nodeType&&8!==n.nodeType&&!xe.test(m+ut.event.triggered)&&(m.indexOf(".")>-1&&(u=m.split("."),m=u.shift(),u.sort()),c=m.indexOf(":")<0&&"on"+m,e=e[ut.expando]?e:new ut.Event(m,"object"==typeof e&&e),e.isTrigger=o?2:3,e.namespace=u.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),i=null==i?[e]:ut.makeArray(i,[e]),d=ut.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(n,i))){if(!o&&!d.noBubble&&!ut.isWindow(n)){for(r=d.delegateType||m,xe.test(r+m)||(a=a.parentNode);a;a=a.parentNode)p.push(a),l=a;l===(n.ownerDocument||it)&&p.push(l.defaultView||l.parentWindow||t)}for(s=0;(a=p[s++])&&!e.isPropagationStopped();)e.type=s>1?r:d.bindType||m,h=(Ut.get(a,"events")||{})[e.type]&&Ut.get(a,"handle"),h&&h.apply(a,i),(h=c&&a[c])&&h.apply&&Ft(a)&&(e.result=h.apply(a,i),!1===e.result&&e.preventDefault());return e.type=m,o||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(p.pop(),i)||!Ft(n)||c&&ut.isFunction(n[m])&&!ut.isWindow(n)&&(l=n[c],l&&(n[c]=null),ut.event.triggered=m,n[m](),ut.event.triggered=void 0,l&&(n[c]=l)),e.result}},simulate:function(t,e,i){var n=ut.extend(new ut.Event,i,{type:t,isSimulated:!0});ut.event.trigger(n,null,e)}}),ut.fn.extend({trigger:function(t,e){return this.each(function(){ut.event.trigger(t,e,this)})},triggerHandler:function(t,e){var i=this[0];if(i)return ut.event.trigger(t,e,i,!0)}}),ut.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(t,e){ut.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),ut.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),mt.focusin="onfocusin"in t,mt.focusin||ut.each({focus:"focusin",blur:"focusout"},function(t,e){var i=function(t){ut.event.simulate(e,t.target,ut.event.fix(t))};ut.event.special[e]={setup:function(){var n=this.ownerDocument||this,o=Ut.access(n,e);o||n.addEventListener(t,i,!0),Ut.access(n,e,(o||0)+1)},teardown:function(){var n=this.ownerDocument||this,o=Ut.access(n,e)-1;o?Ut.access(n,e,o):(n.removeEventListener(t,i,!0),Ut.remove(n,e))}}});var we=t.location,Se=ut.now(),Ae=/\?/;ut.parseXML=function(e){var i;if(!e||"string"!=typeof e)return null;try{i=(new t.DOMParser).parseFromString(e,"text/xml")}catch(t){i=void 0}return i&&!i.getElementsByTagName("parsererror").length||ut.error("Invalid XML: "+e),i};var ke=/\[\]$/,Te=/\r?\n/g,Ie=/^(?:submit|button|image|reset|file)$/i,Ee=/^(?:input|select|textarea|keygen)/i;ut.param=function(t,e){var i,n=[],o=function(t,e){var i=ut.isFunction(e)?e():e;n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==i?"":i)};if(Array.isArray(t)||t.jquery&&!ut.isPlainObject(t))ut.each(t,function(){o(this.name,this.value)});else for(i in t)Y(i,t[i],e,o);return n.join("&")},ut.fn.extend({serialize:function(){return ut.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=ut.prop(this,"elements");return t?ut.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!ut(this).is(":disabled")&&Ee.test(this.nodeName)&&!Ie.test(t)&&(this.checked||!Gt.test(t))}).map(function(t,e){var i=ut(this).val();return null==i?null:Array.isArray(i)?ut.map(i,function(t){return{name:e.name,value:t.replace(Te,"\r\n")}}):{name:e.name,value:i.replace(Te,"\r\n")}}).get()}});var Pe=/%20/g,Me=/#.*$/,De=/([?&])_=[^&]*/,Fe=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ue=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ve=/^(?:GET|HEAD)$/,Re=/^\/\//,Be={},Le={},Ne="*/".concat("*"),Oe=it.createElement("a");Oe.href=we.href,ut.extend({active:0,lastModified:{},etag:{},ajaxSettings:{ url:we.href,type:"GET",isLocal:Ue.test(we.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ne,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ut.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?Z(Z(t,ut.ajaxSettings),e):Z(ut.ajaxSettings,t)},ajaxPrefilter:X(Be),ajaxTransport:X(Le),ajax:function(e,i){function n(e,i,n,l){var c,p,m,_,y,x=i;h||(h=!0,r&&t.clearTimeout(r),o=void 0,a=l||"",w.readyState=e>0?4:0,c=e>=200&&e<300||304===e,n&&(_=Q(u,w,n)),_=tt(u,_,w,c),c?(u.ifModified&&(y=w.getResponseHeader("Last-Modified"),y&&(ut.lastModified[s]=y),(y=w.getResponseHeader("etag"))&&(ut.etag[s]=y)),204===e||"HEAD"===u.type?x="nocontent":304===e?x="notmodified":(x=_.state,p=_.data,m=_.error,c=!m)):(m=x,!e&&x||(x="error",e<0&&(e=0))),w.status=e,w.statusText=(i||x)+"",c?f.resolveWith(g,[p,x,w]):f.rejectWith(g,[w,x,m]),w.statusCode(v),v=void 0,d&&b.trigger(c?"ajaxSuccess":"ajaxError",[w,u,c?p:m]),C.fireWith(g,[w,x]),d&&(b.trigger("ajaxComplete",[w,u]),--ut.active||ut.event.trigger("ajaxStop")))}"object"==typeof e&&(i=e,e=void 0),i=i||{};var o,s,a,l,r,c,h,d,p,m,u=ut.ajaxSetup({},i),g=u.context||u,b=u.context&&(g.nodeType||g.jquery)?ut(g):ut.event,f=ut.Deferred(),C=ut.Callbacks("once memory"),v=u.statusCode||{},_={},y={},x="canceled",w={readyState:0,getResponseHeader:function(t){var e;if(h){if(!l)for(l={};e=Fe.exec(a);)l[e[1].toLowerCase()]=e[2];e=l[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return h?a:null},setRequestHeader:function(t,e){return null==h&&(t=y[t.toLowerCase()]=y[t.toLowerCase()]||t,_[t]=e),this},overrideMimeType:function(t){return null==h&&(u.mimeType=t),this},statusCode:function(t){var e;if(t)if(h)w.always(t[w.status]);else for(e in t)v[e]=[v[e],t[e]];return this},abort:function(t){var e=t||x;return o&&o.abort(e),n(0,e),this}};if(f.promise(w),u.url=((e||u.url||we.href)+"").replace(Re,we.protocol+"//"),u.type=i.method||i.type||u.method||u.type,u.dataTypes=(u.dataType||"*").toLowerCase().match(Et)||[""],null==u.crossDomain){c=it.createElement("a");try{c.href=u.url,c.href=c.href,u.crossDomain=Oe.protocol+"//"+Oe.host!=c.protocol+"//"+c.host}catch(t){u.crossDomain=!0}}if(u.data&&u.processData&&"string"!=typeof u.data&&(u.data=ut.param(u.data,u.traditional)),J(Be,u,i,w),h)return w;d=ut.event&&u.global,d&&0==ut.active++&&ut.event.trigger("ajaxStart"),u.type=u.type.toUpperCase(),u.hasContent=!Ve.test(u.type),s=u.url.replace(Me,""),u.hasContent?u.data&&u.processData&&0===(u.contentType||"").indexOf("application/x-www-form-urlencoded")&&(u.data=u.data.replace(Pe,"+")):(m=u.url.slice(s.length),u.data&&(s+=(Ae.test(s)?"&":"?")+u.data,delete u.data),!1===u.cache&&(s=s.replace(De,"$1"),m=(Ae.test(s)?"&":"?")+"_="+Se+++m),u.url=s+m),u.ifModified&&(ut.lastModified[s]&&w.setRequestHeader("If-Modified-Since",ut.lastModified[s]),ut.etag[s]&&w.setRequestHeader("If-None-Match",ut.etag[s])),(u.data&&u.hasContent&&!1!==u.contentType||i.contentType)&&w.setRequestHeader("Content-Type",u.contentType),w.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+Ne+"; q=0.01":""):u.accepts["*"]);for(p in u.headers)w.setRequestHeader(p,u.headers[p]);if(u.beforeSend&&(!1===u.beforeSend.call(g,w,u)||h))return w.abort();if(x="abort",C.add(u.complete),w.done(u.success),w.fail(u.error),o=J(Le,u,i,w)){if(w.readyState=1,d&&b.trigger("ajaxSend",[w,u]),h)return w;u.async&&u.timeout>0&&(r=t.setTimeout(function(){w.abort("timeout")},u.timeout));try{h=!1,o.send(_,n)}catch(t){if(h)throw t;n(-1,t)}}else n(-1,"No Transport");return w},getJSON:function(t,e,i){return ut.get(t,e,i,"json")},getScript:function(t,e){return ut.get(t,void 0,e,"script")}}),ut.each(["get","post"],function(t,e){ut[e]=function(t,i,n,o){return ut.isFunction(i)&&(o=o||n,n=i,i=void 0),ut.ajax(ut.extend({url:t,type:e,dataType:o,data:i,success:n},ut.isPlainObject(t)&&t))}}),ut._evalUrl=function(t){return ut.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},ut.fn.extend({wrapAll:function(t){var e;return this[0]&&(ut.isFunction(t)&&(t=t.call(this[0])),e=ut(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return ut.isFunction(t)?this.each(function(e){ut(this).wrapInner(t.call(this,e))}):this.each(function(){var e=ut(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=ut.isFunction(t);return this.each(function(i){ut(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(t){return this.parent(t).not("body").each(function(){ut(this).replaceWith(this.childNodes)}),this}}),ut.expr.pseudos.hidden=function(t){return!ut.expr.pseudos.visible(t)},ut.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},ut.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(t){}};var He={0:200,1223:204},$e=ut.ajaxSettings.xhr();mt.cors=!!$e&&"withCredentials"in $e,mt.ajax=$e=!!$e,ut.ajaxTransport(function(e){var i,n;if(mt.cors||$e&&!e.crossDomain)return{send:function(o,s){var a,l=e.xhr();if(l.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)l[a]=e.xhrFields[a];e.mimeType&&l.overrideMimeType&&l.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(a in o)l.setRequestHeader(a,o[a]);i=function(t){return function(){i&&(i=n=l.onload=l.onerror=l.onabort=l.onreadystatechange=null,"abort"===t?l.abort():"error"===t?"number"!=typeof l.status?s(0,"error"):s(l.status,l.statusText):s(He[l.status]||l.status,l.statusText,"text"!==(l.responseType||"text")||"string"!=typeof l.responseText?{binary:l.response}:{text:l.responseText},l.getAllResponseHeaders()))}},l.onload=i(),n=l.onerror=i("error"),void 0!==l.onabort?l.onabort=n:l.onreadystatechange=function(){4===l.readyState&&t.setTimeout(function(){i&&n()})},i=i("abort");try{l.send(e.hasContent&&e.data||null)}catch(t){if(i)throw t}},abort:function(){i&&i()}}}),ut.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=!1)}),ut.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return ut.globalEval(t),t}}}),ut.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),ut.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,o){e=ut(" + + - \ No newline at end of file + From 81ec2000406f2b8d64afdbcbba500be9e9d1120c Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 21 Oct 2020 15:53:01 +0200 Subject: [PATCH 33/43] New OO build to fix cache issues --- .../v2b/sdkjs/common/libfont/wasm/fonts.js | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/www/common/onlyoffice/v2b/sdkjs/common/libfont/wasm/fonts.js b/www/common/onlyoffice/v2b/sdkjs/common/libfont/wasm/fonts.js index 0d75c38e1..11de77631 100644 --- a/www/common/onlyoffice/v2b/sdkjs/common/libfont/wasm/fonts.js +++ b/www/common/onlyoffice/v2b/sdkjs/common/libfont/wasm/fonts.js @@ -23,43 +23,43 @@ TOTAL_STACK+")");if(Module["buffer"])buffer=Module["buffer"];else{if(typeof WebA continue}var func=callback.func;if(typeof func==="number")if(callback.arg===undefined)Module["dynCall_v"](func);else Module["dynCall_vi"](func,callback.arg);else func(callback.arg===undefined?null:callback.arg)}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[function(){window["AscFonts"].onLoadModule()}];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length)addOnPreRun(Module["preRun"].shift())}callRuntimeCallbacks(__ATPRERUN__)} function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length)addOnPostRun(Module["postRun"].shift())}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies= 0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"])Module["monitorRunDependencies"](runDependencies)}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"])Module["monitorRunDependencies"](runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled; -dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}var wasmBinaryFile="fonts.wasm";if(!isDataURI(wasmBinaryFile))wasmBinaryFile=locateFile(wasmBinaryFile);function getBinary(){try{if(Module["wasmBinary"])return new Uint8Array(Module["wasmBinary"]);if(Module["readBinary"])return Module["readBinary"](wasmBinaryFile); -else throw"both async and sync fetching of the wasm failed";}catch(err$0){abort(err$0)}}function getBinaryPromise2(){if(!Module["wasmBinary"]&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function")return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"])throw"failed to load wasm binary file at '"+wasmBinaryFile+"'";return response["arrayBuffer"]()}).catch(function(){return getBinary()});return new Promise(function(resolve,reject){resolve(getBinary())})} -function createWasm(env){var info={"env":env,"global":{"NaN":NaN,Infinity:Infinity},"global.Math":Math,"asm2wasm":asm2wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");if(Module["instantiateWasm"])try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}function receiveInstantiatedSource(output){receiveInstance(output["instance"])} -function instantiateArrayBuffer(receiver){getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}if(!Module["wasmBinary"]&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&typeof fetch==="function")WebAssembly.instantiateStreaming(fetch(wasmBinaryFile,{credentials:"same-origin"}),info).then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+ -reason);err("falling back to ArrayBuffer instantiation");instantiateArrayBuffer(receiveInstantiatedSource)});else instantiateArrayBuffer(receiveInstantiatedSource);return{}}Module["asm"]=function(global,env,providedBuffer){env["memory"]=wasmMemory;env["table"]=wasmTable=new WebAssembly.Table({"initial":814,"maximum":814,"element":"anyfunc"});env["__memory_base"]=1024;env["__table_base"]=0;var exports=createWasm(env);return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}}); -var ENV={};function ___buildEnvironment(environ){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV["USER"]=ENV["LOGNAME"]="web_user";ENV["PATH"]="/";ENV["PWD"]="/";ENV["HOME"]="/home/web_user";ENV["LANG"]="C.UTF-8";ENV["_"]=Module["thisProgram"];poolPtr=getMemory(TOTAL_ENV_SIZE);envPtr=getMemory(MAX_ENV_VALUES*4);HEAP32[envPtr>>2]=poolPtr;HEAP32[environ>>2]=envPtr}else{envPtr=HEAP32[environ>>2];poolPtr=HEAP32[envPtr>> -2]}var strings=[];var totalSize=0;for(var key in ENV)if(typeof ENV[key]==="string"){var line=key+"="+ENV[key];strings.push(line);totalSize+=line.length}if(totalSize>TOTAL_ENV_SIZE)throw new Error("Environment size exceeded TOTAL_ENV_SIZE!");var ptrSize=4;for(var i=0;i>2]=poolPtr;poolPtr+=line.length+1}HEAP32[envPtr+strings.length*ptrSize>>2]=0}function ___lock(){}var SYSCALLS={buffers:[null,[],[]],printChar:function(stream, -curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else buffer.push(curr)},varargs:0,get:function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(){var ret=UTF8ToString(SYSCALLS.get());return ret},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get();return low},getZero:function(){SYSCALLS.get()}};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream= -SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(), -iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=value;return value}function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname, -flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}} -function ___unlock(){}function _emscripten_get_heap_size(){return TOTAL_MEMORY}function _longjmp(env,value){_setThrew(env,value||1);throw"longjmp";}function _emscripten_longjmp(env,value){_longjmp(env,value)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function emscripten_realloc_buffer(size){var PAGE_MULTIPLE=65536;size=alignUp(size,PAGE_MULTIPLE);var old=Module["buffer"];var oldSize=old.byteLength;try{var result=wasmMemory.grow((size-oldSize)/65536);if(result!==(-1|0))return Module["buffer"]= -wasmMemory.buffer;else return null}catch(e){return null}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT)return false;var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0)return;preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running..."); -setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else doRun()}Module["run"]=run;function abort(what){if(Module["onAbort"])Module["onAbort"](what);if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else what="";ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info.";}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length> -0)Module["preInit"].pop()()}Module["noExitRuntime"]=true;run();window["AscFonts"]=window["AscFonts"]||{};var AscFonts=window["AscFonts"];AscFonts.CreateLibrary=function(){return Module["_ASC_FT_Init"]()};AscFonts.TT_INTERPRETER_VERSION_35=35;AscFonts.TT_INTERPRETER_VERSION_38=38;AscFonts.TT_INTERPRETER_VERSION_40=40;AscFonts.FT_Set_TrueType_HintProp=function(library,tt_interpreter){return Module["_ASC_FT_Set_TrueType_HintProp"](library,tt_interpreter)};AscFonts.CreateNativeStream=function(_typed_array){var _fontStreamPointer= -Module["_ASC_FT_Malloc"](_typed_array.size);Module["HEAP8"].set(_typed_array.data,_fontStreamPointer);return{asc_marker:true,data:_fontStreamPointer,len:_typed_array.size}};AscFonts.CreateNativeStreamByIndex=function(stream_index){var _stream_pos=AscFonts.g_fonts_streams[stream_index];if(_stream_pos&&true!==_stream_pos.asc_marker){var _native_stream=AscFonts.CreateNativeStream(AscFonts.g_fonts_streams[stream_index]);AscFonts.g_fonts_streams[stream_index]=null;AscFonts.g_fonts_streams[stream_index]= -_native_stream}};function CFaceInfo(){this.units_per_EM=0;this.ascender=0;this.descender=0;this.height=0;this.face_flags=0;this.num_faces=0;this.num_glyphs=0;this.num_charmaps=0;this.style_flags=0;this.face_index=0;this.family_name="";this.style_name="";this.os2_version=0;this.os2_usWeightClass=0;this.os2_fsSelection=0;this.os2_usWinAscent=0;this.os2_usWinDescent=0;this.os2_usDefaultChar=0;this.os2_sTypoAscender=0;this.os2_sTypoDescender=0;this.os2_sTypoLineGap=0;this.os2_ulUnicodeRange1=0;this.os2_ulUnicodeRange2= -0;this.os2_ulUnicodeRange3=0;this.os2_ulUnicodeRange4=0;this.os2_ulCodePageRange1=0;this.os2_ulCodePageRange2=0;this.os2_nSymbolic=0;this.header_yMin=0;this.header_yMax=0;this.monochromeSizes=[]}CFaceInfo.prototype.load=function(face){var _bufferPtr=Module["_ASC_FT_GetFaceInfo"](face);if(!_bufferPtr)return;var _len_buffer=Math.min(Module["HEAP8"].length-_bufferPtr>>2,250);var _buffer=new Int32Array(Module["HEAP8"].buffer,_bufferPtr,_len_buffer);var _index=0;this.units_per_EM=Math.abs(_buffer[_index++]); -this.ascender=_buffer[_index++];this.descender=_buffer[_index++];this.height=_buffer[_index++];this.face_flags=_buffer[_index++];this.num_faces=_buffer[_index++];this.num_glyphs=_buffer[_index++];this.num_charmaps=_buffer[_index++];this.style_flags=_buffer[_index++];this.face_index=_buffer[_index++];var c=_buffer[_index++];while(c){this.family_name+=String.fromCharCode(c);c=_buffer[_index++]}c=_buffer[_index++];while(c){this.style_name+=String.fromCharCode(c);c=_buffer[_index++]}this.os2_version= -_buffer[_index++];this.os2_usWeightClass=_buffer[_index++];this.os2_fsSelection=_buffer[_index++];this.os2_usWinAscent=_buffer[_index++];this.os2_usWinDescent=_buffer[_index++];this.os2_usDefaultChar=_buffer[_index++];this.os2_sTypoAscender=_buffer[_index++];this.os2_sTypoDescender=_buffer[_index++];this.os2_sTypoLineGap=_buffer[_index++];this.os2_ulUnicodeRange1=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulUnicodeRange2=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulUnicodeRange3= -AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulUnicodeRange4=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulCodePageRange1=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulCodePageRange2=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_nSymbolic=_buffer[_index++];this.header_yMin=_buffer[_index++];this.header_yMax=_buffer[_index++];var fixedSizesCount=_buffer[_index++];for(var i=0;i>2];var _buffer=new Int32Array(Module["HEAP8"].buffer,_bufferPtr,4*_len);var _info=new CGlyphMetrics;_info.bbox_xMin=_buffer[1]; -_info.bbox_yMin=_buffer[2];_info.bbox_xMax=_buffer[3];_info.bbox_yMax=_buffer[4];_info.width=_buffer[5];_info.height=_buffer[6];_info.horiAdvance=_buffer[7];_info.horiBearingX=_buffer[8];_info.horiBearingY=_buffer[9];_info.vertAdvance=_buffer[10];_info.vertBearingX=_buffer[11];_info.vertBearingY=_buffer[12];_info.linearHoriAdvance=_buffer[13];_info.linearVertAdvance=_buffer[14];if(vector_worker){painter.start(vector_worker);var _pos=15;while(_pos<_len)switch(_buffer[_pos++]){case 0:{painter._move_to(_buffer[_pos++], +dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}var wasmBinaryFile="fonts.wasm?"+window.CP_urlArgs;if(!isDataURI(wasmBinaryFile))wasmBinaryFile=locateFile(wasmBinaryFile);function getBinary(){try{if(Module["wasmBinary"])return new Uint8Array(Module["wasmBinary"]); +if(Module["readBinary"])return Module["readBinary"](wasmBinaryFile);else throw"both async and sync fetching of the wasm failed";}catch(err$0){abort(err$0)}}function getBinaryPromise2(){if(!Module["wasmBinary"]&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function")return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"])throw"failed to load wasm binary file at '"+wasmBinaryFile+"'";return response["arrayBuffer"]()}).catch(function(){return getBinary()}); +return new Promise(function(resolve,reject){resolve(getBinary())})}function createWasm(env){var info={"env":env,"global":{"NaN":NaN,Infinity:Infinity},"global.Math":Math,"asm2wasm":asm2wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");if(Module["instantiateWasm"])try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err("Module.instantiateWasm callback failed with error: "+ +e);return false}function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}if(!Module["wasmBinary"]&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&typeof fetch==="function")WebAssembly.instantiateStreaming(fetch(wasmBinaryFile, +{credentials:"same-origin"}),info).then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");instantiateArrayBuffer(receiveInstantiatedSource)});else instantiateArrayBuffer(receiveInstantiatedSource);return{}}Module["asm"]=function(global,env,providedBuffer){env["memory"]=wasmMemory;env["table"]=wasmTable=new WebAssembly.Table({"initial":814,"maximum":814,"element":"anyfunc"});env["__memory_base"]=1024;env["__table_base"]= +0;var exports=createWasm(env);return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}});var ENV={};function ___buildEnvironment(environ){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV["USER"]=ENV["LOGNAME"]="web_user";ENV["PATH"]="/";ENV["PWD"]="/";ENV["HOME"]="/home/web_user";ENV["LANG"]="C.UTF-8";ENV["_"]=Module["thisProgram"];poolPtr=getMemory(TOTAL_ENV_SIZE);envPtr=getMemory(MAX_ENV_VALUES* +4);HEAP32[envPtr>>2]=poolPtr;HEAP32[environ>>2]=envPtr}else{envPtr=HEAP32[environ>>2];poolPtr=HEAP32[envPtr>>2]}var strings=[];var totalSize=0;for(var key in ENV)if(typeof ENV[key]==="string"){var line=key+"="+ENV[key];strings.push(line);totalSize+=line.length}if(totalSize>TOTAL_ENV_SIZE)throw new Error("Environment size exceeded TOTAL_ENV_SIZE!");var ptrSize=4;for(var i=0;i>2]=poolPtr;poolPtr+=line.length+ +1}HEAP32[envPtr+strings.length*ptrSize>>2]=0}function ___lock(){}var SYSCALLS={buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else buffer.push(curr)},varargs:0,get:function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(){var ret=UTF8ToString(SYSCALLS.get());return ret},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get(); +return low},getZero:function(){SYSCALLS.get()}};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}} +function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+ +4)>>2];for(var j=0;j>2]=value;return value}function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs= +varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(); +FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___unlock(){}function _emscripten_get_heap_size(){return TOTAL_MEMORY}function _longjmp(env,value){_setThrew(env,value||1);throw"longjmp";}function _emscripten_longjmp(env,value){_longjmp(env,value)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function emscripten_realloc_buffer(size){var PAGE_MULTIPLE=65536;size=alignUp(size,PAGE_MULTIPLE);var old=Module["buffer"]; +var oldSize=old.byteLength;try{var result=wasmMemory.grow((size-oldSize)/65536);if(result!==(-1|0))return Module["buffer"]=wasmMemory.buffer;else return null}catch(e){return null}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT)return false;var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0)return;preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"](); +postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else doRun()}Module["run"]=run;function abort(what){if(Module["onAbort"])Module["onAbort"](what);if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else what="";ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info.";}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]= +[Module["preInit"]];while(Module["preInit"].length>0)Module["preInit"].pop()()}Module["noExitRuntime"]=true;run();window["AscFonts"]=window["AscFonts"]||{};var AscFonts=window["AscFonts"];AscFonts.CreateLibrary=function(){return Module["_ASC_FT_Init"]()};AscFonts.TT_INTERPRETER_VERSION_35=35;AscFonts.TT_INTERPRETER_VERSION_38=38;AscFonts.TT_INTERPRETER_VERSION_40=40;AscFonts.FT_Set_TrueType_HintProp=function(library,tt_interpreter){return Module["_ASC_FT_Set_TrueType_HintProp"](library,tt_interpreter)}; +AscFonts.CreateNativeStream=function(_typed_array){var _fontStreamPointer=Module["_ASC_FT_Malloc"](_typed_array.size);Module["HEAP8"].set(_typed_array.data,_fontStreamPointer);return{asc_marker:true,data:_fontStreamPointer,len:_typed_array.size}};AscFonts.CreateNativeStreamByIndex=function(stream_index){var _stream_pos=AscFonts.g_fonts_streams[stream_index];if(_stream_pos&&true!==_stream_pos.asc_marker){var _native_stream=AscFonts.CreateNativeStream(AscFonts.g_fonts_streams[stream_index]);AscFonts.g_fonts_streams[stream_index]= +null;AscFonts.g_fonts_streams[stream_index]=_native_stream}};function CFaceInfo(){this.units_per_EM=0;this.ascender=0;this.descender=0;this.height=0;this.face_flags=0;this.num_faces=0;this.num_glyphs=0;this.num_charmaps=0;this.style_flags=0;this.face_index=0;this.family_name="";this.style_name="";this.os2_version=0;this.os2_usWeightClass=0;this.os2_fsSelection=0;this.os2_usWinAscent=0;this.os2_usWinDescent=0;this.os2_usDefaultChar=0;this.os2_sTypoAscender=0;this.os2_sTypoDescender=0;this.os2_sTypoLineGap= +0;this.os2_ulUnicodeRange1=0;this.os2_ulUnicodeRange2=0;this.os2_ulUnicodeRange3=0;this.os2_ulUnicodeRange4=0;this.os2_ulCodePageRange1=0;this.os2_ulCodePageRange2=0;this.os2_nSymbolic=0;this.header_yMin=0;this.header_yMax=0;this.monochromeSizes=[]}CFaceInfo.prototype.load=function(face){var _bufferPtr=Module["_ASC_FT_GetFaceInfo"](face);if(!_bufferPtr)return;var _len_buffer=Math.min(Module["HEAP8"].length-_bufferPtr>>2,250);var _buffer=new Int32Array(Module["HEAP8"].buffer,_bufferPtr,_len_buffer); +var _index=0;this.units_per_EM=Math.abs(_buffer[_index++]);this.ascender=_buffer[_index++];this.descender=_buffer[_index++];this.height=_buffer[_index++];this.face_flags=_buffer[_index++];this.num_faces=_buffer[_index++];this.num_glyphs=_buffer[_index++];this.num_charmaps=_buffer[_index++];this.style_flags=_buffer[_index++];this.face_index=_buffer[_index++];var c=_buffer[_index++];while(c){this.family_name+=String.fromCharCode(c);c=_buffer[_index++]}c=_buffer[_index++];while(c){this.style_name+=String.fromCharCode(c); +c=_buffer[_index++]}this.os2_version=_buffer[_index++];this.os2_usWeightClass=_buffer[_index++];this.os2_fsSelection=_buffer[_index++];this.os2_usWinAscent=_buffer[_index++];this.os2_usWinDescent=_buffer[_index++];this.os2_usDefaultChar=_buffer[_index++];this.os2_sTypoAscender=_buffer[_index++];this.os2_sTypoDescender=_buffer[_index++];this.os2_sTypoLineGap=_buffer[_index++];this.os2_ulUnicodeRange1=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulUnicodeRange2=AscFonts.FT_Common.IntToUInt(_buffer[_index++]); +this.os2_ulUnicodeRange3=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulUnicodeRange4=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulCodePageRange1=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_ulCodePageRange2=AscFonts.FT_Common.IntToUInt(_buffer[_index++]);this.os2_nSymbolic=_buffer[_index++];this.header_yMin=_buffer[_index++];this.header_yMax=_buffer[_index++];var fixedSizesCount=_buffer[_index++];for(var i=0;i>2];var _buffer=new Int32Array(Module["HEAP8"].buffer,_bufferPtr,4*_len);var _info=new CGlyphMetrics;_info.bbox_xMin= +_buffer[1];_info.bbox_yMin=_buffer[2];_info.bbox_xMax=_buffer[3];_info.bbox_yMax=_buffer[4];_info.width=_buffer[5];_info.height=_buffer[6];_info.horiAdvance=_buffer[7];_info.horiBearingX=_buffer[8];_info.horiBearingY=_buffer[9];_info.vertAdvance=_buffer[10];_info.vertBearingX=_buffer[11];_info.vertBearingY=_buffer[12];_info.linearHoriAdvance=_buffer[13];_info.linearVertAdvance=_buffer[14];if(vector_worker){painter.start(vector_worker);var _pos=15;while(_pos<_len)switch(_buffer[_pos++]){case 0:{painter._move_to(_buffer[_pos++], _buffer[_pos++],vector_worker);break}case 1:{painter._line_to(_buffer[_pos++],_buffer[_pos++],vector_worker);break}case 2:{painter._conic_to(_buffer[_pos++],_buffer[_pos++],_buffer[_pos++],_buffer[_pos++],vector_worker);break}case 3:{painter._cubic_to(_buffer[_pos++],_buffer[_pos++],_buffer[_pos++],_buffer[_pos++],_buffer[_pos++],_buffer[_pos++],vector_worker);break}default:break}painter.end(vector_worker)}Module["_ASC_FT_Free"](_bufferPtr);_buffer=null;return _info};AscFonts.FT_Glyph_Get_Raster= function(face,render_mode){var _bufferPtr=Module["_ASC_FT_Get_Glyph_Render_Params"](face,render_mode);if(!_bufferPtr)return null;var _buffer=new Int32Array(Module["HEAP8"].buffer,_bufferPtr,24);var _info=new CGlyphBitmapImage;_info.left=_buffer[0];_info.top=_buffer[1];_info.width=_buffer[2];_info.rows=_buffer[3];_info.pitch=_buffer[4];_info.mode=_buffer[5];Module["_ASC_FT_Free"](_bufferPtr);return _info};AscFonts.FT_Load_Glyph=Module["_FT_Load_Glyph"];AscFonts.FT_Set_Transform=Module["_ASC_FT_Set_Transform"]; AscFonts.FT_Set_Char_Size=Module["_FT_Set_Char_Size"];AscFonts.FT_SetCMapForCharCode=Module["_ASC_FT_SetCMapForCharCode"];AscFonts.FT_GetKerningX=Module["_ASC_FT_GetKerningX"];AscFonts.FT_GetFaceMaxAdvanceX=Module["_ASC_FT_GetFaceMaxAdvanceX"];AscFonts.FT_Get_Glyph_Render_Buffer=function(face,rasterInfo,isCopyToRasterMemory){var _bufferPtr=Module["_ASC_FT_Get_Glyph_Render_Buffer"](face);var tmp=new Uint8Array(Module["HEAP8"].buffer,_bufferPtr,rasterInfo.pitch*rasterInfo.rows);if(!isCopyToRasterMemory)return tmp; From ae95b088dc0af562b210bbbe951562b058531c81 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 21 Oct 2020 16:04:04 +0200 Subject: [PATCH 34/43] Fix syntax error --- www/pad/csp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/pad/csp.js b/www/pad/csp.js index 02f21f883..13a40f851 100644 --- a/www/pad/csp.js +++ b/www/pad/csp.js @@ -27,7 +27,7 @@ define(['jquery'], function ($) { if (bgImg) { $icon[0].style.setProperty('background-image', bgImg, 'important'); } - catch (e) { console.error(e); } + } catch (e) { console.error(e); } } $el.on('keydown blur focus click dragstart', function (e) { e.preventDefault(); From 0e6e691d7df5fc81e100fceadc72ac19ef12d2d0 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 21 Oct 2020 16:14:49 +0200 Subject: [PATCH 35/43] Remove hardcoded translation key --- www/common/toolbar.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/www/common/toolbar.js b/www/common/toolbar.js index cf319f124..9a96039f6 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -1350,8 +1350,6 @@ MessengerUI, Messages) { } }; - Messages.snaphot_title = "Snapshot"; //XXX - toolbar.setSnapshot = function (bool) { toolbar.history = bool; toolbar.title.toggleClass('cp-toolbar-unsync', bool); From 714f2c6051d1481e467897425651a506b5ad6218 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 21 Oct 2020 16:27:18 +0200 Subject: [PATCH 36/43] Fix an issue with the maxTeamsSlots configuration --- www/teams/inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/teams/inner.js b/www/teams/inner.js index 44734ad85..2eb234b12 100644 --- a/www/teams/inner.js +++ b/www/teams/inner.js @@ -395,7 +395,7 @@ define([ if (obj.error === "OFFLINE") { return UI.alert(Messages.driveOfflineError); } if (obj.error) { return void console.error(obj.error); } var list = []; - var keys = Object.keys(obj).slice(0,3); + var keys = Object.keys(obj).slice(0,MAX_TEAMS_SLOTS); var slots = '('+Math.min(keys.length, MAX_TEAMS_SLOTS)+'/'+MAX_TEAMS_SLOTS+')'; for (var i = keys.length; i < MAX_TEAMS_SLOTS; i++) { obj[i] = { From fbfb25bf290783b074a971711a78390400246780 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 21 Oct 2020 21:29:52 +0530 Subject: [PATCH 37/43] lint compliance --- lib/workers/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/workers/index.js b/lib/workers/index.js index 4ca1996d0..6e9f57e88 100644 --- a/lib/workers/index.js +++ b/lib/workers/index.js @@ -110,6 +110,7 @@ Workers.initialize = function (Env, config, _cb) { return; } + const txid = guid(); var cb = Util.once(Util.mkAsync(Util.both(_cb, function (err /*, value */) { if (err !== 'TIMEOUT') { return; } // in the event of a timeout the user will receive an error @@ -124,7 +125,6 @@ Workers.initialize = function (Env, config, _cb) { return void cb('ESERVERERR'); } - const txid = guid(); msg.txid = txid; msg.pid = PID; From 67430de7ffb1749cc3f5f9561c892fbe3e59fab3 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 22 Oct 2020 11:17:03 +0530 Subject: [PATCH 38/43] Make efforts to avoid closing streams mid-read 1. Close streams when you're done with them 2. Close streams if they seem to have been abandoned --- lib/storage/file.js | 68 +++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/lib/storage/file.js b/lib/storage/file.js index d9d3f7c89..5f3d4ae46 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -94,25 +94,28 @@ const destroyStream = function (stream) { }, STREAM_DESTROY_TIMEOUT); }; -/* - accept a stream, an id (used as a label) and an optional number of milliseconds +/* createIdleStreamCollector + +Takes a stream and returns a function to asynchronously close that stream. +Successive calls to the function will be ignored. - return a function which ignores all arguments - and first tries to gracefully close a stream - then destroys it after a period if the close was not successful - if the function is not called within the specified number of milliseconds - then it will be called implicitly with an error to indicate - that it was run because it timed out +If the function is not called for a period of STREAM_CLOSE_TIMEOUT it will +be called automatically unless its `keepAlive` method has been invoked +in the meantime. Used to prevent file descriptor leaks in the case of +abandoned streams while closing streams which are being read very very +slowly. */ -const ensureStreamCloses = function (stream, id, ms) { - return Util.bake(Util.mkTimeout(Util.once(function (err) { - destroyStream(stream); - if (err) { - // this can only be a timeout error... - console.log("stream close error:", err, id); - } - }), ms || STREAM_CLOSE_TIMEOUT), []); +const createIdleStreamCollector = function (stream) { + // create a function to close the stream which takes no arguments + // and will do nothing after being called the first time + var collector = Util.once(Util.mkAsync(Util.bake(destroyStream, [stream]))); + + // create a second function which will execute the first function after a delay + // calling this function will reset the delay and thus keep the stream 'alive' + collector.keepAlive = Util.throttle(collector, STREAM_CLOSE_TIMEOUT); + collector.keepAlive(); + return collector; }; // readMessagesBin asynchronously iterates over the messages in a channel log @@ -122,25 +125,22 @@ const ensureStreamCloses = function (stream, id, ms) { // it also allows the handler to abort reading at any time const readMessagesBin = (env, id, start, msgHandler, cb) => { const stream = Fs.createReadStream(mkPath(env, id), { start: start }); - const finish = ensureStreamCloses(stream, '[readMessagesBin:' + id + ']'); - return void readFileBin(stream, msgHandler, function (err) { - cb(err); - finish(); - }); + const collector = createIdleStreamCollector(stream); + const handleMessageAndKeepStreamAlive = Util.both(msgHandler, collector.keepAlive); + const done = Util.both(cb, collector); + return void readFileBin(stream, handleMessageAndKeepStreamAlive, done); }; // reads classic metadata from a channel log and aborts // returns undefined if the first message was not an object (not an array) var getMetadataAtPath = function (Env, path, _cb) { const stream = Fs.createReadStream(path, { start: 0 }); - const finish = ensureStreamCloses(stream, '[getMetadataAtPath:' + path + ']'); - var cb = Util.once(Util.mkAsync(Util.both(_cb, finish)), function () { - throw new Error("Multiple Callbacks"); - }); - + const collector = createIdleStreamCollector(stream); + var cb = Util.once(Util.mkAsync(Util.both(_cb, collector))); var i = 0; return readFileBin(stream, function (msgObj, readMore, abort) { + collector.keepAlive(); const line = msgObj.buff.toString('utf8'); if (!line) { @@ -149,7 +149,7 @@ var getMetadataAtPath = function (Env, path, _cb) { // metadata should always be on the first line or not exist in the channel at all if (i++ > 0) { - console.log("aborting"); + //console.log("aborting"); abort(); return void cb(); } @@ -219,10 +219,11 @@ var clearChannel = function (env, channelId, _cb) { */ var readMessages = function (path, msgHandler, _cb) { var stream = Fs.createReadStream(path, { start: 0}); - const finish = ensureStreamCloses(stream, '[readMessages:' + path + ']'); - var cb = Util.once(Util.mkAsync(Util.both(finish, _cb))); + var collector = createIdleStreamCollector(stream); + var cb = Util.once(Util.mkAsync(Util.both(_cb, collector))); return readFileBin(stream, function (msgObj, readMore) { + collector.keepAlive(); msgHandler(msgObj.buff.toString('utf8')); readMore(); }, function (err) { @@ -247,10 +248,11 @@ var getDedicatedMetadata = function (env, channelId, handler, _cb) { var metadataPath = mkMetadataPath(env, channelId); var stream = Fs.createReadStream(metadataPath, {start: 0}); - const finish = ensureStreamCloses(stream, '[getDedicatedMetadata:' + metadataPath + ']'); - var cb = Util.both(finish, _cb); + const collector = createIdleStreamCollector(stream); + var cb = Util.both(_cb, collector); readFileBin(stream, function (msgObj, readMore) { + collector.keepAlive(); var line = msgObj.buff.toString('utf8'); try { var parsed = JSON.parse(line); @@ -758,11 +760,11 @@ var getChannel = function (env, id, _callback) { }); }); }).nThen(function () { - channel.delayClose = Util.throttle(function () { + channel.delayClose = Util.throttle(Util.once(function () { delete env.channels[id]; destroyStream(channel.writeStream, path); //console.log("closing writestream"); - }, CHANNEL_WRITE_WINDOW); + }), CHANNEL_WRITE_WINDOW); channel.delayClose(); env.channels[id] = channel; done(void 0, channel); From d72e053560f7dfeab8fd244f47ec76b173219324 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 22 Oct 2020 11:24:58 +0530 Subject: [PATCH 39/43] make a note to improve stream timeout error handling --- lib/storage/file.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/storage/file.js b/lib/storage/file.js index 5f3d4ae46..b1ccfde0f 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -105,6 +105,9 @@ in the meantime. Used to prevent file descriptor leaks in the case of abandoned streams while closing streams which are being read very very slowly. +XXX inform the stream consumer when it has been closed prematurely +by calling back with a TIMEOUT error or something + */ const createIdleStreamCollector = function (stream) { // create a function to close the stream which takes no arguments From 8ed48d36ab0009776357f359e614db09b498ab10 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 22 Oct 2020 14:00:30 +0530 Subject: [PATCH 40/43] remove a temporary cache-busting hack --- www/pad/inner.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/pad/inner.js b/www/pad/inner.js index 678b674a4..19c2063d8 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -190,7 +190,6 @@ define([ var intr; var check = function() { if (window.CKEDITOR) { - window.CKEDITOR.timestamp = 123456; // XXX cache-busting string for CkEditor clearTimeout(intr); cb(window.CKEDITOR); } From 678fc5e41e1233d914cdf2734f6c573ae0425f00 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 22 Oct 2020 11:20:18 +0200 Subject: [PATCH 41/43] Make contribution URLs configurable --- customize.dist/pages/features.js | 4 ++-- www/common/cryptpad-common.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/customize.dist/pages/features.js b/customize.dist/pages/features.js index 00308fc29..6403ec36a 100644 --- a/customize.dist/pages/features.js +++ b/customize.dist/pages/features.js @@ -9,8 +9,8 @@ define([ ], function ($, h, Msg, AppConfig, LocalStore, Pages, Config) { var origin = encodeURIComponent(window.location.hostname); var accounts = { - donateURL: 'https://accounts.cryptpad.fr/#/donate?on=' + origin, - upgradeURL: 'https://accounts.cryptpad.fr/#/?on=' + origin, + donateURL: AppConfig.donateURL || "https://opencollective.com/cryptpad/", + upgradeURL: AppConfig.upgradeURL || 'https://accounts.cryptpad.fr/#/?on=' + origin, }; return function () { Msg.features_f_apps_note = AppConfig.availablePadTypes.map(function (app) { diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 85de0b006..696627cbe 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -44,9 +44,8 @@ define([ var origin = encodeURIComponent(window.location.hostname); var common = window.Cryptpad = { Messages: Messages, - //donateURL: 'https://accounts.cryptpad.fr/#/donate?on=' + origin, - donateURL: "https://opencollective.com/cryptpad/", - upgradeURL: 'https://accounts.cryptpad.fr/#/?on=' + origin, + donateURL: AppConfig.donateURL || "https://opencollective.com/cryptpad/", + upgradeURL: AppConfig.upgradeURL || 'https://accounts.cryptpad.fr/#/?on=' + origin, account: {}, }; From 66e04f620450948eede3b50a445dfa2209d1c930 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 22 Oct 2020 12:09:48 +0200 Subject: [PATCH 42/43] Improve script to remote duplicate teams --- www/common/outer/team.js | 95 +++++++++++++++++++---------- www/common/sframe-common-history.js | 2 +- 2 files changed, 65 insertions(+), 32 deletions(-) diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 7d85cea1f..a206b07dc 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -505,7 +505,8 @@ define([ // Check access rights // If we're not a viewer, make sure we have edit rights var s = state.members[me]; - if (!teamData.hash && ['ADMIN', 'MEMBER'].indexOf(s.role) !== -1) { + var teamEdPrivate = Util.find(teamData, ['keys', 'drive', 'edPrivate']); + if ((!teamData.hash || !teamEdPrivate) && ['ADMIN', 'MEMBER'].indexOf(s.role) !== -1) { console.warn("Missing edit rights: demote to viewer"); var data = {}; data[ctx.store.proxy.curvePublic] = { @@ -513,11 +514,15 @@ define([ }; roster.describe(data, function (err) { Feedback.send("TEAM_RIGHTS_FIXED"); + // Make sure we've removed all the keys + delete teamData.hash; + delete teamData.keys.drive.edPrivate; + delete teamData.keys.chat.edit; if (!err) { return; } if (err === 'NO_CHANGE') { return; } console.error(err); }); - } else if (!teamData.hash && s.role === "OWNER") { + } else if ((!teamData.hash || !teamEdPrivate) && s.role === "OWNER") { Feedback.send("TEAM_RIGHTS_OWNER"); } }).nThen(function () { @@ -1696,33 +1701,71 @@ define([ updateMyRights(ctx, p[1]); }); + var checkKeyPair = function (edPrivate, edPublic) { + if (!edPrivate || !edPublic) { return true; } + try { + var secretKey = Nacl.util.decodeBase64(edPrivate); + var pair = Nacl.sign.keyPair.fromSecretKey(secretKey); + return Nacl.util.encodeBase64(pair.publicKey) === edPublic; + } catch (e) { + return false; + } + }; + // Remove duplicate teams var _teams = {}; Object.keys(teams).forEach(function (id) { - var t = teams[id]; - var _t = _teams[t.channel]; + try { + var t = teams[id]; + var _t = _teams[t.channel]; + + var edPrivate = Util.find(t, ['keys', 'drive', 'edPrivate']); + var edPublic = Util.find(t, ['keys', 'drive', 'edPublic']); + + // If the edPrivate is corrupted, remove it + if (!edPublic) { + Feedback.send("TEAM_CORRUPTED_EDPUBLIC"); + } else if (edPrivate && edPublic && !checkKeyPair(edPrivate, edPublic)) { + Feedback.send("TEAM_CORRUPTED_EDPUBLIC"); + delete teams[id].keys.drive.edPrivate; + edPrivate = undefined; + } - // Not found yet? add to the list - if (!_t) { - _teams[t.channel] = { edit: Boolean(t.hash), owner: t.owner, id:id }; - return; - } + // If the hash is corrupted, feedback + if (t.hash) { + var parsed = Hash.parseTypeHash('drive', t.hash); + if (parsed.version === 2 && t.hash.length !== 40) { + Feedback.send("TEAM_CORRUPTED_HASH"); + // FIXME ? + } + } + + // Not found yet? add to the list + if (!_t) { + _teams[t.channel] = id; + return; + } - // Team already found. If this one has better access rights, keep it. - // Otherwise, delete it - ctx.store.proxy.duplicateTeams = ctx.store.proxy.duplicateTeams || {}; + // Duplicate found: update our team to add missing data + var best = teams[_t]; // This is a proxy! + var bestPrivate = Util.find(best, ['keys', 'drive', 'edPrivate']); + var bestChat = Util.find(best, ['keys', 'chat', 'edit']); + var chat = Util.find(t, ['keys', 'chat', 'edit']); + if (!best.hash && t.hash) { + best.hash = t.hash; + } + if (!bestPrivate && edPrivate) { + best.keys.drive.edPrivate = edPrivate; + } + if (!bestChat && chat) { + best.keys.chat.edit = chat; + } - // No edit right or we already had edit rights? delete - if (!t.hash || (!t.owner && _t.edit) || _t.owner) { + // Deprecate the duplicate + ctx.store.proxy.duplicateTeams = ctx.store.proxy.duplicateTeams || {}; ctx.store.proxy.duplicateTeams[id] = teams[id]; delete teams[id]; - return; - } - - // We didn't have edit rights and now we have them: replace - ctx.store.proxy.duplicateTeams[_t.id] = teams[_t.id]; - delete teams[_t.id]; - _teams[t.channel] = { edit: Boolean(t.hash), owner: t.owner, id:id }; + } catch (e) { console.error(e); } }); // Load teams @@ -1740,16 +1783,6 @@ define([ team.getTeam = function (id) { return ctx.teams[id]; }; - var checkKeyPair = function (edPrivate, edPublic) { - if (!edPrivate || !edPublic) { return true; } - try { - var secretKey = Nacl.util.decodeBase64(edPrivate); - var pair = Nacl.sign.keyPair.fromSecretKey(secretKey); - return Nacl.util.encodeBase64(pair.publicKey) === edPublic; - } catch (e) { - return false; - } - }; team.getTeamsData = function (app) { var t = {}; var safe = false; diff --git a/www/common/sframe-common-history.js b/www/common/sframe-common-history.js index 9362c7899..c0c8ef678 100644 --- a/www/common/sframe-common-history.js +++ b/www/common/sframe-common-history.js @@ -254,7 +254,7 @@ define([ // goal of having snapshots if (config.getLastMetadata) { var metadataMgr = common.getMetadataMgr(); - var lastMd = config.getLastMetadata(); + var lastMd = config.getLastMetadata() || {}; var _snapshots = lastMd.snapshots; var _users = lastMd.users; var md = Util.clone(metadataMgr.getMetadata()); From 7763f966c62cbf234a2b3cc942ad379a90b7747f Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 22 Oct 2020 12:14:52 +0200 Subject: [PATCH 43/43] Fix feedback --- www/common/outer/team.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/outer/team.js b/www/common/outer/team.js index a206b07dc..e5a40505e 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -1726,7 +1726,7 @@ define([ if (!edPublic) { Feedback.send("TEAM_CORRUPTED_EDPUBLIC"); } else if (edPrivate && edPublic && !checkKeyPair(edPrivate, edPublic)) { - Feedback.send("TEAM_CORRUPTED_EDPUBLIC"); + Feedback.send("TEAM_CORRUPTED_EDPRIVATE"); delete teams[id].keys.drive.edPrivate; edPrivate = undefined; }