diff --git a/appasar/canary/app_bootstrap/Constants.js b/appasar/canary/app_bootstrap/Constants.js new file mode 100644 index 0000000..880fa94 --- /dev/null +++ b/appasar/canary/app_bootstrap/Constants.js @@ -0,0 +1,28 @@ +'use strict'; + +// bootstrap constants +// after startup, these constants will be merged into core module constants +// since they are used in both locations (see app/Constants.js) + +const { releaseChannel } = require('./buildInfo'); +const { getSettings } = require('./appSettings'); + +const settings = getSettings(); + +function capitalizeFirstLetter(s) { + return s.charAt(0).toUpperCase() + s.slice(1); +} + +const APP_NAME = 'Discord' + (releaseChannel === 'stable' ? '' : capitalizeFirstLetter(releaseChannel)); +const APP_ID_BASE = 'com.squirrel'; +const APP_ID = `${APP_ID_BASE}.${APP_NAME}.${APP_NAME}`; + +const API_ENDPOINT = settings.get('API_ENDPOINT') || 'https://discordapp.com/api'; +const UPDATE_ENDPOINT = settings.get('UPDATE_ENDPOINT') || API_ENDPOINT; + +module.exports = { + APP_NAME, + APP_ID, + API_ENDPOINT, + UPDATE_ENDPOINT +}; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/GPUSettings.js b/appasar/canary/app_bootstrap/GPUSettings.js new file mode 100644 index 0000000..f208526 --- /dev/null +++ b/appasar/canary/app_bootstrap/GPUSettings.js @@ -0,0 +1,17 @@ +"use strict"; + +// this file is here for two reasons: +// 1. web requires ./GPUSettings file from electron app (bad!), and requires are +// relative to process.main (bootstrap's index.js) +// 2. GPUSettings has been refactored into GPUSettings, and because we want to +// be able to update GPUSettings OTA, we will have the core module provide +// us with the GPUSettings +// so tl;dr this is core module's GPUSettings, providing compat for web + +exports.replace = function (GPUSettings) { + // replacing module.exports directly would have no effect, since requires are cached + // so we mutate the existing object + for (const name of Object.keys(GPUSettings)) { + exports[name] = GPUSettings[name]; + } +}; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/appSettings.js b/appasar/canary/app_bootstrap/appSettings.js new file mode 100644 index 0000000..2d880a8 --- /dev/null +++ b/appasar/canary/app_bootstrap/appSettings.js @@ -0,0 +1,29 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.init = init; +exports.getSettings = getSettings; + +var _Settings = require('../common/Settings'); + +var _Settings2 = _interopRequireDefault(_Settings); + +var _paths = require('../common/paths'); + +var paths = _interopRequireWildcard(_paths); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +let settings; + +function init() { + settings = new _Settings2.default(paths.getUserData()); +} + +function getSettings() { + return settings; +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/appUpdater.js b/appasar/canary/app_bootstrap/appUpdater.js new file mode 100644 index 0000000..ca7af7f --- /dev/null +++ b/appasar/canary/app_bootstrap/appUpdater.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.update = update; +exports.focusSplash = focusSplash; + +var _moduleUpdater = require('../common/moduleUpdater'); + +var moduleUpdater = _interopRequireWildcard(_moduleUpdater); + +var _splashScreen = require('./splashScreen'); + +var splashScreen = _interopRequireWildcard(_splashScreen); + +var _appSettings = require('./appSettings'); + +var _Constants = require('./Constants'); + +var _buildInfo = require('./buildInfo'); + +var _buildInfo2 = _interopRequireDefault(_buildInfo); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function update(startMinimized, doneCallback, showCallback) { + const settings = (0, _appSettings.getSettings)(); + moduleUpdater.init(_Constants.UPDATE_ENDPOINT, settings, _buildInfo2.default); + + splashScreen.initSplash(startMinimized); + splashScreen.events.once(splashScreen.APP_SHOULD_LAUNCH, doneCallback); + splashScreen.events.once(splashScreen.APP_SHOULD_SHOW, showCallback); +} + +function focusSplash() { + splashScreen.focusWindow(); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/autoStart/darwin.js b/appasar/canary/app_bootstrap/autoStart/darwin.js new file mode 100644 index 0000000..954818c --- /dev/null +++ b/appasar/canary/app_bootstrap/autoStart/darwin.js @@ -0,0 +1,24 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.install = install; +exports.update = update; +exports.isInstalled = isInstalled; +exports.uninstall = uninstall; +function install(callback) { + return callback(); +} + +function update(callback) { + return callback(); +} + +function isInstalled(callback) { + return callback(false); +} + +function uninstall(callback) { + return callback(); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/autoStart/index.js b/appasar/canary/app_bootstrap/autoStart/index.js new file mode 100644 index 0000000..012f895 --- /dev/null +++ b/appasar/canary/app_bootstrap/autoStart/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./' + process.platform); \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/autoStart/linux.js b/appasar/canary/app_bootstrap/autoStart/linux.js new file mode 100644 index 0000000..4097e7f --- /dev/null +++ b/appasar/canary/app_bootstrap/autoStart/linux.js @@ -0,0 +1,87 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.install = install; +exports.update = update; +exports.isInstalled = isInstalled; +exports.uninstall = uninstall; + +var _fs = require('fs'); + +var _fs2 = _interopRequireDefault(_fs); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _electron = require('electron'); + +var _buildInfo = require('../buildInfo'); + +var _buildInfo2 = _interopRequireDefault(_buildInfo); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// TODO: We should use Constant's APP_NAME, but only once +// we set up backwards compat with this. +const appName = _path2.default.basename(process.execPath, '.exe'); +const exePath = _electron.app.getPath('exe'); +const exeDir = _path2.default.dirname(exePath); +const iconPath = _path2.default.join(exeDir, 'discord.png'); +const autostartDir = _path2.default.join(_electron.app.getPath('appData'), 'autostart'); +const autostartFileName = _path2.default.join(autostartDir, _electron.app.getName() + '-' + _buildInfo2.default.releaseChannel + '.desktop'); +const desktopFile = `[Desktop Entry] +Type=Application +Exec=${exePath} +Hidden=false +NoDisplay=false +Name=${appName} +Icon=${iconPath} +Comment=Text and voice chat for gamers. +X-GNOME-Autostart-enabled=true +`; + +function ensureDir() { + try { + _fs2.default.mkdirSync(autostartDir); + return true; + } catch (e) { + // catch for when it already exists. + } + return false; +} + +function install(callback) { + // TODO: This could fail. We should read its return value + ensureDir(); + try { + return _fs2.default.writeFile(autostartFileName, desktopFile, callback); + } catch (e) { + // I guess we don't autostart then + return callback(); + } +} + +function update(callback) { + // TODO: We might need to implement this later on + return callback(); +} + +function isInstalled(callback) { + try { + _fs2.default.stat(autostartFileName, (err, stats) => { + if (err) { + return callback(false); + } + return callback(stats.isFile()); + }); + } catch (e) { + return callback(false); + } +} + +function uninstall(callback) { + return _fs2.default.unlink(autostartFileName, callback); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/autoStart/win32.js b/appasar/canary/app_bootstrap/autoStart/win32.js new file mode 100644 index 0000000..3350c17 --- /dev/null +++ b/appasar/canary/app_bootstrap/autoStart/win32.js @@ -0,0 +1,67 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.install = install; +exports.update = update; +exports.isInstalled = isInstalled; +exports.uninstall = uninstall; + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _windowsUtils = require('../windowsUtils'); + +var windowsUtils = _interopRequireWildcard(_windowsUtils); + +var _appSettings = require('../appSettings'); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const settings = (0, _appSettings.getSettings)(); + +// TODO: We should use Constant's APP_NAME, but only once +// we set up backwards compat with this. +const appName = _path2.default.basename(process.execPath, '.exe'); + +function install(callback) { + const startMinimized = settings.get('START_MINIMIZED', false); + let { execPath } = process; + if (startMinimized) { + execPath = `${execPath} --start-minimized`; + } + const queue = [['HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName, '/d', execPath]]; + + windowsUtils.addToRegistry(queue, callback); +} + +function update(callback) { + isInstalled(installed => { + if (installed) { + install(callback); + } else { + callback(); + } + }); +} + +function isInstalled(callback) { + const queryValue = ['HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName]; + queryValue.unshift('query'); + windowsUtils.spawnReg(queryValue, (error, stdout) => { + const doesOldKeyExist = stdout.indexOf(appName) >= 0; + callback(doesOldKeyExist); + }); +} + +function uninstall(callback) { + const queryValue = ['HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName, '/f']; + queryValue.unshift('delete'); + windowsUtils.spawnReg(queryValue, (error, stdout) => { + callback(); + }); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/bootstrap.js b/appasar/canary/app_bootstrap/bootstrap.js new file mode 100644 index 0000000..252b489 --- /dev/null +++ b/appasar/canary/app_bootstrap/bootstrap.js @@ -0,0 +1,142 @@ +'use strict'; + +// bootstrap, or what runs before the rest of desktop does +// responsible for handling updates and updating modules before continuing startup + +if (process.platform === 'linux') { + // Some people are reporting audio problems on Linux that are fixed by setting + // an environment variable PULSE_LATENCY_MSEC=30 -- the "real" fix is to see + // what conditions require this and set this then (also to set it directly in + // our webrtc setup code rather than here) but this should fix the bug for now. + if (process.env.PULSE_LATENCY_MSEC === undefined) { + process.env.PULSE_LATENCY_MSEC = 30; + } +} + +const { app, Menu } = require('electron'); + +const buildInfo = require('./buildInfo'); +app.setVersion(buildInfo.version); + +// expose releaseChannel to a global, since it's used by splash screen +global.releaseChannel = buildInfo.releaseChannel; + +const errorHandler = require('./errorHandler'); +errorHandler.init(); + +const paths = require('../common/paths'); +paths.init(buildInfo); + +global.modulePath = paths.getModulePath(); + +const appSettings = require('./appSettings'); +appSettings.init(); + +const Constants = require('./Constants'); +const GPUSettings = require('./GPUSettings'); + +function setupHardwareAcceleration() { + const settings = appSettings.getSettings(); + // TODO: this is a copy of gpuSettings.getEnableHardwareAcceleration + if (!settings.get('enableHardwareAcceleration', true)) { + app.disableHardwareAcceleration(); + } +} + +setupHardwareAcceleration(); + +// [adill] work around chrome 66 disabling autoplay by default +app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required'); + +function hasArgvFlag(flag) { + return (process.argv || []).slice(1).includes(flag); +} + +console.log(`${Constants.APP_NAME} ${app.getVersion()}`); + +let preventStartup = false; +if (process.platform === 'win32') { + // this tells Windows (in particular Windows 10) which icon to associate your app with, important for correctly + // pinning app to task bar. + app.setAppUserModelId(Constants.APP_ID); + + const { handleStartupEvent } = require('./squirrelUpdate'); + // TODO: Isn't using argv[1] fragile? + const squirrelCommand = process.argv[1]; + // TODO: Should `Discord` be a constant in this case? It's a protocol. + // TODO: Is protocol case sensitive? + if (handleStartupEvent('Discord', app, squirrelCommand)) { + preventStartup = true; + } +} + +const singleInstance = require('./singleInstance'); +const appUpdater = require('./appUpdater'); +const moduleUpdater = require('../common/moduleUpdater'); +const splashScreen = require('./splashScreen'); +const autoStart = require('./autoStart'); +const requireNative = require('./requireNative'); +let coreModule; + +function startUpdate() { + console.log('Starting updater.'); + const startMinimized = hasArgvFlag('--start-minimized'); + + appUpdater.update(startMinimized, () => { + try { + coreModule = requireNative('discord_desktop_core'); + coreModule.startup({ + paths, + splashScreen, + moduleUpdater, + autoStart, + buildInfo, + appSettings, + Constants, + GPUSettings + }); + } catch (err) { + return errorHandler.fatal(err); + } + }, () => { + coreModule.setMainWindowVisible(!startMinimized); + }); +} + +function startApp() { + console.log('Starting app.'); + paths.cleanOldVersions(buildInfo); + const startupMenu = require('./startupMenu'); + Menu.setApplicationMenu(startupMenu); + + const multiInstance = hasArgvFlag('--multi-instance'); + + if (multiInstance) { + startUpdate(); + } else { + singleInstance.create(startUpdate, args => { + // TODO: isn't relying on index 0 awfully fragile? + if (args != null && args.length > 0 && args[0] === '--squirrel-uninstall') { + app.quit(); + return; + } + + if (coreModule) { + coreModule.handleSingleInstance(args); + } else { + appUpdater.focusSplash(); + } + }); + } +} + +if (preventStartup) { + console.log('Startup prevented.'); + // TODO: shouldn't we exit out? +} else { + if (app.isReady()) { + startApp(); + } else { + app.once('ready', startApp); + } +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/buildInfo.js b/appasar/canary/app_bootstrap/buildInfo.js new file mode 100644 index 0000000..1e83b40 --- /dev/null +++ b/appasar/canary/app_bootstrap/buildInfo.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const buildInfo = require(_path2.default.join(process.resourcesPath, 'build_info.json')); + +exports.default = buildInfo; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/data/quotes_copy.json b/appasar/canary/app_bootstrap/data/quotes_copy.json new file mode 100644 index 0000000..fc33384 --- /dev/null +++ b/appasar/canary/app_bootstrap/data/quotes_copy.json @@ -0,0 +1,14 @@ +[ + "Upsorbing the Contents", + "Additive Parsing the Load", + "Commence Monosaturated Goodening", + "Kick Off the Multi-Core Widening", + "Bastening the Game Turkey", + "Abstracting the Rummage Disc", + "Undecerealenizing the Process", + "Postrefragmenting the Widget Layer", + "Satisfying the Constraints", + "Abnoramalzing Some of the Matrices", + "Optimizing the People", + "Proclaigerizing the Network" +] diff --git a/appasar/canary/app_bootstrap/errorHandler.js b/appasar/canary/app_bootstrap/errorHandler.js new file mode 100644 index 0000000..cac1672 --- /dev/null +++ b/appasar/canary/app_bootstrap/errorHandler.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.init = init; +exports.fatal = fatal; + +var _electron = require('electron'); + +function isErrorSafeToSuppress(error) { + return (/attempting to call a function in a renderer window/i.test(error.message) + ); +} + +function init() { + process.on('uncaughtException', error => { + const stack = error.stack ? error.stack : String(error); + const message = `Uncaught exception:\n ${stack}`; + console.warn(message); + + if (!isErrorSafeToSuppress(error)) { + _electron.dialog.showErrorBox('A JavaScript error occurred in the main process', message); + } + }); +} + +// show a similar error message to the error handler, except exit out the app +// after the error message has been closed +function fatal(err) { + const options = { + type: 'error', + message: 'A fatal Javascript error occured', + detail: err && err.stack ? err.stack : String(err) + }; + const callback = _ => _electron.app.quit(); + const electronMajor = parseInt(process.versions.electron.split('.')[0]); + if (electronMajor >= 6) { + _electron.dialog.showMessageBox(null, options).then(callback); + } else { + _electron.dialog.showMessageBox(options, callback); + } +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/hostUpdater.js b/appasar/canary/app_bootstrap/hostUpdater.js new file mode 100644 index 0000000..5dd9f8e --- /dev/null +++ b/appasar/canary/app_bootstrap/hostUpdater.js @@ -0,0 +1,189 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _events = require('events'); + +var _squirrelUpdate = require('./squirrelUpdate'); + +var squirrelUpdate = _interopRequireWildcard(_squirrelUpdate); + +var _electron = require('electron'); + +var _request = require('./request'); + +var _request2 = _interopRequireDefault(_request); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function versionParse(verString) { + return verString.split('.').map(i => parseInt(i)); +} + +function versionNewer(verA, verB) { + let i = 0; + while (true) { + const a = verA[i]; + const b = verB[i]; + i++; + if (a === undefined) { + return false; + } else { + if (b === undefined || a > b) { + return true; + } + if (a < b) { + return false; + } + } + } +} + +class AutoUpdaterWin32 extends _events.EventEmitter { + constructor() { + super(); + + this.updateUrl = null; + this.updateVersion = null; + } + + setFeedURL(updateUrl) { + this.updateUrl = updateUrl; + } + + quitAndInstall() { + if (squirrelUpdate.updateExistsSync()) { + squirrelUpdate.restart(_electron.app, this.updateVersion || _electron.app.getVersion()); + } else { + require('auto-updater').quitAndInstall(); + } + } + + downloadAndInstallUpdate(callback) { + squirrelUpdate.spawnUpdateInstall(this.updateUrl, progress => { + this.emit('update-progress', progress); + }).catch(err => callback(err)).then(() => callback()); + } + + checkForUpdates() { + if (this.updateUrl == null) { + throw new Error('Update URL is not set'); + } + + this.emit('checking-for-update'); + + if (!squirrelUpdate.updateExistsSync()) { + this.emit('update-not-available'); + return; + } + + squirrelUpdate.spawnUpdate(['--check', this.updateUrl], (error, stdout) => { + if (error != null) { + this.emit('error', error); + return; + } + + try { + // Last line of the output is JSON details about the releases + const json = stdout.trim().split('\n').pop(); + const releasesFound = JSON.parse(json).releasesToApply; + if (releasesFound == null || releasesFound.length == 0) { + this.emit('update-not-available'); + return; + } + + const update = releasesFound.pop(); + this.emit('update-available'); + this.downloadAndInstallUpdate(error => { + if (error != null) { + this.emit('error', error); + return; + } + + this.updateVersion = update.version; + + this.emit('update-downloaded', {}, update.release, update.version, new Date(), this.updateUrl, this.quitAndInstall.bind(this)); + }); + } catch (error) { + error.stdout = stdout; + this.emit('error', error); + } + }); + } +} + +// todo +class AutoUpdaterLinux extends _events.EventEmitter { + constructor() { + super(); + this.updateUrl = null; + } + + setFeedURL(url) { + this.updateUrl = url; + } + + checkForUpdates() { + const currVersion = versionParse(_electron.app.getVersion()); + this.emit('checking-for-update'); + + _request2.default.get({ url: this.updateUrl, encoding: null }, (error, response, body) => { + if (error) { + console.error('[Updates] Error fetching ' + this.updateUrl + ': ' + error); + this.emit('error', error); + return; + } + + if (response.statusCode === 204) { + // you are up to date + this.emit('update-not-available'); + } else if (response.statusCode === 200) { + let latestVerStr = ''; + let latestVersion = []; + try { + const latestMetadata = JSON.parse(body); + latestVerStr = latestMetadata.name; + latestVersion = versionParse(latestVerStr); + } catch (e) {} + + if (versionNewer(latestVersion, currVersion)) { + console.log('[Updates] You are out of date!'); + // you need to update + this.emit('update-manually', latestVerStr); + } else { + console.log('[Updates] You are living in the future!'); + this.emit('update-not-available'); + } + } else { + // something is wrong + console.error(`[Updates] Error: fetch returned: ${response.statusCode}`); + this.emit('update-not-available'); + } + }); + } +} + +let autoUpdater; + +// TODO +// events: checking-for-update, update-available, update-not-available, update-manually, update-downloaded, error +// also, checkForUpdates, setFeedURL, quitAndInstall +// also, see electron.autoUpdater, and its API +switch (process.platform) { + case 'darwin': + autoUpdater = require('electron').autoUpdater; + break; + case 'win32': + autoUpdater = new AutoUpdaterWin32(); + break; + case 'linux': + autoUpdater = new AutoUpdaterLinux(); + break; +} + +exports.default = autoUpdater; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/images/img_lucky_dice.png b/appasar/canary/app_bootstrap/images/img_lucky_dice.png new file mode 100644 index 0000000..909b729 Binary files /dev/null and b/appasar/canary/app_bootstrap/images/img_lucky_dice.png differ diff --git a/appasar/canary/app_bootstrap/index.js b/appasar/canary/app_bootstrap/index.js new file mode 100644 index 0000000..8f37857 --- /dev/null +++ b/appasar/canary/app_bootstrap/index.js @@ -0,0 +1,23 @@ +'use strict'; + +const buildInfo = require('./buildInfo'); +const paths = require('../common/paths'); +paths.init(buildInfo); +const moduleUpdater = require('../common/moduleUpdater'); +moduleUpdater.initPathsOnly(buildInfo); +const requireNative = require('./requireNative'); + +function getAppMode() { + if (process.argv && process.argv.includes('--overlay-host')) { + return 'overlay-host'; + } + + return 'app'; +} + +const mode = getAppMode(); +if (mode === 'app') { + require('./bootstrap'); +} else if (mode === 'overlay-host') { + requireNative('discord_overlay2/standalone_host.js'); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/installDevTools.js b/appasar/canary/app_bootstrap/installDevTools.js new file mode 100644 index 0000000..ca17e45 --- /dev/null +++ b/appasar/canary/app_bootstrap/installDevTools.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +// used in devtools to hook in additional dev tools +// require('electron').remote.require('./installDevTools')() + +function installDevTools() { + console.log(`Installing Devtron`); + const devtron = require('devtron'); + devtron.uninstall(); + devtron.install(); + console.log(`Installed Devtron`); +} + +exports.default = installDevTools; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/ipcMain.js b/appasar/canary/app_bootstrap/ipcMain.js new file mode 100644 index 0000000..8b9cc21 --- /dev/null +++ b/appasar/canary/app_bootstrap/ipcMain.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _electron = require('electron'); + +exports.default = { + on: (event, callback) => _electron.ipcMain.on(`DISCORD_${event}`, callback), + removeListener: (event, callback) => _electron.ipcMain.removeListener(`DISCORD_${event}`, callback) +}; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/request.js b/appasar/canary/app_bootstrap/request.js new file mode 100644 index 0000000..58e1730 --- /dev/null +++ b/appasar/canary/app_bootstrap/request.js @@ -0,0 +1,116 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _electron = require('electron'); + +var _querystring = require('querystring'); + +var _querystring2 = _interopRequireDefault(_querystring); + +var _request = require('request'); + +var _request2 = _interopRequireDefault(_request); + +var _events = require('events'); + +var _events2 = _interopRequireDefault(_events); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _log(_msg) { + // console.log('[Request] ' + _msg); +} + +function requestWithMethod(method, origOpts, origCallback) { + if (typeof origOpts == 'string') { + origOpts = { url: origOpts }; + } + + const opts = _extends({}, origOpts, { method }); + + let callback; + if (origCallback || opts.callback) { + const origOptsCallback = opts.callback; + delete opts.callback; + callback = (...args) => { + if (origCallback) { + origCallback.apply(this, args); + } + if (origOptsCallback) { + origOptsCallback.apply(this, args); + } + }; + } + + const strictOpts = _extends({}, opts, { strictSSL: true }); + const laxOpts = _extends({}, opts, { strictSSL: false }); + + const rv = new _events2.default(); + + if (callback) { + _log('have callback, so wrapping'); + rv.on('response', response => { + const chunks = []; + response.on('data', chunk => chunks.push(chunk)); + response.on('end', () => { + callback(null, response, Buffer.concat(chunks)); + }); + }); + rv.on('error', error => callback(error)); + } + + const requestTypes = [{ + factory: function () { + return (0, _request2.default)(strictOpts); + }, + method: 'node_request_strict' + }, { + factory: function () { + const qs = _querystring2.default.stringify(strictOpts.qs); + const nr = _electron.net.request(_extends({}, strictOpts, { url: `${strictOpts.url}?${qs}` })); + nr.end(); + return nr; + }, + method: 'electron_net_request_strict' + }, { + factory: function () { + return (0, _request2.default)(laxOpts); + }, + method: 'node_request_lax' + }]; + + function attempt(index) { + const { factory, method } = requestTypes[index]; + _log(`Attempt #${index + 1}: ${method}`); + factory().on('response', response => { + _log(`${method} success! emitting response ${response}`); + rv.emit('response', response); + }).on('error', error => { + if (index + 1 < requestTypes.length) { + _log(`${method} failure, trying next option`); + attempt(index + 1); + } else { + _log(`${method} failure, out of options`); + rv.emit('error', error); + } + }); + } + + attempt(0); + + return rv; +} + +// only supports get for now, since retrying is non-idempotent and +// we'd want to grovel the errors to make sure it's safe to retry +for (const method of ['get']) { + requestWithMethod[method] = requestWithMethod.bind(null, method); +} + +exports.default = requestWithMethod; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/requireNative.js b/appasar/canary/app_bootstrap/requireNative.js new file mode 100644 index 0000000..c18c0c0 --- /dev/null +++ b/appasar/canary/app_bootstrap/requireNative.js @@ -0,0 +1,5 @@ +"use strict"; + +// require(), with paths specialized for requiring only native modules. +module.paths = []; +module.exports = require; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/singleInstance.js b/appasar/canary/app_bootstrap/singleInstance.js new file mode 100644 index 0000000..a7d305c --- /dev/null +++ b/appasar/canary/app_bootstrap/singleInstance.js @@ -0,0 +1,130 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.create = create; +exports.pipeCommandLineArgs = pipeCommandLineArgs; + +var _electron = require('electron'); + +var _net = require('net'); + +var _net2 = _interopRequireDefault(_net); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _fs = require('fs'); + +var _fs2 = _interopRequireDefault(_fs); + +var _os = require('os'); + +var _os2 = _interopRequireDefault(_os); + +var _buildInfo = require('./buildInfo'); + +var _buildInfo2 = _interopRequireDefault(_buildInfo); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function deleteSocketFile(socketPath) { + if (process.platform === 'win32') { + return; + } + + if (_fs2.default.existsSync(socketPath)) { + try { + _fs2.default.unlinkSync(socketPath); + } catch (error) { + // Ignore ENOENT errors in case the file was deleted between the exists + // check and the call to unlink sync. This occurred occasionally on CI + // which is why this check is here. + if (error.code !== 'ENOENT') { + throw error; + } + } + } +} + +/** + * Creates server to listen for additional atom application launches. + * + * You can run the command multiple times, but after the first launch + * the other launches will just pass their information to this server and then + * close immediately. + */ +function listenForArgumentsFromNewProcess(socketPath, callback) { + deleteSocketFile(socketPath); + + const server = _net2.default.createServer(connection => { + connection.on('data', data => { + const args = JSON.parse(data); + callback(args); + }); + }); + server.listen(socketPath); + server.on('error', error => console.error('Application server failed', error)); + return server; +} + +function tryStart(socketPath, callback, otherAppFound) { + // FIXME: Sometimes when socketPath doesn't exist, net.connect would strangely + // take a few seconds to trigger 'error' event, it could be a bug of node + // or atom-shell, before it's fixed we check the existence of socketPath to + // speedup startup. + if (process.platform !== 'win32' && !_fs2.default.existsSync(socketPath)) { + callback(); + return; + } + + const client = _net2.default.connect({ path: socketPath }, () => { + client.write(JSON.stringify(process.argv.slice(1)), () => { + client.end(); + otherAppFound(); + }); + }); + client.on('error', callback); +} + +function makeSocketPath() { + let name = _electron.app.getName(); + if (_buildInfo2.default.releaseChannel !== 'stable') { + name = _electron.app.getName() + _buildInfo2.default.releaseChannel; + } + + if (process.platform === 'win32') { + return '\\\\.\\pipe\\' + name + '-sock'; + } else { + return _path2.default.join(_os2.default.tmpdir(), name + '.sock'); + } +} + +function create(startCallback, newProcessCallback) { + const socketPath = makeSocketPath(); + + tryStart(socketPath, () => { + const server = listenForArgumentsFromNewProcess(socketPath, newProcessCallback); + + _electron.app.on('will-quit', () => { + server.close(); + deleteSocketFile(socketPath); + }); + + _electron.app.on('will-exit', () => { + server.close(); + deleteSocketFile(socketPath); + }); + + startCallback(); + }, () => { + console.log('Another instance exists. Quitting.'); + _electron.app.exit(0); + }); +} + +function pipeCommandLineArgs(noOtherAppFoundCallback, otherAppFound) { + tryStart(makeSocketPath(), noOtherAppFoundCallback, otherAppFound); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/splash/a934ab008c7f6a2274ec441f6be0696a.woff b/appasar/canary/app_bootstrap/splash/a934ab008c7f6a2274ec441f6be0696a.woff new file mode 100644 index 0000000..98aa239 Binary files /dev/null and b/appasar/canary/app_bootstrap/splash/a934ab008c7f6a2274ec441f6be0696a.woff differ diff --git a/appasar/canary/app_bootstrap/splash/abddffb32a4a35627c3857a06c751424.png b/appasar/canary/app_bootstrap/splash/abddffb32a4a35627c3857a06c751424.png new file mode 100644 index 0000000..909b729 Binary files /dev/null and b/appasar/canary/app_bootstrap/splash/abddffb32a4a35627c3857a06c751424.png differ diff --git a/appasar/canary/app_bootstrap/splash/d153359b5d87601d2b9c708b7ae2db02.woff b/appasar/canary/app_bootstrap/splash/d153359b5d87601d2b9c708b7ae2db02.woff new file mode 100644 index 0000000..2a2f65a Binary files /dev/null and b/appasar/canary/app_bootstrap/splash/d153359b5d87601d2b9c708b7ae2db02.woff differ diff --git a/appasar/canary/app_bootstrap/splash/index.html b/appasar/canary/app_bootstrap/splash/index.html new file mode 100644 index 0000000..5dec1de --- /dev/null +++ b/appasar/canary/app_bootstrap/splash/index.html @@ -0,0 +1,11 @@ + + + + + Discord Updater + + +
+ + + diff --git a/appasar/canary/app_bootstrap/splash/index.js b/appasar/canary/app_bootstrap/splash/index.js new file mode 100644 index 0000000..6458c7c --- /dev/null +++ b/appasar/canary/app_bootstrap/splash/index.js @@ -0,0 +1,47 @@ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t,n){e.exports=n(27)()},function(e,t,n){"use strict";e.exports=n(18)},function(e,t,n){var r; +/*! + Copyright (c) 2016 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/*! + Copyright (c) 2016 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(this.props,[]);return function(e){c.forEach(function(t){return delete e[t]})}(o),o.className=this.props.inputClassName,o.id=this.state.inputId,o.style=n,a.default.createElement("div",{className:this.props.className,style:t},this.renderStyles(),a.default.createElement("input",r({},o,{ref:this.inputRef})),a.default.createElement("div",{ref:this.sizerRef,style:s},e),this.props.placeholder?a.default.createElement("div",{ref:this.placeHolderSizerRef,style:s},this.props.placeholder):null)}}]),t}();h.propTypes={className:l.default.string,defaultValue:l.default.any,id:l.default.string,injectStyles:l.default.bool,inputClassName:l.default.string,inputRef:l.default.func,inputStyle:l.default.object,minWidth:l.default.oneOfType([l.default.number,l.default.string]),onAutosize:l.default.func,onChange:l.default.func,placeholder:l.default.string,placeholderIsMinWidth:l.default.bool,style:l.default.object,value:l.default.any},h.defaultProps={minWidth:1,injectStyles:!0},t.default=h},function(e,t,n){"use strict";n(10);var r=a(n(1)),o=a(n(3)),i=a(n(22));function a(e){return e&&e.__esModule?e:{default:e}}o.default.render(r.default.createElement(i.default,null),document.getElementById("splash-mount"))},function(e,t,n){var r=n(11);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0};n(16)(r,o);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=e.exports=n(6)(void 0)).i(n(12),""),t.push([e.i,"@font-face {\n font-family: Whitney;\n font-style: normal;\n font-weight: 400;\n src: url("+n(13)+") format('woff');\n}\n@font-face {\n font-family: Whitney;\n font-style: medium;\n font-weight: 600;\n src: url("+n(14)+') format(\'woff\');\n}\n* {\n box-sizing: border-box;\n -webkit-user-select: none;\n cursor: default;\n}\nbody,\nhtml {\n -webkit-app-region: drag;\n padding: 0;\n margin: 0;\n overflow: hidden;\n width: 300px;\n height: 300px;\n}\n#splash {\n -webkit-app-region: drag;\n background: #282b30;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 3000;\n transform: translateZ(0);\n padding-bottom: 40px;\n}\n#splash .splash-inner {\n text-align: center;\n}\n#splash .splash-inner img,\n#splash .splash-inner video {\n size: 200px;\n}\n#splash .splash-inner video {\n visibility: hidden;\n}\n#splash .splash-inner video.loaded {\n visibility: visible;\n}\n#splash .splash-inner > span {\n color: #8a8e94;\n font-size: 12px;\n font-family: Whitney, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;\n font-weight: 600;\n text-transform: uppercase;\n display: block;\n}\n#splash .splash-inner > span.quote {\n margin-bottom: 10px;\n color: #fff;\n font-weight: 400;\n font-style: italic;\n font-size: 16px;\n}\n#splash .splash-inner-dl .dice-image {\n position: absolute;\n left: 77px;\n top: 45px;\n width: 146px;\n height: 100px;\n background: url('+n(15)+') center center no-repeat;\n background-size: 146px 100px;\n}\n#splash .splash-inner-dl .dl-update-message {\n font-family: Whitney, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;\n font-style: medium;\n font-size: 18px;\n color: #fff;\n padding-left: 20px;\n padding-right: 20px;\n top: 169px;\n left: 0;\n margin: 0;\n position: absolute;\n text-align: center;\n}\n#splash .splash-inner-dl .dl-version-message {\n font-family: Whitney, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;\n font-style: medium;\n font-size: 12px;\n color: #8a8e94;\n text-transform: uppercase;\n position: absolute;\n width: 100%;\n bottom: 12px;\n left: 0;\n margin: 0;\n text-align: center;\n}\n#splash .splash-inner-dl .dl-select-frame {\n -webkit-app-region: no-drag;\n font-family: Whitney, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;\n overflow: hidden;\n position: absolute;\n width: 100%;\n height: 130px;\n top: 220px;\n left: 0;\n margin: 0;\n}\n#splash .splash-inner-dl .dl-select-frame .Select {\n position: absolute;\n left: 0;\n top: 0;\n width: 165px;\n height: 44px;\n margin-left: 20px;\n margin-right: 10px;\n color: #fff;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-control {\n border: 1px solid;\n border-color: rgba(255,255,255,0.3);\n border-radius: 3px;\n background: #282b30;\n height: 44px;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-menu-outer {\n background: #282b30;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-menu {\n max-height: 80px;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-option {\n color: #8a8e94;\n line-height: 15px;\n padding: 5px 10px;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-option.is-focused {\n color: #fff;\n background-color: #697ec4;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-value {\n color: #fff;\n bottom: 0;\n align-items: center;\n display: flex;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-input {\n outline: none;\n}\n#splash .splash-inner-dl .dl-select-frame .dl-button {\n position: absolute;\n left: 195px;\n top: 0;\n width: 85px;\n height: 44px;\n background-color: #7289da;\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n border-radius: 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n#splash .splash-inner-dl .dl-select-frame .dl-button:hover {\n background-color: #697ec4;\n}\n.progress {\n display: flex;\n justify-content: center;\n margin-top: 10px;\n}\n.progress .progress-bar {\n height: 8px;\n border-radius: 4px;\n width: 180px;\n background-color: rgba(255,255,255,0.1);\n}\n.progress .progress-bar .complete {\n border-radius: 4px;\n box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1), inset 0px 1px 0px 0px rgba(255,255,255,0.1);\n height: 100%;\n background-color: #737f8d;\n}\n.progress-placeholder {\n margin-top: 10px;\n height: 8px;\n}\n',""])},function(e,t,n){(e.exports=n(6)(void 0)).push([e.i,"/**\n * React Select\n * ============\n * Created by Jed Watson and Joss Mackison for KeystoneJS, http://www.keystonejs.com/\n * https://twitter.com/jedwatson https://twitter.com/jossmackison https://twitter.com/keystonejs\n * MIT License: https://github.com/keystonejs/react-select\n*/\n.Select {\n position: relative;\n}\n.Select,\n.Select div,\n.Select input,\n.Select span {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n.Select.is-disabled > .Select-control {\n background-color: #f6f6f6;\n}\n.Select.is-disabled .Select-arrow-zone {\n cursor: default;\n pointer-events: none;\n}\n.Select-control {\n background-color: #fff;\n border-color: #d9d9d9 #ccc #b3b3b3;\n border-radius: 4px;\n border: 1px solid #ccc;\n color: #333;\n cursor: default;\n display: table;\n height: 36px;\n outline: none;\n overflow: hidden;\n position: relative;\n width: 100%;\n}\n.Select-control:hover {\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);\n}\n.is-searchable.is-open > .Select-control {\n cursor: text;\n}\n.is-open > .Select-control {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n background: #fff;\n border-color: #b3b3b3 #ccc #d9d9d9;\n}\n.is-open > .Select-control > .Select-arrow {\n border-color: transparent transparent #999;\n border-width: 0 5px 5px;\n}\n.is-searchable.is-focused:not(.is-open) > .Select-control {\n cursor: text;\n}\n.is-focused:not(.is-open) > .Select-control {\n border-color: #08c #0099e6 #0099e6;\n box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 5px -1px rgba(0, 136, 204, 0.5);\n}\n.Select-placeholder {\n bottom: 0;\n color: #aaa;\n left: 0;\n line-height: 34px;\n padding-left: 10px;\n padding-right: 10px;\n position: absolute;\n right: 0;\n top: 0;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.has-value > .Select-control > .Select-placeholder {\n color: #333;\n}\n.Select-value {\n color: #aaa;\n left: 0;\n padding: 8px 52px 8px 10px;\n position: absolute;\n right: -15px;\n top: 0;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.has-value > .Select-control > .Select-value {\n color: #333;\n}\n.Select-input {\n height: 34px;\n padding-left: 10px;\n padding-right: 10px;\n vertical-align: middle;\n}\n.Select-input > input {\n background: none transparent;\n border: 0 none;\n box-shadow: none;\n cursor: default;\n display: inline-block;\n font-family: inherit;\n font-size: inherit;\n height: 34px;\n margin: 0;\n outline: none;\n padding: 0;\n -webkit-appearance: none;\n}\n.is-focused .Select-input > input {\n cursor: text;\n}\n.Select-control:not(.is-searchable) > .Select-input {\n outline: none;\n}\n.Select-loading-zone {\n cursor: pointer;\n display: table-cell;\n position: relative;\n text-align: center;\n vertical-align: middle;\n width: 16px;\n}\n.Select-loading {\n -webkit-animation: Select-animation-spin 400ms infinite linear;\n -o-animation: Select-animation-spin 400ms infinite linear;\n animation: Select-animation-spin 400ms infinite linear;\n width: 16px;\n height: 16px;\n box-sizing: border-box;\n border-radius: 50%;\n border: 2px solid #ccc;\n border-right-color: #333;\n display: inline-block;\n position: relative;\n vertical-align: middle;\n}\n.Select-clear-zone {\n -webkit-animation: Select-animation-fadeIn 200ms;\n -o-animation: Select-animation-fadeIn 200ms;\n animation: Select-animation-fadeIn 200ms;\n color: #999;\n cursor: pointer;\n display: table-cell;\n position: relative;\n text-align: center;\n vertical-align: middle;\n width: 17px;\n}\n.Select-clear-zone:hover {\n color: #d0021b;\n}\n.Select-clear {\n display: inline-block;\n font-size: 18px;\n line-height: 1;\n}\n.Select--multi .Select-clear-zone {\n width: 17px;\n}\n.Select-arrow-zone {\n cursor: pointer;\n display: table-cell;\n position: relative;\n text-align: center;\n vertical-align: middle;\n width: 25px;\n padding-right: 5px;\n}\n.Select-arrow {\n border-color: #999 transparent transparent;\n border-style: solid;\n border-width: 5px 5px 2.5px;\n display: inline-block;\n height: 0;\n width: 0;\n}\n.is-open .Select-arrow,\n.Select-arrow-zone:hover > .Select-arrow {\n border-top-color: #666;\n}\n@-webkit-keyframes Select-animation-fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes Select-animation-fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n.Select-menu-outer {\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px;\n background-color: #fff;\n border: 1px solid #ccc;\n border-top-color: #e6e6e6;\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);\n box-sizing: border-box;\n margin-top: -1px;\n max-height: 200px;\n position: absolute;\n top: 100%;\n width: 100%;\n z-index: 1000;\n -webkit-overflow-scrolling: touch;\n}\n.Select-menu {\n max-height: 198px;\n overflow-y: auto;\n}\n.Select-option {\n box-sizing: border-box;\n color: #666666;\n cursor: pointer;\n display: block;\n padding: 8px 10px;\n}\n.Select-option:last-child {\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.Select-option.is-focused {\n background-color: #f2f9fc;\n color: #333;\n}\n.Select-option.is-disabled {\n color: #cccccc;\n cursor: not-allowed;\n}\n.Select-noresults,\n.Select-search-prompt,\n.Select-searching {\n box-sizing: border-box;\n color: #999999;\n cursor: default;\n display: block;\n padding: 8px 10px;\n}\n.Select--multi .Select-input {\n vertical-align: middle;\n margin-left: 10px;\n padding: 0;\n}\n.Select--multi.has-value .Select-input {\n margin-left: 5px;\n}\n.Select-item {\n background-color: #f2f9fc;\n border-radius: 2px;\n border: 1px solid #c9e6f2;\n color: #08c;\n display: inline-block;\n font-size: 0.9em;\n margin-left: 5px;\n margin-top: 5px;\n vertical-align: top;\n}\n.Select-item-icon,\n.Select-item-label {\n display: inline-block;\n vertical-align: middle;\n}\n.Select-item-label {\n border-bottom-right-radius: 2px;\n border-top-right-radius: 2px;\n cursor: default;\n padding: 2px 5px;\n}\n.Select-item-label .Select-item-label__a {\n color: #08c;\n cursor: pointer;\n}\n.Select-item-icon {\n cursor: pointer;\n border-bottom-left-radius: 2px;\n border-top-left-radius: 2px;\n border-right: 1px solid #c9e6f2;\n padding: 1px 5px 3px;\n}\n.Select-item-icon:hover,\n.Select-item-icon:focus {\n background-color: #ddeff7;\n color: #0077b3;\n}\n.Select-item-icon:active {\n background-color: #c9e6f2;\n}\n.Select--multi.is-disabled .Select-item {\n background-color: #f2f2f2;\n border: 1px solid #d9d9d9;\n color: #888;\n}\n.Select--multi.is-disabled .Select-item-icon {\n cursor: not-allowed;\n border-right: 1px solid #d9d9d9;\n}\n.Select--multi.is-disabled .Select-item-icon:hover,\n.Select--multi.is-disabled .Select-item-icon:focus,\n.Select--multi.is-disabled .Select-item-icon:active {\n background-color: #f2f2f2;\n}\n@keyframes Select-animation-spin {\n to {\n transform: rotate(1turn);\n }\n}\n@-webkit-keyframes Select-animation-spin {\n to {\n -webkit-transform: rotate(1turn);\n }\n}\n",""])},function(e,t,n){e.exports=n.p+"d153359b5d87601d2b9c708b7ae2db02.woff"},function(e,t,n){e.exports=n.p+"a934ab008c7f6a2274ec441f6be0696a.woff"},function(e,t,n){e.exports=n.p+"abddffb32a4a35627c3857a06c751424.png"},function(e,t,n){var r,o,i={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=r.apply(this,arguments)),o}),l=function(e){var t={};return function(e){if(void 0===t[e]){var n=function(e){return document.querySelector(e)}.call(this,e);if(n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,s=0,c=[],p=n(17);function f(e,t){for(var n=0;n=0&&c.splice(t,1)}function v(e){var t=document.createElement("style");return e.attrs.type="text/css",y(t,e.attrs),h(e,t),t}function y(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}function g(e,t){var n,r,o,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i}if(t.singleton){var a=s++;n=u||(u=v(t)),r=x.bind(null,n,a,!1),o=x.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",y(t,e.attrs),h(e,t),t}(t),r=function(e,t,n){var r=n.css,o=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||i)&&(r=p(r));o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),l=e.href;e.href=URL.createObjectURL(a),l&&URL.revokeObjectURL(l)}.bind(null,n,t),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){m(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=d(e,t);return f(n,t),function(e){for(var r=[],o=0;oA.length&&A.push(e)}function I(e,t,n){return null==e?0:function e(t,n,r,o){var l=typeof t;"undefined"!==l&&"boolean"!==l||(t=null);var u=!1;if(null===t)u=!0;else switch(l){case"string":case"number":u=!0;break;case"object":switch(t.$$typeof){case i:case a:u=!0}}if(u)return r(o,t,""===n?"."+M(t,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(t))for(var s=0;sthis.eventPool.length&&this.eventPool.push(e)}function pe(e){e.eventPool=[],e.getPooled=se,e.release=ce}o(ue.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=ae)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=ae)},persist:function(){this.isPersistent=ae},isPersistent:le,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=le,this._dispatchInstances=this._dispatchListeners=null}}),ue.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},ue.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return o(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=o({},r.Interface,e),n.extend=r.extend,pe(n),n},pe(ue);var fe=ue.extend({data:null}),de=ue.extend({data:null}),he=[9,13,27,32],me=H&&"CompositionEvent"in window,ve=null;H&&"documentMode"in document&&(ve=document.documentMode);var ye=H&&"TextEvent"in window&&!ve,ge=H&&(!me||ve&&8=ve),be=String.fromCharCode(32),Ee={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},xe=!1;function we(e,t){switch(e){case"keyup":return-1!==he.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function ke(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ce=!1;var Se={eventTypes:Ee,extractEvents:function(e,t,n,r){var o=void 0,i=void 0;if(me)e:{switch(e){case"compositionstart":o=Ee.compositionStart;break e;case"compositionend":o=Ee.compositionEnd;break e;case"compositionupdate":o=Ee.compositionUpdate;break e}o=void 0}else Ce?we(e,n)&&(o=Ee.compositionEnd):"keydown"===e&&229===n.keyCode&&(o=Ee.compositionStart);return o?(ge&&"ko"!==n.locale&&(Ce||o!==Ee.compositionStart?o===Ee.compositionEnd&&Ce&&(i=ie()):(re="value"in(ne=r)?ne.value:ne.textContent,Ce=!0)),o=fe.getPooled(o,t,n,r),i?o.data=i:null!==(i=ke(n))&&(o.data=i),K(o),i=o):i=null,(e=ye?function(e,t){switch(e){case"compositionend":return ke(t);case"keypress":return 32!==t.which?null:(xe=!0,be);case"textInput":return(e=t.data)===be&&xe?null:e;default:return null}}(e,n):function(e,t){if(Ce)return"compositionend"===e||!me&&we(e,t)?(e=ie(),oe=re=ne=null,Ce=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1