Socket
Socket
Sign inDemoInstall

jingle

Package Overview
Dependencies
13
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

4

jingle.bundle.js

@@ -1,2 +0,2 @@

!function(n){if("function"==typeof bootstrap)bootstrap("jingle",n);else if("object"==typeof exports)module.exports=n();else if("function"==typeof define&&define.amd)define(n);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeJingle=n}else"undefined"!=typeof window?window.Jingle=n():global.Jingle=n()}(function(){var n;return function(n,t,e){function r(e,o){if(!t[e]){if(!n[e]){var a="function"==typeof require&&require;if(!o&&a)return a(e,!0);if(i)return i(e,!0);throw new Error("Cannot find module '"+e+"'")}var s=t[e]={exports:{}};n[e][0].call(s.exports,function(t){var i=n[e][1][t];return r(i?i:t)},s,s.exports)}return t[e].exports}for(var i="function"==typeof require&&require,o=0;o<e.length;o++)r(e[o]);return r}({1:[function(n,t){t.exports=n("./lib/sessionManager")},{"./lib/sessionManager":4}],2:[function(n,t){function e(n){var t=n.split("-");return"on"+t[0][0].toUpperCase()+t[0].substr(1)+t[1][0].toUpperCase()+t[1].substr(1)}function r(n){var t=this;this.sid=n.sid||Date.now().toString(),this.peer=n.peer,this.isInitiator=n.initiator||!1,this.state="starting",this.parent=n.parent,this.processingQueue=o.queue(function(n,e){var r=n.action,i=n.changes,o=n.cb;s(this.sid+": "+r),t[r](i,function(n){o(n),e()})})}var i=n("bows"),o=n("async"),a=n("wildemitter");n("jingle-rtcpeerconnection"),n("sdp-jingle-json");var s=i("JingleSession");r.prototype=Object.create(a.prototype,{constructor:{value:r}}),r.prototype.process=function(n,t,r){var i=e(n);this.processingQueue.push({action:i,changes:t,cb:r})},r.prototype.send=function(n,t){t=t||{},t.sid=this.sid,t.action=n,this.parent.emit("send",{to:this.peer,type:"set",jingle:t})},Object.defineProperty(r.prototype,"state",{get:function(){return this._state},set:function(n){var t={starting:!0,pending:!0,active:!0,ended:!0};if(!t[n])throw new Error("Invalid Jingle Session State: "+n);this._state!==n&&(this._state=n,s(this.sid+": State changed to "+n))}}),Object.defineProperty(r.prototype,"starting",{get:function(){return"starting"==this._state}}),Object.defineProperty(r.prototype,"pending",{get:function(){return"pending"==this._state}}),Object.defineProperty(r.prototype,"active",{get:function(){return"active"==this._state}}),Object.defineProperty(r.prototype,"ended",{get:function(){return"ended"==this._state}}),r.prototype.start=function(){this.state="pending",s(this.sid+": Can not start generic session")},r.prototype.end=function(n){this.parent.peers[this.peer].splice(this.parent.peers[this.peer].indexOf(this),1),delete this.parent.sessions[this.sid],this.state="ended",n||this.send("session-terminate")};var c=["content-accept","content-add","content-modify","conent-reject","content-remove","description-info","session-accept","session-info","session-initiate","session-terminate","transport-accept","transport-info","transport-reject","transport-replace"];c.forEach(function(n){var t=e(n);r.prototype[t]=function(t,e){s(this.sid+": Unsupported action "+n),e()}}),t.exports=r},{async:5,bows:6,"jingle-rtcpeerconnection":11,"sdp-jingle-json":16,wildemitter:22}],3:[function(n,t){function e(n){o.call(this,n),this.pc=new a(this.parent.config.peerConnectionConfig,this.parent.config.peerConnectionConstraints),this.pc.on("ice",this.onIceCandidate.bind(this)),this.pc.on("addStream",this.onStreamAdded.bind(this)),this.pc.on("removeStream",this.onStreamRemoved.bind(this)),this.pendingAnswer=null,this.pc.addStream(this.parent.localStream),this.stream=null}var r=n("underscore"),i=n("bows"),o=n("./genericSession"),a=n("jingle-rtcpeerconnection"),s=i("JingleMedia");e.prototype=Object.create(o.prototype,{constructor:{value:e}}),e.prototype=r.extend(e.prototype,{start:function(){var n=this;this.state="pending",this.pc.isInitiator=!0,this.pc.offer(function(t,e){n.send("session-initiate",e.json)})},end:function(){this.pc.close(),this.onStreamRemoved(),o.prototype.end.call(this)},accept:function(){s(this.sid+": Accepted incoming session"),this.send("session-accept",this.pendingAnswer)},ring:function(){s(this.sid+": Ringing on incoming session"),this.send("session-info",{ringing:!0})},mute:function(n,t){s(this.sid+": Muting"),this.send("session-info",{mute:{creator:n,name:t}})},unmute:function(n,t){s(this.sid+": Unmuting"),this.send("session-info",{unmute:{creator:n,name:t}})},hold:function(){s(this.sid+": Placing on hold"),this.send("session-info",{hold:!0})},resume:function(){s(this.sid+": Resuing from hold"),this.send("session-info",{active:!0})},onSessionInitiate:function(n,t){s(this.sid+": Initiating incoming session");var e=this;this.state="pending",this.pc.isInitiator=!1,this.pc.answer({type:"offer",json:n},function(n,r){return n?(s(e.sid+": Could not create WebRTC answer",n),t({condition:"general-error"})):(e.pendingAnswer=r.json,t(),void 0)})},onSessionAccept:function(n,t){var e=this;s(this.sid+": Activating accepted outbound session"),this.state="active",this.pc.handleAnswer({type:"answer",json:n},function(n){s(e.sid+": Could not process WebRTC answer",n),t({condition:"general-error"})})},onSessionTerminate:function(n,t){s(this.sid+": Terminating session"),this.pc.close(),this.onStreamRemoved(),o.prototype.end.call(this,!0),t()},onTransportInfo:function(n,t){var e=this;s(this.sid+": Adding ICE candidate"),this.pc.processIce(n,function(n){n&&s(e.sid+": Could not process ICE candidate",n),t()})},onIceCandidate:function(n){s(this.sid+": Discovered new ICE candidate",n),this.send("transport-info",n)},onStreamAdded:function(n){this.stream?s(this.sid+": Received remote stream, but one already exists"):(s(this.sid+": Remote media stream added"),this.stream=n.stream,this.parent.emit("peerStreamAdded",this))},onStreamRemoved:function(){s(this.sid+": Remote media stream removed"),this.parent.emit("peerStreamRemoved",this)}}),t.exports=e},{"./genericSession":2,bows:6,"jingle-rtcpeerconnection":11,underscore:20}],4:[function(n,t){function e(n){n=n||{};var t=this.config={debug:!1,peerConnectionConfig:{iceServers:[{url:"stun:stun.l.google.com:19302"}]},peerConnectionConstraints:{optional:[{DtlsSrtpKeyAgreement:!0},{RtpDataChannels:!1}]},autoAdjustMic:!1,media:{audio:!0,video:!0}};this.MediaSession=f,this.jid=n.jid,this.sessions={},this.peers={},this.screenSharingSupport=a.screenSharing;for(var e in n)t[e]=n[e];this.capabilities=["urn:xmpp:jingle:1"],a.support?this.capabilities=["urn:xmpp:jingle:1","urn:xmpp:jingle:apps:rtp:1","urn:xmpp:jingle:apps:rtp:audio","urn:xmpp:jingle:apps:rtp:video","urn:xmpp:jingle:apps:rtp:rtcb-fb:0","urn:xmpp:jingle:apps:dtls:0","urn:xmpp:jingle:transports:ice-udp:1","urn:ietf:rfc:3264"]:l("WebRTC not supported"),c.call(this),this.config.debug&&this.on("*",function(n,t,e){l(n,t,e)})}var r=n("underscore"),i=n("bows"),o=n("hark"),a=n("webrtcsupport");n("mockconsole");var s=n("getusermedia");n("jingle-rtcpeerconnection");var c=n("wildemitter"),u=n("mediastream-gain"),p=n("./genericSession"),f=n("./mediaSession"),l=i("Jingle");e.prototype=Object.create(c.prototype,{constructor:{value:e}}),e.prototype.startLocalMedia=function(n,t){var e=this,r=n||{video:!0,audio:!0};s(r,function(n,i){n?l("Could not start local media"):(r.audio&&e.config.detectSpeakingEvents&&e.setupAudioMonitor(i),e.localStream=i,e.config.autoAdjustMic&&(e.gainController=new u(i),e.setMicIfEnabled(.5)),l("Local media stream started"),e.emit("localStream",i)),t&&t(n,i)})},e.prototype.stopLocalMedia=function(){this.localStream&&(this.localStream.stop(),this.emit("localStreamStopped"))},e.prototype.setupAudioMonitor=function(n){l("Setup audio");var t,e=o(n),r=this;e.on("speaking",function(){r.hardMuted||(r.setMicIfEnabled(1),r.emit("speaking"))}),e.on("stopped_speaking",function(){r.hardMuted||(t&&clearTimeout(t),t=setTimeout(function(){r.setMicIfEnabled(.5),r.emit("stoppedSpeaking")},1e3))})},e.prototype.setMicIfEnabled=function(n){this.config.autoAdjustMic&&this.gainController.setGain(n)},e.prototype.sendError=function(n,t,e){e.type="cancel",this.emit("send",{to:n,id:t,type:"error",error:e})},e.prototype.process=function(n){var t=this;if("error"===n.type)return this.emit("error",n);if("result"!==n.type){var e,i,o,a=n.jingle.sid,s=n.jingle.action,c=n.jingle.contents||[],u=r.map(c,function(n){return(n.description||{}).descType}),d=this.sessions[a]||null,h=n.from.full||n.from,m=n.id;if("session-initiate"!==s){if(!d)return l("Unknown session",a),this.sendError(h,m,{condition:"item-not-found",jingleCondition:"unknown-session"});if(d.peer!==h||d.ended)return l("Session has ended, or action has wrong sender"),this.sendError(h,m,{condition:"item-not-found",jingleCondition:"unknown-session"});if("session-accept"===s&&!d.pending)return l("Tried to accept session twice",a),this.sendError(h,m,{condition:"unexpected-request",jingleCondition:"out-of-order"});if("session-terminate"!==s&&d.pendingAction&&(l("Tie break during pending request"),d.isInitiator))return this.sendError(h,m,{condition:"conflict",jingleCondition:"tie-break"})}else{if(d)return d.peer!==h?(l("Duplicate sid from new sender"),this.sendError(h,m,{condition:"service-unavailable"})):d.pending&&this.jid>d.peer?(l("Tie break new session because of duplicate sids"),this.sendError(h,m,{condition:"conflict",jingleCondition:"tie-break"})):(l("Someone is doing this wrong"),this.sendError(h,m,{condition:"unexpected-request",jingleCondition:"out-of-order"}));if(Object.keys(this.peers[h]||{}).length){e=Object.keys(this.peers[h]);for(var g=0;g<e.length;g++)if(i=e[g],o=this.sessions[i],o.pending&&r.intersection(u,o.contentTypes).length&&i>a)return l("Tie break"),this.sendError(h,m,{condition:"conflict",jingleCondition:"tie-break"})}}if("session-initiate"===s){var v={sid:a,peer:h,initiator:!1,parent:this};d=u.indexOf("rtp")>=0?new f(v):new p(v),this.sessions[a]=d,this.peers[h]||(this.peers[h]=[]),this.peers[h].push(d)}d.process(s,n.jingle,function(e){e?(l("Could not process request",n,e),t.sendError(h,m,e)):(t.emit("send",{to:h,id:m,type:"result"}),"session-initiate"===s&&(l("Incoming session request from ",h,d),t.emit("incoming",d)))})}},e.prototype.createMediaSession=function(n,t){var e=new f({sid:t,peer:n,initiator:!0,parent:this});return t=e.sid,this.sessions[t]=e,this.peers[n]||(this.peers[n]=[]),this.peers[n].push(e),l("Outgoing session",e.sid,e),this.emit("outgoing",e),e},e.prototype.endPeerSessions=function(n){l("Ending all sessions with",n);var t=this.peers[n]||[];t.forEach(function(n){n.end()})},t.exports=e},{"./genericSession":2,"./mediaSession":3,bows:6,getusermedia:9,hark:10,"jingle-rtcpeerconnection":11,"mediastream-gain":12,mockconsole:14,underscore:20,webrtcsupport:21,wildemitter:22}],5:[function(t,e){var r=t("__browserify_process");!function(){function t(n){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,n.apply(i,arguments)}}var i,o,a={};i=this,null!=i&&(o=i.async),a.noConflict=function(){return i.async=o,a};var s=function(n,t){if(n.forEach)return n.forEach(t);for(var e=0;e<n.length;e+=1)t(n[e],e,n)},c=function(n,t){if(n.map)return n.map(t);var e=[];return s(n,function(n,r,i){e.push(t(n,r,i))}),e},u=function(n,t,e){return n.reduce?n.reduce(t,e):(s(n,function(n,r,i){e=t(e,n,r,i)}),e)},p=function(n){if(Object.keys)return Object.keys(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t};"undefined"!=typeof r&&r.nextTick?(a.nextTick=r.nextTick,a.setImmediate="undefined"!=typeof setImmediate?setImmediate:a.nextTick):"function"==typeof setImmediate?(a.nextTick=function(n){setImmediate(n)},a.setImmediate=a.nextTick):(a.nextTick=function(n){setTimeout(n,0)},a.setImmediate=a.nextTick),a.each=function(n,e,r){if(r=r||function(){},!n.length)return r();var i=0;s(n,function(o){e(o,t(function(t){t?(r(t),r=function(){}):(i+=1,i>=n.length&&r(null))}))})},a.forEach=a.each,a.eachSeries=function(n,t,e){if(e=e||function(){},!n.length)return e();var r=0,i=function(){t(n[r],function(t){t?(e(t),e=function(){}):(r+=1,r>=n.length?e(null):i())})};i()},a.forEachSeries=a.eachSeries,a.eachLimit=function(n,t,e,r){var i=f(t);i.apply(null,[n,e,r])},a.forEachLimit=a.eachLimit;var f=function(n){return function(t,e,r){if(r=r||function(){},!t.length||0>=n)return r();var i=0,o=0,a=0;!function s(){if(i>=t.length)return r();for(;n>a&&o<t.length;)o+=1,a+=1,e(t[o-1],function(n){n?(r(n),r=function(){}):(i+=1,a-=1,i>=t.length?r():s())})}()}},l=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[a.each].concat(t))}},d=function(n,t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[f(n)].concat(e))}},h=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[a.eachSeries].concat(t))}},m=function(n,t,e,r){var i=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e,r){i[n.index]=r,t(e)})},function(n){r(n,i)})};a.map=l(m),a.mapSeries=h(m),a.mapLimit=function(n,t,e,r){return g(t)(n,e,r)};var g=function(n){return d(n,m)};a.reduce=function(n,t,e,r){a.eachSeries(n,function(n,r){e(t,n,function(n,e){t=e,r(n)})},function(n){r(n,t)})},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(n,t,e,r){var i=c(n,function(n){return n}).reverse();a.reduce(i,t,e,r)},a.foldr=a.reduceRight;var v=function(n,t,e,r){var i=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e&&i.push(n),t()})},function(){r(c(i.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};a.filter=l(v),a.filterSeries=h(v),a.select=a.filter,a.selectSeries=a.filterSeries;var y=function(n,t,e,r){var i=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e||i.push(n),t()})},function(){r(c(i.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};a.reject=l(y),a.rejectSeries=h(y);var w=function(n,t,e,r){n(t,function(n,t){e(n,function(e){e?(r(n),r=function(){}):t()})},function(){r()})};a.detect=l(w),a.detectSeries=h(w),a.some=function(n,t,e){a.each(n,function(n,r){t(n,function(n){n&&(e(!0),e=function(){}),r()})},function(){e(!1)})},a.any=a.some,a.every=function(n,t,e){a.each(n,function(n,r){t(n,function(n){n||(e(!1),e=function(){}),r()})},function(){e(!0)})},a.all=a.every,a.sortBy=function(n,t,e){a.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){if(n)return e(n);var r=function(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0};e(null,c(t.sort(r),function(n){return n.value}))})},a.auto=function(n,t){t=t||function(){};var e=p(n);if(!e.length)return t(null);var r={},i=[],o=function(n){i.unshift(n)},c=function(n){for(var t=0;t<i.length;t+=1)if(i[t]===n)return i.splice(t,1),void 0},f=function(){s(i.slice(0),function(n){n()})};o(function(){p(r).length===e.length&&(t(null,r),t=function(){})}),s(e,function(e){var i=n[e]instanceof Function?[n[e]]:n[e],l=function(n){var i=Array.prototype.slice.call(arguments,1);if(i.length<=1&&(i=i[0]),n){var o={};s(p(r),function(n){o[n]=r[n]}),o[e]=i,t(n,o),t=function(){}}else r[e]=i,a.setImmediate(f)},d=i.slice(0,Math.abs(i.length-1))||[],h=function(){return u(d,function(n,t){return n&&r.hasOwnProperty(t)},!0)&&!r.hasOwnProperty(e)};if(h())i[i.length-1](l,r);else{var m=function(){h()&&(c(m),i[i.length-1](l,r))};o(m)}})},a.waterfall=function(n,t){if(t=t||function(){},n.constructor!==Array){var e=new Error("First argument to waterfall must be an array of functions");return t(e)}if(!n.length)return t();var r=function(n){return function(e){if(e)t.apply(null,arguments),t=function(){};else{var i=Array.prototype.slice.call(arguments,1),o=n.next();o?i.push(r(o)):i.push(t),a.setImmediate(function(){n.apply(null,i)})}}};r(a.iterator(n))()};var b=function(n,t,e){if(e=e||function(){},t.constructor===Array)n.map(t,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},e);else{var r={};n.each(p(t),function(n,e){t[n](function(t){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),r[n]=i,e(t)})},function(n){e(n,r)})}};a.parallel=function(n,t){b({map:a.map,each:a.each},n,t)},a.parallelLimit=function(n,t,e){b({map:g(t),each:f(t)},n,e)},a.series=function(n,t){if(t=t||function(){},n.constructor===Array)a.mapSeries(n,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},t);else{var e={};a.eachSeries(p(n),function(t,r){n[t](function(n){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),e[t]=i,r(n)})},function(n){t(n,e)})}},a.iterator=function(n){var t=function(e){var r=function(){return n.length&&n[e].apply(null,arguments),r.next()};return r.next=function(){return e<n.length-1?t(e+1):null},r};return t(0)},a.apply=function(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t.concat(Array.prototype.slice.call(arguments)))}};var S=function(n,t,e,r){var i=[];n(t,function(n,t){e(n,function(n,e){i=i.concat(e||[]),t(n)})},function(n){r(n,i)})};a.concat=l(S),a.concatSeries=h(S),a.whilst=function(n,t,e){n()?t(function(r){return r?e(r):(a.whilst(n,t,e),void 0)}):e()},a.doWhilst=function(n,t,e){n(function(r){return r?e(r):(t()?a.doWhilst(n,t,e):e(),void 0)})},a.until=function(n,t,e){n()?e():t(function(r){return r?e(r):(a.until(n,t,e),void 0)})},a.doUntil=function(n,t,e){n(function(r){return r?e(r):(t()?e():a.doUntil(n,t,e),void 0)})},a.queue=function(n,e){function r(n,t,r,i){t.constructor!==Array&&(t=[t]),s(t,function(t){var o={data:t,callback:"function"==typeof i?i:null};r?n.tasks.unshift(o):n.tasks.push(o),n.saturated&&n.tasks.length===e&&n.saturated(),a.setImmediate(n.process)})}void 0===e&&(e=1);var i=0,o={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,push:function(n,t){r(o,n,!1,t)},unshift:function(n,t){r(o,n,!0,t)},process:function(){if(i<o.concurrency&&o.tasks.length){var e=o.tasks.shift();o.empty&&0===o.tasks.length&&o.empty(),i+=1;var r=function(){i-=1,e.callback&&e.callback.apply(e,arguments),o.drain&&0===o.tasks.length+i&&o.drain(),o.process()},a=t(r);n(e.data,a)}},length:function(){return o.tasks.length},running:function(){return i}};return o},a.cargo=function(n,t){var e=!1,r=[],i={tasks:r,payload:t,saturated:null,empty:null,drain:null,push:function(n,e){n.constructor!==Array&&(n=[n]),s(n,function(n){r.push({data:n,callback:"function"==typeof e?e:null}),i.saturated&&r.length===t&&i.saturated()}),a.setImmediate(i.process)},process:function o(){if(!e){if(0===r.length)return i.drain&&i.drain(),void 0;var a="number"==typeof t?r.splice(0,t):r.splice(0),u=c(a,function(n){return n.data});i.empty&&i.empty(),e=!0,n(u,function(){e=!1;var n=arguments;s(a,function(t){t.callback&&t.callback.apply(null,n)}),o()})}},length:function(){return r.length},running:function(){return e}};return i};var x=function(n){return function(t){var e=Array.prototype.slice.call(arguments,1);t.apply(null,e.concat([function(t){var e=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(t?console.error&&console.error(t):console[n]&&s(e,function(t){console[n](t)}))}]))}};a.log=x("log"),a.dir=x("dir"),a.memoize=function(n,t){var e={},r={};t=t||function(n){return n};var i=function(){var i=Array.prototype.slice.call(arguments),o=i.pop(),a=t.apply(null,i);a in e?o.apply(null,e[a]):a in r?r[a].push(o):(r[a]=[o],n.apply(null,i.concat([function(){e[a]=arguments;var n=r[a];delete r[a];for(var t=0,i=n.length;i>t;t++)n[t].apply(null,arguments)}])))};return i.memo=e,i.unmemoized=n,i},a.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},a.times=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return a.map(r,t,e)},a.timesSeries=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return a.mapSeries(r,t,e)},a.compose=function(){var n=Array.prototype.reverse.call(arguments);return function(){var t=this,e=Array.prototype.slice.call(arguments),r=e.pop();a.reduce(n,e,function(n,e,r){e.apply(t,n.concat([function(){var n=arguments[0],t=Array.prototype.slice.call(arguments,1);r(n,t)}]))},function(n,e){r.apply(t,[n].concat(e))})}};var k=function(n,t){var e=function(){var e=this,r=Array.prototype.slice.call(arguments),i=r.pop();return n(t,function(n,t){n.apply(e,r.concat([t]))},i)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return e.apply(this,r)}return e};a.applyEach=l(k),a.applyEachSeries=h(k),a.forever=function(n,t){function e(r){if(r){if(t)return t(r);throw r}n(e)}e()},"undefined"!=typeof n&&n.amd?n([],function(){return a}):"undefined"!=typeof e&&e.exports?e.exports=a:i.async=a}()},{__browserify_process:8}],6:[function(n,t){!function(){var e,r,i,o="undefined"==typeof window,a=!o&&window.localStorage,s=a.debug,c=n("andlog"),u=.618033988749895,p=0,f=15,l=function(){};e=function(){return p+=u,p%=1,360*p};var i=s&&"/"===s[0]&&new RegExp(s.substring(1,s.length-1));r=function(n){var t;return t="%c"+n.slice(0,f),t+=Array(f+3-t.length).join(" ")+"|",i&&!n.match(i)?l:window.chrome?c.log.bind(c,t,"color: hsl("+e()+",99%,40%); font-weight: bold"):c.log.bind(c,t)},r.config=function(n){return n.padLength?f=n.padLength:void 0},"undefined"!=typeof t?t.exports=r:window.bows=r}.call()},{andlog:7}],7:[function(n,t,e){!function(){var n="undefined"==typeof window,r=!n&&window.localStorage,i={};if(n)return t.exports=console,void 0;if(r&&r.debug&&window.console)i=window.console;else for(var o="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a=o.length,s=function(){};a--;)i[o[a]]=s;"undefined"!=typeof e?t.exports=i:window.console=i}()},{}],8:[function(n,t){var e=t.exports={};e.nextTick=function(){var n="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(n)return function(n){return window.setImmediate(n)};if(t){var e=[];return window.addEventListener("message",function(n){if(n.source===window&&"process-tick"===n.data&&(n.stopPropagation(),e.length>0)){var t=e.shift();t()}},!0),function(n){e.push(n),window.postMessage("process-tick","*")}}return function(n){setTimeout(n,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.binding=function(){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(){throw new Error("process.chdir is not supported")}},{}],9:[function(n,t){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;t.exports=function(n,t){var r,i=2===arguments.length,o={video:!0,audio:!0},a="PERMISSION_DENIED",s="CONSTRAINT_NOT_SATISFIED";return i||(t=n,n=o),e?(e.call(navigator,n,function(n){t(null,n)},function(n){var e;"string"==typeof n?(e=new Error("NavigatorUserMediaError"),e.name=n===a?a:s):(e=n,e.name||(n.name=e[a]?a:s)),t(e)}),void 0):(r=new Error("NavigatorUserMediaError"),r.name="NOT_SUPPORTED_ERROR",t(r))}},{}],10:[function(n,t){function e(n,t){var e=-1/0;n.getFloatFrequencyData(t);for(var r=0,i=t.length;i>r;r++)t[r]>e&&t[r]<0&&(e=t[r]);return e}var r=n("wildemitter");t.exports=function(n,t){var i=new r;if(!window.webkitAudioContext)return i;var o,a,s,t=t||{},c=t.smoothing||.5,u=t.interval||100,p=t.threshold,f=t.play,l=new webkitAudioContext;s=l.createAnalyser(),s.fftSize=512,s.smoothingTimeConstant=c,a=new Float32Array(s.fftSize),n.jquery&&(n=n[0]),n instanceof HTMLAudioElement?(o=l.createMediaElementSource(n),"undefined"==typeof f&&(f=!0),p=p||-65):(o=l.createMediaStreamSource(n),p=p||-45),o.connect(s),f&&s.connect(l.destination),i.speaking=!1,i.setThreshold=function(n){p=n},i.setInterval=function(n){u=n};var d=function(){setTimeout(function(){var n=e(s,a);i.emit("volume_change",n,p),n>p?i.speaking||(i.speaking=!0,i.emit("speaking")):i.speaking&&(i.speaking=!1,i.emit("stopped_speaking")),d()},u)};return d(),i}},{wildemitter:22}],11:[function(n,t){function e(n,t){this.sid="",this.sdpSessId=Date.now(),this.isInitiator=!0,this.localDescription={contents:[]},this.remoteDescription={contents:[]},o.call(this,n,t)}var r=n("underscore"),i=n("webrtcsupport"),o=n("rtcpeerconnection"),a=n("sdp-jingle-json");e.prototype=Object.create(o.prototype,{constructor:{value:e}}),e.prototype.offer=function(n,t){var e=this,r=2===arguments.length,i=r?n:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},o=r?t:n;this.pc.createOffer(function(n){n.sdp=e._applySdpHack(n.sdp),e.pc.setLocalDescription(n);var t=a.toSessionJSON(n.sdp,e.isInitiator?"initiator":"responder");t.sid=this.sid,e.localDescription=t;var r={type:"offer",sdp:n.sdp,json:t};e.emit("offer",r),o&&o(null,r)},function(n){e.emit("error",n),o&&o(n)},i)},o.prototype.handleAnswer=function(n,t){t=t||function(){};var e=this;n.sdp=a.toSessionSDP(n.json,this.sdpSessId),e.remoteDescription=n.json,this.pc.setRemoteDescription(new i.SessionDescription(n),function(){t(null)},function(n){t(n)})},e.prototype._answer=function(n,t,e){e=e||function(){};var r=this;n.sdp=a.toSessionSDP(n.json,r.sdpSessId),r.remoteDescription=n.json,this.pc.setRemoteDescription(new i.SessionDescription(n),function(){r.pc.createAnswer(function(n){n.sdp=r._applySdpHack(n.sdp),r.pc.setLocalDescription(n);var t=a.toSessionJSON(n.sdp);t.sid=r.sid,r.localDescription=t;var i={type:"answer",sdp:n.sdp,json:t};r.emit("answer",i),e&&e(null,i)},function(n){r.emit("error",n),e&&e(n)},t)},function(n){e(n)})},e.prototype.processIce=function(n,t){t=t||function(){};var e=this,o=r.map(this.remoteDescription.contents,function(n){return n.name}),s=n.contents||[];s.forEach(function(n){var t=n.transport||{},r=t.candidates||[],s=o.indexOf(n.name),c=n.name;r.forEach(function(n){var t=a.toCandidateSDP(n)+"\r\n",r={candidate:t,sdpMLineIndex:s,sdpMid:c};e.pc.addIceCandidate(new i.IceCandidate(r))})}),t()},e.prototype._onIce=function(n){var t=this;if(n.candidate){var e=n.candidate;this.emit("ice",{contents:[{name:e.sdpMid,creator:t.isInitiator?"initiator":"responder",transport:{transType:"iceUdp",candidates:[a.toCandidateJSON(e.candidate)]}}]})}else this.emit("endOfCandidates")},t.exports=e},{rtcpeerconnection:15,"sdp-jingle-json":16,underscore:20,webrtcsupport:21}],12:[function(n,t){function e(n){if(this.support=r.webAudio&&r.mediaStream,this.gain=1,this.support){var t=this.context=new r.AudioContext;this.microphone=t.createMediaStreamSource(n),this.gainFilter=t.createGain(),this.destination=t.createMediaStreamDestination(),this.outputStream=this.destination.stream,this.microphone.connect(this.gainFilter),this.gainFilter.connect(this.destination),n.removeTrack(n.getAudioTracks()[0]),n.addTrack(this.outputStream.getAudioTracks()[0])}this.stream=n}var r=n("webrtcsupport");e.prototype.setGain=function(n){this.support&&(this.gainFilter.gain.value=n,this.gain=n)},e.prototype.getGain=function(){return this.gain},e.prototype.off=function(){return this.setGain(0)},e.prototype.on=function(){this.setGain(1)},t.exports=e},{webrtcsupport:13}],13:[function(n,t){var e=window.mozRTCPeerConnection||window.webkitRTCPeerConnection||window.RTCPeerConnection,r=window.mozRTCIceCandidate||window.RTCIceCandidate,i=window.mozRTCSessionDescription||window.RTCSessionDescription,o=function(){return window.mozRTCPeerConnection?"moz":window.webkitRTCPeerConnection?"webkit":void 0}(),a=window.webkitMediaStream||window.MediaStream,s=navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,c=window.webkitAudioContext||window.AudioContext;t.exports={support:!!e,dataChannel:!!(e&&e.prototype&&e.prototype.createDataChannel),prefix:o,webAudio:!(!c||!c.prototype.createMediaStreamSource),mediaStream:!(!a||!a.prototype.removeTrack),screenSharing:s,AudioContext:c,PeerConnection:e,SessionDescription:i,IceCandidate:r}},{}],14:[function(n,t){for(var e="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),r=e.length,i=function(){},o={};r--;)o[e[r]]=i;t.exports=o},{}],15:[function(n,t){function e(n,t){var e;this.pc=new i.PeerConnection(n,t),r.call(this),this.pc.onremovestream=this.emit.bind(this,"removeStream"),this.pc.onnegotiationneeded=this.emit.bind(this,"negotiationNeeded"),this.pc.oniceconnectionstatechange=this.emit.bind(this,"iceConnectionStateChange"),this.pc.onsignalingstatechange=this.emit.bind(this,"signalingStateChange"),this.pc.onaddstream=this._onAddStream.bind(this),this.pc.onicecandidate=this._onIce.bind(this),this.pc.ondatachannel=this._onDataChannel.bind(this),this.config={debug:!1,sdpHack:!0};for(e in n)this.config[e]=n[e];this.config.debug&&this.on("*",function(){var t=n.logger||console;t.log("PeerConnection event:",arguments)})}var r=n("wildemitter"),i=n("webrtcsupport");e.prototype=Object.create(r.prototype,{constructor:{value:e}}),e.prototype.addStream=function(n){this.localStream=n,this.pc.addStream(n)},e.prototype.processIce=function(n){this.pc.addIceCandidate(new i.IceCandidate(n))},e.prototype.offer=function(n,t){var e=this,r=2===arguments.length,i=r?n:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},o=r?t:n;this.pc.createOffer(function(n){n.sdp=e._applySdpHack(n.sdp),e.pc.setLocalDescription(n),e.emit("offer",n),o&&o(null,n)},function(n){e.emit("error",n),o&&o(n)},i)},e.prototype.answerAudioOnly=function(n,t){var e={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!1}};this._answer(n,e,t)},e.prototype.answerBroadcastOnly=function(n,t){var e={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}};this._answer(n,e,t)},e.prototype.answer=function(n,t,e){var r=3===arguments.length,i=r?e:t,o=r?t:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};this._answer(n,o,i)},e.prototype.handleAnswer=function(n){this.pc.setRemoteDescription(new i.SessionDescription(n))},e.prototype.close=function(){this.pc.close(),this.emit("close")},e.prototype._answer=function(n,t,e){var r=this;this.pc.setRemoteDescription(new i.SessionDescription(n)),this.pc.createAnswer(function(n){n.sdp=r._applySdpHack(n.sdp),r.pc.setLocalDescription(n),r.emit("answer",n),e&&e(null,n)},function(n){r.emit("error",n),e&&e(n)},t)},e.prototype._onIce=function(n){n.candidate?this.emit("ice",n.candidate):this.emit("endOfCandidates")},e.prototype._onDataChannel=function(n){this.emit("addChannel",n.channel)},e.prototype._onAddStream=function(n){this.remoteStream=n.stream,this.emit("addStream",n)},e.prototype._applySdpHack=function(n){if(!this.config.sdpHack)return n;var t=n.split("b=AS:30");return 2===t.length?t[0]+"b=AS:102400"+t[1]:n},e.prototype.createDataChannel=function(n,t){t||(t={});var e,r,o=!!t.reliable,a=t.protocol||"text/plain",s=!(!t.negotiated&&!t.preset);return"moz"===i.prefix?(e=o?{protocol:a,preset:s,stream:n}:{},r=this.pc.createDataChannel(n,e),r.binaryType="blob"):(e=o?{reliable:!0}:{reliable:!1},r=this.pc.createDataChannel(n,e)),r},t.exports=e},{webrtcsupport:21,wildemitter:22}],16:[function(n,t,e){var r=n("./lib/tosdp"),i=n("./lib/tojson");e.toSessionSDP=r.toSessionSDP,e.toMediaSDP=r.toMediaSDP,e.toCandidateSDP=r.toCandidateSDP,e.toSessionJSON=i.toSessionJSON,e.toMediaJSON=i.toMediaJSON,e.toCandidateJSON=i.toCandidateJSON},{"./lib/tojson":18,"./lib/tosdp":19}],17:[function(n,t,e){e.lines=function(n){return n.split("\r\n").filter(function(n){return n.length>0})},e.findLine=function(n,t,e){for(var r=n.length,i=0;i<t.length;i++)if(t[i].substr(0,r)===n)return t[i];if(!e)return!1;for(var o=0;o<e.length;o++)if(e[o].substr(0,r)===n)return e[o];return!1},e.findLines=function(n,t,e){for(var r=[],i=n.length,o=0;o<t.length;o++)t[o].substr(0,i)===n&&r.push(t[o]);if(r.length||!e)return r;for(var a=0;a<e.length;a++)e[a].substr(0,i)===n&&r.push(e[a]);return r},e.mline=function(n){for(var t=n.substr(2).split(" "),e={media:t[0],port:t[1],proto:t[2],formats:[]},r=3;r<t.length;r++)t[r]&&e.formats.push(t[r]);return e},e.rtpmap=function(n){var t=n.substr(9).split(" "),e={id:t.shift()};return t=t[0].split("/"),e.name=t[0],e.clockrate=t[1],e.channels=3==t.length?t[2]:"1",e},e.fmtp=function(n){for(var t,e,r,i=n.substr(n.indexOf(" ")+1).split(";"),o=[],a=0;a<i.length;a++)t=i[a].split("="),e=t[0].trim(),r=t[1],e&&r?o.push({key:e,value:r}):e&&o.push({key:"",value:e});return o},e.crypto=function(n){var t=n.substr(9).split(" "),e={tag:t[0],cipherSuite:t[1],keyParams:t[2],sessionParams:t.slice(3).join(" ")};
return e},e.fingerprint=function(n){var t=n.substr(14).split(" ");return{hash:t[0],value:t[1]}},e.extmap=function(n){var t=n.substr(9).split(" "),e={},r=t.shift(),i=r.indexOf("/");return i>=0?(e.id=r.substr(0,i),e.senders=r.substr(i)):(e.id=r,e.senders="sendrecv"),e.uri=t.shift(),e},e.rtcpfb=function(n){var t=n.substr(10).split(" "),e={};return e.id=t.shift(),e.type=t.shift(),"trr-int"===e.type?e.value=t.shift():e.subtype=t.shift(),e.parameters=t,e},e.candidate=function(n){for(var t=n.substring(12).split(" "),e={foundation:t[0],component:t[1],protocol:t[2].toLowerCase(),priority:t[3],ip:t[4],port:t[5],type:t[7]},r=8;r<t.length;r+=2)"raddr"===t[r]?e.relAddr=t[r+1]:"rport"===t[r]?e.relPort=t[r+1]:"generation"===t[r]&&(e.generation=t[r+1]);return e.network="1",e},e.ssrc=function(n){for(var t,e,r=[],i={},o=0;o<n.length;o++){t=n[o].substr(7).split(" "),e=t.shift(),t=t.join(" ").split(":");var a=t.shift(),s=t.join(":")||null;i[e]||(i[e]={}),i[e][a]=s}for(e in i){var c=i[e];c.ssrc=e,r.push(c)}return r},e.grouping=function(n){for(var t,e=[],r=0;r<n.length;r++)t=n[r].substr(8).split(" "),e.push({semantics:t.shift(),contents:t});return e}},{}],18:[function(n,t,e){var r=n("./parsers"),i=Math.random();e.toSessionJSON=function(n,t){for(var i=n.split("\r\nm="),o=1;o<i.length;o++)i[o]="m="+i[o],o!==i.length-1&&(i[o]+="\r\n");var a=i.shift()+"\r\n",s=r.lines(a),c={},u=[];i.forEach(function(n){u.push(e.toMediaJSON(n,a,t))}),c.contents=u;var p=r.findLines("a=group:",s);return p.length&&(c.groupings=r.grouping(p)),c},e.toMediaJSON=function(n,t,i){var o=r.lines(n),a=r.lines(t),s=r.mline(o[0]),c={creator:i,name:s.media,description:{descType:"rtp",media:s.media,payloads:[],encryption:[],feedback:[],headerExtensions:[]},transport:{transType:"iceUdp",candidates:[],fingerprints:[]}},u=c.description,p=c.transport,f=r.findLine("a=ssrc:",o);f&&(u.ssrc=f.substr(7).split(" ")[0]);var l=r.findLine("a=mid:",o);l&&(c.name=l.substr(6)),r.findLine("a=sendrecv",o,a)?c.senders="both":r.findLine("a=sendonly",o,a)?c.senders="initiator":r.findLine("a=recvonly",o,a)?c.senders="responder":r.findLine("a=inactive",o,a)&&(c.senders="none");var d=r.findLines("a=rtpmap:",o);d.forEach(function(n){var t=r.rtpmap(n);t.feedback=[];var e=r.findLines("a=fmtp:"+t.id,o);e.forEach(function(n){t.parameters=r.fmtp(n)});var i=r.findLines("a=rtcp-fb:"+t.id,o);i.forEach(function(n){t.feedback.push(r.rtcpfb(n))}),u.payloads.push(t)});var h=r.findLines("a=crypto:",o,a);h.forEach(function(n){u.encryption.push(r.crypto(n))}),r.findLine("a=rtcp-mux",o)&&(u.mux=!0);var m=r.findLines("a=rtcp-fb:*",o);m.forEach(function(n){u.feedback.push(r.rtcpfb(n))});var g=r.findLines("a=extmap:",o);g.forEach(function(n){var t=r.extmap(n),e={sendonly:"responder",recvonly:"initiator",sendrecv:"both",inactive:"none"};t.senders=e[t.senders],u.headerExtensions.push(t)});var v=r.findLines("a=ssrc:",o);v.length&&(u.ssrcs=r.ssrc(v));var y=r.findLines("a=fingerprint:",o,a);y.forEach(function(n){p.fingerprints.push(r.fingerprint(n))});var w=r.findLine("a=ice-ufrag:",o,a),b=r.findLine("a=ice-pwd:",o,a);if(w&&b){p.ufrag=w.substr(12),p.pwd=b.substr(10),p.candidates=[];var S=r.findLines("a=candidate:",o,a);S.forEach(function(n){p.candidates.push(e.toCandidateJSON(n))})}return c},e.toCandidateJSON=function(n){var t=r.candidate(n.split("\r\n")[0]);return t.id=(i++).toString(36).substr(0,12),t}},{"./parsers":17}],19:[function(n,t,e){var r={initiator:"sendonly",responder:"recvonly",both:"sendrecv",none:"inactive",sendonly:"initator",recvonly:"responder",sendrecv:"both",inactive:"none"};e.toSessionSDP=function(n,t){var r=["v=0","o=- "+(t||n.sid||Date.now())+" "+Date.now()+" IN IP4 0.0.0.0","s=-","t=0 0"],i=n.groupings||[];i.forEach(function(n){r.push("a=group:"+n.semantics+" "+n.contents.join(" "))});var o=n.contents||[];return o.forEach(function(n){r.push(e.toMediaSDP(n))}),r.join("\r\n")+"\r\n"},e.toMediaSDP=function(n){var t=[],i=n.description,o=n.transport,a=i.payloads||[],s=o&&o.fingerprints||[],c=[i.media,"1"];i.encryption&&i.encryption.length>0||s.length>0?c.push("RTP/SAVPF"):c.push("RTP/AVPF"),a.forEach(function(n){c.push(n.id)}),t.push("m="+c.join(" ")),t.push("c=IN IP4 0.0.0.0"),t.push("a=rtcp:1 IN IP4 0.0.0.0"),o&&(o.ufrag&&t.push("a=ice-ufrag:"+o.ufrag),o.pwd&&t.push("a=ice-pwd:"+o.pwd),s.forEach(function(n){t.push("a=fingerprint:"+n.hash+" "+n.value)})),t.push("a="+(r[n.senders]||"sendrecv")),t.push("a=mid:"+n.name),i.mux&&t.push("a=rtcp-mux");var u=i.encryption||[];u.forEach(function(n){t.push("a=crypto:"+n.tag+" "+n.cipherSuite+" "+n.keyParams+" "+n.sessionParams)}),a.forEach(function(n){var e="a=rtpmap:"+n.id+" "+n.name+"/"+n.clockrate;if(n.channels&&"1"!=n.channels&&(e+="/"+n.channels),t.push(e),n.parameters&&n.parameters.length){var r=["a=fmtp:"+n.id];n.parameters.forEach(function(n){r.push((n.key?n.key+"=":"")+n.value)}),t.push(r.join(" "))}n.feedback&&n.feedback.forEach(function(e){"trr-int"===e.type?t.push("a=rtcp-fb:"+n.id+" trr-int "+e.value?e.value:"0"):t.push("a=rtcp-fb:"+n.id+" "+e.type+(e.subtype?" "+e.subtype:""))})}),i.feedback&&i.feedback.forEach(function(n){"trr-int"===n.type?t.push(n.value):t.push("a=rtcp-fb:* "+n.type+(n.subtype?" "+n.subtype:""))});var p=i.headerExtensions||[];p.forEach(function(n){t.push("a=extmap:"+n.id+(n.senders?"/"+r[n.senders]:"")+" "+n.uri)});var f=i.ssrcs||[];f.forEach(function(n){for(var e in n)"ssrc"!=e&&t.push("a=ssrc:"+n.ssrc+" "+e+(n[e]?":"+n[e]:""))});var l=o.candidates||[];return l.forEach(function(n){t.push(e.toCandidateSDP(n))}),t.join("\r\n")},e.toCandidateSDP=function(n){var t=[];t.push(n.foundation),t.push(n.component),t.push(n.protocol),t.push(n.priority),t.push(n.ip),t.push(n.port);var e=n.type;return t.push("typ"),t.push(e),("srflx"===e||"prflx"===e||"relay"===e)&&n.relAddr&&n.relPort&&(t.push("raddr"),t.push(n.relAddr),t.push("rport"),t.push(n.relPort)),t.push("generation"),t.push(n.generation||"0"),"a=candidate:"+t.join(" ")}},{}],20:[function(n,t,e){!function(){var n=this,r=n._,i={},o=Array.prototype,a=Object.prototype,s=Function.prototype,c=o.push,u=o.slice,p=o.concat,f=a.toString,l=a.hasOwnProperty,d=o.forEach,h=o.map,m=o.reduce,g=o.reduceRight,v=o.filter,y=o.every,w=o.some,b=o.indexOf,S=o.lastIndexOf,x=Array.isArray,k=Object.keys,C=s.bind,j=function(n){return n instanceof j?n:this instanceof j?(this._wrapped=n,void 0):new j(n)};"undefined"!=typeof e?("undefined"!=typeof t&&t.exports&&(e=t.exports=j),e._=j):n._=j,j.VERSION="1.5.2";var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(d&&n.forEach===d)n.forEach(t,e);else if(n.length===+n.length){for(var r=0,o=n.length;o>r;r++)if(t.call(e,n[r],r,n)===i)return}else for(var a=j.keys(n),r=0,o=a.length;o>r;r++)if(t.call(e,n[a[r]],a[r],n)===i)return};j.map=j.collect=function(n,t,e){var r=[];return null==n?r:h&&n.map===h?n.map(t,e):(A(n,function(n,i,o){r.push(t.call(e,n,i,o))}),r)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,e,r){var i=arguments.length>2;if(null==n&&(n=[]),m&&n.reduce===m)return r&&(t=j.bind(t,r)),i?n.reduce(t,e):n.reduce(t);if(A(n,function(n,o,a){i?e=t.call(r,e,n,o,a):(e=n,i=!0)}),!i)throw new TypeError(E);return e},j.reduceRight=j.foldr=function(n,t,e,r){var i=arguments.length>2;if(null==n&&(n=[]),g&&n.reduceRight===g)return r&&(t=j.bind(t,r)),i?n.reduceRight(t,e):n.reduceRight(t);var o=n.length;if(o!==+o){var a=j.keys(n);o=a.length}if(A(n,function(s,c,u){c=a?a[--o]:--o,i?e=t.call(r,e,n[c],c,u):(e=n[c],i=!0)}),!i)throw new TypeError(E);return e},j.find=j.detect=function(n,t,e){var r;return T(n,function(n,i,o){return t.call(e,n,i,o)?(r=n,!0):void 0}),r},j.filter=j.select=function(n,t,e){var r=[];return null==n?r:v&&n.filter===v?n.filter(t,e):(A(n,function(n,i,o){t.call(e,n,i,o)&&r.push(n)}),r)},j.reject=function(n,t,e){return j.filter(n,function(n,r,i){return!t.call(e,n,r,i)},e)},j.every=j.all=function(n,t,e){t||(t=j.identity);var r=!0;return null==n?r:y&&n.every===y?n.every(t,e):(A(n,function(n,o,a){return(r=r&&t.call(e,n,o,a))?void 0:i}),!!r)};var T=j.some=j.any=function(n,t,e){t||(t=j.identity);var r=!1;return null==n?r:w&&n.some===w?n.some(t,e):(A(n,function(n,o,a){return r||(r=t.call(e,n,o,a))?i:void 0}),!!r)};j.contains=j.include=function(n,t){return null==n?!1:b&&n.indexOf===b?-1!=n.indexOf(t):T(n,function(n){return n===t})},j.invoke=function(n,t){var e=u.call(arguments,2),r=j.isFunction(t);return j.map(n,function(n){return(r?t:n[t]).apply(n,e)})},j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},j.where=function(n,t,e){return j.isEmpty(t)?e?void 0:[]:j[e?"find":"filter"](n,function(n){for(var e in t)if(t[e]!==n[e])return!1;return!0})},j.findWhere=function(n,t){return j.where(n,t,!0)},j.max=function(n,t,e){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;var r={computed:-1/0,value:-1/0};return A(n,function(n,i,o){var a=t?t.call(e,n,i,o):n;a>r.computed&&(r={value:n,computed:a})}),r.value},j.min=function(n,t,e){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var r={computed:1/0,value:1/0};return A(n,function(n,i,o){var a=t?t.call(e,n,i,o):n;a<r.computed&&(r={value:n,computed:a})}),r.value},j.shuffle=function(n){var t,e=0,r=[];return A(n,function(n){t=j.random(e++),r[e-1]=r[t],r[t]=n}),r},j.sample=function(n,t,e){return arguments.length<2||e?n[j.random(n.length-1)]:j.shuffle(n).slice(0,Math.max(0,t))};var O=function(n){return j.isFunction(n)?n:function(t){return t[n]}};j.sortBy=function(n,t,e){var r=O(t);return j.pluck(j.map(n,function(n,t,i){return{value:n,index:t,criteria:r.call(e,n,t,i)}}).sort(function(n,t){var e=n.criteria,r=t.criteria;if(e!==r){if(e>r||void 0===e)return 1;if(r>e||void 0===r)return-1}return n.index-t.index}),"value")};var I=function(n){return function(t,e,r){var i={},o=null==e?j.identity:O(e);return A(t,function(e,a){var s=o.call(r,e,a,t);n(i,s,e)}),i}};j.groupBy=I(function(n,t,e){(j.has(n,t)?n[t]:n[t]=[]).push(e)}),j.indexBy=I(function(n,t,e){n[t]=e}),j.countBy=I(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,e,r){e=null==e?j.identity:O(e);for(var i=e.call(r,t),o=0,a=n.length;a>o;){var s=o+a>>>1;e.call(r,n[s])<i?o=s+1:a=s}return o},j.toArray=function(n){return n?j.isArray(n)?u.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,e){return null==n?void 0:null==t||e?n[0]:u.call(n,0,t)},j.initial=function(n,t,e){return u.call(n,0,n.length-(null==t||e?1:t))},j.last=function(n,t,e){return null==n?void 0:null==t||e?n[n.length-1]:u.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,e){return u.call(n,null==t||e?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var _=function(n,t,e){return t&&j.every(n,j.isArray)?p.apply(e,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?c.apply(e,n):_(n,t,e):e.push(n)}),e)};j.flatten=function(n,t){return _(n,t,[])},j.without=function(n){return j.difference(n,u.call(arguments,1))},j.uniq=j.unique=function(n,t,e,r){j.isFunction(t)&&(r=e,e=t,t=!1);var i=e?j.map(n,e,r):n,o=[],a=[];return A(i,function(e,r){(t?r&&a[a.length-1]===e:j.contains(a,e))||(a.push(e),o.push(n[r]))}),o},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=u.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.indexOf(t,n)>=0})})},j.difference=function(n){var t=p.apply(o,u.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),e=0;n>e;e++)t[e]=j.pluck(arguments,""+e);return t},j.object=function(n,t){if(null==n)return{};for(var e={},r=0,i=n.length;i>r;r++)t?e[n[r]]=t[r]:e[n[r][0]]=n[r][1];return e},j.indexOf=function(n,t,e){if(null==n)return-1;var r=0,i=n.length;if(e){if("number"!=typeof e)return r=j.sortedIndex(n,t),n[r]===t?r:-1;r=0>e?Math.max(0,i+e):e}if(b&&n.indexOf===b)return n.indexOf(t,e);for(;i>r;r++)if(n[r]===t)return r;return-1},j.lastIndexOf=function(n,t,e){if(null==n)return-1;var r=null!=e;if(S&&n.lastIndexOf===S)return r?n.lastIndexOf(t,e):n.lastIndexOf(t);for(var i=r?e:n.length;i--;)if(n[i]===t)return i;return-1},j.range=function(n,t,e){arguments.length<=1&&(t=n||0,n=0),e=arguments[2]||1;for(var r=Math.max(Math.ceil((t-n)/e),0),i=0,o=new Array(r);r>i;)o[i++]=n,n+=e;return o};var D=function(){};j.bind=function(n,t){var e,r;if(C&&n.bind===C)return C.apply(n,u.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return e=u.call(arguments,2),r=function(){if(!(this instanceof r))return n.apply(t,e.concat(u.call(arguments)));D.prototype=n.prototype;var i=new D;D.prototype=null;var o=n.apply(i,e.concat(u.call(arguments)));return Object(o)===o?o:i}},j.partial=function(n){var t=u.call(arguments,1);return function(){return n.apply(this,t.concat(u.call(arguments)))}},j.bindAll=function(n){var t=u.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var e={};return t||(t=j.identity),function(){var r=t.apply(this,arguments);return j.has(e,r)?e[r]:e[r]=n.apply(this,arguments)}},j.delay=function(n,t){var e=u.call(arguments,2);return setTimeout(function(){return n.apply(null,e)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(u.call(arguments,1)))},j.throttle=function(n,t,e){var r,i,o,a=null,s=0;e||(e={});var c=function(){s=e.leading===!1?0:new Date,a=null,o=n.apply(r,i)};return function(){var u=new Date;s||e.leading!==!1||(s=u);var p=t-(u-s);return r=this,i=arguments,0>=p?(clearTimeout(a),a=null,s=u,o=n.apply(r,i)):a||e.trailing===!1||(a=setTimeout(c,p)),o}},j.debounce=function(n,t,e){var r,i,o,a,s;return function(){o=this,i=arguments,a=new Date;var c=function(){var u=new Date-a;t>u?r=setTimeout(c,t-u):(r=null,e||(s=n.apply(o,i)))},u=e&&!r;return r||(r=setTimeout(c,t)),u&&(s=n.apply(o,i)),s}},j.once=function(n){var t,e=!1;return function(){return e?t:(e=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return function(){var e=[n];return c.apply(e,arguments),t.apply(this,e)}},j.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length-1;e>=0;e--)t=[n[e].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=k||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var e in n)j.has(n,e)&&t.push(e);return t},j.values=function(n){for(var t=j.keys(n),e=t.length,r=new Array(e),i=0;e>i;i++)r[i]=n[t[i]];return r},j.pairs=function(n){for(var t=j.keys(n),e=t.length,r=new Array(e),i=0;e>i;i++)r[i]=[t[i],n[t[i]]];return r},j.invert=function(n){for(var t={},e=j.keys(n),r=0,i=e.length;i>r;r++)t[n[e[r]]]=e[r];return t},j.functions=j.methods=function(n){var t=[];for(var e in n)j.isFunction(n[e])&&t.push(e);return t.sort()},j.extend=function(n){return A(u.call(arguments,1),function(t){if(t)for(var e in t)n[e]=t[e]}),n},j.pick=function(n){var t={},e=p.apply(o,u.call(arguments,1));return A(e,function(e){e in n&&(t[e]=n[e])}),t},j.omit=function(n){var t={},e=p.apply(o,u.call(arguments,1));for(var r in n)j.contains(e,r)||(t[r]=n[r]);return t},j.defaults=function(n){return A(u.call(arguments,1),function(t){if(t)for(var e in t)void 0===n[e]&&(n[e]=t[e])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var R=function(n,t,e,r){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var i=f.call(n);if(i!=f.call(t))return!1;switch(i){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var o=e.length;o--;)if(e[o]==n)return r[o]==t;var a=n.constructor,s=t.constructor;if(a!==s&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(s)&&s instanceof s))return!1;e.push(n),r.push(t);var c=0,u=!0;if("[object Array]"==i){if(c=n.length,u=c==t.length)for(;c--&&(u=R(n[c],t[c],e,r)););}else{for(var p in n)if(j.has(n,p)&&(c++,!(u=j.has(t,p)&&R(n[p],t[p],e,r))))break;if(u){for(p in t)if(j.has(t,p)&&!c--)break;u=!c}}return e.pop(),r.pop(),u};j.isEqual=function(n,t){return R(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==f.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return f.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==f.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return void 0===n},j.has=function(n,t){return l.call(n,t)},j.noConflict=function(){return n._=r,this},j.identity=function(n){return n},j.times=function(n,t,e){for(var r=Array(Math.max(0,n)),i=0;n>i;i++)r[i]=t.call(e,i);return r},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var M={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};M.unescape=j.invert(M.escape);var P={escape:new RegExp("["+j.keys(M.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(M.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(P[n],function(t){return M[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var e=n[t];return j.isFunction(e)?e.call(n):e},j.mixin=function(n){A(j.functions(n),function(t){var e=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return c.apply(n,arguments),q.call(this,e.apply(j,n))}})};var L=0;j.uniqueId=function(n){var t=++L+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,F={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},J=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,e){var r;e=j.defaults({},e,j.templateSettings);var i=new RegExp([(e.escape||N).source,(e.interpolate||N).source,(e.evaluate||N).source].join("|")+"|$","g"),o=0,a="__p+='";n.replace(i,function(t,e,r,i,s){return a+=n.slice(o,s).replace(J,function(n){return"\\"+F[n]}),e&&(a+="'+\n((__t=("+e+"))==null?'':_.escape(__t))+\n'"),r&&(a+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(a+="';\n"+i+"\n__p+='"),o=s+t.length,t}),a+="';\n",e.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{r=new Function(e.variable||"obj","_",a)}catch(s){throw s.source=a,s}if(t)return r(t,j);var c=function(n){return r.call(this,n,j)};return c.source="function("+(e.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var q=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=o[n];j.prototype[n]=function(){var e=this._wrapped;return t.apply(e,arguments),"shift"!=n&&"splice"!=n||0!==e.length||delete e[0],q.call(this,e)}}),A(["concat","join","slice"],function(n){var t=o[n];j.prototype[n]=function(){return q.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this)},{}],21:[function(n,t){var e,r=!1,i=!1,o=navigator.userAgent.toLowerCase();-1!==o.indexOf("firefox")?(e="moz",i=!0):-1!==o.indexOf("chrome")&&(e="webkit",r=!0);var a=window.mozRTCPeerConnection||window.webkitRTCPeerConnection,s=window.mozRTCIceCandidate||window.RTCIceCandidate,c=window.mozRTCSessionDescription||window.RTCSessionDescription,u=window.webkitMediaStream||window.MediaStream,p=navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,f=window.webkitAudioContext||window.AudioContext;t.exports={support:!!a,dataChannel:r||i||a.prototype&&a.prototype.createDataChannel,prefix:e,webAudio:!(!f||!f.prototype.createMediaStreamSource),mediaStream:!(!u||!u.prototype.removeTrack),screenSharing:!!p,AudioContext:f,PeerConnection:a,SessionDescription:c,IceCandidate:s}},{}],22:[function(n,t){function e(){this.callbacks={}}t.exports=e,e.prototype.on=function(n){var t=3===arguments.length,e=t?arguments[1]:void 0,r=t?arguments[2]:arguments[1];return r._groupName=e,(this.callbacks[n]=this.callbacks[n]||[]).push(r),this},e.prototype.once=function(n){function t(){e.off(n,t),o.apply(this,arguments)}var e=this,r=3===arguments.length,i=r?arguments[1]:void 0,o=r?arguments[2]:arguments[1];return this.on(n,i,t),this},e.prototype.releaseGroup=function(n){var t,e,r,i;for(t in this.callbacks)for(i=this.callbacks[t],e=0,r=i.length;r>e;e++)i[e]._groupName===n&&(i.splice(e,1),e--,r--);return this},e.prototype.off=function(n,t){var e,r=this.callbacks[n];return r?1===arguments.length?(delete this.callbacks[n],this):(e=r.indexOf(t),r.splice(e,1),this):this},e.prototype.emit=function(n){var t,e,r=[].slice.call(arguments,1),i=this.callbacks[n],o=this.getWildcardCallbacks(n);if(i)for(t=0,e=i.length;e>t&&i[t];++t)i[t].apply(this,r);if(o)for(t=0,e=o.length;e>t&&o[t];++t)o[t].apply(this,[n].concat(r));return this},e.prototype.getWildcardCallbacks=function(n){var t,e,r=[];for(t in this.callbacks)e=t.split("*"),("*"===t||2===e.length&&n.slice(0,e[1].length)===e[1])&&(r=r.concat(this.callbacks[t]));return r}},{}]},{},[1])(1)});
!function(n){if("function"==typeof bootstrap)bootstrap("jingle",n);else if("object"==typeof exports)module.exports=n();else if("function"==typeof define&&define.amd)define(n);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeJingle=n}else"undefined"!=typeof window?window.Jingle=n():global.Jingle=n()}(function(){var n;return function(n,t,e){function r(e,o){if(!t[e]){if(!n[e]){var a="function"==typeof require&&require;if(!o&&a)return a(e,!0);if(i)return i(e,!0);throw new Error("Cannot find module '"+e+"'")}var s=t[e]={exports:{}};n[e][0].call(s.exports,function(t){var i=n[e][1][t];return r(i?i:t)},s,s.exports)}return t[e].exports}for(var i="function"==typeof require&&require,o=0;o<e.length;o++)r(e[o]);return r}({1:[function(n,t){t.exports=n("./lib/sessionManager")},{"./lib/sessionManager":4}],2:[function(n,t){function e(n){var t=n.split("-");return"on"+t[0][0].toUpperCase()+t[0].substr(1)+t[1][0].toUpperCase()+t[1].substr(1)}function r(n){var t=this;this.sid=n.sid||Date.now().toString(),this.peer=n.peer,this.isInitiator=n.initiator||!1,this.state="starting",this.parent=n.parent,this.processingQueue=o.queue(function(n,e){var r=n.action,i=n.changes,o=n.cb;s(this.sid+": "+r),t[r](i,function(n){o(n),e()})})}var i=n("bows"),o=n("async"),a=n("wildemitter");n("jingle-rtcpeerconnection"),n("sdp-jingle-json");var s=i("JingleSession");r.prototype=Object.create(a.prototype,{constructor:{value:r}}),r.prototype.process=function(n,t,r){var i=e(n);this.processingQueue.push({action:i,changes:t,cb:r})},r.prototype.send=function(n,t){t=t||{},t.sid=this.sid,t.action=n,this.parent.emit("send",{to:this.peer,type:"set",jingle:t})},Object.defineProperty(r.prototype,"state",{get:function(){return this._state},set:function(n){var t={starting:!0,pending:!0,active:!0,ended:!0};if(!t[n])throw new Error("Invalid Jingle Session State: "+n);this._state!==n&&(this._state=n,s(this.sid+": State changed to "+n))}}),Object.defineProperty(r.prototype,"starting",{get:function(){return"starting"==this._state}}),Object.defineProperty(r.prototype,"pending",{get:function(){return"pending"==this._state}}),Object.defineProperty(r.prototype,"active",{get:function(){return"active"==this._state}}),Object.defineProperty(r.prototype,"ended",{get:function(){return"ended"==this._state}}),r.prototype.start=function(){this.state="pending",s(this.sid+": Can not start generic session")},r.prototype.end=function(n){this.parent.peers[this.peer].splice(this.parent.peers[this.peer].indexOf(this),1),delete this.parent.sessions[this.sid],this.state="ended",n||this.send("session-terminate")};var c=["content-accept","content-add","content-modify","conent-reject","content-remove","description-info","session-accept","session-info","session-initiate","session-terminate","transport-accept","transport-info","transport-reject","transport-replace"];c.forEach(function(n){var t=e(n);r.prototype[t]=function(t,e){s(this.sid+": Unsupported action "+n),e()}}),t.exports=r},{async:5,bows:6,"jingle-rtcpeerconnection":11,"sdp-jingle-json":16,wildemitter:22}],3:[function(n,t){function e(n){o.call(this,n),this.pc=new a(this.parent.config.peerConnectionConfig,this.parent.config.peerConnectionConstraints),this.pc.on("ice",this.onIceCandidate.bind(this)),this.pc.on("addStream",this.onStreamAdded.bind(this)),this.pc.on("removeStream",this.onStreamRemoved.bind(this)),this.pendingAnswer=null,this.pc.addStream(this.parent.localStream),this.stream=null}var r=n("underscore"),i=n("bows"),o=n("./genericSession"),a=n("jingle-rtcpeerconnection"),s=i("JingleMedia");e.prototype=Object.create(o.prototype,{constructor:{value:e}}),e.prototype=r.extend(e.prototype,{start:function(){var n=this;this.state="pending",this.pc.isInitiator=!0,this.pc.offer(function(t,e){n.send("session-initiate",e.json)})},end:function(){this.pc.close(),this.onStreamRemoved(),o.prototype.end.call(this)},accept:function(){s(this.sid+": Accepted incoming session"),this.send("session-accept",this.pendingAnswer)},ring:function(){s(this.sid+": Ringing on incoming session"),this.send("session-info",{ringing:!0})},mute:function(n,t){s(this.sid+": Muting"),this.send("session-info",{mute:{creator:n,name:t}})},unmute:function(n,t){s(this.sid+": Unmuting"),this.send("session-info",{unmute:{creator:n,name:t}})},hold:function(){s(this.sid+": Placing on hold"),this.send("session-info",{hold:!0})},resume:function(){s(this.sid+": Resuing from hold"),this.send("session-info",{active:!0})},onSessionInitiate:function(n,t){s(this.sid+": Initiating incoming session");var e=this;this.state="pending",this.pc.isInitiator=!1,this.pc.answer({type:"offer",json:n},function(n,r){return n?(s(e.sid+": Could not create WebRTC answer",n),t({condition:"general-error"})):(e.pendingAnswer=r.json,t(),void 0)})},onSessionAccept:function(n,t){var e=this;s(this.sid+": Activating accepted outbound session"),this.state="active",this.pc.handleAnswer({type:"answer",json:n},function(n){s(e.sid+": Could not process WebRTC answer",n),t({condition:"general-error"})})},onSessionTerminate:function(n,t){s(this.sid+": Terminating session"),this.pc.close(),this.onStreamRemoved(),o.prototype.end.call(this,!0),t()},onTransportInfo:function(n,t){var e=this;s(this.sid+": Adding ICE candidate"),this.pc.processIce(n,function(n){n&&s(e.sid+": Could not process ICE candidate",n),t()})},onIceCandidate:function(n){s(this.sid+": Discovered new ICE candidate",n),this.send("transport-info",n)},onStreamAdded:function(n){this.stream?s(this.sid+": Received remote stream, but one already exists"):(s(this.sid+": Remote media stream added"),this.stream=n.stream,this.parent.emit("peerStreamAdded",this))},onStreamRemoved:function(){s(this.sid+": Remote media stream removed"),this.parent.emit("peerStreamRemoved",this)}}),t.exports=e},{"./genericSession":2,bows:6,"jingle-rtcpeerconnection":11,underscore:20}],4:[function(n,t){function e(n){n=n||{};var t=this.config={debug:!1,peerConnectionConfig:{iceServers:[{url:"stun:stun.l.google.com:19302"}]},peerConnectionConstraints:{optional:[{DtlsSrtpKeyAgreement:!0},{RtpDataChannels:!1}]},autoAdjustMic:!1,media:{audio:!0,video:!0}};this.MediaSession=f,this.jid=n.jid,this.sessions={},this.peers={},this.screenSharingSupport=a.screenSharing;for(var e in n)t[e]=n[e];this.capabilities=["urn:xmpp:jingle:1"],a.support?this.capabilities=["urn:xmpp:jingle:1","urn:xmpp:jingle:apps:rtp:1","urn:xmpp:jingle:apps:rtp:audio","urn:xmpp:jingle:apps:rtp:video","urn:xmpp:jingle:apps:rtp:rtcb-fb:0","urn:xmpp:jingle:apps:dtls:0","urn:xmpp:jingle:transports:ice-udp:1","urn:ietf:rfc:3264"]:l("WebRTC not supported"),c.call(this),this.config.debug&&this.on("*",function(n,t,e){l(n,t,e)})}var r=n("underscore"),i=n("bows"),o=n("hark"),a=n("webrtcsupport");n("mockconsole");var s=n("getusermedia");n("jingle-rtcpeerconnection");var c=n("wildemitter"),u=n("mediastream-gain"),p=n("./genericSession"),f=n("./mediaSession"),l=i("Jingle");e.prototype=Object.create(c.prototype,{constructor:{value:e}}),e.prototype.startLocalMedia=function(n,t){var e=this,r=n||{video:!0,audio:!0};s(r,function(n,i){n?l("Could not start local media"):(r.audio&&e.config.detectSpeakingEvents&&e.setupAudioMonitor(i),e.localStream=i,e.config.autoAdjustMic&&(e.gainController=new u(i),e.setMicIfEnabled(.5)),l("Local media stream started"),e.emit("localStream",i)),t&&t(n,i)})},e.prototype.stopLocalMedia=function(){this.localStream&&(this.localStream.stop(),this.emit("localStreamStopped"))},e.prototype.setupAudioMonitor=function(n){l("Setup audio");var t,e=o(n),r=this;e.on("speaking",function(){r.hardMuted||(r.setMicIfEnabled(1),r.emit("speaking"))}),e.on("stopped_speaking",function(){r.hardMuted||(t&&clearTimeout(t),t=setTimeout(function(){r.setMicIfEnabled(.5),r.emit("stoppedSpeaking")},1e3))})},e.prototype.setMicIfEnabled=function(n){this.config.autoAdjustMic&&this.gainController.setGain(n)},e.prototype.sendError=function(n,t,e){e.type="cancel",this.emit("send",{to:n,id:t,type:"error",error:e})},e.prototype.process=function(n){var t=this;if("error"===n.type)return this.emit("error",n);if("result"!==n.type){var e,i,o,a=n.jingle.sid,s=n.jingle.action,c=n.jingle.contents||[],u=r.map(c,function(n){return(n.description||{}).descType}),d=this.sessions[a]||null,h=n.from.full||n.from,m=n.id;if("session-initiate"!==s){if(!d)return l("Unknown session",a),this.sendError(h,m,{condition:"item-not-found",jingleCondition:"unknown-session"});if(d.peer!==h||d.ended)return l("Session has ended, or action has wrong sender"),this.sendError(h,m,{condition:"item-not-found",jingleCondition:"unknown-session"});if("session-accept"===s&&!d.pending)return l("Tried to accept session twice",a),this.sendError(h,m,{condition:"unexpected-request",jingleCondition:"out-of-order"});if("session-terminate"!==s&&d.pendingAction&&(l("Tie break during pending request"),d.isInitiator))return this.sendError(h,m,{condition:"conflict",jingleCondition:"tie-break"})}else{if(d)return d.peer!==h?(l("Duplicate sid from new sender"),this.sendError(h,m,{condition:"service-unavailable"})):d.pending&&this.jid>d.peer?(l("Tie break new session because of duplicate sids"),this.sendError(h,m,{condition:"conflict",jingleCondition:"tie-break"})):(l("Someone is doing this wrong"),this.sendError(h,m,{condition:"unexpected-request",jingleCondition:"out-of-order"}));if(Object.keys(this.peers[h]||{}).length){e=Object.keys(this.peers[h]);for(var g=0;g<e.length;g++)if(i=e[g],o=this.sessions[i],o&&o.pending&&r.intersection(u,o.contentTypes).length&&i>a)return l("Tie break"),this.sendError(h,m,{condition:"conflict",jingleCondition:"tie-break"})}}if("session-initiate"===s){var v={sid:a,peer:h,initiator:!1,parent:this};d=u.indexOf("rtp")>=0?new f(v):new p(v),this.sessions[a]=d,this.peers[h]||(this.peers[h]=[]),this.peers[h].push(d)}d.process(s,n.jingle,function(e){e?(l("Could not process request",n,e),t.sendError(h,m,e)):(t.emit("send",{to:h,id:m,type:"result"}),"session-initiate"===s&&(l("Incoming session request from ",h,d),t.emit("incoming",d)))})}},e.prototype.createMediaSession=function(n,t){var e=new f({sid:t,peer:n,initiator:!0,parent:this});return t=e.sid,this.sessions[t]=e,this.peers[n]||(this.peers[n]=[]),this.peers[n].push(e),l("Outgoing session",e.sid,e),this.emit("outgoing",e),e},e.prototype.endPeerSessions=function(n){l("Ending all sessions with",n);var t=this.peers[n]||[];t.forEach(function(n){n.end()})},t.exports=e},{"./genericSession":2,"./mediaSession":3,bows:6,getusermedia:9,hark:10,"jingle-rtcpeerconnection":11,"mediastream-gain":12,mockconsole:14,underscore:20,webrtcsupport:21,wildemitter:22}],5:[function(t,e){var r=t("__browserify_process");!function(){function t(n){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,n.apply(i,arguments)}}var i,o,a={};i=this,null!=i&&(o=i.async),a.noConflict=function(){return i.async=o,a};var s=function(n,t){if(n.forEach)return n.forEach(t);for(var e=0;e<n.length;e+=1)t(n[e],e,n)},c=function(n,t){if(n.map)return n.map(t);var e=[];return s(n,function(n,r,i){e.push(t(n,r,i))}),e},u=function(n,t,e){return n.reduce?n.reduce(t,e):(s(n,function(n,r,i){e=t(e,n,r,i)}),e)},p=function(n){if(Object.keys)return Object.keys(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t};"undefined"!=typeof r&&r.nextTick?(a.nextTick=r.nextTick,a.setImmediate="undefined"!=typeof setImmediate?setImmediate:a.nextTick):"function"==typeof setImmediate?(a.nextTick=function(n){setImmediate(n)},a.setImmediate=a.nextTick):(a.nextTick=function(n){setTimeout(n,0)},a.setImmediate=a.nextTick),a.each=function(n,e,r){if(r=r||function(){},!n.length)return r();var i=0;s(n,function(o){e(o,t(function(t){t?(r(t),r=function(){}):(i+=1,i>=n.length&&r(null))}))})},a.forEach=a.each,a.eachSeries=function(n,t,e){if(e=e||function(){},!n.length)return e();var r=0,i=function(){t(n[r],function(t){t?(e(t),e=function(){}):(r+=1,r>=n.length?e(null):i())})};i()},a.forEachSeries=a.eachSeries,a.eachLimit=function(n,t,e,r){var i=f(t);i.apply(null,[n,e,r])},a.forEachLimit=a.eachLimit;var f=function(n){return function(t,e,r){if(r=r||function(){},!t.length||0>=n)return r();var i=0,o=0,a=0;!function s(){if(i>=t.length)return r();for(;n>a&&o<t.length;)o+=1,a+=1,e(t[o-1],function(n){n?(r(n),r=function(){}):(i+=1,a-=1,i>=t.length?r():s())})}()}},l=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[a.each].concat(t))}},d=function(n,t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[f(n)].concat(e))}},h=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[a.eachSeries].concat(t))}},m=function(n,t,e,r){var i=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e,r){i[n.index]=r,t(e)})},function(n){r(n,i)})};a.map=l(m),a.mapSeries=h(m),a.mapLimit=function(n,t,e,r){return g(t)(n,e,r)};var g=function(n){return d(n,m)};a.reduce=function(n,t,e,r){a.eachSeries(n,function(n,r){e(t,n,function(n,e){t=e,r(n)})},function(n){r(n,t)})},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(n,t,e,r){var i=c(n,function(n){return n}).reverse();a.reduce(i,t,e,r)},a.foldr=a.reduceRight;var v=function(n,t,e,r){var i=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e&&i.push(n),t()})},function(){r(c(i.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};a.filter=l(v),a.filterSeries=h(v),a.select=a.filter,a.selectSeries=a.filterSeries;var y=function(n,t,e,r){var i=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e||i.push(n),t()})},function(){r(c(i.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};a.reject=l(y),a.rejectSeries=h(y);var w=function(n,t,e,r){n(t,function(n,t){e(n,function(e){e?(r(n),r=function(){}):t()})},function(){r()})};a.detect=l(w),a.detectSeries=h(w),a.some=function(n,t,e){a.each(n,function(n,r){t(n,function(n){n&&(e(!0),e=function(){}),r()})},function(){e(!1)})},a.any=a.some,a.every=function(n,t,e){a.each(n,function(n,r){t(n,function(n){n||(e(!1),e=function(){}),r()})},function(){e(!0)})},a.all=a.every,a.sortBy=function(n,t,e){a.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){if(n)return e(n);var r=function(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0};e(null,c(t.sort(r),function(n){return n.value}))})},a.auto=function(n,t){t=t||function(){};var e=p(n);if(!e.length)return t(null);var r={},i=[],o=function(n){i.unshift(n)},c=function(n){for(var t=0;t<i.length;t+=1)if(i[t]===n)return i.splice(t,1),void 0},f=function(){s(i.slice(0),function(n){n()})};o(function(){p(r).length===e.length&&(t(null,r),t=function(){})}),s(e,function(e){var i=n[e]instanceof Function?[n[e]]:n[e],l=function(n){var i=Array.prototype.slice.call(arguments,1);if(i.length<=1&&(i=i[0]),n){var o={};s(p(r),function(n){o[n]=r[n]}),o[e]=i,t(n,o),t=function(){}}else r[e]=i,a.setImmediate(f)},d=i.slice(0,Math.abs(i.length-1))||[],h=function(){return u(d,function(n,t){return n&&r.hasOwnProperty(t)},!0)&&!r.hasOwnProperty(e)};if(h())i[i.length-1](l,r);else{var m=function(){h()&&(c(m),i[i.length-1](l,r))};o(m)}})},a.waterfall=function(n,t){if(t=t||function(){},n.constructor!==Array){var e=new Error("First argument to waterfall must be an array of functions");return t(e)}if(!n.length)return t();var r=function(n){return function(e){if(e)t.apply(null,arguments),t=function(){};else{var i=Array.prototype.slice.call(arguments,1),o=n.next();o?i.push(r(o)):i.push(t),a.setImmediate(function(){n.apply(null,i)})}}};r(a.iterator(n))()};var b=function(n,t,e){if(e=e||function(){},t.constructor===Array)n.map(t,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},e);else{var r={};n.each(p(t),function(n,e){t[n](function(t){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),r[n]=i,e(t)})},function(n){e(n,r)})}};a.parallel=function(n,t){b({map:a.map,each:a.each},n,t)},a.parallelLimit=function(n,t,e){b({map:g(t),each:f(t)},n,e)},a.series=function(n,t){if(t=t||function(){},n.constructor===Array)a.mapSeries(n,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},t);else{var e={};a.eachSeries(p(n),function(t,r){n[t](function(n){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),e[t]=i,r(n)})},function(n){t(n,e)})}},a.iterator=function(n){var t=function(e){var r=function(){return n.length&&n[e].apply(null,arguments),r.next()};return r.next=function(){return e<n.length-1?t(e+1):null},r};return t(0)},a.apply=function(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t.concat(Array.prototype.slice.call(arguments)))}};var S=function(n,t,e,r){var i=[];n(t,function(n,t){e(n,function(n,e){i=i.concat(e||[]),t(n)})},function(n){r(n,i)})};a.concat=l(S),a.concatSeries=h(S),a.whilst=function(n,t,e){n()?t(function(r){return r?e(r):(a.whilst(n,t,e),void 0)}):e()},a.doWhilst=function(n,t,e){n(function(r){return r?e(r):(t()?a.doWhilst(n,t,e):e(),void 0)})},a.until=function(n,t,e){n()?e():t(function(r){return r?e(r):(a.until(n,t,e),void 0)})},a.doUntil=function(n,t,e){n(function(r){return r?e(r):(t()?e():a.doUntil(n,t,e),void 0)})},a.queue=function(n,e){function r(n,t,r,i){t.constructor!==Array&&(t=[t]),s(t,function(t){var o={data:t,callback:"function"==typeof i?i:null};r?n.tasks.unshift(o):n.tasks.push(o),n.saturated&&n.tasks.length===e&&n.saturated(),a.setImmediate(n.process)})}void 0===e&&(e=1);var i=0,o={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,push:function(n,t){r(o,n,!1,t)},unshift:function(n,t){r(o,n,!0,t)},process:function(){if(i<o.concurrency&&o.tasks.length){var e=o.tasks.shift();o.empty&&0===o.tasks.length&&o.empty(),i+=1;var r=function(){i-=1,e.callback&&e.callback.apply(e,arguments),o.drain&&0===o.tasks.length+i&&o.drain(),o.process()},a=t(r);n(e.data,a)}},length:function(){return o.tasks.length},running:function(){return i}};return o},a.cargo=function(n,t){var e=!1,r=[],i={tasks:r,payload:t,saturated:null,empty:null,drain:null,push:function(n,e){n.constructor!==Array&&(n=[n]),s(n,function(n){r.push({data:n,callback:"function"==typeof e?e:null}),i.saturated&&r.length===t&&i.saturated()}),a.setImmediate(i.process)},process:function o(){if(!e){if(0===r.length)return i.drain&&i.drain(),void 0;var a="number"==typeof t?r.splice(0,t):r.splice(0),u=c(a,function(n){return n.data});i.empty&&i.empty(),e=!0,n(u,function(){e=!1;var n=arguments;s(a,function(t){t.callback&&t.callback.apply(null,n)}),o()})}},length:function(){return r.length},running:function(){return e}};return i};var x=function(n){return function(t){var e=Array.prototype.slice.call(arguments,1);t.apply(null,e.concat([function(t){var e=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(t?console.error&&console.error(t):console[n]&&s(e,function(t){console[n](t)}))}]))}};a.log=x("log"),a.dir=x("dir"),a.memoize=function(n,t){var e={},r={};t=t||function(n){return n};var i=function(){var i=Array.prototype.slice.call(arguments),o=i.pop(),a=t.apply(null,i);a in e?o.apply(null,e[a]):a in r?r[a].push(o):(r[a]=[o],n.apply(null,i.concat([function(){e[a]=arguments;var n=r[a];delete r[a];for(var t=0,i=n.length;i>t;t++)n[t].apply(null,arguments)}])))};return i.memo=e,i.unmemoized=n,i},a.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},a.times=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return a.map(r,t,e)},a.timesSeries=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return a.mapSeries(r,t,e)},a.compose=function(){var n=Array.prototype.reverse.call(arguments);return function(){var t=this,e=Array.prototype.slice.call(arguments),r=e.pop();a.reduce(n,e,function(n,e,r){e.apply(t,n.concat([function(){var n=arguments[0],t=Array.prototype.slice.call(arguments,1);r(n,t)}]))},function(n,e){r.apply(t,[n].concat(e))})}};var k=function(n,t){var e=function(){var e=this,r=Array.prototype.slice.call(arguments),i=r.pop();return n(t,function(n,t){n.apply(e,r.concat([t]))},i)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return e.apply(this,r)}return e};a.applyEach=l(k),a.applyEachSeries=h(k),a.forever=function(n,t){function e(r){if(r){if(t)return t(r);throw r}n(e)}e()},"undefined"!=typeof n&&n.amd?n([],function(){return a}):"undefined"!=typeof e&&e.exports?e.exports=a:i.async=a}()},{__browserify_process:8}],6:[function(n,t){!function(){var e,r,i,o="undefined"==typeof window,a=!o&&window.localStorage,s=a.debug,c=n("andlog"),u=.618033988749895,p=0,f=15,l=function(){};e=function(){return p+=u,p%=1,360*p};var i=s&&"/"===s[0]&&new RegExp(s.substring(1,s.length-1));r=function(n){var t;return t="%c"+n.slice(0,f),t+=Array(f+3-t.length).join(" ")+"|",i&&!n.match(i)?l:window.chrome?c.log.bind(c,t,"color: hsl("+e()+",99%,40%); font-weight: bold"):c.log.bind(c,t)},r.config=function(n){return n.padLength?f=n.padLength:void 0},"undefined"!=typeof t?t.exports=r:window.bows=r}.call()},{andlog:7}],7:[function(n,t,e){!function(){var n="undefined"==typeof window,r=!n&&window.localStorage,i={};if(n)return t.exports=console,void 0;if(r&&r.debug&&window.console)i=window.console;else for(var o="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a=o.length,s=function(){};a--;)i[o[a]]=s;"undefined"!=typeof e?t.exports=i:window.console=i}()},{}],8:[function(n,t){var e=t.exports={};e.nextTick=function(){var n="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(n)return function(n){return window.setImmediate(n)};if(t){var e=[];return window.addEventListener("message",function(n){if(n.source===window&&"process-tick"===n.data&&(n.stopPropagation(),e.length>0)){var t=e.shift();t()}},!0),function(n){e.push(n),window.postMessage("process-tick","*")}}return function(n){setTimeout(n,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.binding=function(){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(){throw new Error("process.chdir is not supported")}},{}],9:[function(n,t){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;t.exports=function(n,t){var r,i=2===arguments.length,o={video:!0,audio:!0},a="PERMISSION_DENIED",s="CONSTRAINT_NOT_SATISFIED";return i||(t=n,n=o),e?(e.call(navigator,n,function(n){t(null,n)},function(n){var e;"string"==typeof n?(e=new Error("NavigatorUserMediaError"),e.name=n===a?a:s):(e=n,e.name||(n.name=e[a]?a:s)),t(e)}),void 0):(r=new Error("NavigatorUserMediaError"),r.name="NOT_SUPPORTED_ERROR",t(r))}},{}],10:[function(n,t){function e(n,t){var e=-1/0;n.getFloatFrequencyData(t);for(var r=0,i=t.length;i>r;r++)t[r]>e&&t[r]<0&&(e=t[r]);return e}var r=n("wildemitter");t.exports=function(n,t){var i=new r;if(!window.webkitAudioContext)return i;var o,a,s,t=t||{},c=t.smoothing||.5,u=t.interval||100,p=t.threshold,f=t.play,l=new webkitAudioContext;s=l.createAnalyser(),s.fftSize=512,s.smoothingTimeConstant=c,a=new Float32Array(s.fftSize),n.jquery&&(n=n[0]),n instanceof HTMLAudioElement?(o=l.createMediaElementSource(n),"undefined"==typeof f&&(f=!0),p=p||-65):(o=l.createMediaStreamSource(n),p=p||-45),o.connect(s),f&&s.connect(l.destination),i.speaking=!1,i.setThreshold=function(n){p=n},i.setInterval=function(n){u=n};var d=function(){setTimeout(function(){var n=e(s,a);i.emit("volume_change",n,p),n>p?i.speaking||(i.speaking=!0,i.emit("speaking")):i.speaking&&(i.speaking=!1,i.emit("stopped_speaking")),d()},u)};return d(),i}},{wildemitter:22}],11:[function(n,t){function e(n,t){this.sid="",this.sdpSessId=Date.now(),this.isInitiator=!0,this.localDescription={contents:[]},this.remoteDescription={contents:[]},o.call(this,n,t)}var r=n("underscore"),i=n("webrtcsupport"),o=n("rtcpeerconnection"),a=n("sdp-jingle-json");e.prototype=Object.create(o.prototype,{constructor:{value:e}}),e.prototype.offer=function(n,t){var e=this,r=2===arguments.length,i=r?n:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},o=r?t:n;this.pc.createOffer(function(n){n.sdp=e._applySdpHack(n.sdp),e.pc.setLocalDescription(n);var t=a.toSessionJSON(n.sdp,e.isInitiator?"initiator":"responder");t.sid=this.sid,e.localDescription=t;var r={type:"offer",sdp:n.sdp,json:t};e.emit("offer",r),o&&o(null,r)},function(n){e.emit("error",n),o&&o(n)},i)},o.prototype.handleAnswer=function(n,t){t=t||function(){};var e=this;n.sdp=a.toSessionSDP(n.json,this.sdpSessId),e.remoteDescription=n.json,this.pc.setRemoteDescription(new i.SessionDescription(n),function(){t(null)},function(n){t(n)})},e.prototype._answer=function(n,t,e){e=e||function(){};var r=this;n.sdp=a.toSessionSDP(n.json,r.sdpSessId),r.remoteDescription=n.json,this.pc.setRemoteDescription(new i.SessionDescription(n),function(){r.pc.createAnswer(function(n){n.sdp=r._applySdpHack(n.sdp),r.pc.setLocalDescription(n);var t=a.toSessionJSON(n.sdp);t.sid=r.sid,r.localDescription=t;var i={type:"answer",sdp:n.sdp,json:t};r.emit("answer",i),e&&e(null,i)},function(n){r.emit("error",n),e&&e(n)},t)},function(n){e(n)})},e.prototype.processIce=function(n,t){t=t||function(){};var e=this,o=r.map(this.remoteDescription.contents,function(n){return n.name}),s=n.contents||[];s.forEach(function(n){var t=n.transport||{},r=t.candidates||[],s=o.indexOf(n.name),c=n.name;r.forEach(function(n){var t=a.toCandidateSDP(n)+"\r\n",r={candidate:t,sdpMLineIndex:s,sdpMid:c};e.pc.addIceCandidate(new i.IceCandidate(r))})}),t()},e.prototype._onIce=function(n){var t=this;if(n.candidate){var e=n.candidate;this.emit("ice",{contents:[{name:e.sdpMid,creator:t.isInitiator?"initiator":"responder",transport:{transType:"iceUdp",candidates:[a.toCandidateJSON(e.candidate)]}}]})}else this.emit("endOfCandidates")},t.exports=e},{rtcpeerconnection:15,"sdp-jingle-json":16,underscore:20,webrtcsupport:21}],12:[function(n,t){function e(n){if(this.support=r.webAudio&&r.mediaStream,this.gain=1,this.support){var t=this.context=new r.AudioContext;this.microphone=t.createMediaStreamSource(n),this.gainFilter=t.createGain(),this.destination=t.createMediaStreamDestination(),this.outputStream=this.destination.stream,this.microphone.connect(this.gainFilter),this.gainFilter.connect(this.destination),n.removeTrack(n.getAudioTracks()[0]),n.addTrack(this.outputStream.getAudioTracks()[0])}this.stream=n}var r=n("webrtcsupport");e.prototype.setGain=function(n){this.support&&(this.gainFilter.gain.value=n,this.gain=n)},e.prototype.getGain=function(){return this.gain},e.prototype.off=function(){return this.setGain(0)},e.prototype.on=function(){this.setGain(1)},t.exports=e},{webrtcsupport:13}],13:[function(n,t){var e=window.mozRTCPeerConnection||window.webkitRTCPeerConnection||window.RTCPeerConnection,r=window.mozRTCIceCandidate||window.RTCIceCandidate,i=window.mozRTCSessionDescription||window.RTCSessionDescription,o=function(){return window.mozRTCPeerConnection?"moz":window.webkitRTCPeerConnection?"webkit":void 0}(),a=window.webkitMediaStream||window.MediaStream,s=navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,c=window.webkitAudioContext||window.AudioContext;t.exports={support:!!e,dataChannel:!!(e&&e.prototype&&e.prototype.createDataChannel),prefix:o,webAudio:!(!c||!c.prototype.createMediaStreamSource),mediaStream:!(!a||!a.prototype.removeTrack),screenSharing:s,AudioContext:c,PeerConnection:e,SessionDescription:i,IceCandidate:r}},{}],14:[function(n,t){for(var e="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),r=e.length,i=function(){},o={};r--;)o[e[r]]=i;t.exports=o},{}],15:[function(n,t){function e(n,t){var e;this.pc=new i.PeerConnection(n,t),r.call(this),this.pc.onremovestream=this.emit.bind(this,"removeStream"),this.pc.onnegotiationneeded=this.emit.bind(this,"negotiationNeeded"),this.pc.oniceconnectionstatechange=this.emit.bind(this,"iceConnectionStateChange"),this.pc.onsignalingstatechange=this.emit.bind(this,"signalingStateChange"),this.pc.onaddstream=this._onAddStream.bind(this),this.pc.onicecandidate=this._onIce.bind(this),this.pc.ondatachannel=this._onDataChannel.bind(this),this.config={debug:!1,sdpHack:!0};for(e in n)this.config[e]=n[e];this.config.debug&&this.on("*",function(){var t=n.logger||console;t.log("PeerConnection event:",arguments)})}var r=n("wildemitter"),i=n("webrtcsupport");e.prototype=Object.create(r.prototype,{constructor:{value:e}}),e.prototype.addStream=function(n){this.localStream=n,this.pc.addStream(n)},e.prototype.processIce=function(n){this.pc.addIceCandidate(new i.IceCandidate(n))},e.prototype.offer=function(n,t){var e=this,r=2===arguments.length,i=r?n:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},o=r?t:n;this.pc.createOffer(function(n){n.sdp=e._applySdpHack(n.sdp),e.pc.setLocalDescription(n),e.emit("offer",n),o&&o(null,n)},function(n){e.emit("error",n),o&&o(n)},i)},e.prototype.answerAudioOnly=function(n,t){var e={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!1}};this._answer(n,e,t)},e.prototype.answerBroadcastOnly=function(n,t){var e={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}};this._answer(n,e,t)},e.prototype.answer=function(n,t,e){var r=3===arguments.length,i=r?e:t,o=r?t:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};this._answer(n,o,i)},e.prototype.handleAnswer=function(n){this.pc.setRemoteDescription(new i.SessionDescription(n))},e.prototype.close=function(){this.pc.close(),this.emit("close")},e.prototype._answer=function(n,t,e){var r=this;this.pc.setRemoteDescription(new i.SessionDescription(n)),this.pc.createAnswer(function(n){n.sdp=r._applySdpHack(n.sdp),r.pc.setLocalDescription(n),r.emit("answer",n),e&&e(null,n)},function(n){r.emit("error",n),e&&e(n)},t)},e.prototype._onIce=function(n){n.candidate?this.emit("ice",n.candidate):this.emit("endOfCandidates")},e.prototype._onDataChannel=function(n){this.emit("addChannel",n.channel)},e.prototype._onAddStream=function(n){this.remoteStream=n.stream,this.emit("addStream",n)},e.prototype._applySdpHack=function(n){if(!this.config.sdpHack)return n;var t=n.split("b=AS:30");return 2===t.length?t[0]+"b=AS:102400"+t[1]:n},e.prototype.createDataChannel=function(n,t){t||(t={});var e,r,o=!!t.reliable,a=t.protocol||"text/plain",s=!(!t.negotiated&&!t.preset);return"moz"===i.prefix?(e=o?{protocol:a,preset:s,stream:n}:{},r=this.pc.createDataChannel(n,e),r.binaryType="blob"):(e=o?{reliable:!0}:{reliable:!1},r=this.pc.createDataChannel(n,e)),r},t.exports=e},{webrtcsupport:21,wildemitter:22}],16:[function(n,t,e){var r=n("./lib/tosdp"),i=n("./lib/tojson");e.toSessionSDP=r.toSessionSDP,e.toMediaSDP=r.toMediaSDP,e.toCandidateSDP=r.toCandidateSDP,e.toSessionJSON=i.toSessionJSON,e.toMediaJSON=i.toMediaJSON,e.toCandidateJSON=i.toCandidateJSON},{"./lib/tojson":18,"./lib/tosdp":19}],17:[function(n,t,e){e.lines=function(n){return n.split("\r\n").filter(function(n){return n.length>0})},e.findLine=function(n,t,e){for(var r=n.length,i=0;i<t.length;i++)if(t[i].substr(0,r)===n)return t[i];if(!e)return!1;for(var o=0;o<e.length;o++)if(e[o].substr(0,r)===n)return e[o];return!1},e.findLines=function(n,t,e){for(var r=[],i=n.length,o=0;o<t.length;o++)t[o].substr(0,i)===n&&r.push(t[o]);if(r.length||!e)return r;for(var a=0;a<e.length;a++)e[a].substr(0,i)===n&&r.push(e[a]);return r},e.mline=function(n){for(var t=n.substr(2).split(" "),e={media:t[0],port:t[1],proto:t[2],formats:[]},r=3;r<t.length;r++)t[r]&&e.formats.push(t[r]);return e},e.rtpmap=function(n){var t=n.substr(9).split(" "),e={id:t.shift()};return t=t[0].split("/"),e.name=t[0],e.clockrate=t[1],e.channels=3==t.length?t[2]:"1",e},e.fmtp=function(n){for(var t,e,r,i=n.substr(n.indexOf(" ")+1).split(";"),o=[],a=0;a<i.length;a++)t=i[a].split("="),e=t[0].trim(),r=t[1],e&&r?o.push({key:e,value:r}):e&&o.push({key:"",value:e});return o},e.crypto=function(n){var t=n.substr(9).split(" "),e={tag:t[0],cipherSuite:t[1],keyParams:t[2],sessionParams:t.slice(3).join(" ")};
return e},e.fingerprint=function(n){var t=n.substr(14).split(" ");return{hash:t[0],value:t[1]}},e.extmap=function(n){var t=n.substr(9).split(" "),e={},r=t.shift(),i=r.indexOf("/");return i>=0?(e.id=r.substr(0,i),e.senders=r.substr(i)):(e.id=r,e.senders="sendrecv"),e.uri=t.shift(),e},e.rtcpfb=function(n){var t=n.substr(10).split(" "),e={};return e.id=t.shift(),e.type=t.shift(),"trr-int"===e.type?e.value=t.shift():e.subtype=t.shift(),e.parameters=t,e},e.candidate=function(n){for(var t=n.substring(12).split(" "),e={foundation:t[0],component:t[1],protocol:t[2].toLowerCase(),priority:t[3],ip:t[4],port:t[5],type:t[7]},r=8;r<t.length;r+=2)"raddr"===t[r]?e.relAddr=t[r+1]:"rport"===t[r]?e.relPort=t[r+1]:"generation"===t[r]&&(e.generation=t[r+1]);return e.network="1",e},e.ssrc=function(n){for(var t,e,r=[],i={},o=0;o<n.length;o++){t=n[o].substr(7).split(" "),e=t.shift(),t=t.join(" ").split(":");var a=t.shift(),s=t.join(":")||null;i[e]||(i[e]={}),i[e][a]=s}for(e in i){var c=i[e];c.ssrc=e,r.push(c)}return r},e.grouping=function(n){for(var t,e=[],r=0;r<n.length;r++)t=n[r].substr(8).split(" "),e.push({semantics:t.shift(),contents:t});return e}},{}],18:[function(n,t,e){var r=n("./parsers"),i=Math.random();e.toSessionJSON=function(n,t){for(var i=n.split("\r\nm="),o=1;o<i.length;o++)i[o]="m="+i[o],o!==i.length-1&&(i[o]+="\r\n");var a=i.shift()+"\r\n",s=r.lines(a),c={},u=[];i.forEach(function(n){u.push(e.toMediaJSON(n,a,t))}),c.contents=u;var p=r.findLines("a=group:",s);return p.length&&(c.groupings=r.grouping(p)),c},e.toMediaJSON=function(n,t,i){var o=r.lines(n),a=r.lines(t),s=r.mline(o[0]),c={creator:i,name:s.media,description:{descType:"rtp",media:s.media,payloads:[],encryption:[],feedback:[],headerExtensions:[]},transport:{transType:"iceUdp",candidates:[],fingerprints:[]}},u=c.description,p=c.transport,f=r.findLine("a=ssrc:",o);f&&(u.ssrc=f.substr(7).split(" ")[0]);var l=r.findLine("a=mid:",o);l&&(c.name=l.substr(6)),r.findLine("a=sendrecv",o,a)?c.senders="both":r.findLine("a=sendonly",o,a)?c.senders="initiator":r.findLine("a=recvonly",o,a)?c.senders="responder":r.findLine("a=inactive",o,a)&&(c.senders="none");var d=r.findLines("a=rtpmap:",o);d.forEach(function(n){var t=r.rtpmap(n);t.feedback=[];var e=r.findLines("a=fmtp:"+t.id,o);e.forEach(function(n){t.parameters=r.fmtp(n)});var i=r.findLines("a=rtcp-fb:"+t.id,o);i.forEach(function(n){t.feedback.push(r.rtcpfb(n))}),u.payloads.push(t)});var h=r.findLines("a=crypto:",o,a);h.forEach(function(n){u.encryption.push(r.crypto(n))}),r.findLine("a=rtcp-mux",o)&&(u.mux=!0);var m=r.findLines("a=rtcp-fb:*",o);m.forEach(function(n){u.feedback.push(r.rtcpfb(n))});var g=r.findLines("a=extmap:",o);g.forEach(function(n){var t=r.extmap(n),e={sendonly:"responder",recvonly:"initiator",sendrecv:"both",inactive:"none"};t.senders=e[t.senders],u.headerExtensions.push(t)});var v=r.findLines("a=ssrc:",o);v.length&&(u.ssrcs=r.ssrc(v));var y=r.findLines("a=fingerprint:",o,a);y.forEach(function(n){p.fingerprints.push(r.fingerprint(n))});var w=r.findLine("a=ice-ufrag:",o,a),b=r.findLine("a=ice-pwd:",o,a);if(w&&b){p.ufrag=w.substr(12),p.pwd=b.substr(10),p.candidates=[];var S=r.findLines("a=candidate:",o,a);S.forEach(function(n){p.candidates.push(e.toCandidateJSON(n))})}return c},e.toCandidateJSON=function(n){var t=r.candidate(n.split("\r\n")[0]);return t.id=(i++).toString(36).substr(0,12),t}},{"./parsers":17}],19:[function(n,t,e){var r={initiator:"sendonly",responder:"recvonly",both:"sendrecv",none:"inactive",sendonly:"initator",recvonly:"responder",sendrecv:"both",inactive:"none"};e.toSessionSDP=function(n,t){var r=["v=0","o=- "+(t||n.sid||Date.now())+" "+Date.now()+" IN IP4 0.0.0.0","s=-","t=0 0"],i=n.groupings||[];i.forEach(function(n){r.push("a=group:"+n.semantics+" "+n.contents.join(" "))});var o=n.contents||[];return o.forEach(function(n){r.push(e.toMediaSDP(n))}),r.join("\r\n")+"\r\n"},e.toMediaSDP=function(n){var t=[],i=n.description,o=n.transport,a=i.payloads||[],s=o&&o.fingerprints||[],c=[i.media,"1"];i.encryption&&i.encryption.length>0||s.length>0?c.push("RTP/SAVPF"):c.push("RTP/AVPF"),a.forEach(function(n){c.push(n.id)}),t.push("m="+c.join(" ")),t.push("c=IN IP4 0.0.0.0"),t.push("a=rtcp:1 IN IP4 0.0.0.0"),o&&(o.ufrag&&t.push("a=ice-ufrag:"+o.ufrag),o.pwd&&t.push("a=ice-pwd:"+o.pwd),s.forEach(function(n){t.push("a=fingerprint:"+n.hash+" "+n.value)})),t.push("a="+(r[n.senders]||"sendrecv")),t.push("a=mid:"+n.name),i.mux&&t.push("a=rtcp-mux");var u=i.encryption||[];u.forEach(function(n){t.push("a=crypto:"+n.tag+" "+n.cipherSuite+" "+n.keyParams+n.sessionParams?" "+n.sessionParams:"")}),a.forEach(function(n){var e="a=rtpmap:"+n.id+" "+n.name+"/"+n.clockrate;if(n.channels&&"1"!=n.channels&&(e+="/"+n.channels),t.push(e),n.parameters&&n.parameters.length){var r=["a=fmtp:"+n.id];n.parameters.forEach(function(n){r.push((n.key?n.key+"=":"")+n.value)}),t.push(r.join(" "))}n.feedback&&n.feedback.forEach(function(e){"trr-int"===e.type?t.push("a=rtcp-fb:"+n.id+" trr-int "+e.value?e.value:"0"):t.push("a=rtcp-fb:"+n.id+" "+e.type+(e.subtype?" "+e.subtype:""))})}),i.feedback&&i.feedback.forEach(function(n){"trr-int"===n.type?t.push(n.value):t.push("a=rtcp-fb:* "+n.type+(n.subtype?" "+n.subtype:""))});var p=i.headerExtensions||[];p.forEach(function(n){t.push("a=extmap:"+n.id+(n.senders?"/"+r[n.senders]:"")+" "+n.uri)});var f=i.ssrcs||[];f.forEach(function(n){for(var e in n)"ssrc"!=e&&t.push("a=ssrc:"+(n.ssrc||i.ssrc)+" "+e+(n[e]?":"+n[e]:""))});var l=o.candidates||[];return l.forEach(function(n){t.push(e.toCandidateSDP(n))}),t.join("\r\n")},e.toCandidateSDP=function(n){var t=[];t.push(n.foundation),t.push(n.component),t.push(n.protocol),t.push(n.priority),t.push(n.ip),t.push(n.port);var e=n.type;return t.push("typ"),t.push(e),("srflx"===e||"prflx"===e||"relay"===e)&&n.relAddr&&n.relPort&&(t.push("raddr"),t.push(n.relAddr),t.push("rport"),t.push(n.relPort)),t.push("generation"),t.push(n.generation||"0"),"a=candidate:"+t.join(" ")}},{}],20:[function(n,t,e){!function(){var n=this,r=n._,i={},o=Array.prototype,a=Object.prototype,s=Function.prototype,c=o.push,u=o.slice,p=o.concat,f=a.toString,l=a.hasOwnProperty,d=o.forEach,h=o.map,m=o.reduce,g=o.reduceRight,v=o.filter,y=o.every,w=o.some,b=o.indexOf,S=o.lastIndexOf,x=Array.isArray,k=Object.keys,C=s.bind,j=function(n){return n instanceof j?n:this instanceof j?(this._wrapped=n,void 0):new j(n)};"undefined"!=typeof e?("undefined"!=typeof t&&t.exports&&(e=t.exports=j),e._=j):n._=j,j.VERSION="1.5.2";var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(d&&n.forEach===d)n.forEach(t,e);else if(n.length===+n.length){for(var r=0,o=n.length;o>r;r++)if(t.call(e,n[r],r,n)===i)return}else for(var a=j.keys(n),r=0,o=a.length;o>r;r++)if(t.call(e,n[a[r]],a[r],n)===i)return};j.map=j.collect=function(n,t,e){var r=[];return null==n?r:h&&n.map===h?n.map(t,e):(A(n,function(n,i,o){r.push(t.call(e,n,i,o))}),r)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,e,r){var i=arguments.length>2;if(null==n&&(n=[]),m&&n.reduce===m)return r&&(t=j.bind(t,r)),i?n.reduce(t,e):n.reduce(t);if(A(n,function(n,o,a){i?e=t.call(r,e,n,o,a):(e=n,i=!0)}),!i)throw new TypeError(E);return e},j.reduceRight=j.foldr=function(n,t,e,r){var i=arguments.length>2;if(null==n&&(n=[]),g&&n.reduceRight===g)return r&&(t=j.bind(t,r)),i?n.reduceRight(t,e):n.reduceRight(t);var o=n.length;if(o!==+o){var a=j.keys(n);o=a.length}if(A(n,function(s,c,u){c=a?a[--o]:--o,i?e=t.call(r,e,n[c],c,u):(e=n[c],i=!0)}),!i)throw new TypeError(E);return e},j.find=j.detect=function(n,t,e){var r;return T(n,function(n,i,o){return t.call(e,n,i,o)?(r=n,!0):void 0}),r},j.filter=j.select=function(n,t,e){var r=[];return null==n?r:v&&n.filter===v?n.filter(t,e):(A(n,function(n,i,o){t.call(e,n,i,o)&&r.push(n)}),r)},j.reject=function(n,t,e){return j.filter(n,function(n,r,i){return!t.call(e,n,r,i)},e)},j.every=j.all=function(n,t,e){t||(t=j.identity);var r=!0;return null==n?r:y&&n.every===y?n.every(t,e):(A(n,function(n,o,a){return(r=r&&t.call(e,n,o,a))?void 0:i}),!!r)};var T=j.some=j.any=function(n,t,e){t||(t=j.identity);var r=!1;return null==n?r:w&&n.some===w?n.some(t,e):(A(n,function(n,o,a){return r||(r=t.call(e,n,o,a))?i:void 0}),!!r)};j.contains=j.include=function(n,t){return null==n?!1:b&&n.indexOf===b?-1!=n.indexOf(t):T(n,function(n){return n===t})},j.invoke=function(n,t){var e=u.call(arguments,2),r=j.isFunction(t);return j.map(n,function(n){return(r?t:n[t]).apply(n,e)})},j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},j.where=function(n,t,e){return j.isEmpty(t)?e?void 0:[]:j[e?"find":"filter"](n,function(n){for(var e in t)if(t[e]!==n[e])return!1;return!0})},j.findWhere=function(n,t){return j.where(n,t,!0)},j.max=function(n,t,e){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;var r={computed:-1/0,value:-1/0};return A(n,function(n,i,o){var a=t?t.call(e,n,i,o):n;a>r.computed&&(r={value:n,computed:a})}),r.value},j.min=function(n,t,e){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var r={computed:1/0,value:1/0};return A(n,function(n,i,o){var a=t?t.call(e,n,i,o):n;a<r.computed&&(r={value:n,computed:a})}),r.value},j.shuffle=function(n){var t,e=0,r=[];return A(n,function(n){t=j.random(e++),r[e-1]=r[t],r[t]=n}),r},j.sample=function(n,t,e){return arguments.length<2||e?n[j.random(n.length-1)]:j.shuffle(n).slice(0,Math.max(0,t))};var O=function(n){return j.isFunction(n)?n:function(t){return t[n]}};j.sortBy=function(n,t,e){var r=O(t);return j.pluck(j.map(n,function(n,t,i){return{value:n,index:t,criteria:r.call(e,n,t,i)}}).sort(function(n,t){var e=n.criteria,r=t.criteria;if(e!==r){if(e>r||void 0===e)return 1;if(r>e||void 0===r)return-1}return n.index-t.index}),"value")};var I=function(n){return function(t,e,r){var i={},o=null==e?j.identity:O(e);return A(t,function(e,a){var s=o.call(r,e,a,t);n(i,s,e)}),i}};j.groupBy=I(function(n,t,e){(j.has(n,t)?n[t]:n[t]=[]).push(e)}),j.indexBy=I(function(n,t,e){n[t]=e}),j.countBy=I(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,e,r){e=null==e?j.identity:O(e);for(var i=e.call(r,t),o=0,a=n.length;a>o;){var s=o+a>>>1;e.call(r,n[s])<i?o=s+1:a=s}return o},j.toArray=function(n){return n?j.isArray(n)?u.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,e){return null==n?void 0:null==t||e?n[0]:u.call(n,0,t)},j.initial=function(n,t,e){return u.call(n,0,n.length-(null==t||e?1:t))},j.last=function(n,t,e){return null==n?void 0:null==t||e?n[n.length-1]:u.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,e){return u.call(n,null==t||e?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var _=function(n,t,e){return t&&j.every(n,j.isArray)?p.apply(e,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?c.apply(e,n):_(n,t,e):e.push(n)}),e)};j.flatten=function(n,t){return _(n,t,[])},j.without=function(n){return j.difference(n,u.call(arguments,1))},j.uniq=j.unique=function(n,t,e,r){j.isFunction(t)&&(r=e,e=t,t=!1);var i=e?j.map(n,e,r):n,o=[],a=[];return A(i,function(e,r){(t?r&&a[a.length-1]===e:j.contains(a,e))||(a.push(e),o.push(n[r]))}),o},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=u.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.indexOf(t,n)>=0})})},j.difference=function(n){var t=p.apply(o,u.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),e=0;n>e;e++)t[e]=j.pluck(arguments,""+e);return t},j.object=function(n,t){if(null==n)return{};for(var e={},r=0,i=n.length;i>r;r++)t?e[n[r]]=t[r]:e[n[r][0]]=n[r][1];return e},j.indexOf=function(n,t,e){if(null==n)return-1;var r=0,i=n.length;if(e){if("number"!=typeof e)return r=j.sortedIndex(n,t),n[r]===t?r:-1;r=0>e?Math.max(0,i+e):e}if(b&&n.indexOf===b)return n.indexOf(t,e);for(;i>r;r++)if(n[r]===t)return r;return-1},j.lastIndexOf=function(n,t,e){if(null==n)return-1;var r=null!=e;if(S&&n.lastIndexOf===S)return r?n.lastIndexOf(t,e):n.lastIndexOf(t);for(var i=r?e:n.length;i--;)if(n[i]===t)return i;return-1},j.range=function(n,t,e){arguments.length<=1&&(t=n||0,n=0),e=arguments[2]||1;for(var r=Math.max(Math.ceil((t-n)/e),0),i=0,o=new Array(r);r>i;)o[i++]=n,n+=e;return o};var D=function(){};j.bind=function(n,t){var e,r;if(C&&n.bind===C)return C.apply(n,u.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return e=u.call(arguments,2),r=function(){if(!(this instanceof r))return n.apply(t,e.concat(u.call(arguments)));D.prototype=n.prototype;var i=new D;D.prototype=null;var o=n.apply(i,e.concat(u.call(arguments)));return Object(o)===o?o:i}},j.partial=function(n){var t=u.call(arguments,1);return function(){return n.apply(this,t.concat(u.call(arguments)))}},j.bindAll=function(n){var t=u.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var e={};return t||(t=j.identity),function(){var r=t.apply(this,arguments);return j.has(e,r)?e[r]:e[r]=n.apply(this,arguments)}},j.delay=function(n,t){var e=u.call(arguments,2);return setTimeout(function(){return n.apply(null,e)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(u.call(arguments,1)))},j.throttle=function(n,t,e){var r,i,o,a=null,s=0;e||(e={});var c=function(){s=e.leading===!1?0:new Date,a=null,o=n.apply(r,i)};return function(){var u=new Date;s||e.leading!==!1||(s=u);var p=t-(u-s);return r=this,i=arguments,0>=p?(clearTimeout(a),a=null,s=u,o=n.apply(r,i)):a||e.trailing===!1||(a=setTimeout(c,p)),o}},j.debounce=function(n,t,e){var r,i,o,a,s;return function(){o=this,i=arguments,a=new Date;var c=function(){var u=new Date-a;t>u?r=setTimeout(c,t-u):(r=null,e||(s=n.apply(o,i)))},u=e&&!r;return r||(r=setTimeout(c,t)),u&&(s=n.apply(o,i)),s}},j.once=function(n){var t,e=!1;return function(){return e?t:(e=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return function(){var e=[n];return c.apply(e,arguments),t.apply(this,e)}},j.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length-1;e>=0;e--)t=[n[e].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=k||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var e in n)j.has(n,e)&&t.push(e);return t},j.values=function(n){for(var t=j.keys(n),e=t.length,r=new Array(e),i=0;e>i;i++)r[i]=n[t[i]];return r},j.pairs=function(n){for(var t=j.keys(n),e=t.length,r=new Array(e),i=0;e>i;i++)r[i]=[t[i],n[t[i]]];return r},j.invert=function(n){for(var t={},e=j.keys(n),r=0,i=e.length;i>r;r++)t[n[e[r]]]=e[r];return t},j.functions=j.methods=function(n){var t=[];for(var e in n)j.isFunction(n[e])&&t.push(e);return t.sort()},j.extend=function(n){return A(u.call(arguments,1),function(t){if(t)for(var e in t)n[e]=t[e]}),n},j.pick=function(n){var t={},e=p.apply(o,u.call(arguments,1));return A(e,function(e){e in n&&(t[e]=n[e])}),t},j.omit=function(n){var t={},e=p.apply(o,u.call(arguments,1));for(var r in n)j.contains(e,r)||(t[r]=n[r]);return t},j.defaults=function(n){return A(u.call(arguments,1),function(t){if(t)for(var e in t)void 0===n[e]&&(n[e]=t[e])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var R=function(n,t,e,r){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var i=f.call(n);if(i!=f.call(t))return!1;switch(i){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var o=e.length;o--;)if(e[o]==n)return r[o]==t;var a=n.constructor,s=t.constructor;if(a!==s&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(s)&&s instanceof s))return!1;e.push(n),r.push(t);var c=0,u=!0;if("[object Array]"==i){if(c=n.length,u=c==t.length)for(;c--&&(u=R(n[c],t[c],e,r)););}else{for(var p in n)if(j.has(n,p)&&(c++,!(u=j.has(t,p)&&R(n[p],t[p],e,r))))break;if(u){for(p in t)if(j.has(t,p)&&!c--)break;u=!c}}return e.pop(),r.pop(),u};j.isEqual=function(n,t){return R(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==f.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return f.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==f.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return void 0===n},j.has=function(n,t){return l.call(n,t)},j.noConflict=function(){return n._=r,this},j.identity=function(n){return n},j.times=function(n,t,e){for(var r=Array(Math.max(0,n)),i=0;n>i;i++)r[i]=t.call(e,i);return r},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var M={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};M.unescape=j.invert(M.escape);var P={escape:new RegExp("["+j.keys(M.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(M.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(P[n],function(t){return M[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var e=n[t];return j.isFunction(e)?e.call(n):e},j.mixin=function(n){A(j.functions(n),function(t){var e=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return c.apply(n,arguments),q.call(this,e.apply(j,n))}})};var L=0;j.uniqueId=function(n){var t=++L+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,F={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},J=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,e){var r;e=j.defaults({},e,j.templateSettings);var i=new RegExp([(e.escape||N).source,(e.interpolate||N).source,(e.evaluate||N).source].join("|")+"|$","g"),o=0,a="__p+='";n.replace(i,function(t,e,r,i,s){return a+=n.slice(o,s).replace(J,function(n){return"\\"+F[n]}),e&&(a+="'+\n((__t=("+e+"))==null?'':_.escape(__t))+\n'"),r&&(a+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(a+="';\n"+i+"\n__p+='"),o=s+t.length,t}),a+="';\n",e.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{r=new Function(e.variable||"obj","_",a)}catch(s){throw s.source=a,s}if(t)return r(t,j);var c=function(n){return r.call(this,n,j)};return c.source="function("+(e.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var q=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=o[n];j.prototype[n]=function(){var e=this._wrapped;return t.apply(e,arguments),"shift"!=n&&"splice"!=n||0!==e.length||delete e[0],q.call(this,e)}}),A(["concat","join","slice"],function(n){var t=o[n];j.prototype[n]=function(){return q.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this)},{}],21:[function(n,t){var e,r=!1,i=!1,o=navigator.userAgent.toLowerCase();-1!==o.indexOf("firefox")?(e="moz",i=!0):-1!==o.indexOf("chrome")&&(e="webkit",r=!0);var a=window.mozRTCPeerConnection||window.webkitRTCPeerConnection,s=window.mozRTCIceCandidate||window.RTCIceCandidate,c=window.mozRTCSessionDescription||window.RTCSessionDescription,u=window.webkitMediaStream||window.MediaStream,p=navigator.userAgent.match("Chrome")&&parseInt(navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,f=window.webkitAudioContext||window.AudioContext;t.exports={support:!!a,dataChannel:r||i||a.prototype&&a.prototype.createDataChannel,prefix:e,webAudio:!(!f||!f.prototype.createMediaStreamSource),mediaStream:!(!u||!u.prototype.removeTrack),screenSharing:!!p,AudioContext:f,PeerConnection:a,SessionDescription:c,IceCandidate:s}},{}],22:[function(n,t){function e(){this.callbacks={}}t.exports=e,e.prototype.on=function(n){var t=3===arguments.length,e=t?arguments[1]:void 0,r=t?arguments[2]:arguments[1];return r._groupName=e,(this.callbacks[n]=this.callbacks[n]||[]).push(r),this},e.prototype.once=function(n){function t(){e.off(n,t),o.apply(this,arguments)}var e=this,r=3===arguments.length,i=r?arguments[1]:void 0,o=r?arguments[2]:arguments[1];return this.on(n,i,t),this},e.prototype.releaseGroup=function(n){var t,e,r,i;for(t in this.callbacks)for(i=this.callbacks[t],e=0,r=i.length;r>e;e++)i[e]._groupName===n&&(i.splice(e,1),e--,r--);return this},e.prototype.off=function(n,t){var e,r=this.callbacks[n];return r?1===arguments.length?(delete this.callbacks[n],this):(e=r.indexOf(t),r.splice(e,1),this):this},e.prototype.emit=function(n){var t,e,r=[].slice.call(arguments,1),i=this.callbacks[n],o=this.getWildcardCallbacks(n);if(i)for(t=0,e=i.length;e>t&&i[t];++t)i[t].apply(this,r);if(o)for(t=0,e=o.length;e>t&&o[t];++t)o[t].apply(this,[n].concat(r));return this},e.prototype.getWildcardCallbacks=function(n){var t,e,r=[];for(t in this.callbacks)e=t.split("*"),("*"===t||2===e.length&&n.slice(0,e[1].length)===e[1])&&(r=r.concat(this.callbacks[t]));return r}},{}]},{},[1])(1)});

@@ -249,3 +249,3 @@ var _ = require('underscore');

sess = this.sessions[currsid];
if (sess.pending) {
if (sess && sess.pending) {
if (_.intersection(contentTypes, sess.contentTypes).length) {

@@ -252,0 +252,0 @@ // We already have a pending session request for this content type.

{
"name": "jingle",
"version": "0.1.1",
"version": "0.1.2",
"description": "Generic Jingle via WebRTC session manager.",

@@ -23,4 +23,4 @@ "main": "index.js",

"webrtcsupport": "0.7.0",
"jingle-rtcpeerconnection": "0.2.5",
"sdp-jingle-json": "0.3.2",
"jingle-rtcpeerconnection": "0.2.6",
"sdp-jingle-json": "0.3.3",
"wildemitter": "0.0.5",

@@ -27,0 +27,0 @@ "getusermedia": "0.2.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc