', {}, {\n CurrentPageURL: getRedactedUrl()\n })\n }, { expl: (0, _languageHandler._td)('Your User Agent'), value: navigator.userAgent }, { expl: (0, _languageHandler._td)('Your device resolution'), value: resolution }];\n\n var ErrorDialog = _index2.default.getComponent('dialogs.ErrorDialog');\n _Modal2.default.createTrackedDialog('Analytics Details', '', ErrorDialog, {\n title: (0, _languageHandler._t)('Analytics'),\n description: React.createElement(\n 'div',\n { className: 'mx_AnalyticsModal' },\n React.createElement(\n 'div',\n null,\n (0, _languageHandler._t)('The information being sent to us to help make Riot.im better includes:')\n ),\n React.createElement(\n 'table',\n null,\n rows.map(function (row) {\n return React.createElement(\n 'tr',\n { key: row[0] },\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)(customVariables[row[0]].expl)\n ),\n row[1] !== undefined && React.createElement(\n 'td',\n null,\n React.createElement(\n 'code',\n null,\n row[1]\n )\n )\n );\n }),\n otherVariables.map(function (item, index) {\n return React.createElement(\n 'tr',\n { key: index },\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)(item.expl)\n ),\n React.createElement(\n 'td',\n null,\n React.createElement(\n 'code',\n null,\n item.value\n )\n )\n );\n })\n ),\n React.createElement(\n 'div',\n null,\n (0, _languageHandler._t)('Where this page includes identifiable information, such as a room, ' + 'user or group ID, that data is removed before being sent to the server.')\n )\n )\n });\n }\n }]);\n return Analytics;\n}();\n\nif (!global.mxAnalytics) {\n global.mxAnalytics = new Analytics();\n}\nmodule.exports = global.mxAnalytics;\n//# sourceMappingURL=Analytics.js.map","var core = module.exports = { version: '2.5.7' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","'use strict';\nvar fails = require('./_fails');\n\nmodule.exports = function (method, arg) {\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call\n arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n });\n};\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nfunction makeEmptyFunction(arg) {\n return function () {\n return arg;\n };\n}\n\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\nvar emptyFunction = function emptyFunction() {};\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\nemptyFunction.thatReturnsThis = function () {\n return this;\n};\nemptyFunction.thatReturnsArgument = function (arg) {\n return arg;\n};\n\nmodule.exports = emptyFunction;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar _prodInvariant = require('./reactProdInvariant'),\n _assign = require('object-assign');\n\nvar CallbackQueue = require('./CallbackQueue');\nvar PooledClass = require('./PooledClass');\nvar ReactFeatureFlags = require('./ReactFeatureFlags');\nvar ReactReconciler = require('./ReactReconciler');\nvar Transaction = require('./Transaction');\n\nvar invariant = require('fbjs/lib/invariant');\n\nvar dirtyComponents = [];\nvar updateBatchNumber = 0;\nvar asapCallbackQueue = CallbackQueue.getPooled();\nvar asapEnqueued = false;\n\nvar batchingStrategy = null;\n\nfunction ensureInjected() {\n !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;\n}\n\nvar NESTED_UPDATES = {\n initialize: function () {\n this.dirtyComponentsLength = dirtyComponents.length;\n },\n close: function () {\n if (this.dirtyComponentsLength !== dirtyComponents.length) {\n // Additional updates were enqueued by componentDidUpdate handlers or\n // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run\n // these new updates so that if A's componentDidUpdate calls setState on\n // B, B will update before the callback A's updater provided when calling\n // setState.\n dirtyComponents.splice(0, this.dirtyComponentsLength);\n flushBatchedUpdates();\n } else {\n dirtyComponents.length = 0;\n }\n }\n};\n\nvar UPDATE_QUEUEING = {\n initialize: function () {\n this.callbackQueue.reset();\n },\n close: function () {\n this.callbackQueue.notifyAll();\n }\n};\n\nvar TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];\n\nfunction ReactUpdatesFlushTransaction() {\n this.reinitializeTransaction();\n this.dirtyComponentsLength = null;\n this.callbackQueue = CallbackQueue.getPooled();\n this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(\n /* useCreateElement */true);\n}\n\n_assign(ReactUpdatesFlushTransaction.prototype, Transaction, {\n getTransactionWrappers: function () {\n return TRANSACTION_WRAPPERS;\n },\n\n destructor: function () {\n this.dirtyComponentsLength = null;\n CallbackQueue.release(this.callbackQueue);\n this.callbackQueue = null;\n ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);\n this.reconcileTransaction = null;\n },\n\n perform: function (method, scope, a) {\n // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`\n // with this transaction's wrappers around it.\n return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);\n }\n});\n\nPooledClass.addPoolingTo(ReactUpdatesFlushTransaction);\n\nfunction batchedUpdates(callback, a, b, c, d, e) {\n ensureInjected();\n return batchingStrategy.batchedUpdates(callback, a, b, c, d, e);\n}\n\n/**\n * Array comparator for ReactComponents by mount ordering.\n *\n * @param {ReactComponent} c1 first component you're comparing\n * @param {ReactComponent} c2 second component you're comparing\n * @return {number} Return value usable by Array.prototype.sort().\n */\nfunction mountOrderComparator(c1, c2) {\n return c1._mountOrder - c2._mountOrder;\n}\n\nfunction runBatchedUpdates(transaction) {\n var len = transaction.dirtyComponentsLength;\n !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;\n\n // Since reconciling a component higher in the owner hierarchy usually (not\n // always -- see shouldComponentUpdate()) will reconcile children, reconcile\n // them before their children by sorting the array.\n dirtyComponents.sort(mountOrderComparator);\n\n // Any updates enqueued while reconciling must be performed after this entire\n // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and\n // C, B could update twice in a single batch if C's render enqueues an update\n // to B (since B would have already updated, we should skip it, and the only\n // way we can know to do so is by checking the batch counter).\n updateBatchNumber++;\n\n for (var i = 0; i < len; i++) {\n // If a component is unmounted before pending changes apply, it will still\n // be here, but we assume that it has cleared its _pendingCallbacks and\n // that performUpdateIfNecessary is a noop.\n var component = dirtyComponents[i];\n\n // If performUpdateIfNecessary happens to enqueue any new updates, we\n // shouldn't execute the callbacks until the next render happens, so\n // stash the callbacks first\n var callbacks = component._pendingCallbacks;\n component._pendingCallbacks = null;\n\n var markerName;\n if (ReactFeatureFlags.logTopLevelRenders) {\n var namedComponent = component;\n // Duck type TopLevelWrapper. This is probably always true.\n if (component._currentElement.type.isReactTopLevelWrapper) {\n namedComponent = component._renderedComponent;\n }\n markerName = 'React update: ' + namedComponent.getName();\n console.time(markerName);\n }\n\n ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);\n\n if (markerName) {\n console.timeEnd(markerName);\n }\n\n if (callbacks) {\n for (var j = 0; j < callbacks.length; j++) {\n transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());\n }\n }\n }\n}\n\nvar flushBatchedUpdates = function () {\n // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents\n // array and perform any updates enqueued by mount-ready handlers (i.e.,\n // componentDidUpdate) but we need to check here too in order to catch\n // updates enqueued by setState callbacks and asap calls.\n while (dirtyComponents.length || asapEnqueued) {\n if (dirtyComponents.length) {\n var transaction = ReactUpdatesFlushTransaction.getPooled();\n transaction.perform(runBatchedUpdates, null, transaction);\n ReactUpdatesFlushTransaction.release(transaction);\n }\n\n if (asapEnqueued) {\n asapEnqueued = false;\n var queue = asapCallbackQueue;\n asapCallbackQueue = CallbackQueue.getPooled();\n queue.notifyAll();\n CallbackQueue.release(queue);\n }\n }\n};\n\n/**\n * Mark a component as needing a rerender, adding an optional callback to a\n * list of functions which will be executed once the rerender occurs.\n */\nfunction enqueueUpdate(component) {\n ensureInjected();\n\n // Various parts of our code (such as ReactCompositeComponent's\n // _renderValidatedComponent) assume that calls to render aren't nested;\n // verify that that's the case. (This is called by each top-level update\n // function, like setState, forceUpdate, etc.; creation and\n // destruction of top-level components is guarded in ReactMount.)\n\n if (!batchingStrategy.isBatchingUpdates) {\n batchingStrategy.batchedUpdates(enqueueUpdate, component);\n return;\n }\n\n dirtyComponents.push(component);\n if (component._updateBatchNumber == null) {\n component._updateBatchNumber = updateBatchNumber + 1;\n }\n}\n\n/**\n * Enqueue a callback to be run at the end of the current batching cycle. Throws\n * if no updates are currently being performed.\n */\nfunction asap(callback, context) {\n invariant(batchingStrategy.isBatchingUpdates, \"ReactUpdates.asap: Can't enqueue an asap callback in a context where\" + 'updates are not being batched.');\n asapCallbackQueue.enqueue(callback, context);\n asapEnqueued = true;\n}\n\nvar ReactUpdatesInjection = {\n injectReconcileTransaction: function (ReconcileTransaction) {\n !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;\n ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;\n },\n\n injectBatchingStrategy: function (_batchingStrategy) {\n !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;\n !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;\n !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;\n batchingStrategy = _batchingStrategy;\n }\n};\n\nvar ReactUpdates = {\n /**\n * React references `ReactReconcileTransaction` using this property in order\n * to allow dependency injection.\n *\n * @internal\n */\n ReactReconcileTransaction: null,\n\n batchedUpdates: batchedUpdates,\n enqueueUpdate: enqueueUpdate,\n flushBatchedUpdates: flushBatchedUpdates,\n injection: ReactUpdatesInjection,\n asap: asap\n};\n\nmodule.exports = ReactUpdates;","// Browser Request\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// UMD HEADER START \n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], factory);\n } else if (typeof exports === 'object') {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like enviroments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n // Browser globals (root is window)\n root.returnExports = factory();\n }\n}(this, function () {\n// UMD HEADER END\n\nvar XHR = XMLHttpRequest\nif (!XHR) throw new Error('missing XMLHttpRequest')\nrequest.log = {\n 'trace': noop, 'debug': noop, 'info': noop, 'warn': noop, 'error': noop\n}\n\nvar DEFAULT_TIMEOUT = 3 * 60 * 1000 // 3 minutes\n\n//\n// request\n//\n\nfunction request(options, callback) {\n // The entry-point to the API: prep the options object and pass the real work to run_xhr.\n if(typeof callback !== 'function')\n throw new Error('Bad callback given: ' + callback)\n\n if(!options)\n throw new Error('No options given')\n\n var options_onResponse = options.onResponse; // Save this for later.\n\n if(typeof options === 'string')\n options = {'uri':options};\n else\n options = JSON.parse(JSON.stringify(options)); // Use a duplicate for mutating.\n\n options.onResponse = options_onResponse // And put it back.\n\n if (options.verbose) request.log = getLogger();\n\n if(options.url) {\n options.uri = options.url;\n delete options.url;\n }\n\n if(!options.uri && options.uri !== \"\")\n throw new Error(\"options.uri is a required argument\");\n\n if(typeof options.uri != \"string\")\n throw new Error(\"options.uri must be a string\");\n\n var unsupported_options = ['proxy', '_redirectsFollowed', 'maxRedirects', 'followRedirect']\n for (var i = 0; i < unsupported_options.length; i++)\n if(options[ unsupported_options[i] ])\n throw new Error(\"options.\" + unsupported_options[i] + \" is not supported\")\n\n options.callback = callback\n options.method = options.method || 'GET';\n options.headers = options.headers || {};\n options.body = options.body || null\n options.timeout = options.timeout || request.DEFAULT_TIMEOUT\n\n if(options.headers.host)\n throw new Error(\"Options.headers.host is not supported\");\n\n if(options.json) {\n options.headers.accept = options.headers.accept || 'application/json'\n if(options.method !== 'GET')\n options.headers['content-type'] = 'application/json'\n\n if(typeof options.json !== 'boolean')\n options.body = JSON.stringify(options.json)\n else if(typeof options.body !== 'string')\n options.body = JSON.stringify(options.body)\n }\n \n //BEGIN QS Hack\n var serialize = function(obj) {\n var str = [];\n for(var p in obj)\n if (obj.hasOwnProperty(p)) {\n str.push(encodeURIComponent(p) + \"=\" + encodeURIComponent(obj[p]));\n }\n return str.join(\"&\");\n }\n \n if(options.qs){\n var qs = (typeof options.qs == 'string')? options.qs : serialize(options.qs);\n if(options.uri.indexOf('?') !== -1){ //no get params\n options.uri = options.uri+'&'+qs;\n }else{ //existing get params\n options.uri = options.uri+'?'+qs;\n }\n }\n //END QS Hack\n \n //BEGIN FORM Hack\n var multipart = function(obj) {\n //todo: support file type (useful?)\n var result = {};\n result.boundry = '-------------------------------'+Math.floor(Math.random()*1000000000);\n var lines = [];\n for(var p in obj){\n if (obj.hasOwnProperty(p)) {\n lines.push(\n '--'+result.boundry+\"\\n\"+\n 'Content-Disposition: form-data; name=\"'+p+'\"'+\"\\n\"+\n \"\\n\"+\n obj[p]+\"\\n\"\n );\n }\n }\n lines.push( '--'+result.boundry+'--' );\n result.body = lines.join('');\n result.length = result.body.length;\n result.type = 'multipart/form-data; boundary='+result.boundry;\n return result;\n }\n \n if(options.form){\n if(typeof options.form == 'string') throw('form name unsupported');\n if(options.method === 'POST'){\n var encoding = (options.encoding || 'application/x-www-form-urlencoded').toLowerCase();\n options.headers['content-type'] = encoding;\n switch(encoding){\n case 'application/x-www-form-urlencoded':\n options.body = serialize(options.form).replace(/%20/g, \"+\");\n break;\n case 'multipart/form-data':\n var multi = multipart(options.form);\n //options.headers['content-length'] = multi.length;\n options.body = multi.body;\n options.headers['content-type'] = multi.type;\n break;\n default : throw new Error('unsupported encoding:'+encoding);\n }\n }\n }\n //END FORM Hack\n\n // If onResponse is boolean true, call back immediately when the response is known,\n // not when the full request is complete.\n options.onResponse = options.onResponse || noop\n if(options.onResponse === true) {\n options.onResponse = callback\n options.callback = noop\n }\n\n // XXX Browsers do not like this.\n //if(options.body)\n // options.headers['content-length'] = options.body.length;\n\n // HTTP basic authentication\n if(!options.headers.authorization && options.auth)\n options.headers.authorization = 'Basic ' + b64_enc(options.auth.username + ':' + options.auth.password);\n\n return run_xhr(options)\n}\n\nvar req_seq = 0\nfunction run_xhr(options) {\n var xhr = new XHR\n , timed_out = false\n , is_cors = is_crossDomain(options.uri)\n , supports_cors = ('withCredentials' in xhr)\n\n req_seq += 1\n xhr.seq_id = req_seq\n xhr.id = req_seq + ': ' + options.method + ' ' + options.uri\n xhr._id = xhr.id // I know I will type \"_id\" from habit all the time.\n\n if(is_cors && !supports_cors) {\n var cors_err = new Error('Browser does not support cross-origin request: ' + options.uri)\n cors_err.cors = 'unsupported'\n return options.callback(cors_err, xhr)\n }\n\n xhr.timeoutTimer = setTimeout(too_late, options.timeout)\n function too_late() {\n timed_out = true\n var er = new Error('ETIMEDOUT')\n er.code = 'ETIMEDOUT'\n er.duration = options.timeout\n\n request.log.error('Timeout', { 'id':xhr._id, 'milliseconds':options.timeout })\n return options.callback(er, xhr)\n }\n\n // Some states can be skipped over, so remember what is still incomplete.\n var did = {'response':false, 'loading':false, 'end':false}\n\n xhr.onreadystatechange = on_state_change\n xhr.open(options.method, options.uri, true) // asynchronous\n if(is_cors)\n xhr.withCredentials = !! options.withCredentials\n xhr.send(options.body)\n return xhr\n\n function on_state_change(event) {\n if(timed_out)\n return request.log.debug('Ignoring timed out state change', {'state':xhr.readyState, 'id':xhr.id})\n\n request.log.debug('State change', {'state':xhr.readyState, 'id':xhr.id, 'timed_out':timed_out})\n\n if(xhr.readyState === XHR.OPENED) {\n request.log.debug('Request started', {'id':xhr.id})\n for (var key in options.headers)\n xhr.setRequestHeader(key, options.headers[key])\n }\n\n else if(xhr.readyState === XHR.HEADERS_RECEIVED)\n on_response()\n\n else if(xhr.readyState === XHR.LOADING) {\n on_response()\n on_loading()\n }\n\n else if(xhr.readyState === XHR.DONE) {\n on_response()\n on_loading()\n on_end()\n }\n }\n\n function on_response() {\n if(did.response)\n return\n\n did.response = true\n request.log.debug('Got response', {'id':xhr.id, 'status':xhr.status})\n clearTimeout(xhr.timeoutTimer)\n xhr.statusCode = xhr.status // Node request compatibility\n\n // Detect failed CORS requests.\n if(is_cors && xhr.statusCode == 0) {\n var cors_err = new Error('CORS request rejected: ' + options.uri)\n cors_err.cors = 'rejected'\n\n // Do not process this request further.\n did.loading = true\n did.end = true\n\n return options.callback(cors_err, xhr)\n }\n\n options.onResponse(null, xhr)\n }\n\n function on_loading() {\n if(did.loading)\n return\n\n did.loading = true\n request.log.debug('Response body loading', {'id':xhr.id})\n // TODO: Maybe simulate \"data\" events by watching xhr.responseText\n }\n\n function on_end() {\n if(did.end)\n return\n\n did.end = true\n request.log.debug('Request done', {'id':xhr.id})\n\n xhr.body = xhr.responseText\n if(options.json) {\n try { xhr.body = JSON.parse(xhr.responseText) }\n catch (er) { return options.callback(er, xhr) }\n }\n\n options.callback(null, xhr, xhr.body)\n }\n\n} // request\n\nrequest.withCredentials = false;\nrequest.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;\n\n//\n// defaults\n//\n\nrequest.defaults = function(options, requester) {\n var def = function (method) {\n var d = function (params, callback) {\n if(typeof params === 'string')\n params = {'uri': params};\n else {\n params = JSON.parse(JSON.stringify(params));\n }\n for (var i in options) {\n if (params[i] === undefined) params[i] = options[i]\n }\n return method(params, callback)\n }\n return d\n }\n var de = def(request)\n de.get = def(request.get)\n de.post = def(request.post)\n de.put = def(request.put)\n de.head = def(request.head)\n return de\n}\n\n//\n// HTTP method shortcuts\n//\n\nvar shortcuts = [ 'get', 'put', 'post', 'head' ];\nshortcuts.forEach(function(shortcut) {\n var method = shortcut.toUpperCase();\n var func = shortcut.toLowerCase();\n\n request[func] = function(opts) {\n if(typeof opts === 'string')\n opts = {'method':method, 'uri':opts};\n else {\n opts = JSON.parse(JSON.stringify(opts));\n opts.method = method;\n }\n\n var args = [opts].concat(Array.prototype.slice.apply(arguments, [1]));\n return request.apply(this, args);\n }\n})\n\n//\n// CouchDB shortcut\n//\n\nrequest.couch = function(options, callback) {\n if(typeof options === 'string')\n options = {'uri':options}\n\n // Just use the request API to do JSON.\n options.json = true\n if(options.body)\n options.json = options.body\n delete options.body\n\n callback = callback || noop\n\n var xhr = request(options, couch_handler)\n return xhr\n\n function couch_handler(er, resp, body) {\n if(er)\n return callback(er, resp, body)\n\n if((resp.statusCode < 200 || resp.statusCode > 299) && body.error) {\n // The body is a Couch JSON object indicating the error.\n er = new Error('CouchDB error: ' + (body.error.reason || body.error.error))\n for (var key in body)\n er[key] = body[key]\n return callback(er, resp, body);\n }\n\n return callback(er, resp, body);\n }\n}\n\n//\n// Utility\n//\n\nfunction noop() {}\n\nfunction getLogger() {\n var logger = {}\n , levels = ['trace', 'debug', 'info', 'warn', 'error']\n , level, i\n\n for(i = 0; i < levels.length; i++) {\n level = levels[i]\n\n logger[level] = noop\n if(typeof console !== 'undefined' && console && console[level])\n logger[level] = formatted(console, level)\n }\n\n return logger\n}\n\nfunction formatted(obj, method) {\n return formatted_logger\n\n function formatted_logger(str, context) {\n if(typeof context === 'object')\n str += ' ' + JSON.stringify(context)\n\n return obj[method].call(obj, str)\n }\n}\n\n// Return whether a URL is a cross-domain request.\nfunction is_crossDomain(url) {\n var rurl = /^([\\w\\+\\.\\-]+:)(?:\\/\\/([^\\/?#:]*)(?::(\\d+))?)?/\n\n // jQuery #8138, IE may throw an exception when accessing\n // a field from window.location if document.domain has been set\n var ajaxLocation\n try { ajaxLocation = location.href }\n catch (e) {\n // Use the href attribute of an A element since IE will modify it given document.location\n ajaxLocation = document.createElement( \"a\" );\n ajaxLocation.href = \"\";\n ajaxLocation = ajaxLocation.href;\n }\n\n var ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []\n , parts = rurl.exec(url.toLowerCase() )\n\n var result = !!(\n parts &&\n ( parts[1] != ajaxLocParts[1]\n || parts[2] != ajaxLocParts[2]\n || (parts[3] || (parts[1] === \"http:\" ? 80 : 443)) != (ajaxLocParts[3] || (ajaxLocParts[1] === \"http:\" ? 80 : 443))\n )\n )\n\n //console.debug('is_crossDomain('+url+') -> ' + result)\n return result\n}\n\n// MIT License from http://phpjs.org/functions/base64_encode:358\nfunction b64_enc (data) {\n // Encodes string using MIME base64 algorithm\n var b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc=\"\", tmp_arr = [];\n\n if (!data) {\n return data;\n }\n\n // assume utf8 data\n // data = this.utf8_encode(data+'');\n\n do { // pack three octets into four hexets\n o1 = data.charCodeAt(i++);\n o2 = data.charCodeAt(i++);\n o3 = data.charCodeAt(i++);\n\n bits = o1<<16 | o2<<8 | o3;\n\n h1 = bits>>18 & 0x3f;\n h2 = bits>>12 & 0x3f;\n h3 = bits>>6 & 0x3f;\n h4 = bits & 0x3f;\n\n // use hexets to index into b64, and append result to encoded string\n tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);\n } while (i < data.length);\n\n enc = tmp_arr.join('');\n\n switch (data.length % 3) {\n case 1:\n enc = enc.slice(0, -2) + '==';\n break;\n case 2:\n enc = enc.slice(0, -1) + '=';\n break;\n }\n\n return enc;\n}\n return request;\n//UMD FOOTER START\n}));\n//UMD FOOTER END\n","\"use strict\";\n\nexports.__esModule = true;\n\nexports.default = function (obj, keys) {\n var target = {};\n\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n\n return target;\n};","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","module.exports = __webpack_public_path__ + \"img/cancel.4b9715b.svg\";","'use strict';\n\nvar _stringify = require('babel-runtime/core-js/json/stringify');\n\nvar _stringify2 = _interopRequireDefault(_stringify);\n\nvar _assign = require('babel-runtime/core-js/object/assign');\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _dispatcher = require('../dispatcher');\n\nvar _dispatcher2 = _interopRequireDefault(_dispatcher);\n\nvar _utils = require('flux/utils');\n\nvar _MatrixClientPeg = require('../MatrixClientPeg');\n\nvar _MatrixClientPeg2 = _interopRequireDefault(_MatrixClientPeg);\n\nvar _index = require('../index');\n\nvar _index2 = _interopRequireDefault(_index);\n\nvar _Modal = require('../Modal');\n\nvar _Modal2 = _interopRequireDefault(_Modal);\n\nvar _languageHandler = require('../languageHandler');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\nCopyright 2017 Vector Creations Ltd\nCopyright 2017, 2018 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\nvar INITIAL_STATE = {\n // Whether we're joining the currently viewed room (see isJoining())\n joining: false,\n // Any error that has occurred during joining\n joinError: null,\n // The room ID of the room currently being viewed\n roomId: null,\n\n // The event to scroll to when the room is first viewed\n initialEventId: null,\n // Whether to highlight the initial event\n isInitialEventHighlighted: false,\n\n // The room alias of the room (or null if not originally specified in view_room)\n roomAlias: null,\n // Whether the current room is loading\n roomLoading: false,\n // Any error that has occurred during loading\n roomLoadError: null,\n\n forwardingEvent: null,\n\n quotingEvent: null\n};\n\n/**\n * A class for storing application state for RoomView. This is the RoomView's interface\n* with a subset of the js-sdk.\n * ```\n */\n\nvar RoomViewStore = function (_Store) {\n (0, _inherits3.default)(RoomViewStore, _Store);\n\n function RoomViewStore() {\n (0, _classCallCheck3.default)(this, RoomViewStore);\n\n // Initialise state\n var _this = (0, _possibleConstructorReturn3.default)(this, (RoomViewStore.__proto__ || (0, _getPrototypeOf2.default)(RoomViewStore)).call(this, _dispatcher2.default));\n\n _this._state = INITIAL_STATE;\n return _this;\n }\n\n (0, _createClass3.default)(RoomViewStore, [{\n key: '_setState',\n value: function _setState(newState) {\n this._state = (0, _assign2.default)(this._state, newState);\n this.__emitChange();\n }\n }, {\n key: '__onDispatch',\n value: function __onDispatch(payload) {\n switch (payload.action) {\n // view_room:\n // - room_alias: '#somealias:matrix.org'\n // - room_id: '!roomid123:matrix.org'\n // - event_id: '$213456782:matrix.org'\n // - event_offset: 100\n // - highlighted: true\n case 'view_room':\n this._viewRoom(payload);\n break;\n case 'view_my_groups':\n case 'view_group':\n this._setState({\n roomId: null,\n roomAlias: null\n });\n break;\n case 'view_room_error':\n this._viewRoomError(payload);\n break;\n case 'will_join':\n this._setState({\n joining: true\n });\n break;\n case 'cancel_join':\n this._setState({\n joining: false\n });\n break;\n // join_room:\n // - opts: options for joinRoom\n case 'join_room':\n this._joinRoom(payload);\n break;\n case 'join_room_error':\n this._joinRoomError(payload);\n break;\n case 'on_logged_out':\n this.reset();\n break;\n case 'forward_event':\n this._setState({\n forwardingEvent: payload.event\n });\n break;\n case 'reply_to_event':\n this._setState({\n replyingToEvent: payload.event\n });\n break;\n case 'open_room_settings':\n {\n var RoomSettingsDialog = _index2.default.getComponent(\"dialogs.RoomSettingsDialog\");\n _Modal2.default.createTrackedDialog('Room settings', '', RoomSettingsDialog, {\n roomId: payload.room_id || this._state.roomId\n }, 'mx_SettingsDialog', /*isPriority=*/false, /*isStatic=*/true);\n break;\n }\n }\n }\n }, {\n key: '_viewRoom',\n value: function _viewRoom(payload) {\n if (payload.room_id) {\n var newState = {\n roomId: payload.room_id,\n roomAlias: payload.room_alias,\n initialEventId: payload.event_id,\n isInitialEventHighlighted: payload.highlighted,\n forwardingEvent: null,\n roomLoading: false,\n roomLoadError: null,\n // should peek by default\n shouldPeek: payload.should_peek === undefined ? true : payload.should_peek,\n // have we sent a join request for this room and are waiting for a response?\n joining: payload.joining || false,\n // Reset replyingToEvent because we don't want cross-room because bad UX\n replyingToEvent: null,\n // pull the user out of Room Settings\n isEditingSettings: false\n };\n\n if (this._state.forwardingEvent) {\n _dispatcher2.default.dispatch({\n action: 'send_event',\n room_id: newState.roomId,\n event: this._state.forwardingEvent\n });\n }\n\n this._setState(newState);\n\n if (payload.auto_join) {\n this._joinRoom(payload);\n }\n } else if (payload.room_alias) {\n // Resolve the alias and then do a second dispatch with the room ID acquired\n this._setState({\n roomId: null,\n initialEventId: null,\n initialEventPixelOffset: null,\n isInitialEventHighlighted: null,\n roomAlias: payload.room_alias,\n roomLoading: true,\n roomLoadError: null\n });\n _MatrixClientPeg2.default.get().getRoomIdForAlias(payload.room_alias).done(function (result) {\n _dispatcher2.default.dispatch({\n action: 'view_room',\n room_id: result.room_id,\n event_id: payload.event_id,\n highlighted: payload.highlighted,\n room_alias: payload.room_alias,\n auto_join: payload.auto_join,\n oob_data: payload.oob_data\n });\n }, function (err) {\n _dispatcher2.default.dispatch({\n action: 'view_room_error',\n room_id: null,\n room_alias: payload.room_alias,\n err: err\n });\n });\n }\n }\n }, {\n key: '_viewRoomError',\n value: function _viewRoomError(payload) {\n this._setState({\n roomId: payload.room_id,\n roomAlias: payload.room_alias,\n roomLoading: false,\n roomLoadError: payload.err\n });\n }\n }, {\n key: '_joinRoom',\n value: function _joinRoom(payload) {\n this._setState({\n joining: true\n });\n _MatrixClientPeg2.default.get().joinRoom(this._state.roomAlias || this._state.roomId, payload.opts).done(function () {\n // We don't actually need to do anything here: we do *not*\n // clear the 'joining' flag because the Room object and/or\n // our 'joined' member event may not have come down the sync\n // stream yet, and that's the point at which we'd consider\n // the user joined to the room.\n }, function (err) {\n _dispatcher2.default.dispatch({\n action: 'join_room_error',\n err: err\n });\n var msg = err.message ? err.message : (0, _stringify2.default)(err);\n // XXX: We are relying on the error message returned by browsers here.\n // This isn't great, but it does generalize the error being shown to users.\n if (msg && msg.startsWith(\"CORS request rejected\")) {\n msg = (0, _languageHandler._t)(\"There was an error joining the room\");\n }\n if (err.errcode === 'M_INCOMPATIBLE_ROOM_VERSION') {\n msg = React.createElement(\n 'div',\n null,\n (0, _languageHandler._t)(\"Sorry, your homeserver is too old to participate in this room.\"),\n React.createElement('br', null),\n (0, _languageHandler._t)(\"Please contact your homeserver administrator.\")\n );\n }\n var ErrorDialog = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n _Modal2.default.createTrackedDialog('Failed to join room', '', ErrorDialog, {\n title: (0, _languageHandler._t)(\"Failed to join room\"),\n description: msg\n });\n });\n }\n }, {\n key: '_joinRoomError',\n value: function _joinRoomError(payload) {\n this._setState({\n joining: false,\n joinError: payload.err\n });\n }\n }, {\n key: 'reset',\n value: function reset() {\n this._state = (0, _assign2.default)({}, INITIAL_STATE);\n }\n\n // The room ID of the room currently being viewed\n\n }, {\n key: 'getRoomId',\n value: function getRoomId() {\n return this._state.roomId;\n }\n\n // The event to scroll to when the room is first viewed\n\n }, {\n key: 'getInitialEventId',\n value: function getInitialEventId() {\n return this._state.initialEventId;\n }\n\n // Whether to highlight the initial event\n\n }, {\n key: 'isInitialEventHighlighted',\n value: function isInitialEventHighlighted() {\n return this._state.isInitialEventHighlighted;\n }\n\n // The room alias of the room (or null if not originally specified in view_room)\n\n }, {\n key: 'getRoomAlias',\n value: function getRoomAlias() {\n return this._state.roomAlias;\n }\n\n // Whether the current room is loading (true whilst resolving an alias)\n\n }, {\n key: 'isRoomLoading',\n value: function isRoomLoading() {\n return this._state.roomLoading;\n }\n\n // Any error that has occurred during loading\n\n }, {\n key: 'getRoomLoadError',\n value: function getRoomLoadError() {\n return this._state.roomLoadError;\n }\n\n // True if we're expecting the user to be joined to the room currently being\n // viewed. Note that this is left true after the join request has finished,\n // since we should still consider a join to be in progress until the room\n // & member events come down the sync.\n //\n // This flag remains true after the room has been sucessfully joined,\n // (this store doesn't listen for the appropriate member events)\n // so you should always observe the joined state from the member event\n // if a room object is present.\n // ie. The correct logic is:\n // if (room) {\n // if (myMember.membership == 'joined') {\n // // user is joined to the room\n // } else {\n // // Not joined\n // }\n // } else {\n // if (RoomViewStore.isJoining()) {\n // // show spinner\n // } else {\n // // show join prompt\n // }\n // }\n\n }, {\n key: 'isJoining',\n value: function isJoining() {\n return this._state.joining;\n }\n\n // Any error that has occurred during joining\n\n }, {\n key: 'getJoinError',\n value: function getJoinError() {\n return this._state.joinError;\n }\n\n // The mxEvent if one is about to be forwarded\n\n }, {\n key: 'getForwardingEvent',\n value: function getForwardingEvent() {\n return this._state.forwardingEvent;\n }\n\n // The mxEvent if one is currently being replied to/quoted\n\n }, {\n key: 'getQuotingEvent',\n value: function getQuotingEvent() {\n return this._state.replyingToEvent;\n }\n }, {\n key: 'shouldPeek',\n value: function shouldPeek() {\n return this._state.shouldPeek;\n }\n }]);\n return RoomViewStore;\n}(_utils.Store);\n\nvar singletonRoomViewStore = null;\nif (!singletonRoomViewStore) {\n singletonRoomViewStore = new RoomViewStore();\n}\nmodule.exports = singletonRoomViewStore;\n//# sourceMappingURL=RoomViewStore.js.map","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","// most Object methods by ES6 should accept primitives\nvar $export = require('./_export');\nvar core = require('./_core');\nvar fails = require('./_fails');\nmodule.exports = function (KEY, exec) {\n var fn = (core.Object || {})[KEY] || Object[KEY];\n var exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);\n};\n","// 0 -> Array#forEach\n// 1 -> Array#map\n// 2 -> Array#filter\n// 3 -> Array#some\n// 4 -> Array#every\n// 5 -> Array#find\n// 6 -> Array#findIndex\nvar ctx = require('./_ctx');\nvar IObject = require('./_iobject');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar asc = require('./_array-species-create');\nmodule.exports = function (TYPE, $create) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n var create = $create || asc;\n return function ($this, callbackfn, that) {\n var O = toObject($this);\n var self = IObject(O);\n var f = ctx(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var val, res;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n val = self[index];\n res = f(val, index, O);\n if (TYPE) {\n if (IS_MAP) result[index] = res; // map\n else if (res) switch (TYPE) {\n case 3: return true; // some\n case 5: return val; // find\n case 6: return index; // findIndex\n case 2: result.push(val); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;\n };\n};\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","require('./es6.array.iterator');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar TO_STRING_TAG = require('./_wks')('toStringTag');\n\nvar DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +\n 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +\n 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +\n 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +\n 'TextTrackList,TouchList').split(',');\n\nfor (var i = 0; i < DOMIterables.length; i++) {\n var NAME = DOMIterables[i];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = Iterators.Array;\n}\n","/*\nCopyright 2015, 2016 OpenMarket Ltd\nCopyright 2017, 2018 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _assign = require('babel-runtime/core-js/object/assign');\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _keys = require('babel-runtime/core-js/object/keys');\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nexports.containsEmoji = containsEmoji;\nexports.charactersToImageNode = charactersToImageNode;\nexports.processHtmlForSending = processHtmlForSending;\nexports.sanitizedHtmlNode = sanitizedHtmlNode;\nexports.isUrlPermitted = isUrlPermitted;\nexports.bodyToHtml = bodyToHtml;\nexports.emojifyText = emojifyText;\nexports.linkifyString = linkifyString;\nexports.linkifyElement = linkifyElement;\nexports.linkifyAndSanitizeHtml = linkifyAndSanitizeHtml;\n\nvar _ReplyThread = require('./components/views/elements/ReplyThread');\n\nvar _ReplyThread2 = _interopRequireDefault(_ReplyThread);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _sanitizeHtml = require('sanitize-html');\n\nvar _sanitizeHtml2 = _interopRequireDefault(_sanitizeHtml);\n\nvar _highlight = require('highlight.js');\n\nvar _highlight2 = _interopRequireDefault(_highlight);\n\nvar _linkifyjs = require('linkifyjs');\n\nvar linkify = _interopRequireWildcard(_linkifyjs);\n\nvar _linkifyMatrix = require('./linkify-matrix');\n\nvar _linkifyMatrix2 = _interopRequireDefault(_linkifyMatrix);\n\nvar _element = require('linkifyjs/element');\n\nvar _element2 = _interopRequireDefault(_element);\n\nvar _string = require('linkifyjs/string');\n\nvar _string2 = _interopRequireDefault(_string);\n\nvar _escape = require('lodash/escape');\n\nvar _escape2 = _interopRequireDefault(_escape);\n\nvar _emojione = require('emojione');\n\nvar _emojione2 = _interopRequireDefault(_emojione);\n\nvar _classnames = require('classnames');\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _MatrixClientPeg = require('./MatrixClientPeg');\n\nvar _MatrixClientPeg2 = _interopRequireDefault(_MatrixClientPeg);\n\nvar _url = require('url');\n\nvar _url2 = _interopRequireDefault(_url);\n\nfunction _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; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(0, _linkifyMatrix2.default)(linkify);\n\n_emojione2.default.imagePathSVG = 'emojione/svg/';\n// Store PNG path for displaying many flags at once (for increased performance over SVG)\n_emojione2.default.imagePathPNG = 'emojione/png/';\n// Use SVGs for emojis\n_emojione2.default.imageType = 'svg';\n\n// Anything outside the basic multilingual plane will be a surrogate pair\nvar SURROGATE_PAIR_PATTERN = /([\\ud800-\\udbff])([\\udc00-\\udfff])/;\n// And there a bunch more symbol characters that emojione has within the\n// BMP, so this includes the ranges from 'letterlike symbols' to\n// 'miscellaneous symbols and arrows' which should catch all of them\n// (with plenty of false positives, but that's OK)\nvar SYMBOL_PATTERN = /([\\u2100-\\u2bff])/;\n\n// Regex pattern for Zero-Width joiner unicode characters\nvar ZWJ_REGEX = new RegExp('\\u200D|\\u2003', \"g\");\n\n// Regex pattern for whitespace characters\nvar WHITESPACE_REGEX = new RegExp(\"\\\\s\", \"g\");\n\n// And this is emojione's complete regex\nvar EMOJI_REGEX = new RegExp(_emojione2.default.unicodeRegexp + \"+\", \"gi\");\nvar COLOR_REGEX = /^#[0-9a-fA-F]{6}$/;\n\nvar PERMITTED_URL_SCHEMES = ['http', 'https', 'ftp', 'mailto', 'magnet'];\n\n/*\n * Return true if the given string contains emoji\n * Uses a much, much simpler regex than emojione's so will give false\n * positives, but useful for fast-path testing strings to see if they\n * need emojification.\n * unicodeToImage uses this function.\n */\nfunction containsEmoji(str) {\n return SURROGATE_PAIR_PATTERN.test(str) || SYMBOL_PATTERN.test(str);\n}\n\n/* modified from https://github.com/Ranks/emojione/blob/master/lib/js/emojione.js\n * because we want to include emoji shortnames in title text\n */\nfunction unicodeToImage(str, addAlt) {\n if (addAlt === undefined) addAlt = true;\n\n var replaceWith = void 0;var unicode = void 0;var short = void 0;var fname = void 0;\n var mappedUnicode = _emojione2.default.mapUnicodeToShort();\n\n str = str.replace(_emojione2.default.regUnicode, function (unicodeChar) {\n if (typeof unicodeChar === 'undefined' || unicodeChar === '' || !(unicodeChar in _emojione2.default.jsEscapeMap)) {\n // if the unicodeChar doesnt exist just return the entire match\n return unicodeChar;\n } else {\n // get the unicode codepoint from the actual char\n unicode = _emojione2.default.jsEscapeMap[unicodeChar];\n\n short = mappedUnicode[unicode];\n fname = _emojione2.default.emojioneList[short].fname;\n\n // depending on the settings, we'll either add the native unicode as the alt tag, otherwise the shortname\n var title = mappedUnicode[unicode];\n\n if (addAlt) {\n var alt = _emojione2.default.unicodeAlt ? _emojione2.default.convert(unicode.toUpperCase()) : mappedUnicode[unicode];\n replaceWith = '';\n } else {\n replaceWith = '';\n }\n return replaceWith;\n }\n });\n\n return str;\n}\n\n/**\n * Given one or more unicode characters (represented by unicode\n * character number), return an image node with the corresponding\n * emoji.\n *\n * @param alt {string} String to use for the image alt text\n * @param useSvg {boolean} Whether to use SVG image src. If False, PNG will be used.\n * @param unicode {integer} One or more integers representing unicode characters\n * @returns A img node with the corresponding emoji\n */\nfunction charactersToImageNode(alt, useSvg) {\n for (var _len = arguments.length, unicode = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n unicode[_key - 2] = arguments[_key];\n }\n\n var fileName = unicode.map(function (u) {\n return u.toString(16);\n }).join('-');\n var path = useSvg ? _emojione2.default.imagePathSVG : _emojione2.default.imagePathPNG;\n var fileType = useSvg ? 'svg' : 'png';\n return _react2.default.createElement('img', {\n alt: alt,\n src: '' + path + fileName + '.' + fileType + _emojione2.default.cacheBustParam\n });\n}\n\nfunction processHtmlForSending(html) {\n var contentDiv = document.createElement('div');\n contentDiv.innerHTML = html;\n\n if (contentDiv.children.length === 0) {\n return contentDiv.innerHTML;\n }\n\n var contentHTML = \"\";\n for (var i = 0; i < contentDiv.children.length; i++) {\n var element = contentDiv.children[i];\n if (element.tagName.toLowerCase() === 'p') {\n contentHTML += element.innerHTML;\n // Don't add a
for the last \n if (i !== contentDiv.children.length - 1) {\n contentHTML += '
';\n }\n } else {\n var temp = document.createElement('div');\n temp.appendChild(element.cloneNode(true));\n contentHTML += temp.innerHTML;\n }\n }\n\n return contentHTML;\n}\n\n/*\n * Given an untrusted HTML string, return a React node with an sanitized version\n * of that HTML.\n */\nfunction sanitizedHtmlNode(insaneHtml) {\n var saneHtml = (0, _sanitizeHtml2.default)(insaneHtml, sanitizeHtmlParams);\n\n return _react2.default.createElement('div', { dangerouslySetInnerHTML: { __html: saneHtml }, dir: 'auto' });\n}\n\n/**\n * Tests if a URL from an untrusted source may be safely put into the DOM\n * The biggest threat here is javascript: URIs.\n * Note that the HTML sanitiser library has its own internal logic for\n * doing this, to which we pass the same list of schemes. This is used in\n * other places we need to sanitise URLs.\n * @return true if permitted, otherwise false\n */\nfunction isUrlPermitted(inputUrl) {\n try {\n var parsed = _url2.default.parse(inputUrl);\n if (!parsed.protocol) return false;\n // URL parser protocol includes the trailing colon\n return PERMITTED_URL_SCHEMES.includes(parsed.protocol.slice(0, -1));\n } catch (e) {\n return false;\n }\n}\n\nvar transformTags = { // custom to matrix\n // add blank targets to all hyperlinks except vector URLs\n 'a': function a(tagName, attribs) {\n if (attribs.href) {\n attribs.target = '_blank'; // by default\n\n var m = void 0;\n // FIXME: horrible duplication with linkify-matrix\n m = attribs.href.match(_linkifyMatrix2.default.VECTOR_URL_PATTERN);\n if (m) {\n attribs.href = m[1];\n delete attribs.target;\n } else {\n m = attribs.href.match(_linkifyMatrix2.default.MATRIXTO_URL_PATTERN);\n if (m) {\n var entity = m[1];\n switch (entity[0]) {\n case '@':\n attribs.href = '#/user/' + entity;\n break;\n case '+':\n attribs.href = '#/group/' + entity;\n break;\n case '#':\n case '!':\n attribs.href = '#/room/' + entity;\n break;\n }\n delete attribs.target;\n }\n }\n }\n attribs.rel = 'noopener'; // https://mathiasbynens.github.io/rel-noopener/\n return { tagName: tagName, attribs: attribs };\n },\n 'img': function img(tagName, attribs) {\n // Strip out imgs that aren't `mxc` here instead of using allowedSchemesByTag\n // because transformTags is used _before_ we filter by allowedSchemesByTag and\n // we don't want to allow images with `https?` `src`s.\n if (!attribs.src || !attribs.src.startsWith('mxc://')) {\n return { tagName: tagName, attribs: {} };\n }\n attribs.src = _MatrixClientPeg2.default.get().mxcUrlToHttp(attribs.src, attribs.width || 800, attribs.height || 600);\n return { tagName: tagName, attribs: attribs };\n },\n 'code': function code(tagName, attribs) {\n if (typeof attribs.class !== 'undefined') {\n // Filter out all classes other than ones starting with language- for syntax highlighting.\n var classes = attribs.class.split(/\\s/).filter(function (cl) {\n return cl.startsWith('language-');\n });\n attribs.class = classes.join(' ');\n }\n return { tagName: tagName, attribs: attribs };\n },\n '*': function _(tagName, attribs) {\n // Delete any style previously assigned, style is an allowedTag for font and span\n // because attributes are stripped after transforming\n delete attribs.style;\n\n // Sanitise and transform data-mx-color and data-mx-bg-color to their CSS\n // equivalents\n var customCSSMapper = {\n 'data-mx-color': 'color',\n 'data-mx-bg-color': 'background-color'\n // $customAttributeKey: $cssAttributeKey\n };\n\n var style = \"\";\n (0, _keys2.default)(customCSSMapper).forEach(function (customAttributeKey) {\n var cssAttributeKey = customCSSMapper[customAttributeKey];\n var customAttributeValue = attribs[customAttributeKey];\n if (customAttributeValue && typeof customAttributeValue === 'string' && COLOR_REGEX.test(customAttributeValue)) {\n style += cssAttributeKey + \":\" + customAttributeValue + \";\";\n delete attribs[customAttributeKey];\n }\n });\n\n if (style) {\n attribs.style = style;\n }\n\n return { tagName: tagName, attribs: attribs };\n }\n};\n\nvar sanitizeHtmlParams = {\n allowedTags: ['font', // custom to matrix for IRC-style font coloring\n 'del', // for markdown\n 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul', 'ol', 'sup', 'sub', 'nl', 'li', 'b', 'i', 'u', 'strong', 'em', 'strike', 'code', 'hr', 'br', 'div', 'table', 'thead', 'caption', 'tbody', 'tr', 'th', 'td', 'pre', 'span', 'img'],\n allowedAttributes: {\n // custom ones first:\n font: ['color', 'data-mx-bg-color', 'data-mx-color', 'style'], // custom to matrix\n span: ['data-mx-bg-color', 'data-mx-color', 'style'], // custom to matrix\n a: ['href', 'name', 'target', 'rel'], // remote target: custom to matrix\n img: ['src', 'width', 'height', 'alt', 'title'],\n ol: ['start'],\n code: ['class'] // We don't actually allow all classes, we filter them in transformTags\n },\n // Lots of these won't come up by default because we don't allow them\n selfClosing: ['img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta'],\n // URL schemes we permit\n allowedSchemes: PERMITTED_URL_SCHEMES,\n\n allowProtocolRelative: false,\n transformTags: transformTags\n};\n\n// this is the same as the above except with less rewriting\nvar composerSanitizeHtmlParams = (0, _assign2.default)({}, sanitizeHtmlParams);\ncomposerSanitizeHtmlParams.transformTags = {\n 'code': transformTags['code'],\n '*': transformTags['*']\n};\n\nvar BaseHighlighter = function () {\n function BaseHighlighter(highlightClass, highlightLink) {\n (0, _classCallCheck3.default)(this, BaseHighlighter);\n\n this.highlightClass = highlightClass;\n this.highlightLink = highlightLink;\n }\n\n /**\n * apply the highlights to a section of text\n *\n * @param {string} safeSnippet The snippet of text to apply the highlights\n * to.\n * @param {string[]} safeHighlights A list of substrings to highlight,\n * sorted by descending length.\n *\n * returns a list of results (strings for HtmlHighligher, react nodes for\n * TextHighlighter).\n */\n\n\n (0, _createClass3.default)(BaseHighlighter, [{\n key: 'applyHighlights',\n value: function applyHighlights(safeSnippet, safeHighlights) {\n var lastOffset = 0;\n var offset = void 0;\n var nodes = [];\n\n var safeHighlight = safeHighlights[0];\n while ((offset = safeSnippet.toLowerCase().indexOf(safeHighlight.toLowerCase(), lastOffset)) >= 0) {\n // handle preamble\n if (offset > lastOffset) {\n var subSnippet = safeSnippet.substring(lastOffset, offset);\n nodes = nodes.concat(this._applySubHighlights(subSnippet, safeHighlights));\n }\n\n // do highlight. use the original string rather than safeHighlight\n // to preserve the original casing.\n var endOffset = offset + safeHighlight.length;\n nodes.push(this._processSnippet(safeSnippet.substring(offset, endOffset), true));\n\n lastOffset = endOffset;\n }\n\n // handle postamble\n if (lastOffset !== safeSnippet.length) {\n subSnippet = safeSnippet.substring(lastOffset, undefined);\n nodes = nodes.concat(this._applySubHighlights(subSnippet, safeHighlights));\n }\n return nodes;\n }\n }, {\n key: '_applySubHighlights',\n value: function _applySubHighlights(safeSnippet, safeHighlights) {\n if (safeHighlights[1]) {\n // recurse into this range to check for the next set of highlight matches\n return this.applyHighlights(safeSnippet, safeHighlights.slice(1));\n } else {\n // no more highlights to be found, just return the unhighlighted string\n return [this._processSnippet(safeSnippet, false)];\n }\n }\n }]);\n return BaseHighlighter;\n}();\n\nvar HtmlHighlighter = function (_BaseHighlighter) {\n (0, _inherits3.default)(HtmlHighlighter, _BaseHighlighter);\n\n function HtmlHighlighter() {\n (0, _classCallCheck3.default)(this, HtmlHighlighter);\n return (0, _possibleConstructorReturn3.default)(this, (HtmlHighlighter.__proto__ || (0, _getPrototypeOf2.default)(HtmlHighlighter)).apply(this, arguments));\n }\n\n (0, _createClass3.default)(HtmlHighlighter, [{\n key: '_processSnippet',\n\n /* highlight the given snippet if required\n *\n * snippet: content of the span; must have been sanitised\n * highlight: true to highlight as a search match\n *\n * returns an HTML string\n */\n value: function _processSnippet(snippet, highlight) {\n if (!highlight) {\n // nothing required here\n return snippet;\n }\n\n var span = \"\" + snippet + \"\";\n\n if (this.highlightLink) {\n span = \"\" + span + \"\";\n }\n return span;\n }\n }]);\n return HtmlHighlighter;\n}(BaseHighlighter);\n\nvar TextHighlighter = function (_BaseHighlighter2) {\n (0, _inherits3.default)(TextHighlighter, _BaseHighlighter2);\n\n function TextHighlighter(highlightClass, highlightLink) {\n (0, _classCallCheck3.default)(this, TextHighlighter);\n\n var _this2 = (0, _possibleConstructorReturn3.default)(this, (TextHighlighter.__proto__ || (0, _getPrototypeOf2.default)(TextHighlighter)).call(this, highlightClass, highlightLink));\n\n _this2._key = 0;\n return _this2;\n }\n\n /* create a node to hold the given content\n *\n * snippet: content of the span\n * highlight: true to highlight as a search match\n *\n * returns a React node\n */\n\n\n (0, _createClass3.default)(TextHighlighter, [{\n key: '_processSnippet',\n value: function _processSnippet(snippet, highlight) {\n var key = this._key++;\n\n var node = _react2.default.createElement(\n 'span',\n { key: key, className: highlight ? this.highlightClass : null },\n snippet\n );\n\n if (highlight && this.highlightLink) {\n node = _react2.default.createElement(\n 'a',\n { key: key, href: this.highlightLink },\n node\n );\n }\n\n return node;\n }\n }]);\n return TextHighlighter;\n}(BaseHighlighter);\n\n/* turn a matrix event body into html\n *\n * content: 'content' of the MatrixEvent\n *\n * highlights: optional list of words to highlight, ordered by longest word first\n *\n * opts.highlightLink: optional href to add to highlighted words\n * opts.disableBigEmoji: optional argument to disable the big emoji class.\n * opts.stripReplyFallback: optional argument specifying the event is a reply and so fallback needs removing\n * opts.returnString: return an HTML string rather than JSX elements\n * opts.emojiOne: optional param to do emojiOne (default true)\n * opts.forComposerQuote: optional param to lessen the url rewriting done by sanitization, for quoting into composer\n */\n\n\nfunction bodyToHtml(content, highlights) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var isHtmlMessage = content.format === \"org.matrix.custom.html\" && content.formatted_body;\n\n var doEmojiOne = opts.emojiOne === undefined ? true : opts.emojiOne;\n var bodyHasEmoji = false;\n\n var sanitizeParams = sanitizeHtmlParams;\n if (opts.forComposerQuote) {\n sanitizeParams = composerSanitizeHtmlParams;\n }\n\n var strippedBody = void 0;\n var safeBody = void 0;\n var isDisplayedWithHtml = void 0;\n // XXX: We sanitize the HTML whilst also highlighting its text nodes, to avoid accidentally trying\n // to highlight HTML tags themselves. However, this does mean that we don't highlight textnodes which\n // are interrupted by HTML tags (not that we did before) - e.g. foobar won't get highlighted\n // by an attempt to search for 'foobar'. Then again, the search query probably wouldn't work either\n try {\n if (highlights && highlights.length > 0) {\n var highlighter = new HtmlHighlighter(\"mx_EventTile_searchHighlight\", opts.highlightLink);\n var safeHighlights = highlights.map(function (highlight) {\n return (0, _sanitizeHtml2.default)(highlight, sanitizeParams);\n });\n // XXX: hacky bodge to temporarily apply a textFilter to the sanitizeParams structure.\n sanitizeParams.textFilter = function (safeText) {\n return highlighter.applyHighlights(safeText, safeHighlights).join('');\n };\n }\n\n var formattedBody = content.formatted_body;\n if (opts.stripReplyFallback && formattedBody) formattedBody = _ReplyThread2.default.stripHTMLReply(formattedBody);\n strippedBody = opts.stripReplyFallback ? _ReplyThread2.default.stripPlainReply(content.body) : content.body;\n\n if (doEmojiOne) {\n bodyHasEmoji = containsEmoji(isHtmlMessage ? formattedBody : content.body);\n }\n\n // Only generate safeBody if the message was sent as org.matrix.custom.html\n if (isHtmlMessage) {\n isDisplayedWithHtml = true;\n safeBody = (0, _sanitizeHtml2.default)(formattedBody, sanitizeParams);\n } else {\n // ... or if there are emoji, which we insert as HTML alongside the\n // escaped plaintext body.\n if (bodyHasEmoji) {\n isDisplayedWithHtml = true;\n safeBody = (0, _sanitizeHtml2.default)((0, _escape2.default)(strippedBody), sanitizeParams);\n }\n }\n\n // An HTML message with emoji\n // or a plaintext message with emoji that was escaped and sanitized into\n // HTML.\n if (bodyHasEmoji) {\n safeBody = unicodeToImage(safeBody);\n }\n } finally {\n delete sanitizeParams.textFilter;\n }\n\n if (opts.returnString) {\n return isDisplayedWithHtml ? safeBody : strippedBody;\n }\n\n var emojiBody = false;\n if (!opts.disableBigEmoji && bodyHasEmoji) {\n EMOJI_REGEX.lastIndex = 0;\n var contentBodyTrimmed = strippedBody !== undefined ? strippedBody.trim() : '';\n\n // Ignore spaces in body text. Emojis with spaces in between should\n // still be counted as purely emoji messages.\n contentBodyTrimmed = contentBodyTrimmed.replace(WHITESPACE_REGEX, '');\n\n // Remove zero width joiner characters from emoji messages. This ensures\n // that emojis that are made up of multiple unicode characters are still\n // presented as large.\n contentBodyTrimmed = contentBodyTrimmed.replace(ZWJ_REGEX, '');\n\n var match = EMOJI_REGEX.exec(contentBodyTrimmed);\n emojiBody = match && match[0] && match[0].length === contentBodyTrimmed.length;\n }\n\n var className = (0, _classnames2.default)({\n 'mx_EventTile_body': true,\n 'mx_EventTile_bigEmoji': emojiBody,\n 'markdown-body': isHtmlMessage\n });\n\n return isDisplayedWithHtml ? _react2.default.createElement('span', { className: className, dangerouslySetInnerHTML: { __html: safeBody }, dir: 'auto' }) : _react2.default.createElement(\n 'span',\n { className: className, dir: 'auto' },\n strippedBody\n );\n}\n\nfunction emojifyText(text, addAlt) {\n return {\n __html: unicodeToImage((0, _escape2.default)(text), addAlt)\n };\n}\n\n/**\n * Linkifies the given string. This is a wrapper around 'linkifyjs/string'.\n *\n * @param {string} str\n * @returns {string}\n */\nfunction linkifyString(str) {\n return (0, _string2.default)(str);\n}\n\n/**\n * Linkifies the given DOM element. This is a wrapper around 'linkifyjs/element'.\n *\n * @param {object} element DOM element to linkify\n * @param {object} [options] Options for linkifyElement. Default: linkifyMatrix.options\n * @returns {object}\n */\nfunction linkifyElement(element) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _linkifyMatrix2.default.options;\n\n return (0, _element2.default)(element, options);\n}\n\n/**\n * Linkify the given string and sanitize the HTML afterwards.\n *\n * @param {string} dirtyHtml The HTML string to sanitize and linkify\n * @returns {string}\n */\nfunction linkifyAndSanitizeHtml(dirtyHtml) {\n return (0, _sanitizeHtml2.default)(linkifyString(dirtyHtml), sanitizeHtmlParams);\n}\n//# sourceMappingURL=HtmlUtils.js.map","'use strict';\nif (require('./_descriptors')) {\n var LIBRARY = require('./_library');\n var global = require('./_global');\n var fails = require('./_fails');\n var $export = require('./_export');\n var $typed = require('./_typed');\n var $buffer = require('./_typed-buffer');\n var ctx = require('./_ctx');\n var anInstance = require('./_an-instance');\n var propertyDesc = require('./_property-desc');\n var hide = require('./_hide');\n var redefineAll = require('./_redefine-all');\n var toInteger = require('./_to-integer');\n var toLength = require('./_to-length');\n var toIndex = require('./_to-index');\n var toAbsoluteIndex = require('./_to-absolute-index');\n var toPrimitive = require('./_to-primitive');\n var has = require('./_has');\n var classof = require('./_classof');\n var isObject = require('./_is-object');\n var toObject = require('./_to-object');\n var isArrayIter = require('./_is-array-iter');\n var create = require('./_object-create');\n var getPrototypeOf = require('./_object-gpo');\n var gOPN = require('./_object-gopn').f;\n var getIterFn = require('./core.get-iterator-method');\n var uid = require('./_uid');\n var wks = require('./_wks');\n var createArrayMethod = require('./_array-methods');\n var createArrayIncludes = require('./_array-includes');\n var speciesConstructor = require('./_species-constructor');\n var ArrayIterators = require('./es6.array.iterator');\n var Iterators = require('./_iterators');\n var $iterDetect = require('./_iter-detect');\n var setSpecies = require('./_set-species');\n var arrayFill = require('./_array-fill');\n var arrayCopyWithin = require('./_array-copy-within');\n var $DP = require('./_object-dp');\n var $GOPD = require('./_object-gopd');\n var dP = $DP.f;\n var gOPD = $GOPD.f;\n var RangeError = global.RangeError;\n var TypeError = global.TypeError;\n var Uint8Array = global.Uint8Array;\n var ARRAY_BUFFER = 'ArrayBuffer';\n var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER;\n var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';\n var PROTOTYPE = 'prototype';\n var ArrayProto = Array[PROTOTYPE];\n var $ArrayBuffer = $buffer.ArrayBuffer;\n var $DataView = $buffer.DataView;\n var arrayForEach = createArrayMethod(0);\n var arrayFilter = createArrayMethod(2);\n var arraySome = createArrayMethod(3);\n var arrayEvery = createArrayMethod(4);\n var arrayFind = createArrayMethod(5);\n var arrayFindIndex = createArrayMethod(6);\n var arrayIncludes = createArrayIncludes(true);\n var arrayIndexOf = createArrayIncludes(false);\n var arrayValues = ArrayIterators.values;\n var arrayKeys = ArrayIterators.keys;\n var arrayEntries = ArrayIterators.entries;\n var arrayLastIndexOf = ArrayProto.lastIndexOf;\n var arrayReduce = ArrayProto.reduce;\n var arrayReduceRight = ArrayProto.reduceRight;\n var arrayJoin = ArrayProto.join;\n var arraySort = ArrayProto.sort;\n var arraySlice = ArrayProto.slice;\n var arrayToString = ArrayProto.toString;\n var arrayToLocaleString = ArrayProto.toLocaleString;\n var ITERATOR = wks('iterator');\n var TAG = wks('toStringTag');\n var TYPED_CONSTRUCTOR = uid('typed_constructor');\n var DEF_CONSTRUCTOR = uid('def_constructor');\n var ALL_CONSTRUCTORS = $typed.CONSTR;\n var TYPED_ARRAY = $typed.TYPED;\n var VIEW = $typed.VIEW;\n var WRONG_LENGTH = 'Wrong length!';\n\n var $map = createArrayMethod(1, function (O, length) {\n return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);\n });\n\n var LITTLE_ENDIAN = fails(function () {\n // eslint-disable-next-line no-undef\n return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;\n });\n\n var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () {\n new Uint8Array(1).set({});\n });\n\n var toOffset = function (it, BYTES) {\n var offset = toInteger(it);\n if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!');\n return offset;\n };\n\n var validate = function (it) {\n if (isObject(it) && TYPED_ARRAY in it) return it;\n throw TypeError(it + ' is not a typed array!');\n };\n\n var allocate = function (C, length) {\n if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) {\n throw TypeError('It is not a typed array constructor!');\n } return new C(length);\n };\n\n var speciesFromList = function (O, list) {\n return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);\n };\n\n var fromList = function (C, list) {\n var index = 0;\n var length = list.length;\n var result = allocate(C, length);\n while (length > index) result[index] = list[index++];\n return result;\n };\n\n var addGetter = function (it, key, internal) {\n dP(it, key, { get: function () { return this._d[internal]; } });\n };\n\n var $from = function from(source /* , mapfn, thisArg */) {\n var O = toObject(source);\n var aLen = arguments.length;\n var mapfn = aLen > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iterFn = getIterFn(O);\n var i, length, values, result, step, iterator;\n if (iterFn != undefined && !isArrayIter(iterFn)) {\n for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) {\n values.push(step.value);\n } O = values;\n }\n if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2);\n for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) {\n result[i] = mapping ? mapfn(O[i], i) : O[i];\n }\n return result;\n };\n\n var $of = function of(/* ...items */) {\n var index = 0;\n var length = arguments.length;\n var result = allocate(this, length);\n while (length > index) result[index] = arguments[index++];\n return result;\n };\n\n // iOS Safari 6.x fails here\n var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); });\n\n var $toLocaleString = function toLocaleString() {\n return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);\n };\n\n var proto = {\n copyWithin: function copyWithin(target, start /* , end */) {\n return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);\n },\n every: function every(callbackfn /* , thisArg */) {\n return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n },\n fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars\n return arrayFill.apply(validate(this), arguments);\n },\n filter: function filter(callbackfn /* , thisArg */) {\n return speciesFromList(this, arrayFilter(validate(this), callbackfn,\n arguments.length > 1 ? arguments[1] : undefined));\n },\n find: function find(predicate /* , thisArg */) {\n return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);\n },\n findIndex: function findIndex(predicate /* , thisArg */) {\n return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);\n },\n forEach: function forEach(callbackfn /* , thisArg */) {\n arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n },\n indexOf: function indexOf(searchElement /* , fromIndex */) {\n return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);\n },\n includes: function includes(searchElement /* , fromIndex */) {\n return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);\n },\n join: function join(separator) { // eslint-disable-line no-unused-vars\n return arrayJoin.apply(validate(this), arguments);\n },\n lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars\n return arrayLastIndexOf.apply(validate(this), arguments);\n },\n map: function map(mapfn /* , thisArg */) {\n return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);\n },\n reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars\n return arrayReduce.apply(validate(this), arguments);\n },\n reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars\n return arrayReduceRight.apply(validate(this), arguments);\n },\n reverse: function reverse() {\n var that = this;\n var length = validate(that).length;\n var middle = Math.floor(length / 2);\n var index = 0;\n var value;\n while (index < middle) {\n value = that[index];\n that[index++] = that[--length];\n that[length] = value;\n } return that;\n },\n some: function some(callbackfn /* , thisArg */) {\n return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n },\n sort: function sort(comparefn) {\n return arraySort.call(validate(this), comparefn);\n },\n subarray: function subarray(begin, end) {\n var O = validate(this);\n var length = O.length;\n var $begin = toAbsoluteIndex(begin, length);\n return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(\n O.buffer,\n O.byteOffset + $begin * O.BYTES_PER_ELEMENT,\n toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin)\n );\n }\n };\n\n var $slice = function slice(start, end) {\n return speciesFromList(this, arraySlice.call(validate(this), start, end));\n };\n\n var $set = function set(arrayLike /* , offset */) {\n validate(this);\n var offset = toOffset(arguments[1], 1);\n var length = this.length;\n var src = toObject(arrayLike);\n var len = toLength(src.length);\n var index = 0;\n if (len + offset > length) throw RangeError(WRONG_LENGTH);\n while (index < len) this[offset + index] = src[index++];\n };\n\n var $iterators = {\n entries: function entries() {\n return arrayEntries.call(validate(this));\n },\n keys: function keys() {\n return arrayKeys.call(validate(this));\n },\n values: function values() {\n return arrayValues.call(validate(this));\n }\n };\n\n var isTAIndex = function (target, key) {\n return isObject(target)\n && target[TYPED_ARRAY]\n && typeof key != 'symbol'\n && key in target\n && String(+key) == String(key);\n };\n var $getDesc = function getOwnPropertyDescriptor(target, key) {\n return isTAIndex(target, key = toPrimitive(key, true))\n ? propertyDesc(2, target[key])\n : gOPD(target, key);\n };\n var $setDesc = function defineProperty(target, key, desc) {\n if (isTAIndex(target, key = toPrimitive(key, true))\n && isObject(desc)\n && has(desc, 'value')\n && !has(desc, 'get')\n && !has(desc, 'set')\n // TODO: add validation descriptor w/o calling accessors\n && !desc.configurable\n && (!has(desc, 'writable') || desc.writable)\n && (!has(desc, 'enumerable') || desc.enumerable)\n ) {\n target[key] = desc.value;\n return target;\n } return dP(target, key, desc);\n };\n\n if (!ALL_CONSTRUCTORS) {\n $GOPD.f = $getDesc;\n $DP.f = $setDesc;\n }\n\n $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {\n getOwnPropertyDescriptor: $getDesc,\n defineProperty: $setDesc\n });\n\n if (fails(function () { arrayToString.call({}); })) {\n arrayToString = arrayToLocaleString = function toString() {\n return arrayJoin.call(this);\n };\n }\n\n var $TypedArrayPrototype$ = redefineAll({}, proto);\n redefineAll($TypedArrayPrototype$, $iterators);\n hide($TypedArrayPrototype$, ITERATOR, $iterators.values);\n redefineAll($TypedArrayPrototype$, {\n slice: $slice,\n set: $set,\n constructor: function () { /* noop */ },\n toString: arrayToString,\n toLocaleString: $toLocaleString\n });\n addGetter($TypedArrayPrototype$, 'buffer', 'b');\n addGetter($TypedArrayPrototype$, 'byteOffset', 'o');\n addGetter($TypedArrayPrototype$, 'byteLength', 'l');\n addGetter($TypedArrayPrototype$, 'length', 'e');\n dP($TypedArrayPrototype$, TAG, {\n get: function () { return this[TYPED_ARRAY]; }\n });\n\n // eslint-disable-next-line max-statements\n module.exports = function (KEY, BYTES, wrapper, CLAMPED) {\n CLAMPED = !!CLAMPED;\n var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array';\n var GETTER = 'get' + KEY;\n var SETTER = 'set' + KEY;\n var TypedArray = global[NAME];\n var Base = TypedArray || {};\n var TAC = TypedArray && getPrototypeOf(TypedArray);\n var FORCED = !TypedArray || !$typed.ABV;\n var O = {};\n var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];\n var getter = function (that, index) {\n var data = that._d;\n return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);\n };\n var setter = function (that, index, value) {\n var data = that._d;\n if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;\n data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);\n };\n var addElement = function (that, index) {\n dP(that, index, {\n get: function () {\n return getter(this, index);\n },\n set: function (value) {\n return setter(this, index, value);\n },\n enumerable: true\n });\n };\n if (FORCED) {\n TypedArray = wrapper(function (that, data, $offset, $length) {\n anInstance(that, TypedArray, NAME, '_d');\n var index = 0;\n var offset = 0;\n var buffer, byteLength, length, klass;\n if (!isObject(data)) {\n length = toIndex(data);\n byteLength = length * BYTES;\n buffer = new $ArrayBuffer(byteLength);\n } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {\n buffer = data;\n offset = toOffset($offset, BYTES);\n var $len = data.byteLength;\n if ($length === undefined) {\n if ($len % BYTES) throw RangeError(WRONG_LENGTH);\n byteLength = $len - offset;\n if (byteLength < 0) throw RangeError(WRONG_LENGTH);\n } else {\n byteLength = toLength($length) * BYTES;\n if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH);\n }\n length = byteLength / BYTES;\n } else if (TYPED_ARRAY in data) {\n return fromList(TypedArray, data);\n } else {\n return $from.call(TypedArray, data);\n }\n hide(that, '_d', {\n b: buffer,\n o: offset,\n l: byteLength,\n e: length,\n v: new $DataView(buffer)\n });\n while (index < length) addElement(that, index++);\n });\n TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);\n hide(TypedArrayPrototype, 'constructor', TypedArray);\n } else if (!fails(function () {\n TypedArray(1);\n }) || !fails(function () {\n new TypedArray(-1); // eslint-disable-line no-new\n }) || !$iterDetect(function (iter) {\n new TypedArray(); // eslint-disable-line no-new\n new TypedArray(null); // eslint-disable-line no-new\n new TypedArray(1.5); // eslint-disable-line no-new\n new TypedArray(iter); // eslint-disable-line no-new\n }, true)) {\n TypedArray = wrapper(function (that, data, $offset, $length) {\n anInstance(that, TypedArray, NAME);\n var klass;\n // `ws` module bug, temporarily remove validation length for Uint8Array\n // https://github.com/websockets/ws/pull/645\n if (!isObject(data)) return new Base(toIndex(data));\n if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {\n return $length !== undefined\n ? new Base(data, toOffset($offset, BYTES), $length)\n : $offset !== undefined\n ? new Base(data, toOffset($offset, BYTES))\n : new Base(data);\n }\n if (TYPED_ARRAY in data) return fromList(TypedArray, data);\n return $from.call(TypedArray, data);\n });\n arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) {\n if (!(key in TypedArray)) hide(TypedArray, key, Base[key]);\n });\n TypedArray[PROTOTYPE] = TypedArrayPrototype;\n if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray;\n }\n var $nativeIterator = TypedArrayPrototype[ITERATOR];\n var CORRECT_ITER_NAME = !!$nativeIterator\n && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined);\n var $iterator = $iterators.values;\n hide(TypedArray, TYPED_CONSTRUCTOR, true);\n hide(TypedArrayPrototype, TYPED_ARRAY, NAME);\n hide(TypedArrayPrototype, VIEW, true);\n hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);\n\n if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) {\n dP(TypedArrayPrototype, TAG, {\n get: function () { return NAME; }\n });\n }\n\n O[NAME] = TypedArray;\n\n $export($export.G + $export.W + $export.F * (TypedArray != Base), O);\n\n $export($export.S, NAME, {\n BYTES_PER_ELEMENT: BYTES\n });\n\n $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, {\n from: $from,\n of: $of\n });\n\n if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);\n\n $export($export.P, NAME, proto);\n\n setSpecies(NAME);\n\n $export($export.P + $export.F * FORCED_SET, NAME, { set: $set });\n\n $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);\n\n if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString;\n\n $export($export.P + $export.F * fails(function () {\n new TypedArray(1).slice();\n }), NAME, { slice: $slice });\n\n $export($export.P + $export.F * (fails(function () {\n return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString();\n }) || !fails(function () {\n TypedArrayPrototype.toLocaleString.call([1, 2]);\n })), NAME, { toLocaleString: $toLocaleString });\n\n Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;\n if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator);\n };\n} else module.exports = function () { /* empty */ };\n","var Map = require('./es6.map');\nvar $export = require('./_export');\nvar shared = require('./_shared')('metadata');\nvar store = shared.store || (shared.store = new (require('./es6.weak-map'))());\n\nvar getOrCreateMetadataMap = function (target, targetKey, create) {\n var targetMetadata = store.get(target);\n if (!targetMetadata) {\n if (!create) return undefined;\n store.set(target, targetMetadata = new Map());\n }\n var keyMetadata = targetMetadata.get(targetKey);\n if (!keyMetadata) {\n if (!create) return undefined;\n targetMetadata.set(targetKey, keyMetadata = new Map());\n } return keyMetadata;\n};\nvar ordinaryHasOwnMetadata = function (MetadataKey, O, P) {\n var metadataMap = getOrCreateMetadataMap(O, P, false);\n return metadataMap === undefined ? false : metadataMap.has(MetadataKey);\n};\nvar ordinaryGetOwnMetadata = function (MetadataKey, O, P) {\n var metadataMap = getOrCreateMetadataMap(O, P, false);\n return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);\n};\nvar ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) {\n getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);\n};\nvar ordinaryOwnMetadataKeys = function (target, targetKey) {\n var metadataMap = getOrCreateMetadataMap(target, targetKey, false);\n var keys = [];\n if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); });\n return keys;\n};\nvar toMetaKey = function (it) {\n return it === undefined || typeof it == 'symbol' ? it : String(it);\n};\nvar exp = function (O) {\n $export($export.S, 'Reflect', O);\n};\n\nmodule.exports = {\n store: store,\n map: getOrCreateMetadataMap,\n has: ordinaryHasOwnMetadata,\n get: ordinaryGetOwnMetadata,\n set: ordinaryDefineOwnMetadata,\n keys: ordinaryOwnMetadataKeys,\n key: toMetaKey,\n exp: exp\n};\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2018 Denis Pushkarev (zloirock.ru)'\n});\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","exports.f = {}.propertyIsEnumerable;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use strict';\n\n/**\n * Keeps track of the current owner.\n *\n * The current owner is the component who should own any components that are\n * currently being constructed.\n */\nvar ReactCurrentOwner = {\n /**\n * @internal\n * @type {ReactComponent}\n */\n current: null\n};\n\nmodule.exports = ReactCurrentOwner;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar _assign = require('object-assign');\n\nvar PooledClass = require('./PooledClass');\n\nvar emptyFunction = require('fbjs/lib/emptyFunction');\nvar warning = require('fbjs/lib/warning');\n\nvar didWarnForAddedNewProperty = false;\nvar isProxySupported = typeof Proxy === 'function';\n\nvar shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];\n\n/**\n * @interface Event\n * @see http://www.w3.org/TR/DOM-Level-3-Events/\n */\nvar EventInterface = {\n type: null,\n target: null,\n // currentTarget is set when dispatching; no use in copying it here\n currentTarget: emptyFunction.thatReturnsNull,\n eventPhase: null,\n bubbles: null,\n cancelable: null,\n timeStamp: function (event) {\n return event.timeStamp || Date.now();\n },\n defaultPrevented: null,\n isTrusted: null\n};\n\n/**\n * Synthetic events are dispatched by event plugins, typically in response to a\n * top-level event delegation handler.\n *\n * These systems should generally use pooling to reduce the frequency of garbage\n * collection. The system should check `isPersistent` to determine whether the\n * event should be released into the pool after being dispatched. Users that\n * need a persisted event should invoke `persist`.\n *\n * Synthetic events (and subclasses) implement the DOM Level 3 Events API by\n * normalizing browser quirks. Subclasses do not necessarily have to implement a\n * DOM interface; custom application-specific events can also subclass this.\n *\n * @param {object} dispatchConfig Configuration used to dispatch this event.\n * @param {*} targetInst Marker identifying the event target.\n * @param {object} nativeEvent Native browser event.\n * @param {DOMEventTarget} nativeEventTarget Target node.\n */\nfunction SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {\n if (process.env.NODE_ENV !== 'production') {\n // these have a getter/setter for warnings\n delete this.nativeEvent;\n delete this.preventDefault;\n delete this.stopPropagation;\n }\n\n this.dispatchConfig = dispatchConfig;\n this._targetInst = targetInst;\n this.nativeEvent = nativeEvent;\n\n var Interface = this.constructor.Interface;\n for (var propName in Interface) {\n if (!Interface.hasOwnProperty(propName)) {\n continue;\n }\n if (process.env.NODE_ENV !== 'production') {\n delete this[propName]; // this has a getter/setter for warnings\n }\n var normalize = Interface[propName];\n if (normalize) {\n this[propName] = normalize(nativeEvent);\n } else {\n if (propName === 'target') {\n this.target = nativeEventTarget;\n } else {\n this[propName] = nativeEvent[propName];\n }\n }\n }\n\n var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;\n if (defaultPrevented) {\n this.isDefaultPrevented = emptyFunction.thatReturnsTrue;\n } else {\n this.isDefaultPrevented = emptyFunction.thatReturnsFalse;\n }\n this.isPropagationStopped = emptyFunction.thatReturnsFalse;\n return this;\n}\n\n_assign(SyntheticEvent.prototype, {\n preventDefault: function () {\n this.defaultPrevented = true;\n var event = this.nativeEvent;\n if (!event) {\n return;\n }\n\n if (event.preventDefault) {\n event.preventDefault();\n // eslint-disable-next-line valid-typeof\n } else if (typeof event.returnValue !== 'unknown') {\n event.returnValue = false;\n }\n this.isDefaultPrevented = emptyFunction.thatReturnsTrue;\n },\n\n stopPropagation: function () {\n var event = this.nativeEvent;\n if (!event) {\n return;\n }\n\n if (event.stopPropagation) {\n event.stopPropagation();\n // eslint-disable-next-line valid-typeof\n } else if (typeof event.cancelBubble !== 'unknown') {\n // The ChangeEventPlugin registers a \"propertychange\" event for\n // IE. This event does not support bubbling or cancelling, and\n // any references to cancelBubble throw \"Member not found\". A\n // typeof check of \"unknown\" circumvents this issue (and is also\n // IE specific).\n event.cancelBubble = true;\n }\n\n this.isPropagationStopped = emptyFunction.thatReturnsTrue;\n },\n\n /**\n * We release all dispatched `SyntheticEvent`s after each event loop, adding\n * them back into the pool. This allows a way to hold onto a reference that\n * won't be added back into the pool.\n */\n persist: function () {\n this.isPersistent = emptyFunction.thatReturnsTrue;\n },\n\n /**\n * Checks if this event should be released back into the pool.\n *\n * @return {boolean} True if this should not be released, false otherwise.\n */\n isPersistent: emptyFunction.thatReturnsFalse,\n\n /**\n * `PooledClass` looks for `destructor` on each instance it releases.\n */\n destructor: function () {\n var Interface = this.constructor.Interface;\n for (var propName in Interface) {\n if (process.env.NODE_ENV !== 'production') {\n Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));\n } else {\n this[propName] = null;\n }\n }\n for (var i = 0; i < shouldBeReleasedProperties.length; i++) {\n this[shouldBeReleasedProperties[i]] = null;\n }\n if (process.env.NODE_ENV !== 'production') {\n Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));\n Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));\n Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));\n }\n }\n});\n\nSyntheticEvent.Interface = EventInterface;\n\n/**\n * Helper to reduce boilerplate when creating subclasses.\n *\n * @param {function} Class\n * @param {?object} Interface\n */\nSyntheticEvent.augmentClass = function (Class, Interface) {\n var Super = this;\n\n var E = function () {};\n E.prototype = Super.prototype;\n var prototype = new E();\n\n _assign(prototype, Class.prototype);\n Class.prototype = prototype;\n Class.prototype.constructor = Class;\n\n Class.Interface = _assign({}, Super.Interface, Interface);\n Class.augmentClass = Super.augmentClass;\n\n PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);\n};\n\n/** Proxying after everything set on SyntheticEvent\n * to resolve Proxy issue on some WebKit browsers\n * in which some Event properties are set to undefined (GH#10010)\n */\nif (process.env.NODE_ENV !== 'production') {\n if (isProxySupported) {\n /*eslint-disable no-func-assign */\n SyntheticEvent = new Proxy(SyntheticEvent, {\n construct: function (target, args) {\n return this.apply(target, Object.create(target.prototype), args);\n },\n apply: function (constructor, that, args) {\n return new Proxy(constructor.apply(that, args), {\n set: function (target, prop, value) {\n if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {\n process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), \"This synthetic event is reused for performance reasons. If you're \" + \"seeing this, you're adding a new property in the synthetic event object. \" + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;\n didWarnForAddedNewProperty = true;\n }\n target[prop] = value;\n return true;\n }\n });\n }\n });\n /*eslint-enable no-func-assign */\n }\n}\n\nPooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);\n\nmodule.exports = SyntheticEvent;\n\n/**\n * Helper to nullify syntheticEvent instance properties when destructing\n *\n * @param {object} SyntheticEvent\n * @param {String} propName\n * @return {object} defineProperty object\n */\nfunction getPooledWarningPropertyDefinition(propName, getVal) {\n var isFunction = typeof getVal === 'function';\n return {\n configurable: true,\n set: set,\n get: get\n };\n\n function set(val) {\n var action = isFunction ? 'setting the method' : 'setting the property';\n warn(action, 'This is effectively a no-op');\n return val;\n }\n\n function get() {\n var action = isFunction ? 'accessing the method' : 'accessing the property';\n var result = isFunction ? 'This is a no-op function' : 'This is set to null';\n warn(action, result);\n return getVal;\n }\n\n function warn(action, result) {\n var warningCondition = false;\n process.env.NODE_ENV !== 'production' ? warning(warningCondition, \"This synthetic event is reused for performance reasons. If you're seeing this, \" + \"you're %s `%s` on a released/nullified synthetic event. %s. \" + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;\n }\n}","/*\nCopyright 2015, 2016 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\"use strict\";\n\n/**\n * This is an internal module. See {@link MatrixEvent} and {@link RoomEvent} for\n * the public classes.\n * @module models/event\n */\n\nvar _regenerator = require('babel-runtime/regenerator');\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _bluebird = require('bluebird');\n\nvar _bluebird2 = _interopRequireDefault(_bluebird);\n\nvar _events = require('events');\n\nvar _utils = require('../utils.js');\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Enum for event statuses.\n * @readonly\n * @enum {string}\n */\nmodule.exports.EventStatus = {\n /** The event was not sent and will no longer be retried. */\n NOT_SENT: \"not_sent\",\n\n /** The message is being encrypted */\n ENCRYPTING: \"encrypting\",\n\n /** The event is in the process of being sent. */\n SENDING: \"sending\",\n /** The event is in a queue waiting to be sent. */\n QUEUED: \"queued\",\n /** The event has been sent to the server, but we have not yet received the\n * echo. */\n SENT: \"sent\",\n\n /** The event was cancelled before it was successfully sent. */\n CANCELLED: \"cancelled\"\n};\n\nvar interns = {};\n\n/**\n * Construct a Matrix Event object\n * @constructor\n *\n * @param {Object} event The raw event to be wrapped in this DAO\n *\n * @prop {Object} event The raw (possibly encrypted) event. Do not access\n * this property directly unless you absolutely have to. Prefer the getter\n * methods defined on this class. Using the getter methods shields your app\n * from changes to event JSON between Matrix versions.\n *\n * @prop {RoomMember} sender The room member who sent this event, or null e.g.\n * this is a presence event. This is only guaranteed to be set for events that\n * appear in a timeline, ie. do not guarantee that it will be set on state\n * events.\n * @prop {RoomMember} target The room member who is the target of this event, e.g.\n * the invitee, the person being banned, etc.\n * @prop {EventStatus} status The sending status of the event.\n * @prop {Error} error most recent error associated with sending the event, if any\n * @prop {boolean} forwardLooking True if this event is 'forward looking', meaning\n * that getDirectionalContent() will return event.content and not event.prev_content.\n * Default: true. This property is experimental and may change.\n */\nmodule.exports.MatrixEvent = function MatrixEvent(event) {\n // intern the values of matrix events to force share strings and reduce the\n // amount of needless string duplication. This can save moderate amounts of\n // memory (~10% on a 350MB heap).\n // 'membership' at the event level (rather than the content level) is a legacy\n // field that Riot never otherwise looks at, but it will still take up a lot\n // of space if we don't intern it.\n [\"state_key\", \"type\", \"sender\", \"room_id\", \"membership\"].forEach(function (prop) {\n if (!event[prop]) {\n return;\n }\n if (!interns[event[prop]]) {\n interns[event[prop]] = event[prop];\n }\n event[prop] = interns[event[prop]];\n });\n\n [\"membership\", \"avatar_url\", \"displayname\"].forEach(function (prop) {\n if (!event.content || !event.content[prop]) {\n return;\n }\n if (!interns[event.content[prop]]) {\n interns[event.content[prop]] = event.content[prop];\n }\n event.content[prop] = interns[event.content[prop]];\n });\n\n this.event = event || {};\n\n this.sender = null;\n this.target = null;\n this.status = null;\n this.error = null;\n this.forwardLooking = true;\n this._pushActions = null;\n\n this._clearEvent = {};\n\n /* curve25519 key which we believe belongs to the sender of the event. See\n * getSenderKey()\n */\n this._senderCurve25519Key = null;\n\n /* ed25519 key which the sender of this event (for olm) or the creator of\n * the megolm session (for megolm) claims to own. See getClaimedEd25519Key()\n */\n this._claimedEd25519Key = null;\n\n /* curve25519 keys of devices involved in telling us about the\n * _senderCurve25519Key and _claimedEd25519Key.\n * See getForwardingCurve25519KeyChain().\n */\n this._forwardingCurve25519KeyChain = [];\n\n /* if we have a process decrypting this event, a Promise which resolves\n * when it is finished. Normally null.\n */\n this._decryptionPromise = null;\n\n /* flag to indicate if we should retry decrypting this event after the\n * first attempt (eg, we have received new data which means that a second\n * attempt may succeed)\n */\n this._retryDecryption = false;\n};\n_utils2.default.inherits(module.exports.MatrixEvent, _events.EventEmitter);\n\n_utils2.default.extend(module.exports.MatrixEvent.prototype, {\n\n /**\n * Get the event_id for this event.\n * @return {string} The event ID, e.g. $143350589368169JsLZx:localhost\n *
\n */\n getId: function getId() {\n return this.event.event_id;\n },\n\n /**\n * Get the user_id for this event.\n * @return {string} The user ID, e.g. @alice:matrix.org
\n */\n getSender: function getSender() {\n return this.event.sender || this.event.user_id; // v2 / v1\n },\n\n /**\n * Get the (decrypted, if necessary) type of event.\n *\n * @return {string} The event type, e.g. m.room.message
\n */\n getType: function getType() {\n return this._clearEvent.type || this.event.type;\n },\n\n /**\n * Get the (possibly encrypted) type of the event that will be sent to the\n * homeserver.\n *\n * @return {string} The event type.\n */\n getWireType: function getWireType() {\n return this.event.type;\n },\n\n /**\n * Get the room_id for this event. This will return undefined
\n * for m.presence
events.\n * @return {string} The room ID, e.g. !cURbafjkfsMDVwdRDQ:matrix.org\n *
\n */\n getRoomId: function getRoomId() {\n return this.event.room_id;\n },\n\n /**\n * Get the timestamp of this event.\n * @return {Number} The event timestamp, e.g. 1433502692297
\n */\n getTs: function getTs() {\n return this.event.origin_server_ts;\n },\n\n /**\n * Get the timestamp of this event, as a Date object.\n * @return {Date} The event date, e.g. new Date(1433502692297)
\n */\n getDate: function getDate() {\n return this.event.origin_server_ts ? new Date(this.event.origin_server_ts) : null;\n },\n\n /**\n * Get the (decrypted, if necessary) event content JSON.\n *\n * @return {Object} The event content JSON, or an empty object.\n */\n getContent: function getContent() {\n return this._clearEvent.content || this.event.content || {};\n },\n\n /**\n * Get the (possibly encrypted) event content JSON that will be sent to the\n * homeserver.\n *\n * @return {Object} The event content JSON, or an empty object.\n */\n getWireContent: function getWireContent() {\n return this.event.content || {};\n },\n\n /**\n * Get the previous event content JSON. This will only return something for\n * state events which exist in the timeline.\n * @return {Object} The previous event content JSON, or an empty object.\n */\n getPrevContent: function getPrevContent() {\n // v2 then v1 then default\n return this.getUnsigned().prev_content || this.event.prev_content || {};\n },\n\n /**\n * Get either 'content' or 'prev_content' depending on if this event is\n * 'forward-looking' or not. This can be modified via event.forwardLooking.\n * In practice, this means we get the chronologically earlier content value\n * for this event (this method should surely be called getEarlierContent)\n * This method is experimental and may change.\n * @return {Object} event.content if this event is forward-looking, else\n * event.prev_content.\n */\n getDirectionalContent: function getDirectionalContent() {\n return this.forwardLooking ? this.getContent() : this.getPrevContent();\n },\n\n /**\n * Get the age of this event. This represents the age of the event when the\n * event arrived at the device, and not the age of the event when this\n * function was called.\n * @return {Number} The age of this event in milliseconds.\n */\n getAge: function getAge() {\n return this.getUnsigned().age || this.event.age; // v2 / v1\n },\n\n /**\n * Get the event state_key if it has one. This will return undefined\n *
for message events.\n * @return {string} The event's state_key
.\n */\n getStateKey: function getStateKey() {\n return this.event.state_key;\n },\n\n /**\n * Check if this event is a state event.\n * @return {boolean} True if this is a state event.\n */\n isState: function isState() {\n return this.event.state_key !== undefined;\n },\n\n /**\n * Replace the content of this event with encrypted versions.\n * (This is used when sending an event; it should not be used by applications).\n *\n * @internal\n *\n * @param {string} crypto_type type of the encrypted event - typically\n * \"m.room.encrypted\"\n *\n * @param {object} crypto_content raw 'content' for the encrypted event.\n *\n * @param {string} senderCurve25519Key curve25519 key to record for the\n * sender of this event.\n * See {@link module:models/event.MatrixEvent#getSenderKey}.\n *\n * @param {string} claimedEd25519Key claimed ed25519 key to record for the\n * sender if this event.\n * See {@link module:models/event.MatrixEvent#getClaimedEd25519Key}\n */\n makeEncrypted: function makeEncrypted(crypto_type, crypto_content, senderCurve25519Key, claimedEd25519Key) {\n // keep the plain-text data for 'view source'\n this._clearEvent = {\n type: this.event.type,\n content: this.event.content\n };\n this.event.type = crypto_type;\n this.event.content = crypto_content;\n this._senderCurve25519Key = senderCurve25519Key;\n this._claimedEd25519Key = claimedEd25519Key;\n },\n\n /**\n * Check if this event is currently being decrypted.\n *\n * @return {boolean} True if this event is currently being decrypted, else false.\n */\n isBeingDecrypted: function isBeingDecrypted() {\n return this._decryptionPromise != null;\n },\n\n /**\n * Check if this event is an encrypted event which we failed to decrypt\n *\n * (This implies that we might retry decryption at some point in the future)\n *\n * @return {boolean} True if this event is an encrypted event which we\n * couldn't decrypt.\n */\n isDecryptionFailure: function isDecryptionFailure() {\n return this._clearEvent && this._clearEvent.content && this._clearEvent.content.msgtype === \"m.bad.encrypted\";\n },\n\n /**\n * Start the process of trying to decrypt this event.\n *\n * (This is used within the SDK: it isn't intended for use by applications)\n *\n * @internal\n *\n * @param {module:crypto} crypto crypto module\n *\n * @returns {Promise} promise which resolves (to undefined) when the decryption\n * attempt is completed.\n */\n attemptDecryption: function () {\n var _ref = (0, _bluebird.method)(function (crypto) {\n // start with a couple of sanity checks.\n if (!this.isEncrypted()) {\n throw new Error(\"Attempt to decrypt event which isn't encrypted\");\n }\n\n if (this._clearEvent && this._clearEvent.content && this._clearEvent.content.msgtype !== \"m.bad.encrypted\") {\n // we may want to just ignore this? let's start with rejecting it.\n throw new Error(\"Attempt to decrypt event which has already been encrypted\");\n }\n\n // if we already have a decryption attempt in progress, then it may\n // fail because it was using outdated info. We now have reason to\n // succeed where it failed before, but we don't want to have multiple\n // attempts going at the same time, so just set a flag that says we have\n // new info.\n //\n if (this._decryptionPromise) {\n console.log('Event ' + this.getId() + ' already being decrypted; queueing a retry');\n this._retryDecryption = true;\n return this._decryptionPromise;\n }\n\n this._decryptionPromise = this._decryptionLoop(crypto);\n return this._decryptionPromise;\n });\n\n function attemptDecryption(_x) {\n return _ref.apply(this, arguments);\n }\n\n return attemptDecryption;\n }(),\n\n /**\n * Cancel any room key request for this event and resend another.\n *\n * @param {module:crypto} crypto crypto module\n * @param {string} userId the user who received this event\n *\n * @returns {Promise} a promise that resolves when the request is queued\n */\n cancelAndResendKeyRequest: function cancelAndResendKeyRequest(crypto, userId) {\n var wireContent = this.getWireContent();\n return crypto.requestRoomKey({\n algorithm: wireContent.algorithm,\n room_id: this.getRoomId(),\n session_id: wireContent.session_id,\n sender_key: wireContent.sender_key\n }, this.getKeyRequestRecipients(userId), true);\n },\n\n /**\n * Calculate the recipients for keyshare requests.\n *\n * @param {string} userId the user who received this event.\n *\n * @returns {Array} array of recipients\n */\n getKeyRequestRecipients: function getKeyRequestRecipients(userId) {\n // send the request to all of our own devices, and the\n // original sending device if it wasn't us.\n var wireContent = this.getWireContent();\n var recipients = [{\n userId: userId, deviceId: '*'\n }];\n var sender = this.getSender();\n if (sender !== userId) {\n recipients.push({\n userId: sender, deviceId: wireContent.device_id\n });\n }\n return recipients;\n },\n\n _decryptionLoop: function () {\n var _ref2 = (0, _bluebird.coroutine)( /*#__PURE__*/_regenerator2.default.mark(function _callee(crypto) {\n var res, err;\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return (0, _bluebird.resolve)(_bluebird2.default.resolve());\n\n case 2:\n if (!true) {\n _context.next = 37;\n break;\n }\n\n this._retryDecryption = false;\n\n res = void 0;\n err = void 0;\n _context.prev = 6;\n\n if (crypto) {\n _context.next = 11;\n break;\n }\n\n res = this._badEncryptedMessage(\"Encryption not enabled\");\n _context.next = 14;\n break;\n\n case 11:\n _context.next = 13;\n return (0, _bluebird.resolve)(crypto.decryptEvent(this));\n\n case 13:\n res = _context.sent;\n\n case 14:\n _context.next = 29;\n break;\n\n case 16:\n _context.prev = 16;\n _context.t0 = _context['catch'](6);\n\n if (!(_context.t0.name !== \"DecryptionError\")) {\n _context.next = 23;\n break;\n }\n\n // not a decryption error: log the whole exception as an error\n // (and don't bother with a retry)\n console.error('Error decrypting event (id=' + this.getId() + '): ' + (_context.t0.stack || _context.t0));\n this._decryptionPromise = null;\n this._retryDecryption = false;\n return _context.abrupt('return');\n\n case 23:\n\n err = _context.t0;\n\n // see if we have a retry queued.\n //\n // NB: make sure to keep this check in the same tick of the\n // event loop as `_decryptionPromise = null` below - otherwise we\n // risk a race:\n //\n // * A: we check _retryDecryption here and see that it is\n // false\n // * B: we get a second call to attemptDecryption, which sees\n // that _decryptionPromise is set so sets\n // _retryDecryption\n // * A: we continue below, clear _decryptionPromise, and\n // never do the retry.\n //\n\n if (!this._retryDecryption) {\n _context.next = 27;\n break;\n }\n\n // decryption error, but we have a retry queued.\n console.log('Got error decrypting event (id=' + this.getId() + ': ' + (_context.t0 + '), but retrying'));\n return _context.abrupt('continue', 2);\n\n case 27:\n\n // decryption error, no retries queued. Warn about the error and\n // set it to m.bad.encrypted.\n console.warn('Error decrypting event (id=' + this.getId() + '): ' + _context.t0.detailedString);\n\n res = this._badEncryptedMessage(_context.t0.message);\n\n case 29:\n\n // at this point, we've either successfully decrypted the event, or have given up\n // (and set res to a 'badEncryptedMessage'). Either way, we can now set the\n // cleartext of the event and raise Event.decrypted.\n //\n // make sure we clear '_decryptionPromise' before sending the 'Event.decrypted' event,\n // otherwise the app will be confused to see `isBeingDecrypted` still set when\n // there isn't an `Event.decrypted` on the way.\n //\n // see also notes on _retryDecryption above.\n //\n this._decryptionPromise = null;\n this._retryDecryption = false;\n this._setClearData(res);\n\n // Before we emit the event, clear the push actions so that they can be recalculated\n // by relevant code. We do this because the clear event has now changed, making it\n // so that existing rules can be re-run over the applicable properties. Stuff like\n // highlighting when the user's name is mentioned rely on this happening. We also want\n // to set the push actions before emitting so that any notification listeners don't\n // pick up the wrong contents.\n this.setPushActions(null);\n\n this.emit(\"Event.decrypted\", this, err);\n\n return _context.abrupt('return');\n\n case 37:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this, [[6, 16]]);\n }));\n\n function _decryptionLoop(_x2) {\n return _ref2.apply(this, arguments);\n }\n\n return _decryptionLoop;\n }(),\n\n _badEncryptedMessage: function _badEncryptedMessage(reason) {\n return {\n clearEvent: {\n type: \"m.room.message\",\n content: {\n msgtype: \"m.bad.encrypted\",\n body: \"** Unable to decrypt: \" + reason + \" **\"\n }\n }\n };\n },\n\n /**\n * Update the cleartext data on this event.\n *\n * (This is used after decrypting an event; it should not be used by applications).\n *\n * @internal\n *\n * @fires module:models/event.MatrixEvent#\"Event.decrypted\"\n *\n * @param {module:crypto~EventDecryptionResult} decryptionResult\n * the decryption result, including the plaintext and some key info\n */\n _setClearData: function _setClearData(decryptionResult) {\n this._clearEvent = decryptionResult.clearEvent;\n this._senderCurve25519Key = decryptionResult.senderCurve25519Key || null;\n this._claimedEd25519Key = decryptionResult.claimedEd25519Key || null;\n this._forwardingCurve25519KeyChain = decryptionResult.forwardingCurve25519KeyChain || [];\n },\n\n /**\n * Gets the cleartext content for this event. If the event is not encrypted,\n * or encryption has not been completed, this will return null.\n *\n * @returns {Object} The cleartext (decrypted) content for the event\n */\n getClearContent: function getClearContent() {\n var ev = this._clearEvent;\n return ev && ev.content ? ev.content : null;\n },\n\n /**\n * Check if the event is encrypted.\n * @return {boolean} True if this event is encrypted.\n */\n isEncrypted: function isEncrypted() {\n return this.event.type === \"m.room.encrypted\";\n },\n\n /**\n * The curve25519 key for the device that we think sent this event\n *\n * For an Olm-encrypted event, this is inferred directly from the DH\n * exchange at the start of the session: the curve25519 key is involved in\n * the DH exchange, so only a device which holds the private part of that\n * key can establish such a session.\n *\n * For a megolm-encrypted event, it is inferred from the Olm message which\n * established the megolm session\n *\n * @return {string}\n */\n getSenderKey: function getSenderKey() {\n return this._senderCurve25519Key;\n },\n\n /**\n * The additional keys the sender of this encrypted event claims to possess.\n *\n * Just a wrapper for #getClaimedEd25519Key (q.v.)\n *\n * @return {Object}\n */\n getKeysClaimed: function getKeysClaimed() {\n return {\n ed25519: this._claimedEd25519Key\n };\n },\n\n /**\n * Get the ed25519 the sender of this event claims to own.\n *\n * For Olm messages, this claim is encoded directly in the plaintext of the\n * event itself. For megolm messages, it is implied by the m.room_key event\n * which established the megolm session.\n *\n * Until we download the device list of the sender, it's just a claim: the\n * device list gives a proof that the owner of the curve25519 key used for\n * this event (and returned by #getSenderKey) also owns the ed25519 key by\n * signing the public curve25519 key with the ed25519 key.\n *\n * In general, applications should not use this method directly, but should\n * instead use MatrixClient.getEventSenderDeviceInfo.\n *\n * @return {string}\n */\n getClaimedEd25519Key: function getClaimedEd25519Key() {\n return this._claimedEd25519Key;\n },\n\n /**\n * Get the curve25519 keys of the devices which were involved in telling us\n * about the claimedEd25519Key and sender curve25519 key.\n *\n * Normally this will be empty, but in the case of a forwarded megolm\n * session, the sender keys are sent to us by another device (the forwarding\n * device), which we need to trust to do this. In that case, the result will\n * be a list consisting of one entry.\n *\n * If the device that sent us the key (A) got it from another device which\n * it wasn't prepared to vouch for (B), the result will be [A, B]. And so on.\n *\n * @return {string[]} base64-encoded curve25519 keys, from oldest to newest.\n */\n getForwardingCurve25519KeyChain: function getForwardingCurve25519KeyChain() {\n return this._forwardingCurve25519KeyChain;\n },\n\n getUnsigned: function getUnsigned() {\n return this.event.unsigned || {};\n },\n\n /**\n * Update the content of an event in the same way it would be by the server\n * if it were redacted before it was sent to us\n *\n * @param {module:models/event.MatrixEvent} redaction_event\n * event causing the redaction\n */\n makeRedacted: function makeRedacted(redaction_event) {\n // quick sanity-check\n if (!redaction_event.event) {\n throw new Error(\"invalid redaction_event in makeRedacted\");\n }\n\n // we attempt to replicate what we would see from the server if\n // the event had been redacted before we saw it.\n //\n // The server removes (most of) the content of the event, and adds a\n // \"redacted_because\" key to the unsigned section containing the\n // redacted event.\n if (!this.event.unsigned) {\n this.event.unsigned = {};\n }\n this.event.unsigned.redacted_because = redaction_event.event;\n\n var key = void 0;\n for (key in this.event) {\n if (!this.event.hasOwnProperty(key)) {\n continue;\n }\n if (!_REDACT_KEEP_KEY_MAP[key]) {\n delete this.event[key];\n }\n }\n\n var keeps = _REDACT_KEEP_CONTENT_MAP[this.getType()] || {};\n var content = this.getContent();\n for (key in content) {\n if (!content.hasOwnProperty(key)) {\n continue;\n }\n if (!keeps[key]) {\n delete content[key];\n }\n }\n },\n\n /**\n * Check if this event has been redacted\n *\n * @return {boolean} True if this event has been redacted\n */\n isRedacted: function isRedacted() {\n return Boolean(this.getUnsigned().redacted_because);\n },\n\n /**\n * Get the push actions, if known, for this event\n *\n * @return {?Object} push actions\n */\n getPushActions: function getPushActions() {\n return this._pushActions;\n },\n\n /**\n * Set the push actions for this event.\n *\n * @param {Object} pushActions push actions\n */\n setPushActions: function setPushActions(pushActions) {\n this._pushActions = pushActions;\n },\n\n /**\n * Replace the `event` property and recalculate any properties based on it.\n * @param {Object} event the object to assign to the `event` property\n */\n handleRemoteEcho: function handleRemoteEcho(event) {\n this.event = event;\n // successfully sent.\n this.status = null;\n }\n});\n\n/* _REDACT_KEEP_KEY_MAP gives the keys we keep when an event is redacted\n *\n * This is specified here:\n * http://matrix.org/speculator/spec/HEAD/client_server/unstable.html#redactions\n *\n * Also:\n * - We keep 'unsigned' since that is created by the local server\n * - We keep user_id for backwards-compat with v1\n */\nvar _REDACT_KEEP_KEY_MAP = ['event_id', 'type', 'room_id', 'user_id', 'sender', 'state_key', 'prev_state', 'content', 'unsigned', 'origin_server_ts'].reduce(function (ret, val) {\n ret[val] = 1;return ret;\n}, {});\n\n// a map from event type to the .content keys we keep when an event is redacted\nvar _REDACT_KEEP_CONTENT_MAP = {\n 'm.room.member': { 'membership': 1 },\n 'm.room.create': { 'creator': 1 },\n 'm.room.join_rules': { 'join_rule': 1 },\n 'm.room.power_levels': { 'ban': 1, 'events': 1, 'events_default': 1,\n 'kick': 1, 'redact': 1, 'state_default': 1,\n 'users': 1, 'users_default': 1\n },\n 'm.room.aliases': { 'aliases': 1 }\n};\n\n/**\n * Fires when an event is decrypted\n *\n * @event module:models/event.MatrixEvent#\"Event.decrypted\"\n *\n * @param {module:models/event.MatrixEvent} event\n * The matrix event which has been decrypted\n * @param {module:crypto/algorithms/base.DecryptionError?} err\n * The error that occured during decryption, or `undefined` if no\n * error occured.\n */\n//# sourceMappingURL=event.js.map","'use strict';\n\nvar _keys = require('babel-runtime/core-js/object/keys');\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nvar _regenerator = require('babel-runtime/regenerator');\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _bluebird = require('bluebird');\n\nvar _startCallApp = function () {\n var _ref = (0, _bluebird.coroutine)( /*#__PURE__*/_regenerator2.default.mark(function _callee(roomId, type) {\n var scalarClient, haveScalar, ErrorDialog, room, currentRoomWidgets, _ErrorDialog3, currentJitsiWidgets, _ErrorDialog4, widgetSessionId, confId, queryString, widgetUrl, widgetData, widgetId;\n\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n // check for a working intgrations manager. Technically we could put\n // the state event in anyway, but the resulting widget would then not\n // work for us. Better that the user knows before everyone else in the\n // room sees it.\n scalarClient = new _ScalarAuthClient2.default();\n haveScalar = false;\n _context.prev = 2;\n _context.next = 5;\n return (0, _bluebird.resolve)(scalarClient.connect());\n\n case 5:\n haveScalar = scalarClient.hasCredentials();\n _context.next = 10;\n break;\n\n case 8:\n _context.prev = 8;\n _context.t0 = _context['catch'](2);\n\n case 10:\n if (haveScalar) {\n _context.next = 14;\n break;\n }\n\n ErrorDialog = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n\n\n _Modal2.default.createTrackedDialog('Could not connect to the integration server', '', ErrorDialog, {\n title: (0, _languageHandler._t)('Could not connect to the integration server'),\n description: (0, _languageHandler._t)('A conference call could not be started because the intgrations server is not available')\n });\n return _context.abrupt('return');\n\n case 14:\n\n _dispatcher2.default.dispatch({\n action: 'appsDrawer',\n show: true\n });\n\n room = _MatrixClientPeg2.default.get().getRoom(roomId);\n currentRoomWidgets = _WidgetUtils2.default.getRoomWidgets(room);\n\n if (!_WidgetEchoStore2.default.roomHasPendingWidgetsOfType(roomId, currentRoomWidgets, 'jitsi')) {\n _context.next = 21;\n break;\n }\n\n _ErrorDialog3 = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n\n\n _Modal2.default.createTrackedDialog('Call already in progress', '', _ErrorDialog3, {\n title: (0, _languageHandler._t)('Call in Progress'),\n description: (0, _languageHandler._t)('A call is currently being placed!')\n });\n return _context.abrupt('return');\n\n case 21:\n currentJitsiWidgets = currentRoomWidgets.filter(function (ev) {\n return ev.getContent().type === 'jitsi';\n });\n\n if (!(currentJitsiWidgets.length > 0)) {\n _context.next = 27;\n break;\n }\n\n console.warn(\"Refusing to start conference call widget in \" + roomId + \" a conference call widget is already present\");\n _ErrorDialog4 = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n\n\n _Modal2.default.createTrackedDialog('Already have Jitsi Widget', '', _ErrorDialog4, {\n title: (0, _languageHandler._t)('Call in Progress'),\n description: (0, _languageHandler._t)('A call is already in progress!')\n });\n return _context.abrupt('return');\n\n case 27:\n\n // This inherits its poor naming from the field of the same name that goes into\n // the event. It's just a random string to make the Jitsi URLs unique.\n widgetSessionId = Math.random().toString(36).substring(2);\n confId = room.roomId.replace(/[^A-Za-z0-9]/g, '') + widgetSessionId;\n // NB. we can't just encodeURICompoent all of these because the $ signs need to be there\n // (but currently the only thing that needs encoding is the confId)\n\n queryString = ['confId=' + encodeURIComponent(confId), 'isAudioConf=' + (type === 'voice' ? 'true' : 'false'), 'displayName=$matrix_display_name', 'avatarUrl=$matrix_avatar_url', 'email=$matrix_user_id'].join('&');\n widgetUrl = void 0;\n\n if (_SdkConfig2.default.get().integrations_jitsi_widget_url) {\n // Try this config key. This probably isn't ideal as a way of discovering this\n // URL, but this will at least allow the integration manager to not be hardcoded.\n widgetUrl = _SdkConfig2.default.get().integrations_jitsi_widget_url + '?' + queryString;\n } else {\n widgetUrl = _SdkConfig2.default.get().integrations_rest_url + '/widgets/jitsi.html?' + queryString;\n }\n\n widgetData = { widgetSessionId: widgetSessionId };\n widgetId = 'jitsi_' + _MatrixClientPeg2.default.get().credentials.userId + '_' + Date.now();\n\n\n _WidgetUtils2.default.setRoomWidget(roomId, widgetId, 'jitsi', widgetUrl, 'Jitsi', widgetData).then(function () {\n console.log('Jitsi widget added');\n }).catch(function (e) {\n if (e.errcode === 'M_FORBIDDEN') {\n var _ErrorDialog5 = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n\n _Modal2.default.createTrackedDialog('Call Failed', '', _ErrorDialog5, {\n title: (0, _languageHandler._t)('Permission Required'),\n description: (0, _languageHandler._t)(\"You do not have permission to start a conference call in this room\")\n });\n }\n console.error(e);\n });\n\n case 35:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this, [[2, 8]]);\n }));\n\n return function _startCallApp(_x, _x2) {\n return _ref.apply(this, arguments);\n };\n}();\n\n// FIXME: Nasty way of making sure we only register\n// with the dispatcher once\n\n\nvar _MatrixClientPeg = require('./MatrixClientPeg');\n\nvar _MatrixClientPeg2 = _interopRequireDefault(_MatrixClientPeg);\n\nvar _PlatformPeg = require('./PlatformPeg');\n\nvar _PlatformPeg2 = _interopRequireDefault(_PlatformPeg);\n\nvar _Modal = require('./Modal');\n\nvar _Modal2 = _interopRequireDefault(_Modal);\n\nvar _index = require('./index');\n\nvar _index2 = _interopRequireDefault(_index);\n\nvar _languageHandler = require('./languageHandler');\n\nvar _matrixJsSdk = require('matrix-js-sdk');\n\nvar _matrixJsSdk2 = _interopRequireDefault(_matrixJsSdk);\n\nvar _dispatcher = require('./dispatcher');\n\nvar _dispatcher2 = _interopRequireDefault(_dispatcher);\n\nvar _SdkConfig = require('./SdkConfig');\n\nvar _SdkConfig2 = _interopRequireDefault(_SdkConfig);\n\nvar _cryptodevices = require('./cryptodevices');\n\nvar _WidgetUtils = require('./utils/WidgetUtils');\n\nvar _WidgetUtils2 = _interopRequireDefault(_WidgetUtils);\n\nvar _WidgetEchoStore = require('./stores/WidgetEchoStore');\n\nvar _WidgetEchoStore2 = _interopRequireDefault(_WidgetEchoStore);\n\nvar _ScalarAuthClient = require('./ScalarAuthClient');\n\nvar _ScalarAuthClient2 = _interopRequireDefault(_ScalarAuthClient);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\nCopyright 2015, 2016 OpenMarket Ltd\nCopyright 2017, 2018 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/*\n * Manages a list of all the currently active calls.\n *\n * This handler dispatches when voip calls are added/updated/removed from this list:\n * {\n * action: 'call_state'\n * room_id: \n * }\n *\n * To know the state of the call, this handler exposes a getter to\n * obtain the call for a room:\n * var call = CallHandler.getCall(roomId)\n * var state = call.call_state; // ringing|ringback|connected|ended|busy|stop_ringback|stop_ringing\n *\n * This handler listens for and handles the following actions:\n * {\n * action: 'place_call',\n * type: 'voice|video',\n * room_id: \n * }\n *\n * {\n * action: 'incoming_call'\n * call: MatrixCall\n * }\n *\n * {\n * action: 'hangup'\n * room_id: \n * }\n *\n * {\n * action: 'answer'\n * room_id: \n * }\n */\n\nglobal.mxCalls = {\n //room_id: MatrixCall\n};\nvar calls = global.mxCalls;\nvar ConferenceHandler = null;\n\nvar audioPromises = {};\n\nfunction play(audioId) {\n // TODO: Attach an invisible element for this instead\n // which listens?\n var audio = document.getElementById(audioId);\n if (audio) {\n if (audioPromises[audioId]) {\n audioPromises[audioId] = audioPromises[audioId].then(function () {\n audio.load();\n return audio.play();\n });\n } else {\n audioPromises[audioId] = audio.play();\n }\n }\n}\n\nfunction pause(audioId) {\n // TODO: Attach an invisible element for this instead\n // which listens?\n var audio = document.getElementById(audioId);\n if (audio) {\n if (audioPromises[audioId]) {\n audioPromises[audioId] = audioPromises[audioId].then(function () {\n return audio.pause();\n });\n } else {\n // pause doesn't actually return a promise, but might as well do this for symmetry with play();\n audioPromises[audioId] = audio.pause();\n }\n }\n}\n\nfunction _reAttemptCall(call) {\n if (call.direction === 'outbound') {\n _dispatcher2.default.dispatch({\n action: 'place_call',\n room_id: call.roomId,\n type: call.type\n });\n } else {\n call.answer();\n }\n}\n\nfunction _setCallListeners(call) {\n call.on(\"error\", function (err) {\n console.error(\"Call error: %s\", err);\n console.error(err.stack);\n if (err.code === 'unknown_devices') {\n var QuestionDialog = _index2.default.getComponent(\"dialogs.QuestionDialog\");\n\n _Modal2.default.createTrackedDialog('Call Failed', '', QuestionDialog, {\n title: (0, _languageHandler._t)('Call Failed'),\n description: (0, _languageHandler._t)(\"There are unknown devices in this room: \" + \"if you proceed without verifying them, it will be \" + \"possible for someone to eavesdrop on your call.\"),\n button: (0, _languageHandler._t)('Review Devices'),\n onFinished: function onFinished(confirmed) {\n if (confirmed) {\n var room = _MatrixClientPeg2.default.get().getRoom(call.roomId);\n (0, _cryptodevices.showUnknownDeviceDialogForCalls)(_MatrixClientPeg2.default.get(), room, function () {\n _reAttemptCall(call);\n }, call.direction === 'outbound' ? (0, _languageHandler._t)(\"Call Anyway\") : (0, _languageHandler._t)(\"Answer Anyway\"), call.direction === 'outbound' ? (0, _languageHandler._t)(\"Call\") : (0, _languageHandler._t)(\"Answer\"));\n }\n }\n });\n } else {\n var ErrorDialog = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n\n _Modal2.default.createTrackedDialog('Call Failed', '', ErrorDialog, {\n title: (0, _languageHandler._t)('Call Failed'),\n description: err.message\n });\n }\n });\n call.on(\"hangup\", function () {\n _setCallState(undefined, call.roomId, \"ended\");\n });\n // map web rtc states to dummy UI state\n // ringing|ringback|connected|ended|busy|stop_ringback|stop_ringing\n call.on(\"state\", function (newState, oldState) {\n if (newState === \"ringing\") {\n _setCallState(call, call.roomId, \"ringing\");\n pause(\"ringbackAudio\");\n } else if (newState === \"invite_sent\") {\n _setCallState(call, call.roomId, \"ringback\");\n play(\"ringbackAudio\");\n } else if (newState === \"ended\" && oldState === \"connected\") {\n _setCallState(undefined, call.roomId, \"ended\");\n pause(\"ringbackAudio\");\n play(\"callendAudio\");\n } else if (newState === \"ended\" && oldState === \"invite_sent\" && (call.hangupParty === \"remote\" || call.hangupParty === \"local\" && call.hangupReason === \"invite_timeout\")) {\n _setCallState(call, call.roomId, \"busy\");\n pause(\"ringbackAudio\");\n play(\"busyAudio\");\n var ErrorDialog = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n _Modal2.default.createTrackedDialog('Call Handler', 'Call Timeout', ErrorDialog, {\n title: (0, _languageHandler._t)('Call Timeout'),\n description: (0, _languageHandler._t)('The remote side failed to pick up') + '.'\n });\n } else if (oldState === \"invite_sent\") {\n _setCallState(call, call.roomId, \"stop_ringback\");\n pause(\"ringbackAudio\");\n } else if (oldState === \"ringing\") {\n _setCallState(call, call.roomId, \"stop_ringing\");\n pause(\"ringbackAudio\");\n } else if (newState === \"connected\") {\n _setCallState(call, call.roomId, \"connected\");\n pause(\"ringbackAudio\");\n }\n });\n}\n\nfunction _setCallState(call, roomId, status) {\n console.log(\"Call state in %s changed to %s (%s)\", roomId, status, call ? call.call_state : \"-\");\n calls[roomId] = call;\n\n if (status === \"ringing\") {\n play(\"ringAudio\");\n } else if (call && call.call_state === \"ringing\") {\n pause(\"ringAudio\");\n }\n\n if (call) {\n call.call_state = status;\n }\n _dispatcher2.default.dispatch({\n action: 'call_state',\n room_id: roomId,\n state: status\n });\n}\n\nfunction _onAction(payload) {\n function placeCall(newCall) {\n _setCallListeners(newCall);\n if (payload.type === 'voice') {\n newCall.placeVoiceCall();\n } else if (payload.type === 'video') {\n newCall.placeVideoCall(payload.remote_element, payload.local_element);\n } else if (payload.type === 'screensharing') {\n var screenCapErrorString = _PlatformPeg2.default.get().screenCaptureErrorString();\n if (screenCapErrorString) {\n _setCallState(undefined, newCall.roomId, \"ended\");\n console.log(\"Can't capture screen: \" + screenCapErrorString);\n var ErrorDialog = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n _Modal2.default.createTrackedDialog('Call Handler', 'Unable to capture screen', ErrorDialog, {\n title: (0, _languageHandler._t)('Unable to capture screen'),\n description: screenCapErrorString\n });\n return;\n }\n newCall.placeScreenSharingCall(payload.remote_element, payload.local_element);\n } else {\n console.error(\"Unknown conf call type: %s\", payload.type);\n }\n }\n\n switch (payload.action) {\n case 'place_call':\n {\n if (module.exports.getAnyActiveCall()) {\n var ErrorDialog = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n _Modal2.default.createTrackedDialog('Call Handler', 'Existing Call', ErrorDialog, {\n title: (0, _languageHandler._t)('Existing Call'),\n description: (0, _languageHandler._t)('You are already in a call.')\n });\n return; // don't allow >1 call to be placed.\n }\n\n // if the runtime env doesn't do VoIP, whine.\n if (!_MatrixClientPeg2.default.get().supportsVoip()) {\n var _ErrorDialog = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n _Modal2.default.createTrackedDialog('Call Handler', 'VoIP is unsupported', _ErrorDialog, {\n title: (0, _languageHandler._t)('VoIP is unsupported'),\n description: (0, _languageHandler._t)('You cannot place VoIP calls in this browser.')\n });\n return;\n }\n\n var room = _MatrixClientPeg2.default.get().getRoom(payload.room_id);\n if (!room) {\n console.error(\"Room %s does not exist.\", payload.room_id);\n return;\n }\n\n var members = room.getJoinedMembers();\n if (members.length <= 1) {\n var _ErrorDialog2 = _index2.default.getComponent(\"dialogs.ErrorDialog\");\n _Modal2.default.createTrackedDialog('Call Handler', 'Cannot place call with self', _ErrorDialog2, {\n description: (0, _languageHandler._t)('You cannot place a call with yourself.')\n });\n return;\n } else if (members.length === 2) {\n console.log(\"Place %s call in %s\", payload.type, payload.room_id);\n var call = _matrixJsSdk2.default.createNewMatrixCall(_MatrixClientPeg2.default.get(), payload.room_id);\n placeCall(call);\n } else {\n // > 2\n _dispatcher2.default.dispatch({\n action: \"place_conference_call\",\n room_id: payload.room_id,\n type: payload.type,\n remote_element: payload.remote_element,\n local_element: payload.local_element\n });\n }\n }\n break;\n case 'place_conference_call':\n console.log(\"Place conference call in %s\", payload.room_id);\n _startCallApp(payload.room_id, payload.type);\n break;\n case 'incoming_call':\n {\n if (module.exports.getAnyActiveCall()) {\n // ignore multiple incoming calls. in future, we may want a line-1/line-2 setup.\n // we avoid rejecting with \"busy\" in case the user wants to answer it on a different device.\n // in future we could signal a \"local busy\" as a warning to the caller.\n // see https://github.com/vector-im/vector-web/issues/1964\n return;\n }\n\n // if the runtime env doesn't do VoIP, stop here.\n if (!_MatrixClientPeg2.default.get().supportsVoip()) {\n return;\n }\n\n var _call = payload.call;\n _setCallListeners(_call);\n _setCallState(_call, _call.roomId, \"ringing\");\n }\n break;\n case 'hangup':\n if (!calls[payload.room_id]) {\n return; // no call to hangup\n }\n calls[payload.room_id].hangup();\n _setCallState(null, payload.room_id, \"ended\");\n break;\n case 'answer':\n if (!calls[payload.room_id]) {\n return; // no call to answer\n }\n calls[payload.room_id].answer();\n _setCallState(calls[payload.room_id], payload.room_id, \"connected\");\n _dispatcher2.default.dispatch({\n action: \"view_room\",\n room_id: payload.room_id\n });\n break;\n }\n}\n\nif (!global.mxCallHandler) {\n _dispatcher2.default.register(_onAction);\n}\n\nvar callHandler = {\n getCallForRoom: function getCallForRoom(roomId) {\n var call = module.exports.getCall(roomId);\n if (call) return call;\n\n if (ConferenceHandler) {\n call = ConferenceHandler.getConferenceCallForRoom(roomId);\n }\n if (call) return call;\n\n return null;\n },\n\n getCall: function getCall(roomId) {\n return calls[roomId] || null;\n },\n\n getAnyActiveCall: function getAnyActiveCall() {\n var roomsWithCalls = (0, _keys2.default)(calls);\n for (var i = 0; i < roomsWithCalls.length; i++) {\n if (calls[roomsWithCalls[i]] && calls[roomsWithCalls[i]].call_state !== \"ended\") {\n return calls[roomsWithCalls[i]];\n }\n }\n return null;\n },\n\n /**\n * The conference handler is a module that deals with implementation-specific\n * multi-party calling implementations. Riot passes in its own which creates\n * a one-to-one call with a freeswitch conference bridge. As of July 2018,\n * the de-facto way of conference calling is a Jitsi widget, so this is\n * deprecated. It reamins here for two reasons:\n * 1. So Riot still supports joining existing freeswitch conference calls\n * (but doesn't support creating them). After a transition period, we can\n * remove support for joining them too.\n * 2. To hide the one-to-one rooms that old-style conferencing creates. This\n * is much harder to remove: probably either we make Riot leave & forget these\n * rooms after we remove support for joining freeswitch conferences, or we\n * accept that random rooms with cryptic users will suddently appear for\n * anyone who's ever used conference calling, or we are stuck with this\n * code forever.\n *\n * @param {object} confHandler The conference handler object\n */\n setConferenceHandler: function setConferenceHandler(confHandler) {\n ConferenceHandler = confHandler;\n },\n\n getConferenceHandler: function getConferenceHandler() {\n return ConferenceHandler;\n }\n};\n// Only things in here which actually need to be global are the\n// calls list (done separately) and making sure we only register\n// with the dispatcher once (which uses this mechanism but checks\n// separately). This could be tidied up.\nif (global.mxCallHandler === undefined) {\n global.mxCallHandler = callHandler;\n}\n\nmodule.exports = global.mxCallHandler;\n//# sourceMappingURL=CallHandler.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.formatCount = formatCount;\nexports.formatCryptoKey = formatCryptoKey;\nexports.hashCode = hashCode;\n/*\nCopyright 2016 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * formats numbers to fit into ~3 characters, suitable for badge counts\n * e.g: 999, 9.9K, 99K, 0.9M, 9.9M, 99M, 0.9B, 9.9B\n */\nfunction formatCount(count) {\n if (count < 1000) return count;\n if (count < 10000) return (count / 1000).toFixed(1) + \"K\";\n if (count < 100000) return (count / 1000).toFixed(0) + \"K\";\n if (count < 10000000) return (count / 1000000).toFixed(1) + \"M\";\n if (count < 100000000) return (count / 1000000).toFixed(0) + \"M\";\n return (count / 1000000000).toFixed(1) + \"B\"; // 10B is enough for anyone, right? :S\n}\n\n/**\n * format a key into groups of 4 characters, for easier visual inspection\n *\n * @param {string} key key to format\n *\n * @return {string}\n */\nfunction formatCryptoKey(key) {\n return key.match(/.{1,4}/g).join(\" \");\n}\n/**\n * calculates a numeric hash for a given string\n *\n * @param {string} str string to hash\n *\n * @return {number}\n */\nfunction hashCode(str) {\n var hash = 0;\n var i = void 0;\n var chr = void 0;\n if (str.length === 0) {\n return hash;\n }\n for (i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0;\n }\n return Math.abs(hash);\n}\n//# sourceMappingURL=FormattingUtils.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends2 = require('babel-runtime/helpers/extends');\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _setImmediate2 = require('babel-runtime/core-js/set-immediate');\n\nvar _setImmediate3 = _interopRequireDefault(_setImmediate2);\n\nvar _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nexports.createMenu = createMenu;\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _reactDom = require('react-dom');\n\nvar _reactDom2 = _interopRequireDefault(_reactDom);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _classnames = require('classnames');\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Shamelessly ripped off Modal.js. There's probably a better way\n// of doing reusable widgets like dialog boxes & menus where we go and\n// pass in a custom control as the actual body.\n\n/*\nCopyright 2015, 2016 OpenMarket Ltd\nCopyright 2018 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar ContextualMenuContainerId = \"mx_ContextualMenu_Container\";\n\nfunction getOrCreateContainer() {\n var container = document.getElementById(ContextualMenuContainerId);\n\n if (!container) {\n container = document.createElement(\"div\");\n container.id = ContextualMenuContainerId;\n document.body.appendChild(container);\n }\n\n return container;\n}\n\nvar ContextualMenu = function (_React$Component) {\n (0, _inherits3.default)(ContextualMenu, _React$Component);\n\n function ContextualMenu() {\n (0, _classCallCheck3.default)(this, ContextualMenu);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, (ContextualMenu.__proto__ || (0, _getPrototypeOf2.default)(ContextualMenu)).call(this));\n\n _this.state = {\n contextMenuRect: null\n };\n\n _this.onContextMenu = _this.onContextMenu.bind(_this);\n _this.collectContextMenuRect = _this.collectContextMenuRect.bind(_this);\n return _this;\n }\n\n (0, _createClass3.default)(ContextualMenu, [{\n key: 'collectContextMenuRect',\n value: function collectContextMenuRect(element) {\n // We don't need to clean up when unmounting, so ignore\n if (!element) return;\n\n this.setState({\n contextMenuRect: element.getBoundingClientRect()\n });\n }\n }, {\n key: 'onContextMenu',\n value: function onContextMenu(e) {\n if (this.props.closeMenu) {\n this.props.closeMenu();\n\n e.preventDefault();\n var x = e.clientX;\n var y = e.clientY;\n\n // XXX: This isn't pretty but the only way to allow opening a different context menu on right click whilst\n // a context menu and its click-guard are up without completely rewriting how the context menus work.\n (0, _setImmediate3.default)(function () {\n var clickEvent = document.createEvent('MouseEvents');\n clickEvent.initMouseEvent('contextmenu', true, true, window, 0, 0, 0, x, y, false, false, false, false, 0, null);\n document.elementFromPoint(x, y).dispatchEvent(clickEvent);\n });\n }\n }\n }, {\n key: 'render',\n value: function render() {\n var position = {};\n var chevronFace = null;\n var props = this.props;\n\n if (props.top) {\n position.top = props.top;\n } else {\n position.bottom = props.bottom;\n }\n\n if (props.left) {\n position.left = props.left;\n chevronFace = 'left';\n } else {\n position.right = props.right;\n chevronFace = 'right';\n }\n\n var contextMenuRect = this.state.contextMenuRect || null;\n var padding = 10;\n\n var chevronOffset = {};\n if (props.chevronFace) {\n chevronFace = props.chevronFace;\n }\n var hasChevron = chevronFace && chevronFace !== \"none\";\n\n if (chevronFace === 'top' || chevronFace === 'bottom') {\n chevronOffset.left = props.chevronOffset;\n } else {\n var target = position.top;\n\n // By default, no adjustment is made\n var adjusted = target;\n\n // If we know the dimensions of the context menu, adjust its position\n // such that it does not leave the (padded) window.\n if (contextMenuRect) {\n adjusted = Math.min(position.top, document.body.clientHeight - contextMenuRect.height - padding);\n }\n\n position.top = adjusted;\n chevronOffset.top = Math.max(props.chevronOffset, props.chevronOffset + target - adjusted);\n }\n\n // To override the default chevron colour, if it's been set\n var chevronCSS = \"\";\n if (props.menuColour) {\n chevronCSS = '\\n .mx_ContextualMenu_chevron_left:after {\\n border-right-color: ' + props.menuColour + ';\\n }\\n .mx_ContextualMenu_chevron_right:after {\\n border-left-color: ' + props.menuColour + ';\\n }\\n .mx_ContextualMenu_chevron_top:after {\\n border-left-color: ' + props.menuColour + ';\\n }\\n .mx_ContextualMenu_chevron_bottom:after {\\n border-left-color: ' + props.menuColour + ';\\n }\\n ';\n }\n\n var chevron = hasChevron ? _react2.default.createElement('div', { style: chevronOffset, className: \"mx_ContextualMenu_chevron_\" + chevronFace }) : undefined;\n var className = 'mx_ContextualMenu_wrapper';\n\n var menuClasses = (0, _classnames2.default)({\n 'mx_ContextualMenu': true,\n 'mx_ContextualMenu_noChevron': chevronFace === 'none',\n 'mx_ContextualMenu_left': chevronFace === 'left',\n 'mx_ContextualMenu_right': chevronFace === 'right',\n 'mx_ContextualMenu_top': chevronFace === 'top',\n 'mx_ContextualMenu_bottom': chevronFace === 'bottom'\n });\n\n var menuStyle = {};\n if (props.menuWidth) {\n menuStyle.width = props.menuWidth;\n }\n\n if (props.menuHeight) {\n menuStyle.height = props.menuHeight;\n }\n\n if (props.menuColour) {\n menuStyle[\"backgroundColor\"] = props.menuColour;\n }\n\n if (!isNaN(Number(props.menuPaddingTop))) {\n menuStyle[\"paddingTop\"] = props.menuPaddingTop;\n }\n if (!isNaN(Number(props.menuPaddingLeft))) {\n menuStyle[\"paddingLeft\"] = props.menuPaddingLeft;\n }\n if (!isNaN(Number(props.menuPaddingBottom))) {\n menuStyle[\"paddingBottom\"] = props.menuPaddingBottom;\n }\n if (!isNaN(Number(props.menuPaddingRight))) {\n menuStyle[\"paddingRight\"] = props.menuPaddingRight;\n }\n\n var ElementClass = props.elementClass;\n\n // FIXME: If a menu uses getDefaultProps it clobbers the onFinished\n // property set here so you can't close the menu from a button click!\n return _react2.default.createElement(\n 'div',\n { className: className, style: position },\n _react2.default.createElement(\n 'div',\n { className: menuClasses, style: menuStyle, ref: this.collectContextMenuRect },\n chevron,\n _react2.default.createElement(ElementClass, (0, _extends3.default)({}, props, { onFinished: props.closeMenu, onResize: props.windowResize }))\n ),\n props.hasBackground && _react2.default.createElement('div', { className: 'mx_ContextualMenu_background',\n onClick: props.closeMenu, onContextMenu: this.onContextMenu }),\n _react2.default.createElement(\n 'style',\n null,\n chevronCSS\n )\n );\n }\n }]);\n return ContextualMenu;\n}(_react2.default.Component);\n\nexports.default = ContextualMenu;\nfunction createMenu(ElementClass, props) {\n var hasBackground = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n var closeMenu = function closeMenu() {\n _reactDom2.default.unmountComponentAtNode(getOrCreateContainer());\n\n if (props && props.onFinished) {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n props.onFinished.apply(null, args);\n }\n };\n\n // We only reference closeMenu once per call to createMenu\n var menu = _react2.default.createElement(ContextualMenu, (0, _extends3.default)({\n hasBackground: hasBackground\n }, props, {\n elementClass: ElementClass,\n closeMenu: closeMenu // eslint-disable-line react/jsx-no-bind\n , windowResize: closeMenu // eslint-disable-line react/jsx-no-bind\n }));\n\n _reactDom2.default.render(menu, getOrCreateContainer());\n\n return { close: closeMenu };\n}\n//# sourceMappingURL=ContextualMenu.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _keys = require('babel-runtime/core-js/object/keys');\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nvar _getIterator2 = require('babel-runtime/core-js/get-iterator');\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _MatrixClientPeg = require('../MatrixClientPeg');\n\nvar _MatrixClientPeg2 = _interopRequireDefault(_MatrixClientPeg);\n\nvar _uniq2 = require('lodash/uniq');\n\nvar _uniq3 = _interopRequireDefault(_uniq2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Class that takes a Matrix Client and flips the m.direct map\n * so the operation of mapping a room ID to which user it's a DM\n * with can be performed efficiently.\n *\n * With 'start', this can also keep itself up to date over time.\n */\n/*\nCopyright 2016 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar DMRoomMap = function () {\n function DMRoomMap(matrixClient) {\n (0, _classCallCheck3.default)(this, DMRoomMap);\n\n this.matrixClient = matrixClient;\n this.roomToUser = null;\n // see _onAccountData\n this._hasSentOutPatchDirectAccountDataPatch = false;\n\n // XXX: Force-bind the event handler method because it\n // doesn't call it with our object as the 'this'\n // (use a static property arrow function for this when we can)\n this._onAccountData = this._onAccountData.bind(this);\n\n var mDirectEvent = matrixClient.getAccountData('m.direct');\n this.mDirectEvent = mDirectEvent ? mDirectEvent.getContent() : {};\n this.userToRooms = null;\n }\n\n /**\n * Makes and returns a new shared instance that can then be accessed\n * with shared(). This returned instance is not automatically started.\n */\n\n\n (0, _createClass3.default)(DMRoomMap, [{\n key: 'start',\n value: function start() {\n this._populateRoomToUser();\n this.matrixClient.on(\"accountData\", this._onAccountData);\n }\n }, {\n key: 'stop',\n value: function stop() {\n this.matrixClient.removeListener(\"accountData\", this._onAccountData);\n }\n }, {\n key: '_onAccountData',\n value: function _onAccountData(ev) {\n if (ev.getType() == 'm.direct') {\n this.mDirectEvent = this.matrixClient.getAccountData('m.direct').getContent() || {};\n this.userToRooms = null;\n this.roomToUser = null;\n }\n }\n /**\n * some client bug somewhere is causing some DMs to be marked\n * with ourself, not the other user. Fix it by guessing the other user and\n * modifying userToRooms\n */\n\n }, {\n key: '_patchUpSelfDMs',\n value: function _patchUpSelfDMs(userToRooms) {\n var _this = this;\n\n var myUserId = this.matrixClient.getUserId();\n var selfRoomIds = userToRooms[myUserId];\n if (selfRoomIds) {\n // any self-chats that should not be self-chats?\n var guessedUserIdsThatChanged = selfRoomIds.map(function (roomId) {\n var room = _this.matrixClient.getRoom(roomId);\n if (room) {\n var userId = room.guessDMUserId();\n if (userId && userId !== myUserId) {\n return { userId: userId, roomId: roomId };\n }\n }\n }).filter(function (ids) {\n return !!ids;\n }); //filter out\n // these are actually all legit self-chats\n // bail out\n if (!guessedUserIdsThatChanged.length) {\n return false;\n }\n userToRooms[myUserId] = selfRoomIds.filter(function (roomId) {\n return !guessedUserIdsThatChanged.some(function (ids) {\n return ids.roomId === roomId;\n });\n });\n guessedUserIdsThatChanged.forEach(function (_ref) {\n var userId = _ref.userId,\n roomId = _ref.roomId;\n\n var roomIds = userToRooms[userId];\n if (!roomIds) {\n userToRooms[userId] = [roomId];\n } else {\n roomIds.push(roomId);\n userToRooms[userId] = (0, _uniq3.default)(roomIds);\n }\n });\n return true;\n }\n }\n }, {\n key: 'getDMRoomsForUserId',\n value: function getDMRoomsForUserId(userId) {\n // Here, we return the empty list if there are no rooms,\n // since the number of conversations you have with this user is zero.\n return this._getUserToRooms()[userId] || [];\n }\n }, {\n key: 'getUserIdForRoomId',\n value: function getUserIdForRoomId(roomId) {\n if (this.roomToUser == null) {\n // we lazily populate roomToUser so you can use\n // this class just to call getDMRoomsForUserId\n // which doesn't do very much, but is a fairly\n // convenient wrapper and there's no point\n // iterating through the map if getUserIdForRoomId()\n // is never called.\n this._populateRoomToUser();\n }\n // Here, we return undefined if the room is not in the map:\n // the room ID you gave is not a DM room for any user.\n if (this.roomToUser[roomId] === undefined) {\n // no entry? if the room is an invite, look for the is_direct hint.\n var room = this.matrixClient.getRoom(roomId);\n if (room) {\n return room.getDMInviter();\n }\n }\n return this.roomToUser[roomId];\n }\n }, {\n key: '_getUserToRooms',\n value: function _getUserToRooms() {\n if (!this.userToRooms) {\n var userToRooms = this.mDirectEvent;\n var myUserId = this.matrixClient.getUserId();\n var selfDMs = userToRooms[myUserId];\n if (selfDMs && selfDMs.length) {\n var neededPatching = this._patchUpSelfDMs(userToRooms);\n // to avoid multiple devices fighting to correct\n // the account data, only try to send the corrected\n // version once.\n console.warn('Invalid m.direct account data detected ' + '(self-chats that shouldn\\'t be), patching it up.');\n if (neededPatching && !this._hasSentOutPatchDirectAccountDataPatch) {\n this._hasSentOutPatchDirectAccountDataPatch = true;\n this.matrixClient.setAccountData('m.direct', userToRooms);\n }\n }\n this.userToRooms = userToRooms;\n }\n return this.userToRooms;\n }\n }, {\n key: '_populateRoomToUser',\n value: function _populateRoomToUser() {\n this.roomToUser = {};\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = (0, _getIterator3.default)((0, _keys2.default)(this._getUserToRooms())), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var user = _step.value;\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = (0, _getIterator3.default)(this.userToRooms[user]), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var roomId = _step2.value;\n\n this.roomToUser[roomId] = user;\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n }], [{\n key: 'makeShared',\n value: function makeShared() {\n DMRoomMap._sharedInstance = new DMRoomMap(_MatrixClientPeg2.default.get());\n return DMRoomMap._sharedInstance;\n }\n\n /**\n * Returns a shared instance of the class\n * that uses the singleton matrix client\n * The shared instance must be started before use.\n */\n\n }, {\n key: 'shared',\n value: function shared() {\n return DMRoomMap._sharedInstance;\n }\n }]);\n return DMRoomMap;\n}();\n\nexports.default = DMRoomMap;\nmodule.exports = exports['default'];\n//# sourceMappingURL=DMRoomMap.js.map","\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n/**\n * Colors.\n */\n\nexports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n// eslint-disable-next-line complexity\n\nfunction useColors() {\n // NB: In an Electron preload script, document will be defined but not fully\n // initialized. Since we know we're in Chrome, we'll just detect this case\n // explicitly\n if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n return true;\n } // Internet Explorer and Edge do not support colors.\n\n\n if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n } // Is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\n\n return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773\n typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker\n typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n}\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\n\nfunction formatArgs(args) {\n args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);\n\n if (!this.useColors) {\n return;\n }\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit'); // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function (match) {\n if (match === '%%') {\n return;\n }\n\n index++;\n\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n args.splice(lastC, 0, c);\n}\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\n\nfunction log() {\n var _console;\n\n // This hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return (typeof console === \"undefined\" ? \"undefined\" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);\n}\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\n\nfunction save(namespaces) {\n try {\n if (namespaces) {\n exports.storage.setItem('debug', namespaces);\n } else {\n exports.storage.removeItem('debug');\n }\n } catch (error) {// Swallow\n // XXX (@Qix-) should we be logging these?\n }\n}\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\n\nfunction load() {\n var r;\n\n try {\n r = exports.storage.getItem('debug');\n } catch (error) {} // Swallow\n // XXX (@Qix-) should we be logging these?\n // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\n\n if (!r && typeof process !== 'undefined' && 'env' in process) {\n r = process.env.DEBUG;\n }\n\n return r;\n}\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\n\nfunction localstorage() {\n try {\n // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n // The Browser also has localStorage in the global context.\n return localStorage;\n } catch (error) {// Swallow\n // XXX (@Qix-) should we be logging these?\n }\n}\n\nmodule.exports = require('./common')(exports);\nvar formatters = module.exports.formatters;\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n try {\n return JSON.stringify(v);\n } catch (error) {\n return '[UnexpectedJSONParseError]: ' + error.message;\n }\n};\n\n","var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n","module.exports = false;\n","// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n","module.exports = { \"default\": require(\"core-js/library/fn/set\"), __esModule: true };","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","\"use strict\";\n\nexports.__esModule = true;\n\nvar _getPrototypeOf = require(\"../core-js/object/get-prototype-of\");\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _getOwnPropertyDescriptor = require(\"../core-js/object/get-own-property-descriptor\");\n\nvar _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n var desc = (0, _getOwnPropertyDescriptor2.default)(object, property);\n\n if (desc === undefined) {\n var parent = (0, _getPrototypeOf2.default)(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n};","/**\n * Copyright 2013-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule invariant\n */\n\n\"use strict\";\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function (condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () {\n return args[argIndex++];\n }));\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;","'use strict';\n\nvar _getIterator2 = require('babel-runtime/core-js/get-iterator');\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nvar _MatrixClientPeg = require('./MatrixClientPeg');\n\nvar _MatrixClientPeg2 = _interopRequireDefault(_MatrixClientPeg);\n\nvar _PlatformPeg = require('./PlatformPeg');\n\nvar _PlatformPeg2 = _interopRequireDefault(_PlatformPeg);\n\nvar _TextForEvent = require('./TextForEvent');\n\nvar _TextForEvent2 = _interopRequireDefault(_TextForEvent);\n\nvar _Analytics = require('./Analytics');\n\nvar _Analytics2 = _interopRequireDefault(_Analytics);\n\nvar _Avatar = require('./Avatar');\n\nvar _Avatar2 = _interopRequireDefault(_Avatar);\n\nvar _dispatcher = require('./dispatcher');\n\nvar _dispatcher2 = _interopRequireDefault(_dispatcher);\n\nvar _index = require('./index');\n\nvar _index2 = _interopRequireDefault(_index);\n\nvar _languageHandler = require('./languageHandler');\n\nvar _Modal = require('./Modal');\n\nvar _Modal2 = _interopRequireDefault(_Modal);\n\nvar _SettingsStore = require('./settings/SettingsStore');\n\nvar _SettingsStore2 = _interopRequireDefault(_SettingsStore);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\n * Dispatches:\n * {\n * action: \"notifier_enabled\",\n * value: boolean\n * }\n */\n\n/*\nCopyright 2015, 2016 OpenMarket Ltd\nCopyright 2017 Vector Creations Ltd\nCopyright 2017 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar MAX_PENDING_ENCRYPTED = 20;\n\nvar Notifier = {\n notifsByRoom: {},\n\n // A list of event IDs that we've received but need to wait until\n // they're decrypted until we decide whether to notify for them\n // or not\n pendingEncryptedEventIds: [],\n\n notificationMessageForEvent: function notificationMessageForEvent(ev) {\n return _TextForEvent2.default.textForEvent(ev);\n },\n\n _displayPopupNotification: function _displayPopupNotification(ev, room) {\n var plaf = _PlatformPeg2.default.get();\n if (!plaf) {\n return;\n }\n if (!plaf.supportsNotifications() || !plaf.maySendNotifications()) {\n return;\n }\n if (global.document.hasFocus()) {\n return;\n }\n\n var msg = this.notificationMessageForEvent(ev);\n if (!msg) return;\n\n var title = void 0;\n if (!ev.sender || room.name === ev.sender.name) {\n title = room.name;\n // notificationMessageForEvent includes sender,\n // but we already have the sender here\n if (ev.getContent().body) msg = ev.getContent().body;\n } else if (ev.getType() === 'm.room.member') {\n // context is all in the message here, we don't need\n // to display sender info\n title = room.name;\n } else if (ev.sender) {\n title = ev.sender.name + \" (\" + room.name + \")\";\n // notificationMessageForEvent includes sender,\n // but we've just out sender in the title\n if (ev.getContent().body) msg = ev.getContent().body;\n }\n\n if (!this.isBodyEnabled()) {\n msg = '';\n }\n\n var avatarUrl = ev.sender ? _Avatar2.default.avatarUrlForMember(ev.sender, 40, 40, 'crop') : null;\n var notif = plaf.displayNotification(title, msg, avatarUrl, room);\n\n // if displayNotification returns non-null, the platform supports\n // clearing notifications later, so keep track of this.\n if (notif) {\n if (this.notifsByRoom[ev.getRoomId()] === undefined) this.notifsByRoom[ev.getRoomId()] = [];\n this.notifsByRoom[ev.getRoomId()].push(notif);\n }\n },\n\n _playAudioNotification: function _playAudioNotification(ev, room) {\n var e = document.getElementById(\"messageAudio\");\n if (e) {\n e.play();\n }\n },\n\n start: function start() {\n this.boundOnEvent = this.onEvent.bind(this);\n this.boundOnSyncStateChange = this.onSyncStateChange.bind(this);\n this.boundOnRoomReceipt = this.onRoomReceipt.bind(this);\n this.boundOnEventDecrypted = this.onEventDecrypted.bind(this);\n _MatrixClientPeg2.default.get().on('event', this.boundOnEvent);\n _MatrixClientPeg2.default.get().on('Room.receipt', this.boundOnRoomReceipt);\n _MatrixClientPeg2.default.get().on('Event.decrypted', this.boundOnEventDecrypted);\n _MatrixClientPeg2.default.get().on(\"sync\", this.boundOnSyncStateChange);\n this.toolbarHidden = false;\n this.isSyncing = false;\n },\n\n stop: function stop() {\n if (_MatrixClientPeg2.default.get() && this.boundOnRoomTimeline) {\n _MatrixClientPeg2.default.get().removeListener('Event', this.boundOnEvent);\n _MatrixClientPeg2.default.get().removeListener('Room.receipt', this.boundOnRoomReceipt);\n _MatrixClientPeg2.default.get().removeListener('Event.decrypted', this.boundOnEventDecrypted);\n _MatrixClientPeg2.default.get().removeListener('sync', this.boundOnSyncStateChange);\n }\n this.isSyncing = false;\n },\n\n supportsDesktopNotifications: function supportsDesktopNotifications() {\n var plaf = _PlatformPeg2.default.get();\n return plaf && plaf.supportsNotifications();\n },\n\n setEnabled: function setEnabled(enable, callback) {\n var plaf = _PlatformPeg2.default.get();\n if (!plaf) return;\n\n // Dev note: We don't set the \"notificationsEnabled\" setting to true here because it is a\n // calculated value. It is determined based upon whether or not the master rule is enabled\n // and other flags. Setting it here would cause a circular reference.\n\n _Analytics2.default.trackEvent('Notifier', 'Set Enabled', enable);\n\n // make sure that we persist the current setting audio_enabled setting\n // before changing anything\n if (_SettingsStore2.default.isLevelSupported(_SettingsStore.SettingLevel.DEVICE)) {\n _SettingsStore2.default.setValue(\"audioNotificationsEnabled\", null, _SettingsStore.SettingLevel.DEVICE, this.isEnabled());\n }\n\n if (enable) {\n // Attempt to get permission from user\n plaf.requestNotificationPermission().done(function (result) {\n if (result !== 'granted') {\n // The permission request was dismissed or denied\n // TODO: Support alternative branding in messaging\n var description = result === 'denied' ? (0, _languageHandler._t)('Riot does not have permission to send you notifications - please check your browser settings') : (0, _languageHandler._t)('Riot was not given permission to send notifications - please try again');\n var ErrorDialog = _index2.default.getComponent('dialogs.ErrorDialog');\n _Modal2.default.createTrackedDialog('Unable to enable Notifications', result, ErrorDialog, {\n title: (0, _languageHandler._t)('Unable to enable Notifications'),\n description: description\n });\n return;\n }\n\n if (callback) callback();\n _dispatcher2.default.dispatch({\n action: \"notifier_enabled\",\n value: true\n });\n });\n } else {\n _dispatcher2.default.dispatch({\n action: \"notifier_enabled\",\n value: false\n });\n }\n // set the notifications_hidden flag, as the user has knowingly interacted\n // with the setting we shouldn't nag them any further\n this.setToolbarHidden(true);\n },\n\n isEnabled: function isEnabled() {\n return this.isPossible() && _SettingsStore2.default.getValue(\"notificationsEnabled\");\n },\n\n isPossible: function isPossible() {\n var plaf = _PlatformPeg2.default.get();\n if (!plaf) return false;\n if (!plaf.supportsNotifications()) return false;\n if (!plaf.maySendNotifications()) return false;\n\n return true; // possible, but not necessarily enabled\n },\n\n isBodyEnabled: function isBodyEnabled() {\n return this.isEnabled() && _SettingsStore2.default.getValue(\"notificationBodyEnabled\");\n },\n\n isAudioEnabled: function isAudioEnabled() {\n return this.isEnabled() && _SettingsStore2.default.getValue(\"audioNotificationsEnabled\");\n },\n\n setToolbarHidden: function setToolbarHidden(hidden) {\n var persistent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n this.toolbarHidden = hidden;\n\n _Analytics2.default.trackEvent('Notifier', 'Set Toolbar Hidden', hidden);\n\n // XXX: why are we dispatching this here?\n // this is nothing to do with notifier_enabled\n _dispatcher2.default.dispatch({\n action: \"notifier_enabled\",\n value: this.isEnabled()\n });\n\n // update the info to localStorage for persistent settings\n if (persistent && global.localStorage) {\n global.localStorage.setItem(\"notifications_hidden\", hidden);\n }\n },\n\n isToolbarHidden: function isToolbarHidden() {\n // Check localStorage for any such meta data\n if (global.localStorage) {\n return global.localStorage.getItem(\"notifications_hidden\") === \"true\";\n }\n\n return this.toolbarHidden;\n },\n\n onSyncStateChange: function onSyncStateChange(state) {\n if (state === \"SYNCING\") {\n this.isSyncing = true;\n } else if (state === \"STOPPED\" || state === \"ERROR\") {\n this.isSyncing = false;\n }\n },\n\n onEvent: function onEvent(ev) {\n if (!this.isSyncing) return; // don't alert for any messages initially\n if (ev.sender && ev.sender.userId === _MatrixClientPeg2.default.get().credentials.userId) return;\n\n // If it's an encrypted event and the type is still 'm.room.encrypted',\n // it hasn't yet been decrypted, so wait until it is.\n if (ev.isBeingDecrypted() || ev.isDecryptionFailure()) {\n this.pendingEncryptedEventIds.push(ev.getId());\n // don't let the list fill up indefinitely\n while (this.pendingEncryptedEventIds.length > MAX_PENDING_ENCRYPTED) {\n this.pendingEncryptedEventIds.shift();\n }\n return;\n }\n\n this._evaluateEvent(ev);\n },\n\n onEventDecrypted: function onEventDecrypted(ev) {\n // 'decrypted' means the decryption process has finished: it may have failed,\n // in which case it might decrypt soon if the keys arrive\n if (ev.isDecryptionFailure()) return;\n\n var idx = this.pendingEncryptedEventIds.indexOf(ev.getId());\n if (idx === -1) return;\n\n this.pendingEncryptedEventIds.splice(idx, 1);\n this._evaluateEvent(ev);\n },\n\n onRoomReceipt: function onRoomReceipt(ev, room) {\n if (room.getUnreadNotificationCount() === 0) {\n // ideally we would clear each notification when it was read,\n // but we have no way, given a read receipt, to know whether\n // the receipt comes before or after an event, so we can't\n // do this. Instead, clear all notifications for a room once\n // there are no notifs left in that room., which is not quite\n // as good but it's something.\n var plaf = _PlatformPeg2.default.get();\n if (!plaf) return;\n if (this.notifsByRoom[room.roomId] === undefined) return;\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = (0, _getIterator3.default)(this.notifsByRoom[room.roomId]), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var notif = _step.value;\n\n plaf.clearNotification(notif);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n delete this.notifsByRoom[room.roomId];\n }\n },\n\n _evaluateEvent: function _evaluateEvent(ev) {\n var room = _MatrixClientPeg2.default.get().getRoom(ev.getRoomId());\n var actions = _MatrixClientPeg2.default.get().getPushActionsForEvent(ev);\n if (actions && actions.notify) {\n if (this.isEnabled()) {\n this._displayPopupNotification(ev, room);\n }\n if (actions.tweaks.sound && this.isAudioEnabled()) {\n _PlatformPeg2.default.get().loudNotification(ev, room);\n this._playAudioNotification(ev, room);\n }\n }\n }\n};\n\nif (!global.mxNotifier) {\n global.mxNotifier = Notifier;\n}\n\nmodule.exports = global.mxNotifier;\n//# sourceMappingURL=Notifier.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _keys = require('babel-runtime/core-js/object/keys');\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nvar _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');\n\nvar _slicedToArray3 = _interopRequireDefault(_slicedToArray2);\n\nvar _entries = require('babel-runtime/core-js/object/entries');\n\nvar _entries2 = _interopRequireDefault(_entries);\n\nvar _values = require('babel-runtime/core-js/object/values');\n\nvar _values2 = _interopRequireDefault(_values);\n\nvar _promise = require('babel-runtime/core-js/promise');\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _MatrixClientPeg = require('../MatrixClientPeg');\n\nvar _MatrixClientPeg2 = _interopRequireDefault(_MatrixClientPeg);\n\nvar _SdkConfig = require('../SdkConfig');\n\nvar _SdkConfig2 = _interopRequireDefault(_SdkConfig);\n\nvar _dispatcher = require('../dispatcher');\n\nvar _dispatcher2 = _interopRequireDefault(_dispatcher);\n\nvar _url = require('url');\n\nvar url = _interopRequireWildcard(_url);\n\nvar _WidgetEchoStore = require('../stores/WidgetEchoStore');\n\nvar _WidgetEchoStore2 = _interopRequireDefault(_WidgetEchoStore);\n\nvar _SettingsStore = require('../settings/SettingsStore');\n\nvar _SettingsStore2 = _interopRequireDefault(_SettingsStore);\n\nfunction _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; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// How long we wait for the state event echo to come back from the server\n// before waitFor[Room/User]Widget rejects its promise\nvar WIDGET_WAIT_TIME = 20000; /*\n Copyright 2017 Vector Creations Ltd\n Copyright 2018 New Vector Ltd\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n/**\n * Encodes a URI according to a set of template variables. Variables will be\n * passed through encodeURIComponent.\n * @param {string} pathTemplate The path with template variables e.g. '/foo/$bar'.\n * @param {Object} variables The key/value pairs to replace the template\n * variables with. E.g. { '$bar': 'baz' }.\n * @return {string} The result of replacing all template variables e.g. '/foo/baz'.\n */\nfunction encodeUri(pathTemplate, variables) {\n for (var key in variables) {\n if (!variables.hasOwnProperty(key)) {\n continue;\n }\n pathTemplate = pathTemplate.replace(key, encodeURIComponent(variables[key]));\n }\n return pathTemplate;\n}\n\nvar WidgetUtils = function () {\n function WidgetUtils() {\n (0, _classCallCheck3.default)(this, WidgetUtils);\n }\n\n (0, _createClass3.default)(WidgetUtils, null, [{\n key: 'canUserModifyWidgets',\n\n /* Returns true if user is able to send state events to modify widgets in this room\n * (Does not apply to non-room-based / user widgets)\n * @param roomId -- The ID of the room to check\n * @return Boolean -- true if the user can modify widgets in this room\n * @throws Error -- specifies the error reason\n */\n value: function canUserModifyWidgets(roomId) {\n if (!roomId) {\n console.warn('No room ID specified');\n return false;\n }\n\n var client = _MatrixClientPeg2.default.get();\n if (!client) {\n console.warn('User must be be logged in');\n return false;\n }\n\n var room = client.getRoom(roomId);\n if (!room) {\n console.warn('Room ID ' + roomId + ' is not recognised');\n return false;\n }\n\n var me = client.credentials.userId;\n if (!me) {\n console.warn('Failed to get user ID');\n return false;\n }\n\n if (room.getMyMembership() !== \"join\") {\n console.warn('User ' + me + ' is not in room ' + roomId);\n return false;\n }\n\n return room.currentState.maySendStateEvent('im.vector.modular.widgets', me);\n }\n\n /**\n * Returns true if specified url is a scalar URL, typically https://scalar.vector.im/api\n * @param {[type]} testUrlString URL to check\n * @return {Boolean} True if specified URL is a scalar URL\n */\n\n }, {\n key: 'isScalarUrl',\n value: function isScalarUrl(testUrlString) {\n if (!testUrlString) {\n console.error('Scalar URL check failed. No URL specified');\n return false;\n }\n\n var testUrl = url.parse(testUrlString);\n\n var scalarUrls = _SdkConfig2.default.get().integrations_widgets_urls;\n if (!scalarUrls || scalarUrls.length === 0) {\n scalarUrls = [_SdkConfig2.default.get().integrations_rest_url];\n }\n\n for (var i = 0; i < scalarUrls.length; i++) {\n var scalarUrl = url.parse(scalarUrls[i]);\n if (testUrl && scalarUrl) {\n if (testUrl.protocol === scalarUrl.protocol && testUrl.host === scalarUrl.host && testUrl.pathname.startsWith(scalarUrl.pathname)) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Returns a promise that resolves when a widget with the given\n * ID has been added as a user widget (ie. the accountData event\n * arrives) or rejects after a timeout\n *\n * @param {string} widgetId The ID of the widget to wait for\n * @param {boolean} add True to wait for the widget to be added,\n * false to wait for it to be deleted.\n * @returns {Promise} that resolves when the widget is in the\n * requested state according to the `add` param\n */\n\n }, {\n key: 'waitForUserWidget',\n value: function waitForUserWidget(widgetId, add) {\n return new _promise2.default(function (resolve, reject) {\n // Tests an account data event, returning true if it's in the state\n // we're waiting for it to be in\n function eventInIntendedState(ev) {\n if (!ev || !ev.getContent()) return false;\n if (add) {\n return ev.getContent()[widgetId] !== undefined;\n } else {\n return ev.getContent()[widgetId] === undefined;\n }\n }\n\n var startingAccountDataEvent = _MatrixClientPeg2.default.get().getAccountData('m.widgets');\n if (eventInIntendedState(startingAccountDataEvent)) {\n resolve();\n return;\n }\n\n function onAccountData(ev) {\n var currentAccountDataEvent = _MatrixClientPeg2.default.get().getAccountData('m.widgets');\n if (eventInIntendedState(currentAccountDataEvent)) {\n _MatrixClientPeg2.default.get().removeListener('accountData', onAccountData);\n clearTimeout(timerId);\n resolve();\n }\n }\n var timerId = setTimeout(function () {\n _MatrixClientPeg2.default.get().removeListener('accountData', onAccountData);\n reject(new Error(\"Timed out waiting for widget ID \" + widgetId + \" to appear\"));\n }, WIDGET_WAIT_TIME);\n _MatrixClientPeg2.default.get().on('accountData', onAccountData);\n });\n }\n\n /**\n * Returns a promise that resolves when a widget with the given\n * ID has been added as a room widget in the given room (ie. the\n * room state event arrives) or rejects after a timeout\n *\n * @param {string} widgetId The ID of the widget to wait for\n * @param {string} roomId The ID of the room to wait for the widget in\n * @param {boolean} add True to wait for the widget to be added,\n * false to wait for it to be deleted.\n * @returns {Promise} that resolves when the widget is in the\n * requested state according to the `add` param\n */\n\n }, {\n key: 'waitForRoomWidget',\n value: function waitForRoomWidget(widgetId, roomId, add) {\n return new _promise2.default(function (resolve, reject) {\n // Tests a list of state events, returning true if it's in the state\n // we're waiting for it to be in\n function eventsInIntendedState(evList) {\n var widgetPresent = evList.some(function (ev) {\n return ev.getContent() && ev.getContent()['id'] === widgetId;\n });\n if (add) {\n return widgetPresent;\n } else {\n return !widgetPresent;\n }\n }\n\n var room = _MatrixClientPeg2.default.get().getRoom(roomId);\n var startingWidgetEvents = room.currentState.getStateEvents('im.vector.modular.widgets');\n if (eventsInIntendedState(startingWidgetEvents)) {\n resolve();\n return;\n }\n\n function onRoomStateEvents(ev) {\n if (ev.getRoomId() !== roomId) return;\n\n var currentWidgetEvents = room.currentState.getStateEvents('im.vector.modular.widgets');\n\n if (eventsInIntendedState(currentWidgetEvents)) {\n _MatrixClientPeg2.default.get().removeListener('RoomState.events', onRoomStateEvents);\n clearTimeout(timerId);\n resolve();\n }\n }\n var timerId = setTimeout(function () {\n _MatrixClientPeg2.default.get().removeListener('RoomState.events', onRoomStateEvents);\n reject(new Error(\"Timed out waiting for widget ID \" + widgetId + \" to appear\"));\n }, WIDGET_WAIT_TIME);\n _MatrixClientPeg2.default.get().on('RoomState.events', onRoomStateEvents);\n });\n }\n }, {\n key: 'setUserWidget',\n value: function setUserWidget(widgetId, widgetType, widgetUrl, widgetName, widgetData) {\n var content = {\n type: widgetType,\n url: widgetUrl,\n name: widgetName,\n data: widgetData\n };\n\n var client = _MatrixClientPeg2.default.get();\n var userWidgets = WidgetUtils.getUserWidgets();\n\n // Delete existing widget with ID\n try {\n delete userWidgets[widgetId];\n } catch (e) {\n console.error('$widgetId is non-configurable');\n }\n\n var addingWidget = Boolean(widgetUrl);\n\n // Add new widget / update\n if (addingWidget) {\n userWidgets[widgetId] = {\n content: content,\n sender: client.getUserId(),\n state_key: widgetId,\n type: 'm.widget',\n id: widgetId\n };\n }\n\n // This starts listening for when the echo comes back from the server\n // since the widget won't appear added until this happens. If we don't\n // wait for this, the action will complete but if the user is fast enough,\n // the widget still won't actually be there.\n return client.setAccountData('m.widgets', userWidgets).then(function () {\n return WidgetUtils.waitForUserWidget(widgetId, addingWidget);\n }).then(function () {\n _dispatcher2.default.dispatch({ action: \"user_widget_updated\" });\n });\n }\n }, {\n key: 'setRoomWidget',\n value: function setRoomWidget(roomId, widgetId, widgetType, widgetUrl, widgetName, widgetData) {\n var content = void 0;\n\n var addingWidget = Boolean(widgetUrl);\n\n if (addingWidget) {\n content = {\n type: widgetType,\n url: widgetUrl,\n name: widgetName,\n data: widgetData\n };\n } else {\n content = {};\n }\n\n _WidgetEchoStore2.default.setRoomWidgetEcho(roomId, widgetId, content);\n\n var client = _MatrixClientPeg2.default.get();\n // TODO - Room widgets need to be moved to 'm.widget' state events\n // https://docs.google.com/document/d/1uPF7XWY_dXTKVKV7jZQ2KmsI19wn9-kFRgQ1tFQP7wQ/edit?usp=sharing\n return client.sendStateEvent(roomId, \"im.vector.modular.widgets\", content, widgetId).then(function () {\n return WidgetUtils.waitForRoomWidget(widgetId, roomId, addingWidget);\n }).finally(function () {\n _WidgetEchoStore2.default.removeRoomWidgetEcho(roomId, widgetId);\n });\n }\n\n /**\n * Get room specific widgets\n * @param {object} room The room to get widgets force\n * @return {[object]} Array containing current / active room widgets\n */\n\n }, {\n key: 'getRoomWidgets',\n value: function getRoomWidgets(room) {\n var appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets');\n if (!appsStateEvents) {\n return [];\n }\n\n return appsStateEvents.filter(function (ev) {\n return ev.getContent().type && ev.getContent().url;\n });\n }\n\n /**\n * Get user specific widgets (not linked to a specific room)\n * @return {object} Event content object containing current / active user widgets\n */\n\n }, {\n key: 'getUserWidgets',\n value: function getUserWidgets() {\n var client = _MatrixClientPeg2.default.get();\n if (!client) {\n throw new Error('User not logged in');\n }\n var userWidgets = client.getAccountData('m.widgets');\n if (userWidgets && userWidgets.getContent()) {\n return userWidgets.getContent();\n }\n return {};\n }\n\n /**\n * Get user specific widgets (not linked to a specific room) as an array\n * @return {[object]} Array containing current / active user widgets\n */\n\n }, {\n key: 'getUserWidgetsArray',\n value: function getUserWidgetsArray() {\n return (0, _values2.default)(WidgetUtils.getUserWidgets());\n }\n\n /**\n * Get active stickerpicker widgets (stickerpickers are user widgets by nature)\n * @return {[object]} Array containing current / active stickerpicker widgets\n */\n\n }, {\n key: 'getStickerpickerWidgets',\n value: function getStickerpickerWidgets() {\n var widgets = WidgetUtils.getUserWidgetsArray();\n return widgets.filter(function (widget) {\n return widget.content && widget.content.type === \"m.stickerpicker\";\n });\n }\n\n /**\n * Remove all stickerpicker widgets (stickerpickers are user widgets by nature)\n * @return {Promise} Resolves on account data updated\n */\n\n }, {\n key: 'removeStickerpickerWidgets',\n value: function removeStickerpickerWidgets() {\n var client = _MatrixClientPeg2.default.get();\n if (!client) {\n throw new Error('User not logged in');\n }\n var userWidgets = client.getAccountData('m.widgets').getContent() || {};\n (0, _entries2.default)(userWidgets).forEach(function (_ref) {\n var _ref2 = (0, _slicedToArray3.default)(_ref, 2),\n key = _ref2[0],\n widget = _ref2[1];\n\n if (widget.content && widget.content.type === 'm.stickerpicker') {\n delete userWidgets[key];\n }\n });\n return client.setAccountData('m.widgets', userWidgets);\n }\n }, {\n key: 'makeAppConfig',\n value: function makeAppConfig(appId, app, sender, roomId) {\n var myUserId = _MatrixClientPeg2.default.get().credentials.userId;\n var user = _MatrixClientPeg2.default.get().getUser(myUserId);\n var params = {\n '$matrix_user_id': myUserId,\n '$matrix_room_id': roomId,\n '$matrix_display_name': user ? user.displayName : myUserId,\n '$matrix_avatar_url': user ? _MatrixClientPeg2.default.get().mxcUrlToHttp(user.avatarUrl) : '',\n\n // TODO: Namespace themes through some standard\n '$theme': _SettingsStore2.default.getValue(\"theme\")\n };\n\n app.id = appId;\n app.name = app.name || app.type;\n\n if (app.data) {\n (0, _keys2.default)(app.data).forEach(function (key) {\n params['$' + key] = app.data[key];\n });\n\n app.waitForIframeLoad = app.data.waitForIframeLoad === 'false' ? false : true;\n }\n\n app.url = encodeUri(app.url, params);\n app.creatorUserId = sender && sender.userId ? sender.userId : null;\n\n return app;\n }\n }, {\n key: 'getCapWhitelistForAppTypeInRoomId',\n value: function getCapWhitelistForAppTypeInRoomId(appType, roomId) {\n var enableScreenshots = _SettingsStore2.default.getValue(\"enableWidgetScreenshots\", roomId);\n\n var capWhitelist = enableScreenshots ? [\"m.capability.screenshot\"] : [];\n\n // Obviously anyone that can add a widget can claim it's a jitsi widget,\n // so this doesn't really offer much over the set of domains we load\n // widgets from at all, but it probably makes sense for sanity.\n if (appType == 'jitsi') capWhitelist.push(\"m.always_on_screen\");\n\n return capWhitelist;\n }\n }]);\n return WidgetUtils;\n}();\n\nexports.default = WidgetUtils;\nmodule.exports = exports['default'];\n//# sourceMappingURL=WidgetUtils.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.formatDate = formatDate;\nexports.formatFullDateNoTime = formatFullDateNoTime;\nexports.formatFullDate = formatFullDate;\nexports.formatFullTime = formatFullTime;\nexports.formatTime = formatTime;\nexports.wantsDateSeparator = wantsDateSeparator;\n\nvar _languageHandler = require('./languageHandler');\n\nfunction getDaysArray() {\n return [(0, _languageHandler._t)('Sun'), (0, _languageHandler._t)('Mon'), (0, _languageHandler._t)('Tue'), (0, _languageHandler._t)('Wed'), (0, _languageHandler._t)('Thu'), (0, _languageHandler._t)('Fri'), (0, _languageHandler._t)('Sat')];\n} /*\n Copyright 2015, 2016 OpenMarket Ltd\n Copyright 2017 Vector Creations Ltd\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\nfunction getMonthsArray() {\n return [(0, _languageHandler._t)('Jan'), (0, _languageHandler._t)('Feb'), (0, _languageHandler._t)('Mar'), (0, _languageHandler._t)('Apr'), (0, _languageHandler._t)('May'), (0, _languageHandler._t)('Jun'), (0, _languageHandler._t)('Jul'), (0, _languageHandler._t)('Aug'), (0, _languageHandler._t)('Sep'), (0, _languageHandler._t)('Oct'), (0, _languageHandler._t)('Nov'), (0, _languageHandler._t)('Dec')];\n}\n\nfunction pad(n) {\n return (n < 10 ? '0' : '') + n;\n}\n\nfunction twelveHourTime(date) {\n var showSeconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var hours = date.getHours() % 12;\n var minutes = pad(date.getMinutes());\n var ampm = date.getHours() >= 12 ? (0, _languageHandler._t)('PM') : (0, _languageHandler._t)('AM');\n hours = hours ? hours : 12; // convert 0 -> 12\n if (showSeconds) {\n var seconds = pad(date.getSeconds());\n return hours + ':' + minutes + ':' + seconds + ampm;\n }\n return hours + ':' + minutes + ampm;\n}\n\nfunction formatDate(date) {\n var showTwelveHour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var now = new Date();\n var days = getDaysArray();\n var months = getMonthsArray();\n if (date.toDateString() === now.toDateString()) {\n return formatTime(date, showTwelveHour);\n } else if (now.getTime() - date.getTime() < 6 * 24 * 60 * 60 * 1000) {\n // TODO: use standard date localize function provided in counterpart\n return (0, _languageHandler._t)('%(weekDayName)s %(time)s', {\n weekDayName: days[date.getDay()],\n time: formatTime(date, showTwelveHour)\n });\n } else if (now.getFullYear() === date.getFullYear()) {\n // TODO: use standard date localize function provided in counterpart\n return (0, _languageHandler._t)('%(weekDayName)s, %(monthName)s %(day)s %(time)s', {\n weekDayName: days[date.getDay()],\n monthName: months[date.getMonth()],\n day: date.getDate(),\n time: formatTime(date, showTwelveHour)\n });\n }\n return formatFullDate(date, showTwelveHour);\n}\n\nfunction formatFullDateNoTime(date) {\n var days = getDaysArray();\n var months = getMonthsArray();\n return (0, _languageHandler._t)('%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s', {\n weekDayName: days[date.getDay()],\n monthName: months[date.getMonth()],\n day: date.getDate(),\n fullYear: date.getFullYear()\n });\n}\n\nfunction formatFullDate(date) {\n var showTwelveHour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var days = getDaysArray();\n var months = getMonthsArray();\n return (0, _languageHandler._t)('%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s', {\n weekDayName: days[date.getDay()],\n monthName: months[date.getMonth()],\n day: date.getDate(),\n fullYear: date.getFullYear(),\n time: formatFullTime(date, showTwelveHour)\n });\n}\n\nfunction formatFullTime(date) {\n var showTwelveHour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (showTwelveHour) {\n return twelveHourTime(date, true);\n }\n return pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds());\n}\n\nfunction formatTime(date) {\n var showTwelveHour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (showTwelveHour) {\n return twelveHourTime(date);\n }\n return pad(date.getHours()) + ':' + pad(date.getMinutes());\n}\n\nvar MILLIS_IN_DAY = 86400000;\nfunction wantsDateSeparator(prevEventDate, nextEventDate) {\n if (!nextEventDate || !prevEventDate) {\n return false;\n }\n // Return early for events that are > 24h apart\n if (Math.abs(prevEventDate.getTime() - nextEventDate.getTime()) > MILLIS_IN_DAY) {\n return true;\n }\n\n // Compare weekdays\n return prevEventDate.getDay() !== nextEventDate.getDay();\n}\n//# sourceMappingURL=DateUtils.js.map","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _regenerator = require('babel-runtime/regenerator');\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _keys = require('babel-runtime/core-js/object/keys');\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nvar _bluebird = require('bluebird');\n\nvar _bluebird2 = _interopRequireDefault(_bluebird);\n\nvar _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _events = require('events');\n\nvar _events2 = _interopRequireDefault(_events);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\nCopyright 2017 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar BULK_REQUEST_DEBOUNCE_MS = 200;\n\n// Does the server support groups? Assume yes until we receive M_UNRECOGNIZED.\n// If true, flair can function and we should keep sending requests for groups and avatars.\nvar _groupSupport = true;\n\nvar USER_GROUPS_CACHE_BUST_MS = 1800000; // 30 mins\nvar GROUP_PROFILES_CACHE_BUST_MS = 1800000; // 30 mins\n\n/**\n * Stores data used by \n */\n\nvar FlairStore = function (_EventEmitter) {\n (0, _inherits3.default)(FlairStore, _EventEmitter);\n\n function FlairStore(matrixClient) {\n (0, _classCallCheck3.default)(this, FlairStore);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, (FlairStore.__proto__ || (0, _getPrototypeOf2.default)(FlairStore)).call(this));\n\n _this._matrixClient = matrixClient;\n _this._userGroups = {\n // $userId: ['+group1:domain', '+group2:domain', ...]\n };\n _this._groupProfiles = {\n // $groupId: {\n // avatar_url: 'mxc://...'\n // }\n };\n _this._groupProfilesPromise = {\n // $groupId: Promise\n };\n _this._usersPending = {\n // $userId: {\n // prom: Promise\n // resolve: () => {}\n // reject: () => {}\n // }\n };\n _this._usersInFlight = {\n // This has the same schema as _usersPending\n };\n\n _this._debounceTimeoutID = null;\n return _this;\n }\n\n (0, _createClass3.default)(FlairStore, [{\n key: 'groupSupport',\n value: function groupSupport() {\n return _groupSupport;\n }\n }, {\n key: 'invalidatePublicisedGroups',\n value: function invalidatePublicisedGroups(userId) {\n delete this._userGroups[userId];\n }\n }, {\n key: 'getPublicisedGroupsCached',\n value: function getPublicisedGroupsCached(matrixClient, userId) {\n var _this2 = this;\n\n if (this._userGroups[userId]) {\n return _bluebird2.default.resolve(this._userGroups[userId]);\n }\n\n // Bulk lookup ongoing, return promise to resolve/reject\n if (this._usersPending[userId]) {\n return this._usersPending[userId].prom;\n }\n // User has been moved from pending to in-flight\n if (this._usersInFlight[userId]) {\n return this._usersInFlight[userId].prom;\n }\n\n this._usersPending[userId] = {};\n this._usersPending[userId].prom = new _bluebird2.default(function (resolve, reject) {\n _this2._usersPending[userId].resolve = resolve;\n _this2._usersPending[userId].reject = reject;\n }).then(function (groups) {\n _this2._userGroups[userId] = groups;\n setTimeout(function () {\n delete _this2._userGroups[userId];\n }, USER_GROUPS_CACHE_BUST_MS);\n return _this2._userGroups[userId];\n }).catch(function (err) {\n // Indicate whether the homeserver supports groups\n if (err.errcode === 'M_UNRECOGNIZED') {\n console.warn('Cannot display flair, server does not support groups');\n _groupSupport = false;\n // Return silently to avoid spamming for non-supporting servers\n return;\n }\n console.error('Could not get groups for user', userId, err);\n throw err;\n }).finally(function () {\n delete _this2._usersInFlight[userId];\n });\n\n // This debounce will allow consecutive requests for the public groups of users that\n // are sent in intervals of < BULK_REQUEST_DEBOUNCE_MS to be batched and only requested\n // when no more requests are received within the next BULK_REQUEST_DEBOUNCE_MS. The naive\n // implementation would do a request that only requested the groups for `userId`, leading\n // to a worst and best case of 1 user per request. This implementation's worst is still\n // 1 user per request but only if the requests are > BULK_REQUEST_DEBOUNCE_MS apart and the\n // best case is N users per request.\n //\n // This is to reduce the number of requests made whilst trading off latency when viewing\n // a Flair component.\n if (this._debounceTimeoutID) clearTimeout(this._debounceTimeoutID);\n this._debounceTimeoutID = setTimeout(function () {\n _this2._batchedGetPublicGroups(matrixClient);\n }, BULK_REQUEST_DEBOUNCE_MS);\n\n return this._usersPending[userId].prom;\n }\n }, {\n key: '_batchedGetPublicGroups',\n value: function () {\n var _ref = (0, _bluebird.coroutine)( /*#__PURE__*/_regenerator2.default.mark(function _callee(matrixClient) {\n var _this3 = this;\n\n var resp, updatedUserGroups;\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n // Move users pending to users in flight\n this._usersInFlight = this._usersPending;\n this._usersPending = {};\n\n resp = {\n users: []\n };\n _context.prev = 3;\n _context.next = 6;\n return (0, _bluebird.resolve)(matrixClient.getPublicisedGroups((0, _keys2.default)(this._usersInFlight)));\n\n case 6:\n resp = _context.sent;\n _context.next = 13;\n break;\n\n case 9:\n _context.prev = 9;\n _context.t0 = _context['catch'](3);\n\n // Propagate the same error to all usersInFlight\n (0, _keys2.default)(this._usersInFlight).forEach(function (userId) {\n // The promise should always exist for userId, but do a null-check anyway\n if (!_this3._usersInFlight[userId]) return;\n _this3._usersInFlight[userId].reject(_context.t0);\n });\n return _context.abrupt('return');\n\n case 13:\n updatedUserGroups = resp.users;\n\n (0, _keys2.default)(this._usersInFlight).forEach(function (userId) {\n // The promise should always exist for userId, but do a null-check anyway\n if (!_this3._usersInFlight[userId]) return;\n _this3._usersInFlight[userId].resolve(updatedUserGroups[userId] || []);\n });\n\n case 15:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this, [[3, 9]]);\n }));\n\n function _batchedGetPublicGroups(_x) {\n return _ref.apply(this, arguments);\n }\n\n return _batchedGetPublicGroups;\n }()\n }, {\n key: 'getGroupProfileCached',\n value: function () {\n var _ref2 = (0, _bluebird.coroutine)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(matrixClient, groupId) {\n var _this4 = this;\n\n var profile;\n return _regenerator2.default.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!this._groupProfiles[groupId]) {\n _context2.next = 2;\n break;\n }\n\n return _context2.abrupt('return', this._groupProfiles[groupId]);\n\n case 2:\n if (!this._groupProfilesPromise[groupId]) {\n _context2.next = 12;\n break;\n }\n\n _context2.prev = 3;\n _context2.next = 6;\n return (0, _bluebird.resolve)(this._groupProfilesPromise[groupId]);\n\n case 6:\n _context2.next = 11;\n break;\n\n case 8:\n _context2.prev = 8;\n _context2.t0 = _context2['catch'](3);\n return _context2.abrupt('return', null);\n\n case 11:\n return _context2.abrupt('return', this._groupProfiles[groupId]);\n\n case 12:\n\n // No request yet, start one\n console.log('FlairStore: Request group profile of ' + groupId);\n this._groupProfilesPromise[groupId] = matrixClient.getGroupProfile(groupId);\n\n profile = void 0;\n _context2.prev = 15;\n _context2.next = 18;\n return (0, _bluebird.resolve)(this._groupProfilesPromise[groupId]);\n\n case 18:\n profile = _context2.sent;\n _context2.next = 26;\n break;\n\n case 21:\n _context2.prev = 21;\n _context2.t1 = _context2['catch'](15);\n\n console.log('FlairStore: Failed to get group profile for ' + groupId, _context2.t1);\n // Don't retry, but allow a retry when the profile is next requested\n delete this._groupProfilesPromise[groupId];\n return _context2.abrupt('return', null);\n\n case 26:\n\n this._groupProfiles[groupId] = {\n groupId: groupId,\n avatarUrl: profile.avatar_url,\n name: profile.name,\n shortDescription: profile.short_description\n };\n delete this._groupProfilesPromise[groupId];\n\n /// XXX: This is verging on recreating a third \"Flux\"-looking Store. We really\n /// should replace FlairStore with a Flux store and some async actions.\n console.log('FlairStore: Emit updateGroupProfile for ' + groupId);\n this.emit('updateGroupProfile');\n\n setTimeout(function () {\n _this4.refreshGroupProfile(matrixClient, groupId);\n }, GROUP_PROFILES_CACHE_BUST_MS);\n\n return _context2.abrupt('return', this._groupProfiles[groupId]);\n\n case 32:\n case 'end':\n return _context2.stop();\n }\n }\n }, _callee2, this, [[3, 8], [15, 21]]);\n }));\n\n function getGroupProfileCached(_x2, _x3) {\n return _ref2.apply(this, arguments);\n }\n\n return getGroupProfileCached;\n }()\n }, {\n key: 'refreshGroupProfile',\n value: function refreshGroupProfile(matrixClient, groupId) {\n // Invalidate the cache\n delete this._groupProfiles[groupId];\n // Fetch new profile data, and cache it\n return this.getGroupProfileCached(matrixClient, groupId);\n }\n }]);\n return FlairStore;\n}(_events2.default);\n\nif (global.singletonFlairStore === undefined) {\n global.singletonFlairStore = new FlairStore();\n}\nexports.default = global.singletonFlairStore;\nmodule.exports = exports['default'];\n//# sourceMappingURL=FlairStore.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _getArea = require('../get-area');\n\nvar _getArea2 = _interopRequireDefault(_getArea);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n var top = window.pageYOffset;\n var left = window.pageXOffset;\n var width = window.innerWidth;\n var height = window.innerHeight;\n\n var right = left + width;\n var bottom = top + height;\n\n return (0, _getArea2.default)({\n top: top, left: left, right: right, bottom: bottom\n });\n};","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar prefix = function prefix(key) {\n return 'private-react-beautiful-dnd-key-do-not-use-' + key;\n};\n\nvar storeKey = exports.storeKey = prefix('store');\nvar droppableIdKey = exports.droppableIdKey = prefix('droppable-id');\nvar dimensionMarshalKey = exports.dimensionMarshalKey = prefix('dimension-marshal');\nvar styleContextKey = exports.styleContextKey = prefix('style-context');\nvar canLiftContextKey = exports.canLiftContextKey = prefix('can-lift');","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _getIterator2 = require('babel-runtime/core-js/get-iterator');\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nvar _keys = require('babel-runtime/core-js/object/keys');\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nexports.getDisplayAliasForRoom = getDisplayAliasForRoom;\nexports.getOnlyOtherMember = getOnlyOtherMember;\nexports.isConfCallRoom = isConfCallRoom;\nexports.looksLikeDirectMessageRoom = looksLikeDirectMessageRoom;\nexports.guessAndSetDMRoom = guessAndSetDMRoom;\nexports.setDMRoom = setDMRoom;\n\nvar _MatrixClientPeg = require('./MatrixClientPeg');\n\nvar _MatrixClientPeg2 = _interopRequireDefault(_MatrixClientPeg);\n\nvar _bluebird = require('bluebird');\n\nvar _bluebird2 = _interopRequireDefault(_bluebird);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Given a room object, return the alias we should use for it,\n * if any. This could be the canonical alias if one exists, otherwise\n * an alias selected arbitrarily but deterministically from the list\n * of aliases. Otherwise return null;\n */\n/*\nCopyright 2015, 2016 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nfunction getDisplayAliasForRoom(room) {\n return room.getCanonicalAlias() || room.getAliases()[0];\n}\n\n/**\n * If the room contains only two members including the logged-in user,\n * return the other one. Otherwise, return null.\n */\nfunction getOnlyOtherMember(room, myUserId) {\n if (room.currentState.getJoinedMemberCount() === 2) {\n return room.getJoinedMembers().filter(function (m) {\n return m.userId !== myUserId;\n })[0];\n }\n\n return null;\n}\n\nfunction _isConfCallRoom(room, myUserId, conferenceHandler) {\n if (!conferenceHandler) return false;\n\n var myMembership = room.getMyMembership();\n if (myMembership != \"join\") {\n return false;\n }\n\n var otherMember = getOnlyOtherMember(room, myUserId);\n if (!otherMember) {\n return false;\n }\n\n if (conferenceHandler.isConferenceUser(otherMember.userId)) {\n return true;\n }\n\n return false;\n}\n\n// Cache whether a room is a conference call. Assumes that rooms will always\n// either will or will not be a conference call room.\nvar isConfCallRoomCache = {\n // $roomId: bool\n};\n\nfunction isConfCallRoom(room, myUserId, conferenceHandler) {\n if (isConfCallRoomCache[room.roomId] !== undefined) {\n return isConfCallRoomCache[room.roomId];\n }\n\n var result = _isConfCallRoom(room, myUserId, conferenceHandler);\n\n isConfCallRoomCache[room.roomId] = result;\n\n return result;\n}\n\nfunction looksLikeDirectMessageRoom(room, myUserId) {\n var myMembership = room.getMyMembership();\n var me = room.getMember(myUserId);\n\n if (myMembership == \"join\" || myMembership === \"ban\" || me && me.isKicked()) {\n // Used to split rooms via tags\n var tagNames = (0, _keys2.default)(room.tags);\n // Used for 1:1 direct chats\n // Show 1:1 chats in seperate \"Direct Messages\" section as long as they haven't\n // been moved to a different tag section\n var totalMemberCount = room.currentState.getJoinedMemberCount() + room.currentState.getInvitedMemberCount();\n if (totalMemberCount === 2 && !tagNames.length) {\n return true;\n }\n }\n return false;\n}\n\nfunction guessAndSetDMRoom(room, isDirect) {\n var newTarget = void 0;\n if (isDirect) {\n var guessedUserId = guessDMRoomTargetId(room, _MatrixClientPeg2.default.get().getUserId());\n newTarget = guessedUserId;\n } else {\n newTarget = null;\n }\n\n return setDMRoom(room.roomId, newTarget);\n}\n\n/**\n * Marks or unmarks the given room as being as a DM room.\n * @param {string} roomId The ID of the room to modify\n * @param {string} userId The user ID of the desired DM\n room target user or null to un-mark\n this room as a DM room\n * @returns {object} A promise\n */\nfunction setDMRoom(roomId, userId) {\n if (_MatrixClientPeg2.default.get().isGuest()) {\n return _bluebird2.default.resolve();\n }\n\n var mDirectEvent = _MatrixClientPeg2.default.get().getAccountData('m.direct');\n var dmRoomMap = {};\n\n if (mDirectEvent !== undefined) dmRoomMap = mDirectEvent.getContent();\n\n // remove it from the lists of any others users\n // (it can only be a DM room for one person)\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = (0, _getIterator3.default)((0, _keys2.default)(dmRoomMap)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var thisUserId = _step.value;\n\n var _roomList = dmRoomMap[thisUserId];\n\n if (thisUserId != userId) {\n var indexOfRoom = _roomList.indexOf(roomId);\n if (indexOfRoom > -1) {\n _roomList.splice(indexOfRoom, 1);\n }\n }\n }\n\n // now add it, if it's not already there\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n if (userId) {\n var roomList = dmRoomMap[userId] || [];\n if (roomList.indexOf(roomId) == -1) {\n roomList.push(roomId);\n }\n dmRoomMap[userId] = roomList;\n }\n\n return _MatrixClientPeg2.default.get().setAccountData('m.direct', dmRoomMap);\n}\n\n/**\n * Given a room, estimate which of its members is likely to\n * be the target if the room were a DM room and return that user.\n *\n * @param {Object} room Target room\n * @param {string} myUserId User ID of the current user\n * @returns {string} User ID of the user that the room is probably a DM with\n */\nfunction guessDMRoomTargetId(room, myUserId) {\n var oldestTs = void 0;\n var oldestUser = void 0;\n\n // Pick the joined user who's been here longest (and isn't us),\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = (0, _getIterator3.default)(room.getJoinedMembers()), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var user = _step2.value;\n\n if (user.userId == myUserId) continue;\n\n if (oldestTs === undefined || user.events.member && user.events.member.getTs() < oldestTs) {\n oldestUser = user;\n oldestTs = user.events.member.getTs();\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n if (oldestUser) return oldestUser.userId;\n\n // if there are no joined members other than us, use the oldest member\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = (0, _getIterator3.default)(room.currentState.getMembers()), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var _user = _step3.value;\n\n if (_user.userId == myUserId) continue;\n\n if (oldestTs === undefined || _user.events.member && _user.events.member.getTs() < oldestTs) {\n oldestUser = _user;\n oldestTs = _user.events.member.getTs();\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n if (oldestUser === undefined) return myUserId;\n return oldestUser.userId;\n}\n//# sourceMappingURL=Rooms.js.map","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = require('./_object-keys-internal');\nvar hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n","'use strict';\nvar global = require('./_global');\nvar dP = require('./_object-dp');\nvar DESCRIPTORS = require('./_descriptors');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (KEY) {\n var C = global[KEY];\n if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n};\n","module.exports = function (it, Constructor, name, forbiddenField) {\n if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {\n throw TypeError(name + ': incorrect invocation!');\n } return it;\n};\n","var ctx = require('./_ctx');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar anObject = require('./_an-object');\nvar toLength = require('./_to-length');\nvar getIterFn = require('./core.get-iterator-method');\nvar BREAK = {};\nvar RETURN = {};\nvar exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {\n var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);\n var f = ctx(fn, that, entries ? 2 : 1);\n var index = 0;\n var length, step, iterator, result;\n if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');\n // fast case for arrays with default iterator\n if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {\n result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);\n if (result === BREAK || result === RETURN) return result;\n } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {\n result = call(iterator, f, step.value, entries);\n if (result === BREAK || result === RETURN) return result;\n }\n};\nexports.BREAK = BREAK;\nexports.RETURN = RETURN;\n","var redefine = require('./_redefine');\nmodule.exports = function (target, src, safe) {\n for (var key in src) redefine(target, key, src[key], safe);\n return target;\n};\n","module.exports = { \"default\": require(\"core-js/library/fn/array/from\"), __esModule: true };","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n","exports.f = require('./_wks');\n","var global = require('./_global');\nvar core = require('./_core');\nvar LIBRARY = require('./_library');\nvar wksExt = require('./_wks-ext');\nvar defineProperty = require('./_object-dp').f;\nmodule.exports = function (name) {\n var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar _assign = require('object-assign');\n\nvar ReactBaseClasses = require('./ReactBaseClasses');\nvar ReactChildren = require('./ReactChildren');\nvar ReactDOMFactories = require('./ReactDOMFactories');\nvar ReactElement = require('./ReactElement');\nvar ReactPropTypes = require('./ReactPropTypes');\nvar ReactVersion = require('./ReactVersion');\n\nvar createReactClass = require('./createClass');\nvar onlyChild = require('./onlyChild');\n\nvar createElement = ReactElement.createElement;\nvar createFactory = ReactElement.createFactory;\nvar cloneElement = ReactElement.cloneElement;\n\nif (process.env.NODE_ENV !== 'production') {\n var lowPriorityWarning = require('./lowPriorityWarning');\n var canDefineProperty = require('./canDefineProperty');\n var ReactElementValidator = require('./ReactElementValidator');\n var didWarnPropTypesDeprecated = false;\n createElement = ReactElementValidator.createElement;\n createFactory = ReactElementValidator.createFactory;\n cloneElement = ReactElementValidator.cloneElement;\n}\n\nvar __spread = _assign;\nvar createMixin = function (mixin) {\n return mixin;\n};\n\nif (process.env.NODE_ENV !== 'production') {\n var warnedForSpread = false;\n var warnedForCreateMixin = false;\n __spread = function () {\n lowPriorityWarning(warnedForSpread, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.');\n warnedForSpread = true;\n return _assign.apply(null, arguments);\n };\n\n createMixin = function (mixin) {\n lowPriorityWarning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. ' + 'In React v16.0, it will be removed. ' + 'You can use this mixin directly instead. ' + 'See https://fb.me/createmixin-was-never-implemented for more info.');\n warnedForCreateMixin = true;\n return mixin;\n };\n}\n\nvar React = {\n // Modern\n\n Children: {\n map: ReactChildren.map,\n forEach: ReactChildren.forEach,\n count: ReactChildren.count,\n toArray: ReactChildren.toArray,\n only: onlyChild\n },\n\n Component: ReactBaseClasses.Component,\n PureComponent: ReactBaseClasses.PureComponent,\n\n createElement: createElement,\n cloneElement: cloneElement,\n isValidElement: ReactElement.isValidElement,\n\n // Classic\n\n PropTypes: ReactPropTypes,\n createClass: createReactClass,\n createFactory: createFactory,\n createMixin: createMixin,\n\n // This looks DOM specific but these are actually isomorphic helpers\n // since they are just generating DOM strings.\n DOM: ReactDOMFactories,\n\n version: ReactVersion,\n\n // Deprecated hook for JSX spread, don't use this for anything.\n __spread: __spread\n};\n\nif (process.env.NODE_ENV !== 'production') {\n var warnedForCreateClass = false;\n if (canDefineProperty) {\n Object.defineProperty(React, 'PropTypes', {\n get: function () {\n lowPriorityWarning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated,' + ' and will be removed in React v16.0.' + ' Use the latest available v15.* prop-types package from npm instead.' + ' For info on usage, compatibility, migration and more, see ' + 'https://fb.me/prop-types-docs');\n didWarnPropTypesDeprecated = true;\n return ReactPropTypes;\n }\n });\n\n Object.defineProperty(React, 'createClass', {\n get: function () {\n lowPriorityWarning(warnedForCreateClass, 'Accessing createClass via the main React package is deprecated,' + ' and will be removed in React v16.0.' + \" Use a plain JavaScript class instead. If you're not yet \" + 'ready to migrate, create-react-class v15.* is available ' + 'on npm as a temporary, drop-in replacement. ' + 'For more info see https://fb.me/react-create-class');\n warnedForCreateClass = true;\n return createReactClass;\n }\n });\n }\n\n // React.DOM factories are deprecated. Wrap these methods so that\n // invocations of the React.DOM namespace and alert users to switch\n // to the `react-dom-factories` package.\n React.DOM = {};\n var warnedForFactories = false;\n Object.keys(ReactDOMFactories).forEach(function (factory) {\n React.DOM[factory] = function () {\n if (!warnedForFactories) {\n lowPriorityWarning(false, 'Accessing factories like React.DOM.%s has been deprecated ' + 'and will be removed in v16.0+. Use the ' + 'react-dom-factories package instead. ' + ' Version 1.0 provides a drop-in replacement.' + ' For more info, see https://fb.me/react-dom-factories', factory);\n warnedForFactories = true;\n }\n return ReactDOMFactories[factory].apply(ReactDOMFactories, arguments);\n };\n });\n}\n\nmodule.exports = React;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use strict';\n\nvar _prodInvariant = require('./reactProdInvariant');\n\nvar invariant = require('fbjs/lib/invariant');\n\n/**\n * Static poolers. Several custom versions for each potential number of\n * arguments. A completely generic pooler is easy to implement, but would\n * require accessing the `arguments` object. In each of these, `this` refers to\n * the Class itself, not an instance. If any others are needed, simply add them\n * here, or in their own files.\n */\nvar oneArgumentPooler = function (copyFieldsFrom) {\n var Klass = this;\n if (Klass.instancePool.length) {\n var instance = Klass.instancePool.pop();\n Klass.call(instance, copyFieldsFrom);\n return instance;\n } else {\n return new Klass(copyFieldsFrom);\n }\n};\n\nvar twoArgumentPooler = function (a1, a2) {\n var Klass = this;\n if (Klass.instancePool.length) {\n var instance = Klass.instancePool.pop();\n Klass.call(instance, a1, a2);\n return instance;\n } else {\n return new Klass(a1, a2);\n }\n};\n\nvar threeArgumentPooler = function (a1, a2, a3) {\n var Klass = this;\n if (Klass.instancePool.length) {\n var instance = Klass.instancePool.pop();\n Klass.call(instance, a1, a2, a3);\n return instance;\n } else {\n return new Klass(a1, a2, a3);\n }\n};\n\nvar fourArgumentPooler = function (a1, a2, a3, a4) {\n var Klass = this;\n if (Klass.instancePool.length) {\n var instance = Klass.instancePool.pop();\n Klass.call(instance, a1, a2, a3, a4);\n return instance;\n } else {\n return new Klass(a1, a2, a3, a4);\n }\n};\n\nvar standardReleaser = function (instance) {\n var Klass = this;\n !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;\n instance.destructor();\n if (Klass.instancePool.length < Klass.poolSize) {\n Klass.instancePool.push(instance);\n }\n};\n\nvar DEFAULT_POOL_SIZE = 10;\nvar DEFAULT_POOLER = oneArgumentPooler;\n\n/**\n * Augments `CopyConstructor` to be a poolable class, augmenting only the class\n * itself (statically) not adding any prototypical fields. Any CopyConstructor\n * you give this may have a `poolSize` property, and will look for a\n * prototypical `destructor` on instances.\n *\n * @param {Function} CopyConstructor Constructor that can be used to reset.\n * @param {Function} pooler Customizable pooler.\n */\nvar addPoolingTo = function (CopyConstructor, pooler) {\n // Casting as any so that flow ignores the actual implementation and trusts\n // it to match the type we declared\n var NewKlass = CopyConstructor;\n NewKlass.instancePool = [];\n NewKlass.getPooled = pooler || DEFAULT_POOLER;\n if (!NewKlass.poolSize) {\n NewKlass.poolSize = DEFAULT_POOL_SIZE;\n }\n NewKlass.release = standardReleaser;\n return NewKlass;\n};\n\nvar PooledClass = {\n addPoolingTo: addPoolingTo,\n oneArgumentPooler: oneArgumentPooler,\n twoArgumentPooler: twoArgumentPooler,\n threeArgumentPooler: threeArgumentPooler,\n fourArgumentPooler: fourArgumentPooler\n};\n\nmodule.exports = PooledClass;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar ReactRef = require('./ReactRef');\nvar ReactInstrumentation = require('./ReactInstrumentation');\n\nvar warning = require('fbjs/lib/warning');\n\n/**\n * Helper to call ReactRef.attachRefs with this composite component, split out\n * to avoid allocations in the transaction mount-ready queue.\n */\nfunction attachRefs() {\n ReactRef.attachRefs(this, this._currentElement);\n}\n\nvar ReactReconciler = {\n /**\n * Initializes the component, renders markup, and registers event listeners.\n *\n * @param {ReactComponent} internalInstance\n * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n * @param {?object} the containing host component instance\n * @param {?object} info about the host container\n * @return {?string} Rendered markup to be inserted into the DOM.\n * @final\n * @internal\n */\n mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID) // 0 in production and for roots\n {\n if (process.env.NODE_ENV !== 'production') {\n if (internalInstance._debugID !== 0) {\n ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);\n }\n }\n var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);\n if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {\n transaction.getReactMountReady().enqueue(attachRefs, internalInstance);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (internalInstance._debugID !== 0) {\n ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);\n }\n }\n return markup;\n },\n\n /**\n * Returns a value that can be passed to\n * ReactComponentEnvironment.replaceNodeWithMarkup.\n */\n getHostNode: function (internalInstance) {\n return internalInstance.getHostNode();\n },\n\n /**\n * Releases any resources allocated by `mountComponent`.\n *\n * @final\n * @internal\n */\n unmountComponent: function (internalInstance, safely) {\n if (process.env.NODE_ENV !== 'production') {\n if (internalInstance._debugID !== 0) {\n ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);\n }\n }\n ReactRef.detachRefs(internalInstance, internalInstance._currentElement);\n internalInstance.unmountComponent(safely);\n if (process.env.NODE_ENV !== 'production') {\n if (internalInstance._debugID !== 0) {\n ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);\n }\n }\n },\n\n /**\n * Update a component using a new element.\n *\n * @param {ReactComponent} internalInstance\n * @param {ReactElement} nextElement\n * @param {ReactReconcileTransaction} transaction\n * @param {object} context\n * @internal\n */\n receiveComponent: function (internalInstance, nextElement, transaction, context) {\n var prevElement = internalInstance._currentElement;\n\n if (nextElement === prevElement && context === internalInstance._context) {\n // Since elements are immutable after the owner is rendered,\n // we can do a cheap identity compare here to determine if this is a\n // superfluous reconcile. It's possible for state to be mutable but such\n // change should trigger an update of the owner which would recreate\n // the element. We explicitly check for the existence of an owner since\n // it's possible for an element created outside a composite to be\n // deeply mutated and reused.\n\n // TODO: Bailing out early is just a perf optimization right?\n // TODO: Removing the return statement should affect correctness?\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (internalInstance._debugID !== 0) {\n ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);\n }\n }\n\n var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);\n\n if (refsChanged) {\n ReactRef.detachRefs(internalInstance, prevElement);\n }\n\n internalInstance.receiveComponent(nextElement, transaction, context);\n\n if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {\n transaction.getReactMountReady().enqueue(attachRefs, internalInstance);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (internalInstance._debugID !== 0) {\n ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);\n }\n }\n },\n\n /**\n * Flush any dirty changes in a component.\n *\n * @param {ReactComponent} internalInstance\n * @param {ReactReconcileTransaction} transaction\n * @internal\n */\n performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {\n if (internalInstance._updateBatchNumber !== updateBatchNumber) {\n // The component's enqueued batch number should always be the current\n // batch or the following one.\n process.env.NODE_ENV !== 'production' ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n if (internalInstance._debugID !== 0) {\n ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);\n }\n }\n internalInstance.performUpdateIfNecessary(transaction);\n if (process.env.NODE_ENV !== 'production') {\n if (internalInstance._debugID !== 0) {\n ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);\n }\n }\n }\n};\n\nmodule.exports = ReactReconciler;","/*\nCopyright 2016, 2017 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\"use strict\";\n\n/**\n * @module models/event-timeline\n */\n\nvar _freeze = require(\"babel-runtime/core-js/object/freeze\");\n\nvar _freeze2 = _interopRequireDefault(_freeze);\n\nvar _getIterator2 = require(\"babel-runtime/core-js/get-iterator\");\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar RoomState = require(\"./room-state\");\n\n/**\n * Construct a new EventTimeline\n *\n * An EventTimeline represents a contiguous sequence of events in a room.\n *\n *
As well as keeping track of the events themselves, it stores the state of\n * the room at the beginning and end of the timeline, and pagination tokens for\n * going backwards and forwards in the timeline.\n *\n *
In order that clients can meaningfully maintain an index into a timeline,\n * the EventTimeline object tracks a 'baseIndex'. This starts at zero, but is\n * incremented when events are prepended to the timeline. The index of an event\n * relative to baseIndex therefore remains constant.\n *\n *
Once a timeline joins up with its neighbour, they are linked together into a\n * doubly-linked list.\n *\n * @param {EventTimelineSet} eventTimelineSet the set of timelines this is part of\n * @constructor\n */\nfunction EventTimeline(eventTimelineSet) {\n this._eventTimelineSet = eventTimelineSet;\n this._roomId = eventTimelineSet.room ? eventTimelineSet.room.roomId : null;\n this._events = [];\n this._baseIndex = 0;\n this._startState = new RoomState(this._roomId);\n this._startState.paginationToken = null;\n this._endState = new RoomState(this._roomId);\n this._endState.paginationToken = null;\n\n this._prevTimeline = null;\n this._nextTimeline = null;\n\n // this is used by client.js\n this._paginationRequests = { 'b': null, 'f': null };\n\n this._name = this._roomId + \":\" + new Date().toISOString();\n}\n\n/**\n * Symbolic constant for methods which take a 'direction' argument:\n * refers to the start of the timeline, or backwards in time.\n */\nEventTimeline.BACKWARDS = \"b\";\n\n/**\n * Symbolic constant for methods which take a 'direction' argument:\n * refers to the end of the timeline, or forwards in time.\n */\nEventTimeline.FORWARDS = \"f\";\n\n/**\n * Initialise the start and end state with the given events\n *\n *
This can only be called before any events are added.\n *\n * @param {MatrixEvent[]} stateEvents list of state events to initialise the\n * state with.\n * @throws {Error} if an attempt is made to call this after addEvent is called.\n */\nEventTimeline.prototype.initialiseState = function (stateEvents) {\n if (this._events.length > 0) {\n throw new Error(\"Cannot initialise state after events are added\");\n }\n\n // We previously deep copied events here and used different copies in\n // the oldState and state events: this decision seems to date back\n // quite a way and was apparently made to fix a bug where modifications\n // made to the start state leaked through to the end state.\n // This really shouldn't be possible though: the events themselves should\n // not change. Duplicating the events uses a lot of extra memory,\n // so we now no longer do it. To assert that they really do never change,\n // freeze them! Note that we can't do this for events in general:\n // although it looks like the only things preventing us are the\n // 'status' flag, forwardLooking (which is only set once when adding to the\n // timeline) and possibly the sender (which seems like it should never be\n // reset but in practice causes a lot of the tests to break).\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = (0, _getIterator3.default)(stateEvents), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var e = _step.value;\n\n (0, _freeze2.default)(e);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n this._startState.setStateEvents(stateEvents);\n this._endState.setStateEvents(stateEvents);\n};\n\n/**\n * Forks the (live) timeline, taking ownership of the existing directional state of this timeline.\n * All attached listeners will keep receiving state updates from the new live timeline state.\n * The end state of this timeline gets replaced with an independent copy of the current RoomState,\n * and will need a new pagination token if it ever needs to paginate forwards.\n\n * @param {string} direction EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @return {EventTimeline} the new timeline\n */\nEventTimeline.prototype.forkLive = function (direction) {\n var forkState = this.getState(direction);\n var timeline = new EventTimeline(this._eventTimelineSet);\n timeline._startState = forkState.clone();\n // Now clobber the end state of the new live timeline with that from the\n // previous live timeline. It will be identical except that we'll keep\n // using the same RoomMember objects for the 'live' set of members with any\n // listeners still attached\n timeline._endState = forkState;\n // Firstly, we just stole the current timeline's end state, so it needs a new one.\n // Make an immutable copy of the state so back pagination will get the correct sentinels.\n this._endState = forkState.clone();\n return timeline;\n};\n\n/**\n * Creates an independent timeline, inheriting the directional state from this timeline.\n *\n * @param {string} direction EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @return {EventTimeline} the new timeline\n */\nEventTimeline.prototype.fork = function (direction) {\n var forkState = this.getState(direction);\n var timeline = new EventTimeline(this._eventTimelineSet);\n timeline._startState = forkState.clone();\n timeline._endState = forkState.clone();\n return timeline;\n};\n\n/**\n * Get the ID of the room for this timeline\n * @return {string} room ID\n */\nEventTimeline.prototype.getRoomId = function () {\n return this._roomId;\n};\n\n/**\n * Get the filter for this timeline's timelineSet (if any)\n * @return {Filter} filter\n */\nEventTimeline.prototype.getFilter = function () {\n return this._eventTimelineSet.getFilter();\n};\n\n/**\n * Get the timelineSet for this timeline\n * @return {EventTimelineSet} timelineSet\n */\nEventTimeline.prototype.getTimelineSet = function () {\n return this._eventTimelineSet;\n};\n\n/**\n * Get the base index.\n *\n *
This is an index which is incremented when events are prepended to the\n * timeline. An individual event therefore stays at the same index in the array\n * relative to the base index (although note that a given event's index may\n * well be less than the base index, thus giving that event a negative relative\n * index).\n *\n * @return {number}\n */\nEventTimeline.prototype.getBaseIndex = function () {\n return this._baseIndex;\n};\n\n/**\n * Get the list of events in this context\n *\n * @return {MatrixEvent[]} An array of MatrixEvents\n */\nEventTimeline.prototype.getEvents = function () {\n return this._events;\n};\n\n/**\n * Get the room state at the start/end of the timeline\n *\n * @param {string} direction EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @return {RoomState} state at the start/end of the timeline\n */\nEventTimeline.prototype.getState = function (direction) {\n if (direction == EventTimeline.BACKWARDS) {\n return this._startState;\n } else if (direction == EventTimeline.FORWARDS) {\n return this._endState;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n};\n\n/**\n * Get a pagination token\n *\n * @param {string} direction EventTimeline.BACKWARDS to get the pagination\n * token for going backwards in time; EventTimeline.FORWARDS to get the\n * pagination token for going forwards in time.\n *\n * @return {?string} pagination token\n */\nEventTimeline.prototype.getPaginationToken = function (direction) {\n return this.getState(direction).paginationToken;\n};\n\n/**\n * Set a pagination token\n *\n * @param {?string} token pagination token\n *\n * @param {string} direction EventTimeline.BACKWARDS to set the pagination\n * token for going backwards in time; EventTimeline.FORWARDS to set the\n * pagination token for going forwards in time.\n */\nEventTimeline.prototype.setPaginationToken = function (token, direction) {\n this.getState(direction).paginationToken = token;\n};\n\n/**\n * Get the next timeline in the series\n *\n * @param {string} direction EventTimeline.BACKWARDS to get the previous\n * timeline; EventTimeline.FORWARDS to get the next timeline.\n *\n * @return {?EventTimeline} previous or following timeline, if they have been\n * joined up.\n */\nEventTimeline.prototype.getNeighbouringTimeline = function (direction) {\n if (direction == EventTimeline.BACKWARDS) {\n return this._prevTimeline;\n } else if (direction == EventTimeline.FORWARDS) {\n return this._nextTimeline;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n};\n\n/**\n * Set the next timeline in the series\n *\n * @param {EventTimeline} neighbour previous/following timeline\n *\n * @param {string} direction EventTimeline.BACKWARDS to set the previous\n * timeline; EventTimeline.FORWARDS to set the next timeline.\n *\n * @throws {Error} if an attempt is made to set the neighbouring timeline when\n * it is already set.\n */\nEventTimeline.prototype.setNeighbouringTimeline = function (neighbour, direction) {\n if (this.getNeighbouringTimeline(direction)) {\n throw new Error(\"timeline already has a neighbouring timeline - \" + \"cannot reset neighbour\");\n }\n\n if (direction == EventTimeline.BACKWARDS) {\n this._prevTimeline = neighbour;\n } else if (direction == EventTimeline.FORWARDS) {\n this._nextTimeline = neighbour;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n\n // make sure we don't try to paginate this timeline\n this.setPaginationToken(null, direction);\n};\n\n/**\n * Add a new event to the timeline, and update the state\n *\n * @param {MatrixEvent} event new event\n * @param {boolean} atStart true to insert new event at the start\n */\nEventTimeline.prototype.addEvent = function (event, atStart) {\n var stateContext = atStart ? this._startState : this._endState;\n\n // only call setEventMetadata on the unfiltered timelineSets\n var timelineSet = this.getTimelineSet();\n if (timelineSet.room && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {\n EventTimeline.setEventMetadata(event, stateContext, atStart);\n\n // modify state\n if (event.isState()) {\n stateContext.setStateEvents([event]);\n // it is possible that the act of setting the state event means we\n // can set more metadata (specifically sender/target props), so try\n // it again if the prop wasn't previously set. It may also mean that\n // the sender/target is updated (if the event set was a room member event)\n // so we want to use the *updated* member (new avatar/name) instead.\n //\n // However, we do NOT want to do this on member events if we're going\n // back in time, else we'll set the .sender value for BEFORE the given\n // member event, whereas we want to set the .sender value for the ACTUAL\n // member event itself.\n if (!event.sender || event.getType() === \"m.room.member\" && !atStart) {\n EventTimeline.setEventMetadata(event, stateContext, atStart);\n }\n }\n }\n\n var insertIndex = void 0;\n\n if (atStart) {\n insertIndex = 0;\n } else {\n insertIndex = this._events.length;\n }\n\n this._events.splice(insertIndex, 0, event); // insert element\n if (atStart) {\n this._baseIndex++;\n }\n};\n\n/**\n * Static helper method to set sender and target properties\n *\n * @param {MatrixEvent} event the event whose metadata is to be set\n * @param {RoomState} stateContext the room state to be queried\n * @param {bool} toStartOfTimeline if true the event's forwardLooking flag is set false\n */\nEventTimeline.setEventMetadata = function (event, stateContext, toStartOfTimeline) {\n // set sender and target properties\n event.sender = stateContext.getSentinelMember(event.getSender());\n if (event.getType() === \"m.room.member\") {\n event.target = stateContext.getSentinelMember(event.getStateKey());\n }\n if (event.isState()) {\n // room state has no concept of 'old' or 'current', but we want the\n // room state to regress back to previous values if toStartOfTimeline\n // is set, which means inspecting prev_content if it exists. This\n // is done by toggling the forwardLooking flag.\n if (toStartOfTimeline) {\n event.forwardLooking = false;\n }\n }\n};\n\n/**\n * Remove an event from the timeline\n *\n * @param {string} eventId ID of event to be removed\n * @return {?MatrixEvent} removed event, or null if not found\n */\nEventTimeline.prototype.removeEvent = function (eventId) {\n for (var i = this._events.length - 1; i >= 0; i--) {\n var ev = this._events[i];\n if (ev.getId() == eventId) {\n this._events.splice(i, 1);\n if (i < this._baseIndex) {\n this._baseIndex--;\n }\n return ev;\n }\n }\n return null;\n};\n\n/**\n * Return a string to identify this timeline, for debugging\n *\n * @return {string} name for this timeline\n */\nEventTimeline.prototype.toString = function () {\n return this._name;\n};\n\n/**\n * The EventTimeline class\n */\nmodule.exports = EventTimeline;\n//# sourceMappingURL=event-timeline.js.map","'use strict';\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _bluebird = require('bluebird');\n\nvar _bluebird2 = _interopRequireDefault(_bluebird);\n\nvar _SettingsStore = require('./settings/SettingsStore');\n\nvar _SettingsStore2 = _interopRequireDefault(_SettingsStore);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\nCopyright 2016 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar request = require('browser-request');\n\nvar SdkConfig = require('./SdkConfig');\nvar MatrixClientPeg = require('./MatrixClientPeg');\n\n// The version of the integration manager API we're intending to work with\nvar imApiVersion = \"1.1\";\n\nvar ScalarAuthClient = function () {\n function ScalarAuthClient() {\n (0, _classCallCheck3.default)(this, ScalarAuthClient);\n\n this.scalarToken = null;\n }\n\n (0, _createClass3.default)(ScalarAuthClient, [{\n key: 'connect',\n value: function connect() {\n var _this = this;\n\n return this.getScalarToken().then(function (tok) {\n _this.scalarToken = tok;\n });\n }\n }, {\n key: 'hasCredentials',\n value: function hasCredentials() {\n return this.scalarToken != null; // undef or null\n }\n\n // Returns a scalar_token string\n\n }, {\n key: 'getScalarToken',\n value: function getScalarToken() {\n var _this2 = this;\n\n var token = window.localStorage.getItem(\"mx_scalar_token\");\n\n if (!token) {\n return this.registerForToken();\n } else {\n return this.validateToken(token).then(function (userId) {\n var me = MatrixClientPeg.get().getUserId();\n if (userId !== me) {\n throw new Error(\"Scalar token is owned by someone else: \" + me);\n }\n return token;\n }).catch(function (err) {\n console.error(err);\n\n // Something went wrong - try to get a new token.\n console.warn(\"Registering for new scalar token\");\n return _this2.registerForToken();\n });\n }\n }\n }, {\n key: 'validateToken',\n value: function validateToken(token) {\n var url = SdkConfig.get().integrations_rest_url + \"/account\";\n\n return new _bluebird2.default(function (resolve, reject) {\n request({\n method: \"GET\",\n uri: url,\n qs: { scalar_token: token, v: imApiVersion },\n json: true\n }, function (err, response, body) {\n if (err) {\n reject(err);\n } else if (response.statusCode / 100 !== 2) {\n reject({ statusCode: response.statusCode });\n } else if (!body || !body.user_id) {\n reject(new Error(\"Missing user_id in response\"));\n } else {\n resolve(body.user_id);\n }\n });\n });\n }\n }, {\n key: 'registerForToken',\n value: function registerForToken() {\n var _this3 = this;\n\n // Get openid bearer token from the HS as the first part of our dance\n return MatrixClientPeg.get().getOpenIdToken().then(function (token_object) {\n // Now we can send that to scalar and exchange it for a scalar token\n return _this3.exchangeForScalarToken(token_object);\n }).then(function (token_object) {\n window.localStorage.setItem(\"mx_scalar_token\", token_object);\n return token_object;\n });\n }\n }, {\n key: 'exchangeForScalarToken',\n value: function exchangeForScalarToken(openid_token_object) {\n var scalar_rest_url = SdkConfig.get().integrations_rest_url;\n\n return new _bluebird2.default(function (resolve, reject) {\n request({\n method: 'POST',\n uri: scalar_rest_url + '/register',\n qs: { v: imApiVersion },\n body: openid_token_object,\n json: true\n }, function (err, response, body) {\n if (err) {\n reject(err);\n } else if (response.statusCode / 100 !== 2) {\n reject({ statusCode: response.statusCode });\n } else if (!body || !body.scalar_token) {\n reject(new Error(\"Missing scalar_token in response\"));\n } else {\n resolve(body.scalar_token);\n }\n });\n });\n }\n }, {\n key: 'getScalarPageTitle',\n value: function getScalarPageTitle(url) {\n var scalarPageLookupUrl = SdkConfig.get().integrations_rest_url + '/widgets/title_lookup';\n scalarPageLookupUrl = this.getStarterLink(scalarPageLookupUrl);\n scalarPageLookupUrl += '&curl=' + encodeURIComponent(url);\n\n return new _bluebird2.default(function (resolve, reject) {\n request({\n method: 'GET',\n uri: scalarPageLookupUrl,\n json: true\n }, function (err, response, body) {\n if (err) {\n reject(err);\n } else if (response.statusCode / 100 !== 2) {\n reject({ statusCode: response.statusCode });\n } else if (!body) {\n reject(new Error(\"Missing page title in response\"));\n } else {\n var title = \"\";\n if (body.page_title_cache_item && body.page_title_cache_item.cached_title) {\n title = body.page_title_cache_item.cached_title;\n }\n resolve(title);\n }\n });\n });\n }\n\n /**\n * Mark all assets associated with the specified widget as \"disabled\" in the\n * integration manager database.\n * This can be useful to temporarily prevent purchased assets from being displayed.\n * @param {string} widgetType [description]\n * @param {string} widgetId [description]\n * @return {Promise} Resolves on completion\n */\n\n }, {\n key: 'disableWidgetAssets',\n value: function disableWidgetAssets(widgetType, widgetId) {\n var url = SdkConfig.get().integrations_rest_url + '/widgets/set_assets_state';\n url = this.getStarterLink(url);\n return new _bluebird2.default(function (resolve, reject) {\n request({\n method: 'GET',\n uri: url,\n json: true,\n qs: {\n 'widget_type': widgetType,\n 'widget_id': widgetId,\n 'state': 'disable'\n }\n }, function (err, response, body) {\n if (err) {\n reject(err);\n } else if (response.statusCode / 100 !== 2) {\n reject({ statusCode: response.statusCode });\n } else if (!body) {\n reject(new Error(\"Failed to set widget assets state\"));\n } else {\n resolve();\n }\n });\n });\n }\n }, {\n key: 'getScalarInterfaceUrlForRoom',\n value: function getScalarInterfaceUrlForRoom(room, screen, id) {\n var roomId = room.roomId;\n var roomName = room.name;\n var url = SdkConfig.get().integrations_ui_url;\n url += \"?scalar_token=\" + encodeURIComponent(this.scalarToken);\n url += \"&room_id=\" + encodeURIComponent(roomId);\n url += \"&room_name=\" + encodeURIComponent(roomName);\n url += \"&theme=\" + encodeURIComponent(_SettingsStore2.default.getValue(\"theme\"));\n if (id) {\n url += '&integ_id=' + encodeURIComponent(id);\n }\n if (screen) {\n url += '&screen=' + encodeURIComponent(screen);\n }\n return url;\n }\n }, {\n key: 'getStarterLink',\n value: function getStarterLink(starterLinkUrl) {\n return starterLinkUrl + \"?scalar_token=\" + encodeURIComponent(this.scalarToken);\n }\n }]);\n return ScalarAuthClient;\n}();\n\nmodule.exports = ScalarAuthClient;\n//# sourceMappingURL=ScalarAuthClient.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\nCopyright 2015 OpenMarket Ltd\nCopyright 2017 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar DEBUG = 0;\n\n// utility to turn #rrggbb or rgb(r,g,b) into [red,green,blue]\nfunction colorToRgb(color) {\n if (!color) {\n return [0, 0, 0];\n }\n\n if (color[0] === '#') {\n color = color.slice(1);\n if (color.length === 3) {\n color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n }\n var val = parseInt(color, 16);\n var r = val >> 16 & 255;\n var g = val >> 8 & 255;\n var b = val & 255;\n return [r, g, b];\n } else {\n var match = color.match(/rgb\\((.*?),(.*?),(.*?)\\)/);\n if (match) {\n return [parseInt(match[1]), parseInt(match[2]), parseInt(match[3])];\n }\n }\n return [0, 0, 0];\n}\n\n// utility to turn [red,green,blue] into #rrggbb\nfunction rgbToColor(rgb) {\n var val = rgb[0] << 16 | rgb[1] << 8 | rgb[2];\n return '#' + (0x1000000 + val).toString(16).slice(1);\n}\n\nvar Tinter = function () {\n function Tinter() {\n (0, _classCallCheck3.default)(this, Tinter);\n\n // The default colour keys to be replaced as referred to in CSS\n // (should be overridden by .mx_theme_accentColor and .mx_theme_secondaryAccentColor)\n this.keyRgb = [\"rgb(118, 207, 166)\", // Vector Green\n \"rgb(234, 245, 240)\", // Vector Light Green\n \"rgb(211, 239, 225)\"];\n\n // Some algebra workings for calculating the tint % of Vector Green & Light Green\n // x * 118 + (1 - x) * 255 = 234\n // x * 118 + 255 - 255 * x = 234\n // x * 118 - x * 255 = 234 - 255\n // (255 - 118) x = 255 - 234\n // x = (255 - 234) / (255 - 118) = 0.16\n\n // The colour keys to be replaced as referred to in SVGs\n this.keyHex = [\"#76CFA6\", // Vector Green\n \"#EAF5F0\", // Vector Light Green\n \"#D3EFE1\", // roomsublist-label-bg-color (20% Green overlaid on Light Green)\n \"#FFFFFF\", // white highlights of the SVGs (for switching to dark theme)\n \"#000000\"];\n\n // track the replacement colours actually being used\n // defaults to our keys.\n this.colors = [this.keyHex[0], this.keyHex[1], this.keyHex[2], this.keyHex[3], this.keyHex[4]];\n\n // track the most current tint request inputs (which may differ from the\n // end result stored in this.colors\n this.currentTint = [undefined, undefined, undefined, undefined, undefined];\n\n this.cssFixups = [\n // { theme: {\n // style: a style object that should be fixed up taken from a stylesheet\n // attr: name of the attribute to be clobbered, e.g. 'color'\n // index: ordinal of primary, secondary or tertiary\n // },\n // }\n ];\n\n // CSS attributes to be fixed up\n this.cssAttrs = [\"color\", \"backgroundColor\", \"borderColor\", \"borderTopColor\", \"borderBottomColor\", \"borderLeftColor\"];\n\n this.svgAttrs = [\"fill\", \"stroke\"];\n\n // List of functions to call when the tint changes.\n this.tintables = [];\n\n // the currently loaded theme (if any)\n this.theme = undefined;\n\n // whether to force a tint (e.g. after changing theme)\n this.forceTint = false;\n }\n\n /**\n * Register a callback to fire when the tint changes.\n * This is used to rewrite the tintable SVGs with the new tint.\n *\n * It's not possible to unregister a tintable callback. So this can only be\n * used to register a static callback. If a set of tintables will change\n * over time then the best bet is to register a single callback for the\n * entire set.\n *\n * @param {Function} tintable Function to call when the tint changes.\n */\n\n\n (0, _createClass3.default)(Tinter, [{\n key: 'registerTintable',\n value: function registerTintable(tintable) {\n this.tintables.push(tintable);\n }\n }, {\n key: 'getKeyRgb',\n value: function getKeyRgb() {\n return this.keyRgb;\n }\n }, {\n key: 'tint',\n value: function tint(primaryColor, secondaryColor, tertiaryColor) {\n return;\n // eslint-disable-next-line no-unreachable\n this.currentTint[0] = primaryColor;\n this.currentTint[1] = secondaryColor;\n this.currentTint[2] = tertiaryColor;\n\n this.calcCssFixups();\n\n if (DEBUG) {\n console.log(\"Tinter.tint(\" + primaryColor + \", \" + secondaryColor + \", \" + tertiaryColor + \")\");\n }\n\n if (!primaryColor) {\n primaryColor = this.keyRgb[0];\n secondaryColor = this.keyRgb[1];\n tertiaryColor = this.keyRgb[2];\n }\n\n if (!secondaryColor) {\n var x = 0.16; // average weighting factor calculated from vector green & light green\n var rgb = colorToRgb(primaryColor);\n rgb[0] = x * rgb[0] + (1 - x) * 255;\n rgb[1] = x * rgb[1] + (1 - x) * 255;\n rgb[2] = x * rgb[2] + (1 - x) * 255;\n secondaryColor = rgbToColor(rgb);\n }\n\n if (!tertiaryColor) {\n var _x = 0.19;\n var rgb1 = colorToRgb(primaryColor);\n var rgb2 = colorToRgb(secondaryColor);\n rgb1[0] = _x * rgb1[0] + (1 - _x) * rgb2[0];\n rgb1[1] = _x * rgb1[1] + (1 - _x) * rgb2[1];\n rgb1[2] = _x * rgb1[2] + (1 - _x) * rgb2[2];\n tertiaryColor = rgbToColor(rgb1);\n }\n\n if (this.forceTint == false && this.colors[0] === primaryColor && this.colors[1] === secondaryColor && this.colors[2] === tertiaryColor) {\n return;\n }\n\n this.forceTint = false;\n\n this.colors[0] = primaryColor;\n this.colors[1] = secondaryColor;\n this.colors[2] = tertiaryColor;\n\n if (DEBUG) {\n console.log(\"Tinter.tint final: (\" + primaryColor + \", \" + secondaryColor + \", \" + tertiaryColor + \")\");\n }\n\n // go through manually fixing up the stylesheets.\n this.applyCssFixups();\n\n // tell all the SVGs to go fix themselves up\n // we don't do this as a dispatch otherwise it will visually lag\n this.tintables.forEach(function (tintable) {\n tintable();\n });\n }\n }, {\n key: 'tintSvgWhite',\n value: function tintSvgWhite(whiteColor) {\n this.currentTint[3] = whiteColor;\n\n if (!whiteColor) {\n whiteColor = this.colors[3];\n }\n if (this.colors[3] === whiteColor) {\n return;\n }\n this.colors[3] = whiteColor;\n this.tintables.forEach(function (tintable) {\n tintable();\n });\n }\n }, {\n key: 'tintSvgBlack',\n value: function tintSvgBlack(blackColor) {\n this.currentTint[4] = blackColor;\n\n if (!blackColor) {\n blackColor = this.colors[4];\n }\n if (this.colors[4] === blackColor) {\n return;\n }\n this.colors[4] = blackColor;\n this.tintables.forEach(function (tintable) {\n tintable();\n });\n }\n }, {\n key: 'setTheme',\n value: function setTheme(theme) {\n this.theme = theme;\n\n // update keyRgb from the current theme CSS itself, if it defines it\n if (document.getElementById('mx_theme_accentColor')) {\n this.keyRgb[0] = window.getComputedStyle(document.getElementById('mx_theme_accentColor')).color;\n }\n if (document.getElementById('mx_theme_secondaryAccentColor')) {\n this.keyRgb[1] = window.getComputedStyle(document.getElementById('mx_theme_secondaryAccentColor')).color;\n }\n if (document.getElementById('mx_theme_tertiaryAccentColor')) {\n this.keyRgb[2] = window.getComputedStyle(document.getElementById('mx_theme_tertiaryAccentColor')).color;\n }\n\n this.calcCssFixups();\n this.forceTint = true;\n\n this.tint(this.currentTint[0], this.currentTint[1], this.currentTint[2]);\n\n if (theme === 'dark') {\n // abuse the tinter to change all the SVG's #fff to #2d2d2d\n // XXX: obviously this shouldn't be hardcoded here.\n this.tintSvgWhite('#2d2d2d');\n this.tintSvgBlack('#dddddd');\n } else {\n this.tintSvgWhite('#ffffff');\n this.tintSvgBlack('#000000');\n }\n }\n }, {\n key: 'calcCssFixups',\n value: function calcCssFixups() {\n // cache our fixups\n if (this.cssFixups[this.theme]) return;\n\n if (DEBUG) {\n console.debug(\"calcCssFixups start for \" + this.theme + \" (checking \" + document.styleSheets.length + \" stylesheets)\");\n }\n\n this.cssFixups[this.theme] = [];\n\n for (var i = 0; i < document.styleSheets.length; i++) {\n var ss = document.styleSheets[i];\n try {\n if (!ss) continue; // well done safari >:(\n // Chromium apparently sometimes returns null here; unsure why.\n // see $14534907369972FRXBx:matrix.org in HQ\n // ...ah, it's because there's a third party extension like\n // privacybadger inserting its own stylesheet in there with a\n // resource:// URI or something which results in a XSS error.\n // See also #vector:matrix.org/$145357669685386ebCfr:matrix.org\n // ...except some browsers apparently return stylesheets without\n // hrefs, which we have no choice but ignore right now\n\n // XXX seriously? we are hardcoding the name of vector's CSS file in\n // here?\n //\n // Why do we need to limit it to vector's CSS file anyway - if there\n // are other CSS files affecting the doc don't we want to apply the\n // same transformations to them?\n //\n // Iterating through the CSS looking for matches to hack on feels\n // pretty horrible anyway. And what if the application skin doesn't use\n // Vector Green as its primary color?\n // --richvdh\n\n // Yes, tinting assumes that you are using the Riot skin for now.\n // The right solution will be to move the CSS over to react-sdk.\n // And yes, the default assets for the base skin might as well use\n // Vector Green as any other colour.\n // --matthew\n\n // stylesheets we don't have permission to access (eg. ones from extensions) have a null\n // href and will throw exceptions if we try to access their rules.\n if (!ss.href || !ss.href.match(new RegExp('/theme-' + this.theme + '.css$'))) continue;\n if (ss.disabled) continue;\n if (!ss.cssRules) continue;\n\n if (DEBUG) console.debug(\"calcCssFixups checking \" + ss.cssRules.length + \" rules for \" + ss.href);\n\n for (var j = 0; j < ss.cssRules.length; j++) {\n var rule = ss.cssRules[j];\n if (!rule.style) continue;\n if (rule.selectorText && rule.selectorText.match(/#mx_theme/)) continue;\n for (var k = 0; k < this.cssAttrs.length; k++) {\n var attr = this.cssAttrs[k];\n for (var l = 0; l < this.keyRgb.length; l++) {\n if (rule.style[attr] === this.keyRgb[l]) {\n this.cssFixups[this.theme].push({\n style: rule.style,\n attr: attr,\n index: l\n });\n }\n }\n }\n }\n } catch (e) {\n // Catch any random exceptions that happen here: all sorts of things can go\n // wrong with this (nulls, SecurityErrors) and mostly it's for other\n // stylesheets that we don't want to proces anyway. We should not propagate an\n // exception out since this will cause the app to fail to start.\n console.log(\"Failed to calculate CSS fixups for a stylesheet: \" + ss.href, e);\n }\n }\n if (DEBUG) {\n console.log(\"calcCssFixups end (\" + this.cssFixups[this.theme].length + \" fixups)\");\n }\n }\n }, {\n key: 'applyCssFixups',\n value: function applyCssFixups() {\n if (DEBUG) {\n console.log(\"applyCssFixups start (\" + this.cssFixups[this.theme].length + \" fixups)\");\n }\n for (var i = 0; i < this.cssFixups[this.theme].length; i++) {\n var cssFixup = this.cssFixups[this.theme][i];\n try {\n cssFixup.style[cssFixup.attr] = this.colors[cssFixup.index];\n } catch (e) {\n // Firefox Quantum explodes if you manually edit the CSS in the\n // inspector and then try to do a tint, as apparently all the\n // fixups are then stale.\n console.error(\"Failed to apply cssFixup in Tinter! \", e.name);\n }\n }\n if (DEBUG) console.log(\"applyCssFixups end\");\n }\n\n // XXX: we could just move this all into TintableSvg, but as it's so similar\n // to the CSS fixup stuff in Tinter (just that the fixups are stored in TintableSvg)\n // keeping it here for now.\n\n }, {\n key: 'calcSvgFixups',\n value: function calcSvgFixups(svgs) {\n // go through manually fixing up SVG colours.\n // we could do this by stylesheets, but keeping the stylesheets\n // updated would be a PITA, so just brute-force search for the\n // key colour; cache the element and apply.\n\n if (DEBUG) console.log(\"calcSvgFixups start for \" + svgs);\n var fixups = [];\n for (var i = 0; i < svgs.length; i++) {\n var svgDoc = void 0;\n try {\n svgDoc = svgs[i].contentDocument;\n } catch (e) {\n var msg = 'Failed to get svg.contentDocument of ' + svgs[i].toString();\n if (e.message) {\n msg += e.message;\n }\n if (e.stack) {\n msg += ' | stack: ' + e.stack;\n }\n console.error(msg);\n }\n if (!svgDoc) continue;\n var tags = svgDoc.getElementsByTagName(\"*\");\n for (var j = 0; j < tags.length; j++) {\n var tag = tags[j];\n for (var k = 0; k < this.svgAttrs.length; k++) {\n var attr = this.svgAttrs[k];\n for (var l = 0; l < this.keyHex.length; l++) {\n if (tag.getAttribute(attr) && tag.getAttribute(attr).toUpperCase() === this.keyHex[l]) {\n fixups.push({\n node: tag,\n attr: attr,\n index: l\n });\n }\n }\n }\n }\n }\n if (DEBUG) console.log(\"calcSvgFixups end\");\n\n return fixups;\n }\n }, {\n key: 'applySvgFixups',\n value: function applySvgFixups(fixups) {\n if (DEBUG) console.log(\"applySvgFixups start for \" + fixups);\n for (var i = 0; i < fixups.length; i++) {\n var svgFixup = fixups[i];\n svgFixup.node.setAttribute(svgFixup.attr, this.colors[svgFixup.index]);\n }\n if (DEBUG) console.log(\"applySvgFixups end\");\n }\n }]);\n return Tinter;\n}();\n\nif (global.singletonTinter === undefined) {\n global.singletonTinter = new Tinter();\n}\nexports.default = global.singletonTinter;\nmodule.exports = exports['default'];\n//# sourceMappingURL=Tinter.js.map","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","module.exports = __webpack_public_path__ + \"img/spinner.0b29ec9.gif\";","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _bluebird = require('bluebird');\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar AutocompleteProvider = function () {\n function AutocompleteProvider(commandRegex, forcedCommandRegex) {\n (0, _classCallCheck3.default)(this, AutocompleteProvider);\n\n if (commandRegex) {\n if (!commandRegex.global) {\n throw new Error('commandRegex must have global flag set');\n }\n this.commandRegex = commandRegex;\n }\n if (forcedCommandRegex) {\n if (!forcedCommandRegex.global) {\n throw new Error('forcedCommandRegex must have global flag set');\n }\n this.forcedCommandRegex = forcedCommandRegex;\n }\n }\n\n (0, _createClass3.default)(AutocompleteProvider, [{\n key: 'destroy',\n value: function destroy() {}\n // stub\n\n\n /**\n * Of the matched commands in the query, returns the first that contains or is contained by the selection, or null.\n * @param {string} query The query string\n * @param {SelectionRange} selection Selection to search\n * @param {boolean} force True if the user is forcing completion\n * @return {object} { command, range } where both objects fields are null if no match\n */\n\n }, {\n key: 'getCurrentCommand',\n value: function getCurrentCommand(query, selection) {\n var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n var commandRegex = this.commandRegex;\n\n if (force && this.shouldForceComplete()) {\n commandRegex = this.forcedCommandRegex || /\\S+/g;\n }\n\n if (commandRegex == null) {\n return null;\n }\n\n commandRegex.lastIndex = 0;\n\n var match = void 0;\n while ((match = commandRegex.exec(query)) != null) {\n var start = match.index;\n var end = start + match[0].length;\n if (selection.start <= end && selection.end >= start) {\n return {\n command: match,\n range: {\n start: start,\n end: end\n }\n };\n }\n }\n return {\n command: null,\n range: {\n start: -1,\n end: -1\n }\n };\n }\n }, {\n key: 'getCompletions',\n value: function () {\n var _ref = (0, _bluebird.method)(function (query, selection) {\n var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n return [];\n });\n\n function getCompletions(_x2, _x3, _x4) {\n return _ref.apply(this, arguments);\n }\n\n return getCompletions;\n }()\n }, {\n key: 'getName',\n value: function getName() {\n return 'Default Provider';\n }\n }, {\n key: 'renderCompletions',\n value: function renderCompletions(completions) {\n console.error('stub; should be implemented in subclasses');\n return null;\n }\n\n // Whether we should provide completions even if triggered forcefully, without a sigil.\n\n }, {\n key: 'shouldForceComplete',\n value: function shouldForceComplete() {\n return false;\n }\n }]);\n return AutocompleteProvider;\n}(); /*\n Copyright 2016 Aviral Dasgupta\n Copyright 2017 Vector Creations Ltd\n Copyright 2017, 2018 New Vector Ltd\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\nexports.default = AutocompleteProvider;\nmodule.exports = exports['default'];\n//# sourceMappingURL=AutocompleteProvider.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.PillCompletion = exports.TextualCompletion = undefined;\n\nvar _extends2 = require('babel-runtime/helpers/extends');\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');\n\nvar _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);\n\nvar _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _classnames = require('classnames');\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* These were earlier stateless functional components but had to be converted\nsince we need to use refs/findDOMNode to access the underlying DOM node to focus the correct completion,\nsomething that is not entirely possible with stateless functional components. One could\npresumably wrap them in a
before rendering but I think this is the better way to do it.\n */\n\nvar TextualCompletion = exports.TextualCompletion = function (_React$Component) {\n (0, _inherits3.default)(TextualCompletion, _React$Component);\n\n function TextualCompletion() {\n (0, _classCallCheck3.default)(this, TextualCompletion);\n return (0, _possibleConstructorReturn3.default)(this, (TextualCompletion.__proto__ || (0, _getPrototypeOf2.default)(TextualCompletion)).apply(this, arguments));\n }\n\n (0, _createClass3.default)(TextualCompletion, [{\n key: 'render',\n value: function render() {\n var _props = this.props,\n title = _props.title,\n subtitle = _props.subtitle,\n description = _props.description,\n className = _props.className,\n restProps = (0, _objectWithoutProperties3.default)(_props, ['title', 'subtitle', 'description', 'className']);\n\n return _react2.default.createElement(\n 'div',\n (0, _extends3.default)({ className: (0, _classnames2.default)('mx_Autocomplete_Completion_block', className) }, restProps),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_title' },\n title\n ),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_subtitle' },\n subtitle\n ),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_description' },\n description\n )\n );\n }\n }]);\n return TextualCompletion;\n}(_react2.default.Component); /*\n Copyright 2016 Aviral Dasgupta\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\nTextualCompletion.propTypes = {\n title: _propTypes2.default.string,\n subtitle: _propTypes2.default.string,\n description: _propTypes2.default.string,\n className: _propTypes2.default.string\n};\n\nvar PillCompletion = exports.PillCompletion = function (_React$Component2) {\n (0, _inherits3.default)(PillCompletion, _React$Component2);\n\n function PillCompletion() {\n (0, _classCallCheck3.default)(this, PillCompletion);\n return (0, _possibleConstructorReturn3.default)(this, (PillCompletion.__proto__ || (0, _getPrototypeOf2.default)(PillCompletion)).apply(this, arguments));\n }\n\n (0, _createClass3.default)(PillCompletion, [{\n key: 'render',\n value: function render() {\n var _props2 = this.props,\n title = _props2.title,\n subtitle = _props2.subtitle,\n description = _props2.description,\n initialComponent = _props2.initialComponent,\n className = _props2.className,\n restProps = (0, _objectWithoutProperties3.default)(_props2, ['title', 'subtitle', 'description', 'initialComponent', 'className']);\n\n return _react2.default.createElement(\n 'div',\n (0, _extends3.default)({ className: (0, _classnames2.default)('mx_Autocomplete_Completion_pill', className) }, restProps),\n initialComponent,\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_title' },\n title\n ),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_subtitle' },\n subtitle\n ),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_description' },\n description\n )\n );\n }\n }]);\n return PillCompletion;\n}(_react2.default.Component);\n\nPillCompletion.propTypes = {\n title: _propTypes2.default.string,\n subtitle: _propTypes2.default.string,\n description: _propTypes2.default.string,\n initialComponent: _propTypes2.default.element,\n className: _propTypes2.default.string\n};\n//# sourceMappingURL=Components.js.map","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","var $export = require('./_export');\nvar defined = require('./_defined');\nvar fails = require('./_fails');\nvar spaces = require('./_string-ws');\nvar space = '[' + spaces + ']';\nvar non = '\\u200b\\u0085';\nvar ltrim = RegExp('^' + space + space + '*');\nvar rtrim = RegExp(space + space + '*$');\n\nvar exporter = function (KEY, exec, ALIAS) {\n var exp = {};\n var FORCE = fails(function () {\n return !!spaces[KEY]() || non[KEY]() != non;\n });\n var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];\n if (ALIAS) exp[ALIAS] = fn;\n $export($export.P + $export.F * FORCE, 'String', exp);\n};\n\n// 1 -> String#trimLeft\n// 2 -> String#trimRight\n// 3 -> String#trim\nvar trim = exporter.trim = function (string, TYPE) {\n string = String(defined(string));\n if (TYPE & 1) string = string.replace(ltrim, '');\n if (TYPE & 2) string = string.replace(rtrim, '');\n return string;\n};\n\nmodule.exports = exporter;\n","module.exports = {};\n","var isObject = require('./_is-object');\nmodule.exports = function (it, TYPE) {\n if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');\n return it;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","exports.f = Object.getOwnPropertySymbols;\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar _assign = require('object-assign');\n\nvar ReactCurrentOwner = require('./ReactCurrentOwner');\n\nvar warning = require('fbjs/lib/warning');\nvar canDefineProperty = require('./canDefineProperty');\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar REACT_ELEMENT_TYPE = require('./ReactElementSymbol');\n\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\n\nvar specialPropKeyWarningShown, specialPropRefWarningShown;\n\nfunction hasValidRef(config) {\n if (process.env.NODE_ENV !== 'production') {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n if (process.env.NODE_ENV !== 'production') {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n return config.key !== undefined;\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n var warnAboutAccessingKey = function () {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;\n }\n };\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n var warnAboutAccessingRef = function () {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;\n }\n };\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n}\n\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, no instanceof check\n * will work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} key\n * @param {string|object} ref\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @param {*} owner\n * @param {*} props\n * @internal\n */\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allow us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n if (process.env.NODE_ENV !== 'production') {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {};\n\n // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n if (canDefineProperty) {\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n });\n // self and source are DEV only properties.\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n });\n // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n } else {\n element._store.validated = false;\n element._self = self;\n element._source = source;\n }\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n\n/**\n * Create and return a new ReactElement of the given type.\n * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement\n */\nReactElement.createElement = function (type, config, children) {\n var propName;\n\n // Reserved names are extracted\n var props = {};\n\n var key = null;\n var ref = null;\n var self = null;\n var source = null;\n\n if (config != null) {\n if (hasValidRef(config)) {\n ref = config.ref;\n }\n if (hasValidKey(config)) {\n key = '' + config.key;\n }\n\n self = config.__self === undefined ? null : config.__self;\n source = config.__source === undefined ? null : config.__source;\n // Remaining properties are added to a new props object\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n }\n }\n\n // Children can be more than one argument, and those are transferred onto\n // the newly allocated props object.\n var childrenLength = arguments.length - 2;\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 2];\n }\n if (process.env.NODE_ENV !== 'production') {\n if (Object.freeze) {\n Object.freeze(childArray);\n }\n }\n props.children = childArray;\n }\n\n // Resolve default props\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n if (key || ref) {\n if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n }\n }\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n};\n\n/**\n * Return a function that produces ReactElements of a given type.\n * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory\n */\nReactElement.createFactory = function (type) {\n var factory = ReactElement.createElement.bind(null, type);\n // Expose the type on the factory and the prototype so that it can be\n // easily accessed on elements. E.g. `
.type === Foo`.\n // This should not be named `constructor` since this may not be the function\n // that created the element, and it may not even be a constructor.\n // Legacy hook TODO: Warn if this is accessed\n factory.type = type;\n return factory;\n};\n\nReactElement.cloneAndReplaceKey = function (oldElement, newKey) {\n var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);\n\n return newElement;\n};\n\n/**\n * Clone and return a new ReactElement using element as the starting point.\n * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement\n */\nReactElement.cloneElement = function (element, config, children) {\n var propName;\n\n // Original props are copied\n var props = _assign({}, element.props);\n\n // Reserved names are extracted\n var key = element.key;\n var ref = element.ref;\n // Self is preserved since the owner is preserved.\n var self = element._self;\n // Source is preserved since cloneElement is unlikely to be targeted by a\n // transpiler, and the original source is probably a better indicator of the\n // true owner.\n var source = element._source;\n\n // Owner will be preserved, unless ref is overridden\n var owner = element._owner;\n\n if (config != null) {\n if (hasValidRef(config)) {\n // Silently steal the ref from the parent.\n ref = config.ref;\n owner = ReactCurrentOwner.current;\n }\n if (hasValidKey(config)) {\n key = '' + config.key;\n }\n\n // Remaining properties override existing props\n var defaultProps;\n if (element.type && element.type.defaultProps) {\n defaultProps = element.type.defaultProps;\n }\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n if (config[propName] === undefined && defaultProps !== undefined) {\n // Resolve default props\n props[propName] = defaultProps[propName];\n } else {\n props[propName] = config[propName];\n }\n }\n }\n }\n\n // Children can be more than one argument, and those are transferred onto\n // the newly allocated props object.\n var childrenLength = arguments.length - 2;\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 2];\n }\n props.children = childArray;\n }\n\n return ReactElement(element.type, key, ref, self, source, owner, props);\n};\n\n/**\n * Verifies the object is a ReactElement.\n * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a valid component.\n * @final\n */\nReactElement.isValidElement = function (object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n};\n\nmodule.exports = ReactElement;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar _prodInvariant = require('./reactProdInvariant');\n\nvar invariant = require('fbjs/lib/invariant');\n\nfunction checkMask(value, bitmask) {\n return (value & bitmask) === bitmask;\n}\n\nvar DOMPropertyInjection = {\n /**\n * Mapping from normalized, camelcased property names to a configuration that\n * specifies how the associated DOM property should be accessed or rendered.\n */\n MUST_USE_PROPERTY: 0x1,\n HAS_BOOLEAN_VALUE: 0x4,\n HAS_NUMERIC_VALUE: 0x8,\n HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,\n HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,\n\n /**\n * Inject some specialized knowledge about the DOM. This takes a config object\n * with the following properties:\n *\n * isCustomAttribute: function that given an attribute name will return true\n * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*\n * attributes where it's impossible to enumerate all of the possible\n * attribute names,\n *\n * Properties: object mapping DOM property name to one of the\n * DOMPropertyInjection constants or null. If your attribute isn't in here,\n * it won't get written to the DOM.\n *\n * DOMAttributeNames: object mapping React attribute name to the DOM\n * attribute name. Attribute names not specified use the **lowercase**\n * normalized name.\n *\n * DOMAttributeNamespaces: object mapping React attribute name to the DOM\n * attribute namespace URL. (Attribute names not specified use no namespace.)\n *\n * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.\n * Property names not specified use the normalized name.\n *\n * DOMMutationMethods: Properties that require special mutation methods. If\n * `value` is undefined, the mutation method should unset the property.\n *\n * @param {object} domPropertyConfig the config as described above.\n */\n injectDOMPropertyConfig: function (domPropertyConfig) {\n var Injection = DOMPropertyInjection;\n var Properties = domPropertyConfig.Properties || {};\n var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};\n var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};\n var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};\n var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};\n\n if (domPropertyConfig.isCustomAttribute) {\n DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);\n }\n\n for (var propName in Properties) {\n !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\\'re trying to inject DOM property \\'%s\\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0;\n\n var lowerCased = propName.toLowerCase();\n var propConfig = Properties[propName];\n\n var propertyInfo = {\n attributeName: lowerCased,\n attributeNamespace: null,\n propertyName: propName,\n mutationMethod: null,\n\n mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),\n hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),\n hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),\n hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),\n hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)\n };\n !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;\n\n if (process.env.NODE_ENV !== 'production') {\n DOMProperty.getPossibleStandardName[lowerCased] = propName;\n }\n\n if (DOMAttributeNames.hasOwnProperty(propName)) {\n var attributeName = DOMAttributeNames[propName];\n propertyInfo.attributeName = attributeName;\n if (process.env.NODE_ENV !== 'production') {\n DOMProperty.getPossibleStandardName[attributeName] = propName;\n }\n }\n\n if (DOMAttributeNamespaces.hasOwnProperty(propName)) {\n propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];\n }\n\n if (DOMPropertyNames.hasOwnProperty(propName)) {\n propertyInfo.propertyName = DOMPropertyNames[propName];\n }\n\n if (DOMMutationMethods.hasOwnProperty(propName)) {\n propertyInfo.mutationMethod = DOMMutationMethods[propName];\n }\n\n DOMProperty.properties[propName] = propertyInfo;\n }\n }\n};\n\n/* eslint-disable max-len */\nvar ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD';\n/* eslint-enable max-len */\n\n/**\n * DOMProperty exports lookup objects that can be used like functions:\n *\n * > DOMProperty.isValid['id']\n * true\n * > DOMProperty.isValid['foobar']\n * undefined\n *\n * Although this may be confusing, it performs better in general.\n *\n * @see http://jsperf.com/key-exists\n * @see http://jsperf.com/key-missing\n */\nvar DOMProperty = {\n ID_ATTRIBUTE_NAME: 'data-reactid',\n ROOT_ATTRIBUTE_NAME: 'data-reactroot',\n\n ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,\n ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\\\-.0-9\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040',\n\n /**\n * Map from property \"standard name\" to an object with info about how to set\n * the property in the DOM. Each object contains:\n *\n * attributeName:\n * Used when rendering markup or with `*Attribute()`.\n * attributeNamespace\n * propertyName:\n * Used on DOM node instances. (This includes properties that mutate due to\n * external factors.)\n * mutationMethod:\n * If non-null, used instead of the property or `setAttribute()` after\n * initial render.\n * mustUseProperty:\n * Whether the property must be accessed and mutated as an object property.\n * hasBooleanValue:\n * Whether the property should be removed when set to a falsey value.\n * hasNumericValue:\n * Whether the property must be numeric or parse as a numeric and should be\n * removed when set to a falsey value.\n * hasPositiveNumericValue:\n * Whether the property must be positive numeric or parse as a positive\n * numeric and should be removed when set to a falsey value.\n * hasOverloadedBooleanValue:\n * Whether the property can be used as a flag as well as with a value.\n * Removed when strictly equal to false; present without a value when\n * strictly equal to true; present with a value otherwise.\n */\n properties: {},\n\n /**\n * Mapping from lowercase property names to the properly cased version, used\n * to warn in the case of missing properties. Available only in __DEV__.\n *\n * autofocus is predefined, because adding it to the property whitelist\n * causes unintended side effects.\n *\n * @type {Object}\n */\n getPossibleStandardName: process.env.NODE_ENV !== 'production' ? { autofocus: 'autoFocus' } : null,\n\n /**\n * All of the isCustomAttribute() functions that have been injected.\n */\n _isCustomAttributeFunctions: [],\n\n /**\n * Checks whether a property name is a custom attribute.\n * @method\n */\n isCustomAttribute: function (attributeName) {\n for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {\n var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];\n if (isCustomAttributeFn(attributeName)) {\n return true;\n }\n }\n return false;\n },\n\n injection: DOMPropertyInjection\n};\n\nmodule.exports = DOMProperty;","/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar DOMNamespaces = require('./DOMNamespaces');\nvar setInnerHTML = require('./setInnerHTML');\n\nvar createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');\nvar setTextContent = require('./setTextContent');\n\nvar ELEMENT_NODE_TYPE = 1;\nvar DOCUMENT_FRAGMENT_NODE_TYPE = 11;\n\n/**\n * In IE (8-11) and Edge, appending nodes with no children is dramatically\n * faster than appending a full subtree, so we essentially queue up the\n * .appendChild calls here and apply them so each node is added to its parent\n * before any children are added.\n *\n * In other browsers, doing so is slower or neutral compared to the other order\n * (in Firefox, twice as slow) so we only do this inversion in IE.\n *\n * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.\n */\nvar enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\\bEdge\\/\\d/.test(navigator.userAgent);\n\nfunction insertTreeChildren(tree) {\n if (!enableLazy) {\n return;\n }\n var node = tree.node;\n var children = tree.children;\n if (children.length) {\n for (var i = 0; i < children.length; i++) {\n insertTreeBefore(node, children[i], null);\n }\n } else if (tree.html != null) {\n setInnerHTML(node, tree.html);\n } else if (tree.text != null) {\n setTextContent(node, tree.text);\n }\n}\n\nvar insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {\n // DocumentFragments aren't actually part of the DOM after insertion so\n // appending children won't update the DOM. We need to ensure the fragment\n // is properly populated first, breaking out of our lazy approach for just\n // this level. Also, some