@signalwire/js 1.3.0-dev.1 → 1.3.0
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.
- package/README.md +4 -2
- package/dist/esm/common/src/BaseSession.d.ts +8 -13
- package/dist/esm/common/src/BaseSession.js +33 -46
- package/dist/esm/common/src/BrowserSession.d.ts +20 -57
- package/dist/esm/common/src/BrowserSession.js +91 -359
- package/dist/esm/common/src/messages/Verto.d.ts +1 -10
- package/dist/esm/common/src/messages/Verto.js +1 -16
- package/dist/esm/common/src/messages/verto/Login.d.ts +1 -13
- package/dist/esm/common/src/messages/verto/Login.js +2 -5
- package/dist/esm/common/src/services/BroadcastHandler.js +3 -2
- package/dist/esm/common/src/services/Handler.d.ts +8 -9
- package/dist/esm/common/src/services/Handler.js +38 -41
- package/dist/esm/common/src/util/constants/index.d.ts +0 -1
- package/dist/esm/common/src/util/constants/index.js +0 -1
- package/dist/esm/common/src/util/helpers.d.ts +9 -2
- package/dist/esm/common/src/util/helpers.js +11 -6
- package/dist/esm/common/src/util/interfaces.d.ts +55 -20
- package/dist/esm/common/src/util/logger.js +1 -4
- package/dist/esm/common/src/util/webrtc/index.d.ts +1 -6
- package/dist/esm/common/src/util/webrtc/index.js +2 -63
- package/dist/esm/common/src/webrtc/BaseCall.d.ts +76 -0
- package/dist/esm/common/src/webrtc/BaseCall.js +701 -0
- package/dist/esm/common/src/webrtc/Call.d.ts +5 -5
- package/dist/esm/common/src/webrtc/Call.js +15 -34
- package/dist/esm/common/src/webrtc/CantinaAuth.d.ts +13 -8
- package/dist/esm/common/src/webrtc/CantinaAuth.js +18 -24
- package/dist/esm/common/src/webrtc/LayoutHandler.d.ts +3 -0
- package/dist/esm/common/src/webrtc/LayoutHandler.js +36 -0
- package/dist/esm/common/src/webrtc/Peer.d.ts +21 -0
- package/dist/esm/common/src/webrtc/Peer.js +145 -0
- package/dist/esm/common/src/webrtc/VertoHandler.d.ts +11 -2
- package/dist/esm/common/src/webrtc/VertoHandler.js +187 -147
- package/dist/esm/common/src/webrtc/constants.d.ts +12 -28
- package/dist/esm/common/src/webrtc/constants.js +11 -34
- package/dist/esm/common/src/webrtc/helpers.d.ts +20 -18
- package/dist/esm/common/src/webrtc/helpers.js +177 -162
- package/dist/esm/common/src/webrtc/interfaces.d.ts +51 -209
- package/dist/esm/js/index.d.ts +1 -3
- package/dist/esm/js/index.js +1 -2
- package/dist/esm/js/src/SignalWire.d.ts +2 -0
- package/dist/esm/js/src/SignalWire.js +13 -0
- package/dist/esm/js/src/Verto.d.ts +2 -8
- package/dist/esm/js/src/Verto.js +14 -50
- package/dist/index.min.js +2 -2
- package/package.json +13 -14
- package/dist/esm/common/src/webrtc/ChatChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/ChatChannelHandler.js +0 -22
- package/dist/esm/common/src/webrtc/Conference.d.ts +0 -15
- package/dist/esm/common/src/webrtc/Conference.js +0 -68
- package/dist/esm/common/src/webrtc/ConferenceListChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/ConferenceListChannelHandler.js +0 -77
- package/dist/esm/common/src/webrtc/InfoChannelHandler.d.ts +0 -7
- package/dist/esm/common/src/webrtc/InfoChannelHandler.js +0 -85
- package/dist/esm/common/src/webrtc/LaChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/LaChannelHandler.js +0 -58
- package/dist/esm/common/src/webrtc/ModChannelHandler.d.ts +0 -71
- package/dist/esm/common/src/webrtc/ModChannelHandler.js +0 -267
- package/dist/esm/common/src/webrtc/RTCPeer.d.ts +0 -51
- package/dist/esm/common/src/webrtc/RTCPeer.js +0 -556
- package/dist/esm/common/src/webrtc/WebRTCCall.d.ts +0 -182
- package/dist/esm/common/src/webrtc/WebRTCCall.js +0 -784
- package/dist/esm/common/src/webrtc/deviceHelpers.d.ts +0 -18
- package/dist/esm/common/src/webrtc/deviceHelpers.js +0 -113
- package/dist/esm/common/src/webrtc/sdpHelpers.d.ts +0 -3
- package/dist/esm/common/src/webrtc/sdpHelpers.js +0 -56
package/dist/index.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Relay SDK for JavaScript v1.3.0
|
|
2
|
+
* Relay SDK for JavaScript v1.3.0 (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 i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));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=23)}([function(e,t,n){"use strict";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",e.MediaParams="verto.mediaParams",e.Prompt="verto.prompt",e.JsApi="jsapi",e.Stats="verto.stats",e.Ping="verto.ping",e.Announce="verto.announce"}(t.VertoMethod||(t.VertoMethod={})),function(e){e.Generic="event",e.ParticipantData="participantData",e.ConferenceUpdate="conferenceUpdate",e.CallUpdate="callUpdate",e.VertoClientReady="vertoClientReady",e.UserMediaError="userMediaError",e.RefreshToken="refreshToken",e.Prompt="prompt",e.Announce="announce",e.DeviceUpdated="deviceUpdated",e.MediaParams="mediaParams",e.ConferenceListBootstrap="conferenceListBootstrap",e.ConferenceListAdd="conferenceListAdd",e.ConferenceListModify="conferenceListModify",e.ConferenceListDelete="conferenceListDelete"}(t.Notification||(t.Notification={})),t.DEFAULT_CALL_OPTIONS={destinationNumber:"",remoteCallerName:"Outbound Call",remoteCallerNumber:"",callerName:"",callerNumber:"",audio:!0,video:!0,useStereo:!1,attach:!1,screenShare:!1,secondSource:!1,userVariables:{},requestTimeout:1e4,experimental:!1,autoApplyMediaParams:!0,iceGatheringTimeout:2e3,maxIceGatheringTimeout:5e3},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",e.ConferenceInfo="conferenceInfo",e.CaptionInfo="captionInfo",e.MemberTalkState="memberTalkState"}(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";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(26)),o=function(){return(new Date).toISOString().replace("T"," ").replace("Z","")},a=i.default.getLogger("signalwire"),s=a.methodFactory;a.methodFactory=function(e,t,n){var r=s(e,t,n);return function(){var e=[];"undefined"==typeof window&&e.push(o()+" -");for(var t=0;t<arguments.length;t++)e.push(arguments[t]);r.apply(void 0,e)}},a.setLevel(a.getLevel()),t.default=a},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",t.VERTO_PROTOCOL="verto-protocol",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=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=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""+o.STORAGE_PREFIX+e},t.mutateLiveArrayData=function(e){var t=i(e,3),n=t[0],o=t[1],a=t[2],s=o.memberID,c=o.callerIDNumber,u=o.callerIDName,l=o.company;return r({participantId:s,participantNumber:c,participantName:u,participantCompany:l,visibility:a},n)},t.safeParseJson=function(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return 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,i=void 0===r?{}:r,o=e.error;if(o)return{error:o};var a=i.result,s=void 0===a?null:a;if(null===s)return null!==n&&(i.node_id=n),{result:i};var c=s.code,u=void 0===c?null:c,l=s.node_id,d=void 0===l?null:l,f=s.result,p=void 0===f?null:f;return u&&"200"!==u?{error:s}:p?t.destructResponse(p,d):{result:s}},t.randomInt=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},t.roundToFixed=function(e,t){return void 0===t&&(t=2),Number(e.toFixed(t))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i={},o=function(e,t){return e+"|"+t},a=function(e,t){return void 0===t&&(t="GLOBAL"),o(e,t)in i};t.isQueued=a;t.queueLength=function(e,t){void 0===t&&(t="GLOBAL");var n=o(e,t);return n in i?i[n].length:0};var s=function(e,t,n){void 0===n&&(n="GLOBAL");var r=o(e,n);r in i||(i[r]=[]),i[r].push(t)};t.register=s;t.registerOnce=function(e,t,n){void 0===n&&(n="GLOBAL");var r=function(i){c(e,r,n),t(i)};return r.prototype.targetRef=t,s(e,r,n)};var c=function(e,t,n){if(void 0===n&&(n="GLOBAL"),!a(e,n))return!1;var s=o(e,n);if(r.isFunction(t))for(var c=i[s].length-1;c>=0;c--){var u=i[s][c];(t===u||u.prototype&&t===u.prototype.targetRef)&&i[s].splice(c,1)}else i[s]=[];return 0===i[s].length&&delete i[s],!0};t.deRegister=c;var u=function(e,t,n,r){void 0===n&&(n="GLOBAL"),void 0===r&&(r=!0);var s=r&&"GLOBAL"!==n;if(!a(e,n))return s&&u(e,t),!1;var c=o(e,n),l=i[c].length;if(!l)return s&&u(e,t),!1;for(var d=l-1;d>=0;d--)i[c][d](t);return s&&u(e,t),!0};t.trigger=u;t.deRegisterAll=function(e){var t=o(e,"");Object.keys(i).filter((function(e){return 0===e.indexOf(t)})).forEach((function(e){return delete i[e]}))};t.clearQueue=function(){return Object.keys(i).forEach((function(e){return delete i[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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},s=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=s(n(1)),l=c(n(7)),d=n(3),f=n(13),p=n(0);t.getUserMedia=function(e){return i(void 0,void 0,void 0,(function(){var t,n,r;return o(this,(function(i){switch(i.label){case 0:if(u.default.info("RTCService.getUserMedia",e),t=e.audio,n=e.video,!t&&!n)return[2,null];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,l.getUserMedia(e)];case 2:return[2,i.sent()];case 3:throw r=i.sent(),u.default.error("getUserMedia error: ",r),r;case 4:return[2]}}))}))},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.getMediaConstraints=function(e){return i(void 0,void 0,void 0,(function(){var t,n,r,i,a,s,c,u,l,d;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,a=void 0===i?"":i,r?[4,f.assureDeviceId(r,a,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 s=e.video,c=void 0!==s&&s,u=e.camId,l=e.camLabel,d=void 0===l?"":l,u?[4,f.assureDeviceId(u,d,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}]}}))}))},t.destructSubscribeResponse=function(e){var t={subscribed:[],alreadySubscribed:[],unauthorized:[],unsubscribed:[],notSubscribed:[]};return Object.keys(t).forEach((function(n){t[n]=e[n+"Channels"]||[]})),t};var h=function(e,t,n){if(void 0===t&&(t=null),void 0===n&&(n=null),!l.streamIsValid(e))return null;var r=function(e){switch(n){case!0:e.enabled=!0;break;case!1:e.enabled=!1;break;default:e.enabled=!e.enabled}};switch(t){case"audio":return e.getAudioTracks().forEach(r);case"video":return e.getVideoTracks().forEach(r);default:return e.getTracks().forEach(r)}};t.enableAudioTracks=function(e){return h(e,"audio",!0)},t.disableAudioTracks=function(e){return h(e,"audio",!1)},t.toggleAudioTracks=function(e){return h(e,"audio",null)},t.enableVideoTracks=function(e){return h(e,"video",!0)},t.disableVideoTracks=function(e){return h(e,"video",!1)},t.toggleVideoTracks=function(e){return h(e,"video",null)},t.mutateCanvasInfoData=function(e){for(var t=e.canvasID,n=e.layoutFloorID,i=e.scale,o=e.canvasLayouts,s=a(e,["canvasID","layoutFloorID","scale","canvasLayouts"]),c=[],u=!1,l=0;l<o.length;l++){var f=o[l],p=f.memberID,h=void 0===p?0:p,v=f.audioPOS,y=f.xPOS,m=f.yPOS,b=a(f,["memberID","audioPOS","xPOS","yPOS"]);u=u||Boolean(1===f.overlap&&f.layerOccupied),c.push(r({startX:d.roundToFixed(f.x/i*100)+"%",startY:d.roundToFixed(f.y/i*100)+"%",percentageWidth:d.roundToFixed(f.scale/i*100)+"%",percentageHeight:d.roundToFixed(f.hscale/i*100)+"%",participantId:String(h),audioPos:v,xPos:y,yPos:m},b))}return r(r({},s),{canvasId:t,layoutFloorId:n,scale:i,canvasLayouts:c,layoutOverlap:u})},t.checkIsDirectCall=function(e){var t=e.variables;return"object"==typeof t&&"verto_svar_direct_call"in t},t.destructConferenceState=function(e){var t=e.variables,n=void 0===t?{}:t,r=e.flags,i=void 0===r?{}:r,o=e.md5+"@"+e.domain,a=e.displayName||e.name,s=[],c=[],l=[];try{s=JSON.parse(n.custom_canvas),c=JSON.parse(n.custom_empty),l=JSON.parse(n.custom_alone)}catch(e){u.default.warn("Invalid conferenceState vars",e)}return{uuid:e.uuid,md5:e.md5,domain:e.domain,running:Boolean(e.running),laName:e.name,laChannel:"conference-liveArray."+o,infoChannel:"conference-info."+o,modChannel:"conference-mod."+o,chatChannel:"conference-chat."+o,confName:a,numMembers:Number(e.members)||0,isPrivate:"true"===n.is_private,mohPlaying:Boolean(e.mohPlaying),filesPlaying:Boolean(e.filesPlaying),filesRole:e.filesRole||null,filePlaybackRole:e.filePlaybackRole||null,filesPlayingName:e.filesPlayingName||null,filesPlayingVolume:Number(e.filesPlayingVolume)||0,filesPlayingPaused:Boolean(e.filesPlayingPaused),filesSeekable:Boolean(e.filesSeekable),asyncFilesPlaying:Boolean(e.asyncFilesPlaying),asyncFilesRole:e.asyncFilesRole||null,asyncFilesPlayingName:e.asyncFilesPlayingName||null,asyncFilesPlayingVolume:Number(e.asyncFilesPlayingVolume)||0,asyncFilesPlayingPaused:Boolean(e.asyncFilesPlayingPaused),asyncFilesSeekable:Boolean(e.asyncFilesSeekable),performerDelay:e.performerDelay,volAudience:e["vol-audience"],filesFullScreen:Boolean(e.filesFullScreen),vidFloorRole:e.vidFloorRole||null,motionQuality:e.motionQuality||1,motionQualityInbound:e.motionQualityIn||1,videoShuffle:e.videoShuffle||0,zones:e.zones||[],maxVisible:null==e?void 0:e.maxVisible,silentMode:i["silent-mode"]||!1,blindMode:i["blind-mode"]||!1,meetingMode:i["meeting-mode"]||!1,vidMuteHide:i["vid-mute-hide"]||!1,personalCanvas:Boolean(i.personalCanvas),personalCanvasTP:i.personalCanvasTP||null,locked:Boolean(i.locked),recording:Boolean(i.recording),liveMusic:Boolean(i.liveMusic),logosVisible:Boolean(i["logos-visible"]),handraiseOnscreen:Boolean(i["handraise-onscreen"]),publicClipeeze:"true"===n.public_clipeeze,confQuality:n.conf_quality,accessPin:n.access_pin||null,moderatorPin:n.moderator_pin||null,speakerHighlight:"true"===n.speaker_highlight,disableIntercom:!0===n.disable_intercom,lastSnapshot:n.lastSnapshot,lastLayoutGroup:n.lastLayoutGroup,lastLayout:n.lastLayout,userRecordFile:n.user_record_file||null,podcastMode:"true"===n.podcast_mode,publicDisableChat:"true"===n.public_disable_chat,chatOneWay:"true"===n.chat_one_way,bannerDisplayOption:n.banner_display_option,defaultPlayVolume:Number(n.default_play_volume)||0,hasSms:Boolean(n.has_sms),autoOpenNav:Boolean(n.auto_open_nav),customCanvas:s,customEmpty:c,customAlone:l}};var v=function(e,t){var n=t.type,r=t.name,i=t.displayName,o=t.resIDS,a=void 0===o?[]:o,s=i||r.replace(/[-_]/g," ");return e.concat({id:r,label:s,type:n,reservationIds:a,belongsToAGroup:!1})};function y(e,t){var n=e.label.toLowerCase(),r=t.label.toLowerCase();return n>r?1:n<r?-1:0}t.mungeLayoutList=function(e,t){var n=t.reduce((function(e,t){return e.concat(t.groupLayouts||[])}),[]),r=e.reduce(v,[]);return r.forEach((function(e){e.belongsToAGroup=n.includes(e.id)})),t.reduce(v,[]).concat(r).sort(y)}},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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(17),o=function(){function e(){}return e.prototype.buildRequest=function(e){this.request=r({jsonrpc:"2.0",id:i.v4()},e)},e}();t.default=o},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(3),s=o(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)};var c=function(){return navigator.mediaDevices.enumerateDevices()};t.enumerateDevices=c;t.enumerateDevicesByKind=function(e){return void 0===e&&(e=null),r(void 0,void 0,void 0,(function(){var t;return i(this,(function(n){switch(n.label){case 0:return[4,c().catch((function(e){return[]}))];case 1:return t=n.sent(),e&&(t=t.filter((function(t){return t.kind===e}))),[2,t]}}))}))};t.getSupportedConstraints=function(){return navigator.mediaDevices.getSupportedConstraints()};var u=function(e){return e&&e instanceof MediaStream};t.streamIsValid=u;t.attachMediaStream=function(e,t){var n=a.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=a.findElementByType(e);t&&(t.srcObject=null)};t.muteMediaElement=function(e){var t=a.findElementByType(e);t&&(t.muted=!0)};t.unmuteMediaElement=function(e){var t=a.findElementByType(e);t&&(t.muted=!1)};t.toggleMuteMediaElement=function(e){var t=a.findElementByType(e);t&&(t.muted=!t.muted)};t.setMediaElementSinkId=function(e,t){return r(void 0,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:if(null===(n=a.findElementByType(e)))return s.default.info("No HTMLMediaElement to attach the speakerId"),[2,!1];if("string"!=typeof t)return s.default.info("Invalid speaker deviceId: '"+t+"'"),[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){u(e)&&e.getTracks().forEach(l),e=null};var l=function(e){e&&"live"===e.readyState&&(e.stop(),e.dispatchEvent(new Event("ended")))};t.stopTrack=l;t.getHostname=function(){return window.location.hostname};t.buildVideoElementByTrack=function(e,t){void 0===t&&(t=[]);var n=document.createElement("video");n.muted=!0,n.autoplay=!0,n.playsinline=!0,n._streamIds=t;var r=new MediaStream([e]);n.srcObject=r;var i=function(){return console.debug("video can play!")},o=function(){return console.debug("video is now playing...")};return n.addEventListener("play",o),n.addEventListener("canplay",i),e.addEventListener("ended",(function(){n.removeEventListener("play",o),n.removeEventListener("canplay",i),n.srcObject=null,delete n._streamIds,n.remove()})),n};t.buildAudioElementByTrack=function(e,t){void 0===t&&(t=[]);var n=new Audio;n.autoplay=!0,n.playsinline=!0,n._streamIds=t;var r=new MediaStream([e]);n.srcObject=r;var i=function(){return console.debug("audio can play!")},o=function(){return console.debug("audio is now playing...")};return n.addEventListener("play",o),n.addEventListener("canplay",i),e.addEventListener("ended",(function(){n.removeEventListener("play",o),n.removeEventListener("canplay",i),n.srcObject=null,delete n._streamIds,n.remove()})),n}},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=o(n(10)),s=n(38);t.Login=s.Login;var c=n(39);t.Result=c.Result;var u=n(0),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Invite},t}(a.default);t.Invite=l;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Answer},t}(a.default);t.Answer=d;var f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Attach},t}(a.default);t.Attach=f;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Bye},t}(a.default);t.Bye=p;var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Modify},t}(a.default);t.Modify=h;var v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Info},t}(a.default);t.Info=v;var y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Broadcast},t}(a.default);t.Broadcast=y;var m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Subscribe},t}(a.default);t.Subscribe=m;var b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Unsubscribe},t}(a.default);t.Unsubscribe=b;var g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.JsApi},t}(a.default);t.JSApi=g;var _=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Stats},t}(a.default);t.Stats=_;var w=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.toString=function(){return u.VertoMethod.Ping},t}(a.default);t.Ping=w},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),a=function(){return"undefined"==typeof window&&"undefined"!=typeof process},s=function(e,t){return r(void 0,void 0,void 0,(function(){var n;return i(this,(function(r){return a()?[2,null]:(n=window[e].getItem(o.mutateStorageKey(t)),[2,o.safeParseJson(n)])}))}))},c=function(e,t,n){return r(void 0,void 0,void 0,(function(){return i(this,(function(r){return a()?[2,null]:("object"==typeof n&&(n=JSON.stringify(n)),window[e].setItem(o.mutateStorageKey(t),n),[2])}))}))},u=function(e,t){return r(void 0,void 0,void 0,(function(){return i(this,(function(n){return a()?[2,null]:[2,window[e].removeItem(o.mutateStorageKey(t))]}))}))};t.localStorage={getItem:function(e){return s("localStorage",e)},setItem:function(e,t){return c("localStorage",e,t)},removeItem:function(e){return u("localStorage",e)}},t.sessionStorage={getItem:function(e){return s("sessionStorage",e)},setItem:function(e,t){return c("sessionStorage",e,t)},removeItem:function(e){return u("sessionStorage",e)}}},function(e,t,n){"use strict";var r,i=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)}),o=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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=a(n(6)),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,i=(r.remoteSdp,r.localStream,r.remoteStream,r.onNotification,r.camId,r.micId,r.speakerId,o(r,["remoteSdp","localStream","remoteStream","onNotification","camId","micId","speakerId"]));for(var a in c)a&&i.hasOwnProperty(a)&&(i[c[a]]=i[a],delete i[a]);t.dialogParams=i}return n.buildRequest({method:n.toString(),params:t}),n}return i(t,e),t}(s.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(19);t.Connect=r.Connect;var i=n(29);t.Execute=i.Execute;var o=n(30);t.Subscription=o.Subscription;var a=n(31);t.Reauthenticate=a.Reauthenticate;var s=n(32);t.Ping=s.Ping},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=c(n(1)),l=c(n(34)),d=n(7),f=n(0),p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._statsInterval=null,t}return i(t,e),t.prototype.startScreenShare=function(e){return a(this,void 0,void 0,(function(){var n,r,i,a,c,u,l,f,p,h,v,y,m=this;return s(this,(function(s){switch(s.label){case 0:return r=(n=e||{}).audio,i=void 0!==r&&r,a=n.video,c=void 0===a||a,[4,d.getDisplayMedia({audio:i,video:c})];case 1:return(u=s.sent()).getVideoTracks().forEach((function(e){e.addEventListener("ended",(function(){m.screenShare&&m.screenShare.hangup()}))})),l=this.options,f=l.remoteCallerName,p=l.remoteCallerNumber,h=l.callerName,v=l.callerNumber,y=o({screenShare:!0,recoverCall:!1,skipLiveArray:!0,skipNotifications:!0,localStream:u,destinationNumber:this.extension,remoteCallerName:f,remoteCallerNumber:p,callerName:h+" (Screen)",callerNumber:v+" (Screen)"},e),this.screenShare=new t(this.session,y),this.screenShare.invite(),[2,this.screenShare]}}))}))},t.prototype.stopScreenShare=function(){this.screenShare instanceof t&&this.screenShare.hangup()},t.prototype.addSecondSource=function(e){return a(this,void 0,void 0,(function(){var n,r,i,a,c,u;return s(this,(function(s){return n=this.options,r=n.remoteCallerName,i=n.remoteCallerNumber,a=n.callerName,c=n.callerNumber,u=o({secondSource:!0,recoverCall:!1,skipLiveArray:!0,skipNotifications:!0,destinationNumber:this.extension,remoteCallerName:r,remoteCallerNumber:i,callerName:a+" (Second Source)",callerNumber:c+" (Second Source)",localStream:null},e),this.secondSource=new t(this.session,u),this.secondSource.invite(),[2,this.secondSource]}))}))},t.prototype.removeSecondSource=function(){this.secondSource instanceof t&&this.secondSource.hangup()},t.prototype.setAudioOutDevice=function(e){return a(this,void 0,void 0,(function(){var t,n,r;return s(this,(function(i){switch(i.label){case 0:if(this.options.speakerId=e,t=this.options,n=t.remoteElement,r=t.speakerId,!0!==t.experimental)return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.audioElements[0].setSinkId(r)];case 2:return i.sent(),this._dispatchNotification({type:f.Notification.DeviceUpdated}),[3,4];case 3:return i.sent(),console.error("setAudioOutDevice error",this.audioElements,r),[3,4];case 4:return[2];case 5:return[2,d.setMediaElementSinkId(n,r)]}}))}))},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 a(t,void 0,void 0,(function(){var e,t,n,r;return s(this,(function(i){switch(i.label){case 0:return[4,this.peer.instance.getStats(null)];case 1:return e=i.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=p},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},s=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 c=a(n(1)),u=s(n(7)),l=n(0);t.checkPermissions=function(e){return void 0===e&&(e=null),r(void 0,void 0,void 0,(function(){var t;return i(this,(function(n){switch(n.label){case 0:return[4,u.enumerateDevicesByKind(e)];case 1:return(t=n.sent()).length?[2,t.every((function(e){var t=e.deviceId,n=e.label;return Boolean(t&&n)}))]:(c.default.warn("No "+e+" devices to check for permissions!"),[2,null])}}))}))},t.checkVideoPermissions=function(){return t.checkPermissions(l.DeviceType.Video)},t.checkAudioPermissions=function(){return t.checkPermissions(l.DeviceType.AudioIn)};t.getDevicesWithPermissions=function(e,n){return void 0===e&&(e=null),void 0===n&&(n=!1),r(void 0,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return[4,t.checkPermissions(e)];case 1:return!1!==i.sent()?[3,3]:(r=function(e){return void 0===e&&(e=null),{audio:!e||e===l.DeviceType.AudioIn||e===l.DeviceType.AudioOut,video:!e||e===l.DeviceType.Video}}(e),[4,u.getUserMedia(r)]);case 2:o=i.sent(),u.stopStream(o),i.label=3;case 3:return[2,t.getDevices(e,n)]}}))}))},t.getVideoDevicesWithPermissions=function(){return t.getDevicesWithPermissions(l.DeviceType.Video)},t.getAudioInDevicesWithPermissions=function(){return t.getDevicesWithPermissions(l.DeviceType.AudioIn)},t.getAudioOutDevicesWithPermissions=function(){return t.getDevicesWithPermissions(l.DeviceType.AudioOut)},t.getDevices=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;return i(this,(function(i){switch(i.label){case 0:return[4,u.enumerateDevicesByKind(e)];case 1:return n=i.sent(),!0===t?[2,n]:(r=[],[2,n.filter((function(e){var t=e.deviceId,n=e.kind,i=e.groupId;if(!t)return!1;if(!i)return!0;var o=n+"-"+i;return!r.includes(o)&&(r.push(o),!0)}))])}}))}))},t.getVideoDevices=function(){return t.getDevices(l.DeviceType.Video)},t.getAudioInDevices=function(){return t.getDevices(l.DeviceType.AudioIn)},t.getAudioOutDevices=function(){return t.getDevices(l.DeviceType.AudioOut)};var d=[[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,a,s,c,l;return i(this,(function(i){switch(i.label){case 0:return t=[],[4,u.getUserMedia({video:{deviceId:{exact:e}}})];case 1:n=i.sent(),r=n.getVideoTracks()[0],a=0,i.label=2;case 2:return a<d.length?(s=o(d[a],2),c=s[0],l=s[1],[4,r.applyConstraints({width:{exact:c},height:{exact:l}}).then((function(){return!0})).catch((function(){return!1}))]):[3,5];case 3:i.sent()&&t.push({resolution:c+"x"+l,width:c,height:l}),i.label=4;case 4:return a++,[3,2];case 5:return u.stopStream(n),[2,t]}}))}))},t.assureDeviceId=function(e,n,o){return r(void 0,void 0,void 0,(function(){var r,a,s,c,u;return i(this,(function(i){switch(i.label){case 0:return[4,t.getDevices(o,!0)];case 1:for(r=i.sent(),a=0;a<r.length;a++)if(s=r[a],c=s.deviceId,u=s.label,e===c||n===u)return[2,c];return[2,null]}}))}))},t.validateVideoDevice=function(e,n){return t.assureDeviceId(e,n,l.DeviceType.Video)},t.validateAudioInDevice=function(e,n){return t.assureDeviceId(e,n,l.DeviceType.AudioIn)},t.validateAudioOutDevice=function(e,n){return t.assureDeviceId(e,n,l.DeviceType.AudioOut)},t.checkDeviceIdConstraints=function(e,n,o,a){return r(void 0,void 0,void 0,(function(){var r,s;return i(this,(function(i){switch(i.label){case 0:return r=a.deviceId,null!==(void 0===r?null:r)||!e&&!n?[3,2]:[4,t.assureDeviceId(e,n,o).catch((function(e){return null}))];case 1:(s=i.sent())&&(a.deviceId={exact:s}),i.label=2;case 2:return[2,a]}}))}))},t.requestPermissions=function(e){return r(void 0,void 0,void 0,(function(){var t;return i(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,u.getUserMedia(e)];case 1:return t=n.sent(),u.stopStream(t),[3,3];case 2:throw n.sent();case 3:return[2]}}))}))}},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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),a=n(0);t.default=function(e,t){var n=t.eventChannel,c=t.eventSerno,u=t.data,l=i(n.match(/conference-liveArray.(.*)@(.*)/),3),d=l[1],f=l[2],p=e.channelToCallIds.get(n)||[],h=u.action,v=u.data,y=u.hashKey,m=u.wireSerno;switch(h){case"bootObj":var b=[];for(var g in v){var _=r({callId:v[g][0],confMd5:d,domain:f,eventChannel:n},o.mutateLiveArrayData(v[g][1])),w=_.callId,S=_.audio,P=_.video;p.includes(w)&&S&&P&&e.calls[w]&&e.calls[w].updateFromLaChannel(S.muted,P.muted),b.push(_)}return s(e,{action:a.ConferenceAction.Bootstrap,participants:b,confMd5:d,domain:f,eventChannel:n,eventSerno:c,wireSerno:m},p);case"add":return s(e,r({action:a.ConferenceAction.Add,callId:y,confMd5:d,domain:f,eventChannel:n,eventSerno:c,wireSerno:m},o.mutateLiveArrayData(v)),p);case"modify":var O=r({action:a.ConferenceAction.Modify,callId:y,confMd5:d,domain:f,eventChannel:n,eventSerno:c,wireSerno:m},o.mutateLiveArrayData(v));if(p.includes(y)){S=O.audio,P=O.video;S&&P&&e.calls[y]&&e.calls[y].updateFromLaChannel(S.muted,P.muted)}return s(e,O,p);case"del":return s(e,r({action:a.ConferenceAction.Delete,callId:y,confMd5:d,domain:f,eventChannel:n,eventSerno:c,wireSerno:m},o.mutateLiveArrayData(v)),p);case"clear":return s(e,{action:a.ConferenceAction.Clear,confMd5:d,domain:f,eventChannel:n,eventSerno:c,wireSerno:m,confName:u.name||null},p);default:return s(e,{action:h,data:v,callId:y,confMd5:d,domain:f,eventChannel:n,eventSerno:c,wireSerno:m},p)}},t.publicLiveArrayMethods={liveArrayBootstrap:function(){var e=this.session,t=this.nodeId,n=this.channel,r={liveArray:{command:"bootstrap",context:n,name:this.laName}};e.vertoBroadcast({nodeId:t,channel:n,data:r})}};var s=function(e,t,n){n.length?n.forEach((function(n){e.calls[n]&&e.calls[n]._dispatchConferenceUpdate(t)})):e.dispatchConferenceUpdate(t)}},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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=n(5);t.default=function(e,t){var n=t.data,i=t.eventChannel,c=t.eventSerno,u=void 0===c?null:c,l=e.channelToCallIds.get(i)||[],d=null;switch(n["conf-command"]){case"list-videoLayouts":if(n.responseData){var f=n.responseData.filter((function(e){return"layout"===e.type})),p=n.responseData.filter((function(e){return"layoutGroup"===e.type})),h=a.mungeLayoutList(f,p);d={action:o.ConferenceAction.LayoutList,eventChannel:i,eventSerno:u,layouts:h}}break;case"getConferenceState":n.responseData&&s(e,{action:o.ConferenceAction.ConferenceInfo,eventChannel:i,eventSerno:u,conferenceState:a.destructConferenceState(n.responseData),messages:[]},l);break;default:d=r(r({},n),{action:o.ConferenceAction.ModCmdResponse,eventChannel:i,eventSerno:u,command:n["conf-command"]})}d&&s(e,d,l)};var s=function(e,t,n){n.length?n.forEach((function(n){e.calls[n]&&e.calls[n]._dispatchConferenceUpdate(t)})):e.dispatchConferenceUpdate(t)};function c(e){var t=this.session,n=this.nodeId,o=this.channel,a=i(this,["session","nodeId","channel"]);if(!o)return console.warn("Missing modChannel");var s=r(r({application:"conf-control"},a),e);t.vertoBroadcast({nodeId:n,channel:o,data:s})}t.publicModMethods={modCommand:function(e,t,n){return c.call(this,{command:e,id:t,value:n})},listVideoLayouts:function(){return c.call(this,{command:"list-videoLayouts"})},getConferenceState:function(){return c.call(this,{command:"getConferenceState"})},playMedia:function(e){return c.call(this,{command:"play",value:e})},stopMedia:function(){return c.call(this,{command:"stop",value:"all"})},pauseMedia:function(e){void 0===e&&(e=!0);var t=e?"async":"";return c.call(this,{command:"pause_play",value:[t]})},fileSeek:function(e,t){void 0===t&&(t=!0);var n=t?"async":"";return c.call(this,{command:"file_seek",value:[String(e),n]})},fileVolume:function(e,t){void 0===t&&(t=!0);var n=t?"async":"";return c.call(this,{command:"file-vol",value:[String(e),n]})},fileReservationId:function(e,t){void 0===t&&(t=!0);var n=t?"async":"";return c.call(this,{command:"file-res-id",value:[String(e),n]})},startRecord:function(e){return c.call(this,{command:"recording",value:["start",e]})},stopRecord:function(){return c.call(this,{command:"recording",value:["stop","all"]})},snapshot:function(e){return c.call(this,{command:"vid-write-png",value:e})},lock:function(){return c.call(this,{command:"lock"})},unlock:function(){return c.call(this,{command:"unlock"})},setVideoLayout:function(e,t){var n=t?[e,t]:e;return c.call(this,{command:"vid-layout",value:n})},kick:function(e){return c.call(this,{command:"kick",id:e})},muteAudioAll:function(e){return void 0===e&&(e="nores:nofloor"),c.call(this,{command:"mute",value:["all",e]})},unmuteAudioAll:function(){return c.call(this,{command:"unmute",value:"all"})},muteVideoAll:function(){return c.call(this,{command:"vmute",value:"all"})},unmuteVideoAll:function(){return c.call(this,{command:"unvmute",value:"all"})},muteAudio:function(e){return c.call(this,{command:"mute",id:e})},unmuteAudio:function(e){return c.call(this,{command:"unmute",id:e})},toggleAudioMute:function(e){return c.call(this,{command:"tmute",id:e})},muteVideo:function(e){return c.call(this,{command:"vmute",id:e})},unmuteVideo:function(e){return c.call(this,{command:"unvmute",id:e})},toggleVideoMute:function(e){return c.call(this,{command:"tvmute",id:e})},deaf:function(e){return c.call(this,{command:"deaf",id:e})},undeaf:function(e){return c.call(this,{command:"undeaf",id:e})},setReservationId:function(e,t){return void 0===t&&(t="presenter"),c.call(this,{command:"vid-res-id",id:e,value:t})},videoFloor:function(e){return c.call(this,{command:"vid-floor",id:e,value:"force"})},banner:function(e,t){return c.call(this,{command:"vid-banner",id:e,value:encodeURI(t)})},volumeDown:function(e){return c.call(this,{command:"volume_out",id:e,value:"down"})},volumeUp:function(e){return c.call(this,{command:"volume_out",id:e,value:"up"})},gainDown:function(e){return c.call(this,{command:"volume_in",id:e,value:"down"})},gainUp:function(e){return c.call(this,{command:"volume_in",id:e,value:"up"})},setEnergy:function(e,t){return c.call(this,{command:"energy",id:e,value:t})},transferMember:function(e,t){return c.call(this,{command:"transfer",id:e,value:t})},setDenoise:function(e,t){return void 0===t&&(t=null),c.call(this,{command:"denoise",id:e,value:t})},setLowBitrate:function(e,t){return void 0===t&&(t=null),c.call(this,{command:"lowbr",id:e,value:t})},addToCall:function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=""),c.call(this,{command:"xdial",value:[e,t,n]})},setHandRaised:function(e,t){return void 0===t&&(t=null),c.call(this,{command:"handraise",id:e,value:t})},setVidFloorResId:function(e){return c.call(this,{command:"vid-floor-res-id",value:e})},confQuality:function(e){return c.call(this,{command:"quality.lua",value:e})},confMotionQuality:function(e){return c.call(this,{command:"motion-quality",value:e})},confMotionQualityInbound:function(e){return c.call(this,{command:"motion-quality-in",value:e})},confMotionQualityMember:function(e,t){return c.call(this,{command:"motion-quality-member",id:e,value:t})},confFullscreen:function(e,t){return c.call(this,{command:"full-screen",id:e,value:t})},sayAll:function(e){return c.call(this,{command:"say",value:e})},sayMember:function(e,t){return c.call(this,{command:"saymember",id:e,value:t})},setBanner:function(e,t){return c.call(this,{command:"banner.lua",id:e,value:t})},setPerformerDelay:function(e){return c.call(this,{command:"performer-delay",value:e})},setVolumeAudience:function(e){return c.call(this,{command:"vol-audience",value:e})},toggleVidMuteHide:function(e){return void 0===e&&(e="toggle"),c.call(this,{command:"vid-mute-hide",value:e})},setMeetingMode:function(e){return void 0===e&&(e="toggle"),c.call(this,{command:"meeting-mode",value:e})},setSilentMode:function(e){return void 0===e&&(e="toggle"),c.call(this,{command:"silent-mode",value:e})},setBlindMode:function(e){return void 0===e&&(e="toggle"),c.call(this,{command:"blind-mode",value:e})},setConfVariable:function(e,t){return c.call(this,{command:"setvar",value:[e,String(t)]})},grantModerator:function(e,t){return c.call(this,{command:"grant-moderator",id:e,value:t})},grantScreenShare:function(e,t){return c.call(this,{command:"grant-share",id:e,value:t})},setPin:function(e){return c.call(this,{command:"pin",value:e})},removePin:function(){return c.call(this,{command:"nopin"})},setModeratorPin:function(e){return c.call(this,{command:"pin",value:"mod "+e})},removeModeratorPin:function(){return c.call(this,{command:"pin",value:"nomod"})},setConfLayoutMode:function(e){return c.call(this,{command:"vid-personal",value:e})},shuffleVideo:function(e){return c.call(this,{command:"vid-shuffle",value:e})},setVidLogos:function(e){return c.call(this,{command:"vid-logos",value:e})},setHandraiseOnscreen:function(e){return c.call(this,{command:"handraise-onscreen",value: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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=o(n(1)),s=n(0),c=n(5);t.default=function(e,t){var n=t.eventData,r=void 0===n?null:n,i=t.eventChannel,o=t.eventSerno,l=void 0===o?null:o;if(t.data)return a.default.debug("Unhandled conference info event",t);if(!r)return a.default.warn("Unknown conference info event",t);var d=e.channelToCallIds.get(i)||[];switch(r.contentType){case"layout-info":d.length&&d.forEach((function(t){e.calls[t]&&e.calls[t].updateLayouts(r)}));break;case"conference-info":var f=r.conferenceState,p=r.messages,h=void 0===p?[]:p;return u(e,{action:s.ConferenceAction.ConferenceInfo,eventChannel:i,eventSerno:l,conferenceState:c.destructConferenceState(f),messages:h},d);case"member-talk-state":var v=r.callID,y=r.memberID,m=r.talking;return u(e,{action:s.ConferenceAction.MemberTalkState,eventChannel:i,eventSerno:l,callID:v,memberID:y,talking:m},d);case"caption-info":d.length&&d.forEach((function(t){e.calls[t]&&e.calls[t].handleCaptionInfo(r)}));break;default:a.default.warn("Unknown conference info event",t)}};var u=function(e,t,n){n.length?n.forEach((function(n){e.calls[n]&&e.calls[n]._dispatchConferenceUpdate(t)})):e.dispatchConferenceUpdate(t)};function l(e){var t=this.session,n=this.nodeId,o=this.channel,a=i(this,["session","nodeId","channel"]);if(!o)return console.warn("Missing modChannel");var s=r(r({application:"conf-control"},a),e);t.vertoBroadcast({nodeId:n,channel:o,data:s})}t.publicInfoMethods={infoCommand:function(e,t,n){return l.call(this,{command:e,id:t,value:n})},getLayoutInfo:function(){return l.call(this,{command:"get-layout-info"})},getConferenceState:function(){return l.call(this,{command:"get-conference-state"})}}},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 I})),n.d(t,"v5",(function(){return M})),n.d(t,"NIL",(function(){return E})),n.d(t,"version",(function(){return x})),n.d(t,"validate",(function(){return s})),n.d(t,"stringify",(function(){return f})),n.d(t,"parse",(function(){return y}));var i=new Uint8Array(16);function o(){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(i)}var a=/^(?:[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 s=function(e){return"string"==typeof e&&a.test(e)},c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));var l,d,f=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(!s(n))throw TypeError("Stringified UUID is invalid");return n},p=0,h=0;var v=function(e,t,n){var r=t&&n||0,i=t||new Array(16),a=(e=e||{}).node||l,s=void 0!==e.clockseq?e.clockseq:d;if(null==a||null==s){var c=e.random||(e.rng||o)();null==a&&(a=l=[1|c[0],c[1],c[2],c[3],c[4],c[5]]),null==s&&(s=d=16383&(c[6]<<8|c[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),v=void 0!==e.nsecs?e.nsecs:h+1,y=u-p+(v-h)/1e4;if(y<0&&void 0===e.clockseq&&(s=s+1&16383),(y<0||u>p)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=u,h=v,d=s;var m=(1e4*(268435455&(u+=122192928e5))+v)%4294967296;i[r++]=m>>>24&255,i[r++]=m>>>16&255,i[r++]=m>>>8&255,i[r++]=255&m;var b=u/4294967296*1e4&268435455;i[r++]=b>>>8&255,i[r++]=255&b,i[r++]=b>>>24&15|16,i[r++]=b>>>16&255,i[r++]=s>>>8|128,i[r++]=255&s;for(var g=0;g<6;++g)i[r+g]=a[g];return t||f(i)};var y=function(e){if(!s(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 m=function(e,t,n){function r(e,r,i,o){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 a=new Uint8Array(16+e.length);if(a.set(r),a.set(e,r.length),(a=n(a))[6]=15&a[6]|t,a[8]=63&a[8]|128,i){o=o||0;for(var s=0;s<16;++s)i[o+s]=a[s];return i}return f(a)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r};function b(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 _(e,t,n,r,i,o){return g((a=g(g(t,e),g(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function w(e,t,n,r,i,o,a){return _(t&n|~t&r,e,t,i,o,a)}function S(e,t,n,r,i,o,a){return _(t&r|n&~r,e,t,i,o,a)}function P(e,t,n,r,i,o,a){return _(t^n^r,e,t,i,o,a)}function O(e,t,n,r,i,o,a){return _(n^(t|~r),e,t,i,o,a)}var k=m("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 i=e[r>>5]>>>r%32&255,o=parseInt("0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[b(t)-1]=t;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<e.length;a+=16){var s=n,c=r,u=i,l=o;n=w(n,r,i,o,e[a],7,-680876936),o=w(o,n,r,i,e[a+1],12,-389564586),i=w(i,o,n,r,e[a+2],17,606105819),r=w(r,i,o,n,e[a+3],22,-1044525330),n=w(n,r,i,o,e[a+4],7,-176418897),o=w(o,n,r,i,e[a+5],12,1200080426),i=w(i,o,n,r,e[a+6],17,-1473231341),r=w(r,i,o,n,e[a+7],22,-45705983),n=w(n,r,i,o,e[a+8],7,1770035416),o=w(o,n,r,i,e[a+9],12,-1958414417),i=w(i,o,n,r,e[a+10],17,-42063),r=w(r,i,o,n,e[a+11],22,-1990404162),n=w(n,r,i,o,e[a+12],7,1804603682),o=w(o,n,r,i,e[a+13],12,-40341101),i=w(i,o,n,r,e[a+14],17,-1502002290),r=w(r,i,o,n,e[a+15],22,1236535329),n=S(n,r,i,o,e[a+1],5,-165796510),o=S(o,n,r,i,e[a+6],9,-1069501632),i=S(i,o,n,r,e[a+11],14,643717713),r=S(r,i,o,n,e[a],20,-373897302),n=S(n,r,i,o,e[a+5],5,-701558691),o=S(o,n,r,i,e[a+10],9,38016083),i=S(i,o,n,r,e[a+15],14,-660478335),r=S(r,i,o,n,e[a+4],20,-405537848),n=S(n,r,i,o,e[a+9],5,568446438),o=S(o,n,r,i,e[a+14],9,-1019803690),i=S(i,o,n,r,e[a+3],14,-187363961),r=S(r,i,o,n,e[a+8],20,1163531501),n=S(n,r,i,o,e[a+13],5,-1444681467),o=S(o,n,r,i,e[a+2],9,-51403784),i=S(i,o,n,r,e[a+7],14,1735328473),r=S(r,i,o,n,e[a+12],20,-1926607734),n=P(n,r,i,o,e[a+5],4,-378558),o=P(o,n,r,i,e[a+8],11,-2022574463),i=P(i,o,n,r,e[a+11],16,1839030562),r=P(r,i,o,n,e[a+14],23,-35309556),n=P(n,r,i,o,e[a+1],4,-1530992060),o=P(o,n,r,i,e[a+4],11,1272893353),i=P(i,o,n,r,e[a+7],16,-155497632),r=P(r,i,o,n,e[a+10],23,-1094730640),n=P(n,r,i,o,e[a+13],4,681279174),o=P(o,n,r,i,e[a],11,-358537222),i=P(i,o,n,r,e[a+3],16,-722521979),r=P(r,i,o,n,e[a+6],23,76029189),n=P(n,r,i,o,e[a+9],4,-640364487),o=P(o,n,r,i,e[a+12],11,-421815835),i=P(i,o,n,r,e[a+15],16,530742520),r=P(r,i,o,n,e[a+2],23,-995338651),n=O(n,r,i,o,e[a],6,-198630844),o=O(o,n,r,i,e[a+7],10,1126891415),i=O(i,o,n,r,e[a+14],15,-1416354905),r=O(r,i,o,n,e[a+5],21,-57434055),n=O(n,r,i,o,e[a+12],6,1700485571),o=O(o,n,r,i,e[a+3],10,-1894986606),i=O(i,o,n,r,e[a+10],15,-1051523),r=O(r,i,o,n,e[a+1],21,-2054922799),n=O(n,r,i,o,e[a+8],6,1873313359),o=O(o,n,r,i,e[a+15],10,-30611744),i=O(i,o,n,r,e[a+6],15,-1560198380),r=O(r,i,o,n,e[a+13],21,1309151649),n=O(n,r,i,o,e[a+4],6,-145523070),o=O(o,n,r,i,e[a+11],10,-1120210379),i=O(i,o,n,r,e[a+2],15,718787259),r=O(r,i,o,n,e[a+9],21,-343485551),n=g(n,s),r=g(r,c),i=g(i,u),o=g(o,l)}return[n,r,i,o]}(function(e){if(0===e.length)return[];for(var t=8*e.length,n=new Uint32Array(b(t)),r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))}));var I=function(e,t,n){var r=(e=e||{}).random||(e.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return f(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 T(e,t){return e<<t|e>>>32-t}var M=m("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 i=0;i<r.length;++i)e.push(r.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var o=e.length/4+2,a=Math.ceil(o/16),s=new Array(a),c=0;c<a;++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];s[c]=u}s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295;for(var d=0;d<a;++d){for(var f=new Uint32Array(80),p=0;p<16;++p)f[p]=s[d][p];for(var h=16;h<80;++h)f[h]=T(f[h-3]^f[h-8]^f[h-14]^f[h-16],1);for(var v=n[0],y=n[1],m=n[2],b=n[3],g=n[4],_=0;_<80;++_){var w=Math.floor(_/20),S=T(v,5)+C(w,y,m,b)+g+t[w]+f[_]>>>0;g=b,b=m,m=T(y,30)>>>0,y=v,v=S}n[0]=n[0]+v>>>0,n[1]=n[1]+y>>>0,n[2]=n[2]+m>>>0,n[3]=n[3]+b>>>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]]})),E="00000000-0000-0000-0000-000000000000";var x=function(e){if(!s(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},c=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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},l=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 d=u(n(25)),f=n(4),p=n(2),h=n(0),v=n(5),y=n(13),m=u(n(10)),b=n(11),g=n(8),_=n(9),w=n(7),S=u(n(14)),P=u(n(15)),O=u(n(16)),k=l(n(40)),I=u(n(22)),C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.calls={},t.conferences={},t.channelToCallIds=new Map,t.autoRecoverCalls=!0,t.incognito=!1,t._iceServers=[],t._localElement=null,t._remoteElement=null,t._jwtAuth=!0,t._audioConstraints=!0,t._videoConstraints=!1,t._speaker=null,t._purgeTimeout=null,t._experimental=!1,t.watchVertoConferences=function(e){return a(t,void 0,void 0,(function(){var t,n,r,i,o,a,c,u,l,d,f,p,h=this;return s(this,(function(s){switch(s.label){case 0:return this.conferences={},[4,this.vertoConferenceList(e)];case 1:return(t=s.sent()).forEach((function(e){h.conferences[e.uuid]=new I.default(h,e)})),o=[n="conference-info",r="conference-liveArray",i="conference-mod"],this._detachChannels(o),[4,this.vertoSubscribe({nodeId:this.nodeid,channels:o})];case 2:return a=s.sent(),c=v.destructSubscribeResponse(a),u=c.subscribed,l=void 0===u?[]:u,d=c.alreadySubscribed,f=void 0===d?[]:d,(p=l.concat(f)).includes(r)&&this._addSubscription(this.relayProtocol,S.default.bind(this,this),r),p.includes(n)&&(this.off("signalwire.notification",this._watchRoomsNotificationHandler),this.on("signalwire.notification",this._watchRoomsNotificationHandler),this._addSubscription(this.relayProtocol,O.default.bind(this,this),n)),p.includes(i)&&this._addSubscription(this.relayProtocol,P.default.bind(this,this),i),[2,t]}}))}))},t._watchRoomsNotificationHandler=function(e){if("conferenceUpdate"===e.type)switch(e.action){case"clear":Object.keys(t.conferences).forEach((function(n){t.conferences[n].confName===e.confName&&delete t.conferences[n]}));break;case"conferenceInfo":var n=e.conferenceState,r=n.uuid;if(n.running){var i=v.destructConferenceState(n);t.conferences[r]=new I.default(t,i)}else delete t.conferences[r]}},t.unwatchVertoConferences=function(){return a(t,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return this.conferences={},"conference-info","conference-liveArray","conference-mod",e=["conference-info","conference-liveArray","conference-mod"],this._detachChannels(e),[4,this.vertoUnsubscribe({nodeId:this.nodeid,channels:e})];case 1:return t.sent(),[2]}}))}))},t._detachChannels=function(e){e.forEach((function(e){f.deRegister(t.relayProtocol,null,e),t._removeSubscription(t.relayProtocol,e)}))},t.watchVertoConferenceList=function(){return a(t,void 0,void 0,(function(){var e,t,n,r,i,o,a,c,u,l=this;return s(this,(function(s){switch(s.label){case 0:return this.conferences={},t=[e="conference-list"],this._detachChannels(t),[4,this.vertoSubscribe({nodeId:this.nodeid,channels:t})];case 1:return n=s.sent(),r=v.destructSubscribeResponse(n),i=r.subscribed,o=void 0===i?[]:i,a=r.alreadySubscribed,c=void 0===a?[]:a,o.concat(c).includes(e)&&(this._addSubscription(this.relayProtocol,k.default.bind(this,this),e),u={session:this,nodeId:this.nodeid,channel:e},Object.keys(k.publicConferenceListMethods).forEach((function(e){Object.defineProperty(l,e,{configurable:!0,writable:!0,value:k.publicConferenceListMethods[e].bind(u)})})),this.conferenceListBootstrap()),[2]}}))}))},t.unwatchVertoConferenceList=function(){return a(t,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return"conference-list",e=["conference-list"],this._detachChannels(e),[4,this.vertoUnsubscribe({nodeId:this.nodeid,channels:e})];case 1:return t.sent(),[2]}}))}))},t}return i(t,e),Object.defineProperty(t.prototype,"callIds",{get:function(){return Object.keys(this.calls)},enumerable:!0,configurable:!0}),t.prototype.addChannelCallIdEntry=function(e,t){var n=(this.channelToCallIds.get(e)||[]).filter((function(e){return e!==t}));n.push(t),this.channelToCallIds.set(e,n)},t.prototype.removeChannelCallIdEntry=function(e,t){var n=(this.channelToCallIds.get(e)||[]).filter((function(e){return e!==t}));this.channelToCallIds.set(e,n)},Object.defineProperty(t.prototype,"reconnectDelay",{get:function(){return 1e3},enumerable:!0,configurable:!0}),t.prototype.connect=function(){return a(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return this.incognito?[3,2]:(t=this,[4,_.localStorage.getItem(p.SESSION_ID)]);case 1:t.sessionid=n.sent(),n.label=2;case 2:return e.prototype.connect.call(this),[2]}}))}))},t.prototype.checkPermissions=function(e,t){return void 0===e&&(e=!0),void 0===t&&(t=!0),a(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,v.getUserMedia({audio:e,video:t})];case 1:return n=r.sent(),w.stopStream(n),[2,!0];case 2:return r.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.purge=function(){var e=this;Object.keys(this.calls).forEach((function(t){return e.calls[t].setState(h.State.Purge)})),this.calls={}},t.prototype.disconnect=function(){return a(this,void 0,void 0,(function(){var t,n=this;return s(this,(function(r){switch(r.label){case 0:return t=Object.keys(this.calls).map((function(e){return n.calls[e].hangup()})),[4,Promise.all(t)];case 1:return r.sent(),this.purge(),[2,e.prototype.disconnect.call(this)]}}))}))},t.prototype.speedTest=function(e){var t=this;return new Promise((function(n,r){if(f.registerOnce(p.SwEvent.SpeedTest,(function(t){var r=t.upDur,i=t.downDur,o=i?8*e/(i/1e3)/1024:0;n({upDur:r,downDur:i,upKps:(r?8*e/(r/1e3)/1024:0).toFixed(0),downKps:o.toFixed(0)})}),t.uuid),!(e=Number(e)))return r("Invalid parameter 'bytes': "+e);t.executeRaw("#SPU "+e);var i=e/1024;e%1024&&i++;for(var o=".".repeat(1024),a=0;a<i;a++)t.executeRaw("#SPB "+o);t.executeRaw("#SPE")}))},t.prototype.getDevices=function(){var e=this;return y.getDevices().catch((function(t){return f.trigger(p.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getVideoDevices=function(){var e=this;return y.getDevices(h.DeviceType.Video).catch((function(t){return f.trigger(p.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getAudioInDevices=function(){var e=this;return y.getDevices(h.DeviceType.AudioIn).catch((function(t){return f.trigger(p.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.getAudioOutDevices=function(){var e=this;return y.getDevices(h.DeviceType.AudioOut).catch((function(t){return f.trigger(p.SwEvent.MediaError,t,e.uuid),[]}))},t.prototype.validateDeviceId=function(e,t,n){return y.assureDeviceId(e,t,n)},t.prototype.validateVideoDevice=function(e,t){return y.assureDeviceId(e,t,"videoinput")},t.prototype.validateAudioInDevice=function(e,t){return y.assureDeviceId(e,t,"audioinput")},t.prototype.validateAudioOutDevice=function(e,t){return y.assureDeviceId(e,t,"audiooutput")},t.prototype.getDeviceResolutions=function(e){return y.scanResolutions(e)},Object.defineProperty(t.prototype,"mediaConstraints",{get:function(){return{audio:this._audioConstraints,video:this._videoConstraints}},enumerable:!0,configurable:!0}),t.prototype.setAudioSettings=function(e){return a(this,void 0,void 0,(function(){var t,n,r,i;return s(this,(function(o){switch(o.label){case 0:return t=e.micId,n=e.micLabel,r=c(e,["micId","micLabel"]),v.removeUnsupportedConstraints(r),i=this,[4,y.checkDeviceIdConstraints(t,n,"audioinput",r)];case 1:return i._audioConstraints=o.sent(),this.micId=t,this.micLabel=n,[2,this._audioConstraints]}}))}))},t.prototype.disableMicrophone=function(){this.micId=null,this.micLabel=null,this._audioConstraints=!1},t.prototype.enableMicrophone=function(){this._audioConstraints=!0},t.prototype.setVideoSettings=function(e){return a(this,void 0,void 0,(function(){var t,n,r,i;return s(this,(function(o){switch(o.label){case 0:return t=e.camId,n=e.camLabel,r=c(e,["camId","camLabel"]),v.removeUnsupportedConstraints(r),i=this,[4,y.checkDeviceIdConstraints(t,n,"videoinput",r)];case 1:return i._videoConstraints=o.sent(),this.camId=t,this.camLabel=n,[2,this._videoConstraints]}}))}))},t.prototype.disableWebcam=function(){this.camId=null,this.camLabel=null,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=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"remoteElement",{get:function(){return this._remoteElement},set:function(e){this._remoteElement=e},enumerable:!0,configurable:!0}),t.prototype.vertoBroadcast=function(e){var t=e.nodeId,n=e.channel,r=e.data,i=new g.Broadcast({sessid:this.sessionid,eventChannel:n,data:r});return t&&(i.targetNodeId=t),this.execute(i)},t.prototype.vertoSubscribe=function(e){var t=e.nodeId,n=e.channels,r=e.handler,i=void 0===r?null:r;return a(this,void 0,void 0,(function(){var e,r,o,a=this;return s(this,(function(s){switch(s.label){case 0:e=new g.Subscribe({sessid:this.sessionid,eventChannel:n}),t&&(e.targetNodeId=t),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.execute(e)];case 2:return r=s.sent(),i&&(o=v.destructSubscribeResponse(r).subscribed,(void 0===o?[]:o).forEach((function(e){return a._addSubscription(a.relayProtocol,i,e)}))),[2,r];case 3:throw s.sent();case 4:return[2]}}))}))},t.prototype.vertoUnsubscribe=function(e){var t=e.nodeId,n=e.channels,r=e.handler,i=void 0===r?null:r;return a(this,void 0,void 0,(function(){var e,r,o,a,c,u,l,d=this;return s(this,(function(s){switch(s.label){case 0:e=new g.Unsubscribe({sessid:this.sessionid,eventChannel:n}),t&&(e.targetNodeId=t),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.execute(e)];case 2:return r=s.sent(),i&&(o=v.destructSubscribeResponse(r),a=o.unsubscribed,c=void 0===a?[]:a,u=o.notSubscribed,l=void 0===u?[]:u,c.forEach((function(e){return d._removeSubscription(d.relayProtocol,e)})),l.forEach((function(e){return d._removeSubscription(d.relayProtocol,e)}))),[2,r];case 3:throw s.sent();case 4:return[2]}}))}))},t.prototype.listConf=function(){var e=new b.Execute({protocol:this.relayProtocol,method:"conference.list",params:{}});return console.debug("Send confList",e),this.execute(e)},t.prototype.vertoConferenceList=function(e){return a(this,void 0,void 0,(function(){var t,n;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=[],[4,this._jsApi({command:"conference",data:o({command:"list"},e)})];case 1:return r.sent().conferences.forEach((function(e){var n=e.conferenceState,r=e.members,i=void 0===r?[]:r,a=e.layouts,s=void 0===a?[]:a,u=v.destructConferenceState(n);if(i.length&&(u.members=i.filter((function(e){return"caller"===e.type})).map((function(e){var t=e.id,n=e.uuid,r=e.caller_id_number,i=e.caller_id_name,a=c(e,["id","uuid","caller_id_number","caller_id_name"]);return o({participantId:Number(t).toString(),callId:n,participantNumber:r,participantName:i},a)}))),s.length){var l=s.filter((function(e){return"layout"===e.type})),d=s.filter((function(e){return"layoutGroup"===e.type}));u.layouts=v.mungeLayoutList(l,d)}t.push(u)})),[2,t];case 2:return n=r.sent(),console.error("vertoConferenceList error",n),[2,[]];case 3:return[2]}}))}))},t.prototype.vertoLayoutList=function(e){return void 0===e&&(e={}),a(this,void 0,void 0,(function(){var t,n,r,i,a,c,u;return s(this,(function(s){switch(s.label){case 0:t=e.fullList,n=void 0!==t&&t,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._jsApi({command:"conference",data:{command:"listLayouts"}})];case 2:return r=s.sent().layouts,i=r.layouts,a=r.groups,c=v.mungeLayoutList(i,a).map((function(e){var t=e.id,n="group"===e.type?"group:":"";return o(o({},e),{id:""+n+t})})),n?[2,c]:[2,c.filter((function(e){return!e.belongsToAGroup}))];case 3:return u=s.sent(),console.error("vertoLayoutList error",u),[2,[]];case 4:return[2]}}))}))},t.prototype.dispatchConferenceUpdate=function(e){var t=o({type:h.Notification.ConferenceUpdate},e);f.trigger(p.SwEvent.Notification,t,this.uuid)},t.prototype._jsApi=function(e){void 0===e&&(e={});var t=new g.JSApi(o(o({},e),{sessid:this.sessionid}));return this.execute(t)},t.prototype._wrapInExecute=function(e){var t={message:e.request,node_id:e.targetNodeId||void 0};return new b.Execute({protocol:this.relayProtocol,method:"message",params:t})},t.prototype.execute=function(t){return t instanceof m.default&&(t=this._wrapInExecute(t)),e.prototype.execute.call(this,t)},t.prototype._onSocketOpen=function(){return a(this,void 0,void 0,(function(){return s(this,(function(t){return clearTimeout(this._purgeTimeout),e.prototype._onSocketOpen.call(this),[2]}))}))},t.prototype._onSocketCloseOrError=function(t){var n=this;if(this._experimental){this._purgeTimeout=setTimeout((function(){n.purge()}),1e4)}else this.purge();this._detachChannels(["conference-info","conference-liveArray","conference-mod"]),e.prototype._onSocketCloseOrError.call(this,t)},t.prototype.vertoSubscribeToConference=function(e){var t=e.infoChannel,n=e.modChannel,r=e.laChannel;return a(this,void 0,void 0,(function(){var e,i,o,a,c,u,l,d,f;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),(null==(e=[t,n,r].filter(Boolean))?void 0:e.length)?(this._detachChannels(e),[4,this.vertoSubscribe({channels:e})]):[2];case 1:return i=s.sent(),o=v.destructSubscribeResponse(i),a=o.subscribed,c=void 0===a?[]:a,u=o.alreadySubscribed,l=void 0===u?[]:u,(d=c.concat(l)).includes(t)&&this._addSubscription(this.relayProtocol,O.default.bind(this,this),t),d.includes(n)&&this._addSubscription(this.relayProtocol,P.default.bind(this,this),n),d.includes(r)&&this._addSubscription(this.relayProtocol,S.default.bind(this,this),r),[3,3];case 2:return f=s.sent(),console.error("vertoSubscribeToConference error",f),[3,3];case 3:return[2]}}))}))},t.prototype.vertoUnsubscribeFromConference=function(e){var t=e.infoChannel,n=e.modChannel,r=e.laChannel;return a(this,void 0,void 0,(function(){var e,i;return s(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),(null==(e=[t,n,r].filter(Boolean))?void 0:e.length)?(this._detachChannels(e),[4,this.vertoUnsubscribe({nodeId:this.nodeid,channels:e})]):[2];case 1:return o.sent(),[3,3];case 2:return i=o.sent(),console.error("vertoUnsubscribeFromConference error",i),[3,3];case 3:return[2]}}))}))},t}(d.default);t.default=C},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=o(n(6)),s=null;t.setAgentName=function(e){s=e};var c=function(e){function t(t,n){var r=e.call(this)||this;r.method="blade.connect";var i={version:{major:2,minor:1,revision:0},authentication:t};return n&&(i.sessionid=n),s&&(i.agent=s),r.buildRequest({method:r.method,params:i}),r}return i(t,e),t}(a.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(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=o(n(1)),s=o(n(12)),c=n(8),u=n(2),l=n(0),d=n(4),f=n(0),p=n(5),h=function(e,t,n,r){var i=t.caller_id_name,o=t.caller_id_number,a=t.callee_id_name,c=t.callee_id_number;t.display_direction===l.Direction.Inbound&&(i=t.callee_id_name,o=t.callee_id_number,a=t.caller_id_name,c=t.caller_id_number);var u=new s.default(e,{id:t.callID,remoteSdp:t.sdp,destinationNumber:t.callee_id_number,remoteCallerName:i,remoteCallerNumber:o,callerName:a,callerNumber:c,attach:n,secondSource:/;second-source$/.test(t.callee_id_number),screenShare:/;screen$/.test(t.callee_id_number),shakenCheck:t.shaken_check||"",shakenResult:t.shaken_result||""});return-1!==t.sdp.indexOf("m=audio")||(u.options.audio=!1,u.options.micId=null,u.options.micLabel=null),-1!==t.sdp.indexOf("m=video")||(u.options.video=!1,u.options.camId=null,u.options.camLabel=null),u.nodeId=r,u.isDirect=p.checkIsDirectCall(t),u};t.default=function(e,t){var n=t.id,o=t.method,s=t.nodeId,p=t.params,v=p.callID,y=p.eventChannel;if("channelPvtData"===p.eventType)return p.pvtData.nodeId=s,function(e,t){return r(void 0,void 0,void 0,(function(){var n,r,o;return i(this,(function(i){switch(i.label){case 0:if(n=t.action,!(r=t.callID)||!e.calls[r])return[2,a.default.debug("Verto pvtData with invalid or unknown callID.",t)];if((o=e.calls[r]).options.skipLiveArray)return[2,a.default.debug("Skip liveArray pvtData for",r,t)];switch(n){case"conference-liveArray-join":return[3,1];case"conference-liveArray-part":return[3,3]}return[3,5];case 1:return[4,o.conferenceJoinHandler(t)];case 2:return i.sent(),[3,5];case 3:return[4,o.conferencePartHandler(t)];case 4:return i.sent(),[3,5];case 5:return[2]}}))}))}(e,p.pvtData);if(y===e.sessionid||y===e.relayProtocol)return function(e,t){var n=t.contentType,r=t.callID;if(!r||!e.calls.hasOwnProperty(r))return a.default.debug("Unhandled session event:",t);var i=e.calls[r];switch(n){case"layout-info":case"layer-info":i.updateLayouts(t);break;case"logo-info":i.updateLogo(t);break;case"caption-info":i.handleCaptionInfo(t);break;case"conference-info":i.handleConferenceInfo(t)}}(e,p.eventData);if(v&&e.calls.hasOwnProperty(v)){if(d.trigger(v,p,o),o!==l.VertoMethod.Attach){var m=new c.Result(n,o);m.targetNodeId=s,e.execute(m)}}else{var b=o===l.VertoMethod.Attach;switch(o){case l.VertoMethod.Ping:var g=new c.Result(n,o);return g.targetNodeId=s,e.execute(g);case l.VertoMethod.Punt:return e.purge(),e.disconnect();case l.VertoMethod.Invite:(w=h(e,p,b,s)).setState(f.State.Ringing);var _=new c.Result(n,o);return _.targetNodeId=s,e.execute(_);case l.VertoMethod.Attach:var w=h(e,p,b,s);return d.trigger(w.id,p,o);case l.VertoMethod.Event:case"webrtc.event":var S=p.subscribedChannel;if(S&&d.trigger(e.relayProtocol,p,S))return;if(y){var P=y.split(".")[0],O=d.trigger(e.relayProtocol,p,P),k=!1;if(P!==y&&(k=d.trigger(e.relayProtocol,p,y)),O||k)return}return p.type=l.Notification.Generic,d.trigger(u.SwEvent.Notification,p,e.uuid);case l.VertoMethod.Info:return p.type=l.Notification.Generic,d.trigger(u.SwEvent.Notification,p,e.uuid);case l.VertoMethod.ClientReady:return p.type=l.Notification.VertoClientReady,d.trigger(u.SwEvent.Notification,p,e.uuid);case l.VertoMethod.Announce:return p.type=l.Notification.Announce,d.trigger(u.SwEvent.Notification,p,e.uuid);default:return a.default.debug("Unknown Verto method:",o,p),p.type=o,d.trigger(u.SwEvent.Notification,p,e.uuid)}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);t.default=function(e,t){var n=t.eventChannel,i=t.eventSerno,o=t.data,a=e.channelToCallIds.get(n)||[],s=o.direction,c=o.from,u=o.fromDisplay,l=o.message,d=o.type,f={action:r.ConferenceAction.ChatMessage,direction:s,participantNumber:c,participantName:u,messageText:l,messageType:d,messageId:i};a.length?a.forEach((function(t){e.calls[t]&&e.calls[t]._dispatchConferenceUpdate(f)})):console.warn("Dispatch global ConferenceUpdate for",f)},t.publicChatMethods={sendChatMessage:function(e,t){var n=this.session,r=this.nodeId,i=this.channel;n.vertoBroadcast({nodeId:r,channel:i,data:{action:"send",message:e,type:t}})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(15),i=n(21),o=n(16),a=n(14),s=function(e,t){var n=this,s=t.uuid,c=t.md5,u=t.domain,l=t.laName,d=t.laChannel,f=t.infoChannel,p=t.chatChannel,h=t.modChannel,v=void 0===h?null:h,y=t.confName,m=t.isPrivate,b=void 0!==m&&m;this.uuid=s,this.md5=c,this.domain=u,this.laName=l,this.laChannel=d,this.infoChannel=f,this.chatChannel=p,this.modChannel=v,this.confName=y,this.isPrivate=b;var g={session:e,nodeId:e.nodeid,channel:this.modChannel||null};Object.keys(r.publicModMethods).forEach((function(e){Object.defineProperty(n,e,{configurable:!0,writable:!0,value:r.publicModMethods[e].bind(g)})}));var _={session:e,nodeId:e.nodeid,channel:this.chatChannel||null};Object.keys(i.publicChatMethods).forEach((function(e){Object.defineProperty(n,e,{configurable:!0,writable:!0,value:i.publicChatMethods[e].bind(_)})}));var w={session:e,nodeId:e.nodeid,channel:this.infoChannel||null};Object.keys(o.publicInfoMethods).forEach((function(e){Object.defineProperty(n,e,{configurable:!0,writable:!0,value:o.publicInfoMethods[e].bind(w)})}));var S={session:e,nodeId:e.nodeid,channel:this.laChannel||null,laName:this.laName||null};Object.keys(a.publicLiveArrayMethods).forEach((function(e){Object.defineProperty(n,e,{configurable:!0,writable:!0,value:a.publicLiveArrayMethods[e].bind(S)})}))};t.default=s},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(24));t.Relay=i.default;var o=r(n(41));t.Verto=o.default;var a=n(19),s=r(n(42));t.CantinaAuth=s.default,t.VERSION="1.3.0-dev.1",a.setAgentName("JavaScript SDK/"+t.VERSION),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(13))},function(e,t,n){"use strict";var r,i=(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)}),o=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},a=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},s=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=s(n(18)),u=s(n(12)),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.newCall=function(e){return o(this,void 0,void 0,(function(){var t,n;return a(this,(function(r){if(t=e.destinationNumber,!(void 0===t?null:t))throw new TypeError("destinationNumber is required");return(n=new u.default(this,e)).invite(),[2,n]}))}))},t}(c.default);t.default=l},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(17),s=o(n(1)),c=o(n(27)),u=o(n(28)),l=n(4),d=o(n(33)),f=n(2),p=n(0),h=n(11),v=n(3),y=n(9),m=function(){function e(e){if(this.options=e,this.uuid=a.v4(),this.sessionid="",this.subscriptions=new Map,this.relayProtocol=null,this.contexts=[],this.timeoutErrorCode=-32e3,this.connection=null,this._jwtAuth=!1,this._checkJWTExpirationTimeout=3e4,this._refreshTokenNotificationDiff=120,this._expiredDiffSeconds=0,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 s.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,"signature",{get:function(){return this.authorization?this.authorization.signature:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scopeId",{get:function(){return this.authorization?this.authorization.scope_id:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"resource",{get:function(){return this.authorization?this.authorization.resource:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scopes",{get:function(){return this.authorization?this.authorization.scopes:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expiresAt",{get:function(){return this.authorization?+this.authorization.expires_at:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"expired",{get:function(){if(this.expiresAt){var e=Math.floor(Date.now()/1e3);return this.expiresAt-e<=this._expiredDiffSeconds}return!1},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,o=e.handler;return r(this,void 0,void 0,(function(){var e,r,a,s,c,u,l=this;return i(this,(function(i){switch(i.label){case 0:return e=new h.Subscription({command:f.ADD,protocol:t,channels:n}),[4,this.execute(e)];case 1:return r=i.sent(),a=r.failed_channels,s=void 0===a?[]:a,c=r.subscribe_channels,u=void 0===c?[]:c,s.length&&s.forEach((function(e){return l._removeSubscription(t,e)})),u.forEach((function(e){return l._addSubscription(t,o,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 i(this,(function(r){return e=new h.Subscription({command:f.REMOVE,protocol:t,channels:n}),[2,this.execute(e)]}))}))},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return clearTimeout(this._reconnectTimeout),this.subscriptions.clear(),this._autoReconnect=!1,this.relayProtocol=null,this._closeConnection(),[4,y.sessionStorage.removeItem(this.signature)];case 1:return e.sent(),this._executeQueue=[],this._detachListeners(),this.off(f.SwEvent.Ready),this.off(f.SwEvent.Notification),this.off(f.SwEvent.Error),[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;return i(this,(function(i){switch(i.label){case 0:this.options.token=e,i.label=1;case 1:return i.trys.push([1,6,,7]),this.expired?[4,this.connect()]:[3,3];case 2:return i.sent(),[3,5];case 3:return t=new h.Reauthenticate(this.options.project,e,this.sessionid),[4,this.execute(t)];case 4:n=i.sent(),this.authorization=n.authorization||null,i.label=5;case 5:return[3,7];case 6:return r=i.sent(),s.default.error("refreshToken error:",r),l.trigger(f.SwEvent.Error,r,this.uuid,!1),[3,7];case 7:return[2]}}))}))},e.prototype.connect=function(){return r(this,void 0,void 0,(function(){return i(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(f.SwEvent.Error,e,this.uuid)},e.prototype._onSocketOpen=function(){return r(this,void 0,void 0,(function(){var e,t,n,r,o,a,c,d,p,v,y,m;return i(this,(function(i){switch(i.label){case 0:return this._idle=!1,e=this._jwtAuth?"jwt_token":"token",t=this.options,n=t.project,r=t.token,o=new h.Connect(((m={project:n})[e]=r,m),this.sessionid),[4,this.execute(o).catch(this._handleLoginError)];case 1:return(a=i.sent())?(this._autoReconnect=!0,c=a.sessionid,d=a.nodeid,p=a.master_nodeid,v=a.authorization,this.authorization=v,y=this,[4,u.default(this)]):[3,3];case 2:y.relayProtocol=i.sent(),this._checkTokenExpiration(),this.sessionid=c,this.nodeid=d,this.master_nodeid=p,this._emptyExecuteQueues(),this._pong=null,this._keepAlive(),l.trigger(f.SwEvent.Ready,this,this.uuid),s.default.info("Session Ready!"),i.label=3;case 3:return[2]}}))}))},e.prototype._onSocketCloseOrError=function(e){var t=this;for(var n in s.default.error("Socket "+e.type+" "+e.message),this.relayProtocol&&l.deRegisterAll(this.relayProtocol),this.subscriptions){var r=n.split("|")[0];l.deRegisterAll(r)}this.subscriptions.clear(),this.contexts=[],this.expired&&(this._idle=!0,this._autoReconnect=!1,this.authorization=null),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 f.BladeMethod.Broadcast:d.default(this,n);break;case f.BladeMethod.Disconnect:this._idle=!0}},e.prototype._removeSubscription=function(e,t){this._existsSubscription(e,t)&&(t?l.deRegister(e,null,t):l.deRegisterAll(e),this.subscriptions.delete(e+"|"+t))},e.prototype._addSubscription=function(e,t,n){void 0===t&&(t=null),this._existsSubscription(e,n)||(v.isFunction(t)&&l.register(e,t,n),this.subscriptions.set(e+"|"+n,!0))},e.prototype._existsSubscription=function(e,t){var n=e+"|"+t;return this.subscriptions.has(n)},e.prototype._attachListeners=function(){this._detachListeners(),this.on(f.SwEvent.SocketOpen,this._onSocketOpen),this.on(f.SwEvent.SocketClose,this._onSocketCloseOrError),this.on(f.SwEvent.SocketError,this._onSocketCloseOrError),this.on(f.SwEvent.SocketMessage,this._onSocketMessage)},e.prototype._detachListeners=function(){this.off(f.SwEvent.SocketOpen,this._onSocketOpen),this.off(f.SwEvent.SocketClose,this._onSocketCloseOrError),this.off(f.SwEvent.SocketError,this._onSocketCloseOrError),this.off(f.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(),this.connection=null)},e.prototype._checkTokenExpiration=function(){this.expiresAt&&(this.expiresAt-Date.now()/1e3<=this._refreshTokenNotificationDiff&&l.trigger(f.SwEvent.Notification,{type:p.Notification.RefreshToken,session:this},this.uuid,!1),clearTimeout(this._checkTokenExpirationTimeout),this.expired||(this._checkTokenExpirationTimeout=setTimeout(this._checkTokenExpiration,this._checkJWTExpirationTimeout)))},e.prototype._keepAlive=function(){var e=this;if(!0===this._doKeepAlive){if(!1===this._pong)return this._closeConnection();this._pong=!1,this.execute(new h.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 a.v4()},e}();t.default=m},function(e,t,n){var r,i;!function(o,a){"use strict";void 0===(i="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 i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function o(n){return"debug"===n&&(n="log"),"undefined"!=typeof console&&("trace"===n&&t?i:void 0!==console[n]?r(console,n):void 0!==console.log?r(console,"log"):e)}function a(t,r){for(var i=0;i<n.length;i++){var o=n[i];this[o]=i<t?e:this.methodFactory(o,t,r)}this.log=this.debug}function s(e,t,n){return function(){"undefined"!=typeof console&&(a.call(this,t,n),this[e].apply(this,arguments))}}function c(e,t,n){return o(e)||s.apply(this,arguments)}function u(e,t,r){var i,o=this,s="loglevel";function u(){var e;if("undefined"!=typeof window&&s){try{e=window.localStorage[s]}catch(e){}if(void 0===e)try{var t=window.document.cookie,n=t.indexOf(encodeURIComponent(s)+"=");-1!==n&&(e=/^([^;]+)/.exec(t.slice(n))[1])}catch(e){}return void 0===o.levels[e]&&(e=void 0),e}}"string"==typeof e?s+=":"+e:"symbol"==typeof e&&(s=void 0),o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=r||c,o.getLevel=function(){return i},o.setLevel=function(t,r){if("string"==typeof t&&void 0!==o.levels[t.toUpperCase()]&&(t=o.levels[t.toUpperCase()]),!("number"==typeof t&&t>=0&&t<=o.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(i=t,!1!==r&&function(e){var t=(n[e]||"silent").toUpperCase();if("undefined"!=typeof window&&s){try{return void(window.localStorage[s]=t)}catch(e){}try{window.document.cookie=encodeURIComponent(s)+"="+t+";"}catch(e){}}}(t),a.call(o,t,e),"undefined"==typeof console&&t<o.levels.SILENT)return"No console available for logging"},o.setDefaultLevel=function(e){u()||o.setLevel(e,!1)},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)};var l=u();null==l&&(l=null==t?"WARN":t),o.setLevel(l,!1)}var l=new u,d={};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=d[e];return t||(t=d[e]=new u(e,l.getLevel(),l.methodFactory)),t};var f="undefined"!=typeof window?window.log:void 0;return l.noConflict=function(){return"undefined"!=typeof window&&window.log===l&&(window.log=f),l},l.getLoggers=function(){return d},l.default=l,l})?r.call(t,n,t,e):r)||(e.exports=i)}()},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 i=r(n(1)),o=n(2),a=n(3),s=n(4),c=n(3),u="undefined"!=typeof WebSocket?WebSocket:null;t.setWebSocket=function(e){u=e};var l=0,d=1,f=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=a.checkWebSocketHost(t))}return Object.defineProperty(e.prototype,"connected",{get:function(){return this._wsClient&&this._wsClient.readyState===d},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===f},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 s.trigger(o.SwEvent.SocketOpen,t,e.session.uuid)},this._wsClient.onclose=function(t){return s.trigger(o.SwEvent.SocketClose,t,e.session.uuid)},this._wsClient.onerror=function(t){return s.trigger(o.SwEvent.SocketError,t,e.session.uuid)},this._wsClient.onmessage=function(t){var n=a.safeParseJson(t.data);"string"!=typeof n?(e._unsetTimer(n.id),i.default.debug("RECV: \n",JSON.stringify(n,null,2),"\n"),s.trigger(n.id,n)||s.trigger(o.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();s.registerOnce(n.id,(function(t){var n=a.destructResponse(t),i=n.result,o=n.error;return o?r(o):e(i)})),t._setTimer(n.id)}));return i.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(){s.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)),s.trigger(o.SwEvent.SpeedTest,{upDur:this.upDur,downDur:this.downDur},this.session.uuid)}else i.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(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=o(n(1)),s=n(11),c=n(9);t.default=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,o,u,l,d;return i(this,(function(i){switch(i.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:(o=i.sent())&&(t.protocol=o),i.label=3;case 3:return u=new s.Execute({protocol:"signalwire",method:"setup",params:t}),[4,e.execute(u)];case 4:return l=i.sent().protocol,(d=void 0===l?null:l)?[4,e.subscribe({protocol:d,channels:["notifications"]})]:[3,7];case 5:return i.sent(),[4,c.sessionStorage.setItem(n,d)];case 6:return i.sent(),[3,8];case 7:a.default.error("Error during setup the session protocol."),i.label=8;case 8:return[2,d]}}))}))}},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t,n){void 0===n&&(n="");var r,i=e.call(this)||this;return i.method="blade.execute",r=t.hasOwnProperty("result")?{result:t}:{method:i.method,params:t},n&&(r.id=n),i.buildRequest(r),i}return i(t,e),t}(o(n(6)).default);t.Execute=a},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=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 i(t,e),t}(o(n(6)).default);t.Subscription=a},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t,n,r){var i=e.call(this)||this;i.method="blade.reauthenticate";var o={sessionid:r,authentication:{project:t,jwt_token:n}};return i.buildRequest({method:i.method,params:o}),i}return i(t,e),t}(o(n(6)).default);t.Reauthenticate=a},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){var t=e.call(this)||this;return t.method="blade.ping",t.buildRequest({method:t.method,params:{}}),t}return i(t,e),t}(o(n(6)).default);t.Ping=a},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 i=r(n(1)),o=r(n(20));t.default=function(e,t){var n=t.protocol,r=t.event,a=t.params,s=a.event_type,c=a.node_id;if(n!==e.relayProtocol)return i.default.error("Session protocol mismatch.");switch(r){case"queuing.relay.events":"webrtc.message"===s?(a.params.nodeId=c,o.default(e,a.params)):e.calling.notificationHandler(a);break;case"queuing.relay.tasks":e.tasking.notificationHandler(a);break;case"queuing.relay.messaging":e.messaging.notificationHandler(a);break;default:return i.default.error("Unknown notification type: "+s)}}},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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},s=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=n(17),l=s(n(1)),d=s(n(35)),f=n(8),p=n(2),h=n(0),v=n(4),y=n(5),m=n(3),b=n(7),g=c(n(14)),_=c(n(21)),w=c(n(15)),S=c(n(16)),P=n(5),O=function(){function e(e,t){this.session=e,this.id="",this.gotEarly=!1,this.doReinvite=!1,this.isDirect=!1,this.videoElements=[],this.audioElements=[],this.pvtData=null,this.participantLayerIndex=-1,this.participantLogo="",this._extension=null,this._state=h.State.New,this._prevState=h.State.New,this._laChannelAudioMuted=null,this._laChannelVideoMuted=null;var n=e.iceServers,r=e.speaker,i=e.micId,o=e.micLabel,a=e.camId,s=e.camLabel,c=e.localElement,u=e.remoteElement,l=e.mediaConstraints,d=l.audio,f=l.video;this.options=Object.assign({},h.DEFAULT_CALL_OPTIONS,{audio:d,video:f,iceServers:n,localElement:c,remoteElement:u,micId:i,micLabel:o,camId:a,camLabel:s,speakerId:r},t),this._onMediaError=this._onMediaError.bind(this),this._onVertoAnswer=this._onVertoAnswer.bind(this),this._onVertoAttach=this._onVertoAttach.bind(this),this._onVertoMedia=this._onVertoMedia.bind(this),this._onVertoMediaParams=this._onVertoMediaParams.bind(this),this._onVertoPrompt=this._onVertoPrompt.bind(this),this._hangup=this._hangup.bind(this),this._onParticipantData=this._onParticipantData.bind(this),this._onGenericEvent=this._onGenericEvent.bind(this),this._init()}return Object.defineProperty(e.prototype,"state",{get:function(){return h.State[this._state].toLowerCase()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"active",{get:function(){return this._state===h.State.Active},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trying",{get:function(){return this._state===h.State.Trying},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extension",{get:function(){return this._extension||this.options.destinationNumber},set:function(e){this._extension=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"prevState",{get:function(){return h.State[this._prevState].toLowerCase()},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,"messagePayload",{get:function(){if(this.session.relayProtocol===p.VERTO_PROTOCOL)return{sessid:this.session.sessionid,dialogParams:this.options};var e=this.options,t=e.id,n=e.destinationNumber,r=e.attach,i=e.callerName,o=e.callerNumber,a=e.remoteCallerName,s=e.remoteCallerNumber,c=e.userVariables,u=e.screenShare;return{sessid:this.session.sessionid,dialogParams:{id:t,destinationNumber:n,attach:r,callerName:i,callerNumber:o,remoteCallerName:a,remoteCallerNumber:s,userVariables:c,screenShare:u}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentParticipant",{get:function(){var e={id:this.participantId,role:this.participantRole,layer:null,layerIndex:this.participantLayerIndex,isLayerBehind:!1};if(this.canvasInfo&&this.participantLayerIndex>=0){var t=this.canvasInfo,n=t.layoutOverlap,r=t.canvasLayouts;e.layer=r[this.participantLayerIndex]||null,e.isLayerBehind=n&&e.layer&&0===e.layer.overlap}return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"participantId",{get:function(){return this.pvtData?String(this.pvtData.conferenceMemberID):null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"participantRole",{get:function(){return this.pvtData?this.pvtData.role:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"role",{get:function(){return this.participantRole},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cameraId",{get:function(){return this.peer?this.peer.getDeviceId("video"):null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cameraLabel",{get:function(){return this.peer?this.peer.getDeviceLabel("video"):null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"microphoneId",{get:function(){return this.peer?this.peer.getDeviceId("audio"):null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"microphoneLabel",{get:function(){return this.peer?this.peer.getDeviceLabel("audio"):null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"withAudio",{get:function(){return!!this.remoteStream&&this.remoteStream.getAudioTracks().length>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"withVideo",{get:function(){return!!this.remoteStream&&this.remoteStream.getVideoTracks().length>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"htmlVideoElement",{get:function(){return this.videoElements.length?this.videoElements[0]:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"htmlAudioElement",{get:function(){return this.audioElements.length?this.audioElements[0]:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"conferenceChannels",{get:function(){if(!this.pvtData)return[];var e=this.pvtData;return[e.laChannel,e.chatChannel,e.infoChannel,e.modChannel].filter(Boolean)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"conferenceName",{get:function(){if(this.pvtData){var e=this.pvtData,t=e.conferenceDisplayName,n=e.conferenceName;return t||n}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"conferenceMd5",{get:function(){return this.pvtData?this.pvtData.conferenceMD5:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"conferenceUuid",{get:function(){if(this.pvtData){var e=this.pvtData,t=e.conferenceDisplayName,n=e.conferenceName,r=e.conferenceUUID;return t?n:r}return null},enumerable:!0,configurable:!0}),e.prototype._upgrade=function(){return i(this,void 0,void 0,(function(){var e=this;return o(this,(function(t){switch(t.label){case 0:return l.default.warn("Untested upgrade method!"),this.doReinvite=!0,this.peer.type=h.PeerType.Offer,[4,b.getUserMedia({video:!0})];case 1:return t.sent().getTracks().forEach((function(t){e.options.localStream.addTrack(t),e.peer.instance.addTrack(t,e.options.localStream)})),[2]}}))}))},e.prototype.updateDevices=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,a,s,c,u=this;return o(this,(function(l){switch(l.label){case 0:return l.trys.push([0,6,,7]),console.debug("updateDevices trying constraints",this.id,e),Object.keys(e).length?[4,b.getUserMedia(e)]:[2,console.warn("Invalid constraints:",e)];case 1:t=l.sent(),console.debug("updateDevices got stream",t),this.options.localStream||(this.options.localStream=new MediaStream),n=this.peer.instance,r=t.getTracks(),i=function(e){var t,i;return o(this,(function(o){switch(o.label){case 0:return t=r[e],console.debug("updateDevices apply track: ",t),(i=n.getTransceivers().find((function(e){var n=e.mid,r=e.sender,i=e.receiver;return r.track&&r.track.kind===t.kind?(console.debug("Found transceiver by sender"),!0):i.track&&i.track.kind===t.kind?(console.debug("Found transceiver by receiver"),!0):null===n&&(console.debug("Found disassociated transceiver"),!0)})))&&i.sender?(console.debug("updateDevices FOUND - replaceTrack on it and on localStream"),[4,i.sender.replaceTrack(t)]):[3,2];case 1:return o.sent(),a.options.localStream.addTrack(t),console.debug("updateDevices replaceTrack SUCCESS"),a.options.localStream.getTracks().forEach((function(e){e.kind===t.kind&&e.id!==t.id&&(console.debug("updateDevices stop old track and apply new one - "),b.stopTrack(e),u.options.localStream.removeTrack(e))})),[3,3];case 2:console.debug("updateDevices NOT FOUND - addTrack and start dancing!"),a.peer.type=h.PeerType.Offer,a.doReinvite=!0,a.options.localStream.addTrack(t),n.addTrack(t,a.options.localStream),o.label=3;case 3:return console.debug("updateDevices Simply update mic/cam"),"audio"===t.kind?a.options.micId=t.getSettings().deviceId:"video"===t.kind&&(a.options.camId=t.getSettings().deviceId),[2]}}))},a=this,s=0,l.label=2;case 2:return s<r.length?[5,i(s)]:[3,5];case 3:l.sent(),l.label=4;case 4:return s++,[3,2];case 5:return console.debug("updateDevices done!"),this._dispatchNotification({type:h.Notification.DeviceUpdated}),[3,7];case 6:throw c=l.sent(),console.error("updateDevices",c),c;case 7:return[2]}}))}))},e.prototype.invite=function(){this.direction=h.Direction.Outbound,this.peer=new d.default(this,h.PeerType.Offer,this.options)},e.prototype.answer=function(){this.direction=h.Direction.Inbound,this.peer=new d.default(this,h.PeerType.Answer,this.options)},e.prototype.hangup=function(e){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:if([h.State.Hangup,h.State.Destroy].includes(this._state))return l.default.info("Call "+this.id+" already in "+this.state+" state."),[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),t=new f.Bye(this.messagePayload),[4,this._execute(t)];case 2:return r.sent(),[3,5];case 3:return n=r.sent(),l.default.error("Hangup error:",n),[3,5];case 4:return this._hangup(e),[7];case 5:return[2]}}))}))},e.prototype.dtmf=function(e){var t=new f.Info(r(r({},this.messagePayload),{dtmf:e}));this._execute(t)},e.prototype.sendCurrentMediaSettings=function(){var e={type:"mediaSettings",audioinput:this.peer.getTrackSettings("audio"),videoinput:this.peer.getTrackSettings("video"),audiooutput:{deviceId:this.options.speakerId}};return this._sendVertoInfo(e)},e.prototype._sendVertoInfo=function(e){var t=new f.Info(r(r({},this.messagePayload),e));return this._execute(t)},e.prototype.transfer=function(e){var t=new f.Modify(r(r({},this.messagePayload),{action:"transfer",destination:e}));this._execute(t)},e.prototype.replace=function(e){var t=new f.Modify(r(r({},this.messagePayload),{action:"replace",replaceCallID:e}));this._execute(t)},e.prototype.askVideoKeyFrame=function(){var e=new f.Modify(r(r({},this.messagePayload),{action:"videoRefresh"}));return this._execute(e)},e.prototype.hold=function(){return this._changeHold("hold")},e.prototype.unhold=function(){return this._changeHold("unhold")},e.prototype.toggleHold=function(){return this._changeHold("toggleHold")},e.prototype.disableOutboundAudio=function(){y.disableAudioTracks(this.options.localStream)},e.prototype.enableOutboundAudio=function(){y.enableAudioTracks(this.options.localStream)},e.prototype.toggleOutboundAudio=function(){y.toggleAudioTracks(this.options.localStream)},e.prototype.disableOutboundVideo=function(){y.disableVideoTracks(this.options.localStream)},e.prototype.enableOutboundVideo=function(){y.enableVideoTracks(this.options.localStream)},e.prototype.toggleOutboundVideo=function(){y.toggleVideoTracks(this.options.localStream)},e.prototype.muteAudio=function(){y.disableAudioTracks(this.options.localStream)},e.prototype.unmuteAudio=function(){y.enableAudioTracks(this.options.localStream)},e.prototype.toggleAudioMute=function(){y.toggleAudioTracks(this.options.localStream)},e.prototype.muteVideo=function(){y.disableVideoTracks(this.options.localStream)},e.prototype.unmuteVideo=function(){y.enableVideoTracks(this.options.localStream)},e.prototype.toggleVideoMute=function(){y.toggleVideoTracks(this.options.localStream)},e.prototype.deaf=function(){y.disableAudioTracks(this.options.remoteStream)},e.prototype.undeaf=function(){y.enableAudioTracks(this.options.remoteStream)},e.prototype.toggleDeaf=function(){y.toggleAudioTracks(this.options.remoteStream)},e.prototype.sfuLowResolution=function(e,t){console.debug("Set video res to low");var n=new f.Modify(r(r({},this.messagePayload),{action:"set-sfu-low-res",streamId:e,trackId:t}));return this._execute(n)},e.prototype.sfuHighResolution=function(e,t){console.debug("Set video res to high");var n=new f.Modify(r(r({},this.messagePayload),{action:"set-sfu-high-res",streamId:e,trackId:t}));return this._execute(n)},e.prototype.sfuDefaultResolution=function(e,t){console.debug("Set video res to default");var n=new f.Modify(r(r({},this.messagePayload),{action:"set-sfu-default-res",streamId:e,trackId:t}));return this._execute(n)},e.prototype.doReinviteWithRelayOnly=function(){this.peer&&this.active&&this.peer.restartIceWithRelayOnly()},e.prototype.stopOutboundAudio=function(){this.peer&&this.active&&this.peer.stopTrackSender("audio")},e.prototype.restoreOutboundAudio=function(){this.peer&&this.active&&this.peer.restoreTrackSender("audio")},e.prototype.stopOutboundVideo=function(){this.peer&&this.active&&this.peer.stopTrackSender("video")},e.prototype.restoreOutboundVideo=function(){this.peer&&this.active&&this.peer.restoreTrackSender("video")},e.prototype.setState=function(t){var n=this;switch(this._prevState=this._state,this._state=t,l.default.info("Call "+this.id+" state change from "+this.prevState+" to "+this.state),this._dispatchNotification({type:h.Notification.CallUpdate}),t){case h.State.Purge:this.screenShare instanceof e&&this.screenShare.setState(h.State.Purge),this.secondSource instanceof e&&this.secondSource.setState(h.State.Purge),this._finalize();break;case h.State.Active:setTimeout((function(){var e=n.options,t=e.remoteElement,r=e.speakerId;b.setMediaElementSinkId(t,r)}),0);break;case h.State.Hangup:this.screenShare instanceof e&&this.screenShare.hangup(),this.secondSource instanceof e&&this.secondSource.hangup(),this.setState(h.State.Destroy);break;case h.State.Destroy:this._finalize()}},e.prototype.conferencePartHandler=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(n){return this.pvtData=e,t={action:h.ConferenceAction.Leave,conferenceName:this.conferenceName,conferenceMd5:this.conferenceMd5,conferenceUuid:this.conferenceUuid,participantId:this.participantId,role:this.participantRole},this._dispatchConferenceUpdate(t),this._removeConferenceChannels(),[2]}))}))},e.prototype.conferenceJoinHandler=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,a,s,c,u,d,f,p,m,b,P,O,k,I,C,T,M,E=this;return o(this,(function(o){switch(o.label){case 0:this.pvtData=e,this.extension=e.conferenceDisplayName||e.laName,t={session:this.session,nodeId:this.nodeId,channel:this.pvtData.laChannel||null,laName:this.pvtData.laName||null},Object.keys(g.publicLiveArrayMethods).forEach((function(e){Object.defineProperty(E,e,{configurable:!0,writable:!0,value:g.publicLiveArrayMethods[e].bind(t)})})),n={session:this.session,nodeId:this.nodeId,channel:this.pvtData.chatChannel||null},Object.keys(_.publicChatMethods).forEach((function(e){Object.defineProperty(E,e,{configurable:!0,writable:!0,value:_.publicChatMethods[e].bind(n)})})),r={session:this.session,nodeId:this.nodeId,channel:this.pvtData.modChannel||null,callID:this.id},Object.keys(w.publicModMethods).forEach((function(e){Object.defineProperty(E,e,{configurable:!0,writable:!0,value:w.publicModMethods[e].bind(r)})})),i={session:this.session,nodeId:this.nodeId,channel:this.pvtData.infoChannel||null,callID:this.id},Object.keys(S.publicInfoMethods).forEach((function(e){Object.defineProperty(E,e,{configurable:!0,writable:!0,value:S.publicInfoMethods[e].bind(i)})})),o.label=1;case 1:return o.trys.push([1,3,,4]),a=this.session.relayProtocol,this.conferenceChannels.forEach((function(e){v.deRegister(a,null,e),E.session.addChannelCallIdEntry(e,E.id)})),s=this.conferenceChannels.filter((function(e){var t=e.split(".")[0];return!E.session._existsSubscription(a,t)})),[4,this.session.vertoSubscribe({nodeId:e.nodeId,channels:s})];case 2:return c=o.sent(),u=y.destructSubscribeResponse(c),d=u.subscribed,f=void 0===d?[]:d,p=u.alreadySubscribed,m=void 0===p?[]:p,b=f.concat(m),P=this.pvtData,O=P.laChannel,k=P.chatChannel,I=P.infoChannel,C=P.modChannel,b.includes(O)&&(v.deRegister(a,null,O),v.register(a,g.default.bind(this,this.session),O)),b.includes(k)&&(v.deRegister(a,null,k),v.register(a,_.default.bind(this,this.session),k)),b.includes(I)&&(v.deRegister(a,null,I),v.register(a,S.default.bind(this,this.session),I)),b.includes(C)&&(v.deRegister(a,null,C),v.register(a,w.default.bind(this,this.session),C)),T={action:h.ConferenceAction.Join,conferenceName:this.conferenceName,conferenceMd5:this.conferenceMd5,conferenceUuid:this.conferenceUuid,participantId:this.participantId,role:this.participantRole},this._dispatchConferenceUpdate(T),b.includes(O)&&this.liveArrayBootstrap(),b.includes(I)&&(this.getLayoutInfo(),this.getConferenceState()),[3,4];case 3:return M=o.sent(),l.default.error("Conference subscriptions error:",M),[3,4];case 4:return[2]}}))}))},e.prototype.updateLayouts=function(e){var t=e.contentType,n=(e.callID,e.canvasType),i=e.canvasInfo,o=void 0===i?null:i,s=e.currentLayerIdx,c=void 0===s?null:s,u=a(e,["contentType","callID","canvasType","canvasInfo","currentLayerIdx"]);this.canvasType=n,"layer-info"===t&&null!==c&&(this.participantLayerIndex=c),null!==o&&(this.canvasInfo=y.mutateCanvasInfoData(o));var l="layer-info"===t?h.ConferenceAction.LayerInfo:h.ConferenceAction.LayoutInfo;this._dispatchConferenceUpdate(r({action:l,participant:this.currentParticipant,canvasInfo:this.canvasInfo,contentType:t,canvasType:n},u))},e.prototype.updateLogo=function(e){var t=e.logoURL;this.participantLogo=t,this._dispatchConferenceUpdate({action:h.ConferenceAction.LogoInfo,logo:t})},e.prototype.handleCaptionInfo=function(e){e.contentType;var t=a(e,["contentType"]);this._dispatchConferenceUpdate(r({action:h.ConferenceAction.CaptionInfo},t))},e.prototype.handleConferenceInfo=function(e){var t=e.conferenceState,n=e.messages,r=void 0===n?[]:n;this._dispatchConferenceUpdate({action:h.ConferenceAction.ConferenceInfo,conferenceState:P.destructConferenceState(t),messages:r})},e.prototype.updateFromLaChannel=function(e,t){this._laChannelAudioMuted=e,this._laChannelVideoMuted!==t&&(t?this.stopOutboundVideo():this.restoreOutboundVideo()),this._laChannelVideoMuted=t},e.prototype._removeConferenceChannels=function(){var e,t=this;(null===(e=this.conferenceChannels)||void 0===e?void 0:e.length)&&(this.conferenceChannels.forEach((function(e){v.deRegister(t.session.relayProtocol,null,e),t.session.removeChannelCallIdEntry(e,t.id)})),this.session.vertoUnsubscribe({nodeId:this.nodeId,channels:this.conferenceChannels}).catch((function(e){l.default.error("Conference unsubscribe error:",e)})))},e.prototype._changeHold=function(e){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(i){switch(i.label){case 0:if(this._state>=h.State.Hangup)return[2,l.default.warn("This call is not active",this.id,this.state)];t=new f.Modify(r(r({},this.messagePayload),{action:e})),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._execute(t)];case 2:return"active"===i.sent().holdState?this.setState(h.State.Active):this.setState(h.State.Held),[2,!0];case 3:return n=i.sent(),l.default.error("Error changing hold state",n),[2,!1];case 4:return[2]}}))}))},e.prototype._hangup=function(e){void 0===e&&(e={});var t=e.cause,n=void 0===t?"NORMAL_CLEARING":t,r=e.code,i=void 0===r?"16":r,o=e.redirectDestination,a=void 0===o?null:o;if(this.cause=n,this.causeCode=i,a&&this.trying)return this.peer.executeInvite();this.setState(h.State.Hangup)},e.prototype._onMediaError=function(e){this._dispatchNotification({type:h.Notification.UserMediaError,error:e}),this._hangup()},e.prototype._onGenericEvent=function(e){this._dispatchNotification(r(r({},e),{type:h.Notification.Generic}))},e.prototype._onParticipantData=function(e){var t=e.display_name,n=e.display_number,i=e.display_direction,o=a(e,["display_name","display_number","display_direction"]);this.extension=n;var s=i===h.Direction.Inbound?h.Direction.Outbound:h.Direction.Inbound;this._dispatchNotification(r({type:h.Notification.ParticipantData,displayName:t,displayNumber:n,displayDirection:s},o))},e.prototype._onVertoAnswer=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this._state>=h.State.Active?[2]:this.gotEarly?[3,2]:[4,this.peer.onRemoteSdp(e.sdp)];case 1:t.sent(),t.label=2;case 2:return this.isDirect=y.checkIsDirectCall(e),this.setState(h.State.Active),[2]}}))}))},e.prototype._onVertoMedia=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this._state>=h.State.Early?[2]:(this.gotEarly=!0,[4,this.peer.onRemoteSdp(e.sdp)]);case 1:return t.sent(),this.isDirect=y.checkIsDirectCall(e),this.setState(h.State.Early),[2]}}))}))},e.prototype._onVertoMediaParams=function(e){var t=this,n=e.mediaParams;if(!1===this.options.autoApplyMediaParams)return this._dispatchNotification({type:h.Notification.MediaParams,mediaParams:n});this.peer&&n&&Object.keys(n).forEach((function(e){t.peer.applyMediaConstraints(e,n[e])}))},e.prototype._onVertoPrompt=function(e){var t=r(r({},e),{promptType:e.type,type:h.Notification.Prompt,call:this});this._dispatchNotification(t)},e.prototype._dispatchNotification=function(e){!0!==this.options.skipNotifications&&(e.call=this,v.trigger(this.id,e,p.SwEvent.Notification,!1)||v.trigger(p.SwEvent.Notification,e,this.session.uuid))},e.prototype._dispatchConferenceUpdate=function(e){this._dispatchNotification(r({type:h.Notification.ConferenceUpdate},e))},e.prototype._execute=function(e){this.nodeId&&(e.targetNodeId=this.nodeId);var t=this.options.requestTimeout,n=void 0===t?1e4:t;return Promise.race([new Promise((function(e,t){return setTimeout(t,n,"timeout")})),this.session.execute(e)])},e.prototype._onVertoAttach=function(e){return i(this,void 0,void 0,(function(){var t=this;return o(this,(function(n){switch(n.label){case 0:switch(!0===this.options.simulcast&&console.debug("Handle verto.attach for a simulcast call?",e),this._state){case h.State.New:return[3,1];case h.State.Active:return[3,2]}return[3,4];case 1:return this.session.autoRecoverCalls?this.answer():this.setState(h.State.Recovering),[3,4];case 2:return this.doReinvite?(console.debug("doReinvite IS ACTIVE!",e),[2,l.default.warn(">>>> This leg alreay sent a reinvite??")]):(this.peer.type=h.PeerType.Answer,this.options.remoteSdp=e.sdp,[4,b.getUserMedia({video:!0})]);case 3:return n.sent().getVideoTracks().forEach((function(e){t.options.localStream.addTrack(e),t.peer.instance.addTrack(e,t.options.localStream)})),[3,4];case 4:return[2]}}))}))},e.prototype._init=function(){var e=this.options,t=e.id,n=e.userVariables,r=e.remoteCallerNumber,i=e.onNotification;t||(this.options.id=u.v4()),this.id=this.options.id,n&&!m.objEmpty(n)||(this.options.userVariables=this.session.options.userVariables||{}),this.options.userVariables.hostname=b.getHostname(),r||(this.options.remoteCallerNumber=this.options.destinationNumber),this.session.calls[this.id]=this,m.isFunction(i)&&v.register(this.id,i.bind(this),p.SwEvent.Notification),v.register(this.id,this._onMediaError,p.SwEvent.MediaError),v.register(this.id,this._onVertoAnswer,h.VertoMethod.Answer),v.register(this.id,this._onVertoMedia,h.VertoMethod.Media),v.register(this.id,this._onVertoMediaParams,h.VertoMethod.MediaParams),v.register(this.id,this._onVertoPrompt,h.VertoMethod.Prompt),v.register(this.id,this._hangup,h.VertoMethod.Bye),v.register(this.id,this._onParticipantData,h.VertoMethod.Display),v.register(this.id,this._onVertoAttach,h.VertoMethod.Attach),v.register(this.id,this._onGenericEvent,h.VertoMethod.Info),v.register(this.id,this._onGenericEvent,h.VertoMethod.Event),this.setState(h.State.New),l.default.info("New Call with Options:",this.options)},e.prototype._finalize=function(){this.peer&&this.peer.instance&&(this.peer.instance.close(),this.peer=null),this._removeConferenceChannels();var e=this.options,t=e.remoteStream,n=e.localStream;b.stopStream(t),b.stopStream(n),v.deRegisterAll(this.id),this.session.calls[this.id]=null,delete this.session.calls[this.id]},e}();t.default=O},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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=s(n(1)),u=s(n(36)),l=n(5),d=n(37),f=n(2),p=n(0),h=n(7),v=n(4),y=n(8),m=function(){function e(e,t,n){this.call=e,this.type=t,this.options=n,this._iceTimeout=null,this._negotiating=!1,c.default.info("New Peer with type:",this.type,"Options:",this.options),this._onIce=this._onIce.bind(this),this._init()}return Object.defineProperty(e.prototype,"isOffer",{get:function(){return this.type===p.PeerType.Offer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAnswer",{get:function(){return this.type===p.PeerType.Answer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isSimulcast",{get:function(){return!0===this.options.simulcast},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isSfu",{get:function(){return!0===this.options.sfu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasExperimentalFlag",{get:function(){return!0===this.options.experimental},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasAudioSender",{get:function(){return!!this._getSenderByKind("audio")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasVideoSender",{get:function(){return!!this._getSenderByKind("video")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasAudioReceiver",{get:function(){return!!this._getReceiverByKind("audio")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasVideoReceiver",{get:function(){return!!this._getReceiverByKind("video")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"config",{get:function(){var e=this.options,t=e.iceServers,n=void 0===t?[]:t,i=e.rtcPeerConfig,o=r({bundlePolicy:"max-compat",iceServers:n,sdpSemantics:"unified-plan"},void 0===i?{}:i);return c.default.info("RTC config",o),o},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localSdp",{get:function(){return this.instance.localDescription.sdp},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasIceServers",{get:function(){if(this.instance){var e=this.instance.getConfiguration().iceServers,t=void 0===e?[]:e;return Boolean(null==t?void 0:t.length)}return!1},enumerable:!0,configurable:!0}),e.prototype.stopTrackSender=function(e){try{var t=this._getSenderByKind(e);if(!t)return c.default.info("There is not a '"+e+"' sender to stop.");t.track&&(h.stopTrack(t.track),this.options.localStream.removeTrack(t.track))}catch(t){c.default.error("RTCPeer stopTrackSender error",e,t)}},e.prototype.restoreTrackSender=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,a,s;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),(t=this._getSenderByKind(e))?t.track&&"ended"!==t.track.readyState?[2,c.default.info("There is already an active "+e+" track.")]:[4,l.getMediaConstraints(this.options)]:[2,c.default.info("There is not a '"+e+"' sender to restore.")];case 1:return n=o.sent(),[4,l.getUserMedia((s={},s[e]=n[e],s))];case 2:return r=o.sent(),h.streamIsValid(r)?(i=r.getTracks().find((function(t){return t.kind===e})),[4,t.replaceTrack(i)]):[3,4];case 3:o.sent(),this.options.localStream.addTrack(i),o.label=4;case 4:return[3,6];case 5:return a=o.sent(),c.default.error("RTCPeer restoreTrackSender error",e,a),[3,6];case 6:return[2]}}))}))},e.prototype.getDeviceId=function(e){try{var t=this._getSenderByKind(e);if(!t||!t.track)return null;var n=t.track.getSettings().deviceId;return void 0===n?null:n}catch(t){c.default.error("RTCPeer getDeviceId error",e,t)}},e.prototype.getTrackSettings=function(e){try{var t=this._getSenderByKind(e);return t&&t.track?t.track.getSettings():null}catch(t){c.default.error("RTCPeer getTrackSettings error",e,t)}},e.prototype.getDeviceLabel=function(e){try{var t=this._getSenderByKind(e);return t&&t.track?t.track.label:null}catch(t){c.default.error("RTCPeer getDeviceLabel error",e,t)}},e.prototype.restartIceWithRelayOnly=function(){try{var e=this.instance.getConfiguration();if("relay"===e.iceTransportPolicy)return console.warn("RTCPeer already with iceTransportPolicy relay only");var t=r(r({},e),{iceTransportPolicy:"relay"});this.instance.setConfiguration(t),this.instance.restartIce()}catch(e){c.default.error("RTCPeer restartIce error",e)}},e.prototype.applyMediaConstraints=function(e,t){return i(this,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),(n=this._getSenderByKind(e))&&n.track?"live"!==n.track.readyState?[3,2]:(c.default.info("Apply "+e+" constraints",this.options.id,t),[4,n.track.applyConstraints(t)]):[2,c.default.info("No sender to apply constraints",e,t)];case 1:r.sent(),r.label=2;case 2:return[3,4];case 3:return r.sent(),c.default.error("Error applying constraints",e,t),[3,4];case 4:return[2]}}))}))},e.prototype._getSenderByKind=function(e){return this.instance.getSenders().find((function(t){var n=t.track;return n&&n.kind===e}))},e.prototype._getReceiverByKind=function(e){return this.instance.getReceivers().find((function(t){var n=t.track;return n&&n.kind===e}))},e.prototype.startNegotiation=function(e){return void 0===e&&(e=!1),i(this,void 0,void 0,(function(){var t,n,r,i=this;return o(this,(function(o){switch(o.label){case 0:if(this._negotiating)return[2,c.default.warn("Skip twice onnegotiationneeded!")];this._negotiating=!0,o.label=1;case 1:return o.trys.push([1,9,,10]),!0!==this.options.screenShare&&!0!==this.options.secondSource||this.instance.getTransceivers().forEach((function(e){e.direction="sendonly"})),this.instance.removeEventListener("icecandidate",this._onIce),this.instance.addEventListener("icecandidate",this._onIce),this.isOffer?(c.default.info("Trying to generate offer"),[4,this.instance.createOffer({voiceActivityDetection:!1})]):[3,4];case 2:return t=o.sent(),[4,this._setLocalDescription(t)];case 3:o.sent(),o.label=4;case 4:return this.isAnswer?(c.default.info("Trying to generate answer"),[4,this._setRemoteDescription({sdp:this.options.remoteSdp,type:p.PeerType.Offer})]):[3,8];case 5:return o.sent(),this._logTransceivers(),[4,this.instance.createAnswer({voiceActivityDetection:!1})];case 6:return n=o.sent(),[4,this._setLocalDescription(n)];case 7:o.sent(),o.label=8;case 8:return e&&this._sdpReady(),c.default.info("iceGatheringState",this.instance.iceGatheringState),"gathering"===this.instance.iceGatheringState&&(this._iceTimeout=setTimeout((function(){i._onIceTimeout()}),this.options.maxIceGatheringTimeout)),[3,10];case 9:return r=o.sent(),c.default.error("Error creating "+this.type+":",r),[3,10];case 10:return[2]}}))}))},e.prototype.onRemoteSdp=function(e){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=this.isOffer?p.PeerType.Answer:p.PeerType.Offer,[4,this._setRemoteDescription({sdp:e,type:t})];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),c.default.error("Error handling remote SDP on call "+this.options.id+":",n),this.call.hangup(),[3,3];case 3:return[2]}}))}))},e.prototype._logTransceivers=function(){c.default.info("Number of transceivers:",this.instance.getTransceivers().length),this.instance.getTransceivers().forEach((function(e,t){c.default.info(">> Transceiver ["+t+"]:",e.mid,e.direction,e.stopped),c.default.info(">> Sender Params ["+t+"]:",JSON.stringify(e.sender.getParameters(),null,2))}))},e.prototype._init=function(){return i(this,void 0,void 0,(function(){var e,t,n,r,i,a,s,u,l,d,p,y,m,b=this;return o(this,(function(o){switch(o.label){case 0:return this.instance=h.RTCPeerConnection(this.config),this.instance.onsignalingstatechange=function(e){switch(c.default.info("signalingState:",b.instance.signalingState),b.instance.signalingState){case"stable":b._negotiating=!1;break;case"closed":b.instance=null;break;default:b._negotiating=!0}},this.instance.addEventListener("connectionstatechange",(function(e){c.default.info("connectionState:",b.instance.connectionState)}),!1),this.instance.onnegotiationneeded=function(e){c.default.info("Negotiation needed event"),b.startNegotiation()},this.instance.addEventListener("track",(function(e){if(b.hasExperimentalFlag){b._buildMediaElementByTrack(e);var t={type:"trackAdd",event:e};b.call._dispatchNotification(t)}if(b.isSfu){t={type:"trackAdd",event:e};b.call._dispatchNotification(t)}b.options.remoteStream=e.streams[0];var n=b.options,r=n.remoteElement,i=n.remoteStream;!1===n.screenShare&&h.attachMediaStream(r,i)})),this.instance.addEventListener("addstream",(function(e){b.options.remoteStream=e.stream})),e=this.options,[4,this._retrieveLocalStream().catch((function(e){return v.trigger(b.options.id,e,f.SwEvent.MediaError),null}))];case 1:if(e.localStream=o.sent(),t=this.options,n=t.localElement,r=t.localStream,i=void 0===r?null:r,a=t.screenShare,h.streamIsValid(i)){if(s=i.getAudioTracks(),c.default.info("Local audio tracks: ",s),u=i.getVideoTracks(),c.default.info("Local video tracks: ",u),this.isOffer&&"function"==typeof this.instance.addTransceiver){if(s.forEach((function(e){b.options.userVariables.microphoneLabel=e.label,b.instance.addTransceiver(e,{direction:"sendrecv",streams:[i]})})),l={direction:"sendrecv",streams:[i]},this.isSimulcast&&(d=["0","1","2"],l.sendEncodings=d.map((function(e){return{active:!0,rid:e,scaleResolutionDownBy:6*Number(e)||1}}))),console.debug("Applying video transceiverParams",l),u.forEach((function(e){b.options.userVariables.cameraLabel=e.label,b.instance.addTransceiver(e,l)})),this.isSfu)for(p=this.options.msStreamsNumber,y=void 0===p?5:p,console.debug("Add ",y,"recvonly MS Streams"),l.direction="recvonly",m=0;m<Number(y);m++)this.instance.addTransceiver("video",l)}else"function"==typeof this.instance.addTrack?(s.forEach((function(e){b.options.userVariables.microphoneLabel=e.label,b.instance.addTrack(e,i)})),u.forEach((function(e){b.options.userVariables.cameraLabel=e.label,b.instance.addTrack(e,i)}))):this.instance.addStream(i);!1===a&&(h.muteMediaElement(n),h.attachMediaStream(n,i))}return this.isOffer?(this.options.negotiateAudio&&this._checkMediaToNegotiate("audio"),this.options.negotiateVideo&&this._checkMediaToNegotiate("video")):this.startNegotiation(),this._logTransceivers(),[2]}}))}))},e.prototype._checkMediaToNegotiate=function(e){if(!this._getSenderByKind(e)){var t=this.instance.addTransceiver(e);console.debug("Add transceiver",e,t)}},e.prototype._sdpIsValid=function(){var e,t;try{if(this.hasIceServers){var n=/typ (?:srflx|prflx|relay)/,r=u.default.getMediaSections(this.localSdp);try{for(var i=a(r),o=i.next();!o.done;o=i.next()){var s=o.value;if(!u.default.splitLines(s).some((function(e){return 0===e.indexOf("a=candidate")&&n.test(e)})))return!1}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}}return!0}catch(e){return c.default.error("Error checking SDP",e),!1}},e.prototype._forceNegotiation=function(){c.default.info("Force negotiation again"),this._negotiating=!1,this.startNegotiation()},e.prototype._sdpReady=function(){if(clearTimeout(this._iceTimeout),this._iceTimeout=null,!this._sdpIsValid())return c.default.info("SDP ready but not valid"),void this._forceNegotiation();var e=this.instance.localDescription,t=e.sdp,n=e.type;if(-1===t.indexOf("candidate"))return c.default.info("No candidate - retry \n"),void this.startNegotiation(!0);switch(c.default.info("LOCAL SDP \n","Type: "+n,"\n\n",t),n){case p.PeerType.Offer:this.call.active?this.executeUpdateMedia():this.executeInvite();break;case p.PeerType.Answer:this.executeAnswer();break;default:return c.default.error("Unknown SDP type: '"+n+"' on call "+this.options.id)}},e.prototype.executeInvite=function(){this.call.setState(p.State.Requesting);var e=new y.Invite(r(r({},this.call.messagePayload),{sdp:this.localSdp}));return this._execute(e)},e.prototype.executeUpdateMedia=function(){var e=new y.Modify(r(r({},this.call.messagePayload),{sdp:this.localSdp,action:"updateMedia"}));return this._execute(e)},e.prototype.executeAnswer=function(){this.call.setState(p.State.Answering);var e=r(r({},this.call.messagePayload),{sdp:this.localSdp}),t=!0===this.options.attach?new y.Attach(e):new y.Answer(e);return this._execute(t)},e.prototype._execute=function(e){return i(this,void 0,void 0,(function(){var t,n,r,i,a,s,u;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),[4,this.call._execute(e)];case 1:return t=o.sent(),n=t.node_id,r=void 0===n?null:n,i=t.sdp,a=void 0===i?null:i,r&&(this.call.nodeId=r),null===a?[3,3]:[4,this._setRemoteDescription({sdp:a,type:p.PeerType.Answer})];case 2:return o.sent(),[3,4];case 3:s=this.isOffer?p.State.Trying:p.State.Active,this.call.setState(s),o.label=4;case 4:return[3,6];case 5:return u=o.sent(),c.default.error("Error sending "+this.type+" on call "+this.options.id+":",u),this.call.hangup(),[3,6];case 6:return[2]}}))}))},e.prototype._onIceTimeout=function(){if(this._sdpIsValid())return this._sdpReady();var e=this.instance.getConfiguration();if("relay"===e.iceTransportPolicy)return c.default.info("RTCPeer already with `iceTransportPolicy: relay`"),void this.call.setState(p.State.Destroy);this.instance.setConfiguration(r(r({},e),{iceTransportPolicy:"relay"})),this._forceNegotiation()},e.prototype._onIce=function(e){var t=this;if(this._iceTimeout&&(clearTimeout(this._iceTimeout),this._iceTimeout=null),!e.candidate)return this.instance.removeEventListener("icecandidate",this._onIce),void this._sdpReady();c.default.info("RTCPeer Candidate:",e.candidate),"host"===e.candidate.type?this._iceTimeout=setTimeout((function(){t.instance.removeEventListener("icecandidate",t._onIce),t._onIceTimeout()}),this.options.maxIceGatheringTimeout):this._iceTimeout=setTimeout((function(){t.instance.removeEventListener("icecandidate",t._onIce),t._sdpReady()}),this.options.iceGatheringTimeout)},e.prototype._setLocalDescription=function(e){var t=this.options,n=t.useStereo,r=t.googleMaxBitrate,i=t.googleMinBitrate,o=t.googleStartBitrate;return n&&(e.sdp=d.sdpStereoHack(e.sdp)),r&&i&&o&&(e.sdp=d.sdpBitrateHack(e.sdp,r,i,o)),this.isAnswer&&c.default.info("LOCAL SDP \n","Type: "+e.type,"\n\n",e.sdp),this.instance.setLocalDescription(e)},e.prototype._setRemoteDescription=function(e){this.options.useStereo&&(e.sdp=d.sdpStereoHack(e.sdp)),this.instance.localDescription&&(e.sdp=d.sdpMediaOrderHack(e.sdp,this.instance.localDescription.sdp));var t=h.sdpToJsonHack(e);return c.default.info("REMOTE SDP \n","Type: "+e.type,"\n\n",e.sdp),this.instance.setRemoteDescription(t)},e.prototype._retrieveLocalStream=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return h.streamIsValid(this.options.localStream)?[2,this.options.localStream]:[4,l.getMediaConstraints(this.options)];case 1:return e=t.sent(),[2,l.getUserMedia(e)]}}))}))},e.prototype._buildMediaElementByTrack=function(e){console.debug("_buildMediaElementByTrack",e.track.kind,e.track.id,e.streams,e);var t=e.streams.map((function(e){return e.id}));switch(e.track.kind){case"audio":var n=h.buildAudioElementByTrack(e.track,t);if(this.options.speakerId)try{n.setSinkId(this.options.speakerId)}catch(e){console.debug("setSinkId not supported",this.options.speakerId)}this.call.audioElements.push(n);break;case"video":this.call.videoElements.push(h.buildVideoElementByTrack(e.track,t))}},e}();t.default=m},function(e,t,n){"use strict";const r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},r.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},r.getDescription=function(e){const t=r.splitSections(e);return t&&t[0]},r.getMediaSections=function(e){const t=r.splitSections(e);return t.shift(),t},r.matchPrefix=function(e,t){return r.splitLines(e).filter(e=>0===e.indexOf(t))},r.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},r.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){let t=e.substr(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},r.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},r.parseExtmap=function(e){const t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){const t={};let n;const r=e.substr(e.indexOf(" ")+1).split(";");for(let e=0;e<r.length;e++)n=r[e].trim().split("="),t[n[0].trim()]=n[1];return t},r.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const r=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)}),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){const t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},r.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},r.parseSsrcGroup=function(e){const t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},r.getMid=function(e){const t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){const t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},r.parseCryptoLine=function(e){const t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},r.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?r.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},r.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},r.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},r.getCryptoParameters=function(e,t){return r.matchPrefix(e+t,"a=crypto:").map(r.parseCryptoLine)},r.getIceParameters=function(e,t){const n=r.matchPrefix(e+t,"a=ice-ufrag:")[0],i=r.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},r.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},r.parseRtpParameters=function(e){const t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=r.splitLines(e)[0].split(" ");for(let i=3;i<n.length;i++){const o=n[i],a=r.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){const n=r.parseRtpMap(a),i=r.matchPrefix(e,"a=fmtp:"+o+" ");switch(n.parameters=i.length?r.parseFmtp(i[0]):{},n.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),t.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(n.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach(e=>{t.headerExtensions.push(r.parseExtmap(e))}),t},r.writeRtpDescription=function(e,t){let n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(e=>{n+=r.writeRtpMap(e),n+=r.writeFmtp(e),n+=r.writeRtcpFb(e)});let i=0;return t.codecs.forEach(e=>{e.maxptime>i&&(i=e.maxptime)}),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach(e=>{n+=r.writeExtmap(e)}),n},r.parseRtpEncodingParameters=function(e){const t=[],n=r.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=r.matchPrefix(e,"a=ssrc:").map(e=>r.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),s=a.length>0&&a[0].ssrc;let c;const u=r.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substr(17).split(" ").map(e=>parseInt(e,10)));u.length>0&&u[0].length>1&&u[0][0]===s&&(c=u[0][1]),n.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let n={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&c&&(n.rtx={ssrc:c}),t.push(n),i&&(n=JSON.parse(JSON.stringify(n)),n.fec={ssrc:s,mechanism:o?"red+ulpfec":"red"},t.push(n))}}),0===t.length&&s&&t.push({ssrc:s});let l=r.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,t.forEach(e=>{e.maxBitrate=l})),t},r.parseRtcpParameters=function(e){const t={},n=r.matchPrefix(e,"a=ssrc:").map(e=>r.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);const i=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=i.length>0,t.compound=0===i.length;const o=r.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},r.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},r.parseMsid=function(e){let t;const n=r.matchPrefix(e,"a=msid:");if(1===n.length)return t=n[0].substr(7).split(" "),{stream:t[0],track:t[1]};const i=r.matchPrefix(e,"a=ssrc:").map(e=>r.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return i.length>0?(t=i[0].value.split(" "),{stream:t[0],track:t[1]}):void 0},r.parseSctpDescription=function(e){const t=r.parseMLine(e),n=r.matchPrefix(e,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substr(19),10)),isNaN(i)&&(i=65536);const o=r.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:t.fmt,maxMessageSize:i};const a=r.matchPrefix(e,"a=sctpmap:");if(a.length>0){const e=a[0].substr(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},r.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(e,t,n){let i;const o=void 0!==t?t:2;i=e||r.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.getDirection=function(e,t){const n=r.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){return r.splitLines(e)[0].split(" ")[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},r.parseMLine=function(e){const t=r.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},r.parseOLine=function(e){const t=r.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},r.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const t=r.splitLines(e);for(let e=0;e<t.length;e++)if(t[e].length<2||"="!==t[e].charAt(1))return!1;return!0},e.exports=r},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,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){return/^m=audio/.test(e)},a=function(e){return/^m=video/.test(e)};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]),i=new RegExp("a=fmtp:"+r),o=t.findIndex((function(e){return i.test(e)}));return o>=0?/stereo=1;/.test(t[o])||(t[o]+="; stereo=1; sprop-stereo=1"):t[n]+="\r\na=fmtp:"+r+" stereo=1; sprop-stereo=1",t.join("\r\n")},t.sdpMediaOrderHack=function(e,t){var n=t.split("\r\n");if(n.findIndex(o)<n.findIndex(a))return e;var r=e.split("\r\n"),s=r.findIndex(o),c=r.findIndex(a),u=r.slice(s,c),l=r.slice(c,r.length-1),d=r.slice(0,s);return i(d,l,u,[""]).join("\r\n")},t.sdpBitrateHack=function(e,t,n,r){var i=e.split("\r\n");return i.forEach((function(e,o){/^a=fmtp:\d*/.test(e)?i[o]+=";x-google-max-bitrate="+t+";x-google-min-bitrate="+n+";x-google-start-bitrate="+r:/^a=mid:(1|video)/.test(e)&&(i[o]+="\r\nb=AS:"+t)})),i.join("\r\n")}},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=t.login,r=t.passwd,i=t.sessionid,o=t.userVariables,a=void 0===o?{}:o,s=t.loginParams,c=void 0===s?{}:s,u=t.callIds,l=void 0===u?[]:u,d=e.call(this)||this;d.method="login";var f={login:n,passwd:r,userVariables:a,loginParams:c};return i&&(f.sessid=i),(null==l?void 0:l.length)&&(f.callIds=l),d.buildRequest({method:d.method,params:f}),d}return i(t,e),t}(o(n(10)).default);t.Login=a},function(e,t,n){"use strict";var r,i=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)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t,n){var r=e.call(this)||this;return r.buildRequest({id:t,result:{method:n}}),r}return i(t,e),t}(o(n(10)).default);t.Result=a},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 i=n(4),o=n(2),a=n(0),s=r(n(22)),c=function(e){return{uuid:e.uuid,md5:e.md5,running:!0,laName:e.name,laChannel:e.liveArrayChannel,infoChannel:e.infoChannel,chatChannel:e.chatChannel,modChannel:e.modChannel,confName:e.displayName,numMembers:e.member_count||0,isPrivate:!1,recording:Boolean(e.recording),locked:Boolean(e.locked),lastSnapshot:e.lastSnapshot}};t.default=function(e,t){t.eventChannel,t.eventSerno;var n=t.data;try{switch(n.action){case"bootObj":e.conferences={};var r=[];for(var u in n.data){var l=n.data[u][1],d=c(l);e.conferences[l.uuid]=new s.default(e,d),r.push(l)}var f={type:a.Notification.ConferenceListBootstrap,conferences:r};i.trigger(o.SwEvent.Notification,f,e.uuid);break;case"add":l=n.data,d=c(l);e.conferences[l.uuid]=new s.default(e,d);f={type:a.Notification.ConferenceListAdd,conference:l};i.trigger(o.SwEvent.Notification,f,e.uuid);break;case"modify":l=n.data,d=c(l);e.conferences[l.uuid]=new s.default(e,d);f={type:a.Notification.ConferenceListModify,conference:l};i.trigger(o.SwEvent.Notification,f,e.uuid);break;case"del":l=n.data;delete e.conferences[l.uuid];f={type:a.Notification.ConferenceListDelete,conference:l};i.trigger(o.SwEvent.Notification,f,e.uuid);break;default:console.warn("ConferenceList unknown action",n.action,n)}}catch(e){console.warn("ConferenceList error",e,n)}},t.publicConferenceListMethods={conferenceListBootstrap:function(){var e=this.session,t=this.nodeId,n=this.channel,r={liveArray:{command:"bootstrap",context:n,name:"conferences"}};e.vertoBroadcast({nodeId:t,channel:n,data:r})}}},function(e,t,n){"use strict";var r,i=(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)}),o=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},a=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},s=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=s(n(18)),u=n(8),l=s(n(12)),d=n(2),f=n(4),p=n(9),h=s(n(20)),v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.relayProtocol=d.VERTO_PROTOCOL,t.timeoutErrorCode=-329990,t.loginResponse={},t.moderator=!1,t.superuser=!1,t}return i(t,e),t.prototype.validateOptions=function(){var e=this.options,t=e.host,n=e.login,r=e.passwd,i=e.password;return Boolean(t)&&Boolean(n&&(r||i))},t.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},t.prototype.broadcast=function(e){return this.vertoBroadcast(e)},t.prototype.subscribe=function(e){return this.vertoSubscribe(e)},t.prototype.unsubscribe=function(e){return this.vertoUnsubscribe(e)},t.prototype.ping=function(){var e=new u.Ping({serno:Date.now()});return this.execute(e)},t.prototype._wrapInExecute=function(e){return e},t.prototype.vertoLogin=function(){return o(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,c;return a(this,(function(a){switch(a.label){case 0:return e=this.options,t=e.login,n=e.password,r=e.passwd,i=e.userVariables,o=e.loginParams,s=new u.Login({login:t,passwd:n||r,sessionid:this.sessionid,userVariables:i,loginParams:o,callIds:this._experimental?this.callIds:[]}),[4,this.execute(s).catch(this._handleLoginError)];case 1:return(c=a.sent())&&(this._autoReconnect=!0,this._idle=!1,this.loginResponse=c,this.moderator=c.moderator||!1,this.superuser=c.superuser||!1,this.sessionid=c.sessid,c["auth-expires"]&&(this.authorization={expires_at:c["auth-expires"],signature:null,project:null,scope_id:null,scopes:[],resource:null},this._checkTokenExpiration()),this.incognito||p.localStorage.setItem(d.SESSION_ID,this.sessionid)),[2,c]}}))}))},t.prototype._onSocketOpen=function(){return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this._idle=!1,[4,this.vertoLogin()];case 1:return e.sent()&&f.trigger(d.SwEvent.Ready,this,this.uuid),[2]}}))}))},t.prototype._onSocketMessage=function(e){h.default(this,e)},t}(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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=a(n(1)),c={method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}},u=function(){function e(){var e=this;this.baseUrl="",this._fetch=function(t,n){return fetch(t,n).then((function(t){return i(e,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return t.status>=200&&t.status<300?204===t.status?[2,t]:[4,t.json()]:[3,2];case 1:return[2,r.sent()];case 2:return e="HTTP Request failed with status "+t.status,(n=new Error(e)).response=t,[2,Promise.reject(n)]}}))}))}))}}return e.prototype.bootstrap=function(e){return i(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(o){switch(o.label){case 0:return t=encodeURIComponent(e),n=this.baseUrl+"/api/configuration?hostname="+t,[4,this._fetch(n,r(r({},c),{method:"GET"}))];case 1:return i=o.sent(),s.default.info("bootstrap response",i),[2,i]}}))}))},e.prototype.login=function(e,t){return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return[4,this._fetch(this.baseUrl+"/api/login",r(r({},c),{body:JSON.stringify({username:e,project_id:t})}))];case 1:return n=i.sent(),s.default.info("userLogin response",n),[2,n]}}))}))},e.prototype.refresh=function(e){return void 0===e&&(e=null),i(this,void 0,void 0,(function(){var t,n;return o(this,(function(i){switch(i.label){case 0:return t=r(r({},c),{method:"PUT"}),e&&(t.body=JSON.stringify({refresh_token:e})),[4,this._fetch(this.baseUrl+"/api/refresh",t)];case 1:return n=i.sent(),s.default.info("refresh response",n),[2,n]}}))}))},e.prototype.logout=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,this._fetch(this.baseUrl+"/api/logout",r(r({},c),{method:"PUT"}))];case 1:return e=t.sent(),s.default.info("logout response",e),[2,e]}}))}))},e}();t.default=u}]));
|
|
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";n.r(t),n.d(t,"v1",(function(){return h})),n.d(t,"v3",(function(){return w})),n.d(t,"v4",(function(){return S})),n.d(t,"v5",(function(){return I}));var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function i(){if(!r)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}for(var s=[],a=0;a<256;++a)s[a]=(a+256).toString(16).substr(1);var c,u,l=function(e,t){var n=t||0,r=s;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")},f=0,d=0;var h=function(e,t,n){var r=t&&n||0,o=t||[],s=(e=e||{}).node||c,a=void 0!==e.clockseq?e.clockseq:u;if(null==s||null==a){var h=e.random||(e.rng||i)();null==s&&(s=c=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==a&&(a=u=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:d+1,y=p-f+(v-d)/1e4;if(y<0&&void 0===e.clockseq&&(a=a+1&16383),(y<0||p>f)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=p,d=v,u=a;var b=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;o[r++]=b>>>24&255,o[r++]=b>>>16&255,o[r++]=b>>>8&255,o[r++]=255&b;var _=p/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||l(o)};var p=function(e,t,n){var r=function(e,r,o,i){var s=o&&i||0;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(e)),"string"==typeof r&&(r=function(e){var t=[];return e.replace(/[a-fA-F0-9]{2}/g,(function(e){t.push(parseInt(e,16))})),t}(r)),!Array.isArray(e))throw TypeError("value must be an array of bytes");if(!Array.isArray(r)||16!==r.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var a=n(r.concat(e));if(a[6]=15&a[6]|t,a[8]=63&a[8]|128,o)for(var c=0;c<16;++c)o[s+c]=a[c];return o||l(a)};try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r};function v(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function y(e,t,n,r,o,i){return v((s=v(v(t,e),v(r,i)))<<(a=o)|s>>>32-a,n);var s,a}function b(e,t,n,r,o,i,s){return y(t&n|~t&r,e,t,o,i,s)}function _(e,t,n,r,o,i,s){return y(t&r|n&~r,e,t,o,i,s)}function g(e,t,n,r,o,i,s){return y(t^n^r,e,t,o,i,s)}function m(e,t,n,r,o,i,s){return y(n^(t|~r),e,t,o,i,s)}var w=p("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Array(t.length);for(var n=0;n<t.length;n++)e[n]=t.charCodeAt(n)}return function(e){var t,n,r,o=[],i=32*e.length;for(t=0;t<i;t+=8)n=e[t>>5]>>>t%32&255,r=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16),o.push(r);return o}(function(e,t){var n,r,o,i,s;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var a=1732584193,c=-271733879,u=-1732584194,l=271733878;for(n=0;n<e.length;n+=16)r=a,o=c,i=u,s=l,a=b(a,c,u,l,e[n],7,-680876936),l=b(l,a,c,u,e[n+1],12,-389564586),u=b(u,l,a,c,e[n+2],17,606105819),c=b(c,u,l,a,e[n+3],22,-1044525330),a=b(a,c,u,l,e[n+4],7,-176418897),l=b(l,a,c,u,e[n+5],12,1200080426),u=b(u,l,a,c,e[n+6],17,-1473231341),c=b(c,u,l,a,e[n+7],22,-45705983),a=b(a,c,u,l,e[n+8],7,1770035416),l=b(l,a,c,u,e[n+9],12,-1958414417),u=b(u,l,a,c,e[n+10],17,-42063),c=b(c,u,l,a,e[n+11],22,-1990404162),a=b(a,c,u,l,e[n+12],7,1804603682),l=b(l,a,c,u,e[n+13],12,-40341101),u=b(u,l,a,c,e[n+14],17,-1502002290),c=b(c,u,l,a,e[n+15],22,1236535329),a=_(a,c,u,l,e[n+1],5,-165796510),l=_(l,a,c,u,e[n+6],9,-1069501632),u=_(u,l,a,c,e[n+11],14,643717713),c=_(c,u,l,a,e[n],20,-373897302),a=_(a,c,u,l,e[n+5],5,-701558691),l=_(l,a,c,u,e[n+10],9,38016083),u=_(u,l,a,c,e[n+15],14,-660478335),c=_(c,u,l,a,e[n+4],20,-405537848),a=_(a,c,u,l,e[n+9],5,568446438),l=_(l,a,c,u,e[n+14],9,-1019803690),u=_(u,l,a,c,e[n+3],14,-187363961),c=_(c,u,l,a,e[n+8],20,1163531501),a=_(a,c,u,l,e[n+13],5,-1444681467),l=_(l,a,c,u,e[n+2],9,-51403784),u=_(u,l,a,c,e[n+7],14,1735328473),c=_(c,u,l,a,e[n+12],20,-1926607734),a=g(a,c,u,l,e[n+5],4,-378558),l=g(l,a,c,u,e[n+8],11,-2022574463),u=g(u,l,a,c,e[n+11],16,1839030562),c=g(c,u,l,a,e[n+14],23,-35309556),a=g(a,c,u,l,e[n+1],4,-1530992060),l=g(l,a,c,u,e[n+4],11,1272893353),u=g(u,l,a,c,e[n+7],16,-155497632),c=g(c,u,l,a,e[n+10],23,-1094730640),a=g(a,c,u,l,e[n+13],4,681279174),l=g(l,a,c,u,e[n],11,-358537222),u=g(u,l,a,c,e[n+3],16,-722521979),c=g(c,u,l,a,e[n+6],23,76029189),a=g(a,c,u,l,e[n+9],4,-640364487),l=g(l,a,c,u,e[n+12],11,-421815835),u=g(u,l,a,c,e[n+15],16,530742520),c=g(c,u,l,a,e[n+2],23,-995338651),a=m(a,c,u,l,e[n],6,-198630844),l=m(l,a,c,u,e[n+7],10,1126891415),u=m(u,l,a,c,e[n+14],15,-1416354905),c=m(c,u,l,a,e[n+5],21,-57434055),a=m(a,c,u,l,e[n+12],6,1700485571),l=m(l,a,c,u,e[n+3],10,-1894986606),u=m(u,l,a,c,e[n+10],15,-1051523),c=m(c,u,l,a,e[n+1],21,-2054922799),a=m(a,c,u,l,e[n+8],6,1873313359),l=m(l,a,c,u,e[n+15],10,-30611744),u=m(u,l,a,c,e[n+6],15,-1560198380),c=m(c,u,l,a,e[n+13],21,1309151649),a=m(a,c,u,l,e[n+4],6,-145523070),l=m(l,a,c,u,e[n+11],10,-1120210379),u=m(u,l,a,c,e[n+2],15,718787259),c=m(c,u,l,a,e[n+9],21,-343485551),a=v(a,r),c=v(c,o),u=v(u,i),l=v(l,s);return[a,c,u,l]}(function(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e[t/8])<<t%32;return n}(e),8*e.length))}));var S=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[r+s]=o[s];return t||l(o)};function O(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 k(e,t){return e<<t|e>>>32-t}var I=p("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=new Array(r.length);for(var o=0;o<r.length;o++)e[o]=r.charCodeAt(o)}e.push(128);var i=e.length/4+2,s=Math.ceil(i/16),a=new Array(s);for(o=0;o<s;o++){a[o]=new Array(16);for(var c=0;c<16;c++)a[o][c]=e[64*o+4*c]<<24|e[64*o+4*c+1]<<16|e[64*o+4*c+2]<<8|e[64*o+4*c+3]}for(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,o=0;o<s;o++){for(var u=new Array(80),l=0;l<16;l++)u[l]=a[o][l];for(l=16;l<80;l++)u[l]=k(u[l-3]^u[l-8]^u[l-14]^u[l-16],1);var f=n[0],d=n[1],h=n[2],p=n[3],v=n[4];for(l=0;l<80;l++){var y=Math.floor(l/20),b=k(f,5)+O(y,d,h,p)+v+t[y]+u[l]>>>0;v=p,p=h,h=k(d,30)>>>0,d=f,f=b}n[0]=n[0]+f>>>0,n[1]=n[1]+d>>>0,n[2]=n[2]+h>>>0,n[3]=n[3]+p>>>0,n[4]=n[4]+v>>>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]]}))},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._handleBladeConnectResponse=function(e){var t=e.ice_servers,n=void 0===t?[]:t;this.iceServers=n},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,k,I,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,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:P.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=_||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&&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,k=void 0===O?null:O,S=t.calls[k]||null,null!==k&&(I={type:f.NOTIFICATION_TYPE.conferenceUpdate,action:h.ConferenceAction.Leave,conferenceName:a,participantId:Number(y),role:b},d.trigger(l.SwEvent.Notification,I,k,!1)||d.trigger(l.SwEvent.Notification,I,t.uuid),null===S&&d.deRegister(l.SwEvent.Notification,null,k))),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.3.0",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){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}}e&&(a+=":"+e),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){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("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})?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(),this._handleBladeConnectResponse(s),l.trigger(d.SwEvent.Ready,this,this.uuid),a.default.info("Session Ready!"),o.label=3;case 3:return[2]}}))}))},e.prototype._handleBladeConnectResponse=function(e){},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(e){e&&(null==e?void 0:e.iceTransportPolicy)&&(this.options.iceTransportPolicy=null==e?void 0:e.iceTransportPolicy),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,t=e.iceServers,n=void 0===t?[]:t,r=e.iceTransportPolicy,o={iceTransportPolicy:void 0===r?"all":r,sdpSemantics:"unified-plan",bundlePolicy:"max-compat",iceServers:n};return s.default.info("RTC config",o),o},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}]));
|