Created
April 21, 2014 20:16
-
-
Save legastero/11155110 to your computer and use it in GitHub Desktop.
[email protected] minified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! stanzaio 2014-04-21!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.XMPP=e()}}(function(){var e,f,n;return function o(e,f,n){function d(t,l){if(!f[t]){if(!e[t]){var u="function"==typeof require&&require;if(!l&&u)return u(t,!0);if(i)return i(t,!0);throw new Error("Cannot find module '"+t+"'")}var p=f[t]={exports:{}};e[t][0].call(p.exports,function(f){var n=e[t][1][f];return d(n?n:f)},p,p.exports,o,e,f,n)}return f[t].exports}for(var i="function"==typeof require&&require,t=0;t<n.length;t++)d(n[t]);return d}({1:[function(e,f,n){"use strict";n.Stream=e("./lib/stanza/stream"),n.BOSH=e("./lib/stanza/bosh"),n.Message=e("./lib/stanza/message"),n.Presence=e("./lib/stanza/presence"),n.Iq=e("./lib/stanza/iq"),n.PubsubEvent=e("./lib/stanza/pubsub").EventItem,n.PubsubItem=e("./lib/stanza/pubsub").Item,n.JID=e("./lib/jid"),n.Client=e("./lib/client"),n.crypto=e("crypto"),n.jxt=e("jxt"),n.createClient=function(f){var o=new n.Client(f);return o.use(e("./lib/plugins")),o}},{"./lib/client":3,"./lib/jid":4,"./lib/plugins":21,"./lib/stanza/bosh":45,"./lib/stanza/iq":59,"./lib/stanza/message":63,"./lib/stanza/presence":68,"./lib/stanza/pubsub":71,"./lib/stanza/stream":79,crypto:133,jxt:204}],2:[function(e,f){(function(n){"use strict";function o(){}function d(e,f,n,i){i=i||0;var t=p(e).cancellable().timeout(1e3*(f||20));return t.spread(function(e,f){if(e.statusCode<200||e.statusCode>=400)throw new o("HTTP Status Error");return f}).catch(u.TimeoutError,function(){throw new o("Dead Connection, exceeded timeout limit")}).catch(u.CancellationError,function(){}).catch(function(){if(n>i)return u.delay(100).then(function(){return d(e,f,n,i+1)});throw new o("Dead Connection, exceeded retry limit")})}function i(e){var f=this;s.call(this),f.sm=e,f.sendQueue=[],f.requests=[],f.maxRequests=2,f.sid="",f.on("raw:incoming",function(e){if(e=e.trim(),""!==e){var n,o;try{n=c.parse(e,y)}catch(d){return o=new a({condition:"invalid-xml"}),f.emit("stream:error",o,d),f.send(o),f.disconnect()}f.hasStream||(f.hasStream=!0,f.stream={id:n.sid,lang:n.lang||"en",version:n.version||"1.0",to:n.to,from:n.from},f.sid=n.sid,f.maxRequests=n.requests);var i=n.payload;i.forEach(function(e){if(e.lang||(e.lang=f.stream.lang),f.emit("stream:data",e),f.emit(e._eventname||e._name,e),"message"===e._name||"presence"===e._name||"iq"===e._name)f.sm.handle(e),f.emit("stanza",e);else{if("smAck"===e._name)return f.sm.process(e);if("smRequest"===e._name)return f.sm.ack()}e.id&&f.emit("id:"+e.id,e)}),"terminate"==n.type&&(f.rid=void 0,f.sid=void 0,f.emit("bosh:terminate",n),f.emit("stream:end"),f.emit("disconnected",f))}})}{var t=e("underscore"),l=e("util"),u=(e("async"),e("bluebird")),p=u.promisify(e("request")),s=e("wildemitter"),c=e("jxt"),y=e("./stanza/bosh"),a=e("./stanza/streamError");e("./stanza/message"),e("./stanza/presence"),e("./stanza/iq")}l.inherits(o,Error),l.inherits(i,s),i.prototype.connect=function(e){var f=this;f.config=t.extend({rid:Math.ceil(9999999999*Math.random()),wait:30,maxRetries:5},e),f.hasStream=!1,f.sm.started=!1,f.url=e.boshURL,f.rid=f.config.rid,f.requests=[],f.rid++,f.request(new y({version:f.config.version||"1.0",to:f.config.server,lang:f.config.lang||"en",wait:f.config.wait,ver:"1.6",hold:1}))},i.prototype.disconnect=function(){this.hasStream?(this.rid++,this.request(new y({type:"terminate"}))):(this.requests.forEach(function(e){e.request.cancel()}),this.stream=void 0,this.sid=void 0,this.rid=void 0,this.emit("disconnected",this))},i.prototype.restart=function(){var e=this;e.rid++,e.request(new y({to:e.config.server,lang:e.config.lang||"en",restart:"true"}))},i.prototype.send=function(e){var f=this;f.hasStream&&(f.sm.track(e),f.sendQueue.push(e),n.nextTick(f.longPoll.bind(f)))},i.prototype.longPoll=function(){var e=0===this.requests.length,f=this.sendQueue.length>0&&this.requests.length<this.maxRequests;if(this.sid&&(e||f)){var n=this.sendQueue;this.sendQueue=[],this.rid++,this.request(new y({payload:n}))}},i.prototype.request=function(e){var f=this,i={id:f.rid,request:null};e.rid=f.rid,e.sid=f.sid;var l=e.toString();f.emit("raw:outgoing",l),f.requests.push(i);var u=d({uri:f.url,body:l,method:"POST",strictSSL:!0},1.5*f.config.wait,this.config.maxRetries);return i.request=u,u.then(function(e){f.emit("raw:incoming",e)}).catch(o,function(e){f.hasStream=!1;var n=new a({condition:"connection-timeout"});f.emit("stream:error",n,e),f.disconnect()}).catch(function(e){var n=new a({condition:"undefined-condition"});f.emit("stream:error",n,e),f.send(n),f.disconnect()}).finally(function(){f.requests=t.filter(f.requests,function(e){return e.id!==i.id}),"terminate"!==e.type&&n.nextTick(function(){n.nextTick(f.longPoll.bind(f))})})},f.exports=i}).call(this,e("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./stanza/bosh":45,"./stanza/iq":59,"./stanza/message":63,"./stanza/presence":68,"./stanza/streamError":80,"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139,async:88,bluebird:92,jxt:204,request:127,underscore:228,util:141,wildemitter:229}],3:[function(e,f){"use strict";function n(e){var f=this;o.call(this),e=e||{},this.config=d.extend({useStreamManagement:!0,transports:["websocket","bosh"],sasl:["external","scram-sha-1","digest-md5","plain","anonymous"]},e),d.isArray(this.config.sasl)||(this.config.sasl=[this.config.sasl]),this.config.sasl.forEach(function(e){if("string"==typeof e){var f=v[e.toLowerCase()];f&&j.use(f)}else j.use(e)}),this.jid=new b,this.transports={websocket:function(e,f){var n=e.transport=new m(e.sm);n.on("*",function(f,n){e.emit(f,n)}),n.connect(f)},bosh:function(e,f){var n=e.transport=new x(e.sm);n.on("*",function(f,n){e.emit(f,n)}),n.connect(f)}},this.negotiatedFeatures={},this.featureOrder=["sasl","streamManagement","bind","streamManagement","session"],this.features={},this.sm=new g,this.on("streamFeatures",function(e){var n=[];f.featureOrder.forEach(function(o){e._extensions[o]&&!f.negotiatedFeatures[o]&&n.push(function(n){!f.negotiatedFeatures[o]&&f.features[o]?f.features[o](e,n):n()})}),l.series(n,function(e){if("restart"===e)f.transport.restart();else if("disconnect"===e){var n=new r({condition:"policy-violation",text:"failed to negotiate stream features"});f.emit("stream:error",n),f.disconnect()}})}),this.features.sasl=function(e,n){var o=j.create(e.sasl.mechanisms);f.on("sasl:success","sasl",function(){f.negotiatedFeatures.sasl=!0,f.releaseGroup("sasl"),f.emit("auth:success"),n("restart")}),f.on("sasl:challenge","sasl",function(e){o.challenge(e.value),f.send(new c.Response({value:o.response(f.getCredentials())})),o.cache&&(d.each(o.cache,function(e,n){e&&(f.config.credentials[n]=s(e))}),f.emit("credentials:update",f.config.credentials)),n()}),f.on("sasl:failure","sasl",function(){f.releaseGroup("sasl"),f.emit("auth:failed"),n("disconnect")}),f.on("sasl:abort","sasl",function(){f.releaseGroup("sasl"),f.emit("auth:failed"),n("disconnect")});var i={mechanism:o.name};o.clientFirst&&(i.value=o.response(f.getCredentials())),f.send(new c.Auth(i))},this.features.bind=function(e,n){f.sendIq({type:"set",bind:{resource:f.config.resource}}).then(function(o){f.negotiatedFeatures.bind=!0,f.emit("session:bound",o.bind.jid),f.jid=new b(o.bind.jid),f.sessionStarted||e._extensions.session||(f.sessionStarted=!0,f.emit("session:started",o.bind.jid)),n()}).catch(function(e){f.emit("session:error",e),n("disconnect")})},this.features.session=function(e,n){f.sendIq({type:"set",session:{}},function(){f.negotiatedFeatures.session=!0,f.sessionStarted||(f.sessionStarted=!0,f.emit("session:started",f.jid)),n()})},this.features.streamManagement=function(e,n){return f.config.useStreamManagement?(f.on("stream:management:enabled","sm",function(e){f.sm.enabled(e),f.negotiatedFeatures.streamManagement=!0,f.releaseGroup("sm"),n()}),f.on("stream:management:resumed","sm",function(e){f.sm.enabled(e),f.negotiatedFeatures.streamManagement=!0,f.negotiatedFeatures.bind=!0,f.sessionStarted=!0,f.releaseGroup("sm"),n()}),f.on("stream:management:failed","sm",function(){f.sm.failed(),f.emit("session:end"),f.releaseGroup("session"),f.releaseGroup("sm"),n()}),void(f.sm.id?f.sm.id&&f.sm.allowResume?f.sm.resume(f.transport):n():f.negotiatedFeatures.bind?f.sm.enable(f.transport):n())):n()},this.on("disconnected",function(){f.transport&&(f.transport.off("*"),delete f.transport),f.sessionStarted=!1,f.negotiatedFeatures.sasl=!1,f.negotiatedFeatures.streamManagement=!1,f.negotiatedFeatures.bind=!1,f.negotiatedFeatures.session=!1,f.releaseGroup("connection")}),this.on("iq",function(e){var n=e.type,o=Object.keys(e._extensions),i=e.xml.childNodes,t=0;if(d.each(i,function(e){1===e.nodeType&&(t+=1)}),"get"===e.type||"set"===e.type){if(1!=t)return f.sendIq(e.errorReply({error:{type:"modify",condition:"bad-request"}}));if(!o.length)return f.sendIq(e.errorReply({error:{type:"cancel",condition:"feature-not-implemented"}}));var l="iq:"+n+":"+o[0];f.callbacks[l]?f.emit(l,e):f.sendIq(e.errorReply({error:{type:"cancel",condition:"feature-not-implemented"}}))}}),this.on("message",function(e){Object.keys(e.$body).length&&("chat"===e.type||"normal"===e.type?f.emit("chat",e):"groupchat"===e.type&&f.emit("groupchat",e)),"error"===e.type&&f.emit("message:error",e)}),this.on("presence",function(e){var n=e.type||"available";"error"===n&&(n="presence:error"),f.emit(n,e)})}var o=e("wildemitter"),d=e("underscore"),i=e("util"),t=e("bluebird"),l=e("async"),u=e("node-uuid"),p=e("atob"),s=e("btoa"),c=e("./stanza/sasl"),y=e("./stanza/message"),a=e("./stanza/presence"),r=e("./stanza/streamError"),w=e("./stanza/iq"),b=e("./jid"),g=e("./sm"),m=e("./websocket"),x=e("./bosh"),P=e("hostmeta"),j=e("saslmechanisms");j=new j;var v={external:e("sasl-external"),"scram-sha-1":e("sasl-scram-sha-1"),"digest-md5":e("sasl-digest-md5"),plain:e("sasl-plain"),anonymous:e("sasl-anonymous")};e("./stanza/stream"),e("./stanza/sm"),e("./stanza/error"),e("./stanza/streamFeatures"),e("./stanza/bind"),e("./stanza/session"),i.inherits(n,o),n.prototype.__defineGetter__("stream",function(){return this.transport?this.transport.stream:void 0}),n.prototype.use=function(e){e(this)},n.prototype.nextId=function(){return u.v4()},n.prototype.discoverBindings=function(e,f){P(e,function(e,n){if(e)return f(e,[]);var o={websocket:[],bosh:[]},d=n.links||[];d.forEach(function(e){e.href&&"urn:xmpp:alt-connections:websocket"===e.rel&&o.websocket.push(e.href),e.href&&"urn:xmpp:altconnect:websocket"===e.rel&&o.websocket.push(e.href),e.href&&"urn:xmpp:alt-connections:xbosh"===e.rel&&o.bosh.push(e.href),e.href&&"urn:xmpp:altconnect:bosh"===e.rel&&o.bosh.push(e.href)}),f(!1,o)})},n.prototype.getCredentials=function(){var e=this.config.credentials||{},f=new b(this.config.jid),n=e.username||f.local,o=e.server||f.domain,i={username:n,password:this.config.password,server:o,host:o,realm:o,serviceType:"xmpp",serviceName:o},t=d.extend(i,e),l=["saltedPassword","clientKey","serverKey"];return l.forEach(function(e){t[e]&&(t[e]=p(t[e]))}),t},n.prototype.connect=function(e){var f=this;return d.extend(f.config,e||{}),f.config.jid=new b(f.config.jid),f.config.server||(f.config.server=f.config.jid.domain),f.config.password&&(f.config.credentials=f.config.credentials||{},f.config.credentials.password=f.config.password,delete f.config.password),f.config.transport?f.transports[f.config.transport](f,f.config):f.discoverBindings(f.config.server,function(e,n){if(e)return f.disconnect();for(var o=0,d=f.config.transports.length;d>o;o++){var i=f.config.transports[o];console.log("Checking for %s endpoints",i);for(var t=0,l=(n[i]||[]).length;l>t;t++){var u=n[i][t];if(0===u.indexOf("wss://")||0===u.indexOf("https://"))return"websocket"==i?f.config.wsURL=u:f.config.boshURL=u,console.log("Using %s endpoint: %s",i,u),f.config.transport=i,f.connect();console.warn("Discovered unencrypted %s endpoint (%s). Ignoring",i,u)}}return console.warn("No endpoints found for the requested transports."),f.disconnect()})},n.prototype.disconnect=function(){this.sessionStarted&&(this.emit("session:end"),this.releaseGroup("session")),this.sessionStarted=!1,this.releaseGroup("connection"),this.transport?this.transport.disconnect():this.emit("disconnected")},n.prototype.send=function(e){this.transport.send(e)},n.prototype.sendMessage=function(e){e=e||{},e.id||(e.id=this.nextId());var f=new y(e);return this.emit("message:sent",f),this.send(f),e.id},n.prototype.sendPresence=function(e){return e=e||{},e.id||(e.id=this.nextId()),this.send(new a(e)),e.id},n.prototype.sendIq=function(e,f){var n,o,d,i,l=this;e=e||{},e.id||(e.id=this.nextId());var u=e.toJSON?e:new w(e);return"error"===e.type?void this.send(u):(i=new b(e.to),d={},d[""]=!0,d[i.full]=!0,d[i.bare]=!0,d[i.domain]=!0,d[l.jid.bare]=!0,d[l.jid.domain]=!0,o="id:"+e.id,n=new t(function(e,f){var n=function(i){d[i.from.full]&&(l.off(o,n),i._extensions.error?f(i):e(i))};l.on(o,"session",n)}),this.send(u),n.timeout(1e3*l.config.timeout||15e3).catch(t.TimeoutError,function(){return{type:"error",error:{condition:"timeout"}}}).nodeify(f))},n.prototype.sendStreamError=function(e){e=e||{};var f=new r(e);this.emit("stream:error",f),this.send(f),this.disconnect()},n.prototype.JID=function(e){return new b(e)},f.exports=n},{"./bosh":2,"./jid":4,"./sm":40,"./stanza/bind":42,"./stanza/error":53,"./stanza/iq":59,"./stanza/message":63,"./stanza/presence":68,"./stanza/sasl":76,"./stanza/session":77,"./stanza/sm":78,"./stanza/stream":79,"./stanza/streamError":80,"./stanza/streamFeatures":81,"./websocket":87,async:88,atob:89,bluebird:92,btoa:142,hostmeta:143,"node-uuid":210,"sasl-anonymous":212,"sasl-digest-md5":214,"sasl-external":216,"sasl-plain":218,"sasl-scram-sha-1":220,saslmechanisms:227,underscore:228,util:141,wildemitter:229}],4:[function(e,f){"use strict";function n(e){e=e||"","string"==typeof e?(this.jid=e,this.parts={}):(this.jid=e.jid,this.parts=e.parts)}n.prototype={constructor:{value:n},toString:function(){return this.jid},get full(){return this.jid},get bare(){if(this.parts.bare)return this.parts.bare;var e=this.jid.indexOf("/");return this.parts.bare=e>0?this.jid.slice(0,e):this.jid,this.parts.bare},get resource(){if(this.parts.resource)return this.parts.resource;var e=this.jid.indexOf("/");return this.parts.resource=e>0?this.jid.slice(e+1):"",this.parts.resource},get local(){if(this.parts.local)return this.parts.local;var e=this.bare,f=e.indexOf("@");return this.parts.local=f>0?e.slice(0,f):e,this.parts.local},get domain(){if(this.parts.domain)return this.parts.domain;var e=this.bare,f=e.indexOf("@");return this.parts.domain=f>0?e.slice(f+1):e,this.parts.domain}},f.exports=n},{}],5:[function(e,f){"use strict";f.exports=function(e){e.disco.addFeature("urn:xmpp:attention:0"),e.getAttention=function(f,n){n=n||{},n.to=f,n.type="headline",n.attention=!0,e.sendMessage(n)},e.on("message",function(f){f.attention&&e.emit("attention",f)})}},{}],6:[function(e,f){"use strict";e("../stanza/avatar");f.exports=function(e){e.disco.addFeature("urn:xmpp:avatar:metadata+notify"),e.on("pubsub:event",function(f){f.event._extensions.updated&&"urn:xmpp:avatar:metadata"===f.event.updated.node&&e.emit("avatar",{jid:f.from,source:"pubsub",avatars:f.event.updated.published[0].avatars})}),e.on("presence",function(f){f.avatarId&&e.emit("avatar",{jid:f.from,source:"vcard",avatars:[{id:f.avatarId}]})}),e.publishAvatar=function(e,f,n){return this.publish("","urn:xmpp:avatar:data",{id:e,avatarData:f},n)},e.useAvatars=function(e,f){return this.publish("","urn:xmpp:avatar:metadata",{id:"current",avatars:e},f)},e.getAvatar=function(e,f,n){return this.getItem(e,"urn:xmpp:avatar:data",f,n)}}},{"../stanza/avatar":41}],7:[function(e,f){"use strict";e("../stanza/blocking"),f.exports=function(e){e.disco.addFeature("urn:xmpp:blocking"),e.block=function(f,n){return e.sendIq({type:"set",block:{jids:[f]}},n)},e.unblock=function(f,n){return e.sendIq({type:"set",unblock:{jids:[f]}},n)},e.getBlocked=function(f){return e.sendIq({type:"get",blockList:{}},f)},e.on("iq:set:block",function(f){e.emit("block",{jids:f.block.jids}),e.sendIq(f.resultReply())}),e.on("iq:set:unblock",function(f){e.emit("unblock",{jids:f.unblock.jids}),e.sendIq(f.resultReply())})}},{"../stanza/blocking":43}],8:[function(e,f){"use strict";e("../stanza/bookmarks");f.exports=function(e){e.getBookmarks=function(e){return this.getPrivateData({bookmarks:{}},e)},e.setBookmarks=function(e,f){return this.setPrivateData({bookmarks:e},f)}}},{"../stanza/bookmarks":44}],9:[function(e,f){"use strict";e("../stanza/carbons");f.exports=function(e){e.disco.addFeature("urn:xmpp:carbons:2"),e.enableCarbons=function(e){return this.sendIq({type:"set",enableCarbons:!0},e)},e.disableCarbons=function(e){return this.sendIq({type:"set",disableCarbons:!0},e)},e.on("message",function(f){return f._extensions.carbonSent?e.emit("carbon:sent",f):f._extensions.carbonReceived?e.emit("carbon:received",f):void 0})}},{"../stanza/carbons":47}],10:[function(e,f){"use strict";e("../stanza/chatstates");f.exports=function(e){e.disco.addFeature("http://jabber.org/protocol/chatstates"),e.on("message",function(f){f.chatState&&(e.emit("chat:state",{to:f.to,from:f.from,chatState:f.chatState}),e.emit("chatState",{to:f.to,from:f.from,chatState:f.chatState}))})}},{"../stanza/chatstates":48}],11:[function(e,f){"use strict";{var n="http://jabber.org/protocol/commands";e("../stanza/command")}f.exports=function(e){e.disco.addFeature(n),e.disco.addItem({name:"Ad-Hoc Commands",node:n}),e.getCommands=function(f,o){return e.getDiscoItems(f,n,o)}}},{"../stanza/command":49}],12:[function(e,f){"use strict";f.exports=function(e){e.disco.addFeature("urn:xmpp:message-correct:0"),e.on("message",function(f){f.replace&&(e.emit("replace",f),e.emit("replace:"+f.id,f))})}},{}],13:[function(e,f){"use strict";e("../stanza/dataforms"),f.exports=function(e){e.disco.addFeature("jabber:x:data"),e.disco.addFeature("urn:xmpp:media-element"),e.on("message",function(f){f._extensions.form&&e.emit("dataform",f)})}},{"../stanza/dataforms":50}],14:[function(e,f){"use strict";e("../stanza/delayed");f.exports=function(e){e.disco.addFeature("urn:xmpp:delay")}},{"../stanza/delayed":51}],15:[function(e,f){"use strict";function n(e,f){var n="",o=e.features.sort(),d=[],u={},p=[];i.forEach(e.identities,function(e){d.push([e.category||"",e.type||"",e.lang||"",e.name||""].join("/"))});var s=d.length,c=o.length;if(d=i.unique(d,!0),o=i.unique(o,!0),c!=o.length||s!=d.length)return!1;n+=d.join("<")+"<",n+=o.join("<")+"<";var y=!1;if(i.forEach(e.extensions,function(e){for(var f=e.fields,n=0,o=f.length;o>n;n++)if("FORM_TYPE"==f[n].name&&"hidden"==f[n].type){var d=f[n].value;return u[d]?void(y=!0):(u[d]=e,void p.push(d))}}),y)return!1;p.sort(),i.forEach(p,function(e){var f=u[e],o={},d=[];n+="<"+e,i.forEach(f.fields,function(e){var f=e.name;if("FORM_TYPE"!=f){var n=e.value||"";"object"!=typeof n&&(n=n.split("\n")),o[f]=n.sort(),d.push(f)}}),d.sort(),i.forEach(d,function(e){n+="<"+e,i.forEach(o[e],function(e){n+="<"+e})})}),"sha-1"===f&&(f="sha1");var a=t.createHash(f).update(l.encode(n)).digest("base64"),r=4-a.length%4;4===r&&(r=0);for(var w=0;r>w;w++)a+="=";return a}function o(e,f,o){"sha-1"===f&&(f="sha1");var d=n(e,f);return d&&d==o}function d(){this.features={},this.identities={},this.extensions={},this.items={},this.caps={}}var i=e("underscore"),t=e("crypto");e("../stanza/disco"),e("../stanza/caps");var l={encode:function(e){return unescape(encodeURIComponent(e))},decode:function(e){return decodeURIComponent(escape(e))}};d.prototype={constructor:{value:d},addFeature:function(e,f){f=f||"",this.features[f]||(this.features[f]=[]),this.features[f].push(e)},addIdentity:function(e,f){f=f||"",this.identities[f]||(this.identities[f]=[]),this.identities[f].push(e)},addItem:function(e,f){f=f||"",this.items[f]||(this.items[f]=[]),this.items[f].push(e)},addExtension:function(e,f){f=f||"",this.extensions[f]||(this.extensions[f]=[]),this.extensions[f].push(e)}},f.exports=function(e){e.disco=new d(e),e.disco.addFeature("http://jabber.org/protocol/disco#info"),e.disco.addIdentity({category:"client",type:"web"}),e.getDiscoInfo=function(e,f,n){return this.sendIq({to:e,type:"get",discoInfo:{node:f}},n)},e.getDiscoItems=function(e,f,n){return this.sendIq({to:e,type:"get",discoItems:{node:f}},n)},e.updateCaps=function(){var f=this.config.capsNode||"https://stanza.io",o=JSON.parse(JSON.stringify({identities:this.disco.identities[""],features:this.disco.features[""],extensions:this.disco.extensions[""]})),d=n(o,"sha-1");return this.disco.caps={node:f,hash:"sha-1",ver:d},f=f+"#"+d,this.disco.features[f]=o.features,this.disco.identities[f]=o.identities,this.disco.extensions[f]=o.extensions,e.getCurrentCaps()},e.getCurrentCaps=function(){var f=e.disco.caps;if(!f.ver)return{ver:null,discoInfo:null};var n=f.node+"#"+f.ver;return{ver:f.ver,discoInfo:{identities:e.disco.identities[n],features:e.disco.features[n],extensions:e.disco.extensions[n]}}},e.on("presence",function(f){f._extensions.caps&&e.emit("disco:caps",f)}),e.on("iq:get:discoInfo",function(f){var n=f.discoInfo.node,o=f.discoInfo.node;n===e.disco.caps.node+"#"+e.disco.caps.ver&&(o=n,n=""),e.sendIq(f.resultReply({discoInfo:{node:o,identities:e.disco.identities[n]||[],features:e.disco.features[n]||[],extensions:e.disco.extensions[n]||[]}}))}),e.on("iq:get:discoItems",function(f){var n=f.discoInfo.node;e.sendIq(f.resultReply({discoItems:{node:n,items:e.disco.items[n]||[]}}))}),e.verifyVerString=o,e.generateVerString=n}},{"../stanza/caps":46,"../stanza/disco":52,crypto:133,underscore:228}],16:[function(e,f){"use strict";e("../stanza/extdisco");f.exports=function(e){e.disco.addFeature("urn:xmpp:extdisco:1"),e.getServices=function(e,f,n){return this.sendIq({type:"get",to:e,services:{type:f}},n)},e.getServiceCredentials=function(e,f,n){return this.sendIq({type:"get",to:e,credentials:{service:{host:f}}},n)}}},{"../stanza/extdisco":54}],17:[function(e,f){"use strict";e("../stanza/forwarded");f.exports=function(e){e.disco.addFeature("urn:xmpp:forward:0")}},{"../stanza/forwarded":55}],18:[function(e,f){"use strict";e("../stanza/geoloc");f.exports=function(e){e.disco.addFeature("http://jabber.org/protocol/geoloc"),e.disco.addFeature("http://jabber.org/protocol/geoloc+notify"),e.on("pubsub:event",function(f){f.event._extensions.updated&&"http://jabber.org/protocol/geoloc"===f.event.updated.node&&e.emit("geoloc",{jid:f.from,geoloc:f.event.updated.published[0].geoloc})}),e.publishGeoLoc=function(e,f){return this.publish("","http://jabber.org/protocol/geoloc",{geoloc:e},f)}}},{"../stanza/geoloc":57}],19:[function(e,f){"use strict";f.exports=function(e){e.disco.addFeature("urn:xmpp:hashes:1"),e.disco.addFeature("urn:xmpp:hash-function-text-names:md5"),e.disco.addFeature("urn:xmpp:hash-function-text-names:sha-1"),e.disco.addFeature("urn:xmpp:hash-function-text-names:sha-256")}},{}],20:[function(e,f){"use strict";f.exports=function(e){e.disco.addFeature("urn:xmpp:idle:1")}},{}],21:[function(e,f){"use strict";f.exports=function(f){f.use(e("./disco")),f.use(e("./attention")),f.use(e("./avatar")),f.use(e("./blocking")),f.use(e("./bookmarks")),f.use(e("./carbons")),f.use(e("./chatstates")),f.use(e("./command")),f.use(e("./correction")),f.use(e("./dataforms")),f.use(e("./delayed")),f.use(e("./extdisco")),f.use(e("./forwarding")),f.use(e("./geoloc")),f.use(e("./hashes")),f.use(e("./idle")),f.use(e("./invisible")),f.use(e("./jingle")),f.use(e("./json")),f.use(e("./keepalive")),f.use(e("./mam")),f.use(e("./muc")),f.use(e("./nick")),f.use(e("./oob")),f.use(e("./ping")),f.use(e("./private")),f.use(e("./psa")),f.use(e("./pubsub")),f.use(e("./reach")),f.use(e("./receipts")),f.use(e("./roster")),f.use(e("./time")),f.use(e("./vcard")),f.use(e("./version"))}},{"./attention":5,"./avatar":6,"./blocking":7,"./bookmarks":8,"./carbons":9,"./chatstates":10,"./command":11,"./correction":12,"./dataforms":13,"./delayed":14,"./disco":15,"./extdisco":16,"./forwarding":17,"./geoloc":18,"./hashes":19,"./idle":20,"./invisible":22,"./jingle":23,"./json":24,"./keepalive":25,"./mam":26,"./muc":27,"./nick":28,"./oob":29,"./ping":30,"./private":31,"./psa":32,"./pubsub":33,"./reach":34,"./receipts":35,"./roster":36,"./time":37,"./vcard":38,"./version":39}],22:[function(e,f){"use strict";e("../stanza/visibility"),f.exports=function(e){e.goInvisible=function(e){return this.sendIq({type:"set",invisible:!0},e)},e.goVisible=function(e){return this.sendIq({type:"set",visible:!0},e)}}},{"../stanza/visibility":86}],23:[function(e,f){"use strict";{var n=e("jingle");e("../stanza/jingle"),e("../stanza/rtp"),e("../stanza/iceUdp")}f.exports=function(e){var f=e.jingle=new n;f.capabilities.forEach(function(f){e.disco.addFeature(f)});var o=["outgoing","incoming","accepted","terminated","ringing","mute","unmute","hold","resumed"];o.forEach(function(n){f.on(n,function(f,o){e.emit("jingle:"+n,f,o)})}),f.on("localStream",function(f){e.emit("jingle:localstream:added",f)}),f.on("localStreamStopped",function(){e.emit("jingle:localstream:removed")}),f.on("peerStreamAdded",function(f,n){e.emit("jingle:remotestream:added",f,n)}),f.on("peerStreamRemoved",function(f,n){e.emit("jingle:remotestream:removed",f,n)}),f.on("send",function(f){e.sendIq(f)}),e.on("iq:set:jingle",function(e){e=e.toJSON(),f.process(e)}),e.on("unavailable",function(e){var n=e.from.full;f.endPeerSessions(n)}),e.call=function(n){n=n.full||n;var o=f.createMediaSession(n);return e.sendPresence({to:n}),o.start(),o},e.discoverICEServers=function(f){return this.getServices(e.config.server).then(function(f){for(var n=f.services.services,o=[],d=0;d<n.length;d++){var i=n[d],t={};"stun"===i.type?(t.url="stun:"+i.host,i.port&&(t.url+=":"+i.port),o.push(t),e.jingle.addICEServer(t)):"turn"===i.type&&(t.url="turn:"+i.host,i.port&&(t.url+=":"+i.port),i.transport&&"udp"!==i.transport&&(t.url+="?transport="+i.transport),i.username&&(t.username=i.username),i.password&&(t.credential=i.password),o.push(t),e.jingle.addICEServer(t))}return o}).nodeify(f)}}},{"../stanza/iceUdp":58,"../stanza/jingle":60,"../stanza/rtp":75,jingle:185}],24:[function(e,f){"use strict";e("../stanza/json");f.exports=function(e){e.disco.addFeature("urn:xmpp:json:tmp")}},{"../stanza/json":61}],25:[function(e,f){"use strict";function n(e,f){return new o(function(f,n){e.sm.started?(e.once("stream:management:ack",f),e.sm.request()):e.ping().then(f).catch(function(e){e.error&&"timeout"!==e.error.condition?f():n()})}).timeout(1e3*f||15e3)}var o=e("bluebird");f.exports=function(e){e.enableKeepAlive=function(f){function o(){e.sessionStarted&&n(e,f.timeout).catch(function(){e.sendStreamError({condition:"connection-timeout"})})}f=f||{},f.interval=f.interval||300,f.timeout=f.timeout||15,e._keepAliveInterval=setInterval(o,1e3*f.interval)},e.disableKeepAlive=function(){e._keepAliveInterval&&(clearInterval(e._keepAliveInterval),delete e._keepAliveInterval)},e.on("disconnected",function(){e.disableKeepAlive()})}},{bluebird:92}],26:[function(e,f){"use strict";var n=(e("../stanza/mam"),e("../jid"));f.exports=function(e){e.disco.addFeature("urn:xmpp:mam:tmp"),e.getHistory=function(f,o){var d=this,i=this.nextId();f=f||{},f.queryid=i;var t=f.to||"";delete f.to;var l=new n(t||e.jid.bare),u={};u[""]=!0,u[l.full]=!0,u[l.bare]=!0,u[l.domain]=!0,u[e.jid.bare]=!0,u[e.jid.domain]=!0;var p=[];return this.on("mam:"+i,"session",function(e){u[e.from.full]&&p.push(e)}),this.sendIq({type:"get",to:t,id:i,mamQuery:f}).then(function(e){return e.mamQuery.results=p,e}).finally(function(){d.off("mam:"+i)}).nodeify(o)},e.getHistoryPreferences=function(e){return this.sendIq({type:"get",mamPrefs:{}},e)},e.setHistoryPreferences=function(e,f){return this.sendIq({type:"set",mamPrefs:e},f)},e.on("message",function(f){f._extensions.mam&&e.emit("mam:"+f.mam.queryid,f)})}},{"../jid":4,"../stanza/mam":62}],27:[function(e,f){"use strict";var n=e("../jid");e("../stanza/muc"),f.exports=function(e){e.disco.addFeature("http://jabber.org/protocol/muc"),e.disco.addFeature("jabber:x:conference"),e.on("message",function(f){f._extensions.muc?(f._extensions.muc._extensions.invite&&e.emit("muc:invite",{from:f.muc.invite.from,room:f.from,reason:f.muc.invite.reason,password:f.muc.password,thread:f.muc.invite.thread,type:"mediated"}),f._extensions.muc._extensions.destroyed&&e.emit("muc:destroyed",{room:f.from,newRoom:f.muc.destroyed.jid,reason:f.muc.destroyed.reason,password:f.muc.password}),f._extensions.muc._extensions.decline&&e.emit("muc:declined",{room:f.from,from:f.muc.decline.from,reason:f.muc.decline.reason})):f._extensions.mucInvite&&e.emit("muc:invite",{from:f.from,room:f.mucInvite.jid,reason:f.mucInvite.reason,password:f.mucInvite.password,thread:f.mucInvite.thread,type:"direct"}),"groupchat"===f.type&&f.subject&&(e.emit("muc:subject",f),e.emit("groupchat:subject",f))}),e.on("presence",function(f){f._extensions.muc&&("error"==f.type?e.emit("muc:error",f):"unavailable"==f.type?e.emit("muc:leave",f):e.emit("muc:join",f))}),e.joinRoom=function(e,f,n){n=n||{},n.to=e+"/"+f,n.caps=this.disco.caps,n.joinMuc=n.joinMuc||{},this.sendPresence(n)},e.leaveRoom=function(e,f,n){n=n||{},n.to=e+"/"+f,n.type="unavailable",this.sendPresence(n)},e.ban=function(f,n,o,d){e.setRoomAffiliation(f,n,"outcast",o,d)},e.kick=function(f,n,o,d){e.setRoomRole(f,n,"none",o,d)},e.invite=function(f,n){e.sendMessage({to:f,muc:{invites:n}})},e.directInvite=function(f,n){n.jid=f,e.sendMessage({to:n.to,mucInvite:n})},e.declineInvite=function(f,n,o){e.sendMessage({to:f,muc:{decline:{to:n,reason:o}}})},e.changeNick=function(f,o){e.sendPresence({to:new n(f).bare+"/"+o})},e.setSubject=function(f,n){e.sendMessage({to:f,type:"groupchat",subject:n})},e.discoverReservedNick=function(f,n){e.getDiscoInfo(f,"x-roomuser-item",function(e,f){if(e)return n(e);var o=f.discoInfo.identities[0]||{};n(null,o.name)})},e.requestRoomVoice=function(f){e.sendMessage({to:f,form:{fields:[{name:"FORM_TYPE",value:"http://jabber.org/protocol/muc#request"},{name:"muc#role",type:"text-single",value:"participant"}]}})},e.setRoomAffiliation=function(e,f,n,o,d){return this.sendIq({type:"set",to:e,mucAdmin:{jid:f,affiliation:n,reason:o}},d)},e.setRoomRole=function(e,f,n,o,d){return this.sendIq({type:"set",to:e,mucAdmin:{nick:f,role:n,reason:o}},d)},e.getRoomMembers=function(e,f,n){return this.sendIq({type:"get",to:e,mucAdmin:f},n)},e.getRoomConfig=function(e,f){return this.sendIq({to:e,type:"get",mucOwner:{}},f)},e.configureRoom=function(e,f,n){return f.type||(f.type="submit"),this.sendIq({to:e,type:"set",mucOwner:{form:f}},n)}}},{"../jid":4,"../stanza/muc":64}],28:[function(e,f){"use strict";var n=(e("../stanza/nick"),"http://jabber.org/protocol/nick");f.exports=function(e){e.disco.addFeature(n),e.disco.addFeature(n+"+notify"),e.on("pubsub:event",function(f){f.event._extensions.updated&&f.event.updated.node===n&&e.emit("nick",{jid:f.from,nick:f.event.updated.published[0].nick})}),e.publishNick=function(e,f){return this.publish("",n,{nick:e},f)}}},{"../stanza/nick":65}],29:[function(e,f){"use strict";e("../stanza/oob");f.exports=function(e){e.disco.addFeature("jabber:x:oob")}},{"../stanza/oob":66}],30:[function(e,f){"use strict";e("../stanza/ping");f.exports=function(e){e.disco.addFeature("urn:xmpp:ping"),e.on("iq:get:ping",function(f){e.sendIq(f.resultReply())}),e.ping=function(e){return this.sendIq({to:e,type:"get",ping:{}})}}},{"../stanza/ping":67}],31:[function(e,f){"use strict";e("../stanza/private");f.exports=function(e){e.getPrivateData=function(e,f){return this.sendIq({type:"get",privateStorage:e},f)},e.setPrivateData=function(e,f){return this.sendIq({type:"set",privateStorage:e},f)}}},{"../stanza/private":69}],32:[function(e,f){"use strict";e("../stanza/psa"),f.exports=function(e){e.disco.addFeature("urn:xmpp:psa")}},{"../stanza/psa":70}],33:[function(e,f){"use strict";e("../stanza/pubsub");f.exports=function(e){e.on("message",function(f){f._extensions.event&&(e.emit("pubsub:event",f),e.emit("pubsubEvent",f)) | |
}),e.subscribeToNode=function(f,n,o){return this.sendIq({type:"set",to:f,pubsub:{subscribe:{node:n.node,jid:n.jid||e.jid}}},o)},e.unsubscribeFromNode=function(f,n,o){return this.sendIq({type:"set",to:f,pubsub:{unsubscribe:{node:n.node,jid:n.jid||e.jid.split("/")[0]}}},o)},e.publish=function(e,f,n,o){return this.sendIq({type:"set",to:e,pubsub:{publish:{node:f,item:n}}},o)},e.getItem=function(e,f,n,o){return this.sendIq({type:"get",to:e,pubsub:{retrieve:{node:f,item:n}}},o)},e.getItems=function(e,f,n,o){return n=n||{},n.node=f,this.sendIq({type:"get",to:e,pubsub:{retrieve:{node:f,max:n.max},rsm:n.rsm}},o)},e.retract=function(e,f,n,o,d){return this.sendIq({type:"set",to:e,pubsub:{retract:{node:f,notify:o,id:n}}},d)},e.purgeNode=function(e,f,n){return this.sendIq({type:"set",to:e,pubsubOwner:{purge:f}},n)},e.deleteNode=function(e,f,n){return this.sendIq({type:"set",to:e,pubsubOwner:{del:f}},n)},e.createNode=function(e,f,n,o){var d={type:"set",to:e,pubsubOwner:{create:f}};return n&&(d.pubsubOwner.config={form:n}),this.sendIq(d,o)}}},{"../stanza/pubsub":71}],34:[function(e,f){"use strict";e("../stanza/reach");f.exports=function(e){e.disco.addFeature("urn:xmpp:reach:0"),e.disco.addFeature("urn:xmpp:reach:0+notify"),e.on("pubsub:event",function(f){f.event._extensions.updated&&"urn:xmpp:reach:0"===f.event.updated.node&&e.emit("reachability",{jid:f.from,addresses:f.event.updated.published[0].reach})}),e.on("presence",function(f){f.reach.length&&e.emit("reachability",{jid:f.from,addresses:f.reach})}),e.publishReachability=function(e,f){return this.publish("","urn:xmpp:reach:0",{reach:e},f)}}},{"../stanza/reach":72}],35:[function(e,f){"use strict";f.exports=function(e){e.disco.addFeature("urn:xmpp:receipts"),e.on("message",function(f){var n={normal:!0,chat:!0,headline:!0};n[f.type]&&f.requestReceipt&&!f.receipt&&e.sendMessage({to:f.from,receipt:f.id,id:f.id}),f.receipt&&(e.emit("receipt",f),e.emit("receipt:"+f.receipt))})}},{}],36:[function(e,f){"use strict";e("../stanza/roster");f.exports=function(e){e.on("iq:set:roster",function(f){var n={};return n[""]=!0,n[e.jid.bare]=!0,n[e.jid.domain]=!0,n[f.from.full]?(e.emit("roster:update",f),void e.sendIq({id:f.id,type:"result"})):e.sendIq(f.errorReply({error:{type:"cancel",condition:"service-unavailable"}}))}),e.getRoster=function(f){var n=this;return f=f||function(){},e.sendIq({type:"get",roster:{ver:n.config.rosterVer}}).then(function(e){var f=e.roster.ver;return f&&(n.config.rosterVer=f,n.emit("roster:ver",f)),e}).nodeify(f)},e.updateRosterItem=function(f,n){return e.sendIq({type:"set",roster:{items:[f]}},n)},e.removeRosterItem=function(f,n){return e.updateRosterItem({jid:f,subscription:"remove"},n)},e.subscribe=function(f){e.sendPresence({type:"subscribe",to:f})},e.unsubscribe=function(f){e.sendPresence({type:"unsubscribe",to:f})},e.acceptSubscription=function(f){e.sendPresence({type:"subscribed",to:f})},e.denySubscription=function(f){e.sendPresence({type:"unsubscribed",to:f})}}},{"../stanza/roster":73}],37:[function(e,f){"use strict";e("../stanza/time");f.exports=function(e){e.disco.addFeature("urn:xmpp:time"),e.getTime=function(e,f){return this.sendIq({to:e,type:"get",time:!0},f)},e.on("iq:get:time",function(f){var n=new Date;e.sendIq(f.resultReply({time:{utc:n,tzo:n.getTimezoneOffset()}}))})}},{"../stanza/time":82}],38:[function(e,f){"use strict";e("../stanza/vcard");f.exports=function(e){e.disco.addFeature("vcard-temp"),e.getVCard=function(e,f){return this.sendIq({to:e,type:"get",vCardTemp:{}},f)},e.publishVCard=function(e,f){return this.sendIq({type:"set",vCardTemp:e},f)}}},{"../stanza/vcard":84}],39:[function(e,f){"use strict";e("../stanza/version"),f.exports=function(e){e.disco.addFeature("jabber:iq:version"),e.on("iq:get:version",function(f){e.sendIq(f.resultReply({version:e.config.version||{name:"stanza.io"}}))}),e.getSoftwareVersion=function(e,f){return this.sendIq({to:e,type:"get",version:{}},f)}}},{"../stanza/version":85}],40:[function(e,f){"use strict";function n(e,f){return(e%f+f)%f}function o(){this.conn=null,this.id=!1,this.allowResume=!0,this.started=!1,this.lastAck=0,this.handled=0,this.windowSize=1,this.unacked=[],this.pendingAck=!1}var d=e("./stanza/sm"),i=Math.pow(2,32);o.prototype={constructor:{value:o},enable:function(e){this.conn=e;var f=new d.Enable;f.resume=this.allowResume,this.conn.send(f),this.handled=0,this.started=!0},resume:function(e){this.conn=e;var f=new d.Resume({h:this.handled,previd:this.id});this.conn.send(f),this.started=!0},enabled:function(e){this.id=e.id},resumed:function(e){this.id=e.id,e.h&&this.process(e,!0)},failed:function(){this.started=!1,this.id=!1,this.lastAck=0,this.handled=0,this.unacked=[]},ack:function(){this.conn.send(new d.Ack({h:this.handled}))},request:function(){this.pendingAck=!0,this.conn.send(new d.Request)},process:function(e,f){var o=this,d=n(e.h-this.lastAck,i);this.pendingAck=!1;for(var t=0;d>t&&this.unacked.length>0;t++)this.conn.emit("stanza:acked",this.unacked.shift());if(this.lastAck=e.h,f){var l=this.unacked;this.unacked=[],l.forEach(function(e){o.conn.send(e)})}this.needAck()&&this.request()},track:function(e){var f=e._name,n={message:!0,presence:!0,iq:!0};this.started&&n[f]&&(this.unacked.push(e),this.needAck()&&this.request())},handle:function(){this.started&&(this.handled=n(this.handled+1,i))},needAck:function(){return!this.pendingAck&&this.unacked.length>=this.windowSize}},f.exports=o},{"./stanza/sm":78}],41:[function(e,f){"use strict";var n=e("underscore"),o=e("jxt"),d=e("./pubsub").Item,i=e("./pubsub").EventItem,t=f.exports=o.define({name:"avatar",namespace:"urn:xmpp:avatar:metadata",element:"info",fields:{id:o.attribute("id"),bytes:o.attribute("bytes"),height:o.attribute("height"),width:o.attribute("width"),type:o.attribute("type","image/png"),url:o.attribute("url")}}),l={get:function(){var e=o.find(this.xml,"urn:xmpp:avatar:metadata","metadata"),f=[];if(e.length){var d=o.find(e[0],"urn:xmpp:avatar:metadata","info");n.forEach(d,function(e){f.push(new t({},e))})}return f},set:function(e){var f=o.findOrCreate(this.xml,"urn:xmpp:avatar:metadata","metadata");o.setAttribute(f,"xmlns","urn:xmpp:avatar:metadata"),n.forEach(e,function(e){var n=new t(e);f.appendChild(n.xml)})}};o.add(d,"avatars",l),o.add(i,"avatars",l),o.add(d,"avatarData",o.subText("urn:xmpp:avatar:data","data")),o.add(i,"avatarData",o.subText("urn:xmpp:avatar:data","data"))},{"./pubsub":71,jxt:204,underscore:228}],42:[function(e,f){var n=e("jxt"),o=e("./iq"),d=e("./streamFeatures"),i=e("./util"),t="urn:ietf:params:xml:ns:xmpp-bind",l=f.exports=n.define({name:"bind",namespace:t,element:"bind",fields:{resource:n.subText(t,"resource"),jid:i.jidSub(t,"jid")}});n.extend(o,l),n.extend(d,l)},{"./iq":59,"./streamFeatures":81,"./util":83,jxt:204}],43:[function(e,f,n){"use strict";var o=e("jxt"),d=(e("./util"),e("./iq")),i=e("../jid"),t="urn:xmpp:blocking",l={get:function(){var e=[],f=o.find(this.xml,t,"item");return f.length?(f.forEach(function(f){e.push(new i(o.getAttribute(f,"jid","")))}),e):e},set:function(e){var f=this;e.forEach(function(e){var n=o.createElement(t,"item",t);o.setAttribute(n,"jid",e.toString()),f.xml.appendChild(n)})}};n.Block=o.define({name:"block",namespace:t,element:"block",fields:{jids:l}}),n.Unblock=o.define({name:"unblock",namespace:t,element:"unblock",fields:{jids:l}}),n.BlockList=o.define({name:"blockList",namespace:t,element:"blocklist",fields:{jids:l}}),o.extend(d,n.Block),o.extend(d,n.Unblock),o.extend(d,n.BlockList)},{"../jid":4,"./iq":59,"./util":83,jxt:204}],44:[function(e,f){var n=e("jxt"),o=e("./util"),d=e("./private"),i=n.define({name:"conference",namespace:"storage:bookmarks",element:"conference",fields:{name:n.attribute("name"),autoJoin:n.boolAttribute("autojoin"),jid:o.jidAttribute("jid"),nick:n.subText("storage:bookmarks","nick")}}),t=f.exports=n.define({name:"bookmarks",namespace:"storage:bookmarks",element:"storage"});n.extend(d,t),n.extend(t,i,"conferences")},{"./private":69,"./util":83,jxt:204}],45:[function(e,f){"use strict";var n=e("jxt"),o=e("./util"),d="http://jabber.org/protocol/httpbind",i="urn:xmpp:xbosh";f.exports=n.define({name:"bosh",namespace:d,element:"body",prefixes:{xmpp:i},fields:{accept:n.attribute("accept"),ack:n.numberAttribute("ack"),authid:n.attribute("authid"),charsets:n.attribute("charsets"),condition:n.attribute("condition"),content:n.attribute("content"),from:o.jidAttribute("from"),hold:n.numberAttribute("hold"),inactivity:n.numberAttribute("inactivity"),key:n.attribute("key"),maxpause:n.numberAttribute("maxpause"),newKey:n.attribute("newkey"),pause:n.numberAttribute("pause"),polling:n.numberAttribute("polling"),resport:n.numberAttribute("report"),requests:n.numberAttribute("requests"),rid:n.numberAttribute("rid"),sid:n.attribute("sid"),stream:n.attribute("stream"),time:n.attribute("time"),to:o.jidAttribute("to"),type:n.attribute("type"),ver:n.attribute("ver"),wait:n.numberAttribute("wait"),uri:n.subText(d,"uri"),lang:n.langAttribute(),version:n.attribute("xmpp:version","1.0"),restart:n.attribute("xmpp:restart"),restartLogic:n.boolAttribute("xmpp:restartLogic"),payload:{get:function(){for(var e=[],f=0,o=this.xml.childNodes.length;o>f;f++){var d=n.build(this.xml.childNodes[f]);void 0!==d&&e.push(d)}return e},set:function(e){var f=this;e.forEach(function(e){f.xml.appendChild(e.xml)})}}}})},{"./util":83,jxt:204}],46:[function(e,f){var n=e("jxt"),o=e("./presence"),d=e("./streamFeatures"),i=f.exports=n.define({name:"caps",namespace:"http://jabber.org/protocol/caps",element:"c",fields:{ver:n.attribute("ver"),node:n.attribute("node"),hash:n.attribute("hash"),ext:n.attribute("ext")}});n.extend(o,i),n.extend(d,i)},{"./presence":68,"./streamFeatures":81,jxt:204}],47:[function(e,f,n){var o=e("jxt"),d=e("./message"),i=e("./iq"),t=e("./forwarded");n.Sent=o.define({name:"carbonSent",eventName:"carbon:sent",namespace:"urn:xmpp:carbons:2",element:"sent"}),n.Received=o.define({name:"carbonReceived",eventName:"carbon:received",namespace:"urn:xmpp:carbons:2",element:"received"}),n.Private=o.define({name:"carbonPrivate",eventName:"carbon:private",namespace:"urn:xmpp:carbons:2",element:"private"}),n.Enable=o.define({name:"enableCarbons",namespace:"urn:xmpp:carbons:2",element:"enable"}),n.Disable=o.define({name:"disableCarbons",namespace:"urn:xmpp:carbons:2",element:"disable"}),o.extend(n.Sent,t),o.extend(n.Received,t),o.extend(d,n.Sent),o.extend(d,n.Received),o.extend(d,n.Private),o.extend(i,n.Enable),o.extend(i,n.Disable)},{"./forwarded":55,"./iq":59,"./message":63,jxt:204}],48:[function(e){"use strict";var f=e("jxt"),n=e("./message"),o="http://jabber.org/protocol/chatstates",d=f.define({name:"chatStateActive",eventName:"chat:active",namespace:o,element:"active"}),i=f.define({name:"chatStateComposing",eventName:"chat:composing",namespace:o,element:"composing"}),t=f.define({name:"chatStatePaused",eventName:"chat:paused",namespace:o,element:"paused"}),l=f.define({name:"chatStateInactive",eventName:"chat:inactive",namespace:o,element:"inactive"}),u=f.define({name:"chatStateGone",eventName:"chat:gone",namespace:o,element:"gone"});f.extend(n,d),f.extend(n,i),f.extend(n,t),f.extend(n,l),f.extend(n,u),f.add(n,"chatState",{get:function(){for(var e=this,f=["Active","Composing","Paused","Inactive","Gone"],n=0;n<f.length;n++)if(e._extensions["chatState"+f[n]])return f[n].toLowerCase();return""},set:function(e){var f=this,n=["Active","Composing","Paused","Inactive","Gone"];n.forEach(function(e){f._extensions["chatState"+e]&&(f.xml.removeChild(f._extensions["chatState"+e].xml),delete f._extensions["chatState"+e])}),e&&this["chatState"+e.charAt(0).toUpperCase()+e.slice(1)]}})},{"./message":63,jxt:204}],49:[function(e,f){"use strict";var n=e("jxt"),o=e("./dataforms").DataForm,d=e("./error"),i=e("./iq"),t="http://jabber.org/protocol/commands",l=["next","prev","complete","cancel"],u=["bad-action","bad-locale","bad-payload","bad-sessionid","malformed-action","session-expired"],p=f.exports=n.define({name:"command",namespace:t,element:"command",fields:{action:n.attribute("action"),node:n.attribute("node"),sessionid:n.attribute("sessionid"),status:n.attribute("status"),noteType:n.subAttribute(t,"note","type"),note:n.subText(t,"note"),execute:n.subAttribute(t,"actions","execute"),actions:{get:function(){var e=[],f=n.find(this.xml,t,"actions");return f.length?(l.forEach(function(o){var d=n.find(f[0],t,o);d.length&&e.push(o)}),e):[]},set:function(e){for(var f=n.findOrCreate(this.xml,t,"actions"),o=0,d=f.childNodes.length;d>o;o++)f.removeChild(f.childNodes[o]);e.forEach(function(e){f.appendChild(n.createElement(t,e.toLowerCase(),t))})}}}});n.add(d,"adhocCommandCondition",{get:function(){var e=this,f=[];return u.forEach(function(o){var d=n.find(e.xml,t,o);d.length&&f.push(d[0].tagName)}),f[0]||""},set:function(e){var f=this;if(u.forEach(function(e){var o=n.find(f.xml,t,e);o.length&&f.xml.removeChild(o[0])}),e){var o=n.createElement(t,e);this.xml.appendChild(o)}}}),n.extend(i,p),n.extend(p,o)},{"./dataforms":50,"./error":53,"./iq":59,jxt:204}],50:[function(e,f,n){"use strict";var o=(e("underscore"),e("jxt")),d=(e("./util"),e("./message")),i="jabber:x:data",t="urn:xmpp:media-element";n.DataForm=o.define({name:"form",namespace:i,element:"x",fields:{title:o.subText(i,"title"),instructions:o.multiSubText(i,"instructions"),type:o.attribute("type","form")}}),n.Field=o.define({name:"_field",namespace:i,element:"field",init:function(e){this._type=(e||{}).type||this.type},fields:{type:{get:function(){return o.getAttribute(this.xml,"type","text-single")},set:function(e){this._type=e,o.setAttribute(this.xml,"type",e)}},name:o.attribute("var"),desc:o.subText(i,"desc"),required:o.boolSub(i,"required"),label:o.attribute("label"),value:{get:function(){var e=o.getMultiSubText(this.xml,i,"value");return"boolean"===this._type?"1"===e[0]||"true"===e[0]:e.length>1?"text-multi"===this._type?e.join("\n"):e:e[0]},set:function(e){"boolean"===this._type?o.setSubText(this.xml,i,"value",e?"1":"0"):("text-multi"===this._type&&(e=e.split("\n")),o.setMultiSubText(this.xml,i,"value",e))}},options:{get:function(){return o.getMultiSubText(this.xml,i,"option",function(e){return o.getSubText(e,i,"value")})},set:function(e){var f=this;o.setMultiSubText(this.xml,i,"option",e,function(e){var n=o.createElement(i,"option",i),d=o.createElement(i,"value",i);n.appendChild(d),d.textContent=e,f.xml.appendChild(n)})}}}}),n.Media=o.define({name:"media",element:"media",namespace:t,fields:{height:o.numberAttribute("height"),width:o.numberAttribute("width")}}),n.MediaURI=o.define({name:"_mediaURI",element:"uri",namespace:t,fields:{uri:o.text(),type:o.attribute("type")}}),o.extend(d,n.DataForm),o.extend(n.DataForm,n.Field,"fields"),o.extend(n.Field,n.Media),o.extend(n.Media,n.MediaURI,"uris")},{"./message":63,"./util":83,jxt:204,underscore:228}],51:[function(e,f){var n=e("jxt"),o=e("./message"),d=e("./presence"),i=e("./util"),t=f.exports=n.define({name:"delay",namespace:"urn:xmpp:delay",element:"delay",fields:{from:i.jidAttribute("from"),stamp:n.dateAttribute("stamp"),reason:n.text()}});n.extend(o,t),n.extend(d,t)},{"./message":63,"./presence":68,"./util":83,jxt:204}],52:[function(e,f,n){"use strict";var o=(e("underscore"),e("jxt")),d=e("../jid"),i=e("./iq"),t=e("./rsm"),l=e("./dataforms").DataForm;n.DiscoInfo=o.define({name:"discoInfo",namespace:"http://jabber.org/protocol/disco#info",element:"query",fields:{node:o.attribute("node"),identities:{get:function(){var e=[],f=o.find(this.xml,this._NS,"identity");return f.forEach(function(f){e.push({category:o.getAttribute(f,"category"),type:o.getAttribute(f,"type"),lang:f.getAttributeNS(o.XML_NS,"lang"),name:o.getAttribute(f,"name")})}),e},set:function(e){var f=this,n=o.find(this.xml,this._NS,"identity");n.forEach(function(e){f.xml.removeChild(e)}),e.forEach(function(e){var n=o.createElement(f._NS,"identity",f._NS);o.setAttribute(n,"category",e.category),o.setAttribute(n,"type",e.type),o.setAttribute(n,"name",e.name),e.lang&&n.setAttributeNS(o.XML_NS,"lang",e.lang),f.xml.appendChild(n)})}},features:{get:function(){var e=[],f=o.find(this.xml,this._NS,"feature");return f.forEach(function(f){e.push(f.getAttribute("var"))}),e},set:function(e){var f=this,n=o.find(this.xml,this._NS,"feature");n.forEach(function(e){f.xml.removeChild(e)}),e.forEach(function(e){var n=o.createElement(f._NS,"feature",f._NS);n.setAttribute("var",e),f.xml.appendChild(n)})}}}}),n.DiscoItems=o.define({name:"discoItems",namespace:"http://jabber.org/protocol/disco#items",element:"query",fields:{node:o.attribute("node"),items:{get:function(){var e=[],f=o.find(this.xml,this._NS,"item");return f.forEach(function(f){e.push({jid:new d(o.getAttribute(f,"jid")),node:o.getAttribute(f,"node"),name:o.getAttribute(f,"name")})}),e},set:function(e){var f=this,n=o.find(this.xml,this._NS,"item");n.forEach(function(e){f.xml.removeChild(e)}),e.forEach(function(e){var n=o.createElement(f._NS,"item",f._NS);e.jid&&o.setAttribute(n,"jid",e.jid.toString()),o.setAttribute(n,"node",e.node),o.setAttribute(n,"name",e.name),f.xml.appendChild(n)})}}}}),o.extend(i,n.DiscoInfo),o.extend(i,n.DiscoItems),o.extend(n.DiscoItems,t),o.extend(n.DiscoInfo,l,"extensions")},{"../jid":4,"./dataforms":50,"./iq":59,"./rsm":74,jxt:204,underscore:228}],53:[function(e,f){"use strict";var n=(e("underscore"),e("jxt")),o=e("./util"),d=e("./message"),i=e("./presence"),t=e("./iq"),l="urn:ietf:params:xml:ns:xmpp-stanzas",u=["bad-request","conflict","feature-not-implemented","forbidden","gone","internal-server-error","item-not-found","jid-malformed","not-acceptable","not-allowed","not-authorized","payment-required","recipient-unavailable","redirect","registration-required","remote-server-not-found","remote-server-timeout","resource-constraint","service-unavailable","subscription-required","undefined-condition","unexpected-request"],p=f.exports=n.define({name:"error",namespace:"jabber:client",element:"error",fields:{lang:{get:function(){return(this.parent||{}).lang||""}},condition:{get:function(){var e=this,f=[];return u.forEach(function(o){var d=n.find(e.xml,l,o);d.length&&f.push(d[0].tagName)}),f[0]||""},set:function(e){var f=this;if(u.forEach(function(e){var o=n.find(f.xml,l,e);o.length&&f.xml.removeChild(o[0])}),e){var o=n.createElement(l,e);this.xml.appendChild(o)}}},gone:{get:function(){return n.getSubText(this.xml,l,"gone")},set:function(e){this.condition="gone",n.setSubText(this.xml,l,"gone",e)}},redirect:{get:function(){return n.getSubText(this.xml,l,"redirect")},set:function(e){this.condition="redirect",n.setSubText(this.xml,l,"redirect",e)}},code:n.attribute("code"),type:n.attribute("type"),by:o.jidAttribute("by"),$text:{get:function(){return n.getSubLangText(this.xml,l,"text",this.lang)}},text:{get:function(){var e=this.$text;return e[this.lang]||""},set:function(e){n.setSubLangText(this.xml,l,"text",e,this.lang)}}}});n.extend(d,p),n.extend(i,p),n.extend(t,p)},{"./iq":59,"./message":63,"./presence":68,"./util":83,jxt:204,underscore:228}],54:[function(e,f,n){var o=e("jxt"),d=e("./iq"),i=e("./dataforms").DataForm,t="urn:xmpp:extdisco:1",l=n.Services=o.define({name:"services",namespace:t,element:"services",fields:{type:o.attribute("type")}}),u=n.Credentials=o.define({name:"credentials",namespace:t,element:"credentials"}),p=o.define({name:"service",namespace:t,element:"service",fields:{host:o.attribute("host"),port:o.attribute("port"),transport:o.attribute("transport"),type:o.attribute("type"),username:o.attribute("username"),password:o.attribute("password")}});o.extend(l,p,"services"),o.extend(u,p),o.extend(p,i),o.extend(d,l),o.extend(d,u)},{"./dataforms":50,"./iq":59,jxt:204}],55:[function(e,f){var n=e("jxt"),o=e("./message"),d=e("./presence"),i=e("./iq"),t=e("./delayed"),l=f.exports=n.define({name:"forwarded",eventName:"forward",namespace:"urn:xmpp:forward:0",element:"forwarded"});n.extend(o,l),n.extend(l,o),n.extend(l,d),n.extend(l,i),n.extend(l,t)},{"./delayed":51,"./iq":59,"./message":63,"./presence":68,jxt:204}],56:[function(e,f,n){"use strict";var o=e("jxt"),d=e("./util"),i="urn:ietf:params:xml:ns:xmpp-framing";n.Open=o.define({name:"openStream",namespace:i,element:"open",topLevel:!0,fields:{lang:o.langAttribute(),id:o.attribute("id"),version:o.attribute("version","1.0"),to:d.jidAttribute("to"),from:d.jidAttribute("from")}}),n.Close=o.define({name:"closeStream",namespace:i,element:"close",topLevel:!0,fields:{seeOtherURI:o.attribute("see-other-uri")}})},{"./util":83,jxt:204}],57:[function(e,f){"use strict";var n=e("jxt"),o=e("./pubsub").Item,d=e("./pubsub").EventItem,i="http://jabber.org/protocol/geoloc",t=f.exports=n.define({name:"geoloc",namespace:i,element:"geoloc",fields:{accuracy:n.numberSub(i,"accuracy",!0),altitude:n.numberSub(i,"alt",!0),area:n.subText(i,"area"),heading:n.numberSub(i,"bearing",!0),bearing:n.numberSub(i,"bearing",!0),building:n.subText(i,"building"),country:n.subText(i,"country"),countrycode:n.subText(i,"countrycode"),datum:n.subText(i,"datum"),description:n.subText(i,"description"),error:n.numberSub(i,"error",!0),floor:n.subText(i,"floor"),latitude:n.numberSub(i,"lat",!0),locality:n.subText(i,"locality"),longitude:n.numberSub(i,"lon",!0),postalcode:n.subText(i,"postalcode"),region:n.subText(i,"region"),room:n.subText(i,"room"),speed:n.numberSub(i,"speed",!0),street:n.subText(i,"street"),text:n.subText(i,"text"),timestamp:n.dateSub(i,"timestamp"),uri:n.subText(i,"uri")}});n.extend(o,t),n.extend(d,t)},{"./pubsub":71,jxt:204}],58:[function(e,f,n){var o=(e("underscore"),e("jxt")),d=(e("./util"),e("./jingle")),i="urn:xmpp:jingle:transports:ice-udp:1";n.ICEUDP=o.define({name:"_iceUdp",namespace:i,element:"transport",fields:{transType:{value:"iceUdp"},pwd:o.attribute("pwd"),ufrag:o.attribute("ufrag")}}),n.RemoteCandidate=o.define({name:"remoteCandidate",namespace:i,element:"remote-candidate",fields:{component:o.attribute("component"),ip:o.attribute("ip"),port:o.attribute("port")}}),n.Candidate=o.define({name:"_iceUdpCandidate",namespace:i,element:"candidate",fields:{component:o.attribute("component"),foundation:o.attribute("foundation"),generation:o.attribute("generation"),id:o.attribute("id"),ip:o.attribute("ip"),network:o.attribute("network"),port:o.attribute("port"),priority:o.attribute("priority"),protocol:o.attribute("protocol"),relAddr:o.attribute("rel-addr"),relPort:o.attribute("rel-port"),type:o.attribute("type")}}),n.Fingerprint=o.define({name:"_iceFingerprint",namespace:"urn:xmpp:tmp:jingle:apps:dtls:0",element:"fingerprint",fields:{hash:o.attribute("hash"),value:o.text(),required:o.boolAttribute("required")}}),o.extend(d.Content,n.ICEUDP),o.extend(n.ICEUDP,n.Candidate,"candidates"),o.extend(n.ICEUDP,n.RemoteCandidate),o.extend(n.ICEUDP,n.Fingerprint,"fingerprints")},{"./jingle":60,"./util":83,jxt:204,underscore:228}],59:[function(e,f){"use strict";var n=e("jxt"),o=e("./util"),d=f.exports=n.define({name:"iq",namespace:"jabber:client",element:"iq",topLevel:!0,fields:{lang:n.langAttribute(),id:n.attribute("id"),to:o.jidAttribute("to"),from:o.jidAttribute("from"),type:n.attribute("type")}});d.prototype.resultReply=function(e){return e=e||{},e.to=this.from,e.id=this.id,e.type="result",new d(e)},d.prototype.errorReply=function(e){return e=e||{},e.to=this.from,e.id=this.id,e.type="error",new d(e)}},{"./util":83,jxt:204}],60:[function(e,f,n){"use strict";var o=(e("underscore"),e("jxt")),d=(e("./util"),e("./iq")),i=e("./error"),t="urn:xmpp:jingle:1",l="urn:xmpp:jingle:errors:1",u=["out-of-order","tie-break","unknown-session","unsupported-info"],p=["alternative-session","busy","cancel","connectivity-error","decline","expired","failed-application","failed-transport","general-error","gone","incompatible-parameters","media-error","security-error","success","timeout","unsupported-applications","unsupported-transports"];n.Jingle=o.define({name:"jingle",namespace:t,element:"jingle",fields:{action:o.attribute("action"),initiator:o.attribute("initiator"),responder:o.attribute("responder"),sid:o.attribute("sid")}}),n.Content=o.define({name:"_jingleContent",namespace:t,element:"content",fields:{creator:o.attribute("creator"),disposition:o.attribute("disposition","session"),name:o.attribute("name"),senders:o.attribute("senders","both"),description:{get:function(){for(var e=["_rtp"],f=0;f<e.length;f++)if(this._extensions[e[f]])return this._extensions[e[f]]},set:function(e){var f="_"+e.descType;this[f]=e}},transport:{get:function(){for(var e=["_iceUdp"],f=0;f<e.length;f++)if(this._extensions[e[f]])return this._extensions[e[f]]},set:function(e){var f="_"+e.transType;this[f]=e}}}}),n.Reason=o.define({name:"reason",namespace:t,element:"reason",fields:{condition:{get:function(){var e=this,f=[];return p.forEach(function(n){var d=o.find(e.xml,t,n);d.length&&f.push(d[0].tagName)}),f[0]||""},set:function(e){var f=this;if(p.forEach(function(e){var n=o.find(f.xml,t,e);n.length&&f.xml.removeChild(n[0])}),e){var n=o.createElement(t,e,t);this.xml.appendChild(n)}}},alternativeSession:{get:function(){return o.getSubText(this.xml,t,"alternative-session")},set:function(e){this.condition="alternative-session",o.setSubText(this.xml,t,"alternative-session",e)}},text:o.subText(t,"text")}}),o.add(i,"jingleCondition",{get:function(){var e=this,f=[];return u.forEach(function(n){var d=o.find(e.xml,l,n);d.length&&f.push(d[0].tagName)}),f[0]||""},set:function(e){var f=this;if(u.forEach(function(e){var n=o.find(f.xml,l,e);n.length&&f.xml.removeChild(n[0])}),e){var n=o.createElement(l,e);this.xml.appendChild(n)}}}),o.extend(d,n.Jingle),o.extend(n.Jingle,n.Content,"contents"),o.extend(n.Jingle,n.Reason)},{"./error":53,"./iq":59,"./util":83,jxt:204,underscore:228}],61:[function(e,f){"use strict";var n=e("jxt"),o=e("./message"),d=e("./pubsub").Item,i=e("./pubsub").EventItem,t=f.exports={get:function(){var e=n.getSubText(this.xml,"urn:xmpp:json:0","json");return e?JSON.parse(e):void 0},set:function(e){e=JSON.stringify(e),e&&n.setSubText(this.xml,"urn:xmpp:json:0","json",e)}};n.add(o,"json",t),n.add(d,"json",t),n.add(i,"json",t)},{"./message":63,"./pubsub":71,jxt:204}],62:[function(e,f,n){"use strict";var o=e("jxt"),d=e("./util"),i=e("./message"),t=e("./iq"),l=e("./forwarded"),u=e("./rsm"),p=e("../jid");n.MAMQuery=o.define({name:"mamQuery",namespace:"urn:xmpp:mam:tmp",element:"query",fields:{queryid:o.attribute("queryid"),start:o.dateSub("urn:xmpp:mam:tmp","start"),end:o.dateSub("urn:xmpp:mam:tmp","end"),"with":d.jidSub("urn:xmpp:mam:tmp","with")}}),n.Result=o.define({name:"mam",eventName:"mam:result",namespace:"urn:xmpp:mam:tmp",element:"result",fields:{queryid:o.attribute("queryid"),id:o.attribute("id")}}),n.Archived=o.define({name:"mamArchived",namespace:"urn:xmpp:mam:tmp",element:"archived",fields:{by:d.jidAttribute("by"),id:o.attribute("id")}}),n.Prefs=o.define({name:"mamPrefs",namespace:"urn:xmpp:mam:tmp",element:"prefs",fields:{defaultCondition:o.attribute("default"),always:{get:function(){var e=[],f=o.find(this.xml,this._NS,"always");if(0===f.length)return e;f=f[0];var n=o.getMultiSubText(f,this._NS,"jid");return n.forEach(function(f){e.push(new p(f.textContent))}),e},set:function(e){if(e.length>0){var f=o.find(this.xml,this._NS,"always");o.setMultiSubText(f,this._NS,"jid",e)}}},never:{get:function(){var e=[],f=o.find(this.xml,this._NS,"always");if(0===f.length)return e;f=f[0];var n=o.getMultiSubText(f,this._NS,"jid");return n.forEach(function(f){e.push(new p(f.textContent))}),e},set:function(e){if(e.length>0){var f=o.find(this.xml,this._NS,"never");o.setMultiSubText(f,this._NS,"jid",e)}}}}}),o.extend(i,n.Archived,"archived"),o.extend(t,n.MAMQuery),o.extend(t,n.Prefs),o.extend(i,n.Result),o.extend(n.Result,l),o.extend(n.MAMQuery,u)},{"../jid":4,"./forwarded":55,"./iq":59,"./message":63,"./rsm":74,"./util":83,jxt:204}],63:[function(e,f){"use strict";var n=(e("underscore"),e("jxt")),o=e("./util");f.exports=n.define({name:"message",namespace:"jabber:client",element:"message",topLevel:!0,fields:{lang:n.langAttribute(),id:n.attribute("id"),to:o.jidAttribute("to"),from:o.jidAttribute("from"),type:n.attribute("type","normal"),thread:n.subText("jabber:client","thread"),parentThread:n.subAttribute("jabber:client","thread","parent"),subject:n.subText("jabber:client","subject"),$body:{get:function(){return n.getSubLangText(this.xml,this._NS,"body",this.lang)}},body:{get:function(){var e=this.$body;return e[this.lang]||""},set:function(e){n.setSubLangText(this.xml,this._NS,"body",e,this.lang)}},attention:n.boolSub("urn:xmpp:attention:0","attention"),replace:n.subAttribute("urn:xmpp:message-correct:0","replace","id"),requestReceipt:n.boolSub("urn:xmpp:receipts","request"),receipt:n.subAttribute("urn:xmpp:receipts","received","id")}})},{"./util":83,jxt:204,underscore:228}],64:[function(e,f,n){"use strict";var o=e("jxt"),d=e("./message"),i=e("./presence"),t=e("./iq"),l=e("./dataforms").DataForm,u=e("./util"),p="http://jabber.org/protocol/muc",s=p+"#user",c=p+"#admin",y=p+"#owner",a=function(e,f){return{get:function(){return this._extensions[e]?this[e][f]:void 0},set:function(n){this[e][f]=n}}},r=o.define({name:"_mucUserItem",namespace:s,element:"item",fields:{affiliation:o.attribute("affiliation"),nick:o.attribute("nick"),jid:u.jidAttribute("jid"),role:o.attribute("role"),reason:o.subText(s,"reason")}}),w=o.define({name:"_mucUserActor",namespace:s,element:"actor",fields:{nick:o.attribute("nick"),jid:u.jidAttribute("jid")}}),b=o.define({name:"destroyed",namespace:s,element:"destroy",fields:{jid:u.jidAttribute("jid"),reason:o.subText(s,"reason")}}),g=o.define({name:"invite",namespace:s,element:"invite",fields:{to:u.jidAttribute("to"),from:u.jidAttribute("from"),reason:o.subText(s,"reason"),thread:o.subAttribute(s,"continue","thread"),"continue":o.boolSub(s,"continue")}}),m=o.define({name:"decline",namespace:s,element:"decline",fields:{to:u.jidAttribute("to"),from:u.jidAttribute("from"),reason:o.subText(s,"reason")}}),x=o.define({name:"_mucAdminItem",namespace:c,element:"item",fields:{affiliation:o.attribute("affiliation"),nick:o.attribute("nick"),jid:u.jidAttribute("jid"),role:o.attribute("role"),reason:o.subText(c,"reason")}}),P=o.define({name:"actor",namespace:s,element:"actor",fields:{nick:o.attribute("nick"),jid:u.jidAttribute("jid")}}),j=o.define({name:"destroy",namespace:y,element:"destroy",fields:{jid:u.jidAttribute("jid"),password:o.subText(y,"password"),reason:o.subText(y,"reason")}});n.MUC=o.define({name:"muc",namespace:s,element:"x",fields:{affiliation:a("_mucUserItem","affiliation"),nick:a("_mucUserItem","nick"),jid:a("_mucUserItem","jid"),role:a("_mucUserItem","role"),actor:a("_mucUserItem","_mucUserActor"),reason:a("_mucUserItem","reason"),password:o.subText(s,"password"),codes:{get:function(){return o.getMultiSubText(this.xml,s,"status",function(e){return o.getAttribute(e,"code")})},set:function(e){var f=this;o.setMultiSubText(this.xml,s,"status",e,function(e){var n=o.createElement(s,"status",s);o.setAttribute(n,"code",e),f.xml.appendChild(n)})}}}}),n.MUCAdmin=o.define({name:"mucAdmin",namespace:c,element:"query",fields:{affiliation:a("_mucAdminItem","affiliation"),nick:a("_mucAdminItem","nick"),jid:a("_mucAdminItem","jid"),role:a("_mucAdminItem","role"),actor:a("_mucAdminItem","_mucAdminActor"),reason:a("_mucAdminItem","reason")}}),n.MUCOwner=o.define({name:"mucOwner",namespace:y,element:"query"}),n.MUCJoin=o.define({name:"joinMuc",namespace:p,element:"x",fields:{password:o.subText(p,"password"),history:{get:function(){var e={},f=o.find(this.xml,this._NS,"history");if(!f.length)return{};f=f[0];var n=f.getAttribute("maxchars")||"",d=f.getAttribute("maxstanas")||"",i=f.getAttribute("seconds")||"",t=f.getAttribute("since")||"";n&&(e.maxchars=parseInt(n,10)),d&&(e.maxstanzas=parseInt(d,10)),i&&(e.seconds=parseInt(i,10)),t&&(e.since=new Date(t))},set:function(e){var f=o.find(this.xml,this._NS,"history");if(f.length)for(var n=0;n<f.length;n++)this.xml.removeChild(f[n]);var d=o.createElement(this._NS,"history",this._NS);this.xml.appendChild(d),e.maxchars&&d.setAttribute(""+e.maxchars),e.maxstanzas&&d.setAttribute(""+e.maxstanzas),e.seconds&&d.setAttribute(""+e.seconds),e.since&&d.setAttribute(e.since.toISOString()) | |
}}}}),n.DirectInvite=o.define({name:"mucInvite",namespace:"jabber:x:conference",element:"x",fields:{jid:u.jidAttribute("jid"),password:o.attribute("password"),reason:o.attribute("reason"),thread:o.attribute("thread"),"continue":o.boolAttribute("continue")}}),o.extend(r,w),o.extend(n.MUC,r),o.extend(n.MUC,g,"invites"),o.extend(n.MUC,m),o.extend(n.MUC,b),o.extend(x,P),o.extend(n.MUCAdmin,x,"items"),o.extend(n.MUCOwner,j),o.extend(n.MUCOwner,l),o.extend(i,n.MUC),o.extend(d,n.MUC),o.extend(i,n.MUCJoin),o.extend(d,n.DirectInvite),o.extend(t,n.MUCAdmin),o.extend(t,n.MUCOwner)},{"./dataforms":50,"./iq":59,"./message":63,"./presence":68,"./util":83,jxt:204}],65:[function(e){"use strict";var f=e("jxt"),n=e("./pubsub").Item,o=e("./pubsub").EventItem,d=e("./presence"),i=e("./message"),t=f.subText("http://jabber.org/protocol/nick","nick");f.add(n,"nick",t),f.add(o,"nick",t),f.add(d,"nick",t),f.add(i,"nick",t)},{"./message":63,"./presence":68,"./pubsub":71,jxt:204}],66:[function(e,f){"use strict";var n=e("jxt"),o=e("./message"),d="jabber:x:oob",i=f.exports=n.define({name:"oob",element:"x",namespace:d,fields:{url:n.subText(d,"url"),desc:n.subText(d,"desc")}});n.extend(o,i,"oobURIs")},{"./message":63,jxt:204}],67:[function(e,f){var n=e("jxt"),o=e("./iq"),d="urn:xmpp:ping",i=f.exports=n.define({name:"ping",namespace:d,element:"ping",fields:{}});n.extend(o,i)},{"./iq":59,jxt:204}],68:[function(e,f){"use strict";var n=(e("underscore"),e("jxt")),o=e("./util");f.exports=n.define({name:"presence",namespace:"jabber:client",element:"presence",topLevel:!0,fields:{lang:n.langAttribute(),id:n.attribute("id"),to:o.jidAttribute("to"),from:o.jidAttribute("from"),priority:n.numberSub("jabber:client","priority"),show:n.subText("jabber:client","show"),type:{get:function(){return n.getAttribute(this.xml,"type","available")},set:function(e){"available"===e&&(e=!1),n.setAttribute(this.xml,"type",e)}},$status:{get:function(){return n.getSubLangText(this.xml,this._NS,"status",this.lang)}},status:{get:function(){var e=this.$status;return e[this.lang]||""},set:function(e){n.setSubLangText(this.xml,this._NS,"status",e,this.lang)}},idleSince:n.dateSubAttribute("urn:xmpp:idle:1","idle","since"),decloak:n.subAttribute("urn:xmpp:decloak:0","decloak","reason"),avatarId:{get:function(){var e="vcard-temp:x:update",f=n.find(this.xml,e,"x");return f.length?n.getSubText(f[0],e,"photo"):""},set:function(e){var f="vcard-temp:x:update",o=n.findOrCreate(this.xml,f,"x");if(""===e)n.setBoolSub(o,f,"photo",!0);else{if(e===!0)return;e?n.setSubText(o,f,"photo",e):this.xml.removeChild(o)}}}}})},{"./util":83,jxt:204,underscore:228}],69:[function(e,f){var n=e("jxt"),o=e("./iq"),d=f.exports=n.define({name:"privateStorage",namespace:"jabber:iq:private",element:"query"});n.extend(o,d)},{"./iq":59,jxt:204}],70:[function(e,f){"use strict";var n=e("jxt"),o=e("./util"),d=e("./presence"),i="urn:xmpp:psa",t=["server-unavailable","connection-paused"],l=f.exports=n.define({name:"state",namespace:i,element:"state-annotation",fields:{from:o.jidAttribute("from"),condition:{get:function(){var e=this,f=[];return t.forEach(function(o){var d=n.find(e.xml,i,o);d.length&&f.push(d[0].tagName)}),f[0]||""},set:function(e){var f=this;if(t.forEach(function(e){var o=n.find(f.xml,i,e);o.length&&f.xml.removeChild(o[0])}),e){var o=n.createElement(i,e,i);f.xml.appendChild(o)}}},description:n.subText(i,"description")}});n.extend(d,l)},{"./presence":68,"./util":83,jxt:204}],71:[function(e,f,n){"use strict";var o=e("underscore"),d=e("jxt"),i=e("./util"),t=e("./iq"),l=e("./message"),u=e("./dataforms").DataForm,p=e("./rsm"),s=(e("../jid"),"http://jabber.org/protocol/pubsub"),c="http://jabber.org/protocol/pubsub#owner",y="http://jabber.org/protocol/pubsub#event";n.Pubsub=d.define({name:"pubsub",namespace:"http://jabber.org/protocol/pubsub",element:"pubsub",fields:{publishOptions:{get:function(){var e=d.find(this.xml,this._NS,"publish-options");return e.length&&e[0].childNodes.length?new u({},e[0].childNodes[0]):void 0},set:function(e){var f=d.findOrCreate(this.xml,this._NS,"publish-options");if(e){var n=new u(e);f.appendChild(n.xml)}}}}}),n.PubsubOwner=d.define({name:"pubsubOwner",namespace:c,element:"pubsub",fields:{create:d.subAttribute(c,"create","node"),purge:d.subAttribute(c,"purge","node"),del:d.subAttribute(c,"delete","node"),redirect:{get:function(){var e=d.find(this.xml,this._NS,"delete");return e.length?d.getSubAttribute(e[0],this._NS,"redirect","uri"):""},set:function(e){var f=d.findOrCreate(this.xml,this._NS,"delete");d.setSubAttribute(f,this._NS,"redirect","uri",e)}}}}),n.Configure=d.define({name:"config",namespace:c,element:"configure",fields:{node:d.attribute("node")}}),n.Event=d.define({name:"event",namespace:y,element:"event"}),n.Subscribe=d.define({name:"subscribe",namespace:s,element:"subscribe",fields:{node:d.attribute("node"),jid:i.jidAttribute("jid")}}),n.Subscription=d.define({name:"subscription",namespace:s,element:"subscription",fields:{node:d.attribute("node"),jid:i.jidAttribute("jid"),subid:d.attribute("subid"),type:d.attribute("subscription")}}),n.Unsubscribe=d.define({name:"unsubscribe",namespace:s,element:"unsubscribe",fields:{node:d.attribute("node"),jid:i.jidAttribute("jid")}}),n.Publish=d.define({name:"publish",namespace:s,element:"publish",fields:{node:d.attribute("node")}}),n.Retract=d.define({name:"retract",namespace:s,element:"retract",fields:{node:d.attribute("node"),notify:d.boolAttribute("notify"),id:d.subAttribute(s,"item","id")}}),n.Retrieve=d.define({name:"retrieve",namespace:s,element:"items",fields:{node:d.attribute("node"),max:d.attribute("max_items")}}),n.Item=d.define({name:"item",namespace:s,element:"item",fields:{id:d.attribute("id")}}),n.EventItems=d.define({name:"updated",namespace:y,element:"items",fields:{node:d.attribute("node"),retracted:{get:function(){var e=[],f=d.find(this.xml,this._NS,"retract");return o.forEach(f,function(f){e.push(f.getAttribute("id"))}),e},set:function(e){var f=this;o.forEach(e,function(e){var n=d.createElement(f._NS,"retract",f._NS);n.setAttribute("id",e),this.xml.appendChild(n)})}}}}),n.EventItem=d.define({name:"eventItem",namespace:y,element:"item",fields:{id:d.attribute("id"),node:d.attribute("node"),publisher:i.jidAttribute("publisher")}}),d.extend(n.Pubsub,n.Subscribe),d.extend(n.Pubsub,n.Unsubscribe),d.extend(n.Pubsub,n.Publish),d.extend(n.Pubsub,n.Retrieve),d.extend(n.Pubsub,n.Subscription),d.extend(n.PubsubOwner,n.Configure),d.extend(n.Publish,n.Item,"items"),d.extend(n.Retrieve,n.Item,"items"),d.extend(n.Configure,u),d.extend(n.Pubsub,p),d.extend(n.Event,n.EventItems),d.extend(n.EventItems,n.EventItem,"published"),d.extend(l,n.Event),d.extend(t,n.Pubsub),d.extend(t,n.PubsubOwner)},{"../jid":4,"./dataforms":50,"./iq":59,"./message":63,"./rsm":74,"./util":83,jxt:204,underscore:228}],72:[function(e,f){"use strict";var n=e("underscore"),o=e("jxt"),d=e("./pubsub").Item,i=e("./pubsub").EventItem,t=e("./presence"),l="urn:xmpp:reach:0",u=f.exports=o.define({name:"_reachAddr",namespace:l,element:"addr",fields:{uri:o.attribute("uri"),$desc:{get:function(){return o.getSubLangText(this.xml,l,"desc",this.lang)}},desc:{get:function(){var e=this.$desc;return e[this.lang]||""},set:function(e){o.setSubLangText(this.xml,l,"desc",e,this.lang)}}}}),p={get:function(){var e=o.find(this.xml,l,"reach"),f=[];if(e.length){var d=o.find(e[0],l,"addr");n.forEach(d,function(e){f.push(new u({},e))})}return f},set:function(e){var f=o.findOrCreate(this.xml,l,"reach");o.setAttribute(f,"xmlns",l),n.forEach(e,function(e){var n=new u(e);f.appendChild(n.xml)})}};o.add(d,"reach",p),o.add(i,"reach",p),o.add(t,"reach",p)},{"./presence":68,"./pubsub":71,jxt:204,underscore:228}],73:[function(e,f){"use strict";var n=(e("underscore"),e("jxt")),o=e("./iq"),d=e("../jid"),i=f.exports=n.define({name:"roster",namespace:"jabber:iq:roster",element:"query",fields:{ver:{get:function(){return n.getAttribute(this.xml,"ver")},set:function(e){var f=""===e;n.setAttribute(this.xml,"ver",e,f)}},items:{get:function(){var e=this,f=n.find(this.xml,this._NS,"item");if(!f.length)return[];var o=[];return f.forEach(function(f){var i={jid:new d(n.getAttribute(f,"jid","")),name:n.getAttribute(f,"name",void 0),subscription:n.getAttribute(f,"subscription","none"),ask:n.getAttribute(f,"ask",void 0),groups:[]},t=n.find(f,e._NS,"group");t.forEach(function(e){i.groups.push(e.textContent)}),o.push(i)}),o},set:function(e){var f=this;e.forEach(function(e){var o=n.createElement(f._NS,"item",f._NS);n.setAttribute(o,"jid",e.jid.toString()),n.setAttribute(o,"name",e.name),n.setAttribute(o,"subscription",e.subscription),n.setAttribute(o,"ask",e.ask),(e.groups||[]).forEach(function(e){var d=n.createElement(f._NS,"group",f._NS);d.textContent=e,o.appendChild(d)}),f.xml.appendChild(o)})}}}});n.extend(o,i)},{"../jid":4,"./iq":59,jxt:204,underscore:228}],74:[function(e,f){"use strict";var n=e("jxt"),o=(e("./util"),"http://jabber.org/protocol/rsm");f.exports=n.define({name:"rsm",namespace:o,element:"set",fields:{after:n.subText(o,"after"),before:{get:function(){return n.getSubText(this.xml,this._NS,"before")},set:function(e){e===!0?n.findOrCreate(this.xml,this._NS,"before"):n.setSubText(this.xml,this._NS,"before",e)}},count:n.numberSub(o,"count"),first:n.subText(o,"first"),firstIndex:n.subAttribute(o,"first","index"),index:n.subText(o,"index"),last:n.subText(o,"last"),max:n.subText(o,"max")}})},{"./util":83,jxt:204}],75:[function(e,f,n){"use strict";var o=(e("underscore"),e("jxt")),d=(e("./util"),e("./jingle")),i="urn:xmpp:jingle:apps:rtp:1",t="urn:xmpp:jingle:apps:rtp:rtcp-fb:0",l="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",u="urn:xmpp:jingle:apps:rtp:info:1",p="urn:xmpp:jingle:apps:rtp:ssma:0",s={get:function(){var e=o.find(this.xml,t,"rtcp-fb"),f=[];return e.forEach(function(e){f.push({type:o.getAttribute(e,"type"),subtype:o.getAttribute(e,"subtype")})}),e=o.find(this.xml,t,"rtcp-fb-trr-int"),e.forEach(function(e){f.push({type:o.getAttribute(e,"type"),value:o.getAttribute(e,"value")})}),f},set:function(e){var f=this,n=o.find(this.xml,t,"rtcp-fb");n.forEach(function(e){f.xml.removeChild(e)}),n=o.find(this.xml,t,"rtcp-fb-trr-int"),n.forEach(function(e){f.xml.removeChild(e)}),e.forEach(function(e){var n;"trr-int"===e.type?(n=o.createElement(t,"rtcp-fb-trr-int",i),o.setAttribute(n,"type",e.type),o.setAttribute(n,"value",e.value)):(n=o.createElement(t,"rtcp-fb",i),o.setAttribute(n,"type",e.type),o.setAttribute(n,"subtype",e.subtype)),f.xml.appendChild(n)})}};n.RTP=o.define({name:"_rtp",namespace:i,element:"description",fields:{descType:{value:"rtp"},media:o.attribute("media"),ssrc:o.attribute("ssrc"),bandwidth:o.subText(i,"bandwidth"),bandwidthType:o.subAttribute(i,"bandwidth","type"),mux:o.boolSub(i,"rtcp-mux"),encryption:{get:function(){var e=o.find(this.xml,i,"encryption");if(!e.length)return[];e=e[0];var f=this,d=o.find(e,i,"crypto"),t=[];return d.forEach(function(e){t.push(new n.Crypto({},e,f).toJSON())}),t},set:function(e){var f=o.find(this.xml,i,"encryption");if(f.length&&this.xml.removeChild(f),e.length){o.setBoolSubAttribute(this.xml,i,"encryption","required",!0),f=o.find(this.xml,i,"encryption")[0];var d=this;e.forEach(function(e){var o=new n.Crypto(e,null,d);f.appendChild(o.xml)})}}},feedback:s,headerExtensions:{get:function(){var e=o.find(this.xml,l,"rtp-hdrext"),f=[];return e.forEach(function(e){f.push({id:o.getAttribute(e,"id"),uri:o.getAttribute(e,"uri"),senders:o.getAttribute(e,"senders")})}),f},set:function(e){var f=this,n=o.find(this.xml,l,"rtp-hdrext");n.forEach(function(e){f.xml.removeChild(e)}),e.forEach(function(e){var n=o.createElement(l,"rtp-hdrext",i);o.setAttribute(n,"id",e.id),o.setAttribute(n,"uri",e.uri),o.setAttribute(n,"senders",e.senders),f.xml.appendChild(n)})}}}}),n.PayloadType=o.define({name:"_payloadType",namespace:i,element:"payload-type",fields:{channels:o.attribute("channels"),clockrate:o.attribute("clockrate"),id:o.attribute("id"),maxptime:o.attribute("maxptime"),name:o.attribute("name"),ptime:o.attribute("ptime"),feedback:s,parameters:{get:function(){var e=[],f=o.find(this.xml,i,"parameter");return f.forEach(function(f){e.push({key:o.getAttribute(f,"name"),value:o.getAttribute(f,"value")})}),e},set:function(e){var f=this;e.forEach(function(e){var n=o.createElement(i,"parameter");o.setAttribute(n,"name",e.key),o.setAttribute(n,"value",e.value),f.xml.appendChild(n)})}}}}),n.Crypto=o.define({name:"crypto",namespace:i,element:"crypto",fields:{cipherSuite:o.attribute("crypto-suite"),keyParams:o.attribute("key-params"),sessionParams:o.attribute("session-params"),tag:o.attribute("tag")}}),n.ContentGroup=o.define({name:"_group",namespace:"urn:xmpp:jingle:apps:grouping:0",element:"group",fields:{semantics:o.attribute("semantics"),contents:{get:function(){return o.getMultiSubText(this.xml,this._NS,"content",function(e){return o.getAttribute(e,"name")})},set:function(e){var f=this;o.setMultiSubText(this.xml,this._NS,"content",e,function(e){var n=o.createElement(f._NS,"content",f._NS);o.setAttribute(n,"name",e),f.xml.appendChild(n)})}}}}),n.SourceGroup=o.define({name:"_sourceGroup",namespace:p,element:"ssrc-group",fields:{semantics:o.attribute("semantics"),sources:{get:function(){return o.getMultiSubText(this.xml,this._NS,"source",function(e){return o.getAttribute(e,"ssrc")})},set:function(e){var f=this;o.setMultiSubText(this.xml,this._NS,"source",e,function(e){var n=o.createElement(f._NS,"source",f._NS);o.setAttribute(n,"ssrc",e),f.xml.appendChild(n)})}}}}),n.Source=o.define({name:"_source",namespace:p,element:"source",fields:{ssrc:o.attribute("ssrc"),parameters:{get:function(){var e=[],f=o.find(this.xml,p,"parameter");return f.forEach(function(f){e.push({key:o.getAttribute(f,"name"),value:o.getAttribute(f,"value")})}),e},set:function(e){var f=this;e.forEach(function(e){var n=o.createElement(p,"parameter");o.setAttribute(n,"name",e.key),o.setAttribute(n,"value",e.value),f.xml.appendChild(n)})}}}}),n.Mute=o.define({name:"mute",namespace:u,element:"mute",fields:{creator:o.attribute("creator"),name:o.attribute("name")}}),n.Unmute=o.define({name:"unmute",namespace:u,element:"unmute",fields:{creator:o.attribute("creator"),name:o.attribute("name")}}),o.extend(d.Content,n.RTP),o.extend(n.RTP,n.PayloadType,"payloads"),o.extend(n.RTP,n.Source,"sources"),o.extend(n.RTP,n.SourceGroup,"sourceGroups"),o.extend(d.Jingle,n.Mute),o.extend(d.Jingle,n.Unmute),o.extend(d.Jingle,n.ContentGroup,"groups"),o.add(d.Jingle,"ringing",o.boolSub(u,"ringing")),o.add(d.Jingle,"hold",o.boolSub(u,"hold")),o.add(d.Jingle,"active",o.boolSub(u,"active"))},{"./jingle":60,"./util":83,jxt:204,underscore:228}],76:[function(e,f,n){"use strict";var o=(e("underscore"),e("jxt")),d=(e("./util"),e("./streamFeatures")),i="urn:ietf:params:xml:ns:xmpp-sasl",t=["aborted","account-disabled","credentials-expired","encryption-required","incorrect-encoding","invalid-authzid","invalid-mechanism","malformed-request","mechanism-too-weak","not-authorized","temporary-auth-failure"];n.Mechanisms=o.define({name:"sasl",namespace:i,element:"mechanisms",fields:{mechanisms:o.multiSubText(i,"mechanism")}}),n.Auth=o.define({name:"saslAuth",eventName:"sasl:auth",namespace:i,element:"auth",topLevel:!0,fields:{value:o.b64Text(),mechanism:o.attribute("mechanism")}}),n.Challenge=o.define({name:"saslChallenge",eventName:"sasl:challenge",namespace:i,element:"challenge",topLevel:!0,fields:{value:o.b64Text()}}),n.Response=o.define({name:"saslResponse",eventName:"sasl:response",namespace:i,element:"response",topLevel:!0,fields:{value:o.b64Text()}}),n.Abort=o.define({name:"saslAbort",eventName:"sasl:abort",namespace:i,element:"abort",topLevel:!0}),n.Success=o.define({name:"saslSuccess",eventName:"sasl:success",namespace:i,element:"success",topLevel:!0,fields:{value:o.b64Text()}}),n.Failure=o.define({name:"saslFailure",eventName:"sasl:failure",namespace:i,element:"failure",topLevel:!0,fields:{lang:{get:function(){return this._lang||""},set:function(e){this._lang=e}},condition:{get:function(){var e=this,f=[];return t.forEach(function(n){var d=o.find(e.xml,i,n);d.length&&f.push(d[0].tagName)}),f[0]||""},set:function(e){var f=this;if(this._CONDITIONS.forEach(function(e){var n=o.find(f.xml,i,e);n.length&&f.xml.removeChild(n[0])}),e){var n=o.createElementNS(i,e);n.setAttribute("xmlns",i),this.xml.appendChild(n)}}},$text:{get:function(){return o.getSubLangText(this.xml,i,"text",this.lang)}},text:{get:function(){var e=this.$text;return e[this.lang]||""},set:function(e){o.setSubLangText(this.xml,i,"text",e,this.lang)}}}}),o.extend(d,n.Mechanisms)},{"./streamFeatures":81,"./util":83,jxt:204,underscore:228}],77:[function(e,f){var n=e("jxt"),o=e("./iq"),d=e("./streamFeatures"),i=f.exports=n.define({name:"session",namespace:"urn:ietf:params:xml:ns:xmpp-session",element:"session"});n.extend(d,i),n.extend(o,i)},{"./iq":59,"./streamFeatures":81,jxt:204}],78:[function(e,f,n){var o=e("jxt"),d=(e("./util"),e("./streamFeatures")),i="urn:xmpp:sm:3";n.SMFeature=o.define({name:"streamManagement",namespace:i,element:"sm"}),n.Enable=o.define({name:"smEnable",eventName:"stream:management:enable",namespace:i,element:"enable",topLevel:!0,fields:{resume:o.boolAttribute("resume")}}),n.Enabled=o.define({name:"smEnabled",eventName:"stream:management:enabled",namespace:i,element:"enabled",topLevel:!0,fields:{id:o.attribute("id"),resume:o.boolAttribute("resume")}}),n.Resume=o.define({name:"smResume",eventName:"stream:management:resume",namespace:i,element:"resume",topLevel:!0,fields:{h:o.numberAttribute("h"),previd:o.attribute("previd")}}),n.Resumed=o.define({name:"smResumed",eventName:"stream:management:resumed",namespace:i,element:"resumed",topLevel:!0,fields:{h:o.numberAttribute("h"),previd:o.attribute("previd")}}),n.Failed=o.define({name:"smFailed",eventName:"stream:management:failed",namespace:i,element:"failed",topLevel:!0}),n.Ack=o.define({name:"smAck",eventName:"stream:management:ack",namespace:i,element:"a",topLevel:!0,fields:{h:o.numberAttribute("h")}}),n.Request=o.define({name:"smRequest",eventName:"stream:management:request",namespace:i,element:"r",topLevel:!0}),o.extend(d,n.SMFeature)},{"./streamFeatures":81,"./util":83,jxt:204}],79:[function(e,f){"use strict";var n=e("jxt"),o=e("./util");f.exports=n.define({name:"stream",namespace:"http://etherx.jabber.org/streams",element:"stream",fields:{lang:n.langAttribute(),id:n.attribute("id"),version:n.attribute("version","1.0"),to:o.jidAttribute("to"),from:o.jidAttribute("from")}})},{"./util":83,jxt:204}],80:[function(e,f){"use strict";var n=(e("underscore"),e("jxt")),o="urn:ietf:params:xml:ns:xmpp-streams",d=["bad-format","bad-namespace-prefix","conflict","connection-timeout","host-gone","host-unknown","improper-addressing","internal-server-error","invalid-from","invalid-namespace","invalid-xml","not-authorized","not-well-formed","policy-violation","remote-connection-failed","reset","resource-constraint","restricted-xml","see-other-host","system-shutdown","undefined-condition","unsupported-encoding","unsupported-feature","unsupported-stanza-type","unsupported-version"];f.exports=n.define({name:"streamError",namespace:"http://etherx.jabber.org/streams",element:"error",topLevel:!0,fields:{lang:{get:function(){return this._lang||""},set:function(e){this._lang=e}},condition:{get:function(){var e=this,f=[];return d.forEach(function(d){var i=n.find(e.xml,o,d);i.length&&f.push(i[0].tagName)}),f[0]||""},set:function(e){var f=this;if(d.forEach(function(e){var d=n.find(f.xml,o,e);d.length&&f.xml.removeChild(d[0])}),e){var i=n.createElement(o,e);i.setAttribute("xmlns",o),this.xml.appendChild(i)}}},seeOtherHost:{get:function(){return n.getSubText(this.xml,o,"see-other-host")},set:function(e){this.condition="see-other-host",n.setSubText(this.xml,o,"see-other-host",e)}},$text:{get:function(){return n.getSubLangText(this.xml,o,"text",this.lang)}},text:{get:function(){var e=this.$text;return e[this.lang]||""},set:function(e){n.setSubLangText(this.xml,o,"text",e,this.lang)}}}})},{jxt:204,underscore:228}],81:[function(e,f){"use strict";var n=e("jxt"),o=f.exports=n.define({name:"streamFeatures",namespace:"http://etherx.jabber.org/streams",element:"features",topLevel:!0,fields:{features:{get:function(){return this._extensions}}}}),d=n.define({name:"rosterVersioning",namespace:"urn:xmpp:features:rosterver",element:"ver"}),i=n.define({name:"subscriptionPreApproval",namespace:"urn:xmpp:features:pre-approval",element:"sub"});n.extend(o,d),n.extend(o,i)},{jxt:204}],82:[function(e,f){"use strict";var n=e("jxt"),o=(e("./util"),e("./iq")),d=f.exports=n.define({name:"time",namespace:"urn:xmpp:time",element:"time",fields:{utc:n.dateSub("urn:xmpp:time","utc"),tzo:{get:function(){var e,f,o,d=-1,i=n.getSubText(this.xml,this._NS,"tzo");return i?("-"===i.charAt(0)&&(d=1,i=i.slice(1)),e=i.split(":"),f=parseInt(e[0],10),o=parseInt(e[1],10),(60*f+o)*d):0},set:function(e){var f,o,d="-";"number"==typeof e?(0>e&&(e=-e,d="+"),f=e/60,o=e%60,d+=(10>f?"0":"")+f+":"+(10>o?"0":"")+o):d=e,n.setSubText(this.xml,this._NS,"tzo",d)}}}});n.extend(o,d)},{"./iq":59,"./util":83,jxt:204}],83:[function(e,f,n){"use strict";var o=e("jxt"),d=e("../jid");n.jidAttribute=o.field(function(e,f){return new d(o.getAttribute(e,f))},function(e,f,n){o.setAttribute(e,f,(n||"").toString())}),n.jidSub=o.field(function(e,f,n){return new d(o.getSubText(e,f,n))},function(e,f,n,d){o.setSubText(e,f,n,(d||"").toString())})},{"../jid":4,jxt:204}],84:[function(e,f){"use strict";var n=e("jxt"),o=e("./iq"),d="vcard-temp",i=f.exports=n.define({name:"vCardTemp",namespace:d,element:"vCard",fields:{role:n.subText(d,"ROLE"),website:n.subText(d,"URL"),title:n.subText(d,"TITLE"),description:n.subText(d,"DESC"),fullName:n.subText(d,"FN"),birthday:n.dateSub(d,"BDAY"),nicknames:n.multiSubText(d,"NICKNAME"),jids:n.multiSubText(d,"JABBERID")}}),t=n.define({name:"_email",namespace:d,element:"EMAIL",fields:{email:n.subText(d,"USERID"),home:n.boolSub(d,"HOME"),work:n.boolSub(d,"WORK"),preferred:n.boolSub(d,"PREF")}}),l=n.define({name:"_tel",namespace:d,element:"TEL",fields:{number:n.subText(d,"NUMBER"),home:n.boolSub(d,"HOME"),work:n.boolSub(d,"WORK"),mobile:n.boolSub(d,"CELL"),preferred:n.boolSub(d,"PREF")}}),u=n.define({name:"_address",namespace:d,element:"ADR",fields:{street:n.subText(d,"STREET"),street2:n.subText(d,"EXTADD"),country:n.subText(d,"CTRY"),city:n.subText(d,"LOCALITY"),region:n.subText(d,"REGION"),postalCode:n.subText(d,"PCODE"),pobox:n.subText(d,"POBOX"),home:n.boolSub(d,"HOME"),work:n.boolSub(d,"WORK"),preferred:n.boolSub(d,"PREF")}}),p=n.define({name:"organization",namespace:d,element:"ORG",fields:{name:n.subText(d,"ORGNAME"),unit:n.subText(d,"ORGUNIT")}}),s=n.define({name:"name",namespace:d,element:"N",fields:{family:n.subText(d,"FAMILY"),given:n.subText(d,"GIVEN"),middle:n.subText(d,"MIDDLE"),prefix:n.subText(d,"PREFIX"),suffix:n.subText(d,"SUFFIX")}}),c=n.define({name:"photo",namespace:d,element:"PHOTO",fields:{type:n.subText(d,"TYPE"),data:n.subText(d,"BINVAL"),url:n.subText(d,"EXTVAL")}});n.extend(i,t,"emails"),n.extend(i,u,"addresses"),n.extend(i,l,"phoneNumbers"),n.extend(i,p),n.extend(i,s),n.extend(i,c),n.extend(o,i)},{"./iq":59,jxt:204}],85:[function(e,f){var n=e("jxt"),o=e("./iq"),d="jabber:iq:version",i=f.exports=n.define({name:"version",namespace:d,element:"query",fields:{name:n.subText(d,"name"),version:n.subText(d,"version"),os:n.subText(d,"os")}});n.extend(o,i)},{"./iq":59,jxt:204}],86:[function(e){var f=e("jxt"),n=e("./iq");f.add(n,"visible",f.boolSub("urn:xmpp:invisible:0","visible")),f.add(n,"invisible",f.boolSub("urn:xmpp:invisible:0","invisible"))},{"./iq":59,jxt:204}],87:[function(e,f){"use strict";function n(e){var f=this;i.call(this),f.sm=e,f.closing=!1,f.sendQueue=t.queue(function(e,n){f.conn&&(f.sm.track(e),"string"!=typeof e&&(e=e.toString()),f.emit("raw:outgoing",e),f.conn.readyState===s&&f.conn.send(e)),n()},1),f.on("connected",function(){f.send(new l.Open({version:f.config.version||"1.0",lang:f.config.lang||"en",to:f.config.server}))}),f.on("raw:incoming",function(e){var n,o;if(e=e.trim(),""!==e){try{n=d.parse(e)}catch(i){return o=new u({condition:"invalid-xml"}),f.emit("stream:error",o,i),f.send(o),f.disconnect()}if("openStream"===n._name)return f.hasStream=!0,f.stream=n,f.emit("stream:start",n);if("closeStream"===n._name)return f.emit("stream:end"),f.disconnect();if(n.lang||(n.lang=f.stream.lang),f.emit("stream:data",n),f.emit(n._eventname||n._name,n),"message"===n._name||"presence"===n._name||"iq"===n._name)f.sm.handle(n),f.emit("stanza",n);else{if("smAck"===n._name)return f.sm.process(n);if("smRequest"===n._name)return f.sm.ack()}n.id&&f.emit("id:"+n.id,n)}})}var o=(e("underscore"),e("util")),d=e("jxt"),i=e("wildemitter"),t=e("async"),l=e("./stanza/framing"),u=e("./stanza/streamError"),p=(e("./stanza/message"),e("./stanza/presence"),e("./stanza/iq"),e("faye-websocket")&&e("faye-websocket").Client?e("faye-websocket").Client:window.WebSocket),s=1;o.inherits(n,i),n.prototype.connect=function(e){var f=this;f.config=e,f.hasStream=!1,f.closing=!1,f.conn=new p(e.wsURL,"xmpp"),f.conn.onerror=function(e){e.preventDefault(),f.emit("disconnected",f)},f.conn.onclose=function(){f.emit("disconnected",f)},f.conn.onopen=function(){f.sm.started=!1,f.emit("connected",f)},f.conn.onmessage=function(e){f.emit("raw:incoming",e.data)}},n.prototype.disconnect=function(){this.conn&&!this.closing?(this.closing=!0,this.send(new l.Close)):(this.hasStream=!1,this.stream=void 0,this.sm.failed(),this.conn.readyState===s&&this.conn.close(),this.conn=void 0)},n.prototype.restart=function(){var e=this;e.hasStream=!1,e.send(new l.Open({version:e.config.version||"1.0",lang:e.config.lang||"en",to:e.config.server}))},n.prototype.send=function(e){this.sendQueue.push(e)},f.exports=n},{"./stanza/framing":56,"./stanza/iq":59,"./stanza/message":63,"./stanza/presence":68,"./stanza/streamError":80,async:88,"faye-websocket":128,jxt:204,underscore:228,util:141,wildemitter:229}],88:[function(f,n){(function(f){!function(){function o(e){var f=!1;return function(){if(f)throw new Error("Callback was already called.");f=!0,e.apply(d,arguments)}}var d,i,t={};d=this,null!=d&&(i=d.async),t.noConflict=function(){return d.async=i,t};var l=Object.prototype.toString,u=Array.isArray||function(e){return"[object Array]"===l.call(e)},p=function(e,f){if(e.forEach)return e.forEach(f);for(var n=0;n<e.length;n+=1)f(e[n],n,e)},s=function(e,f){if(e.map)return e.map(f);var n=[];return p(e,function(e,o,d){n.push(f(e,o,d))}),n},c=function(e,f,n){return e.reduce?e.reduce(f,n):(p(e,function(e,o,d){n=f(n,e,o,d)}),n)},y=function(e){if(Object.keys)return Object.keys(e);var f=[];for(var n in e)e.hasOwnProperty(n)&&f.push(n);return f};"undefined"!=typeof f&&f.nextTick?(t.nextTick=f.nextTick,t.setImmediate="undefined"!=typeof setImmediate?function(e){setImmediate(e)}:t.nextTick):"function"==typeof setImmediate?(t.nextTick=function(e){setImmediate(e)},t.setImmediate=t.nextTick):(t.nextTick=function(e){setTimeout(e,0)},t.setImmediate=t.nextTick),t.each=function(e,f,n){function d(f){f?(n(f),n=function(){}):(i+=1,i>=e.length&&n())}if(n=n||function(){},!e.length)return n();var i=0;p(e,function(e){f(e,o(d))})},t.forEach=t.each,t.eachSeries=function(e,f,n){if(n=n||function(){},!e.length)return n();var o=0,d=function(){f(e[o],function(f){f?(n(f),n=function(){}):(o+=1,o>=e.length?n():d())})};d()},t.forEachSeries=t.eachSeries,t.eachLimit=function(e,f,n,o){var d=a(f);d.apply(null,[e,n,o])},t.forEachLimit=t.eachLimit;var a=function(e){return function(f,n,o){if(o=o||function(){},!f.length||0>=e)return o();var d=0,i=0,t=0;!function l(){if(d>=f.length)return o();for(;e>t&&i<f.length;)i+=1,t+=1,n(f[i-1],function(e){e?(o(e),o=function(){}):(d+=1,t-=1,d>=f.length?o():l())})}()}},r=function(e){return function(){var f=Array.prototype.slice.call(arguments);return e.apply(null,[t.each].concat(f))}},w=function(e,f){return function(){var n=Array.prototype.slice.call(arguments);return f.apply(null,[a(e)].concat(n))}},b=function(e){return function(){var f=Array.prototype.slice.call(arguments);return e.apply(null,[t.eachSeries].concat(f))}},g=function(e,f,n,o){var d=[];f=s(f,function(e,f){return{index:f,value:e}}),e(f,function(e,f){n(e.value,function(n,o){d[e.index]=o,f(n)})},function(e){o(e,d)})};t.map=r(g),t.mapSeries=b(g),t.mapLimit=function(e,f,n,o){return m(f)(e,n,o)};var m=function(e){return w(e,g)};t.reduce=function(e,f,n,o){t.eachSeries(e,function(e,o){n(f,e,function(e,n){f=n,o(e)})},function(e){o(e,f)})},t.inject=t.reduce,t.foldl=t.reduce,t.reduceRight=function(e,f,n,o){var d=s(e,function(e){return e}).reverse();t.reduce(d,f,n,o)},t.foldr=t.reduceRight;var x=function(e,f,n,o){var d=[];f=s(f,function(e,f){return{index:f,value:e}}),e(f,function(e,f){n(e.value,function(n){n&&d.push(e),f()})},function(){o(s(d.sort(function(e,f){return e.index-f.index}),function(e){return e.value}))})};t.filter=r(x),t.filterSeries=b(x),t.select=t.filter,t.selectSeries=t.filterSeries;var P=function(e,f,n,o){var d=[];f=s(f,function(e,f){return{index:f,value:e}}),e(f,function(e,f){n(e.value,function(n){n||d.push(e),f()})},function(){o(s(d.sort(function(e,f){return e.index-f.index}),function(e){return e.value}))})};t.reject=r(P),t.rejectSeries=b(P);var j=function(e,f,n,o){e(f,function(e,f){n(e,function(n){n?(o(e),o=function(){}):f()})},function(){o()})};t.detect=r(j),t.detectSeries=b(j),t.some=function(e,f,n){t.each(e,function(e,o){f(e,function(e){e&&(n(!0),n=function(){}),o()})},function(){n(!1)})},t.any=t.some,t.every=function(e,f,n){t.each(e,function(e,o){f(e,function(e){e||(n(!1),n=function(){}),o()})},function(){n(!0)})},t.all=t.every,t.sortBy=function(e,f,n){t.map(e,function(e,n){f(e,function(f,o){f?n(f):n(null,{value:e,criteria:o})})},function(e,f){if(e)return n(e);var o=function(e,f){var n=e.criteria,o=f.criteria;return o>n?-1:n>o?1:0};n(null,s(f.sort(o),function(e){return e.value}))})},t.auto=function(e,f){f=f||function(){};var n=y(e),o=n.length;if(!o)return f();var d={},i=[],l=function(e){i.unshift(e)},s=function(e){for(var f=0;f<i.length;f+=1)if(i[f]===e)return void i.splice(f,1)},a=function(){o--,p(i.slice(0),function(e){e()})};l(function(){if(!o){var e=f;f=function(){},e(null,d)}}),p(n,function(n){var o=u(e[n])?e[n]:[e[n]],i=function(e){var o=Array.prototype.slice.call(arguments,1);if(o.length<=1&&(o=o[0]),e){var i={};p(y(d),function(e){i[e]=d[e]}),i[n]=o,f(e,i),f=function(){}}else d[n]=o,t.setImmediate(a)},r=o.slice(0,Math.abs(o.length-1))||[],w=function(){return c(r,function(e,f){return e&&d.hasOwnProperty(f)},!0)&&!d.hasOwnProperty(n)};if(w())o[o.length-1](i,d);else{var b=function(){w()&&(s(b),o[o.length-1](i,d))};l(b)}})},t.retry=function(e,f,n){var o=5,d=[];"function"==typeof e&&(n=f,f=e,e=o),e=parseInt(e,10)||o;var i=function(o,i){for(var l=function(e,f){return function(n){e(function(e,o){n(!e||f,{err:e,result:o})},i)}};e;)d.push(l(f,!(e-=1)));t.series(d,function(e,f){f=f[f.length-1],(o||n)(f.err,f.result)})};return n?i():i},t.waterfall=function(e,f){if(f=f||function(){},!u(e)){var n=new Error("First argument to waterfall must be an array of functions");return f(n)}if(!e.length)return f();var o=function(e){return function(n){if(n)f.apply(null,arguments),f=function(){};else{var d=Array.prototype.slice.call(arguments,1),i=e.next();d.push(i?o(i):f),t.setImmediate(function(){e.apply(null,d)})}}};o(t.iterator(e))()};var v=function(e,f,n){if(n=n||function(){},u(f))e.map(f,function(e,f){e&&e(function(e){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),f.call(null,e,n)})},n);else{var o={};e.each(y(f),function(e,n){f[e](function(f){var d=Array.prototype.slice.call(arguments,1);d.length<=1&&(d=d[0]),o[e]=d,n(f)})},function(e){n(e,o)})}};t.parallel=function(e,f){v({map:t.map,each:t.each},e,f)},t.parallelLimit=function(e,f,n){v({map:m(f),each:a(f)},e,n)},t.series=function(e,f){if(f=f||function(){},u(e))t.mapSeries(e,function(e,f){e&&e(function(e){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),f.call(null,e,n)})},f);else{var n={};t.eachSeries(y(e),function(f,o){e[f](function(e){var d=Array.prototype.slice.call(arguments,1);d.length<=1&&(d=d[0]),n[f]=d,o(e) | |
})},function(e){f(e,n)})}},t.iterator=function(e){var f=function(n){var o=function(){return e.length&&e[n].apply(null,arguments),o.next()};return o.next=function(){return n<e.length-1?f(n+1):null},o};return f(0)},t.apply=function(e){var f=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,f.concat(Array.prototype.slice.call(arguments)))}};var M=function(e,f,n,o){var d=[];e(f,function(e,f){n(e,function(e,n){d=d.concat(n||[]),f(e)})},function(e){o(e,d)})};t.concat=r(M),t.concatSeries=b(M),t.whilst=function(e,f,n){e()?f(function(o){return o?n(o):void t.whilst(e,f,n)}):n()},t.doWhilst=function(e,f,n){e(function(o){if(o)return n(o);var d=Array.prototype.slice.call(arguments,1);f.apply(null,d)?t.doWhilst(e,f,n):n()})},t.until=function(e,f,n){e()?n():f(function(o){return o?n(o):void t.until(e,f,n)})},t.doUntil=function(e,f,n){e(function(o){if(o)return n(o);var d=Array.prototype.slice.call(arguments,1);f.apply(null,d)?n():t.doUntil(e,f,n)})},t.queue=function(e,f){function n(e,f,n,o){return u(f)||(f=[f]),0==f.length?t.setImmediate(function(){e.drain&&e.drain()}):void p(f,function(f){var d={data:f,callback:"function"==typeof o?o:null};n?e.tasks.unshift(d):e.tasks.push(d),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),t.setImmediate(e.process)})}void 0===f&&(f=1);var d=0,i={tasks:[],concurrency:f,saturated:null,empty:null,drain:null,paused:!1,push:function(e,f){n(i,e,!1,f)},unshift:function(e,f){n(i,e,!0,f)},process:function(){if(!i.paused&&d<i.concurrency&&i.tasks.length){var f=i.tasks.shift();i.empty&&0===i.tasks.length&&i.empty(),d+=1;var n=function(){d-=1,f.callback&&f.callback.apply(f,arguments),i.drain&&i.tasks.length+d===0&&i.drain(),i.process()},t=o(n);e(f.data,t)}},length:function(){return i.tasks.length},running:function(){return d},idle:function(){return i.tasks.length+d===0},pause:function(){i.paused!==!0&&(i.paused=!0,i.process())},resume:function(){i.paused!==!1&&(i.paused=!1,i.process())}};return i},t.cargo=function(e,f){var n=!1,o=[],d={tasks:o,payload:f,saturated:null,empty:null,drain:null,drained:!0,push:function(e,n){u(e)||(e=[e]),p(e,function(e){o.push({data:e,callback:"function"==typeof n?n:null}),d.drained=!1,d.saturated&&o.length===f&&d.saturated()}),t.setImmediate(d.process)},process:function i(){if(!n){if(0===o.length)return d.drain&&!d.drained&&d.drain(),void(d.drained=!0);var t="number"==typeof f?o.splice(0,f):o.splice(0,o.length),l=s(t,function(e){return e.data});d.empty&&d.empty(),n=!0,e(l,function(){n=!1;var e=arguments;p(t,function(f){f.callback&&f.callback.apply(null,e)}),i()})}},length:function(){return o.length},running:function(){return n}};return d};var X=function(e){return function(f){var n=Array.prototype.slice.call(arguments,1);f.apply(null,n.concat([function(f){var n=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(f?console.error&&console.error(f):console[e]&&p(n,function(f){console[e](f)}))}]))}};t.log=X("log"),t.dir=X("dir"),t.memoize=function(e,f){var n={},o={};f=f||function(e){return e};var d=function(){var d=Array.prototype.slice.call(arguments),i=d.pop(),l=f.apply(null,d);l in n?t.nextTick(function(){i.apply(null,n[l])}):l in o?o[l].push(i):(o[l]=[i],e.apply(null,d.concat([function(){n[l]=arguments;var e=o[l];delete o[l];for(var f=0,d=e.length;d>f;f++)e[f].apply(null,arguments)}])))};return d.memo=n,d.unmemoized=e,d},t.unmemoize=function(e){return function(){return(e.unmemoized||e).apply(null,arguments)}},t.times=function(e,f,n){for(var o=[],d=0;e>d;d++)o.push(d);return t.map(o,f,n)},t.timesSeries=function(e,f,n){for(var o=[],d=0;e>d;d++)o.push(d);return t.mapSeries(o,f,n)},t.seq=function(){var e=arguments;return function(){var f=this,n=Array.prototype.slice.call(arguments),o=n.pop();t.reduce(e,n,function(e,n,o){n.apply(f,e.concat([function(){var e=arguments[0],f=Array.prototype.slice.call(arguments,1);o(e,f)}]))},function(e,n){o.apply(f,[e].concat(n))})}},t.compose=function(){return t.seq.apply(null,Array.prototype.reverse.call(arguments))};var h=function(e,f){var n=function(){var n=this,o=Array.prototype.slice.call(arguments),d=o.pop();return e(f,function(e,f){e.apply(n,o.concat([f]))},d)};if(arguments.length>2){var o=Array.prototype.slice.call(arguments,2);return n.apply(this,o)}return n};t.applyEach=r(h),t.applyEachSeries=b(h),t.forever=function(e,f){function n(o){if(o){if(f)return f(o);throw o}e(n)}n()},"undefined"!=typeof n&&n.exports?n.exports=t:"undefined"!=typeof e&&e.amd?e([],function(){return t}):d.async=t}()}).call(this,f("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139}],89:[function(e,f){(function(e){!function(){"use strict";function n(f){return new e(f,"base64").toString("binary")}f.exports=n}()}).call(this,e("buffer").Buffer)},{buffer:129}],90:[function(e,f){"use strict";f.exports=function(f,n,o){function d(e,f){var o=n(e,i,f===!0&&e._isBound()?e._boundTo:void 0),d=o.promise();return d.isRejected()?d:(o.setHowMany(1),o.setUnwrap(),o.init(),d)}var i=e("./some_promise_array.js")(o);f.any=function(e){return d(e,!1)},f.prototype.any=function(){return d(this,!0)}}},{"./some_promise_array.js":122}],91:[function(e,f){"use strict";function n(){this._isTickUsed=!1,this._length=0,this._lateBuffer=new d,this._functionBuffer=new d(75e3);var e=this;this.consumeFunctionBuffer=function(){e._consumeFunctionBuffer()}}var o=e("./schedule.js"),d=e("./queue.js"),i=e("./util.js").errorObj,t=e("./util.js").tryCatch1,l=e("./global.js").process;n.prototype.haveItemsQueued=function(){return this._length>0},n.prototype.invokeLater=function(e,f,n){void 0===l||null==l.domain||e.domain||(e=l.domain.bind(e)),this._lateBuffer.push(e,f,n),this._queueTick()},n.prototype.invoke=function(e,f,n){void 0===l||null==l.domain||e.domain||(e=l.domain.bind(e));var o=this._functionBuffer;o.push(e,f,n),this._length=o.length(),this._queueTick()},n.prototype._consumeFunctionBuffer=function(){for(var e=this._functionBuffer;e.length()>0;){var f=e.shift(),n=e.shift(),o=e.shift();f.call(n,o)}this._reset(),this._consumeLateBuffer()},n.prototype._consumeLateBuffer=function(){for(var e=this._lateBuffer;e.length()>0;){var f=e.shift(),n=e.shift(),o=e.shift(),d=t(f,n,o);if(d===i){if(this._queueTick(),null==f.domain)throw d.e;f.domain.emit("error",d.e)}}},n.prototype._queueTick=function(){this._isTickUsed||(o(this.consumeFunctionBuffer),this._isTickUsed=!0)},n.prototype._reset=function(){this._isTickUsed=!1,this._length=0},f.exports=new n},{"./global.js":104,"./queue.js":115,"./schedule.js":118,"./util.js":126}],92:[function(e,f){"use strict";var n=e("./promise.js")();f.exports=n},{"./promise.js":108}],93:[function(e,f){"use strict";f.exports=function(e){function f(e){var f="string"==typeof this?this:""+this;return e[f]}e.prototype.call=function(e){for(var f=arguments.length,n=new Array(f-1),o=1;f>o;++o)n[o-1]=arguments[o];return this._then(function(f){return f[e].apply(f,n)},void 0,void 0,void 0,void 0)},e.prototype.get=function(e){return this._then(f,void 0,void 0,e,void 0)}}},{}],94:[function(e,f){"use strict";f.exports=function(f,n){var o=e("./errors.js"),d=e("./async.js"),i=o.CancellationError;f.prototype._cancel=function(){if(!this.isCancellable())return this;for(var e,f=this;void 0!==(e=f._cancellationParent)&&e.isCancellable();)f=e;var n=new i;f._attachExtraTrace(n),f._rejectUnchecked(n)},f.prototype.cancel=function(){return this.isCancellable()?(d.invokeLater(this._cancel,this,void 0),this):this},f.prototype.cancellable=function(){return this._cancellable()?this:(this._setCancellable(),this._cancellationParent=void 0,this)},f.prototype.uncancellable=function(){var e=new f(n);return e._setTrace(this),e._follow(this),e._unsetCancellable(),this._isBound()&&e._setBoundTo(this._boundTo),e},f.prototype.fork=function(e,f,n){var o=this._then(e,f,n,void 0,void 0);return o._setCancellable(),o._cancellationParent=void 0,o}}},{"./async.js":91,"./errors.js":98}],95:[function(e,f){"use strict";f.exports=function(){function f(e){var f;if("function"==typeof e)f="[function "+(e.name||"anonymous")+"]";else{f=e.toString();var o=/\[object [a-zA-Z0-9$_]+\]/;if(o.test(f))try{var d=JSON.stringify(e);f=d}catch(i){}0===f.length&&(f="(empty array)")}return"(<"+n(f)+">, no stack trace)"}function n(e){var f=41;return e.length<f?e:e.substr(0,f-3)+"..."}function o(e,f){this.captureStackTrace(o,f)}var d=e("./util.js").inherits,i=e("./es5.js").defineProperty,t=new RegExp("\\b(?:[a-zA-Z0-9.]+\\$_\\w+|tryCatch(?:1|2|Apply)|new \\w*PromiseArray|\\w*PromiseArray\\.\\w*PromiseArray|setTimeout|CatchFilter\\$_\\w+|makeNodePromisified|processImmediate|process._tickCallback|nextTick|Async\\$\\w+)\\b"),l=null,u=null;d(o,Error),o.prototype.captureStackTrace=function(e,f){p(this,e,f)},o.possiblyUnhandledRejection=function(e){if("object"==typeof console){var f;if("object"==typeof e||"function"==typeof e){var n=e.stack;f="Possibly unhandled "+u(n,e)}else f="Possibly unhandled "+String(e);"function"==typeof console.error||"object"==typeof console.error?console.error(f):("function"==typeof console.log||"object"==typeof console.log)&&console.log(f)}},o.combine=function(e,f){for(var n=e.length-1,o=f.length-1;o>=0;--o){var d=f[o];if(e[n]!==d)break;e.pop(),n--}e.push("From previous event:");for(var i=e.concat(f),u=[],o=0,p=i.length;p>o;++o)t.test(i[o])||o>0&&!l.test(i[o])&&"From previous event:"!==i[o]||u.push(i[o]);return u},o.isSupported=function(){return"function"==typeof p};var p=function s(){if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){l=/^\s*at\s*/,u=function(e,n){return"string"==typeof e?e:void 0!==n.name&&void 0!==n.message?n.name+". "+n.message:f(n)};var e=Error.captureStackTrace;return function(f,n){e(f,n)}}var n=new Error;if("string"==typeof n.stack&&"function"==typeof"".startsWith&&n.stack.startsWith("stackDetection@")&&"stackDetection"===s.name){i(Error,"stackTraceLimit",{writable:!0,enumerable:!1,configurable:!1,value:25}),l=/@/;var o=/[@\n]/;return u=function(e,n){return"string"==typeof e?n.name+". "+n.message+"\n"+e:void 0!==n.name&&void 0!==n.message?n.name+". "+n.message:f(n)},function(e){for(var f=(new Error).stack,n=f.split(o),d=n.length,i="",t=0;d>t;t+=2)i+=n[t],i+="@",i+=n[t+1],i+="\n";e.stack=i}}return u=function(e,n){return"string"==typeof e?e:"object"!=typeof n&&"function"!=typeof n||void 0===n.name||void 0===n.message?f(n):n.name+". "+n.message},null}();return o}},{"./es5.js":100,"./util.js":126}],96:[function(e,f){"use strict";f.exports=function(f){function n(e,f,n){this._instances=e,this._callback=f,this._promise=n}function o(e,f){var n={},o=t(e,n,f);if(o===l)return o;var d=u(n);return d.length?(l.e=new p("Catch filter must inherit from Error or be a simple predicate function"),l):o}var d=e("./util.js"),i=e("./errors.js"),t=d.tryCatch1,l=d.errorObj,u=e("./es5.js").keys,p=i.TypeError;return n.prototype.doFilter=function(e){for(var n=this._callback,d=this._promise,u=d._isBound()?d._boundTo:void 0,p=0,s=this._instances.length;s>p;++p){var c=this._instances[p],y=c===Error||null!=c&&c.prototype instanceof Error;if(y&&e instanceof c){var a=t(n,u,e);return a===l?(f.e=a.e,f):a}if("function"==typeof c&&!y){var r=o(c,e);if(r===l){var w=i.canAttach(l.e)?l.e:new Error(l.e+"");this._promise._attachExtraTrace(w),e=l.e;break}if(r){var a=t(n,u,e);return a===l?(f.e=a.e,f):a}}}return f.e=e,f},n}},{"./errors.js":98,"./es5.js":100,"./util.js":126}],97:[function(e,f){"use strict";var n=e("./util.js"),o=n.isPrimitive,d=n.wrapsPrimitiveReceiver;f.exports=function(e){var f=function(){return this},n=function(){throw this},i=function(e,f){return 1===f?function(){throw e}:2===f?function(){return e}:void 0};e.prototype["return"]=e.prototype.thenReturn=function(e){return d&&o(e)?this._then(i(e,2),void 0,void 0,void 0,void 0):this._then(f,void 0,void 0,e,void 0)},e.prototype["throw"]=e.prototype.thenThrow=function(e){return d&&o(e)?this._then(i(e,1),void 0,void 0,void 0,void 0):this._then(n,void 0,void 0,e,void 0)}}},{"./util.js":126}],98:[function(e,f){"use strict";function n(e){try{y(e,"isAsync",!0)}catch(f){}}function o(e){return null==e?!1:e instanceof l||e.isAsync===!0}function d(e){return e instanceof a}function i(e){return d(e)}function t(e,f){function n(o){return this instanceof n?(this.message="string"==typeof o?o:f,this.name=e,void(a.captureStackTrace&&a.captureStackTrace(this,this.constructor))):new n(o)}return c(n,a),n}function l(e){this.name="RejectionError",this.message=e,this.cause=e,this.isAsync=!0,e instanceof a?(this.message=e.message,this.stack=e.stack):a.captureStackTrace&&a.captureStackTrace(this,this.constructor)}var u=e("./global.js"),p=e("./es5.js").freeze,s=e("./util.js"),c=s.inherits,y=s.notEnumerableProp,a=u.Error,r=u.TypeError;"function"!=typeof r&&(r=t("TypeError","type error"));var w=u.RangeError;"function"!=typeof w&&(w=t("RangeError","range error"));var b=t("CancellationError","cancellation error"),g=t("TimeoutError","timeout error");c(l,a);var m="__BluebirdErrorTypes__",x=u[m];x||(x=p({CancellationError:b,TimeoutError:g,RejectionError:l}),y(u,m,x)),f.exports={Error:a,TypeError:r,RangeError:w,CancellationError:x.CancellationError,RejectionError:x.RejectionError,TimeoutError:x.TimeoutError,originatesFromRejection:o,markAsOriginatingFromRejection:n,canAttach:i}},{"./es5.js":100,"./global.js":104,"./util.js":126}],99:[function(e,f){"use strict";f.exports=function(f){function n(e){var n=new o(e),d=f.rejected(n),i=d._peekContext();return null!=i&&i._attachExtraTrace(n),d}var o=e("./errors.js").TypeError;return n}},{"./errors.js":98}],100:[function(e,f){function n(e){var f=[];for(var n in e)u.call(e,n)&&f.push(n);return f}function o(e,f,n){return e[f]=n.value,e}function d(e){return e}function i(e){try{return Object(e).constructor.prototype}catch(f){return s}}function t(e){try{return"[object Array]"===p.call(e)}catch(f){return!1}}var l=function(){"use strict";return void 0===this}();if(l)f.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,keys:Object.keys,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:l};else{var u={}.hasOwnProperty,p={}.toString,s={}.constructor.prototype;f.exports={isArray:t,keys:n,defineProperty:o,freeze:d,getPrototypeOf:i,isES5:l}}},{}],101:[function(e,f){"use strict";f.exports=function(f){function n(e){for(var n=this instanceof f?this._settledValue:this,o=n.length,d=new Array(o),i=0,t=0;o>t;++t)e[t]&&(d[i++]=n[t]);return d.length=i,d}var o=(e("./util.js").isArray,{ref:null});f.filter=function(e,d){return f.map(e,d,o)._then(n,void 0,void 0,o.ref,void 0)},f.prototype.filter=function(e){return this.map(e,o)._then(n,void 0,void 0,o.ref,void 0)}}},{"./util.js":126}],102:[function(e,f){"use strict";f.exports=function(f,n){function o(){return this}function d(){throw this}function i(e){return function(){return e}}function t(e){return function(){throw e}}function l(e,f,n){var l;return l=c&&y(f)?n?i(f):t(f):n?o:d,e._then(l,a,void 0,f,void 0)}function u(e){var o=this.promise,d=this.handler,i=o._isBound()?d.call(o._boundTo):d();if(void 0!==i){var t=f._cast(i,void 0);if(t instanceof f)return l(t,e,o.isFulfilled())}return o.isRejected()?(n.e=e,n):e}function p(e){var n=this.promise,o=this.handler,d=n._isBound()?o.call(n._boundTo,e):o(e);if(void 0!==d){var i=f._cast(d,void 0);if(i instanceof f)return l(i,e,!0)}return e}var s=e("./util.js"),c=s.wrapsPrimitiveReceiver,y=s.isPrimitive,a=s.thrower;f.prototype._passThroughHandler=function(e,f){if("function"!=typeof e)return this.then();var n={promise:this,handler:e};return this._then(f?u:p,f?u:void 0,void 0,n,void 0)},f.prototype.lastly=f.prototype["finally"]=function(e){return this._passThroughHandler(e,!0)},f.prototype.tap=function(e){return this._passThroughHandler(e,!1)}}},{"./util.js":126}],103:[function(e,f){"use strict";f.exports=function(f,n,o){var d=e("./promise_spawn.js")(f,o),i=e("./errors.js"),t=i.TypeError,l=e("./util.js").deprecated;f.coroutine=function(e){if("function"!=typeof e)throw new t("generatorFunction must be a function");var f=d;return function(){var n=e.apply(this,arguments),o=new f(void 0,void 0);return o._generator=n,o._next(void 0),o.promise()}},f.coroutine.addYieldHandler=d.addYieldHandler,f.spawn=function(e){if(l("Promise.spawn is deprecated. Use Promise.coroutine instead."),"function"!=typeof e)return n("generatorFunction must be a function");var o=new d(e,this),i=o.promise();return o._run(f.spawn),i}}},{"./errors.js":98,"./promise_spawn.js":111,"./util.js":126}],104:[function(e,f){(function(e){f.exports=function(){if(void 0!==this)return this;try{return e}catch(f){}try{return window}catch(f){}try{return self}catch(f){}}()}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],105:[function(e,f){"use strict";f.exports=function(f,n,o,d){function i(e){return t(e,this[0],this[1],this[2])}function t(e,n,t,u){if("function"!=typeof n)return d("fn must be a function");var p=void 0;t===!0?e._isBound()&&(p=e._boundTo):t!==!1&&(p=t);var s=void 0!==u;if(s&&(u.ref=e),e instanceof f){var y=[n,p,u];return e._then(i,void 0,void 0,y,void 0)}if(!c(e))return d("expecting an array, a promise or a thenable");var a=new f(o);void 0!==p&&a._setBoundTo(p),a._setTrace(void 0);var r=new l(a,n,e,p,s);return r.init(),a}function l(e,f,n,o,d){this.shouldUnwrapItems=d,this.index=0,this.items=n,this.callback=f,this.receiver=o,this.promise=e,this.result=new Array(n.length)}var u=f.all,p=e("./util.js"),s=e("./errors.js").canAttach,c=p.isArray,y=f._cast,a={};p.inherits(l,n),l.prototype.init=function(){for(var e=this.items,n=e.length,o=this.result,d=!1,i=0;n>i;++i){var t=y(e[i],void 0);t instanceof f?t.isPending()?(o[i]=a,t._proxyPromiseArray(this,i)):t.isFulfilled()?o[i]=t.value():(t._unsetRejectionIsUnhandled(),d||(this.reject(t.reason()),d=!0)):o[i]=t}d||this.iterate()},l.prototype.isResolved=function(){return null===this.promise},l.prototype._promiseProgressed=function(e){this.isResolved()||this.promise._progress(e)},l.prototype._promiseFulfilled=function(e,f){this.isResolved()||(this.result[f]=e,this.shouldUnwrapItems&&(this.items[f]=e),this.index===f&&this.iterate())},l.prototype._promiseRejected=function(e){this.reject(e)},l.prototype.reject=function(e){if(!this.isResolved()){var f=s(e)?e:new Error(e+"");this.promise._attachExtraTrace(f),this.promise._reject(e,f)}},l.prototype.iterate=function(){for(var e=this.index,f=this.items,n=this.result,o=f.length,n=this.result,d=this.receiver,i=this.callback;o>e;++e){var t=n[e];if(t===a)return void(this.index=e);try{n[e]=i.call(d,t,e,o)}catch(l){return this.reject(l)}}this.promise._follow(u(n)),this.items=this.result=this.callback=this.promise=null},f.prototype.map=function(e,f){return t(this,e,!0,f)},f.map=function(e,f,n){return t(e,f,!1,n)}}},{"./errors.js":98,"./util.js":126}],106:[function(e,f){"use strict";f.exports=function(f){function n(e){throw e}function o(e,f){var o=this,d=void 0===e?u(o,f,null):l(o,f,null,e);d===p&&t.invokeLater(n,void 0,d.e)}function d(e,f){var o=this,d=u(o,f,e);d===p&&t.invokeLater(n,void 0,d.e)}var i=e("./util.js"),t=e("./async.js"),l=i.tryCatch2,u=i.tryCatch1,p=i.errorObj;f.prototype.nodeify=function(e){return"function"==typeof e&&this._then(o,d,void 0,e,this._isBound()?this._boundTo:null),this}}},{"./async.js":91,"./util.js":126}],107:[function(e,f){"use strict";f.exports=function(f,n){var o=e("./util.js"),d=e("./async.js"),i=e("./errors.js"),t=o.tryCatch1,l=o.errorObj;f.prototype.progressed=function(e){return this._then(void 0,void 0,e,void 0,void 0)},f.prototype._progress=function(e){this._isFollowingOrFulfilledOrRejected()||this._progressUnchecked(e)},f.prototype._progressHandlerAt=function(e){return 0===e?this._progressHandler0:this[e+2-5]},f.prototype._doProgressWith=function(e){var n=e.value,o=e.handler,d=e.promise,u=e.receiver;this._pushContext();var p=t(o,u,n);if(this._popContext(),p===l){if(null!=p.e&&"StopProgressPropagation"!==p.e.name){var s=i.canAttach(p.e)?p.e:new Error(p.e+"");d._attachExtraTrace(s),d._progress(p.e)}}else p instanceof f?p._then(d._progress,null,null,d,void 0):d._progress(p)},f.prototype._progressUnchecked=function(e){if(this.isPending())for(var o=this._length(),i=this._progress,t=0;o>t;t+=5){var l=this._progressHandlerAt(t),u=this._promiseAt(t);if(u instanceof f)"function"==typeof l?d.invoke(this._doProgressWith,this,{handler:l,promise:u,receiver:this._receiverAt(t),value:e}):d.invoke(i,u,e);else{var p=this._receiverAt(t);"function"==typeof l?l.call(p,e,u):p instanceof f&&p._isProxied()?p._progressUnchecked(e):n(p,u)&&p._promiseProgressed(e,u)}}}}},{"./async.js":91,"./errors.js":98,"./util.js":126}],108:[function(e,f){(function(n){"use strict";f.exports=function(){function f(e){return void 0===e?!1:e instanceof d}function o(e,f){return e instanceof r?f>=0:!1}function d(e){if("function"!=typeof e)throw new X("the promise constructor requires a resolver function");if(this.constructor!==d)throw new X("the promise constructor cannot be invoked directly");this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._settledValue=void 0,this._boundTo=void 0,e!==c&&this._resolveFromResolver(e)}function i(e,f){return t(e,r,f===!0&&e._isBound()?e._boundTo:void 0).promise()}function t(e,n,o){var i=null;return m(e)?i=e:(i=d._cast(e,void 0),i!==e?i._setBoundTo(o):f(i)||(i=null)),null!==i?new n(i,o):{promise:function(){return D("expecting an array, a promise or a thenable")}}}var l=e("./global.js"),u=e("./util.js"),p=e("./async.js"),s=e("./errors.js"),c=function(){},y={},a={e:null},r=e("./promise_array.js")(d,c),w=e("./captured_trace.js")(),b=e("./catch_filter.js")(a),g=e("./promise_resolver.js"),m=u.isArray,x=u.errorObj,P=u.tryCatch1,j=u.tryCatch2,v=u.tryCatchApply,M=s.RangeError,X=s.TypeError,h=s.CancellationError,k=s.TimeoutError,q=s.RejectionError,z=s.originatesFromRejection,A=s.markAsOriginatingFromRejection,B=s.canAttach,C=u.thrower,D=e("./errors_api_rejection")(d),E=function(){return new X("circular promise resolution chain")};d.prototype.bind=function(e){var f=new d(c);return f._setTrace(this),f._follow(this),f._setBoundTo(e),this._cancellable()&&(f._setCancellable(),f._cancellationParent=this),f},d.prototype.toString=function(){return"[object Promise]"},d.prototype.caught=d.prototype["catch"]=function(e){var f=arguments.length;if(f>1){var n,o=new Array(f-1),d=0;for(n=0;f-1>n;++n){var i=arguments[n];if("function"!=typeof i){var t=new X("A catch filter must be an error constructor or a filter function");return this._attachExtraTrace(t),void p.invoke(this._reject,this,t)}o[d++]=i}o.length=d,e=arguments[n],this._resetTrace();var l=new b(o,e,this);return this._then(void 0,l.doFilter,void 0,l,void 0)}return this._then(void 0,e,void 0,void 0,void 0)},d.prototype.then=function(e,f,n){return this._then(e,f,n,void 0,void 0)},d.prototype.done=function(e,f,n){var o=this._then(e,f,n,void 0,void 0);o._setIsFinal()},d.prototype.spread=function(e,f){return this._then(e,f,void 0,y,void 0)},d.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable()},d.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this._settledValue,e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this._settledValue,e.isRejected=!0),e},d.prototype.all=function(){return i(this,!0)},d.is=f,d.all=function(e){return i(e,!1)},d.join=function(){for(var e=arguments.length,f=new Array(e),n=0;e>n;++n)f[n]=arguments[n];return t(f,r,void 0).promise()},d.resolve=d.fulfilled=function(e){var f=new d(c);return f._setTrace(void 0),f._tryFollow(e)?f:(f._cleanValues(),f._setFulfilled(),f._settledValue=e,f)},d.reject=d.rejected=function(e){var f=new d(c);if(f._setTrace(void 0),A(e),f._cleanValues(),f._setRejected(),f._settledValue=e,!B(e)){var n=new Error(e+"");f._setCarriedStackTrace(n)}return f._ensurePossibleRejectionHandled(),f},d.prototype.error=function(e){return this.caught(z,e)},d.prototype._resolveFromSyncValue=function(e){if(e===x)this._cleanValues(),this._setRejected(),this._settledValue=e.e,this._ensurePossibleRejectionHandled();else{var f=d._cast(e,void 0);f instanceof d?this._follow(f):(this._cleanValues(),this._setFulfilled(),this._settledValue=e)}},d.method=function(e){if("function"!=typeof e)throw new X("fn must be a function");return function(){var f;switch(arguments.length){case 0:f=P(e,this,void 0);break;case 1:f=P(e,this,arguments[0]);break;case 2:f=j(e,this,arguments[0],arguments[1]);break;default:for(var n=arguments.length,o=new Array(n),i=0;n>i;++i)o[i]=arguments[i];f=v(e,o,this)}var t=new d(c);return t._setTrace(void 0),t._resolveFromSyncValue(f),t}},d.attempt=d["try"]=function(e,f,n){if("function"!=typeof e)return D("fn must be a function");var o=m(f)?v(e,f,n):P(e,n,f),i=new d(c);return i._setTrace(void 0),i._resolveFromSyncValue(o),i},d.defer=d.pending=function(){var e=new d(c);return e._setTrace(void 0),new g(e)},d.bind=function(e){var f=new d(c);return f._setTrace(void 0),f._setFulfilled(),f._setBoundTo(e),f},d.cast=function(e){var f=d._cast(e,void 0);return f instanceof d?f:d.resolve(f)},d.onPossiblyUnhandledRejection=function(e){w.possiblyUnhandledRejection="function"==typeof e?e:void 0};var F;d.onUnhandledRejectionHandled=function(e){F="function"==typeof e?e:void 0};var G=!1||!("undefined"==typeof n||"string"!=typeof n.execPath||"object"!=typeof n.env||!n.env.BLUEBIRD_DEBUG&&"development"!==n.env.NODE_ENV);d.longStackTraces=function(){if(p.haveItemsQueued()&&G===!1)throw new Error("cannot enable long stack traces after promises have been created");G=w.isSupported()},d.hasLongStackTraces=function(){return G&&w.isSupported()},d.prototype._setProxyHandlers=function(e,f){var n=this._length();if(n>=524282&&(n=0,this._setLength(0)),0===n)this._promise0=f,this._receiver0=e;else{var o=n-5;this[o+3]=f,this[o+4]=e,this[o+0]=this[o+1]=this[o+2]=void 0}this._setLength(n+5)},d.prototype._proxyPromiseArray=function(e,f){this._setProxyHandlers(e,f)},d.prototype._proxyPromise=function(e){e._setProxied(),this._setProxyHandlers(e,-1)},d.prototype._then=function(e,f,n,o,i){var t=void 0!==i,l=t?i:new d(c);if(G&&!t){var u=this._peekContext()===this._traceParent;l._traceParent=u?this._traceParent:this,l._setTrace(this)}!t&&this._isBound()&&l._setBoundTo(this._boundTo);var s=this._addCallbacks(e,f,n,l,o);return!t&&this._cancellable()&&(l._setCancellable(),l._cancellationParent=this),this.isResolved()&&p.invoke(this._queueSettleAt,this,s),l},d.prototype._length=function(){return 524287&this._bitField},d.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},d.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},d.prototype._setLength=function(e){this._bitField=-524288&this._bitField|524287&e},d.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},d.prototype._setRejected=function(){this._bitField=134217728|this._bitField},d.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},d.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},d.prototype._isFinal=function(){return(33554432&this._bitField)>0},d.prototype._cancellable=function(){return(67108864&this._bitField)>0},d.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},d.prototype._unsetCancellable=function(){this._bitField=-67108865&this._bitField},d.prototype._setRejectionIsUnhandled=function(){this._bitField=2097152|this._bitField},d.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-2097153&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},d.prototype._isRejectionUnhandled=function(){return(2097152&this._bitField)>0},d.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=524288|this._bitField},d.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-524289&this._bitField},d.prototype._isUnhandledRejectionNotified=function(){return(524288&this._bitField)>0},d.prototype._setCarriedStackTrace=function(e){this._bitField=1048576|this._bitField,this._fulfillmentHandler0=e},d.prototype._unsetCarriedStackTrace=function(){this._bitField=-1048577&this._bitField,this._fulfillmentHandler0=void 0},d.prototype._isCarryingStackTrace=function(){return(1048576&this._bitField)>0},d.prototype._getCarriedStackTrace=function(){return this._isCarryingStackTrace()?this._fulfillmentHandler0:void 0},d.prototype._receiverAt=function(e){var f;return f=0===e?this._receiver0:this[e+4-5],this._isBound()&&void 0===f?this._boundTo:f},d.prototype._promiseAt=function(e){return 0===e?this._promise0:this[e+3-5]},d.prototype._fulfillmentHandlerAt=function(e){return 0===e?this._fulfillmentHandler0:this[e+0-5]},d.prototype._rejectionHandlerAt=function(e){return 0===e?this._rejectionHandler0:this[e+1-5]},d.prototype._unsetAt=function(e){0===e?(this._rejectionHandler0=this._progressHandler0=this._promise0=this._receiver0=void 0,this._isCarryingStackTrace()||(this._fulfillmentHandler0=void 0)):this[e-5+0]=this[e-5+1]=this[e-5+2]=this[e-5+3]=this[e-5+4]=void 0},d.prototype._resolveFromResolver=function(e){function f(e){o._tryFollow(e)||o._fulfill(e)}function n(e){var f=B(e)?e:new Error(e+"");o._attachExtraTrace(f),A(e),o._reject(e,f===e?void 0:f)}var o=this;this._setTrace(void 0),this._pushContext();var d=j(e,void 0,f,n);if(this._popContext(),void 0!==d&&d===x){var i=d.e,t=B(i)?i:new Error(i+"");o._reject(i,t)}},d.prototype._addCallbacks=function(e,f,n,o,d){var i=this._length();if(i>=524282&&(i=0,this._setLength(0)),0===i)this._promise0=o,void 0!==d&&(this._receiver0=d),"function"!=typeof e||this._isCarryingStackTrace()||(this._fulfillmentHandler0=e),"function"==typeof f&&(this._rejectionHandler0=f),"function"==typeof n&&(this._progressHandler0=n);else{var t=i-5;this[t+3]=o,this[t+4]=d,this[t+0]="function"==typeof e?e:void 0,this[t+1]="function"==typeof f?f:void 0,this[t+2]="function"==typeof n?n:void 0}return this._setLength(i+5),i},d.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=8388608|this._bitField,this._boundTo=e):this._bitField=-8388609&this._bitField},d.prototype._isBound=function(){return 8388608===(8388608&this._bitField)},d.prototype._spreadSlowCase=function(e,f,n,o){var d=t(n,r,o).promise()._then(function(){return e.apply(o,arguments)},void 0,void 0,y,void 0);f._follow(d)},d.prototype._callSpread=function(e,n,o,i){var t=this._isBound()?this._boundTo:void 0;if(m(o))for(var l=0,u=o.length;u>l;++l)if(f(d._cast(o[l],void 0)))return void this._spreadSlowCase(e,n,o,t);return i&&n._pushContext(),v(e,o,t)},d.prototype._callHandler=function(e,f,n,o,d){var i;return f!==y||this.isRejected()?(d&&n._pushContext(),i=P(e,f,o)):i=this._callSpread(e,n,o,d),d&&n._popContext(),i},d.prototype._settlePromiseFromHandler=function(e,n,o,i){if(!f(i))return void e.call(n,o,i);var t=G,l=this._callHandler(e,n,i,o,t);if(!i._isFollowing())if(l===x||l===i||l===a){var u=l===i?E():l.e,p=B(u)?u:new Error(u+"");l!==a&&i._attachExtraTrace(p),i._rejectUnchecked(u,p)}else{var s=d._cast(l,i);if(f(s)){if(s.isRejected()&&!s._isCarryingStackTrace()&&!B(s._settledValue)){var p=new Error(s._settledValue+"");i._attachExtraTrace(p),s._setCarriedStackTrace(p)}i._follow(s),s._cancellable()&&(i._cancellationParent=s,i._setCancellable())}else i._fulfillUnchecked(l)}},d.prototype._follow=function(e){this._setFollowing(),e.isPending()?(e._cancellable()&&(this._cancellationParent=e,this._setCancellable()),e._proxyPromise(this)):e.isFulfilled()?this._fulfillUnchecked(e._settledValue):this._rejectUnchecked(e._settledValue,e._getCarriedStackTrace()),e._isRejectionUnhandled()&&e._unsetRejectionIsUnhandled(),G&&null==e._traceParent&&(e._traceParent=this)},d.prototype._tryFollow=function(e){if(this._isFollowingOrFulfilledOrRejected()||e===this)return!1;var n=d._cast(e,void 0); | |
return f(n)?(this._follow(n),!0):!1},d.prototype._resetTrace=function(){G&&(this._trace=new w(void 0===this._peekContext()))},d.prototype._setTrace=function(e){if(G){var f=this._peekContext();this._traceParent=f;var n=void 0===f;this._trace=void 0!==e&&e._traceParent===f?e._trace:new w(n)}return this},d.prototype._attachExtraTrace=function(e){if(G){var f=this,n=e.stack;n="string"==typeof n?n.split("\n"):[];for(var o=1;null!=f&&null!=f._trace;)n=w.combine(n,f._trace.stack.split("\n")),f=f._traceParent;var d=Error.stackTraceLimit+o,i=n.length;i>d&&(n.length=d),e.stack=n.length<=o?"(No stack trace)":n.join("\n")}},d.prototype._cleanValues=function(){this._cancellable()&&(this._cancellationParent=void 0)},d.prototype._fulfill=function(e){this._isFollowingOrFulfilledOrRejected()||this._fulfillUnchecked(e)},d.prototype._reject=function(e,f){this._isFollowingOrFulfilledOrRejected()||this._rejectUnchecked(e,f)},d.prototype._settlePromiseAt=function(e){var f=this.isFulfilled()?this._fulfillmentHandlerAt(e):this._rejectionHandlerAt(e),n=this._settledValue,i=this._receiverAt(e),t=this._promiseAt(e);if("function"==typeof f)this._settlePromiseFromHandler(f,i,n,t);else{var l=!1,u=this.isFulfilled();void 0!==i&&(i instanceof d&&i._isProxied()?(i._unsetProxied(),u?i._fulfillUnchecked(n):i._rejectUnchecked(n,this._getCarriedStackTrace()),l=!0):o(i,t)&&(u?i._promiseFulfilled(n,t):i._promiseRejected(n,t),l=!0)),l||(u?t._fulfill(n):t._reject(n,this._getCarriedStackTrace()))}e>=256&&this._queueGC()},d.prototype._isProxied=function(){return 4194304===(4194304&this._bitField)},d.prototype._setProxied=function(){this._bitField=4194304|this._bitField},d.prototype._unsetProxied=function(){this._bitField=-4194305&this._bitField},d.prototype._isGcQueued=function(){return-1073741824===(-1073741824&this._bitField)},d.prototype._setGcQueued=function(){this._bitField=-1073741824|this._bitField},d.prototype._unsetGcQueued=function(){this._bitField=1073741823&this._bitField},d.prototype._queueGC=function(){this._isGcQueued()||(this._setGcQueued(),p.invokeLater(this._gc,this,void 0))},d.prototype._gc=function(){var e=this._length();this._unsetAt(0);for(var f=0;e>f;f++)delete this[f];this._setLength(0),this._unsetGcQueued()},d.prototype._queueSettleAt=function(e){this._isRejectionUnhandled()&&this._unsetRejectionIsUnhandled(),p.invoke(this._settlePromiseAt,this,e)},d.prototype._fulfillUnchecked=function(e){if(this.isPending()){if(e===this){var f=E();return this._attachExtraTrace(f),this._rejectUnchecked(f,void 0)}this._cleanValues(),this._setFulfilled(),this._settledValue=e;var n=this._length();n>0&&p.invoke(this._settlePromises,this,n)}},d.prototype._rejectUncheckedCheckError=function(e){var f=B(e)?e:new Error(e+"");this._rejectUnchecked(e,f===e?void 0:f)},d.prototype._rejectUnchecked=function(e,f){if(this.isPending()){if(e===this){var n=E();return this._attachExtraTrace(n),this._rejectUnchecked(n)}if(this._cleanValues(),this._setRejected(),this._settledValue=e,this._isFinal())return void p.invokeLater(C,void 0,void 0===f?e:f);var o=this._length();void 0!==f&&this._setCarriedStackTrace(f),o>0?p.invoke(this._rejectPromises,this,null):this._ensurePossibleRejectionHandled()}},d.prototype._rejectPromises=function(){this._settlePromises(),this._unsetCarriedStackTrace()},d.prototype._settlePromises=function(){for(var e=this._length(),f=0;e>f;f+=5)this._settlePromiseAt(f)},d.prototype._ensurePossibleRejectionHandled=function(){this._setRejectionIsUnhandled(),void 0!==w.possiblyUnhandledRejection&&p.invokeLater(this._notifyUnhandledRejection,this,void 0)},d.prototype._notifyUnhandledRejectionIsHandled=function(){"function"==typeof F&&p.invokeLater(F,void 0,this)},d.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue,f=this._getCarriedStackTrace();this._setUnhandledRejectionIsNotified(),void 0!==f&&(this._unsetCarriedStackTrace(),e=f),"function"==typeof w.possiblyUnhandledRejection&&w.possiblyUnhandledRejection(e,this)}};var H=[];d.prototype._peekContext=function(){var e=H.length-1;return e>=0?H[e]:void 0},d.prototype._pushContext=function(){G&&H.push(this)},d.prototype._popContext=function(){G&&H.pop()};var I=l.Promise;return d.noConflict=function(){return l.Promise===d&&(l.Promise=I),d},w.isSupported()||(d.longStackTraces=function(){},G=!1),d._makeSelfResolutionError=E,e("./finally.js")(d,a),e("./direct_resolve.js")(d),e("./thenables.js")(d,c),e("./synchronous_inspection.js")(d),d.RangeError=M,d.CancellationError=h,d.TimeoutError=k,d.TypeError=X,d.RejectionError=q,u.toFastProperties(d),u.toFastProperties(d.prototype),e("./timers.js")(d,c),e("./any.js")(d,t,r),e("./race.js")(d,c),e("./call_get.js")(d),e("./filter.js")(d,t,r,D),e("./generators.js")(d,D,c),e("./map.js")(d,r,c,D),e("./nodeify.js")(d),e("./promisify.js")(d,c),e("./props.js")(d,r),e("./reduce.js")(d,t,r,D,c),e("./settle.js")(d,t,r),e("./some.js")(d,t,r,D),e("./progress.js")(d,o),e("./cancel.js")(d,c),d.prototype=d.prototype,d}}).call(this,e("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./any.js":90,"./async.js":91,"./call_get.js":93,"./cancel.js":94,"./captured_trace.js":95,"./catch_filter.js":96,"./direct_resolve.js":97,"./errors.js":98,"./errors_api_rejection":99,"./filter.js":101,"./finally.js":102,"./generators.js":103,"./global.js":104,"./map.js":105,"./nodeify.js":106,"./progress.js":107,"./promise_array.js":109,"./promise_resolver.js":110,"./promisify.js":112,"./props.js":114,"./race.js":116,"./reduce.js":117,"./settle.js":119,"./some.js":121,"./synchronous_inspection.js":123,"./thenables.js":124,"./timers.js":125,"./util.js":126,"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139}],109:[function(e,f){"use strict";f.exports=function(f,n){function o(e){switch(e){case-1:return void 0;case-2:return[];case-3:return{}}}function d(e,o){var d=this._promise=new f(n),i=void 0;e instanceof f&&(i=e,e._cancellable()&&(d._setCancellable(),d._cancellationParent=e),e._isBound()&&d._setBoundTo(o)),d._setTrace(i),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var i=e("./errors.js").canAttach,t=e("./util.js"),l=e("./async.js"),u={}.hasOwnProperty,p=t.isArray;return d.PropertiesPromiseArray=function(){},d.prototype.length=function(){return this._length},d.prototype.promise=function(){return this._promise},d.prototype._init=function(e,n){var i=this._values;if(i instanceof f){if(!i.isFulfilled())return i.isPending()?void i._then(this._init,this._reject,void 0,this,n):(i._unsetRejectionIsUnhandled(),void this._reject(i._settledValue));if(i=i._settledValue,!p(i)){var t=new f.TypeError("expecting an array, a promise or a thenable");return void this.__hardReject__(t)}this._values=i}if(0===i.length)return void this._resolve(o(n));var s,c=i.length,y=c;s=this instanceof d.PropertiesPromiseArray?this._values:new Array(c);for(var a=!1,r=0;c>r;++r){var w=i[r];if(void 0!==w||u.call(i,r)){var b=f._cast(w,void 0);b instanceof f?b.isPending()?b._proxyPromiseArray(this,r):(b._unsetRejectionIsUnhandled(),a=!0):a=!0,s[r]=b}else y--}if(0===y)return void this._resolve(-2===n?s:o(n));if(this._values=s,this._length=y,a){var g=y===c?this._scanDirectValues:this._scanDirectValuesHoled;l.invoke(g,this,c)}},d.prototype._settlePromiseAt=function(e){var n=this._values[e];n instanceof f?n.isFulfilled()?this._promiseFulfilled(n._settledValue,e):n.isRejected()&&this._promiseRejected(n._settledValue,e):this._promiseFulfilled(n,e)},d.prototype._scanDirectValuesHoled=function(e){for(var f=0;e>f&&!this._isResolved();++f)u.call(this._values,f)&&this._settlePromiseAt(f)},d.prototype._scanDirectValues=function(e){for(var f=0;e>f&&!this._isResolved();++f)this._settlePromiseAt(f)},d.prototype._isResolved=function(){return null===this._values},d.prototype._resolve=function(e){this._values=null,this._promise._fulfill(e)},d.prototype.__hardReject__=d.prototype._reject=function(e){this._values=null;var f=i(e)?e:new Error(e+"");this._promise._attachExtraTrace(f),this._promise._reject(e,f)},d.prototype._promiseProgressed=function(e,f){this._isResolved()||this._promise._progress({index:f,value:e})},d.prototype._promiseFulfilled=function(e,f){if(!this._isResolved()){this._values[f]=e;var n=++this._totalResolved;n>=this._length&&this._resolve(this._values)}},d.prototype._promiseRejected=function(e){this._isResolved()||(this._totalResolved++,this._reject(e))},d}},{"./async.js":91,"./errors.js":98,"./util.js":126}],110:[function(e,f){"use strict";function n(e){return e instanceof Error&&a.getPrototypeOf(e)===Error.prototype}function o(e){var f;return f=n(e)?new s(e):e,u.markAsOriginatingFromRejection(f),f}function d(e){function f(f,n){if(null!==e){if(f){var d=o(l(f));e._attachExtraTrace(d),e._reject(d)}else if(arguments.length>2){for(var i=arguments.length,t=new Array(i-1),u=1;i>u;++u)t[u-1]=arguments[u];e._fulfill(t)}else e._fulfill(n);e=null}}return f}var i,t=e("./util.js"),l=t.maybeWrapAsError,u=e("./errors.js"),p=u.TimeoutError,s=u.RejectionError,c=e("./async.js"),y=t.haveGetters,a=e("./es5.js");if(i=y?function(e){this.promise=e}:function(e){this.promise=e,this.asCallback=d(e),this.callback=this.asCallback},y){var r={get:function(){return d(this.promise)}};a.defineProperty(i.prototype,"asCallback",r),a.defineProperty(i.prototype,"callback",r)}i._nodebackForPromise=d,i.prototype.toString=function(){return"[object PromiseResolver]"},i.prototype.resolve=i.prototype.fulfill=function(e){var f=this.promise;f._tryFollow(e)||c.invoke(f._fulfill,f,e)},i.prototype.reject=function(e){var f=this.promise;u.markAsOriginatingFromRejection(e);var n=u.canAttach(e)?e:new Error(e+"");f._attachExtraTrace(n),c.invoke(f._reject,f,e),n!==e&&c.invoke(this._setCarriedStackTrace,this,n)},i.prototype.progress=function(e){c.invoke(this.promise._progress,this.promise,e)},i.prototype.cancel=function(){c.invoke(this.promise.cancel,this.promise,void 0)},i.prototype.timeout=function(){this.reject(new p("timeout"))},i.prototype.isResolved=function(){return this.promise.isResolved()},i.prototype.toJSON=function(){return this.promise.toJSON()},i.prototype._setCarriedStackTrace=function(e){this.promise.isRejected()&&this.promise._setCarriedStackTrace(e)},f.exports=i},{"./async.js":91,"./errors.js":98,"./es5.js":100,"./util.js":126}],111:[function(e,f){"use strict";f.exports=function(f,n){function o(e){for(var n=c,d=p,i=f,t=n.length,l=0;t>l;++l){var u=s(n[l],void 0,e);if(u===d)return i.reject(d.e);var y=i._cast(u,o,void 0);if(y instanceof i)return y}return null}function d(e,o){var d=this._promise=new f(n);d._setTrace(void 0),this._generatorFunction=e,this._receiver=o,this._generator=void 0}var i=e("./errors.js"),t=i.TypeError,l=e("./util.js"),u=l.isArray,p=l.errorObj,s=l.tryCatch1,c=[];return d.prototype.promise=function(){return this._promise},d.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._next(void 0)},d.prototype._continue=function y(e){if(e===p){this._generator=void 0;var n=i.canAttach(e.e)?e.e:new Error(e.e+"");return this._promise._attachExtraTrace(n),void this._promise._reject(e.e,n)}var d=e.value;if(e.done===!0)this._generator=void 0,this._promise._tryFollow(d)||this._promise._fulfill(d);else{var l=f._cast(d,y,void 0);if(!(l instanceof f)&&(l=u(l)?f.all(l):o(l),null===l))return void this._throw(new t("A value was yielded that could not be treated as a promise"));l._then(this._next,this._throw,void 0,this,null)}},d.prototype._throw=function(e){i.canAttach(e)&&this._promise._attachExtraTrace(e),this._continue(s(this._generator["throw"],this._generator,e))},d.prototype._next=function(e){this._continue(s(this._generator.next,this._generator,e))},d.addYieldHandler=function(e){if("function"!=typeof e)throw new t("fn must be a function");c.push(e)},d}},{"./errors.js":98,"./util.js":126}],112:[function(e,f){"use strict";f.exports=function(f,n){function o(e){return e.__isPromisified__===!0}function d(e,f){var n=f+"Async"in e;return n?o(e[f+"Async"]):!1}function i(e){for(var f=0;f<e.length;f+=2){var n=e[f];if(v.test(n))for(var o=n.replace(v,""),d=0;d<e.length;d+=2)if(e[d]===o)throw new j("Cannot promisify an API that has normal methods with Async-suffix")}}function t(e){for(var f=[e],n=Math.max(0,e-1-5),o=e-1;o>=n;--o)o!==e&&f.push(o);for(var o=e+1;5>=o;++o)f.push(o);return f}function l(e){for(var f=new Array(e),n=0;n<f.length;++n)f[n]="_arg"+n;return f.join(", ")}function u(e){return"number"==typeof e.length?Math.max(Math.min(e.length,1024),0):0}function p(e){var f=/^[a-z$_][a-z$_0-9]*$/i;return f.test(e)?"."+e:"['"+e.replace(/(['\\])/g,"\\$1")+"']"}function s(e,o,d,i){function s(f){for(var n=new Array(f),d=0,i=n.length;i>d;++d)n[d]="arguments["+d+"]";var t=f>0?",":"";return"string"==typeof e&&o===a?"this"+p(e)+"("+n.join(",")+t+" fn);break;":(void 0===o?"callback("+n.join(",")+t+" fn);":"callback.call("+(o===a?"this":"receiver")+", "+n.join(",")+t+" fn);")+"break;"}function c(){for(var f="",n=0;n<r.length;++n)f+="case "+r[n]+":"+s(r[n]);return f+="default: var args = new Array(len + 1);var i = 0;for (var i = 0; i < len; ++i) { args[i] = arguments[i];}args[i] = fn;"+("string"==typeof e?"this"+p(e)+".apply(":"callback.apply(")+(o===a?"this":"receiver")+", args); break;"}var y=Math.max(0,u(i)-1),r=t(y),w="string"==typeof d?d+"Async":"promisified";return new Function("Promise","callback","receiver","withAppended","maybeWrapAsError","nodebackForPromise","INTERNAL","var ret = function "+w+"("+l(y)+') {"use strict";var len = arguments.length;var promise = new Promise(INTERNAL);promise._setTrace(void 0);var fn = nodebackForPromise(promise);try {switch(len) {'+c()+"}}catch(e){ var wrapped = maybeWrapAsError(e);promise._attachExtraTrace(wrapped);promise._reject(wrapped);}return promise;}; ret.__isPromisified__ = true; return ret;")(f,e,o,g,m,b,n)}function c(e,o){function d(){var d=o;o===a&&(d=this),"string"==typeof e&&(e=d[e]);var i=new f(n);i._setTrace(void 0);var t=b(i);try{e.apply(d,g(arguments,t))}catch(l){var u=m(l);i._attachExtraTrace(u),i._reject(u)}return i}return d.__isPromisified__=!0,d}function y(e,f,n){if(n){for(var o=M(e),d=0,i=o.length;i>d;d+=2){var t=o[d],l=o[d+1],u=t+"Async";e[u]=X(t,a,t,l)}return r.toFastProperties(e),e}return X(e,f,void 0,e)}var a={},r=e("./util.js"),w=e("./es5.js"),b=e("./promise_resolver.js")._nodebackForPromise,g=r.withAppended,m=r.maybeWrapAsError,x=r.canEvaluate,P=r.deprecated,j=e("./errors").TypeError,v=new RegExp("Async$"),M=function(){if(w.isES5){var e=Object.create,f=Object.getOwnPropertyDescriptor;return function(n){for(var t=[],l=e(null),u=n;null!==n;){for(var p=w.keys(n),s=0,c=p.length;c>s;++s){var y=p[s];if(!l[y]){l[y]=!0;var a=f(n,y);null==a||"function"!=typeof a.value||o(a.value)||d(u,y)||t.push(y,a.value)}}n=w.getPrototypeOf(n)}return i(t),t}}return function(e){var f=[];for(var n in e){var t=e[n];"function"!=typeof t||o(t)||d(e,n)||f.push(n,t)}return i(f),f}}(),X=x?s:c;f.promisify=function(e,f){if("object"==typeof e&&null!==e)return P("Promise.promisify for promisifying entire objects is deprecated. Use Promise.promisifyAll instead."),y(e,f,!0);if("function"!=typeof e)throw new j("fn must be a function");return o(e)?e:y(e,arguments.length<2?a:f,!1)},f.promisifyAll=function(e){if("function"!=typeof e&&"object"!=typeof e)throw new j("the target of promisifyAll must be an object or a function");return y(e,void 0,!0)}}},{"./errors":98,"./es5.js":100,"./promise_resolver.js":110,"./util.js":126}],113:[function(e,f){"use strict";f.exports=function(f,n){function o(e,f){for(var n=t.keys(e),o=new Array(n.length),d=0,i=o.length;i>d;++d)o[d]=e[n[d]];if(this.constructor$(o,f),!this._isResolved())for(var d=0,i=n.length;i>d;++d)o.push(n[d])}var d=e("./util.js"),i=d.inherits,t=e("./es5.js");return i(o,n),o.prototype._init=function(){this._init$(void 0,-3)},o.prototype._promiseFulfilled=function(e,f){if(!this._isResolved()){this._values[f]=e;var n=++this._totalResolved;if(n>=this._length){for(var o={},d=this.length(),i=0,t=this.length();t>i;++i)o[this._values[i+d]]=this._values[i];this._resolve(o)}}},o.prototype._promiseProgressed=function(e,f){this._isResolved()||this._promise._progress({key:this._values[f+this.length()],value:e})},n.PropertiesPromiseArray=o,o}},{"./es5.js":100,"./util.js":126}],114:[function(e,f){"use strict";f.exports=function(f,n){function o(e,n){var o,i=f._cast(e,void 0);return l(i)?(i instanceof f?o=i._then(f.props,void 0,void 0,void 0,void 0):(o=new d(i,n===!0&&i._isBound()?i._boundTo:void 0).promise(),n=!1),n===!0&&i._isBound()&&o._setBoundTo(i._boundTo),o):t("cannot await properties of a non-object")}var d=e("./properties_promise_array.js")(f,n),i=e("./util.js"),t=e("./errors_api_rejection")(f),l=i.isObject;f.prototype.props=function(){return o(this,!0)},f.props=function(e){return o(e,!1)}}},{"./errors_api_rejection":99,"./properties_promise_array.js":113,"./util.js":126}],115:[function(e,f){"use strict";function n(e,f,n,o,d){for(var i=0;d>i;++i)n[i+o]=e[i+f]}function o(e){return e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function d(e){return"number"!=typeof e?16:o(Math.min(Math.max(16,e),1073741824))}function i(e){this._capacity=d(e),this._length=0,this._front=0,this._makeCapacity()}i.prototype._willBeOverCapacity=function(e){return this._capacity<e},i.prototype._pushOne=function(e){var f=this.length();this._checkCapacity(f+1);var n=this._front+f&this._capacity-1;this[n]=e,this._length=f+1},i.prototype.push=function(e,f,n){var o=this.length()+3;if(this._willBeOverCapacity(o))return this._pushOne(e),this._pushOne(f),void this._pushOne(n);var d=this._front+o-3;this._checkCapacity(o);var i=this._capacity-1;this[d+0&i]=e,this[d+1&i]=f,this[d+2&i]=n,this._length=o},i.prototype.shift=function(){var e=this._front,f=this[e];return this[e]=void 0,this._front=e+1&this._capacity-1,this._length--,f},i.prototype.length=function(){return this._length},i.prototype._makeCapacity=function(){for(var e=this._capacity,f=0;e>f;++f)this[f]=void 0},i.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(this._capacity<<3)},i.prototype._resizeTo=function(e){var f=this._front,o=this._capacity,d=new Array(o),i=this.length();if(n(this,0,d,0,o),this._capacity=e,this._makeCapacity(),this._front=0,o>=f+i)n(d,f,this,0,i);else{var t=i-(f+i&o-1);n(d,f,this,0,t),n(d,0,this,t,i-t)}},f.exports=i},{}],116:[function(e,f){"use strict";f.exports=function(f,n){function o(e,o){var u=f._cast(e,void 0);if(u instanceof f)return t(u);if(!i(e))return d("expecting an array, a promise or a thenable");var p=new f(n);p._setTrace(o),void 0!==o&&(o._isBound()&&p._setBoundTo(o._boundTo),o._cancellable()&&(p._setCancellable(),p._cancellationParent=o));for(var s=p._fulfill,c=p._reject,y=0,a=e.length;a>y;++y){var r=e[y];(void 0!==r||l.call(e,y))&&f.cast(r)._then(s,c,void 0,p,null)}return p}var d=e("./errors_api_rejection.js")(f),i=e("./util.js").isArray,t=function(e){return e.then(function(f){return o(f,e)})},l={}.hasOwnProperty;f.race=function(e){return o(e,void 0)},f.prototype.race=function(){return o(this,void 0)}}},{"./errors_api_rejection.js":99,"./util.js":126}],117:[function(e,f){"use strict";f.exports=function(e,f,n,o,d){function i(f,n,o,i,t){this.promise=new e(d),this.index=n,this.length=i.length,this.items=i,this.callback=f,this.receiver=t,this.accum=o}function t(e,f){var n=this,o=void 0;"function"!=typeof n&&(o=n.receiver,n=n.fn);var d=e.length,t=void 0,l=0;void 0!==f?(t=f,l=0):(l=1,d>0&&(t=e[0]));var u=l;if(u>=d)return t;var p=new i(n,u,t,e,o);return p.iterate(),p.promise}function l(e){var f=this.fn,n=this.initialValue;return t.call(f,e,n)}function u(e,f,n,o){return n._then(function(n){return p(e,f,n,o)},void 0,void 0,void 0,void 0)}function p(d,i,p,s){if("function"!=typeof i)return o("fn must be a function");if(s===!0&&d._isBound()&&(i={fn:i,receiver:d._boundTo}),void 0!==p){if(p instanceof e){if(!p.isFulfilled())return u(d,i,p,s);p=p._settledValue}return f(d,n,s===!0&&d._isBound()?d._boundTo:void 0).promise()._then(l,void 0,void 0,{fn:i,initialValue:p},void 0)}return f(d,n,s===!0&&d._isBound()?d._boundTo:void 0).promise()._then(t,void 0,void 0,i,void 0)}i.prototype.reject=function(e){this.promise._reject(e)},i.prototype.fulfill=function(e,f){this.accum=e,this.index=f+1,this.iterate()},i.prototype.iterate=function(){for(var f=this.index,n=this.length,o=this.items,d=this.accum,i=this.receiver,t=this.callback;n>f;++f)if(d=t.call(i,d,o[f],f,n),d=e._cast(d,void 0),d instanceof e)return void d._then(this.fulfill,this.reject,void 0,this,f);this.promise._fulfill(d)},e.reduce=function(e,f,n){return p(e,f,n,!1)},e.prototype.reduce=function(e,f){return p(this,e,f,!0)}}},{}],118:[function(e,f){(function(n){"use strict";var o,d=e("./global.js");if("undefined"!=typeof n&&null!==n&&"function"==typeof n.cwd&&"function"==typeof n.nextTick&&"string"==typeof n.version)o=function(e){n.nextTick(e)};else if("function"!=typeof d.MutationObserver&&"function"!=typeof d.WebkitMutationObserver&&"function"!=typeof d.WebKitMutationObserver||"undefined"==typeof document||"function"!=typeof document.createElement)if("function"==typeof d.postMessage&&"function"!=typeof d.importScripts&&"function"==typeof d.addEventListener&&"function"==typeof d.removeEventListener){var i="bluebird_message_key_"+Math.random();o=function(){function e(e){if(e.source===d&&e.data===i){var n=f;f=void 0,n()}}var f=void 0;return d.addEventListener("message",e,!1),function(e){f=e,d.postMessage(i,"*")}}()}else o="function"==typeof d.MessageChannel?function(){var e=void 0,f=new d.MessageChannel;return f.port1.onmessage=function(){var f=e;e=void 0,f()},function(n){e=n,f.port2.postMessage(null)}}():d.setTimeout?function(e){setTimeout(e,4)}:function(e){e()};else o=function(){var e=d.MutationObserver||d.WebkitMutationObserver||d.WebKitMutationObserver,f=document.createElement("div"),n=void 0,o=new e(function(){var e=n;n=void 0,e()});return o.observe(f,{attributes:!0}),function(e){n=e,f.setAttribute("class","foo")}}();f.exports=o}).call(this,e("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./global.js":104,"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139}],119:[function(e,f){"use strict";f.exports=function(f,n,o){function d(e,f){return n(e,i,f===!0&&e._isBound()?e._boundTo:void 0).promise()}var i=e("./settled_promise_array.js")(f,o);f.settle=function(e){return d(e,!1)},f.prototype.settle=function(){return d(this,!0)}}},{"./settled_promise_array.js":120}],120:[function(e,f){"use strict";f.exports=function(f,n){function o(e,f){this.constructor$(e,f)}var d=f.PromiseInspection,i=e("./util.js"),t=i.inherits;return t(o,n),o.prototype._promiseResolved=function(e,f){this._values[e]=f;var n=++this._totalResolved;n>=this._length&&this._resolve(this._values)},o.prototype._promiseFulfilled=function(e,f){if(!this._isResolved()){var n=new d;n._bitField=268435456,n._settledValue=e,this._promiseResolved(f,n)}},o.prototype._promiseRejected=function(e,f){if(!this._isResolved()){var n=new d;n._bitField=134217728,n._settledValue=e,this._promiseResolved(f,n)}},o}},{"./util.js":126}],121:[function(e,f){"use strict";f.exports=function(f,n,o,d){function i(e,f,o){if((0|f)!==f||0>f)return d("expecting a positive integer");var i=n(e,t,o===!0&&e._isBound()?e._boundTo:void 0),l=i.promise();return l.isRejected()?l:(i.setHowMany(f),i.init(),l)}var t=e("./some_promise_array.js")(o);f.some=function(e,f){return i(e,f,!1)},f.prototype.some=function(e){return i(this,e,!0)}}},{"./some_promise_array.js":122}],122:[function(e,f){"use strict";f.exports=function(f){function n(e,f){this.constructor$(e,f),this._howMany=0,this._unwrap=!1,this._initialized=!1}var o=e("./util.js"),d=e("./errors.js").RangeError,i=o.inherits,t=o.isArray;return i(n,f),n.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-2);var e=t(this._values);if(this._holes=e?this._values.length-this.length():0,!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()){var f="(Promise.some) input array contains less than "+this._howMany+" promises";this._reject(new d(f))}}},n.prototype.init=function(){this._initialized=!0,this._init()},n.prototype.setUnwrap=function(){this._unwrap=!0},n.prototype.howMany=function(){return this._howMany},n.prototype.setHowMany=function(e){this._isResolved()||(this._howMany=e)},n.prototype._promiseFulfilled=function(e){this._isResolved()||(this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),this._resolve(1===this.howMany()&&this._unwrap?this._values[0]:this._values)))},n.prototype._promiseRejected=function(e){this._isResolved()||(this._addRejected(e),this.howMany()>this._canPossiblyFulfill()&&this._reject(this._values.length===this.length()?[]:this._values.slice(this.length()+this._holes)))},n.prototype._fulfilled=function(){return this._totalResolved},n.prototype._rejected=function(){return this._values.length-this.length()-this._holes},n.prototype._addRejected=function(e){this._values.push(e)},n.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},n.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},n}},{"./errors.js":98,"./util.js":126}],123:[function(e,f){"use strict";f.exports=function(e){function f(e){void 0!==e?(this._bitField=e._bitField,this._settledValue=e.isResolved()?e._settledValue:void 0):(this._bitField=0,this._settledValue=void 0)}f.prototype.isFulfilled=e.prototype.isFulfilled=function(){return(268435456&this._bitField)>0},f.prototype.isRejected=e.prototype.isRejected=function(){return(134217728&this._bitField)>0},f.prototype.isPending=e.prototype.isPending=function(){return 0===(402653184&this._bitField)},f.prototype.value=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise");return this._settledValue},f.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise");return this._settledValue},f.prototype.isResolved=e.prototype.isResolved=function(){return(402653184&this._bitField)>0},e.prototype.inspect=function(){return new f(this)},e.PromiseInspection=f}},{}],124:[function(e,f){"use strict";f.exports=function(f,n){function o(e){try{return e.then}catch(f){return p.e=f,p}}function d(e,d){if(s(e)){if(e instanceof f)return e;if(i(e)){var l=new f(n);return l._setTrace(void 0),e._then(l._fulfillUnchecked,l._rejectUncheckedCheckError,l._progressUnchecked,l,null),l._setFollowing(),l}var c=o(e);if(c===p)return void 0!==d&&u(c.e)&&d._attachExtraTrace(c.e),f.reject(c.e);if("function"==typeof c)return t(e,c,d)}return e}function i(e){return c.call(e,"_promise0")}function t(e,n,o){function d(n){if(!p){if(p=!0,e===n){var d=f._makeSelfResolutionError();return void 0!==o&&o._attachExtraTrace(d),void l.promise._reject(d,void 0)}l.resolve(n)}}function i(e){if(!p){p=!0;var f=u(e)?e:new Error(e+"");void 0!==o&&o._attachExtraTrace(f),l.promise._reject(e,f)}}function t(e){if(!p){var f=l.promise;"function"==typeof f._progress&&f._progress(e)}}var l=f.defer(),p=!1;try{n.call(e,d,i,t)}catch(s){if(!p){p=!0;var c=u(s)?s:new Error(s+"");void 0!==o&&o._attachExtraTrace(c),l.promise._reject(s,c)}}return l.promise}var l=e("./util.js"),u=e("./errors.js").canAttach,p=l.errorObj,s=l.isObject,c={}.hasOwnProperty;f._cast=d}},{"./errors.js":98,"./util.js":126}],125:[function(e,f){"use strict";var n=e("./global.js"),o=function(e,f){for(var o=arguments.length,d=new Array(o-2),i=2;o>i;++i)d[i-2]=arguments[i];n.setTimeout(function(){e.apply(void 0,d)},f)};f.exports=function(f,n){var d=(e("./util.js"),e("./errors.js")),i=(e("./errors_api_rejection")(f),f.TimeoutError),t=function(e,f,n){if(e.isPending()){"string"!=typeof f&&(f="operation timed out after "+n+" ms");var o=new i(f);d.markAsOriginatingFromRejection(o),e._attachExtraTrace(o),e._rejectUnchecked(o)}},l=function(e,f){f._fulfill(e)},u=f.delay=function(e,d){void 0===d&&(d=e,e=void 0),d=+d;var i=f._cast(e,void 0),t=new f(n);return i instanceof f?(i._isBound()&&t._setBoundTo(i._boundTo),i._cancellable()&&(t._setCancellable(),t._cancellationParent=i),t._setTrace(i),t._follow(i),t.then(function(e){return f.delay(e,d)})):(t._setTrace(void 0),o(l,d,e,t),t)};f.prototype.delay=function(e){return u(this,e)},f.prototype.timeout=function(e,d){e=+e;var i=new f(n);return i._setTrace(this),this._isBound()&&i._setBoundTo(this._boundTo),this._cancellable()&&(i._setCancellable(),i._cancellationParent=this),i._follow(this),o(t,e,i,d,e),i}}},{"./errors.js":98,"./errors_api_rejection":99,"./global.js":104,"./util.js":126}],126:[function(e,f,n){"use strict";function o(e){"undefined"!=typeof console&&null!==console&&"function"==typeof console.warn&&console.warn("Bluebird: "+e)}function d(e,f,n){try{return e.call(f,n)}catch(o){return x.e=o,x}}function i(e,f,n,o){try{return e.call(f,n,o)}catch(d){return x.e=d,x}}function t(e,f,n){try{return e.apply(n,f)}catch(o){return x.e=o,x}}function l(e){return"string"==typeof e?e:""+e}function u(e){return null==e||e===!0||e===!1||"string"==typeof e||"number"==typeof e}function p(e){return!u(e)}function s(e){return u(e)?new Error(l(e)):e}function c(e,f){var n,o=e.length,d=new Array(o+1);for(n=0;o>n;++n)d[n]=e[n];return d[n]=f,d}function y(e,f,n){if(u(e))return e;var o={value:n,configurable:!0,enumerable:!1,writable:!0};return b.defineProperty(e,f,o),e}function a(e){throw e}function r(e){function f(){}return f.prototype=e,f}var w=e("./global.js"),b=e("./es5.js"),g=function(){try{var e={};return b.defineProperty(e,"f",{get:function(){return 3}}),3===e.f}catch(f){return!1}}(),m=function(){return"undefined"!=typeof window&&null!==window&&"undefined"!=typeof window.document&&"undefined"!=typeof navigator&&null!==navigator&&"string"==typeof navigator.appName&&window===w?!1:!0}(),x={e:{}},P=function(e,f){function n(){this.constructor=e,this.constructor$=f;for(var n in f.prototype)o.call(f.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=f.prototype[n])}var o={}.hasOwnProperty;return n.prototype=f.prototype,e.prototype=new n,e.prototype},j=function(){return"string"!==this}.call("string"),v={thrower:a,isArray:b.isArray,haveGetters:g,notEnumerableProp:y,isPrimitive:u,isObject:p,canEvaluate:m,deprecated:o,errorObj:x,tryCatch1:d,tryCatch2:i,tryCatchApply:t,inherits:P,withAppended:c,asString:l,maybeWrapAsError:s,wrapsPrimitiveReceiver:j,toFastProperties:r};f.exports=v},{"./es5.js":100,"./global.js":104}],127:[function(e,f){function n(e,f){if("function"!=typeof f)throw new Error("Bad callback given: "+f);if(!e)throw new Error("No options given");var t=e.onResponse;if(e="string"==typeof e?{uri:e}:JSON.parse(JSON.stringify(e)),e.onResponse=t,e.verbose&&(n.log=i()),e.url&&(e.uri=e.url,delete e.url),!e.uri&&""!==e.uri)throw new Error("options.uri is a required argument");if("string"!=typeof e.uri)throw new Error("options.uri must be a string");for(var l=["proxy","_redirectsFollowed","maxRedirects","followRedirect"],p=0;p<l.length;p++)if(e[l[p]])throw new Error("options."+l[p]+" is not supported");if(e.callback=f,e.method=e.method||"GET",e.headers=e.headers||{},e.body=e.body||null,e.timeout=e.timeout||n.DEFAULT_TIMEOUT,e.headers.host)throw new Error("Options.headers.host is not supported");return e.json&&(e.headers.accept=e.headers.accept||"application/json","GET"!==e.method&&(e.headers["content-type"]="application/json"),"boolean"!=typeof e.json?e.body=JSON.stringify(e.json):"string"!=typeof e.body&&(e.body=JSON.stringify(e.body))),e.onResponse=e.onResponse||d,e.onResponse===!0&&(e.onResponse=f,e.callback=d),!e.headers.authorization&&e.auth&&(e.headers.authorization="Basic "+u(e.auth.username+":"+e.auth.password)),o(e)}function o(e){function f(){s=!0;var f=new Error("ETIMEDOUT");return f.code="ETIMEDOUT",f.duration=e.timeout,n.log.error("Timeout",{id:u._id,milliseconds:e.timeout}),e.callback(f,u) | |
}function o(){if(s)return n.log.debug("Ignoring timed out state change",{state:u.readyState,id:u.id});if(n.log.debug("State change",{state:u.readyState,id:u.id,timed_out:s}),u.readyState===p.OPENED){n.log.debug("Request started",{id:u.id});for(var f in e.headers)u.setRequestHeader(f,e.headers[f])}else u.readyState===p.HEADERS_RECEIVED?d():u.readyState===p.LOADING?(d(),i()):u.readyState===p.DONE&&(d(),i(),t())}function d(){if(!w.response){if(w.response=!0,n.log.debug("Got response",{id:u.id,status:u.status}),clearTimeout(u.timeoutTimer),u.statusCode=u.status,y&&0==u.statusCode){var f=new Error("CORS request rejected: "+e.uri);return f.cors="rejected",w.loading=!0,w.end=!0,e.callback(f,u)}e.onResponse(null,u)}}function i(){w.loading||(w.loading=!0,n.log.debug("Response body loading",{id:u.id}))}function t(){if(!w.end){if(w.end=!0,n.log.debug("Request done",{id:u.id}),u.body=u.responseText,e.json)try{u.body=JSON.parse(u.responseText)}catch(f){return e.callback(f,u)}e.callback(null,u,u.body)}}var u=new p,s=!1,y=l(e.uri),a="withCredentials"in u;if(c+=1,u.seq_id=c,u.id=c+": "+e.method+" "+e.uri,u._id=u.id,y&&!a){var r=new Error("Browser does not support cross-origin request: "+e.uri);return r.cors="unsupported",e.callback(r,u)}u.timeoutTimer=setTimeout(f,e.timeout);var w={response:!1,loading:!1,end:!1};return u.onreadystatechange=o,u.open(e.method,e.uri,!0),y&&(u.withCredentials=!!e.withCredentials),u.send(e.body),u}function d(){}function i(){var e,f,n={},o=["trace","debug","info","warn","error"];for(f=0;f<o.length;f++)e=o[f],n[e]=d,"undefined"!=typeof console&&console&&console[e]&&(n[e]=t(console,e));return n}function t(e,f){function n(n,o){return"object"==typeof o&&(n+=" "+JSON.stringify(o)),e[f].call(e,n)}return n}function l(e){var f,n=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/;try{f=location.href}catch(o){f=document.createElement("a"),f.href="",f=f.href}var d=n.exec(f.toLowerCase())||[],i=n.exec(e.toLowerCase()),t=!(!i||i[1]==d[1]&&i[2]==d[2]&&(i[3]||("http:"===i[1]?80:443))==(d[3]||("http:"===d[1]?80:443)));return t}function u(e){var f,n,o,d,i,t,l,u,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=0,c=0,y="",a=[];if(!e)return e;do f=e.charCodeAt(s++),n=e.charCodeAt(s++),o=e.charCodeAt(s++),u=f<<16|n<<8|o,d=u>>18&63,i=u>>12&63,t=u>>6&63,l=63&u,a[c++]=p.charAt(d)+p.charAt(i)+p.charAt(t)+p.charAt(l);while(s<e.length);switch(y=a.join(""),e.length%3){case 1:y=y.slice(0,-2)+"==";break;case 2:y=y.slice(0,-1)+"="}return y}var p=XMLHttpRequest;if(!p)throw new Error("missing XMLHttpRequest");f.exports=n,n.log={trace:d,debug:d,info:d,warn:d,error:d};var s=18e4,c=0;n.withCredentials=!1,n.DEFAULT_TIMEOUT=s,n.defaults=function(e){var f=function(f){var n=function(n,o){n="string"==typeof n?{uri:n}:JSON.parse(JSON.stringify(n));for(var d in e)void 0===n[d]&&(n[d]=e[d]);return f(n,o)};return n},o=f(n);return o.get=f(n.get),o.post=f(n.post),o.put=f(n.put),o.head=f(n.head),o};var y=["get","put","post","head"];y.forEach(function(e){var f=e.toUpperCase(),o=e.toLowerCase();n[o]=function(e){"string"==typeof e?e={method:f,uri:e}:(e=JSON.parse(JSON.stringify(e)),e.method=f);var o=[e].concat(Array.prototype.slice.apply(arguments,[1]));return n.apply(this,o)}}),n.couch=function(e,f){function o(e,n,o){if(e)return f(e,n,o);if((n.statusCode<200||n.statusCode>299)&&o.error){e=new Error("CouchDB error: "+(o.error.reason||o.error.error));for(var d in o)e[d]=o[d];return f(e,n,o)}return f(e,n,o)}"string"==typeof e&&(e={uri:e}),e.json=!0,e.body&&(e.json=e.body),delete e.body,f=f||d;var i=n(e,o);return i}},{}],128:[function(){},{}],129:[function(e,f,n){function o(e,f,n){if(!(this instanceof o))return new o(e,f,n);var d=typeof e;if("base64"===f&&"string"===d)for(e=z(e);e.length%4!==0;)e+="=";var i;if("number"===d)i=B(e);else if("string"===d)i=o.byteLength(e,f);else{if("object"!==d)throw new Error("First argument needs to be a number, array or string.");i=B(e.length)}var t;o._useTypedArrays?t=o._augment(new Uint8Array(i)):(t=this,t.length=i,t._isBuffer=!0);var l;if(o._useTypedArrays&&"number"==typeof e.byteLength)t._set(e);else if(D(e))for(l=0;i>l;l++)t[l]=o.isBuffer(e)?e.readUInt8(l):e[l];else if("string"===d)t.write(e,0,f);else if("number"===d&&!o._useTypedArrays&&!n)for(l=0;i>l;l++)t[l]=0;return t}function d(e,f,n,d){n=Number(n)||0;var i=e.length-n;d?(d=Number(d),d>i&&(d=i)):d=i;var t=f.length;Q(t%2===0,"Invalid hex string"),d>t/2&&(d=t/2);for(var l=0;d>l;l++){var u=parseInt(f.substr(2*l,2),16);Q(!isNaN(u),"Invalid hex string"),e[n+l]=u}return o._charsWritten=2*l,l}function i(e,f,n,d){var i=o._charsWritten=J(F(f),e,n,d);return i}function t(e,f,n,d){var i=o._charsWritten=J(G(f),e,n,d);return i}function l(e,f,n,o){return t(e,f,n,o)}function u(e,f,n,d){var i=o._charsWritten=J(I(f),e,n,d);return i}function p(e,f,n,d){var i=o._charsWritten=J(H(f),e,n,d);return i}function s(e,f,n){return R.fromByteArray(0===f&&n===e.length?e:e.slice(f,n))}function c(e,f,n){var o="",d="";n=Math.min(e.length,n);for(var i=f;n>i;i++)e[i]<=127?(o+=K(d)+String.fromCharCode(e[i]),d=""):d+="%"+e[i].toString(16);return o+K(d)}function y(e,f,n){var o="";n=Math.min(e.length,n);for(var d=f;n>d;d++)o+=String.fromCharCode(e[d]);return o}function a(e,f,n){return y(e,f,n)}function r(e,f,n){var o=e.length;(!f||0>f)&&(f=0),(!n||0>n||n>o)&&(n=o);for(var d="",i=f;n>i;i++)d+=E(e[i]);return d}function w(e,f,n){for(var o=e.slice(f,n),d="",i=0;i<o.length;i+=2)d+=String.fromCharCode(o[i]+256*o[i+1]);return d}function b(e,f,n,o){o||(Q("boolean"==typeof n,"missing or invalid endian"),Q(void 0!==f&&null!==f,"missing offset"),Q(f+1<e.length,"Trying to read beyond buffer length"));var d=e.length;if(!(f>=d)){var i;return n?(i=e[f],d>f+1&&(i|=e[f+1]<<8)):(i=e[f]<<8,d>f+1&&(i|=e[f+1])),i}}function g(e,f,n,o){o||(Q("boolean"==typeof n,"missing or invalid endian"),Q(void 0!==f&&null!==f,"missing offset"),Q(f+3<e.length,"Trying to read beyond buffer length"));var d=e.length;if(!(f>=d)){var i;return n?(d>f+2&&(i=e[f+2]<<16),d>f+1&&(i|=e[f+1]<<8),i|=e[f],d>f+3&&(i+=e[f+3]<<24>>>0)):(d>f+1&&(i=e[f+1]<<16),d>f+2&&(i|=e[f+2]<<8),d>f+3&&(i|=e[f+3]),i+=e[f]<<24>>>0),i}}function m(e,f,n,o){o||(Q("boolean"==typeof n,"missing or invalid endian"),Q(void 0!==f&&null!==f,"missing offset"),Q(f+1<e.length,"Trying to read beyond buffer length"));var d=e.length;if(!(f>=d)){var i=b(e,f,n,!0),t=32768&i;return t?-1*(65535-i+1):i}}function x(e,f,n,o){o||(Q("boolean"==typeof n,"missing or invalid endian"),Q(void 0!==f&&null!==f,"missing offset"),Q(f+3<e.length,"Trying to read beyond buffer length"));var d=e.length;if(!(f>=d)){var i=g(e,f,n,!0),t=2147483648&i;return t?-1*(4294967295-i+1):i}}function P(e,f,n,o){return o||(Q("boolean"==typeof n,"missing or invalid endian"),Q(f+3<e.length,"Trying to read beyond buffer length")),S.read(e,f,n,23,4)}function j(e,f,n,o){return o||(Q("boolean"==typeof n,"missing or invalid endian"),Q(f+7<e.length,"Trying to read beyond buffer length")),S.read(e,f,n,52,8)}function v(e,f,n,o,d){d||(Q(void 0!==f&&null!==f,"missing value"),Q("boolean"==typeof o,"missing or invalid endian"),Q(void 0!==n&&null!==n,"missing offset"),Q(n+1<e.length,"trying to write beyond buffer length"),L(f,65535));var i=e.length;if(!(n>=i))for(var t=0,l=Math.min(i-n,2);l>t;t++)e[n+t]=(f&255<<8*(o?t:1-t))>>>8*(o?t:1-t)}function M(e,f,n,o,d){d||(Q(void 0!==f&&null!==f,"missing value"),Q("boolean"==typeof o,"missing or invalid endian"),Q(void 0!==n&&null!==n,"missing offset"),Q(n+3<e.length,"trying to write beyond buffer length"),L(f,4294967295));var i=e.length;if(!(n>=i))for(var t=0,l=Math.min(i-n,4);l>t;t++)e[n+t]=f>>>8*(o?t:3-t)&255}function X(e,f,n,o,d){d||(Q(void 0!==f&&null!==f,"missing value"),Q("boolean"==typeof o,"missing or invalid endian"),Q(void 0!==n&&null!==n,"missing offset"),Q(n+1<e.length,"Trying to write beyond buffer length"),N(f,32767,-32768));var i=e.length;n>=i||(f>=0?v(e,f,n,o,d):v(e,65535+f+1,n,o,d))}function h(e,f,n,o,d){d||(Q(void 0!==f&&null!==f,"missing value"),Q("boolean"==typeof o,"missing or invalid endian"),Q(void 0!==n&&null!==n,"missing offset"),Q(n+3<e.length,"Trying to write beyond buffer length"),N(f,2147483647,-2147483648));var i=e.length;n>=i||(f>=0?M(e,f,n,o,d):M(e,4294967295+f+1,n,o,d))}function k(e,f,n,o,d){d||(Q(void 0!==f&&null!==f,"missing value"),Q("boolean"==typeof o,"missing or invalid endian"),Q(void 0!==n&&null!==n,"missing offset"),Q(n+3<e.length,"Trying to write beyond buffer length"),O(f,3.4028234663852886e38,-3.4028234663852886e38));var i=e.length;n>=i||S.write(e,f,n,o,23,4)}function q(e,f,n,o,d){d||(Q(void 0!==f&&null!==f,"missing value"),Q("boolean"==typeof o,"missing or invalid endian"),Q(void 0!==n&&null!==n,"missing offset"),Q(n+7<e.length,"Trying to write beyond buffer length"),O(f,1.7976931348623157e308,-1.7976931348623157e308));var i=e.length;n>=i||S.write(e,f,n,o,52,8)}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function A(e,f,n){return"number"!=typeof e?n:(e=~~e,e>=f?f:e>=0?e:(e+=f,e>=0?e:0))}function B(e){return e=~~Math.ceil(+e),0>e?0:e}function C(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function D(e){return C(e)||o.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function E(e){return 16>e?"0"+e.toString(16):e.toString(16)}function F(e){for(var f=[],n=0;n<e.length;n++){var o=e.charCodeAt(n);if(127>=o)f.push(e.charCodeAt(n));else{var d=n;o>=55296&&57343>=o&&n++;for(var i=encodeURIComponent(e.slice(d,n+1)).substr(1).split("%"),t=0;t<i.length;t++)f.push(parseInt(i[t],16))}}return f}function G(e){for(var f=[],n=0;n<e.length;n++)f.push(255&e.charCodeAt(n));return f}function H(e){for(var f,n,o,d=[],i=0;i<e.length;i++)f=e.charCodeAt(i),n=f>>8,o=f%256,d.push(o),d.push(n);return d}function I(e){return R.toByteArray(e)}function J(e,f,n,o){for(var d=0;o>d&&!(d+n>=f.length||d>=e.length);d++)f[d+n]=e[d];return d}function K(e){try{return decodeURIComponent(e)}catch(f){return String.fromCharCode(65533)}}function L(e,f){Q("number"==typeof e,"cannot write a non-number as a number"),Q(e>=0,"specified a negative value for writing an unsigned value"),Q(f>=e,"value is larger than maximum value for type"),Q(Math.floor(e)===e,"value has a fractional component")}function N(e,f,n){Q("number"==typeof e,"cannot write a non-number as a number"),Q(f>=e,"value larger than maximum allowed value"),Q(e>=n,"value smaller than minimum allowed value"),Q(Math.floor(e)===e,"value has a fractional component")}function O(e,f,n){Q("number"==typeof e,"cannot write a non-number as a number"),Q(f>=e,"value larger than maximum allowed value"),Q(e>=n,"value smaller than minimum allowed value")}function Q(e,f){if(!e)throw new Error(f||"Failed assertion")}var R=e("base64-js"),S=e("ieee754");n.Buffer=o,n.SlowBuffer=o,n.INSPECT_MAX_BYTES=50,o.poolSize=8192,o._useTypedArrays=function(){try{var e=new ArrayBuffer(0),f=new Uint8Array(e);return f.foo=function(){return 42},42===f.foo()&&"function"==typeof f.subarray}catch(n){return!1}}(),o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.isBuffer=function(e){return!(null===e||void 0===e||!e._isBuffer)},o.byteLength=function(e,f){var n;switch(e+="",f||"utf8"){case"hex":n=e.length/2;break;case"utf8":case"utf-8":n=F(e).length;break;case"ascii":case"binary":case"raw":n=e.length;break;case"base64":n=I(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;default:throw new Error("Unknown encoding")}return n},o.concat=function(e,f){if(Q(C(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new o(0);if(1===e.length)return e[0];var n;if("number"!=typeof f)for(f=0,n=0;n<e.length;n++)f+=e[n].length;var d=new o(f),i=0;for(n=0;n<e.length;n++){var t=e[n];t.copy(d,i),i+=t.length}return d},o.prototype.write=function(e,f,n,o){if(isFinite(f))isFinite(n)||(o=n,n=void 0);else{var s=o;o=f,f=n,n=s}f=Number(f)||0;var c=this.length-f;n?(n=Number(n),n>c&&(n=c)):n=c,o=String(o||"utf8").toLowerCase();var y;switch(o){case"hex":y=d(this,e,f,n);break;case"utf8":case"utf-8":y=i(this,e,f,n);break;case"ascii":y=t(this,e,f,n);break;case"binary":y=l(this,e,f,n);break;case"base64":y=u(this,e,f,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":y=p(this,e,f,n);break;default:throw new Error("Unknown encoding")}return y},o.prototype.toString=function(e,f,n){var o=this;if(e=String(e||"utf8").toLowerCase(),f=Number(f)||0,n=void 0!==n?Number(n):n=o.length,n===f)return"";var d;switch(e){case"hex":d=r(o,f,n);break;case"utf8":case"utf-8":d=c(o,f,n);break;case"ascii":d=y(o,f,n);break;case"binary":d=a(o,f,n);break;case"base64":d=s(o,f,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":d=w(o,f,n);break;default:throw new Error("Unknown encoding")}return d},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.copy=function(e,f,n,d){var i=this;if(n||(n=0),d||0===d||(d=this.length),f||(f=0),d!==n&&0!==e.length&&0!==i.length){Q(d>=n,"sourceEnd < sourceStart"),Q(f>=0&&f<e.length,"targetStart out of bounds"),Q(n>=0&&n<i.length,"sourceStart out of bounds"),Q(d>=0&&d<=i.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),e.length-f<d-n&&(d=e.length-f+n);var t=d-n;if(100>t||!o._useTypedArrays)for(var l=0;t>l;l++)e[l+f]=this[l+n];else e._set(this.subarray(n,n+t),f)}},o.prototype.slice=function(e,f){var n=this.length;if(e=A(e,n,0),f=A(f,n,n),o._useTypedArrays)return o._augment(this.subarray(e,f));for(var d=f-e,i=new o(d,void 0,!0),t=0;d>t;t++)i[t]=this[t+e];return i},o.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},o.prototype.set=function(e,f){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,f)},o.prototype.readUInt8=function(e,f){return f||(Q(void 0!==e&&null!==e,"missing offset"),Q(e<this.length,"Trying to read beyond buffer length")),e>=this.length?void 0:this[e]},o.prototype.readUInt16LE=function(e,f){return b(this,e,!0,f)},o.prototype.readUInt16BE=function(e,f){return b(this,e,!1,f)},o.prototype.readUInt32LE=function(e,f){return g(this,e,!0,f)},o.prototype.readUInt32BE=function(e,f){return g(this,e,!1,f)},o.prototype.readInt8=function(e,f){if(f||(Q(void 0!==e&&null!==e,"missing offset"),Q(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length)){var n=128&this[e];return n?-1*(255-this[e]+1):this[e]}},o.prototype.readInt16LE=function(e,f){return m(this,e,!0,f)},o.prototype.readInt16BE=function(e,f){return m(this,e,!1,f)},o.prototype.readInt32LE=function(e,f){return x(this,e,!0,f)},o.prototype.readInt32BE=function(e,f){return x(this,e,!1,f)},o.prototype.readFloatLE=function(e,f){return P(this,e,!0,f)},o.prototype.readFloatBE=function(e,f){return P(this,e,!1,f)},o.prototype.readDoubleLE=function(e,f){return j(this,e,!0,f)},o.prototype.readDoubleBE=function(e,f){return j(this,e,!1,f)},o.prototype.writeUInt8=function(e,f,n){n||(Q(void 0!==e&&null!==e,"missing value"),Q(void 0!==f&&null!==f,"missing offset"),Q(f<this.length,"trying to write beyond buffer length"),L(e,255)),f>=this.length||(this[f]=e)},o.prototype.writeUInt16LE=function(e,f,n){v(this,e,f,!0,n)},o.prototype.writeUInt16BE=function(e,f,n){v(this,e,f,!1,n)},o.prototype.writeUInt32LE=function(e,f,n){M(this,e,f,!0,n)},o.prototype.writeUInt32BE=function(e,f,n){M(this,e,f,!1,n)},o.prototype.writeInt8=function(e,f,n){n||(Q(void 0!==e&&null!==e,"missing value"),Q(void 0!==f&&null!==f,"missing offset"),Q(f<this.length,"Trying to write beyond buffer length"),N(e,127,-128)),f>=this.length||(e>=0?this.writeUInt8(e,f,n):this.writeUInt8(255+e+1,f,n))},o.prototype.writeInt16LE=function(e,f,n){X(this,e,f,!0,n)},o.prototype.writeInt16BE=function(e,f,n){X(this,e,f,!1,n)},o.prototype.writeInt32LE=function(e,f,n){h(this,e,f,!0,n)},o.prototype.writeInt32BE=function(e,f,n){h(this,e,f,!1,n)},o.prototype.writeFloatLE=function(e,f,n){k(this,e,f,!0,n)},o.prototype.writeFloatBE=function(e,f,n){k(this,e,f,!1,n)},o.prototype.writeDoubleLE=function(e,f,n){q(this,e,f,!0,n)},o.prototype.writeDoubleBE=function(e,f,n){q(this,e,f,!1,n)},o.prototype.fill=function(e,f,n){if(e||(e=0),f||(f=0),n||(n=this.length),"string"==typeof e&&(e=e.charCodeAt(0)),Q("number"==typeof e&&!isNaN(e),"value is not a number"),Q(n>=f,"end < start"),n!==f&&0!==this.length){Q(f>=0&&f<this.length,"start out of bounds"),Q(n>=0&&n<=this.length,"end out of bounds");for(var o=f;n>o;o++)this[o]=e}},o.prototype.inspect=function(){for(var e=[],f=this.length,o=0;f>o;o++)if(e[o]=E(this[o]),o===n.INSPECT_MAX_BYTES){e[o+1]="...";break}return"<Buffer "+e.join(" ")+">"},o.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(o._useTypedArrays)return new o(this).buffer;for(var e=new Uint8Array(this.length),f=0,n=e.length;n>f;f+=1)e[f]=this[f];return e.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var T=o.prototype;o._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=T.get,e.set=T.set,e.write=T.write,e.toString=T.toString,e.toLocaleString=T.toString,e.toJSON=T.toJSON,e.copy=T.copy,e.slice=T.slice,e.readUInt8=T.readUInt8,e.readUInt16LE=T.readUInt16LE,e.readUInt16BE=T.readUInt16BE,e.readUInt32LE=T.readUInt32LE,e.readUInt32BE=T.readUInt32BE,e.readInt8=T.readInt8,e.readInt16LE=T.readInt16LE,e.readInt16BE=T.readInt16BE,e.readInt32LE=T.readInt32LE,e.readInt32BE=T.readInt32BE,e.readFloatLE=T.readFloatLE,e.readFloatBE=T.readFloatBE,e.readDoubleLE=T.readDoubleLE,e.readDoubleBE=T.readDoubleBE,e.writeUInt8=T.writeUInt8,e.writeUInt16LE=T.writeUInt16LE,e.writeUInt16BE=T.writeUInt16BE,e.writeUInt32LE=T.writeUInt32LE,e.writeUInt32BE=T.writeUInt32BE,e.writeInt8=T.writeInt8,e.writeInt16LE=T.writeInt16LE,e.writeInt16BE=T.writeInt16BE,e.writeInt32LE=T.writeInt32LE,e.writeInt32BE=T.writeInt32BE,e.writeFloatLE=T.writeFloatLE,e.writeFloatBE=T.writeFloatBE,e.writeDoubleLE=T.writeDoubleLE,e.writeDoubleBE=T.writeDoubleBE,e.fill=T.fill,e.inspect=T.inspect,e.toArrayBuffer=T.toArrayBuffer,e}},{"base64-js":130,ieee754:131}],130:[function(e,f){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(){"use strict";function e(e){var f=e.charCodeAt(0);return f===t?62:f===l?63:u>f?-1:u+10>f?f-u+26+26:s+26>f?f-s:p+26>f?f-p+26:void 0}function o(f){function n(e){p[c++]=e}var o,d,t,l,u,p;if(f.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var s=f.length;u="="===f.charAt(s-2)?2:"="===f.charAt(s-1)?1:0,p=new i(3*f.length/4-u),t=u>0?f.length-4:f.length;var c=0;for(o=0,d=0;t>o;o+=4,d+=3)l=e(f.charAt(o))<<18|e(f.charAt(o+1))<<12|e(f.charAt(o+2))<<6|e(f.charAt(o+3)),n((16711680&l)>>16),n((65280&l)>>8),n(255&l);return 2===u?(l=e(f.charAt(o))<<2|e(f.charAt(o+1))>>4,n(255&l)):1===u&&(l=e(f.charAt(o))<<10|e(f.charAt(o+1))<<4|e(f.charAt(o+2))>>2,n(l>>8&255),n(255&l)),p}function d(e){function f(e){return n.charAt(e)}function o(e){return f(e>>18&63)+f(e>>12&63)+f(e>>6&63)+f(63&e)}var d,i,t,l=e.length%3,u="";for(d=0,t=e.length-l;t>d;d+=3)i=(e[d]<<16)+(e[d+1]<<8)+e[d+2],u+=o(i);switch(l){case 1:i=e[e.length-1],u+=f(i>>2),u+=f(i<<4&63),u+="==";break;case 2:i=(e[e.length-2]<<8)+e[e.length-1],u+=f(i>>10),u+=f(i>>4&63),u+=f(i<<2&63),u+="="}return u}var i="undefined"!=typeof Uint8Array?Uint8Array:Array,t=("0".charCodeAt(0),"+".charCodeAt(0)),l="/".charCodeAt(0),u="0".charCodeAt(0),p="a".charCodeAt(0),s="A".charCodeAt(0);f.exports.toByteArray=o,f.exports.fromByteArray=d}()},{}],131:[function(e,f,n){n.read=function(e,f,n,o,d){var i,t,l=8*d-o-1,u=(1<<l)-1,p=u>>1,s=-7,c=n?d-1:0,y=n?-1:1,a=e[f+c];for(c+=y,i=a&(1<<-s)-1,a>>=-s,s+=l;s>0;i=256*i+e[f+c],c+=y,s-=8);for(t=i&(1<<-s)-1,i>>=-s,s+=o;s>0;t=256*t+e[f+c],c+=y,s-=8);if(0===i)i=1-p;else{if(i===u)return t?0/0:1/0*(a?-1:1);t+=Math.pow(2,o),i-=p}return(a?-1:1)*t*Math.pow(2,i-o)},n.write=function(e,f,n,o,d,i){var t,l,u,p=8*i-d-1,s=(1<<p)-1,c=s>>1,y=23===d?Math.pow(2,-24)-Math.pow(2,-77):0,a=o?0:i-1,r=o?1:-1,w=0>f||0===f&&0>1/f?1:0;for(f=Math.abs(f),isNaN(f)||1/0===f?(l=isNaN(f)?1:0,t=s):(t=Math.floor(Math.log(f)/Math.LN2),f*(u=Math.pow(2,-t))<1&&(t--,u*=2),f+=t+c>=1?y/u:y*Math.pow(2,1-c),f*u>=2&&(t++,u/=2),t+c>=s?(l=0,t=s):t+c>=1?(l=(f*u-1)*Math.pow(2,d),t+=c):(l=f*Math.pow(2,c-1)*Math.pow(2,d),t=0));d>=8;e[n+a]=255&l,a+=r,l/=256,d-=8);for(t=t<<d|l,p+=d;p>0;e[n+a]=255&t,a+=r,t/=256,p-=8);e[n+a-r]|=128*w}},{}],132:[function(e,f){function n(e,f){if(e.length%t!==0){var n=e.length+(t-e.length%t);e=i.concat([e,l],n)}for(var o=[],d=f?e.readInt32BE:e.readInt32LE,u=0;u<e.length;u+=t)o.push(d.call(e,u));return o}function o(e,f,n){for(var o=new i(f),d=n?o.writeInt32BE:o.writeInt32LE,t=0;t<e.length;t++)d.call(o,e[t],4*t,!0);return o}function d(e,f,d,t){i.isBuffer(e)||(e=new i(e));var l=f(n(e,t),e.length*u);return o(l,d,t)}var i=e("buffer").Buffer,t=4,l=new i(t);l.fill(0);var u=8;f.exports={hash:d}},{buffer:129}],133:[function(e,f,n){function o(e,f,n){l.isBuffer(f)||(f=new l(f)),l.isBuffer(n)||(n=new l(n)),f.length>a?f=e(f):f.length<a&&(f=l.concat([f,r],a));for(var o=new l(a),d=new l(a),i=0;a>i;i++)o[i]=54^f[i],d[i]=92^f[i];var t=e(l.concat([o,n]));return e(l.concat([d,t]))}function d(e,f){e=e||"sha1";var n=y[e],d=[],t=0;return n||i("algorithm:",e,"is not yet supported"),{update:function(e){return l.isBuffer(e)||(e=new l(e)),d.push(e),t+=e.length,this},digest:function(e){var i=l.concat(d),t=f?o(n,f,i):n(i);return d=null,e?t.toString(e):t}}}function i(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function t(e,f){for(var n in e)f(e[n],n)}var l=e("buffer").Buffer,u=e("./sha"),p=e("./sha256"),s=e("./rng"),c=e("./md5"),y={sha1:u,sha256:p,md5:c},a=64,r=new l(a);r.fill(0),n.createHash=function(e){return d(e)},n.createHmac=function(e,f){return d(e,f)},n.randomBytes=function(e,f){if(!f||!f.call)return new l(s(e));try{f.call(this,void 0,new l(s(e)))}catch(n){f(n)}},t(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){n[e]=function(){i("sorry,",e,"is not implemented yet")}})},{"./md5":134,"./rng":135,"./sha":136,"./sha256":137,buffer:129}],134:[function(e,f){function n(e,f){e[f>>5]|=128<<f%32,e[(f+64>>>9<<4)+14]=f;for(var n=1732584193,o=-271733879,p=-1732584194,s=271733878,c=0;c<e.length;c+=16){var y=n,a=o,r=p,w=s;n=d(n,o,p,s,e[c+0],7,-680876936),s=d(s,n,o,p,e[c+1],12,-389564586),p=d(p,s,n,o,e[c+2],17,606105819),o=d(o,p,s,n,e[c+3],22,-1044525330),n=d(n,o,p,s,e[c+4],7,-176418897),s=d(s,n,o,p,e[c+5],12,1200080426),p=d(p,s,n,o,e[c+6],17,-1473231341),o=d(o,p,s,n,e[c+7],22,-45705983),n=d(n,o,p,s,e[c+8],7,1770035416),s=d(s,n,o,p,e[c+9],12,-1958414417),p=d(p,s,n,o,e[c+10],17,-42063),o=d(o,p,s,n,e[c+11],22,-1990404162),n=d(n,o,p,s,e[c+12],7,1804603682),s=d(s,n,o,p,e[c+13],12,-40341101),p=d(p,s,n,o,e[c+14],17,-1502002290),o=d(o,p,s,n,e[c+15],22,1236535329),n=i(n,o,p,s,e[c+1],5,-165796510),s=i(s,n,o,p,e[c+6],9,-1069501632),p=i(p,s,n,o,e[c+11],14,643717713),o=i(o,p,s,n,e[c+0],20,-373897302),n=i(n,o,p,s,e[c+5],5,-701558691),s=i(s,n,o,p,e[c+10],9,38016083),p=i(p,s,n,o,e[c+15],14,-660478335),o=i(o,p,s,n,e[c+4],20,-405537848),n=i(n,o,p,s,e[c+9],5,568446438),s=i(s,n,o,p,e[c+14],9,-1019803690),p=i(p,s,n,o,e[c+3],14,-187363961),o=i(o,p,s,n,e[c+8],20,1163531501),n=i(n,o,p,s,e[c+13],5,-1444681467),s=i(s,n,o,p,e[c+2],9,-51403784),p=i(p,s,n,o,e[c+7],14,1735328473),o=i(o,p,s,n,e[c+12],20,-1926607734),n=t(n,o,p,s,e[c+5],4,-378558),s=t(s,n,o,p,e[c+8],11,-2022574463),p=t(p,s,n,o,e[c+11],16,1839030562),o=t(o,p,s,n,e[c+14],23,-35309556),n=t(n,o,p,s,e[c+1],4,-1530992060),s=t(s,n,o,p,e[c+4],11,1272893353),p=t(p,s,n,o,e[c+7],16,-155497632),o=t(o,p,s,n,e[c+10],23,-1094730640),n=t(n,o,p,s,e[c+13],4,681279174),s=t(s,n,o,p,e[c+0],11,-358537222),p=t(p,s,n,o,e[c+3],16,-722521979),o=t(o,p,s,n,e[c+6],23,76029189),n=t(n,o,p,s,e[c+9],4,-640364487),s=t(s,n,o,p,e[c+12],11,-421815835),p=t(p,s,n,o,e[c+15],16,530742520),o=t(o,p,s,n,e[c+2],23,-995338651),n=l(n,o,p,s,e[c+0],6,-198630844),s=l(s,n,o,p,e[c+7],10,1126891415),p=l(p,s,n,o,e[c+14],15,-1416354905),o=l(o,p,s,n,e[c+5],21,-57434055),n=l(n,o,p,s,e[c+12],6,1700485571),s=l(s,n,o,p,e[c+3],10,-1894986606),p=l(p,s,n,o,e[c+10],15,-1051523),o=l(o,p,s,n,e[c+1],21,-2054922799),n=l(n,o,p,s,e[c+8],6,1873313359),s=l(s,n,o,p,e[c+15],10,-30611744),p=l(p,s,n,o,e[c+6],15,-1560198380),o=l(o,p,s,n,e[c+13],21,1309151649),n=l(n,o,p,s,e[c+4],6,-145523070),s=l(s,n,o,p,e[c+11],10,-1120210379),p=l(p,s,n,o,e[c+2],15,718787259),o=l(o,p,s,n,e[c+9],21,-343485551),n=u(n,y),o=u(o,a),p=u(p,r),s=u(s,w)}return Array(n,o,p,s)}function o(e,f,n,o,d,i){return u(p(u(u(f,e),u(o,i)),d),n)}function d(e,f,n,d,i,t,l){return o(f&n|~f&d,e,f,i,t,l)}function i(e,f,n,d,i,t,l){return o(f&d|n&~d,e,f,i,t,l)}function t(e,f,n,d,i,t,l){return o(f^n^d,e,f,i,t,l)}function l(e,f,n,d,i,t,l){return o(n^(f|~d),e,f,i,t,l)}function u(e,f){var n=(65535&e)+(65535&f),o=(e>>16)+(f>>16)+(n>>16);return o<<16|65535&n}function p(e,f){return e<<f|e>>>32-f}var s=e("./helpers");f.exports=function(e){return s.hash(e,n,16)}},{"./helpers":132}],135:[function(e,f){!function(){var e,n,o=this;e=function(e){for(var f,f,n=new Array(e),o=0;e>o;o++)0==(3&o)&&(f=4294967296*Math.random()),n[o]=f>>>((3&o)<<3)&255;return n},o.crypto&&crypto.getRandomValues&&(n=function(e){var f=new Uint8Array(e);return crypto.getRandomValues(f),f}),f.exports=n||e}()},{}],136:[function(e,f){function n(e,f){e[f>>5]|=128<<24-f%32,e[(f+64>>9<<4)+15]=f;for(var n=Array(80),l=1732584193,u=-271733879,p=-1732584194,s=271733878,c=-1009589776,y=0;y<e.length;y+=16){for(var a=l,r=u,w=p,b=s,g=c,m=0;80>m;m++){n[m]=16>m?e[y+m]:t(n[m-3]^n[m-8]^n[m-14]^n[m-16],1);var x=i(i(t(l,5),o(m,u,p,s)),i(i(c,n[m]),d(m)));c=s,s=p,p=t(u,30),u=l,l=x}l=i(l,a),u=i(u,r),p=i(p,w),s=i(s,b),c=i(c,g)}return Array(l,u,p,s,c)}function o(e,f,n,o){return 20>e?f&n|~f&o:40>e?f^n^o:60>e?f&n|f&o|n&o:f^n^o}function d(e){return 20>e?1518500249:40>e?1859775393:60>e?-1894007588:-899497514}function i(e,f){var n=(65535&e)+(65535&f),o=(e>>16)+(f>>16)+(n>>16);return o<<16|65535&n}function t(e,f){return e<<f|e>>>32-f}var l=e("./helpers");f.exports=function(e){return l.hash(e,n,20,!0)}},{"./helpers":132}],137:[function(e,f){var n=e("./helpers"),o=function(e,f){var n=(65535&e)+(65535&f),o=(e>>16)+(f>>16)+(n>>16);return o<<16|65535&n},d=function(e,f){return e>>>f|e<<32-f},i=function(e,f){return e>>>f},t=function(e,f,n){return e&f^~e&n},l=function(e,f,n){return e&f^e&n^f&n},u=function(e){return d(e,2)^d(e,13)^d(e,22)},p=function(e){return d(e,6)^d(e,11)^d(e,25)},s=function(e){return d(e,7)^d(e,18)^i(e,3)},c=function(e){return d(e,17)^d(e,19)^i(e,10)},y=function(e,f){var n,d,i,y,a,r,w,b,g,m,x,P,j=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),v=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),M=new Array(64);e[f>>5]|=128<<24-f%32,e[(f+64>>9<<4)+15]=f;for(var g=0;g<e.length;g+=16){n=v[0],d=v[1],i=v[2],y=v[3],a=v[4],r=v[5],w=v[6],b=v[7];for(var m=0;64>m;m++)M[m]=16>m?e[m+g]:o(o(o(c(M[m-2]),M[m-7]),s(M[m-15])),M[m-16]),x=o(o(o(o(b,p(a)),t(a,r,w)),j[m]),M[m]),P=o(u(n),l(n,d,i)),b=w,w=r,r=a,a=o(y,x),y=i,i=d,d=n,n=o(x,P);v[0]=o(n,v[0]),v[1]=o(d,v[1]),v[2]=o(i,v[2]),v[3]=o(y,v[3]),v[4]=o(a,v[4]),v[5]=o(r,v[5]),v[6]=o(w,v[6]),v[7]=o(b,v[7])}return v};f.exports=function(e){return n.hash(e,y,32,!0)}},{"./helpers":132}],138:[function(e,f){f.exports="function"==typeof Object.create?function(e,f){e.super_=f,e.prototype=Object.create(f.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,f){e.super_=f;var n=function(){};n.prototype=f.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],139:[function(e,f){function n(){}var o=f.exports={};o.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,f="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(f){var n=[];return window.addEventListener("message",function(e){var f=e.source;if((f===window||null===f)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var o=n.shift();o()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),o.title="browser",o.browser=!0,o.env={},o.argv=[],o.on=n,o.once=n,o.off=n,o.emit=n,o.binding=function(){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(){throw new Error("process.chdir is not supported")}},{}],140:[function(e,f){f.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],141:[function(e,f,n){(function(f,o){function d(e,f){var o={seen:[],stylize:t};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),w(f)?o.showHidden=f:f&&n._extend(o,f),j(o.showHidden)&&(o.showHidden=!1),j(o.depth)&&(o.depth=2),j(o.colors)&&(o.colors=!1),j(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=i),u(o,e,o.depth)}function i(e,f){var n=d.styles[f];return n?"["+d.colors[n][0]+"m"+e+"["+d.colors[n][1]+"m":e}function t(e){return e}function l(e){var f={};return e.forEach(function(e){f[e]=!0}),f}function u(e,f,o){if(e.customInspect&&f&&k(f.inspect)&&f.inspect!==n.inspect&&(!f.constructor||f.constructor.prototype!==f)){var d=f.inspect(o,e);return x(d)||(d=u(e,d,o)),d}var i=p(e,f);if(i)return i;var t=Object.keys(f),w=l(t);if(e.showHidden&&(t=Object.getOwnPropertyNames(f)),h(f)&&(t.indexOf("message")>=0||t.indexOf("description")>=0))return s(f);if(0===t.length){if(k(f)){var b=f.name?": "+f.name:"";return e.stylize("[Function"+b+"]","special")}if(v(f))return e.stylize(RegExp.prototype.toString.call(f),"regexp");if(X(f))return e.stylize(Date.prototype.toString.call(f),"date");if(h(f))return s(f)}var g="",m=!1,P=["{","}"];if(r(f)&&(m=!0,P=["[","]"]),k(f)){var j=f.name?": "+f.name:"";g=" [Function"+j+"]"}if(v(f)&&(g=" "+RegExp.prototype.toString.call(f)),X(f)&&(g=" "+Date.prototype.toUTCString.call(f)),h(f)&&(g=" "+s(f)),0===t.length&&(!m||0==f.length))return P[0]+g+P[1];if(0>o)return v(f)?e.stylize(RegExp.prototype.toString.call(f),"regexp"):e.stylize("[Object]","special");e.seen.push(f);var M;return M=m?c(e,f,o,w,t):t.map(function(n){return y(e,f,o,w,n,m)}),e.seen.pop(),a(M,g,P)}function p(e,f){if(j(f))return e.stylize("undefined","undefined");if(x(f)){var n="'"+JSON.stringify(f).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return m(f)?e.stylize(""+f,"number"):w(f)?e.stylize(""+f,"boolean"):b(f)?e.stylize("null","null"):void 0}function s(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,f,n,o,d){for(var i=[],t=0,l=f.length;l>t;++t)i.push(C(f,String(t))?y(e,f,n,o,String(t),!0):"");return d.forEach(function(d){d.match(/^\d+$/)||i.push(y(e,f,n,o,d,!0))}),i}function y(e,f,n,o,d,i){var t,l,p;if(p=Object.getOwnPropertyDescriptor(f,d)||{value:f[d]},p.get?l=p.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):p.set&&(l=e.stylize("[Setter]","special")),C(o,d)||(t="["+d+"]"),l||(e.seen.indexOf(p.value)<0?(l=b(n)?u(e,p.value,null):u(e,p.value,n-1),l.indexOf("\n")>-1&&(l=i?l.split("\n").map(function(e){return" "+e | |
}).join("\n").substr(2):"\n"+l.split("\n").map(function(e){return" "+e}).join("\n"))):l=e.stylize("[Circular]","special")),j(t)){if(i&&d.match(/^\d+$/))return l;t=JSON.stringify(""+d),t.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(t=t.substr(1,t.length-2),t=e.stylize(t,"name")):(t=t.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),t=e.stylize(t,"string"))}return t+": "+l}function a(e,f,n){var o=0,d=e.reduce(function(e,f){return o++,f.indexOf("\n")>=0&&o++,e+f.replace(/\u001b\[\d\d?m/g,"").length+1},0);return d>60?n[0]+(""===f?"":f+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+f+" "+e.join(", ")+" "+n[1]}function r(e){return Array.isArray(e)}function w(e){return"boolean"==typeof e}function b(e){return null===e}function g(e){return null==e}function m(e){return"number"==typeof e}function x(e){return"string"==typeof e}function P(e){return"symbol"==typeof e}function j(e){return void 0===e}function v(e){return M(e)&&"[object RegExp]"===z(e)}function M(e){return"object"==typeof e&&null!==e}function X(e){return M(e)&&"[object Date]"===z(e)}function h(e){return M(e)&&("[object Error]"===z(e)||e instanceof Error)}function k(e){return"function"==typeof e}function q(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function z(e){return Object.prototype.toString.call(e)}function A(e){return 10>e?"0"+e.toString(10):e.toString(10)}function B(){var e=new Date,f=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),G[e.getMonth()],f].join(" ")}function C(e,f){return Object.prototype.hasOwnProperty.call(e,f)}var D=/%[sdj%]/g;n.format=function(e){if(!x(e)){for(var f=[],n=0;n<arguments.length;n++)f.push(d(arguments[n]));return f.join(" ")}for(var n=1,o=arguments,i=o.length,t=String(e).replace(D,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(o[n++]);case"%d":return Number(o[n++]);case"%j":try{return JSON.stringify(o[n++])}catch(f){return"[Circular]"}default:return e}}),l=o[n];i>n;l=o[++n])t+=b(l)||!M(l)?" "+l:" "+d(l);return t},n.deprecate=function(e,d){function i(){if(!t){if(f.throwDeprecation)throw new Error(d);f.traceDeprecation?console.trace(d):console.error(d),t=!0}return e.apply(this,arguments)}if(j(o.process))return function(){return n.deprecate(e,d).apply(this,arguments)};if(f.noDeprecation===!0)return e;var t=!1;return i};var E,F={};n.debuglog=function(e){if(j(E)&&(E=f.env.NODE_DEBUG||""),e=e.toUpperCase(),!F[e])if(new RegExp("\\b"+e+"\\b","i").test(E)){var o=f.pid;F[e]=function(){var f=n.format.apply(n,arguments);console.error("%s %d: %s",e,o,f)}}else F[e]=function(){};return F[e]},n.inspect=d,d.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},d.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=r,n.isBoolean=w,n.isNull=b,n.isNullOrUndefined=g,n.isNumber=m,n.isString=x,n.isSymbol=P,n.isUndefined=j,n.isRegExp=v,n.isObject=M,n.isDate=X,n.isError=h,n.isFunction=k,n.isPrimitive=q,n.isBuffer=e("./support/isBuffer");var G=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",B(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,f){if(!f||!M(f))return e;for(var n=Object.keys(f),o=n.length;o--;)e[n[o]]=f[n[o]];return e}}).call(this,e("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":140,"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139,inherits:138}],142:[function(e,f){(function(e){!function(){"use strict";function n(f){var n;return n=f instanceof e?f:new e(f.toString(),"binary"),n.toString("base64")}f.exports=n}()}).call(this,e("buffer").Buffer)},{buffer:129}],143:[function(e,f){"use strict";var n=e("underscore"),o=e("bluebird"),d=o.promisify(e("request")),i=e("jxt"),t=e("./lib/xrd");f.exports=function(e,f){"string"==typeof e&&(e={host:e}),e=n.extend({ssl:!0,json:!0,xrd:!0},e);var l=e.ssl?"https://":"http://",u=new o(function(f,n){d(l+e.host+"/.well-known/host-meta.json").spread(function(e,n){f(JSON.parse(n))}).catch(n)}),p=new o(function(f,n){d(l+e.host+"/.well-known/host-meta").spread(function(e,n){var o=i.parse(n,t);f(o.toJSON())}).catch(n)});return new o(function(e,f){o.some([u,p],1).spread(e).catch(function(){f("no-host-meta")})}).nodeify(f)}},{"./lib/xrd":144,bluebird:148,jxt:204,request:127,underscore:184}],144:[function(e,f){"use strict";var n=e("underscore"),o=e("jxt"),d="http://docs.oasis-open.org/ns/xri/xrd-1.0",i={get:function(){var e={},f=o.find(this.xml,d,"Property");return n.each(f,function(f){var n=o.getAttribute(f,"type");e[n]=f.textContent}),e}},t=f.exports=o.define({name:"xrd",namespace:d,element:"XRD",fields:{subject:o.subText(d,"Subject"),expires:o.dateSub(d,"Expires"),aliases:o.multiSubText(d,"Alias"),properties:i}}),l=o.define({name:"xrdlink",namespace:d,element:"Link",fields:{rel:o.attribute("rel"),href:o.attribute("href"),type:o.attribute("type"),template:o.attribute("template"),titles:o.subLangText(d,"Title","default"),properties:i}});o.extend(t,l,"links")},{jxt:204,underscore:184}],145:[function(e,f){"use strict";f.exports=function(f,n,o){function d(e,f,o){var d=n(e,i,o,f===!0&&e._isBound()?e._boundTo:void 0),t=d.promise();return t.isRejected()?t:(d.setHowMany(1),d.setUnwrap(),d.init(),t)}{var i=e("./some_promise_array.js")(o);e("./assert.js")}f.any=function(e){return d(e,!1,f.any)},f.prototype.any=function(){return d(this,!0,this.any)}}},{"./assert.js":146,"./some_promise_array.js":179}],146:[function(e,f){"use strict";f.exports=function(){var e=function(){function e(e){this.constructor$(e),this.message=e,this.name="AssertionError"}return e.prototype=new Error,e.prototype.constructor=e,e.prototype.constructor$=Error,e}();return function f(n,o){if(n!==!0){var d=new e(o);throw Error.captureStackTrace&&Error.captureStackTrace(d,f),console&&console.error&&console.error(d.stack+""),d}}}()},{}],147:[function(e,f){"use strict";function n(){this._isTickUsed=!1,this._length=0,this._lateBuffer=new d,this._functionBuffer=new d(75e3);var e=this;this.consumeFunctionBuffer=function(){e._consumeFunctionBuffer()}}var o=(e("./assert.js"),e("./schedule.js")),d=e("./queue.js"),i=e("./util.js").errorObj,t=e("./util.js").tryCatch1;n.prototype.haveItemsQueued=function(){return this._length>0},n.prototype.invokeLater=function(e,f,n){this._lateBuffer.push(e,f,n),this._queueTick()},n.prototype.invoke=function(e,f,n){var o=this._functionBuffer;o.push(e,f,n),this._length=o.length(),this._queueTick()},n.prototype._consumeFunctionBuffer=function(){for(var e=this._functionBuffer;e.length()>0;){var f=e.shift(),n=e.shift(),o=e.shift();f.call(n,o)}this._reset(),this._consumeLateBuffer()},n.prototype._consumeLateBuffer=function(){for(var e=this._lateBuffer;e.length()>0;){var f=e.shift(),n=e.shift(),o=e.shift(),d=t(f,n,o);if(d===i)throw this._queueTick(),d.e}},n.prototype._queueTick=function(){this._isTickUsed||(o(this.consumeFunctionBuffer),this._isTickUsed=!0)},n.prototype._reset=function(){this._isTickUsed=!1,this._length=0},f.exports=new n},{"./assert.js":146,"./queue.js":172,"./schedule.js":175,"./util.js":183}],148:[function(e,f){"use strict";var n=e("./promise.js")();f.exports=n},{"./promise.js":164}],149:[function(e,f){"use strict";f.exports=function(e){function f(e){var f="string"==typeof this?this:""+this;return e[f]}e.prototype.call=function(e){for(var f=arguments.length,n=new Array(f-1),o=1;f>o;++o)n[o-1]=arguments[o];return this._then(function(f){return f[e].apply(f,n)},void 0,void 0,void 0,void 0,this.call)},e.prototype.get=function(e){return this._then(f,void 0,void 0,e,void 0,this.get)}}},{}],150:[function(e,f){"use strict";f.exports=function(f,n){var o=e("./errors.js"),d=e("./async.js"),i=(e("./assert.js"),o.CancellationError),t={};f.prototype._cancel=function(){if(!this.isCancellable())return this;var e;if(void 0!==(e=this._cancellationParent))return void e.cancel(t);var f=new i;this._attachExtraTrace(f),this._rejectUnchecked(f)},f.prototype.cancel=function(e){return this.isCancellable()?e===t?(this._cancel(),this):(d.invokeLater(this._cancel,this,void 0),this):this},f.prototype.cancellable=function(){return this._cancellable()?this:(this._setCancellable(),this._cancellationParent=void 0,this)},f.prototype.uncancellable=function(){var e=new f(n);return e._setTrace(this.uncancellable,this),e._follow(this),e._unsetCancellable(),this._isBound()&&e._setBoundTo(this._boundTo),e},f.prototype.fork=function(e,f,n){var o=this._then(e,f,n,void 0,void 0,this.fork);return o._setCancellable(),o._cancellationParent=void 0,o}}},{"./assert.js":146,"./async.js":147,"./errors.js":154}],151:[function(e,f){"use strict";f.exports=function(){function f(e){var f;if("function"==typeof e)f="[function "+(e.name||"anonymous")+"]";else{f=e.toString();var o=/\[object [a-zA-Z0-9$_]+\]/;if(o.test(f))try{var d=JSON.stringify(e);f=d}catch(i){}0===f.length&&(f="(empty array)")}return"(<"+n(f)+">, no stack trace)"}function n(e){var f=41;return e.length<f?e:e.substr(0,f-3)+"..."}function o(e,f){this.captureStackTrace(e,f)}var d=(e("./assert.js"),e("./util.js").inherits),i=e("./es5.js").defineProperty,t=new RegExp("\\b(?:[\\w.]*Promise(?:Array|Spawn)?\\$_\\w+|tryCatch(?:1|2|Apply)|new \\w*PromiseArray|\\w*PromiseArray\\.\\w*PromiseArray|setTimeout|CatchFilter\\$_\\w+|makeNodePromisified|processImmediate|process._tickCallback|nextTick|Async\\$\\w+)\\b"),l=null,u=null,p=!1;d(o,Error),o.prototype.captureStackTrace=function(e,f){s(this,e,f)},o.possiblyUnhandledRejection=function(e){if("object"==typeof console){var f;if("object"==typeof e||"function"==typeof e){var n=e.stack;f="Possibly unhandled "+u(n,e)}else f="Possibly unhandled "+String(e);"function"==typeof console.error||"object"==typeof console.error?console.error(f):("function"==typeof console.log||"object"==typeof console.error)&&console.log(f)}},p="CapturedTrace$captureStackTrace"!==o.prototype.captureStackTrace.name,o.combine=function(e,f){for(var n=e.length-1,o=f.length-1;o>=0;--o){var d=f[o];if(e[n]!==d)break;e.pop(),n--}e.push("From previous event:");for(var i=e.concat(f),u=[],o=0,p=i.length;p>o;++o)t.test(i[o])||o>0&&!l.test(i[o])&&"From previous event:"!==i[o]||u.push(i[o]);return u},o.isSupported=function(){return"function"==typeof s};var s=function c(){if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){l=/^\s*at\s*/,u=function(e,n){return"string"==typeof e?e:void 0!==n.name&&void 0!==n.message?n.name+". "+n.message:f(n)};var e=Error.captureStackTrace;return function(f,n){e(f,n)}}var n=new Error;if(!p&&"string"==typeof n.stack&&"function"==typeof"".startsWith&&n.stack.startsWith("stackDetection@")&&"stackDetection"===c.name){i(Error,"stackTraceLimit",{writable:!0,enumerable:!1,configurable:!1,value:25}),l=/@/;var o=/[@\n]/;return u=function(e,n){return"string"==typeof e?n.name+". "+n.message+"\n"+e:void 0!==n.name&&void 0!==n.message?n.name+". "+n.message:f(n)},function(e,f){var n,d=f.name,i=(new Error).stack,t=i.split(o),l=t.length;for(n=0;l>n&&t[n]!==d;n+=2);t=t.slice(n+2),l=t.length-2;var u="";for(n=0;l>n;n+=2)u+=t[n],u+="@",u+=t[n+1],u+="\n";e.stack=u}}return u=function(e,n){return"string"==typeof e?e:"object"!=typeof n&&"function"!=typeof n||void 0===n.name||void 0===n.message?f(n):n.name+". "+n.message},null}();return o}},{"./assert.js":146,"./es5.js":156,"./util.js":183}],152:[function(e,f){"use strict";f.exports=function(f){function n(e,f,n){this._instances=e,this._callback=f,this._promise=n}function o(e,f){var n={},o=i(e,n,f);if(o===t)return o;var d=l(n);return d.length?(t.e=new TypeError("Catch filter must inherit from Error or be a simple predicate function"),t):o}var d=e("./util.js"),i=d.tryCatch1,t=d.errorObj,l=e("./es5.js").keys;return n.prototype.doFilter=function(e){for(var n=this._callback,d=this._promise,l=d._isBound()?d._boundTo:void 0,u=0,p=this._instances.length;p>u;++u){var s=this._instances[u],c=s===Error||null!=s&&s.prototype instanceof Error;if(c&&e instanceof s){var y=i(n,l,e);return y===t?(f.e=y.e,f):y}if("function"==typeof s&&!c){var a=o(s,e);if(a===t){this._promise._attachExtraTrace(t.e),e=t.e;break}if(a){var y=i(n,l,e);return y===t?(f.e=y.e,f):y}}}return f.e=e,f},n}},{"./es5.js":156,"./util.js":183}],153:[function(e,f){"use strict";var n=e("./util.js"),o=(e("./assert.js"),n.isPrimitive),d=n.wrapsPrimitiveReceiver;f.exports=function(e){var f=function(){return this},n=function(){throw this},i=function(e,f){return 1===f?function(){throw e}:2===f?function(){return e}:void 0};e.prototype["return"]=e.prototype.thenReturn=function(e){return d&&o(e)?this._then(i(e,2),void 0,void 0,void 0,void 0,this.thenReturn):this._then(f,void 0,void 0,e,void 0,this.thenReturn)},e.prototype["throw"]=e.prototype.thenThrow=function(e){return d&&o(e)?this._then(i(e,1),void 0,void 0,void 0,void 0,this.thenThrow):this._then(n,void 0,void 0,e,void 0,this.thenThrow)}}},{"./assert.js":146,"./util.js":183}],154:[function(e,f){"use strict";function n(e){return(1&e)>0}function o(e){return(2&e)>0}function d(e){return 1|e}function i(e){return 2|e}function t(e){return-3&e}function l(e){var f;return x(e)&&void 0!==(f=e.__promiseHandled__)&&(e.__promiseHandled__=t(f)),e}function u(e){try{P(e,"__rejectionError__",r)}catch(f){}}function p(e){return null==e?!1:e instanceof r||e.__rejectionError__===r}function s(e){try{return P(e,"__promiseHandled__",0),!0}catch(f){return!1}}function c(e){return e instanceof j}function y(e){if(c(e)){var f=e.__promiseHandled__;return void 0===f?s(e):!n(f)}return!1}function a(e,f){function n(n){this.message="string"==typeof n?n:f,this.name=e,j.captureStackTrace&&j.captureStackTrace(this,this.constructor)}return m(n,j),n}function r(e){this.name="RejectionError",this.message=e,this.cause=e,e instanceof j?(this.message=e.message,this.stack=e.stack):j.captureStackTrace&&j.captureStackTrace(this,this.constructor)}var w=e("./global.js"),b=e("./es5.js").freeze,g=e("./util.js"),m=g.inherits,x=g.isObject,P=g.notEnumerableProp,j=w.Error,v=w.TypeError;"function"!=typeof v&&(v=a("TypeError","type error"));var M=w.RangeError;"function"!=typeof M&&(M=a("RangeError","range error"));var X=a("CancellationError","cancellation error"),h=a("TimeoutError","timeout error");m(r,j);var k="__BluebirdErrorTypes__",q=w[k];q||(q=b({CancellationError:X,TimeoutError:h,RejectionError:r}),P(w,k,q)),f.exports={Error:j,TypeError:v,RangeError:M,CancellationError:q.CancellationError,RejectionError:q.RejectionError,TimeoutError:q.TimeoutError,originatesFromRejection:p,markAsOriginatingFromRejection:u,attachDefaultState:s,ensureNotHandled:l,withHandledUnmarked:t,withHandledMarked:i,withStackAttached:d,isStackAttached:n,isHandled:o,canAttach:y}},{"./es5.js":156,"./global.js":160,"./util.js":183}],155:[function(e,f){"use strict";f.exports=function(f){function n(e){var n=new o(e),d=f.rejected(n),i=d._peekContext();return null!=i&&i._attachExtraTrace(n),d}var o=e("./errors.js").TypeError;return n}},{"./errors.js":154}],156:[function(e,f){function n(e){var f=[];for(var n in e)u.call(e,n)&&f.push(n);return f}function o(e,f,n){return e[f]=n.value,e}function d(e){return e}function i(e){try{return Object(e).constructor.prototype}catch(f){return s}}function t(e){try{return"[object Array]"===p.call(e)}catch(f){return!1}}var l=function(){"use strict";return void 0===this}();if(l)f.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,keys:Object.keys,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:l};else{var u={}.hasOwnProperty,p={}.toString,s={}.constructor.prototype;f.exports={isArray:t,keys:n,defineProperty:o,freeze:d,getPrototypeOf:i,isES5:l}}},{}],157:[function(e,f){"use strict";f.exports=function(f){function n(e){for(var f=this._settledValue,n=f.length,o=new Array(n),d=0,i=0;n>i;++i)e[i]&&(o[d++]=f[i]);return o.length=d,o}var o=(e("./assert.js"),e("./util.js").isArray,{ref:null});f.filter=function(e,d){return f.map(e,d,o)._then(n,void 0,void 0,o.ref,void 0,f.filter)},f.prototype.filter=function(e){return this.map(e,o)._then(n,void 0,void 0,o.ref,void 0,this.filter)}}},{"./assert.js":146,"./util.js":183}],158:[function(e,f){f.exports=function(f,n){function o(){return this}function d(){throw s(this),this}function i(e){return function(){return e}}function t(e){return function(){throw s(e),e}}function l(e,f,n){var u=c&&y(f);return n?e._then(u?o:i(f),a,void 0,f,void 0,l):e._then(u?d:t(f),a,void 0,f,void 0,l)}function u(e){var o=this.promise,d=this.handler,i=o._isBound()?d.call(o._boundTo):d();if(void 0!==i){var t=f._cast(i,u,void 0);if(f.is(t))return l(t,e,o.isFulfilled())}return o.isRejected()?(s(e),n.e=e,n):e}var p=e("./util.js"),s=e("./errors.js").ensureNotHandled,c=p.wrapsPrimitiveReceiver,y=p.isPrimitive,a=p.thrower;f.prototype.lastly=f.prototype["finally"]=function(e){if("function"!=typeof e)return this.then();var f={promise:this,handler:e};return this._then(u,u,void 0,f,void 0,this.lastly)}}},{"./errors.js":154,"./util.js":183}],159:[function(e,f){"use strict";f.exports=function(f,n,o){var d=e("./promise_spawn.js")(f,o),i=e("./errors.js"),t=i.TypeError;f.coroutine=function(e){if("function"!=typeof e)throw new t("generatorFunction must be a function");var f=d;return function n(){var o=e.apply(this,arguments),d=new f(void 0,void 0,n);return d._generator=o,d._next(void 0),d.promise()}},f.spawn=function(e){if("function"!=typeof e)return n("generatorFunction must be a function");var o=new d(e,this,f.spawn),i=o.promise();return o._run(f.spawn),i}}},{"./errors.js":154,"./promise_spawn.js":168}],160:[function(e,f){(function(e,n){"use strict";f.exports=function(){return"undefined"!=typeof this?this:"undefined"!=typeof e&&"undefined"!=typeof n&&"string"==typeof e.execPath?n:"undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof navigator&&null!==navigator&&"string"==typeof navigator.appName?void 0!==window.wrappedJSObject?window.wrappedJSObject:window:void 0}()}).call(this,e("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139}],161:[function(e,f){"use strict";f.exports=function(f,n,o,d){function i(e){var d=this,t=void 0;"function"!=typeof d&&(t=d.receiver,d=d.fn);var l=!1,u=new Array(e.length);if(void 0===t)for(var p=0,s=e.length;s>p;++p){var c=d(e[p],p,s);if(!l){var y=f._cast(c,i,void 0);if(y instanceof f){if(y.isFulfilled()){u[p]=y._settledValue;continue}l=!0,c=y}}u[p]=c}else for(var p=0,s=e.length;s>p;++p){var c=d.call(t,e[p],p,s);if(!l){var y=f._cast(c,i,void 0);if(y instanceof f){if(y.isFulfilled()){u[p]=y._settledValue;continue}l=!0,c=y}}u[p]=c}return l?n(u,o,i,void 0).promise():u}function t(e,f,t,l,u){if("function"!=typeof f)return d("fn must be a function");t===!0&&e._isBound()&&(f={fn:f,receiver:e._boundTo});var p=n(e,o,l,t===!0&&e._isBound()?e._boundTo:void 0).promise();return void 0!==u&&(u.ref=p),p._then(i,void 0,void 0,f,void 0,l)}e("./assert.js");f.prototype.map=function(e,f){return t(this,e,!0,this.map,f)},f.map=function(e,n,o){return t(e,n,!1,f.map,o)}}},{"./assert.js":146}],162:[function(e,f){"use strict";f.exports=function(f){function n(e){throw e}function o(e,f){var o=this,d=l(o,f,null,e);d===p&&t.invokeLater(n,void 0,d.e)}function d(e,f){var o=this,d=u(o,f,e);d===p&&t.invokeLater(n,void 0,d.e)}var i=e("./util.js"),t=e("./async.js"),l=(e("./assert.js"),i.tryCatch2),u=i.tryCatch1,p=i.errorObj;f.prototype.nodeify=function(e){return"function"==typeof e&&this._then(o,d,void 0,e,this._isBound()?this._boundTo:null,this.nodeify),this}}},{"./assert.js":146,"./async.js":147,"./util.js":183}],163:[function(e,f){"use strict";f.exports=function(f,n){var o=(e("./assert.js"),e("./util.js")),d=e("./async.js"),i=o.tryCatch1,t=o.errorObj;f.prototype.progressed=function(e){return this._then(void 0,void 0,e,void 0,void 0,this.progressed)},f.prototype._progress=function(e){this._isFollowingOrFulfilledOrRejected()||this._progressUnchecked(e)},f.prototype._progressHandlerAt=function(e){return 0===e?this._progressHandler0:this[e+2-5]},f.prototype._doProgressWith=function(e){var n=e.value,o=e.handler,d=e.promise,l=e.receiver;this._pushContext();var u=i(o,l,n);this._popContext(),u===t?null!=u.e&&"StopProgressPropagation"===u.e.name?u.e.__promiseHandled__=2:(d._attachExtraTrace(u.e),d._progress(u.e)):f.is(u)?u._then(d._progress,null,null,d,void 0,this._progress):d._progress(u)},f.prototype._progressUnchecked=function(e){if(this.isPending())for(var o=this._length(),i=0;o>i;i+=5){var t=this._progressHandlerAt(i),l=this._promiseAt(i);if(f.is(l))"function"==typeof t?d.invoke(this._doProgressWith,this,{handler:t,promise:l,receiver:this._receiverAt(i),value:e}):d.invoke(l._progress,l,e);else{var u=this._receiverAt(i);"function"==typeof t?t.call(u,e,l):f.is(u)&&u._isProxied()?u._progressUnchecked(e):n(u,l)&&u._promiseProgressed(e,l)}}}}},{"./assert.js":146,"./async.js":147,"./util.js":183}],164:[function(e,f){(function(n){"use strict";f.exports=function(){function f(e){return void 0===e?!1:e instanceof d}function o(e,f){return e instanceof r?f>=0:!1}function d(e){if("function"!=typeof e)throw new q("the promise constructor requires a resolver function");if(this.constructor!==d)throw new q("the promise constructor cannot be invoked directly");this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._settledValue=void 0,this._boundTo=void 0,e!==c&&this._resolveFromResolver(e)}function i(e,f,n){return t(e,r,n,f===!0&&e._isBound()?e._boundTo:void 0).promise()}function t(e,n,o,i){var l=null;return m(e)?l=e:(l=d._cast(e,o,void 0),l!==e?l._setBoundTo(i):f(l)||(l=null)),null!==l?new n(l,"function"==typeof o?o:t,i):{promise:function(){return L("expecting an array, a promise or a thenable")}}}var l=e("./global.js"),u=(e("./assert.js"),e("./util.js")),p=e("./async.js"),s=e("./errors.js"),c=function(){},y={},a={e:null},r=e("./promise_array.js")(d,c),w=e("./captured_trace.js")(),b=e("./catch_filter.js")(a),g=e("./promise_resolver.js"),m=u.isArray,x=u.notEnumerableProp,P=u.isObject,j=u.ensurePropertyExpansion,v=u.errorObj,M=u.tryCatch1,X=u.tryCatch2,h=u.tryCatchApply,k=s.RangeError,q=s.TypeError,z=s.CancellationError,A=s.TimeoutError,B=s.RejectionError,C=s.originatesFromRejection,D=s.markAsOriginatingFromRejection,E=s.ensureNotHandled,F=s.withHandledMarked,G=s.withStackAttached,H=s.isStackAttached,I=s.isHandled,J=s.canAttach,K=u.thrower,L=e("./errors_api_rejection")(d),N=function(){return new q("circular promise resolution chain")};d.prototype.bind=function(e){var f=new d(c);return O&&f._setTrace(this.bind,this),f._follow(this),f._setBoundTo(e),this._cancellable()&&(f._setCancellable(),f._cancellationParent=this),f},d.prototype.toString=function(){return"[object Promise]"},d.prototype.caught=d.prototype["catch"]=function(e){var f=arguments.length;if(f>1){var n,o=new Array(f-1),d=0;for(n=0;f-1>n;++n){var i=arguments[n];if("function"!=typeof i){var t=new q("A catch filter must be an error constructor or a filter function");return this._attachExtraTrace(t),void p.invoke(this._reject,this,t)}o[d++]=i}o.length=d,e=arguments[n],this._resetTrace(this.caught);var l=new b(o,e,this);return this._then(void 0,l.doFilter,void 0,l,void 0,this.caught)}return this._then(void 0,e,void 0,void 0,void 0,this.caught)},d.prototype.then=function(e,f,n){return this._then(e,f,n,void 0,void 0,this.then)},d.prototype.done=function(e,f,n){var o=this._then(e,f,n,void 0,void 0,this.done);o._setIsFinal()},d.prototype.spread=function(e,f){return this._then(e,f,void 0,y,void 0,this.spread)},d.prototype.isFulfilled=function(){return(268435456&this._bitField)>0},d.prototype.isRejected=function(){return(134217728&this._bitField)>0},d.prototype.isPending=function(){return!this.isResolved()},d.prototype.isResolved=function(){return(402653184&this._bitField)>0},d.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable()},d.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this._settledValue,e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this._settledValue,e.isRejected=!0),e},d.prototype.all=function(){return i(this,!0,this.all)},d.is=f,d.all=function(e){return i(e,!1,d.all)},d.join=function(){for(var e=arguments.length,f=new Array(e),n=0;e>n;++n)f[n]=arguments[n];return t(f,r,d.join,void 0).promise()},d.resolve=d.fulfilled=function(e,f){var n=new d(c);return O&&n._setTrace("function"==typeof f?f:d.resolve,void 0),n._tryFollow(e)?n:(n._cleanValues(),n._setFulfilled(),n._settledValue=e,n)},d.reject=d.rejected=function(e){var f=new d(c);return O&&f._setTrace(d.reject,void 0),D(e),f._cleanValues(),f._setRejected(),f._settledValue=e,f},d.prototype.error=function(e){return this.caught(C,e)},d.prototype._resolveFromSyncValue=function(e,f){if(e===v)this._cleanValues(),this._setRejected(),this._settledValue=e.e;else{var n=d._cast(e,f,void 0);n instanceof d?this._follow(n):(this._cleanValues(),this._setFulfilled(),this._settledValue=e)}},d.method=function(e){if("function"!=typeof e)throw new q("fn must be a function");return function f(){var n;switch(arguments.length){case 0:n=M(e,this,void 0);break;case 1:n=M(e,this,arguments[0]);break;case 2:n=X(e,this,arguments[0],arguments[1]);break;default:for(var o=arguments.length,i=new Array(o),t=0;o>t;++t)i[t]=arguments[t];n=h(e,i,this)}var l=new d(c);return O&&l._setTrace(f,void 0),l._resolveFromSyncValue(n,f),l}},d["try"]=d.attempt=function(e,f,n){if("function"!=typeof e)return L("fn must be a function");var o=m(f)?h(e,f,n):M(e,n,f),i=new d(c);return O&&i._setTrace(d.attempt,void 0),i._resolveFromSyncValue(o,d.attempt),i},d.defer=d.pending=function(e){var f=new d(c);return O&&f._setTrace("function"==typeof e?e:d.defer,void 0),new g(f)},d.bind=function(e){var f=new d(c);return O&&f._setTrace(d.bind,void 0),f._setFulfilled(),f._setBoundTo(e),f},d.cast=function(e,f){"function"!=typeof f&&(f=d.cast);var n=d._cast(e,f,void 0);return n instanceof d?n:d.resolve(n,f)},d.onPossiblyUnhandledRejection=function(e){w.possiblyUnhandledRejection="function"==typeof e?e:void 0};var O=!1||!("undefined"==typeof n||"string"!=typeof n.execPath||"object"!=typeof n.env||!n.env.BLUEBIRD_DEBUG&&"development"!==n.env.NODE_ENV);d.longStackTraces=function(){if(p.haveItemsQueued()&&O===!1)throw new Error("cannot enable long stack traces after promises have been created");O=w.isSupported()},d.hasLongStackTraces=function(){return O&&w.isSupported()},d.prototype._setProxyHandlers=function(e,f){var n=this._length();if(n>=4194298&&(n=0,this._setLength(0)),0===n)this._promise0=f,this._receiver0=e;else{var o=n-5;this[o+3]=f,this[o+4]=e,this[o+0]=this[o+1]=this[o+2]=void 0}this._setLength(n+5)},d.prototype._proxyPromiseArray=function(e,f){this._setProxyHandlers(e,f)},d.prototype._proxyPromise=function(e){e._setProxied(),this._setProxyHandlers(e,-1)},d.prototype._then=function(e,f,n,o,i,t){var l=void 0!==i,u=l?i:new d(c);if(O&&!l){var s=this._peekContext()===this._traceParent;u._traceParent=s?this._traceParent:this,u._setTrace("function"==typeof t?t:this._then,this)}!l&&this._isBound()&&u._setBoundTo(this._boundTo);var y=this._addCallbacks(e,f,n,u,o);return!l&&this._cancellable()&&(u._setCancellable(),u._cancellationParent=this),this.isResolved()&&p.invoke(this._queueSettleAt,this,y),u},d.prototype._length=function(){return 4194303&this._bitField},d.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},d.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},d.prototype._setLength=function(e){this._bitField=-4194304&this._bitField|4194303&e},d.prototype._cancellable=function(){return(67108864&this._bitField)>0},d.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},d.prototype._setRejected=function(){this._bitField=134217728|this._bitField},d.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},d.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},d.prototype._isFinal=function(){return(33554432&this._bitField)>0},d.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},d.prototype._unsetCancellable=function(){this._bitField=-67108865&this._bitField},d.prototype._receiverAt=function(e){var f;return f=0===e?this._receiver0:this[e+4-5],this._isBound()&&void 0===f?this._boundTo:f},d.prototype._promiseAt=function(e){return 0===e?this._promise0:this[e+3-5]},d.prototype._fulfillmentHandlerAt=function(e){return 0===e?this._fulfillmentHandler0:this[e+0-5]},d.prototype._rejectionHandlerAt=function(e){return 0===e?this._rejectionHandler0:this[e+1-5]},d.prototype._unsetAt=function(e){0===e?this._fulfillmentHandler0=this._rejectionHandler0=this._progressHandler0=this._promise0=this._receiver0=void 0:this[e-5+0]=this[e-5+1]=this[e-5+2]=this[e-5+3]=this[e-5+4]=void 0},d.prototype._resolveFromResolver=function(e){function f(e){o._tryFollow(e)||o._fulfill(e)}function n(e){o._attachExtraTrace(e),D(e),o._reject(e)}var o=this,d=O;d&&(this._setTrace(this._resolveFromResolver,void 0),this._pushContext());var i=X(e,void 0,f,n);d&&this._popContext(),void 0!==i&&i===v&&o._reject(i.e)},d.prototype._addCallbacks=function(e,f,n,o,d){var i=this._length();if(i>=4194298&&(i=0,this._setLength(0)),0===i)this._promise0=o,void 0!==d&&(this._receiver0=d),"function"==typeof e&&(this._fulfillmentHandler0=e),"function"==typeof f&&(this._rejectionHandler0=f),"function"==typeof n&&(this._progressHandler0=n);else{var t=i-5;this[t+3]=o,this[t+4]=d,this[t+0]="function"==typeof e?e:void 0,this[t+1]="function"==typeof f?f:void 0,this[t+2]="function"==typeof n?n:void 0}return this._setLength(i+5),i},d.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=8388608|this._bitField,this._boundTo=e):this._bitField=-8388609&this._bitField},d.prototype._isBound=function(){return 8388608===(8388608&this._bitField)},d.prototype._spreadSlowCase=function(e,f,n,o){var d=t(n,r,this._spreadSlowCase,o).promise()._then(function(){return e.apply(o,arguments)},void 0,void 0,y,void 0,this._spreadSlowCase);f._follow(d)},d.prototype._markHandled=function(e){if("object"==typeof e&&null!==e){var f=e.__promiseHandled__;void 0===f?x(e,"__promiseHandled__",2):e.__promiseHandled__=F(f)}},d.prototype._callSpread=function(e,n,o,i){var t=this._isBound()?this._boundTo:void 0;if(m(o))for(var l=this._settlePromiseFromHandler,u=0,p=o.length;p>u;++u)if(f(d._cast(o[u],l,void 0)))return void this._spreadSlowCase(e,n,o,t);return i&&n._pushContext(),h(e,o,t)},d.prototype._callHandler=function(e,f,n,o,d){var i;return f!==y||this.isRejected()?(d&&n._pushContext(),i=M(e,f,o)):i=this._callSpread(e,n,o,d),d&&n._popContext(),i},d.prototype._settlePromiseFromHandler=function(e,n,o,i){if(!f(i))return void e.call(n,o,i);this.isRejected()&&this._markHandled(o);var t=O,l=this._callHandler(e,n,i,o,t);if(!i._isFollowing())if(l===v||l===i||l===a){var u=l===i?N():E(l.e);l!==a&&i._attachExtraTrace(u),i._rejectUnchecked(u)}else{var p=d._cast(l,t?this._settlePromiseFromHandler:void 0,i);f(p)?(i._follow(p),p._cancellable()&&(i._cancellationParent=p,i._setCancellable())):i._fulfillUnchecked(l)}},d.prototype._follow=function(e){this._setFollowing(),e.isPending()?(e._cancellable()&&(this._cancellationParent=e,this._setCancellable()),e._proxyPromise(this)):e.isFulfilled()?this._fulfillUnchecked(e._settledValue):this._rejectUnchecked(e._settledValue),O&&null==e._traceParent&&(e._traceParent=this) | |
},d.prototype._tryFollow=function(e){if(this._isFollowingOrFulfilledOrRejected()||e===this)return!1;var n=d._cast(e,this._tryFollow,void 0);return f(n)?(this._follow(n),!0):!1},d.prototype._resetTrace=function(e){if(O){var f=this._peekContext(),n=void 0===f;this._trace=new w("function"==typeof e?e:this._resetTrace,n)}},d.prototype._setTrace=function(e,f){if(O){var n=this._peekContext();this._traceParent=n;var o=void 0===n;this._trace=void 0!==f&&f._traceParent===n?f._trace:new w("function"==typeof e?e:this._setTrace,o)}return this},d.prototype._attachExtraTrace=function(e){if(O&&J(e)){var f=this,n=e.stack;n="string"==typeof n?n.split("\n"):[];for(var o=1;null!=f&&null!=f._trace;)n=w.combine(n,f._trace.stack.split("\n")),f=f._traceParent;var d=Error.stackTraceLimit+o,i=n.length;i>d&&(n.length=d),e.stack=n.length<=o?"(No stack trace)":n.join("\n"),e.__promiseHandled__=G(e.__promiseHandled__)}},d.prototype._notifyUnhandledRejection=function(e){I(e.__promiseHandled__)||(e.__promiseHandled__=F(e.__promiseHandled__),w.possiblyUnhandledRejection(e,this))},d.prototype._unhandledRejection=function(e){I(e.__promiseHandled__)||p.invokeLater(this._notifyUnhandledRejection,this,e)},d.prototype._cleanValues=function(){this._cancellable()&&(this._cancellationParent=void 0)},d.prototype._fulfill=function(e){this._isFollowingOrFulfilledOrRejected()||this._fulfillUnchecked(e)},d.prototype._reject=function(e){this._isFollowingOrFulfilledOrRejected()||this._rejectUnchecked(e)},d.prototype._settlePromiseAt=function(e){var f=this.isFulfilled()?this._fulfillmentHandlerAt(e):this._rejectionHandlerAt(e),n=this._settledValue,i=this._receiverAt(e),t=this._promiseAt(e);if("function"==typeof f)this._settlePromiseFromHandler(f,i,n,t);else{var l=!1,u=this.isFulfilled();void 0!==i&&(i instanceof d&&i._isProxied()?(i._unsetProxied(),u?i._fulfillUnchecked(n):i._rejectUnchecked(n),l=!0):o(i,t)&&(u?i._promiseFulfilled(n,t):i._promiseRejected(n,t),l=!0)),l||(u?t._fulfill(n):t._reject(n))}e>=256&&this._queueGC()},d.prototype._isProxied=function(){return 4194304===(4194304&this._bitField)},d.prototype._setProxied=function(){this._bitField=4194304|this._bitField},d.prototype._unsetProxied=function(){this._bitField=-4194305&this._bitField},d.prototype._isGcQueued=function(){return-1073741824===(-1073741824&this._bitField)},d.prototype._setGcQueued=function(){this._bitField=-1073741824|this._bitField},d.prototype._unsetGcQueued=function(){this._bitField=1073741823&this._bitField},d.prototype._queueGC=function(){this._isGcQueued()||(this._setGcQueued(),p.invokeLater(this._gc,this,void 0))},d.prototype._gc=function(){var e=this._length();this._unsetAt(0);for(var f=0;e>f;f++)delete this[f];this._setLength(0),this._unsetGcQueued()},d.prototype._queueSettleAt=function(e){p.invoke(this._settlePromiseAt,this,e)},d.prototype._fulfillUnchecked=function(e){if(this.isPending()){if(e===this){var f=N();return this._attachExtraTrace(f),this._rejectUnchecked(f)}this._cleanValues(),this._setFulfilled(),this._settledValue=e;var n=this._length();n>0&&p.invoke(this._fulfillPromises,this,n)}},d.prototype._fulfillPromises=function(e){e=this._length();for(var f=0;e>f;f+=5)this._settlePromiseAt(f)},d.prototype._rejectUnchecked=function(e){if(this.isPending()){if(e===this){var f=N();return this._attachExtraTrace(f),this._rejectUnchecked(f)}if(this._cleanValues(),this._setRejected(),this._settledValue=e,this._isFinal())return void p.invokeLater(K,void 0,e);var n=this._length();n>0?p.invoke(this._rejectPromises,this,n):this._ensurePossibleRejectionHandled(e)}},d.prototype._rejectPromises=function(e){e=this._length();for(var n=!1,d=0;e>d;d+=5){var i=this._rejectionHandlerAt(d);if(!n)if("function"==typeof i)n=!0;else{var t=this._promiseAt(d);if(f(t)&&t._length()>0)n=!0;else{var l=this._receiverAt(d);(f(l)&&l._length()>0||o(l,t))&&(n=!0)}}this._settlePromiseAt(d)}n||this._ensurePossibleRejectionHandled(this._settledValue)},d.prototype._ensurePossibleRejectionHandled=function(e){if(void 0!==w.possiblyUnhandledRejection&&P(e)){var f=e.__promiseHandled__,n=e;if(void 0===f)n=j(e,"__promiseHandled__",0),f=0;else if(I(f))return;H(f)||this._attachExtraTrace(n),p.invoke(this._unhandledRejection,this,n)}};var Q=[];d.prototype._peekContext=function(){var e=Q.length-1;return e>=0?Q[e]:void 0},d.prototype._pushContext=function(){O&&Q.push(this)},d.prototype._popContext=function(){O&&Q.pop()};var R=l.Promise;return d.noConflict=function(){return l.Promise===d&&(l.Promise=R),d},w.isSupported()||(d.longStackTraces=function(){},O=!1),d._makeSelfResolutionError=N,e("./finally.js")(d,a),e("./direct_resolve.js")(d),e("./thenables.js")(d),d.RangeError=k,d.CancellationError=z,d.TimeoutError=A,d.TypeError=q,d.RejectionError=B,e("./timers.js")(d,c),e("./synchronous_inspection.js")(d),e("./any.js")(d,t,r),e("./race.js")(d,c),e("./call_get.js")(d),e("./filter.js")(d,t,r,L),e("./generators.js")(d,L,c),e("./map.js")(d,t,r,L),e("./nodeify.js")(d),e("./promisify.js")(d,c),e("./props.js")(d,r),e("./reduce.js")(d,t,r,L,c),e("./settle.js")(d,t,r),e("./some.js")(d,t,r,L),e("./progress.js")(d,o),e("./cancel.js")(d,c),d.prototype=d.prototype,d}}).call(this,e("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./any.js":145,"./assert.js":146,"./async.js":147,"./call_get.js":149,"./cancel.js":150,"./captured_trace.js":151,"./catch_filter.js":152,"./direct_resolve.js":153,"./errors.js":154,"./errors_api_rejection":155,"./filter.js":157,"./finally.js":158,"./generators.js":159,"./global.js":160,"./map.js":161,"./nodeify.js":162,"./progress.js":163,"./promise_array.js":165,"./promise_resolver.js":167,"./promisify.js":169,"./props.js":171,"./race.js":173,"./reduce.js":174,"./settle.js":176,"./some.js":178,"./synchronous_inspection.js":180,"./thenables.js":181,"./timers.js":182,"./util.js":183,"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139}],165:[function(e,f){"use strict";f.exports=function(f,n){function o(e){switch(e){case-1:return void 0;case-2:return[];case-3:return{}}}function d(e,o,d){var i=this._promise=new f(n),t=void 0;f.is(e)&&(t=e,e._cancellable()&&(i._setCancellable(),i._cancellationParent=e),e._isBound()&&i._setBoundTo(d)),i._setTrace(o,t),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var i=(e("./assert.js"),e("./errors.js").ensureNotHandled),t=e("./util.js"),l=e("./async.js"),u={}.hasOwnProperty,p=t.isArray;return d.PropertiesPromiseArray=function(){},d.prototype.length=function(){return this._length},d.prototype.promise=function(){return this._promise},d.prototype._init=function(e,n){var i=this._values;if(f.is(i)){if(!i.isFulfilled())return i.isPending()?void i._then(this._init,this._reject,void 0,this,n,this.constructor):void this._reject(i._settledValue);if(i=i._settledValue,!p(i)){var t=new f.TypeError("expecting an array, a promise or a thenable");return void this.__hardReject__(t)}this._values=i}if(0===i.length)return void this._resolve(o(n));var s,c=i.length,y=c;s=this instanceof d.PropertiesPromiseArray?this._values:new Array(c);for(var a=!1,r=0;c>r;++r){var w=i[r];if(void 0!==w||u.call(i,r)){var b=f._cast(w,void 0,void 0);b instanceof f&&b.isPending()?b._proxyPromiseArray(this,r):a=!0,s[r]=b}else y--}if(0===y)return void this._resolve(-2===n?s:o(n));if(this._values=s,this._length=y,a){var g=y===c?this._scanDirectValues:this._scanDirectValuesHoled;l.invoke(g,this,c)}},d.prototype._settlePromiseAt=function(e){var n=this._values[e];f.is(n)?n.isFulfilled()?this._promiseFulfilled(n._settledValue,e):n.isRejected()&&this._promiseRejected(n._settledValue,e):this._promiseFulfilled(n,e)},d.prototype._scanDirectValuesHoled=function(e){for(var f=0;e>f&&!this._isResolved();++f)u.call(this._values,f)&&this._settlePromiseAt(f)},d.prototype._scanDirectValues=function(e){for(var f=0;e>f&&!this._isResolved();++f)this._settlePromiseAt(f)},d.prototype._isResolved=function(){return null===this._values},d.prototype._resolve=function(e){this._values=null,this._promise._fulfill(e)},d.prototype.__hardReject__=d.prototype._reject=function(e){i(e),this._values=null,this._promise._attachExtraTrace(e),this._promise._reject(e)},d.prototype._promiseProgressed=function(e,f){this._isResolved()||this._promise._progress({index:f,value:e})},d.prototype._promiseFulfilled=function(e,f){if(!this._isResolved()){this._values[f]=e;var n=++this._totalResolved;n>=this._length&&this._resolve(this._values)}},d.prototype._promiseRejected=function(e){this._isResolved()||(this._totalResolved++,this._reject(e))},d}},{"./assert.js":146,"./async.js":147,"./errors.js":154,"./util.js":183}],166:[function(e,f){"use strict";function n(e){void 0!==e?(this._bitField=e._bitField,this._settledValue=e.isResolved()?e._settledValue:void 0):(this._bitField=0,this._settledValue=void 0)}var o=e("./errors.js").TypeError;n.prototype.isFulfilled=function(){return(268435456&this._bitField)>0},n.prototype.isRejected=function(){return(134217728&this._bitField)>0},n.prototype.isPending=function(){return 0===(402653184&this._bitField)},n.prototype.value=function(){if(!this.isFulfilled())throw new o("cannot get fulfillment value of a non-fulfilled promise");return this._settledValue},n.prototype.error=function(){if(!this.isRejected())throw new o("cannot get rejection reason of a non-rejected promise");return this._settledValue},f.exports=n},{"./errors.js":154}],167:[function(e,f){"use strict";function n(e){return e instanceof Error&&a.getPrototypeOf(e)===Error.prototype}function o(e){var f;return f=n(e)?new s(e):e,u.markAsOriginatingFromRejection(f),f}function d(e){function f(f,n){if(f){var d=o(l(f));e._attachExtraTrace(d),e._reject(d)}else if(arguments.length>2){for(var i=arguments.length,t=new Array(i-1),u=1;i>u;++u)t[u-1]=arguments[u];e._fulfill(t)}else e._fulfill(n)}return f}var i,t=e("./util.js"),l=t.maybeWrapAsError,u=e("./errors.js"),p=u.TimeoutError,s=u.RejectionError,c=e("./async.js"),y=t.haveGetters,a=e("./es5.js");if(i=y?function(e){this.promise=e}:function(e){this.promise=e,this.asCallback=d(e),this.callback=this.asCallback},y){var r={get:function(){return d(this.promise)}};a.defineProperty(i.prototype,"asCallback",r),a.defineProperty(i.prototype,"callback",r)}i._nodebackForPromise=d,i.prototype.toString=function(){return"[object PromiseResolver]"},i.prototype.resolve=i.prototype.fulfill=function(e){var f=this.promise;f._tryFollow(e)||c.invoke(f._fulfill,f,e)},i.prototype.reject=function(e){var f=this.promise;u.markAsOriginatingFromRejection(e),f._attachExtraTrace(e),c.invoke(f._reject,f,e)},i.prototype.progress=function(e){c.invoke(this.promise._progress,this.promise,e)},i.prototype.cancel=function(){c.invoke(this.promise.cancel,this.promise,void 0)},i.prototype.timeout=function(){this.reject(new p("timeout"))},i.prototype.isResolved=function(){return this.promise.isResolved()},i.prototype.toJSON=function(){return this.promise.toJSON()},f.exports=i},{"./async.js":147,"./errors.js":154,"./es5.js":156,"./util.js":183}],168:[function(e,f){"use strict";f.exports=function(f,n){function o(e,o,d){var i=this._promise=new f(n);i._setTrace(d,void 0),this._generatorFunction=e,this._receiver=o,this._generator=void 0}var d=e("./errors.js"),i=d.TypeError,t=d.ensureNotHandled,l=e("./util.js"),u=l.isArray,p=l.errorObj,s=l.tryCatch1;return o.prototype.promise=function(){return this._promise},o.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._next(void 0)},o.prototype._continue=function c(e){if(e===p)return this._generator=void 0,this._promise._attachExtraTrace(e.e),void this._promise._reject(e.e);var n=e.value;if(e.done===!0)this._generator=void 0,this._promise._tryFollow(n)||this._promise._fulfill(n);else{var o=f._cast(n,c,void 0);if(!(o instanceof f)){if(!u(o))return void this._throw(new i("A value was yielded that could not be treated as a promise"));o=f.all(o)}o._then(this._next,this._throw,void 0,this,null,void 0)}},o.prototype._throw=function(e){t(e),this._promise._attachExtraTrace(e),this._continue(s(this._generator["throw"],this._generator,e))},o.prototype._next=function(e){this._continue(s(this._generator.next,this._generator,e))},o}},{"./errors.js":154,"./util.js":183}],169:[function(e,f){"use strict";f.exports=function(f,n){function o(e){return e.__isPromisified__===!0}function d(e,o,d){function i(f){for(var n=new Array(f),d=0,i=n.length;i>d;++d)n[d]="a"+(d+1);var t=f>0?",":"";return"string"==typeof e&&o===u?"this['"+e+"']("+n.join(",")+t+" fn);break;":(void 0===o?"callback("+n.join(",")+t+" fn);":"callback.call("+(o===u?"this":"receiver")+", "+n.join(",")+t+" fn);")+"break;"}function t(){return"var args = new Array(len + 1);var i = 0;for (var i = 0; i < len; ++i) { args[i] = arguments[i];}args[i] = fn;"}var l="string"==typeof d?d+"Async":"promisified";return new Function("Promise","callback","receiver","withAppended","maybeWrapAsError","nodebackForPromise","INTERNAL","var ret = function "+l+'(a1, a2, a3, a4, a5) {"use strict";var len = arguments.length;var promise = new Promise(INTERNAL);promise._setTrace('+l+", void 0);var fn = nodebackForPromise(promise);try{switch(len) {case 1:"+i(1)+"case 2:"+i(2)+"case 3:"+i(3)+"case 0:"+i(0)+"case 4:"+i(4)+"case 5:"+i(5)+"default: "+t()+("string"==typeof e?"this['"+e+"'].apply(":"callback.apply(")+(o===u?"this":"receiver")+", args); break;}}catch(e){ var wrapped = maybeWrapAsError(e);promise._attachExtraTrace(wrapped);promise._reject(wrapped);}return promise;}; ret.__isPromisified__ = true; return ret;")(f,e,o,y,a,c,n)}function i(e,o){function d(){var i=o;o===u&&(i=this),"string"==typeof e&&(e=i[e]);var t=new f(n);t._setTrace(d,void 0);var l=c(t);try{e.apply(i,y(arguments,l))}catch(p){var s=a(p);t._attachExtraTrace(s),t._reject(s)}return t}return d.__isPromisified__=!0,d}function t(){}function l(e,f,n){if(n){for(var o=x(e),d=0,i=o.length;i>d;d+=2){var l=o[d],p=o[d+1],s=l+"__beforePromisified__",c=l+"Async";w(e,s,p),e[c]=P(s,u,l)}return o.length>16&&(t.prototype=e),e}return P(e,f,void 0)}var u={},p=e("./util.js"),s=e("./es5.js"),c=e("./promise_resolver.js")._nodebackForPromise,y=p.withAppended,a=p.maybeWrapAsError,r=p.canEvaluate,w=p.notEnumerableProp,b=p.deprecated,g=(e("./assert.js"),new RegExp("__beforePromisified__$")),m={}.hasOwnProperty,x=function(){if(s.isES5){var e=Object.create,f=Object.getOwnPropertyDescriptor;return function(n){for(var d=n,i=[],t=e(null);null!==n;){for(var l=s.keys(n),u=0,p=l.length;p>u;++u){var c=l[u];if(!(t[c]||g.test(c)||m.call(d,c+"__beforePromisified__"))){t[c]=!0;var y=f(n,c);null==y||"function"!=typeof y.value||o(y.value)||i.push(c,y.value)}}n=s.getPrototypeOf(n)}return i}}return function(e){var f=[];for(var n in e)if(!g.test(n)&&!m.call(e,n+"__beforePromisified__")){var d=e[n];"function"!=typeof d||o(d)||f.push(n,d)}return f}}(),P=r?d:i;f.promisify=function(e,f){if("object"==typeof e&&null!==e)return b("Promise.promisify for promisifying entire objects is deprecated. Use Promise.promisifyAll instead."),l(e,f,!0);if("function"!=typeof e)throw new TypeError("fn must be a function");return o(e)?e:l(e,arguments.length<2?u:f,!1)},f.promisifyAll=function(e){if("function"!=typeof e&&"object"!=typeof e)throw new TypeError("the target of promisifyAll must be an object or a function");return l(e,void 0,!0)}}},{"./assert.js":146,"./es5.js":156,"./promise_resolver.js":167,"./util.js":183}],170:[function(e,f){"use strict";f.exports=function(f,n){function o(e,f,n){for(var o=t.keys(e),d=new Array(o.length),i=0,l=d.length;l>i;++i)d[i]=e[o[i]];if(this.constructor$(d,f,n),!this._isResolved())for(var i=0,l=o.length;l>i;++i)d.push(o[i])}var d=(e("./assert.js"),e("./util.js")),i=d.inherits,t=e("./es5.js");return i(o,n),o.prototype._init=function(){this._init$(void 0,-3)},o.prototype._promiseFulfilled=function(e,f){if(!this._isResolved()){this._values[f]=e;var n=++this._totalResolved;if(n>=this._length){for(var o={},d=this.length(),i=0,t=this.length();t>i;++i)o[this._values[i+d]]=this._values[i];this._resolve(o)}}},o.prototype._promiseProgressed=function(e,f){this._isResolved()||this._promise._progress({key:this._values[f+this.length()],value:e})},n.PropertiesPromiseArray=o,o}},{"./assert.js":146,"./es5.js":156,"./util.js":183}],171:[function(e,f){"use strict";f.exports=function(f,n){function o(e,n,o){var i,u=f._cast(e,o,void 0);return l(u)?(f.is(u)?i=u._then(f.props,void 0,void 0,void 0,void 0,o):(i=new d(u,o,n===!0&&u._isBound()?u._boundTo:void 0).promise(),n=!1),n===!0&&u._isBound()&&i._setBoundTo(u._boundTo),i):t("cannot await properties of a non-object")}var d=e("./properties_promise_array.js")(f,n),i=e("./util.js"),t=e("./errors_api_rejection")(f),l=i.isObject;f.prototype.props=function(){return o(this,!0,this.props)},f.props=function(e){return o(e,!1,f.props)}}},{"./errors_api_rejection":155,"./properties_promise_array.js":170,"./util.js":183}],172:[function(e,f){"use strict";function n(e,f,n,o,d){for(var i=0;d>i;++i)n[i+o]=e[i+f]}function o(e){return e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function d(e){return"number"!=typeof e?16:o(Math.min(Math.max(16,e),1073741824))}function i(e){this._capacity=d(e),this._length=0,this._front=0,this._makeCapacity()}e("./assert.js");i.prototype._willBeOverCapacity=function(e){return this._capacity<e},i.prototype._pushOne=function(e){var f=this.length();this._checkCapacity(f+1);var n=this._front+f&this._capacity-1;this[n]=e,this._length=f+1},i.prototype.push=function(e,f,n){var o=this.length()+3;if(this._willBeOverCapacity(o))return this._pushOne(e),this._pushOne(f),void this._pushOne(n);var d=this._front+o-3;this._checkCapacity(o);var i=this._capacity-1;this[d+0&i]=e,this[d+1&i]=f,this[d+2&i]=n,this._length=o},i.prototype.shift=function(){var e=this._front,f=this[e];return this[e]=void 0,this._front=e+1&this._capacity-1,this._length--,f},i.prototype.length=function(){return this._length},i.prototype._makeCapacity=function(){for(var e=this._capacity,f=0;e>f;++f)this[f]=void 0},i.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(this._capacity<<3)},i.prototype._resizeTo=function(e){var f=this._front,o=this._capacity,d=new Array(o),i=this.length();if(n(this,0,d,0,o),this._capacity=e,this._makeCapacity(),this._front=0,o>=f+i)n(d,f,this,0,i);else{var t=i-(f+i&o-1);n(d,f,this,0,t),n(d,0,this,t,i-t)}},f.exports=i},{"./assert.js":146}],173:[function(e,f){"use strict";f.exports=function(f,n){function o(e,o,u){var p=f._cast(e,o,void 0);if(f.is(p))return t(p);if(!i(e))return d("expecting an array, a promise or a thenable");var s=new f(n);s._setTrace(o,u),void 0!==u&&(u._isBound()&&s._setBoundTo(u._boundTo),u._cancellable()&&(s._setCancellable(),s._cancellationParent=u));for(var c=s._fulfill,y=s._reject,a=0,r=e.length;r>a;++a){var w=e[a];(void 0!==w||l.call(e,a))&&f.cast(w)._then(c,y,void 0,s,null,o)}return s}var d=e("./errors_api_rejection.js")(f),i=e("./util.js").isArray,t=function(e){return e.then(function f(n){return o(n,f,e)})},l={}.hasOwnProperty;f.race=function(e){return o(e,f.race,void 0)},f.prototype.race=function(){return o(this,this.race,void 0)}}},{"./errors_api_rejection.js":155,"./util.js":183}],174:[function(e,f){"use strict";f.exports=function(f,n,o,d,i){function t(e,n,o,d,t){this.promise=new f(i),this.index=n,this.length=d.length,this.items=d,this.callback=e,this.receiver=t,this.accum=o}function l(e,f){var n=this,o=void 0;"function"!=typeof n&&(o=n.receiver,n=n.fn);var d=e.length,i=void 0,l=0;void 0!==f?(i=f,l=0):(l=1,d>0&&(i=e[0]));var u=l;if(u>=d)return i;var p=new t(n,u,i,e,o);return p.iterate(),p.promise}function u(e){var f=this.fn,n=this.initialValue;return l.call(f,e,n)}function p(e,f,n,o,d){return n._then(function i(n){return s(e,f,n,o,i)},void 0,void 0,void 0,void 0,d)}function s(e,i,t,s,c){if("function"!=typeof i)return d("fn must be a function");if(s===!0&&e._isBound()&&(i={fn:i,receiver:e._boundTo}),void 0!==t){if(f.is(t)){if(!t.isFulfilled())return p(e,i,t,s,c);t=t._settledValue}return n(e,o,c,s===!0&&e._isBound()?e._boundTo:void 0).promise()._then(u,void 0,void 0,{fn:i,initialValue:t},void 0,f.reduce)}return n(e,o,c,s===!0&&e._isBound()?e._boundTo:void 0).promise()._then(l,void 0,void 0,i,void 0,c)}e("./assert.js");t.prototype.reject=function(e){this.promise._reject(e)},t.prototype.fulfill=function(e,f){this.accum=e,this.index=f+1,this.iterate()},t.prototype.iterate=function(){for(var e=this.index,n=this.length,o=this.items,d=this.accum,i=this.receiver,t=this.callback,l=this.iterate;n>e;++e)if(d=f._cast(t.call(i,d,o[e],e,n),l,void 0),d instanceof f)return void d._then(this.fulfill,this.reject,void 0,this,e,l);this.promise._fulfill(d)},f.reduce=function(e,n,o){return s(e,n,o,!1,f.reduce)},f.prototype.reduce=function(e,f){return s(this,e,f,!0,this.reduce)}}},{"./assert.js":146}],175:[function(e,f){(function(n){"use strict";{var o,d=e("./global.js");e("./assert.js")}if("undefined"!=typeof n&&null!==n&&"function"==typeof n.cwd&&"function"==typeof n.nextTick)o=n.nextTick;else if("function"!=typeof MutationObserver&&"function"!=typeof WebkitMutationObserver&&"function"!=typeof WebKitMutationObserver||"undefined"==typeof document||"function"!=typeof document.createElement)if("function"==typeof d.postMessage&&"function"!=typeof d.importScripts&&"function"==typeof d.addEventListener&&"function"==typeof d.removeEventListener){var i="bluebird_message_key_"+Math.random();o=function(){function e(e){if(e.source===d&&e.data===i){var n=f;f=void 0,n()}}var f=void 0;return d.addEventListener("message",e,!1),function(e){f=e,d.postMessage(i,"*")}}()}else o="function"==typeof MessageChannel?function(){var e=void 0,f=new MessageChannel;return f.port1.onmessage=function(){var f=e;e=void 0,f()},function(n){e=n,f.port2.postMessage(null)}}():d.setTimeout?function(e){setTimeout(e,4)}:function(e){e()};else o=function(){var e=d.MutationObserver||d.WebkitMutationObserver||d.WebKitMutationObserver,f=document.createElement("div"),n=void 0,o=new e(function(){var e=n;n=void 0,e()});return o.observe(f,{attributes:!0}),function(e){n=e,f.setAttribute("class","foo")}}();f.exports=o}).call(this,e("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./assert.js":146,"./global.js":160,"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139}],176:[function(e,f){"use strict";f.exports=function(f,n,o){function d(e,f,o){return n(e,i,o,f===!0&&e._isBound()?e._boundTo:void 0).promise()}var i=e("./settled_promise_array.js")(f,o);f.settle=function(e){return d(e,!1,f.settle)},f.prototype.settle=function(){return d(this,!0,this.settle)}}},{"./settled_promise_array.js":177}],177:[function(e,f){"use strict";f.exports=function(f,n){function o(e,f,n){this.constructor$(e,f,n)}var d=(e("./assert.js"),e("./promise_inspection.js")),i=e("./util.js"),t=i.inherits;return t(o,n),o.prototype._promiseResolved=function(e,f){this._values[e]=f;var n=++this._totalResolved;n>=this._length&&this._resolve(this._values)},o.prototype._promiseFulfilled=function(e,f){if(!this._isResolved()){var n=new d;n._bitField=268435456,n._settledValue=e,this._promiseResolved(f,n)}},o.prototype._promiseRejected=function(e,f){if(!this._isResolved()){var n=new d;n._bitField=134217728,n._settledValue=e,this._promiseResolved(f,n)}},o}},{"./assert.js":146,"./promise_inspection.js":166,"./util.js":183}],178:[function(e,f){"use strict";f.exports=function(f,n,o,d){function i(e,f,o,i){if((0|f)!==f||0>f)return d("expecting a positive integer");var l=n(e,t,i,o===!0&&e._isBound()?e._boundTo:void 0),u=l.promise();return u.isRejected()?u:(l.setHowMany(f),l.init(),u)}{var t=e("./some_promise_array.js")(o);e("./assert.js")}f.some=function(e,n){return i(e,n,!1,f.some)},f.prototype.some=function(e){return i(this,e,!0,this.some)}}},{"./assert.js":146,"./some_promise_array.js":179}],179:[function(e,f){"use strict";f.exports=function(f){function n(e,f,n){this.constructor$(e,f,n),this._howMany=0,this._unwrap=!1,this._initialized=!1}var o=e("./util.js"),d=e("./errors.js").RangeError,i=o.inherits,t=o.isArray;return i(n,f),n.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-2);var e=t(this._values);if(this._holes=e?this._values.length-this.length():0,!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()){var f="(Promise.some) input array contains less than "+this._howMany+" promises";this._reject(new d(f))}}},n.prototype.init=function(){this._initialized=!0,this._init()},n.prototype.setUnwrap=function(){this._unwrap=!0},n.prototype.howMany=function(){return this._howMany},n.prototype.setHowMany=function(e){this._isResolved()||(this._howMany=e)},n.prototype._promiseFulfilled=function(e){this._isResolved()||(this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),this._resolve(1===this.howMany()&&this._unwrap?this._values[0]:this._values)))},n.prototype._promiseRejected=function(e){this._isResolved()||(this._addRejected(e),this.howMany()>this._canPossiblyFulfill()&&this._reject(this._values.length===this.length()?[]:this._values.slice(this.length()+this._holes)))},n.prototype._fulfilled=function(){return this._totalResolved},n.prototype._rejected=function(){return this._values.length-this.length()-this._holes},n.prototype._addRejected=function(e){this._values.push(e)},n.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},n.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},n}},{"./errors.js":154,"./util.js":183}],180:[function(e,f){"use strict";f.exports=function(f){var n=e("./promise_inspection.js");f.prototype.inspect=function(){return new n(this)}}},{"./promise_inspection.js":166}],181:[function(e,f){"use strict";f.exports=function(f){function n(e){try{return e.then}catch(f){return t.e=f,t}}function o(e,i,u){if(l(e)){if(e instanceof f)return e;var p=n(e);if(p===t)return i="function"==typeof i?i:o,void 0!==u&&u._attachExtraTrace(p.e),f.reject(p.e,i);if("function"==typeof p)return i="function"==typeof i?i:o,d(e,p,i,u)}return e}function d(e,n,o,d){function i(n){if(!s){if(s=!0,e===n){var o=f._makeSelfResolutionError();return void 0!==d&&d._attachExtraTrace(o),void p.promise._reject(o)}p.resolve(n)}}function l(e){s||(s=!0,void 0!==d&&d._attachExtraTrace(e),p.promise._attachExtraTrace(e),p.promise._reject(e))}var p=f.defer(o),s=!1,c=u(n,e,i,l);return c!==t||s||(s=!0,void 0!==d&&d._attachExtraTrace(c.e),p.promise._reject(c.e)),p.promise}var i=(e("./assert.js"),e("./util.js")),t=i.errorObj,l=i.isObject,u=i.tryCatch2;f._cast=o}},{"./assert.js":146,"./util.js":183}],182:[function(e,f){"use strict";var n=e("./global.js"),o=function(e,f){for(var o=arguments.length,d=new Array(o-2),i=2;o>i;++i)d[i-2]=arguments[i];n.setTimeout(function(){e.apply(void 0,d)},f)},d={};n.setTimeout(function(e){e===d&&(o=n.setTimeout)},1,d),f.exports=function(f,n){var d=(e("./util.js"),e("./assert.js"),e("./errors.js")),i=e("./errors_api_rejection")(f),t=f.TimeoutError,l=function(e,f,n){if(e.isPending()){"string"!=typeof f&&(f="operation timed out after "+n+" ms");var o=new t(f);d.markAsOriginatingFromRejection(o),e._attachExtraTrace(o),e._rejectUnchecked(o)}},u=function(e,f){f._fulfill(e)};f.delay=function(e,d,t){if(void 0===d&&(d=e,e=void 0),(0|d)!==d||0>d)return i("expecting a positive integer");"function"!=typeof t&&(t=f.delay);var l=f._cast(e,t,void 0),p=new f(n);return f.is(l)?(l._isBound()&&p._setBoundTo(l._boundTo),l._cancellable()&&(p._setCancellable(),p._cancellationParent=l),p._setTrace(t,l),p._follow(l),p.then(function(e){return f.delay(e,d)})):(p._setTrace(t,void 0),o(u,d,e,p),p)},f.prototype.delay=function(e){return f.delay(this,e,this.delay)},f.prototype.timeout=function(e,d){if((0|e)!==e||0>e)return i("expecting a positive integer");var t=new f(n);return t._setTrace(this.timeout,this),this._isBound()&&t._setBoundTo(this._boundTo),this._cancellable()&&(t._setCancellable(),t._cancellationParent=this),t._follow(this),o(l,e,t,d,e),t}}},{"./assert.js":146,"./errors.js":154,"./errors_api_rejection":155,"./global.js":160,"./util.js":183}],183:[function(e,f){"use strict";function n(e){"undefined"!=typeof console&&null!==console&&"function"==typeof console.warn&&console.warn("Bluebird: "+e)}function o(e,f,n){try{return e.call(f,n)}catch(o){return m.e=o,m}}function d(e,f,n,o){try{return e.call(f,n,o)}catch(d){return m.e=d,m}}function i(e,f,n){try{return e.apply(n,f)}catch(o){return m.e=o,m}}function t(e){return"string"==typeof e?e:""+e}function l(e){return null==e||e===!0||e===!1||"string"==typeof e||"number"==typeof e}function u(e){return!l(e)}function p(e){return l(e)?new Error(t(e)):e}function s(e,f){var n,o=e.length,d=new Array(o+1);for(n=0;o>n;++n)d[n]=e[n];return d[n]=f,d}function c(e,f,n){var o={value:n,configurable:!0,enumerable:!1,writable:!0};return r.defineProperty(e,f,o),e}function y(e){throw e}var a=e("./global.js"),r=(e("./assert.js"),e("./es5.js")),w=function(){try{var e={};return r.defineProperty(e,"f",{get:function(){return 3}}),3===e.f}catch(f){return!1}}(),b=function(e,f,n){try{return c(e,f,n),e}catch(o){for(var d={},i=r.keys(e),t=0,l=i.length;l>t;++t)try{var u=i[t];d[u]=e[u]}catch(p){d[u]=p}return c(d,f,n),d}},g=function(){return"undefined"!=typeof window&&null!==window&&"undefined"!=typeof window.document&&"undefined"!=typeof navigator&&null!==navigator&&"string"==typeof navigator.appName&&window===a?!1:!0}(),m={e:{}},x=function(e,f){function n(){this.constructor=e,this.constructor$=f;for(var n in f.prototype)o.call(f.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=f.prototype[n])}var o={}.hasOwnProperty;return n.prototype=f.prototype,e.prototype=new n,e.prototype},P=function(){return"string"!==this}.call("string"),j={thrower:y,isArray:r.isArray,haveGetters:w,notEnumerableProp:c,isPrimitive:l,isObject:u,ensurePropertyExpansion:b,canEvaluate:g,deprecated:n,errorObj:m,tryCatch1:o,tryCatch2:d,tryCatchApply:i,inherits:x,withAppended:s,asString:t,maybeWrapAsError:p,wrapsPrimitiveReceiver:P};f.exports=j},{"./assert.js":146,"./es5.js":156,"./global.js":160}],184:[function(e,f,n){(function(){var e=this,o=e._,d={},i=Array.prototype,t=Object.prototype,l=Function.prototype,u=i.push,p=i.slice,s=i.concat,c=t.toString,y=t.hasOwnProperty,a=i.forEach,r=i.map,w=i.reduce,b=i.reduceRight,g=i.filter,m=i.every,x=i.some,P=i.indexOf,j=i.lastIndexOf,v=Array.isArray,M=Object.keys,X=l.bind,h=function(e){return e instanceof h?e:this instanceof h?void(this._wrapped=e):new h(e)};"undefined"!=typeof n?("undefined"!=typeof f&&f.exports&&(n=f.exports=h),n._=h):e._=h,h.VERSION="1.5.2";var k=h.each=h.forEach=function(e,f,n){if(null!=e)if(a&&e.forEach===a)e.forEach(f,n);else if(e.length===+e.length){for(var o=0,i=e.length;i>o;o++)if(f.call(n,e[o],o,e)===d)return}else for(var t=h.keys(e),o=0,i=t.length;i>o;o++)if(f.call(n,e[t[o]],t[o],e)===d)return};h.map=h.collect=function(e,f,n){var o=[];return null==e?o:r&&e.map===r?e.map(f,n):(k(e,function(e,d,i){o.push(f.call(n,e,d,i))}),o)};var q="Reduce of empty array with no initial value";h.reduce=h.foldl=h.inject=function(e,f,n,o){var d=arguments.length>2;if(null==e&&(e=[]),w&&e.reduce===w)return o&&(f=h.bind(f,o)),d?e.reduce(f,n):e.reduce(f);if(k(e,function(e,i,t){d?n=f.call(o,n,e,i,t):(n=e,d=!0)}),!d)throw new TypeError(q);return n},h.reduceRight=h.foldr=function(e,f,n,o){var d=arguments.length>2;if(null==e&&(e=[]),b&&e.reduceRight===b)return o&&(f=h.bind(f,o)),d?e.reduceRight(f,n):e.reduceRight(f);var i=e.length;if(i!==+i){var t=h.keys(e);i=t.length}if(k(e,function(l,u,p){u=t?t[--i]:--i,d?n=f.call(o,n,e[u],u,p):(n=e[u],d=!0)}),!d)throw new TypeError(q);return n},h.find=h.detect=function(e,f,n){var o;return z(e,function(e,d,i){return f.call(n,e,d,i)?(o=e,!0):void 0}),o},h.filter=h.select=function(e,f,n){var o=[];return null==e?o:g&&e.filter===g?e.filter(f,n):(k(e,function(e,d,i){f.call(n,e,d,i)&&o.push(e) | |
}),o)},h.reject=function(e,f,n){return h.filter(e,function(e,o,d){return!f.call(n,e,o,d)},n)},h.every=h.all=function(e,f,n){f||(f=h.identity);var o=!0;return null==e?o:m&&e.every===m?e.every(f,n):(k(e,function(e,i,t){return(o=o&&f.call(n,e,i,t))?void 0:d}),!!o)};var z=h.some=h.any=function(e,f,n){f||(f=h.identity);var o=!1;return null==e?o:x&&e.some===x?e.some(f,n):(k(e,function(e,i,t){return o||(o=f.call(n,e,i,t))?d:void 0}),!!o)};h.contains=h.include=function(e,f){return null==e?!1:P&&e.indexOf===P?-1!=e.indexOf(f):z(e,function(e){return e===f})},h.invoke=function(e,f){var n=p.call(arguments,2),o=h.isFunction(f);return h.map(e,function(e){return(o?f:e[f]).apply(e,n)})},h.pluck=function(e,f){return h.map(e,function(e){return e[f]})},h.where=function(e,f,n){return h.isEmpty(f)?n?void 0:[]:h[n?"find":"filter"](e,function(e){for(var n in f)if(f[n]!==e[n])return!1;return!0})},h.findWhere=function(e,f){return h.where(e,f,!0)},h.max=function(e,f,n){if(!f&&h.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!f&&h.isEmpty(e))return-1/0;var o={computed:-1/0,value:-1/0};return k(e,function(e,d,i){var t=f?f.call(n,e,d,i):e;t>o.computed&&(o={value:e,computed:t})}),o.value},h.min=function(e,f,n){if(!f&&h.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!f&&h.isEmpty(e))return 1/0;var o={computed:1/0,value:1/0};return k(e,function(e,d,i){var t=f?f.call(n,e,d,i):e;t<o.computed&&(o={value:e,computed:t})}),o.value},h.shuffle=function(e){var f,n=0,o=[];return k(e,function(e){f=h.random(n++),o[n-1]=o[f],o[f]=e}),o},h.sample=function(e,f,n){return arguments.length<2||n?e[h.random(e.length-1)]:h.shuffle(e).slice(0,Math.max(0,f))};var A=function(e){return h.isFunction(e)?e:function(f){return f[e]}};h.sortBy=function(e,f,n){var o=A(f);return h.pluck(h.map(e,function(e,f,d){return{value:e,index:f,criteria:o.call(n,e,f,d)}}).sort(function(e,f){var n=e.criteria,o=f.criteria;if(n!==o){if(n>o||void 0===n)return 1;if(o>n||void 0===o)return-1}return e.index-f.index}),"value")};var B=function(e){return function(f,n,o){var d={},i=null==n?h.identity:A(n);return k(f,function(n,t){var l=i.call(o,n,t,f);e(d,l,n)}),d}};h.groupBy=B(function(e,f,n){(h.has(e,f)?e[f]:e[f]=[]).push(n)}),h.indexBy=B(function(e,f,n){e[f]=n}),h.countBy=B(function(e,f){h.has(e,f)?e[f]++:e[f]=1}),h.sortedIndex=function(e,f,n,o){n=null==n?h.identity:A(n);for(var d=n.call(o,f),i=0,t=e.length;t>i;){var l=i+t>>>1;n.call(o,e[l])<d?i=l+1:t=l}return i},h.toArray=function(e){return e?h.isArray(e)?p.call(e):e.length===+e.length?h.map(e,h.identity):h.values(e):[]},h.size=function(e){return null==e?0:e.length===+e.length?e.length:h.keys(e).length},h.first=h.head=h.take=function(e,f,n){return null==e?void 0:null==f||n?e[0]:p.call(e,0,f)},h.initial=function(e,f,n){return p.call(e,0,e.length-(null==f||n?1:f))},h.last=function(e,f,n){return null==e?void 0:null==f||n?e[e.length-1]:p.call(e,Math.max(e.length-f,0))},h.rest=h.tail=h.drop=function(e,f,n){return p.call(e,null==f||n?1:f)},h.compact=function(e){return h.filter(e,h.identity)};var C=function(e,f,n){return f&&h.every(e,h.isArray)?s.apply(n,e):(k(e,function(e){h.isArray(e)||h.isArguments(e)?f?u.apply(n,e):C(e,f,n):n.push(e)}),n)};h.flatten=function(e,f){return C(e,f,[])},h.without=function(e){return h.difference(e,p.call(arguments,1))},h.uniq=h.unique=function(e,f,n,o){h.isFunction(f)&&(o=n,n=f,f=!1);var d=n?h.map(e,n,o):e,i=[],t=[];return k(d,function(n,o){(f?o&&t[t.length-1]===n:h.contains(t,n))||(t.push(n),i.push(e[o]))}),i},h.union=function(){return h.uniq(h.flatten(arguments,!0))},h.intersection=function(e){var f=p.call(arguments,1);return h.filter(h.uniq(e),function(e){return h.every(f,function(f){return h.indexOf(f,e)>=0})})},h.difference=function(e){var f=s.apply(i,p.call(arguments,1));return h.filter(e,function(e){return!h.contains(f,e)})},h.zip=function(){for(var e=h.max(h.pluck(arguments,"length").concat(0)),f=new Array(e),n=0;e>n;n++)f[n]=h.pluck(arguments,""+n);return f},h.object=function(e,f){if(null==e)return{};for(var n={},o=0,d=e.length;d>o;o++)f?n[e[o]]=f[o]:n[e[o][0]]=e[o][1];return n},h.indexOf=function(e,f,n){if(null==e)return-1;var o=0,d=e.length;if(n){if("number"!=typeof n)return o=h.sortedIndex(e,f),e[o]===f?o:-1;o=0>n?Math.max(0,d+n):n}if(P&&e.indexOf===P)return e.indexOf(f,n);for(;d>o;o++)if(e[o]===f)return o;return-1},h.lastIndexOf=function(e,f,n){if(null==e)return-1;var o=null!=n;if(j&&e.lastIndexOf===j)return o?e.lastIndexOf(f,n):e.lastIndexOf(f);for(var d=o?n:e.length;d--;)if(e[d]===f)return d;return-1},h.range=function(e,f,n){arguments.length<=1&&(f=e||0,e=0),n=arguments[2]||1;for(var o=Math.max(Math.ceil((f-e)/n),0),d=0,i=new Array(o);o>d;)i[d++]=e,e+=n;return i};var D=function(){};h.bind=function(e,f){var n,o;if(X&&e.bind===X)return X.apply(e,p.call(arguments,1));if(!h.isFunction(e))throw new TypeError;return n=p.call(arguments,2),o=function(){if(!(this instanceof o))return e.apply(f,n.concat(p.call(arguments)));D.prototype=e.prototype;var d=new D;D.prototype=null;var i=e.apply(d,n.concat(p.call(arguments)));return Object(i)===i?i:d}},h.partial=function(e){var f=p.call(arguments,1);return function(){return e.apply(this,f.concat(p.call(arguments)))}},h.bindAll=function(e){var f=p.call(arguments,1);if(0===f.length)throw new Error("bindAll must be passed function names");return k(f,function(f){e[f]=h.bind(e[f],e)}),e},h.memoize=function(e,f){var n={};return f||(f=h.identity),function(){var o=f.apply(this,arguments);return h.has(n,o)?n[o]:n[o]=e.apply(this,arguments)}},h.delay=function(e,f){var n=p.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},f)},h.defer=function(e){return h.delay.apply(h,[e,1].concat(p.call(arguments,1)))},h.throttle=function(e,f,n){var o,d,i,t=null,l=0;n||(n={});var u=function(){l=n.leading===!1?0:new Date,t=null,i=e.apply(o,d)};return function(){var p=new Date;l||n.leading!==!1||(l=p);var s=f-(p-l);return o=this,d=arguments,0>=s?(clearTimeout(t),t=null,l=p,i=e.apply(o,d)):t||n.trailing===!1||(t=setTimeout(u,s)),i}},h.debounce=function(e,f,n){var o,d,i,t,l;return function(){i=this,d=arguments,t=new Date;var u=function(){var p=new Date-t;f>p?o=setTimeout(u,f-p):(o=null,n||(l=e.apply(i,d)))},p=n&&!o;return o||(o=setTimeout(u,f)),p&&(l=e.apply(i,d)),l}},h.once=function(e){var f,n=!1;return function(){return n?f:(n=!0,f=e.apply(this,arguments),e=null,f)}},h.wrap=function(e,f){return function(){var n=[e];return u.apply(n,arguments),f.apply(this,n)}},h.compose=function(){var e=arguments;return function(){for(var f=arguments,n=e.length-1;n>=0;n--)f=[e[n].apply(this,f)];return f[0]}},h.after=function(e,f){return function(){return--e<1?f.apply(this,arguments):void 0}},h.keys=M||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var f=[];for(var n in e)h.has(e,n)&&f.push(n);return f},h.values=function(e){for(var f=h.keys(e),n=f.length,o=new Array(n),d=0;n>d;d++)o[d]=e[f[d]];return o},h.pairs=function(e){for(var f=h.keys(e),n=f.length,o=new Array(n),d=0;n>d;d++)o[d]=[f[d],e[f[d]]];return o},h.invert=function(e){for(var f={},n=h.keys(e),o=0,d=n.length;d>o;o++)f[e[n[o]]]=n[o];return f},h.functions=h.methods=function(e){var f=[];for(var n in e)h.isFunction(e[n])&&f.push(n);return f.sort()},h.extend=function(e){return k(p.call(arguments,1),function(f){if(f)for(var n in f)e[n]=f[n]}),e},h.pick=function(e){var f={},n=s.apply(i,p.call(arguments,1));return k(n,function(n){n in e&&(f[n]=e[n])}),f},h.omit=function(e){var f={},n=s.apply(i,p.call(arguments,1));for(var o in e)h.contains(n,o)||(f[o]=e[o]);return f},h.defaults=function(e){return k(p.call(arguments,1),function(f){if(f)for(var n in f)void 0===e[n]&&(e[n]=f[n])}),e},h.clone=function(e){return h.isObject(e)?h.isArray(e)?e.slice():h.extend({},e):e},h.tap=function(e,f){return f(e),e};var E=function(e,f,n,o){if(e===f)return 0!==e||1/e==1/f;if(null==e||null==f)return e===f;e instanceof h&&(e=e._wrapped),f instanceof h&&(f=f._wrapped);var d=c.call(e);if(d!=c.call(f))return!1;switch(d){case"[object String]":return e==String(f);case"[object Number]":return e!=+e?f!=+f:0==e?1/e==1/f:e==+f;case"[object Date]":case"[object Boolean]":return+e==+f;case"[object RegExp]":return e.source==f.source&&e.global==f.global&&e.multiline==f.multiline&&e.ignoreCase==f.ignoreCase}if("object"!=typeof e||"object"!=typeof f)return!1;for(var i=n.length;i--;)if(n[i]==e)return o[i]==f;var t=e.constructor,l=f.constructor;if(t!==l&&!(h.isFunction(t)&&t instanceof t&&h.isFunction(l)&&l instanceof l))return!1;n.push(e),o.push(f);var u=0,p=!0;if("[object Array]"==d){if(u=e.length,p=u==f.length)for(;u--&&(p=E(e[u],f[u],n,o)););}else{for(var s in e)if(h.has(e,s)&&(u++,!(p=h.has(f,s)&&E(e[s],f[s],n,o))))break;if(p){for(s in f)if(h.has(f,s)&&!u--)break;p=!u}}return n.pop(),o.pop(),p};h.isEqual=function(e,f){return E(e,f,[],[])},h.isEmpty=function(e){if(null==e)return!0;if(h.isArray(e)||h.isString(e))return 0===e.length;for(var f in e)if(h.has(e,f))return!1;return!0},h.isElement=function(e){return!(!e||1!==e.nodeType)},h.isArray=v||function(e){return"[object Array]"==c.call(e)},h.isObject=function(e){return e===Object(e)},k(["Arguments","Function","String","Number","Date","RegExp"],function(e){h["is"+e]=function(f){return c.call(f)=="[object "+e+"]"}}),h.isArguments(arguments)||(h.isArguments=function(e){return!(!e||!h.has(e,"callee"))}),"function"!=typeof/./&&(h.isFunction=function(e){return"function"==typeof e}),h.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},h.isNaN=function(e){return h.isNumber(e)&&e!=+e},h.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==c.call(e)},h.isNull=function(e){return null===e},h.isUndefined=function(e){return void 0===e},h.has=function(e,f){return y.call(e,f)},h.noConflict=function(){return e._=o,this},h.identity=function(e){return e},h.times=function(e,f,n){for(var o=Array(Math.max(0,e)),d=0;e>d;d++)o[d]=f.call(n,d);return o},h.random=function(e,f){return null==f&&(f=e,e=0),e+Math.floor(Math.random()*(f-e+1))};var F={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};F.unescape=h.invert(F.escape);var G={escape:new RegExp("["+h.keys(F.escape).join("")+"]","g"),unescape:new RegExp("("+h.keys(F.unescape).join("|")+")","g")};h.each(["escape","unescape"],function(e){h[e]=function(f){return null==f?"":(""+f).replace(G[e],function(f){return F[e][f]})}}),h.result=function(e,f){if(null==e)return void 0;var n=e[f];return h.isFunction(n)?n.call(e):n},h.mixin=function(e){k(h.functions(e),function(f){var n=h[f]=e[f];h.prototype[f]=function(){var e=[this._wrapped];return u.apply(e,arguments),L.call(this,n.apply(h,e))}})};var H=0;h.uniqueId=function(e){var f=++H+"";return e?e+f:f},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var I=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},K=/\\|'|\r|\n|\t|\u2028|\u2029/g;h.template=function(e,f,n){var o;n=h.defaults({},n,h.templateSettings);var d=new RegExp([(n.escape||I).source,(n.interpolate||I).source,(n.evaluate||I).source].join("|")+"|$","g"),i=0,t="__p+='";e.replace(d,function(f,n,o,d,l){return t+=e.slice(i,l).replace(K,function(e){return"\\"+J[e]}),n&&(t+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),o&&(t+="'+\n((__t=("+o+"))==null?'':__t)+\n'"),d&&(t+="';\n"+d+"\n__p+='"),i=l+f.length,f}),t+="';\n",n.variable||(t="with(obj||{}){\n"+t+"}\n"),t="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+t+"return __p;\n";try{o=new Function(n.variable||"obj","_",t)}catch(l){throw l.source=t,l}if(f)return o(f,h);var u=function(e){return o.call(this,e,h)};return u.source="function("+(n.variable||"obj")+"){\n"+t+"}",u},h.chain=function(e){return h(e).chain()};var L=function(e){return this._chain?h(e).chain():e};h.mixin(h),k(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var f=i[e];h.prototype[e]=function(){var n=this._wrapped;return f.apply(n,arguments),"shift"!=e&&"splice"!=e||0!==n.length||delete n[0],L.call(this,n)}}),k(["concat","join","slice"],function(e){var f=i[e];h.prototype[e]=function(){return L.call(this,f.apply(this._wrapped,arguments))}}),h.extend(h.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],185:[function(e,f){f.exports=e("./lib/sessionManager")},{"./lib/sessionManager":188}],186:[function(e,f){function n(e){var f=e.split("-");return"on"+f[0][0].toUpperCase()+f[0].substr(1)+f[1][0].toUpperCase()+f[1].substr(1)}function o(e){var f=this;this.sid=e.sid||Date.now().toString(),this.peer=e.peer,this.isInitiator=e.initiator||!1,this.state="starting",this.parent=e.parent,this.processingQueue=i.queue(function(e,n){var o=e.action,d=e.changes,i=e.cb;l(f.sid+": "+o),f[o](d,function(e){i(e),n()})})}var d=e("bows"),i=e("async"),t=e("wildemitter"),l=d("JingleSession");o.prototype=Object.create(t.prototype,{constructor:{value:o}}),o.prototype.process=function(e,f,o){var d=n(e);this.processingQueue.push({action:d,changes:f,cb:o})},o.prototype.send=function(e,f){f=f||{},f.sid=this.sid,f.action=e,this.parent.emit("send",{to:this.peer,type:"set",jingle:f})},Object.defineProperty(o.prototype,"state",{get:function(){return this._state},set:function(e){var f={starting:!0,pending:!0,active:!0,ended:!0};if(!f[e])throw new Error("Invalid Jingle Session State: "+e);this._state!==e&&(this._state=e,l(this.sid+": State changed to "+e))}}),Object.defineProperty(o.prototype,"starting",{get:function(){return"starting"==this._state}}),Object.defineProperty(o.prototype,"pending",{get:function(){return"pending"==this._state}}),Object.defineProperty(o.prototype,"active",{get:function(){return"active"==this._state}}),Object.defineProperty(o.prototype,"ended",{get:function(){return"ended"==this._state}}),o.prototype.start=function(){this.state="pending",l(this.sid+": Can not start generic session")},o.prototype.end=function(e,f){this.parent.peers[this.peer].splice(this.parent.peers[this.peer].indexOf(this),1),delete this.parent.sessions[this.sid],this.state="ended",e=e||{},f||this.send("session-terminate",{reason:e}),this.parent.emit("terminated",this,e)};var u=["content-accept","content-add","content-modify","content-reject","content-remove","description-info","session-accept","session-info","session-initiate","session-terminate","transport-accept","transport-info","transport-reject","transport-replace"];u.forEach(function(e){var f=n(e);o.prototype[f]=function(f,n){l(this.sid+": Unsupported action "+e),n()}}),f.exports=o},{async:189,bows:190,wildemitter:229}],187:[function(e,f){function n(e){t.call(this,e);var f=this,n=this.parent.config.peerConnectionConfig,o=this.parent.config.peerConnectionConstraints;n.useJingle=!0,this.pc=new l(n,o),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.parent.localStream?(this.pc.addStream(this.parent.localStream),this.localStream=this.parent.localStream):this.parent.once("localStream",function(e){f.pc.addStream(e),this.localStream=e})}var o=e("underscore"),d=e("util"),i=e("bows"),t=e("./genericSession"),l=e("rtcpeerconnection"),u=i("JingleMedia");d.inherits(n,t),Object.defineProperty(n.prototype,"streams",{get:function(){return this.pc.remoteStreams}}),n.prototype=o.extend(n.prototype,{start:function(){var e=this;this.state="pending",this.pc.isInitiator=!0,this.pc.offer(function(f,n){e.send("session-initiate",n.jingle)})},end:function(e){var f=this;this.pc.close(),o.each(this.streams,function(e){f.onStreamRemoved({stream:e})}),t.prototype.end.call(this,e)},accept:function(){var e=this;u(this.sid+": Accepted incoming session"),this.state="active",this.pc.answer(function(f,n){return f?u(e.sid+": Could not create WebRTC answer",f):void e.send("session-accept",n.jingle)})},ring:function(){u(this.sid+": Ringing on incoming session"),this.send("session-info",{ringing:!0})},mute:function(e,f){u(this.sid+": Muting"),this.send("session-info",{mute:{creator:e,name:f}})},unmute:function(e,f){u(this.sid+": Unmuting"),this.send("session-info",{unmute:{creator:e,name:f}})},hold:function(){u(this.sid+": Placing on hold"),this.send("session-info",{hold:!0})},resume:function(){u(this.sid+": Resuing from hold"),this.send("session-info",{active:!0})},onSessionInitiate:function(e,f){var n=this;u(n.sid+": Initiating incoming session"),this.state="pending",this.pc.isInitiator=!1,this.pc.handleOffer({type:"offer",jingle:e},function(e){return e?(u(n.sid+": Could not create WebRTC answer",e),f({condition:"general-error"})):void f()})},onSessionAccept:function(e,f){var n=this;u(this.sid+": Activating accepted outbound session"),this.state="active",this.pc.handleAnswer({type:"answer",jingle:e},function(e){return e?(u(n.sid+": Could not process WebRTC answer",e),f({condition:"general-error"})):(n.parent.emit("accepted",n),void f())})},onSessionTerminate:function(e,f){var n=this;u(this.sid+": Terminating session"),this.pc.close(),o.each(this.streams,function(e){n.onStreamRemoved({stream:e})}),t.prototype.end.call(this,e.reason,!0),f()},onTransportInfo:function(e,f){var n=this;u(this.sid+": Adding ICE candidate"),this.pc.processIce(e,function(e){e&&u(n.sid+": Could not process ICE candidate",e),f()})},onSessionInfo:function(e,f){u(e),e.ringing&&(u(this.sid+": Ringing on remote stream"),this.parent.emit("ringing",this)),e.hold&&(u(this.sid+": On hold"),this.parent.emit("hold",this)),e.active&&(u(this.sid+": Resumed from hold"),this.parent.emit("resumed",this)),e.mute&&(u(this.sid+": Muted",e.mute),this.parent.emit("mute",this,e.mute)),e.unmute&&(u(this.sid+": Unmuted",e.unmute),this.parent.emit("unmute",this,e.unmute)),f()},onIceCandidate:function(e){u(this.sid+": Discovered new ICE candidate",e.jingle),this.send("transport-info",e.jingle)},onStreamAdded:function(e){var f=this;u(this.sid+": Remote media stream added"),e.stream.onended=function(){f.onStreamRemoved({stream:e.stream})},this.parent.emit("peerStreamAdded",this,e.stream)},onStreamRemoved:function(e){u(this.sid+": Remote media stream removed"),this.parent.emit("peerStreamRemoved",this,e.stream)}}),f.exports=n},{"./genericSession":186,bows:190,rtcpeerconnection:198,underscore:228,util:141}],188:[function(e,f){function n(e){e=e||{};var f=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=c,this.jid=e.jid,this.sessions={},this.peers={},this.screenSharingSupport=t.screenSharing;for(var n in e)f[n]=e[n];this.capabilities=["urn:xmpp:jingle:1"],t.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:rtp:rtp-hdrext:0","urn:xmpp:jingle:apps:rtp:ssma:0","urn:xmpp:jingle:apps:dtls:0","urn:xmpp:jingle:apps:grouping:0","urn:xmpp:jingle:transports:ice-udp:1","urn:ietf:rfc:3264","urn:ietf:rfc:5576","urn:ietf:rfc:5888"]:y("WebRTC not supported"),u.call(this),this.config.debug&&this.on("*",function(e,f,n){y(e,f,n)})}var o=e("underscore"),d=e("bows"),i=e("hark"),t=e("webrtcsupport"),l=(e("mockconsole"),e("getusermedia")),u=e("wildemitter"),p=e("mediastream-gain"),s=e("./genericSession"),c=e("./mediaSession"),y=d("Jingle");n.prototype=Object.create(u.prototype,{constructor:{value:n}}),n.prototype.addICEServer=function(e){this.config.peerConnectionConfig.iceServers.push(e)},n.prototype.startLocalMedia=function(e,f){var n=this,o=e||{video:!0,audio:!0};l(o,function(e,d){e?y("Could not start local media"):(o.audio&&n.config.detectSpeakingEvents&&n.setupAudioMonitor(d),n.localStream=d,n.config.autoAdjustMic&&(n.gainController=new p(d),n.setMicIfEnabled(.5)),y("Local media stream started"),n.emit("localStream",d)),f&&f(e,d)})},n.prototype.stopLocalMedia=function(){this.localStream&&(this.localStream.stop(),this.emit("localStreamStopped"))},n.prototype.setupAudioMonitor=function(e){y("Setup audio");var f,n=i(e),o=this;n.on("speaking",function(){o.hardMuted||(o.setMicIfEnabled(1),o.emit("speaking"))}),n.on("stopped_speaking",function(){o.hardMuted||(f&&clearTimeout(f),f=setTimeout(function(){o.setMicIfEnabled(.5),o.emit("stoppedSpeaking")},1e3))})},n.prototype.setMicIfEnabled=function(e){this.config.autoAdjustMic&&this.gainController.setGain(e)},n.prototype.sendError=function(e,f,n){n.type="cancel",this.emit("send",{to:e,id:f,type:"error",error:n})},n.prototype.process=function(e){var f=this;if("error"===e.type)return this.emit("error",e);if("result"!==e.type){var n,d,i,t=e.jingle.sid,l=e.jingle.action,u=e.jingle.contents||[],p=o.map(u,function(e){return(e.description||{}).descType}),a=this.sessions[t]||null,r=e.from.full||e.from,w=e.id;if("session-initiate"!==l){if(!a)return y("Unknown session",t),this.sendError(r,w,{condition:"item-not-found",jingleCondition:"unknown-session"});if(a.peer!==r||a.ended)return y("Session has ended, or action has wrong sender"),this.sendError(r,w,{condition:"item-not-found",jingleCondition:"unknown-session"});if("session-accept"===l&&!a.pending)return y("Tried to accept session twice",t),this.sendError(r,w,{condition:"unexpected-request",jingleCondition:"out-of-order"});if("session-terminate"!==l&&a.pendingAction&&(y("Tie break during pending request"),a.isInitiator))return this.sendError(r,w,{condition:"conflict",jingleCondition:"tie-break"})}else{if(a)return a.peer!==r?(y("Duplicate sid from new sender"),this.sendError(r,w,{condition:"service-unavailable"})):a.pending&&this.jid>a.peer?(y("Tie break new session because of duplicate sids"),this.sendError(r,w,{condition:"conflict",jingleCondition:"tie-break"})):(y("Someone is doing this wrong"),this.sendError(r,w,{condition:"unexpected-request",jingleCondition:"out-of-order"}));if(Object.keys(this.peers[r]||{}).length){n=Object.keys(this.peers[r]);for(var b=0;b<n.length;b++)if(d=n[b],i=this.sessions[d],i&&i.pending&&o.intersection(p,i.contentTypes).length&&d>t)return y("Tie break"),this.sendError(r,w,{condition:"conflict",jingleCondition:"tie-break"})}}if("session-initiate"===l){var g={sid:t,peer:r,initiator:!1,parent:this};a=p.indexOf("rtp")>=0?new c(g):new s(g),this.sessions[t]=a,this.peers[r]||(this.peers[r]=[]),this.peers[r].push(a)}a.process(l,e.jingle,function(n){n?(y("Could not process request",e,n),f.sendError(r,w,n)):(f.emit("send",{to:r,id:w,type:"result",action:l}),"session-initiate"===l&&(y("Incoming session request from ",r,a),f.emit("incoming",a)))})}},n.prototype.createMediaSession=function(e,f){var n=new c({sid:f,peer:e,initiator:!0,parent:this});return f=n.sid,this.sessions[f]=n,this.peers[e]||(this.peers[e]=[]),this.peers[e].push(n),y("Outgoing session",n.sid,n),this.emit("outgoing",n),n},n.prototype.endPeerSessions=function(e){y("Ending all sessions with",e);var f=this.peers[e]||[];f.forEach(function(e){e.end()})},f.exports=n},{"./genericSession":186,"./mediaSession":187,bows:190,getusermedia:192,hark:193,"mediastream-gain":195,mockconsole:196,underscore:228,webrtcsupport:203,wildemitter:229}],189:[function(f,n){(function(f){!function(){function o(e){var f=!1;return function(){if(f)throw new Error("Callback was already called.");f=!0,e.apply(d,arguments)}}var d,i,t={};d=this,null!=d&&(i=d.async),t.noConflict=function(){return d.async=i,t};var l=function(e,f){if(e.forEach)return e.forEach(f);for(var n=0;n<e.length;n+=1)f(e[n],n,e)},u=function(e,f){if(e.map)return e.map(f);var n=[];return l(e,function(e,o,d){n.push(f(e,o,d))}),n},p=function(e,f,n){return e.reduce?e.reduce(f,n):(l(e,function(e,o,d){n=f(n,e,o,d)}),n)},s=function(e){if(Object.keys)return Object.keys(e);var f=[];for(var n in e)e.hasOwnProperty(n)&&f.push(n);return f};"undefined"!=typeof f&&f.nextTick?(t.nextTick=f.nextTick,t.setImmediate="undefined"!=typeof setImmediate?function(e){setImmediate(e)}:t.nextTick):"function"==typeof setImmediate?(t.nextTick=function(e){setImmediate(e)},t.setImmediate=t.nextTick):(t.nextTick=function(e){setTimeout(e,0)},t.setImmediate=t.nextTick),t.each=function(e,f,n){if(n=n||function(){},!e.length)return n();var d=0;l(e,function(i){f(i,o(function(f){f?(n(f),n=function(){}):(d+=1,d>=e.length&&n(null))}))})},t.forEach=t.each,t.eachSeries=function(e,f,n){if(n=n||function(){},!e.length)return n();var o=0,d=function(){f(e[o],function(f){f?(n(f),n=function(){}):(o+=1,o>=e.length?n(null):d())})};d()},t.forEachSeries=t.eachSeries,t.eachLimit=function(e,f,n,o){var d=c(f);d.apply(null,[e,n,o])},t.forEachLimit=t.eachLimit;var c=function(e){return function(f,n,o){if(o=o||function(){},!f.length||0>=e)return o();var d=0,i=0,t=0;!function l(){if(d>=f.length)return o();for(;e>t&&i<f.length;)i+=1,t+=1,n(f[i-1],function(e){e?(o(e),o=function(){}):(d+=1,t-=1,d>=f.length?o():l())})}()}},y=function(e){return function(){var f=Array.prototype.slice.call(arguments);return e.apply(null,[t.each].concat(f))}},a=function(e,f){return function(){var n=Array.prototype.slice.call(arguments);return f.apply(null,[c(e)].concat(n))}},r=function(e){return function(){var f=Array.prototype.slice.call(arguments);return e.apply(null,[t.eachSeries].concat(f))}},w=function(e,f,n,o){var d=[];f=u(f,function(e,f){return{index:f,value:e}}),e(f,function(e,f){n(e.value,function(n,o){d[e.index]=o,f(n)})},function(e){o(e,d)})};t.map=y(w),t.mapSeries=r(w),t.mapLimit=function(e,f,n,o){return b(f)(e,n,o)};var b=function(e){return a(e,w)};t.reduce=function(e,f,n,o){t.eachSeries(e,function(e,o){n(f,e,function(e,n){f=n,o(e)})},function(e){o(e,f)})},t.inject=t.reduce,t.foldl=t.reduce,t.reduceRight=function(e,f,n,o){var d=u(e,function(e){return e}).reverse();t.reduce(d,f,n,o)},t.foldr=t.reduceRight;var g=function(e,f,n,o){var d=[];f=u(f,function(e,f){return{index:f,value:e}}),e(f,function(e,f){n(e.value,function(n){n&&d.push(e),f()})},function(){o(u(d.sort(function(e,f){return e.index-f.index}),function(e){return e.value}))})};t.filter=y(g),t.filterSeries=r(g),t.select=t.filter,t.selectSeries=t.filterSeries;var m=function(e,f,n,o){var d=[];f=u(f,function(e,f){return{index:f,value:e}}),e(f,function(e,f){n(e.value,function(n){n||d.push(e),f()})},function(){o(u(d.sort(function(e,f){return e.index-f.index}),function(e){return e.value}))})};t.reject=y(m),t.rejectSeries=r(m);var x=function(e,f,n,o){e(f,function(e,f){n(e,function(n){n?(o(e),o=function(){}):f()})},function(){o()})};t.detect=y(x),t.detectSeries=r(x),t.some=function(e,f,n){t.each(e,function(e,o){f(e,function(e){e&&(n(!0),n=function(){}),o()})},function(){n(!1)})},t.any=t.some,t.every=function(e,f,n){t.each(e,function(e,o){f(e,function(e){e||(n(!1),n=function(){}),o()})},function(){n(!0)})},t.all=t.every,t.sortBy=function(e,f,n){t.map(e,function(e,n){f(e,function(f,o){f?n(f):n(null,{value:e,criteria:o})})},function(e,f){if(e)return n(e);var o=function(e,f){var n=e.criteria,o=f.criteria;return o>n?-1:n>o?1:0};n(null,u(f.sort(o),function(e){return e.value}))})},t.auto=function(e,f){f=f||function(){};var n=s(e);if(!n.length)return f(null);var o={},d=[],i=function(e){d.unshift(e)},u=function(e){for(var f=0;f<d.length;f+=1)if(d[f]===e)return void d.splice(f,1)},c=function(){l(d.slice(0),function(e){e()})};i(function(){s(o).length===n.length&&(f(null,o),f=function(){})}),l(n,function(n){var d=e[n]instanceof Function?[e[n]]:e[n],y=function(e){var d=Array.prototype.slice.call(arguments,1);if(d.length<=1&&(d=d[0]),e){var i={};l(s(o),function(e){i[e]=o[e]}),i[n]=d,f(e,i),f=function(){}}else o[n]=d,t.setImmediate(c)},a=d.slice(0,Math.abs(d.length-1))||[],r=function(){return p(a,function(e,f){return e&&o.hasOwnProperty(f)},!0)&&!o.hasOwnProperty(n)};if(r())d[d.length-1](y,o);else{var w=function(){r()&&(u(w),d[d.length-1](y,o))};i(w)}})},t.waterfall=function(e,f){if(f=f||function(){},e.constructor!==Array){var n=new Error("First argument to waterfall must be an array of functions");return f(n)}if(!e.length)return f();var o=function(e){return function(n){if(n)f.apply(null,arguments),f=function(){};else{var d=Array.prototype.slice.call(arguments,1),i=e.next();d.push(i?o(i):f),t.setImmediate(function(){e.apply(null,d)})}}};o(t.iterator(e))()};var P=function(e,f,n){if(n=n||function(){},f.constructor===Array)e.map(f,function(e,f){e&&e(function(e){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),f.call(null,e,n)})},n);else{var o={};e.each(s(f),function(e,n){f[e](function(f){var d=Array.prototype.slice.call(arguments,1);d.length<=1&&(d=d[0]),o[e]=d,n(f)})},function(e){n(e,o)})}};t.parallel=function(e,f){P({map:t.map,each:t.each},e,f)},t.parallelLimit=function(e,f,n){P({map:b(f),each:c(f)},e,n)},t.series=function(e,f){if(f=f||function(){},e.constructor===Array)t.mapSeries(e,function(e,f){e&&e(function(e){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),f.call(null,e,n)})},f);else{var n={};t.eachSeries(s(e),function(f,o){e[f](function(e){var d=Array.prototype.slice.call(arguments,1);d.length<=1&&(d=d[0]),n[f]=d,o(e)})},function(e){f(e,n)})}},t.iterator=function(e){var f=function(n){var o=function(){return e.length&&e[n].apply(null,arguments),o.next()};return o.next=function(){return n<e.length-1?f(n+1):null},o};return f(0)},t.apply=function(e){var f=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,f.concat(Array.prototype.slice.call(arguments)))}};var j=function(e,f,n,o){var d=[];e(f,function(e,f){n(e,function(e,n){d=d.concat(n||[]),f(e)})},function(e){o(e,d)})};t.concat=y(j),t.concatSeries=r(j),t.whilst=function(e,f,n){e()?f(function(o){return o?n(o):void t.whilst(e,f,n)}):n()},t.doWhilst=function(e,f,n){e(function(o){return o?n(o):void(f()?t.doWhilst(e,f,n):n())})},t.until=function(e,f,n){e()?n():f(function(o){return o?n(o):void t.until(e,f,n)})},t.doUntil=function(e,f,n){e(function(o){return o?n(o):void(f()?n():t.doUntil(e,f,n))})},t.queue=function(e,f){function n(e,n,o,d){n.constructor!==Array&&(n=[n]),l(n,function(n){var i={data:n,callback:"function"==typeof d?d:null};o?e.tasks.unshift(i):e.tasks.push(i),e.saturated&&e.tasks.length===f&&e.saturated(),t.setImmediate(e.process)})}void 0===f&&(f=1);var d=0,i={tasks:[],concurrency:f,saturated:null,empty:null,drain:null,push:function(e,f){n(i,e,!1,f)},unshift:function(e,f){n(i,e,!0,f)},process:function(){if(d<i.concurrency&&i.tasks.length){var f=i.tasks.shift();i.empty&&0===i.tasks.length&&i.empty(),d+=1;var n=function(){d-=1,f.callback&&f.callback.apply(f,arguments),i.drain&&i.tasks.length+d===0&&i.drain(),i.process()},t=o(n);e(f.data,t)}},length:function(){return i.tasks.length},running:function(){return d}};return i},t.cargo=function(e,f){var n=!1,o=[],d={tasks:o,payload:f,saturated:null,empty:null,drain:null,push:function(e,n){e.constructor!==Array&&(e=[e]),l(e,function(e){o.push({data:e,callback:"function"==typeof n?n:null}),d.saturated&&o.length===f&&d.saturated()}),t.setImmediate(d.process)},process:function i(){if(!n){if(0===o.length)return void(d.drain&&d.drain());var t="number"==typeof f?o.splice(0,f):o.splice(0),p=u(t,function(e){return e.data});d.empty&&d.empty(),n=!0,e(p,function(){n=!1;var e=arguments;l(t,function(f){f.callback&&f.callback.apply(null,e)}),i()})}},length:function(){return o.length},running:function(){return n}};return d};var v=function(e){return function(f){var n=Array.prototype.slice.call(arguments,1);f.apply(null,n.concat([function(f){var n=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(f?console.error&&console.error(f):console[e]&&l(n,function(f){console[e](f)}))}]))}};t.log=v("log"),t.dir=v("dir"),t.memoize=function(e,f){var n={},o={};f=f||function(e){return e};var d=function(){var d=Array.prototype.slice.call(arguments),i=d.pop(),t=f.apply(null,d);t in n?i.apply(null,n[t]):t in o?o[t].push(i):(o[t]=[i],e.apply(null,d.concat([function(){n[t]=arguments;var e=o[t];delete o[t];for(var f=0,d=e.length;d>f;f++)e[f].apply(null,arguments)}])))};return d.memo=n,d.unmemoized=e,d},t.unmemoize=function(e){return function(){return(e.unmemoized||e).apply(null,arguments) | |
}},t.times=function(e,f,n){for(var o=[],d=0;e>d;d++)o.push(d);return t.map(o,f,n)},t.timesSeries=function(e,f,n){for(var o=[],d=0;e>d;d++)o.push(d);return t.mapSeries(o,f,n)},t.compose=function(){var e=Array.prototype.reverse.call(arguments);return function(){var f=this,n=Array.prototype.slice.call(arguments),o=n.pop();t.reduce(e,n,function(e,n,o){n.apply(f,e.concat([function(){var e=arguments[0],f=Array.prototype.slice.call(arguments,1);o(e,f)}]))},function(e,n){o.apply(f,[e].concat(n))})}};var M=function(e,f){var n=function(){var n=this,o=Array.prototype.slice.call(arguments),d=o.pop();return e(f,function(e,f){e.apply(n,o.concat([f]))},d)};if(arguments.length>2){var o=Array.prototype.slice.call(arguments,2);return n.apply(this,o)}return n};t.applyEach=y(M),t.applyEachSeries=r(M),t.forever=function(e,f){function n(o){if(o){if(f)return f(o);throw o}e(n)}n()},"undefined"!=typeof e&&e.amd?e([],function(){return t}):"undefined"!=typeof n&&n.exports?n.exports=t:d.async=t}()}).call(this,f("/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/Users/lance/Projects/stanza.io/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":139}],190:[function(e,f){(function(){function n(){var e=!!window.chrome,f=/firefox/i.test(navigator.userAgent),n=f&&!!window.console.exception;return e||n}var o,d,i,t="undefined"==typeof window,l=!t&&window.localStorage,u=l.debug,p=e("andlog"),s=0,c=15,y=function(){},a=l.debugColors||n();o=function(){var e=.618033988749895;return s+=e,s%=1,360*s},i=u&&"/"===u[0]&&new RegExp(u.substring(1,u.length-1)),d=function(e){var f,n,d;if(f=e.slice(0,c),f+=Array(c+3-f.length).join(" ")+"|",i&&!e.match(i))return y;if(a){var t=o();f="%c"+f,n="color: hsl("+t+",99%,40%); font-weight: bold",d=p.log.bind(p,f,n),["log","debug","warn","error","info"].forEach(function(e){d[e]=p[e].bind(p,f,n)})}else d=p.log.bind(p,f),["log","debug","warn","error","info"].forEach(function(e){d[e]=p[e].bind(p,f)});return d},d.config=function(e){e.padLength&&(this.padLength=e.padLength)},"undefined"!=typeof f?f.exports=d:window.bows=d}).call()},{andlog:191}],191:[function(e,f,n){!function(){var e="undefined"==typeof window,o=!e&&window.localStorage,d={};if(e)return void(f.exports=console);if(o&&o.debug&&window.console)d=window.console;else for(var i="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),t=i.length,l=function(){};t--;)d[i[t]]=l;"undefined"!=typeof n?f.exports=d:window.console=d}()},{}],192:[function(e,f){var n=window.navigator.getUserMedia||window.navigator.webkitGetUserMedia||window.navigator.mozGetUserMedia||window.navigator.msGetUserMedia;f.exports=function(e,f){var o,d=2===arguments.length,i={video:!0,audio:!0},t="PERMISSION_DENIED",l="CONSTRAINT_NOT_SATISFIED";return d||(f=e,e=i),n?void n.call(window.navigator,e,function(e){f(null,e)},function(e){var n;"string"==typeof e?(n=new Error("NavigatorUserMediaError"),n.name=e===t?t:l):(n=e,n.name||(e.name=n[t]?t:l)),f(n)}):(o=new Error("NavigatorUserMediaError"),o.name="NOT_SUPPORTED_ERROR",f(o))}},{}],193:[function(e,f){function n(e,f){var n=-1/0;e.getFloatFrequencyData(f);for(var o=0,d=f.length;d>o;o++)f[o]>n&&f[o]<0&&(n=f[o]);return n}var o=e("wildemitter"),d=window.webkitAudioContext||window.AudioContext,i=null;f.exports=function(e,f){var t=new o;if(!d)return t;var f=f||{},l=f.smoothing||.5,u=f.interval||100,p=f.threshold,s=f.play;i||(i=new d);var c,y,a;a=i.createAnalyser(),a.fftSize=512,a.smoothingTimeConstant=l,y=new Float32Array(a.fftSize),e.jquery&&(e=e[0]),e instanceof HTMLAudioElement?(c=i.createMediaElementSource(e),"undefined"==typeof s&&(s=!0),p=p||-65):(c=i.createMediaStreamSource(e),p=p||-45),c.connect(a),s&&a.connect(i.destination),t.speaking=!1,t.setThreshold=function(e){p=e},t.setInterval=function(e){u=e};var r=function(){setTimeout(function(){var e=n(a,y);t.emit("volume_change",e,p),e>p?t.speaking||(t.speaking=!0,t.emit("speaking")):t.speaking&&(t.speaking=!1,t.emit("stopped_speaking")),r()},u)};return r(),t}},{wildemitter:194}],194:[function(e,f){function n(){this.callbacks={}}f.exports=n,n.prototype.on=function(e){var f=3===arguments.length,n=f?arguments[1]:void 0,o=f?arguments[2]:arguments[1];return o._groupName=n,(this.callbacks[e]=this.callbacks[e]||[]).push(o),this},n.prototype.once=function(e){function f(){n.off(e,f),i.apply(this,arguments)}var n=this,o=3===arguments.length,d=o?arguments[1]:void 0,i=o?arguments[2]:arguments[1];return this.on(e,d,f),this},n.prototype.releaseGroup=function(e){var f,n,o,d;for(f in this.callbacks)for(d=this.callbacks[f],n=0,o=d.length;o>n;n++)d[n]._groupName===e&&(d.splice(n,1),n--,o--);return this},n.prototype.off=function(e,f){var n,o=this.callbacks[e];return o?1===arguments.length?(delete this.callbacks[e],this):(n=o.indexOf(f),o.splice(n,1),this):this},n.prototype.emit=function(e){var f,n,o=[].slice.call(arguments,1),d=this.callbacks[e],i=this.getWildcardCallbacks(e);if(d)for(f=0,n=d.length;n>f&&d[f];++f)d[f].apply(this,o);if(i)for(f=0,n=i.length;n>f&&i[f];++f)i[f].apply(this,[e].concat(o));return this},n.prototype.getWildcardCallbacks=function(e){var f,n,o=[];for(f in this.callbacks)n=f.split("*"),("*"===f||2===n.length&&e.slice(0,n[1].length)===n[1])&&(o=o.concat(this.callbacks[f]));return o}},{}],195:[function(e,f){function n(e){if(this.support=o.webAudio&&o.mediaStream,this.gain=1,this.support){var f=this.context=new o.AudioContext;this.microphone=f.createMediaStreamSource(e),this.gainFilter=f.createGain(),this.destination=f.createMediaStreamDestination(),this.outputStream=this.destination.stream,this.microphone.connect(this.gainFilter),this.gainFilter.connect(this.destination),e.removeTrack(e.getAudioTracks()[0]),e.addTrack(this.outputStream.getAudioTracks()[0])}this.stream=e}var o=e("webrtcsupport");n.prototype.setGain=function(e){this.support&&(this.gainFilter.gain.value=e,this.gain=e)},n.prototype.getGain=function(){return this.gain},n.prototype.off=function(){return this.setGain(0)},n.prototype.on=function(){this.setGain(1)},f.exports=n},{webrtcsupport:203}],196:[function(e,f){for(var n="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),o=n.length,d=function(){},i={};o--;)i[n[o]]=d;f.exports=i},{}],197:[function(e,f){function n(e){return"type: "+e.type+"\r\n"+e.sdp}function o(e,f){var n=this;t.call(this),this.peerconnection=new i.PeerConnection(e,f),this.trace=function(e,f){n.emit("PeerConnectionTrace",{time:new Date,type:e,value:f||""})},this.onicecandidate=null,this.peerconnection.onicecandidate=function(e){n.trace("onicecandidate",JSON.stringify(e.candidate,null," ")),null!==n.onicecandidate&&n.onicecandidate(e)},this.onaddstream=null,this.peerconnection.onaddstream=function(e){n.trace("onaddstream",e.stream.id),null!==n.onaddstream&&n.onaddstream(e)},this.onremovestream=null,this.peerconnection.onremovestream=function(e){n.trace("onremovestream",e.stream.id),null!==n.onremovestream&&n.onremovestream(e)},this.onsignalingstatechange=null,this.peerconnection.onsignalingstatechange=function(e){n.trace("onsignalingstatechange",n.signalingState),null!==n.onsignalingstatechange&&n.onsignalingstatechange(e)},this.oniceconnectionstatechange=null,this.peerconnection.oniceconnectionstatechange=function(e){n.trace("oniceconnectionstatechange",n.iceConnectionState),null!==n.oniceconnectionstatechange&&n.oniceconnectionstatechange(e)},this.onnegotiationneeded=null,this.peerconnection.onnegotiationneeded=function(e){n.trace("onnegotiationneeded"),null!==n.onnegotiationneeded&&n.onnegotiationneeded(e)},n.ondatachannel=null,this.peerconnection.ondatachannel=function(e){n.trace("ondatachannel",e),null!==n.ondatachannel&&n.ondatachannel(e)}}var d=e("util"),i=e("webrtcsupport"),t=e("wildemitter");d.inherits(o,t),void 0!==o.prototype.__defineGetter__&&(o.prototype.__defineGetter__("signalingState",function(){return this.peerconnection.signalingState}),o.prototype.__defineGetter__("iceConnectionState",function(){return this.peerconnection.iceConnectionState}),o.prototype.__defineGetter__("localDescription",function(){return this.peerconnection.localDescription}),o.prototype.__defineGetter__("remoteDescription",function(){return this.peerconnection.remoteDescription})),o.prototype.addStream=function(e){this.trace("addStream",e.id),this.peerconnection.addStream(e)},o.prototype.removeStream=function(e){this.trace("removeStream",e.id),this.peerconnection.removeStream(e)},o.prototype.createDataChannel=function(e,f){return this.trace("createDataChannel",e,f),this.peerconnection.createDataChannel(e,f)},o.prototype.setLocalDescription=function(e,f,o){var d=this;this.trace("setLocalDescription",n(e)),this.peerconnection.setLocalDescription(e,function(){d.trace("setLocalDescriptionOnSuccess"),f()},function(e){d.trace("setLocalDescriptionOnFailure",e),o(e)})},o.prototype.setRemoteDescription=function(e,f,o){var d=this;this.trace("setRemoteDescription",n(e)),this.peerconnection.setRemoteDescription(e,function(){d.trace("setRemoteDescriptionOnSuccess"),f()},function(e){d.trace("setRemoteDescriptionOnFailure",e),o(e)})},o.prototype.close=function(){this.trace("stop"),null!==this.statsinterval&&(window.clearInterval(this.statsinterval),this.statsinterval=null),"closed"!=this.peerconnection.signalingState&&this.peerconnection.close()},o.prototype.createOffer=function(e,f,o){var d=this;this.trace("createOffer",JSON.stringify(o,null," ")),this.peerconnection.createOffer(function(f){d.trace("createOfferOnSuccess",n(f)),e(f)},function(e){d.trace("createOfferOnFailure",e),f(e)},o)},o.prototype.createAnswer=function(e,f,o){var d=this;this.trace("createAnswer",JSON.stringify(o,null," ")),this.peerconnection.createAnswer(function(f){d.trace("createAnswerOnSuccess",n(f)),e(f)},function(e){d.trace("createAnswerOnFailure",e),f(e)},o)},o.prototype.addIceCandidate=function(e){this.trace("addIceCandidate",JSON.stringify(e,null," ")),this.peerconnection.addIceCandidate(e)},o.prototype.getStats=function(e,f){navigator.mozGetUserMedia?this.peerconnection.getStats(null,e,f):this.peerconnection.getStats(e)},f.exports=o},{util:141,webrtcsupport:203,wildemitter:229}],198:[function(e,f){function n(e,f){var n,o=this;l.call(this),e=e||{},e.iceServers=e.iceServers||[],this.pc=new u(e,f),this.pc.on("*",function(){o.emit.apply(o,arguments)}),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.localDescription={contents:[]},this.remoteDescription={contents:[]},this.localStream=null,this.remoteStreams=[],this.config={debug:!1,ice:{},sid:"",isInitiator:!0,sdpSessionID:Date.now(),useJingle:!1};for(n in e)this.config[n]=e[n];this.config.debug&&this.on("*",function(){var f=e.logger||console;f.log("PeerConnection event:",arguments)})}var o=e("underscore"),d=e("util"),i=e("webrtcsupport"),t=e("sdp-jingle-json"),l=e("wildemitter"),u=e("traceablepeerconnection");d.inherits(n,l),n.prototype.__defineGetter__&&(n.prototype.__defineGetter__("signalingState",function(){return this.pc.signalingState}),n.prototype.__defineGetter__("iceConnectionState",function(){return this.pc.iceConnectionState})),n.prototype.addStream=function(e){this.localStream=e,this.pc.addStream(e)},n.prototype.processIce=function(e,f){f=f||function(){};var n=this;if(e.contents){var d=o.pluck(this.remoteDescription.contents,"name"),l=e.contents;l.forEach(function(e){var f=e.transport||{},o=f.candidates||[],l=d.indexOf(e.name),u=e.name;o.forEach(function(e){console.log("addicecandidate");var f=t.toCandidateSDP(e)+"\r\n";n.pc.addIceCandidate(new i.IceCandidate({candidate:f,sdpMLineIndex:l,sdpMid:u}))})})}else n.pc.addIceCandidate(new i.IceCandidate(e.candidate));f()},n.prototype.offer=function(e,f){var n=this,d=2===arguments.length,i=d?e:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};f=d?f:e,f=f||function(){},this.pc.createOffer(function(e){n.pc.setLocalDescription(e,function(){var d,i={type:"offer",sdp:e.sdp};n.config.useJingle&&(d=t.toSessionJSON(e.sdp,n.config.isInitiator?"initiator":"responder"),d.sid=n.config.sid,n.localDescription=d,o.each(d.contents,function(e){var f=e.transport||{};f.ufrag&&(n.config.ice[e.name]={ufrag:f.ufrag,pwd:f.pwd})}),i.jingle=d),n.emit("offer",i),f(null,i)},function(e){n.emit("error",e),f(e)})},function(e){n.emit("error",e),f(e)},i)},n.prototype.handleOffer=function(e,f){f=f||function(){};var n=this;e.type="offer",e.jingle&&(e.sdp=t.toSessionSDP(e.jingle,n.config.sdpSessionID)),n.pc.setRemoteDescription(new i.SessionDescription(e),function(){f()},f)},n.prototype.answerAudioOnly=function(e){var f={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!1}};this._answer(f,e)},n.prototype.answerBroadcastOnly=function(e){var f={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}};this._answer(f,e)},n.prototype.answer=function(e,f){var n=2===arguments.length,o=n?f:e,d=n?e:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};this._answer(d,o)},n.prototype.handleAnswer=function(e,f){f=f||function(){};var n=this;e.jingle&&(e.sdp=t.toSessionSDP(e.jingle,n.config.sdpSessionID),n.remoteDescription=e.jingle),n.pc.setRemoteDescription(new i.SessionDescription(e),function(){f(null)},f)},n.prototype.close=function(){this.pc.close(),this.emit("close")},n.prototype._answer=function(e,f){f=f||function(){};var n=this;if(!this.pc.remoteDescription)throw new Error("remoteDescription not set");n.pc.createAnswer(function(e){n.pc.setLocalDescription(e,function(){var o={type:"answer",sdp:e.sdp};if(n.config.useJingle){var d=t.toSessionJSON(e.sdp);d.sid=n.config.sid,n.localDescription=d,o.jingle=d}n.emit("answer",o),f(null,o)},function(e){n.emit("error",e),f(e)})},function(e){n.emit("error",e),f(e)},e)},n.prototype._onIce=function(e){var f=this;if(e.candidate){var n=e.candidate,d={candidate:e.candidate};if(f.config.useJingle){if(!f.config.ice[n.sdpMid]){var i=t.toSessionJSON(f.pc.localDescription.sdp,f.config.isInitiator?"initiator":"responder");o.each(i.contents,function(e){var n=e.transport||{};n.ufrag&&(f.config.ice[e.name]={ufrag:n.ufrag,pwd:n.pwd})})}d.jingle={contents:[{name:n.sdpMid,creator:f.config.isInitiator?"initiator":"responder",transport:{transType:"iceUdp",ufrag:f.config.ice[n.sdpMid].ufrag,pwd:f.config.ice[n.sdpMid].pwd,candidates:[t.toCandidateJSON(n.candidate)]}}]}}this.emit("ice",d)}else this.emit("endOfCandidates")},n.prototype._onDataChannel=function(e){this.emit("addChannel",e.channel)},n.prototype._onAddStream=function(e){this.remoteStreams.push(e.stream),this.emit("addStream",e)},n.prototype.createDataChannel=function(e,f){var n=this.pc.createDataChannel(e,f);return n},n.prototype.getStats=function(e){"moz"===i.prefix?this.pc.getStats(function(f){var n=[];f.forEach(function(e){n.push(e)}),e(null,n)},e):this.pc.getStats(function(f){var n=[];f.result().forEach(function(e){var f={};e.names().forEach(function(n){f[n]=e.stat(n)}),f.id=e.id,f.type=e.type,f.timestamp=e.timestamp,n.push(f)}),e(null,n)})},f.exports=n},{"sdp-jingle-json":199,traceablepeerconnection:197,underscore:228,util:141,webrtcsupport:203,wildemitter:229}],199:[function(e,f,n){var o=e("./lib/tosdp"),d=e("./lib/tojson");n.toSessionSDP=o.toSessionSDP,n.toMediaSDP=o.toMediaSDP,n.toCandidateSDP=o.toCandidateSDP,n.toSessionJSON=d.toSessionJSON,n.toMediaJSON=d.toMediaJSON,n.toCandidateJSON=d.toCandidateJSON},{"./lib/tojson":201,"./lib/tosdp":202}],200:[function(e,f,n){n.lines=function(e){return e.split("\r\n").filter(function(e){return e.length>0})},n.findLine=function(e,f,n){for(var o=e.length,d=0;d<f.length;d++)if(f[d].substr(0,o)===e)return f[d];if(!n)return!1;for(var i=0;i<n.length;i++)if(n[i].substr(0,o)===e)return n[i];return!1},n.findLines=function(e,f,n){for(var o=[],d=e.length,i=0;i<f.length;i++)f[i].substr(0,d)===e&&o.push(f[i]);if(o.length||!n)return o;for(var t=0;t<n.length;t++)n[t].substr(0,d)===e&&o.push(n[t]);return o},n.mline=function(e){for(var f=e.substr(2).split(" "),n={media:f[0],port:f[1],proto:f[2],formats:[]},o=3;o<f.length;o++)f[o]&&n.formats.push(f[o]);return n},n.rtpmap=function(e){var f=e.substr(9).split(" "),n={id:f.shift()};return f=f[0].split("/"),n.name=f[0],n.clockrate=f[1],n.channels=3==f.length?f[2]:"1",n},n.fmtp=function(e){for(var f,n,o,d=e.substr(e.indexOf(" ")+1).split(";"),i=[],t=0;t<d.length;t++)f=d[t].split("="),n=f[0].trim(),o=f[1],n&&o?i.push({key:n,value:o}):n&&i.push({key:"",value:n});return i},n.crypto=function(e){var f=e.substr(9).split(" "),n={tag:f[0],cipherSuite:f[1],keyParams:f[2],sessionParams:f.slice(3).join(" ")};return n},n.fingerprint=function(e){var f=e.substr(14).split(" ");return{hash:f[0],value:f[1]}},n.extmap=function(e){var f=e.substr(9).split(" "),n={},o=f.shift(),d=o.indexOf("/");return d>=0?(n.id=o.substr(0,d),n.senders=o.substr(d+1)):(n.id=o,n.senders="sendrecv"),n.uri=f.shift()||"",n},n.rtcpfb=function(e){var f=e.substr(10).split(" "),n={};return n.id=f.shift(),n.type=f.shift(),"trr-int"===n.type?n.value=f.shift():n.subtype=f.shift()||"",n.parameters=f,n},n.candidate=function(e){for(var f=e.substring(12).split(" "),n={foundation:f[0],component:f[1],protocol:f[2].toLowerCase(),priority:f[3],ip:f[4],port:f[5],type:f[7],generation:"0"},o=8;o<f.length;o+=2)"raddr"===f[o]?n.relAddr=f[o+1]:"rport"===f[o]?n.relPort=f[o+1]:"generation"===f[o]&&(n.generation=f[o+1]);return n.network="1",n},n.sourceGroups=function(e){for(var f=[],n=0;n<e.length;n++){var o=e[n].substr(13).split(" ");f.push({semantics:o.shift(),sources:o})}return f},n.sources=function(e){for(var f=[],n={},o=0;o<e.length;o++){var d=e[o].substr(7).split(" "),i=d.shift();if(!n[i]){var t={ssrc:i,parameters:[]};f.push(t),n[i]=t}d=d.join(" ").split(":");var l=d.shift(),u=d.join(":")||null;n[i].parameters.push({key:l,value:u})}return f},n.groups=function(e){for(var f,n=[],o=0;o<e.length;o++)f=e[o].substr(8).split(" "),n.push({semantics:f.shift(),contents:f});return n}},{}],201:[function(e,f,n){var o=e("./parsers"),d=Math.random();n._setIdCounter=function(e){d=e},n.toSessionJSON=function(e,f){for(var d=e.split("\r\nm="),i=1;i<d.length;i++)d[i]="m="+d[i],i!==d.length-1&&(d[i]+="\r\n");var t=d.shift()+"\r\n",l=o.lines(t),u={},p=[];d.forEach(function(e){p.push(n.toMediaJSON(e,t,f))}),u.contents=p;var s=o.findLines("a=group:",l);return s.length&&(u.groups=o.groups(s)),u},n.toMediaJSON=function(e,f,d){var i=o.lines(e),t=o.lines(f),l=o.mline(i[0]),u={creator:d,name:l.media,description:{descType:"rtp",media:l.media,payloads:[],encryption:[],feedback:[],headerExtensions:[]},transport:{transType:"iceUdp",candidates:[],fingerprints:[]}},p=u.description,s=u.transport,c=o.findLine("a=ssrc:",i);c&&(p.ssrc=c.substr(7).split(" ")[0]);var y=o.findLine("a=mid:",i);y&&(u.name=y.substr(6)),o.findLine("a=sendrecv",i,t)?u.senders="both":o.findLine("a=sendonly",i,t)?u.senders="initiator":o.findLine("a=recvonly",i,t)?u.senders="responder":o.findLine("a=inactive",i,t)&&(u.senders="none");var a=o.findLines("a=rtpmap:",i);a.forEach(function(e){var f=o.rtpmap(e);f.feedback=[];var n=o.findLines("a=fmtp:"+f.id,i);n.forEach(function(e){f.parameters=o.fmtp(e)});var d=o.findLines("a=rtcp-fb:"+f.id,i);d.forEach(function(e){f.feedback.push(o.rtcpfb(e))}),p.payloads.push(f)});var r=o.findLines("a=crypto:",i,t);r.forEach(function(e){p.encryption.push(o.crypto(e))}),o.findLine("a=rtcp-mux",i)&&(p.mux=!0);var w=o.findLines("a=rtcp-fb:*",i);w.forEach(function(e){p.feedback.push(o.rtcpfb(e))});var b=o.findLines("a=extmap:",i);b.forEach(function(e){var f=o.extmap(e),n={sendonly:"responder",recvonly:"initiator",sendrecv:"both",inactive:"none"};f.senders=n[f.senders],p.headerExtensions.push(f)});var g=o.findLines("a=ssrc-group:",i);p.sourceGroups=o.sourceGroups(g||[]);var m=o.findLines("a=ssrc:",i);p.sources=o.sources(m||[]);var x=o.findLines("a=fingerprint:",i,t);x.forEach(function(e){var f=o.fingerprint(e),n=o.findLine("a=setup:",i,t);n&&(f.setup=n.substr(8)),s.fingerprints.push(f)});var P=o.findLine("a=ice-ufrag:",i,t),j=o.findLine("a=ice-pwd:",i,t);if(P&&j){s.ufrag=P.substr(12),s.pwd=j.substr(10),s.candidates=[];var v=o.findLines("a=candidate:",i,t);v.forEach(function(e){s.candidates.push(n.toCandidateJSON(e))})}return u},n.toCandidateJSON=function(e){var f=o.candidate(e.split("\r\n")[0]);return f.id=(d++).toString(36).substr(0,12),f}},{"./parsers":200}],202:[function(e,f,n){var o={initiator:"sendonly",responder:"recvonly",both:"sendrecv",none:"inactive",sendonly:"initator",recvonly:"responder",sendrecv:"both",inactive:"none"};n.toSessionSDP=function(e,f,o){var d=["v=0","o=- "+(f||e.sid||Date.now())+" "+(o||Date.now())+" IN IP4 0.0.0.0","s=-","t=0 0"],i=e.groups||[];i.forEach(function(e){d.push("a=group:"+e.semantics+" "+e.contents.join(" "))});var t=e.contents||[];return t.forEach(function(e){d.push(n.toMediaSDP(e))}),d.join("\r\n")+"\r\n"},n.toMediaSDP=function(e){var f=[],d=e.description,i=e.transport,t=d.payloads||[],l=i&&i.fingerprints||[],u=[d.media,"1"];u.push(d.encryption&&d.encryption.length>0||l.length>0?"RTP/SAVPF":"RTP/AVPF"),t.forEach(function(e){u.push(e.id)}),f.push("m="+u.join(" ")),f.push("c=IN IP4 0.0.0.0"),f.push("a=rtcp:1 IN IP4 0.0.0.0"),i&&(i.ufrag&&f.push("a=ice-ufrag:"+i.ufrag),i.pwd&&f.push("a=ice-pwd:"+i.pwd),i.setup&&f.push("a=setup:"+i.setup),l.forEach(function(e){f.push("a=fingerprint:"+e.hash+" "+e.value)})),f.push("a="+(o[e.senders]||"sendrecv")),f.push("a=mid:"+e.name),d.mux&&f.push("a=rtcp-mux");var p=d.encryption||[];p.forEach(function(e){f.push("a=crypto:"+e.tag+" "+e.cipherSuite+" "+e.keyParams+(e.sessionParams?" "+e.sessionParams:""))}),t.forEach(function(e){var n="a=rtpmap:"+e.id+" "+e.name+"/"+e.clockrate;if(e.channels&&"1"!=e.channels&&(n+="/"+e.channels),f.push(n),e.parameters&&e.parameters.length){var o=["a=fmtp:"+e.id];e.parameters.forEach(function(e){o.push((e.key?e.key+"=":"")+e.value)}),f.push(o.join(" "))}e.feedback&&e.feedback.forEach(function(n){f.push("trr-int"===n.type?"a=rtcp-fb:"+e.id+" trr-int "+n.value?n.value:"0":"a=rtcp-fb:"+e.id+" "+n.type+(n.subtype?" "+n.subtype:""))})}),d.feedback&&d.feedback.forEach(function(e){f.push("trr-int"===e.type?e.value:"a=rtcp-fb:* "+e.type+(e.subtype?" "+e.subtype:""))});var s=d.headerExtensions||[];s.forEach(function(e){f.push("a=extmap:"+e.id+(e.senders?"/"+o[e.senders]:"")+" "+e.uri)});var c=d.sourceGroups||[];c.forEach(function(e){f.push("a=ssrc-group:"+e.semantics+" "+e.sources.join(" "))});var y=d.sources||[];y.forEach(function(e){for(var n=0;n<e.parameters.length;n++){var o=e.parameters[n];f.push("a=ssrc:"+(e.ssrc||d.ssrc)+" "+o.key+(o.value?":"+o.value:""))}});var a=i.candidates||[];return a.forEach(function(e){f.push(n.toCandidateSDP(e))}),f.join("\r\n")},n.toCandidateSDP=function(e){var f=[];f.push(e.foundation),f.push(e.component),f.push(e.protocol),f.push(e.priority),f.push(e.ip),f.push(e.port);var n=e.type;return f.push("typ"),f.push(n),("srflx"===n||"prflx"===n||"relay"===n)&&e.relAddr&&e.relPort&&(f.push("raddr"),f.push(e.relAddr),f.push("rport"),f.push(e.relPort)),f.push("generation"),f.push(e.generation||"0"),"a=candidate:"+f.join(" ")}},{}],203:[function(e,f){var n,o=!1,d=!1,i=window.navigator.userAgent.toLowerCase();-1!==i.indexOf("firefox")?(n="moz",d=!0):-1!==i.indexOf("chrome")&&(n="webkit",o=!0);var t=window.mozRTCPeerConnection||window.webkitRTCPeerConnection,l=window.mozRTCIceCandidate||window.RTCIceCandidate,u=window.mozRTCSessionDescription||window.RTCSessionDescription,p=window.webkitMediaStream||window.MediaStream,s="https:"===window.location.protocol&&window.navigator.userAgent.match("Chrome")&&parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,c=window.webkitAudioContext||window.AudioContext;f.exports={support:!!t,dataChannel:o||d||t&&t.prototype&&t.prototype.createDataChannel,prefix:n,webAudio:!(!c||!c.prototype.createMediaStreamSource),mediaStream:!(!p||!p.prototype.removeTrack),screenSharing:!!s,AudioContext:c,PeerConnection:t,SessionDescription:u,IceCandidate:l}},{}],204:[function(e,f){"use strict";var n=e("underscore"),o=e("./lib/core"),d=e("./lib/helpers"),i=e("./lib/types");f.exports=n.extend({},o,d,i)},{"./lib/core":205,"./lib/helpers":206,"./lib/types":207,underscore:209}],205:[function(e,f,n){"use strict";function o(e){var f=e.prototype._NS+"|"+e.prototype._EL;s[f]=e,y[f]=e}function d(e){return l.serializeToString(e)}function i(e){var f,n={},o={constructor:!0,_EL:!0,_NS:!0,_extensions:!0,_name:!0,parent:!0,prototype:!0,toJSON:!0,toString:!0,xml:!0};for(f in e._extensions)e._extensions[f].toJSON&&"_"!==f[0]&&(n[f]=e._extensions[f].toJSON());for(f in e)if(!o[f]&&!(c[e._NS+"|"+e._EL]||{})[f]&&!e._extensions[f]&&"_"!==f[0]){var d=e[f];if("function"==typeof d)continue;var i=Object.prototype.toString.call(d);i.indexOf("Object")>=0?Object.keys(d).length>0&&(n[f]=d):i.indexOf("Array")>=0?d.length>0&&(n[f]=d):d&&(n[f]=d)}return n}var t=e("underscore"),l=e("ltx-dom-shim"),u=e("./helpers"),p=e("./types"),s=(u.find,{}),c={},y={};n.build=function(e){var f=y[e.namespaceURI+"|"+e.localName];return f?new f(null,e):void 0},n.parse=function(e,f,n){n=n||y;for(var o=l.parseFromString(e,"application/xml").childNodes,d=0;d<o.length;d++)if(1===o[d].nodeType){if("parsererror"===o[d].nodeName)throw new Error({name:"parsererror",message:"Could not parse: "+e});if(o[d].childElementCount>0&&"parsererror"===o[d].childNodes[0].nodeName)throw new Error({name:"parsererror",message:"Could not parse: "+e});var i=o[d];return f?new f(null,i):new(f=n[i.namespaceURI+"|"+i.localName])(null,i)}throw new Error({name:"parsererror",message:"Could not parse: "+e})},n.extend=function(e,f,o){var d=e.prototype._NS+"|"+e.prototype._EL,i=f.prototype._name,t=f.prototype._NS+"|"+f.prototype._EL;s[t]=f,c[t]||(c[t]={}),c[d]||(c[d]={}),c[d][i]=f,n.add(e,i,p.extension(f)),o&&n.add(e,o,p.multiExtension(f))},n.add=function(e,f,n){n.enumerable=!0,Object.defineProperty(e.prototype,f,n)},n.define=function(e){var f=function(f,n,o){var d=this,i=(n||{}).parentNode||(o||{}).xml,l=(i||{}).namespaceURI;d.xml=n||u.createElement(d._NS,d._EL,l);e.prefixes||{};return t.each(e.prefixes||{},function(e,f){d.xml.setAttribute("xmlns:"+f,e)}),d._extensions={},t.each(d.xml.childNodes,function(e){var f=e.namespaceURI+"|"+e.localName,n=s[f];if(void 0!==n){var o=n.prototype._name;d._extensions[o]=new n(null,e),d._extensions[o].parent=d}}),t.extend(d,f),e.init&&e.init.apply(d,[f]),d};f.prototype={constructor:{value:f},_name:e.name,_eventname:e.eventName,_NS:e.namespace,_EL:e.element,toString:function(){return d(this.xml)},toJSON:function(){return i(this)}};var l=Object.keys(e.fields||{});return l.forEach(function(o){n.add(f,o,e.fields[o])}),e.topLevel&&o(f),f}},{"./helpers":206,"./types":207,"ltx-dom-shim":208,underscore:209}],206:[function(e,f,n){"use strict";var o=e("underscore"),d=e("ltx-dom-shim"),i=n.XML_NS="http://www.w3.org/XML/1998/namespace";n.createElement=function(e,f,o){var i=d.createElementNS(e,f);return o&&o===e||n.setAttribute(i,"xmlns",e),i};var t=n.find=function(e,f,n){var d=e.getElementsByTagName(n);return o.filter(d,function(n){return n.namespaceURI===f&&n.parentNode==e})};n.findOrCreate=function(e,f,o){var d=n.find(e,f,o);if(d.length)return d[0];var i=n.createElement(f,o,e.namespaceURI);return e.appendChild(i),i},n.getAttribute=function(e,f,n){return e.getAttribute(f)||n||""},n.getAttributeNS=function(e,f,n,o){return e.getAttributeNS(f,n)||o||""},n.setAttribute=function(e,f,n,o){n||o?e.setAttribute(f,n):e.removeAttribute(f)},n.setAttributeNS=function(e,f,n,o,d){o||d?e.setAttributeNS(f,n,o):e.removeAttributeNS(f,n)},n.getBoolAttribute=function(e,f,n){var o=e.getAttribute(f)||n||"";return"true"===o||"1"===o},n.setBoolAttribute=function(e,f,n){n?e.setAttribute(f,"1"):e.removeAttribute(f)},n.getSubAttribute=function(e,f,n,o,d){var i=t(e,f,n);if(!i)return"";for(var l=0;l<i.length;l++)return i[l].getAttribute(o)||d||"";return""},n.setSubAttribute=function(e,f,o,d,i){var l=t(e,f,o);if(l.length)for(var u=0;u<l.length;u++){if(i)return void l[u].setAttribute(d,i);l[u].removeAttribute(d)}else i&&(o=n.createElement(f,o,e.namespaceURI),o.setAttribute(d,i),e.appendChild(o))},n.getBoolSubAttribute=function(e,f,n,o,d){var i=e.getSubAttribute(f,n,o)||d||"";return"true"===i||"1"===i},n.setBoolSubAttribute=function(e,f,o,d,i){i=i?"1":"",n.setSubAttribute(e,f,o,d,i)},n.getText=function(e){return e.textContent},n.setText=function(e,f){e.textContent=f},n.getSubText=function(e,f,n,o){var d=t(e,f,n);return o=o||"",d.length?d[0].textContent||o:o},n.setSubText=function(e,f,o,d){var i=t(e,f,o);if(i.length)for(var l=0;l<i.length;l++){if(d)return void(i[l].textContent=d);e.removeChild(i[l])}else if(d){var u=n.createElement(f,o,e.namespaceURI);u.textContent=d,e.appendChild(u)}},n.getMultiSubText=function(e,f,n,o){var d=t(e,f,n),i=[];o=o||function(e){return e.textContent||""};for(var l=0;l<d.length;l++)i.push(o(d[l]));return i},n.setMultiSubText=function(e,f,d,i,l){var u=t(e,f,d),p=[];l=l||function(o){var i=n.createElement(f,d,e.namespaceURI);i.textContent=o,e.appendChild(i)},p="string"==typeof i?(i||"").split("\n"):i,o.forEach(u,function(f){e.removeChild(f)}),o.forEach(p,function(e){e&&l(e)})},n.getSubLangText=function(e,f,n,o){var d=t(e,f,n);if(!d.length)return{};for(var l,u,p={},s=[],c=0;c<d.length;c++)u=d[c],l=u.getAttributeNS(i,"lang")||o,s.push(l),p[l]=u.textContent||"";return p},n.setSubLangText=function(e,f,o,d,l){var u,p,s=t(e,f,o);if(s.length)for(var c=0;c<s.length;c++)e.removeChild(s[c]);if("string"==typeof d)u=n.createElement(f,o,e.namespaceURI),u.textContent=d,e.appendChild(u);else if("object"==typeof d)for(p in d)d.hasOwnProperty(p)&&(u=n.createElement(f,o,e.namespaceURI),p!==l&&u.setAttributeNS(i,"lang",p),u.textContent=d[p],e.appendChild(u))},n.getBoolSub=function(e,f,n){var o=t(e,f,n);return!!o.length},n.setBoolSub=function(e,f,o,d){var i=t(e,f,o);if(i.length)for(var l=0;l<i.length;l++){if(d)return;e.removeChild(i[l])}else if(d){var u=n.createElement(f,o,e.namespaceURI);e.appendChild(u)}}},{"ltx-dom-shim":208,underscore:209}],207:[function(e,f,n){"use strict";var o=e("underscore"),d=e("atob"),i=e("btoa"),t=e("./helpers"),l=t.find,u=n.field=function(e,f){return function(){var n=o.toArray(arguments);return{get:function(){return e.apply(null,[this.xml].concat(n))},set:function(e){f.apply(null,[this.xml].concat(n).concat([e]))}}}};n.field=u,n.boolAttribute=u(t.getBoolAttribute,t.setBoolAttribute),n.subAttribute=u(t.getSubAttribute,t.setSubAttribute),n.boolSubAttribute=u(t.getSubBoolAttribute,t.setSubBoolAttribute),n.text=u(t.getText,t.setText),n.subText=u(t.getSubText,t.setSubText),n.multiSubText=u(t.getMultiSubText,t.setMultiSubText),n.subLangText=u(t.getSubLangText,t.setSubLangText),n.boolSub=u(t.getBoolSub,t.setBoolSub),n.langAttribute=u(function(e){return e.getAttributeNS(t.XML_NS,"lang")||""},function(e,f){e.setAttributeNS(t.XML_NS,"lang",f)}),n.b64Text=u(function(e){return e.textContent&&"="!=e.textContent?d(e.textContent):""},function(e,f){e.textContent=i(f)||"="}),n.dateAttribute=function(e,f){return{get:function(){var n=t.getAttribute(this.xml,e);return n?new Date(n):f?new Date(Date.now()):void 0},set:function(f){f&&("string"!=typeof f&&(f=f.toISOString()),t.setAttribute(this.xml,e,f))}}},n.dateSub=function(e,f,n){return{get:function(){var o=t.getSubText(this.xml,e,f);return o?new Date(o):n?new Date(Date.now()):void 0},set:function(n){n&&("string"!=typeof n&&(n=n.toISOString()),t.setSubText(this.xml,e,f,n))}}},n.dateSubAttribute=function(e,f,n,o){return{get:function(){var d=t.getSubAttribute(this.xml,e,f,n);return d?new Date(d):o?new Date(Date.now()):void 0},set:function(o){o&&("string"!=typeof o&&(o=o.toISOString()),t.setSubAttribute(this.xml,e,f,n,o)) | |
}}},n.numberAttribute=function(e,f){return{get:function(){var n=f?parseFloat:parseInt;return n(t.getAttribute(this.xml,e,"0"),10)},set:function(f){t.setAttribute(this.xml,e,f.toString())}}},n.numberSub=function(e,f,n){return{get:function(){var o=n?parseFloat:parseInt;return o(t.getSubText(this.xml,e,f,"0"),10)},set:function(n){t.setSubText(this.xml,e,f,n.toString())}}},n.attribute=function(e,f){return{get:function(){return t.getAttribute(this.xml,e,f)},set:function(f){t.setAttribute(this.xml,e,f)}}},n.attributeNS=function(e,f,n){return{get:function(){return t.getAttributeNS(this.xml,e,f,n)},set:function(n){t.setAttributeNS(this.xml,e,f,n)}}},n.extension=function(e){return{get:function(){var f=this,n=e.prototype._name;if(!this._extensions[n]){var o=l(this.xml,e.prototype._NS,e.prototype._EL);o.length?this._extensions[n]=new e(null,o[0],f):(this._extensions[n]=new e({},null,f),this.xml.appendChild(this._extensions[n].xml)),this._extensions[n].parent=this}return this._extensions[n]},set:function(f){var n=this[e.prototype._name];o.extend(n,f)}}},n.multiExtension=function(e){return{get:function(){var f=this,n=l(this.xml,e.prototype._NS,e.prototype._EL),d=[];return o.forEach(n,function(n){d.push(new e({},n,f).toJSON())}),d},set:function(f){var n=this,d=l(this.xml,e.prototype._NS,e.prototype._EL);o.forEach(d,function(e){n.xml.removeChild(e)}),o.forEach(f,function(f){var o=new e(f,null,n);n.xml.appendChild(o.xml)})}}}},{"./helpers":206,atob:89,btoa:142,underscore:209}],208:[function(e,f){var n=new window.DOMParser,o=new window.XMLSerializer;f.exports={serializeToString:function(e){return o.serializeToString(e)},parseFromString:function(e,f){return n.parseFromString(e,f)},createElementNS:function(e,f){return document.createElementNS(e,f)}}},{}],209:[function(e,f){f.exports=e(184)},{}],210:[function(f,n){(function(o){(function(){function d(e,f,n){var o=f&&n||0,d=0;for(f=f||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){16>d&&(f[o+d++]=b[e])});16>d;)f[o+d++]=0;return f}function i(e,f){var n=f||0,o=w;return o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+"-"+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]+o[e[n++]]}function t(e,f,n){var o=f&&n||0,d=f||[];e=e||{};var t=null!=e.clockseq?e.clockseq:P,l=null!=e.msecs?e.msecs:(new Date).getTime(),u=null!=e.nsecs?e.nsecs:v+1,p=l-j+(u-v)/1e4;if(0>p&&null==e.clockseq&&(t=t+1&16383),(0>p||l>j)&&null==e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");j=l,v=u,P=t,l+=122192928e5;var s=(1e4*(268435455&l)+u)%4294967296;d[o++]=s>>>24&255,d[o++]=s>>>16&255,d[o++]=s>>>8&255,d[o++]=255&s;var c=l/4294967296*1e4&268435455;d[o++]=c>>>8&255,d[o++]=255&c,d[o++]=c>>>24&15|16,d[o++]=c>>>16&255,d[o++]=t>>>8|128,d[o++]=255&t;for(var y=e.node||x,a=0;6>a;a++)d[o+a]=y[a];return f?f:i(d)}function l(e,f,n){var o=f&&n||0;"string"==typeof e&&(f="binary"==e?new r(16):null,e=null),e=e||{};var d=e.random||(e.rng||u)();if(d[6]=15&d[6]|64,d[8]=63&d[8]|128,f)for(var t=0;16>t;t++)f[o+t]=d[t];return f||i(d)}var u,p=this;if("function"==typeof f)try{var s=f("crypto").randomBytes;u=s&&function(){return s(16)}}catch(c){}if(!u&&p.crypto&&crypto.getRandomValues){var y=new Uint8Array(16);u=function(){return crypto.getRandomValues(y),y}}if(!u){var a=new Array(16);u=function(){for(var e,f=0;16>f;f++)0===(3&f)&&(e=4294967296*Math.random()),a[f]=e>>>((3&f)<<3)&255;return a}}for(var r="function"==typeof o?o:Array,w=[],b={},g=0;256>g;g++)w[g]=(g+256).toString(16).substr(1),b[w[g]]=g;var m=u(),x=[1|m[0],m[1],m[2],m[3],m[4],m[5]],P=16383&(m[6]<<8|m[7]),j=0,v=0,M=l;if(M.v1=t,M.v4=l,M.parse=d,M.unparse=i,M.BufferClass=r,"function"==typeof e&&e.amd)e(function(){return M});else if("undefined"!=typeof n&&n.exports)n.exports=M;else{var X=p.uuid;M.noConflict=function(){return p.uuid=X,M},p.uuid=M}}).call(this)}).call(this,f("buffer").Buffer)},{buffer:129,crypto:133}],211:[function(f,n,o){!function(f,d){"object"==typeof o?d(o,n):"function"==typeof e&&e.amd&&e(["exports","module"],d)}(this,function(e,f){function n(){}n.prototype.name="ANONYMOUS",n.prototype.clientFirst=!0,n.prototype.response=function(e){return e.trace||""},n.prototype.challenge=function(){},e=f.exports=n})},{}],212:[function(f,n,o){!function(d,i){"object"==typeof o?i(o,n,f("./lib/mechanism")):"function"==typeof e&&e.amd&&e(["exports","module","./lib/mechanism"],i)}(this,function(e,f,n){e=f.exports=n,e.Mechanism=n})},{"./lib/mechanism":211}],213:[function(f,n,o){!function(d,i){"object"==typeof o?i(o,n,f("crypto")):"function"==typeof e&&e.amd&&e(["exports","module","crypto"],i)}(this,function(e,f,n){function o(e){e=e||{},this._genNonce=e.genNonce||i(32)}function d(e){for(var f={},n=e.split(/,(?=(?:[^"]|"[^"]*")*$)/),o=0,d=n.length;d>o;o++){var i=/(\w+)=["]?([^"]+)["]?$/.exec(n[o]);i&&(f[i[1]]=i[2])}return f}function i(e){var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=f.length;return function(){for(var o=[],d=0;e>d;++d)o.push(f[Math.random()*n|0]);return o.join("")}}function t(e,f){return n.createHash("md5").update(e).digest(f||"hex")}o.prototype.name="DIGEST-MD5",o.prototype.clientFirst=!1,o.prototype.response=function(e){var f=e.serviceType+"/"+e.host;e.serviceName&&e.host!==e.serviceName&&(f+="/"+serviceName);var n,o,d,i=e.realm||this._realm||"",l=this._genNonce(),u="00000001",p="auth",s="";return s+='username="'+e.username+'"',i&&(s+=',realm="'+i+'"'),s+=',nonce="'+this._nonce+'"',s+=',cnonce="'+l+'"',s+=",nc="+u,s+=",qop="+p,s+=',digest-uri="'+f+'"',n=t(e.authzid?t(e.username+":"+i+":"+e.password,"binary")+":"+this._nonce+":"+l+":"+e.authzid:t(e.username+":"+i+":"+e.password,"binary")+":"+this._nonce+":"+l),"auth"==p?o=t("AUTHENTICATE:"+f):("auth-int"==p||"auth-conf"==p)&&(o=t("AUTHENTICATE:"+f+":00000000000000000000000000000000")),d=t(n+":"+this._nonce+":"+u+":"+l+":"+p+":"+o),s+=",response="+d,"utf-8"==this._charset&&(s+=",charset=utf-8"),e.authzid&&(s+='authzid="'+e.authzid+'"'),s},o.prototype.challenge=function(e){var f=d(e);return this._realm=f.realm,this._nonce=f.nonce,this._qop=(f.qop||"auth").split(","),this._stale=f.stale,this._maxbuf=parseInt(f.maxbuf)||65536,this._charset=f.charset,this._algo=f.algorithm,this._cipher=f.cipher,this._cipher&&this._cipher.split(","),this},e=f.exports=o})},{crypto:133}],214:[function(e,f,n){arguments[4][212][0].apply(n,arguments)},{"./lib/mechanism":213}],215:[function(f,n,o){!function(f,d){"object"==typeof o?d(o,n):"function"==typeof e&&e.amd&&e(["exports","module"],d)}(this,function(e,f){function n(){}n.prototype.name="EXTERNAL",n.prototype.clientFirst=!0,n.prototype.response=function(e){return e.authzid||""},n.prototype.challenge=function(){},e=f.exports=n})},{}],216:[function(e,f,n){arguments[4][212][0].apply(n,arguments)},{"./lib/mechanism":215}],217:[function(f,n,o){!function(f,d){"object"==typeof o?d(o,n):"function"==typeof e&&e.amd&&e(["exports","module"],d)}(this,function(e,f){function n(){}n.prototype.name="PLAIN",n.prototype.clientFirst=!0,n.prototype.response=function(e){var f="";return f+=e.authzid||"",f+="\x00",f+=e.username,f+="\x00",f+=e.password},n.prototype.challenge=function(){return this},e=f.exports=n})},{}],218:[function(e,f,n){arguments[4][212][0].apply(n,arguments)},{"./lib/mechanism":217}],219:[function(f,n,o){!function(d,i){"object"==typeof o?i(o,n,f("crypto"),f("buffer")):"function"==typeof e&&e.amd&&e(["exports","module","crypto","buffer"],i)}(this,function(e,f,n,o){function d(e){e=e||{},this._genNonce=e.genNonce||c(32),this._stage=0}function i(e,f){return n.createHmac("sha1",e).update(f).digest("binary")}function t(e,f,n){for(var o=i(e,f+"\x00\x00\x00"),d=o,t=0;n-1>t;t++)o=i(e,o),d=u(d,o);return d}function l(e){return n.createHash("sha1").update(e).digest("binary")}function u(e,f){e=new y(e,"binary"),f=new y(f,"binary");var n=Math.min(e.length,f.length);result=[];for(var o=0;n>o;o++)result.push(e[o]^f[o]);return result=new y(result,"binary"),result.toString("binary")}function p(e){for(var f=[],n="",o=0;o<e.length;o++)n=e[o],f.push(","===n?"=2C":"="===n?"=3D":n);return f.join("")}function s(e){for(var f={},n=e.split(/,(?=(?:[^"]|"[^"]*")*$)/),o=0,d=n.length;d>o;o++){var i=/(\w+)=["]?([^"]+)["]?$/.exec(n[o]);i&&(f[i[1]]=i[2])}return f}function c(e){var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=f.length;return function(){for(var o=[],d=0;e>d;++d)o.push(f[Math.random()*n|0]);return o.join("")}}var y=o.Buffer;d.prototype.name="SCRAM-SHA-1",d.prototype.clientFirst=!0,d.prototype.response=function(e){return a[this._stage](this,e)},d.prototype.challenge=function(e){var f=s(e);return this._salt=new y(f.s||"","base64").toString("binary"),this._iterationCount=parseInt(f.i,10),this._nonce=f.r,this._verifier=f.v,this._error=f.e,this._challenge=e,this};var a={};a[0]=function(e,f){e._cnonce=e._genNonce();var n="";f.authzid&&(n="a="+p(f.authzid)),e._gs2Header="n,"+n+",";var o="r="+e._cnonce,d="n="+p(f.username);e._clientFirstMessageBare=d+","+o;var i=e._gs2Header+e._clientFirstMessageBare;return e._stage=1,i},a[1]=function(e,f){var n=new y(e._gs2Header).toString("base64");e._clientFinalMessageWithoutProof="c="+n+",r="+e._nonce;var o,d,p;f.clientKey&&f.serverKey?(d=f.clientKey,p=f.serverKey):(o=f.saltedPassword||t(f.password,e._salt,e._iterationCount),d=i(o,"Client Key"),p=i(o,"Server Key"));var s=l(d),c=e._clientFirstMessageBare+","+e._challenge+","+e._clientFinalMessageWithoutProof,a=i(s,c),r=u(d,a),w=new y(r,"binary").toString("base64");e._serverSignature=i(p,c);var b=e._clientFinalMessageWithoutProof+",p="+w;return e._stage=2,e.cache={saltedPassword:o,clientKey:d,serverKey:p},b},a[2]=function(){return""},e=f.exports=d})},{buffer:129,crypto:221}],220:[function(e,f,n){arguments[4][212][0].apply(n,arguments)},{"./lib/mechanism":219}],221:[function(e,f,n){function o(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function d(e,f){for(var n in e)f(e[n],n)}var i=e("buffer").Buffer,t=e("./sha"),l=e("./sha256"),u=e("./rng"),p=e("./md5"),s={sha1:{hex:t.hex_sha1,base64:t.b64_sha1,binary:t.str_sha1},sha256:{hex:l.hex_sha256,base64:l.b64_sha256,binary:l.str_sha256},md5:{hex:p.hex_md5,base64:p.b64_md5,binary:p.bin_md5}},c={sha1:{hex:t.hex_hmac_sha1,base64:t.b64_hmac_sha1,binary:t.str_hmac_sha1},sha256:{hex:l.hex_hmac_sha256,base64:l.b64_hmac_sha256,binary:l.str_hmac_sha256},md5:{hex:p.hex_hmac_md5,base64:p.b64_hmac_md5,binary:p.bin_hmac_md5}};n.createHash=function(e){e=e||"sha1",s[e]||o("algorithm:",e,"is not yet supported");var f="",n=s[e];return{update:function(e){return f+=e,this},digest:function(d){d=d||"binary";var i;(i=n[d])||o("encoding:",d,"is not yet supported for algorithm",e);var t=i(f);return f=null,t}}},n.createHmac=function(e,f){c[e]||o("algorithm:",e,"is not yet supported"),"string"!=typeof f&&(f=f.toString("binary"));var n="",d=c[e];return{update:function(e){return n+=e,this},digest:function(i){i=i||"binary";var t;(t=d[i])||o("encoding:",i,"is not yet support for algorithm",e);var l=t(f,n);return n=null,l}}},n.randomBytes=function(e,f){if(!f||!f.call)return new i(u(e));try{f.call(this,void 0,new i(u(e)))}catch(n){f(n)}},d(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){n[e]=function(){o("sorry,",e,"is not implemented yet")}})},{"./md5":222,"./rng":223,"./sha":224,"./sha256":225,buffer:129}],222:[function(e,f,n){function o(e){return P(p(m(e),e.length*X))}function d(e){return j(p(m(e),e.length*X))}function i(e){return x(p(m(e),e.length*X))}function t(e,f){return P(w(e,f))}function l(e,f){return j(w(e,f))}function u(e,f){return x(w(e,f))}function p(e,f){e[f>>5]|=128<<f%32,e[(f+64>>>9<<4)+14]=f;for(var n=1732584193,o=-271733879,d=-1732584194,i=271733878,t=0;t<e.length;t+=16){var l=n,u=o,p=d,s=i;n=c(n,o,d,i,e[t+0],7,-680876936),i=c(i,n,o,d,e[t+1],12,-389564586),d=c(d,i,n,o,e[t+2],17,606105819),o=c(o,d,i,n,e[t+3],22,-1044525330),n=c(n,o,d,i,e[t+4],7,-176418897),i=c(i,n,o,d,e[t+5],12,1200080426),d=c(d,i,n,o,e[t+6],17,-1473231341),o=c(o,d,i,n,e[t+7],22,-45705983),n=c(n,o,d,i,e[t+8],7,1770035416),i=c(i,n,o,d,e[t+9],12,-1958414417),d=c(d,i,n,o,e[t+10],17,-42063),o=c(o,d,i,n,e[t+11],22,-1990404162),n=c(n,o,d,i,e[t+12],7,1804603682),i=c(i,n,o,d,e[t+13],12,-40341101),d=c(d,i,n,o,e[t+14],17,-1502002290),o=c(o,d,i,n,e[t+15],22,1236535329),n=y(n,o,d,i,e[t+1],5,-165796510),i=y(i,n,o,d,e[t+6],9,-1069501632),d=y(d,i,n,o,e[t+11],14,643717713),o=y(o,d,i,n,e[t+0],20,-373897302),n=y(n,o,d,i,e[t+5],5,-701558691),i=y(i,n,o,d,e[t+10],9,38016083),d=y(d,i,n,o,e[t+15],14,-660478335),o=y(o,d,i,n,e[t+4],20,-405537848),n=y(n,o,d,i,e[t+9],5,568446438),i=y(i,n,o,d,e[t+14],9,-1019803690),d=y(d,i,n,o,e[t+3],14,-187363961),o=y(o,d,i,n,e[t+8],20,1163531501),n=y(n,o,d,i,e[t+13],5,-1444681467),i=y(i,n,o,d,e[t+2],9,-51403784),d=y(d,i,n,o,e[t+7],14,1735328473),o=y(o,d,i,n,e[t+12],20,-1926607734),n=a(n,o,d,i,e[t+5],4,-378558),i=a(i,n,o,d,e[t+8],11,-2022574463),d=a(d,i,n,o,e[t+11],16,1839030562),o=a(o,d,i,n,e[t+14],23,-35309556),n=a(n,o,d,i,e[t+1],4,-1530992060),i=a(i,n,o,d,e[t+4],11,1272893353),d=a(d,i,n,o,e[t+7],16,-155497632),o=a(o,d,i,n,e[t+10],23,-1094730640),n=a(n,o,d,i,e[t+13],4,681279174),i=a(i,n,o,d,e[t+0],11,-358537222),d=a(d,i,n,o,e[t+3],16,-722521979),o=a(o,d,i,n,e[t+6],23,76029189),n=a(n,o,d,i,e[t+9],4,-640364487),i=a(i,n,o,d,e[t+12],11,-421815835),d=a(d,i,n,o,e[t+15],16,530742520),o=a(o,d,i,n,e[t+2],23,-995338651),n=r(n,o,d,i,e[t+0],6,-198630844),i=r(i,n,o,d,e[t+7],10,1126891415),d=r(d,i,n,o,e[t+14],15,-1416354905),o=r(o,d,i,n,e[t+5],21,-57434055),n=r(n,o,d,i,e[t+12],6,1700485571),i=r(i,n,o,d,e[t+3],10,-1894986606),d=r(d,i,n,o,e[t+10],15,-1051523),o=r(o,d,i,n,e[t+1],21,-2054922799),n=r(n,o,d,i,e[t+8],6,1873313359),i=r(i,n,o,d,e[t+15],10,-30611744),d=r(d,i,n,o,e[t+6],15,-1560198380),o=r(o,d,i,n,e[t+13],21,1309151649),n=r(n,o,d,i,e[t+4],6,-145523070),i=r(i,n,o,d,e[t+11],10,-1120210379),d=r(d,i,n,o,e[t+2],15,718787259),o=r(o,d,i,n,e[t+9],21,-343485551),n=b(n,l),o=b(o,u),d=b(d,p),i=b(i,s)}return Array(n,o,d,i)}function s(e,f,n,o,d,i){return b(g(b(b(f,e),b(o,i)),d),n)}function c(e,f,n,o,d,i,t){return s(f&n|~f&o,e,f,d,i,t)}function y(e,f,n,o,d,i,t){return s(f&o|n&~o,e,f,d,i,t)}function a(e,f,n,o,d,i,t){return s(f^n^o,e,f,d,i,t)}function r(e,f,n,o,d,i,t){return s(n^(f|~o),e,f,d,i,t)}function w(e,f){var n=m(e);n.length>16&&(n=p(n,e.length*X));for(var o=Array(16),d=Array(16),i=0;16>i;i++)o[i]=909522486^n[i],d[i]=1549556828^n[i];var t=p(o.concat(m(f)),512+f.length*X);return p(d.concat(t),640)}function b(e,f){var n=(65535&e)+(65535&f),o=(e>>16)+(f>>16)+(n>>16);return o<<16|65535&n}function g(e,f){return e<<f|e>>>32-f}function m(e){for(var f=Array(),n=(1<<X)-1,o=0;o<e.length*X;o+=X)f[o>>5]|=(e.charCodeAt(o/X)&n)<<o%32;return f}function x(e){for(var f="",n=(1<<X)-1,o=0;o<32*e.length;o+=X)f+=String.fromCharCode(e[o>>5]>>>o%32&n);return f}function P(e){for(var f=v?"0123456789ABCDEF":"0123456789abcdef",n="",o=0;o<4*e.length;o++)n+=f.charAt(e[o>>2]>>o%4*8+4&15)+f.charAt(e[o>>2]>>o%4*8&15);return n}function j(e){for(var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",o=0;o<4*e.length;o+=3)for(var d=(e[o>>2]>>8*(o%4)&255)<<16|(e[o+1>>2]>>8*((o+1)%4)&255)<<8|e[o+2>>2]>>8*((o+2)%4)&255,i=0;4>i;i++)n+=8*o+6*i>32*e.length?M:f.charAt(d>>6*(3-i)&63);return n}var v=0,M="=",X=8;n.hex_md5=o,n.b64_md5=d,n.bin_md5=i,n.hex_hmac_md5=t,n.b64_hmac_md5=l,n.bin_hmac_md5=u},{}],223:[function(e,f){!function(){var e,n,o=this;if(e=function(e){for(var f,f,n=new Array(e),o=0;e>o;o++)0==(3&o)&&(f=4294967296*Math.random()),n[o]=f>>>((3&o)<<3)&255;return n},o.crypto&&crypto.getRandomValues){var d=new Uint32Array(4);n=function(e){var f=new Array(e);crypto.getRandomValues(d);for(var n=0;e>n;n++)f[n]=d[n>>2]>>>8*(3&n)&255;return f}}f.exports=n||e}()},{}],224:[function(e,f,n){function o(e){return g(p(w(e),e.length*j))}function d(e){return m(p(w(e),e.length*j))}function i(e){return b(p(w(e),e.length*j))}function t(e,f){return g(y(e,f))}function l(e,f){return m(y(e,f))}function u(e,f){return b(y(e,f))}function p(e,f){e[f>>5]|=128<<24-f%32,e[(f+64>>9<<4)+15]=f;for(var n=Array(80),o=1732584193,d=-271733879,i=-1732584194,t=271733878,l=-1009589776,u=0;u<e.length;u+=16){for(var p=o,y=d,w=i,b=t,g=l,m=0;80>m;m++){n[m]=16>m?e[u+m]:r(n[m-3]^n[m-8]^n[m-14]^n[m-16],1);var x=a(a(r(o,5),s(m,d,i,t)),a(a(l,n[m]),c(m)));l=t,t=i,i=r(d,30),d=o,o=x}o=a(o,p),d=a(d,y),i=a(i,w),t=a(t,b),l=a(l,g)}return Array(o,d,i,t,l)}function s(e,f,n,o){return 20>e?f&n|~f&o:40>e?f^n^o:60>e?f&n|f&o|n&o:f^n^o}function c(e){return 20>e?1518500249:40>e?1859775393:60>e?-1894007588:-899497514}function y(e,f){var n=w(e);n.length>16&&(n=p(n,e.length*j));for(var o=Array(16),d=Array(16),i=0;16>i;i++)o[i]=909522486^n[i],d[i]=1549556828^n[i];var t=p(o.concat(w(f)),512+f.length*j);return p(d.concat(t),672)}function a(e,f){var n=(65535&e)+(65535&f),o=(e>>16)+(f>>16)+(n>>16);return o<<16|65535&n}function r(e,f){return e<<f|e>>>32-f}function w(e){for(var f=Array(),n=(1<<j)-1,o=0;o<e.length*j;o+=j)f[o>>5]|=(e.charCodeAt(o/j)&n)<<32-j-o%32;return f}function b(e){for(var f="",n=(1<<j)-1,o=0;o<32*e.length;o+=j)f+=String.fromCharCode(e[o>>5]>>>32-j-o%32&n);return f}function g(e){for(var f=x?"0123456789ABCDEF":"0123456789abcdef",n="",o=0;o<4*e.length;o++)n+=f.charAt(e[o>>2]>>8*(3-o%4)+4&15)+f.charAt(e[o>>2]>>8*(3-o%4)&15);return n}function m(e){for(var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",o=0;o<4*e.length;o+=3)for(var d=(e[o>>2]>>8*(3-o%4)&255)<<16|(e[o+1>>2]>>8*(3-(o+1)%4)&255)<<8|e[o+2>>2]>>8*(3-(o+2)%4)&255,i=0;4>i;i++)n+=8*o+6*i>32*e.length?P:f.charAt(d>>6*(3-i)&63);return n}n.hex_sha1=o,n.b64_sha1=d,n.str_sha1=i,n.hex_hmac_sha1=t,n.b64_hmac_sha1=l,n.str_hmac_sha1=u;var x=0,P="=",j=8},{}],225:[function(e,f,n){function o(e){return M(j(v(e),e.length*c))}function d(e){return X(j(v(e),e.length*c))}function i(e){return p(j(v(e),e.length*c))}function t(e,f){return M(h(e,f))}function l(e,f){return X(h(e,f))}function u(e,f){return p(h(e,f))}function p(e){for(var f="",n=(1<<c)-1,o=0;o<32*e.length;o+=c)f+=String.fromCharCode(e[o>>5]>>>32-c-o%32&n);return f}n.hex_sha256=o,n.b64_sha256=d,n.str_sha256=i,n.hex_hmac_sha256=t,n.b64_hmac_sha256=l,n.str_hmac_sha256=u;var s=0,c=8,y=function(e,f){var n=(65535&e)+(65535&f),o=(e>>16)+(f>>16)+(n>>16);return o<<16|65535&n},a=function(e,f){return e>>>f|e<<32-f},r=function(e,f){return e>>>f},w=function(e,f,n){return e&f^~e&n},b=function(e,f,n){return e&f^e&n^f&n},g=function(e){return a(e,2)^a(e,13)^a(e,22)},m=function(e){return a(e,6)^a(e,11)^a(e,25)},x=function(e){return a(e,7)^a(e,18)^r(e,3)},P=function(e){return a(e,17)^a(e,19)^r(e,10)},j=function(e,f){var n,o,d,i,t,l,u,p,s,c,a,r,j=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),v=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),M=new Array(64);e[f>>5]|=128<<24-f%32,e[(f+64>>9<<4)+15]=f;for(var s=0;s<e.length;s+=16){n=v[0],o=v[1],d=v[2],i=v[3],t=v[4],l=v[5],u=v[6],p=v[7];for(var c=0;64>c;c++)M[c]=16>c?e[c+s]:y(y(y(P(M[c-2]),M[c-7]),x(M[c-15])),M[c-16]),a=y(y(y(y(p,m(t)),w(t,l,u)),j[c]),M[c]),r=y(g(n),b(n,o,d)),p=u,u=l,l=t,t=y(i,a),i=d,d=o,o=n,n=y(a,r);v[0]=y(n,v[0]),v[1]=y(o,v[1]),v[2]=y(d,v[2]),v[3]=y(i,v[3]),v[4]=y(t,v[4]),v[5]=y(l,v[5]),v[6]=y(u,v[6]),v[7]=y(p,v[7])}return v},v=function(e){for(var f=Array(),n=(1<<c)-1,o=0;o<e.length*c;o+=c)f[o>>5]|=(e.charCodeAt(o/c)&n)<<24-o%32;return f},M=function(e){for(var f=s?"0123456789ABCDEF":"0123456789abcdef",n="",o=0;o<4*e.length;o++)n+=f.charAt(e[o>>2]>>8*(3-o%4)+4&15)+f.charAt(e[o>>2]>>8*(3-o%4)&15);return n},X=function(e){var f,n,o,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="",t=4*e.length,l="=";for(f=0;t>f;f+=3)for(o=(e[f>>2]>>8*(3-f%4)&255)<<16|(e[f+1>>2]>>8*(3-(f+1)%4)&255)<<8|e[f+2>>2]>>8*(3-(f+2)%4)&255,n=0;4>n;n+=1)i+=8*f+6*n<=32*e.length?d.charAt(o>>6*(3-n)&63):l;return i},h=function(e,f){var n=v(e);n.length>16&&(n=j(n,e.length*c));for(var o=Array(16),d=Array(16),i=0;16>i;i++)o[i]=909522486^n[i],d[i]=1549556828^n[i];var t=j(o.concat(v(f)),512+f.length*c);return j(d.concat(t),768)}},{}],226:[function(f,n,o){!function(f,d){"object"==typeof o?d(o,n):"function"==typeof e&&e.amd&&e(["exports","module"],d)}(this,function(e,f){function n(){this._mechs=[]}n.prototype.use=function(e,f){return f||(f=e,e=f.prototype.name),this._mechs.push({name:e,mech:f}),this},n.prototype.create=function(e){for(var f=0,n=this._mechs.length;n>f;f++)for(var o=0,d=e.length;d>o;o++){var i=this._mechs[f];if(i.name==e[o])return new i.mech}return null},e=f.exports=n})},{}],227:[function(f,n,o){!function(d,i){"object"==typeof o?i(o,n,f("./lib/factory")):"function"==typeof e&&e.amd&&e(["exports","module","./lib/factory"],i)}(this,function(e,f,n){e=f.exports=n,e.Factory=n})},{"./lib/factory":226}],228:[function(f,n,o){(function(){var f=this,d=f._,i={},t=Array.prototype,l=Object.prototype,u=Function.prototype,p=t.push,s=t.slice,c=t.concat,y=l.toString,a=l.hasOwnProperty,r=t.forEach,w=t.map,b=t.reduce,g=t.reduceRight,m=t.filter,x=t.every,P=t.some,j=t.indexOf,v=t.lastIndexOf,M=Array.isArray,X=Object.keys,h=u.bind,k=function(e){return e instanceof k?e:this instanceof k?void(this._wrapped=e):new k(e)};"undefined"!=typeof o?("undefined"!=typeof n&&n.exports&&(o=n.exports=k),o._=k):f._=k,k.VERSION="1.6.0";var q=k.each=k.forEach=function(e,f,n){if(null==e)return e;if(r&&e.forEach===r)e.forEach(f,n);else if(e.length===+e.length){for(var o=0,d=e.length;d>o;o++)if(f.call(n,e[o],o,e)===i)return}else for(var t=k.keys(e),o=0,d=t.length;d>o;o++)if(f.call(n,e[t[o]],t[o],e)===i)return;return e};k.map=k.collect=function(e,f,n){var o=[];return null==e?o:w&&e.map===w?e.map(f,n):(q(e,function(e,d,i){o.push(f.call(n,e,d,i))}),o)};var z="Reduce of empty array with no initial value";k.reduce=k.foldl=k.inject=function(e,f,n,o){var d=arguments.length>2;if(null==e&&(e=[]),b&&e.reduce===b)return o&&(f=k.bind(f,o)),d?e.reduce(f,n):e.reduce(f);if(q(e,function(e,i,t){d?n=f.call(o,n,e,i,t):(n=e,d=!0)}),!d)throw new TypeError(z);return n},k.reduceRight=k.foldr=function(e,f,n,o){var d=arguments.length>2;if(null==e&&(e=[]),g&&e.reduceRight===g)return o&&(f=k.bind(f,o)),d?e.reduceRight(f,n):e.reduceRight(f);var i=e.length;if(i!==+i){var t=k.keys(e);i=t.length}if(q(e,function(l,u,p){u=t?t[--i]:--i,d?n=f.call(o,n,e[u],u,p):(n=e[u],d=!0)}),!d)throw new TypeError(z);return n},k.find=k.detect=function(e,f,n){var o;return A(e,function(e,d,i){return f.call(n,e,d,i)?(o=e,!0):void 0}),o},k.filter=k.select=function(e,f,n){var o=[];return null==e?o:m&&e.filter===m?e.filter(f,n):(q(e,function(e,d,i){f.call(n,e,d,i)&&o.push(e)}),o)},k.reject=function(e,f,n){return k.filter(e,function(e,o,d){return!f.call(n,e,o,d)},n)},k.every=k.all=function(e,f,n){f||(f=k.identity);var o=!0;return null==e?o:x&&e.every===x?e.every(f,n):(q(e,function(e,d,t){return(o=o&&f.call(n,e,d,t))?void 0:i}),!!o)};var A=k.some=k.any=function(e,f,n){f||(f=k.identity);var o=!1;return null==e?o:P&&e.some===P?e.some(f,n):(q(e,function(e,d,t){return o||(o=f.call(n,e,d,t))?i:void 0}),!!o)};k.contains=k.include=function(e,f){return null==e?!1:j&&e.indexOf===j?-1!=e.indexOf(f):A(e,function(e){return e===f})},k.invoke=function(e,f){var n=s.call(arguments,2),o=k.isFunction(f);return k.map(e,function(e){return(o?f:e[f]).apply(e,n)})},k.pluck=function(e,f){return k.map(e,k.property(f))},k.where=function(e,f){return k.filter(e,k.matches(f))},k.findWhere=function(e,f){return k.find(e,k.matches(f))},k.max=function(e,f,n){if(!f&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);var o=-1/0,d=-1/0;return q(e,function(e,i,t){var l=f?f.call(n,e,i,t):e;l>d&&(o=e,d=l)}),o},k.min=function(e,f,n){if(!f&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);var o=1/0,d=1/0;return q(e,function(e,i,t){var l=f?f.call(n,e,i,t):e;d>l&&(o=e,d=l)}),o},k.shuffle=function(e){var f,n=0,o=[];return q(e,function(e){f=k.random(n++),o[n-1]=o[f],o[f]=e}),o},k.sample=function(e,f,n){return null==f||n?(e.length!==+e.length&&(e=k.values(e)),e[k.random(e.length-1)]):k.shuffle(e).slice(0,Math.max(0,f))};var B=function(e){return null==e?k.identity:k.isFunction(e)?e:k.property(e)};k.sortBy=function(e,f,n){return f=B(f),k.pluck(k.map(e,function(e,o,d){return{value:e,index:o,criteria:f.call(n,e,o,d)}}).sort(function(e,f){var n=e.criteria,o=f.criteria;if(n!==o){if(n>o||void 0===n)return 1;if(o>n||void 0===o)return-1}return e.index-f.index}),"value")};var C=function(e){return function(f,n,o){var d={};return n=B(n),q(f,function(i,t){var l=n.call(o,i,t,f);e(d,l,i)}),d}};k.groupBy=C(function(e,f,n){k.has(e,f)?e[f].push(n):e[f]=[n]}),k.indexBy=C(function(e,f,n){e[f]=n}),k.countBy=C(function(e,f){k.has(e,f)?e[f]++:e[f]=1}),k.sortedIndex=function(e,f,n,o){n=B(n);for(var d=n.call(o,f),i=0,t=e.length;t>i;){var l=i+t>>>1;n.call(o,e[l])<d?i=l+1:t=l}return i},k.toArray=function(e){return e?k.isArray(e)?s.call(e):e.length===+e.length?k.map(e,k.identity):k.values(e):[]},k.size=function(e){return null==e?0:e.length===+e.length?e.length:k.keys(e).length},k.first=k.head=k.take=function(e,f,n){return null==e?void 0:null==f||n?e[0]:0>f?[]:s.call(e,0,f)},k.initial=function(e,f,n){return s.call(e,0,e.length-(null==f||n?1:f))},k.last=function(e,f,n){return null==e?void 0:null==f||n?e[e.length-1]:s.call(e,Math.max(e.length-f,0))},k.rest=k.tail=k.drop=function(e,f,n){return s.call(e,null==f||n?1:f)},k.compact=function(e){return k.filter(e,k.identity)};var D=function(e,f,n){return f&&k.every(e,k.isArray)?c.apply(n,e):(q(e,function(e){k.isArray(e)||k.isArguments(e)?f?p.apply(n,e):D(e,f,n):n.push(e)}),n)};k.flatten=function(e,f){return D(e,f,[])},k.without=function(e){return k.difference(e,s.call(arguments,1))},k.partition=function(e,f){var n=[],o=[];return q(e,function(e){(f(e)?n:o).push(e)}),[n,o]},k.uniq=k.unique=function(e,f,n,o){k.isFunction(f)&&(o=n,n=f,f=!1);var d=n?k.map(e,n,o):e,i=[],t=[];return q(d,function(n,o){(f?o&&t[t.length-1]===n:k.contains(t,n))||(t.push(n),i.push(e[o]))}),i},k.union=function(){return k.uniq(k.flatten(arguments,!0))},k.intersection=function(e){var f=s.call(arguments,1);return k.filter(k.uniq(e),function(e){return k.every(f,function(f){return k.contains(f,e)})})},k.difference=function(e){var f=c.apply(t,s.call(arguments,1));return k.filter(e,function(e){return!k.contains(f,e)})},k.zip=function(){for(var e=k.max(k.pluck(arguments,"length").concat(0)),f=new Array(e),n=0;e>n;n++)f[n]=k.pluck(arguments,""+n);return f},k.object=function(e,f){if(null==e)return{};for(var n={},o=0,d=e.length;d>o;o++)f?n[e[o]]=f[o]:n[e[o][0]]=e[o][1];return n},k.indexOf=function(e,f,n){if(null==e)return-1;var o=0,d=e.length;if(n){if("number"!=typeof n)return o=k.sortedIndex(e,f),e[o]===f?o:-1;o=0>n?Math.max(0,d+n):n}if(j&&e.indexOf===j)return e.indexOf(f,n);for(;d>o;o++)if(e[o]===f)return o;return-1},k.lastIndexOf=function(e,f,n){if(null==e)return-1;var o=null!=n;if(v&&e.lastIndexOf===v)return o?e.lastIndexOf(f,n):e.lastIndexOf(f);for(var d=o?n:e.length;d--;)if(e[d]===f)return d;return-1},k.range=function(e,f,n){arguments.length<=1&&(f=e||0,e=0),n=arguments[2]||1;for(var o=Math.max(Math.ceil((f-e)/n),0),d=0,i=new Array(o);o>d;)i[d++]=e,e+=n;return i};var E=function(){};k.bind=function(e,f){var n,o;if(h&&e.bind===h)return h.apply(e,s.call(arguments,1));if(!k.isFunction(e))throw new TypeError;return n=s.call(arguments,2),o=function(){if(!(this instanceof o))return e.apply(f,n.concat(s.call(arguments)));E.prototype=e.prototype;var d=new E;E.prototype=null;var i=e.apply(d,n.concat(s.call(arguments)));return Object(i)===i?i:d}},k.partial=function(e){var f=s.call(arguments,1);return function(){for(var n=0,o=f.slice(),d=0,i=o.length;i>d;d++)o[d]===k&&(o[d]=arguments[n++]);for(;n<arguments.length;)o.push(arguments[n++]);return e.apply(this,o)}},k.bindAll=function(e){var f=s.call(arguments,1);if(0===f.length)throw new Error("bindAll must be passed function names");return q(f,function(f){e[f]=k.bind(e[f],e)}),e},k.memoize=function(e,f){var n={};return f||(f=k.identity),function(){var o=f.apply(this,arguments);return k.has(n,o)?n[o]:n[o]=e.apply(this,arguments)}},k.delay=function(e,f){var n=s.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},f)},k.defer=function(e){return k.delay.apply(k,[e,1].concat(s.call(arguments,1)))},k.throttle=function(e,f,n){var o,d,i,t=null,l=0;n||(n={});var u=function(){l=n.leading===!1?0:k.now(),t=null,i=e.apply(o,d),o=d=null};return function(){var p=k.now();l||n.leading!==!1||(l=p);var s=f-(p-l);return o=this,d=arguments,0>=s?(clearTimeout(t),t=null,l=p,i=e.apply(o,d),o=d=null):t||n.trailing===!1||(t=setTimeout(u,s)),i}},k.debounce=function(e,f,n){var o,d,i,t,l,u=function(){var p=k.now()-t;f>p?o=setTimeout(u,f-p):(o=null,n||(l=e.apply(i,d),i=d=null))};return function(){i=this,d=arguments,t=k.now();var p=n&&!o;return o||(o=setTimeout(u,f)),p&&(l=e.apply(i,d),i=d=null),l}},k.once=function(e){var f,n=!1;return function(){return n?f:(n=!0,f=e.apply(this,arguments),e=null,f)}},k.wrap=function(e,f){return k.partial(f,e)},k.compose=function(){var e=arguments;return function(){for(var f=arguments,n=e.length-1;n>=0;n--)f=[e[n].apply(this,f)];return f[0]}},k.after=function(e,f){return function(){return--e<1?f.apply(this,arguments):void 0}},k.keys=function(e){if(!k.isObject(e))return[];if(X)return X(e);var f=[];for(var n in e)k.has(e,n)&&f.push(n);return f},k.values=function(e){for(var f=k.keys(e),n=f.length,o=new Array(n),d=0;n>d;d++)o[d]=e[f[d]];return o},k.pairs=function(e){for(var f=k.keys(e),n=f.length,o=new Array(n),d=0;n>d;d++)o[d]=[f[d],e[f[d]]];return o},k.invert=function(e){for(var f={},n=k.keys(e),o=0,d=n.length;d>o;o++)f[e[n[o]]]=n[o];return f},k.functions=k.methods=function(e){var f=[];for(var n in e)k.isFunction(e[n])&&f.push(n);return f.sort()},k.extend=function(e){return q(s.call(arguments,1),function(f){if(f)for(var n in f)e[n]=f[n]}),e},k.pick=function(e){var f={},n=c.apply(t,s.call(arguments,1));return q(n,function(n){n in e&&(f[n]=e[n])}),f},k.omit=function(e){var f={},n=c.apply(t,s.call(arguments,1));for(var o in e)k.contains(n,o)||(f[o]=e[o]);return f},k.defaults=function(e){return q(s.call(arguments,1),function(f){if(f)for(var n in f)void 0===e[n]&&(e[n]=f[n])}),e},k.clone=function(e){return k.isObject(e)?k.isArray(e)?e.slice():k.extend({},e):e},k.tap=function(e,f){return f(e),e};var F=function(e,f,n,o){if(e===f)return 0!==e||1/e==1/f;if(null==e||null==f)return e===f;e instanceof k&&(e=e._wrapped),f instanceof k&&(f=f._wrapped);var d=y.call(e);if(d!=y.call(f))return!1;switch(d){case"[object String]":return e==String(f);case"[object Number]":return e!=+e?f!=+f:0==e?1/e==1/f:e==+f;case"[object Date]":case"[object Boolean]":return+e==+f;case"[object RegExp]":return e.source==f.source&&e.global==f.global&&e.multiline==f.multiline&&e.ignoreCase==f.ignoreCase}if("object"!=typeof e||"object"!=typeof f)return!1;for(var i=n.length;i--;)if(n[i]==e)return o[i]==f;var t=e.constructor,l=f.constructor;if(t!==l&&!(k.isFunction(t)&&t instanceof t&&k.isFunction(l)&&l instanceof l)&&"constructor"in e&&"constructor"in f)return!1;n.push(e),o.push(f);var u=0,p=!0;if("[object Array]"==d){if(u=e.length,p=u==f.length)for(;u--&&(p=F(e[u],f[u],n,o)););}else{for(var s in e)if(k.has(e,s)&&(u++,!(p=k.has(f,s)&&F(e[s],f[s],n,o))))break;if(p){for(s in f)if(k.has(f,s)&&!u--)break; | |
p=!u}}return n.pop(),o.pop(),p};k.isEqual=function(e,f){return F(e,f,[],[])},k.isEmpty=function(e){if(null==e)return!0;if(k.isArray(e)||k.isString(e))return 0===e.length;for(var f in e)if(k.has(e,f))return!1;return!0},k.isElement=function(e){return!(!e||1!==e.nodeType)},k.isArray=M||function(e){return"[object Array]"==y.call(e)},k.isObject=function(e){return e===Object(e)},q(["Arguments","Function","String","Number","Date","RegExp"],function(e){k["is"+e]=function(f){return y.call(f)=="[object "+e+"]"}}),k.isArguments(arguments)||(k.isArguments=function(e){return!(!e||!k.has(e,"callee"))}),"function"!=typeof/./&&(k.isFunction=function(e){return"function"==typeof e}),k.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},k.isNaN=function(e){return k.isNumber(e)&&e!=+e},k.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==y.call(e)},k.isNull=function(e){return null===e},k.isUndefined=function(e){return void 0===e},k.has=function(e,f){return a.call(e,f)},k.noConflict=function(){return f._=d,this},k.identity=function(e){return e},k.constant=function(e){return function(){return e}},k.property=function(e){return function(f){return f[e]}},k.matches=function(e){return function(f){if(f===e)return!0;for(var n in e)if(e[n]!==f[n])return!1;return!0}},k.times=function(e,f,n){for(var o=Array(Math.max(0,e)),d=0;e>d;d++)o[d]=f.call(n,d);return o},k.random=function(e,f){return null==f&&(f=e,e=0),e+Math.floor(Math.random()*(f-e+1))},k.now=Date.now||function(){return(new Date).getTime()};var G={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};G.unescape=k.invert(G.escape);var H={escape:new RegExp("["+k.keys(G.escape).join("")+"]","g"),unescape:new RegExp("("+k.keys(G.unescape).join("|")+")","g")};k.each(["escape","unescape"],function(e){k[e]=function(f){return null==f?"":(""+f).replace(H[e],function(f){return G[e][f]})}}),k.result=function(e,f){if(null==e)return void 0;var n=e[f];return k.isFunction(n)?n.call(e):n},k.mixin=function(e){q(k.functions(e),function(f){var n=k[f]=e[f];k.prototype[f]=function(){var e=[this._wrapped];return p.apply(e,arguments),N.call(this,n.apply(k,e))}})};var I=0;k.uniqueId=function(e){var f=++I+"";return e?e+f:f},k.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;k.template=function(e,f,n){var o;n=k.defaults({},n,k.templateSettings);var d=new RegExp([(n.escape||J).source,(n.interpolate||J).source,(n.evaluate||J).source].join("|")+"|$","g"),i=0,t="__p+='";e.replace(d,function(f,n,o,d,l){return t+=e.slice(i,l).replace(L,function(e){return"\\"+K[e]}),n&&(t+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),o&&(t+="'+\n((__t=("+o+"))==null?'':__t)+\n'"),d&&(t+="';\n"+d+"\n__p+='"),i=l+f.length,f}),t+="';\n",n.variable||(t="with(obj||{}){\n"+t+"}\n"),t="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+t+"return __p;\n";try{o=new Function(n.variable||"obj","_",t)}catch(l){throw l.source=t,l}if(f)return o(f,k);var u=function(e){return o.call(this,e,k)};return u.source="function("+(n.variable||"obj")+"){\n"+t+"}",u},k.chain=function(e){return k(e).chain()};var N=function(e){return this._chain?k(e).chain():e};k.mixin(k),q(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var f=t[e];k.prototype[e]=function(){var n=this._wrapped;return f.apply(n,arguments),"shift"!=e&&"splice"!=e||0!==n.length||delete n[0],N.call(this,n)}}),q(["concat","join","slice"],function(e){var f=t[e];k.prototype[e]=function(){return N.call(this,f.apply(this._wrapped,arguments))}}),k.extend(k.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof e&&e.amd&&e("underscore",[],function(){return k})}).call(this)},{}],229:[function(e,f){function n(){this.callbacks={}}f.exports=n,n.prototype.on=function(e){var f=3===arguments.length,n=f?arguments[1]:void 0,o=f?arguments[2]:arguments[1];return o._groupName=n,(this.callbacks[e]=this.callbacks[e]||[]).push(o),this},n.prototype.once=function(e){function f(){n.off(e,f),i.apply(this,arguments)}var n=this,o=3===arguments.length,d=o?arguments[1]:void 0,i=o?arguments[2]:arguments[1];return this.on(e,d,f),this},n.prototype.releaseGroup=function(e){var f,n,o,d;for(f in this.callbacks)for(d=this.callbacks[f],n=0,o=d.length;o>n;n++)d[n]._groupName===e&&(d.splice(n,1),n--,o--);return this},n.prototype.off=function(e,f){var n,o=this.callbacks[e];return o?1===arguments.length?(delete this.callbacks[e],this):(n=o.indexOf(f),o.splice(n,1),this):this},n.prototype.emit=function(e){var f,n,o,d=[].slice.call(arguments,1),i=this.callbacks[e],t=this.getWildcardCallbacks(e);if(i)for(o=i.slice(),f=0,n=o.length;n>f&&o[f];++f)o[f].apply(this,d);if(t)for(n=t.length,o=t.slice(),f=0,n=o.length;n>f&&o[f];++f)o[f].apply(this,[e].concat(d));return this},n.prototype.getWildcardCallbacks=function(e){var f,n,o=[];for(f in this.callbacks)n=f.split("*"),("*"===f||2===n.length&&e.slice(0,n[0].length)===n[0])&&(o=o.concat(this.callbacks[f]));return o}},{}]},{},[1])(1)}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment