From fb41a40128c0ade9bbbec382a226a203b3c252a7 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 3 Aug 2017 14:07:22 -0700 Subject: [PATCH 1/5] use webcrypto-liner to support Safari 10 --- frontend/src/common.js | 27 +- frontend/src/download.js | 338 +++++++------- frontend/src/upload.js | 965 ++++++++++++++++++++------------------- frontend/src/utils.js | 16 +- package-lock.json | 55 +++ package.json | 4 +- public/cryptofill.js | 22 + 7 files changed, 770 insertions(+), 657 deletions(-) create mode 100644 public/cryptofill.js diff --git a/frontend/src/common.js b/frontend/src/common.js index 282bdca1..5b8c3330 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -1,35 +1,30 @@ -window.Raven = require('raven-js'); +const testPilotGA = require('testpilot-ga'); +const { sendEvent } = require('./utils'); +const Raven = require('raven-js'); + if (navigator.doNotTrack !== '1' && window.RAVEN_CONFIG) { - window.Raven.config(window.SENTRY_ID, window.RAVEN_CONFIG).install(); + Raven.config(window.SENTRY_ID, window.RAVEN_CONFIG).install(); } -const testPilotGA = require('testpilot-ga'); -const { gcmCompliant, sendEvent } = require('./utils'); -window.analytics = new testPilotGA({ +const analytics = new testPilotGA({ an: 'Firefox Send', ds: 'web', tid: window.GOOGLE_ANALYTICS_ID }); -const isSender = !location.pathname.includes('/download'); -const ec = isSender ? 'sender' : 'recipient'; const ua = navigator.userAgent.toLowerCase(); - -gcmCompliant().catch(err => { - sendEvent(ec, 'unsupported', { - cd6: err - }).then(() => { - location.replace('/unsupported/gcm'); - }); -}); - if ( ua.indexOf('firefox') > -1 && parseInt(ua.match(/firefox\/*([^\n\r]*)\./)[1], 10) <= 49 ) { + const isSender = !location.pathname.includes('/download'); + const ec = isSender ? 'sender' : 'recipient'; sendEvent(ec, 'unsupported', { cd6: new Error('Firefox is outdated.') }).then(() => { location.replace('/unsupported/outdated'); }); } + +window.analytics = analytics; +window.Raven = Raven; diff --git a/frontend/src/download.js b/frontend/src/download.js index 0f004357..e4f89690 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -1,6 +1,6 @@ require('./common'); const FileReceiver = require('./fileReceiver'); -const { notify, findMetric, sendEvent } = require('./utils'); +const { notify, findMetric, sendEvent, gcmCompliant } = require('./utils'); const bytes = require('bytes'); const Storage = require('./storage'); const storage = new Storage(localStorage); @@ -11,171 +11,181 @@ require('jquery-circle-progress'); const Raven = window.Raven; $(document).ready(function() { - //link back to homepage - $('.send-new').attr('href', window.location.origin); + gcmCompliant() + .then(function() { + //link back to homepage + $('.send-new').attr('href', window.location.origin); - $('.send-new').click(function() { - sendEvent('recipient', 'restarted', { - cd2: 'completed' - }); - }); - - $('.legal-links a, .social-links a, #dl-firefox').click(function(target) { - const metric = findMetric(target.currentTarget.href); - // record exited event by recipient - sendEvent('recipient', 'exited', { - cd3: metric - }); - }); - - const filename = $('#dl-filename').text(); - const bytelength = Number($('#dl-bytelength').text()); - const timeToExpiry = Number($('#dl-ttl').text()); - - //initiate progress bar - $('#dl-progress').circleProgress({ - value: 0.0, - startAngle: -Math.PI / 2, - fill: '#3B9DFF', - size: 158, - animation: { duration: 300 } - }); - $('#download-btn').click(download); - function download() { - storage.totalDownloads += 1; - - const fileReceiver = new FileReceiver(); - const unexpiredFiles = storage.numFiles; - - fileReceiver.on('progress', progress => { - window.onunload = function() { - storage.referrer = 'cancelled-download'; - // record download-stopped (cancelled by tab close or reload) - sendEvent('recipient', 'download-stopped', { - cm1: bytelength, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads, - cd2: 'cancelled' - }); - }; - - $('#download-page-one').attr('hidden', true); - $('#download-progress').removeAttr('hidden'); - const percent = progress[0] / progress[1]; - // update progress bar - $('#dl-progress').circleProgress('value', percent); - $('.percent-number').text(`${Math.floor(percent * 100)}`); - $('.progress-text').text( - `${filename} (${bytes(progress[0], { - decimalPlaces: 1, - fixedDecimals: true - })} of ${bytes(progress[1], { decimalPlaces: 1 })})` - ); - }); - - let downloadEnd; - fileReceiver.on('decrypting', isStillDecrypting => { - // The file is being decrypted - if (isStillDecrypting) { - fileReceiver.removeAllListeners('progress'); - window.onunload = null; - document.l10n.formatValue('decryptingFile').then(decryptingFile => { - $('.progress-text').text(decryptingFile); - }); - } else { - downloadEnd = Date.now(); - } - }); - - fileReceiver.on('hashing', isStillHashing => { - // The file is being hashed to make sure a malicious user hasn't tampered with it - if (isStillHashing) { - document.l10n.formatValue('verifyingFile').then(verifyingFile => { - $('.progress-text').text(verifyingFile); - }); - } else { - $('.progress-text').text(' '); - document.l10n - .formatValues('downloadNotification', 'downloadFinish') - .then(translated => { - notify(translated[0]); - $('.title').text(translated[1]); - }); - } - }); - - const startTime = Date.now(); - - // record download-started by recipient - sendEvent('recipient', 'download-started', { - cm1: bytelength, - cm4: timeToExpiry, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads - }); - - fileReceiver - .download() - .catch(err => { - // record download-stopped (errored) by recipient - sendEvent('recipient', 'download-stopped', { - cm1: bytelength, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads, - cd2: 'errored', - cd6: err - }); - - if (err.message === 'notfound') { - location.reload(); - } else { - document.l10n.formatValue('errorPageHeader').then(translated => { - $('.title').text(translated); - }); - $('#download-btn').attr('hidden', true); - $('#expired-img').removeAttr('hidden'); - } - throw err; - }) - .then(([decrypted, fname]) => { - const endTime = Date.now(); - const totalTime = endTime - startTime; - const downloadTime = endTime - downloadEnd; - const downloadSpeed = bytelength / (downloadTime / 1000); - - storage.referrer = 'completed-download'; - // record download-stopped (completed) by recipient - sendEvent('recipient', 'download-stopped', { - cm1: bytelength, - cm2: totalTime, - cm3: downloadSpeed, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads, + $('.send-new').click(function() { + sendEvent('recipient', 'restarted', { cd2: 'completed' }); - - const dataView = new DataView(decrypted); - const blob = new Blob([dataView]); - const downloadUrl = URL.createObjectURL(blob); - - const a = document.createElement('a'); - a.href = downloadUrl; - if (window.navigator.msSaveBlob) { - // if we are in microsoft edge or IE - window.navigator.msSaveBlob(blob, fname); - return; - } - a.download = fname; - document.body.appendChild(a); - a.click(); - }) - .catch(err => { - Raven.captureException(err); - return Promise.reject(err); }); - } + + $('.legal-links a, .social-links a, #dl-firefox').click(function(target) { + const metric = findMetric(target.currentTarget.href); + // record exited event by recipient + sendEvent('recipient', 'exited', { + cd3: metric + }); + }); + + const filename = $('#dl-filename').text(); + const bytelength = Number($('#dl-bytelength').text()); + const timeToExpiry = Number($('#dl-ttl').text()); + + //initiate progress bar + $('#dl-progress').circleProgress({ + value: 0.0, + startAngle: -Math.PI / 2, + fill: '#3B9DFF', + size: 158, + animation: { duration: 300 } + }); + $('#download-btn').click(download); + function download() { + storage.totalDownloads += 1; + + const fileReceiver = new FileReceiver(); + const unexpiredFiles = storage.numFiles; + + fileReceiver.on('progress', progress => { + window.onunload = function() { + storage.referrer = 'cancelled-download'; + // record download-stopped (cancelled by tab close or reload) + sendEvent('recipient', 'download-stopped', { + cm1: bytelength, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads, + cd2: 'cancelled' + }); + }; + + $('#download-page-one').attr('hidden', true); + $('#download-progress').removeAttr('hidden'); + const percent = progress[0] / progress[1]; + // update progress bar + $('#dl-progress').circleProgress('value', percent); + $('.percent-number').text(`${Math.floor(percent * 100)}`); + $('.progress-text').text( + `${filename} (${bytes(progress[0], { + decimalPlaces: 1, + fixedDecimals: true + })} of ${bytes(progress[1], { decimalPlaces: 1 })})` + ); + }); + + let downloadEnd; + fileReceiver.on('decrypting', isStillDecrypting => { + // The file is being decrypted + if (isStillDecrypting) { + fileReceiver.removeAllListeners('progress'); + window.onunload = null; + document.l10n.formatValue('decryptingFile').then(decryptingFile => { + $('.progress-text').text(decryptingFile); + }); + } else { + downloadEnd = Date.now(); + } + }); + + fileReceiver.on('hashing', isStillHashing => { + // The file is being hashed to make sure a malicious user hasn't tampered with it + if (isStillHashing) { + document.l10n.formatValue('verifyingFile').then(verifyingFile => { + $('.progress-text').text(verifyingFile); + }); + } else { + $('.progress-text').text(' '); + document.l10n + .formatValues('downloadNotification', 'downloadFinish') + .then(translated => { + notify(translated[0]); + $('.title').text(translated[1]); + }); + } + }); + + const startTime = Date.now(); + + // record download-started by recipient + sendEvent('recipient', 'download-started', { + cm1: bytelength, + cm4: timeToExpiry, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads + }); + + fileReceiver + .download() + .catch(err => { + // record download-stopped (errored) by recipient + sendEvent('recipient', 'download-stopped', { + cm1: bytelength, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads, + cd2: 'errored', + cd6: err + }); + + if (err.message === 'notfound') { + location.reload(); + } else { + document.l10n.formatValue('errorPageHeader').then(translated => { + $('.title').text(translated); + }); + $('#download-btn').attr('hidden', true); + $('#expired-img').removeAttr('hidden'); + } + throw err; + }) + .then(([decrypted, fname]) => { + const endTime = Date.now(); + const totalTime = endTime - startTime; + const downloadTime = endTime - downloadEnd; + const downloadSpeed = bytelength / (downloadTime / 1000); + + storage.referrer = 'completed-download'; + // record download-stopped (completed) by recipient + sendEvent('recipient', 'download-stopped', { + cm1: bytelength, + cm2: totalTime, + cm3: downloadSpeed, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads, + cd2: 'completed' + }); + + const dataView = new DataView(decrypted); + const blob = new Blob([dataView]); + const downloadUrl = URL.createObjectURL(blob); + + const a = document.createElement('a'); + a.href = downloadUrl; + if (window.navigator.msSaveBlob) { + // if we are in microsoft edge or IE + window.navigator.msSaveBlob(blob, fname); + return; + } + a.download = fname; + document.body.appendChild(a); + a.click(); + }) + .catch(err => { + Raven.captureException(err); + return Promise.reject(err); + }); + } + }) + .catch(err => { + sendEvent('sender', 'unsupported', { + cd6: err + }).then(() => { + location.replace('/unsupported/gcm'); + }); + }); }); diff --git a/frontend/src/upload.js b/frontend/src/upload.js index 1ae58428..0d0aa48c 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -1,7 +1,13 @@ /* global MAXFILESIZE EXPIRE_SECONDS */ require('./common'); const FileSender = require('./fileSender'); -const { notify, findMetric, sendEvent, ONE_DAY_IN_MS } = require('./utils'); +const { + notify, + gcmCompliant, + findMetric, + sendEvent, + ONE_DAY_IN_MS +} = require('./utils'); const bytes = require('bytes'); const Storage = require('./storage'); const storage = new Storage(localStorage); @@ -19,519 +25,536 @@ if (storage.has('referrer')) { } $(document).ready(function() { - $('#page-one').removeAttr('hidden'); - $('#file-upload').change(onUpload); + gcmCompliant() + .then(function() { + $('#page-one').removeAttr('hidden'); + $('#file-upload').change(onUpload); - $('.legal-links a, .social-links a, #dl-firefox').click(function(target) { - const metric = findMetric(target.currentTarget.href); - // record exited event by recipient - sendEvent('sender', 'exited', { - cd3: metric - }); - }); + $('.legal-links a, .social-links a, #dl-firefox').click(function(target) { + const metric = findMetric(target.currentTarget.href); + // record exited event by recipient + sendEvent('sender', 'exited', { + cd3: metric + }); + }); - $('#send-new-completed').click(function() { - // record restarted event - storage.referrer = 'errored-upload'; - sendEvent('sender', 'restarted', { - cd2: 'completed' - }); - }); + $('#send-new-completed').click(function() { + // record restarted event + storage.referrer = 'errored-upload'; + sendEvent('sender', 'restarted', { + cd2: 'completed' + }); + }); - $('#send-new-error').click(function() { - // record restarted event - storage.referrer = 'errored-upload'; - sendEvent('sender', 'restarted', { - cd2: 'errored' - }); - }); + $('#send-new-error').click(function() { + // record restarted event + storage.referrer = 'errored-upload'; + sendEvent('sender', 'restarted', { + cd2: 'errored' + }); + }); - $('body').on('dragover', allowDrop).on('drop', onUpload); - // reset copy button - const $copyBtn = $('#copy-btn'); - $copyBtn.attr('disabled', false); - $('#link').attr('disabled', false); - $copyBtn.attr('data-l10n-id', 'copyUrlFormButton'); - - const files = storage.files; - if (files.length === 0) { - toggleHeader(); - } else { - // eslint-disable-next-line prefer-const - for (let index in files) { - const id = files[index].fileId; - //check if file still exists before adding to list - checkExistence(id, files[index], true); - } - } - - // copy link to clipboard - $copyBtn.click(() => { - // record copied event from success screen - sendEvent('sender', 'copied', { - cd4: 'success-screen' - }); - const aux = document.createElement('input'); - aux.setAttribute('value', $('#link').attr('value')); - document.body.appendChild(aux); - aux.select(); - document.execCommand('copy'); - document.body.removeChild(aux); - //disable button for 3s - $copyBtn.attr('disabled', true); - $('#link').attr('disabled', true); - $copyBtn.html( - '' - ); - window.setTimeout(() => { + $('body').on('dragover', allowDrop).on('drop', onUpload); + // reset copy button + const $copyBtn = $('#copy-btn'); $copyBtn.attr('disabled', false); $('#link').attr('disabled', false); $copyBtn.attr('data-l10n-id', 'copyUrlFormButton'); - }, 3000); - }); - $('.upload-window').on('dragover', () => { - $('.upload-window').addClass('ondrag'); - }); - $('.upload-window').on('dragleave', () => { - $('.upload-window').removeClass('ondrag'); - }); - //initiate progress bar - $('#ul-progress').circleProgress({ - value: 0.0, - startAngle: -Math.PI / 2, - fill: '#3B9DFF', - size: 158, - animation: { duration: 300 } - }); - - //link back to homepage - $('.send-new').attr('href', window.location); - - // on file upload by browse or drag & drop - function onUpload(event) { - event.preventDefault(); - - // don't allow upload if not on upload page - if ($('#page-one').attr('hidden')) { - return; - } - - storage.totalUploads += 1; - - let file = ''; - if (event.type === 'drop') { - if (!event.originalEvent.dataTransfer.files[0]) { - $('.upload-window').removeClass('ondrag'); - return; - } - if ( - event.originalEvent.dataTransfer.files.length > 1 || - event.originalEvent.dataTransfer.files[0].size === 0 - ) { - $('.upload-window').removeClass('ondrag'); - document.l10n.formatValue('uploadPageMultipleFilesAlert').then(str => { - alert(str); - }); - return; - } - file = event.originalEvent.dataTransfer.files[0]; - } else { - file = event.target.files[0]; - } - - if (file.size > MAXFILESIZE) { - return document.l10n - .formatValue('fileTooBig', { size: bytes(MAXFILESIZE) }) - .then(alert); - } - - $('#page-one').attr('hidden', true); - $('#upload-error').attr('hidden', true); - $('#upload-progress').removeAttr('hidden'); - document.l10n.formatValue('importingFile').then(importingFile => { - $('.progress-text').text(importingFile); - }); - //don't allow drag and drop when not on page-one - $('body').off('drop', onUpload); - - const fileSender = new FileSender(file); - $('#cancel-upload').click(() => { - fileSender.cancel(); - storage.referrer = 'cancelled-upload'; - - // record upload-stopped (cancelled) by sender - sendEvent('sender', 'upload-stopped', { - cm1: file.size, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads, - cd1: event.type === 'drop' ? 'drop' : 'click', - cd2: 'cancelled' - }); - location.reload(); - }); - - fileSender.on('progress', progress => { - const percent = progress[0] / progress[1]; - // update progress bar - $('#ul-progress').circleProgress('value', percent); - $('#ul-progress').circleProgress().on('circle-animation-end', function() { - $('.percent-number').text(`${Math.floor(percent * 100)}`); - }); - $('.progress-text').text( - `${file.name} (${bytes(progress[0], { - decimalPlaces: 1, - fixedDecimals: true - })} of ${bytes(progress[1], { decimalPlaces: 1 })})` - ); - }); - - fileSender.on('hashing', isStillHashing => { - // The file is being hashed - if (isStillHashing) { - document.l10n.formatValue('verifyingFile').then(verifyingFile => { - $('.progress-text').text(verifyingFile); - }); - } - }); - - let uploadStart; - fileSender.on('encrypting', isStillEncrypting => { - // The file is being encrypted - if (isStillEncrypting) { - document.l10n.formatValue('encryptingFile').then(encryptingFile => { - $('.progress-text').text(encryptingFile); - }); + const files = storage.files; + if (files.length === 0) { + toggleHeader(); } else { - uploadStart = Date.now(); + // eslint-disable-next-line prefer-const + for (let index in files) { + const id = files[index].fileId; + //check if file still exists before adding to list + checkExistence(id, files[index], true); + } } - }); - let t; - const startTime = Date.now(); - const unexpiredFiles = storage.numFiles + 1; + // copy link to clipboard + $copyBtn.click(() => { + // record copied event from success screen + sendEvent('sender', 'copied', { + cd4: 'success-screen' + }); + const aux = document.createElement('input'); + aux.setAttribute('value', $('#link').attr('value')); + document.body.appendChild(aux); + aux.select(); + document.execCommand('copy'); + document.body.removeChild(aux); + //disable button for 3s + $copyBtn.attr('disabled', true); + $('#link').attr('disabled', true); + $copyBtn.html( + '' + ); + window.setTimeout(() => { + $copyBtn.attr('disabled', false); + $('#link').attr('disabled', false); + $copyBtn.attr('data-l10n-id', 'copyUrlFormButton'); + }, 3000); + }); - // record upload-started event by sender - sendEvent('sender', 'upload-started', { - cm1: file.size, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads, - cd1: event.type === 'drop' ? 'drop' : 'click', - cd5: window.referrer - }); + $('.upload-window').on('dragover', () => { + $('.upload-window').addClass('ondrag'); + }); + $('.upload-window').on('dragleave', () => { + $('.upload-window').removeClass('ondrag'); + }); + //initiate progress bar + $('#ul-progress').circleProgress({ + value: 0.0, + startAngle: -Math.PI / 2, + fill: '#3B9DFF', + size: 158, + animation: { duration: 300 } + }); - // For large files we need to give the ui a tick to breathe and update - // before we kick off the FileSender - setTimeout(() => { - fileSender - .upload() - .then(info => { - const endTime = Date.now(); - const totalTime = endTime - startTime; - const uploadTime = endTime - uploadStart; - const uploadSpeed = file.size / (uploadTime / 1000); - const expiration = EXPIRE_SECONDS * 1000; + //link back to homepage + $('.send-new').attr('href', window.location); - // record upload-stopped (completed) by sender - sendEvent('sender', 'upload-stopped', { - cm1: file.size, - cm2: totalTime, - cm3: uploadSpeed, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads, - cd1: event.type === 'drop' ? 'drop' : 'click', - cd2: 'completed' - }); + // on file upload by browse or drag & drop + function onUpload(event) { + event.preventDefault(); - const fileData = { - name: file.name, - size: file.size, - fileId: info.fileId, - url: info.url, - secretKey: info.secretKey, - deleteToken: info.deleteToken, - creationDate: new Date(), - expiry: expiration, - totalTime: totalTime, - typeOfUpload: event.type === 'drop' ? 'drop' : 'click', - uploadSpeed: uploadSpeed - }; + // don't allow upload if not on upload page + if ($('#page-one').attr('hidden')) { + return; + } - storage.addFile(info.fileId, fileData); - $('#upload-filename').attr( - 'data-l10n-id', - 'uploadSuccessConfirmHeader' - ); - t = window.setTimeout(() => { - $('#page-one').attr('hidden', true); - $('#upload-progress').attr('hidden', true); - $('#upload-error').attr('hidden', true); - $('#share-link').removeAttr('hidden'); - }, 1000); + storage.totalUploads += 1; - populateFileList(fileData); - document.l10n.formatValue('notifyUploadDone').then(str => { - notify(str); - }); - }) - .catch(err => { - // err is 0 when coming from a cancel upload event - if (err === 0) { + let file = ''; + if (event.type === 'drop') { + if (!event.originalEvent.dataTransfer.files[0]) { + $('.upload-window').removeClass('ondrag'); return; } - // only show error page when the error is anything other than user cancelling the upload - Raven.captureException(err); - $('#page-one').attr('hidden', true); - $('#upload-progress').attr('hidden', true); - $('#upload-error').removeAttr('hidden'); - window.clearTimeout(t); + if ( + event.originalEvent.dataTransfer.files.length > 1 || + event.originalEvent.dataTransfer.files[0].size === 0 + ) { + $('.upload-window').removeClass('ondrag'); + document.l10n + .formatValue('uploadPageMultipleFilesAlert') + .then(str => { + alert(str); + }); + return; + } + file = event.originalEvent.dataTransfer.files[0]; + } else { + file = event.target.files[0]; + } - // record upload-stopped (errored) by sender + if (file.size > MAXFILESIZE) { + return document.l10n + .formatValue('fileTooBig', { size: bytes(MAXFILESIZE) }) + .then(alert); + } + + $('#page-one').attr('hidden', true); + $('#upload-error').attr('hidden', true); + $('#upload-progress').removeAttr('hidden'); + document.l10n.formatValue('importingFile').then(importingFile => { + $('.progress-text').text(importingFile); + }); + //don't allow drag and drop when not on page-one + $('body').off('drop', onUpload); + + const fileSender = new FileSender(file); + $('#cancel-upload').click(() => { + fileSender.cancel(); + storage.referrer = 'cancelled-upload'; + + // record upload-stopped (cancelled) by sender sendEvent('sender', 'upload-stopped', { cm1: file.size, cm5: storage.totalUploads, cm6: unexpiredFiles, cm7: storage.totalDownloads, cd1: event.type === 'drop' ? 'drop' : 'click', - cd2: 'errored', - cd6: err + cd2: 'cancelled' }); + location.reload(); }); - }, 10); - } - function allowDrop(ev) { - ev.preventDefault(); - } + fileSender.on('progress', progress => { + const percent = progress[0] / progress[1]; + // update progress bar + $('#ul-progress').circleProgress('value', percent); + $('#ul-progress') + .circleProgress() + .on('circle-animation-end', function() { + $('.percent-number').text(`${Math.floor(percent * 100)}`); + }); + $('.progress-text').text( + `${file.name} (${bytes(progress[0], { + decimalPlaces: 1, + fixedDecimals: true + })} of ${bytes(progress[1], { decimalPlaces: 1 })})` + ); + }); - function checkExistence(id, file, populate) { - const xhr = new XMLHttpRequest(); - xhr.onreadystatechange = () => { - if (xhr.readyState === XMLHttpRequest.DONE) { - if (xhr.status === 200) { - if (populate) { - populateFileList(file); + fileSender.on('hashing', isStillHashing => { + // The file is being hashed + if (isStillHashing) { + document.l10n.formatValue('verifyingFile').then(verifyingFile => { + $('.progress-text').text(verifyingFile); + }); } - } else if (xhr.status === 404) { - storage.remove(id); - if (storage.numFiles === 0) { + }); + + let uploadStart; + fileSender.on('encrypting', isStillEncrypting => { + // The file is being encrypted + if (isStillEncrypting) { + document.l10n.formatValue('encryptingFile').then(encryptingFile => { + $('.progress-text').text(encryptingFile); + }); + } else { + uploadStart = Date.now(); + } + }); + + let t; + const startTime = Date.now(); + const unexpiredFiles = storage.numFiles + 1; + + // record upload-started event by sender + sendEvent('sender', 'upload-started', { + cm1: file.size, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads, + cd1: event.type === 'drop' ? 'drop' : 'click', + cd5: window.referrer + }); + + // For large files we need to give the ui a tick to breathe and update + // before we kick off the FileSender + setTimeout(() => { + fileSender + .upload() + .then(info => { + const endTime = Date.now(); + const totalTime = endTime - startTime; + const uploadTime = endTime - uploadStart; + const uploadSpeed = file.size / (uploadTime / 1000); + const expiration = EXPIRE_SECONDS * 1000; + + // record upload-stopped (completed) by sender + sendEvent('sender', 'upload-stopped', { + cm1: file.size, + cm2: totalTime, + cm3: uploadSpeed, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads, + cd1: event.type === 'drop' ? 'drop' : 'click', + cd2: 'completed' + }); + + const fileData = { + name: file.name, + size: file.size, + fileId: info.fileId, + url: info.url, + secretKey: info.secretKey, + deleteToken: info.deleteToken, + creationDate: new Date(), + expiry: expiration, + totalTime: totalTime, + typeOfUpload: event.type === 'drop' ? 'drop' : 'click', + uploadSpeed: uploadSpeed + }; + + storage.addFile(info.fileId, fileData); + $('#upload-filename').attr( + 'data-l10n-id', + 'uploadSuccessConfirmHeader' + ); + t = window.setTimeout(() => { + $('#page-one').attr('hidden', true); + $('#upload-progress').attr('hidden', true); + $('#upload-error').attr('hidden', true); + $('#share-link').removeAttr('hidden'); + }, 1000); + + populateFileList(fileData); + document.l10n.formatValue('notifyUploadDone').then(str => { + notify(str); + }); + }) + .catch(err => { + // err is 0 when coming from a cancel upload event + if (err === 0) { + return; + } + // only show error page when the error is anything other than user cancelling the upload + Raven.captureException(err); + $('#page-one').attr('hidden', true); + $('#upload-progress').attr('hidden', true); + $('#upload-error').removeAttr('hidden'); + window.clearTimeout(t); + + // record upload-stopped (errored) by sender + sendEvent('sender', 'upload-stopped', { + cm1: file.size, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads, + cd1: event.type === 'drop' ? 'drop' : 'click', + cd2: 'errored', + cd6: err + }); + }); + }, 10); + } + + function allowDrop(ev) { + ev.preventDefault(); + } + + function checkExistence(id, file, populate) { + const xhr = new XMLHttpRequest(); + xhr.onreadystatechange = () => { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status === 200) { + if (populate) { + populateFileList(file); + } + } else if (xhr.status === 404) { + storage.remove(id); + if (storage.numFiles === 0) { + toggleHeader(); + } + } + } + }; + xhr.open('get', '/exists/' + id, true); + xhr.send(); + } + + //update file table with current files in storage + function populateFileList(file) { + const row = document.createElement('tr'); + const name = document.createElement('td'); + const link = document.createElement('td'); + const $copyIcon = $('', { + src: '/resources/copy-16.svg', + class: 'icon-copy', + 'data-l10n-id': 'copyUrlHover' + }); + const expiry = document.createElement('td'); + const del = document.createElement('td'); + const $delIcon = $('', { + src: '/resources/close-16.svg', + class: 'icon-delete', + 'data-l10n-id': 'deleteButtonHover' + }); + const popupDiv = document.createElement('div'); + const $popupText = $('
', { class: 'popuptext' }); + const cellText = document.createTextNode(file.name); + + const url = file.url.trim() + `#${file.secretKey}`.trim(); + + $('#link').attr('value', url); + $('#copy-text').attr( + 'data-l10n-args', + '{"filename": "' + file.name + '"}' + ); + $('#copy-text').attr('data-l10n-id', 'copyUrlFormLabelWithName'); + $popupText.attr('tabindex', '-1'); + + name.appendChild(cellText); + + // create delete button + + const delSpan = document.createElement('span'); + $(delSpan).addClass('icon-cancel-1'); + $(delSpan).attr('data-l10n-id', 'deleteButtonHover'); + del.appendChild(delSpan); + + const linkSpan = document.createElement('span'); + $(linkSpan).addClass('icon-docs'); + $(linkSpan).attr('data-l10n-id', 'copyUrlHover'); + link.appendChild(linkSpan); + + link.style.color = '#0A8DFF'; + + //copy link to clipboard when icon clicked + $copyIcon.click(function() { + // record copied event from upload list + sendEvent('sender', 'copied', { + cd4: 'upload-list' + }); + const aux = document.createElement('input'); + aux.setAttribute('value', url); + document.body.appendChild(aux); + aux.select(); + document.execCommand('copy'); + document.body.removeChild(aux); + document.l10n.formatValue('copiedUrl').then(translated => { + link.innerHTML = translated; + }); + window.setTimeout(() => { + const linkImg = document.createElement('img'); + $(linkImg).addClass('icon-copy'); + $(linkImg).attr('data-l10n-id', 'copyUrlHover'); + $(linkImg).attr('src', '/resources/copy-16.svg'); + $(link).html(linkImg); + }, 500); + }); + + file.creationDate = new Date(file.creationDate); + + const future = new Date(); + future.setTime(file.creationDate.getTime() + file.expiry); + + let countdown = 0; + countdown = future.getTime() - Date.now(); + let minutes = Math.floor(countdown / 1000 / 60); + let hours = Math.floor(minutes / 60); + let seconds = Math.floor(countdown / 1000 % 60); + + poll(); + + function poll() { + countdown = future.getTime() - Date.now(); + minutes = Math.floor(countdown / 1000 / 60); + hours = Math.floor(minutes / 60); + seconds = Math.floor(countdown / 1000 % 60); + let t; + + if (hours >= 1) { + expiry.innerHTML = hours + 'h ' + minutes % 60 + 'm'; + t = window.setTimeout(() => { + poll(); + }, 60000); + } else if (hours === 0) { + expiry.innerHTML = minutes + 'm ' + seconds + 's'; + t = window.setTimeout(() => { + poll(); + }, 1000); + } + //remove from list when expired + if (countdown <= 0) { + storage.remove(file.fileId); + $(expiry).parents('tr').remove(); + window.clearTimeout(t); toggleHeader(); } } - } - }; - xhr.open('get', '/exists/' + id, true); - xhr.send(); - } - //update file table with current files in storage - function populateFileList(file) { - const row = document.createElement('tr'); - const name = document.createElement('td'); - const link = document.createElement('td'); - const $copyIcon = $('', { - src: '/resources/copy-16.svg', - class: 'icon-copy', - 'data-l10n-id': 'copyUrlHover' - }); - const expiry = document.createElement('td'); - const del = document.createElement('td'); - const $delIcon = $('', { - src: '/resources/close-16.svg', - class: 'icon-delete', - 'data-l10n-id': 'deleteButtonHover' - }); - const popupDiv = document.createElement('div'); - const $popupText = $('
', { class: 'popuptext' }); - const cellText = document.createTextNode(file.name); + // create popup + popupDiv.classList.add('popup'); + const $popupMessage = $('
', { class: 'popup-message' }); + $popupMessage.attr('data-l10n-id', 'deletePopupText'); + const $popupAction = $('
', { class: 'popup-action' }); + const $popupNvmSpan = $('', { class: 'popup-no' }); + $popupNvmSpan.attr('data-l10n-id', 'deletePopupCancel'); + const $popupDelSpan = $('', { class: 'popup-yes' }); + $popupDelSpan.attr('data-l10n-id', 'deletePopupYes'); - const url = file.url.trim() + `#${file.secretKey}`.trim(); + $popupText.html([$popupMessage, $popupAction]); + $popupAction.html([$popupNvmSpan, $popupDelSpan]); - $('#link').attr('value', url); - $('#copy-text').attr('data-l10n-args', '{"filename": "' + file.name + '"}'); - $('#copy-text').attr('data-l10n-id', 'copyUrlFormLabelWithName'); - $popupText.attr('tabindex', '-1'); + // add data cells to table row + row.appendChild(name); + $(link).append($copyIcon); + row.appendChild(link); + row.appendChild(expiry); + $(popupDiv).append($popupText); + $(del).append($delIcon); + del.appendChild(popupDiv); + row.appendChild(del); + $('tbody').append(row); //add row to table - name.appendChild(cellText); + const unexpiredFiles = storage.numFiles; - // create delete button + // delete file + $popupText.find('.popup-yes').click(e => { + FileSender.delete(file.fileId, file.deleteToken).then(() => { + $(e.target).parents('tr').remove(); + const timeToExpiry = + ONE_DAY_IN_MS - (Date.now() - file.creationDate.getTime()); + // record upload-deleted from file list + sendEvent('sender', 'upload-deleted', { + cm1: file.size, + cm2: file.totalTime, + cm3: file.uploadSpeed, + cm4: timeToExpiry, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads, + cd1: file.typeOfUpload, + cd4: 'upload-list' + }).then(() => { + storage.remove(file.fileId); + }); + toggleHeader(); + }); + }); - const delSpan = document.createElement('span'); - $(delSpan).addClass('icon-cancel-1'); - $(delSpan).attr('data-l10n-id', 'deleteButtonHover'); - del.appendChild(delSpan); + document.getElementById('delete-file').onclick = () => { + FileSender.delete(file.fileId, file.deleteToken).then(() => { + const timeToExpiry = + ONE_DAY_IN_MS - (Date.now() - file.creationDate.getTime()); + // record upload-deleted from success screen + sendEvent('sender', 'upload-deleted', { + cm1: file.size, + cm2: file.totalTime, + cm3: file.uploadSpeed, + cm4: timeToExpiry, + cm5: storage.totalUploads, + cm6: unexpiredFiles, + cm7: storage.totalDownloads, + cd1: file.typeOfUpload, + cd4: 'success-screen' + }).then(() => { + storage.remove(file.fileId); + location.reload(); + }); + }); + }; + // show popup + $delIcon.click(function() { + $popupText.addClass('show'); + $popupText.focus(); + }); + // hide popup + $popupText.find('.popup-no').click(function(e) { + e.stopPropagation(); + $popupText.removeClass('show'); + }); + $popupText.click(function(e) { + e.stopPropagation(); + }); + //close when popup loses focus + $popupText.blur(() => { + $popupText.removeClass('show'); + }); - const linkSpan = document.createElement('span'); - $(linkSpan).addClass('icon-docs'); - $(linkSpan).attr('data-l10n-id', 'copyUrlHover'); - link.appendChild(linkSpan); - - link.style.color = '#0A8DFF'; - - //copy link to clipboard when icon clicked - $copyIcon.click(function() { - // record copied event from upload list - sendEvent('sender', 'copied', { - cd4: 'upload-list' - }); - const aux = document.createElement('input'); - aux.setAttribute('value', url); - document.body.appendChild(aux); - aux.select(); - document.execCommand('copy'); - document.body.removeChild(aux); - document.l10n.formatValue('copiedUrl').then(translated => { - link.innerHTML = translated; - }); - window.setTimeout(() => { - const linkImg = document.createElement('img'); - $(linkImg).addClass('icon-copy'); - $(linkImg).attr('data-l10n-id', 'copyUrlHover'); - $(linkImg).attr('src', '/resources/copy-16.svg'); - $(link).html(linkImg); - }, 500); - }); - - file.creationDate = new Date(file.creationDate); - - const future = new Date(); - future.setTime(file.creationDate.getTime() + file.expiry); - - let countdown = 0; - countdown = future.getTime() - Date.now(); - let minutes = Math.floor(countdown / 1000 / 60); - let hours = Math.floor(minutes / 60); - let seconds = Math.floor(countdown / 1000 % 60); - - poll(); - - function poll() { - countdown = future.getTime() - Date.now(); - minutes = Math.floor(countdown / 1000 / 60); - hours = Math.floor(minutes / 60); - seconds = Math.floor(countdown / 1000 % 60); - let t; - - if (hours >= 1) { - expiry.innerHTML = hours + 'h ' + minutes % 60 + 'm'; - t = window.setTimeout(() => { - poll(); - }, 60000); - } else if (hours === 0) { - expiry.innerHTML = minutes + 'm ' + seconds + 's'; - t = window.setTimeout(() => { - poll(); - }, 1000); - } - //remove from list when expired - if (countdown <= 0) { - storage.remove(file.fileId); - $(expiry).parents('tr').remove(); - window.clearTimeout(t); toggleHeader(); } - } - - // create popup - popupDiv.classList.add('popup'); - const $popupMessage = $('
', { class: 'popup-message' }); - $popupMessage.attr('data-l10n-id', 'deletePopupText'); - const $popupAction = $('
', { class: 'popup-action' }); - const $popupNvmSpan = $('', { class: 'popup-no' }); - $popupNvmSpan.attr('data-l10n-id', 'deletePopupCancel'); - const $popupDelSpan = $('', { class: 'popup-yes' }); - $popupDelSpan.attr('data-l10n-id', 'deletePopupYes'); - - $popupText.html([$popupMessage, $popupAction]); - $popupAction.html([$popupNvmSpan, $popupDelSpan]); - - // add data cells to table row - row.appendChild(name); - $(link).append($copyIcon); - row.appendChild(link); - row.appendChild(expiry); - $(popupDiv).append($popupText); - $(del).append($delIcon); - del.appendChild(popupDiv); - row.appendChild(del); - $('tbody').append(row); //add row to table - - const unexpiredFiles = storage.numFiles; - - // delete file - $popupText.find('.popup-yes').click(e => { - FileSender.delete(file.fileId, file.deleteToken).then(() => { - $(e.target).parents('tr').remove(); - const timeToExpiry = - ONE_DAY_IN_MS - (Date.now() - file.creationDate.getTime()); - // record upload-deleted from file list - sendEvent('sender', 'upload-deleted', { - cm1: file.size, - cm2: file.totalTime, - cm3: file.uploadSpeed, - cm4: timeToExpiry, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads, - cd1: file.typeOfUpload, - cd4: 'upload-list' - }).then(() => { - storage.remove(file.fileId); - }); - toggleHeader(); + function toggleHeader() { + //hide table header if empty list + if (document.querySelector('tbody').childNodes.length === 1) { + $('#file-list').attr('hidden', true); + } else { + $('#file-list').removeAttr('hidden'); + } + } + }) + .catch(err => { + sendEvent('sender', 'unsupported', { + cd6: err + }).then(() => { + location.replace('/unsupported/gcm'); }); }); - - document.getElementById('delete-file').onclick = () => { - FileSender.delete(file.fileId, file.deleteToken).then(() => { - const timeToExpiry = - ONE_DAY_IN_MS - (Date.now() - file.creationDate.getTime()); - // record upload-deleted from success screen - sendEvent('sender', 'upload-deleted', { - cm1: file.size, - cm2: file.totalTime, - cm3: file.uploadSpeed, - cm4: timeToExpiry, - cm5: storage.totalUploads, - cm6: unexpiredFiles, - cm7: storage.totalDownloads, - cd1: file.typeOfUpload, - cd4: 'success-screen' - }).then(() => { - storage.remove(file.fileId); - location.reload(); - }); - }); - }; - // show popup - $delIcon.click(function() { - $popupText.addClass('show'); - $popupText.focus(); - }); - // hide popup - $popupText.find('.popup-no').click(function(e) { - e.stopPropagation(); - $popupText.removeClass('show'); - }); - $popupText.click(function(e) { - e.stopPropagation(); - }); - //close when popup loses focus - $popupText.blur(() => { - $popupText.removeClass('show'); - }); - - toggleHeader(); - } - function toggleHeader() { - //hide table header if empty list - if (document.querySelector('tbody').childNodes.length === 1) { - $('#file-list').attr('hidden', true); - } else { - $('#file-list').removeAttr('hidden'); - } - } }); diff --git a/frontend/src/utils.js b/frontend/src/utils.js index 1c77b407..91b8da04 100644 --- a/frontend/src/utils.js +++ b/frontend/src/utils.js @@ -60,16 +60,22 @@ function gcmCompliant() { ) .then(() => { return Promise.resolve(); - }) - .catch(err => { - return Promise.reject(); }); }) .catch(err => { - return Promise.reject(); + return loadShim(); }); } catch (err) { - return Promise.reject(); + return loadShim(); + } + function loadShim() { + return new Promise((resolve, reject) => { + const shim = document.createElement('script'); + shim.src = '/cryptofill.js'; + shim.addEventListener('load', resolve); + shim.addEventListener('error', reject); + document.head.appendChild(shim); + }); } } diff --git a/package-lock.json b/package-lock.json index 384d44a7..e478f713 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,12 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@types/node": { + "version": "7.0.39", + "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.39.tgz", + "integrity": "sha512-KQHAZeVsk4UIT9XaR6cn4WpHZzimK6UBD1UomQKfQQFmTlUHaNBzeuov+TM4+kigLO0IJt4I5OOsshcCyA9gSA==", + "dev": true + }, "accepts": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", @@ -181,6 +187,12 @@ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" }, + "asmcrypto.js": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/asmcrypto.js/-/asmcrypto.js-0.0.11.tgz", + "integrity": "sha1-dLshuq/Z3OFoTcBvFShoOzUMHKA=", + "dev": true + }, "asn1.js": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.1.tgz", @@ -5254,6 +5266,12 @@ "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", "dev": true }, + "tslib": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz", + "integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw=", + "dev": true + }, "tty-browserify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", @@ -5290,6 +5308,12 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typescript": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.3.4.tgz", + "integrity": "sha1-PTgyGCgjHkNPKHUUlZw3qCtin0I=", + "dev": true + }, "uglify-js": { "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", @@ -5440,6 +5464,37 @@ "indexof": "0.0.1" } }, + "webcrypto-core": { + "version": "0.1.16", + "resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-0.1.16.tgz", + "integrity": "sha1-3kkUtZFI23Moe8T45hz0+y9W8CA=", + "dev": true, + "requires": { + "@types/node": "6.0.85", + "tslib": "1.7.1" + }, + "dependencies": { + "@types/node": { + "version": "6.0.85", + "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.85.tgz", + "integrity": "sha512-6qLZpfQFO/g5Ns2e7RsW6brk0Q6Xzwiw7kVVU/XiQNOiJXSojhX76GP457PBYIsNMH2WfcGgcnZB4awFDHrwpA==", + "dev": true + } + } + }, + "webcrypto-liner": { + "version": "0.1.25", + "resolved": "https://registry.npmjs.org/webcrypto-liner/-/webcrypto-liner-0.1.25.tgz", + "integrity": "sha512-p/wtjIvs10nZvruEJlglTf5Qjb9W/sDvfEFuw5RjM+axGaXj8mBGF7tFJb5sjVbSTqv1gsxktYWzG/PZfn2A8Q==", + "dev": true, + "requires": { + "@types/node": "7.0.39", + "asmcrypto.js": "0.0.11", + "elliptic": "6.4.0", + "typescript": "2.3.4", + "webcrypto-core": "0.1.16" + } + }, "which": { "version": "1.2.14", "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", diff --git a/package.json b/package.json index 79dae0e4..8f268c45 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "redis": "^2.7.1" }, "devDependencies": { + "asmcrypto.js": "0.0.11", "babel-polyfill": "^6.23.0", "browserify": "^14.4.0", "eslint": "^4.3.0", @@ -38,7 +39,8 @@ "stylelint-config-standard": "^17.0.0", "supertest": "^3.0.0", "testpilot-ga": "^0.3.0", - "uglifyify": "^4.0.3" + "uglifyify": "^4.0.3", + "webcrypto-liner": "^0.1.25" }, "engines": { "node": ">=8.0.0" diff --git a/public/cryptofill.js b/public/cryptofill.js new file mode 100644 index 00000000..db29a332 --- /dev/null +++ b/public/cryptofill.js @@ -0,0 +1,22 @@ +var liner=function(e){function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}var t={};return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=16)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){function n(e){for(var r=[],t=1;t=0;s--){var c=i[s],u=c.arg.substring(1),h=c.index+1;a=a.substring(0,h)+arguments[+u]+a.substring(h+1+u.length)}return a=a.replace("%%","%")}function a(e){var r;r="string"==typeof e?{name:e}:e,h.checkAlgorithm(r);var t=e;return t.hash&&(t.hash=a(t.hash)),r}function o(e,r){if(!e)throw new s("Parameter '"+r+"' is required and cant be empty");if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer);if(e instanceof ArrayBuffer)return new Uint8Array(e);throw new s("Incoming parameter '"+r+"' has wrong data type. Must be ArrayBufferView or ArrayBuffer")}t.d(r,"WebCryptoError",function(){return s}),t.d(r,"AlgorithmError",function(){return c}),t.d(r,"CryptoKeyError",function(){return u}),t.d(r,"PrepareAlgorithm",function(){return a}),t.d(r,"PrepareData",function(){return o}),t.d(r,"BaseCrypto",function(){return h}),t.d(r,"AlgorithmNames",function(){return p}),t.d(r,"Base64Url",function(){return l}),t.d(r,"SubtleCrypto",function(){return W}),t.d(r,"Aes",function(){return m}),t.d(r,"AesAlgorithmError",function(){return A}),t.d(r,"AesWrapKey",function(){return w}),t.d(r,"AesEncrypt",function(){return v}),t.d(r,"AesECB",function(){return g}),t.d(r,"AesCBC",function(){return C}),t.d(r,"AesCTR",function(){return d}),t.d(r,"AesGCM",function(){return E}),t.d(r,"AesKW",function(){return P}),t.d(r,"RsaKeyGenParamsError",function(){return N}),t.d(r,"RsaHashedImportParamsError",function(){return G}),t.d(r,"Rsa",function(){return M}),t.d(r,"RsaSSA",function(){return B}),t.d(r,"RsaPSSParamsError",function(){return T}),t.d(r,"RsaPSS",function(){return D}),t.d(r,"RsaOAEPParamsError",function(){return x}),t.d(r,"RsaOAEP",function(){return H}),t.d(r,"EcKeyGenParamsError",function(){return S}),t.d(r,"Ec",function(){return _}),t.d(r,"EcAlgorithmError",function(){return U}),t.d(r,"EcDSA",function(){return L}),t.d(r,"EcDH",function(){return R}),t.d(r,"ShaAlgorithms",function(){return k}),t.d(r,"Sha",function(){return b});var i=t(6),s=function(e){function r(r){for(var t=[],a=1;a0&&e.length<=128))throw new A(A.PARAM_WRONG_VALUE,"length","number [1-128]")},r}(v);d.ALG_NAME=p.AesCTR;var E=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.i(i.a)(r,e),r.checkAlgorithmParams=function(e){if(this.checkAlgorithm(e),e.additionalData&&!(ArrayBuffer.isView(e.additionalData)||e.additionalData instanceof ArrayBuffer))throw new A(A.PARAM_WRONG_TYPE,"additionalData","ArrayBufferView or ArrayBuffer");if(!e.iv)throw new A(A.PARAM_REQUIRED,"iv");if(!(ArrayBuffer.isView(e.iv)||e.iv instanceof ArrayBuffer))throw new A(A.PARAM_WRONG_TYPE,"iv","ArrayBufferView or ArrayBuffer");if(e.tagLength){if(![32,64,96,104,112,120,128].some(function(r){return r===e.tagLength}))throw new A(A.PARAM_WRONG_VALUE,"tagLength","32, 64, 96, 104, 112, 120 or 128")}},r}(v);E.ALG_NAME=p.AesGCM;var P=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.i(i.a)(r,e),r.checkAlgorithmParams=function(e){this.checkAlgorithm(e)},r}(w);P.ALG_NAME=p.AesKW,P.KEY_USAGES=["wrapKey","unwrapKey"];var k=[p.Sha1,p.Sha256,p.Sha384,p.Sha512].join(" | "),b=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.i(i.a)(r,e),r.checkAlgorithm=function(r){var t;switch(t="string"==typeof r?{name:r}:r,e.checkAlgorithm.call(this,t),t.name.toUpperCase()){case p.Sha1:case p.Sha256:case p.Sha384:case p.Sha512:break;default:throw new c(c.WRONG_ALG_NAME,t.name,k)}},r.digest=function(e,r){var t=this;return new Promise(function(r,n){t.checkAlgorithm(e),r(void 0)})},r}(h),S=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.code=9,r}return t.i(i.a)(r,e),r}(c),_=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.i(i.a)(r,e),r.checkAlgorithm=function(e){if(e.name.toUpperCase()!==this.ALG_NAME.toUpperCase())throw new c(c.WRONG_ALG_NAME,e.name,this.ALG_NAME)},r.checkKeyGenParams=function(e){if(!e.namedCurve)throw new S(S.PARAM_REQUIRED,"namedCurve");if("string"!=typeof e.namedCurve)throw new S(S.PARAM_WRONG_TYPE,"namedCurve","string");switch(e.namedCurve.toUpperCase()){case"P-256":case"P-384":case"P-521":break;default:throw new S(S.PARAM_WRONG_VALUE,"namedCurve","P-256, P-384 or P-521")}},r.checkKeyGenUsages=function(e){var r=this;e.forEach(function(e){var t=0;for(t;t0&&e.length<=512))throw new c(c.PARAM_WRONG_VALUE,"length","more 0 and less than 512")},r.checkKeyGenUsages=function(e){var r=this;this.checkKeyUsages(e),e.forEach(function(e){var t=0;for(t;t=256&&r<=16384)||r%8)throw new N(N.PARAM_WRONG_VALUE,"modulusLength"," a multiple of 8 bits and >= 256 and <= 16384");var t=e.publicExponent;if(!t)throw new N(N.PARAM_REQUIRED,"publicExponent");if(!ArrayBuffer.isView(t))throw new N(N.PARAM_WRONG_TYPE,"publicExponent","ArrayBufferView");if(3!==t[0]&&(1!==t[0]||0!==t[1]||1!==t[2]))throw new N(N.PARAM_WRONG_VALUE,"publicExponent","Uint8Array([3]) | Uint8Array([1, 0, 1])");if(!e.hash)throw new N(N.PARAM_REQUIRED,"hash",k);b.checkAlgorithm(e.hash)},r.checkKeyGenUsages=function(e){var r=this;this.checkKeyUsages(e),e.forEach(function(e){var t=0;for(t;t>>16&65535,n=65535&e,a=r>>>16&65535,o=65535&r;return n*o+(t*o+n*a<<16>>>0)|0})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(){}return e}();r.CryptoKey=n},function(e,r,t){"use strict";function n(e,r){function t(){this.constructor=e}a(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}r.a=n;/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};Object.assign},function(e,r,t){"use strict";function n(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}Object.defineProperty(r,"__esModule",{value:!0}),n(t(4)),n(t(2))},function(e,r,t){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var a=t(0),o=t(1),i=t(5),s=t(3),c=t(4),u=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.generateKey=function(e,r,t){var n=this;return Promise.resolve().then(function(){n.checkModule();var a=c.nativeCrypto.getRandomValues(new Uint8Array(e.length/8)),o=new i.CryptoKey;return o.key=a,o.algorithm=e,o.extractable=r,o.type="secret",o.usages=t,o})},r.encrypt=function(e,r,t){return Promise.resolve().then(function(){var n;switch(e.name.toUpperCase()){case a.AlgorithmNames.AesECB:;n=asmCrypto.AES_ECB.encrypt(t,r.key,!0);break;case a.AlgorithmNames.AesCBC:var i=e;n=asmCrypto.AES_CBC.encrypt(t,r.key,void 0,a.PrepareData(i.iv,"iv"));break;case a.AlgorithmNames.AesGCM:var s=e;s.tagLength=s.tagLength||128;var c=void 0;s.additionalData&&(c=a.PrepareData(s.additionalData,"additionalData")),n=asmCrypto.AES_GCM.encrypt(t,r.key,s.iv,c,s.tagLength/8);break;default:throw new o.LinerError(a.AlgorithmError.UNSUPPORTED_ALGORITHM,e.name)}return n.buffer})},r.decrypt=function(e,r,t){return Promise.resolve().then(function(){var n;switch(e.name.toUpperCase()){case a.AlgorithmNames.AesECB:;n=asmCrypto.AES_ECB.decrypt(t,r.key,!0);break;case a.AlgorithmNames.AesCBC:var i=e;n=asmCrypto.AES_CBC.decrypt(t,r.key,void 0,a.PrepareData(i.iv,"iv"));break;case a.AlgorithmNames.AesGCM:var s=e;s.tagLength=s.tagLength||128;var c=void 0;s.additionalData&&(c=a.PrepareData(s.additionalData,"additionalData")),n=asmCrypto.AES_GCM.decrypt(t,r.key,s.iv,c,s.tagLength/8);break;default:throw new o.LinerError(a.AlgorithmError.UNSUPPORTED_ALGORITHM,e.name)}return n.buffer})},r.wrapKey=function(e,r,t,n){var a;return Promise.resolve().then(function(){return a=new h.Crypto,a.subtle.exportKey(e,r)}).then(function(e){var r;return r=e instanceof ArrayBuffer?new Uint8Array(e):s.string2buffer(JSON.stringify(e)),a.subtle.encrypt(n,t,r)})},r.unwrapKey=function(e,r,t,n,a,o,i){var c;return Promise.resolve().then(function(){return c=new h.Crypto,c.subtle.decrypt(n,t,r)}).then(function(r){var t;return t="jwk"===e.toLowerCase()?JSON.parse(s.buffer2string(new Uint8Array(r))):new Uint8Array(r),c.subtle.importKey(e,t,a,o,i)})},r.alg2jwk=function(e){return"A"+e.length+/-(\w+)/i.exec(e.name.toUpperCase())[1]},r.jwk2alg=function(e){throw new Error("Not implemented")},r.exportKey=function(e,r){var t=this;return Promise.resolve().then(function(){var n=r.key;if("jwk"===e.toLowerCase()){return{alg:t.alg2jwk(r.algorithm),ext:r.extractable,k:a.Base64Url.encode(n),key_ops:r.usages,kty:"oct"}}return n.buffer})},r.importKey=function(e,r,t,n,o){return Promise.resolve().then(function(){var n;if("jwk"===e.toLowerCase()){var s=r;n=a.Base64Url.decode(s.k)}else n=new Uint8Array(r);var c=new i.CryptoKey;return c.algorithm=t,c.type="secret",c.usages=o,c.key=n,c})},r.checkModule=function(){if("undefined"==typeof asmCrypto)throw new o.LinerError(o.LinerError.MODULE_NOT_FOUND,"asmCrypto","https://github.com/vibornoff/asmcrypto.js")},r}(a.BaseCrypto);r.AesCrypto=u;var h=t(2)},function(e,r,t){"use strict";function n(e){for(var r=new Uint8Array(e),t=[],n=0;n32?o>48?66:48:32,t.length32?o>48?66:48:32,t.length/232?o>48?66:48:32,a.length-1&&("public"===e.type||"secret"===e.type)&&e.usages.push(t)}),["sign","decrypt","unwrapKey","deriveKey","deriveBits"].forEach(function(t){r.indexOf(t)>-1&&("private"===e.type||"secret"===e.type)&&e.usages.push(t)})))})}function s(e,r,t){if(r&&A.BrowserInfo().name===A.Browser.IE){"extractable"in e&&(e.ext=e.extractable,delete e.extractable);var n=null;switch(r.name.toUpperCase()){case h.AlgorithmNames.RsaOAEP.toUpperCase():case h.AlgorithmNames.RsaPSS.toUpperCase():case h.AlgorithmNames.RsaSSA.toUpperCase():n=g.RsaCrypto;break;case h.AlgorithmNames.AesECB.toUpperCase():case h.AlgorithmNames.AesCBC.toUpperCase():case h.AlgorithmNames.AesGCM.toUpperCase():n=w.AesCrypto;break;default:throw new m.LinerError(m.LinerError.UNSUPPORTED_ALGORITHM,r.name.toUpperCase())}n&&!e.alg&&(e.alg=n.alg2jwk(r)),"key_ops"in e||(e.key_ops=t)}}function c(e){A.BrowserInfo().name===A.Browser.IE&&("ext"in e&&(e.extractable=e.ext,delete e.ext),delete e.key_ops,delete e.alg)}var u=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var h=t(0),p=t(0),f=t(0),l=t(4),y=t(2),m=t(1),A=t(3),w=t(8),v=t(11),g=t(10),C=t(9),d=[],E=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),r.prototype.generateKey=function(r,t,n){var o,s=arguments;return e.prototype.generateKey.apply(this,s).then(function(e){if(o=f.PrepareAlgorithm(r),(A.BrowserInfo().name!==A.Browser.Edge||o.name.toUpperCase()!==h.AlgorithmNames.AesGCM)&&l.nativeSubtle)try{return l.nativeSubtle.generateKey.apply(l.nativeSubtle,s).catch(function(e){console.warn("WebCrypto: native generateKey for "+o.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native generateKey for "+o.name+" doesn't work.",e.message||"")}}).then(function(e){if(e)return i(e,n),a(o,e),e;var r;switch(o.name.toLowerCase()){case h.AlgorithmNames.AesECB.toLowerCase():case h.AlgorithmNames.AesCBC.toLowerCase():case h.AlgorithmNames.AesGCM.toLowerCase():r=w.AesCrypto;break;case h.AlgorithmNames.EcDSA.toLowerCase():case h.AlgorithmNames.EcDH.toLowerCase():r=C.EcCrypto;break;case h.AlgorithmNames.RsaOAEP.toLowerCase():case h.AlgorithmNames.RsaPSS.toLowerCase():case h.AlgorithmNames.RsaSSA.toLowerCase():r=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.UNSUPPORTED_ALGORITHM,o.name.toLowerCase())}return r.generateKey(o,t,n)})},r.prototype.digest=function(r,t){var n,a,o=arguments;return e.prototype.digest.apply(this,o).then(function(e){if(n=f.PrepareAlgorithm(r),a=f.PrepareData(t,"data"),l.nativeSubtle)try{return l.nativeSubtle.digest.apply(l.nativeSubtle,o).catch(function(e){console.warn("WebCrypto: native digest for "+n.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native digest for "+n.name+" doesn't work.",e.message||"")}}).then(function(e){return e||v.ShaCrypto.digest(n,a)})},r.prototype.sign=function(r,t,a){var i,s,c=arguments;return e.prototype.sign.apply(this,c).then(function(e){i=f.PrepareAlgorithm(r),s=f.PrepareData(a,"data");var n=o(t);if(n&&(c[0]=A.assign(i,n)),l.nativeSubtle)try{return l.nativeSubtle.sign.apply(l.nativeSubtle,c).catch(function(e){console.warn("WebCrypto: native sign for "+i.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native sign for "+i.name+" doesn't work.",e.message||"")}}).then(function(e){if(e)return e;var r;switch(i.name.toLowerCase()){case h.AlgorithmNames.EcDSA.toLowerCase():r=C.EcCrypto;break;case h.AlgorithmNames.RsaSSA.toLowerCase():case h.AlgorithmNames.RsaPSS.toLowerCase():r=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.UNSUPPORTED_ALGORITHM,i.name.toLowerCase())}return n(t,r).then(function(e){return r.sign(i,e,s)})})},r.prototype.verify=function(r,t,a,i){var s,c,u,p=arguments;return e.prototype.verify.apply(this,p).then(function(e){s=f.PrepareAlgorithm(r),c=f.PrepareData(a,"data"),u=f.PrepareData(i,"data");var n=o(t);if(n&&(p[0]=A.assign(s,n)),l.nativeSubtle)try{return l.nativeSubtle.verify.apply(l.nativeSubtle,p).catch(function(e){console.warn("WebCrypto: native verify for "+s.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native verify for "+s.name+" doesn't work.",e.message||"")}}).then(function(e){if("boolean"==typeof e)return e;var r;switch(s.name.toLowerCase()){case h.AlgorithmNames.EcDSA.toLowerCase():r=C.EcCrypto;break;case h.AlgorithmNames.RsaSSA.toLowerCase():case h.AlgorithmNames.RsaPSS.toLowerCase():r=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.UNSUPPORTED_ALGORITHM,s.name.toLowerCase())}return n(t,r).then(function(e){return r.verify(s,e,c,u)})})},r.prototype.deriveBits=function(r,t,n){var a,o=arguments;return e.prototype.deriveBits.apply(this,o).then(function(e){if(a=f.PrepareAlgorithm(r),l.nativeSubtle)try{return l.nativeSubtle.deriveBits.apply(l.nativeSubtle,o).catch(function(e){console.warn("WebCrypto: native deriveBits for "+a.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native deriveBits for "+a.name+" doesn't work.",e.message||"")}}).then(function(e){if(e)return e;var r;switch(a.name.toLowerCase()){case h.AlgorithmNames.EcDH.toLowerCase():r=C.EcCrypto;break;default:throw new m.LinerError(m.LinerError.NOT_SUPPORTED,"deriveBits")}return r.deriveBits(a,t,n)})},r.prototype.deriveKey=function(r,t,n,a,o){var s,c,u=arguments;return e.prototype.deriveKey.apply(this,u).then(function(e){if(s=f.PrepareAlgorithm(r),c=f.PrepareAlgorithm(n),l.nativeSubtle)try{return l.nativeSubtle.deriveKey.apply(l.nativeSubtle,u).catch(function(e){console.warn("WebCrypto: native deriveKey for "+s.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native deriveKey for "+s.name+" doesn't work.",e.message||"")}}).then(function(e){if(e)return i(e,o),e;var r;switch(s.name.toLowerCase()){case h.AlgorithmNames.EcDH.toLowerCase():r=C.EcCrypto;break;default:throw new m.LinerError(m.LinerError.NOT_SUPPORTED,"deriveBits")}return r.deriveKey(s,t,c,a,o)})},r.prototype.encrypt=function(r,t,a){var o,i,s=arguments;return e.prototype.encrypt.apply(this,s).then(function(e){if(o=f.PrepareAlgorithm(r),i=f.PrepareData(a,"data"),l.nativeSubtle)try{return l.nativeSubtle.encrypt.apply(l.nativeSubtle,s).catch(function(e){console.warn("WebCrypto: native 'encrypt' for "+o.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native 'encrypt' for "+o.name+" doesn't work.",e.message||"")}}).then(function(e){if(e){if(A.BrowserInfo().name===A.Browser.IE&&o.name.toUpperCase()===h.AlgorithmNames.AesGCM&&e.ciphertext){var r=new Uint8Array(e.ciphertext.byteLength+e.tag.byteLength),a=0;new Uint8Array(e.ciphertext).forEach(function(e){return r[a++]=e}),new Uint8Array(e.tag).forEach(function(e){return r[a++]=e}),e=r.buffer}return Promise.resolve(e)}var s;switch(o.name.toLowerCase()){case h.AlgorithmNames.AesECB.toLowerCase():case h.AlgorithmNames.AesCBC.toLowerCase():case h.AlgorithmNames.AesGCM.toLowerCase():s=w.AesCrypto;break;case h.AlgorithmNames.RsaOAEP.toLowerCase():s=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.NOT_SUPPORTED,"encrypt")}return n(t,s).then(function(e){return s.encrypt(o,e,i)})})},r.prototype.decrypt=function(r,t,n){var a,o,i=arguments;return e.prototype.decrypt.apply(this,i).then(function(e){a=f.PrepareAlgorithm(r),o=f.PrepareData(n,"data");var i=o;if(A.BrowserInfo().name===A.Browser.IE&&a.name.toUpperCase()===h.AlgorithmNames.AesGCM){var s=o.byteLength-a.tagLength/8;i={ciphertext:o.buffer.slice(0,s),tag:o.buffer.slice(s,o.byteLength)}}if(t.key){var c=void 0;switch(a.name.toLowerCase()){case h.AlgorithmNames.AesECB.toLowerCase():case h.AlgorithmNames.AesCBC.toLowerCase():case h.AlgorithmNames.AesGCM.toLowerCase():c=w.AesCrypto;break;case h.AlgorithmNames.RsaOAEP.toLowerCase():c=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.NOT_SUPPORTED,"decrypt")}return c.decrypt(a,t,o)}return l.nativeSubtle.decrypt.call(l.nativeSubtle,a,t,i)})},r.prototype.wrapKey=function(r,t,n,a){var o,i=arguments;return e.prototype.wrapKey.apply(this,i).then(function(e){if(o=f.PrepareAlgorithm(a),l.nativeSubtle)try{return l.nativeSubtle.wrapKey.apply(l.nativeSubtle,i).catch(function(e){console.warn("WebCrypto: native 'wrapKey' for "+o.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native 'wrapKey' for "+o.name+" doesn't work.",e.message||"")}}).then(function(e){if(e)return e;var a;switch(o.name.toLowerCase()){case h.AlgorithmNames.AesECB.toLowerCase():case h.AlgorithmNames.AesCBC.toLowerCase():case h.AlgorithmNames.AesGCM.toLowerCase():a=w.AesCrypto;break;case h.AlgorithmNames.RsaOAEP.toLowerCase():a=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.NOT_SUPPORTED,"wrapKey")}return a.wrapKey(r,t,n,o)})},r.prototype.unwrapKey=function(r,t,n,a,o,s,c){var u,p,y,v=this,C=arguments;return e.prototype.unwrapKey.apply(this,C).then(function(e){if(u=f.PrepareAlgorithm(a),p=f.PrepareAlgorithm(o),y=f.PrepareData(t,"wrappedKey"),n.key){var d=void 0;switch(u.name.toLowerCase()){case h.AlgorithmNames.AesECB.toLowerCase():case h.AlgorithmNames.AesCBC.toLowerCase():case h.AlgorithmNames.AesGCM.toLowerCase():d=w.AesCrypto;break;case h.AlgorithmNames.RsaOAEP.toLowerCase():d=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.NOT_SUPPORTED,"unwrapKey")}return d.unwrapKey(r,y,n,u,p,s,c)}return l.nativeSubtle.unwrapKey.apply(l.nativeSubtle,C).catch(function(e){return v.decrypt(u,n,t).then(function(e){var t;return t="jwk"===r?JSON.parse(A.buffer2string(new Uint8Array(e))):e,v.importKey(r,t,p,s,c)})}).then(function(e){if(e)return i(e,c),e}).catch(function(e){throw console.error(e),new Error("Cannot unwrap key from incoming data")})})},r.prototype.exportKey=function(r,t){var n=arguments;return e.prototype.exportKey.apply(this,n).then(function(){if(l.nativeSubtle)try{return l.nativeSubtle.exportKey.apply(l.nativeSubtle,n).catch(function(e){console.warn("WebCrypto: native 'exportKey' for "+t.algorithm.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native 'exportKey' for "+t.algorithm.name+" doesn't work.",e.message||"")}}).then(function(e){if(e){"jwk"===r&&e instanceof ArrayBuffer&&(e=A.buffer2string(new Uint8Array(e)),e=JSON.parse(e));var n=o(t);return n||(n=A.assign({},t.algorithm)),s(e,n,t.usages),Promise.resolve(e)}if(!t.key)throw new m.LinerError("Cannot export native CryptoKey from JS implementation");var a;switch(t.algorithm.name.toLowerCase()){case h.AlgorithmNames.AesECB.toLowerCase():case h.AlgorithmNames.AesCBC.toLowerCase():case h.AlgorithmNames.AesGCM.toLowerCase():a=w.AesCrypto;break;case h.AlgorithmNames.EcDH.toLowerCase():case h.AlgorithmNames.EcDSA.toLowerCase():a=C.EcCrypto;break;case h.AlgorithmNames.RsaSSA.toLowerCase():case h.AlgorithmNames.RsaPSS.toLowerCase():case h.AlgorithmNames.RsaOAEP.toLowerCase():a=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.UNSUPPORTED_ALGORITHM,t.algorithm.name.toLowerCase())}return a.exportKey(r,t)})},r.prototype.importKey=function(r,t,n,o,s){var u,p,y=arguments;return e.prototype.importKey.apply(this,y).then(function(e){if(u=f.PrepareAlgorithm(n),p=t,A.BrowserInfo().name!==A.Browser.Safari&&A.BrowserInfo().name!==A.Browser.IE||(A.BrowserInfo().name===A.Browser.IE&&(t=A.assign({},t),c(t)),y[1]=A.string2buffer(JSON.stringify(t)).buffer),ArrayBuffer.isView(t)&&(p=f.PrepareData(t,"keyData")),l.nativeSubtle)try{return l.nativeSubtle.importKey.apply(l.nativeSubtle,y).catch(function(e){console.warn("WebCrypto: native 'importKey' for "+u.name+" doesn't work.",e.message||"")})}catch(e){console.warn("WebCrypto: native 'importKey' for "+u.name+" doesn't work.",e.message||"")}}).then(function(e){if(e)return a(u,e),i(e,s),Promise.resolve(e);var t;switch(u.name.toLowerCase()){case h.AlgorithmNames.AesECB.toLowerCase():case h.AlgorithmNames.AesCBC.toLowerCase():case h.AlgorithmNames.AesGCM.toLowerCase():t=w.AesCrypto;break;case h.AlgorithmNames.EcDH.toLowerCase():case h.AlgorithmNames.EcDSA.toLowerCase():t=C.EcCrypto;break;case h.AlgorithmNames.RsaSSA.toLowerCase():case h.AlgorithmNames.RsaPSS.toLowerCase():case h.AlgorithmNames.RsaOAEP.toLowerCase():t=g.RsaCrypto;break;default:throw new m.LinerError(m.LinerError.UNSUPPORTED_ALGORITHM,u.name.toLowerCase())}return t.importKey(r,p,u,o,s)})},r}(p.SubtleCrypto);r.SubtleCrypto=E,Uint8Array.prototype.forEach||(Uint8Array.prototype.forEach=function(e){for(var r=0;re;e++){var g=a.charCodeAt(e);if(b&&g>=55296&&56319>=g){if(++e>=c)throw new Error("Malformed string, low surrogate expected at position "+e);g=(55296^g)<<10|65536|56320^a.charCodeAt(e)}else if(!b&&g>>>8)throw new Error("Wide characters are not allowed.");!b||127>=g?d[f++]=g:2047>=g?(d[f++]=192|g>>6,d[f++]=128|63&g):65535>=g?(d[f++]=224|g>>12,d[f++]=128|g>>6&63,d[f++]=128|63&g):(d[f++]=240|g>>18,d[f++]=128|g>>12&63,d[f++]=128|g>>6&63,d[f++]=128|63&g)}return d.subarray(0,f)}function g(a){var b=a.length;1&b&&(a="0"+a,b++);for(var c=new Uint8Array(b>>1),d=0;b>d;d+=2)c[d>>1]=parseInt(a.substr(d,2),16);return c}function h(a){return f(atob(a))}function i(a,b){b=!!b;for(var c=a.length,d=new Array(c),e=0,f=0;c>e;e++){var g=a[e];if(!b||128>g)d[f++]=g;else if(g>=192&&224>g&&c>e+1)d[f++]=(31&g)<<6|63&a[++e];else if(g>=224&&240>g&&c>e+2)d[f++]=(15&g)<<12|(63&a[++e])<<6|63&a[++e];else{if(!(g>=240&&248>g&&c>e+3))throw new Error("Malformed UTF8 character at byte offset "+e);var h=(7&g)<<18|(63&a[++e])<<12|(63&a[++e])<<6|63&a[++e];65535>=h?d[f++]=h:(h^=65536,d[f++]=55296|h>>10,d[f++]=56320|1023&h)}}for(var i="",j=16384,e=0;f>e;e+=j)i+=String.fromCharCode.apply(String,d.slice(e,f>=e+j?e+j:f));return i}function j(a){for(var b="",c=0;c>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a+=1}function m(a){return"number"==typeof a}function n(a){return"string"==typeof a}function o(a){return a instanceof ArrayBuffer}function p(a){return a instanceof Uint8Array}function q(a){return a instanceof Int8Array||a instanceof Uint8Array||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array}function r(a,b){var c=b.heap,d=c?c.byteLength:b.heapSize||65536;if(4095&d||0>=d)throw new Error("heap size must be a positive integer and a multiple of 4096");return c=c||new a(new ArrayBuffer(d))}function s(a,b,c,d,e){var f=a.length-b,g=e>f?f:e;return a.set(c.subarray(d,d+g),b),g}function t(a){a=a||{},this.heap=r(Uint8Array,a).subarray(Xa.HEAP_DATA),this.asm=a.asm||Xa(b,null,this.heap.buffer),this.mode=null,this.key=null,this.reset(a)}function u(a){if(void 0!==a){if(o(a)||p(a))a=new Uint8Array(a);else{if(!n(a))throw new TypeError("unexpected key type");a=f(a)}var b=a.length;if(16!==b&&24!==b&&32!==b)throw new d("illegal key size");var c=new DataView(a.buffer,a.byteOffset,a.byteLength);this.asm.set_key(b>>2,c.getUint32(0),c.getUint32(4),c.getUint32(8),c.getUint32(12),b>16?c.getUint32(16):0,b>16?c.getUint32(20):0,b>24?c.getUint32(24):0,b>24?c.getUint32(28):0),this.key=a}else if(!this.key)throw new Error("key is required")}function v(a){if(void 0!==a){if(o(a)||p(a))a=new Uint8Array(a);else{if(!n(a))throw new TypeError("unexpected iv type");a=f(a)}if(16!==a.length)throw new d("illegal iv size");var b=new DataView(a.buffer,a.byteOffset,a.byteLength);this.iv=a,this.asm.set_iv(b.getUint32(0),b.getUint32(4),b.getUint32(8),b.getUint32(12))}else this.iv=null,this.asm.set_iv(0,0,0,0)}function w(a){void 0!==a?this.padding=!!a:this.padding=!0}function x(a){return a=a||{},this.result=null,this.pos=0,this.len=0,u.call(this,a.key),this.hasOwnProperty("iv")&&v.call(this,a.iv),this.hasOwnProperty("padding")&&w.call(this,a.padding),this}function y(a){if(n(a)&&(a=f(a)),o(a)&&(a=new Uint8Array(a)),!p(a))throw new TypeError("data isn't of expected type");for(var b=this.asm,c=this.heap,d=Xa.ENC[this.mode],e=Xa.HEAP_DATA,g=this.pos,h=this.len,i=0,j=a.length||0,k=0,l=h+j&-16,m=0,q=new Uint8Array(l);j>0;)m=s(c,g+h,a,i,j),h+=m,i+=m,j-=m,m=b.cipher(d,e+g,h),m&&q.set(c.subarray(g,g+m),k),k+=m,h>m?(g+=m,h-=m):(g=0,h=0);return this.result=q,this.pos=g,this.len=h,this}function z(a){var b=null,c=0;void 0!==a&&(b=y.call(this,a).result,c=b.length);var e=this.asm,f=this.heap,g=Xa.ENC[this.mode],h=Xa.HEAP_DATA,i=this.pos,j=this.len,k=16-j%16,l=j;if(this.hasOwnProperty("padding")){if(this.padding){for(var m=0;k>m;++m)f[i+j+m]=k;j+=k,l=j}else if(j%16)throw new d("data length must be a multiple of the block size")}else j+=k;var n=new Uint8Array(c+l);return c&&n.set(b),j&&e.cipher(g,h+i,j),l&&n.set(f.subarray(i,i+l),c),this.result=n,this.pos=0,this.len=0,this}function A(a){this.nonce=null,this.counter=0,this.counterSize=0,t.call(this,a),this.mode="CTR"}function B(a){A.call(this,a)}function C(a,b,c){if(void 0!==c){if(8>c||c>48)throw new d("illegal counter size");this.counterSize=c;var e=Math.pow(2,c)-1;this.asm.set_mask(0,0,e/4294967296|0,0|e)}else this.counterSize=c=48,this.asm.set_mask(0,0,65535,4294967295);if(void 0===a)throw new Error("nonce is required");if(o(a)||p(a))a=new Uint8Array(a);else{if(!n(a))throw new TypeError("unexpected nonce type");a=f(a)}var g=a.length;if(!g||g>16)throw new d("illegal nonce size");this.nonce=a;var h=new DataView(new ArrayBuffer(16));if(new Uint8Array(h.buffer).set(a),this.asm.set_nonce(h.getUint32(0),h.getUint32(4),h.getUint32(8),h.getUint32(12)),void 0!==b){if(!m(b))throw new TypeError("unexpected counter type");if(0>b||b>=Math.pow(2,c))throw new d("illegal counter value");this.counter=b,this.asm.set_counter(0,0,b/4294967296|0,0|b)}else this.counter=b=0}function D(a){return a=a||{},x.call(this,a),C.call(this,a.nonce,a.counter,a.counterSize),this}function E(a){for(var b=this.heap,c=this.asm,d=0,e=a.length||0,f=0;e>0;){for(f=s(b,0,a,d,e),d+=f,e-=f;15&f;)b[f++]=0;c.mac(Xa.MAC.GCM,Xa.HEAP_DATA,f)}}function F(a){this.nonce=null,this.adata=null,this.iv=null,this.counter=1,this.tagSize=16,t.call(this,a),this.mode="GCM"}function G(a){F.call(this,a)}function H(a){F.call(this,a)}function I(a){a=a||{},x.call(this,a);var b=this.asm,c=this.heap;b.gcm_init();var e=a.tagSize;if(void 0!==e){if(!m(e))throw new TypeError("tagSize must be a number");if(4>e||e>16)throw new d("illegal tagSize value");this.tagSize=e}else this.tagSize=16;var g=a.nonce;if(void 0===g)throw new Error("nonce is required");if(p(g)||o(g))g=new Uint8Array(g);else{if(!n(g))throw new TypeError("unexpected nonce type");g=f(g)}this.nonce=g;var h=g.length||0,i=new Uint8Array(16);12!==h?(E.call(this,g),c[0]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=0,c[11]=h>>>29,c[12]=h>>>21&255,c[13]=h>>>13&255,c[14]=h>>>5&255,c[15]=h<<3&255,b.mac(Xa.MAC.GCM,Xa.HEAP_DATA,16),b.get_iv(Xa.HEAP_DATA),b.set_iv(),i.set(c.subarray(0,16))):(i.set(g),i[15]=1);var j=new DataView(i.buffer);this.gamma0=j.getUint32(12),b.set_nonce(j.getUint32(0),j.getUint32(4),j.getUint32(8),0),b.set_mask(0,0,0,4294967295);var k=a.adata;if(void 0!==k&&null!==k){if(p(k)||o(k))k=new Uint8Array(k);else{if(!n(k))throw new TypeError("unexpected adata type");k=f(k)}if(k.length>$a)throw new d("illegal adata length");k.length?(this.adata=k,E.call(this,k)):this.adata=null}else this.adata=null;var l=a.counter;if(void 0!==l){if(!m(l))throw new TypeError("counter must be a number");if(1>l||l>4294967295)throw new RangeError("counter must be a positive 32-bit integer");this.counter=l,b.set_counter(0,0,0,this.gamma0+l|0)}else this.counter=1,b.set_counter(0,0,0,this.gamma0+1|0);var q=a.iv;if(void 0!==q){if(!m(l))throw new TypeError("counter must be a number");this.iv=q,v.call(this,q)}return this}function J(a){if(n(a)&&(a=f(a)),o(a)&&(a=new Uint8Array(a)),!p(a))throw new TypeError("data isn't of expected type");var b=0,c=a.length||0,d=this.asm,e=this.heap,g=this.counter,h=this.pos,i=this.len,j=0,k=i+c&-16,l=0;if((g-1<<4)+i+c>$a)throw new RangeError("counter overflow");for(var m=new Uint8Array(k);c>0;)l=s(e,h+i,a,b,c),i+=l,b+=l,c-=l,l=d.cipher(Xa.ENC.CTR,Xa.HEAP_DATA+h,i),l=d.mac(Xa.MAC.GCM,Xa.HEAP_DATA+h,l),l&&m.set(e.subarray(h,h+l),j),g+=l>>>4,j+=l,i>l?(h+=l,i-=l):(h=0,i=0);return this.result=m,this.counter=g,this.pos=h,this.len=i,this}function K(){var a=this.asm,b=this.heap,c=this.counter,d=this.tagSize,e=this.adata,f=this.pos,g=this.len,h=new Uint8Array(g+d);a.cipher(Xa.ENC.CTR,Xa.HEAP_DATA+f,g+15&-16),g&&h.set(b.subarray(f,f+g));for(var i=g;15&i;i++)b[f+i]=0;a.mac(Xa.MAC.GCM,Xa.HEAP_DATA+f,i);var j=null!==e?e.length:0,k=(c-1<<4)+g;return b[0]=b[1]=b[2]=0,b[3]=j>>>29,b[4]=j>>>21,b[5]=j>>>13&255,b[6]=j>>>5&255,b[7]=j<<3&255,b[8]=b[9]=b[10]=0,b[11]=k>>>29,b[12]=k>>>21&255,b[13]=k>>>13&255,b[14]=k>>>5&255,b[15]=k<<3&255,a.mac(Xa.MAC.GCM,Xa.HEAP_DATA,16),a.get_iv(Xa.HEAP_DATA),a.set_counter(0,0,0,this.gamma0),a.cipher(Xa.ENC.CTR,Xa.HEAP_DATA,16),h.set(b.subarray(0,d),g),this.result=h,this.counter=1,this.pos=0,this.len=0,this}function L(a){var b=J.call(this,a).result,c=K.call(this).result,d=new Uint8Array(b.length+c.length);return b.length&&d.set(b),c.length&&d.set(c,b.length),this.result=d,this}function M(a){if(n(a)&&(a=f(a)),o(a)&&(a=new Uint8Array(a)),!p(a))throw new TypeError("data isn't of expected type");var b=0,c=a.length||0,d=this.asm,e=this.heap,g=this.counter,h=this.tagSize,i=this.pos,j=this.len,k=0,l=j+c>h?j+c-h&-16:0,m=j+c-l,q=0;if((g-1<<4)+j+c>$a)throw new RangeError("counter overflow");for(var r=new Uint8Array(l);c>m;)q=s(e,i+j,a,b,c-m),j+=q,b+=q,c-=q,q=d.mac(Xa.MAC.GCM,Xa.HEAP_DATA+i,q),q=d.cipher(Xa.DEC.CTR,Xa.HEAP_DATA+i,q),q&&r.set(e.subarray(i,i+q),k),g+=q>>>4,k+=q,i=0,j=0;return c>0&&(j+=s(e,0,a,b,c)),this.result=r,this.counter=g,this.pos=i,this.len=j,this}function N(){var a=this.asm,b=this.heap,d=this.tagSize,f=this.adata,g=this.counter,h=this.pos,i=this.len,j=i-d,k=0;if(d>i)throw new c("authentication tag not found");for(var l=new Uint8Array(j),m=new Uint8Array(b.subarray(h+j,h+i)),n=j;15&n;n++)b[h+n]=0;k=a.mac(Xa.MAC.GCM,Xa.HEAP_DATA+h,n),k=a.cipher(Xa.DEC.CTR,Xa.HEAP_DATA+h,n),j&&l.set(b.subarray(h,h+j));var o=null!==f?f.length:0,p=(g-1<<4)+i-d;b[0]=b[1]=b[2]=0,b[3]=o>>>29,b[4]=o>>>21,b[5]=o>>>13&255,b[6]=o>>>5&255,b[7]=o<<3&255,b[8]=b[9]=b[10]=0,b[11]=p>>>29,b[12]=p>>>21&255,b[13]=p>>>13&255,b[14]=p>>>5&255,b[15]=p<<3&255,a.mac(Xa.MAC.GCM,Xa.HEAP_DATA,16),a.get_iv(Xa.HEAP_DATA),a.set_counter(0,0,0,this.gamma0),a.cipher(Xa.ENC.CTR,Xa.HEAP_DATA,16);for(var q=0,n=0;d>n;++n)q|=m[n]^b[n];if(q)throw new e("data integrity check failed");return this.result=l,this.counter=1,this.pos=0,this.len=0,this}function O(a){var b=M.call(this,a).result,c=N.call(this).result,d=new Uint8Array(b.length+c.length);return b.length&&d.set(b),c.length&&d.set(c,b.length),this.result=d,this}function P(a,b,c,d,e){if(void 0===a)throw new SyntaxError("data required");if(void 0===b)throw new SyntaxError("key required");if(void 0===c)throw new SyntaxError("nonce required");return new F({heap:cb,asm:db,key:b,nonce:c,adata:d,tagSize:e}).encrypt(a).result}function Q(a,b,c,d,e){if(void 0===a)throw new SyntaxError("data required");if(void 0===b)throw new SyntaxError("key required");if(void 0===c)throw new SyntaxError("nonce required");return new F({heap:cb,asm:db,key:b,nonce:c,adata:d,tagSize:e}).decrypt(a).result}function R(){return this.result=null,this.pos=0,this.len=0,this.asm.reset(),this}function S(a){if(null!==this.result)throw new c("state must be reset before processing new data");if(n(a)&&(a=f(a)),o(a)&&(a=new Uint8Array(a)),!p(a))throw new TypeError("data isn't of expected type");for(var b=this.asm,d=this.heap,e=this.pos,g=this.len,h=0,i=a.length,j=0;i>0;)j=s(d,e+g,a,h,i),g+=j,h+=j,i-=j,j=b.process(e,g),e+=j,g-=j,g||(e=0);return this.pos=e,this.len=g,this}function T(){if(null!==this.result)throw new c("state must be reset before processing new data");return this.asm.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(this.heap.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this}function U(a,b,c){"use asm";var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;var D=new a.Uint8Array(c);function E(Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da){Q=Q|0;R=R|0;S=S|0;T=T|0;U=U|0;V=V|0;W=W|0;X=X|0;Y=Y|0;Z=Z|0;$=$|0;_=_|0;aa=aa|0;ba=ba|0;ca=ca|0;da=da|0;var ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0;ea=d;fa=e;ga=f;ha=g;ia=h;ja=i;ka=j;la=k;ma=Q+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+1116352408|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=R+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+1899447441|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=S+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+3049323471|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=T+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+3921009573|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=U+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+961987163|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=V+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+1508970993|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=W+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+2453635748|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=X+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+2870763221|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;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^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+2162078206|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=ca+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+2614888103|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ma=da+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+3248222580|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;Q=ma=(R>>>7^R>>>18^R>>>3^R<<25^R<<14)+(ca>>>17^ca>>>19^ca>>>10^ca<<15^ca<<13)+Q+Z|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+3835390401|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;R=ma=(S>>>7^S>>>18^S>>>3^S<<25^S<<14)+(da>>>17^da>>>19^da>>>10^da<<15^da<<13)+R+$|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+4022224774|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30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(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ca=ma=(da>>>7^da>>>18^da>>>3^da<<25^da<<14)+(aa>>>17^aa>>>19^aa>>>10^aa<<15^aa<<13)+ca+X|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+113926993|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;da=ma=(Q>>>7^Q>>>18^Q>>>3^Q<<25^Q<<14)+(ba>>>17^ba>>>19^ba>>>10^ba<<15^ba<<13)+da+Y|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+338241895|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;Q=ma=(R>>>7^R>>>18^R>>>3^R<<25^R<<14)+(ca>>>17^ca>>>19^ca>>>10^ca<<15^ca<<13)+Q+Z|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+666307205|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;R=ma=(S>>>7^S>>>18^S>>>3^S<<25^S<<14)+(da>>>17^da>>>19^da>>>10^da<<15^da<<13)+R+$|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+773529912|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;S=ma=(T>>>7^T>>>18^T>>>3^T<<25^T<<14)+(Q>>>17^Q>>>19^Q>>>10^Q<<15^Q<<13)+S+_|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+1294757372|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;T=ma=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(R>>>17^R>>>19^R>>>10^R<<15^R<<13)+T+aa|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+1396182291|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;U=ma=(V>>>7^V>>>18^V>>>3^V<<25^V<<14)+(S>>>17^S>>>19^S>>>10^S<<15^S<<13)+U+ba|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+1695183700|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;V=ma=(W>>>7^W>>>18^W>>>3^W<<25^W<<14)+(T>>>17^T>>>19^T>>>10^T<<15^T<<13)+V+ca|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+1986661051|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;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ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;ca=ma=(da>>>7^da>>>18^da>>>3^da<<25^da<<14)+(aa>>>17^aa>>>19^aa>>>10^aa<<15^aa<<13)+ca+X|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+4094571909|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;da=ma=(Q>>>7^Q>>>18^Q>>>3^Q<<25^Q<<14)+(ba>>>17^ba>>>19^ba>>>10^ba<<15^ba<<13)+da+Y|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+275423344|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;Q=ma=(R>>>7^R>>>18^R>>>3^R<<25^R<<14)+(ca>>>17^ca>>>19^ca>>>10^ca<<15^ca<<13)+Q+Z|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+430227734|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;R=ma=(S>>>7^S>>>18^S>>>3^S<<25^S<<14)+(da>>>17^da>>>19^da>>>10^da<<15^da<<13)+R+$|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+506948616|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;S=ma=(T>>>7^T>>>18^T>>>3^T<<25^T<<14)+(Q>>>17^Q>>>19^Q>>>10^Q<<15^Q<<13)+S+_|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+659060556|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;T=ma=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(R>>>17^R>>>19^R>>>10^R<<15^R<<13)+T+aa|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+883997877|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;U=ma=(V>>>7^V>>>18^V>>>3^V<<25^V<<14)+(S>>>17^S>>>19^S>>>10^S<<15^S<<13)+U+ba|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(ja^ka))+958139571|0;la=ka;ka=ja;ja=ia;ia=ha+ma|0;ha=ga;ga=fa;fa=ea;ea=ma+(fa&ga^ha&(fa^ga))+(fa>>>2^fa>>>13^fa>>>22^fa<<30^fa<<19^fa<<10)|0;V=ma=(W>>>7^W>>>18^W>>>3^W<<25^W<<14)+(T>>>17^T>>>19^T>>>10^T<<15^T<<13)+V+ca|0;ma=ma+la+(ia>>>6^ia>>>11^ia>>>25^ia<<26^ia<<21^ia<<7)+(ka^ia&(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<24|D[Q|25]<<16|D[Q|26]<<8|D[Q|27],D[Q|28]<<24|D[Q|29]<<16|D[Q|30]<<8|D[Q|31],D[Q|32]<<24|D[Q|33]<<16|D[Q|34]<<8|D[Q|35],D[Q|36]<<24|D[Q|37]<<16|D[Q|38]<<8|D[Q|39],D[Q|40]<<24|D[Q|41]<<16|D[Q|42]<<8|D[Q|43],D[Q|44]<<24|D[Q|45]<<16|D[Q|46]<<8|D[Q|47],D[Q|48]<<24|D[Q|49]<<16|D[Q|50]<<8|D[Q|51],D[Q|52]<<24|D[Q|53]<<16|D[Q|54]<<8|D[Q|55],D[Q|56]<<24|D[Q|57]<<16|D[Q|58]<<8|D[Q|59],D[Q|60]<<24|D[Q|61]<<16|D[Q|62]<<8|D[Q|63])}function G(Q){Q=Q|0;D[Q|0]=d>>>24;D[Q|1]=d>>>16&255;D[Q|2]=d>>>8&255;D[Q|3]=d&255;D[Q|4]=e>>>24;D[Q|5]=e>>>16&255;D[Q|6]=e>>>8&255;D[Q|7]=e&255;D[Q|8]=f>>>24;D[Q|9]=f>>>16&255;D[Q|10]=f>>>8&255;D[Q|11]=f&255;D[Q|12]=g>>>24;D[Q|13]=g>>>16&255;D[Q|14]=g>>>8&255;D[Q|15]=g&255;D[Q|16]=h>>>24;D[Q|17]=h>>>16&255;D[Q|18]=h>>>8&255;D[Q|19]=h&255;D[Q|20]=i>>>24;D[Q|21]=i>>>16&255;D[Q|22]=i>>>8&255;D[Q|23]=i&255;D[Q|24]=j>>>24;D[Q|25]=j>>>16&255;D[Q|26]=j>>>8&255;D[Q|27]=j&255;D[Q|28]=k>>>24;D[Q|29]=k>>>16&255;D[Q|30]=k>>>8&255;D[Q|31]=k&255}function H(){d=1779033703;e=3144134277;f=1013904242;g=2773480762;h=1359893119;i=2600822924;j=528734635;k=1541459225;l=m=0}function I(Q,R,S,T,U,V,W,X,Y,Z){Q=Q|0;R=R|0;S=S|0;T=T|0;U=U|0;V=V|0;W=W|0;X=X|0;Y=Y|0;Z=Z|0;d=Q;e=R;f=S;g=T;h=U;i=V;j=W;k=X;l=Y;m=Z}function J(Q,R){Q=Q|0;R=R|0;var S=0;if(Q&63)return-1;while((R|0)>=64){F(Q);Q=Q+64|0;R=R-64|0;S=S+64|0}l=l+S|0;if(l>>>0>>0)m=m+1|0;return S|0}function K(Q,R,S){Q=Q|0;R=R|0;S=S|0;var T=0,U=0;if(Q&63)return-1;if(~S)if(S&31)return-1;if((R|0)>=64){T=J(Q,R)|0;if((T|0)==-1)return-1;Q=Q+T|0;R=R-T|0}T=T+R|0;l=l+R|0;if(l>>>0>>0)m=m+1|0;D[Q|R]=128;if((R|0)>=56){for(U=R+1|0;(U|0)<64;U=U+1|0)D[Q|U]=0;F(Q);R=0;D[Q|0]=0}for(U=R+1|0;(U|0)<59;U=U+1|0)D[Q|U]=0;D[Q|56]=m>>>21&255;D[Q|57]=m>>>13&255;D[Q|58]=m>>>5&255;D[Q|59]=m<<3&255|l>>>29;D[Q|60]=l>>>21&255;D[Q|61]=l>>>13&255;D[Q|62]=l>>>5&255;D[Q|63]=l<<3&255;F(Q);if(~S)G(S);return T|0}function L(){d=n;e=o;f=p;g=q;h=r;i=s;j=t;k=u;l=64;m=0}function M(){d=v;e=w;f=x;g=y;h=z;i=A;j=B;k=C;l=64;m=0}function N(Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da){Q=Q|0;R=R|0;S=S|0;T=T|0;U=U|0;V=V|0;W=W|0;X=X|0;Y=Y|0;Z=Z|0;$=$|0;_=_|0;aa=aa|0;ba=ba|0;ca=ca|0;da=da|0;H();E(Q^1549556828,R^1549556828,S^1549556828,T^1549556828,U^1549556828,V^1549556828,W^1549556828,X^1549556828,Y^1549556828,Z^1549556828,$^1549556828,_^1549556828,aa^1549556828,ba^1549556828,ca^1549556828,da^1549556828);v=d;w=e;x=f;y=g;z=h;A=i;B=j;C=k;H();E(Q^909522486,R^909522486,S^909522486,T^909522486,U^909522486,V^909522486,W^909522486,X^909522486,Y^909522486,Z^909522486,$^909522486,_^909522486,aa^909522486,ba^909522486,ca^909522486,da^909522486); + +n=d;o=e;p=f;q=g;r=h;s=i;t=j;u=k;l=64;m=0}function O(Q,R,S){Q=Q|0;R=R|0;S=S|0;var T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,_=0;if(Q&63)return-1;if(~S)if(S&31)return-1;_=K(Q,R,-1)|0;T=d,U=e,V=f,W=g,X=h,Y=i,Z=j,$=k;M();E(T,U,V,W,X,Y,Z,$,2147483648,0,0,0,0,0,0,768);if(~S)G(S);return _|0}function P(Q,R,S,T,U){Q=Q|0;R=R|0;S=S|0;T=T|0;U=U|0;var V=0,W=0,X=0,Y=0,Z=0,$=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0;if(Q&63)return-1;if(~U)if(U&31)return-1;D[Q+R|0]=S>>>24;D[Q+R+1|0]=S>>>16&255;D[Q+R+2|0]=S>>>8&255;D[Q+R+3|0]=S&255;O(Q,R+4|0,-1)|0;V=ba=d,W=ca=e,X=da=f,Y=ea=g,Z=fa=h,$=ga=i,_=ha=j,aa=ia=k;T=T-1|0;while((T|0)>0){L();E(ba,ca,da,ea,fa,ga,ha,ia,2147483648,0,0,0,0,0,0,768);ba=d,ca=e,da=f,ea=g,fa=h,ga=i,ha=j,ia=k;M();E(ba,ca,da,ea,fa,ga,ha,ia,2147483648,0,0,0,0,0,0,768);ba=d,ca=e,da=f,ea=g,fa=h,ga=i,ha=j,ia=k;V=V^d;W=W^e;X=X^f;Y=Y^g;Z=Z^h;$=$^i;_=_^j;aa=aa^k;T=T-1|0}d=V;e=W;f=X;g=Y;h=Z;i=$;j=_;k=aa;if(~U)G(U);return 0}return{reset:H,init:I,process:J,finish:K,hmac_reset:L,hmac_init:N,hmac_finish:O,pbkdf2_generate_block:P}}function V(a){a=a||{},this.heap=r(Uint8Array,a),this.asm=a.asm||U({Uint8Array:Uint8Array},null,this.heap.buffer),this.BLOCK_SIZE=eb,this.HASH_SIZE=fb,this.reset()}function W(){return null===hb&&(hb=new V({heapSize:1048576})),hb}function X(a){if(void 0===a)throw new SyntaxError("data required");return W().reset().process(a).finish().result}function Y(a){var b=X(a);return j(b)}function Z(a){var b=X(a);return k(b)}function $(a){if(a=a||{},!a.hash)throw new SyntaxError("option 'hash' is required");if(!a.hash.HASH_SIZE)throw new SyntaxError("option 'hash' supplied doesn't seem to be a valid hash function");return this.hash=a.hash,this.BLOCK_SIZE=this.hash.BLOCK_SIZE,this.HMAC_SIZE=this.hash.HASH_SIZE,this.key=null,this.verify=null,this.result=null,(void 0!==a.password||void 0!==a.verify)&&this.reset(a),this}function _(a,b){if(o(b)&&(b=new Uint8Array(b)),n(b)&&(b=f(b)),!p(b))throw new TypeError("password isn't of expected type");var c=new Uint8Array(a.BLOCK_SIZE);return c.set(b.length>a.BLOCK_SIZE?a.reset().process(b).finish().result:b),c}function aa(a){if(o(a)||p(a))a=new Uint8Array(a);else{if(!n(a))throw new TypeError("verify tag isn't of expected type");a=f(a)}if(a.length!==this.HMAC_SIZE)throw new d("illegal verification tag size");this.verify=a}function ba(a){a=a||{};var b=a.password;if(null===this.key&&!n(b)&&!b)throw new c("no key is associated with the instance");this.result=null,this.hash.reset(),(b||n(b))&&(this.key=_(this.hash,b));for(var d=new Uint8Array(this.key),e=0;e=g;++g){var h=(g-1)*this.hmac.HMAC_SIZE,i=(f>g?0:e%this.hmac.HMAC_SIZE)||this.hmac.HMAC_SIZE,j=new Uint8Array(this.hmac.reset().process(a).process(new Uint8Array([g>>>24&255,g>>>16&255,g>>>8&255,255&g])).finish().result);this.result.set(j.subarray(0,i),h);for(var k=1;b>k;++k){j=new Uint8Array(this.hmac.reset().process(j).finish().result);for(var l=0;i>l;++l)this.result[h+l]^=j[l]}}return this}function oa(a){return a=a||{},a.hmac instanceof ea||(a.hmac=ha()),la.call(this,a),this}function pa(a,b,e){if(null!==this.result)throw new c("state must be reset before processing new data");if(!a&&!n(a))throw new d("bad 'salt' value");b=b||this.count,e=e||this.length,this.result=new Uint8Array(e);for(var f=Math.ceil(e/this.hmac.HMAC_SIZE),g=1;f>=g;++g){var h=(g-1)*this.hmac.HMAC_SIZE,i=(f>g?0:e%this.hmac.HMAC_SIZE)||this.hmac.HMAC_SIZE;this.hmac.reset().process(a),this.hmac.hash.asm.pbkdf2_generate_block(this.hmac.hash.pos,this.hmac.hash.len,g,b,0),this.result.set(this.hmac.hash.heap.subarray(0,i),h)}return this}function qa(){return null===ob&&(ob=new oa),ob}function ra(){if(void 0!==ub)d=new Uint8Array(32),nb.call(ub,d),xb(d);else{var a,c,d=new Wa(3);d[0]=sb(),d[1]=rb(),d[2]=vb(),d=new Uint8Array(d.buffer);var e="";void 0!==b.location?e+=b.location.href:void 0!==b.process&&(e+=b.process.pid+b.process.title);var f=qa();for(a=0;100>a;a++)d=f.reset({password:d}).generate(e,1e3,32).result,c=vb(),d[0]^=c>>>24,d[1]^=c>>>16,d[2]^=c>>>8,d[3]^=c;xb(d)}yb=0,zb=!0}function sa(a){if(!o(a)&&!q(a))throw new TypeError("bad seed type");var b=a.byteOffset||0,c=a.byteLength||a.length,d=new Uint8Array(a.buffer||a,b,c);xb(d),yb=0;for(var e=0,f=0;f=Cb}function ta(a){if(zb||ra(),!Ab&&void 0===ub){if(!Db)throw new e("No strong PRNGs available. Use asmCrypto.random.seed().");void 0!==qb&&qb.error("No strong PRNGs available; your security is greatly lowered. Use asmCrypto.random.seed().")}if(!Eb&&!Ab&&void 0!==ub&&void 0!==qb){var b=(new Error).stack;Fb[b]|=0,Fb[b]++||qb.warn("asmCrypto PRNG not seeded; your security relies on your system PRNG. If this is not acceptable, use asmCrypto.random.seed().")}if(!o(a)&&!q(a))throw new TypeError("unexpected buffer type");var c,d,f=a.byteOffset||0,g=a.byteLength||a.length,h=new Uint8Array(a.buffer||a,f,g);for(void 0!==ub&&nb.call(ub,h),c=0;g>c;c++)0===(3&c)&&(yb>=1099511627776&&ra(),d=wb(),yb++),h[c]^=d,d>>>=8;return a}function ua(){(!zb||yb>=1099511627776)&&ra();var a=(1048576*wb()+(wb()>>>12))/4503599627370496;return yb+=2,a}function va(a,b,c){"use asm";var d=0;var e=new a.Uint32Array(c);var f=a.Math.imul;function g(u){u=u|0;d=u=u+31&-32;return u|0}function h(u){u=u|0;var v=0;v=d;d=v+(u+31&-32)|0;return v|0}function i(u){u=u|0;d=d-(u+31&-32)|0}function j(u,v,w){u=u|0;v=v|0;w=w|0;var x=0;if((v|0)>(w|0)){for(;(x|0)<(u|0);x=x+4|0){e[w+x>>2]=e[v+x>>2]}}else{for(x=u-4|0;(x|0)>=0;x=x-4|0){e[w+x>>2]=e[v+x>>2]}}}function k(u,v,w){u=u|0;v=v|0;w=w|0;var x=0;for(;(x|0)<(u|0);x=x+4|0){e[w+x>>2]=v}}function l(u,v,w,x){u=u|0;v=v|0;w=w|0;x=x|0;var y=0,z=0,A=0,B=0,C=0;if((x|0)<=0)x=v;if((x|0)<(v|0))v=x;z=1;for(;(C|0)<(v|0);C=C+4|0){y=~e[u+C>>2];A=(y&65535)+z|0;B=(y>>>16)+(A>>>16)|0;e[w+C>>2]=B<<16|A&65535;z=B>>>16}for(;(C|0)<(x|0);C=C+4|0){e[w+C>>2]=z-1|0}return z|0}function m(u,v,w,x){u=u|0;v=v|0;w=w|0;x=x|0;var y=0,z=0,A=0;if((v|0)>(x|0)){for(A=v-4|0;(A|0)>=(x|0);A=A-4|0){if(e[u+A>>2]|0)return 1}}else{for(A=x-4|0;(A|0)>=(v|0);A=A-4|0){if(e[w+A>>2]|0)return-1}}for(;(A|0)>=0;A=A-4|0){y=e[u+A>>2]|0,z=e[w+A>>2]|0;if(y>>>0>>0)return-1;if(y>>>0>z>>>0)return 1}return 0}function n(u,v){u=u|0;v=v|0;var w=0;for(w=v-4|0;(w|0)>=0;w=w-4|0){if(e[u+w>>2]|0)return w+4|0}return 0}function o(u,v,w,x,y,z){u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;var A=0,B=0,C=0,D=0,E=0,F=0;if((v|0)<(x|0)){D=u,u=w,w=D;D=v,v=x,x=D}if((z|0)<=0)z=v+4|0;if((z|0)<(x|0))v=x=z;for(;(F|0)<(x|0);F=F+4|0){A=e[u+F>>2]|0;B=e[w+F>>2]|0;D=((A&65535)+(B&65535)|0)+C|0;E=((A>>>16)+(B>>>16)|0)+(D>>>16)|0;e[y+F>>2]=D&65535|E<<16;C=E>>>16}for(;(F|0)<(v|0);F=F+4|0){A=e[u+F>>2]|0;D=(A&65535)+C|0;E=(A>>>16)+(D>>>16)|0;e[y+F>>2]=D&65535|E<<16;C=E>>>16}for(;(F|0)<(z|0);F=F+4|0){e[y+F>>2]=C|0;C=0}return C|0}function p(u,v,w,x,y,z){u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;var A=0,B=0,C=0,D=0,E=0,F=0;if((z|0)<=0)z=(v|0)>(x|0)?v+4|0:x+4|0;if((z|0)<(v|0))v=z;if((z|0)<(x|0))x=z;if((v|0)<(x|0)){for(;(F|0)<(v|0);F=F+4|0){A=e[u+F>>2]|0;B=e[w+F>>2]|0;D=((A&65535)-(B&65535)|0)+C|0;E=((A>>>16)-(B>>>16)|0)+(D>>16)|0;e[y+F>>2]=D&65535|E<<16;C=E>>16}for(;(F|0)<(x|0);F=F+4|0){B=e[w+F>>2]|0;D=C-(B&65535)|0;E=(D>>16)-(B>>>16)|0;e[y+F>>2]=D&65535|E<<16;C=E>>16}}else{for(;(F|0)<(x|0);F=F+4|0){A=e[u+F>>2]|0;B=e[w+F>>2]|0;D=((A&65535)-(B&65535)|0)+C|0;E=((A>>>16)-(B>>>16)|0)+(D>>16)|0;e[y+F>>2]=D&65535|E<<16;C=E>>16}for(;(F|0)<(v|0);F=F+4|0){A=e[u+F>>2]|0;D=(A&65535)+C|0;E=(A>>>16)+(D>>16)|0;e[y+F>>2]=D&65535|E<<16;C=E>>16}}for(;(F|0)<(z|0);F=F+4|0){e[y+F>>2]=C|0}return C|0}function q(u,v,w,x,y,z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=aa>>>16,ba=ba>>>16,ca=ca>>>16,da=da>>>16;ea=e[(Ca|0)>>2]|0,fa=e[(Ca|4)>>2]|0,ga=e[(Ca|8)>>2]|0,ha=e[(Ca|12)>>2]|0,ia=e[(Ca|16)>>2]|0,ja=e[(Ca|20)>>2]|0,ka=e[(Ca|24)>>2]|0,la=e[(Ca|28)>>2]|0;ua=((f(A,Q)|0)+(ma&65535)|0)+(ea&65535)|0;va=((f(I,Q)|0)+(ma>>>16)|0)+(ea>>>16)|0;wa=((f(A,Y)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(I,Y)|0)+(va>>>16)|0)+(wa>>>16)|0;ea=wa<<16|ua&65535;ua=((f(A,R)|0)+(xa&65535)|0)+(fa&65535)|0;va=((f(I,R)|0)+(xa>>>16)|0)+(fa>>>16)|0;wa=((f(A,Z)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(I,Z)|0)+(va>>>16)|0)+(wa>>>16)|0;fa=wa<<16|ua&65535;ua=((f(A,S)|0)+(xa&65535)|0)+(ga&65535)|0;va=((f(I,S)|0)+(xa>>>16)|0)+(ga>>>16)|0;wa=((f(A,$)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(I,$)|0)+(va>>>16)|0)+(wa>>>16)|0;ga=wa<<16|ua&65535;ua=((f(A,T)|0)+(xa&65535)|0)+(ha&65535)|0;va=((f(I,T)|0)+(xa>>>16)|0)+(ha>>>16)|0;wa=((f(A,_)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(I,_)|0)+(va>>>16)|0)+(wa>>>16)|0;ha=wa<<16|ua&65535;ua=((f(A,U)|0)+(xa&65535)|0)+(ia&65535)|0;va=((f(I,U)|0)+(xa>>>16)|0)+(ia>>>16)|0;wa=((f(A,aa)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(I,aa)|0)+(va>>>16)|0)+(wa>>>16)|0;ia=wa<<16|ua&65535;ua=((f(A,V)|0)+(xa&65535)|0)+(ja&65535)|0;va=((f(I,V)|0)+(xa>>>16)|0)+(ja>>>16)|0;wa=((f(A,ba)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(I,ba)|0)+(va>>>16)|0)+(wa>>>16)|0;ja=wa<<16|ua&65535;ua=((f(A,W)|0)+(xa&65535)|0)+(ka&65535)|0;va=((f(I,W)|0)+(xa>>>16)|0)+(ka>>>16)|0;wa=((f(A,ca)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(I,ca)|0)+(va>>>16)|0)+(wa>>>16)|0;ka=wa<<16|ua&65535;ua=((f(A,X)|0)+(xa&65535)|0)+(la&65535)|0;va=((f(I,X)|0)+(xa>>>16)|0)+(la>>>16)|0;wa=((f(A,da)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(I,da)|0)+(va>>>16)|0)+(wa>>>16)|0;la=wa<<16|ua&65535;ma=xa;ua=((f(B,Q)|0)+(na&65535)|0)+(fa&65535)|0;va=((f(J,Q)|0)+(na>>>16)|0)+(fa>>>16)|0;wa=((f(B,Y)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(J,Y)|0)+(va>>>16)|0)+(wa>>>16)|0;fa=wa<<16|ua&65535;ua=((f(B,R)|0)+(xa&65535)|0)+(ga&65535)|0;va=((f(J,R)|0)+(xa>>>16)|0)+(ga>>>16)|0;wa=((f(B,Z)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(J,Z)|0)+(va>>>16)|0)+(wa>>>16)|0;ga=wa<<16|ua&65535;ua=((f(B,S)|0)+(xa&65535)|0)+(ha&65535)|0;va=((f(J,S)|0)+(xa>>>16)|0)+(ha>>>16)|0;wa=((f(B,$)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(J,$)|0)+(va>>>16)|0)+(wa>>>16)|0;ha=wa<<16|ua&65535;ua=((f(B,T)|0)+(xa&65535)|0)+(ia&65535)|0;va=((f(J,T)|0)+(xa>>>16)|0)+(ia>>>16)|0;wa=((f(B,_)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(J,_)|0)+(va>>>16)|0)+(wa>>>16)|0;ia=wa<<16|ua&65535;ua=((f(B,U)|0)+(xa&65535)|0)+(ja&65535)|0;va=((f(J,U)|0)+(xa>>>16)|0)+(ja>>>16)|0;wa=((f(B,aa)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(J,aa)|0)+(va>>>16)|0)+(wa>>>16)|0;ja=wa<<16|ua&65535;ua=((f(B,V)|0)+(xa&65535)|0)+(ka&65535)|0;va=((f(J,V)|0)+(xa>>>16)|0)+(ka>>>16)|0;wa=((f(B,ba)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(J,ba)|0)+(va>>>16)|0)+(wa>>>16)|0;ka=wa<<16|ua&65535;ua=((f(B,W)|0)+(xa&65535)|0)+(la&65535)|0;va=((f(J,W)|0)+(xa>>>16)|0)+(la>>>16)|0;wa=((f(B,ca)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(J,ca)|0)+(va>>>16)|0)+(wa>>>16)|0;la=wa<<16|ua&65535;ua=((f(B,X)|0)+(xa&65535)|0)+(ma&65535)|0;va=((f(J,X)|0)+(xa>>>16)|0)+(ma>>>16)|0;wa=((f(B,da)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(J,da)|0)+(va>>>16)|0)+(wa>>>16)|0;ma=wa<<16|ua&65535;na=xa;ua=((f(C,Q)|0)+(oa&65535)|0)+(ga&65535)|0;va=((f(K,Q)|0)+(oa>>>16)|0)+(ga>>>16)|0;wa=((f(C,Y)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(K,Y)|0)+(va>>>16)|0)+(wa>>>16)|0;ga=wa<<16|ua&65535;ua=((f(C,R)|0)+(xa&65535)|0)+(ha&65535)|0;va=((f(K,R)|0)+(xa>>>16)|0)+(ha>>>16)|0;wa=((f(C,Z)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(K,Z)|0)+(va>>>16)|0)+(wa>>>16)|0;ha=wa<<16|ua&65535;ua=((f(C,S)|0)+(xa&65535)|0)+(ia&65535)|0;va=((f(K,S)|0)+(xa>>>16)|0)+(ia>>>16)|0;wa=((f(C,$)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(K,$)|0)+(va>>>16)|0)+(wa>>>16)|0;ia=wa<<16|ua&65535;ua=((f(C,T)|0)+(xa&65535)|0)+(ja&65535)|0;va=((f(K,T)|0)+(xa>>>16)|0)+(ja>>>16)|0;wa=((f(C,_)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(K,_)|0)+(va>>>16)|0)+(wa>>>16)|0;ja=wa<<16|ua&65535;ua=((f(C,U)|0)+(xa&65535)|0)+(ka&65535)|0;va=((f(K,U)|0)+(xa>>>16)|0)+(ka>>>16)|0;wa=((f(C,aa)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(K,aa)|0)+(va>>>16)|0)+(wa>>>16)|0;ka=wa<<16|ua&65535;ua=((f(C,V)|0)+(xa&65535)|0)+(la&65535)|0;va=((f(K,V)|0)+(xa>>>16)|0)+(la>>>16)|0;wa=((f(C,ba)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(K,ba)|0)+(va>>>16)|0)+(wa>>>16)|0;la=wa<<16|ua&65535;ua=((f(C,W)|0)+(xa&65535)|0)+(ma&65535)|0;va=((f(K,W)|0)+(xa>>>16)|0)+(ma>>>16)|0;wa=((f(C,ca)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(K,ca)|0)+(va>>>16)|0)+(wa>>>16)|0;ma=wa<<16|ua&65535;ua=((f(C,X)|0)+(xa&65535)|0)+(na&65535)|0;va=((f(K,X)|0)+(xa>>>16)|0)+(na>>>16)|0;wa=((f(C,da)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(K,da)|0)+(va>>>16)|0)+(wa>>>16)|0;na=wa<<16|ua&65535;oa=xa;ua=((f(D,Q)|0)+(pa&65535)|0)+(ha&65535)|0;va=((f(L,Q)|0)+(pa>>>16)|0)+(ha>>>16)|0;wa=((f(D,Y)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(L,Y)|0)+(va>>>16)|0)+(wa>>>16)|0;ha=wa<<16|ua&65535;ua=((f(D,R)|0)+(xa&65535)|0)+(ia&65535)|0;va=((f(L,R)|0)+(xa>>>16)|0)+(ia>>>16)|0;wa=((f(D,Z)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(L,Z)|0)+(va>>>16)|0)+(wa>>>16)|0;ia=wa<<16|ua&65535;ua=((f(D,S)|0)+(xa&65535)|0)+(ja&65535)|0;va=((f(L,S)|0)+(xa>>>16)|0)+(ja>>>16)|0;wa=((f(D,$)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(L,$)|0)+(va>>>16)|0)+(wa>>>16)|0;ja=wa<<16|ua&65535;ua=((f(D,T)|0)+(xa&65535)|0)+(ka&65535)|0;va=((f(L,T)|0)+(xa>>>16)|0)+(ka>>>16)|0;wa=((f(D,_)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(L,_)|0)+(va>>>16)|0)+(wa>>>16)|0;ka=wa<<16|ua&65535;ua=((f(D,U)|0)+(xa&65535)|0)+(la&65535)|0;va=((f(L,U)|0)+(xa>>>16)|0)+(la>>>16)|0;wa=((f(D,aa)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(L,aa)|0)+(va>>>16)|0)+(wa>>>16)|0;la=wa<<16|ua&65535;ua=((f(D,V)|0)+(xa&65535)|0)+(ma&65535)|0;va=((f(L,V)|0)+(xa>>>16)|0)+(ma>>>16)|0;wa=((f(D,ba)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(L,ba)|0)+(va>>>16)|0)+(wa>>>16)|0;ma=wa<<16|ua&65535;ua=((f(D,W)|0)+(xa&65535)|0)+(na&65535)|0;va=((f(L,W)|0)+(xa>>>16)|0)+(na>>>16)|0;wa=((f(D,ca)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(L,ca)|0)+(va>>>16)|0)+(wa>>>16)|0;na=wa<<16|ua&65535;ua=((f(D,X)|0)+(xa&65535)|0)+(oa&65535)|0;va=((f(L,X)|0)+(xa>>>16)|0)+(oa>>>16)|0;wa=((f(D,da)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(L,da)|0)+(va>>>16)|0)+(wa>>>16)|0;oa=wa<<16|ua&65535;pa=xa;ua=((f(E,Q)|0)+(qa&65535)|0)+(ia&65535)|0;va=((f(M,Q)|0)+(qa>>>16)|0)+(ia>>>16)|0;wa=((f(E,Y)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(M,Y)|0)+(va>>>16)|0)+(wa>>>16)|0;ia=wa<<16|ua&65535;ua=((f(E,R)|0)+(xa&65535)|0)+(ja&65535)|0;va=((f(M,R)|0)+(xa>>>16)|0)+(ja>>>16)|0;wa=((f(E,Z)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(M,Z)|0)+(va>>>16)|0)+(wa>>>16)|0;ja=wa<<16|ua&65535;ua=((f(E,S)|0)+(xa&65535)|0)+(ka&65535)|0;va=((f(M,S)|0)+(xa>>>16)|0)+(ka>>>16)|0;wa=((f(E,$)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(M,$)|0)+(va>>>16)|0)+(wa>>>16)|0;ka=wa<<16|ua&65535;ua=((f(E,T)|0)+(xa&65535)|0)+(la&65535)|0;va=((f(M,T)|0)+(xa>>>16)|0)+(la>>>16)|0;wa=((f(E,_)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(M,_)|0)+(va>>>16)|0)+(wa>>>16)|0;la=wa<<16|ua&65535;ua=((f(E,U)|0)+(xa&65535)|0)+(ma&65535)|0;va=((f(M,U)|0)+(xa>>>16)|0)+(ma>>>16)|0;wa=((f(E,aa)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(M,aa)|0)+(va>>>16)|0)+(wa>>>16)|0;ma=wa<<16|ua&65535;ua=((f(E,V)|0)+(xa&65535)|0)+(na&65535)|0;va=((f(M,V)|0)+(xa>>>16)|0)+(na>>>16)|0;wa=((f(E,ba)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(M,ba)|0)+(va>>>16)|0)+(wa>>>16)|0;na=wa<<16|ua&65535;ua=((f(E,W)|0)+(xa&65535)|0)+(oa&65535)|0;va=((f(M,W)|0)+(xa>>>16)|0)+(oa>>>16)|0;wa=((f(E,ca)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(M,ca)|0)+(va>>>16)|0)+(wa>>>16)|0;oa=wa<<16|ua&65535;ua=((f(E,X)|0)+(xa&65535)|0)+(pa&65535)|0;va=((f(M,X)|0)+(xa>>>16)|0)+(pa>>>16)|0;wa=((f(E,da)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(M,da)|0)+(va>>>16)|0)+(wa>>>16)|0;pa=wa<<16|ua&65535;qa=xa;ua=((f(F,Q)|0)+(ra&65535)|0)+(ja&65535)|0;va=((f(N,Q)|0)+(ra>>>16)|0)+(ja>>>16)|0;wa=((f(F,Y)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(N,Y)|0)+(va>>>16)|0)+(wa>>>16)|0;ja=wa<<16|ua&65535;ua=((f(F,R)|0)+(xa&65535)|0)+(ka&65535)|0;va=((f(N,R)|0)+(xa>>>16)|0)+(ka>>>16)|0;wa=((f(F,Z)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(N,Z)|0)+(va>>>16)|0)+(wa>>>16)|0;ka=wa<<16|ua&65535;ua=((f(F,S)|0)+(xa&65535)|0)+(la&65535)|0;va=((f(N,S)|0)+(xa>>>16)|0)+(la>>>16)|0;wa=((f(F,$)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(N,$)|0)+(va>>>16)|0)+(wa>>>16)|0;la=wa<<16|ua&65535;ua=((f(F,T)|0)+(xa&65535)|0)+(ma&65535)|0;va=((f(N,T)|0)+(xa>>>16)|0)+(ma>>>16)|0;wa=((f(F,_)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(N,_)|0)+(va>>>16)|0)+(wa>>>16)|0;ma=wa<<16|ua&65535;ua=((f(F,U)|0)+(xa&65535)|0)+(na&65535)|0;va=((f(N,U)|0)+(xa>>>16)|0)+(na>>>16)|0;wa=((f(F,aa)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(N,aa)|0)+(va>>>16)|0)+(wa>>>16)|0;na=wa<<16|ua&65535;ua=((f(F,V)|0)+(xa&65535)|0)+(oa&65535)|0;va=((f(N,V)|0)+(xa>>>16)|0)+(oa>>>16)|0;wa=((f(F,ba)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(N,ba)|0)+(va>>>16)|0)+(wa>>>16)|0;oa=wa<<16|ua&65535;ua=((f(F,W)|0)+(xa&65535)|0)+(pa&65535)|0;va=((f(N,W)|0)+(xa>>>16)|0)+(pa>>>16)|0;wa=((f(F,ca)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(N,ca)|0)+(va>>>16)|0)+(wa>>>16)|0;pa=wa<<16|ua&65535;ua=((f(F,X)|0)+(xa&65535)|0)+(qa&65535)|0;va=((f(N,X)|0)+(xa>>>16)|0)+(qa>>>16)|0;wa=((f(F,da)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(N,da)|0)+(va>>>16)|0)+(wa>>>16)|0;qa=wa<<16|ua&65535;ra=xa;ua=((f(G,Q)|0)+(sa&65535)|0)+(ka&65535)|0;va=((f(O,Q)|0)+(sa>>>16)|0)+(ka>>>16)|0;wa=((f(G,Y)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(O,Y)|0)+(va>>>16)|0)+(wa>>>16)|0;ka=wa<<16|ua&65535;ua=((f(G,R)|0)+(xa&65535)|0)+(la&65535)|0;va=((f(O,R)|0)+(xa>>>16)|0)+(la>>>16)|0;wa=((f(G,Z)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(O,Z)|0)+(va>>>16)|0)+(wa>>>16)|0;la=wa<<16|ua&65535;ua=((f(G,S)|0)+(xa&65535)|0)+(ma&65535)|0;va=((f(O,S)|0)+(xa>>>16)|0)+(ma>>>16)|0;wa=((f(G,$)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(O,$)|0)+(va>>>16)|0)+(wa>>>16)|0;ma=wa<<16|ua&65535;ua=((f(G,T)|0)+(xa&65535)|0)+(na&65535)|0;va=((f(O,T)|0)+(xa>>>16)|0)+(na>>>16)|0;wa=((f(G,_)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(O,_)|0)+(va>>>16)|0)+(wa>>>16)|0;na=wa<<16|ua&65535;ua=((f(G,U)|0)+(xa&65535)|0)+(oa&65535)|0;va=((f(O,U)|0)+(xa>>>16)|0)+(oa>>>16)|0;wa=((f(G,aa)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(O,aa)|0)+(va>>>16)|0)+(wa>>>16)|0;oa=wa<<16|ua&65535;ua=((f(G,V)|0)+(xa&65535)|0)+(pa&65535)|0;va=((f(O,V)|0)+(xa>>>16)|0)+(pa>>>16)|0;wa=((f(G,ba)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(O,ba)|0)+(va>>>16)|0)+(wa>>>16)|0;pa=wa<<16|ua&65535;ua=((f(G,W)|0)+(xa&65535)|0)+(qa&65535)|0;va=((f(O,W)|0)+(xa>>>16)|0)+(qa>>>16)|0;wa=((f(G,ca)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(O,ca)|0)+(va>>>16)|0)+(wa>>>16)|0;qa=wa<<16|ua&65535;ua=((f(G,X)|0)+(xa&65535)|0)+(ra&65535)|0;va=((f(O,X)|0)+(xa>>>16)|0)+(ra>>>16)|0;wa=((f(G,da)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(O,da)|0)+(va>>>16)|0)+(wa>>>16)|0;ra=wa<<16|ua&65535;sa=xa;ua=((f(H,Q)|0)+(ta&65535)|0)+(la&65535)|0;va=((f(P,Q)|0)+(ta>>>16)|0)+(la>>>16)|0;wa=((f(H,Y)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(P,Y)|0)+(va>>>16)|0)+(wa>>>16)|0;la=wa<<16|ua&65535;ua=((f(H,R)|0)+(xa&65535)|0)+(ma&65535)|0;va=((f(P,R)|0)+(xa>>>16)|0)+(ma>>>16)|0;wa=((f(H,Z)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(P,Z)|0)+(va>>>16)|0)+(wa>>>16)|0;ma=wa<<16|ua&65535;ua=((f(H,S)|0)+(xa&65535)|0)+(na&65535)|0;va=((f(P,S)|0)+(xa>>>16)|0)+(na>>>16)|0;wa=((f(H,$)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(P,$)|0)+(va>>>16)|0)+(wa>>>16)|0;na=wa<<16|ua&65535;ua=((f(H,T)|0)+(xa&65535)|0)+(oa&65535)|0;va=((f(P,T)|0)+(xa>>>16)|0)+(oa>>>16)|0;wa=((f(H,_)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(P,_)|0)+(va>>>16)|0)+(wa>>>16)|0;oa=wa<<16|ua&65535;ua=((f(H,U)|0)+(xa&65535)|0)+(pa&65535)|0;va=((f(P,U)|0)+(xa>>>16)|0)+(pa>>>16)|0;wa=((f(H,aa)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(P,aa)|0)+(va>>>16)|0)+(wa>>>16)|0;pa=wa<<16|ua&65535;ua=((f(H,V)|0)+(xa&65535)|0)+(qa&65535)|0;va=((f(P,V)|0)+(xa>>>16)|0)+(qa>>>16)|0;wa=((f(H,ba)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(P,ba)|0)+(va>>>16)|0)+(wa>>>16)|0;qa=wa<<16|ua&65535;ua=((f(H,W)|0)+(xa&65535)|0)+(ra&65535)|0;va=((f(P,W)|0)+(xa>>>16)|0)+(ra>>>16)|0;wa=((f(H,ca)|0)+(va&65535)|0)+(ua>>>16)|0;xa=((f(P,ca)|0)+(va>>>16)|0)+(wa>>>16)|0;ra=wa<<16|ua&65535;ua=((f(H,X)|0)+(xa&65535)|0)+(sa&65535)|0;va=((f(P,X)|0)+(xa>>>16)|0)+(sa>>>16)|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x,V)|0)+(ra>>>16)|0;ta=(f(F,N)|0)+(sa&65535)|0;wa=((f(F,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;xa=e[(Ga|4)>>2]|0;ra=(xa&65535)+((ra&65535)<<1)|0;ta=((xa>>>16)+((ta&65535)<<1)|0)+(ra>>>16)|0;e[(Ga|4)>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[(Ga|8)>>2]|0;ra=((xa&65535)+((wa&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(wa>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|8)>>2]=ta<<16|ra&65535;ua=ta>>>16;if(ua){xa=e[(Ga|12)>>2]|0;ra=(xa&65535)+ua|0;ta=(xa>>>16)+(ra>>>16)|0;e[(Ga|12)>>2]=ta<<16|ra&65535}}for(Aa=0;(Aa|0)<(v|0);Aa=Aa+16|0){Ea=u+Aa|0,Ga=w+(Aa<<1)|0;F=e[Ea>>2]|0,x=F&65535,F=F>>>16,G=e[(Ea|4)>>2]|0,y=G&65535,G=G>>>16;V=e[(Ea|8)>>2]|0,N=V&65535,V=V>>>16,W=e[(Ea|12)>>2]|0,O=W&65535,W=W>>>16;ra=f(x,N)|0;sa=f(F,N)|0;ta=((f(x,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ba=ta<<16|ra&65535;ra=(f(x,O)|0)+(wa&65535)|0;sa=(f(F,O)|0)+(wa>>>16)|0;ta=((f(x,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ca=ta<<16|ra&65535;da=wa;ra=(f(y,N)|0)+(ca&65535)|0;sa=(f(G,N)|0)+(ca>>>16)|0;ta=((f(y,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ca=ta<<16|ra&65535;ra=((f(y,O)|0)+(da&65535)|0)+(wa&65535)|0;sa=((f(G,O)|0)+(da>>>16)|0)+(wa>>>16)|0;ta=((f(y,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;da=ta<<16|ra&65535;ea=wa;xa=e[(Ga|8)>>2]|0;ra=(xa&65535)+((ba&65535)<<1)|0;ta=((xa>>>16)+(ba>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|8)>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[(Ga|12)>>2]|0;ra=((xa&65535)+((ca&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ca>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|12)>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[(Ga|16)>>2]|0;ra=((xa&65535)+((da&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(da>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|16)>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[(Ga|20)>>2]|0;ra=((xa&65535)+((ea&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ea>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|20)>>2]=ta<<16|ra&65535;ua=ta>>>16;for(Da=24;!!ua&(Da|0)<32;Da=Da+4|0){xa=e[(Ga|Da)>>2]|0;ra=(xa&65535)+ua|0;ta=(xa>>>16)+(ra>>>16)|0;e[(Ga|Da)>>2]=ta<<16|ra&65535;ua=ta>>>16}}for(Aa=0;(Aa|0)<(v|0);Aa=Aa+32|0){Ea=u+Aa|0,Ga=w+(Aa<<1)|0;F=e[Ea>>2]|0,x=F&65535,F=F>>>16,G=e[(Ea|4)>>2]|0,y=G&65535,G=G>>>16,H=e[(Ea|8)>>2]|0,z=H&65535,H=H>>>16,I=e[(Ea|12)>>2]|0,A=I&65535,I=I>>>16;V=e[(Ea|16)>>2]|0,N=V&65535,V=V>>>16,W=e[(Ea|20)>>2]|0,O=W&65535,W=W>>>16,X=e[(Ea|24)>>2]|0,P=X&65535,X=X>>>16,Y=e[(Ea|28)>>2]|0,Q=Y&65535,Y=Y>>>16;ra=f(x,N)|0;sa=f(F,N)|0;ta=((f(x,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ba=ta<<16|ra&65535;ra=(f(x,O)|0)+(wa&65535)|0;sa=(f(F,O)|0)+(wa>>>16)|0;ta=((f(x,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ca=ta<<16|ra&65535;ra=(f(x,P)|0)+(wa&65535)|0;sa=(f(F,P)|0)+(wa>>>16)|0;ta=((f(x,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;da=ta<<16|ra&65535;ra=(f(x,Q)|0)+(wa&65535)|0;sa=(f(F,Q)|0)+(wa>>>16)|0;ta=((f(x,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ea=ta<<16|ra&65535;fa=wa;ra=(f(y,N)|0)+(ca&65535)|0;sa=(f(G,N)|0)+(ca>>>16)|0;ta=((f(y,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ca=ta<<16|ra&65535;ra=((f(y,O)|0)+(da&65535)|0)+(wa&65535)|0;sa=((f(G,O)|0)+(da>>>16)|0)+(wa>>>16)|0;ta=((f(y,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;da=ta<<16|ra&65535;ra=((f(y,P)|0)+(ea&65535)|0)+(wa&65535)|0;sa=((f(G,P)|0)+(ea>>>16)|0)+(wa>>>16)|0;ta=((f(y,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;ea=ta<<16|ra&65535;ra=((f(y,Q)|0)+(fa&65535)|0)+(wa&65535)|0;sa=((f(G,Q)|0)+(fa>>>16)|0)+(wa>>>16)|0;ta=((f(y,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;fa=ta<<16|ra&65535;ga=wa;ra=(f(z,N)|0)+(da&65535)|0;sa=(f(H,N)|0)+(da>>>16)|0;ta=((f(z,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;da=ta<<16|ra&65535;ra=((f(z,O)|0)+(ea&65535)|0)+(wa&65535)|0;sa=((f(H,O)|0)+(ea>>>16)|0)+(wa>>>16)|0;ta=((f(z,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ea=ta<<16|ra&65535;ra=((f(z,P)|0)+(fa&65535)|0)+(wa&65535)|0;sa=((f(H,P)|0)+(fa>>>16)|0)+(wa>>>16)|0;ta=((f(z,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;fa=ta<<16|ra&65535;ra=((f(z,Q)|0)+(ga&65535)|0)+(wa&65535)|0;sa=((f(H,Q)|0)+(ga>>>16)|0)+(wa>>>16)|0;ta=((f(z,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ga=ta<<16|ra&65535;ha=wa;ra=(f(A,N)|0)+(ea&65535)|0;sa=(f(I,N)|0)+(ea>>>16)|0;ta=((f(A,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ea=ta<<16|ra&65535;ra=((f(A,O)|0)+(fa&65535)|0)+(wa&65535)|0;sa=((f(I,O)|0)+(fa>>>16)|0)+(wa>>>16)|0;ta=((f(A,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;fa=ta<<16|ra&65535;ra=((f(A,P)|0)+(ga&65535)|0)+(wa&65535)|0;sa=((f(I,P)|0)+(ga>>>16)|0)+(wa>>>16)|0;ta=((f(A,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;ga=ta<<16|ra&65535;ra=((f(A,Q)|0)+(ha&65535)|0)+(wa&65535)|0;sa=((f(I,Q)|0)+(ha>>>16)|0)+(wa>>>16)|0;ta=((f(A,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ha=ta<<16|ra&65535;ia=wa;xa=e[(Ga|16)>>2]|0;ra=(xa&65535)+((ba&65535)<<1)|0;ta=((xa>>>16)+(ba>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|16)>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[(Ga|20)>>2]|0;ra=((xa&65535)+((ca&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ca>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|20)>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[(Ga|24)>>2]|0;ra=((xa&65535)+((da&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(da>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|24)>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[(Ga|28)>>2]|0;ra=((xa&65535)+((ea&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ea>>>16<<1)|0)+(ra>>>16)|0;e[(Ga|28)>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[Ga+32>>2]|0;ra=((xa&65535)+((fa&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(fa>>>16<<1)|0)+(ra>>>16)|0;e[Ga+32>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[Ga+36>>2]|0;ra=((xa&65535)+((ga&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ga>>>16<<1)|0)+(ra>>>16)|0;e[Ga+36>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[Ga+40>>2]|0;ra=((xa&65535)+((ha&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ha>>>16<<1)|0)+(ra>>>16)|0;e[Ga+40>>2]=ta<<16|ra&65535;ua=ta>>>16;xa=e[Ga+44>>2]|0;ra=((xa&65535)+((ia&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ia>>>16<<1)|0)+(ra>>>16)|0;e[Ga+44>>2]=ta<<16|ra&65535;ua=ta>>>16;for(Da=48;!!ua&(Da|0)<64;Da=Da+4|0){xa=e[Ga+Da>>2]|0;ra=(xa&65535)+ua|0;ta=(xa>>>16)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16}}for(ya=32;(ya|0)<(v|0);ya=ya<<1){za=ya<<1;for(Aa=0;(Aa|0)<(v|0);Aa=Aa+za|0){Ga=w+(Aa<<1)|0;va=0;for(Ba=0;(Ba|0)<(ya|0);Ba=Ba+32|0){Ea=(u+Aa|0)+Ba|0;F=e[Ea>>2]|0,x=F&65535,F=F>>>16,G=e[(Ea|4)>>2]|0,y=G&65535,G=G>>>16,H=e[(Ea|8)>>2]|0,z=H&65535,H=H>>>16,I=e[(Ea|12)>>2]|0,A=I&65535,I=I>>>16,J=e[(Ea|16)>>2]|0,B=J&65535,J=J>>>16,K=e[(Ea|20)>>2]|0,C=K&65535,K=K>>>16,L=e[(Ea|24)>>2]|0,D=L&65535,L=L>>>16,M=e[(Ea|28)>>2]|0,E=M&65535,M=M>>>16;ja=ka=la=ma=na=oa=pa=qa=ua=0;for(Ca=0;(Ca|0)<(ya|0);Ca=Ca+32|0){Fa=((u+Aa|0)+ya|0)+Ca|0;V=e[Fa>>2]|0,N=V&65535,V=V>>>16,W=e[(Fa|4)>>2]|0,O=W&65535,W=W>>>16,X=e[(Fa|8)>>2]|0,P=X&65535,X=X>>>16,Y=e[(Fa|12)>>2]|0,Q=Y&65535,Y=Y>>>16,Z=e[(Fa|16)>>2]|0,R=Z&65535,Z=Z>>>16,$=e[(Fa|20)>>2]|0,S=$&65535,$=$>>>16,_=e[(Fa|24)>>2]|0,T=_&65535,_=_>>>16,aa=e[(Fa|28)>>2]|0,U=aa&65535,aa=aa>>>16;ba=ca=da=ea=fa=ga=ha=ia=0;ra=((f(x,N)|0)+(ba&65535)|0)+(ja&65535)|0;sa=((f(F,N)|0)+(ba>>>16)|0)+(ja>>>16)|0;ta=((f(x,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ba=ta<<16|ra&65535;ra=((f(x,O)|0)+(ca&65535)|0)+(wa&65535)|0;sa=((f(F,O)|0)+(ca>>>16)|0)+(wa>>>16)|0; + +ta=((f(x,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ca=ta<<16|ra&65535;ra=((f(x,P)|0)+(da&65535)|0)+(wa&65535)|0;sa=((f(F,P)|0)+(da>>>16)|0)+(wa>>>16)|0;ta=((f(x,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;da=ta<<16|ra&65535;ra=((f(x,Q)|0)+(ea&65535)|0)+(wa&65535)|0;sa=((f(F,Q)|0)+(ea>>>16)|0)+(wa>>>16)|0;ta=((f(x,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ea=ta<<16|ra&65535;ra=((f(x,R)|0)+(fa&65535)|0)+(wa&65535)|0;sa=((f(F,R)|0)+(fa>>>16)|0)+(wa>>>16)|0;ta=((f(x,Z)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,Z)|0)+(sa>>>16)|0)+(ta>>>16)|0;fa=ta<<16|ra&65535;ra=((f(x,S)|0)+(ga&65535)|0)+(wa&65535)|0;sa=((f(F,S)|0)+(ga>>>16)|0)+(wa>>>16)|0;ta=((f(x,$)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,$)|0)+(sa>>>16)|0)+(ta>>>16)|0;ga=ta<<16|ra&65535;ra=((f(x,T)|0)+(ha&65535)|0)+(wa&65535)|0;sa=((f(F,T)|0)+(ha>>>16)|0)+(wa>>>16)|0;ta=((f(x,_)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,_)|0)+(sa>>>16)|0)+(ta>>>16)|0;ha=ta<<16|ra&65535;ra=((f(x,U)|0)+(ia&65535)|0)+(wa&65535)|0;sa=((f(F,U)|0)+(ia>>>16)|0)+(wa>>>16)|0;ta=((f(x,aa)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(F,aa)|0)+(sa>>>16)|0)+(ta>>>16)|0;ia=ta<<16|ra&65535;ja=wa;ra=((f(y,N)|0)+(ca&65535)|0)+(ka&65535)|0;sa=((f(G,N)|0)+(ca>>>16)|0)+(ka>>>16)|0;ta=((f(y,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ca=ta<<16|ra&65535;ra=((f(y,O)|0)+(da&65535)|0)+(wa&65535)|0;sa=((f(G,O)|0)+(da>>>16)|0)+(wa>>>16)|0;ta=((f(y,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;da=ta<<16|ra&65535;ra=((f(y,P)|0)+(ea&65535)|0)+(wa&65535)|0;sa=((f(G,P)|0)+(ea>>>16)|0)+(wa>>>16)|0;ta=((f(y,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;ea=ta<<16|ra&65535;ra=((f(y,Q)|0)+(fa&65535)|0)+(wa&65535)|0;sa=((f(G,Q)|0)+(fa>>>16)|0)+(wa>>>16)|0;ta=((f(y,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;fa=ta<<16|ra&65535;ra=((f(y,R)|0)+(ga&65535)|0)+(wa&65535)|0;sa=((f(G,R)|0)+(ga>>>16)|0)+(wa>>>16)|0;ta=((f(y,Z)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,Z)|0)+(sa>>>16)|0)+(ta>>>16)|0;ga=ta<<16|ra&65535;ra=((f(y,S)|0)+(ha&65535)|0)+(wa&65535)|0;sa=((f(G,S)|0)+(ha>>>16)|0)+(wa>>>16)|0;ta=((f(y,$)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,$)|0)+(sa>>>16)|0)+(ta>>>16)|0;ha=ta<<16|ra&65535;ra=((f(y,T)|0)+(ia&65535)|0)+(wa&65535)|0;sa=((f(G,T)|0)+(ia>>>16)|0)+(wa>>>16)|0;ta=((f(y,_)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,_)|0)+(sa>>>16)|0)+(ta>>>16)|0;ia=ta<<16|ra&65535;ra=((f(y,U)|0)+(ja&65535)|0)+(wa&65535)|0;sa=((f(G,U)|0)+(ja>>>16)|0)+(wa>>>16)|0;ta=((f(y,aa)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(G,aa)|0)+(sa>>>16)|0)+(ta>>>16)|0;ja=ta<<16|ra&65535;ka=wa;ra=((f(z,N)|0)+(da&65535)|0)+(la&65535)|0;sa=((f(H,N)|0)+(da>>>16)|0)+(la>>>16)|0;ta=((f(z,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;da=ta<<16|ra&65535;ra=((f(z,O)|0)+(ea&65535)|0)+(wa&65535)|0;sa=((f(H,O)|0)+(ea>>>16)|0)+(wa>>>16)|0;ta=((f(z,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ea=ta<<16|ra&65535;ra=((f(z,P)|0)+(fa&65535)|0)+(wa&65535)|0;sa=((f(H,P)|0)+(fa>>>16)|0)+(wa>>>16)|0;ta=((f(z,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;fa=ta<<16|ra&65535;ra=((f(z,Q)|0)+(ga&65535)|0)+(wa&65535)|0;sa=((f(H,Q)|0)+(ga>>>16)|0)+(wa>>>16)|0;ta=((f(z,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ga=ta<<16|ra&65535;ra=((f(z,R)|0)+(ha&65535)|0)+(wa&65535)|0;sa=((f(H,R)|0)+(ha>>>16)|0)+(wa>>>16)|0;ta=((f(z,Z)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,Z)|0)+(sa>>>16)|0)+(ta>>>16)|0;ha=ta<<16|ra&65535;ra=((f(z,S)|0)+(ia&65535)|0)+(wa&65535)|0;sa=((f(H,S)|0)+(ia>>>16)|0)+(wa>>>16)|0;ta=((f(z,$)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,$)|0)+(sa>>>16)|0)+(ta>>>16)|0;ia=ta<<16|ra&65535;ra=((f(z,T)|0)+(ja&65535)|0)+(wa&65535)|0;sa=((f(H,T)|0)+(ja>>>16)|0)+(wa>>>16)|0;ta=((f(z,_)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,_)|0)+(sa>>>16)|0)+(ta>>>16)|0;ja=ta<<16|ra&65535;ra=((f(z,U)|0)+(ka&65535)|0)+(wa&65535)|0;sa=((f(H,U)|0)+(ka>>>16)|0)+(wa>>>16)|0;ta=((f(z,aa)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(H,aa)|0)+(sa>>>16)|0)+(ta>>>16)|0;ka=ta<<16|ra&65535;la=wa;ra=((f(A,N)|0)+(ea&65535)|0)+(ma&65535)|0;sa=((f(I,N)|0)+(ea>>>16)|0)+(ma>>>16)|0;ta=((f(A,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ea=ta<<16|ra&65535;ra=((f(A,O)|0)+(fa&65535)|0)+(wa&65535)|0;sa=((f(I,O)|0)+(fa>>>16)|0)+(wa>>>16)|0;ta=((f(A,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;fa=ta<<16|ra&65535;ra=((f(A,P)|0)+(ga&65535)|0)+(wa&65535)|0;sa=((f(I,P)|0)+(ga>>>16)|0)+(wa>>>16)|0;ta=((f(A,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;ga=ta<<16|ra&65535;ra=((f(A,Q)|0)+(ha&65535)|0)+(wa&65535)|0;sa=((f(I,Q)|0)+(ha>>>16)|0)+(wa>>>16)|0;ta=((f(A,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ha=ta<<16|ra&65535;ra=((f(A,R)|0)+(ia&65535)|0)+(wa&65535)|0;sa=((f(I,R)|0)+(ia>>>16)|0)+(wa>>>16)|0;ta=((f(A,Z)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,Z)|0)+(sa>>>16)|0)+(ta>>>16)|0;ia=ta<<16|ra&65535;ra=((f(A,S)|0)+(ja&65535)|0)+(wa&65535)|0;sa=((f(I,S)|0)+(ja>>>16)|0)+(wa>>>16)|0;ta=((f(A,$)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,$)|0)+(sa>>>16)|0)+(ta>>>16)|0;ja=ta<<16|ra&65535;ra=((f(A,T)|0)+(ka&65535)|0)+(wa&65535)|0;sa=((f(I,T)|0)+(ka>>>16)|0)+(wa>>>16)|0;ta=((f(A,_)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,_)|0)+(sa>>>16)|0)+(ta>>>16)|0;ka=ta<<16|ra&65535;ra=((f(A,U)|0)+(la&65535)|0)+(wa&65535)|0;sa=((f(I,U)|0)+(la>>>16)|0)+(wa>>>16)|0;ta=((f(A,aa)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(I,aa)|0)+(sa>>>16)|0)+(ta>>>16)|0;la=ta<<16|ra&65535;ma=wa;ra=((f(B,N)|0)+(fa&65535)|0)+(na&65535)|0;sa=((f(J,N)|0)+(fa>>>16)|0)+(na>>>16)|0;ta=((f(B,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(J,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;fa=ta<<16|ra&65535;ra=((f(B,O)|0)+(ga&65535)|0)+(wa&65535)|0;sa=((f(J,O)|0)+(ga>>>16)|0)+(wa>>>16)|0;ta=((f(B,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(J,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ga=ta<<16|ra&65535;ra=((f(B,P)|0)+(ha&65535)|0)+(wa&65535)|0;sa=((f(J,P)|0)+(ha>>>16)|0)+(wa>>>16)|0;ta=((f(B,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(J,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;ha=ta<<16|ra&65535;ra=((f(B,Q)|0)+(ia&65535)|0)+(wa&65535)|0;sa=((f(J,Q)|0)+(ia>>>16)|0)+(wa>>>16)|0;ta=((f(B,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(J,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ia=ta<<16|ra&65535;ra=((f(B,R)|0)+(ja&65535)|0)+(wa&65535)|0;sa=((f(J,R)|0)+(ja>>>16)|0)+(wa>>>16)|0;ta=((f(B,Z)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(J,Z)|0)+(sa>>>16)|0)+(ta>>>16)|0;ja=ta<<16|ra&65535;ra=((f(B,S)|0)+(ka&65535)|0)+(wa&65535)|0;sa=((f(J,S)|0)+(ka>>>16)|0)+(wa>>>16)|0;ta=((f(B,$)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(J,$)|0)+(sa>>>16)|0)+(ta>>>16)|0;ka=ta<<16|ra&65535;ra=((f(B,T)|0)+(la&65535)|0)+(wa&65535)|0;sa=((f(J,T)|0)+(la>>>16)|0)+(wa>>>16)|0;ta=((f(B,_)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(J,_)|0)+(sa>>>16)|0)+(ta>>>16)|0;la=ta<<16|ra&65535;ra=((f(B,U)|0)+(ma&65535)|0)+(wa&65535)|0;sa=((f(J,U)|0)+(ma>>>16)|0)+(wa>>>16)|0;ta=((f(B,aa)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(J,aa)|0)+(sa>>>16)|0)+(ta>>>16)|0;ma=ta<<16|ra&65535;na=wa;ra=((f(C,N)|0)+(ga&65535)|0)+(oa&65535)|0;sa=((f(K,N)|0)+(ga>>>16)|0)+(oa>>>16)|0;ta=((f(C,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(K,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ga=ta<<16|ra&65535;ra=((f(C,O)|0)+(ha&65535)|0)+(wa&65535)|0;sa=((f(K,O)|0)+(ha>>>16)|0)+(wa>>>16)|0;ta=((f(C,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(K,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ha=ta<<16|ra&65535;ra=((f(C,P)|0)+(ia&65535)|0)+(wa&65535)|0;sa=((f(K,P)|0)+(ia>>>16)|0)+(wa>>>16)|0;ta=((f(C,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(K,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;ia=ta<<16|ra&65535;ra=((f(C,Q)|0)+(ja&65535)|0)+(wa&65535)|0;sa=((f(K,Q)|0)+(ja>>>16)|0)+(wa>>>16)|0;ta=((f(C,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(K,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ja=ta<<16|ra&65535;ra=((f(C,R)|0)+(ka&65535)|0)+(wa&65535)|0;sa=((f(K,R)|0)+(ka>>>16)|0)+(wa>>>16)|0;ta=((f(C,Z)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(K,Z)|0)+(sa>>>16)|0)+(ta>>>16)|0;ka=ta<<16|ra&65535;ra=((f(C,S)|0)+(la&65535)|0)+(wa&65535)|0;sa=((f(K,S)|0)+(la>>>16)|0)+(wa>>>16)|0;ta=((f(C,$)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(K,$)|0)+(sa>>>16)|0)+(ta>>>16)|0;la=ta<<16|ra&65535;ra=((f(C,T)|0)+(ma&65535)|0)+(wa&65535)|0;sa=((f(K,T)|0)+(ma>>>16)|0)+(wa>>>16)|0;ta=((f(C,_)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(K,_)|0)+(sa>>>16)|0)+(ta>>>16)|0;ma=ta<<16|ra&65535;ra=((f(C,U)|0)+(na&65535)|0)+(wa&65535)|0;sa=((f(K,U)|0)+(na>>>16)|0)+(wa>>>16)|0;ta=((f(C,aa)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(K,aa)|0)+(sa>>>16)|0)+(ta>>>16)|0;na=ta<<16|ra&65535;oa=wa;ra=((f(D,N)|0)+(ha&65535)|0)+(pa&65535)|0;sa=((f(L,N)|0)+(ha>>>16)|0)+(pa>>>16)|0;ta=((f(D,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(L,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ha=ta<<16|ra&65535;ra=((f(D,O)|0)+(ia&65535)|0)+(wa&65535)|0;sa=((f(L,O)|0)+(ia>>>16)|0)+(wa>>>16)|0;ta=((f(D,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(L,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ia=ta<<16|ra&65535;ra=((f(D,P)|0)+(ja&65535)|0)+(wa&65535)|0;sa=((f(L,P)|0)+(ja>>>16)|0)+(wa>>>16)|0;ta=((f(D,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(L,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;ja=ta<<16|ra&65535;ra=((f(D,Q)|0)+(ka&65535)|0)+(wa&65535)|0;sa=((f(L,Q)|0)+(ka>>>16)|0)+(wa>>>16)|0;ta=((f(D,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(L,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;ka=ta<<16|ra&65535;ra=((f(D,R)|0)+(la&65535)|0)+(wa&65535)|0;sa=((f(L,R)|0)+(la>>>16)|0)+(wa>>>16)|0;ta=((f(D,Z)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(L,Z)|0)+(sa>>>16)|0)+(ta>>>16)|0;la=ta<<16|ra&65535;ra=((f(D,S)|0)+(ma&65535)|0)+(wa&65535)|0;sa=((f(L,S)|0)+(ma>>>16)|0)+(wa>>>16)|0;ta=((f(D,$)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(L,$)|0)+(sa>>>16)|0)+(ta>>>16)|0;ma=ta<<16|ra&65535;ra=((f(D,T)|0)+(na&65535)|0)+(wa&65535)|0;sa=((f(L,T)|0)+(na>>>16)|0)+(wa>>>16)|0;ta=((f(D,_)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(L,_)|0)+(sa>>>16)|0)+(ta>>>16)|0;na=ta<<16|ra&65535;ra=((f(D,U)|0)+(oa&65535)|0)+(wa&65535)|0;sa=((f(L,U)|0)+(oa>>>16)|0)+(wa>>>16)|0;ta=((f(D,aa)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(L,aa)|0)+(sa>>>16)|0)+(ta>>>16)|0;oa=ta<<16|ra&65535;pa=wa;ra=((f(E,N)|0)+(ia&65535)|0)+(qa&65535)|0;sa=((f(M,N)|0)+(ia>>>16)|0)+(qa>>>16)|0;ta=((f(E,V)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(M,V)|0)+(sa>>>16)|0)+(ta>>>16)|0;ia=ta<<16|ra&65535;ra=((f(E,O)|0)+(ja&65535)|0)+(wa&65535)|0;sa=((f(M,O)|0)+(ja>>>16)|0)+(wa>>>16)|0;ta=((f(E,W)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(M,W)|0)+(sa>>>16)|0)+(ta>>>16)|0;ja=ta<<16|ra&65535;ra=((f(E,P)|0)+(ka&65535)|0)+(wa&65535)|0;sa=((f(M,P)|0)+(ka>>>16)|0)+(wa>>>16)|0;ta=((f(E,X)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(M,X)|0)+(sa>>>16)|0)+(ta>>>16)|0;ka=ta<<16|ra&65535;ra=((f(E,Q)|0)+(la&65535)|0)+(wa&65535)|0;sa=((f(M,Q)|0)+(la>>>16)|0)+(wa>>>16)|0;ta=((f(E,Y)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(M,Y)|0)+(sa>>>16)|0)+(ta>>>16)|0;la=ta<<16|ra&65535;ra=((f(E,R)|0)+(ma&65535)|0)+(wa&65535)|0;sa=((f(M,R)|0)+(ma>>>16)|0)+(wa>>>16)|0;ta=((f(E,Z)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(M,Z)|0)+(sa>>>16)|0)+(ta>>>16)|0;ma=ta<<16|ra&65535;ra=((f(E,S)|0)+(na&65535)|0)+(wa&65535)|0;sa=((f(M,S)|0)+(na>>>16)|0)+(wa>>>16)|0;ta=((f(E,$)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(M,$)|0)+(sa>>>16)|0)+(ta>>>16)|0;na=ta<<16|ra&65535;ra=((f(E,T)|0)+(oa&65535)|0)+(wa&65535)|0;sa=((f(M,T)|0)+(oa>>>16)|0)+(wa>>>16)|0;ta=((f(E,_)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(M,_)|0)+(sa>>>16)|0)+(ta>>>16)|0;oa=ta<<16|ra&65535;ra=((f(E,U)|0)+(pa&65535)|0)+(wa&65535)|0;sa=((f(M,U)|0)+(pa>>>16)|0)+(wa>>>16)|0;ta=((f(E,aa)|0)+(sa&65535)|0)+(ra>>>16)|0;wa=((f(M,aa)|0)+(sa>>>16)|0)+(ta>>>16)|0;pa=ta<<16|ra&65535;qa=wa;Da=ya+(Ba+Ca|0)|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((ba&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ba>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((ca&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ca>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((da&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(da>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((ea&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ea>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((fa&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(fa>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((ga&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ga>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((ha&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ha>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((ia&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ia>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16}Da=ya+(Ba+Ca|0)|0;xa=e[Ga+Da>>2]|0;ra=(((xa&65535)+((ja&65535)<<1)|0)+ua|0)+va|0;ta=((xa>>>16)+(ja>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((ka&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ka>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((la&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(la>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((ma&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(ma>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((na&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(na>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((oa&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(oa>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((pa&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(pa>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;ua=ta>>>16;Da=Da+4|0;xa=e[Ga+Da>>2]|0;ra=((xa&65535)+((qa&65535)<<1)|0)+ua|0;ta=((xa>>>16)+(qa>>>16<<1)|0)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;va=ta>>>16}for(Da=Da+4|0;!!va&(Da|0)>2]|0;ra=(xa&65535)+va|0;ta=(xa>>>16)+(ra>>>16)|0;e[Ga+Da>>2]=ta<<16|ra&65535;va=ta>>>16}}}}function s(u,v,w,x,y){u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;var z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;for(P=v-1&-4;(P|0)>=0;P=P-4|0){z=e[u+P>>2]|0;if(z){v=P;break}}for(P=x-1&-4;(P|0)>=0;P=P-4|0){A=e[w+P>>2]|0;if(A){x=P;break}}while((A&2147483648)==0){A=A<<1;B=B+1|0}D=e[u+v>>2]|0;if(B){C=D>>>(32-B|0);for(P=v-4|0;(P|0)>=0;P=P-4|0){z=e[u+P>>2]|0;e[u+P+4>>2]=D<>>(32-B|0):0);D=z}e[u>>2]=D<>2]|0;for(P=x-4|0;(P|0)>=0;P=P-4|0){A=e[w+P>>2]|0;e[w+P+4>>2]=E<>>(32-B|0);E=A}e[w>>2]=E<>2]|0;F=E>>>16,G=E&65535;for(P=v;(P|0)>=(x|0);P=P-4|0){Q=P-x|0;D=e[u+P>>2]|0;H=(C>>>0)/(F>>>0)|0,J=(C>>>0)%(F>>>0)|0,L=f(H,G)|0;while((H|0)==65536|L>>>0>(J<<16|D>>>16)>>>0){H=H-1|0,J=J+F|0,L=L-G|0;if((J|0)>=65536)break}N=0,O=0;for(R=0;(R|0)<=(x|0);R=R+4|0){A=e[w+R>>2]|0;L=(f(H,A&65535)|0)+(N>>>16)|0;M=(f(H,A>>>16)|0)+(L>>>16)|0;A=N&65535|L<<16;N=M;z=e[u+Q+R>>2]|0;L=((z&65535)-(A&65535)|0)+O|0;M=((z>>>16)-(A>>>16)|0)+(L>>16)|0;e[u+Q+R>>2]=M<<16|L&65535;O=M>>16}L=((C&65535)-(N&65535)|0)+O|0;M=((C>>>16)-(N>>>16)|0)+(L>>16)|0;C=M<<16|L&65535;O=M>>16;if(O){H=H-1|0;O=0;for(R=0;(R|0)<=(x|0);R=R+4|0){A=e[w+R>>2]|0;z=e[u+Q+R>>2]|0;L=(z&65535)+O|0;M=(z>>>16)+A+(L>>>16)|0;e[u+Q+R>>2]=M<<16|L&65535;O=M>>>16}C=C+O|0}D=e[u+P>>2]|0;z=C<<16|D>>>16;I=(z>>>0)/(F>>>0)|0,K=(z>>>0)%(F>>>0)|0,L=f(I,G)|0;while((I|0)==65536|L>>>0>(K<<16|D&65535)>>>0){I=I-1|0,K=K+F|0,L=L-G|0;if((K|0)>=65536)break}N=0,O=0;for(R=0;(R|0)<=(x|0);R=R+4|0){A=e[w+R>>2]|0;L=(f(I,A&65535)|0)+(N&65535)|0;M=((f(I,A>>>16)|0)+(L>>>16)|0)+(N>>>16)|0;A=L&65535|M<<16;N=M>>>16;z=e[u+Q+R>>2]|0;L=((z&65535)-(A&65535)|0)+O|0;M=((z>>>16)-(A>>>16)|0)+(L>>16)|0;O=M>>16;e[u+Q+R>>2]=M<<16|L&65535}L=((C&65535)-(N&65535)|0)+O|0;M=((C>>>16)-(N>>>16)|0)+(L>>16)|0;O=M>>16;if(O){I=I-1|0;O=0;for(R=0;(R|0)<=(x|0);R=R+4|0){A=e[w+R>>2]|0;z=e[u+Q+R>>2]|0;L=((z&65535)+(A&65535)|0)+O|0;M=((z>>>16)+(A>>>16)|0)+(L>>>16)|0;O=M>>>16;e[u+Q+R>>2]=L&65535|M<<16}}e[y+Q>>2]=H<<16|I;C=e[u+P>>2]|0}if(B){D=e[u>>2]|0;for(P=4;(P|0)<=(x|0);P=P+4|0){z=e[u+P>>2]|0;e[u+P-4>>2]=z<<(32-B|0)|D>>>B;D=z}e[u+x>>2]=D>>>B}}function t(u,v,w,x,y,z){u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;var A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;A=h(x<<1)|0;k(x<<1,0,A);j(v,u,A);for(L=0;(L|0)<(x|0);L=L+4|0){C=e[A+L>>2]|0,D=C&65535,C=C>>>16;F=y>>>16,E=y&65535;G=f(D,E)|0,H=((f(D,F)|0)+(f(C,E)|0)|0)+(G>>>16)|0;D=G&65535,C=H&65535;K=0;for(M=0;(M|0)<(x|0);M=M+4|0){N=L+M|0;F=e[w+M>>2]|0,E=F&65535,F=F>>>16;J=e[A+N>>2]|0;G=((f(D,E)|0)+(K&65535)|0)+(J&65535)|0;H=((f(D,F)|0)+(K>>>16)|0)+(J>>>16)|0;I=((f(C,E)|0)+(H&65535)|0)+(G>>>16)|0;K=((f(C,F)|0)+(I>>>16)|0)+(H>>>16)|0;J=I<<16|G&65535;e[A+N>>2]=J}N=L+M|0;J=e[A+N>>2]|0;G=((J&65535)+(K&65535)|0)+B|0;H=((J>>>16)+(K>>>16)|0)+(G>>>16)|0;e[A+N>>2]=H<<16|G&65535;B=H>>>16}j(x,A+x|0,z);i(x<<1);if(B|(m(w,x,z,x)|0)<=0){p(z,x,w,x,z,x)|0}}return{sreset:g,salloc:h,sfree:i,z:k,tst:n,neg:l,cmp:m,add:o,sub:p,mul:q,sqr:r,div:s,mredc:t}}function wa(a){return a instanceof ya}function xa(a,b){return a*b|0}function ya(a){var b=Kb,c=0,d=0;if(n(a)&&(a=f(a)),o(a)&&(a=new Uint8Array(a)),void 0===a);else if(m(a)){var e=Math.abs(a);e>4294967295?(b=new Uint32Array(2),b[0]=0|e,b[1]=e/4294967296|0,c=52):e>0?(b=new Uint32Array(1),b[0]=e,c=32):(b=Kb,c=0),d=0>a?-1:1}else if(p(a)){for(var g=0;!a[g];g++);if(c=8*(a.length-g),!c)return Mb;b=new Uint32Array(c+31>>5);for(var h=a.length-4;h>=g;h-=4)b[a.length-4-h>>2]=a[h]<<24|a[h+1]<<16|a[h+2]<<8|a[h+3];g-h===3?b[b.length-1]=a[g]:g-h===2?b[b.length-1]=a[g]<<8|a[g+1]:g-h===1&&(b[b.length-1]=a[g]<<16|a[g+1]<<8|a[g+2]),d=1}else{if("object"!=typeof a||null===a)throw new TypeError("number is of unexpected type");b=new Uint32Array(a.limbs),c=a.bitLength,d=a.sign}this.limbs=b,this.bitLength=c,this.sign=d}function za(a){a=a||16;var b=this.limbs,c=this.bitLength,e="";if(16!==a)throw new d("bad radix");for(var f=(c+31>>5)-1;f>=0;f--){var g=b[f].toString(16);e+="00000000".substr(g.length),e+=g}return e=e.replace(/^0+/,""),e.length||(e="0"),this.sign<0&&(e="-"+e),e}function Aa(){var a=this.bitLength,b=this.limbs;if(0===a)return new Uint8Array(0);for(var c=a+7>>3,d=new Uint8Array(c),e=0;c>e;e++){var f=c-e-1;d[e]=b[f>>2]>>((3&f)<<3)}return d}function Ba(){var a=this.limbs,b=this.bitLength,c=this.sign;if(!c)return 0;if(32>=b)return c*(a[0]>>>0);if(52>=b)return c*(4294967296*(a[1]>>>0)+(a[0]>>>0));var d,e,f=0;for(d=a.length-1;d>=0;d--)if(0!==(e=a[d])){for(;0===(e<>>0):c*(1048576*((a[d]<>>32-f:0))>>>0)+((a[d-1]<1?a[d-2]>>>32-f:0))>>>12))*Math.pow(2,32*d-f-52)}function Ca(a){var b=this.limbs,c=this.bitLength;if(a>=c)return this;var d=new ya,e=a+31>>5,f=a%32;return d.limbs=new Uint32Array(b.subarray(0,e)),d.bitLength=a,d.sign=this.sign,f&&(d.limbs[e-1]&=-1>>>32-f),d}function Da(a,b){if(!m(a))throw new TypeError("TODO");if(void 0!==b&&!m(b))throw new TypeError("TODO");var c=this.limbs,d=this.bitLength;if(0>a)throw new RangeError("TODO");if(a>=d)return Mb;(void 0===b||b>d-a)&&(b=d-a);var e,f=new ya,g=a>>5,h=a+b+31>>5,i=b+31>>5,j=a%32,k=b%32;if(e=new Uint32Array(i),j){for(var l=0;h-g-1>l;l++)e[l]=c[g+l]>>>j|c[g+l+1]<<32-j;e[l]=c[g+l]>>>j}else e.set(c.subarray(g,h));return k&&(e[i-1]&=-1>>>32-k),f.limbs=e,f.bitLength=b,f.sign=this.sign,f}function Ea(){var a=new ya;return a.limbs=this.limbs,a.bitLength=this.bitLength,a.sign=-1*this.sign,a}function Fa(a){wa(a)||(a=new ya(a));var b=this.limbs,c=b.length,d=a.limbs,e=d.length,f=0;return this.signa.sign?1:(Jb.set(b,0),Jb.set(d,c),f=Hb.cmp(0,c<<2,c<<2,e<<2),f*this.sign)}function Ga(a){if(wa(a)||(a=new ya(a)),!this.sign)return a;if(!a.sign)return this;var b,c,d,e,f=this.bitLength,g=this.limbs,h=g.length,i=this.sign,j=a.bitLength,k=a.limbs,l=k.length,m=a.sign,n=new ya;b=(f>j?f:j)+(i*m>0?1:0),c=b+31>>5,Hb.sreset();var o=Hb.salloc(h<<2),p=Hb.salloc(l<<2),q=Hb.salloc(c<<2);return Hb.z(q-o+(c<<2),0,o),Jb.set(g,o>>2),Jb.set(k,p>>2),i*m>0?(Hb.add(o,h<<2,p,l<<2,q,c<<2),d=i):i>m?(e=Hb.sub(o,h<<2,p,l<<2,q,c<<2),d=e?m:i):(e=Hb.sub(p,l<<2,o,h<<2,q,c<<2),d=e?i:m),e&&Hb.neg(q,c<<2,q,c<<2),0===Hb.tst(q,c<<2)?Mb:(n.limbs=new Uint32Array(Jb.subarray(q>>2,(q>>2)+c)),n.bitLength=b,n.sign=d,n)}function Ha(a){return wa(a)||(a=new ya(a)),this.add(a.negate())}function Ia(a){if(wa(a)||(a=new ya(a)),!this.sign||!a.sign)return Mb;var b,c,d=this.bitLength,e=this.limbs,f=e.length,g=a.bitLength,h=a.limbs,i=h.length,j=new ya;b=d+g,c=b+31>>5,Hb.sreset();var k=Hb.salloc(f<<2),l=Hb.salloc(i<<2),m=Hb.salloc(c<<2);return Hb.z(m-k+(c<<2),0,k),Jb.set(e,k>>2),Jb.set(h,l>>2),Hb.mul(k,f<<2,l,i<<2,m,c<<2),j.limbs=new Uint32Array(Jb.subarray(m>>2,(m>>2)+c)),j.sign=this.sign*a.sign,j.bitLength=b,j}function Ja(){if(!this.sign)return Mb;var a,b,c=this.bitLength,d=this.limbs,e=d.length,f=new ya;a=c<<1,b=a+31>>5,Hb.sreset();var g=Hb.salloc(e<<2),h=Hb.salloc(b<<2);return Hb.z(h-g+(b<<2),0,g),Jb.set(d,g>>2),Hb.sqr(g,e<<2,h),f.limbs=new Uint32Array(Jb.subarray(h>>2,(h>>2)+b)),f.bitLength=a,f.sign=1,f}function Ka(a){wa(a)||(a=new ya(a));var b,c,d=this.bitLength,e=this.limbs,f=e.length,g=a.bitLength,h=a.limbs,i=h.length,j=Mb,k=Mb;Hb.sreset();var l=Hb.salloc(f<<2),m=Hb.salloc(i<<2),n=Hb.salloc(f<<2);return Hb.z(n-l+(f<<2),0,l),Jb.set(e,l>>2),Jb.set(h,m>>2),Hb.div(l,f<<2,m,i<<2,n),b=Hb.tst(n,f<<2)>>2,b&&(j=new ya,j.limbs=new Uint32Array(Jb.subarray(n>>2,(n>>2)+b)),j.bitLength=b<<5>d?d:b<<5,j.sign=this.sign*a.sign),c=Hb.tst(l,i<<2)>>2,c&&(k=new ya,k.limbs=new Uint32Array(Jb.subarray(l>>2,(l>>2)+c)),k.bitLength=c<<5>g?g:c<<5,k.sign=this.sign),{quotient:j,remainder:k}}function La(a,b){var c,d,e,f,g=0>a?-1:1,h=0>b?-1:1,i=1,j=0,k=0,l=1;for(a*=g,b*=h,f=b>a,f&&(e=a,a=b,b=e,e=g,g=h,h=e),d=Math.floor(a/b),c=a-d*b;c;)e=i-d*j,i=j,j=e,e=k-d*l,k=l,l=e,a=b,b=c,d=Math.floor(a/b),c=a-d*b;return j*=g,l*=h,f&&(e=j,j=l,l=e),{gcd:b,x:j,y:l}}function Ma(a,b){wa(a)||(a=new ya(a)),wa(b)||(b=new ya(b));var c=a.sign,d=b.sign;0>c&&(a=a.negate()),0>d&&(b=b.negate());var e=a.compare(b);if(0>e){var f=a;a=b,b=f,f=c,c=d,d=f}var g,h,i,j=Nb,k=Mb,l=b.bitLength,m=Mb,n=Nb,o=a.bitLength;for(g=a.divide(b);(h=g.remainder)!==Mb;)i=g.quotient,g=j.subtract(i.multiply(k).clamp(l)).clamp(l),j=k,k=g,g=m.subtract(i.multiply(n).clamp(o)).clamp(o),m=n,n=g,a=b,b=h,g=a.divide(b);if(0>c&&(k=k.negate()),0>d&&(n=n.negate()),0>e){var f=k;k=n,n=f}return{gcd:b,x:k,y:n}}function Na(){if(ya.apply(this,arguments),this.valueOf()<1)throw new RangeError;if(!(this.bitLength<=32)){var a;if(1&this.limbs[0]){var b=(this.bitLength+31&-32)+1,c=new Uint32Array(b+31>>5);c[c.length-1]=1,a=new ya,a.sign=1,a.bitLength=b,a.limbs=c;var d=La(4294967296,this.limbs[0]).y;this.coefficient=0>d?-d:4294967296-d,this.comodulus=a,this.comodulusRemainder=a.divide(this).remainder,this.comodulusRemainderSquare=a.square().divide(this).remainder}}}function Oa(a){return wa(a)||(a=new ya(a)),a.bitLength<=32&&this.bitLength<=32?new ya(a.valueOf()%this.valueOf()):a.compare(this)<0?a:a.divide(this).remainder}function Pa(a){a=this.reduce(a);var b=Ma(this,a);return 1!==b.gcd.valueOf()?null:(b=b.y,b.sign<0&&(b=b.add(this).clamp(this.bitLength)),b)}function Qa(a,b){wa(a)||(a=new ya(a)),wa(b)||(b=new ya(b));for(var c=0,d=0;d>>=1;var f=8;b.bitLength<=4536&&(f=7),b.bitLength<=1736&&(f=6),b.bitLength<=630&&(f=5),b.bitLength<=210&&(f=4),b.bitLength<=60&&(f=3),b.bitLength<=12&&(f=2),1<=c&&(f=1),a=Ra(this.reduce(a).multiply(this.comodulusRemainderSquare),this);var g=Ra(a.square(),this),h=new Array(1<d;d++)h[d]=Ra(h[d-1].multiply(g),this);for(var i=this.comodulusRemainder,j=i,d=b.limbs.length-1;d>=0;d--)for(var e=b.limbs[d],k=32;k>0;)if(2147483648&e){for(var l=e>>>32-f,m=f;0===(1&l);)l>>>=1,m--;for(var n=h[l>>>1];l;)l>>>=1,j!==i&&(j=Ra(j.square(),this));j=j!==i?Ra(j.multiply(n),this):n,e<<=m,k-=m}else j!==i&&(j=Ra(j.square(),this)),e<<=1,k--;return j=Ra(j,this)}function Ra(a,b){var c=a.limbs,d=c.length,e=b.limbs,f=e.length,g=b.coefficient;Hb.sreset();var h=Hb.salloc(d<<2),i=Hb.salloc(f<<2),j=Hb.salloc(f<<2);Hb.z(j-h+(f<<2),0,h),Jb.set(c,h>>2),Jb.set(e,i>>2),Hb.mredc(h,d<<2,i,f<<2,g,j);var k=new ya;return k.limbs=new Uint32Array(Jb.subarray(j>>2,(j>>2)+f)),k.bitLength=b.bitLength,k.sign=1,k}function Sa(a){var b=new ya(this),c=0;for(b.limbs[0]-=1;0===b.limbs[c>>5];)c+=32;for(;0===(b.limbs[c>>5]>>(31&c)&1);)c++;b=b.slice(c);for(var d=new Na(this),e=this.subtract(Nb),f=new ya(this),g=this.limbs.length-1;0===f.limbs[g];)g--;for(;--a>=0;){for(ta(f.limbs),f.limbs[0]<2&&(f.limbs[0]+=2);f.compare(e)>=0;)f.limbs[g]>>>=1;var h=d.power(f,b);if(0!==h.compare(Nb)&&0!==h.compare(e)){for(var i=c;--i>0;){if(h=h.square().divide(d).remainder,0===h.compare(Nb))return!1;if(0===h.compare(e))break}if(0===i)return!1}}return!0}function Ta(a){a=a||80;var b=this.limbs,c=0;if(0===(1&b[0]))return!1;if(1>=a)return!0;var d=0,e=0,f=0;for(c=0;c>>=2;for(var h=b[c];h;)e+=3&h,h>>>=2,e-=3&h,h>>>=2;for(var i=b[c];i;)f+=15&i,i>>>=4,f-=15&i,i>>>=4}return d%3&&e%5&&f%17?2>=a?!0:Sa.call(this,a>>>1):!1}function Ua(a){if(Pb.length>=a)return Pb.slice(0,a);for(var b=Pb[Pb.length-1]+2;Pb.length=d*d&&b%d!=0;d=Pb[++c]);d*d>b&&Pb.push(b)}return Pb}function Va(a,c){var d=a+31>>5,e=new ya({sign:1,bitLength:a,limbs:d}),f=e.limbs,g=1e4;512>=a&&(g=2200),256>=a&&(g=600);var h=Ua(g),i=new Uint32Array(g),j=a*b.Math.LN2|0,k=27;for(a>=250&&(k=12),a>=450&&(k=6),a>=850&&(k=3),a>=1300&&(k=2);;){ta(f),f[0]|=1,f[d-1]|=1<<(a-1&31),31&a&&(f[d-1]&=l(a+1&31)-1),i[0]=1;for(var m=1;g>m;m++)i[m]=e.divide(h[m]).remainder.valueOf();a:for(var n=0;j>n;n+=2,f[0]+=2){for(var m=1;g>m;m++)if((i[m]+n)%h[m]===0)continue a;if(("function"!=typeof c||c(e))&&Sa.call(e,k))return e}}}c.prototype=Object.create(Error.prototype,{name:{value:"IllegalStateError"}}),d.prototype=Object.create(Error.prototype,{name:{value:"IllegalArgumentError"}}),e.prototype=Object.create(Error.prototype,{name:{value:"SecurityError"}});var Wa=b.Float64Array||b.Float32Array;a.string_to_bytes=f,a.hex_to_bytes=g,a.base64_to_bytes=h,a.bytes_to_string=i,a.bytes_to_hex=j,a.bytes_to_base64=k,b.IllegalStateError=c,b.IllegalArgumentError=d,b.SecurityError=e;var Xa=function(){"use strict";function a(){e=[],f=[];var a,b,c=1;for(a=0;255>a;a++)e[a]=c,b=128&c,c<<=1,c&=255,128===b&&(c^=27),c^=e[a],f[e[a]]=a;e[255]=e[0],f[0]=0,k=!0}function b(a,b){var c=e[(f[a]+f[b])%255];return(0===a||0===b)&&(c=0),c}function c(a){var b=e[255-f[a]];return 0===a&&(b=0),b}function d(){function d(a){var b,d,e;for(d=e=c(a),b=0;4>b;b++)d=255&(d<<1|d>>>7),e^=d;return e^=99}k||a(),g=[],h=[],i=[[],[],[],[]],j=[[],[],[],[]];for(var e=0;256>e;e++){var f=d(e);g[e]=f,h[f]=e,i[0][e]=b(2,f)<<24|f<<16|f<<8|b(3,f),j[0][f]=b(14,e)<<24|b(9,e)<<16|b(13,e)<<8|b(11,e);for(var l=1;4>l;l++)i[l][e]=i[l-1][e]>>>8|i[l-1][e]<<24,j[l][f]=j[l-1][f]>>>8|j[l-1][f]<<24}}var e,f,g,h,i,j,k=!1,l=!1,m=function(a,b,c){function e(a,b,c,d,e,h,i,k,l){var m=f.subarray(0,60),o=f.subarray(256,316);m.set([b,c,d,e,h,i,k,l]);for(var p=a,q=1;4*a+28>p;p++){var r=m[p-1];(p%a===0||8===a&&p%a===4)&&(r=g[r>>>24]<<24^g[r>>>16&255]<<16^g[r>>>8&255]<<8^g[255&r]),p%a===0&&(r=r<<8^r>>>24^q<<24,q=q<<1^(128&q?27:0)),m[p]=m[p-a]^r}for(var s=0;p>s;s+=4)for(var t=0;4>t;t++){var r=m[p-(4+s)+(4-t)%4];4>s||s>=p-4?o[s+t]=r:o[s+t]=j[0][g[r>>>24]]^j[1][g[r>>>16&255]]^j[2][g[r>>>8&255]]^j[3][g[255&r]]}n.set_rounds(a+5)}l||d();var f=new Uint32Array(c);f.set(g,512),f.set(h,768);for(var k=0;4>k;k++)f.set(i[k],4096+1024*k>>2),f.set(j[k],8192+1024*k>>2);var m={Uint8Array:Uint8Array,Uint32Array:Uint32Array},n=function(a,b,c){"use asm";var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;var y=new a.Uint32Array(c),z=new a.Uint8Array(c);function A(X,Y,Z,$,_,aa,ba,ca){X=X|0;Y=Y|0;Z=Z|0;$=$|0;_=_|0;aa=aa|0;ba=ba|0;ca=ca|0;var da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0;da=Z|1024,ea=Z|2048,fa=Z|3072;_=_^y[(X|0)>>2],aa=aa^y[(X|4)>>2],ba=ba^y[(X|8)>>2],ca=ca^y[(X|12)>>2];for(ka=16;(ka|0)<=$<<4;ka=ka+16|0){ga=y[(Z|_>>22&1020)>>2]^y[(da|aa>>14&1020)>>2]^y[(ea|ba>>6&1020)>>2]^y[(fa|ca<<2&1020)>>2]^y[(X|ka|0)>>2],ha=y[(Z|aa>>22&1020)>>2]^y[(da|ba>>14&1020)>>2]^y[(ea|ca>>6&1020)>>2]^y[(fa|_<<2&1020)>>2]^y[(X|ka|4)>>2],ia=y[(Z|ba>>22&1020)>>2]^y[(da|ca>>14&1020)>>2]^y[(ea|_>>6&1020)>>2]^y[(fa|aa<<2&1020)>>2]^y[(X|ka|8)>>2],ja=y[(Z|ca>>22&1020)>>2]^y[(da|_>>14&1020)>>2]^y[(ea|aa>>6&1020)>>2]^y[(fa|ba<<2&1020)>>2]^y[(X|ka|12)>>2];_=ga,aa=ha,ba=ia,ca=ja}d=y[(Y|_>>22&1020)>>2]<<24^y[(Y|aa>>14&1020)>>2]<<16^y[(Y|ba>>6&1020)>>2]<<8^y[(Y|ca<<2&1020)>>2]^y[(X|ka|0)>>2],e=y[(Y|aa>>22&1020)>>2]<<24^y[(Y|ba>>14&1020)>>2]<<16^y[(Y|ca>>6&1020)>>2]<<8^y[(Y|_<<2&1020)>>2]^y[(X|ka|4)>>2],f=y[(Y|ba>>22&1020)>>2]<<24^y[(Y|ca>>14&1020)>>2]<<16^y[(Y|_>>6&1020)>>2]<<8^y[(Y|aa<<2&1020)>>2]^y[(X|ka|8)>>2],g=y[(Y|ca>>22&1020)>>2]<<24^y[(Y|_>>14&1020)>>2]<<16^y[(Y|aa>>6&1020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0){if(_>>>31){da=da^X,ea=ea^Y,fa=fa^Z,ga=ga^$}_=_<<1|aa>>>31,aa=aa<<1|ba>>>31,ba=ba<<1|ca>>>31,ca=ca<<1;ia=$&1;$=$>>>1|Z<<31,Z=Z>>>1|Y<<31,Y=Y>>>1|X<<31,X=X>>>1;if(ia)X=X^3774873600}h=da,i=ea,j=fa,k=ga}function K(X){X=X|0;x=X}function L(X,Y,Z,$){X=X|0;Y=Y|0;Z=Z|0;$=$|0;d=X,e=Y,f=Z,g=$}function M(X,Y,Z,$){X=X|0;Y=Y|0;Z=Z|0;$=$|0;h=X,i=Y,j=Z,k=$}function N(X,Y,Z,$){X=X|0;Y=Y|0;Z=Z|0;$=$|0;l=X,m=Y,n=Z,o=$}function O(X,Y,Z,$){X=X|0;Y=Y|0;Z=Z|0;$=$|0;p=X,q=Y,r=Z,s=$}function P(X,Y,Z,$){X=X|0;Y=Y|0;Z=Z|0;$=$|0;o=~s&o|s&$,n=~r&n|r&Z,m=~q&m|q&Y,l=~p&l|p&X}function Q(X){X=X|0;if(X&15)return-1;z[X|0]=d>>>24,z[X|1]=d>>>16&255,z[X|2]=d>>>8&255,z[X|3]=d&255,z[X|4]=e>>>24,z[X|5]=e>>>16&255,z[X|6]=e>>>8&255,z[X|7]=e&255,z[X|8]=f>>>24,z[X|9]=f>>>16&255,z[X|10]=f>>>8&255,z[X|11]=f&255,z[X|12]=g>>>24,z[X|13]=g>>>16&255,z[X|14]=g>>>8&255,z[X|15]=g&255;return 16}function R(X){X=X|0;if(X&15)return-1;z[X|0]=h>>>24,z[X|1]=h>>>16&255,z[X|2]=h>>>8&255,z[X|3]=h&255,z[X|4]=i>>>24,z[X|5]=i>>>16&255,z[X|6]=i>>>8&255,z[X|7]=i&255,z[X|8]=j>>>24,z[X|9]=j>>>16&255,z[X|10]=j>>>8&255,z[X|11]=j&255,z[X|12]=k>>>24,z[X|13]=k>>>16&255,z[X|14]=k>>>8&255,z[X|15]=k&255;return 16}function S(){B(0,0,0,0);t=d,u=e,v=f,w=g}function T(X,Y,Z){X=X|0;Y=Y|0;Z=Z|0;var $=0;if(Y&15)return-1;while((Z|0)>=16){V[X&7](z[Y|0]<<24|z[Y|1]<<16|z[Y|2]<<8|z[Y|3],z[Y|4]<<24|z[Y|5]<<16|z[Y|6]<<8|z[Y|7],z[Y|8]<<24|z[Y|9]<<16|z[Y|10]<<8|z[Y|11],z[Y|12]<<24|z[Y|13]<<16|z[Y|14]<<8|z[Y|15]);z[Y|0]=d>>>24,z[Y|1]=d>>>16&255,z[Y|2]=d>>>8&255,z[Y|3]=d&255,z[Y|4]=e>>>24,z[Y|5]=e>>>16&255,z[Y|6]=e>>>8&255,z[Y|7]=e&255,z[Y|8]=f>>>24,z[Y|9]=f>>>16&255,z[Y|10]=f>>>8&255,z[Y|11]=f&255,z[Y|12]=g>>>24,z[Y|13]=g>>>16&255,z[Y|14]=g>>>8&255,z[Y|15]=g&255;$=$+16|0,Y=Y+16|0,Z=Z-16|0}return $|0}function U(X,Y,Z){X=X|0;Y=Y|0;Z=Z|0;var $=0;if(Y&15)return-1;while((Z|0)>=16){W[X&1](z[Y|0]<<24|z[Y|1]<<16|z[Y|2]<<8|z[Y|3],z[Y|4]<<24|z[Y|5]<<16|z[Y|6]<<8|z[Y|7],z[Y|8]<<24|z[Y|9]<<16|z[Y|10]<<8|z[Y|11],z[Y|12]<<24|z[Y|13]<<16|z[Y|14]<<8|z[Y|15]);$=$+16|0,Y=Y+16|0,Z=Z-16|0}return $|0}var V=[B,C,D,E,F,G,H,I];var W=[D,J];return{set_rounds:K,set_state:L, +set_iv:M,set_nonce:N,set_mask:O,set_counter:P,get_state:Q,get_iv:R,gcm_init:S,cipher:T,mac:U}}(m,b,c);return n.set_key=e,n};return m.ENC={ECB:0,CBC:2,CFB:4,OFB:6,CTR:7},m.DEC={ECB:1,CBC:3,CFB:5,OFB:6,CTR:7},m.MAC={CBC:0,GCM:1},m.HEAP_DATA=16384,m}(),Ya=A.prototype;Ya.BLOCK_SIZE=16,Ya.reset=D,Ya.encrypt=z,Ya.decrypt=z;var Za=B.prototype;Za.BLOCK_SIZE=16,Za.reset=D,Za.process=y,Za.finish=z;var $a=68719476704,_a=F.prototype;_a.BLOCK_SIZE=16,_a.reset=I,_a.encrypt=L,_a.decrypt=O;var ab=G.prototype;ab.BLOCK_SIZE=16,ab.reset=I,ab.process=J,ab.finish=K;var bb=H.prototype;bb.BLOCK_SIZE=16,bb.reset=I,bb.process=M,bb.finish=N;var cb=new Uint8Array(1048576),db=Xa(b,null,cb.buffer);a.AES_GCM=F,a.AES_GCM.encrypt=P,a.AES_GCM.decrypt=Q,a.AES_GCM.Encrypt=G,a.AES_GCM.Decrypt=H;var eb=64,fb=32;V.BLOCK_SIZE=eb,V.HASH_SIZE=fb;var gb=V.prototype;gb.reset=R,gb.process=S,gb.finish=T;var hb=null;V.bytes=X,V.hex=Y,V.base64=Z,a.SHA256=V;var ib=$.prototype;ib.reset=ba,ib.process=ca,ib.finish=da,ea.BLOCK_SIZE=V.BLOCK_SIZE,ea.HMAC_SIZE=V.HASH_SIZE;var jb=ea.prototype;jb.reset=fa,jb.process=ca,jb.finish=ga;var kb=null;ea.bytes=ia,ea.hex=ja,ea.base64=ka,a.HMAC_SHA256=ea;var lb=la.prototype;lb.reset=ma,lb.generate=na;var mb=oa.prototype;mb.reset=ma,mb.generate=pa;var nb,ob=null,pb=function(){function a(){function a(){b^=d<<11,l=l+b|0,d=d+f|0,d^=f>>>2,m=m+d|0,f=f+l|0,f^=l<<8,n=n+f|0,l=l+m|0,l^=m>>>16,o=o+l|0,m=m+n|0,m^=n<<10,p=p+m|0,n=n+o|0,n^=o>>>4,b=b+n|0,o=o+p|0,o^=p<<8,d=d+o|0,p=p+b|0,p^=b>>>9,f=f+p|0,b=b+d|0}var b,d,f,l,m,n,o,p;h=i=j=0,b=d=f=l=m=n=o=p=2654435769;for(var q=0;4>q;q++)a();for(var q=0;256>q;q+=8)b=b+g[0|q]|0,d=d+g[1|q]|0,f=f+g[2|q]|0,l=l+g[3|q]|0,m=m+g[4|q]|0,n=n+g[5|q]|0,o=o+g[6|q]|0,p=p+g[7|q]|0,a(),e.set([b,d,f,l,m,n,o,p],q);for(var q=0;256>q;q+=8)b=b+e[0|q]|0,d=d+e[1|q]|0,f=f+e[2|q]|0,l=l+e[3|q]|0,m=m+e[4|q]|0,n=n+e[5|q]|0,o=o+e[6|q]|0,p=p+e[7|q]|0,a(),e.set([b,d,f,l,m,n,o,p],q);c(1),k=256}function b(b){var c,d,e,h,i;if(q(b))b=new Uint8Array(b.buffer);else if(m(b))h=new Wa(1),h[0]=b,b=new Uint8Array(h.buffer);else if(n(b))b=f(b);else{if(!o(b))throw new TypeError("bad seed type");b=new Uint8Array(b)}for(i=b.length,d=0;i>d;d+=1024){for(e=d,c=0;1024>c&&i>e;e=d|++c)g[c>>2]^=b[e]<<((3&c)<<3);a()}}function c(a){a=a||1;for(var b,c,d;a--;)for(j=j+1|0,i=i+j|0,b=0;256>b;b+=4)h^=h<<13,h=e[b+128&255]+h|0,c=e[0|b],e[0|b]=d=e[c>>>2&255]+(h+i|0)|0,g[0|b]=i=e[d>>>10&255]+c|0,h^=h>>>6,h=e[b+129&255]+h|0,c=e[1|b],e[1|b]=d=e[c>>>2&255]+(h+i|0)|0,g[1|b]=i=e[d>>>10&255]+c|0,h^=h<<2,h=e[b+130&255]+h|0,c=e[2|b],e[2|b]=d=e[c>>>2&255]+(h+i|0)|0,g[2|b]=i=e[d>>>10&255]+c|0,h^=h>>>16,h=e[b+131&255]+h|0,c=e[3|b],e[3|b]=d=e[c>>>2&255]+(h+i|0)|0,g[3|b]=i=e[d>>>10&255]+c|0}function d(){return k--||(c(1),k=255),g[k]}var e=new Uint32Array(256),g=new Uint32Array(256),h=0,i=0,j=0,k=0;return{seed:b,prng:c,rand:d}}(),qb=b.console,rb=b.Date.now,sb=b.Math.random,tb=b.performance,ub=b.crypto||b.msCrypto;void 0!==ub&&(nb=ub.getRandomValues);var vb,wb=pb.rand,xb=pb.seed,yb=0,zb=!1,Ab=!1,Bb=0,Cb=256,Db=!1,Eb=!1,Fb={};if(void 0!==tb)vb=function(){return 1e3*tb.now()|0};else{var Gb=1e3*rb()|0;vb=function(){return 1e3*rb()-Gb|0}}a.random=ua,a.random.seed=sa,Object.defineProperty(ua,"allowWeak",{get:function(){return Db},set:function(a){Db=a}}),Object.defineProperty(ua,"skipSystemRNGWarning",{get:function(){return Eb},set:function(a){Eb=a}}),a.getRandomValues=ta,a.getRandomValues.seed=sa,Object.defineProperty(ta,"allowWeak",{get:function(){return Db},set:function(a){Db=a}}),Object.defineProperty(ta,"skipSystemRNGWarning",{get:function(){return Eb},set:function(a){Eb=a}}),b.Math.random=ua,void 0===b.crypto&&(b.crypto={}),b.crypto.getRandomValues=ta;var Hb,Ib={Uint32Array:Uint32Array,Math:b.Math},Jb=new Uint32Array(1048576);void 0===Ib.Math.imul?(Ib.Math.imul=xa,Hb=va(Ib,null,Jb.buffer),delete Ib.Math.imul):Hb=va(Ib,null,Jb.buffer);var Kb=new Uint32Array(0),Lb=ya.prototype=new Number;Lb.toString=za,Lb.toBytes=Aa,Lb.valueOf=Ba,Lb.clamp=Ca,Lb.slice=Da,Lb.negate=Ea,Lb.compare=Fa,Lb.add=Ga,Lb.subtract=Ha,Lb.multiply=Ia,Lb.square=Ja,Lb.divide=Ka;var Mb=new ya(0),Nb=new ya(1);Object.freeze(Mb),Object.freeze(Nb);var Ob=Na.prototype=new ya;Ob.reduce=Oa,Ob.inverse=Pa,Ob.power=Qa;var Pb=[2,3];return Lb.isProbablePrime=Ta,ya.randomProbablePrime=Va,ya.ZERO=Mb,ya.ONE=Nb,ya.extGCD=Ma,a.BigNumber=ya,a.Modulus=Na,"function"==typeof define&&define.amd?define([],function(){return a}):"object"==typeof module&&module.exports?module.exports=a:b.asmCrypto=a,a}({},this); From b93a33eba47533fdd52a846e2a23e508ad17e724 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 3 Aug 2017 20:13:17 -0700 Subject: [PATCH 2/5] an ios friendly copy --- frontend/src/upload.js | 15 +++------------ frontend/src/utils.js | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/frontend/src/upload.js b/frontend/src/upload.js index 0d0aa48c..0f768244 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -2,6 +2,7 @@ require('./common'); const FileSender = require('./fileSender'); const { + copyToClipboard, notify, gcmCompliant, findMetric, @@ -79,12 +80,7 @@ $(document).ready(function() { sendEvent('sender', 'copied', { cd4: 'success-screen' }); - const aux = document.createElement('input'); - aux.setAttribute('value', $('#link').attr('value')); - document.body.appendChild(aux); - aux.select(); - document.execCommand('copy'); - document.body.removeChild(aux); + copyToClipboard($('#link').attr('value')); //disable button for 3s $copyBtn.attr('disabled', true); $('#link').attr('disabled', true); @@ -392,12 +388,7 @@ $(document).ready(function() { sendEvent('sender', 'copied', { cd4: 'upload-list' }); - const aux = document.createElement('input'); - aux.setAttribute('value', url); - document.body.appendChild(aux); - aux.select(); - document.execCommand('copy'); - document.body.removeChild(aux); + copyToClipboard(url); document.l10n.formatValue('copiedUrl').then(translated => { link.innerHTML = translated; }); diff --git a/frontend/src/utils.js b/frontend/src/utils.js index 91b8da04..2566914f 100644 --- a/frontend/src/utils.js +++ b/frontend/src/utils.js @@ -114,9 +114,31 @@ function sendEvent() { .catch(() => 0); } +function copyToClipboard(str) { + const aux = document.createElement('input'); + aux.setAttribute('value', str); + aux.contentEditable = true; + aux.readOnly = true; + document.body.appendChild(aux); + if (navigator.userAgent.match(/iphone|ipad|ipod/i)) { + const range = document.createRange(); + range.selectNodeContents(aux); + const sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); + aux.setSelectionRange(0, str.length); + } + else { + aux.select(); + } + document.execCommand('copy'); + document.body.removeChild(aux); +} + const ONE_DAY_IN_MS = 86400000; module.exports = { + copyToClipboard, arrayToHex, hexToArray, notify, From 859554ce21b9cdcbb1cab3af272ae2c1c4885706 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Sat, 5 Aug 2017 09:40:57 -0700 Subject: [PATCH 3/5] only _blank links while downloading. fixed safari link after download --- frontend/src/common.js | 39 ++++++++++++++++++++++++++++++++--- frontend/src/download.js | 15 +++++++------- frontend/src/links.js | 19 +++++++++++++++++ frontend/src/upload.js | 6 +----- frontend/src/utils.js | 33 ----------------------------- views/download.handlebars | 2 +- views/layouts/main.handlebars | 16 +++++++------- views/unsupported.handlebars | 4 ++-- 8 files changed, 74 insertions(+), 60 deletions(-) create mode 100644 frontend/src/links.js diff --git a/frontend/src/common.js b/frontend/src/common.js index 5b8c3330..7baa52b0 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -1,5 +1,4 @@ const testPilotGA = require('testpilot-ga'); -const { sendEvent } = require('./utils'); const Raven = require('raven-js'); if (navigator.doNotTrack !== '1' && window.RAVEN_CONFIG) { @@ -12,6 +11,37 @@ const analytics = new testPilotGA({ tid: window.GOOGLE_ANALYTICS_ID }); +function sendEvent() { + return analytics.sendEvent + .apply(analytics, arguments) + .catch(() => 0); +} + +function findMetric(href) { + switch (href) { + case 'https://www.mozilla.org/': + return 'mozilla'; + case 'https://www.mozilla.org/about/legal': + return 'legal'; + case 'https://testpilot.firefox.com/about': + return 'about'; + case 'https://testpilot.firefox.com/privacy': + return 'privacy'; + case 'https://testpilot.firefox.com/terms': + return 'terms'; + case 'https://www.mozilla.org/privacy/websites/#cookies': + return 'cookies'; + case 'https://github.com/mozilla/send': + return 'github'; + case 'https://twitter.com/FxTestPilot': + return 'twitter'; + case 'https://www.mozilla.org/firefox/new/?scene=2': + return 'download-firefox'; + default: + return 'other'; + } +} + const ua = navigator.userAgent.toLowerCase(); if ( ua.indexOf('firefox') > -1 && @@ -26,5 +56,8 @@ if ( }); } -window.analytics = analytics; -window.Raven = Raven; +module.exports = { + Raven, + sendEvent, + findMetric +} diff --git a/frontend/src/download.js b/frontend/src/download.js index 34540811..a93ae36d 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -1,20 +1,17 @@ -require('./common'); +const { Raven, findMetric, sendEvent } = require('./common'); const FileReceiver = require('./fileReceiver'); -const { notify, findMetric, sendEvent, gcmCompliant } = require('./utils'); +const { notify, gcmCompliant } = require('./utils'); const bytes = require('bytes'); const Storage = require('./storage'); const storage = new Storage(localStorage); +const links = require('./links'); const $ = require('jquery'); require('jquery-circle-progress'); -const Raven = window.Raven; - $(document).ready(function() { gcmCompliant() .then(function() { - //link back to homepage - $('.send-new').attr('href', window.location.origin); $('.send-new').click(function() { sendEvent('recipient', 'restarted', { @@ -46,7 +43,8 @@ $(document).ready(function() { function download() { // Disable the download button to avoid accidental double clicks. $('#download-btn').attr('disabled', 'disabled'); - + links.setOpenInNewTab(true); + storage.totalDownloads += 1; const fileReceiver = new FileReceiver(); @@ -181,7 +179,8 @@ $(document).ready(function() { .catch(err => { Raven.captureException(err); return Promise.reject(err); - }); + }) + .then(() => links.setOpenInNewTab(false)); } }) .catch(err => { diff --git a/frontend/src/links.js b/frontend/src/links.js new file mode 100644 index 00000000..5f5a4840 --- /dev/null +++ b/frontend/src/links.js @@ -0,0 +1,19 @@ + +let links = [] + +document.addEventListener('DOMContentLoaded', function () { + links = document.querySelectorAll('a:not([target])') +}) + +function setOpenInNewTab(bool) { + if (bool === false) { + links.forEach(l => l.removeAttribute('target')); + } + else { + links.forEach(l => l.setAttribute('target', '_blank')); + } +} + +module.exports = { + setOpenInNewTab +} diff --git a/frontend/src/upload.js b/frontend/src/upload.js index 9d3171c2..290cfdf6 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -1,12 +1,10 @@ /* global MAXFILESIZE EXPIRE_SECONDS */ -require('./common'); +const { Raven, findMetric, sendEvent } = require('./common'); const FileSender = require('./fileSender'); const { copyToClipboard, notify, gcmCompliant, - findMetric, - sendEvent, ONE_DAY_IN_MS } = require('./utils'); const bytes = require('bytes'); @@ -16,8 +14,6 @@ const storage = new Storage(localStorage); const $ = require('jquery'); require('jquery-circle-progress'); -const Raven = window.Raven; - if (storage.has('referrer')) { window.referrer = storage.referrer; storage.remove('referrer'); diff --git a/frontend/src/utils.js b/frontend/src/utils.js index 599ef80c..b6d0280c 100644 --- a/frontend/src/utils.js +++ b/frontend/src/utils.js @@ -79,41 +79,10 @@ function gcmCompliant() { } } -function findMetric(href) { - switch (href) { - case 'https://www.mozilla.org/': - return 'mozilla'; - case 'https://www.mozilla.org/about/legal': - return 'legal'; - case 'https://testpilot.firefox.com/about': - return 'about'; - case 'https://testpilot.firefox.com/privacy': - return 'privacy'; - case 'https://testpilot.firefox.com/terms': - return 'terms'; - case 'https://www.mozilla.org/privacy/websites/#cookies': - return 'cookies'; - case 'https://github.com/mozilla/send': - return 'github'; - case 'https://twitter.com/FxTestPilot': - return 'twitter'; - case 'https://www.mozilla.org/firefox/new/?scene=2': - return 'download-firefox'; - default: - return 'other'; - } -} - function isFile(id) { return /^[0-9a-fA-F]{10}$/.test(id); } -function sendEvent() { - return window.analytics.sendEvent - .apply(window.analytics, arguments) - .catch(() => 0); -} - function copyToClipboard(str) { const aux = document.createElement('input'); aux.setAttribute('value', str); @@ -143,8 +112,6 @@ module.exports = { hexToArray, notify, gcmCompliant, - findMetric, isFile, - sendEvent, ONE_DAY_IN_MS }; diff --git a/views/download.handlebars b/views/download.handlebars index b0801422..dc7b0085 100644 --- a/views/download.handlebars +++ b/views/download.handlebars @@ -35,5 +35,5 @@
- +
diff --git a/views/layouts/main.handlebars b/views/layouts/main.handlebars index 15a1fdce..1bd8c63d 100644 --- a/views/layouts/main.handlebars +++ b/views/layouts/main.handlebars @@ -36,7 +36,7 @@
{{{body}}} @@ -44,15 +44,15 @@ diff --git a/views/unsupported.handlebars b/views/unsupported.handlebars index 8f745e35..b4b2f8cf 100644 --- a/views/unsupported.handlebars +++ b/views/unsupported.handlebars @@ -8,8 +8,8 @@ {{else}}
Unfortunately this browser does not support the web technology that powers Firefox Send. You’ll need to try another browser. We recommend Firefox!
- - + +
Firefox
Free Download From 594b584500a6ad462fb7310a9984fde57e99665a Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Sat, 5 Aug 2017 09:52:37 -0700 Subject: [PATCH 4/5] formatting / links rel --- frontend/src/common.js | 6 ++---- frontend/src/download.js | 1 - frontend/src/links.js | 24 ++++++++++++++---------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index 7baa52b0..c993ed7a 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -12,9 +12,7 @@ const analytics = new testPilotGA({ }); function sendEvent() { - return analytics.sendEvent - .apply(analytics, arguments) - .catch(() => 0); + return analytics.sendEvent.apply(analytics, arguments).catch(() => 0); } function findMetric(href) { @@ -60,4 +58,4 @@ module.exports = { Raven, sendEvent, findMetric -} +}; diff --git a/frontend/src/download.js b/frontend/src/download.js index a93ae36d..9663c5f9 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -12,7 +12,6 @@ require('jquery-circle-progress'); $(document).ready(function() { gcmCompliant() .then(function() { - $('.send-new').click(function() { sendEvent('recipient', 'restarted', { cd2: 'completed' diff --git a/frontend/src/links.js b/frontend/src/links.js index 5f5a4840..7c207ed9 100644 --- a/frontend/src/links.js +++ b/frontend/src/links.js @@ -1,19 +1,23 @@ +let links = []; -let links = [] - -document.addEventListener('DOMContentLoaded', function () { - links = document.querySelectorAll('a:not([target])') -}) +document.addEventListener('DOMContentLoaded', function() { + links = document.querySelectorAll('a:not([target])'); +}); function setOpenInNewTab(bool) { if (bool === false) { - links.forEach(l => l.removeAttribute('target')); - } - else { - links.forEach(l => l.setAttribute('target', '_blank')); + links.forEach(l => { + l.removeAttribute('target'); + l.removeAttribute('rel'); + }); + } else { + links.forEach(l => { + l.setAttribute('target', '_blank'); + l.setAttribute('rel', 'noopener noreferrer'); + }); } } module.exports = { setOpenInNewTab -} +}; From a03b1b7a9a6b691316fe71d946b57c4806d5afdc Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Sat, 5 Aug 2017 09:57:57 -0700 Subject: [PATCH 5/5] only _blank feedback link --- views/layouts/main.handlebars | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/views/layouts/main.handlebars b/views/layouts/main.handlebars index d87a071a..a87dab0c 100644 --- a/views/layouts/main.handlebars +++ b/views/layouts/main.handlebars @@ -28,7 +28,7 @@ Send

Send

@@ -37,14 +37,14 @@
{{{body}}}