@signalwire/js 1.2.5-beta.1 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +4 -2
  2. package/dist/esm/common/src/BaseSession.d.ts +2 -1
  3. package/dist/esm/common/src/BaseSession.js +15 -6
  4. package/dist/esm/common/src/BrowserSession.d.ts +4 -3
  5. package/dist/esm/common/src/BrowserSession.js +9 -4
  6. package/dist/esm/common/src/messages/Verto.d.ts +1 -1
  7. package/dist/esm/common/src/messages/Verto.js +1 -1
  8. package/dist/esm/common/src/services/Connection.js +3 -3
  9. package/dist/esm/common/src/util/constants/index.d.ts +0 -44
  10. package/dist/esm/common/src/util/constants/index.js +0 -49
  11. package/dist/esm/common/src/util/helpers.d.ts +1 -0
  12. package/dist/esm/common/src/util/helpers.js +3 -0
  13. package/dist/esm/common/src/util/interfaces.d.ts +47 -38
  14. package/dist/esm/common/src/webrtc/BaseCall.d.ts +3 -4
  15. package/dist/esm/common/src/webrtc/BaseCall.js +2 -2
  16. package/dist/esm/common/src/webrtc/Call.d.ts +1 -1
  17. package/dist/esm/common/src/webrtc/CantinaAuth.d.ts +22 -0
  18. package/dist/esm/common/src/webrtc/CantinaAuth.js +68 -0
  19. package/dist/esm/common/src/webrtc/LayoutHandler.js +2 -2
  20. package/dist/esm/common/src/webrtc/Peer.d.ts +2 -2
  21. package/dist/esm/common/src/webrtc/Peer.js +3 -2
  22. package/dist/esm/common/src/webrtc/VertoHandler.js +3 -2
  23. package/dist/esm/common/src/webrtc/constants.d.ts +74 -0
  24. package/dist/esm/common/src/{util/constants/call.js → webrtc/constants.js} +43 -3
  25. package/dist/esm/common/src/webrtc/helpers.d.ts +2 -2
  26. package/dist/esm/common/src/webrtc/helpers.js +9 -15
  27. package/dist/esm/common/src/webrtc/interfaces.d.ts +87 -0
  28. package/dist/esm/common/src/webrtc/interfaces.js +0 -0
  29. package/dist/esm/js/index.d.ts +4 -2
  30. package/dist/esm/js/index.js +3 -2
  31. package/dist/esm/js/src/SignalWire.d.ts +1 -1
  32. package/dist/esm/js/src/Verto.d.ts +3 -1
  33. package/dist/esm/js/src/Verto.js +5 -0
  34. package/dist/index.min.js +2 -2
  35. package/package.json +15 -15
  36. package/CHANGELOG.md +0 -101
  37. package/dist/.DS_Store +0 -0
  38. package/dist/esm/common/src/util/constants/call.d.ts +0 -35
package/dist/index.min.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Relay SDK for JavaScript v1.2.5-beta.1 (https://signalwire.com)
2
+ * Relay SDK for JavaScript v1.2.8 (https://signalwire.com)
3
3
  * Copyright 2018-2019 SignalWire
4
4
  * Licensed under MIT(https://github.com/signalwire/signalwire-node/blob/master/LICENSE)
5
5
  */
6
- !function(e,t){for(var n in t)e[n]=t[n]}(this,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=76)}([function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(38)("wks"),o=n(24),i=n(0).Symbol,s="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=s&&i[e]||(s?i:o)("Symbol."+e))}).store=r},function(e,t){var n=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(117)),i=function(){return(new Date).toISOString().replace("T"," ").replace("Z","")},s=o.default.getLogger("signalwire"),a=s.methodFactory;s.methodFactory=function(e,t,n){var r=a(e,t,n);return function(){for(var e=[i(),"-"],t=0;t<arguments.length;t++)e.push(arguments[t]);r.apply(void 0,e)}},s.setLevel(s.getLevel()),t.default=s},function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.ProtocolProviderAdd="protocol.provider.add",e.ProtocolProviderRemove="protocol.provider.remove"}(t.Netcast||(t.Netcast={})),t.STORAGE_PREFIX="@signalwire:",t.ADD="add",t.REMOVE="remove",t.SESSION_ID="sessId",function(e){e.SocketOpen="signalwire.socket.open",e.SocketClose="signalwire.socket.close",e.SocketError="signalwire.socket.error",e.SocketMessage="signalwire.socket.message",e.SpeedTest="signalwire.internal.speedtest",e.Ready="signalwire.ready",e.Error="signalwire.error",e.Notification="signalwire.notification",e.Messages="signalwire.messages",e.Calls="signalwire.calls",e.MediaError="signalwire.rtc.mediaError"}(t.SwEvent||(t.SwEvent={})),function(e){e.Offer="offer",e.Answer="answer"}(t.PeerType||(t.PeerType={})),function(e){e.Inbound="inbound",e.Outbound="outbound"}(t.Direction||(t.Direction={})),function(e){e.Invite="verto.invite",e.Attach="verto.attach",e.Answer="verto.answer",e.Info="verto.info",e.Display="verto.display",e.Media="verto.media",e.Event="verto.event",e.Bye="verto.bye",e.Punt="verto.punt",e.Broadcast="verto.broadcast",e.Subscribe="verto.subscribe",e.Unsubscribe="verto.unsubscribe",e.ClientReady="verto.clientReady",e.Modify="verto.modify"}(o=t.VertoMethod||(t.VertoMethod={})),t.NOTIFICATION_TYPE=((r={generic:"event"})[o.Display]="participantData",r[o.Attach]="participantData",r.conferenceUpdate="conferenceUpdate",r.callUpdate="callUpdate",r.vertoClientReady="vertoClientReady",r.userMediaError="userMediaError",r.refreshToken="refreshToken",r),function(e){e.Netcast="blade.netcast",e.Broadcast="blade.broadcast",e.Disconnect="blade.disconnect"}(t.BladeMethod||(t.BladeMethod={})),function(e){e.Video="videoinput",e.AudioIn="audioinput",e.AudioOut="audiooutput"}(t.DeviceType||(t.DeviceType={}))},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=o(n(3)),s=n(4);t.deepCopy=function(e){return JSON.parse(JSON.stringify(e))},t.objEmpty=function(e){return 0===Object.keys(e).length},t.mutateStorageKey=function(e){return""+s.STORAGE_PREFIX+e},t.mutateLiveArrayData=function(e){var t=r(e,6),n=t[0],o=t[1],s=t[2],a=t[3],c=t[4],u=t[5],l={};try{l=JSON.parse(c.replace(/ID"/g,'Id"'))}catch(e){i.default.warn("Verto LA invalid media JSON string:",c)}return{participantId:Number(n),participantNumber:o,participantName:s,codec:a,media:l,participantData:u}},t.safeParseJson=function(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}},t.isDefined=function(e){return void 0!==e},t.isFunction=function(e){return e instanceof Function||"function"==typeof e},t.findElementByType=function(e){return"object"==typeof document&&"getElementById"in document?"string"==typeof e?document.getElementById(e)||null:"function"==typeof e?e():e instanceof HTMLMediaElement?e:null:null};var a=/^(ws|wss):\/\//;t.checkWebSocketHost=function(e){return""+(a.test(e)?"":"wss://")+e},t.destructResponse=function(e,n){void 0===n&&(n=null);var r=e.result,o=void 0===r?{}:r,i=e.error;if(i)return{error:i};var s=o.result,a=void 0===s?null:s;if(null===a)return null!==n&&(o.node_id=n),{result:o};var c=a.code,u=void 0===c?null:c,l=a.node_id,f=void 0===l?null:l,d=a.result,p=void 0===d?null:d;return u&&"200"!==u?{error:a}:p?t.destructResponse(p,f):{result:a}}},function(e,t,n){var r=n(7);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o={},i=function(e,t){return void 0===t&&(t="GLOBAL"),o.hasOwnProperty(e)&&o[e].hasOwnProperty(t)};t.isQueued=i;t.queueLength=function(e,t){return void 0===t&&(t="GLOBAL"),i(e,t)?o[e][t].length:0};var s=function(e,t,n){void 0===n&&(n="GLOBAL"),o.hasOwnProperty(e)||(o[e]={}),o[e].hasOwnProperty(n)||(o[e][n]=[]),o[e][n].push(t)};t.register=s;t.registerOnce=function(e,t,n){void 0===n&&(n="GLOBAL");var r=function(o){a(e,r,n),t(o)};return r.prototype.targetRef=t,s(e,r,n)};var a=function(e,t,n){if(void 0===n&&(n="GLOBAL"),!i(e,n))return!1;if(r.isFunction(t))for(var s=o[e][n].length-1;s>=0;s--){var a=o[e][n][s];(t===a||a.prototype&&t===a.prototype.targetRef)&&o[e][n].splice(s,1)}else o[e][n]=[];return 0===o[e][n].length&&(delete o[e][n],r.objEmpty(o[e])&&delete o[e]),!0};t.deRegister=a;var c=function(e,t,n,r){void 0===n&&(n="GLOBAL"),void 0===r&&(r=!0);var s=r&&"GLOBAL"!==n;if(!i(e,n))return s&&c(e,t),!1;var a=o[e][n].length;if(!a)return s&&c(e,t),!1;for(var u=a-1;u>=0;u--)o[e][n][u](t);return s&&c(e,t),!0};t.trigger=c;t.deRegisterAll=function(e){delete o[e]}},function(e,t,n){var r=n(0),o=n(2),i=n(18),s=n(10),a=n(13),c=function(e,t,n){var u,l,f,d=e&c.F,p=e&c.G,h=e&c.S,v=e&c.P,y=e&c.B,b=e&c.W,_=p?o:o[t]||(o[t]={}),g=_.prototype,m=p?r:h?r[t]:(r[t]||{}).prototype;for(u in p&&(n=t),n)(l=!d&&m&&void 0!==m[u])&&a(_,u)||(f=l?m[u]:n[u],_[u]=p&&"function"!=typeof m[u]?n[u]:y&&l?i(f,r):b&&m[u]==f?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(f):v&&"function"==typeof f?i(Function.call,f):f,v&&((_.virtual||(_.virtual={}))[u]=f,e&c.R&&g&&!g[u]&&s(g,u,f)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,n){var r=n(11),o=n(23);e.exports=n(12)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(6),o=n(50),i=n(34),s=Object.defineProperty;t.f=n(12)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){e.exports=!n(22)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(82),o=n(32);e.exports=function(e){return r(o(e))}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o=n(44),i=function(){function e(){}return e.prototype.buildRequest=function(e){this.request=r({jsonrpc:"2.0",id:o.v4()},e)},e}();t.default=i},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(5);t.RTCPeerConnection=function(e){return new window.RTCPeerConnection(e)};t.getUserMedia=function(e){return navigator.mediaDevices.getUserMedia(e)};t.getDisplayMedia=function(e){return navigator.mediaDevices.getDisplayMedia(e)};t.enumerateDevices=function(){return navigator.mediaDevices.enumerateDevices()};t.getSupportedConstraints=function(){return navigator.mediaDevices.getSupportedConstraints()};var s=function(e){return e&&e instanceof MediaStream};t.streamIsValid=s;t.attachMediaStream=function(e,t){var n=i.findElementByType(e);null!==n&&(n.getAttribute("autoplay")||n.setAttribute("autoplay","autoplay"),n.getAttribute("playsinline")||n.setAttribute("playsinline","playsinline"),n.srcObject=t)};t.detachMediaStream=function(e){var t=i.findElementByType(e);t&&(t.srcObject=null)};t.muteMediaElement=function(e){var t=i.findElementByType(e);t&&(t.muted=!0)};t.unmuteMediaElement=function(e){var t=i.findElementByType(e);t&&(t.muted=!1)};t.toggleMuteMediaElement=function(e){var t=i.findElementByType(e);t&&(t.muted=!t.muted)};t.setMediaElementSinkId=function(e,t){return r(void 0,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:if(null===(n=i.findElementByType(e)))return[2,!1];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n.setSinkId(t)];case 2:return r.sent(),[2,!0];case 3:return r.sent(),[2,!1];case 4:return[2]}}))}))};t.sdpToJsonHack=function(e){return e};t.stopStream=function(e){s(e)&&e.getTracks().forEach((function(e){return e.stop()})),e=null}},function(e,t){e.exports=!0},function(e,t,n){var r=n(21);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports={}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(11).f,o=n(13),i=n(1)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){"use strict";(function(e){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(5),s=function(){return"undefined"==typeof window&&void 0!==e},a=function(e,t){return r(void 0,void 0,void 0,(function(){var n;return o(this,(function(r){return s()?[2,null]:(n=window[e].getItem(i.mutateStorageKey(t)),[2,i.safeParseJson(n)])}))}))},c=function(e,t,n){return r(void 0,void 0,void 0,(function(){return o(this,(function(r){return s()?[2,null]:("object"==typeof n&&(n=JSON.stringify(n)),window[e].setItem(i.mutateStorageKey(t),n),[2])}))}))},u=function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return s()?[2,null]:[2,window[e].removeItem(i.mutateStorageKey(t))]}))}))};t.localStorage={getItem:function(e){return a("localStorage",e)},setItem:function(e,t){return c("localStorage",e,t)},removeItem:function(e){return u("localStorage",e)}},t.sessionStorage={getItem:function(e){return a("sessionStorage",e)},setItem:function(e,t){return c("sessionStorage",e,t)},removeItem:function(e){return u("sessionStorage",e)}}}).call(this,n(127))},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(28)),a=n(130);t.Login=a.Login;var c=n(131);t.Result=c.Result;var u=n(4),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Invite},t}(s.default);t.Invite=l;var f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Answer},t}(s.default);t.Answer=f;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Attach},t}(s.default);t.Attach=d;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Bye},t}(s.default);t.Bye=p;var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Modify},t}(s.default);t.Modify=h;var v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Info},t}(s.default);t.Info=v;var y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Broadcast},t}(s.default);t.Broadcast=y;var b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Subscribe},t}(s.default);t.Subscribe=b;var _=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Unsubscribe},t}(s.default);t.Unsubscribe=_},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(15)),c={id:"callID",destinationNumber:"destination_number",remoteCallerName:"remote_caller_id_name",remoteCallerNumber:"remote_caller_id_number",callerName:"caller_id_name",callerNumber:"caller_id_number"},u=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;if(t.hasOwnProperty("dialogParams")){var r=t.dialogParams,o=(r.remoteSdp,r.localStream,r.remoteStream,r.onNotification,r.camId,r.micId,r.speakerId,i(r,["remoteSdp","localStream","remoteStream","onNotification","camId","micId","speakerId"]));for(var s in c)s&&o.hasOwnProperty(s)&&(o[c[s]]=o[s],delete o[s]);t.dialogParams=o}return n.buildRequest({method:n.toString(),params:t}),n}return o(t,e),t}(a.default);t.default=u},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},s=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var u=a(n(3)),l=c(n(16)),f=n(5),d=n(16),p=n(4),h=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r;return o(this,(function(o){switch(o.label){case 0:if(u.default.info("RTCService.getUserMedia",e),t=e.audio,n=e.video,!t&&!n)return[2,null];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,l.getUserMedia(e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),u.default.error("getUserMedia error: ",r),r;case 4:return[2]}}))}))};t.getUserMedia=h;var v=function(e){return void 0===e&&(e=null),{audio:!e||e===p.DeviceType.AudioIn,video:!e||e===p.DeviceType.Video}},y=function(e){return void 0===e&&(e=null),r(void 0,void 0,void 0,(function(){var t,n,r;return o(this,(function(o){switch(o.label){case 0:return[4,l.enumerateDevices().catch((function(e){return[]}))];case 1:return t=o.sent(),e&&(t=t.filter((function(t){return t.kind===e}))),t.length&&t.every((function(e){return!e.deviceId||!e.label}))?[4,l.getUserMedia(v(e))]:[3,3];case 2:return n=o.sent(),l.stopStream(n),[2,y(e)];case 3:return r=[],[2,t=t.filter((function(e){var t=e.kind,n=e.groupId;if(!n)return!0;var o=t+"-"+n;return!r.includes(o)&&(r.push(o),!0)}))]}}))}))};t.getDevices=y;var b=[[320,240],[640,360],[640,480],[1280,720],[1920,1080]];t.scanResolutions=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,s,a,c,u;return o(this,(function(o){switch(o.label){case 0:return t=[],[4,h({video:{deviceId:{exact:e}}})];case 1:n=o.sent(),r=n.getVideoTracks()[0],s=0,o.label=2;case 2:return s<b.length?(a=i(b[s],2),c=a[0],u=a[1],[4,r.applyConstraints({width:{exact:c},height:{exact:u}}).then((function(){return!0})).catch((function(){return!1}))]):[3,5];case 3:o.sent()&&t.push({resolution:c+"x"+u,width:c,height:u}),o.label=4;case 4:return s++,[3,2];case 5:return d.stopStream(n),[2,t]}}))}))};t.getMediaConstraints=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,i,s,a,c,u,l,f;return o(this,(function(o){switch(o.label){case 0:return t=e.audio,n=void 0===t||t,r=e.micId,i=e.micLabel,s=void 0===i?"":i,r?[4,_(r,s,p.DeviceType.AudioIn).catch((function(e){return null}))]:[3,2];case 1:(r=o.sent())&&("boolean"==typeof n&&(n={}),n.deviceId={exact:r}),o.label=2;case 2:return a=e.video,c=void 0!==a&&a,u=e.camId,l=e.camLabel,f=void 0===l?"":l,u?[4,_(u,f,p.DeviceType.Video).catch((function(e){return null}))]:[3,4];case 3:(u=o.sent())&&("boolean"==typeof c&&(c={}),c.deviceId={exact:u}),o.label=4;case 4:return[2,{audio:n,video:c}]}}))}))};var _=function(e,t,n){return r(void 0,void 0,void 0,(function(){var r,i,s,a,c,u;return o(this,(function(o){switch(o.label){case 0:return[4,l.enumerateDevices().catch((function(e){return[]})).then((function(e){return e.filter((function(e){return e.kind===n}))}))];case 1:return r=o.sent(),r.length&&r.every((function(e){return!e.deviceId||!e.label}))?[4,l.getUserMedia(v(n))]:[3,3];case 2:return i=o.sent(),l.stopStream(i),[2,_(e,t,n)];case 3:for(s=0;s<r.length;s++)if(a=r[s],c=a.deviceId,u=a.label,e===c||t===u)return[2,c];return[2,null]}}))}))};t.assureDeviceId=_;t.removeUnsupportedConstraints=function(e){var t=l.getSupportedConstraints();Object.keys(e).map((function(n){t.hasOwnProperty(n)&&null!==e[n]&&void 0!==e[n]||delete e[n]}))};t.checkDeviceIdConstraints=function(e,t,n,i){return r(void 0,void 0,void 0,(function(){var r,s;return o(this,(function(o){switch(o.label){case 0:return r=i.deviceId,f.isDefined(r)||!e&&!t?[3,2]:[4,_(e,t,n).catch((function(e){return null}))];case 1:(s=o.sent())&&(i.deviceId={exact:s}),o.label=2;case 2:return[2,i]}}))}))};t.sdpStereoHack=function(e){var t=e.split("\r\n"),n=t.findIndex((function(e){return/^a=rtpmap/.test(e)&&/opus\/48000/.test(e)}));if(n<0)return e;var r=function(e){var t=new RegExp("a=rtpmap:(\\d+) \\w+\\/\\d+"),n=e.match(t);return n&&2==n.length?n[1]:null}(t[n]),o=new RegExp("a=fmtp:"+r),i=t.findIndex((function(e){return o.test(e)}));return i>=0?/stereo=1;/.test(t[i])||(t[i]+="; stereo=1; sprop-stereo=1"):t[n]+="\r\na=fmtp:"+r+" stereo=1; sprop-stereo=1",t.join("\r\n")};var g=function(e){return/^m=audio/.test(e)},m=function(e){return/^m=video/.test(e)};t.sdpMediaOrderHack=function(e,t){var n=t.split("\r\n");if(n.findIndex(g)<n.findIndex(m))return e;var r=e.split("\r\n"),o=r.findIndex(g),i=r.findIndex(m),a=r.slice(o,i),c=r.slice(i,r.length-1),u=r.slice(0,o);return s(u,c,a,[""]).join("\r\n")};t.checkSubscribeResponse=function(e,t){if(!e)return!1;var n=w(e),r=n.subscribed,o=n.alreadySubscribed;return r.includes(t)||o.includes(t)};var w=function(e){var t={subscribed:[],alreadySubscribed:[],unauthorized:[],unsubscribed:[],notSubscribed:[]};return Object.keys(t).forEach((function(n){t[n]=e[n+"Channels"]||[]})),t};t.destructSubscribeResponse=w;t.enableAudioTracks=function(e){S(e,"audio",!0)};t.disableAudioTracks=function(e){S(e,"audio",!1)};t.toggleAudioTracks=function(e){S(e,"audio",null)};t.enableVideoTracks=function(e){S(e,"video",!0)};t.disableVideoTracks=function(e){S(e,"video",!1)};t.toggleVideoTracks=function(e){S(e,"video",null)};var S=function(e,t,n){if(void 0===t&&(t=null),void 0===n&&(n=null),!l.streamIsValid(e))return null;var r=[];switch(t){case"audio":r=e.getAudioTracks();break;case"video":r=e.getVideoTracks();break;default:r=e.getTracks()}r.forEach((function(e){switch(n){case"on":case!0:e.enabled=!0;break;case"off":case!1:e.enabled=!1;break;default:e.enabled=!e.enabled}}))};t.sdpBitrateHack=function(e,t,n,r){var o=e.split("\r\n");return o.forEach((function(e,i){/^a=fmtp:\d*/.test(e)?o[i]+=";x-google-max-bitrate="+t+";x-google-min-bitrate="+n+";x-google-start-bitrate="+r:/^a=mid:(1|video)/.test(e)&&(o[i]+="\r\nb=AS:"+t)})),o.join("\r\n")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CALL_OPTIONS={destinationNumber:"",remoteCallerName:"Outbound Call",remoteCallerNumber:"",callerName:"",callerNumber:"",audio:!0,video:!1,useStereo:!1,attach:!1,screenShare:!1,userVariables:{},googleMaxBitrate:2048,googleMinBitrate:0,googleStartBitrate:1024},function(e){e[e.New=0]="New",e[e.Requesting=1]="Requesting",e[e.Trying=2]="Trying",e[e.Recovering=3]="Recovering",e[e.Ringing=4]="Ringing",e[e.Answering=5]="Answering",e[e.Early=6]="Early",e[e.Active=7]="Active",e[e.Held=8]="Held",e[e.Hangup=9]="Hangup",e[e.Destroy=10]="Destroy",e[e.Purge=11]="Purge"}(t.State||(t.State={})),function(e){e.Participant="participant",e.Moderator="moderator"}(t.Role||(t.Role={})),function(e){e.Join="join",e.Leave="leave",e.Bootstrap="bootstrap",e.Add="add",e.Modify="modify",e.Delete="delete",e.Clear="clear",e.ChatMessage="chatMessage",e.LayerInfo="layerInfo",e.LogoInfo="logoInfo",e.LayoutInfo="layoutInfo",e.LayoutList="layoutList",e.ModCmdResponse="modCommandResponse"}(t.ConferenceAction||(t.ConferenceAction={}))},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(7),o=n(0).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(7);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(6),o=n(81),i=n(39),s=n(37)("IE_PROTO"),a=function(){},c=function(){var e,t=n(33)("iframe"),r=i.length;for(t.style.display="none",n(54).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;r--;)delete c.prototype[i[r]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(a.prototype=r(e),n=new a,a.prototype=null,n[s]=e):n=c(),void 0===t?n:o(n,t)}},function(e,t,n){var r=n(52),o=n(39);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(38)("keys"),o=n(24);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(2),o=n(0),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(17)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){t.f=n(1)},function(e,t,n){var r=n(0),o=n(2),i=n(17),s=n(40),a=n(11).f;e.exports=function(e){var t=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||a(t,e,{value:s.f(e)})}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";var r=n(21);function o(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)}e.exports.f=function(e){return new o(e)}},function(e,t,n){var r=n(119),o=n(120),i=o;i.v1=r,i.v4=o,e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(73);t.Connect=r.Connect;var o=n(123);t.Execute=o.Execute;var i=n(124);t.Subscription=i.Subscription;var s=n(125);t.Reauthenticate=s.Reauthenticate;var a=n(126);t.Ping=a.Ping},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=c(n(3)),l=c(n(129)),f=n(16),d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._statsInterval=null,t}return o(t,e),t.prototype.hangup=function(n,r){void 0===n&&(n={}),void 0===r&&(r=!0),this.screenShare instanceof t&&this.screenShare.hangup(n,r),e.prototype.hangup.call(this,n,r)},t.prototype.startScreenShare=function(e){return s(this,void 0,void 0,(function(){var n,r,o,s,c,u,l,d=this;return a(this,(function(a){switch(a.label){case 0:return[4,f.getDisplayMedia({video:!0})];case 1:return(n=a.sent()).getTracks().forEach((function(e){e.addEventListener("ended",(function(){d.screenShare&&d.screenShare.hangup()}))})),r=this.options,o=r.remoteCallerName,s=r.remoteCallerNumber,c=r.callerName,u=r.callerNumber,l=i({screenShare:!0,localStream:n,destinationNumber:this.extension+"-screen",remoteCallerName:o,remoteCallerNumber:s+"-screen",callerName:c+" (Screen)",callerNumber:u+" (Screen)"},e),this.screenShare=new t(this.session,l),this.screenShare.invite(),[2,this.screenShare]}}))}))},t.prototype.stopScreenShare=function(){this.screenShare instanceof t&&this.screenShare.hangup()},t.prototype.setAudioOutDevice=function(e){return s(this,void 0,void 0,(function(){var t,n,r;return a(this,(function(o){return this.options.speakerId=e,t=this.options,n=t.remoteElement,r=t.speakerId,n&&r?[2,f.setMediaElementSinkId(n,r)]:[2,!1]}))}))},t.prototype._finalize=function(){this._stats(!1),e.prototype._finalize.call(this)},t.prototype._stats=function(e){var t=this;if(void 0===e&&(e=!0),!1===e)return clearInterval(this._statsInterval);u.default.setLevel(2),this._statsInterval=window.setInterval((function(){return s(t,void 0,void 0,(function(){var e,t,n,r;return a(this,(function(o){switch(o.label){case 0:return[4,this.peer.instance.getStats(null)];case 1:return e=o.sent(),t="",n=["certificate","codec","peer-connection","stream","local-candidate","remote-candidate"],r=["id","type","timestamp"],e.forEach((function(e){n.includes(e.type)||(t+="\n"+e.type+"\n",Object.keys(e).forEach((function(n){r.includes(n)||(t+="\t"+n+": "+e[n]+"\n")})))})),u.default.info(t),[2]}}))}))}),2e3)},t}(l.default);t.default=d},function(e,t,n){e.exports={default:n(78),__esModule:!0}},function(e,t,n){"use strict";var r=n(79)(!0);n(49)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t,n){"use strict";var r=n(17),o=n(9),i=n(51),s=n(10),a=n(19),c=n(80),u=n(25),l=n(85),f=n(1)("iterator"),d=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(e,t,n,h,v,y,b){c(n,t,h);var _,g,m,w=function(e){if(!d&&e in E)return E[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+" Iterator",O="values"==v,x=!1,E=e.prototype,P=E[f]||E["@@iterator"]||v&&E[v],k=P||w(v),I=v?O?w("entries"):k:void 0,T="Array"==t&&E.entries||P;if(T&&(m=l(T.call(new e)))!==Object.prototype&&m.next&&(u(m,S,!0),r||"function"==typeof m[f]||s(m,f,p)),O&&P&&"values"!==P.name&&(x=!0,k=function(){return P.call(this)}),r&&!b||!d&&!x&&E[f]||s(E,f,k),a[t]=k,a[S]=p,v)if(_={values:O?k:w("values"),keys:y?k:w("keys"),entries:I},b)for(g in _)g in E||i(E,g,_[g]);else o(o.P+o.F*(d||x),t,_);return _}},function(e,t,n){e.exports=!n(12)&&!n(22)((function(){return 7!=Object.defineProperty(n(33)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){e.exports=n(10)},function(e,t,n){var r=n(13),o=n(14),i=n(83)(!1),s=n(37)("IE_PROTO");e.exports=function(e,t){var n,a=o(e),c=0,u=[];for(n in a)n!=s&&r(a,n)&&u.push(n);for(;t.length>c;)r(a,n=t[c++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){var r=n(31),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(0).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(32);e.exports=function(e){return Object(r(e))}},function(e,t,n){n(86);for(var r=n(0),o=n(10),i=n(19),s=n(1)("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(","),c=0;c<a.length;c++){var u=a[c],l=r[u],f=l&&l.prototype;f&&!f[s]&&o(f,s,u),i[u]=i.Array}},function(e,t,n){e.exports={default:n(89),__esModule:!0}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(52),o=n(39).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(42),o=n(23),i=n(14),s=n(34),a=n(13),c=n(50),u=Object.getOwnPropertyDescriptor;t.f=n(12)?u:function(e,t){if(e=i(e),t=s(t,!0),c)try{return u(e,t)}catch(e){}if(a(e,t))return o(!r.f.call(e,t),e[t])}},function(e,t){},function(e,t,n){e.exports={default:n(97),__esModule:!0}},function(e,t,n){var r=n(20),o=n(1)("toStringTag"),i="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:i?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t,n){var r=n(6),o=n(21),i=n(1)("species");e.exports=function(e,t){var n,s=r(e).constructor;return void 0===s||null==(n=r(s)[i])?t:o(n)}},function(e,t,n){var r,o,i,s=n(18),a=n(104),c=n(54),u=n(33),l=n(0),f=l.process,d=l.setImmediate,p=l.clearImmediate,h=l.MessageChannel,v=l.Dispatch,y=0,b={},_=function(){var e=+this;if(b.hasOwnProperty(e)){var t=b[e];delete b[e],t()}},g=function(e){_.call(e.data)};d&&p||(d=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return b[++y]=function(){a("function"==typeof e?e:Function(e),t)},r(y),y},p=function(e){delete b[e]},"process"==n(20)(f)?r=function(e){f.nextTick(s(_,e,1))}:v&&v.now?r=function(e){v.now(s(_,e,1))}:h?(i=(o=new h).port2,o.port1.onmessage=g,r=s(i.postMessage,i,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(e){l.postMessage(e+"","*")},l.addEventListener("message",g,!1)):r="onreadystatechange"in u("script")?function(e){c.appendChild(u("script")).onreadystatechange=function(){c.removeChild(this),_.call(e)}}:function(e){setTimeout(s(_,e,1),0)}),e.exports={set:d,clear:p}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r=n(6),o=n(7),i=n(43);e.exports=function(e,t){if(r(e),o(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){e.exports={default:n(112),__esModule:!0}},function(e,t,n){e.exports={default:n(114),__esModule:!0}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=c(n(3)),l=c(n(118)),f=n(8),d=n(4),p=n(30),h=n(29),v=n(5),y=n(27),b=n(26),_=n(16),g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.calls={},t.autoRecoverCalls=!0,t._iceServers=[],t._localElement=null,t._remoteElement=null,t._jwtAuth=!0,t._reconnectDelay=1e3,t._devices={},t._audioConstraints=!0,t._videoConstraints=!1,t._speaker=null,t}return o(t,e),t.prototype.connect=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return t=this,[4,b.localStorage.getItem(d.SESSION_ID)];case 1:return t.sessionid=n.sent(),e.prototype.connect.call(this),[2]}}))}))},t.prototype.checkPermissions=function(e,t){return void 0===e&&(e=!0),void 0===t&&(t=!0),i(this,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,h.getUserMedia({audio:e,video:t})];case 1:return n=r.sent(),_.stopStream(n),[2,!0];case 2:return r.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.logout=function(){this.disconnect()},t.prototype.disconnect=function(){return i(this,void 0,void 0,(function(){var t=this;return s(this,(function(n){switch(n.label){case 0:return Object.keys(this.calls).forEach((function(e){return t.calls[e].setState(p.State.Purge)})),this.calls={},[4,e.prototype.disconnect.call(this)];case 1:return n.sent(),[2]}}))}))},t.prototype.speedTest=function(e){var t=this;return new Promise((function(n,r){if(f.registerOnce(d.SwEvent.SpeedTest,(function(t){var r=t.upDur,o=t.downDur,i=o?8*e/(o/1e3)/1024:0;n({upDur:r,downDur:o,upKps:(r?8*e/(r/1e3)/1024:0).toFixed(0),downKps:i.toFixed(0)})}),t.uuid),!(e=Number(e)))return r("Invalid parameter 'bytes': "+e);t.executeRaw("#SPU "+e);var o=e/1024;e%1024&&o++;for(var i=".".repeat(1024),s=0;s<o;s++)t.executeRaw("#SPB "+i);t.executeRaw("#SPE")}))},t.prototype.getDevices=function(){var e=this;return h.getDevices().catch((function(t){return f.trigger(d.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getVideoDevices=function(){var e=this;return h.getDevices(d.DeviceType.Video).catch((function(t){return f.trigger(d.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getAudioInDevices=function(){var e=this;return h.getDevices(d.DeviceType.AudioIn).catch((function(t){return f.trigger(d.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getAudioOutDevices=function(){var e=this;return h.getDevices(d.DeviceType.AudioOut).catch((function(t){return f.trigger(d.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.refreshDevices=function(){return i(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return u.default.warn("This method has been deprecated. Use getDevices() instead."),e={},["videoinput","audioinput","audiooutput"].map((function(t){e[t]={},Object.defineProperty(e[t],"toArray",{value:function(){var e=this;return Object.keys(this).map((function(t){return e[t]}))}})})),[4,this.getDevices()];case 1:return t.sent().forEach((function(t){e.hasOwnProperty(t.kind)&&(e[t.kind][t.deviceId]=t)})),this._devices=e,[2,this.devices]}}))}))},Object.defineProperty(t.prototype,"devices",{get:function(){return this._devices||{}},enumerable:!0,configurable:!0}),t.prototype.getDeviceResolutions=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,h.scanResolutions(e)];case 1:return[2,t.sent()];case 2:throw t.sent();case 3:return[2]}}))}))},Object.defineProperty(t.prototype,"videoDevices",{get:function(){return u.default.warn("This property has been deprecated. Use getVideoDevices() instead."),this._devices.videoinput||{}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"audioInDevices",{get:function(){return u.default.warn("This property has been deprecated. Use getAudioInDevices() instead."),this._devices.audioinput||{}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"audioOutDevices",{get:function(){return u.default.warn("This property has been deprecated. Use getAudioOutDevices() instead."),this._devices.audiooutput||{}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mediaConstraints",{get:function(){return{audio:this._audioConstraints,video:this._videoConstraints}},enumerable:!0,configurable:!0}),t.prototype.setAudioSettings=function(e){return i(this,void 0,void 0,(function(){var t,n,r,o;return s(this,(function(i){switch(i.label){case 0:return t=e.micId,n=e.micLabel,r=a(e,["micId","micLabel"]),h.removeUnsupportedConstraints(r),o=this,[4,h.checkDeviceIdConstraints(t,n,"audioinput",r)];case 1:return o._audioConstraints=i.sent(),this.micId=t,this.micLabel=n,[2,this._audioConstraints]}}))}))},t.prototype.disableMicrophone=function(){this._audioConstraints=!1},t.prototype.enableMicrophone=function(){this._audioConstraints=!0},t.prototype.setVideoSettings=function(e){return i(this,void 0,void 0,(function(){var t,n,r,o;return s(this,(function(i){switch(i.label){case 0:return t=e.camId,n=e.camLabel,r=a(e,["camId","camLabel"]),h.removeUnsupportedConstraints(r),o=this,[4,h.checkDeviceIdConstraints(t,n,"videoinput",r)];case 1:return o._videoConstraints=i.sent(),this.camId=t,this.camLabel=n,[2,this._videoConstraints]}}))}))},t.prototype.disableWebcam=function(){this._videoConstraints=!1},t.prototype.enableWebcam=function(){this._videoConstraints=!0},Object.defineProperty(t.prototype,"iceServers",{get:function(){return this._iceServers},set:function(e){this._iceServers="boolean"==typeof e?e?[{urls:["stun:stun.l.google.com:19302"]}]:[]:e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"speaker",{get:function(){return this._speaker},set:function(e){this._speaker=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localElement",{get:function(){return this._localElement},set:function(e){this._localElement=v.findElementByType(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"remoteElement",{get:function(){return this._remoteElement},set:function(e){this._remoteElement=v.findElementByType(e)},enumerable:!0,configurable:!0}),t.prototype.vertoBroadcast=function(e){var t=e.nodeId,n=e.channel,r=void 0===n?"":n,o=e.data;if(!r)throw new Error("Invalid channel for broadcast: "+r);var i=new y.Broadcast({sessid:this.sessionid,eventChannel:r,data:o});t&&(i.targetNodeId=t),this.execute(i).catch((function(e){return e}))},t.prototype.vertoSubscribe=function(e){var t=e.nodeId,n=e.channels,r=void 0===n?[]:n,o=e.handler;return i(this,void 0,void 0,(function(){var e,n,i,a,c,u,l,f=this;return s(this,(function(s){switch(s.label){case 0:return(r=r.filter((function(e){return e&&!f._existsSubscription(f.relayProtocol,e)}))).length?(e=new y.Subscribe({sessid:this.sessionid,eventChannel:r}),t&&(e.targetNodeId=t),[4,this.execute(e)]):[2,{}];case 1:return n=s.sent(),i=h.destructSubscribeResponse(n),a=i.unauthorized,c=void 0===a?[]:a,u=i.subscribed,l=void 0===u?[]:u,c.length&&c.forEach((function(e){return f._removeSubscription(f.relayProtocol,e)})),l.forEach((function(e){return f._addSubscription(f.relayProtocol,o,e)})),[2,n]}}))}))},t.prototype.vertoUnsubscribe=function(e){var t=e.nodeId,n=e.channels,r=void 0===n?[]:n;return i(this,void 0,void 0,(function(){var e,n,o,i,a,c,u,l=this;return s(this,(function(s){switch(s.label){case 0:return(r=r.filter((function(e){return e&&l._existsSubscription(l.relayProtocol,e)}))).length?(e=new y.Unsubscribe({sessid:this.sessionid,eventChannel:r}),t&&(e.targetNodeId=t),[4,this.execute(e)]):[2,{}];case 1:return n=s.sent(),o=h.destructSubscribeResponse(n),i=o.unsubscribed,a=void 0===i?[]:i,c=o.notSubscribed,u=void 0===c?[]:c,a.forEach((function(e){return l._removeSubscription(l.relayProtocol,e)})),u.forEach((function(e){return l._removeSubscription(l.relayProtocol,e)})),[2,n]}}))}))},t}(l.default);t.default=g},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(15)),a=2,c=1,u=0,l=null;t.setAgentName=function(e){l=e};var f=function(e){function t(t,n){var r=e.call(this)||this;r.method="blade.connect";var o={version:{major:a,minor:c,revision:u},authentication:t};return n&&(o.sessionid=n),l&&(o.agent=l),r.buildRequest({method:r.method,params:o}),r}return o(t,e),t}(s.default);t.Connect=f},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(3)),a=i(n(46)),c=n(29),u=n(27),l=n(4),f=n(8),d=n(30),p=n(75),h=function(){function e(e){this.session=e}return e.prototype._ack=function(e,t){var n=new u.Result(e,t);this.nodeId&&(n.targetNodeId=this.nodeId),this.session.execute(n)},e.prototype.handleMessage=function(e){var t=this,n=this.session,r=e.id,o=e.method,i=e.params,c=i.callID,u=i.eventChannel,p=i.eventType,h=o===l.VertoMethod.Attach;if("channelPvtData"===p)return this._handlePvtEvent(i.pvtData);if(c&&n.calls.hasOwnProperty(c)){if(!h)return n.calls[c].handleMessage(e),void this._ack(r,o);n.calls[c].hangup({},!1)}var v=function(){var e=new a.default(n,{id:c,remoteSdp:i.sdp,destinationNumber:i.callee_id_number,remoteCallerName:i.caller_id_name,remoteCallerNumber:i.caller_id_number,callerName:i.callee_id_name,callerNumber:i.callee_id_number,attach:h});return e.nodeId=t.nodeId,e};switch(o){case l.VertoMethod.Punt:n.disconnect();break;case l.VertoMethod.Invite:(y=v()).setState(d.State.Ringing),this._ack(r,o);break;case l.VertoMethod.Attach:var y=v();this.session.autoRecoverCalls?y.answer():y.setState(d.State.Recovering),y.handleMessage(e);break;case l.VertoMethod.Event:case"webrtc.event":if(!u)return void s.default.error("Verto received an unknown event:",i);var b=n.relayProtocol,_=u.split(".")[0];n._existsSubscription(b,u)?f.trigger(b,i,u):u===n.sessionid?this._handleSessionEvent(i.eventData):n._existsSubscription(b,_)?f.trigger(b,i,_):n.calls.hasOwnProperty(u)?n.calls[u].handleMessage(e):f.trigger(l.SwEvent.Notification,i,n.uuid);break;case l.VertoMethod.Info:i.type=l.NOTIFICATION_TYPE.generic,f.trigger(l.SwEvent.Notification,i,n.uuid);break;case l.VertoMethod.ClientReady:i.type=l.NOTIFICATION_TYPE.vertoClientReady,f.trigger(l.SwEvent.Notification,i,n.uuid);break;default:s.default.warn("Verto message unknown method:",e)}},e.prototype._retrieveCallId=function(e,t){var n=this,r=Object.keys(this.session.calls);if("bootObj"!==e.action)return r.find((function(e){return n.session.calls[e].channels.includes(t)}));var o=e.data.find((function(e){return r.includes(e[0])}));return o instanceof Array?o[0]:void 0},e.prototype._handlePvtEvent=function(e){return r(this,void 0,void 0,(function(){var t,n,r,i,a,u,p,h,v,y,b,_,g,m,w,S,O,x,E,P=this;return o(this,(function(o){switch(o.label){case 0:switch(t=this.session,n=t.relayProtocol,r=e.action,i=e.laChannel,a=e.laName,u=e.chatChannel,p=e.infoChannel,h=e.modChannel,v=e.conferenceMemberID,y=e.role,b=e.callID,r){case"conference-liveArray-join":return[3,1];case"conference-liveArray-part":return[3,3]}return[3,4];case 1:return _=function(){t.vertoBroadcast({nodeId:P.nodeId,channel:i,data:{liveArray:{command:"bootstrap",context:i,name:a}}})},g={nodeId:this.nodeId,channels:[i],handler:function(n){var r=n.data,o=b||P._retrieveCallId(r,i);if(o&&t.calls.hasOwnProperty(o)){var s=t.calls[o];s._addChannel(i),s.extension=a,s.handleConferenceUpdate(r,e).then((function(e){"INVALID_PACKET"===e&&_()}))}}},[4,t.vertoSubscribe(g).catch((function(e){s.default.error("liveArray subscription error:",e)}))];case 2:return m=o.sent(),c.checkSubscribeResponse(m,i)&&_(),[3,4];case 3:return w=null,i&&t._existsSubscription(n,i)&&(S=t.subscriptions[n][i].callId,O=void 0===S?null:S,w=t.calls[O]||null,null!==O&&(x={type:l.NOTIFICATION_TYPE.conferenceUpdate,action:d.ConferenceAction.Leave,conferenceName:a,participantId:Number(v),role:y},f.trigger(l.SwEvent.Notification,x,O,!1)||f.trigger(l.SwEvent.Notification,x,t.uuid),null===w&&f.deRegister(l.SwEvent.Notification,null,O))),E=[i,u,p,h],t.vertoUnsubscribe({nodeId:this.nodeId,channels:E}).then((function(e){var t=e.unsubscribedChannels,n=void 0===t?[]:t;w&&(w.channels=w.channels.filter((function(e){return!n.includes(e)})))})).catch((function(e){s.default.error("liveArray unsubscribe error:",e)})),[3,4];case 4:return[2]}}))}))},e.prototype._handleSessionEvent=function(e){switch(e.contentType){case"layout-info":case"layer-info":p.MCULayoutEventHandler(this.session,e);break;case"logo-info":var t={type:l.NOTIFICATION_TYPE.conferenceUpdate,action:d.ConferenceAction.LogoInfo,logo:e.logoURL};f.trigger(l.SwEvent.Notification,t,this.session.uuid)}},e}();t.default=h},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=n(8),s=n(30),a=n(5);t.MCULayoutEventHandler=function(e,t){var n=t.contentType,a=t.canvasType,u=t.callID,l=t.canvasInfo,f=void 0===l?null:l,d=t.currentLayerIdx,p=void 0===d?-1:d;f&&"mcu-personal-canvas"!==a&&delete f.memberID;var h={type:o.NOTIFICATION_TYPE.conferenceUpdate,call:e.calls[u],canvasInfo:c(f),currentLayerIdx:p};switch(n){case"layer-info":var v=r({action:s.ConferenceAction.LayerInfo},h);i.trigger(o.SwEvent.Notification,v,e.uuid);break;case"layout-info":v=r({action:s.ConferenceAction.LayoutInfo},h);i.trigger(o.SwEvent.Notification,v,e.uuid)}};var c=function(e){var t=JSON.stringify(e).replace(/memberID/g,"participantId").replace(/ID"/g,'Id"').replace(/POS"/g,'Pos"');return a.safeParseJson(t)}},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(77));t.Relay=o.default;var i=r(n(133));t.Verto=i.default;var s=n(73);t.VERSION="1.2.5-beta.1",s.setAgentName("JavaScript SDK/"+t.VERSION)},function(e,t,n){"use strict";var r=c(n(47)),o=c(n(57)),i=c(n(62)),s=c(n(68)),a=c(n(69));function c(e){return e&&e.__esModule?e:{default:e}}var u,l=(u=function(e,t){return(u=a.default||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}u(e,t),e.prototype=null===t?(0,s.default)(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,r){return new(n||(n=i.default))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},d=function(e,t){var n,i,s,a,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof o.default&&(a[r.default]=function(){return this}),a;function u(r){return function(o){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,i&&(s=2&r[0]?i.return:r[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return c.label++,{value:r[1],done:!1};case 5:c.label++,i=r[1],r=[0];continue;case 7:r=c.ops.pop(),c.trys.pop();continue;default:if(!(s=(s=c.trys).length>0&&s[s.length-1])&&(6===r[0]||2===r[0])){c=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){c.label=r[1];break}if(6===r[0]&&c.label<s[1]){c.label=s[1],s=r;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(r);break}s[2]&&c.ops.pop(),c.trys.pop();continue}r=t.call(e,c)}catch(e){r=[6,e],i=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,o])}}},p=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var h=p(n(70)),v=n(45),y=p(n(28)),b=p(n(46)),_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.execute=function(t){var n=t;if(t instanceof y.default){var r={message:t.request};t.targetNodeId&&(r.node_id=t.targetNodeId),n=new v.Execute({protocol:this.relayProtocol,method:"message",params:r})}return e.prototype.execute.call(this,n)},t.prototype.newCall=function(e){return f(this,void 0,void 0,(function(){var t,n;return d(this,(function(r){if(t=e.destinationNumber,!(void 0===t?null:t))throw new TypeError("destinationNumber is required");return(n=new b.default(this,e)).invite(),[2,n]}))}))},t}(h.default);t.default=_},function(e,t,n){n(48),n(56),e.exports=n(40).f("iterator")},function(e,t,n){var r=n(31),o=n(32);e.exports=function(e){return function(t,n){var i,s,a=String(o(t)),c=r(n),u=a.length;return c<0||c>=u?e?"":void 0:(i=a.charCodeAt(c))<55296||i>56319||c+1===u||(s=a.charCodeAt(c+1))<56320||s>57343?e?a.charAt(c):i:e?a.slice(c,c+2):s-56320+(i-55296<<10)+65536}}},function(e,t,n){"use strict";var r=n(35),o=n(23),i=n(25),s={};n(10)(s,n(1)("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(s,{next:o(1,n)}),i(e,t+" Iterator")}},function(e,t,n){var r=n(11),o=n(6),i=n(36);e.exports=n(12)?Object.defineProperties:function(e,t){o(e);for(var n,s=i(t),a=s.length,c=0;a>c;)r.f(e,n=s[c++],t[n]);return e}},function(e,t,n){var r=n(20);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(14),o=n(53),i=n(84);e.exports=function(e){return function(t,n,s){var a,c=r(t),u=o(c.length),l=i(s,u);if(e&&n!=n){for(;u>l;)if((a=c[l++])!=a)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){var r=n(31),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t,n){var r=n(13),o=n(55),i=n(37)("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},function(e,t,n){"use strict";var r=n(87),o=n(88),i=n(19),s=n(14);e.exports=n(49)(Array,"Array",(function(e,t){this._t=s(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,o(1)):o(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){n(90),n(61),n(95),n(96),e.exports=n(2).Symbol},function(e,t,n){"use strict";var r=n(0),o=n(13),i=n(12),s=n(9),a=n(51),c=n(91).KEY,u=n(22),l=n(38),f=n(25),d=n(24),p=n(1),h=n(40),v=n(41),y=n(92),b=n(93),_=n(6),g=n(7),m=n(55),w=n(14),S=n(34),O=n(23),x=n(35),E=n(94),P=n(60),k=n(58),I=n(11),T=n(36),C=P.f,M=I.f,A=E.f,j=r.Symbol,D=r.JSON,N=D&&D.stringify,R=p("_hidden"),L=p("toPrimitive"),V={}.propertyIsEnumerable,U=l("symbol-registry"),F=l("symbols"),B=l("op-symbols"),H=Object.prototype,G="function"==typeof j&&!!k.f,q=r.QObject,J=!q||!q.prototype||!q.prototype.findChild,W=i&&u((function(){return 7!=x(M({},"a",{get:function(){return M(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=C(H,t);r&&delete H[t],M(e,t,n),r&&e!==H&&M(H,t,r)}:M,K=function(e){var t=F[e]=x(j.prototype);return t._k=e,t},Y=G&&"symbol"==typeof j.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof j},z=function(e,t,n){return e===H&&z(B,t,n),_(e),t=S(t,!0),_(n),o(F,t)?(n.enumerable?(o(e,R)&&e[R][t]&&(e[R][t]=!1),n=x(n,{enumerable:O(0,!1)})):(o(e,R)||M(e,R,O(1,{})),e[R][t]=!0),W(e,t,n)):M(e,t,n)},Q=function(e,t){_(e);for(var n,r=y(t=w(t)),o=0,i=r.length;i>o;)z(e,n=r[o++],t[n]);return e},X=function(e){var t=V.call(this,e=S(e,!0));return!(this===H&&o(F,e)&&!o(B,e))&&(!(t||!o(this,e)||!o(F,e)||o(this,R)&&this[R][e])||t)},Z=function(e,t){if(e=w(e),t=S(t,!0),e!==H||!o(F,t)||o(B,t)){var n=C(e,t);return!n||!o(F,t)||o(e,R)&&e[R][t]||(n.enumerable=!0),n}},$=function(e){for(var t,n=A(w(e)),r=[],i=0;n.length>i;)o(F,t=n[i++])||t==R||t==c||r.push(t);return r},ee=function(e){for(var t,n=e===H,r=A(n?B:w(e)),i=[],s=0;r.length>s;)!o(F,t=r[s++])||n&&!o(H,t)||i.push(F[t]);return i};G||(a((j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:void 0),t=function(n){this===H&&t.call(B,n),o(this,R)&&o(this[R],e)&&(this[R][e]=!1),W(this,e,O(1,n))};return i&&J&&W(H,e,{configurable:!0,set:t}),K(e)}).prototype,"toString",(function(){return this._k})),P.f=Z,I.f=z,n(59).f=E.f=$,n(42).f=X,k.f=ee,i&&!n(17)&&a(H,"propertyIsEnumerable",X,!0),h.f=function(e){return K(p(e))}),s(s.G+s.W+s.F*!G,{Symbol:j});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)p(te[ne++]);for(var re=T(p.store),oe=0;re.length>oe;)v(re[oe++]);s(s.S+s.F*!G,"Symbol",{for:function(e){return o(U,e+="")?U[e]:U[e]=j(e)},keyFor:function(e){if(!Y(e))throw TypeError(e+" is not a symbol!");for(var t in U)if(U[t]===e)return t},useSetter:function(){J=!0},useSimple:function(){J=!1}}),s(s.S+s.F*!G,"Object",{create:function(e,t){return void 0===t?x(e):Q(x(e),t)},defineProperty:z,defineProperties:Q,getOwnPropertyDescriptor:Z,getOwnPropertyNames:$,getOwnPropertySymbols:ee});var ie=u((function(){k.f(1)}));s(s.S+s.F*ie,"Object",{getOwnPropertySymbols:function(e){return k.f(m(e))}}),D&&s(s.S+s.F*(!G||u((function(){var e=j();return"[null]"!=N([e])||"{}"!=N({a:e})||"{}"!=N(Object(e))}))),"JSON",{stringify:function(e){for(var t,n,r=[e],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=t=r[1],(g(t)||void 0!==e)&&!Y(e))return b(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!Y(t))return t}),r[1]=t,N.apply(D,r)}}),j.prototype[L]||n(10)(j.prototype,L,j.prototype.valueOf),f(j,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(e,t,n){var r=n(24)("meta"),o=n(7),i=n(13),s=n(11).f,a=0,c=Object.isExtensible||function(){return!0},u=!n(22)((function(){return c(Object.preventExtensions({}))})),l=function(e){s(e,r,{value:{i:"O"+ ++a,w:{}}})},f=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!c(e))return"F";if(!t)return"E";l(e)}return e[r].i},getWeak:function(e,t){if(!i(e,r)){if(!c(e))return!0;if(!t)return!1;l(e)}return e[r].w},onFreeze:function(e){return u&&f.NEED&&c(e)&&!i(e,r)&&l(e),e}}},function(e,t,n){var r=n(36),o=n(58),i=n(42);e.exports=function(e){var t=r(e),n=o.f;if(n)for(var s,a=n(e),c=i.f,u=0;a.length>u;)c.call(e,s=a[u++])&&t.push(s);return t}},function(e,t,n){var r=n(20);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(14),o=n(59).f,i={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return s.slice()}}(e):o(r(e))}},function(e,t,n){n(41)("asyncIterator")},function(e,t,n){n(41)("observable")},function(e,t,n){n(61),n(48),n(56),n(98),n(110),n(111),e.exports=n(2).Promise},function(e,t,n){"use strict";var r,o,i,s,a=n(17),c=n(0),u=n(18),l=n(63),f=n(9),d=n(7),p=n(21),h=n(99),v=n(100),y=n(64),b=n(65).set,_=n(105)(),g=n(43),m=n(66),w=n(106),S=n(67),O=c.TypeError,x=c.process,E=x&&x.versions,P=E&&E.v8||"",k=c.Promise,I="process"==l(x),T=function(){},C=o=g.f,M=!!function(){try{var e=k.resolve(1),t=(e.constructor={})[n(1)("species")]=function(e){e(T,T)};return(I||"function"==typeof PromiseRejectionEvent)&&e.then(T)instanceof t&&0!==P.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(e){}}(),A=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},j=function(e,t){if(!e._n){e._n=!0;var n=e._c;_((function(){for(var r=e._v,o=1==e._s,i=0,s=function(t){var n,i,s,a=o?t.ok:t.fail,c=t.resolve,u=t.reject,l=t.domain;try{a?(o||(2==e._h&&R(e),e._h=1),!0===a?n=r:(l&&l.enter(),n=a(r),l&&(l.exit(),s=!0)),n===t.promise?u(O("Promise-chain cycle")):(i=A(n))?i.call(n,c,u):c(n)):u(r)}catch(e){l&&!s&&l.exit(),u(e)}};n.length>i;)s(n[i++]);e._c=[],e._n=!1,t&&!e._h&&D(e)}))}},D=function(e){b.call(c,(function(){var t,n,r,o=e._v,i=N(e);if(i&&(t=m((function(){I?x.emit("unhandledRejection",o,e):(n=c.onunhandledrejection)?n({promise:e,reason:o}):(r=c.console)&&r.error&&r.error("Unhandled promise rejection",o)})),e._h=I||N(e)?2:1),e._a=void 0,i&&t.e)throw t.v}))},N=function(e){return 1!==e._h&&0===(e._a||e._c).length},R=function(e){b.call(c,(function(){var t;I?x.emit("rejectionHandled",e):(t=c.onrejectionhandled)&&t({promise:e,reason:e._v})}))},L=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),j(t,!0))},V=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw O("Promise can't be resolved itself");(t=A(e))?_((function(){var r={_w:n,_d:!1};try{t.call(e,u(V,r,1),u(L,r,1))}catch(e){L.call(r,e)}})):(n._v=e,n._s=1,j(n,!1))}catch(e){L.call({_w:n,_d:!1},e)}}};M||(k=function(e){h(this,k,"Promise","_h"),p(e),r.call(this);try{e(u(V,this,1),u(L,this,1))}catch(e){L.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(107)(k.prototype,{then:function(e,t){var n=C(y(this,k));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=I?x.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&j(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),i=function(){var e=new r;this.promise=e,this.resolve=u(V,e,1),this.reject=u(L,e,1)},g.f=C=function(e){return e===k||e===s?new i(e):o(e)}),f(f.G+f.W+f.F*!M,{Promise:k}),n(25)(k,"Promise"),n(108)("Promise"),s=n(2).Promise,f(f.S+f.F*!M,"Promise",{reject:function(e){var t=C(this);return(0,t.reject)(e),t.promise}}),f(f.S+f.F*(a||!M),"Promise",{resolve:function(e){return S(a&&this===s?k:this,e)}}),f(f.S+f.F*!(M&&n(109)((function(e){k.all(e).catch(T)}))),"Promise",{all:function(e){var t=this,n=C(t),r=n.resolve,o=n.reject,i=m((function(){var n=[],i=0,s=1;v(e,!1,(function(e){var a=i++,c=!1;n.push(void 0),s++,t.resolve(e).then((function(e){c||(c=!0,n[a]=e,--s||r(n))}),o)})),--s||r(n)}));return i.e&&o(i.v),n.promise},race:function(e){var t=this,n=C(t),r=n.reject,o=m((function(){v(e,!1,(function(e){t.resolve(e).then(n.resolve,r)}))}));return o.e&&r(o.v),n.promise}})},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(18),o=n(101),i=n(102),s=n(6),a=n(53),c=n(103),u={},l={};(t=e.exports=function(e,t,n,f,d){var p,h,v,y,b=d?function(){return e}:c(e),_=r(n,f,t?2:1),g=0;if("function"!=typeof b)throw TypeError(e+" is not iterable!");if(i(b)){for(p=a(e.length);p>g;g++)if((y=t?_(s(h=e[g])[0],h[1]):_(e[g]))===u||y===l)return y}else for(v=b.call(e);!(h=v.next()).done;)if((y=o(v,_,h.value,t))===u||y===l)return y}).BREAK=u,t.RETURN=l},function(e,t,n){var r=n(6);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(19),o=n(1)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||i[o]===e)}},function(e,t,n){var r=n(63),o=n(1)("iterator"),i=n(19);e.exports=n(2).getIteratorMethod=function(e){if(null!=e)return e[o]||e["@@iterator"]||i[r(e)]}},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(0),o=n(65).set,i=r.MutationObserver||r.WebKitMutationObserver,s=r.process,a=r.Promise,c="process"==n(20)(s);e.exports=function(){var e,t,n,u=function(){var r,o;for(c&&(r=s.domain)&&r.exit();e;){o=e.fn,e=e.next;try{o()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(c)n=function(){s.nextTick(u)};else if(!i||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var l=a.resolve(void 0);n=function(){l.then(u)}}else n=function(){o.call(r,u)};else{var f=!0,d=document.createTextNode("");new i(u).observe(d,{characterData:!0}),n=function(){d.data=f=!f}}return function(r){var o={fn:r,next:void 0};t&&(t.next=o),e||(e=o,n()),t=o}}},function(e,t,n){var r=n(0).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){var r=n(10);e.exports=function(e,t,n){for(var o in t)n&&e[o]?e[o]=t[o]:r(e,o,t[o]);return e}},function(e,t,n){"use strict";var r=n(0),o=n(2),i=n(11),s=n(12),a=n(1)("species");e.exports=function(e){var t="function"==typeof o[e]?o[e]:r[e];s&&t&&!t[a]&&i.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(1)("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i=[7],s=i[r]();s.next=function(){return{done:n=!0}},i[r]=function(){return s},e(i)}catch(e){}return n}},function(e,t,n){"use strict";var r=n(9),o=n(2),i=n(0),s=n(64),a=n(67);r(r.P+r.R,"Promise",{finally:function(e){var t=s(this,o.Promise||i.Promise),n="function"==typeof e;return this.then(n?function(n){return a(t,e()).then((function(){return n}))}:e,n?function(n){return a(t,e()).then((function(){throw n}))}:e)}})},function(e,t,n){"use strict";var r=n(9),o=n(43),i=n(66);r(r.S,"Promise",{try:function(e){var t=o.f(this),n=i(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){n(113);var r=n(2).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){var r=n(9);r(r.S,"Object",{create:n(35)})},function(e,t,n){n(115),e.exports=n(2).Object.setPrototypeOf},function(e,t,n){var r=n(9);r(r.S,"Object",{setPrototypeOf:n(116).set})},function(e,t,n){var r=n(7),o=n(6),i=function(e,t){if(o(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=n(18)(Function.call,n(60).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return i(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:i}},function(e,t,n){var r,o;!function(i,s){"use strict";void 0===(o="function"==typeof(r=function(){var e=function(){},t="undefined",n=["trace","debug","info","warn","error"];function r(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function o(t,r){for(var o=0;o<n.length;o++){var i=n[o];this[i]=o<t?e:this.methodFactory(i,t,r)}this.log=this.debug}function i(e,n,r){return function(){typeof console!==t&&(o.call(this,n,r),this[e].apply(this,arguments))}}function s(n,o,s){return function(n){return"debug"===n&&(n="log"),typeof console!==t&&(void 0!==console[n]?r(console,n):void 0!==console.log?r(console,"log"):e)}(n)||i.apply(this,arguments)}function a(e,r,i){var a,c=this,u="loglevel";function l(){var e;if(typeof window!==t){try{e=window.localStorage[u]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,r=n.indexOf(encodeURIComponent(u)+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r))[1])}catch(e){}return void 0===c.levels[e]&&(e=void 0),e}}e&&(u+=":"+e),c.name=e,c.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},c.methodFactory=i||s,c.getLevel=function(){return a},c.setLevel=function(r,i){if("string"==typeof r&&void 0!==c.levels[r.toUpperCase()]&&(r=c.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=c.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(a=r,!1!==i&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t){try{return void(window.localStorage[u]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(u)+"="+r+";"}catch(e){}}}(r),o.call(c,r,e),typeof console===t&&r<c.levels.SILENT)return"No console available for logging"},c.setDefaultLevel=function(e){l()||c.setLevel(e,!1)},c.enableAll=function(e){c.setLevel(c.levels.TRACE,e)},c.disableAll=function(e){c.setLevel(c.levels.SILENT,e)};var f=l();null==f&&(f=null==r?"WARN":r),c.setLevel(f,!1)}var c=new a,u={};c.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=u[e];return t||(t=u[e]=new a(e,c.getLevel(),c.methodFactory)),t};var l=typeof window!==t?window.log:void 0;return c.noConflict=function(){return typeof window!==t&&window.log===c&&(window.log=l),c},c.getLoggers=function(){return u},c})?r.call(t,n,t,e):r)||(e.exports=o)}()},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(44),a=i(n(3)),c=i(n(121)),u=i(n(122)),l=n(8),f=i(n(128)),d=n(4),p=n(45),h=n(5),v=n(26),y=function(){function e(e){if(this.options=e,this.uuid=s.v4(),this.sessionid="",this.subscriptions={},this.expiresAt=0,this.signature=null,this.relayProtocol=null,this.contexts=[],this.connection=null,this._jwtAuth=!1,this._doKeepAlive=!1,this._reconnectDelay=5e3,this._autoReconnect=!0,this._idle=!1,this._executeQueue=[],!this.validateOptions())throw new Error("Invalid init options");this._onSocketOpen=this._onSocketOpen.bind(this),this._onSocketCloseOrError=this._onSocketCloseOrError.bind(this),this._onSocketMessage=this._onSocketMessage.bind(this),this._handleLoginError=this._handleLoginError.bind(this),this._checkTokenExpiration=this._checkTokenExpiration.bind(this),this._attachListeners(),this.connection=new c.default(this)}return Object.defineProperty(e.prototype,"__logger",{get:function(){return a.default},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"connected",{get:function(){return this.connection&&this.connection.connected},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expired",{get:function(){return this.expiresAt&&this.expiresAt<=Date.now()/1e3},enumerable:!0,configurable:!0}),e.prototype.execute=function(e){var t=this;return this._idle?new Promise((function(n){return t._executeQueue.push({resolve:n,msg:e})})):this.connected?this.connection.send(e):new Promise((function(n){t._executeQueue.push({resolve:n,msg:e}),t.connect()}))},e.prototype.executeRaw=function(e){this._idle?this._executeQueue.push({msg:e}):this.connection.sendRawText(e)},e.prototype.validateOptions=function(){var e=this.options,t=e.project,n=void 0!==t&&t,r=e.token;return Boolean(n&&(void 0!==r&&r))},e.prototype.broadcast=function(e){},e.prototype.subscribe=function(e){var t=e.protocol,n=e.channels,i=e.handler;return r(this,void 0,void 0,(function(){var e,r,s,a,c,u,l=this;return o(this,(function(o){switch(o.label){case 0:return e=new p.Subscription({command:d.ADD,protocol:t,channels:n}),[4,this.execute(e)];case 1:return r=o.sent(),s=r.failed_channels,a=void 0===s?[]:s,c=r.subscribe_channels,u=void 0===c?[]:c,a.length&&a.forEach((function(e){return l._removeSubscription(t,e)})),u.forEach((function(e){return l._addSubscription(t,i,e)})),[2,r]}}))}))},e.prototype.unsubscribe=function(e){var t=e.protocol,n=e.channels;e.handler;return r(this,void 0,void 0,(function(){var e;return o(this,(function(r){return e=new p.Subscription({command:d.REMOVE,protocol:t,channels:n}),[2,this.execute(e)]}))}))},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return clearTimeout(this._reconnectTimeout),this.subscriptions={},this._autoReconnect=!1,this.relayProtocol=null,this._closeConnection(),[4,v.sessionStorage.removeItem(this.signature)];case 1:return e.sent(),this._executeQueue=[],this._detachListeners(),[2]}}))}))},e.prototype.on=function(e,t){return l.register(e,t,this.uuid),this},e.prototype.off=function(e,t){return l.deRegister(e,t,this.uuid),this},e.prototype.refreshToken=function(e){return r(this,void 0,void 0,(function(){var t,n,r,i,s,c;return o(this,(function(o){switch(o.label){case 0:this.options.token=e,o.label=1;case 1:return o.trys.push([1,6,,7]),this.expired?[4,this.connect()]:[3,3];case 2:return o.sent(),[3,5];case 3:return t=new p.Reauthenticate(this.options.project,e,this.sessionid),[4,this.execute(t)];case 4:n=o.sent(),r=n.authorization,i=(void 0===r?{}:r).expires_at,s=void 0===i?null:i,this.expiresAt=+s||0,o.label=5;case 5:return[3,7];case 6:return c=o.sent(),a.default.error("refreshToken error:",c),l.trigger(d.SwEvent.Error,c,this.uuid,!1),[3,7];case 7:return[2]}}))}))},e.prototype.connect=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return this.connection||(this.connection=new c.default(this)),this._attachListeners(),this.connection.isAlive||this.connection.connect(),[2]}))}))},e.prototype._handleLoginError=function(e){this._autoReconnect=!1,l.trigger(d.SwEvent.Error,e,this.uuid)},e.prototype._onSocketOpen=function(){return r(this,void 0,void 0,(function(){var e,t,n,r,i,s,c,f,h,v,y,b,_,g,m,w,S;return o(this,(function(o){switch(o.label){case 0:return this._idle=!1,e=this._jwtAuth?"jwt_token":"token",t=this.options,n=t.project,r=t.token,i=new p.Connect(((S={project:n})[e]=r,S),this.sessionid),[4,this.execute(i).catch(this._handleLoginError)];case 1:return(s=o.sent())?(this._autoReconnect=!0,c=s.sessionid,f=s.nodeid,h=s.master_nodeid,v=s.authorization,b=(y=void 0===v?{}:v).expires_at,_=void 0===b?null:b,g=y.signature,m=void 0===g?null:g,this.expiresAt=+_||0,this.signature=m,w=this,[4,u.default(this)]):[3,3];case 2:w.relayProtocol=o.sent(),this._checkTokenExpiration(),this.sessionid=c,this.nodeid=f,this.master_nodeid=h,this._emptyExecuteQueues(),this._pong=null,this._keepAlive(),l.trigger(d.SwEvent.Ready,this,this.uuid),a.default.info("Session Ready!"),o.label=3;case 3:return[2]}}))}))},e.prototype._onSocketCloseOrError=function(e){var t=this;for(var n in a.default.error("Socket "+e.type+" "+e.message),this.relayProtocol&&l.deRegisterAll(this.relayProtocol),this.subscriptions)l.deRegisterAll(n);this.subscriptions={},this.contexts=[],this.expired&&(this._idle=!0,this._autoReconnect=!1,this.expiresAt=0),this._autoReconnect&&(this._reconnectTimeout=setTimeout((function(){return t.connect()}),this._reconnectDelay))},e.prototype._onSocketMessage=function(e){var t=e.method,n=e.params;switch(t){case d.BladeMethod.Broadcast:f.default(this,n);break;case d.BladeMethod.Disconnect:this._idle=!0}},e.prototype._removeSubscription=function(e,t){this._existsSubscription(e,t)&&(t?(delete this.subscriptions[e][t],l.deRegister(e,null,t)):(delete this.subscriptions[e],l.deRegisterAll(e)))},e.prototype._addSubscription=function(e,t,n){void 0===t&&(t=null),this._existsSubscription(e,n)||(this._existsSubscription(e)||(this.subscriptions[e]={}),this.subscriptions[e][n]={},h.isFunction(t)&&l.register(e,t,n))},e.prototype._existsSubscription=function(e,t){return!(!this.subscriptions.hasOwnProperty(e)||!(!t||t&&this.subscriptions[e].hasOwnProperty(t)))},e.prototype._attachListeners=function(){this._detachListeners(),this.on(d.SwEvent.SocketOpen,this._onSocketOpen),this.on(d.SwEvent.SocketClose,this._onSocketCloseOrError),this.on(d.SwEvent.SocketError,this._onSocketCloseOrError),this.on(d.SwEvent.SocketMessage,this._onSocketMessage)},e.prototype._detachListeners=function(){this.off(d.SwEvent.SocketOpen,this._onSocketOpen),this.off(d.SwEvent.SocketClose,this._onSocketCloseOrError),this.off(d.SwEvent.SocketError,this._onSocketCloseOrError),this.off(d.SwEvent.SocketMessage,this._onSocketMessage)},e.prototype._emptyExecuteQueues=function(){var e=this;this._executeQueue.forEach((function(t){var n=t.resolve,r=t.msg;"string"==typeof r?e.executeRaw(r):n(e.execute(r))}))},e.prototype._closeConnection=function(){this._idle=!0,clearTimeout(this._keepAliveTimeout),this.connection&&this.connection.close()},e.prototype._checkTokenExpiration=function(){this.expiresAt&&(this.expiresAt-Date.now()/1e3<=60&&(a.default.warn("Your JWT is going to expire. You should refresh it to keep the session live."),l.trigger(d.SwEvent.Notification,{type:d.NOTIFICATION_TYPE.refreshToken,session:this},this.uuid,!1)),this.expired||setTimeout(this._checkTokenExpiration,3e4))},e.prototype._keepAlive=function(){var e=this;if(!0===this._doKeepAlive){if(!1===this._pong)return this._closeConnection();this._pong=!1,this.execute(new p.Ping).then((function(){return e._pong=!0})).catch((function(){return e._pong=!1})),this._keepAliveTimeout=setTimeout((function(){return e._keepAlive()}),1e4)}},e.on=function(e,t){l.register(e,t)},e.off=function(e){l.deRegister(e)},e.uuid=function(){return s.v4()},e}();t.default=y},function(e,t,n){var r,o,i=n(71),s=n(72),a=0,c=0;e.exports=function(e,t,n){var u=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:o;if(null==f||null==d){var p=i();null==f&&(f=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:c+1,y=h-a+(v-c)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||h>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,c=v,o=d;var b=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;l[u++]=b>>>24&255,l[u++]=b>>>16&255,l[u++]=b>>>8&255,l[u++]=255&b;var _=h/4294967296*1e4&268435455;l[u++]=_>>>8&255,l[u++]=255&_,l[u++]=_>>>24&15|16,l[u++]=_>>>16&255,l[u++]=d>>>8|128,l[u++]=255&d;for(var g=0;g<6;++g)l[u+g]=f[g];return t||s(l)}},function(e,t,n){var r=n(71),o=n(72);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[i+a]=s[a];return t||o(s)}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(3)),i=n(4),s=n(5),a=n(8),c=n(5),u="undefined"!=typeof WebSocket?WebSocket:null;t.setWebSocket=function(e){u=e};var l=0,f=1,d=2,p=3,h=function(){function e(e){this.session=e,this._wsClient=null,this._host="wss://relay.signalwire.com",this._timers={},this.upDur=null,this.downDur=null;var t=e.options.host;t&&(this._host=s.checkWebSocketHost(t))}return Object.defineProperty(e.prototype,"connected",{get:function(){return this._wsClient&&this._wsClient.readyState===f},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"connecting",{get:function(){return this._wsClient&&this._wsClient.readyState===l},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"closing",{get:function(){return this._wsClient&&this._wsClient.readyState===d},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._wsClient&&this._wsClient.readyState===p},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAlive",{get:function(){return this.connecting||this.connected},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDead",{get:function(){return this.closing||this.closed},enumerable:!0,configurable:!0}),e.prototype.connect=function(){var e=this;this._wsClient=new u(this._host),this._wsClient.onopen=function(t){return a.trigger(i.SwEvent.SocketOpen,t,e.session.uuid)},this._wsClient.onclose=function(t){return a.trigger(i.SwEvent.SocketClose,t,e.session.uuid)},this._wsClient.onerror=function(t){return a.trigger(i.SwEvent.SocketError,t,e.session.uuid)},this._wsClient.onmessage=function(t){var n=s.safeParseJson(t.data);"string"!=typeof n?(e._unsetTimer(n.id),o.default.debug("RECV: \n",JSON.stringify(n,null,2),"\n"),a.trigger(n.id,n)||a.trigger(i.SwEvent.SocketMessage,n,e.session.uuid)):e._handleStringResponse(n)}},e.prototype.sendRawText=function(e){this._wsClient.send(e)},e.prototype.send=function(e){var t=this,n=e.request,r=new Promise((function(e,r){if(n.hasOwnProperty("result"))return e();a.registerOnce(n.id,(function(t){var n=s.destructResponse(t),o=n.result,i=n.error;return i?r(i):e(o)})),t._setTimer(n.id)}));return o.default.debug("SEND: \n",JSON.stringify(n,null,2),"\n"),this._wsClient.send(JSON.stringify(n)),r},e.prototype.close=function(){this._wsClient&&(c.isFunction(this._wsClient._beginClose)?this._wsClient._beginClose():this._wsClient.close()),this._wsClient=null},e.prototype._unsetTimer=function(e){clearTimeout(this._timers[e]),delete this._timers[e]},e.prototype._setTimer=function(e){var t=this;this._timers[e]=setTimeout((function(){a.trigger(e,{error:{code:"408",message:"Request Timeout"}}),t._unsetTimer(e)}),1e4)},e.prototype._handleStringResponse=function(e){if(/^#SP/.test(e))switch(e[3]){case"U":this.upDur=parseInt(e.substring(4));break;case"D":this.downDur=parseInt(e.substring(4)),a.trigger(i.SwEvent.SpeedTest,{upDur:this.upDur,downDur:this.downDur},this.session.uuid)}else o.default.warn("Unknown message from socket",e)},e}();t.default=h},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(3)),a=n(45),c=n(26);t.default=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,i,u,l,f;return o(this,(function(o){switch(o.label){case 0:return t={},n=e.signature,(r=e.relayProtocol)&&r.split("_")[1]===n?(t.protocol=r,[3,3]):[3,1];case 1:return[4,c.sessionStorage.getItem(n)];case 2:(i=o.sent())&&(t.protocol=i),o.label=3;case 3:return u=new a.Execute({protocol:"signalwire",method:"setup",params:t}),[4,e.execute(u)];case 4:return l=o.sent().protocol,(f=void 0===l?null:l)?[4,e.subscribe({protocol:f,channels:["notifications"]})]:[3,7];case 5:return o.sent(),[4,c.sessionStorage.setItem(n,f)];case 6:return o.sent(),[3,8];case 7:s.default.error("Error during setup the session protocol."),o.label=8;case 8:return[2,f]}}))}))}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t,n){void 0===n&&(n="");var r,o=e.call(this)||this;return o.method="blade.execute",r=t.hasOwnProperty("result")?{result:t}:{method:o.method,params:t},n&&(r.id=n),o.buildRequest(r),o}return o(t,e),t}(i(n(15)).default);t.Execute=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){var n=e.call(this)||this;return n.method="blade.subscription",t.hasOwnProperty("auto_create")&&!t.auto_create&&delete t.auto_create,t.hasOwnProperty("downstream")&&!t.downstream&&delete t.downstream,n.buildRequest({method:n.method,params:t}),n}return o(t,e),t}(i(n(15)).default);t.Subscription=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t,n,r){var o=e.call(this)||this;o.method="blade.reauthenticate";var i={sessionid:r,authentication:{project:t,jwt_token:n}};return o.buildRequest({method:o.method,params:i}),o}return o(t,e),t}(i(n(15)).default);t.Reauthenticate=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(){var t=e.call(this)||this;return t.method="blade.ping",t.buildRequest({method:t.method,params:{}}),t}return o(t,e),t}(i(n(15)).default);t.Ping=s},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],l=!1,f=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&p())}function p(){if(!l){var e=a(d);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new h(e,t)),1!==u.length||l||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(3)),i=r(n(74));t.default=function(e,t){var n=t.protocol,r=t.event,s=t.params,a=s.event_type,c=s.node_id;if(n!==e.relayProtocol)return o.default.error("Session protocol mismatch.");switch(r){case"queuing.relay.events":if("webrtc.message"===a){var u=new i.default(e);u.nodeId=c,u.handleMessage(s.params)}else e.calling.notificationHandler(s);break;case"queuing.relay.tasks":e.tasking.notificationHandler(s);break;case"queuing.relay.messaging":e.messaging.notificationHandler(s);break;default:return o.default.error("Unknown notification type: "+a)}}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(44),c=s(n(3)),u=n(27),l=s(n(132)),f=n(4),d=n(30),p=n(8),h=n(29),v=n(5),y=n(16),b=n(75),_=function(){function e(e,t){var n=this;this.session=e,this.id="",this.state=d.State[d.State.New],this.prevState="",this.channels=[],this.role=d.Role.Participant,this.extension=null,this._state=d.State.New,this._prevState=d.State.New,this.gotAnswer=!1,this.gotEarly=!1,this._lastSerno=0,this._targetNodeId=null,this._iceTimeout=null,this._iceDone=!1,this._checkConferenceSerno=function(e){var t=e<0||!n._lastSerno||n._lastSerno&&e===n._lastSerno+1;return t&&e>=0&&(n._lastSerno=e),t};var r=e.iceServers,o=e.speaker,i=e.micId,s=e.micLabel,a=e.camId,c=e.camLabel,u=e.localElement,l=e.remoteElement,f=e.mediaConstraints,p=f.audio,h=f.video;this.options=Object.assign({},d.DEFAULT_CALL_OPTIONS,{audio:p,video:h,iceServers:r,localElement:u,remoteElement:l,micId:i,micLabel:s,camId:a,camLabel:c,speakerId:o},t),this._onMediaError=this._onMediaError.bind(this),this._init()}return Object.defineProperty(e.prototype,"nodeId",{get:function(){return this._targetNodeId},set:function(e){this._targetNodeId=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localStream",{get:function(){return this.options.localStream},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"remoteStream",{get:function(){return this.options.remoteStream},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"memberChannel",{get:function(){return"conference-member."+this.id},enumerable:!0,configurable:!0}),e.prototype.invite=function(){this.direction=f.Direction.Outbound,this.peer=new l.default(f.PeerType.Offer,this.options),this._registerPeerEvents()},e.prototype.answer=function(){this.direction=f.Direction.Inbound,this.peer=new l.default(f.PeerType.Answer,this.options),this._registerPeerEvents()},e.prototype.hangup=function(e,t){var n=this;void 0===e&&(e={}),void 0===t&&(t=!0),this.cause=e.cause||"NORMAL_CLEARING",this.causeCode=e.causeCode||16,this.setState(d.State.Hangup);var r=function(){n.peer&&n.peer.instance.close(),n.setState(d.State.Destroy)};if(t){var o=new u.Bye({sessid:this.session.sessionid,dialogParams:this.options});this._execute(o).catch((function(e){return c.default.error("verto.bye failed!",e)})).then(r.bind(this))}else r()},e.prototype.transfer=function(e){var t=new u.Modify({sessid:this.session.sessionid,action:"transfer",destination:e,dialogParams:this.options});this._execute(t)},e.prototype.replace=function(e){var t=new u.Modify({sessid:this.session.sessionid,action:"replace",replaceCallID:e,dialogParams:this.options});this._execute(t)},e.prototype.hold=function(){var e=new u.Modify({sessid:this.session.sessionid,action:"hold",dialogParams:this.options});return this._execute(e).then(this._handleChangeHoldStateSuccess.bind(this)).catch(this._handleChangeHoldStateError.bind(this))},e.prototype.unhold=function(){var e=new u.Modify({sessid:this.session.sessionid,action:"unhold",dialogParams:this.options});return this._execute(e).then(this._handleChangeHoldStateSuccess.bind(this)).catch(this._handleChangeHoldStateError.bind(this))},e.prototype.toggleHold=function(){var e=new u.Modify({sessid:this.session.sessionid,action:"toggleHold",dialogParams:this.options});return this._execute(e).then(this._handleChangeHoldStateSuccess.bind(this)).catch(this._handleChangeHoldStateError.bind(this))},e.prototype.dtmf=function(e){var t=new u.Info({sessid:this.session.sessionid,dtmf:e,dialogParams:this.options});this._execute(t)},e.prototype.message=function(e,t){var n={from:this.session.options.login,to:e,body:t},r=new u.Info({sessid:this.session.sessionid,msg:n,dialogParams:this.options});this._execute(r)},e.prototype.muteAudio=function(){h.disableAudioTracks(this.options.localStream)},e.prototype.unmuteAudio=function(){h.enableAudioTracks(this.options.localStream)},e.prototype.toggleAudioMute=function(){h.toggleAudioTracks(this.options.localStream)},e.prototype.setAudioInDevice=function(e){return o(this,void 0,void 0,(function(){var t,n,r,o,s;return i(this,(function(i){switch(i.label){case 0:return t=this.peer.instance,(n=t.getSenders().find((function(e){return"audio"===e.track.kind})))?[4,y.getUserMedia({audio:{deviceId:{exact:e}}})]:[3,2];case 1:r=i.sent(),o=r.getAudioTracks()[0],n.replaceTrack(o),this.options.micId=e,(s=this.options.localStream).getAudioTracks().forEach((function(e){return e.stop()})),s.getVideoTracks().forEach((function(e){return r.addTrack(e)})),this.options.localStream=r,i.label=2;case 2:return[2]}}))}))},e.prototype.muteVideo=function(){h.disableVideoTracks(this.options.localStream)},e.prototype.unmuteVideo=function(){h.enableVideoTracks(this.options.localStream)},e.prototype.toggleVideoMute=function(){h.toggleVideoTracks(this.options.localStream)},e.prototype.setVideoDevice=function(e){return o(this,void 0,void 0,(function(){var t,n,r,o,s,a,c;return i(this,(function(i){switch(i.label){case 0:return t=this.peer.instance,(n=t.getSenders().find((function(e){return"video"===e.track.kind})))?[4,y.getUserMedia({video:{deviceId:{exact:e}}})]:[3,2];case 1:r=i.sent(),o=r.getVideoTracks()[0],n.replaceTrack(o),s=this.options,a=s.localElement,c=s.localStream,y.attachMediaStream(a,r),this.options.camId=e,c.getAudioTracks().forEach((function(e){return r.addTrack(e)})),c.getVideoTracks().forEach((function(e){return e.stop()})),this.options.localStream=r,i.label=2;case 2:return[2]}}))}))},e.prototype.deaf=function(){h.disableAudioTracks(this.options.remoteStream)},e.prototype.undeaf=function(){h.enableAudioTracks(this.options.remoteStream)},e.prototype.toggleDeaf=function(){h.toggleAudioTracks(this.options.remoteStream)},e.prototype.setState=function(e){var t=this;switch(this._prevState=this._state,this._state=e,this.state=d.State[this._state].toLowerCase(),this.prevState=d.State[this._prevState].toLowerCase(),c.default.info("Call "+this.id+" state change from "+this.prevState+" to "+this.state),this._dispatchNotification({type:f.NOTIFICATION_TYPE.callUpdate,call:this}),e){case d.State.Purge:this.hangup({cause:"PURGE",causeCode:"01"},!1);break;case d.State.Active:setTimeout((function(){var e=t.options,n=e.remoteElement,r=e.speakerId;n&&r&&y.setMediaElementSinkId(n,r)}),0);break;case d.State.Destroy:this._finalize()}},e.prototype.handleMessage=function(e){var t=e.method,n=e.params;switch(t){case f.VertoMethod.Answer:if(this.gotAnswer=!0,this._state>=d.State.Active)return;this._state>=d.State.Early&&this.setState(d.State.Active),this.gotEarly||this._onRemoteSdp(n.sdp);break;case f.VertoMethod.Media:if(this._state>=d.State.Early)return;this.gotEarly=!0,this._onRemoteSdp(n.sdp);break;case f.VertoMethod.Display:case f.VertoMethod.Attach:var o=n.display_name,i=n.display_number,s=n.display_direction;this.extension=i;var a=s===f.Direction.Inbound?f.Direction.Outbound:f.Direction.Inbound,c={type:f.NOTIFICATION_TYPE[t],call:this,displayName:o,displayNumber:i,displayDirection:a};p.trigger(f.SwEvent.Notification,c,this.id)||p.trigger(f.SwEvent.Notification,c,this.session.uuid);break;case f.VertoMethod.Info:case f.VertoMethod.Event:c=r(r({},n),{type:f.NOTIFICATION_TYPE.generic,call:this});p.trigger(f.SwEvent.Notification,c,this.id)||p.trigger(f.SwEvent.Notification,c,this.session.uuid);break;case f.VertoMethod.Bye:this.hangup(n,!1)}},e.prototype.handleConferenceUpdate=function(e,t){return o(this,void 0,void 0,(function(){var n,o,s,a,u,l,f,p,h,y,b,_,g;return i(this,(function(i){switch(i.label){case 0:if(!this._checkConferenceSerno(e.wireSerno)&&e.name!==t.laName)return c.default.error("ConferenceUpdate invalid wireSerno or packet name:",e),[2,"INVALID_PACKET"];switch(n=e.action,o=e.data,s=e.hashKey,a=void 0===s?String(this._lastSerno):s,u=e.arrIndex,n){case"bootObj":return[3,1];case"add":return[3,8];case"modify":return[3,9];case"del":return[3,10];case"clear":return[3,11]}return[3,12];case 1:return this._lastSerno=0,t.chatID,l=t.chatChannel,f=t.infoChannel,p=t.modChannel,h=t.laName,y=t.conferenceMemberID,b=t.role,this._dispatchConferenceUpdate({action:d.ConferenceAction.Join,conferenceName:h,participantId:Number(y),role:b}),l?[4,this._subscribeConferenceChat(l)]:[3,3];case 2:i.sent(),i.label=3;case 3:return f?[4,this._subscribeConferenceInfo(f)]:[3,5];case 4:i.sent(),i.label=5;case 5:return p&&b===d.Role.Moderator?[4,this._subscribeConferenceModerator(p)]:[3,7];case 6:i.sent(),i.label=7;case 7:for(g in _=[],o)_.push(r({callId:o[g][0],index:Number(g)},v.mutateLiveArrayData(o[g][1])));return this._dispatchConferenceUpdate({action:d.ConferenceAction.Bootstrap,participants:_}),[3,13];case 8:return this._dispatchConferenceUpdate(r({action:d.ConferenceAction.Add,callId:a,index:u},v.mutateLiveArrayData(o))),[3,13];case 9:return this._dispatchConferenceUpdate(r({action:d.ConferenceAction.Modify,callId:a,index:u},v.mutateLiveArrayData(o))),[3,13];case 10:return this._dispatchConferenceUpdate(r({action:d.ConferenceAction.Delete,callId:a,index:u},v.mutateLiveArrayData(o))),[3,13];case 11:return this._dispatchConferenceUpdate({action:d.ConferenceAction.Clear}),[3,13];case 12:return this._dispatchConferenceUpdate({action:n,data:o,callId:a,index:u}),[3,13];case 13:return[2]}}))}))},e.prototype._addChannel=function(e){this.channels.includes(e)||this.channels.push(e);var t=this.session.relayProtocol;this.session._existsSubscription(t,e)&&(this.session.subscriptions[t][e]=r(r({},this.session.subscriptions[t][e]),{callId:this.id}))},e.prototype._subscribeConferenceChat=function(e){return o(this,void 0,void 0,(function(){var t,n,r=this;return i(this,(function(o){switch(o.label){case 0:return t={nodeId:this.nodeId,channels:[e],handler:function(e){var t=e.data,n=t.direction,o=t.from,i=t.fromDisplay,s=t.message,a=t.type;r._dispatchConferenceUpdate({action:d.ConferenceAction.ChatMessage,direction:n,participantNumber:o,participantName:i,messageText:s,messageType:a,messageId:e.eventSerno})}},[4,this.session.vertoSubscribe(t).catch((function(e){c.default.error("ConfChat subscription error:",e)}))];case 1:return n=o.sent(),h.checkSubscribeResponse(n,e)&&(this._addChannel(e),Object.defineProperties(this,{sendChatMessage:{configurable:!0,value:function(t,n){r.session.vertoBroadcast({nodeId:r.nodeId,channel:e,data:{action:"send",message:t,type:n}})}}})),[2]}}))}))},e.prototype._subscribeConferenceInfo=function(e){return o(this,void 0,void 0,(function(){var t,n,r=this;return i(this,(function(o){switch(o.label){case 0:return t={nodeId:this.nodeId,channels:[e],handler:function(e){var t=e.eventData;switch(t.contentType){case"layout-info":t.callID=r.id,b.MCULayoutEventHandler(r.session,t);break;default:c.default.error("Conference-Info unknown contentType",e)}}},[4,this.session.vertoSubscribe(t).catch((function(e){c.default.error("ConfInfo subscription error:",e)}))];case 1:return n=o.sent(),h.checkSubscribeResponse(n,e)&&this._addChannel(e),[2]}}))}))},e.prototype._confControl=function(e,t){void 0===t&&(t={});var n=r({application:"conf-control",callID:this.id,value:null},t);this.session.vertoBroadcast({nodeId:this.nodeId,channel:e,data:n})},e.prototype._subscribeConferenceModerator=function(e){return o(this,void 0,void 0,(function(){var t,n,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:return t=function(t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var o=parseInt(n)||null;s._confControl(e,{command:t,id:o,value:r})},n=function(){var e=s.options.video;if("boolean"==typeof e&&!e||"object"==typeof e&&v.objEmpty(e))throw"Conference "+s.id+" has no video!"},r={nodeId:this.nodeId,channels:[e],handler:function(e){var t=e.data;switch(t["conf-command"]){case"list-videoLayouts":if(t.responseData){var n=JSON.stringify(t.responseData).replace(/IDS"/g,'Ids"');s._dispatchConferenceUpdate({action:d.ConferenceAction.LayoutList,layouts:JSON.parse(n)})}break;default:s._dispatchConferenceUpdate({action:d.ConferenceAction.ModCmdResponse,command:t["conf-command"],response:t.response})}}},[4,this.session.vertoSubscribe(r).catch((function(e){c.default.error("ConfMod subscription error:",e)}))];case 1:return o=i.sent(),h.checkSubscribeResponse(o,e)&&(this.role=d.Role.Moderator,this._addChannel(e),Object.defineProperties(this,{listVideoLayouts:{configurable:!0,value:function(){t("list-videoLayouts")}},playMedia:{configurable:!0,value:function(e){t("play",null,e)}},stopMedia:{configurable:!0,value:function(){t("stop",null,"all")}},deaf:{configurable:!0,value:function(e){t("deaf",e)}},undeaf:{configurable:!0,value:function(e){t("undeaf",e)}},startRecord:{configurable:!0,value:function(e){t("recording",null,["start",e])}},stopRecord:{configurable:!0,value:function(){t("recording",null,["stop","all"])}},snapshot:{configurable:!0,value:function(e){n(),t("vid-write-png",null,e)}},setVideoLayout:{configurable:!0,value:function(e,r){n(),t("vid-layout",null,r?[e,r]:e)}},kick:{configurable:!0,value:function(e){t("kick",e)}},muteMic:{configurable:!0,value:function(e){t("tmute",e)}},muteVideo:{configurable:!0,value:function(e){n(),t("tvmute",e)}},presenter:{configurable:!0,value:function(e){n(),t("vid-res-id",e,"presenter")}},videoFloor:{configurable:!0,value:function(e){n(),t("vid-floor",e,"force")}},banner:{configurable:!0,value:function(e,r){n(),t("vid-banner",e,encodeURI(r))}},volumeDown:{configurable:!0,value:function(e){t("volume_out",e,"down")}},volumeUp:{configurable:!0,value:function(e){t("volume_out",e,"up")}},gainDown:{configurable:!0,value:function(e){t("volume_in",e,"down")}},gainUp:{configurable:!0,value:function(e){t("volume_in",e,"up")}},transfer:{configurable:!0,value:function(e,n){t("transfer",e,n)}}})),[2]}}))}))},e.prototype._handleChangeHoldStateSuccess=function(e){return"active"===e.holdState?this.setState(d.State.Active):this.setState(d.State.Held),!0},e.prototype._handleChangeHoldStateError=function(e){return c.default.error("Failed to "+e.action+" on call "+this.id),!1},e.prototype._onRemoteSdp=function(e){var t=this,n=h.sdpMediaOrderHack(e,this.peer.instance.localDescription.sdp);this.options.useStereo&&(n=h.sdpStereoHack(n));var r=y.sdpToJsonHack({sdp:n,type:f.PeerType.Answer});this.peer.instance.setRemoteDescription(r).then((function(){t.gotEarly&&t.setState(d.State.Early),t.gotAnswer&&t.setState(d.State.Active)})).catch((function(e){c.default.error("Call setRemoteDescription Error: ",e),t.hangup()}))},e.prototype._requestAnotherLocalDescription=function(){v.isFunction(this.peer.onSdpReadyTwice)?p.trigger(f.SwEvent.Error,new Error("SDP without candidates for the second time!"),this.session.uuid):(Object.defineProperty(this.peer,"onSdpReadyTwice",{value:this._onIceSdp.bind(this)}),this._iceDone=!1,this.peer.startNegotiation())},e.prototype._onIceSdp=function(e){var t=this;this._iceTimeout&&clearTimeout(this._iceTimeout),this._iceTimeout=null,this._iceDone=!0;var n=e.sdp,r=e.type;if(-1!==n.indexOf("candidate")){var o=null,i={sessid:this.session.sessionid,sdp:n,dialogParams:this.options};switch(r){case f.PeerType.Offer:this.setState(d.State.Requesting),o=new u.Invite(i);break;case f.PeerType.Answer:this.setState(d.State.Answering),o=!0===this.options.attach?new u.Attach(i):new u.Answer(i);break;default:return c.default.error(this.id+" - Unknown local SDP type:",e),this.hangup({},!1)}this._execute(o).then((function(e){var n=e.node_id,o=void 0===n?null:n;t._targetNodeId=o,r===f.PeerType.Offer?t.setState(d.State.Trying):t.setState(d.State.Active)})).catch((function(e){c.default.error(t.id+" - Sending "+r+" error:",e),t.hangup()}))}else this._requestAnotherLocalDescription()},e.prototype._registerPeerEvents=function(){var e=this,t=this.peer.instance;this._iceDone=!1,t.onicecandidate=function(n){e._iceDone||(null===e._iceTimeout&&(e._iceTimeout=setTimeout((function(){return e._onIceSdp(t.localDescription)}),1e3)),n.candidate?c.default.info("IceCandidate:",n.candidate):e._onIceSdp(t.localDescription))},t.addEventListener("track",(function(t){e.options.remoteStream=t.streams[0];var n=e.options,r=n.remoteElement,o=n.remoteStream;!1===n.screenShare&&y.attachMediaStream(r,o)})),t.addEventListener("addstream",(function(t){e.options.remoteStream=t.stream}))},e.prototype._onMediaError=function(e){this._dispatchNotification({type:f.NOTIFICATION_TYPE.userMediaError,error:e}),this.hangup({},!1)},e.prototype._dispatchConferenceUpdate=function(e){this._dispatchNotification(r({type:f.NOTIFICATION_TYPE.conferenceUpdate,call:this},e))},e.prototype._dispatchNotification=function(e){!0!==this.options.screenShare&&(p.trigger(f.SwEvent.Notification,e,this.id,!1)||p.trigger(f.SwEvent.Notification,e,this.session.uuid))},e.prototype._execute=function(e){return this.nodeId&&(e.targetNodeId=this.nodeId),this.session.execute(e)},e.prototype._init=function(){var e=this.options,t=e.id,n=e.userVariables,r=e.remoteCallerNumber,o=e.onNotification;t||(this.options.id=a.v4()),this.id=this.options.id,n&&!v.objEmpty(n)||(this.options.userVariables=this.session.options.userVariables||{}),r||(this.options.remoteCallerNumber=this.options.destinationNumber),this.session.calls[this.id]=this,p.register(f.SwEvent.MediaError,this._onMediaError,this.id),v.isFunction(o)&&p.register(f.SwEvent.Notification,o.bind(this),this.id),this.setState(d.State.New),c.default.info("New Call with Options:",this.options)},e.prototype._finalize=function(){var e=this.options,t=e.remoteStream,n=e.localStream,r=e.remoteElement,o=e.localElement;y.stopStream(t),y.stopStream(n),!0!==this.options.screenShare&&(y.detachMediaStream(r),y.detachMediaStream(o)),p.deRegister(f.SwEvent.MediaError,null,this.id),this.peer=null,this.session.calls[this.id]=null,delete this.session.calls[this.id]},e}();t.default=_},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t,n,r,o){void 0===o&&(o={});var i=e.call(this)||this;i.method="login";var s={login:t,passwd:n,userVariables:o,loginParams:{}};return r&&(s.sessid=r),i.buildRequest({method:i.method,params:s}),i}return o(t,e),t}(i(n(28)).default);t.Login=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t,n){var r=e.call(this)||this;return r.buildRequest({id:t,result:{method:n}}),r}return o(t,e),t}(i(n(28)).default);t.Result=s},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(3)),a=n(29),c=n(4),u=n(16),l=n(5),f=n(8),d=function(){function e(e,t){this.type=e,this.options=t,this.onSdpReadyTwice=null,this._negotiating=!1,s.default.info("New Peer with type:",this.type,"Options:",this.options),this._constraints={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this._sdpReady=this._sdpReady.bind(this),this._init()}return e.prototype.startNegotiation=function(){this._negotiating=!0,this._isOffer()?this._createOffer():this._createAnswer()},e.prototype._init=function(){return r(this,void 0,void 0,(function(){var e,t,n,r,i,a,l,d=this;return o(this,(function(o){switch(o.label){case 0:return this.instance=u.RTCPeerConnection(this._config()),this.instance.onsignalingstatechange=function(e){switch(d.instance.signalingState){case"stable":d._negotiating=!1;break;case"closed":d.instance=null;break;default:d._negotiating=!0}},this.instance.onnegotiationneeded=function(e){d._negotiating?s.default.debug("Skip twice onnegotiationneeded.."):d.startNegotiation()},e=this.options,[4,this._retrieveLocalStream().catch((function(e){return f.trigger(c.SwEvent.MediaError,e,d.options.id),null}))];case 1:return e.localStream=o.sent(),t=this.options,n=t.localElement,r=t.localStream,i=void 0===r?null:r,a=t.screenShare,l=void 0!==a&&a,u.streamIsValid(i)?("function"==typeof this.instance.addTrack?i.getTracks().forEach((function(e){return d.instance.addTrack(e,i)})):this.instance.addStream(i),!0!==l&&(u.muteMediaElement(n),u.attachMediaStream(n,i))):null===i&&this.startNegotiation(),[2]}}))}))},e.prototype._createOffer=function(){this._isOffer()&&this.instance.createOffer(this._constraints).then(this._setLocalDescription.bind(this)).then(this._sdpReady).catch((function(e){return s.default.error("Peer _createOffer error:",e)}))},e.prototype._createAnswer=function(){var e=this;if(this._isAnswer()){var t=this.options,n=t.remoteSdp,r=t.useStereo?a.sdpStereoHack(n):n,o=u.sdpToJsonHack({sdp:r,type:c.PeerType.Offer});this.instance.setRemoteDescription(o).then((function(){return e.instance.createAnswer()})).then(this._setLocalDescription.bind(this)).then(this._sdpReady).catch((function(e){return s.default.error("Peer _createAnswer error:",e)}))}},e.prototype._setLocalDescription=function(e){var t=this.options,n=t.useStereo,r=t.googleMaxBitrate,o=t.googleMinBitrate,i=t.googleStartBitrate;return n&&(e.sdp=a.sdpStereoHack(e.sdp)),r&&o&&i&&(e.sdp=a.sdpBitrateHack(e.sdp,r,o,i)),this.instance.setLocalDescription(e)},e.prototype._sdpReady=function(){l.isFunction(this.onSdpReadyTwice)&&this.onSdpReadyTwice(this.instance.localDescription)},e.prototype._retrieveLocalStream=function(){return r(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return u.streamIsValid(this.options.localStream)?[2,this.options.localStream]:[4,a.getMediaConstraints(this.options)];case 1:return e=t.sent(),[2,a.getUserMedia(e)]}}))}))},e.prototype._isOffer=function(){return this.type===c.PeerType.Offer},e.prototype._isAnswer=function(){return this.type===c.PeerType.Answer},e.prototype._config=function(){var e=this.options.iceServers,t={sdpSemantics:"plan-b",bundlePolicy:"max-compat",iceServers:void 0===e?[]:e};return s.default.info("RTC config",t),t},e}();t.default=d},function(e,t,n){"use strict";var r=c(n(47)),o=c(n(57)),i=c(n(62)),s=c(n(68)),a=c(n(69));function c(e){return e&&e.__esModule?e:{default:e}}var u,l=(u=function(e,t){return(u=a.default||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}u(e,t),e.prototype=null===t?(0,s.default)(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,r){return new(n||(n=i.default))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},d=function(e,t){var n,i,s,a,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof o.default&&(a[r.default]=function(){return this}),a;function u(r){return function(o){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,i&&(s=2&r[0]?i.return:r[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return c.label++,{value:r[1],done:!1};case 5:c.label++,i=r[1],r=[0];continue;case 7:r=c.ops.pop(),c.trys.pop();continue;default:if(!(s=(s=c.trys).length>0&&s[s.length-1])&&(6===r[0]||2===r[0])){c=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){c.label=r[1];break}if(6===r[0]&&c.label<s[1]){c.label=s[1],s=r;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(r);break}s[2]&&c.ops.pop(),c.trys.pop();continue}r=t.call(e,c)}catch(e){r=[6,e],i=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,o])}}},p=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var h=p(n(70)),v=n(27),y=p(n(46)),b=n(4),_=n(8),g=n(26),m=p(n(74));t.VERTO_PROTOCOL="verto-protocol";var w=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.relayProtocol=t.VERTO_PROTOCOL,n}return l(n,e),n.prototype.validateOptions=function(){var e=this.options,t=e.host,n=e.login,r=e.passwd,o=e.password;return Boolean(t)&&Boolean(n&&(r||o))},n.prototype.newCall=function(e){var t=e.destinationNumber;if(!(void 0===t?null:t))throw new Error("Verto.newCall() error: destinationNumber is required.");var n=new y.default(this,e);return n.invite(),n},n.prototype.broadcast=function(e){return this.vertoBroadcast(e)},n.prototype.subscribe=function(e){return this.vertoSubscribe(e)},n.prototype.unsubscribe=function(e){return this.vertoUnsubscribe(e)},n.prototype._onSocketOpen=function(){return f(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return d(this,(function(a){switch(a.label){case 0:return this._idle=!1,e=this.options,t=e.login,n=e.password,r=e.passwd,o=e.userVariables,i=new v.Login(t,n||r,this.sessionid,o),[4,this.execute(i).catch(this._handleLoginError)];case 1:return(s=a.sent())&&(this._autoReconnect=!0,this.sessionid=s.sessid,g.localStorage.setItem(b.SESSION_ID,this.sessionid),_.trigger(b.SwEvent.Ready,this,this.uuid)),[2]}}))}))},n.prototype._onSocketMessage=function(e){new m.default(this).handleMessage(e)},n}(h.default);t.default=w}]));
6
+ !function(e,t){for(var n in t)e[n]=t[n]}(this,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(20)),i=function(){return(new Date).toISOString().replace("T"," ").replace("Z","")},s=o.default.getLogger("signalwire"),a=s.methodFactory;s.methodFactory=function(e,t,n){var r=a(e,t,n);return function(){for(var e=[i(),"-"],t=0;t<arguments.length;t++)e.push(arguments[t]);r.apply(void 0,e)}},s.setLevel(s.getLevel()),t.default=s},function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=o(n(0)),s=n(2);t.deepCopy=function(e){return JSON.parse(JSON.stringify(e))},t.objEmpty=function(e){return 0===Object.keys(e).length},t.mutateStorageKey=function(e){return""+s.STORAGE_PREFIX+e},t.mutateLiveArrayData=function(e){var t=r(e,6),n=t[0],o=t[1],s=t[2],a=t[3],c=t[4],u=t[5],l={};try{l=JSON.parse(c.replace(/ID"/g,'Id"'))}catch(e){i.default.warn("Verto LA invalid media JSON string:",c)}return{participantId:Number(n),participantNumber:o,participantName:s,codec:a,media:l,participantData:u}},t.safeParseJson=function(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}},t.isDefined=function(e){return void 0!==e},t.isFunction=function(e){return e instanceof Function||"function"==typeof e},t.findElementByType=function(e){return"object"==typeof document&&"getElementById"in document?"string"==typeof e?document.getElementById(e)||null:"function"==typeof e?e():e instanceof HTMLMediaElement?e:null:null};var a=/^(ws|wss):\/\//;t.checkWebSocketHost=function(e){return""+(a.test(e)?"":"wss://")+e},t.destructResponse=function(e,n){void 0===n&&(n=null);var r=e.result,o=void 0===r?{}:r,i=e.error;if(i)return{error:i};var s=o.result,a=void 0===s?null:s;if(null===a)return null!==n&&(o.node_id=n),{result:o};var c=a.code,u=void 0===c?null:c,l=a.node_id,f=void 0===l?null:l,d=a.result,h=void 0===d?null:d;return u&&"200"!==u?{error:a}:h?t.destructResponse(h,f):{result:a}},t.randomInt=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.STORAGE_PREFIX="@signalwire:",t.ADD="add",t.REMOVE="remove",t.SESSION_ID="sessId",function(e){e.SocketOpen="signalwire.socket.open",e.SocketClose="signalwire.socket.close",e.SocketError="signalwire.socket.error",e.SocketMessage="signalwire.socket.message",e.SpeedTest="signalwire.internal.speedtest",e.Ready="signalwire.ready",e.Error="signalwire.error",e.Notification="signalwire.notification",e.Messages="signalwire.messages",e.Calls="signalwire.calls",e.MediaError="signalwire.rtc.mediaError"}(t.SwEvent||(t.SwEvent={})),function(e){e.Broadcast="blade.broadcast",e.Disconnect="blade.disconnect"}(t.BladeMethod||(t.BladeMethod={}))},function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Offer="offer",e.Answer="answer"}(t.PeerType||(t.PeerType={})),function(e){e.Inbound="inbound",e.Outbound="outbound"}(t.Direction||(t.Direction={})),function(e){e.Invite="verto.invite",e.Attach="verto.attach",e.Answer="verto.answer",e.Info="verto.info",e.Display="verto.display",e.Media="verto.media",e.Event="verto.event",e.Bye="verto.bye",e.Punt="verto.punt",e.Broadcast="verto.broadcast",e.Subscribe="verto.subscribe",e.Unsubscribe="verto.unsubscribe",e.ClientReady="verto.clientReady",e.Modify="verto.modify"}(o=t.VertoMethod||(t.VertoMethod={})),t.NOTIFICATION_TYPE=((r={generic:"event"})[o.Display]="participantData",r[o.Attach]="participantData",r.conferenceUpdate="conferenceUpdate",r.callUpdate="callUpdate",r.vertoClientReady="vertoClientReady",r.userMediaError="userMediaError",r.refreshToken="refreshToken",r),t.DEFAULT_CALL_OPTIONS={destinationNumber:"",remoteCallerName:"Outbound Call",remoteCallerNumber:"",callerName:"",callerNumber:"",audio:!0,video:!1,useStereo:!1,attach:!1,screenShare:!1,userVariables:{}},function(e){e[e.New=0]="New",e[e.Requesting=1]="Requesting",e[e.Trying=2]="Trying",e[e.Recovering=3]="Recovering",e[e.Ringing=4]="Ringing",e[e.Answering=5]="Answering",e[e.Early=6]="Early",e[e.Active=7]="Active",e[e.Held=8]="Held",e[e.Hangup=9]="Hangup",e[e.Destroy=10]="Destroy",e[e.Purge=11]="Purge"}(t.State||(t.State={})),function(e){e.Participant="participant",e.Moderator="moderator"}(t.Role||(t.Role={})),function(e){e.Join="join",e.Leave="leave",e.Bootstrap="bootstrap",e.Add="add",e.Modify="modify",e.Delete="delete",e.Clear="clear",e.ChatMessage="chatMessage",e.LayerInfo="layerInfo",e.LogoInfo="logoInfo",e.LayoutInfo="layoutInfo",e.LayoutList="layoutList",e.ModCmdResponse="modCommandResponse"}(t.ConferenceAction||(t.ConferenceAction={})),function(e){e.Video="videoinput",e.AudioIn="audioinput",e.AudioOut="audiooutput"}(t.DeviceType||(t.DeviceType={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o={},i=function(e,t){return void 0===t&&(t="GLOBAL"),o.hasOwnProperty(e)&&o[e].hasOwnProperty(t)};t.isQueued=i;t.queueLength=function(e,t){return void 0===t&&(t="GLOBAL"),i(e,t)?o[e][t].length:0};var s=function(e,t,n){void 0===n&&(n="GLOBAL"),o.hasOwnProperty(e)||(o[e]={}),o[e].hasOwnProperty(n)||(o[e][n]=[]),o[e][n].push(t)};t.register=s;t.registerOnce=function(e,t,n){void 0===n&&(n="GLOBAL");var r=function(o){a(e,r,n),t(o)};return r.prototype.targetRef=t,s(e,r,n)};var a=function(e,t,n){if(void 0===n&&(n="GLOBAL"),!i(e,n))return!1;if(r.isFunction(t))for(var s=o[e][n].length-1;s>=0;s--){var a=o[e][n][s];(t===a||a.prototype&&t===a.prototype.targetRef)&&o[e][n].splice(s,1)}else o[e][n]=[];return 0===o[e][n].length&&(delete o[e][n],r.objEmpty(o[e])&&delete o[e]),!0};t.deRegister=a;var c=function(e,t,n,r){void 0===n&&(n="GLOBAL"),void 0===r&&(r=!0);var s=r&&"GLOBAL"!==n;if(!i(e,n))return s&&c(e,t),!1;var a=o[e][n].length;if(!a)return s&&c(e,t),!1;for(var u=a-1;u>=0;u--)o[e][n][u](t);return s&&c(e,t),!0};t.trigger=c;t.deRegisterAll=function(e){delete o[e]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o=n(13),i=function(){function e(){}return e.prototype.buildRequest=function(e){this.request=r({jsonrpc:"2.0",id:o.v4()},e)},e}();t.default=i},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(1);t.RTCPeerConnection=function(e){return new window.RTCPeerConnection(e)};t.getUserMedia=function(e){return navigator.mediaDevices.getUserMedia(e)};t.getDisplayMedia=function(e){return navigator.mediaDevices.getDisplayMedia(e)};t.enumerateDevices=function(){return navigator.mediaDevices.enumerateDevices()};t.getSupportedConstraints=function(){return navigator.mediaDevices.getSupportedConstraints()};var s=function(e){return e&&e instanceof MediaStream};t.streamIsValid=s;t.attachMediaStream=function(e,t){var n=i.findElementByType(e);null!==n&&(n.getAttribute("autoplay")||n.setAttribute("autoplay","autoplay"),n.getAttribute("playsinline")||n.setAttribute("playsinline","playsinline"),n.srcObject=t)};t.detachMediaStream=function(e){var t=i.findElementByType(e);t&&(t.srcObject=null)};t.muteMediaElement=function(e){var t=i.findElementByType(e);t&&(t.muted=!0)};t.unmuteMediaElement=function(e){var t=i.findElementByType(e);t&&(t.muted=!1)};t.toggleMuteMediaElement=function(e){var t=i.findElementByType(e);t&&(t.muted=!t.muted)};t.setMediaElementSinkId=function(e,t){return r(void 0,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:if(null===(n=i.findElementByType(e)))return[2,!1];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n.setSinkId(t)];case 2:return r.sent(),[2,!0];case 3:return r.sent(),[2,!1];case 4:return[2]}}))}))};t.sdpToJsonHack=function(e){return e};t.stopStream=function(e){s(e)&&e.getTracks().forEach((function(e){return e.stop()})),e=null}},function(e,t,n){"use strict";(function(e){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),s=function(){return"undefined"==typeof window&&void 0!==e},a=function(e,t){return r(void 0,void 0,void 0,(function(){var n;return o(this,(function(r){return s()?[2,null]:(n=window[e].getItem(i.mutateStorageKey(t)),[2,i.safeParseJson(n)])}))}))},c=function(e,t,n){return r(void 0,void 0,void 0,(function(){return o(this,(function(r){return s()?[2,null]:("object"==typeof n&&(n=JSON.stringify(n)),window[e].setItem(i.mutateStorageKey(t),n),[2])}))}))},u=function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return s()?[2,null]:[2,window[e].removeItem(i.mutateStorageKey(t))]}))}))};t.localStorage={getItem:function(e){return a("localStorage",e)},setItem:function(e,t){return c("localStorage",e,t)},removeItem:function(e){return u("localStorage",e)}},t.sessionStorage={getItem:function(e){return a("sessionStorage",e)},setItem:function(e,t){return c("sessionStorage",e,t)},removeItem:function(e){return u("sessionStorage",e)}}}).call(this,n(28))},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(9)),a=n(31);t.Login=a.Login;var c=n(32);t.Result=c.Result;var u=n(3),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Invite},t}(s.default);t.Invite=l;var f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Answer},t}(s.default);t.Answer=f;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Attach},t}(s.default);t.Attach=d;var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Bye},t}(s.default);t.Bye=h;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Modify},t}(s.default);t.Modify=p;var v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Info},t}(s.default);t.Info=v;var y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Broadcast},t}(s.default);t.Broadcast=y;var b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Subscribe},t}(s.default);t.Subscribe=b;var _=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.toString=function(){return u.VertoMethod.Unsubscribe},t}(s.default);t.Unsubscribe=_},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(5)),c={id:"callID",destinationNumber:"destination_number",remoteCallerName:"remote_caller_id_name",remoteCallerNumber:"remote_caller_id_number",callerName:"caller_id_name",callerNumber:"caller_id_number"},u=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;if(t.hasOwnProperty("dialogParams")){var r=t.dialogParams,o=(r.remoteSdp,r.localStream,r.remoteStream,r.onNotification,r.camId,r.micId,r.speakerId,i(r,["remoteSdp","localStream","remoteStream","onNotification","camId","micId","speakerId"]));for(var s in c)s&&o.hasOwnProperty(s)&&(o[c[s]]=o[s],delete o[s]);t.dialogParams=o}return n.buildRequest({method:n.toString(),params:t}),n}return o(t,e),t}(a.default);t.default=u},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},s=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var u=a(n(0)),l=c(n(6)),f=n(1),d=n(3),h=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r;return o(this,(function(o){switch(o.label){case 0:if(u.default.info("RTCService.getUserMedia",e),t=e.audio,n=e.video,!t&&!n)return[2,null];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,l.getUserMedia(e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),u.default.error("getUserMedia error: ",r),r;case 4:return[2]}}))}))};t.getUserMedia=h;var p=function(e){return void 0===e&&(e=null),{audio:!e||e===d.DeviceType.AudioIn,video:!e||e===d.DeviceType.Video}},v=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),r(void 0,void 0,void 0,(function(){var n,r,i;return o(this,(function(o){switch(o.label){case 0:return[4,l.enumerateDevices().catch((function(e){return[]}))];case 1:return n=o.sent(),e&&(n=n.filter((function(t){return t.kind===e}))),n.length&&n.every((function(e){return e.deviceId&&e.label}))?[3,3]:[4,l.getUserMedia(p(e))];case 2:return r=o.sent(),l.stopStream(r),[2,v(e)];case 3:return!0===t?[2,n]:(i=[],[2,n=n.filter((function(e){var t=e.kind,n=e.groupId;if(!n)return!0;var r=t+"-"+n;return!i.includes(r)&&(i.push(r),!0)}))])}}))}))};t.getDevices=v;var y=[[320,240],[640,360],[640,480],[1280,720],[1920,1080]];t.scanResolutions=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,s,a,c,u;return o(this,(function(o){switch(o.label){case 0:return t=[],[4,h({video:{deviceId:{exact:e}}})];case 1:n=o.sent(),r=n.getVideoTracks()[0],s=0,o.label=2;case 2:return s<y.length?(a=i(y[s],2),c=a[0],u=a[1],[4,r.applyConstraints({width:{exact:c},height:{exact:u}}).then((function(){return!0})).catch((function(){return!1}))]):[3,5];case 3:o.sent()&&t.push({resolution:c+"x"+u,width:c,height:u}),o.label=4;case 4:return s++,[3,2];case 5:return l.stopStream(n),[2,t]}}))}))};t.getMediaConstraints=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,i,s,a,c,u,l,f;return o(this,(function(o){switch(o.label){case 0:return t=e.audio,n=void 0===t||t,r=e.micId,i=e.micLabel,s=void 0===i?"":i,r?[4,b(r,s,d.DeviceType.AudioIn).catch((function(e){return null}))]:[3,2];case 1:(r=o.sent())&&("boolean"==typeof n&&(n={}),n.deviceId={exact:r}),o.label=2;case 2:return a=e.video,c=void 0!==a&&a,u=e.camId,l=e.camLabel,f=void 0===l?"":l,u?[4,b(u,f,d.DeviceType.Video).catch((function(e){return null}))]:[3,4];case 3:(u=o.sent())&&("boolean"==typeof c&&(c={}),c.deviceId={exact:u}),o.label=4;case 4:return[2,{audio:n,video:c}]}}))}))};var b=function(e,t,n){return r(void 0,void 0,void 0,(function(){var r,i,s,a,c;return o(this,(function(o){switch(o.label){case 0:return[4,v(n,!0)];case 1:for(r=o.sent(),i=0;i<r.length;i++)if(s=r[i],a=s.deviceId,c=s.label,e===a||t===c)return[2,a];return[2,null]}}))}))};t.assureDeviceId=b;t.removeUnsupportedConstraints=function(e){var t=l.getSupportedConstraints();Object.keys(e).map((function(n){t.hasOwnProperty(n)&&null!==e[n]&&void 0!==e[n]||delete e[n]}))};t.checkDeviceIdConstraints=function(e,t,n,i){return r(void 0,void 0,void 0,(function(){var r,s;return o(this,(function(o){switch(o.label){case 0:return r=i.deviceId,f.isDefined(r)||!e&&!t?[3,2]:[4,b(e,t,n).catch((function(e){return null}))];case 1:(s=o.sent())&&(i.deviceId={exact:s}),o.label=2;case 2:return[2,i]}}))}))};t.sdpStereoHack=function(e){var t=e.split("\r\n"),n=t.findIndex((function(e){return/^a=rtpmap/.test(e)&&/opus\/48000/.test(e)}));if(n<0)return e;var r=function(e){var t=new RegExp("a=rtpmap:(\\d+) \\w+\\/\\d+"),n=e.match(t);return n&&2==n.length?n[1]:null}(t[n]),o=new RegExp("a=fmtp:"+r),i=t.findIndex((function(e){return o.test(e)}));return i>=0?/stereo=1;/.test(t[i])||(t[i]+="; stereo=1; sprop-stereo=1"):t[n]+="\r\na=fmtp:"+r+" stereo=1; sprop-stereo=1",t.join("\r\n")};var _=function(e){return/^m=audio/.test(e)},g=function(e){return/^m=video/.test(e)};t.sdpMediaOrderHack=function(e,t){var n=t.split("\r\n");if(n.findIndex(_)<n.findIndex(g))return e;var r=e.split("\r\n"),o=r.findIndex(_),i=r.findIndex(g),a=r.slice(o,i),c=r.slice(i,r.length-1),u=r.slice(0,o);return s(u,c,a,[""]).join("\r\n")};t.checkSubscribeResponse=function(e,t){if(!e)return!1;var n=m(e),r=n.subscribed,o=n.alreadySubscribed;return r.includes(t)||o.includes(t)};var m=function(e){var t={subscribed:[],alreadySubscribed:[],unauthorized:[],unsubscribed:[],notSubscribed:[]};return Object.keys(t).forEach((function(n){t[n]=e[n+"Channels"]||[]})),t};t.destructSubscribeResponse=m;t.enableAudioTracks=function(e){w(e,"audio",!0)};t.disableAudioTracks=function(e){w(e,"audio",!1)};t.toggleAudioTracks=function(e){w(e,"audio",null)};t.enableVideoTracks=function(e){w(e,"video",!0)};t.disableVideoTracks=function(e){w(e,"video",!1)};t.toggleVideoTracks=function(e){w(e,"video",null)};var w=function(e,t,n){if(void 0===t&&(t=null),void 0===n&&(n=null),!l.streamIsValid(e))return null;var r=[];switch(t){case"audio":r=e.getAudioTracks();break;case"video":r=e.getVideoTracks();break;default:r=e.getTracks()}r.forEach((function(e){switch(n){case"on":case!0:e.enabled=!0;break;case"off":case!1:e.enabled=!1;break;default:e.enabled=!e.enabled}}))};t.sdpBitrateHack=function(e,t,n,r){var o=e.split("\r\n");return o.forEach((function(e,i){/^a=fmtp:\d*/.test(e)?o[i]+=";x-google-max-bitrate="+t+";x-google-min-bitrate="+n+";x-google-start-bitrate="+r:/^a=mid:(1|video)/.test(e)&&(o[i]+="\r\nb=AS:"+t)})),o.join("\r\n")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(15);t.Connect=r.Connect;var o=n(24);t.Execute=o.Execute;var i=n(25);t.Subscription=i.Subscription;var s=n(26);t.Reauthenticate=s.Reauthenticate;var a=n(27);t.Ping=a.Ping},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=c(n(0)),l=c(n(30)),f=n(6),d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._statsInterval=null,t}return o(t,e),t.prototype.hangup=function(n,r){void 0===n&&(n={}),void 0===r&&(r=!0),this.screenShare instanceof t&&this.screenShare.hangup(n,r),e.prototype.hangup.call(this,n,r)},t.prototype.startScreenShare=function(e){return s(this,void 0,void 0,(function(){var n,r,o,s,c,u,l,d=this;return a(this,(function(a){switch(a.label){case 0:return[4,f.getDisplayMedia({video:!0})];case 1:return(n=a.sent()).getTracks().forEach((function(e){e.addEventListener("ended",(function(){d.screenShare&&d.screenShare.hangup()}))})),r=this.options,o=r.remoteCallerName,s=r.remoteCallerNumber,c=r.callerName,u=r.callerNumber,l=i({screenShare:!0,localStream:n,destinationNumber:this.extension+"-screen",remoteCallerName:o,remoteCallerNumber:s+"-screen",callerName:c+" (Screen)",callerNumber:u+" (Screen)"},e),this.screenShare=new t(this.session,l),this.screenShare.invite(),[2,this.screenShare]}}))}))},t.prototype.stopScreenShare=function(){this.screenShare instanceof t&&this.screenShare.hangup()},t.prototype.setAudioOutDevice=function(e){return s(this,void 0,void 0,(function(){var t,n,r;return a(this,(function(o){return this.options.speakerId=e,t=this.options,n=t.remoteElement,r=t.speakerId,n&&r?[2,f.setMediaElementSinkId(n,r)]:[2,!1]}))}))},t.prototype._finalize=function(){this._stats(!1),e.prototype._finalize.call(this)},t.prototype._stats=function(e){var t=this;if(void 0===e&&(e=!0),!1===e)return clearInterval(this._statsInterval);u.default.setLevel(2),this._statsInterval=window.setInterval((function(){return s(t,void 0,void 0,(function(){var e,t,n,r;return a(this,(function(o){switch(o.label){case 0:return[4,this.peer.instance.getStats(null)];case 1:return e=o.sent(),t="",n=["certificate","codec","peer-connection","stream","local-candidate","remote-candidate"],r=["id","type","timestamp"],e.forEach((function(e){n.includes(e.type)||(t+="\n"+e.type+"\n",Object.keys(e).forEach((function(n){r.includes(n)||(t+="\t"+n+": "+e[n]+"\n")})))})),u.default.info(t),[2]}}))}))}),2e3)},t}(l.default);t.default=d},function(e,t,n){"use strict";var r;n.r(t),n.d(t,"v1",(function(){return v})),n.d(t,"v3",(function(){return k})),n.d(t,"v4",(function(){return E})),n.d(t,"v5",(function(){return T})),n.d(t,"NIL",(function(){return x})),n.d(t,"version",(function(){return M})),n.d(t,"validate",(function(){return a})),n.d(t,"stringify",(function(){return d})),n.d(t,"parse",(function(){return y}));var o=new Uint8Array(16);function i(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}var s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var a=function(e){return"string"==typeof e&&s.test(e)},c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));var l,f,d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!a(n))throw TypeError("Stringified UUID is invalid");return n},h=0,p=0;var v=function(e,t,n){var r=t&&n||0,o=t||new Array(16),s=(e=e||{}).node||l,a=void 0!==e.clockseq?e.clockseq:f;if(null==s||null==a){var c=e.random||(e.rng||i)();null==s&&(s=l=[1|c[0],c[1],c[2],c[3],c[4],c[5]]),null==a&&(a=f=16383&(c[6]<<8|c[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),v=void 0!==e.nsecs?e.nsecs:p+1,y=u-h+(v-p)/1e4;if(y<0&&void 0===e.clockseq&&(a=a+1&16383),(y<0||u>h)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=u,p=v,f=a;var b=(1e4*(268435455&(u+=122192928e5))+v)%4294967296;o[r++]=b>>>24&255,o[r++]=b>>>16&255,o[r++]=b>>>8&255,o[r++]=255&b;var _=u/4294967296*1e4&268435455;o[r++]=_>>>8&255,o[r++]=255&_,o[r++]=_>>>24&15|16,o[r++]=_>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var g=0;g<6;++g)o[r+g]=s[g];return t||d(o)};var y=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};var b=function(e,t,n){function r(e,r,o,i){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof r&&(r=y(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var s=new Uint8Array(16+e.length);if(s.set(r),s.set(e,r.length),(s=n(s))[6]=15&s[6]|t,s[8]=63&s[8]|128,o){i=i||0;for(var a=0;a<16;++a)o[i+a]=s[a];return o}return d(s)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r};function _(e){return 14+(e+64>>>9<<4)+1}function g(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t,n,r,o,i){return g((s=g(g(t,e),g(r,i)))<<(a=o)|s>>>32-a,n);var s,a}function w(e,t,n,r,o,i,s){return m(t&n|~t&r,e,t,o,i,s)}function S(e,t,n,r,o,i,s){return m(t&r|n&~r,e,t,o,i,s)}function O(e,t,n,r,o,i,s){return m(t^n^r,e,t,o,i,s)}function I(e,t,n,r,o,i,s){return m(n^(t|~r),e,t,o,i,s)}var k=b("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){for(var t=[],n=32*e.length,r=0;r<n;r+=8){var o=e[r>>5]>>>r%32&255,i=parseInt("0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[_(t)-1]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,s=0;s<e.length;s+=16){var a=n,c=r,u=o,l=i;n=w(n,r,o,i,e[s],7,-680876936),i=w(i,n,r,o,e[s+1],12,-389564586),o=w(o,i,n,r,e[s+2],17,606105819),r=w(r,o,i,n,e[s+3],22,-1044525330),n=w(n,r,o,i,e[s+4],7,-176418897),i=w(i,n,r,o,e[s+5],12,1200080426),o=w(o,i,n,r,e[s+6],17,-1473231341),r=w(r,o,i,n,e[s+7],22,-45705983),n=w(n,r,o,i,e[s+8],7,1770035416),i=w(i,n,r,o,e[s+9],12,-1958414417),o=w(o,i,n,r,e[s+10],17,-42063),r=w(r,o,i,n,e[s+11],22,-1990404162),n=w(n,r,o,i,e[s+12],7,1804603682),i=w(i,n,r,o,e[s+13],12,-40341101),o=w(o,i,n,r,e[s+14],17,-1502002290),r=w(r,o,i,n,e[s+15],22,1236535329),n=S(n,r,o,i,e[s+1],5,-165796510),i=S(i,n,r,o,e[s+6],9,-1069501632),o=S(o,i,n,r,e[s+11],14,643717713),r=S(r,o,i,n,e[s],20,-373897302),n=S(n,r,o,i,e[s+5],5,-701558691),i=S(i,n,r,o,e[s+10],9,38016083),o=S(o,i,n,r,e[s+15],14,-660478335),r=S(r,o,i,n,e[s+4],20,-405537848),n=S(n,r,o,i,e[s+9],5,568446438),i=S(i,n,r,o,e[s+14],9,-1019803690),o=S(o,i,n,r,e[s+3],14,-187363961),r=S(r,o,i,n,e[s+8],20,1163531501),n=S(n,r,o,i,e[s+13],5,-1444681467),i=S(i,n,r,o,e[s+2],9,-51403784),o=S(o,i,n,r,e[s+7],14,1735328473),r=S(r,o,i,n,e[s+12],20,-1926607734),n=O(n,r,o,i,e[s+5],4,-378558),i=O(i,n,r,o,e[s+8],11,-2022574463),o=O(o,i,n,r,e[s+11],16,1839030562),r=O(r,o,i,n,e[s+14],23,-35309556),n=O(n,r,o,i,e[s+1],4,-1530992060),i=O(i,n,r,o,e[s+4],11,1272893353),o=O(o,i,n,r,e[s+7],16,-155497632),r=O(r,o,i,n,e[s+10],23,-1094730640),n=O(n,r,o,i,e[s+13],4,681279174),i=O(i,n,r,o,e[s],11,-358537222),o=O(o,i,n,r,e[s+3],16,-722521979),r=O(r,o,i,n,e[s+6],23,76029189),n=O(n,r,o,i,e[s+9],4,-640364487),i=O(i,n,r,o,e[s+12],11,-421815835),o=O(o,i,n,r,e[s+15],16,530742520),r=O(r,o,i,n,e[s+2],23,-995338651),n=I(n,r,o,i,e[s],6,-198630844),i=I(i,n,r,o,e[s+7],10,1126891415),o=I(o,i,n,r,e[s+14],15,-1416354905),r=I(r,o,i,n,e[s+5],21,-57434055),n=I(n,r,o,i,e[s+12],6,1700485571),i=I(i,n,r,o,e[s+3],10,-1894986606),o=I(o,i,n,r,e[s+10],15,-1051523),r=I(r,o,i,n,e[s+1],21,-2054922799),n=I(n,r,o,i,e[s+8],6,1873313359),i=I(i,n,r,o,e[s+15],10,-30611744),o=I(o,i,n,r,e[s+6],15,-1560198380),r=I(r,o,i,n,e[s+13],21,1309151649),n=I(n,r,o,i,e[s+4],6,-145523070),i=I(i,n,r,o,e[s+11],10,-1120210379),o=I(o,i,n,r,e[s+2],15,718787259),r=I(r,o,i,n,e[s+9],21,-343485551),n=g(n,a),r=g(r,c),o=g(o,u),i=g(i,l)}return[n,r,o,i]}(function(e){if(0===e.length)return[];for(var t=8*e.length,n=new Uint32Array(_(t)),r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))}));var E=function(e,t,n){var r=(e=e||{}).random||(e.rng||i)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return d(r)};function C(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function P(e,t){return e<<t|e>>>32-t}var T=b("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var o=0;o<r.length;++o)e.push(r.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var i=e.length/4+2,s=Math.ceil(i/16),a=new Array(s),c=0;c<s;++c){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=e[64*c+4*l]<<24|e[64*c+4*l+1]<<16|e[64*c+4*l+2]<<8|e[64*c+4*l+3];a[c]=u}a[s-1][14]=8*(e.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<s;++f){for(var d=new Uint32Array(80),h=0;h<16;++h)d[h]=a[f][h];for(var p=16;p<80;++p)d[p]=P(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var v=n[0],y=n[1],b=n[2],_=n[3],g=n[4],m=0;m<80;++m){var w=Math.floor(m/20),S=P(v,5)+C(w,y,b,_)+g+t[w]+d[m]>>>0;g=_,_=b,b=P(y,30)>>>0,y=v,v=S}n[0]=n[0]+v>>>0,n[1]=n[1]+y>>>0,n[2]=n[2]+b>>>0,n[3]=n[3]+_>>>0,n[4]=n[4]+g>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),x="00000000-0000-0000-0000-000000000000";var M=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=c(n(0)),l=c(n(21)),f=n(4),d=n(2),h=n(3),p=n(10),v=n(1),y=n(8),b=n(7),_=n(6),g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.calls={},t.autoRecoverCalls=!0,t._iceServers=[],t._localElement=null,t._remoteElement=null,t._jwtAuth=!0,t._devices={},t._audioConstraints=!0,t._videoConstraints=!1,t._speaker=null,t}return o(t,e),Object.defineProperty(t.prototype,"reconnectDelay",{get:function(){return 1e3},enumerable:!0,configurable:!0}),t.prototype.connect=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return t=this,[4,b.localStorage.getItem(d.SESSION_ID)];case 1:return t.sessionid=n.sent(),e.prototype.connect.call(this),[2]}}))}))},t.prototype.checkPermissions=function(e,t){return void 0===e&&(e=!0),void 0===t&&(t=!0),i(this,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,p.getUserMedia({audio:e,video:t})];case 1:return n=r.sent(),_.stopStream(n),[2,!0];case 2:return r.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.logout=function(){this.disconnect()},t.prototype.disconnect=function(){return i(this,void 0,void 0,(function(){var t=this;return s(this,(function(n){switch(n.label){case 0:return Object.keys(this.calls).forEach((function(e){return t.calls[e].setState(h.State.Purge)})),this.calls={},[4,e.prototype.disconnect.call(this)];case 1:return n.sent(),[2]}}))}))},t.prototype.speedTest=function(e){var t=this;return new Promise((function(n,r){if(f.registerOnce(d.SwEvent.SpeedTest,(function(t){var r=t.upDur,o=t.downDur,i=o?8*e/(o/1e3)/1024:0;n({upDur:r,downDur:o,upKps:(r?8*e/(r/1e3)/1024:0).toFixed(0),downKps:i.toFixed(0)})}),t.uuid),!(e=Number(e)))return r("Invalid parameter 'bytes': "+e);t.executeRaw("#SPU "+e);var o=e/1024;e%1024&&o++;for(var i=".".repeat(1024),s=0;s<o;s++)t.executeRaw("#SPB "+i);t.executeRaw("#SPE")}))},t.prototype.getDevices=function(){var e=this;return p.getDevices().catch((function(t){return f.trigger(d.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getVideoDevices=function(){var e=this;return p.getDevices(h.DeviceType.Video).catch((function(t){return f.trigger(d.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getAudioInDevices=function(){var e=this;return p.getDevices(h.DeviceType.AudioIn).catch((function(t){return f.trigger(d.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getAudioOutDevices=function(){var e=this;return p.getDevices(h.DeviceType.AudioOut).catch((function(t){return f.trigger(d.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.validateDeviceId=function(e,t,n){return p.assureDeviceId(e,t,n)},t.prototype.refreshDevices=function(){return i(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return u.default.warn("This method has been deprecated. Use getDevices() instead."),e={},["videoinput","audioinput","audiooutput"].map((function(t){e[t]={},Object.defineProperty(e[t],"toArray",{value:function(){var e=this;return Object.keys(this).map((function(t){return e[t]}))}})})),[4,this.getDevices()];case 1:return t.sent().forEach((function(t){e.hasOwnProperty(t.kind)&&(e[t.kind][t.deviceId]=t)})),this._devices=e,[2,this.devices]}}))}))},Object.defineProperty(t.prototype,"devices",{get:function(){return this._devices||{}},enumerable:!0,configurable:!0}),t.prototype.getDeviceResolutions=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,p.scanResolutions(e)];case 1:return[2,t.sent()];case 2:throw t.sent();case 3:return[2]}}))}))},Object.defineProperty(t.prototype,"videoDevices",{get:function(){return u.default.warn("This property has been deprecated. Use getVideoDevices() instead."),this._devices.videoinput||{}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"audioInDevices",{get:function(){return u.default.warn("This property has been deprecated. Use getAudioInDevices() instead."),this._devices.audioinput||{}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"audioOutDevices",{get:function(){return u.default.warn("This property has been deprecated. Use getAudioOutDevices() instead."),this._devices.audiooutput||{}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mediaConstraints",{get:function(){return{audio:this._audioConstraints,video:this._videoConstraints}},enumerable:!0,configurable:!0}),t.prototype.setAudioSettings=function(e){return i(this,void 0,void 0,(function(){var t,n,r,o;return s(this,(function(i){switch(i.label){case 0:return t=e.micId,n=e.micLabel,r=a(e,["micId","micLabel"]),p.removeUnsupportedConstraints(r),o=this,[4,p.checkDeviceIdConstraints(t,n,"audioinput",r)];case 1:return o._audioConstraints=i.sent(),this.micId=t,this.micLabel=n,[2,this._audioConstraints]}}))}))},t.prototype.disableMicrophone=function(){this._audioConstraints=!1},t.prototype.enableMicrophone=function(){this._audioConstraints=!0},t.prototype.setVideoSettings=function(e){return i(this,void 0,void 0,(function(){var t,n,r,o;return s(this,(function(i){switch(i.label){case 0:return t=e.camId,n=e.camLabel,r=a(e,["camId","camLabel"]),p.removeUnsupportedConstraints(r),o=this,[4,p.checkDeviceIdConstraints(t,n,"videoinput",r)];case 1:return o._videoConstraints=i.sent(),this.camId=t,this.camLabel=n,[2,this._videoConstraints]}}))}))},t.prototype.disableWebcam=function(){this._videoConstraints=!1},t.prototype.enableWebcam=function(){this._videoConstraints=!0},Object.defineProperty(t.prototype,"iceServers",{get:function(){return this._iceServers},set:function(e){this._iceServers="boolean"==typeof e?e?[{urls:["stun:stun.l.google.com:19302"]}]:[]:e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"speaker",{get:function(){return this._speaker},set:function(e){this._speaker=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localElement",{get:function(){return this._localElement},set:function(e){this._localElement=v.findElementByType(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"remoteElement",{get:function(){return this._remoteElement},set:function(e){this._remoteElement=v.findElementByType(e)},enumerable:!0,configurable:!0}),t.prototype.vertoBroadcast=function(e){var t=e.nodeId,n=e.channel,r=void 0===n?"":n,o=e.data;if(!r)throw new Error("Invalid channel for broadcast: "+r);var i=new y.Broadcast({sessid:this.sessionid,eventChannel:r,data:o});t&&(i.targetNodeId=t),this.execute(i).catch((function(e){return e}))},t.prototype.vertoSubscribe=function(e){var t=e.nodeId,n=e.channels,r=void 0===n?[]:n,o=e.handler;return i(this,void 0,void 0,(function(){var e,n,i,a,c,u,l,f=this;return s(this,(function(s){switch(s.label){case 0:return(r=r.filter((function(e){return e&&!f._existsSubscription(f.relayProtocol,e)}))).length?(e=new y.Subscribe({sessid:this.sessionid,eventChannel:r}),t&&(e.targetNodeId=t),[4,this.execute(e)]):[2,{}];case 1:return n=s.sent(),i=p.destructSubscribeResponse(n),a=i.unauthorized,c=void 0===a?[]:a,u=i.subscribed,l=void 0===u?[]:u,c.length&&c.forEach((function(e){return f._removeSubscription(f.relayProtocol,e)})),l.forEach((function(e){return f._addSubscription(f.relayProtocol,o,e)})),[2,n]}}))}))},t.prototype.vertoUnsubscribe=function(e){var t=e.nodeId,n=e.channels,r=void 0===n?[]:n;return i(this,void 0,void 0,(function(){var e,n,o,i,a,c,u,l=this;return s(this,(function(s){switch(s.label){case 0:return(r=r.filter((function(e){return e&&l._existsSubscription(l.relayProtocol,e)}))).length?(e=new y.Unsubscribe({sessid:this.sessionid,eventChannel:r}),t&&(e.targetNodeId=t),[4,this.execute(e)]):[2,{}];case 1:return n=s.sent(),o=p.destructSubscribeResponse(n),i=o.unsubscribed,a=void 0===i?[]:i,c=o.notSubscribed,u=void 0===c?[]:c,a.forEach((function(e){return l._removeSubscription(l.relayProtocol,e)})),u.forEach((function(e){return l._removeSubscription(l.relayProtocol,e)})),[2,n]}}))}))},t}(l.default);t.default=g},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(5)),a=null;t.setAgentName=function(e){a=e};var c=function(e){function t(t,n){var r=e.call(this)||this;r.method="blade.connect";var o={version:{major:2,minor:1,revision:0},authentication:t};return n&&(o.sessionid=n),a&&(o.agent=a),r.buildRequest({method:r.method,params:o}),r}return o(t,e),t}(s.default);t.Connect=c},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(0)),a=i(n(12)),c=n(10),u=n(8),l=n(2),f=n(3),d=n(4),h=n(3),p=n(17),v=function(){function e(e){this.session=e}return e.prototype._ack=function(e,t){var n=new u.Result(e,t);this.nodeId&&(n.targetNodeId=this.nodeId),this.session.execute(n)},e.prototype.handleMessage=function(e){var t=this,n=this.session,r=e.id,o=e.method,i=e.params,c=i.callID,u=i.eventChannel,p=i.eventType,v=o===f.VertoMethod.Attach;if("channelPvtData"===p)return this._handlePvtEvent(i.pvtData);if(c&&n.calls.hasOwnProperty(c)){if(!v)return n.calls[c].handleMessage(e),void this._ack(r,o);n.calls[c].hangup({},!1)}var y=function(){var e=new a.default(n,{id:c,remoteSdp:i.sdp,destinationNumber:i.callee_id_number,remoteCallerName:i.caller_id_name,remoteCallerNumber:i.caller_id_number,callerName:i.callee_id_name,callerNumber:i.callee_id_number,attach:v});return e.nodeId=t.nodeId,e};switch(o){case f.VertoMethod.Punt:n.disconnect();break;case f.VertoMethod.Invite:(b=y()).setState(h.State.Ringing),this._ack(r,o);break;case f.VertoMethod.Attach:var b=y();this.session.autoRecoverCalls?b.answer():b.setState(h.State.Recovering),b.handleMessage(e);break;case f.VertoMethod.Event:case"webrtc.event":if(!u)return void s.default.error("Verto received an unknown event:",i);var _=n.relayProtocol,g=u.split(".")[0];n._existsSubscription(_,u)?d.trigger(_,i,u):u===n.sessionid?this._handleSessionEvent(i.eventData):n._existsSubscription(_,g)?d.trigger(_,i,g):n.calls.hasOwnProperty(u)?n.calls[u].handleMessage(e):d.trigger(l.SwEvent.Notification,i,n.uuid);break;case f.VertoMethod.Info:i.type=f.NOTIFICATION_TYPE.generic,d.trigger(l.SwEvent.Notification,i,n.uuid);break;case f.VertoMethod.ClientReady:i.type=f.NOTIFICATION_TYPE.vertoClientReady,d.trigger(l.SwEvent.Notification,i,n.uuid);break;default:s.default.warn("Verto message unknown method:",e)}},e.prototype._retrieveCallId=function(e,t){var n=this,r=Object.keys(this.session.calls);if("bootObj"!==e.action)return r.find((function(e){return n.session.calls[e].channels.includes(t)}));var o=e.data.find((function(e){return r.includes(e[0])}));return o instanceof Array?o[0]:void 0},e.prototype._handlePvtEvent=function(e){return r(this,void 0,void 0,(function(){var t,n,r,i,a,u,p,v,y,b,_,g,m,w,S,O,I,k,E,C=this;return o(this,(function(o){switch(o.label){case 0:switch(t=this.session,n=t.relayProtocol,r=e.action,i=e.laChannel,a=e.laName,u=e.chatChannel,p=e.infoChannel,v=e.modChannel,y=e.conferenceMemberID,b=e.role,_=e.callID,r){case"conference-liveArray-join":return[3,1];case"conference-liveArray-part":return[3,3]}return[3,4];case 1:return g=function(){t.vertoBroadcast({nodeId:C.nodeId,channel:i,data:{liveArray:{command:"bootstrap",context:i,name:a}}})},m={nodeId:this.nodeId,channels:[i],handler:function(n){var r=n.data,o=_||C._retrieveCallId(r,i);if(o&&t.calls.hasOwnProperty(o)){var s=t.calls[o];s._addChannel(i),s.extension=a,s.handleConferenceUpdate(r,e).then((function(e){"INVALID_PACKET"===e&&g()}))}}},[4,t.vertoSubscribe(m).catch((function(e){s.default.error("liveArray subscription error:",e)}))];case 2:return w=o.sent(),c.checkSubscribeResponse(w,i)&&g(),[3,4];case 3:return S=null,i&&t._existsSubscription(n,i)&&(O=t.subscriptions[n][i].callId,I=void 0===O?null:O,S=t.calls[I]||null,null!==I&&(k={type:f.NOTIFICATION_TYPE.conferenceUpdate,action:h.ConferenceAction.Leave,conferenceName:a,participantId:Number(y),role:b},d.trigger(l.SwEvent.Notification,k,I,!1)||d.trigger(l.SwEvent.Notification,k,t.uuid),null===S&&d.deRegister(l.SwEvent.Notification,null,I))),E=[i,u,p,v],t.vertoUnsubscribe({nodeId:this.nodeId,channels:E}).then((function(e){var t=e.unsubscribedChannels,n=void 0===t?[]:t;S&&(S.channels=S.channels.filter((function(e){return!n.includes(e)})))})).catch((function(e){s.default.error("liveArray unsubscribe error:",e)})),[3,4];case 4:return[2]}}))}))},e.prototype._handleSessionEvent=function(e){switch(e.contentType){case"layout-info":case"layer-info":p.MCULayoutEventHandler(this.session,e);break;case"logo-info":var t={type:f.NOTIFICATION_TYPE.conferenceUpdate,action:h.ConferenceAction.LogoInfo,logo:e.logoURL};d.trigger(l.SwEvent.Notification,t,this.session.uuid)}},e}();t.default=v},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(2),s=n(4),a=n(1);t.MCULayoutEventHandler=function(e,t){var n=t.contentType,a=t.canvasType,u=t.callID,l=t.canvasInfo,f=void 0===l?null:l,d=t.currentLayerIdx,h=void 0===d?-1:d;f&&"mcu-personal-canvas"!==a&&delete f.memberID;var p={type:o.NOTIFICATION_TYPE.conferenceUpdate,call:e.calls[u],canvasInfo:c(f),currentLayerIdx:h};switch(n){case"layer-info":var v=r({action:o.ConferenceAction.LayerInfo},p);s.trigger(i.SwEvent.Notification,v,e.uuid);break;case"layout-info":v=r({action:o.ConferenceAction.LayoutInfo},p);s.trigger(i.SwEvent.Notification,v,e.uuid)}};var c=function(e){var t=JSON.stringify(e).replace(/memberID/g,"participantId").replace(/ID"/g,'Id"').replace(/POS"/g,'Pos"');return a.safeParseJson(t)}},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(19));t.Relay=o.default;var i=r(n(34));t.Verto=i.default;var s=n(15),a=r(n(35));t.CantinaAuth=a.default,t.VERSION="1.2.8",s.setAgentName("JavaScript SDK/"+t.VERSION)},function(e,t,n){"use strict";var r,o=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(14)),u=n(11),l=a(n(9)),f=a(n(12)),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.execute=function(t){var n=t;if(t instanceof l.default){var r={message:t.request};t.targetNodeId&&(r.node_id=t.targetNodeId),n=new u.Execute({protocol:this.relayProtocol,method:"message",params:r})}return e.prototype.execute.call(this,n)},t.prototype.newCall=function(e){return i(this,void 0,void 0,(function(){var t,n;return s(this,(function(r){if(t=e.destinationNumber,!(void 0===t?null:t))throw new TypeError("destinationNumber is required");return(n=new f.default(this,e)).invite(),[2,n]}))}))},t}(c.default);t.default=d},function(e,t,n){var r,o;!function(i,s){"use strict";void 0===(o="function"==typeof(r=function(){var e=function(){},t="undefined"!=typeof window&&void 0!==window.navigator&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function r(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function i(n){return"debug"===n&&(n="log"),"undefined"!=typeof console&&("trace"===n&&t?o:void 0!==console[n]?r(console,n):void 0!==console.log?r(console,"log"):e)}function s(t,r){for(var o=0;o<n.length;o++){var i=n[o];this[i]=o<t?e:this.methodFactory(i,t,r)}this.log=this.debug}function a(e,t,n){return function(){"undefined"!=typeof console&&(s.call(this,t,n),this[e].apply(this,arguments))}}function c(e,t,n){return i(e)||a.apply(this,arguments)}function u(e,t,r){var o,i=this,a="loglevel";function u(){var e;if("undefined"!=typeof window&&a){try{e=window.localStorage[a]}catch(e){}if(void 0===e)try{var t=window.document.cookie,n=t.indexOf(encodeURIComponent(a)+"=");-1!==n&&(e=/^([^;]+)/.exec(t.slice(n))[1])}catch(e){}return void 0===i.levels[e]&&(e=void 0),e}}"string"==typeof e?a+=":"+e:"symbol"==typeof e&&(a=void 0),i.name=e,i.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},i.methodFactory=r||c,i.getLevel=function(){return o},i.setLevel=function(t,r){if("string"==typeof t&&void 0!==i.levels[t.toUpperCase()]&&(t=i.levels[t.toUpperCase()]),!("number"==typeof t&&t>=0&&t<=i.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(o=t,!1!==r&&function(e){var t=(n[e]||"silent").toUpperCase();if("undefined"!=typeof window&&a){try{return void(window.localStorage[a]=t)}catch(e){}try{window.document.cookie=encodeURIComponent(a)+"="+t+";"}catch(e){}}}(t),s.call(i,t,e),"undefined"==typeof console&&t<i.levels.SILENT)return"No console available for logging"},i.setDefaultLevel=function(e){u()||i.setLevel(e,!1)},i.enableAll=function(e){i.setLevel(i.levels.TRACE,e)},i.disableAll=function(e){i.setLevel(i.levels.SILENT,e)};var l=u();null==l&&(l=null==t?"WARN":t),i.setLevel(l,!1)}var l=new u,f={};l.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=f[e];return t||(t=f[e]=new u(e,l.getLevel(),l.methodFactory)),t};var d="undefined"!=typeof window?window.log:void 0;return l.noConflict=function(){return"undefined"!=typeof window&&window.log===l&&(window.log=d),l},l.getLoggers=function(){return f},l.default=l,l})?r.call(t,n,t,e):r)||(e.exports=o)}()},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(13),a=i(n(0)),c=i(n(22)),u=i(n(23)),l=n(4),f=i(n(29)),d=n(2),h=n(3),p=n(11),v=n(1),y=n(7),b=function(){function e(e){if(this.options=e,this.uuid=s.v4(),this.sessionid="",this.subscriptions={},this.expiresAt=0,this.signature=null,this.relayProtocol=null,this.contexts=[],this.timeoutErrorCode=-32e3,this.connection=null,this._jwtAuth=!1,this._doKeepAlive=!1,this._autoReconnect=!0,this._idle=!1,this._executeQueue=[],!this.validateOptions())throw new Error("Invalid init options");this._onSocketOpen=this._onSocketOpen.bind(this),this._onSocketCloseOrError=this._onSocketCloseOrError.bind(this),this._onSocketMessage=this._onSocketMessage.bind(this),this._handleLoginError=this._handleLoginError.bind(this),this._checkTokenExpiration=this._checkTokenExpiration.bind(this),this._attachListeners(),this.connection=new c.default(this)}return Object.defineProperty(e.prototype,"__logger",{get:function(){return a.default},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"connected",{get:function(){return this.connection&&this.connection.connected},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expired",{get:function(){return this.expiresAt&&this.expiresAt<=Date.now()/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reconnectDelay",{get:function(){return 1e3*v.randomInt(6,2)},enumerable:!0,configurable:!0}),e.prototype.execute=function(e){var t=this;return this._idle?new Promise((function(n){return t._executeQueue.push({resolve:n,msg:e})})):this.connected?this.connection.send(e).catch((function(e){throw e.code&&e.code===t.timeoutErrorCode&&t._closeConnection(),e})):new Promise((function(n){t._executeQueue.push({resolve:n,msg:e}),t.connect()}))},e.prototype.executeRaw=function(e){this._idle?this._executeQueue.push({msg:e}):this.connection.sendRawText(e)},e.prototype.validateOptions=function(){var e=this.options,t=e.project,n=void 0!==t&&t,r=e.token;return Boolean(n&&(void 0!==r&&r))},e.prototype.broadcast=function(e){},e.prototype.subscribe=function(e){var t=e.protocol,n=e.channels,i=e.handler;return r(this,void 0,void 0,(function(){var e,r,s,a,c,u,l=this;return o(this,(function(o){switch(o.label){case 0:return e=new p.Subscription({command:d.ADD,protocol:t,channels:n}),[4,this.execute(e)];case 1:return r=o.sent(),s=r.failed_channels,a=void 0===s?[]:s,c=r.subscribe_channels,u=void 0===c?[]:c,a.length&&a.forEach((function(e){return l._removeSubscription(t,e)})),u.forEach((function(e){return l._addSubscription(t,i,e)})),[2,r]}}))}))},e.prototype.unsubscribe=function(e){var t=e.protocol,n=e.channels;e.handler;return r(this,void 0,void 0,(function(){var e;return o(this,(function(r){return e=new p.Subscription({command:d.REMOVE,protocol:t,channels:n}),[2,this.execute(e)]}))}))},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return clearTimeout(this._reconnectTimeout),this.subscriptions={},this._autoReconnect=!1,this.relayProtocol=null,this._closeConnection(),[4,y.sessionStorage.removeItem(this.signature)];case 1:return e.sent(),this._executeQueue=[],this._detachListeners(),[2]}}))}))},e.prototype.on=function(e,t){return l.register(e,t,this.uuid),this},e.prototype.off=function(e,t){return l.deRegister(e,t,this.uuid),this},e.prototype.refreshToken=function(e){return r(this,void 0,void 0,(function(){var t,n,r,i,s,c;return o(this,(function(o){switch(o.label){case 0:this.options.token=e,o.label=1;case 1:return o.trys.push([1,6,,7]),this.expired?[4,this.connect()]:[3,3];case 2:return o.sent(),[3,5];case 3:return t=new p.Reauthenticate(this.options.project,e,this.sessionid),[4,this.execute(t)];case 4:n=o.sent(),r=n.authorization,i=(void 0===r?{}:r).expires_at,s=void 0===i?null:i,this.expiresAt=+s||0,o.label=5;case 5:return[3,7];case 6:return c=o.sent(),a.default.error("refreshToken error:",c),l.trigger(d.SwEvent.Error,c,this.uuid,!1),[3,7];case 7:return[2]}}))}))},e.prototype.connect=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return this.connection||(this.connection=new c.default(this)),this._attachListeners(),this.connection.isAlive||this.connection.connect(),[2]}))}))},e.prototype._handleLoginError=function(e){l.trigger(d.SwEvent.Error,e,this.uuid)},e.prototype._onSocketOpen=function(){return r(this,void 0,void 0,(function(){var e,t,n,r,i,s,c,f,h,v,y,b,_,g,m,w,S;return o(this,(function(o){switch(o.label){case 0:return this._idle=!1,e=this._jwtAuth?"jwt_token":"token",t=this.options,n=t.project,r=t.token,i=new p.Connect(((S={project:n})[e]=r,S),this.sessionid),[4,this.execute(i).catch(this._handleLoginError)];case 1:return(s=o.sent())?(this._autoReconnect=!0,c=s.sessionid,f=s.nodeid,h=s.master_nodeid,v=s.authorization,b=(y=void 0===v?{}:v).expires_at,_=void 0===b?null:b,g=y.signature,m=void 0===g?null:g,this.expiresAt=+_||0,this.signature=m,w=this,[4,u.default(this)]):[3,3];case 2:w.relayProtocol=o.sent(),this._checkTokenExpiration(),this.sessionid=c,this.nodeid=f,this.master_nodeid=h,this._emptyExecuteQueues(),this._pong=null,this._keepAlive(),l.trigger(d.SwEvent.Ready,this,this.uuid),a.default.info("Session Ready!"),o.label=3;case 3:return[2]}}))}))},e.prototype._onSocketCloseOrError=function(e){var t=this;for(var n in a.default.error("Socket "+e.type+" "+e.message),this.relayProtocol&&l.deRegisterAll(this.relayProtocol),this.subscriptions)l.deRegisterAll(n);this.subscriptions={},this.contexts=[],this.expired&&(this._idle=!0,this._autoReconnect=!1,this.expiresAt=0),this._autoReconnect&&(this._reconnectTimeout=setTimeout((function(){return t.connect()}),this.reconnectDelay))},e.prototype._onSocketMessage=function(e){var t=e.method,n=e.params;switch(t){case d.BladeMethod.Broadcast:f.default(this,n);break;case d.BladeMethod.Disconnect:this._idle=!0}},e.prototype._removeSubscription=function(e,t){this._existsSubscription(e,t)&&(t?(delete this.subscriptions[e][t],l.deRegister(e,null,t)):(delete this.subscriptions[e],l.deRegisterAll(e)))},e.prototype._addSubscription=function(e,t,n){void 0===t&&(t=null),this._existsSubscription(e,n)||(this._existsSubscription(e)||(this.subscriptions[e]={}),this.subscriptions[e][n]={},v.isFunction(t)&&l.register(e,t,n))},e.prototype._existsSubscription=function(e,t){return!(!this.subscriptions.hasOwnProperty(e)||!(!t||t&&this.subscriptions[e].hasOwnProperty(t)))},e.prototype._attachListeners=function(){this._detachListeners(),this.on(d.SwEvent.SocketOpen,this._onSocketOpen),this.on(d.SwEvent.SocketClose,this._onSocketCloseOrError),this.on(d.SwEvent.SocketError,this._onSocketCloseOrError),this.on(d.SwEvent.SocketMessage,this._onSocketMessage)},e.prototype._detachListeners=function(){this.off(d.SwEvent.SocketOpen,this._onSocketOpen),this.off(d.SwEvent.SocketClose,this._onSocketCloseOrError),this.off(d.SwEvent.SocketError,this._onSocketCloseOrError),this.off(d.SwEvent.SocketMessage,this._onSocketMessage)},e.prototype._emptyExecuteQueues=function(){var e=this;this._executeQueue.forEach((function(t){var n=t.resolve,r=t.msg;"string"==typeof r?e.executeRaw(r):n(e.execute(r))}))},e.prototype._closeConnection=function(){this._idle=!0,clearTimeout(this._keepAliveTimeout),this.connection&&this.connection.close()},e.prototype._checkTokenExpiration=function(){this.expiresAt&&(this.expiresAt-Date.now()/1e3<=60&&(a.default.warn("Your JWT is going to expire. You should refresh it to keep the session live."),l.trigger(d.SwEvent.Notification,{type:h.NOTIFICATION_TYPE.refreshToken,session:this},this.uuid,!1)),this.expired||setTimeout(this._checkTokenExpiration,3e4))},e.prototype._keepAlive=function(){var e=this;if(!0===this._doKeepAlive){if(!1===this._pong)return this._closeConnection();this._pong=!1,this.execute(new p.Ping).then((function(){return e._pong=!0})).catch((function(){return e._pong=!1})),this._keepAliveTimeout=setTimeout((function(){return e._keepAlive()}),1e4)}},e.on=function(e,t){l.register(e,t)},e.off=function(e){l.deRegister(e)},e.uuid=function(){return s.v4()},e}();t.default=b},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(0)),i=n(2),s=n(1),a=n(4),c=n(1),u="undefined"!=typeof WebSocket?WebSocket:null;t.setWebSocket=function(e){u=e};var l=0,f=1,d=2,h=3,p=function(){function e(e){this.session=e,this._wsClient=null,this._host="wss://relay.signalwire.com",this._timers={},this.upDur=null,this.downDur=null;var t=e.options.host;t&&(this._host=s.checkWebSocketHost(t))}return Object.defineProperty(e.prototype,"connected",{get:function(){return this._wsClient&&this._wsClient.readyState===f},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"connecting",{get:function(){return this._wsClient&&this._wsClient.readyState===l},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"closing",{get:function(){return this._wsClient&&this._wsClient.readyState===d},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"closed",{get:function(){return this._wsClient&&this._wsClient.readyState===h},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAlive",{get:function(){return this.connecting||this.connected},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDead",{get:function(){return this.closing||this.closed},enumerable:!0,configurable:!0}),e.prototype.connect=function(){var e=this;this._wsClient=new u(this._host),this._wsClient.onopen=function(t){return a.trigger(i.SwEvent.SocketOpen,t,e.session.uuid)},this._wsClient.onclose=function(t){return a.trigger(i.SwEvent.SocketClose,t,e.session.uuid)},this._wsClient.onerror=function(t){return a.trigger(i.SwEvent.SocketError,t,e.session.uuid)},this._wsClient.onmessage=function(t){var n=s.safeParseJson(t.data);"string"!=typeof n?(e._unsetTimer(n.id),o.default.debug("RECV: \n",JSON.stringify(n,null,2),"\n"),a.trigger(n.id,n)||a.trigger(i.SwEvent.SocketMessage,n,e.session.uuid)):e._handleStringResponse(n)}},e.prototype.sendRawText=function(e){this._wsClient.send(e)},e.prototype.send=function(e){var t=this,n=e.request,r=new Promise((function(e,r){if(n.hasOwnProperty("result"))return e();a.registerOnce(n.id,(function(t){var n=s.destructResponse(t),o=n.result,i=n.error;return i?r(i):e(o)})),t._setTimer(n.id)}));return o.default.debug("SEND: \n",JSON.stringify(n,null,2),"\n"),this._wsClient.send(JSON.stringify(n)),r},e.prototype.close=function(){this._wsClient&&(c.isFunction(this._wsClient._beginClose)?this._wsClient._beginClose():this._wsClient.close()),this._wsClient=null},e.prototype._unsetTimer=function(e){clearTimeout(this._timers[e]),delete this._timers[e]},e.prototype._setTimer=function(e){var t=this;this._timers[e]=setTimeout((function(){a.trigger(e,{error:{code:t.session.timeoutErrorCode,message:"Timeout"}}),t._unsetTimer(e)}),1e4)},e.prototype._handleStringResponse=function(e){if(/^#SP/.test(e))switch(e[3]){case"U":this.upDur=parseInt(e.substring(4));break;case"D":this.downDur=parseInt(e.substring(4)),a.trigger(i.SwEvent.SpeedTest,{upDur:this.upDur,downDur:this.downDur},this.session.uuid)}else o.default.warn("Unknown message from socket",e)},e}();t.default=p},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(0)),a=n(11),c=n(7);t.default=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,i,u,l,f;return o(this,(function(o){switch(o.label){case 0:return t={},n=e.signature,(r=e.relayProtocol)&&r.split("_")[1]===n?(t.protocol=r,[3,3]):[3,1];case 1:return[4,c.sessionStorage.getItem(n)];case 2:(i=o.sent())&&(t.protocol=i),o.label=3;case 3:return u=new a.Execute({protocol:"signalwire",method:"setup",params:t}),[4,e.execute(u)];case 4:return l=o.sent().protocol,(f=void 0===l?null:l)?[4,e.subscribe({protocol:f,channels:["notifications"]})]:[3,7];case 5:return o.sent(),[4,c.sessionStorage.setItem(n,f)];case 6:return o.sent(),[3,8];case 7:s.default.error("Error during setup the session protocol."),o.label=8;case 8:return[2,f]}}))}))}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t,n){void 0===n&&(n="");var r,o=e.call(this)||this;return o.method="blade.execute",r=t.hasOwnProperty("result")?{result:t}:{method:o.method,params:t},n&&(r.id=n),o.buildRequest(r),o}return o(t,e),t}(i(n(5)).default);t.Execute=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){var n=e.call(this)||this;return n.method="blade.subscription",t.hasOwnProperty("auto_create")&&!t.auto_create&&delete t.auto_create,t.hasOwnProperty("downstream")&&!t.downstream&&delete t.downstream,n.buildRequest({method:n.method,params:t}),n}return o(t,e),t}(i(n(5)).default);t.Subscription=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t,n,r){var o=e.call(this)||this;o.method="blade.reauthenticate";var i={sessionid:r,authentication:{project:t,jwt_token:n}};return o.buildRequest({method:o.method,params:i}),o}return o(t,e),t}(i(n(5)).default);t.Reauthenticate=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(){var t=e.call(this)||this;return t.method="blade.ping",t.buildRequest({method:t.method,params:{}}),t}return o(t,e),t}(i(n(5)).default);t.Ping=s},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],l=!1,f=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(0)),i=r(n(16));t.default=function(e,t){var n=t.protocol,r=t.event,s=t.params,a=s.event_type,c=s.node_id;if(n!==e.relayProtocol)return o.default.error("Session protocol mismatch.");switch(r){case"queuing.relay.events":if("webrtc.message"===a){var u=new i.default(e);u.nodeId=c,u.handleMessage(s.params)}else e.calling.notificationHandler(s);break;case"queuing.relay.tasks":e.tasking.notificationHandler(s);break;case"queuing.relay.messaging":e.messaging.notificationHandler(s);break;default:return o.default.error("Unknown notification type: "+a)}}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(13),c=s(n(0)),u=n(8),l=s(n(33)),f=n(2),d=n(3),h=n(4),p=n(10),v=n(1),y=n(6),b=n(17),_=function(){function e(e,t){var n=this;this.session=e,this.id="",this.state=d.State[d.State.New],this.prevState="",this.channels=[],this.role=d.Role.Participant,this.extension=null,this._state=d.State.New,this._prevState=d.State.New,this.gotAnswer=!1,this.gotEarly=!1,this._lastSerno=0,this._targetNodeId=null,this._iceTimeout=null,this._iceDone=!1,this._checkConferenceSerno=function(e){var t=e<0||!n._lastSerno||n._lastSerno&&e===n._lastSerno+1;return t&&e>=0&&(n._lastSerno=e),t};var r=e.iceServers,o=e.speaker,i=e.micId,s=e.micLabel,a=e.camId,c=e.camLabel,u=e.localElement,l=e.remoteElement,f=e.mediaConstraints,h=f.audio,p=f.video;this.options=Object.assign({},d.DEFAULT_CALL_OPTIONS,{audio:h,video:p,iceServers:r,localElement:u,remoteElement:l,micId:i,micLabel:s,camId:a,camLabel:c,speakerId:o},t),this._onMediaError=this._onMediaError.bind(this),this._init()}return Object.defineProperty(e.prototype,"nodeId",{get:function(){return this._targetNodeId},set:function(e){this._targetNodeId=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localStream",{get:function(){return this.options.localStream},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"remoteStream",{get:function(){return this.options.remoteStream},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"memberChannel",{get:function(){return"conference-member."+this.id},enumerable:!0,configurable:!0}),e.prototype.invite=function(){this.direction=d.Direction.Outbound,this.peer=new l.default(d.PeerType.Offer,this.options),this._registerPeerEvents()},e.prototype.answer=function(){this.direction=d.Direction.Inbound,this.peer=new l.default(d.PeerType.Answer,this.options),this._registerPeerEvents()},e.prototype.hangup=function(e,t){var n=this;void 0===e&&(e={}),void 0===t&&(t=!0),this.cause=e.cause||"NORMAL_CLEARING",this.causeCode=e.causeCode||16,this.setState(d.State.Hangup);var r=function(){n.peer&&n.peer.instance.close(),n.setState(d.State.Destroy)};if(t){var o=new u.Bye({sessid:this.session.sessionid,dialogParams:this.options});this._execute(o).catch((function(e){return c.default.error("verto.bye failed!",e)})).then(r.bind(this))}else r()},e.prototype.transfer=function(e){var t=new u.Modify({sessid:this.session.sessionid,action:"transfer",destination:e,dialogParams:this.options});this._execute(t)},e.prototype.replace=function(e){var t=new u.Modify({sessid:this.session.sessionid,action:"replace",replaceCallID:e,dialogParams:this.options});this._execute(t)},e.prototype.hold=function(){var e=new u.Modify({sessid:this.session.sessionid,action:"hold",dialogParams:this.options});return this._execute(e).then(this._handleChangeHoldStateSuccess.bind(this)).catch(this._handleChangeHoldStateError.bind(this))},e.prototype.unhold=function(){var e=new u.Modify({sessid:this.session.sessionid,action:"unhold",dialogParams:this.options});return this._execute(e).then(this._handleChangeHoldStateSuccess.bind(this)).catch(this._handleChangeHoldStateError.bind(this))},e.prototype.toggleHold=function(){var e=new u.Modify({sessid:this.session.sessionid,action:"toggleHold",dialogParams:this.options});return this._execute(e).then(this._handleChangeHoldStateSuccess.bind(this)).catch(this._handleChangeHoldStateError.bind(this))},e.prototype.dtmf=function(e){var t=new u.Info({sessid:this.session.sessionid,dtmf:e,dialogParams:this.options});this._execute(t)},e.prototype.message=function(e,t){var n={from:this.session.options.login,to:e,body:t},r=new u.Info({sessid:this.session.sessionid,msg:n,dialogParams:this.options});this._execute(r)},e.prototype.muteAudio=function(){p.disableAudioTracks(this.options.localStream)},e.prototype.unmuteAudio=function(){p.enableAudioTracks(this.options.localStream)},e.prototype.toggleAudioMute=function(){p.toggleAudioTracks(this.options.localStream)},e.prototype.setAudioInDevice=function(e){return o(this,void 0,void 0,(function(){var t,n,r,o,s;return i(this,(function(i){switch(i.label){case 0:return t=this.peer.instance,(n=t.getSenders().find((function(e){return"audio"===e.track.kind})))?[4,y.getUserMedia({audio:{deviceId:{exact:e}}})]:[3,2];case 1:r=i.sent(),o=r.getAudioTracks()[0],n.replaceTrack(o),this.options.micId=e,(s=this.options.localStream).getAudioTracks().forEach((function(e){return e.stop()})),s.getVideoTracks().forEach((function(e){return r.addTrack(e)})),this.options.localStream=r,i.label=2;case 2:return[2]}}))}))},e.prototype.muteVideo=function(){p.disableVideoTracks(this.options.localStream)},e.prototype.unmuteVideo=function(){p.enableVideoTracks(this.options.localStream)},e.prototype.toggleVideoMute=function(){p.toggleVideoTracks(this.options.localStream)},e.prototype.setVideoDevice=function(e){return o(this,void 0,void 0,(function(){var t,n,r,o,s,a,c;return i(this,(function(i){switch(i.label){case 0:return t=this.peer.instance,(n=t.getSenders().find((function(e){return"video"===e.track.kind})))?[4,y.getUserMedia({video:{deviceId:{exact:e}}})]:[3,2];case 1:r=i.sent(),o=r.getVideoTracks()[0],n.replaceTrack(o),s=this.options,a=s.localElement,c=s.localStream,y.attachMediaStream(a,r),this.options.camId=e,c.getAudioTracks().forEach((function(e){return r.addTrack(e)})),c.getVideoTracks().forEach((function(e){return e.stop()})),this.options.localStream=r,i.label=2;case 2:return[2]}}))}))},e.prototype.deaf=function(){p.disableAudioTracks(this.options.remoteStream)},e.prototype.undeaf=function(){p.enableAudioTracks(this.options.remoteStream)},e.prototype.toggleDeaf=function(){p.toggleAudioTracks(this.options.remoteStream)},e.prototype.setState=function(e){var t=this;switch(this._prevState=this._state,this._state=e,this.state=d.State[this._state].toLowerCase(),this.prevState=d.State[this._prevState].toLowerCase(),c.default.info("Call "+this.id+" state change from "+this.prevState+" to "+this.state),this._dispatchNotification({type:d.NOTIFICATION_TYPE.callUpdate,call:this}),e){case d.State.Purge:this.hangup({cause:"PURGE",causeCode:"01"},!1);break;case d.State.Active:setTimeout((function(){var e=t.options,n=e.remoteElement,r=e.speakerId;n&&r&&y.setMediaElementSinkId(n,r)}),0);break;case d.State.Destroy:this._finalize()}},e.prototype.handleMessage=function(e){var t=e.method,n=e.params;switch(t){case d.VertoMethod.Answer:if(this.gotAnswer=!0,this._state>=d.State.Active)return;this._state>=d.State.Early&&this.setState(d.State.Active),this.gotEarly||this._onRemoteSdp(n.sdp);break;case d.VertoMethod.Media:if(this._state>=d.State.Early)return;this.gotEarly=!0,this._onRemoteSdp(n.sdp);break;case d.VertoMethod.Display:case d.VertoMethod.Attach:var o=n.display_name,i=n.display_number,s=n.display_direction;this.extension=i;var a=s===d.Direction.Inbound?d.Direction.Outbound:d.Direction.Inbound,c={type:d.NOTIFICATION_TYPE[t],call:this,displayName:o,displayNumber:i,displayDirection:a};h.trigger(f.SwEvent.Notification,c,this.id)||h.trigger(f.SwEvent.Notification,c,this.session.uuid);break;case d.VertoMethod.Info:case d.VertoMethod.Event:c=r(r({},n),{type:d.NOTIFICATION_TYPE.generic,call:this});h.trigger(f.SwEvent.Notification,c,this.id)||h.trigger(f.SwEvent.Notification,c,this.session.uuid);break;case d.VertoMethod.Bye:this.hangup(n,!1)}},e.prototype.handleConferenceUpdate=function(e,t){return o(this,void 0,void 0,(function(){var n,o,s,a,u,l,f,h,p,y,b,_,g;return i(this,(function(i){switch(i.label){case 0:if(!this._checkConferenceSerno(e.wireSerno)&&e.name!==t.laName)return c.default.error("ConferenceUpdate invalid wireSerno or packet name:",e),[2,"INVALID_PACKET"];switch(n=e.action,o=e.data,s=e.hashKey,a=void 0===s?String(this._lastSerno):s,u=e.arrIndex,n){case"bootObj":return[3,1];case"add":return[3,8];case"modify":return[3,9];case"del":return[3,10];case"clear":return[3,11]}return[3,12];case 1:return this._lastSerno=0,t.chatID,l=t.chatChannel,f=t.infoChannel,h=t.modChannel,p=t.laName,y=t.conferenceMemberID,b=t.role,this._dispatchConferenceUpdate({action:d.ConferenceAction.Join,conferenceName:p,participantId:Number(y),role:b}),l?[4,this._subscribeConferenceChat(l)]:[3,3];case 2:i.sent(),i.label=3;case 3:return f?[4,this._subscribeConferenceInfo(f)]:[3,5];case 4:i.sent(),i.label=5;case 5:return h&&b===d.Role.Moderator?[4,this._subscribeConferenceModerator(h)]:[3,7];case 6:i.sent(),i.label=7;case 7:for(g in _=[],o)_.push(r({callId:o[g][0],index:Number(g)},v.mutateLiveArrayData(o[g][1])));return this._dispatchConferenceUpdate({action:d.ConferenceAction.Bootstrap,participants:_}),[3,13];case 8:return this._dispatchConferenceUpdate(r({action:d.ConferenceAction.Add,callId:a,index:u},v.mutateLiveArrayData(o))),[3,13];case 9:return this._dispatchConferenceUpdate(r({action:d.ConferenceAction.Modify,callId:a,index:u},v.mutateLiveArrayData(o))),[3,13];case 10:return this._dispatchConferenceUpdate(r({action:d.ConferenceAction.Delete,callId:a,index:u},v.mutateLiveArrayData(o))),[3,13];case 11:return this._dispatchConferenceUpdate({action:d.ConferenceAction.Clear}),[3,13];case 12:return this._dispatchConferenceUpdate({action:n,data:o,callId:a,index:u}),[3,13];case 13:return[2]}}))}))},e.prototype._addChannel=function(e){this.channels.includes(e)||this.channels.push(e);var t=this.session.relayProtocol;this.session._existsSubscription(t,e)&&(this.session.subscriptions[t][e]=r(r({},this.session.subscriptions[t][e]),{callId:this.id}))},e.prototype._subscribeConferenceChat=function(e){return o(this,void 0,void 0,(function(){var t,n,r=this;return i(this,(function(o){switch(o.label){case 0:return t={nodeId:this.nodeId,channels:[e],handler:function(e){var t=e.data,n=t.direction,o=t.from,i=t.fromDisplay,s=t.message,a=t.type;r._dispatchConferenceUpdate({action:d.ConferenceAction.ChatMessage,direction:n,participantNumber:o,participantName:i,messageText:s,messageType:a,messageId:e.eventSerno})}},[4,this.session.vertoSubscribe(t).catch((function(e){c.default.error("ConfChat subscription error:",e)}))];case 1:return n=o.sent(),p.checkSubscribeResponse(n,e)&&(this._addChannel(e),Object.defineProperties(this,{sendChatMessage:{configurable:!0,value:function(t,n){r.session.vertoBroadcast({nodeId:r.nodeId,channel:e,data:{action:"send",message:t,type:n}})}}})),[2]}}))}))},e.prototype._subscribeConferenceInfo=function(e){return o(this,void 0,void 0,(function(){var t,n,r=this;return i(this,(function(o){switch(o.label){case 0:return t={nodeId:this.nodeId,channels:[e],handler:function(e){var t=e.eventData;switch(t.contentType){case"layout-info":t.callID=r.id,b.MCULayoutEventHandler(r.session,t);break;default:c.default.error("Conference-Info unknown contentType",e)}}},[4,this.session.vertoSubscribe(t).catch((function(e){c.default.error("ConfInfo subscription error:",e)}))];case 1:return n=o.sent(),p.checkSubscribeResponse(n,e)&&this._addChannel(e),[2]}}))}))},e.prototype._confControl=function(e,t){void 0===t&&(t={});var n=r({application:"conf-control",callID:this.id,value:null},t);this.session.vertoBroadcast({nodeId:this.nodeId,channel:e,data:n})},e.prototype._subscribeConferenceModerator=function(e){return o(this,void 0,void 0,(function(){var t,n,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:return t=function(t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var o=parseInt(n)||null;s._confControl(e,{command:t,id:o,value:r})},n=function(){var e=s.options.video;if("boolean"==typeof e&&!e||"object"==typeof e&&v.objEmpty(e))throw"Conference "+s.id+" has no video!"},r={nodeId:this.nodeId,channels:[e],handler:function(e){var t=e.data;switch(t["conf-command"]){case"list-videoLayouts":if(t.responseData){var n=JSON.stringify(t.responseData).replace(/IDS"/g,'Ids"');s._dispatchConferenceUpdate({action:d.ConferenceAction.LayoutList,layouts:JSON.parse(n)})}break;default:s._dispatchConferenceUpdate({action:d.ConferenceAction.ModCmdResponse,command:t["conf-command"],response:t.response})}}},[4,this.session.vertoSubscribe(r).catch((function(e){c.default.error("ConfMod subscription error:",e)}))];case 1:return o=i.sent(),p.checkSubscribeResponse(o,e)&&(this.role=d.Role.Moderator,this._addChannel(e),Object.defineProperties(this,{listVideoLayouts:{configurable:!0,value:function(){t("list-videoLayouts")}},playMedia:{configurable:!0,value:function(e){t("play",null,e)}},stopMedia:{configurable:!0,value:function(){t("stop",null,"all")}},deaf:{configurable:!0,value:function(e){t("deaf",e)}},undeaf:{configurable:!0,value:function(e){t("undeaf",e)}},startRecord:{configurable:!0,value:function(e){t("recording",null,["start",e])}},stopRecord:{configurable:!0,value:function(){t("recording",null,["stop","all"])}},snapshot:{configurable:!0,value:function(e){n(),t("vid-write-png",null,e)}},setVideoLayout:{configurable:!0,value:function(e,r){n(),t("vid-layout",null,r?[e,r]:e)}},kick:{configurable:!0,value:function(e){t("kick",e)}},muteMic:{configurable:!0,value:function(e){t("tmute",e)}},muteVideo:{configurable:!0,value:function(e){n(),t("tvmute",e)}},presenter:{configurable:!0,value:function(e){n(),t("vid-res-id",e,"presenter")}},videoFloor:{configurable:!0,value:function(e){n(),t("vid-floor",e,"force")}},banner:{configurable:!0,value:function(e,r){n(),t("vid-banner",e,encodeURI(r))}},volumeDown:{configurable:!0,value:function(e){t("volume_out",e,"down")}},volumeUp:{configurable:!0,value:function(e){t("volume_out",e,"up")}},gainDown:{configurable:!0,value:function(e){t("volume_in",e,"down")}},gainUp:{configurable:!0,value:function(e){t("volume_in",e,"up")}},transfer:{configurable:!0,value:function(e,n){t("transfer",e,n)}}})),[2]}}))}))},e.prototype._handleChangeHoldStateSuccess=function(e){return"active"===e.holdState?this.setState(d.State.Active):this.setState(d.State.Held),!0},e.prototype._handleChangeHoldStateError=function(e){return c.default.error("Failed to "+e.action+" on call "+this.id),!1},e.prototype._onRemoteSdp=function(e){var t=this,n=p.sdpMediaOrderHack(e,this.peer.instance.localDescription.sdp);this.options.useStereo&&(n=p.sdpStereoHack(n));var r=y.sdpToJsonHack({sdp:n,type:d.PeerType.Answer});this.peer.instance.setRemoteDescription(r).then((function(){t.gotEarly&&t.setState(d.State.Early),t.gotAnswer&&t.setState(d.State.Active)})).catch((function(e){c.default.error("Call setRemoteDescription Error: ",e),t.hangup()}))},e.prototype._requestAnotherLocalDescription=function(){v.isFunction(this.peer.onSdpReadyTwice)?h.trigger(f.SwEvent.Error,new Error("SDP without candidates for the second time!"),this.session.uuid):(Object.defineProperty(this.peer,"onSdpReadyTwice",{value:this._onIceSdp.bind(this)}),this._iceDone=!1,this.peer.startNegotiation())},e.prototype._onIceSdp=function(e){var t=this;this._iceTimeout&&clearTimeout(this._iceTimeout),this._iceTimeout=null,this._iceDone=!0;var n=e.sdp,r=e.type;if(-1!==n.indexOf("candidate")){var o=null,i={sessid:this.session.sessionid,sdp:n,dialogParams:this.options};switch(r){case d.PeerType.Offer:this.setState(d.State.Requesting),o=new u.Invite(i);break;case d.PeerType.Answer:this.setState(d.State.Answering),o=!0===this.options.attach?new u.Attach(i):new u.Answer(i);break;default:return c.default.error(this.id+" - Unknown local SDP type:",e),this.hangup({},!1)}this._execute(o).then((function(e){var n=e.node_id,o=void 0===n?null:n;t._targetNodeId=o,r===d.PeerType.Offer?t.setState(d.State.Trying):t.setState(d.State.Active)})).catch((function(e){c.default.error(t.id+" - Sending "+r+" error:",e),t.hangup()}))}else this._requestAnotherLocalDescription()},e.prototype._registerPeerEvents=function(){var e=this,t=this.peer.instance;this._iceDone=!1,t.onicecandidate=function(n){e._iceDone||(null===e._iceTimeout&&(e._iceTimeout=setTimeout((function(){return e._onIceSdp(t.localDescription)}),1e3)),n.candidate?c.default.info("IceCandidate:",n.candidate):e._onIceSdp(t.localDescription))},t.addEventListener("track",(function(t){e.options.remoteStream=t.streams[0];var n=e.options,r=n.remoteElement,o=n.remoteStream;!1===n.screenShare&&y.attachMediaStream(r,o)})),t.addEventListener("addstream",(function(t){e.options.remoteStream=t.stream}))},e.prototype._onMediaError=function(e){this._dispatchNotification({type:d.NOTIFICATION_TYPE.userMediaError,error:e}),this.hangup({},!1)},e.prototype._dispatchConferenceUpdate=function(e){this._dispatchNotification(r({type:d.NOTIFICATION_TYPE.conferenceUpdate,call:this},e))},e.prototype._dispatchNotification=function(e){!0!==this.options.screenShare&&(h.trigger(f.SwEvent.Notification,e,this.id,!1)||h.trigger(f.SwEvent.Notification,e,this.session.uuid))},e.prototype._execute=function(e){return this.nodeId&&(e.targetNodeId=this.nodeId),this.session.execute(e)},e.prototype._init=function(){var e=this.options,t=e.id,n=e.userVariables,r=e.remoteCallerNumber,o=e.onNotification;t||(this.options.id=a.v4()),this.id=this.options.id,n&&!v.objEmpty(n)||(this.options.userVariables=this.session.options.userVariables||{}),r||(this.options.remoteCallerNumber=this.options.destinationNumber),this.session.calls[this.id]=this,h.register(f.SwEvent.MediaError,this._onMediaError,this.id),v.isFunction(o)&&h.register(f.SwEvent.Notification,o.bind(this),this.id),this.setState(d.State.New),c.default.info("New Call with Options:",this.options)},e.prototype._finalize=function(){var e=this.options,t=e.remoteStream,n=e.localStream,r=e.remoteElement,o=e.localElement;y.stopStream(t),y.stopStream(n),!0!==this.options.screenShare&&(y.detachMediaStream(r),y.detachMediaStream(o)),h.deRegister(f.SwEvent.MediaError,null,this.id),this.peer=null,this.session.calls[this.id]=null,delete this.session.calls[this.id]},e}();t.default=_},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t,n,r,o){void 0===o&&(o={});var i=e.call(this)||this;i.method="login";var s={login:t,passwd:n,userVariables:o,loginParams:{}};return r&&(s.sessid=r),i.buildRequest({method:i.method,params:s}),i}return o(t,e),t}(i(n(9)).default);t.Login=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t,n){var r=e.call(this)||this;return r.buildRequest({id:t,result:{method:n}}),r}return o(t,e),t}(i(n(9)).default);t.Result=s},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(0)),a=n(10),c=n(2),u=n(3),l=n(6),f=n(1),d=n(4),h=function(){function e(e,t){this.type=e,this.options=t,this.onSdpReadyTwice=null,this._negotiating=!1,s.default.info("New Peer with type:",this.type,"Options:",this.options),this._constraints={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this._sdpReady=this._sdpReady.bind(this),this._init()}return e.prototype.startNegotiation=function(){this._negotiating=!0,this._isOffer()?this._createOffer():this._createAnswer()},e.prototype._init=function(){return r(this,void 0,void 0,(function(){var e,t,n,r,i,a,u,f=this;return o(this,(function(o){switch(o.label){case 0:return this.instance=l.RTCPeerConnection(this._config()),this.instance.onsignalingstatechange=function(e){switch(f.instance.signalingState){case"stable":f._negotiating=!1;break;case"closed":f.instance=null;break;default:f._negotiating=!0}},this.instance.onnegotiationneeded=function(e){f._negotiating?s.default.debug("Skip twice onnegotiationneeded.."):f.startNegotiation()},e=this.options,[4,this._retrieveLocalStream().catch((function(e){return d.trigger(c.SwEvent.MediaError,e,f.options.id),null}))];case 1:return e.localStream=o.sent(),t=this.options,n=t.localElement,r=t.localStream,i=void 0===r?null:r,a=t.screenShare,u=void 0!==a&&a,l.streamIsValid(i)?("function"==typeof this.instance.addTrack?i.getTracks().forEach((function(e){return f.instance.addTrack(e,i)})):this.instance.addStream(i),!0!==u&&(l.muteMediaElement(n),l.attachMediaStream(n,i))):null===i&&this.startNegotiation(),[2]}}))}))},e.prototype._createOffer=function(){this._isOffer()&&this.instance.createOffer(this._constraints).then(this._setLocalDescription.bind(this)).then(this._sdpReady).catch((function(e){return s.default.error("Peer _createOffer error:",e)}))},e.prototype._createAnswer=function(){var e=this;if(this._isAnswer()){var t=this.options,n=t.remoteSdp,r=t.useStereo?a.sdpStereoHack(n):n,o=l.sdpToJsonHack({sdp:r,type:u.PeerType.Offer});this.instance.setRemoteDescription(o).then((function(){return e.instance.createAnswer()})).then(this._setLocalDescription.bind(this)).then(this._sdpReady).catch((function(e){return s.default.error("Peer _createAnswer error:",e)}))}},e.prototype._setLocalDescription=function(e){var t=this.options,n=t.useStereo,r=t.googleMaxBitrate,o=t.googleMinBitrate,i=t.googleStartBitrate;return n&&(e.sdp=a.sdpStereoHack(e.sdp)),r&&o&&i&&(e.sdp=a.sdpBitrateHack(e.sdp,r,o,i)),this.instance.setLocalDescription(e)},e.prototype._sdpReady=function(){f.isFunction(this.onSdpReadyTwice)&&this.onSdpReadyTwice(this.instance.localDescription)},e.prototype._retrieveLocalStream=function(){return r(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return l.streamIsValid(this.options.localStream)?[2,this.options.localStream]:[4,a.getMediaConstraints(this.options)];case 1:return e=t.sent(),[2,a.getUserMedia(e)]}}))}))},e.prototype._isOffer=function(){return this.type===u.PeerType.Offer},e.prototype._isAnswer=function(){return this.type===u.PeerType.Answer},e.prototype._config=function(){var e=this.options.iceServers,t={sdpSemantics:"unified-plan",bundlePolicy:"max-compat",iceServers:void 0===e?[]:e};return s.default.info("RTC config",t),t},e}();t.default=h},function(e,t,n){"use strict";var r,o=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},a=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=a(n(14)),u=n(8),l=a(n(12)),f=n(2),d=n(4),h=n(7),p=a(n(16));t.VERTO_PROTOCOL="verto-protocol";var v=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.relayProtocol=t.VERTO_PROTOCOL,n.timeoutErrorCode=-329990,n}return o(n,e),n.prototype.validateOptions=function(){var e=this.options,t=e.host,n=e.login,r=e.passwd,o=e.password;return Boolean(t)&&Boolean(n&&(r||o))},n.prototype.newCall=function(e){var t=e.destinationNumber;if(!(void 0===t?null:t))throw new Error("Verto.newCall() error: destinationNumber is required.");var n=new l.default(this,e);return n.invite(),n},n.prototype.broadcast=function(e){return this.vertoBroadcast(e)},n.prototype.subscribe=function(e){return this.vertoSubscribe(e)},n.prototype.unsubscribe=function(e){return this.vertoUnsubscribe(e)},n.prototype._onSocketOpen=function(){return i(this,void 0,void 0,(function(){var e,t,n,r,o,i,a,c;return s(this,(function(s){switch(s.label){case 0:return this._idle=!1,e=this.options,t=e.login,n=e.password,r=e.passwd,o=e.userVariables,this.sessionid?(i=new u.Login(void 0,void 0,this.sessionid,void 0),[4,this.execute(i).catch(console.error)]):[3,2];case 1:s.sent(),s.label=2;case 2:return a=new u.Login(t,n||r,this.sessionid,o),[4,this.execute(a).catch(this._handleLoginError)];case 3:return(c=s.sent())&&(this._autoReconnect=!0,this.sessionid=c.sessid,h.localStorage.setItem(f.SESSION_ID,this.sessionid),d.trigger(f.SwEvent.Ready,this,this.uuid)),[2]}}))}))},n.prototype._onSocketMessage=function(e){new p.default(this).handleMessage(e)},n}(c.default);t.default=v},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(0)),c={method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}},u=function(){function e(e){var t=this;void 0===e&&(e={}),this.params=e,this.baseUrl="https://cantina-backend.signalwire.com",this._fetch=function(e,n){return fetch(e,n).then((function(e){return o(t,void 0,void 0,(function(){var t,n,r;return i(this,(function(o){switch(o.label){case 0:return[4,e.json()];case 1:return t=o.sent(),e.status>=200&&e.status<300?[2,t]:(n="HTTP Request failed with status "+e.status,(r=new Error(n)).payload=t,[2,Promise.reject(r)])}}))}))}))};var n=e.hostname,r=void 0===n?location.hostname:n;this.hostname=r}return e.prototype.userLogin=function(e,t){return o(this,void 0,void 0,(function(){var n;return i(this,(function(o){switch(o.label){case 0:return[4,this._fetch(this.baseUrl+"/login/user",r(r({},c),{body:JSON.stringify({username:e,password:t,hostname:this.hostname})}))];case 1:return n=o.sent(),a.default.info("userLogin response",n),[2,n]}}))}))},e.prototype.guestLogin=function(e,t,n){return o(this,void 0,void 0,(function(){var o;return i(this,(function(i){switch(i.label){case 0:return[4,this._fetch(this.baseUrl+"/login/guest",r(r({},c),{body:JSON.stringify({name:e,email:t,token:n,hostname:this.hostname})}))];case 1:return o=i.sent(),a.default.info("guestLogin response",o),[2,o]}}))}))},e.prototype.refresh=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,this._fetch(this.baseUrl+"/refresh",r(r({},c),{method:"PUT",body:JSON.stringify({hostname:this.hostname})}))];case 1:return e=t.sent(),a.default.info("refresh response",e),[2,e]}}))}))},e.prototype.checkInviteToken=function(e){return o(this,void 0,void 0,(function(){var t;return i(this,(function(n){switch(n.label){case 0:return[4,this._fetch(this.baseUrl+"/check-token",r(r({},c),{body:JSON.stringify({token:e,hostname:this.hostname})}))];case 1:return t=n.sent(),a.default.info("checkInviteToken response",t),[2,t]}}))}))},e}();t.default=u}]));