mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
19 lines
540 KiB
JavaScript
19 lines
540 KiB
JavaScript
|
!function(){function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){return o(t[s][1][e]||e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}return e}()({1:[function(e,t,r){(function(r){var n=e("./lib/matrix");const o=e("browser-request"),i=e("qs");n.request(function(e,t){return e.qs=i.stringify(e.qs||{},e.qsStringifyOptions),o(e,t)});var s;try{s=r.indexedDB}catch(e){}s&&n.setCryptoStoreFactory(function(){return new n.IndexedDBCryptoStore(s,"matrix-js-sdk:crypto")}),t.exports=n,r.matrixcs=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/matrix":30,"browser-request":90,qs:239}],2:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var o=e("babel-runtime/core-js/get-iterator"),i=n(o),s=e("babel-runtime/helpers/classCallCheck"),a=n(s),u=e("babel-runtime/helpers/createClass"),c=n(u),l=function(){function e(t){(0,a.default)(this,e),this.target=t,this.boundHandlers={}}return(0,c.default)(e,[{key:"_handleEvent",value:function(e){for(var t,r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=this.target).emit.apply(t,[e].concat(n))}},{key:"reEmit",value:function(e,t){var r=!0,n=!1,o=void 0;try{for(var s,a=(0,i.default)(t);!(r=(s=a.next()).done);r=!0){var u=s.value;void 0===this.boundHandlers[u]&&(this.boundHandlers[u]=this._handleEvent.bind(this,u));var c=this.boundHandlers[u];e.on(u,c)}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}}}]),e}();r.default=l},{"babel-runtime/core-js/get-iterator":58,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/createClass":80}],3:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){l.checkObjectHasKeys(e,["baseUrl","request"]),this.baseUrl=e.baseUrl,this.idBaseUrl=e.idBaseUrl;var t={baseUrl:e.baseUrl,idBaseUrl:e.idBaseUrl,accessToken:e.accessToken,request:e.request,prefix:c.PREFIX_R0,onlyData:!0,extraParams:e.queryParams,localTimeoutMs:e.localTimeoutMs,useAuthorizationHeader:e.useAuthorizationHeader};this._http=new c.MatrixHttpApi(this,t),this._txnCtr=0}var i=e("babel-runtime/helpers/typeof"),s=n(i),a=e("babel-runtime/core-js/object/keys"),u=n(a),c=e("./http-api"),l=e("./utils");o.prototype.getHomeserverUrl=function(){return this.baseUrl},o.prototype.getIdentityServerUrl=function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this.idBaseUrl.startsWith("http://")||this.idBaseUrl.startsWith("https://"))?this.idBaseUrl.split("://")[1]:this.idBaseUrl},o.prototype.getAccessToken=function(){return this._http.opts.accessToken||null},o.prototype.isLoggedIn=function(){return void 0!==this._http.opts.accessToken},o.prototype.makeTxnId=function(){return"m"+(new Date).getTime()+"."+this._txnCtr++},o.prototype.isUsernameAvailable=function(e){return this._http.authedRequest(void 0,"GET","/register/available",{username:e}).then(function(e){return e.available})},o.prototype.register=function(e,t,r,n,o,i,s){!0===o?o={email:!0}:null!==o&&void 0!==o||(o={}),void 0!==n&&null!==n||(n={}),r&&(n.session=r);var a={auth:n};return void 0!==e&&null!==e&&(a.username=e),void 0!==t&&null!==t&&(a.password=t),o.email&&(a.bind_email=!0),o.msisdn&&(a.bind_msisdn=!0),void 0!==i&&null!==i&&(a.guest_access_token=i),void 0!==t&&null!==t&&(a.x_show_msisdn=!0),this.registerRequest(a,void 0,s)},o.prototype.registerGuest=function(e,t){return e=e||{},e.body=e.body||{},this.registerRequest(e.body,"guest",t)},o.prototype.registerRequest=function(e,t,r){var n={};return t&&(n.kind=t),this._http.request(r,"POST","/register",n,e)},o.prototype.loginFlows=function(e){return this._http.request(e,"GET","/login")},o.prototype.login=function(e,t,r){var n=this,o={type:e};return l
|
||
|
for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,C.resolve)(this.getEventSenderDeviceInfo(t));case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return",!1);case 5:return e.abrupt("return",r.isVerified());case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),s.prototype.cancelAndResendEventRoomKeyRequest=function(e){e.cancelAndResendKeyRequest(this._crypto)},s.prototype.setRoomEncryption=function(e,t){if(!this._crypto)throw new Error("End-to-End encryption disabled");return this._crypto.setRoomEncryption(e,t)},s.prototype.isRoomEncrypted=function(e){var t=this.getRoom(e);return!!t&&(!!t.currentState.getStateEvents("m.room.encryption","")||this._roomList.isRoomEncrypted(e))},s.prototype.forceDiscardSession=function(e){if(!this._crypto)throw new Error("End-to-End encryption disabled");this._crypto.forceDiscardSession(e)},s.prototype.exportRoomKeys=function(){return this._crypto?this._crypto.exportRoomKeys():j.default.reject(new Error("End-to-end encryption disabled"))},s.prototype.importRoomKeys=function(e){if(!this._crypto)throw new Error("End-to-end encryption disabled");return this._crypto.importRoomKeys(e)},s.prototype.getKeyBackupVersion=function(){return this._http.authedRequest(void 0,"GET","/room_keys/version").then(function(e){if(e.algorithm!==fe.MEGOLM_BACKUP_ALGORITHM){var t="Unknown backup algorithm: "+e.algorithm;return j.default.reject(t)}if("object"===(0,I.default)(e.auth_data)&&e.auth_data.public_key)return e;return j.default.reject("Invalid backup data returned")}).catch(function(e){if("M_NOT_FOUND"===e.errcode)return null;throw e})},s.prototype.isKeyBackupTrusted=function(e){return this._crypto.isKeyBackupTrusted(e)},s.prototype.getKeyBackupEnabled=function(){if(null===this._crypto)throw new Error("End-to-end encryption disabled");return Boolean(this._crypto.backupKey)},s.prototype.enableKeyBackup=function(e){if(null===this._crypto)throw new Error("End-to-end encryption disabled");this._crypto.backupInfo=e,this._crypto.backupKey&&this._crypto.backupKey.free(),this._crypto.backupKey=new r.Olm.PkEncryption,this._crypto.backupKey.set_recipient_key(e.auth_data.public_key),this.emit("crypto.keyBackupStatus",!0)},s.prototype.disableKeyBackup=function(){if(null===this._crypto)throw new Error("End-to-end encryption disabled");this._crypto.backupInfo=null,this._crypto.backupKey&&this._crypto.backupKey.free(),this._crypto.backupKey=null,this.emit("crypto.keyBackupStatus",!1)},s.prototype.prepareKeyBackupVersion=function(){var e=(0,C.coroutine)(A.default.mark(function e(t){var n,o,i,s;return A.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==this._crypto){e.next=2;break}throw new Error("End-to-end encryption disabled");case 2:if(n=new r.Olm.PkDecryption,e.prev=3,o=void 0,i={},!t){e.next=15;break}return e.next=9,(0,C.resolve)((0,H.keyForNewBackup)(t));case 9:s=e.sent,o=n.init_with_private_key(s.key),i.private_key_salt=s.salt,i.private_key_iterations=s.iterations,e.next=16;break;case 15:o=n.generate_key();case 16:return i.public_key=o,e.abrupt("return",{algorithm:fe.MEGOLM_BACKUP_ALGORITHM,auth_data:i,recovery_key:(0,W.encodeRecoveryKey)(n.get_private_key())});case 18:return e.prev=18,n.free(),e.finish(18);case 21:case"end":return e.stop()}},e,this,[[3,,18,21]])}));return function(t){return e.apply(this,arguments)}}(),s.prototype.createKeyBackupVersion=function(e){var t=this;if(null===this._crypto)throw new Error("End-to-end encryption disabled");var r={algorithm:e.algorithm,auth_data:e.auth_data};return this._crypto._signObject(r.auth_data).then(function(){return t._http.authedRequest(void 0,"POST","/room_keys/version",void 0,r)}).then(function(r){return t.enableKeyBackup({algorithm:e.algorithm,auth_data:e.auth_data,version:r.version}),r})},s.prototype.deleteKeyBackupVersion=function(e){if(null===this._crypto)throw new Error("End-to-end encryption disabled");this._crypto.backupInfo&&this._crypto.backupInfo.version===e&&this.disableKeyBackup();var t=ie.encodeUri("/room_keys/version/$version",{$version:e});return this._http.authedRequest(void 0
|
||
|
s in o||(S.default.log("Device "+r+":"+s+" has been removed"),delete n[s],i=!0),e.next=2;break;case 9:e.t2=d.default.keys(o);case 10:if((e.t3=e.t2()).done){e.next=27;break}if(a=e.t3.value,o.hasOwnProperty(a)){e.next=14;break}return e.abrupt("continue",10);case 14:if(c=o[a],c.user_id===r){e.next=18;break}return S.default.warn("Mismatched user_id "+c.user_id+" in keys from "+r+":"+a),e.abrupt("continue",10);case 18:if(c.device_id===a){e.next=21;break}return S.default.warn("Mismatched device_id "+c.device_id+" in keys from "+r+":"+a),e.abrupt("continue",10);case 21:return e.next=23,(0,u.resolve)(E(t,n,c));case 23:if(!e.sent){e.next=25;break}i=!0;case 25:e.next=10;break;case 27:return e.abrupt("return",i);case 28:case"end":return e.stop()}},e,this)}));return function(t,r,n,o){return e.apply(this,arguments)}}(),E=function(){var e=(0,u.coroutine)(d.default.mark(function e(t,r,n){var o,i,s,a,c,l;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n.keys){e.next=2;break}return e.abrupt("return",!1);case 2:if(o=n.device_id,i=n.user_id,s="ed25519:"+o,a=n.keys[s]){e.next=9;break}return S.default.warn("Device "+i+":"+o+" has no ed25519 key"),e.abrupt("return",!1);case 9:return c=n.unsigned||{},e.prev=10,e.next=13,(0,u.resolve)(R.default.verifySignature(t,n,i,o,a));case 13:e.next=19;break;case 15:return e.prev=15,e.t0=e.catch(10),S.default.warn("Unable to verify signature on device "+i+":"+o+":"+e.t0),e.abrupt("return",!1);case 19:if(l=void 0,!(o in r)){e.next=27;break}if(l=r[o],l.getFingerprint()==a){e.next=25;break}return S.default.warn("Ed25519 key for device "+i+":"+o+" has changed"),e.abrupt("return",!1);case 25:e.next=28;break;case 27:r[o]=l=new T.default(o);case 28:return l.keys=n.keys||{},l.algorithms=n.algorithms||[],l.unsigned=c,e.abrupt("return",!0);case 32:case"end":return e.stop()}},e,this,[[10,15]])}));return function(t,r,n){return e.apply(this,arguments)}}(),w=e("../logger"),S=n(w),k=e("./deviceinfo"),T=n(k),x=e("./olmlib"),R=n(x),I=e("./store/indexeddb-crypto-store"),C=n(I),j=function(){function e(t,r,n,o){(0,y.default)(this,e),this._cryptoStore=r,this._sessionStore=n,this._devices={},this._userByIdentityKey={},this._deviceTrackingStatus={},this._syncToken=null,this._serialiser=new O(t,o,this),this._keyDownloadsInProgressByUser={},this._dirty=!1,this._savePromise=null,this._resolveSavePromise=null,this._savePromiseTime=null,this._saveTimer=null}return(0,g.default)(e,[{key:"load",value:function(){function e(){return t.apply(this,arguments)}var t=(0,u.coroutine)(d.default.mark(function e(){var t,r,n,o,i,s,a,c=this;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=!1,e.next=3,(0,u.resolve)(this._cryptoStore.doTxn("readwrite",[C.default.STORE_DEVICE_DATA],function(e){c._cryptoStore.getEndToEndDeviceData(e,function(r){null===r?(S.default.log("Migrating e2e device data..."),c._devices=c._sessionStore.getAllEndToEndDevices()||{},c._deviceTrackingStatus=c._sessionStore.getEndToEndDeviceTrackingStatus()||{},c._syncToken=c._sessionStore.getEndToEndDeviceSyncToken(),c._cryptoStore.storeEndToEndDeviceData({devices:c._devices,trackingStatus:c._deviceTrackingStatus,syncToken:c._syncToken},e),t=!0):(c._devices=r?r.devices:{},c._deviceTrackingStatus=r?r.trackingStatus:{},c._syncToken=r?r.syncToken:null),c._userByIdentityKey={};var n=!0,o=!1,i=void 0;try{for(var s,a=(0,v.default)((0,p.default)(c._devices));!(n=(s=a.next()).done);n=!0){var u=s.value,l=c._devices[u],d=!0,f=!1,h=void 0;try{for(var m,y=(0,v.default)((0,p.default)(l));!(d=(m=y.next()).done);d=!0){var _=m.value,g=l[_].keys["curve25519:"+_];void 0!==g&&(c._userByIdentityKey[g]=u)}}catch(e){f=!0,h=e}finally{try{!d&&y.return&&y.return()}finally{if(f)throw h}}}}catch(e){o=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}})}));case 3:for(t&&this._sessionStore.removeEndToEndDeviceData(),r=!0,n=!1,o=void 0,e.prev=7,i=(0,v.default)((0,p.default)(this._deviceTrackingStatus));!(r=(s=i.next()).done);r=!0)a=s.value,2==this._deviceTrackingStatus[a]&&(this._deviceTrackingStatus[a]=1);e.next=15;break;case 11:e.prev=11,e.t
|
||
|
}).then(function(e){e.state===_.UNSENT&&r._startTimer()})}},{key:"cancelRoomKeyRequest",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._cryptoStore.getOutgoingRoomKeyRequest(e).then(function(n){if(n)switch(n.state){case _.CANCELLATION_PENDING:case _.CANCELLATION_PENDING_AND_WILL_RESEND:return;case _.UNSENT:return v.default.log("deleting unnecessary room key request for "+o(e)),t._cryptoStore.deleteOutgoingRoomKeyRequest(n.requestId,_.UNSENT);case _.SENT:var i=r?_.CANCELLATION_PENDING_AND_WILL_RESEND:_.CANCELLATION_PENDING;return t._cryptoStore.updateOutgoingRoomKeyRequest(n.requestId,_.SENT,{state:i,cancellationTxnId:t._baseApis.makeTxnId()}).then(function(n){if(!n)return void v.default.log("Tried to cancel room key request for "+o(e)+" but it was already cancelled in another tab");t._sendOutgoingRoomKeyRequestCancellation(n,r).catch(function(e){v.default.error("Error sending room key request cancellation; will retry later.",e),t._startTimer()}).then(function(){r&&t._startTimer()})});default:throw new Error("unhandled state: "+n.state)}})}},{key:"getOutgoingSentRoomKeyRequest",value:function(e,t){return this._cryptoStore.getOutgoingRoomKeyRequestsByTarget(e,t,[_.SENT])}},{key:"_startTimer",value:function(){var e=this;if(!this._sendOutgoingRoomKeyRequestsTimer){var r=function(){if(e._sendOutgoingRoomKeyRequestsRunning)throw new Error("RoomKeyRequestSend already in progress!");e._sendOutgoingRoomKeyRequestsRunning=!0,e._sendOutgoingRoomKeyRequests().finally(function(){e._sendOutgoingRoomKeyRequestsRunning=!1}).catch(function(e){v.default.warn("error in OutgoingRoomKeyRequestManager: "+e)}).done()};this._sendOutgoingRoomKeyRequestsTimer=t.setTimeout(r,500)}}},{key:"_sendOutgoingRoomKeyRequests",value:function(){var e=this;return this._clientRunning?(v.default.log("Looking for queued outgoing room key requests"),this._cryptoStore.getOutgoingRoomKeyRequestByState([_.CANCELLATION_PENDING,_.CANCELLATION_PENDING_AND_WILL_RESEND,_.UNSENT]).then(function(t){if(!t)return v.default.log("No more outgoing room key requests"),void(e._sendOutgoingRoomKeyRequestsTimer=null);var r=void 0;switch(t.state){case _.UNSENT:r=e._sendOutgoingRoomKeyRequest(t);break;case _.CANCELLATION_PENDING:r=e._sendOutgoingRoomKeyRequestCancellation(t);break;case _.CANCELLATION_PENDING_AND_WILL_RESEND:r=e._sendOutgoingRoomKeyRequestCancellation(t,!0)}return r.then(function(){return e._sendOutgoingRoomKeyRequests()}).catch(function(t){v.default.error("Error sending room key request; will retry later.",t),e._sendOutgoingRoomKeyRequestsTimer=null,e._startTimer()}).done()})):(this._sendOutgoingRoomKeyRequestsTimer=null,p.default.resolve())}},{key:"_sendOutgoingRoomKeyRequest",value:function(e){var t=this;v.default.log("Requesting keys for "+o(e.requestBody)+" from "+i(e.recipients)+"(id "+e.requestId+")");var r={action:"request",requesting_device_id:this._deviceId,request_id:e.requestId,body:e.requestBody};return this._sendMessageToDevices(r,e.recipients,e.requestId).then(function(){return t._cryptoStore.updateOutgoingRoomKeyRequest(e.requestId,_.UNSENT,{state:_.SENT})})}},{key:"_sendOutgoingRoomKeyRequestCancellation",value:function(e,t){var r=this;v.default.log("Sending cancellation for key request for "+o(e.requestBody)+" to "+i(e.recipients)+" (cancellation id "+e.cancellationTxnId+")");var n={action:"request_cancellation",requesting_device_id:this._deviceId,request_id:e.requestId};return this._sendMessageToDevices(n,e.recipients,e.cancellationTxnId).then(function(){return t?r._cryptoStore.updateOutgoingRoomKeyRequest(e.requestId,_.CANCELLATION_PENDING_AND_WILL_RESEND,{state:_.UNSENT}):r._cryptoStore.deleteOutgoingRoomKeyRequest(e.requestId,_.CANCELLATION_PENDING)})}},{key:"_sendMessageToDevices",value:function(e,t,r){var n={},o=!0,i=!1,s=void 0;try{for(var u,c=(0,a.default)(t);!(o=(u=c.next()).done);o=!0){var l=u.value;n[l.userId]||(n[l.userId]={}),n[l.userId][l.deviceId]=e}}catch(e){i=!0,s=e}finally{try{!o&&c.return&&c.return()}finally{if(i)throw s}}return this._baseApis.sendToDevice("m.room_key_request",n
|
||
|
i.coroutine)(o.default.mark(function e(r,n){var a;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.Olm){e.next=2;break}throw new Error("Olm is not available");case 2:if(a=r.auth_data,a.private_key_salt&&a.private_key_iterations){e.next=5;break}throw new Error("Salt and/or iterations not found: this backup cannot be restored with a passphrase");case 5:return e.next=7,(0,i.resolve)(s(n,r.auth_data.private_key_salt,r.auth_data.private_key_iterations));case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}(),r.keyForNewBackup=function(){var e=(0,i.coroutine)(o.default.mark(function e(r){var n,c;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.Olm){e.next=2;break}throw new Error("Olm is not available");case 2:return n=(0,a.randomString)(32),e.next=5,(0,i.resolve)(s(r,n,u));case 5:return c=e.sent,e.abrupt("return",{key:c,salt:n,iterations:u});case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),function(){var e=(0,i.coroutine)(o.default.mark(function e(r,n,s){var a,u,c,l;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.crypto.subtle,u=t.TextEncoder,a&&u){e.next=4;break}throw new Error("Password-based backup is not avaiable on this platform");case 4:return e.next=6,(0,i.resolve)(a.importKey("raw",(new u).encode(r),{name:"PBKDF2"},!1,["deriveBits"]));case 6:return c=e.sent,e.next=9,(0,i.resolve)(a.deriveBits({name:"PBKDF2",salt:(new u).encode(n),iterations:s,hash:"SHA-512"},c,8*t.Olm.PRIVATE_KEY_LENGTH));case 9:return l=e.sent,e.abrupt("return",new Uint8Array(l));case 11:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()),a=e("../randomstring"),u=5e5}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../randomstring":43,"babel-runtime/regenerator":86,bluebird:89}],16:[function(e,t,r){"use strict";function n(e){Object.defineProperty(this,"deviceId",{enumerable:!0,value:e}),this.algorithms=[],this.keys={},this.verified=o.UNVERIFIED,this.known=!1,this.unsigned={}}n.fromStorage=function(e,t){var r=new n(t);for(var o in e)e.hasOwnProperty(o)&&(r[o]=e[o]);return r},n.prototype.toStorage=function(){return{algorithms:this.algorithms,keys:this.keys,verified:this.verified,known:this.known,unsigned:this.unsigned}},n.prototype.getFingerprint=function(){return this.keys["ed25519:"+this.deviceId]},n.prototype.getIdentityKey=function(){return this.keys["curve25519:"+this.deviceId]},n.prototype.getDisplayName=function(){return this.unsigned.device_display_name||null},n.prototype.isBlocked=function(){return this.verified==o.BLOCKED},n.prototype.isVerified=function(){return this.verified==o.VERIFIED},n.prototype.isUnverified=function(){return this.verified==o.UNVERIFIED},n.prototype.isKnown=function(){return 1==this.known},n.DeviceVerification={VERIFIED:1,UNVERIFIED:0,BLOCKED:-1};var o=n.DeviceVerification;t.exports=n},{}],17:[function(e,t,r){(function(t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(){return Boolean(t.Olm)}function i(e,t,r,n,o,i,s){this._baseApis=e,this._sessionStore=t,this._userId=r,this._deviceId=n,this._clientStore=o,this._cryptoStore=i,this._roomList=s,this.backupInfo=null,this.backupKey=null,this._checkedForBackup=!1,this._sendingBackups=!1,this._olmDevice=new L(t,i),this._deviceList=new B(e,i,t,this._olmDevice),this._lastOneTimeKeyCheck=null,this._oneTimeKeyCheckInProgress=!1,this._roomEncryptors={},this._roomDecryptors={},this._supportedAlgorithms=P.keys(N.DECRYPTION_CLASSES),this._deviceKeys={},this._globalBlacklistUnverifiedDevices=!1,this._outgoingRoomKeyRequestManager=new j.default(e,this._deviceId,this._cryptoStore),this._receivedRoomKeyRequests=[],this._receivedRoomKeyRequestCancellations=[],this._processingRoomKeyRequests=!1,this._lazyLoadMembers=!1,this._roomDeviceTrackingState={},this._lastNewSessionForced={}}function s(e){function t(n){if(i<=n)return b.default.reso
|
||
|
e.t0=e.catch(15),M.warn("Failed to re-share keys for session "+o.session_id+" with device "+r+":"+u.deviceId,e.t0);case 23:return e.abrupt("return");case 24:if(this._roomDecryptors[i]){e.next=27;break}return M.log("room key request for unencrypted room "+i),e.abrupt("return");case 27:if(c=this._roomDecryptors[i][s]){e.next=31;break}return M.log("room key request for unknown alg "+s+" in room "+i),e.abrupt("return");case 31:return e.next=33,(0,g.resolve)(c.hasKeysForKeyRequest(t));case 33:if(e.sent){e.next=36;break}return M.log("room key request for unknown session "+i+" / "+o.session_id),e.abrupt("return");case 36:if(t.share=function(){c.shareKeysWithDevice(t)},!(l=this._deviceList.getStoredDevice(r,n))||!l.isVerified()){e.next=42;break}return M.log("device is already verified: sharing keys"),t.share(),e.abrupt("return");case 42:this.emit("crypto.roomKeyRequest",t);case 43:case"end":return e.stop()}},e,this,[[15,20]])}));return function(t){return e.apply(this,arguments)}}(),i.prototype._processReceivedRoomKeyRequestCancellation=function(){var e=(0,g.method)(function(e){M.log("m.room_key_request cancellation for "+e.userId+":"+e.deviceId+" (id "+e.requestId+")"),this.emit("crypto.roomKeyRequestCancellation",e)});return function(t){return e.apply(this,arguments)}}(),i.prototype._getRoomDecryptor=function(e,t){var r=void 0,n=void 0;if((e=e||null)&&(r=this._roomDecryptors[e],r||(this._roomDecryptors[e]=r={}),n=r[t]))return n;var o=N.DECRYPTION_CLASSES[t];if(!o)throw new N.DecryptionError("UNKNOWN_ENCRYPTION_ALGORITHM",'Unknown encryption algorithm "'+t+'".');return n=new o({userId:this._userId,crypto:this,olmDevice:this._olmDevice,baseApis:this._baseApis,roomId:e}),r&&(r[t]=n),n},i.prototype._signObject=function(){var e=(0,g.coroutine)(x.default.mark(function e(t){var r;return x.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={},r[this._userId]={},e.next=4,(0,g.resolve)(this._olmDevice.sign(D.stringify(t)));case 4:r[this._userId]["ed25519:"+this._deviceId]=e.sent,t.signatures=r;case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}();var K=function e(t){(0,u.default)(this,e);var r=t.getContent();this.userId=t.getSender(),this.deviceId=r.requesting_device_id,this.requestId=r.request_id,this.requestBody=r.body||{},this.share=function(){throw new Error("don't know how to share keys for this request yet")}},G=function e(t){(0,u.default)(this,e);var r=t.getContent();this.userId=t.getSender(),this.deviceId=r.requesting_device_id,this.requestId=r.request_id}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../logger":29,"../utils":55,"./DeviceList":7,"./OlmDevice":8,"./OutgoingRoomKeyRequestManager":9,"./algorithms":12,"./deviceinfo":16,"./olmlib":18,"./store/indexeddb-crypto-store":21,"another-json":57,"babel-runtime/core-js/get-iterator":58,"babel-runtime/core-js/json/stringify":60,"babel-runtime/core-js/object/assign":63,"babel-runtime/core-js/object/keys":69,"babel-runtime/core-js/set":76,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/defineProperty":81,"babel-runtime/helpers/typeof":85,"babel-runtime/regenerator":86,bluebird:89,events:234}],18:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=e("bluebird"),i=n(o),s=e("babel-runtime/regenerator"),a=n(s),u=e("babel-runtime/core-js/json/stringify"),c=n(u),l=function(){var e=(0,o.coroutine)(a.default.mark(function e(t,r,n,i){var s,u;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=i.deviceId,e.prev=1,e.next=4,(0,o.resolve)(h(t,r,n,s,i.getFingerprint()));case 4:e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(1),f.error("Unable to verify signature on one-time key for device "+n+":"+s+":",e.t0),e.abrupt("return",null);case 10:return u=void 0,e.prev=11,e.next=14,(0,o.resolve)(t.createOutboundSession(i.getIdentityKey(),r.key));case 14:u=e.sent,e.next=21;break;case 17:return e.prev=17,e.t1=e.catch(11),f.error("Error starting session with device "+n+":"+s+": "+e.t1),e.
|
||
|
;if(n.requestId===e)return n.state!=t?(y.default.warn("Cannot delete room key request in state "+n.state+" (expected "+t+")"),v.default.resolve(null)):(this._outgoingRoomKeyRequests.splice(r,1),v.default.resolve(n))}return v.default.resolve(null)}},{key:"getAccount",value:function(e,t){t(this._account)}},{key:"storeAccount",value:function(e,t){this._account=t}},{key:"countEndToEndSessions",value:function(e,t){return(0,i.default)(this._sessions).length}},{key:"getEndToEndSession",value:function(e,t,r,n){n((this._sessions[e]||{})[t]||null)}},{key:"getEndToEndSessions",value:function(e,t,r){r(this._sessions[e]||{})}},{key:"storeEndToEndSession",value:function(e,t,r,n){var o=this._sessions[e];void 0===o&&(o={},this._sessions[e]=o),o[t]=r}},{key:"getEndToEndInboundGroupSession",value:function(e,t,r,n){n(this._inboundGroupSessions[e+"/"+t]||null)}},{key:"getAllEndToEndInboundGroupSessions",value:function(e,t){var r=!0,n=!1,o=void 0;try{for(var s,a=(0,c.default)((0,i.default)(this._inboundGroupSessions));!(r=(s=a.next()).done);r=!0){var u=s.value;t({senderKey:u.substr(0,43),sessionId:u.substr(44),sessionData:this._inboundGroupSessions[u]})}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}t(null)}},{key:"addEndToEndInboundGroupSession",value:function(e,t,r,n){var o=e+"/"+t;void 0===this._inboundGroupSessions[o]&&(this._inboundGroupSessions[o]=r)}},{key:"storeEndToEndInboundGroupSession",value:function(e,t,r,n){this._inboundGroupSessions[e+"/"+t]=r}},{key:"getEndToEndDeviceData",value:function(e,t){t(this._deviceData)}},{key:"storeEndToEndDeviceData",value:function(e,t){this._deviceData=e}},{key:"storeEndToEndRoom",value:function(e,t,r){this._rooms[e]=t}},{key:"getEndToEndRooms",value:function(e,t){t(this._rooms)}},{key:"getSessionsNeedingBackup",value:function(e){var t=[];for(var r in this._sessionsNeedingBackup)if(this._inboundGroupSessions[r]&&(t.push({senderKey:r.substr(0,43),sessionId:r.substr(44),sessionData:this._inboundGroupSessions[r]}),e&&r.length>=e))break;return v.default.resolve(t)}},{key:"unmarkSessionsNeedingBackup",value:function(e){var t=!0,r=!1,n=void 0;try{for(var o,i=(0,c.default)(e);!(t=(o=i.next()).done);t=!0){var s=o.value,a=s.senderKey+"/"+s.sessionId;delete this._sessionsNeedingBackup[a]}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}return v.default.resolve()}},{key:"markSessionsNeedingBackup",value:function(e){var t=!0,r=!1,n=void 0;try{for(var o,i=(0,c.default)(e);!(t=(o=i.next()).done);t=!0){var s=o.value,a=s.senderKey+"/"+s.sessionId;this._sessionsNeedingBackup[a]=!0}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}return v.default.resolve()}},{key:"doTxn",value:function(e,t,r){return v.default.resolve(r(null))}}]),e}();r.default=b},{"../../logger":29,"../../utils":55,"babel-runtime/core-js/get-iterator":58,"babel-runtime/core-js/object/assign":63,"babel-runtime/core-js/object/keys":69,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/createClass":80,bluebird:89}],24:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r="Store is invalid because "+e+", please stop the client, delete all data and start the client again",n=(0,p.default)(Error,[r]);return(0,d.default)(n,(0,c.default)(this)),n.reason=e,n.value=t,n}function i(e){var t="Crypto store is invalid because "+e+", please stop the client, delete all data and start the client again",r=(0,p.default)(Error,[t]);return(0,d.default)(r,(0,c.default)(this)),r.reason=e,r.name="InvalidCryptoStoreError",r}Object.defineProperty(r,"__esModule",{value:!0});var s=e("babel-runtime/core-js/object/create"),a=n(s),u=e("babel-runtime/core-js/reflect/get-prototype-of"),c=n(u),l=e("babel-runtime/core-js/reflect/set-prototype-of"),d=n(l),f=e("babel-runtime/core-js/reflect/construct"),p=n(f);r.InvalidStoreError=o,r.InvalidCryptoStoreError=i,o.TOGGLED_LAZY_LOADING="TOGGLED_LAZY_LOADING",o.prototype=(0,a.default)(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),(0,d.default)(o,Error
|
||
|
getDate:function(){return this.event.origin_server_ts?new Date(this.event.origin_server_ts):null},getContent:function(){return this._clearEvent.content||this.event.content||{}},getWireContent:function(){return this.event.content||{}},getPrevContent:function(){return this.getUnsigned().prev_content||this.event.prev_content||{}},getDirectionalContent:function(){return this.forwardLooking?this.getContent():this.getPrevContent()},getAge:function(){return this.getUnsigned().age||this.event.age},getStateKey:function(){return this.event.state_key},isState:function(){return void 0!==this.event.state_key},makeEncrypted:function(e,t,r,n){this._clearEvent={type:this.event.type,content:this.event.content},this.event.type=e,this.event.content=t,this._senderCurve25519Key=r,this._claimedEd25519Key=n},isBeingDecrypted:function(){return null!=this._decryptionPromise},isDecryptionFailure:function(){return this._clearEvent&&this._clearEvent.content&&"m.bad.encrypted"===this._clearEvent.content.msgtype},attemptDecryption:function(){function e(e){return t.apply(this,arguments)}var t=(0,s.method)(function(e){if(!this.isEncrypted())throw new Error("Attempt to decrypt event which isn't encrypted");if(this._clearEvent&&this._clearEvent.content&&"m.bad.encrypted"!==this._clearEvent.content.msgtype)throw new Error("Attempt to decrypt event which has already been encrypted");return this._decryptionPromise?(console.log("Event "+this.getId()+" already being decrypted; queueing a retry"),this._retryDecryption=!0,this._decryptionPromise):(this._decryptionPromise=this._decryptionLoop(e),this._decryptionPromise)});return e}(),cancelAndResendKeyRequest:function(e){var t=this.getWireContent();e.cancelRoomKeyRequest({algorithm:t.algorithm,room_id:this.getRoomId(),session_id:t.session_id,sender_key:t.sender_key},!0)},_decryptionLoop:function(){function e(e){return t.apply(this,arguments)}var t=(0,s.coroutine)(i.default.mark(function e(t){var r,n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.resolve)(a.default.resolve());case 2:if(this._retryDecryption=!1,r=void 0,n=void 0,e.prev=6,t){e.next=11;break}r=this._badEncryptedMessage("Encryption not enabled"),e.next=14;break;case 11:return e.next=13,(0,s.resolve)(t.decryptEvent(this));case 13:r=e.sent;case 14:e.next=29;break;case 16:if(e.prev=16,e.t0=e.catch(6),"DecryptionError"===e.t0.name){e.next=23;break}return console.error("Error decrypting event (id="+this.getId()+"): "+(e.t0.stack||e.t0)),this._decryptionPromise=null,this._retryDecryption=!1,e.abrupt("return");case 23:if(n=e.t0,!this._retryDecryption){e.next=27;break}return console.log("Got error decrypting event (id="+this.getId()+": "+e.t0+"), but retrying"),e.abrupt("continue",2);case 27:console.warn("Error decrypting event (id="+this.getId()+"): "+e.t0.detailedString),r=this._badEncryptedMessage(e.t0.message);case 29:return this._decryptionPromise=null,this._retryDecryption=!1,this._setClearData(r),this.emit("Event.decrypted",this,n),e.abrupt("return");case 36:case"end":return e.stop()}},e,this,[[6,16]])}));return e}(),_badEncryptedMessage:function(e){return{clearEvent:{type:"m.room.message",content:{msgtype:"m.bad.encrypted",body:"** Unable to decrypt: "+e+" **"}}}},_setClearData:function(e){this._clearEvent=e.clearEvent,this._senderCurve25519Key=e.senderCurve25519Key||null,this._claimedEd25519Key=e.claimedEd25519Key||null,this._forwardingCurve25519KeyChain=e.forwardingCurve25519KeyChain||[]},isEncrypted:function(){return"m.room.encrypted"===this.event.type},getSenderKey:function(){return this._senderCurve25519Key},getKeysClaimed:function(){return{ed25519:this._claimedEd25519Key}},getClaimedEd25519Key:function(){return this._claimedEd25519Key},getForwardingCurve25519KeyChain:function(){return this._forwardingCurve25519KeyChain},getUnsigned:function(){return this.event.unsigned||{}},makeRedacted:function(e){if(!e.event)throw new Error("invalid redaction_event in makeRedacted");this.event.unsigned||(this.event.unsigned={}),this.event.unsigned.redacted_because=e.event;var t=void 0;for(t in this.event)this.event
|
||
|
;for(var s=0;s<this._timelineSets.length;s++)this._timelineSets[s].replaceEventId(o,r)}else t==b.CANCELLED&&(this._pendingEventList&&k.removeElement(this._pendingEventList,function(e){return e.getId()==o},!1),this.removeEvent(o));this.emit("Room.localEchoUpdated",e,this,e.getId(),n)},i.prototype.addLiveEvents=function(e,t){var r=void 0;if(t&&-1===["replace","ignore"].indexOf(t))throw new Error("duplicateStrategy MUST be either 'replace' or 'ignore'");for(r=0;r<this._timelineSets.length;r++){var n=this._timelineSets[r].getLiveTimeline();if(n.getPaginationToken(x.FORWARDS))throw new Error("live timeline "+r+" is no longer live - it has a pagination token ("+n.getPaginationToken(x.FORWARDS)+")");if(n.getNeighbouringTimeline(x.FORWARDS))throw new Error("live timeline "+r+" is no longer live - it has a neighbouring timeline")}for(r=0;r<e.length;r++)"m.typing"===e[r].getType()?this.currentState.setTypingEvent(e[r]):"m.receipt"===e[r].getType()?this.addReceipt(e[r]):this._addLiveEvent(e[r],t)},i.prototype.removeEvents=function(e){for(var t=0;t<e.length;++t)this.removeEvent(e[t])},i.prototype.removeEvent=function(e){for(var t=!1,r=0;r<this._timelineSets.length;r++){this._timelineSets[r].removeEvent(e)&&(t=!0)}return t},i.prototype.recalculate=function(){var e=this,t=this.currentState.getStateEvents("m.room.member",this.myUserId);if(t&&"invite"===t.getContent().membership){var r=t.event.invite_room_state||[];k.forEach(r,function(t){e.currentState.getStateEvents(t.type,t.state_key)||e.currentState.setStateEvents([new S({type:t.type,state_key:t.state_key,content:t.content,event_id:"$fake"+Date.now(),room_id:e.roomId,user_id:e.myUserId})])})}var n=this.name;this.name=s(this,this.myUserId),this.summary=new E(this.roomId,{title:this.name}),n!==this.name&&this.emit("Room.name",this)},i.prototype.getUsersReadUpTo=function(e){return this.getReceiptsForEvent(e).filter(function(e){return"m.read"===e.type}).map(function(e){return e.userId})},i.prototype.getEventReadUpTo=function(e,t){var r=this._receipts;return t&&(r=this._realReceipts),void 0===r["m.read"]||void 0===r["m.read"][e]?null:r["m.read"][e].eventId},i.prototype.getReceiptsForEvent=function(e){return this._receiptCacheByEventId[e.getId()]||[]},i.prototype.addReceipt=function(e,t){void 0===t&&(t=!1),t||this._addReceiptsToStructure(e,this._realReceipts),this._addReceiptsToStructure(e,this._receipts),this._receiptCacheByEventId=this._buildReceiptCache(this._receipts),this.emit("Room.receipt",e,this)},i.prototype._addReceiptsToStructure=function(e,t){var r=this;k.keys(e.getContent()).forEach(function(n){k.keys(e.getContent()[n]).forEach(function(o){k.keys(e.getContent()[n][o]).forEach(function(i){var s=e.getContent()[n][o][i];t[o]||(t[o]={});var a=t[o][i];if(a){var u=r.getUnfilteredTimelineSet().compareEventOrdering(a.eventId,n);if(null!==u&&u>=0)return}else t[o][i]={};t[o][i]={eventId:n,data:s}})})})},i.prototype._buildReceiptCache=function(e){var t={};return k.keys(e).forEach(function(r){k.keys(e[r]).forEach(function(n){var o=e[r][n];t[o.eventId]||(t[o.eventId]=[]),t[o.eventId].push({userId:n,type:r,data:o.data})})}),t},i.prototype._addLocalEchoReceipt=function(e,t,r){this.addReceipt(o(e,t,r),!0)},i.prototype.addTags=function(e){this.tags=e.getContent().tags||{},this.emit("Room.tags",e,this)},i.prototype.addAccountData=function(e){for(var t=0;t<e.length;t++){var r=e[t];"m.tag"===r.getType()&&this.addTags(r),this.accountData[r.getType()]=r,this.emit("Room.accountData",r,this)}},i.prototype.getAccountData=function(e){return this.accountData[e]},i.prototype.maySendMessage=function(){return"join"===this.getMyMembership()&&this.currentState.maySendEvent("m.room.message",this.myUserId)},t.exports=i},{"../ReEmitter":2,"../content-repo":6,"../utils":55,"./event":34,"./event-timeline":33,"./event-timeline-set":32,"./room-member":36,"./room-summary":38,"babel-runtime/core-js/number/is-integer":62,"babel-runtime/core-js/object/assign":63,"babel-runtime/core-js/promise":72,"babel-runtime/regenerator":86,bluebird:89,events:234}],40:[function(e,t,r){"use strict";function n(e,t){this.rank=e,this.
|
||
|
return a.default.resolve(null)},deleteAllData:function(){return this.rooms={},this.users={},this.syncToken=null,this.filters={},this.accountData={},a.default.resolve()},getOutOfBandMembers:function(e){return a.default.resolve(this._oobMembers[e]||null)},setOutOfBandMembers:function(e,t){return this._oobMembers[e]=t,a.default.resolve()},getClientOptions:function(){return a.default.resolve(this._clientOptions)},storeClientOptions:function(e){return this._clientOptions=(0,i.default)({},e),a.default.resolve()}}},{"../models/user":41,"../utils":55,"babel-runtime/core-js/object/assign":63,bluebird:89}],50:[function(e,t,r){"use strict";function n(e){if(this.store=e,!(h.isFunction(e.getItem)&&h.isFunction(e.setItem)&&h.isFunction(e.removeItem)&&h.isFunction(e.key)&&"number"==typeof e.length))throw new Error("Supplied webStore does not meet the WebStorage API interface")}function o(e){return m+"devices/"+e}function i(e){return m+"sessions/"+e}function s(e,t){return m+"inboundgroupsessions/"+e+"/"+t}function a(e){return m+"rooms/"+e}function u(e,t){try{return JSON.parse(e.getItem(t))}catch(e){d("Failed to get key %s: %s",t,e),d(e.stack)}return null}function c(e,t){for(var r=[],n=0;n<e.length;++n){var o=e.key(n);o.startsWith(t)&&r.push(o)}return r}function l(e,t){for(var r=[],n=0;n<e.length;++n){var o=e.key(n);o.startsWith(t)&&r.push(o)}var i=!0,s=!1,a=void 0;try{for(var u,c=(0,p.default)(r);!(i=(u=c.next()).done);i=!0){var l=u.value;e.removeItem(l)}}catch(e){s=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(s)throw a}}}function d(){if(v){var e;(e=console).log.apply(e,arguments)}}var f=e("babel-runtime/core-js/get-iterator"),p=function(e){return e&&e.__esModule?e:{default:e}}(f),h=e("../../utils"),v=!1,m="session.e2e.";n.prototype={removeEndToEndAccount:function(){this.store.removeItem(y)},getEndToEndAccount:function(){return this.store.getItem(y)},getAllEndToEndDevices:function(){for(var e=o(""),t={},r=0;r<this.store.length;++r){var n=this.store.key(r),i=n.substr(e.length);n.startsWith(e)&&(t[i]=u(this.store,n))}return t},getEndToEndDeviceTrackingStatus:function(){return u(this.store,g)},getEndToEndDeviceSyncToken:function(){return u(this.store,_)},removeEndToEndDeviceData:function(){l(this.store,o("")),l(this.store,g),l(this.store,_)},getEndToEndSessions:function(e){return u(this.store,i(e))},getAllEndToEndSessions:function(){var e=c(this.store,i("")),t={},r=!0,n=!1,o=void 0;try{for(var s,a=(0,p.default)(e);!(r=(s=a.next()).done);r=!0){var l=s.value;t[l.substr(i("").length)]=u(this.store,l)}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}return t},removeAllEndToEndSessions:function(){l(this.store,i(""))},getAllEndToEndInboundGroupSessionKeys:function(){for(var e=m+"inboundgroupsessions/",t=[],r=0;r<this.store.length;r++){var n=this.store.key(r);n.startsWith(e)&&t.push({senderKey:n.substr(e.length,43),sessionId:n.substr(e.length+44)})}return t},getEndToEndInboundGroupSession:function(e,t){var r=s(e,t);return this.store.getItem(r)},removeAllEndToEndInboundGroupSessions:function(){l(this.store,m+"inboundgroupsessions/")},getAllEndToEndRooms:function(){var e=c(this.store,a("")),t={},r=!0,n=!1,o=void 0;try{for(var i,s=(0,p.default)(e);!(r=(i=s.next()).done);r=!0){var l=i.value;t[l.substr(a("").length)]=u(this.store,l)}}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return t},removeAllEndToEndRooms:function(){l(this.store,a(""))}};var y=m+"account",_=m+"device_sync_token",g=m+"device_tracking";t.exports=n},{"../../utils":55,"babel-runtime/core-js/get-iterator":58}],51:[function(e,t,r){"use strict";function n(){this.fromToken=null}var o=e("bluebird"),i=function(e){return e&&e.__esModule?e:{default:e}}(o);n.prototype={isNewlyCreated:function(){return i.default.resolve(!0)},getSyncToken:function(){return this.fromToken},setSyncToken:function(e){this.fromToken=e},storeGroup:function(e){},getGroup:function(e){return null},getGroups:function(){return[]},storeRoom:function(e){},getRoom:function(e){return null},getRooms:function(){return[]},removeRoom:function(e){},getRoomSumm
|
||
|
})},s.prototype._resolveInvites=function(e){if(e&&this.opts.resolveInvitesToProfiles){var t=this.client;e.getMembersWithMembership("invite").forEach(function(r){if(!r._requestedProfileInfo){r._requestedProfileInfo=!0;var n=t.getUser(r.userId),o=void 0;o=n?y.default.resolve({avatar_url:n.avatarUrl,displayname:n.displayName}):t.getProfileInfo(r.userId),o.done(function(t){var n=r.events.member;"invite"===n.getContent().membership&&(n.getContent().avatar_url=t.avatar_url,n.getContent().displayname=t.displayname,r.setMembershipEvent(n,e.currentState))},function(e){})}})}},s.prototype._processRoomEvents=function(e,t,r){var n=e.getLiveTimeline(),o=0==n.getEvents().length;if(o){var i=!0,s=!1,a=void 0;try{for(var u,c=(0,p.default)(t);!(i=(u=c.next()).done);i=!0){var l=u.value;this.client.getPushActionsForEvent(l)}}catch(e){s=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(s)throw a}}n.initialiseState(t)}this._resolveInvites(e),e.recalculate(),o||(e.oldState.setStateEvents(t||[]),e.currentState.setStateEvents(t||[])),e.addLiveEvents(r||[])},s.prototype._processEventsForNotifs=function(e,t){if(this.client.getNotifTimelineSet())for(var r=0;r<t.length;r++){var n=this.client.getPushActionsForEvent(t[r]);n&&n.notify&&n.tweaks&&n.tweaks.highlight&&this._notifEvents.push(t[r])}},s.prototype._getGuestFilter=function(){return this.client._guestRooms?(0,c.default)({room:{timeline:{limit:20}}}):"{}"},s.prototype._updateSyncState=function(e,t){var r=this._syncState;this._syncState=e,this._syncStateData=t,this.client.emit("sync",this._syncState,r,t)},s.prototype._onOnline=function(){i("Browser thinks we are back online"),this._startKeepAlives(0)},t.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./errors":24,"./filter":26,"./models/event-timeline":33,"./models/group":35,"./models/room":39,"./models/user":41,"./utils":55,"babel-runtime/core-js/get-iterator":58,"babel-runtime/core-js/json/stringify":60,"babel-runtime/core-js/object/keys":69,"babel-runtime/regenerator":86,bluebird:89}],54:[function(e,t,r){"use strict";function n(e,t,r){r=r||{},this._client=e,this._timelineSet=t,this._start=null,this._end=null,this._eventCount=0,this._windowLimit=r.windowLimit||1e3}function o(e,t){this.timeline=e,this.index=t}var i=e("bluebird"),s=function(e){return e&&e.__esModule?e:{default:e}}(i),a=e("./models/event-timeline"),u=function(){};n.prototype.load=function(e,t){var r=this;t=t||20;var n=function(n){var i=void 0,s=n.getEvents();if(e){for(var a=0;a<s.length;a++)if(s[a].getId()==e){i=a;break}if(void 0===i)throw new Error("getEventTimeline result didn't include requested event")}else i=s.length;var u=Math.min(s.length,i+Math.ceil(t/2)),c=Math.max(0,u-t);r._start=new o(n,c-n.getBaseIndex()),r._end=new o(n,u-n.getBaseIndex()),r._eventCount=u-c};if(e){var i=this._client.getEventTimeline(this._timelineSet,e);return i.isFulfilled()?(n(i.value()),s.default.resolve()):i.then(n)}return n(this._timelineSet.getLiveTimeline()),s.default.resolve()},n.prototype.canPaginate=function(e){var t=void 0;if(e==a.BACKWARDS)t=this._start;else{if(e!=a.FORWARDS)throw new Error("Invalid direction '"+e+"'");t=this._end}if(!t)return u("TimelineWindow: no timeline yet"),!1;if(e==a.BACKWARDS){if(t.index>t.minIndex())return!0}else if(t.index<t.maxIndex())return!0;return Boolean(t.timeline.getNeighbouringTimeline(e)||t.timeline.getPaginationToken(e))},n.prototype.paginate=function(e,t,r,n){void 0===r&&(r=!0),void 0===n&&(n=5);var o=void 0;if(e==a.BACKWARDS)o=this._start;else{if(e!=a.FORWARDS)throw new Error("Invalid direction '"+e+"'");o=this._end}if(!o)return u("TimelineWindow: no timeline yet"),s.default.resolve(!1);if(o.pendingPaginate)return o.pendingPaginate;var i=e==a.BACKWARDS?o.retreat(t):o.advance(t);if(i){this._eventCount+=i,u("TimelineWindow: increased cap by "+i+" (now "+this._eventCount+")");var c=this._eventCount-this._windowLimit;return c>0&&this.unpaginate(c,e!=a.BACKWARDS),s.default.resolve(!0)}if(!r||0===n)return s.default.resolve(!1);if(!o.timeline.getPaginationToken(e))return u("T
|
||
|
t.exports={default:e("core-js/library/fn/object/entries"),__esModule:!0}},{"core-js/library/fn/object/entries":103}],67:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/freeze"),__esModule:!0}},{"core-js/library/fn/object/freeze":104}],68:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/get-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/get-prototype-of":105}],69:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":106}],70:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/set-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/set-prototype-of":107}],71:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/values"),__esModule:!0}},{"core-js/library/fn/object/values":108}],72:[function(e,t,r){t.exports={default:e("core-js/library/fn/promise"),__esModule:!0}},{"core-js/library/fn/promise":109}],73:[function(e,t,r){t.exports={default:e("core-js/library/fn/reflect/construct"),__esModule:!0}},{"core-js/library/fn/reflect/construct":110}],74:[function(e,t,r){t.exports={default:e("core-js/library/fn/reflect/get-prototype-of"),__esModule:!0}},{"core-js/library/fn/reflect/get-prototype-of":111}],75:[function(e,t,r){t.exports={default:e("core-js/library/fn/reflect/set-prototype-of"),__esModule:!0}},{"core-js/library/fn/reflect/set-prototype-of":112}],76:[function(e,t,r){t.exports={default:e("core-js/library/fn/set"),__esModule:!0}},{"core-js/library/fn/set":113}],77:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":114}],78:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":115}],79:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},{}],80:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("../core-js/object/define-property"),o=function(e){return e&&e.__esModule?e:{default:e}}(n);r.default=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),(0,o.default)(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}()},{"../core-js/object/define-property":65}],81:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("../core-js/object/define-property"),o=function(e){return e&&e.__esModule?e:{default:e}}(n);r.default=function(e,t,r){return t in e?(0,o.default)(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},{"../core-js/object/define-property":65}],82:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var o=e("../core-js/object/set-prototype-of"),i=n(o),s=e("../core-js/object/create"),a=n(s),u=e("../helpers/typeof"),c=n(u);r.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,c.default)(t)));e.prototype=(0,a.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(i.default?(0,i.default)(e,t):e.__proto__=t)}},{"../core-js/object/create":64,"../core-js/object/set-prototype-of":70,"../helpers/typeof":85}],83:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("../helpers/typeof"),o=function(e){return e&&e.__esModule?e:{default:e}}(n);r.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,o.default)(t))&&"function"!=typeof t?e:t}},{"../helpers/typeof":85}],84:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var o=e("../core-js/is-iterable"),i=n(o),s=e("../core-js/get-iterator"),a=n(s);r.default=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var s,u=(0,a.default)(e);!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&u.re
|
||
|
e instanceof Error?(d(this,"message",e.message),d(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var i,s,a=e("./es5"),u=a.freeze,c=e("./util"),l=c.inherits,d=c.notEnumerableProp,f=n("Warning","warning"),p=n("CancellationError","cancellation error"),h=n("TimeoutError","timeout error"),v=n("AggregateError","aggregate error");try{i=TypeError,s=RangeError}catch(e){i=n("TypeError","type error"),s=n("RangeError","range error")}for(var m="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y<m.length;++y)"function"==typeof Array.prototype[m[y]]&&(v.prototype[m[y]]=Array.prototype[m[y]]);a.defineProperty(v.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),v.prototype.isOperational=!0;var _=0;v.prototype.toString=function(){var e=Array(4*_+1).join(" "),t="\n"+e+"AggregateError of:\n";_++,e=Array(4*_+1).join(" ");for(var r=0;r<this.length;++r){for(var n=this[r]===this?"[Circular AggregateError]":this[r]+"",o=n.split("\n"),i=0;i<o.length;++i)o[i]=e+o[i];n=o.join("\n"),t+=n+"\n"}return _--,t},l(o,Error);var g=Error.__BluebirdErrorTypes__;g||(g=u({CancellationError:p,TimeoutError:h,OperationalError:o,RejectionError:o,AggregateError:v}),a.defineProperty(Error,"__BluebirdErrorTypes__",{value:g,writable:!1,enumerable:!1,configurable:!1})),t.exports={Error:Error,TypeError:i,RangeError:s,CancellationError:g.CancellationError,OperationalError:g.OperationalError,TimeoutError:g.TimeoutError,AggregateError:g.AggregateError,Warning:f}},{"./es5":13,"./util":36}],13:[function(e,t,r){var n=function(){"use strict";return void 0===this}();if(n)t.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:n,propertyIsWritable:function(e,t){var r=Object.getOwnPropertyDescriptor(e,t);return!(r&&!r.writable&&!r.set)}};else{var o={}.hasOwnProperty,i={}.toString,s={}.constructor.prototype,a=function(e){var t=[];for(var r in e)o.call(e,r)&&t.push(r);return t},u=function(e,t){return{value:e[t]}},c=function(e,t,r){return e[t]=r.value,e},l=function(e){return e},d=function(e){try{return Object(e).constructor.prototype}catch(e){return s}},f=function(e){try{return"[object Array]"===i.call(e)}catch(e){return!1}};t.exports={isArray:f,keys:a,names:a,defineProperty:c,getDescriptor:u,freeze:l,getPrototypeOf:d,isES5:n,propertyIsWritable:function(){return!0}}}},{}],14:[function(e,t,r){"use strict";t.exports=function(e,t){var r=e.map;e.prototype.filter=function(e,n){return r(this,e,n,t)},e.filter=function(e,n,o){return r(e,n,o,t)}}},{}],15:[function(e,t,r){"use strict";t.exports=function(t,r,n){function o(e,t,r){this.promise=e,this.type=t,this.handler=r,this.called=!1,this.cancelPromise=null}function i(e){this.finallyHandler=e}function s(e,t){return null!=e.cancelPromise&&(arguments.length>1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function a(){return c.call(this,this.promise._target()._settledValue())}function u(e){if(!s(this,e))return f.e=e,f}function c(e){var o=this.promise,c=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?c.call(o._boundValue()):c.call(o._boundValue(),e);if(l===n)return l;if(void 0!==l){o._setReturnedNonUndefined();var p=r(l,o);if(p instanceof t){if(null!=this.cancelPromise){if(p._isCancelled()){var h=new d("late cancellation observer");return o._attachExtraTrace(h),f.e=h,f}p.isPending()&&p._attachCancellationCallback(new i(this))}return p._then(a,u,void 0,this,void 0)}}}return o.isRejected()?(s(this),f.e=e,f):(s(this),e)}var l=e("./util"),d=t.CancellationError,f=l.errorObj,p=e("./catch_filter")(n);return o.prototype.isFinallyHandler=function(){return 0===this.type},i.prototype._resultCancelled=function(){s(this.finallyHandler)},t.prototype._passThrough=function(e,t,r,n){return"function"!=typeof e?this.then():this._then(r,n,void 0,new o(this,t,e),void 0)},t.prototype.lastl
|
||
|
!p.isIdentifier(n))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=p.inheritedDataKeys(e),a=0;a<s.length;++a){var u=e[s[a]];"constructor"!==s[a]&&p.isClass(u)&&(c(u.prototype,n,o,i,r),c(u,n,o,i,r))}return c(e,n,o,i,r)}}},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(e,t,r){"use strict";t.exports=function(t,r,n,o){function i(e){var t,r=!1;if(void 0!==a&&e instanceof a)t=d(e),r=!0;else{var n=l.keys(e),o=n.length;t=new Array(2*o);for(var i=0;i<o;++i){var s=n[i];t[i]=e[s],t[i+o]=s}}this.constructor$(t),this._isMap=r,this._init$(void 0,r?-6:-3)}function s(e){var r,s=n(e);return c(s)?(r=s instanceof t?s._then(t.props,void 0,void 0,void 0,void 0):new i(s).promise(),s instanceof t&&r._propagateFrom(s,2),r):o("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var a,u=e("./util"),c=u.isObject,l=e("./es5");"function"==typeof Map&&(a=Map);var d=function(){function e(e,n){this[t]=e,this[t+r]=n,t++}var t=0,r=0;return function(n){r=n.size,t=0;var o=new Array(2*n.size);return n.forEach(e,o),o}}(),f=function(e){for(var t=new a,r=e.length/2|0,n=0;n<r;++n){var o=e[r+n],i=e[n];t.set(o,i)}return t};u.inherits(i,r),i.prototype._init=function(){},i.prototype._promiseFulfilled=function(e,t){if(this._values[t]=e,++this._totalResolved>=this._length){var r;if(this._isMap)r=f(this._values);else{r={};for(var n=this.length(),o=0,i=this.length();o<i;++o)r[this._values[o+n]]=this._values[o]}return this._resolve(r),!0}return!1},i.prototype.shouldCopyValues=function(){return!1},i.prototype.getActualLength=function(e){return e>>1},t.prototype.props=function(){return s(this)},t.props=function(e){return s(e)}}},{"./es5":13,"./util":36}],26:[function(e,t,r){"use strict";function n(e,t,r,n,o){for(var i=0;i<o;++i)r[i+n]=e[i+t],e[i+t]=void 0}function o(e){this._capacity=e,this._length=0,this._front=0}o.prototype._willBeOverCapacity=function(e){return this._capacity<e},o.prototype._pushOne=function(e){var t=this.length();this._checkCapacity(t+1),this[this._front+t&this._capacity-1]=e,this._length=t+1},o.prototype.push=function(e,t,r){var n=this.length()+3;if(this._willBeOverCapacity(n))return this._pushOne(e),this._pushOne(t),void this._pushOne(r);var o=this._front+n-3;this._checkCapacity(n);var i=this._capacity-1;this[o+0&i]=e,this[o+1&i]=t,this[o+2&i]=r,this._length=n},o.prototype.shift=function(){var e=this._front,t=this[e];return this[e]=void 0,this._front=e+1&this._capacity-1,this._length--,t},o.prototype.length=function(){return this._length},o.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(this._capacity<<1)},o.prototype._resizeTo=function(e){var t=this._capacity;this._capacity=e,n(this,0,this,t,this._front+this._length&t-1)},t.exports=o},{}],27:[function(e,t,r){"use strict";t.exports=function(t,r,n,o){function i(e,i){var u=n(e);if(u instanceof t)return a(u);if(null===(e=s.asArray(e)))return o("expecting an array or an iterable object but got "+s.classString(e));var c=new t(r);void 0!==i&&c._propagateFrom(i,3);for(var l=c._fulfill,d=c._reject,f=0,p=e.length;f<p;++f){var h=e[f];(void 0!==h||f in e)&&t.cast(h)._then(l,d,void 0,c,null)}return c}var s=e("./util"),a=function(e){return e.then(function(t){return i(t,e)})};t.race=function(e){return i(e,void 0)},t.prototype.race=function(){return i(this,void 0)}}},{"./util":36}],28:[function(e,t,r){"use strict";t.exports=function(t,r,n,o,i,s){function a(e,r,n,o){this.constructor$(e);var s=f();this._fn=null===s?r:p.domainBind(s,r),void 0!==n&&(n=t.resolve(n),n._attachCancellationCallback(this)),this._initialValue=n,this._currentCancellable=null,this._eachValues=o===i?Array(this._length):0===o?null:void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function u(e,t){this.isFulfilled()?t._resolve(e):t._reject(e)}function c(e,t,r,o){return"function"!=typeof t?n("expecting a function but got "+p.classString(t)):new a(e,t,r,o).promise()}function l(e){this.accum=e,this.array._gotAccum(e);var r=o(this.value,this.array._promise);return r instanceof t?(this.array._currentCancellable=r,r._then(d,voi
|
||
|
;throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function a(e,t,r){return s(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}function u(e){return s(e),n(e<0?0:0|p(e))}function c(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|v(e,t),i=n(r),s=i.write(e,t);return s!==r&&(i=i.slice(0,s)),i}function l(e){for(var t=e.length<0?0:0|p(e.length),r=n(t),o=0;o<t;o+=1)r[o]=255&e[o];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),n.__proto__=o.prototype,n}function f(e){if(o.isBuffer(e)){var t=0|p(e.length),r=n(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}return void 0!==e.length?"number"!=typeof e.length||W(e.length)?n(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}function p(e){if(e>=Q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return 0|e}function h(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:q(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return x(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function _(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,W(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,o){function i(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}var c;if(o){var l=-1;for(c=r;c<a;c++)if(i(e,c)===i(t,-1===l?0:c-l)){if(-1===l&&(l=c),c-l+1===u)return l*s}else-1!==l&&(c-=c-l),l=-1}else for(r+u>a&&(r=a-u),c=r;c>=0;c--){for(var d=!0,f=0;f<u;f++)if(i(e,c+f)!==i(t,f)){d=!1;break}if(d)return c}return-1}function b(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(W(a))return s;e[r+s]=a}return s}function E(e,t,r,n){return $(q(t,e.length-r),e,r,n)}function w(e,t,r,n){return $(B(t),e,r
|
||
|
h("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(e){var t="add"==e||"set"==e;e in w&&(!_||"clear"!=e)&&a(b.prototype,e,function(r,n){if(l(this,b,e),!t&&_&&!d(r))return"get"==e&&void 0;var o=this._c[e](0===r?0:r,n);return t?this:o})}),_||p(b.prototype,"size",{get:function(){return this._c.size}})):(b=m.getConstructor(t,e,y,E),u(b.prototype,r),i.NEED=!0),f(b,e),S[e]=b,o(o.G+o.W+o.F,S),_||m.setStrong(b,e,y),b}},{"./_an-instance":118,"./_array-methods":122,"./_descriptors":134,"./_export":138,"./_fails":139,"./_for-of":140,"./_global":141,"./_hide":143,"./_is-object":151,"./_meta":159,"./_object-dp":164,"./_redefine-all":179,"./_set-to-string-tag":185}],131:[function(e,t,r){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},{}],132:[function(e,t,r){var n=e("./_a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,o){return e.call(t,r,n,o)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":116}],133:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],134:[function(e,t,r){t.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":139}],135:[function(e,t,r){var n=e("./_is-object"),o=e("./_global").document,i=n(o)&&n(o.createElement);t.exports=function(e){return i?o.createElement(e):{}}},{"./_global":141,"./_is-object":151}],136:[function(e,t,r){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],137:[function(e,t,r){var n=e("./_object-keys"),o=e("./_object-gops"),i=e("./_object-pie");t.exports=function(e){var t=n(e),r=o.f;if(r)for(var s,a=r(e),u=i.f,c=0;a.length>c;)u.call(e,s=a[c++])&&t.push(s);return t}},{"./_object-gops":169,"./_object-keys":172,"./_object-pie":173}],138:[function(e,t,r){var n=e("./_global"),o=e("./_core"),i=e("./_ctx"),s=e("./_hide"),a=e("./_has"),u=function(e,t,r){var c,l,d,f=e&u.F,p=e&u.G,h=e&u.S,v=e&u.P,m=e&u.B,y=e&u.W,_=p?o:o[t]||(o[t]={}),g=_.prototype,b=p?n:h?n[t]:(n[t]||{}).prototype;p&&(r=t);for(c in r)(l=!f&&b&&void 0!==b[c])&&a(_,c)||(d=l?b[c]:r[c],_[c]=p&&"function"!=typeof b[c]?r[c]:m&&l?i(d,n):y&&b[c]==d?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):v&&"function"==typeof d?i(Function.call,d):d,v&&((_.virtual||(_.virtual={}))[c]=d,e&u.R&&g&&!g[c]&&s(g,c,d)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},{"./_core":131,"./_ctx":132,"./_global":141,"./_has":142,"./_hide":143}],139:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],140:[function(e,t,r){var n=e("./_ctx"),o=e("./_iter-call"),i=e("./_is-array-iter"),s=e("./_an-object"),a=e("./_to-length"),u=e("./core.get-iterator-method"),c={},l={},r=t.exports=function(e,t,r,d,f){var p,h,v,m,y=f?function(){return e}:u(e),_=n(r,d,t?2:1),g=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(i(y)){for(p=a(e.length);p>g;g++)if((m=t?_(s(h=e[g])[0],h[1]):_(e[g]))===c||m===l)return m}else for(v=y.call(e);!(h=v.next()).done;)if((m=o(v,_,h.value,t))===c||m===l)return m};r.BREAK=c,r.RETURN=l},{"./_an-object":119,"./_ctx":132,"./_is-array-iter":148,"./_iter-call":152,"./_to-length":194,"./core.get-iterator-method":203}],141:[function(e,t,r){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],142:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],143:[function(e,t,r){var n=e("./_object-dp"),o=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,r){return n.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},{"./_descriptors":134,"./_object-dp"
|
||
|
i&&!e("./_library")&&a(q,"propertyIsEnumerable",J,!0),h.f=function(e){return V(p(e))}),s(s.G+s.W+s.F*!B,{Symbol:O});for(var ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),te=0;ee.length>te;)p(ee[te++]);for(var re=R(p.store),ne=0;re.length>ne;)v(re[ne++]);s(s.S+s.F*!B,"Symbol",{for:function(e){return o(U,e+="")?U[e]:U[e]=O(e)},keyFor:function(e){if(!W(e))throw TypeError(e+" is not a symbol!");for(var t in U)if(U[t]===e)return t},useSetter:function(){G=!0},useSimple:function(){G=!1}}),s(s.S+s.F*!B,"Object",{create:Q,defineProperty:H,defineProperties:z,getOwnPropertyDescriptor:Y,getOwnPropertyNames:X,getOwnPropertySymbols:Z}),A&&s(s.S+s.F*(!B||c(function(){var e=O();return"[null]"!=D([e])||"{}"!=D({a:e})||"{}"!=D(Object(e))})),"JSON",{stringify:function(e){for(var t,r,n=[e],o=1;arguments.length>o;)n.push(arguments[o++]);if(r=t=n[1],(g(t)||void 0!==e)&&!W(e))return y(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!W(t))return t}),n[1]=t,D.apply(A,n)}}),O.prototype[P]||e("./_hide")(O.prototype,P,O.prototype.valueOf),d(O,"Symbol"),d(Math,"Math",!0),d(n.JSON,"JSON",!0)},{"./_an-object":119,"./_descriptors":134,"./_enum-keys":137,"./_export":138,"./_fails":139,"./_global":141,"./_has":142,"./_hide":143,"./_is-array":149,"./_is-object":151,"./_library":158,"./_meta":159,"./_object-create":163,"./_object-dp":164,"./_object-gopd":166,"./_object-gopn":168,"./_object-gopn-ext":167,"./_object-gops":169,"./_object-keys":172,"./_object-pie":173,"./_property-desc":178,"./_redefine":180,"./_set-to-string-tag":185,"./_shared":187,"./_to-iobject":193,"./_to-primitive":196,"./_uid":197,"./_wks":202,"./_wks-define":200,"./_wks-ext":201}],224:[function(e,t,r){var n=e("./_export"),o=e("./_object-to-array")(!0);n(n.S,"Object",{entries:function(e){return o(e)}})},{"./_export":138,"./_object-to-array":175}],225:[function(e,t,r){var n=e("./_export"),o=e("./_object-to-array")(!1);n(n.S,"Object",{values:function(e){return o(e)}})},{"./_export":138,"./_object-to-array":175}],226:[function(e,t,r){"use strict";var n=e("./_export"),o=e("./_core"),i=e("./_global"),s=e("./_species-constructor"),a=e("./_promise-resolve");n(n.P+n.R,"Promise",{finally:function(e){var t=s(this,o.Promise||i.Promise),r="function"==typeof e;return this.then(r?function(r){return a(t,e()).then(function(){return r})}:e,r?function(r){return a(t,e()).then(function(){throw r})}:e)}})},{"./_core":131,"./_export":138,"./_global":141,"./_promise-resolve":177,"./_species-constructor":188}],227:[function(e,t,r){"use strict";var n=e("./_export"),o=e("./_new-promise-capability"),i=e("./_perform");n(n.S,"Promise",{try:function(e){var t=o.f(this),r=i(e);return(r.e?t.reject:t.resolve)(r.v),t.promise}})},{"./_export":138,"./_new-promise-capability":161,"./_perform":176}],228:[function(e,t,r){e("./_set-collection-from")("Set")},{"./_set-collection-from":181}],229:[function(e,t,r){e("./_set-collection-of")("Set")},{"./_set-collection-of":182}],230:[function(e,t,r){var n=e("./_export");n(n.P+n.R,"Set",{toJSON:e("./_collection-to-json")("Set")})},{"./_collection-to-json":129,"./_export":138}],231:[function(e,t,r){e("./_wks-define")("asyncIterator")},{"./_wks-define":200}],232:[function(e,t,r){e("./_wks-define")("observable")},{"./_wks-define":200}],233:[function(e,t,r){e("./es6.array.iterator");for(var n=e("./_global"),o=e("./_hide"),i=e("./_iterators"),s=e("./_wks")("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<a.length;u++){var c=a[u],l=n[c],d=l&&l.prototype;d&&!d[s]&&o(d,s,c),i[c]=i.Array}},{"./_global":141,"./_hide":143,"./_iterators":157,"./_wks":202,"./es6.array.iterator":206
|
||
|
function o(e,t){this._id=e,this._clearFn=t}var i=e("process/browser.js").nextTick,s=Function.prototype.apply,a=Array.prototype.slice,u={},c=0;r.setTimeout=function(){return new o(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new o(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(e){e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},r.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},r._unrefActive=r.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r.setImmediate="function"==typeof t?t:function(e){var t=c++,n=!(arguments.length<2)&&a.call(arguments,1);return u[t]=!0,i(function(){u[t]&&(n?e.apply(null,n):e.call(null),r.clearImmediate(t))}),t},r.clearImmediate="function"==typeof n?n:function(e){delete u[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":237,timers:249}],250:[function(e,t,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(e,t,r){if(e&&c.isObject(e)&&e instanceof n)return e;var o=new n;return o.parse(e,t,r),o}function i(e){return c.isString(e)&&(e=o(e)),e instanceof n?e.format():n.prototype.format.call(e)}function s(e,t){return o(e,!1,!0).resolve(t)}function a(e,t){return e?o(e,!1,!0).resolveObject(t):t}var u=e("punycode"),c=e("./util");r.parse=o,r.resolve=s,r.resolveObject=a,r.format=i,r.Url=n;var l=/^([a-z0-9.+-]+:)/i,d=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["<",">",'"',"`"," ","\r","\n","\t"],h=["{","}","|","\\","^","`"].concat(p),v=["'"].concat(h),m=["%","/","?",";","#"].concat(v),y=["/","?","#"],_=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},S=e("querystring");n.prototype.parse=function(e,t,r){if(!c.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),o=-1!==n&&n<e.indexOf("#")?"?":"#",i=e.split(o),s=/\\/g;i[0]=i[0].replace(s,"/"),e=i.join(o);var a=e;if(a=a.trim(),!r&&1===e.split("#").length){var d=f.exec(a);if(d)return this.path=a,this.href=a,this.pathname=d[1],d[2]?(this.search=d[2],this.query=t?S.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var p=l.exec(a);if(p){p=p[0];var h=p.toLowerCase();this.protocol=h,a=a.substr(p.length)}if(r||p||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===a.substr(0,2);!k||p&&E[p]||(a=a.substr(2),this.slashes=!0)}if(!E[p]&&(k||p&&!w[p])){for(var T=-1,x=0;x<y.length;x++){var R=a.indexOf(y[x]);-1!==R&&(-1===T||R<T)&&(T=R)}var I,C;C=-1===T?a.lastIndexOf("@"):a.lastIndexOf("@",T),-1!==C&&(I=a.slice(0,C),a=a.slice(C+1),this.auth=decodeURIComponent(I)),T=-1;for(var x=0;x<m.length;x++){var R=a.indexOf(m[x]);-1!==R&&(-1===T||R<T)&&(T=R)}-1===T&&(T=a.length),this.host=a.slice(0,T),a=a.slice(T),this.parseHost(),this.hostname=this.hostname||"";var j="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!j)for(var O=this.hostname.split(/\./),x=0,A=O.length;x<A;x++){var D=O[x];if(D&&!D.match(_)){for(var M="",P=0,L=D.length;P<L;P++)D.charCodeAt(P)>127?M+="x":M+=D[P];if(!M.match(_)){var U=O.slice(0,x),N=O.slice(x+1),F=D.match(g);F&&(U.push(F[1]),N.unshift(F[2])),N.length&&(a="/"+N.join(".")+a),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=u.toASCII(this.hostname));var q=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+q,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&
|
||
|
//# sourceMappingURL=dist/browser-matrix.min.js.map
|