forked from QuickBlox/quickblox-javascript-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickblox.min.js
9 lines (9 loc) · 247 KB
/
quickblox.min.js
1
2
3
4
5
6
7
8
9
/* QuickBlox JavaScript SDK - v2.0.1 - 2016-01-06 */
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.QB=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){this.service=a}function e(a){var b={application_id:g.creds.appId,auth_key:g.creds.authKey,nonce:h.randomNonce(),timestamp:h.unixTime()};return a.login&&a.password?b.user={login:a.login,password:a.password}:a.email&&a.password?b.user={email:a.email,password:a.password}:a.provider&&(b.provider=a.provider,a.scope&&(b.scope=a.scope),a.keys&&a.keys.token&&(b.keys={token:a.keys.token}),a.keys&&a.keys.secret&&(b.keys.secret=a.keys.secret)),b}function f(a,b){var c=Object.keys(a).map(function(b){return"object"==typeof a[b]?Object.keys(a[b]).map(function(c){return b+"["+c+"]="+a[b][c]}).sort().join("&"):b+"="+a[b]}).sort().join("&");return i(c,b).toString()}var g=a("../qbConfig"),h=a("../qbUtils"),i=a("crypto-js/hmac-sha1");d.prototype={getSession:function(a){h.QBLog("[AuthProxy]","getSession"),this.service.ajax({url:h.getUrl(g.urls.session)},function(b,c){b?a(b,null):a(b,c)})},createSession:function(a,b){if(""===g.creds.appId||""===g.creds.authKey||""===g.creds.authSecret)throw new Error("Cannot create a new session without app credentials (app ID, auth key and auth secret)");var c,d=this;"function"==typeof a&&"undefined"==typeof b&&(b=a,a={}),c=e(a),c.signature=f(c,g.creds.authSecret),h.QBLog("[AuthProxy]","createSession",c),this.service.ajax({url:h.getUrl(g.urls.session),type:"POST",data:c},function(a,c){a?b(a,null):(d.service.setSession(c.session),b(null,c.session))})},destroySession:function(a){var b=this;h.QBLog("[AuthProxy]","destroySession"),this.service.ajax({url:h.getUrl(g.urls.session),type:"DELETE",dataType:"text"},function(c,d){c?a(c,null):(b.service.setSession(null),a(null,d))})},login:function(a,b){h.QBLog("[AuthProxy]","login",a),this.service.ajax({url:h.getUrl(g.urls.login),type:"POST",data:a},function(a,c){a?b(a,null):b(null,c.user)})},logout:function(a){h.QBLog("[AuthProxy]","logout"),this.service.ajax({url:h.getUrl(g.urls.login),type:"DELETE",dataType:"text"},a)}},b.exports=d},{"../qbConfig":15,"../qbUtils":19,"crypto-js/hmac-sha1":23}],2:[function(a,b,c){function d(a,b,c){var d=this;r=b,q=c,this.service=a,o&&(this.roster=new e(a),this.muc=new f(a),this.privacylist=new g(a),this._isLogout=!1,this._isDisconnected=!1),this.dialog=new h(a),this.message=new i(a),this.helpers=new j,this._onMessage=function(a){var b=a.getAttribute("from"),c=(a.getAttribute("to"),a.getAttribute("type")),e=a.querySelector("body"),f=a.querySelector("markable"),g=a.querySelector("received"),h=a.querySelector("displayed"),i=a.querySelector("composing"),j=a.querySelector("paused"),k=a.querySelector("invite"),l=a.querySelector("extraParams"),m=a.querySelector("delay"),o=a.getAttribute("id"),p="groupchat"===c?d.helpers.getDialogIdFromNode(b):null,r="groupchat"===c?d.helpers.getIdFromResource(b):d.helpers.getIdFromNode(b),s=g||h||null;if(k)return!0;var t;if(l&&(t=d._parseExtraParams(l),t.dialogId&&(p=t.dialogId)),i||j)return"function"!=typeof d.onMessageTypingListener||"chat"!==c&&"groupchat"!==c&&m||n.safeCallbackCall(d.onMessageTypingListener,null!=i,r,p),!0;if(s)return g?"function"==typeof d.onDeliveredStatusListener&&"chat"===c&&n.safeCallbackCall(d.onDeliveredStatusListener,g.getAttribute("id"),p,r):"function"==typeof d.onReadStatusListener&&"chat"===c&&n.safeCallbackCall(d.onReadStatusListener,h.getAttribute("id"),p,r),!0;if(f&&r!=d.helpers.getIdFromNode(q.jid)){var u={messageId:o,userId:r,dialogId:p};d.sendDeliveredStatus(u)}var v={id:o,dialog_id:p,type:c,body:e&&e.textContent||null,extension:t?t.extension:null,delay:m};return f&&(v.markable=1),"function"!=typeof d.onMessageListener||"chat"!==c&&"groupchat"!==c||n.safeCallbackCall(d.onMessageListener,r,v),!0},this._onPresence=function(a){var b=a.getAttribute("from"),c=a.getAttribute("type"),e=d.helpers.getIdFromNode(b);if(c)switch(c){case"subscribe":u[e]&&"to"===u[e].subscription?(u[e]={subscription:"both",ask:null},d.roster._sendSubscriptionPresence({jid:b,type:"subscribed"})):"function"==typeof d.onSubscribeListener&&n.safeCallbackCall(d.onSubscribeListener,e);break;case"subscribed":u[e]&&"from"===u[e].subscription?u[e]={subscription:"both",ask:null}:(u[e]={subscription:"to",ask:null},"function"==typeof d.onConfirmSubscribeListener&&n.safeCallbackCall(d.onConfirmSubscribeListener,e));break;case"unsubscribed":u[e]={subscription:"none",ask:null},"function"==typeof d.onRejectSubscribeListener&&n.safeCallbackCall(d.onRejectSubscribeListener,e);break;case"unsubscribe":u[e]={subscription:"to",ask:null};break;case"unavailable":"function"==typeof d.onContactListListener&&u[e]&&"none"!==u[e].subscription&&n.safeCallbackCall(d.onContactListListener,e,c)}else"function"==typeof d.onContactListListener&&u[e]&&"none"!==u[e].subscription&&n.safeCallbackCall(d.onContactListListener,e);return!0},this._onIQ=function(a){return!0},this._onSystemMessageListener=function(a){var b,c=a.getAttribute("from"),e=(a.getAttribute("to"),a.querySelector("extraParams")),f=e.querySelector("moduleIdentifier").textContent,g=(a.querySelector("delay"),a.getAttribute("id"));if("SystemNotifications"===f&&"function"==typeof d.onSystemMessageListener){var h=d._parseExtraParams(e);b={id:g,userId:d.helpers.getIdFromNode(c),extension:h.extension},n.safeCallbackCall(d.onSystemMessageListener,b)}return!0},this._onMessageErrorListener=function(a){var b=a.getAttribute("id"),c=k(a);return"function"==typeof d.onMessageErrorListener&&n.safeCallbackCall(d.onMessageErrorListener,b,c),!0}}function e(a){this.service=a,this.helpers=new j}function f(a){this.service=a,this.helpers=new j}function g(a){this.service=a,this.helpers=new j}function h(a){this.service=a,this.helpers=new j}function i(a){this.service=a,this.helpers=new j}function j(){}function k(a){var b=a.getElementsByTagName("error")[0],c=parseInt(b.getAttribute("code")),d=b.getElementsByTagName("text")[0].textContent;return getError(c,d)}function l(){return(new Date).toTimeString().split(" ")[0]}var m=a("../qbConfig"),n=a("../qbUtils"),o="undefined"!=typeof window,p="This function isn't supported outside of the browser (...yet)";o&&(a("../../lib/strophe/strophe.min"),Strophe.addNamespace("CARBONS","urn:xmpp:carbons:2"),Strophe.addNamespace("CHAT_MARKERS","urn:xmpp:chat-markers:0"),Strophe.addNamespace("PRIVACY_LIST","jabber:iq:privacy"),Strophe.addNamespace("CHAT_STATES","http://jabber.org/protocol/chatstates"));var q,r,s=m.urls.chat+"/Dialog",t=m.urls.chat+"/Message",u={},v={};d.prototype={connect:function(a,b){if(!o)throw p;n.QBLog("[ChatProxy]","connect",a);var c,d,e,f=this;"userId"in a?(e=a.userId+"-"+m.creds.appId+"@"+m.endpoints.chat,"resource"in a&&(e=e+"/"+a.resource)):"jid"in a&&(e=a.jid),q.connect(e,a.password,function(e){switch(e){case Strophe.Status.ERROR:c=getError(422,"Status.ERROR - An error has occurred"),"function"==typeof b&&b(c,null);break;case Strophe.Status.CONNECTING:n.QBLog("[ChatProxy]","Status.CONNECTING"),n.QBLog("[ChatProxy]","Chat Protocol - "+(1===m.chatProtocol.active?"BOSH":"WebSocket"));break;case Strophe.Status.CONNFAIL:c=getError(422,"Status.CONNFAIL - The connection attempt failed"),"function"==typeof b&&b(c,null);break;case Strophe.Status.AUTHENTICATING:n.QBLog("[ChatProxy]","Status.AUTHENTICATING");break;case Strophe.Status.AUTHFAIL:c=getError(401,"Status.AUTHFAIL - The authentication attempt failed"),"function"==typeof b&&b(c,null);break;case Strophe.Status.CONNECTED:n.QBLog("[ChatProxy]","Status.CONNECTED at "+l()),f._isDisconnected=!1,q.addHandler(f._onMessage,null,"message","chat"),q.addHandler(f._onMessage,null,"message","groupchat"),q.addHandler(f._onPresence,null,"presence"),q.addHandler(f._onIQ,null,"iq"),q.addHandler(f._onSystemMessageListener,null,"message","headline"),q.addHandler(f._onMessageErrorListener,null,"message","error"),q.addHandler(r._onMessage,null,"message","headline"),f._enableCarbons(function(){f.roster.get(function(a){if(u=a,q.send($pres().tree()),q.addTimedHandler(55e3,f._autoSendPresence),"function"==typeof b)b(null,u);else{f._isLogout=!1,d=Object.keys(v);for(var c=0,e=d.length;e>c;c++)f.muc.join(d[c]);"function"==typeof f.onReconnectListener&&n.safeCallbackCall(f.onReconnectListener)}})});break;case Strophe.Status.DISCONNECTING:n.QBLog("[ChatProxy]","Status.DISCONNECTING");break;case Strophe.Status.DISCONNECTED:n.QBLog("[ChatProxy]","Status.DISCONNECTED at "+l()),q.reset(),f._isDisconnected||"function"!=typeof f.onDisconnectedListener||n.safeCallbackCall(f.onDisconnectedListener),f._isDisconnected=!0,f._isLogout||f.connect(a);break;case Strophe.Status.ATTACHED:n.QBLog("[ChatProxy]","Status.ATTACHED")}})},send:function(a,b){if(!o)throw p;b.id||(b.id=n.getBsonObjectId());var c=this,d=$msg({from:q.jid,to:this.helpers.jidOrUserId(a),type:b.type,id:b.id});b.body&&d.c("body",{xmlns:Strophe.NS.CLIENT}).t(b.body).up(),b.extension&&(d.c("extraParams",{xmlns:Strophe.NS.CLIENT}),Object.keys(b.extension).forEach(function(a){"attachments"===a?b.extension[a].forEach(function(a){d.c("attachment",a).up()}):"object"==typeof b.extension[a]?c._JStoXML(a,b.extension[a],d):d.c(a).t(b.extension[a]).up()}),d.up()),b.markable&&d.c("markable",{xmlns:Strophe.NS.CHAT_MARKERS}),q.send(d)},sendSystemMessage:function(a,b){if(!o)throw p;b.id||(b.id=n.getBsonObjectId());var c=this,d=$msg({id:b.id,type:"headline",to:this.helpers.jidOrUserId(a)});b.extension&&(d.c("extraParams",{xmlns:Strophe.NS.CLIENT}).c("moduleIdentifier").t("SystemNotifications").up(),Object.keys(b.extension).forEach(function(a){"object"==typeof b.extension[a]?c._JStoXML(a,b.extension[a],d):d.c(a).t(b.extension[a]).up()}),d.up()),q.send(d)},sendIsTypingStatus:function(a){if(!o)throw p;var b=$msg({from:q.jid,to:this.helpers.jidOrUserId(a),type:this.helpers.typeChat(a)});b.c("composing",{xmlns:Strophe.NS.CHAT_STATES}),q.send(b)},sendIsStopTypingStatus:function(a){if(!o)throw p;var b=$msg({from:q.jid,to:this.helpers.jidOrUserId(a),type:this.helpers.typeChat(a)});b.c("paused",{xmlns:Strophe.NS.CHAT_STATES}),q.send(b)},sendPres:function(a){if(!o)throw p;q.send($pres({from:q.jid,type:a}))},sendDeliveredStatus:function(a){if(!o)throw p;var b=$msg({from:q.jid,to:this.helpers.jidOrUserId(a.userId),type:"chat",id:n.getBsonObjectId()});b.c("received",{xmlns:Strophe.NS.CHAT_MARKERS,id:a.messageId}).up(),b.c("extraParams",{xmlns:Strophe.NS.CLIENT}).c("dialog_id").t(a.dialogId),q.send(b)},sendReadStatus:function(a){if(!o)throw p;var b=$msg({from:q.jid,to:this.helpers.jidOrUserId(a.userId),type:"chat",id:n.getBsonObjectId()});b.c("displayed",{xmlns:Strophe.NS.CHAT_MARKERS,id:a.messageId}).up(),b.c("extraParams",{xmlns:Strophe.NS.CLIENT}).c("dialog_id").t(a.dialogId),q.send(b)},disconnect:function(){if(!o)throw p;v={},this._isLogout=!0,q.flush(),q.disconnect()},addListener:function(a,b){function c(){return b(),a.live!==!1}if(!o)throw p;return q.addHandler(c,null,a.name||null,a.type||null,a.id||null,a.from||null)},deleteListener:function(a){if(!o)throw p;q.deleteHandler(a)},_JStoXML:function(a,b,c){var d=this;c.c(a),Object.keys(b).forEach(function(a){"object"==typeof b[a]?d._JStoXML(a,b[a],c):c.c(a).t(b[a]).up()}),c.up()},_XMLtoJS:function(a,b,c){var d=this;a[b]={};for(var e=0,f=c.childNodes.length;f>e;e++)c.childNodes[e].childNodes.length>1?a[b]=d._XMLtoJS(a[b],c.childNodes[e].tagName,c.childNodes[e]):a[b][c.childNodes[e].tagName]=c.childNodes[e].textContent;return a},_parseExtraParams:function(a){if(!a)return null;for(var b,c={},d=[],e=0,f=a.childNodes.length;f>e;e++)if("attachment"===a.childNodes[e].tagName){for(var g={},h=a.childNodes[e].attributes,i=0,j=h.length;j>i;i++)"id"===h[i].name||"size"===h[i].name?g[h[i].name]=parseInt(h[i].value):g[h[i].name]=h[i].value;d.push(g)}else if("dialog_id"===a.childNodes[e].tagName)b=a.childNodes[e].textContent,c.dialog_id=b;else if(a.childNodes[e].childNodes.length>1){var k=a.childNodes[e].textContent.length;if(k>4096){for(var l="",i=0;i<a.childNodes[e].childNodes.length;++i)l+=a.childNodes[e].childNodes[i].textContent;c[a.childNodes[e].tagName]=l}else c=self._XMLtoJS(c,a.childNodes[e].tagName,a.childNodes[e])}else c[a.childNodes[e].tagName]=a.childNodes[e].textContent;return d.length>0&&(c.attachments=d),c.moduleIdentifier&&delete c.moduleIdentifier,{extension:c,dialogId:b}},_autoSendPresence:function(){if(!o)throw p;return q.send($pres().tree()),!0},_enableCarbons:function(a){if(!o)throw p;var b;b=$iq({from:q.jid,type:"set",id:q.getUniqueId("enableCarbons")}).c("enable",{xmlns:Strophe.NS.CARBONS}),q.sendIQ(b,function(b){a()})}},e.prototype={get:function(a){var b,c,d,e=this,f={};b=$iq({from:q.jid,type:"get",id:q.getUniqueId("getRoster")}).c("query",{xmlns:Strophe.NS.ROSTER}),q.sendIQ(b,function(b){c=b.getElementsByTagName("item");for(var g=0,h=c.length;h>g;g++)d=e.helpers.getIdFromNode(c[g].getAttribute("jid")).toString(),f[d]={subscription:c[g].getAttribute("subscription"),ask:c[g].getAttribute("ask")||null};a(f)})},add:function(a,b){var c=this,d=this.helpers.jidOrUserId(a),e=this.helpers.getIdFromNode(d).toString();u[e]={subscription:"none",ask:"subscribe"},c._sendSubscriptionPresence({jid:d,type:"subscribe"}),"function"==typeof b&&b()},confirm:function(a,b){var c=this,d=this.helpers.jidOrUserId(a),e=this.helpers.getIdFromNode(d).toString();u[e]={subscription:"from",ask:"subscribe"},c._sendSubscriptionPresence({jid:d,type:"subscribed"}),c._sendSubscriptionPresence({jid:d,type:"subscribe"}),"function"==typeof b&&b()},reject:function(a,b){var c=this,d=this.helpers.jidOrUserId(a),e=this.helpers.getIdFromNode(d).toString();u[e]={subscription:"none",ask:null},c._sendSubscriptionPresence({jid:d,type:"unsubscribed"}),"function"==typeof b&&b()},remove:function(a,b){var c,d=this.helpers.jidOrUserId(a),e=this.helpers.getIdFromNode(d).toString();c=$iq({from:q.jid,type:"set",id:q.getUniqueId("removeRosterItem")}).c("query",{xmlns:Strophe.NS.ROSTER}).c("item",{jid:d,subscription:"remove"}),q.sendIQ(c,function(){delete u[e],"function"==typeof b&&b()})},_sendSubscriptionPresence:function(a){var b;b=$pres({to:a.jid,type:a.type}),q.send(b)}},f.prototype={join:function(a,b){var c,d=this,e=q.getUniqueId("join");v[a]=!0,c=$pres({from:q.jid,to:d.helpers.getRoomJid(a),id:e}).c("x",{xmlns:Strophe.NS.MUC}).c("history",{maxstanzas:0}),"function"==typeof b&&q.addHandler(b,null,"presence",null,e),q.send(c)},leave:function(a,b){var c,d=this,e=d.helpers.getRoomJid(a);delete v[a],c=$pres({from:q.jid,to:e,type:"unavailable"}),"function"==typeof b&&q.addHandler(b,null,"presence","unavailable",null,e),q.send(c)},listOnlineUsers:function(a,b){var c,d=this,e=[];c=$iq({from:q.jid,id:q.getUniqueId("muc_disco_items"),to:a,type:"get"}).c("query",{xmlns:"http://jabber.org/protocol/disco#items"}),q.sendIQ(c,function(a){for(var c,f=a.getElementsByTagName("item"),g=0,h=f.length;h>g;g++)c=d.helpers.getUserIdFromRoomJid(f[g].getAttribute("jid")),e.push(c);b(e)})}},g.prototype={getNames:function(a){var b=$iq({from:q.jid,type:"get",id:q.getUniqueId("getNames")}).c("query",{xmlns:Strophe.NS.PRIVACY_LIST});q.sendIQ(b,function(b){for(var c=[],d={},e=b.getElementsByTagName("default"),f=b.getElementsByTagName("active"),g=b.getElementsByTagName("list"),h=e[0].getAttribute("name"),i=f[0].getAttribute("name"),j=0,k=g.length;k>j;j++)c.push(g[j].getAttribute("name"));d={"default":h,active:i,names:c},a(null,d)},function(b){if(b){var c=k(b);a(c,null)}else a(getError(408),null)})},getList:function(a,b){var c,d,e,f,g=this,h=[],i={};c=$iq({from:q.jid,type:"get",id:q.getUniqueId("getlist")}).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}).c("list",{name:a}),q.sendIQ(c,function(c){d=c.getElementsByTagName("item");for(var j=0,k=d.length;k>j;j+=2)e=d[j].getAttribute("value"),f=g.helpers.getIdFromNode(e),h.push({user_id:f,action:d[j].getAttribute("action")});i={name:a,items:h},b(null,i)},function(a){if(a){var c=k(a);b(c,null)}else b(getError(408),null)})},create:function(a,b){var c,d,e,f,g,h=this,i={},j=[];c=$iq({from:q.jid,type:"set",id:q.getUniqueId("edit")}).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}).c("list",{name:a.name}),$(a.items).each(function(a,b){i[b.user_id]=b.action}),j=Object.keys(i);for(var l=0,m=0,n=j.length;n>l;l++,m+=2)d=j[l],f=i[d],e=h.helpers.jidOrUserId(parseInt(d,10)),g=h.helpers.getUserNickWithMucDomain(d),c.c("item",{type:"jid",value:e,action:f,order:m+1}).c("message",{}).up().c("presence-in",{}).up().c("presence-out",{}).up().c("iq",{}).up().up(),c.c("item",{type:"jid",value:g,action:f,order:m+2}).c("message",{}).up().c("presence-in",{}).up().c("presence-out",{}).up().c("iq",{}).up().up();q.sendIQ(c,function(a){b(null)},function(a){if(a){var c=k(a);b(c)}else b(getError(408))})},update:function(a,b){var c=this;c.getList(a.name,function(d,e){if(d)b(d,null);else{var f=JSON.parse(JSON.stringify(a)),g=e.items,h=f.items,i={};f.items=$.merge(g,h),i=f,c.create(i,function(a,c){d?b(a,null):b(null,c)})}})},"delete":function(a,b){var c=$iq({from:q.jid,type:"set",id:q.getUniqueId("remove")}).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}).c("list",{name:a?a:""});q.sendIQ(c,function(a){b(null)},function(a){if(a){var c=k(a);b(c)}else b(getError(408))})},setAsDefault:function(a,b){var c=$iq({from:q.jid,type:"set",id:q.getUniqueId("default")}).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}).c("default",{name:a?a:""});q.sendIQ(c,function(a){b(null)},function(a){if(a){var c=k(a);b(c)}else b(getError(408))})},setAsActive:function(a,b){var c=$iq({from:q.jid,type:"set",id:q.getUniqueId("active")}).c("query",{xmlns:Strophe.NS.PRIVACY_LIST}).c("active",{name:a?a:""});q.sendIQ(c,function(a){b(null)},function(a){if(a){var c=k(a);b(c)}else b(getError(408))})}},h.prototype={list:function(a,b){"function"==typeof a&&"undefined"==typeof b&&(b=a,a={}),n.QBLog("[DialogProxy]","list",a),this.service.ajax({url:n.getUrl(s),data:a},b)},create:function(a,b){a.occupants_ids instanceof Array&&(a.occupants_ids=a.occupants_ids.join(", ")),n.QBLog("[DialogProxy]","create",a),this.service.ajax({url:n.getUrl(s),type:"POST",data:a},b)},update:function(a,b,c){n.QBLog("[DialogProxy]","update",b),this.service.ajax({url:n.getUrl(s,a),type:"PUT",data:b},c)},"delete":function(a,b,c){n.QBLog("[DialogProxy]","delete",a),2==arguments.length?this.service.ajax({url:n.getUrl(s,a),type:"DELETE"},b):3==arguments.length&&this.service.ajax({url:n.getUrl(s,a),type:"DELETE",data:b},c)}},i.prototype={list:function(a,b){n.QBLog("[MessageProxy]","list",a),this.service.ajax({url:n.getUrl(t),data:a},b)},create:function(a,b){n.QBLog("[MessageProxy]","create",a),this.service.ajax({url:n.getUrl(t),type:"POST",data:a},b)},update:function(a,b,c){n.QBLog("[MessageProxy]","update",a,b),this.service.ajax({url:n.getUrl(t,a),type:"PUT",data:b},c)},"delete":function(a,b,c){n.QBLog("[DialogProxy]","delete",a),2==arguments.length?this.service.ajax({url:n.getUrl(t,a),type:"DELETE",dataType:"text"},b):3==arguments.length&&this.service.ajax({url:n.getUrl(t,a),type:"DELETE",data:b,dataType:"text"},c)},unreadCount:function(a,b){n.QBLog("[MessageProxy]","unreadCount",a),this.service.ajax({url:n.getUrl(t+"/unread"),data:a},b)}},j.prototype={jidOrUserId:function(a){var b;if("string"==typeof a)b=a;else{if("number"!=typeof a)throw p;b=a+"-"+m.creds.appId+"@"+m.endpoints.chat}return b},typeChat:function(a){var b;if("string"==typeof a)b=a.indexOf("muc")>-1?"groupchat":"chat";else{if("number"!=typeof a)throw p;b="chat"}return b},getRecipientId:function(a,b){var c=null;return a.forEach(function(a,d,e){a!=b&&(c=a)}),c},getUserJid:function(a,b){return b?a+"-"+b+"@"+m.endpoints.chat:a+"-"+m.creds.appId+"@"+m.endpoints.chat},getUserNickWithMucDomain:function(a){return m.endpoints.muc+"/"+a},getIdFromNode:function(a){return a.indexOf("@")<0?null:parseInt(a.split("@")[0].split("-")[0])},getDialogIdFromNode:function(a){return a.indexOf("@")<0?null:a.split("@")[0].split("_")[1]},getRoomJid:function(a){if(!o)throw p;return a+"/"+this.getIdFromNode(q.jid)},getIdFromResource:function(a){var b=a.split("/");return b.length<2?null:(b.splice(0,1),parseInt(b.join("/")))},getUniqueId:function(a){if(!o)throw p;return q.getUniqueId(a)},getBsonObjectId:function(){return n.getBsonObjectId()},getUserIdFromRoomJid:function(a){var b=a.toString().split("/");return 0==b.length?null:b[b.length-1]}},b.exports=d},{"../../lib/strophe/strophe.min":21,"../qbConfig":15,"../qbUtils":19}],3:[function(a,b,c){function d(a){this.service=a}function e(a){for(var b=e.options,c=b.parser[b.strictMode?"strict":"loose"].exec(a),d={},f=14;f--;)d[b.key[f]]=c[f]||"";return d[b.q.name]={},d[b.key[12]].replace(b.q.parser,function(a,c,e){c&&(d[b.q.name][c]=e)}),d}var f=a("../qbConfig"),g=a("../qbUtils"),h="undefined"!=typeof window;if(!h)var i=a("xml2js");var j=f.urls.blobs+"/tagged";d.prototype={create:function(a,b){g.QBLog("[ContentProxy]","create",a),this.service.ajax({url:g.getUrl(f.urls.blobs),data:{blob:a},type:"POST"},function(a,c){a?b(a,null):b(a,c.blob)})},list:function(a,b){"function"==typeof a&&"undefined"==typeof b&&(b=a,a=null),g.QBLog("[ContentProxy]","list",a),this.service.ajax({url:g.getUrl(f.urls.blobs),data:a,type:"GET"},function(a,c){a?b(a,null):b(a,c)})},"delete":function(a,b){g.QBLog("[ContentProxy]","delete"),this.service.ajax({url:g.getUrl(f.urls.blobs,a),type:"DELETE",dataType:"text"},function(a,c){a?b(a,null):b(null,!0)})},createAndUpload:function(a,b){var c,d,f,i,j,k={},l=this,m=JSON.parse(JSON.stringify(a));m.file.data="...",g.QBLog("[ContentProxy]","createAndUpload",m),c=a.file,d=a.name||c.name,f=a.type||c.type,i=a.size||c.size,k.name=d,k.content_type=f,a["public"]&&(k["public"]=a["public"]),a.tag_list&&(k.tag_list=a.tag_list),this.create(k,function(a,d){if(a)b(a,null);else{var f,g=e(d.blob_object_access.params),k={url:"https://"+g.host};f=h?new FormData:{},j=d.id,Object.keys(g.queryKey).forEach(function(a){h?f.append(a,decodeURIComponent(g.queryKey[a])):f[a]=decodeURIComponent(g.queryKey[a])}),h?f.append("file",c,d.name):f.file=c,k.data=f,l.upload(k,function(a,c){a?b(a,null):(h?d.path=c.Location.replace("http://","https://"):d.path=c.PostResponse.Location,l.markUploaded({id:j,size:i},function(a,c){a?b(a,null):b(null,d)}))})}})},upload:function(a,b){g.QBLog("[ContentProxy]","upload"),this.service.ajax({url:a.url,data:a.data,dataType:"xml",contentType:!1,processData:!1,type:"POST"},function(a,c){if(a)b(a,null);else if(h){var d,e,f={},g=c.documentElement,j=g.childNodes;for(d=0,e=j.length;e>d;d++)f[j[d].nodeName]=j[d].childNodes[0].nodeValue;b(null,f)}else{var k=i.parseString;k(c,function(a,c){c&&b(null,c)})}})},taggedForCurrentUser:function(a){g.QBLog("[ContentProxy]","taggedForCurrentUser"),this.service.ajax({url:g.getUrl(j)},function(b,c){b?a(b,null):a(null,c)})},markUploaded:function(a,b){g.QBLog("[ContentProxy]","markUploaded",a),this.service.ajax({url:g.getUrl(f.urls.blobs,a.id+"/complete"),type:"PUT",data:{size:a.size},dataType:"text"},function(a,c){a?b(a,null):b(null,c)})},getInfo:function(a,b){g.QBLog("[ContentProxy]","getInfo",a),this.service.ajax({url:g.getUrl(f.urls.blobs,a)},function(a,c){a?b(a,null):b(null,c)})},getFile:function(a,b){g.QBLog("[ContentProxy]","getFile",a),this.service.ajax({url:g.getUrl(f.urls.blobs,a)},function(a,c){a?b(a,null):b(null,c)})},getFileUrl:function(a,b){g.QBLog("[ContentProxy]","getFileUrl",a),this.service.ajax({url:g.getUrl(f.urls.blobs,a+"/getblobobjectbyid"),type:"POST"},function(a,c){a?b(a,null):b(null,c.blob_object_access.params)})},update:function(a,b){g.QBLog("[ContentProxy]","update",a);var c={};c.blob={},"undefined"!=typeof a.name&&(c.blob.name=a.name),this.service.ajax({url:g.getUrl(f.urls.blobs,a.id),data:c},function(a,c){a?b(a,null):b(null,c)})},privateUrl:function(a){return"https://"+f.endpoints.api+"/blobs/"+a+"?token="+this.service.getSession().token},publicUrl:function(a){return"https://"+f.endpoints.api+"/blobs/"+a}},b.exports=d,e.options={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}}},{"../qbConfig":15,"../qbUtils":19,xml2js:55}],4:[function(a,b,c){function d(a){this.service=a}var e=a("../qbConfig"),f=a("../qbUtils"),g="undefined"!=typeof window;d.prototype={create:function(a,b,c){f.QBLog("[DataProxy]","create",a,b),this.service.ajax({url:f.getUrl(e.urls.data,a),data:b,type:"POST"},function(a,b){a?c(a,null):c(a,b)})},list:function(a,b,c){"undefined"==typeof c&&"function"==typeof b&&(c=b,b=null),f.QBLog("[DataProxy]","list",a,b),this.service.ajax({url:f.getUrl(e.urls.data,a),data:b},function(a,b){a?c(a,null):c(a,b)})},update:function(a,b,c){f.QBLog("[DataProxy]","update",a,b),this.service.ajax({url:f.getUrl(e.urls.data,a+"/"+b._id),data:b,type:"PUT"},function(a,b){a?c(a,null):c(a,b)})},"delete":function(a,b,c){f.QBLog("[DataProxy]","delete",a,b),this.service.ajax({url:f.getUrl(e.urls.data,a+"/"+b),type:"DELETE",dataType:"text"},function(a,b){a?c(a,null):c(a,!0)})},uploadFile:function(a,b,c){f.QBLog("[DataProxy]","uploadFile",a,b);var d;g?(d=new FormData,d.append("field_name",b.field_name),d.append("file",b.file)):(d={},d.field_name=b.field_name,d.file=b.file),this.service.ajax({url:f.getUrl(e.urls.data,a+"/"+b.id+"/file"),data:d,contentType:!1,processData:!1,type:"POST"},function(a,b){a?c(a,null):c(a,b)})},downloadFile:function(a,b,c){f.QBLog("[DataProxy]","downloadFile",a,b);var d=f.getUrl(e.urls.data,a+"/"+b.id+"/file");d+="?field_name="+b.field_name+"&token="+this.service.getSession().token,c(null,d)},deleteFile:function(a,b,c){f.QBLog("[DataProxy]","deleteFile",a,b),this.service.ajax({url:f.getUrl(e.urls.data,a+"/"+b.id+"/file"),data:{field_name:b.field_name},dataType:"text",type:"DELETE"},function(a,b){a?c(a,null):c(a,!0)})}},b.exports=d},{"../qbConfig":15,"../qbUtils":19}],5:[function(a,b,c){function d(a){this.service=a,this.geodata=new e(a)}function e(a){this.service=a}var f=a("../qbConfig"),g=a("../qbUtils"),h=f.urls.geodata+"/find";e.prototype={create:function(a,b){g.QBLog("[GeoProxy]","create",a),this.service.ajax({url:g.getUrl(f.urls.geodata),data:{geo_data:a},type:"POST"},function(a,c){a?b(a,null):b(a,c.geo_datum)})},update:function(a,b){var c,d=["longitude","latitude","status"],e={};for(c in a)a.hasOwnProperty(c)&&d.indexOf(c)>0&&(e[c]=a[c]);g.QBLog("[GeoProxy]","update",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a.id),data:{geo_data:e},type:"PUT"},function(a,c){a?b(a,null):b(a,c.geo_datum)})},get:function(a,b){g.QBLog("[GeoProxy]","get",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a)},function(a,c){a?b(a,null):b(null,c.geo_datum)})},list:function(a,b){"function"==typeof a&&(b=a,a=void 0),g.QBLog("[GeoProxy]","find",a),this.service.ajax({url:g.getUrl(h),data:a},b)},"delete":function(a,b){g.QBLog("[GeoProxy]","delete",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a),type:"DELETE",dataType:"text"},function(a,c){a?b(a,null):b(null,!0)})},purge:function(a,b){g.QBLog("[GeoProxy]","purge",a),this.service.ajax({url:g.getUrl(f.urls.geodata),data:{days:a},type:"DELETE",dataType:"text"},function(a,c){a?b(a,null):b(null,!0)})}},b.exports=d},{"../qbConfig":15,"../qbUtils":19}],6:[function(a,b,c){function d(a){this.service=a,this.subscriptions=new e(a),this.events=new f(a),this.base64Encode=function(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,b){return String.fromCharCode("0x"+b)}))}}function e(a){this.service=a}function f(a){this.service=a}var g=a("../qbConfig"),h=a("../qbUtils");e.prototype={create:function(a,b){h.QBLog("[SubscriptionsProxy]","create",a),this.service.ajax({url:h.getUrl(g.urls.subscriptions),type:"POST",data:a},b)},list:function(a){h.QBLog("[SubscriptionsProxy]","list"),this.service.ajax({url:h.getUrl(g.urls.subscriptions)},a)},"delete":function(a,b){h.QBLog("[SubscriptionsProxy]","delete",a),this.service.ajax({url:h.getUrl(g.urls.subscriptions,a),type:"DELETE",dataType:"text"},function(a,c){a?b(a,null):b(null,!0)})}},f.prototype={create:function(a,b){h.QBLog("[EventsProxy]","create",a);var c={event:a};this.service.ajax({url:h.getUrl(g.urls.events),type:"POST",data:c},b)},list:function(a,b){"function"==typeof a&&"undefined"==typeof b&&(b=a,a=null),h.QBLog("[EventsProxy]","list",a),this.service.ajax({url:h.getUrl(g.urls.events),data:a},b)},get:function(a,b){h.QBLog("[EventsProxy]","get",a),this.service.ajax({url:h.getUrl(g.urls.events,a)},b)},status:function(a,b){h.QBLog("[EventsProxy]","status",a),this.service.ajax({url:h.getUrl(g.urls.events,a+"/status")},b)},"delete":function(a,b){h.QBLog("[EventsProxy]","delete",a),this.service.ajax({url:h.getUrl(g.urls.events,a),type:"DELETE"},b)}},b.exports=d},{"../qbConfig":15,"../qbUtils":19}],7:[function(a,b,c){function d(a){this.service=a}function e(a){var b=a.field in j?"date":typeof a.value;return(a.value instanceof Array||i.isArray(a.value))&&("object"==b&&(b=typeof a.value[0]),a.value=a.value.toString()),[b,a.field,a.param,a.value].join(" ")}function f(a){var b=a.field in j?"date":a.field in k?"number":"string";return[a.sort,b,a.field].join(" ")}var g=a("../qbConfig"),h=a("../qbUtils"),i=a("util"),j=["created_at","updated_at","last_request_at"],k=["id","external_user_id"],l=g.urls.users+"/password/reset";d.prototype={listUsers:function(a,b){h.QBLog("[UsersProxy]","listUsers",arguments.length>1?a:"");var c,d={},i=[];"function"==typeof a&&"undefined"==typeof b&&(b=a,a={}),a.filter&&(a.filter instanceof Array?a.filter.forEach(function(a){c=e(a),i.push(c)}):(c=e(a.filter),i.push(c)),d.filter=i),a.order&&(d.order=f(a.order)),a.page&&(d.page=a.page),a.per_page&&(d.per_page=a.per_page),this.service.ajax({url:h.getUrl(g.urls.users),data:d},b)},get:function(a,b){h.QBLog("[UsersProxy]","get",a);var c;"number"==typeof a?(c=a,a={}):a.login?c="by_login":a.full_name?c="by_full_name":a.facebook_id?c="by_facebook_id":a.twitter_id?c="by_twitter_id":a.email?c="by_email":a.tags?c="by_tags":a.external&&(c="external/"+a.external,a={}),this.service.ajax({url:h.getUrl(g.urls.users,c),data:a},function(a,c){a?b(a,null):b(null,c.user||c)})},create:function(a,b){h.QBLog("[UsersProxy]","create",a),this.service.ajax({url:h.getUrl(g.urls.users),type:"POST",data:{user:a}},function(a,c){a?b(a,null):b(null,c.user)})},update:function(a,b,c){h.QBLog("[UsersProxy]","update",a,b),this.service.ajax({url:h.getUrl(g.urls.users,a),type:"PUT",data:{user:b}},function(a,b){a?c(a,null):c(null,b.user)})},"delete":function(a,b){h.QBLog("[UsersProxy]","delete",a);var c;"number"==typeof a?c=a:a.external&&(c="external/"+a.external),this.service.ajax({url:h.getUrl(g.urls.users,c),type:"DELETE",dataType:"text"},b)},resetPassword:function(a,b){h.QBLog("[UsersProxy]","resetPassword",a),this.service.ajax({url:h.getUrl(l),data:{email:a}},b)}},b.exports=d},{"../qbConfig":15,"../qbUtils":19,util:52}],8:[function(a,b,c){var d=a("../../qbConfig"),e=a("./qbWebRTCHelpers"),f=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection,g=window.RTCSessionDescription||window.mozRTCSessionDescription,h=window.RTCIceCandidate||window.mozRTCIceCandidate;f.State={NEW:1,CONNECTING:2,CHECKING:3,CONNECTED:4,DISCONNECTED:5,FAILED:6,CLOSED:7,COMPLETED:8},f.prototype.init=function(a,b,c,d){e.trace("RTCPeerConnection init. userID: "+b+", sessionID: "+c+", type: "+d),
this.delegate=a,this.sessionID=c,this.userID=b,this.type=d,this.remoteSDP=null,this.state=f.State.NEW,this.onicecandidate=this.onIceCandidateCallback,this.onaddstream=this.onAddRemoteStreamCallback,this.onsignalingstatechange=this.onSignalingStateCallback,this.oniceconnectionstatechange=this.onIceConnectionStateCallback,this.dialingTimer=null,this.answerTimeInterval=0,this.reconnectTimer=0,this.iceCandidates=[]},f.prototype.release=function(){this._clearDialingTimer(),"closed"!==this.signalingState&&this.close()},f.prototype.updateRemoteSDP=function(a){if(!a)throw new Error("sdp string can't be empty.");this.remoteSDP=a},f.prototype.getRemoteSDP=function(){return this.remoteSDP},f.prototype.setRemoteSessionDescription=function(a,b,c){function d(){c(null)}function e(a){c(a)}var f=new g({sdp:b,type:a});this.setRemoteDescription(f,d,e)},f.prototype.addLocalStream=function(a){if(!a)throw new Error("'RTCPeerConnection.addStream' error: stream is 'null'.");this.addStream(a)},f.prototype.getAndSetLocalSessionDescription=function(a){function b(b){d.setLocalDescription(b,function(){a(null)},c)}function c(b){a(b)}var d=this;d.state=f.State.CONNECTING,"offer"===d.type?d.createOffer(b,c):d.createAnswer(b,c)},f.prototype.addCandidates=function(a){for(var b,c=0,d=a.length;d>c;c++)b={sdpMLineIndex:a[c].sdpMLineIndex,sdpMid:a[c].sdpMid,candidate:a[c].candidate},this.addIceCandidate(new h(b),function(){},function(a){e.traceError("Error on 'addIceCandidate': "+a)})},f.prototype.toString=function(){return"sessionID: "+this.sessionID+", userID: "+this.userID+", type: "+this.type+", state: "+this.state},f.prototype.onSignalingStateCallback=function(){"stable"===this.signalingState&&this.iceCandidates.length>0&&(this.delegate.processIceCandidates(this,this.iceCandidates),this.iceCandidates.length=0)},f.prototype.onIceCandidateCallback=function(a){var b=a.candidate;if(b){var c={sdpMLineIndex:b.sdpMLineIndex,sdpMid:b.sdpMid,candidate:b.candidate};"stable"===this.signalingState?this.delegate.processIceCandidates(this,[c]):this.iceCandidates.push(c)}},f.prototype.onAddRemoteStreamCallback=function(a){"function"==typeof this.delegate._onRemoteStreamListener&&this.delegate._onRemoteStreamListener(this.userID,a.stream)},f.prototype.onIceConnectionStateCallback=function(){var a=this.iceConnectionState;if(e.trace("onIceConnectionStateCallback: "+this.iceConnectionState),"function"==typeof this.delegate._onSessionConnectionStateChangedListener){var b=null;"checking"===a?(this.state=f.State.CHECKING,b=e.SessionConnectionState.CONNECTING):"connected"===a?(this._clearWaitingReconnectTimer(),this.state=f.State.CONNECTED,b=e.SessionConnectionState.CONNECTED):"completed"===a?(this._clearWaitingReconnectTimer(),this.state=f.State.COMPLETED,b=e.SessionConnectionState.COMPLETED):"failed"===a?(this.state=f.State.FAILED,b=e.SessionConnectionState.FAILED):"disconnected"===a?(this._startWaitingReconnectTimer(),this.state=f.State.DISCONNECTED,b=e.SessionConnectionState.DISCONNECTED):"closed"===a&&(this.state=f.State.CLOSED,b=e.SessionConnectionState.CLOSED),b&&this.delegate._onSessionConnectionStateChangedListener(this.userID,b)}},f.prototype._clearWaitingReconnectTimer=function(){this.waitingReconnectTimeoutCallback&&(e.trace("_clearWaitingReconnectTimer"),clearTimeout(this.waitingReconnectTimeoutCallback),this.waitingReconnectTimeoutCallback=null)},f.prototype._startWaitingReconnectTimer=function(){var a=this,b=1e3*d.webrtc.disconnectTimeInterval,c=function(){e.trace("waitingReconnectTimeoutCallback"),clearTimeout(a.waitingReconnectTimeoutCallback),a.release(),a.delegate._closeSessionIfAllConnectionsClosed()};e.trace("_startWaitingReconnectTimer, timeout: "+b),a.waitingReconnectTimeoutCallback=setTimeout(c,b)},f.prototype._clearDialingTimer=function(){this.dialingTimer&&(e.trace("_clearDialingTimer"),clearInterval(this.dialingTimer),this.dialingTimer=null,this.answerTimeInterval=0)},f.prototype._startDialingTimer=function(a,b){var c=this,f=1e3*d.webrtc.dialingTimeInterval;e.trace("_startDialingTimer, dialingTimeInterval: "+f);var g=function(a,b,f){f||(c.answerTimeInterval+=1e3*d.webrtc.dialingTimeInterval),e.trace("_dialingCallback, answerTimeInterval: "+c.answerTimeInterval),c.answerTimeInterval>=1e3*d.webrtc.answerTimeInterval?(c._clearDialingTimer(),b&&c.delegate.processOnNotAnswer(c)):c.delegate.processCall(c,a)};c.dialingTimer=setInterval(g,f,a,b,!1),g(a,b,!0)},b.exports=f},{"../../qbConfig":15,"./qbWebRTCHelpers":10}],9:[function(a,b,c){function d(a,b){return d.__instance?d.__instance:this===window?new d:(d.__instance=this,this.connection=b,this.signalingProcessor=new h(a,this,b),this.signalingProvider=new i(a,b),this.SessionConnectionState=j.SessionConnectionState,this.CallType=j.CallType,this.PeerConnectionState=k.State,void(this.sessions={}))}function e(a,b){var c=!1,d=b.sort();return a.length&&a.forEach(function(a){var b=a.sort();c=b.length==d.length&&b.every(function(a,b){return a===d[b]})}),c}function f(a){var b=[];return Object.keys(a).length>0&&Object.keys(a).forEach(function(c,d,e){var f=a[c];(f.state===g.State.NEW||f.state===g.State.ACTIVE)&&b.push(f.opponentsIDs)}),b}var g=a("./qbWebRTCSession"),h=a("./qbWebRTCSignalingProcessor"),i=a("./qbWebRTCSignalingProvider"),j=a("./qbWebRTCHelpers"),k=a("./qbRTCPeerConnection"),l=a("./qbWebRTCSignalingConstants");d.prototype.sessions={},d.prototype.createNewSession=function(a,b,c){var d=f(this.sessions),g=c||j.getIdFromNode(this.connection.jid),h=!1,i=b||2;if(!a)throw new Error("Can't create a session without the opponentsIDs.");if(h=e(d,a))throw new Error("Can't create a session with the same opponentsIDs. There is a session already in NEW or ACTIVE state.");return this._createAndStoreSession(null,g,a,i)},d.prototype._createAndStoreSession=function(a,b,c,d){var e=new g(a,b,c,d,this.signalingProvider,j.getIdFromNode(this.connection.jid));return e.onUserNotAnswerListener=this.onUserNotAnswerListener,e.onRemoteStreamListener=this.onRemoteStreamListener,e.onSessionConnectionStateChangedListener=this.onSessionConnectionStateChangedListener,e.onSessionCloseListener=this.onSessionCloseListener,this.sessions[e.ID]=e,e},d.prototype.clearSession=function(a){delete d.sessions[a]},d.prototype.isExistNewOrActiveSessionExceptSessionID=function(a){var b=this,c=!1;return Object.keys(b.sessions).length>0&&Object.keys(b.sessions).forEach(function(d,e,f){var h=b.sessions[d];(h.state===g.State.NEW||h.state===g.State.ACTIVE)&&h.ID!==a&&(c=!0)}),c},d.prototype._onCallListener=function(a,b,c){if(j.trace("onCall. UserID:"+a+". SessionID: "+b),this.isExistNewOrActiveSessionExceptSessionID(b))j.trace("User with id "+a+" is busy at the moment."),delete c.sdp,delete c.platform,c.sessionID=b,this.signalingProvider.sendMessage(a,c,l.SignalingType.REJECT);else{var d=this.sessions[b];if(!d){d=this._createAndStoreSession(b,c.callerID,c.opponentsIDs,c.callType);var e=JSON.parse(JSON.stringify(c));this._cleanupExtension(e),"function"==typeof this.onCallListener&&this.onCallListener(d,e)}d.processOnCall(a,c)}},d.prototype._onAcceptListener=function(a,b,c){var d=this.sessions[b];if(j.trace("onAccept. UserID:"+a+". SessionID: "+b),d)if(d.state===g.State.ACTIVE){var e=JSON.parse(JSON.stringify(c));this._cleanupExtension(e),"function"==typeof this.onAcceptCallListener&&this.onAcceptCallListener(d,a,e),d.processOnAccept(a,c)}else j.traceWarning("Ignore 'onAccept', the session( "+b+" ) has invalid state.");else j.traceError("Ignore 'onAccept', there is no information about session "+b+" by some reason.")},d.prototype._onRejectListener=function(a,b,c){var d=this.sessions[b];if(j.trace("onReject. UserID:"+a+". SessionID: "+b),d){var e=JSON.parse(JSON.stringify(c));this._cleanupExtension(e),"function"==typeof this.onRejectCallListener&&this.onRejectCallListener(d,a,e),d.processOnReject(a,c)}else j.traceError("Ignore 'onReject', there is no information about session "+b+" by some reason.")},d.prototype._onStopListener=function(a,b,c){j.trace("onStop. UserID:"+a+". SessionID: "+b);var d=this.sessions[b],e=JSON.parse(JSON.stringify(c));!d||d.state!==g.State.ACTIVE&&d.state!==g.State.NEW?j.traceError("Ignore 'onStop', there is no information about session "+b+" by some reason."):(this._cleanupExtension(e),"function"==typeof this.onStopCallListener&&this.onStopCallListener(d,a,e),d.processOnStop(a,c))},d.prototype._onIceCandidatesListener=function(a,b,c){var d=this.sessions[b];j.trace("onIceCandidates. UserID:"+a+". SessionID: "+b+". ICE candidates count: "+c.iceCandidates.length),d?d.state===g.State.ACTIVE?d.processOnIceCandidates(a,c):j.traceWarning("Ignore 'OnIceCandidates', the session ( "+b+" ) has invalid state."):j.traceError("Ignore 'OnIceCandidates', there is no information about session "+b+" by some reason.")},d.prototype._onUpdateListener=function(a,b,c){var d=this.sessions[b];j.trace("onUpdate. UserID:"+a+". SessionID: "+b+". Extension: "+JSON.stringify(c)),"function"==typeof this.onUpdateCallListener&&this.onUpdateCallListener(d,a,c)},d.prototype._cleanupExtension=function(a){delete a.platform,delete a.sdp,delete a.opponentsIDs,delete a.callerID,delete a.callType},b.exports=d},{"./qbRTCPeerConnection":8,"./qbWebRTCHelpers":10,"./qbWebRTCSession":11,"./qbWebRTCSignalingConstants":12,"./qbWebRTCSignalingProcessor":13,"./qbWebRTCSignalingProvider":14}],10:[function(a,b,c){var d=a("../../qbConfig"),e=a("../../../lib/download/download.min"),f={};f={getUserJid:function(a,b){return a+"-"+b+"@"+d.endpoints.chat},getIdFromNode:function(a){return a.indexOf("@")<0?null:parseInt(a.split("@")[0].split("-")[0])},trace:function(a){d.debug&&console.log("[QBWebRTC]:",a)},traceWarning:function(a){d.debug&&console.warn("[QBWebRTC]:",a)},traceError:function(a){d.debug&&console.error("[QBWebRTC]:",a)},getLocalTime:function(){var a=(new Date).toString().split(" ");return a.slice(1,5).join("-")},dataURItoBlob:function(a,b){for(var c=[],d=window.atob(a.split(",")[1]),e=0,f=d.length;f>e;e++)c.push(d.charCodeAt(e));return new Blob([new Uint8Array(c)],{type:b})}},f.SessionConnectionState={UNDEFINED:0,CONNECTING:1,CONNECTED:2,FAILED:3,DISCONNECTED:4,CLOSED:5,COMPLETED:6},f.CallType={VIDEO:1,AUDIO:2},Blob.prototype.download=function(){e(this,this.name,this.type)},b.exports=f},{"../../../lib/download/download.min":20,"../../qbConfig":15}],11:[function(a,b,c){function d(a,b,c,f,g,h){this.ID=a?a:e(),this.state=d.State.NEW,this.initiatorID=parseInt(b),this.opponentsIDs=c,this.callType=parseInt(f),this.peerConnections={},this.localStream=null,this.signalingProvider=g,this.currentUserID=h,this.answerTimer=null,this.startCallTime=0,this.acceptCallTime=0}function e(){var a=(new Date).getTime(),b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(b){var c=(a+16*Math.random())%16|0;return a=Math.floor(a/16),("x"==b?c:3&c|8).toString(16)});return b}function f(a){try{return JSON.parse(JSON.stringify(a).replace(/null/g,'""'))}catch(b){return{}}}function g(a){var b=JSON.parse(JSON.stringify(a));return Object.keys(b).forEach(function(a,c,d){b[c].hasOwnProperty("url")?b[c].urls=b[c].url:b[c].url=b[c].urls}),b}var h=a("../../qbConfig"),i=a("./qbRTCPeerConnection"),j=a("../../qbUtils"),k=a("./qbWebRTCHelpers"),l=a("./qbWebRTCSignalingConstants");d.State={NEW:1,ACTIVE:2,HUNGUP:3,REJECTED:4,CLOSED:5},d.prototype.getUserMedia=function(a,b){var c=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia;if(!c)throw new Error("getUserMedia() is not supported in your browser");c=c.bind(navigator);var d=this;c({audio:a.audio||!1,video:a.video||!1},function(c){d.localStream=c,a.elemId&&d.attachMediaStream(a.elemId,c,a.options),b(null,c)},function(a){b(a,null)})},d.prototype.attachMediaStream=function(a,b,c){var d=document.getElementById(a);if(!d)throw new Error("Unable to attach media stream, element "+a+" is undefined");var e=window.URL||window.webkitURL;d.src=e.createObjectURL(b),c&&c.muted&&(d.muted=!0),c&&c.mirror&&(d.style.webkitTransform="scaleX(-1)",d.style.transform="scaleX(-1)"),d.play()},d.prototype.connectionStateForUser=function(a){var b=this.peerConnections[a];return b?b.state:null},d.prototype.detachMediaStream=function(a){var b=document.getElementById(a);b&&(b.pause(),b.src="")},d.prototype.call=function(a,b){var c=this,e=f(a),g=window.navigator.onLine,h=null;k.trace("Call, extension: "+JSON.stringify(e)),g?(c.state=d.State.ACTIVE,c.opponentsIDs.forEach(function(a,b,d){c._callInternal(a,e,!0)})):(c.state=d.State.CLOSED,h=j.getError(408,"Call.ERROR - ERR_INTERNET_DISCONNECTED")),"function"==typeof b&&b(h)},d.prototype._callInternal=function(a,b,c){var d=this._createPeer(a,"offer");d.addLocalStream(this.localStream),this.peerConnections[a]=d,d.getAndSetLocalSessionDescription(function(a){a?k.trace("getAndSetLocalSessionDescription error: "+a):(k.trace("getAndSetLocalSessionDescription success"),d._startDialingTimer(b,c))})},d.prototype.accept=function(a){var b=this,c=f(a);if(k.trace("Accept, extension: "+JSON.stringify(c)),b.state===d.State.ACTIVE)return void k.traceError("Can't accept, the session is already active, return.");if(b.state===d.State.CLOSED)return k.traceError("Can't accept, the session is already closed, return."),void b.stop({});b.state=d.State.ACTIVE,b.acceptCallTime=new Date,b._clearAnswerTimer(),b._acceptInternal(b.initiatorID,c);var e=b._uniqueOpponentsIDsWithoutInitiator();if(e.length>0){var g=(b.acceptCallTime-b.startCallTime)/1e3;b._startWaitingOfferOrAnswerTimer(g),e.forEach(function(a,c,d){b.currentUserID>a&&b._callInternal(a,{},!0)})}},d.prototype._acceptInternal=function(a,b){var c=this,d=this.peerConnections[a];d?(d.addLocalStream(this.localStream),d.setRemoteSessionDescription("offer",d.getRemoteSDP(),function(e){e?k.traceError("'setRemoteSessionDescription' error: "+e):(k.trace("'setRemoteSessionDescription' success"),d.getAndSetLocalSessionDescription(function(e){e?k.trace("getAndSetLocalSessionDescription error: "+e):(b.sessionID=c.ID,b.callType=c.callType,b.callerID=c.initiatorID,b.opponentsIDs=c.opponentsIDs,b.sdp=d.localDescription.sdp,c.signalingProvider.sendMessage(a,b,l.SignalingType.ACCEPT))}))})):k.traceError("Can't accept the call, there is no information about peer connection by some reason.")},d.prototype.reject=function(a){var b=this,c=f(a),e=Object.keys(b.peerConnections).length;if(k.trace("Reject, extension: "+JSON.stringify(c)),b.state=d.State.REJECTED,b._clearAnswerTimer(),c.sessionID=b.ID,c.callType=b.callType,c.callerID=b.initiatorID,c.opponentsIDs=b.opponentsIDs,e>0)for(var g in b.peerConnections){var h=b.peerConnections[g];b.signalingProvider.sendMessage(h.userID,c,l.SignalingType.REJECT)}b._close()},d.prototype.stop=function(a){var b=this,c=f(a),e=Object.keys(b.peerConnections).length;if(k.trace("Stop, extension: "+JSON.stringify(c)),b.state=d.State.HUNGUP,b._clearAnswerTimer(),c.sessionID=b.ID,c.callType=b.callType,c.callerID=b.initiatorID,c.opponentsIDs=b.opponentsIDs,e>0)for(var g in b.peerConnections){var h=b.peerConnections[g];b.signalingProvider.sendMessage(h.userID,c,l.SignalingType.STOP)}b._close()},d.prototype.update=function(a){var b=this,c={};if(k.trace("Update, extension: "+JSON.stringify(a)),null==a)return void k.trace("extension is null, no parameters to update");c=f(a),c.sessionID=this.ID;for(var d in b.peerConnections){var e=b.peerConnections[d];b.signalingProvider.sendMessage(e.userID,c,l.SignalingType.PARAMETERS_CHANGED)}},d.prototype.mute=function(a){this._muteStream(0,a)},d.prototype.unmute=function(a){this._muteStream(1,a)},d.snapshot=function(a){var b,c,d=document.getElementById(a),e=document.createElement("canvas"),f=e.getContext("2d");return d?(e.width=d.clientWidth,e.height=d.clientHeight,"scaleX(-1)"===d.style.transform&&(f.translate(e.width,0),f.scale(-1,1)),f.drawImage(d,0,0,d.clientWidth,d.clientHeight),b=e.toDataURL(),c=k.dataURItoBlob(b,"image/png"),c.name="snapshot_"+getLocalTime()+".png",c.url=b,c):void 0},d.filter=function(a,b){var c=document.getElementById(a);c&&(c.style.webkitFilter=b,c.style.filter=b)},d.prototype.processOnCall=function(a,b){var c=this,e=c._uniqueOpponentsIDs();e.forEach(function(e,f,g){var h=c.peerConnections[e];if(h)e==a&&(h.updateRemoteSDP(b.sdp),a!=c.initiatorID&&c.state===d.State.ACTIVE&&c._acceptInternal(a,{}));else{var i;i=e!=a&&c.currentUserID>e?c._createPeer(e,"offer"):c._createPeer(e,"answer"),c.peerConnections[e]=i,e==a&&(i.updateRemoteSDP(b.sdp),c._startAnswerTimer())}})},d.prototype.processOnAccept=function(a,b){var c=this.peerConnections[a];c?(c._clearDialingTimer(),c.setRemoteSessionDescription("answer",b.sdp,function(a){a?k.traceError("'setRemoteSessionDescription' error: "+a):k.trace("'setRemoteSessionDescription' success")})):k.traceError("Ignore 'OnAccept', there is no information about peer connection by some reason.")},d.prototype.processOnReject=function(a,b){var c=this.peerConnections[a];this._clearWaitingOfferOrAnswerTimer(),c?c.release():k.traceError("Ignore 'OnReject', there is no information about peer connection by some reason."),this._closeSessionIfAllConnectionsClosed()},d.prototype.processOnStop=function(a,b){var c=this;if(this._clearAnswerTimer(),a===c.initiatorID)Object.keys(c.peerConnections).length?Object.keys(c.peerConnections).forEach(function(a){c.peerConnections[a].release()}):k.traceError("Ignore 'OnStop', there is no information about peer connections by some reason.");else{var d=c.peerConnections[a];d?d.release():k.traceError("Ignore 'OnStop', there is no information about peer connection by some reason.")}this._closeSessionIfAllConnectionsClosed()},d.prototype.processOnIceCandidates=function(a,b){var c=this.peerConnections[a];c?c.addCandidates(b.iceCandidates):k.traceError("Ignore 'OnIceCandidates', there is no information about peer connection by some reason.")},d.prototype.processCall=function(a,b){var b=b||{};b.sessionID=this.ID,b.callType=this.callType,b.callerID=this.initiatorID,b.opponentsIDs=this.opponentsIDs,b.sdp=a.localDescription.sdp,this.signalingProvider.sendMessage(a.userID,b,l.SignalingType.CALL)},d.prototype.processIceCandidates=function(a,b){var c={};c.sessionID=this.ID,c.callType=this.callType,c.callerID=this.initiatorID,c.opponentsIDs=this.opponentsIDs,this.signalingProvider.sendCandidate(a.userID,b,c)},d.prototype.processOnNotAnswer=function(a){k.trace("Answer timeout callback for session "+this.ID+" for user "+a.userID),this._clearWaitingOfferOrAnswerTimer(),a.release(),"function"==typeof this.onUserNotAnswerListener&&this.onUserNotAnswerListener(this,a.userID),this._closeSessionIfAllConnectionsClosed()},d.prototype._onRemoteStreamListener=function(a,b){"function"==typeof this.onRemoteStreamListener&&this.onRemoteStreamListener(this,a,b)},d.prototype._onSessionConnectionStateChangedListener=function(a,b){var c=this;"function"==typeof c.onSessionConnectionStateChangedListener&&c.onSessionConnectionStateChangedListener(c,a,b)},d.prototype._createPeer=function(a,b){if(!i)throw new Error("_createPeer error: RTCPeerConnection() is not supported in your browser");this.startCallTime=new Date;var c={iceServers:g(h.webrtc.iceServers)};k.trace("_createPeer, iceServers: "+JSON.stringify(c));var d=new i(c);return d.init(this,a,this.ID,b),d},d.prototype._close=function(){k.trace("_close");for(var a in this.peerConnections){var b=this.peerConnections[a];b.release()}this._closeLocalMediaStream(),this.state=d.State.CLOSED,"function"==typeof this.onSessionCloseListener&&this.onSessionCloseListener(this)},d.prototype._closeSessionIfAllConnectionsClosed=function(){var a=!0;for(var b in this.peerConnections){var c=this.peerConnections[b];if("closed"!==c.signalingState){a=!1;break}}k.trace("All peer connections closed: "+a),a&&(this._closeLocalMediaStream(),"function"==typeof this.onSessionCloseListener&&this.onSessionCloseListener(this),this.state=d.State.CLOSED)},d.prototype._closeLocalMediaStream=function(){this.localStream&&(this.localStream.getAudioTracks().forEach(function(a){a.stop()}),this.localStream.getVideoTracks().forEach(function(a){a.stop()}),this.localStream=null)},d.prototype._muteStream=function(a,b){return"audio"===b&&this.localStream.getAudioTracks().length>0?void this.localStream.getAudioTracks().forEach(function(b){b.enabled=!!a}):"video"===b&&this.localStream.getVideoTracks().length>0?void this.localStream.getVideoTracks().forEach(function(b){b.enabled=!!a}):void 0},d.prototype._clearAnswerTimer=function(){this.answerTimer&&(k.trace("_clearAnswerTimer"),clearTimeout(this.answerTimer),this.answerTimer=null)},d.prototype._startAnswerTimer=function(){k.trace("_startAnswerTimer");var a=this,b=function(){k.trace("_answerTimeoutCallback"),"function"==typeof a.onSessionCloseListener&&a._close(),a.answerTimer=null},c=1e3*h.webrtc.answerTimeInterval;this.answerTimer=setTimeout(b,c)},d.prototype._clearWaitingOfferOrAnswerTimer=function(){this.waitingOfferOrAnswerTimer&&(k.trace("_clearWaitingOfferOrAnswerTimer"),clearTimeout(this.waitingOfferOrAnswerTimer),this.waitingOfferOrAnswerTimer=null)},d.prototype._startWaitingOfferOrAnswerTimer=function(a){var b=this,c=h.webrtc.answerTimeInterval-a<0?1:h.webrtc.answerTimeInterval-a,d=function(){k.trace("waitingOfferOrAnswerTimeoutCallback"),Object.keys(b.peerConnections).length>0&&Object.keys(b.peerConnections).forEach(function(a){var c=b.peerConnections[a];(c.state===i.State.CONNECTING||c.state===i.State.NEW)&&b.processOnNotAnswer(c)}),b.waitingOfferOrAnswerTimer=null};k.trace("_startWaitingOfferOrAnswerTimer, timeout: "+c),this.waitingOfferOrAnswerTimer=setTimeout(d,1e3*c)},d.prototype._uniqueOpponentsIDs=function(){var a=this,b=[];return this.initiatorID!==this.currentUserID&&b.push(this.initiatorID),this.opponentsIDs.forEach(function(c,d,e){c!=a.currentUserID&&b.push(parseInt(c))}),b},d.prototype._uniqueOpponentsIDsWithoutInitiator=function(){var a=this,b=[];return this.opponentsIDs.forEach(function(c,d,e){c!=a.currentUserID&&b.push(parseInt(c))}),b},d.prototype.toString=function(){return"ID: "+this.ID+", initiatorID: "+this.initiatorID+", opponentsIDs: "+this.opponentsIDs+", state: "+this.state+", callType: "+this.callType},b.exports=d},{"../../qbConfig":15,"../../qbUtils":19,"./qbRTCPeerConnection":8,"./qbWebRTCHelpers":10,"./qbWebRTCSignalingConstants":12}],12:[function(a,b,c){function d(){}d.MODULE_ID="WebRTCVideoChat",d.SignalingType={CALL:"call",ACCEPT:"accept",REJECT:"reject",STOP:"hangUp",CANDIDATE:"iceCandidates",PARAMETERS_CHANGED:"update"},b.exports=d},{}],13:[function(a,b,c){function d(a,b,c){var d=this;d.service=a,d.delegate=b,d.connection=c,this._onMessage=function(a){var b=a.getAttribute("from"),c=a.querySelector("extraParams"),g=a.querySelector("delay"),h=e.getIdFromNode(b),i=d._getExtension(c);if(g||i.moduleIdentifier!==f.MODULE_ID)return!0;var j=i.sessionID,k=i.signalType;switch(delete i.moduleIdentifier,delete i.sessionID,delete i.signalType,k){case f.SignalingType.CALL:"function"==typeof d.delegate._onCallListener&&d.delegate._onCallListener(h,j,i);break;case f.SignalingType.ACCEPT:"function"==typeof d.delegate._onAcceptListener&&d.delegate._onAcceptListener(h,j,i);break;case f.SignalingType.REJECT:"function"==typeof d.delegate._onRejectListener&&d.delegate._onRejectListener(h,j,i);break;case f.SignalingType.STOP:"function"==typeof d.delegate._onStopListener&&d.delegate._onStopListener(h,j,i);break;case f.SignalingType.CANDIDATE:"function"==typeof d.delegate._onIceCandidatesListener&&d.delegate._onIceCandidatesListener(h,j,i);break;case f.SignalingType.PARAMETERS_CHANGED:"function"==typeof d.delegate._onUpdateListener&&d.delegate._onUpdateListener(h,j,i)}return!0},this._getExtension=function(a){if(!a)return null;for(var b,c,e,f,g={},h=[],i=[],j=0,k=a.childNodes.length;k>j;j++)if("iceCandidates"===a.childNodes[j].tagName){e=a.childNodes[j].childNodes;for(var l=0,m=e.length;m>l;l++){b={},f=e[l].childNodes;for(var n=0,o=f.length;o>n;n++)b[f[n].tagName]=f[n].textContent;h.push(b)}}else if("opponentsIDs"===a.childNodes[j].tagName){e=a.childNodes[j].childNodes;for(var p=0,q=e.length;q>p;p++)c=e[p].textContent,i.push(parseInt(c))}else if(a.childNodes[j].childNodes.length>1){var r=a.childNodes[j].textContent.length;if(r>4096){for(var s="",t=0;t<a.childNodes[j].childNodes.length;++t)s+=a.childNodes[j].childNodes[t].textContent;g[a.childNodes[j].tagName]=s}else g=d._XMLtoJS(g,a.childNodes[j].tagName,a.childNodes[j])}else g[a.childNodes[j].tagName]=a.childNodes[j].textContent;return h.length>0&&(g.iceCandidates=h),i.length>0&&(g.opponentsIDs=i),g},this._XMLtoJS=function(a,b,c){var d=this;a[b]={};for(var e=0,f=c.childNodes.length;f>e;e++)c.childNodes[e].childNodes.length>1?a[b]=d._XMLtoJS(a[b],c.childNodes[e].tagName,c.childNodes[e]):a[b][c.childNodes[e].tagName]=c.childNodes[e].textContent;return a}}a("../../../lib/strophe/strophe.min");var e=a("./qbWebRTCHelpers"),f=a("./qbWebRTCSignalingConstants");b.exports=d},{"../../../lib/strophe/strophe.min":21,"./qbWebRTCHelpers":10,"./qbWebRTCSignalingConstants":12}],14:[function(a,b,c){function d(a,b){this.service=a,this.connection=b}a("../../../lib/strophe/strophe.min");var e=a("./qbWebRTCHelpers"),f=a("./qbWebRTCSignalingConstants"),g=a("../../qbUtils"),h=a("../../qbConfig");d.prototype.sendCandidate=function(a,b,c){var d=c||{};d.iceCandidates=b,this.sendMessage(a,d,f.SignalingType.CANDIDATE)},d.prototype.sendMessage=function(a,b,c){var d,i,j=b||{},k=this;j.moduleIdentifier=f.MODULE_ID,j.signalType=c,j.platform="web",i={to:e.getUserJid(a,h.creds.appId),type:"headline",id:g.getBsonObjectId()},d=$msg(i).c("extraParams",{xmlns:Strophe.NS.CLIENT}),Object.keys(j).forEach(function(a){"iceCandidates"===a?(d=d.c("iceCandidates"),j[a].forEach(function(a){d=d.c("iceCandidate"),Object.keys(a).forEach(function(b){d.c(b).t(a[b]).up()}),d.up()}),d.up()):"opponentsIDs"===a?(d=d.c("opponentsIDs"),j[a].forEach(function(a){d=d.c("opponentID").t(a).up()}),d.up()):"object"==typeof j[a]?k._JStoXML(a,j[a],d):d.c(a).t(j[a]).up()}),this.connection.send(d)},d.prototype._JStoXML=function(a,b,c){var d=this;c.c(a),Object.keys(b).forEach(function(a){"object"==typeof b[a]?d._JStoXML(a,b[a],c):c.c(a).t(b[a]).up()}),c.up()},b.exports=d},{"../../../lib/strophe/strophe.min":21,"../../qbConfig":15,"../../qbUtils":19,"./qbWebRTCHelpers":10,"./qbWebRTCSignalingConstants":12}],15:[function(a,b,c){var d={version:"2.0.1",creds:{appId:"",authKey:"",authSecret:""},endpoints:{api:"api.quickblox.com",chat:"chat.quickblox.com",muc:"muc.chat.quickblox.com"},chatProtocol:{bosh:"https://chat.quickblox.com:5281",websocket:"wss://chat.quickblox.com:5291",active:2},webrtc:{answerTimeInterval:60,dialingTimeInterval:5,disconnectTimeInterval:30,iceServers:[{url:"stun:stun.l.google.com:19302"},{url:"stun:turn.quickblox.com",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turn.quickblox.com:3478?transport=udp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turn.quickblox.com:3478?transport=tcp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"}]},urls:{session:"session",login:"login",users:"users",chat:"chat",blobs:"blobs",geodata:"geodata",pushtokens:"push_tokens",subscriptions:"subscriptions",events:"events",data:"data",type:".json"},on:{sessionExpired:null},timeout:null,debug:{mode:0,file:null},addISOTime:!1};d.set=function(a){"object"==typeof a.endpoints&&a.endpoints.chat&&(d.endpoints.muc="muc."+a.endpoints.chat,d.chatProtocol.bosh="https://"+a.endpoints.chat+":5281",d.chatProtocol.websocket="wss://"+a.endpoints.chat+":5291"),Object.keys(a).forEach(function(b){"set"!==b&&d.hasOwnProperty(b)&&("object"!=typeof a[b]?d[b]=a[b]:Object.keys(a[b]).forEach(function(c){d[b].hasOwnProperty(c)&&(d[b][c]=a[b][c])})),"iceServers"===b&&(d.webrtc.iceServers=a[b])})},b.exports=d},{}],16:[function(a,b,c){function d(){}var e=a("./qbConfig"),f=a("./qbUtils"),g="undefined"!=typeof window;d.prototype={init:function(b,c,d,h){h&&"object"==typeof h&&e.set(h);var i=a("./qbProxy");this.service=new i;var j=a("./modules/qbAuth"),k=a("./modules/qbUsers"),l=a("./modules/qbChat"),m=a("./modules/qbContent"),n=a("./modules/qbLocation"),o=a("./modules/qbPushNotifications"),p=a("./modules/qbData");if(g){var q=a("./qbStrophe"),r=new q;if(f.isWebRTCAvailble()){var s=a("./modules/webrtc/qbWebRTCClient");this.webrtc=new s(this.service,r||null)}else this.webrtc=!1}this.auth=new j(this.service),this.users=new k(this.service),this.chat=new l(this.service,this.webrtc.signalingProcessor||null,r||null),this.content=new m(this.service),this.location=new n(this.service),this.pushnotifications=new o(this.service),this.data=new p(this.service),"string"!=typeof b||c&&"number"!=typeof c||d?(e.creds.appId=b,e.creds.authKey=c,e.creds.authSecret=d):("number"==typeof c&&(e.creds.appId=c),this.service.setSession({token:b}))},getSession:function(a){this.auth.getSession(a)},createSession:function(a,b){this.auth.createSession(a,b)},destroySession:function(a){this.auth.destroySession(a)},login:function(a,b){this.auth.login(a,b)},logout:function(a){this.auth.logout(a)}};var h=new d;h.QuickBlox=d,b.exports=h},{"./modules/qbAuth":1,"./modules/qbChat":2,"./modules/qbContent":3,"./modules/qbData":4,"./modules/qbLocation":5,"./modules/qbPushNotifications":6,"./modules/qbUsers":7,"./modules/webrtc/qbWebRTCClient":9,"./qbConfig":15,"./qbProxy":17,"./qbStrophe":18,"./qbUtils":19}],17:[function(a,b,c){function d(){this.qbInst={config:e,session:null}}var e=a("./qbConfig"),f=a("./qbUtils"),g=e.version,h="undefined"!=typeof window;if(!h)var i=a("request");var j=h&&window.jQuery&&window.jQuery.ajax||h&&window.Zepto&&window.Zepto.ajax;if(h&&!j)throw new Error("Quickblox requires jQuery or Zepto");d.prototype={setSession:function(a){this.qbInst.session=a},getSession:function(){return this.qbInst.session},handleResponse:function(a,b,c,d){!a||"function"!=typeof e.on.sessionExpired||"Unauthorized"!==a.message&&"401 Unauthorized"!==a.status?a?c(a,null):(e.addISOTime&&(b=f.injectISOTimes(b)),c(null,b)):e.on.sessionExpired(function(){c(a,b)},d)},ajax:function(a,b){var c;a.data&&a.data.file?(c=JSON.parse(JSON.stringify(a)),c.data.file="..."):c=a,f.QBLog("[ServiceProxy]","Request: ",a.type||"GET",{data:JSON.stringify(c)});var d=this,k=function(c){c&&d.setSession(c),d.ajax(a,b)},l={url:a.url,type:a.type||"GET",dataType:a.dataType||"json",data:a.data||" ",timeout:e.timeout,beforeSend:function(a,b){-1===b.url.indexOf("s3.amazonaws.com")&&d.qbInst.session&&d.qbInst.session.token&&(a.setRequestHeader("QB-Token",d.qbInst.session.token),a.setRequestHeader("QB-SDK","JS "+g+" - Client"))},success:function(c,g,h){f.QBLog("[ServiceProxy]","Response: ",{data:JSON.stringify(c)}),-1===a.url.indexOf(e.urls.session)?d.handleResponse(null,c,b,k):b(null,c)},error:function(c,g,h){f.QBLog("[ServiceProxy]","ajax error",c.status,h,c.responseText);var i={code:c.status,status:g,message:h,detail:c.responseText};-1===a.url.indexOf(e.urls.session)?d.handleResponse(i,null,b,k):b(i,null)}};if(!h)var m="json"===l.dataType,n=-1===a.url.indexOf("s3.amazonaws.com")&&d.qbInst&&d.qbInst.session&&d.qbInst.session.token||!1,o={url:l.url,method:l.type,timeout:e.timeout,json:m?l.data:null,headers:n?{"QB-Token":d.qbInst.session.token,"QB-SDK":"JS "+g+" - Server"}:null},p=function(a,c,f){if(a||200!==c.statusCode&&201!==c.statusCode&&202!==c.statusCode){var g;try{g={code:c&&c.statusCode||a&&a.code,status:c&&c.headers&&c.headers.status||"error",message:f||a&&a.errno,detail:f&&f.errors||a&&a.syscall}}catch(h){g=a}-1===o.url.indexOf(e.urls.session)?d.handleResponse(g,null,b,k):b(g,null)}else-1===o.url.indexOf(e.urls.session)?d.handleResponse(null,f,b,k):b(null,f)};if(("boolean"==typeof a.contentType||"string"==typeof a.contentType)&&(l.contentType=a.contentType),"boolean"==typeof a.processData&&(l.processData=a.processData),h)j(l);else{var q=i(o,p);if(!m){var r=q.form();Object.keys(l.data).forEach(function(a,b,c){r.append(a,l.data[a])})}}}},b.exports=d},{"./qbConfig":15,"./qbUtils":19,request:26}],18:[function(a,b,c){function d(){var a=1===e.chatProtocol.active?e.chatProtocol.bosh:e.chatProtocol.websocket,b=new Strophe.Connection(a);return 1===e.chatProtocol.active?(b.xmlInput=function(a){
if(a.childNodes[0])for(var b=0,c=a.childNodes.length;c>b;b++)f.QBLog("[QBChat]","RECV:",a.childNodes[b])},b.xmlOutput=function(a){if(a.childNodes[0])for(var b=0,c=a.childNodes.length;c>b;b++)f.QBLog("[QBChat]","SENT:",a.childNodes[b])}):(b.xmlInput=function(a){f.QBLog("[QBChat]","RECV:",a)},b.xmlOutput=function(a){f.QBLog("[QBChat]","SENT:",a)}),b}a("../lib/strophe/strophe.min");var e=a("./qbConfig"),f=a("./qbUtils");b.exports=d},{"../lib/strophe/strophe.min":21,"./qbConfig":15,"./qbUtils":19}],19:[function(a,b,c){var d=a("./qbConfig"),e="undefined"!=typeof window,f="This function isn't supported outside of the browser (...yet)";if(!e)var g=a("fs");var h={machine:Math.floor(16777216*Math.random()).toString(16),pid:Math.floor(32767*Math.random()).toString(16),increment:0},i={safeCallbackCall:function(){if(!e)throw f;for(var a,b=arguments[0].toString(),c=b.split("(")[0].split(" ")[1],d=[],g=0;g<arguments.length;g++)d.push(arguments[g]);a=d.shift();try{a.apply(null,d)}catch(h){""===c?console.error("Error: "+h):console.error("Error in listener "+c+": "+h)}},randomNonce:function(){return Math.floor(1e4*Math.random())},unixTime:function(){return Math.floor(Date.now()/1e3)},getUrl:function(a,b){var c=b?"/"+b:"";return"https://"+d.endpoints.api+"/"+a+c+d.urls.type},getBsonObjectId:function(){var a=this.unixTime().toString(16),b=(h.increment++).toString(16);return b>16777215&&(h.increment=0),"00000000".substr(0,8-a.length)+a+"000000".substr(0,6-h.machine.length)+h.machine+"0000".substr(0,4-h.pid.length)+h.pid+"000000".substr(0,6-b.length)+b},injectISOTimes:function(a){if(a.created_at)"number"==typeof a.created_at&&(a.iso_created_at=new Date(1e3*a.created_at).toISOString()),"number"==typeof a.updated_at&&(a.iso_updated_at=new Date(1e3*a.updated_at).toISOString());else if(a.items)for(var b=0,c=a.items.length;c>b;++b)"number"==typeof a.items[b].created_at&&(a.items[b].iso_created_at=new Date(1e3*a.items[b].created_at).toISOString()),"number"==typeof a.items[b].updated_at&&(a.items[b].iso_updated_at=new Date(1e3*a.items[b].updated_at).toISOString());return a},QBLog:function(){if(this.loggers)for(var a=0;a<this.loggers.length;++a)this.loggers[a](arguments);else{this.loggers=[];var b=function(){var a=function(a){console.log.apply(console,Array.prototype.slice.call(a))};return a},c=function(){var a=function(a){if(e)throw f;for(var b=[],c=0;c<a.length;c++)b.push(JSON.stringify(a[c]));b=b.join(" ");var h="\n"+new Date+". "+b;g.appendFile(d.debug.file,h,function(a){return a?console.error("Error while writing log to file. Error: "+a):void 0})};return a};if("object"==typeof d.debug){if("number"==typeof d.debug.mode){if(1==d.debug.mode){var h=b();this.loggers.push(h)}else if(2==d.debug.mode){var h=c();this.loggers.push(h)}}else if("object"==typeof d.debug.mode){var i=this;d.debug.mode.forEach(function(a,d,e){if(1===a){var f=b();i.loggers.push(f)}else if(2===a){var f=c();i.loggers.push(f)}})}}else if("boolean"==typeof d.debug&&d.debug){var h=b();this.loggers.push(h)}if(this.loggers)for(var a=0;a<this.loggers.length;++a)this.loggers[a](arguments)}},isWebRTCAvailble:function(){var a=window.mozRTCPeerConnection||window.webkitRTCPeerConnection,b=window.mozRTCIceCandidate||window.RTCIceCandidate,c=window.mozRTCSessionDescription||window.RTCSessionDescription,d=!0;return a&&b&&c||(d=!1),d},getError:function(a,b,c){var d={code:a,status:"error",detail:b};switch(a){case 401:d.message="Unauthorized";break;case 403:d.message="Forbidden";break;case 408:d.message="Request Timeout";break;case 422:d.message="Unprocessable Entity";break;case 502:d.message="Bad Gateway";break;default:d.message="Unknown error"}return this.QBLog("["+c+"]","error: ",b),d}};b.exports=i},{"./qbConfig":15,fs:26}],20:[function(a,b,c){function d(a,b,c){function d(a){var b=a.split(/[:;,]/),c=b[1],d="base64"==b[2]?atob:decodeURIComponent,e=d(b.pop()),f=e.length,g=0,h=new Uint8Array(f);for(g;f>g;++g)h[g]=e.charCodeAt(g);return new m([h],{type:c})}function e(a,b){if("download"in k)return k.href=a,k.setAttribute("download",p),k.innerHTML="downloading...",j.body.appendChild(k),setTimeout(function(){k.click(),j.body.removeChild(k),b===!0&&setTimeout(function(){f.URL.revokeObjectURL(k.href)},250)},66),!0;if("undefined"!=typeof safari)return a="data:"+a.replace(/^data:([\w\/\-\+]+)/,g),window.open(a)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=a),!0;var c=j.createElement("iframe");j.body.appendChild(c),b||(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,g)),c.src=a,setTimeout(function(){j.body.removeChild(c)},333)}var f=window,g="application/octet-stream",h=c||g,i=a,j=document,k=j.createElement("a"),l=function(a){return String(a)},m=f.Blob||f.MozBlob||f.WebKitBlob||l;m=m.call?m.bind(f):Blob;var n,o,p=b||"download";if("true"===String(this)&&(i=[i,h],h=i[0],i=i[1]),String(i).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?navigator.msSaveBlob(d(i),p):e(i);if(n=i instanceof m?i:new m([i],{type:h}),navigator.msSaveBlob)return navigator.msSaveBlob(n,p);if(f.URL)e(f.URL.createObjectURL(n),!0);else{if("string"==typeof n||n.constructor===l)try{return e("data:"+h+";base64,"+f.btoa(n))}catch(q){return e("data:"+h+","+encodeURIComponent(n))}o=new FileReader,o.onload=function(){e(this.result)},o.readAsDataURL(n)}return!0}b.exports=d},{}],21:[function(b,c,d){!function(b){return function(b,c){"function"==typeof a&&a.amd?a("strophe-base64",function(){return c()}):b.Base64=c()}(this,function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b={encode:function(b){var c,d,e,f,g,h,i,j="",k=0;do c=b.charCodeAt(k++),d=b.charCodeAt(k++),e=b.charCodeAt(k++),f=c>>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?(g=(3&c)<<4,h=i=64):isNaN(e)&&(i=64),j=j+a.charAt(f)+a.charAt(g)+a.charAt(h)+a.charAt(i);while(k<b.length);return j},decode:function(b){var c,d,e,f,g,h,i,j="",k=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do f=a.indexOf(b.charAt(k++)),g=a.indexOf(b.charAt(k++)),h=a.indexOf(b.charAt(k++)),i=a.indexOf(b.charAt(k++)),c=f<<2|g>>4,d=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(c),64!=h&&(j+=String.fromCharCode(d)),64!=i&&(j+=String.fromCharCode(e));while(k<b.length);return j}};return b}),function(b,c){"function"==typeof a&&a.amd?a("strophe-sha1",function(){return c()}):b.SHA1=c()}(this,function(){function a(a,d){a[d>>5]|=128<<24-d%32,a[(d+64>>9<<4)+15]=d;var g,h,i,j,k,l,m,n,o=new Array(80),p=1732584193,q=-271733879,r=-1732584194,s=271733878,t=-1009589776;for(g=0;g<a.length;g+=16){for(j=p,k=q,l=r,m=s,n=t,h=0;80>h;h++)16>h?o[h]=a[g+h]:o[h]=f(o[h-3]^o[h-8]^o[h-14]^o[h-16],1),i=e(e(f(p,5),b(h,q,r,s)),e(e(t,o[h]),c(h))),t=s,s=r,r=f(q,30),q=p,p=i;p=e(p,j),q=e(q,k),r=e(r,l),s=e(s,m),t=e(t,n)}return[p,q,r,s,t]}function b(a,b,c,d){return 20>a?b&c|~b&d:40>a?b^c^d:60>a?b&c|b&d|c&d:b^c^d}function c(a){return 20>a?1518500249:40>a?1859775393:60>a?-1894007588:-899497514}function d(b,c){var d=g(b);d.length>16&&(d=a(d,8*b.length));for(var e=new Array(16),f=new Array(16),h=0;16>h;h++)e[h]=909522486^d[h],f[h]=1549556828^d[h];var i=a(e.concat(g(c)),512+8*c.length);return a(f.concat(i),672)}function e(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function f(a,b){return a<<b|a>>>32-b}function g(a){for(var b=[],c=255,d=0;d<8*a.length;d+=8)b[d>>5]|=(a.charCodeAt(d/8)&c)<<24-d%32;return b}function h(a){for(var b="",c=255,d=0;d<32*a.length;d+=8)b+=String.fromCharCode(a[d>>5]>>>24-d%32&c);return b}function i(a){for(var b,c,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e="",f=0;f<4*a.length;f+=3)for(b=(a[f>>2]>>8*(3-f%4)&255)<<16|(a[f+1>>2]>>8*(3-(f+1)%4)&255)<<8|a[f+2>>2]>>8*(3-(f+2)%4)&255,c=0;4>c;c++)e+=8*f+6*c>32*a.length?"=":d.charAt(b>>6*(3-c)&63);return e}return{b64_hmac_sha1:function(a,b){return i(d(a,b))},b64_sha1:function(b){return i(a(g(b),8*b.length))},binb2str:h,core_hmac_sha1:d,str_hmac_sha1:function(a,b){return h(d(a,b))},str_sha1:function(b){return h(a(g(b),8*b.length))}}}),function(b,c){"function"==typeof a&&a.amd?a("strophe-md5",function(){return c()}):b.MD5=c()}(this,function(a){var b=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c},c=function(a,b){return a<<b|a>>>32-b},d=function(a){for(var b=[],c=0;c<8*a.length;c+=8)b[c>>5]|=(255&a.charCodeAt(c/8))<<c%32;return b},e=function(a){for(var b="",c=0;c<32*a.length;c+=8)b+=String.fromCharCode(a[c>>5]>>>c%32&255);return b},f=function(a){for(var b="0123456789abcdef",c="",d=0;d<4*a.length;d++)c+=b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15);return c},g=function(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)},h=function(a,b,c,d,e,f,h){return g(b&c|~b&d,a,b,e,f,h)},i=function(a,b,c,d,e,f,h){return g(b&d|c&~d,a,b,e,f,h)},j=function(a,b,c,d,e,f,h){return g(b^c^d,a,b,e,f,h)},k=function(a,b,c,d,e,f,h){return g(c^(b|~d),a,b,e,f,h)},l=function(a,c){a[c>>5]|=128<<c%32,a[(c+64>>>9<<4)+14]=c;for(var d,e,f,g,l=1732584193,m=-271733879,n=-1732584194,o=271733878,p=0;p<a.length;p+=16)d=l,e=m,f=n,g=o,l=h(l,m,n,o,a[p+0],7,-680876936),o=h(o,l,m,n,a[p+1],12,-389564586),n=h(n,o,l,m,a[p+2],17,606105819),m=h(m,n,o,l,a[p+3],22,-1044525330),l=h(l,m,n,o,a[p+4],7,-176418897),o=h(o,l,m,n,a[p+5],12,1200080426),n=h(n,o,l,m,a[p+6],17,-1473231341),m=h(m,n,o,l,a[p+7],22,-45705983),l=h(l,m,n,o,a[p+8],7,1770035416),o=h(o,l,m,n,a[p+9],12,-1958414417),n=h(n,o,l,m,a[p+10],17,-42063),m=h(m,n,o,l,a[p+11],22,-1990404162),l=h(l,m,n,o,a[p+12],7,1804603682),o=h(o,l,m,n,a[p+13],12,-40341101),n=h(n,o,l,m,a[p+14],17,-1502002290),m=h(m,n,o,l,a[p+15],22,1236535329),l=i(l,m,n,o,a[p+1],5,-165796510),o=i(o,l,m,n,a[p+6],9,-1069501632),n=i(n,o,l,m,a[p+11],14,643717713),m=i(m,n,o,l,a[p+0],20,-373897302),l=i(l,m,n,o,a[p+5],5,-701558691),o=i(o,l,m,n,a[p+10],9,38016083),n=i(n,o,l,m,a[p+15],14,-660478335),m=i(m,n,o,l,a[p+4],20,-405537848),l=i(l,m,n,o,a[p+9],5,568446438),o=i(o,l,m,n,a[p+14],9,-1019803690),n=i(n,o,l,m,a[p+3],14,-187363961),m=i(m,n,o,l,a[p+8],20,1163531501),l=i(l,m,n,o,a[p+13],5,-1444681467),o=i(o,l,m,n,a[p+2],9,-51403784),n=i(n,o,l,m,a[p+7],14,1735328473),m=i(m,n,o,l,a[p+12],20,-1926607734),l=j(l,m,n,o,a[p+5],4,-378558),o=j(o,l,m,n,a[p+8],11,-2022574463),n=j(n,o,l,m,a[p+11],16,1839030562),m=j(m,n,o,l,a[p+14],23,-35309556),l=j(l,m,n,o,a[p+1],4,-1530992060),o=j(o,l,m,n,a[p+4],11,1272893353),n=j(n,o,l,m,a[p+7],16,-155497632),m=j(m,n,o,l,a[p+10],23,-1094730640),l=j(l,m,n,o,a[p+13],4,681279174),o=j(o,l,m,n,a[p+0],11,-358537222),n=j(n,o,l,m,a[p+3],16,-722521979),m=j(m,n,o,l,a[p+6],23,76029189),l=j(l,m,n,o,a[p+9],4,-640364487),o=j(o,l,m,n,a[p+12],11,-421815835),n=j(n,o,l,m,a[p+15],16,530742520),m=j(m,n,o,l,a[p+2],23,-995338651),l=k(l,m,n,o,a[p+0],6,-198630844),o=k(o,l,m,n,a[p+7],10,1126891415),n=k(n,o,l,m,a[p+14],15,-1416354905),m=k(m,n,o,l,a[p+5],21,-57434055),l=k(l,m,n,o,a[p+12],6,1700485571),o=k(o,l,m,n,a[p+3],10,-1894986606),n=k(n,o,l,m,a[p+10],15,-1051523),m=k(m,n,o,l,a[p+1],21,-2054922799),l=k(l,m,n,o,a[p+8],6,1873313359),o=k(o,l,m,n,a[p+15],10,-30611744),n=k(n,o,l,m,a[p+6],15,-1560198380),m=k(m,n,o,l,a[p+13],21,1309151649),l=k(l,m,n,o,a[p+4],6,-145523070),o=k(o,l,m,n,a[p+11],10,-1120210379),n=k(n,o,l,m,a[p+2],15,718787259),m=k(m,n,o,l,a[p+9],21,-343485551),l=b(l,d),m=b(m,e),n=b(n,f),o=b(o,g);return[l,m,n,o]},m={hexdigest:function(a){return f(l(d(a),8*a.length))},hash:function(a){return e(l(d(a),8*a.length))}};return m}),Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Array.prototype.slice,d=Array.prototype.concat,e=c.call(arguments,1);return function(){return b.apply(a?a:this,d.call(e,c.call(arguments,0)))}}),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length,c=Number(arguments[1])||0;for(c=0>c?Math.ceil(c):Math.floor(c),0>c&&(c+=b);b>c;c++)if(c in this&&this[c]===a)return c;return-1}),function(b,c){if("function"==typeof a&&a.amd)a("strophe-core",["strophe-sha1","strophe-base64","strophe-md5","strophe-polyfill"],function(){return c.apply(this,arguments)});else{var d=c(b.SHA1,b.Base64,b.MD5);window.Strophe=d.Strophe,window.$build=d.$build,window.$iq=d.$iq,window.$msg=d.$msg,window.$pres=d.$pres,window.SHA1=d.SHA1,window.Base64=d.Base64,window.MD5=d.MD5,window.b64_hmac_sha1=d.SHA1.b64_hmac_sha1,window.b64_sha1=d.SHA1.b64_sha1,window.str_hmac_sha1=d.SHA1.str_hmac_sha1,window.str_sha1=d.SHA1.str_sha1}}(this,function(a,b,c){function d(a,b){return new h.Builder(a,b)}function e(a){return new h.Builder("message",a)}function f(a){return new h.Builder("iq",a)}function g(a){return new h.Builder("presence",a)}var h;return h={VERSION:"1.2.2",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",FRAMING:"urn:ietf:params:xml:ns:xmpp-framing",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas",XHTML_IM:"http://jabber.org/protocol/xhtml-im",XHTML:"http://www.w3.org/1999/xhtml"},XHTML:{tags:["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul","body"],attributes:{a:["href"],blockquote:["style"],br:[],cite:["style"],em:[],img:["src","alt","style","height","width"],li:["style"],ol:["style"],p:["style"],span:["style"],strong:[],ul:["style"],body:[]},css:["background-color","color","font-family","font-size","font-style","font-weight","margin-left","margin-right","text-align","text-decoration"],validTag:function(a){for(var b=0;b<h.XHTML.tags.length;b++)if(a==h.XHTML.tags[b])return!0;return!1},validAttribute:function(a,b){if("undefined"!=typeof h.XHTML.attributes[a]&&h.XHTML.attributes[a].length>0)for(var c=0;c<h.XHTML.attributes[a].length;c++)if(b==h.XHTML.attributes[a][c])return!0;return!1},validCSS:function(a){for(var b=0;b<h.XHTML.css.length;b++)if(a==h.XHTML.css[b])return!0;return!1}},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8,REDIRECT:9},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3,CDATA:4,FRAGMENT:11},TIMEOUT:1.1,SECONDARY_TIMEOUT:.1,addNamespace:function(a,b){h.NS[a]=b},forEachChild:function(a,b,c){var d,e;for(d=0;d<a.childNodes.length;d++)e=a.childNodes[d],e.nodeType!=h.ElementType.NORMAL||b&&!this.isTagEqual(e,b)||c(e)},isTagEqual:function(a,b){return a.tagName==b},_xmlGenerator:null,_makeGenerator:function(){var a;return void 0===document.implementation.createDocument||document.implementation.createDocument&&document.documentMode&&document.documentMode<10?(a=this._getIEXmlDom(),a.appendChild(a.createElement("strophe"))):a=document.implementation.createDocument("jabber:client","strophe",null),a},xmlGenerator:function(){return h._xmlGenerator||(h._xmlGenerator=h._makeGenerator()),h._xmlGenerator},_getIEXmlDom:function(){for(var a=null,b=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"],c=0;c<b.length&&null===a;c++)try{a=new ActiveXObject(b[c])}catch(d){a=null}return a},xmlElement:function(a){if(!a)return null;var b,c,d,e=h.xmlGenerator().createElement(a);for(b=1;b<arguments.length;b++){var f=arguments[b];if(f)if("string"==typeof f||"number"==typeof f)e.appendChild(h.xmlTextNode(f));else if("object"==typeof f&&"function"==typeof f.sort)for(c=0;c<f.length;c++){var g=f[c];"object"==typeof g&&"function"==typeof g.sort&&void 0!==g[1]&&e.setAttribute(g[0],g[1])}else if("object"==typeof f)for(d in f)f.hasOwnProperty(d)&&void 0!==f[d]&&e.setAttribute(d,f[d])}return e},xmlescape:function(a){return a=a.replace(/\&/g,"&"),a=a.replace(/</g,"<"),a=a.replace(/>/g,">"),a=a.replace(/'/g,"'"),a=a.replace(/"/g,""")},xmlunescape:function(a){return a=a.replace(/\&/g,"&"),a=a.replace(/</g,"<"),a=a.replace(/>/g,">"),a=a.replace(/'/g,"'"),a=a.replace(/"/g,'"')},xmlTextNode:function(a){return h.xmlGenerator().createTextNode(a)},xmlHtmlNode:function(a){var b;if(window.DOMParser){var c=new DOMParser;b=c.parseFromString(a,"text/xml")}else b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a);return b},getText:function(a){if(!a)return null;var b="";0===a.childNodes.length&&a.nodeType==h.ElementType.TEXT&&(b+=a.nodeValue);for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeType==h.ElementType.TEXT&&(b+=a.childNodes[c].nodeValue);return h.xmlescape(b)},copyElement:function(a){var b,c;if(a.nodeType==h.ElementType.NORMAL){for(c=h.xmlElement(a.tagName),b=0;b<a.attributes.length;b++)c.setAttribute(a.attributes[b].nodeName,a.attributes[b].value);for(b=0;b<a.childNodes.length;b++)c.appendChild(h.copyElement(a.childNodes[b]))}else a.nodeType==h.ElementType.TEXT&&(c=h.xmlGenerator().createTextNode(a.nodeValue));return c},createHtml:function(a){var b,c,d,e,f,g,i,j,k,l,m;if(a.nodeType==h.ElementType.NORMAL)if(e=a.nodeName.toLowerCase(),h.XHTML.validTag(e))try{for(c=h.xmlElement(e),b=0;b<h.XHTML.attributes[e].length;b++)if(f=h.XHTML.attributes[e][b],g=a.getAttribute(f),"undefined"!=typeof g&&null!==g&&""!==g&&g!==!1&&0!==g)if("style"==f&&"object"==typeof g&&"undefined"!=typeof g.cssText&&(g=g.cssText),"style"==f){for(i=[],j=g.split(";"),d=0;d<j.length;d++)k=j[d].split(":"),l=k[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase(),h.XHTML.validCSS(l)&&(m=k[1].replace(/^\s*/,"").replace(/\s*$/,""),i.push(l+": "+m));i.length>0&&(g=i.join("; "),c.setAttribute(f,g))}else c.setAttribute(f,g);for(b=0;b<a.childNodes.length;b++)c.appendChild(h.createHtml(a.childNodes[b]))}catch(n){c=h.xmlTextNode("")}else for(c=h.xmlGenerator().createDocumentFragment(),b=0;b<a.childNodes.length;b++)c.appendChild(h.createHtml(a.childNodes[b]));else if(a.nodeType==h.ElementType.FRAGMENT)for(c=h.xmlGenerator().createDocumentFragment(),b=0;b<a.childNodes.length;b++)c.appendChild(h.createHtml(a.childNodes[b]));else a.nodeType==h.ElementType.TEXT&&(c=h.xmlTextNode(a.nodeValue));return c},escapeNode:function(a){return"string"!=typeof a?a:a.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(a){return"string"!=typeof a?a:a.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(a){return a.indexOf("@")<0?null:a.split("@")[0]},getDomainFromJid:function(a){var b=h.getBareJidFromJid(a);if(b.indexOf("@")<0)return b;var c=b.split("@");return c.splice(0,1),c.join("@")},getResourceFromJid:function(a){var b=a.split("/");return b.length<2?null:(b.splice(0,1),b.join("/"))},getBareJidFromJid:function(a){return a?a.split("/")[0]:null},log:function(a,b){},debug:function(a){this.log(this.LogLevel.DEBUG,a)},info:function(a){this.log(this.LogLevel.INFO,a)},warn:function(a){this.log(this.LogLevel.WARN,a)},error:function(a){this.log(this.LogLevel.ERROR,a)},fatal:function(a){this.log(this.LogLevel.FATAL,a)},serialize:function(a){var b;if(!a)return null;"function"==typeof a.tree&&(a=a.tree());var c,d,e=a.nodeName;for(a.getAttribute("_realname")&&(e=a.getAttribute("_realname")),b="<"+e,c=0;c<a.attributes.length;c++)"_realname"!=a.attributes[c].nodeName&&(b+=" "+a.attributes[c].nodeName+"='"+a.attributes[c].value.replace(/&/g,"&").replace(/\'/g,"'").replace(/>/g,">").replace(/</g,"<")+"'");if(a.childNodes.length>0){for(b+=">",c=0;c<a.childNodes.length;c++)switch(d=a.childNodes[c],d.nodeType){case h.ElementType.NORMAL:b+=h.serialize(d);break;case h.ElementType.TEXT:b+=h.xmlescape(d.nodeValue);break;case h.ElementType.CDATA:b+="<![CDATA["+d.nodeValue+"]]>"}b+="</"+e+">"}else b+="/>";return b},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(a,b){h._connectionPlugins[a]=b}},h.Builder=function(a,b){("presence"==a||"message"==a||"iq"==a)&&(b&&!b.xmlns?b.xmlns=h.NS.CLIENT:b||(b={xmlns:h.NS.CLIENT})),this.nodeTree=h.xmlElement(a,b),this.node=this.nodeTree},h.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return h.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},attrs:function(a){for(var b in a)a.hasOwnProperty(b)&&(void 0===a[b]?this.node.removeAttribute(b):this.node.setAttribute(b,a[b]));return this},c:function(a,b,c){var d=h.xmlElement(a,b,c);return this.node.appendChild(d),"string"!=typeof c&&(this.node=d),this},cnode:function(a){var b,c=h.xmlGenerator();try{b=void 0!==c.importNode}catch(d){b=!1}var e=b?c.importNode(a,!0):h.copyElement(a);return this.node.appendChild(e),this.node=e,this},t:function(a){var b=h.xmlTextNode(a);return this.node.appendChild(b),this},h:function(a){var b=document.createElement("body");b.innerHTML=a;for(var c=h.createHtml(b);c.childNodes.length>0;)this.node.appendChild(c.childNodes[0]);return this}},h.Handler=function(a,b,c,d,e,f,g){this.handler=a,this.ns=b,this.name=c,this.type=d,this.id=e,this.options=g||{matchBare:!1},this.options.matchBare||(this.options.matchBare=!1),this.options.matchBare?this.from=f?h.getBareJidFromJid(f):null:this.from=f,this.user=!0},h.Handler.prototype={isMatch:function(a){var b,c=null;if(c=this.options.matchBare?h.getBareJidFromJid(a.getAttribute("from")):a.getAttribute("from"),b=!1,this.ns){var d=this;h.forEachChild(a,null,function(a){a.getAttribute("xmlns")==d.ns&&(b=!0)}),b=b||a.getAttribute("xmlns")==this.ns}else b=!0;var e=a.getAttribute("type");return!b||this.name&&!h.isTagEqual(a,this.name)||this.type&&(Array.isArray(this.type)?-1==this.type.indexOf(e):e!=this.type)||this.id&&a.getAttribute("id")!=this.id||this.from&&c!=this.from?!1:!0},run:function(a){var b=null;try{b=this.handler(a)}catch(c){throw c.sourceURL?h.fatal("error: "+this.handler+" "+c.sourceURL+":"+c.line+" - "+c.name+": "+c.message):c.fileName?("undefined"!=typeof console&&(console.trace(),console.error(this.handler," - error - ",c,c.message)),h.fatal("error: "+this.handler+" "+c.fileName+":"+c.lineNumber+" - "+c.name+": "+c.message)):h.fatal("error: "+c.message+"\n"+c.stack),c}return b},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},h.TimedHandler=function(a,b){this.period=a,this.handler=b,this.lastCalled=(new Date).getTime(),this.user=!0},h.TimedHandler.prototype={run:function(){return this.lastCalled=(new Date).getTime(),this.handler()},reset:function(){this.lastCalled=(new Date).getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}},h.Connection=function(a,b){this.service=a,this.options=b||{};var c=this.options.protocol||"";0===a.indexOf("ws:")||0===a.indexOf("wss:")||0===c.indexOf("ws")?this._proto=new h.Websocket(this):this._proto=new h.Bosh(this),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this._idleTimeout=null,this._disconnectTimeout=null,this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,this._data=[],this._uniqueId=0,this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var d in h._connectionPlugins)if(h._connectionPlugins.hasOwnProperty(d)){var e=h._connectionPlugins[d],f=function(){};f.prototype=e,this[d]=new f,this[d].init(this)}},h.Connection.prototype={reset:function(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0},pause:function(){this.paused=!0},resume:function(){this.paused=!1},getUniqueId:function(a){return"string"==typeof a||"number"==typeof a?++this._uniqueId+":"+a:++this._uniqueId+""},connect:function(a,b,c,d,e,f,g){this.jid=a,this.authzid=h.getBareJidFromJid(this.jid),this.authcid=g||h.getNodeFromJid(this.jid),this.pass=b,this.servtype="xmpp",this.connect_callback=c,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=h.getDomainFromJid(this.jid),this._changeConnectStatus(h.Status.CONNECTING,null),this._proto._connect(d,e,f)},attach:function(a,b,c,d,e,f,g){if(!(this._proto instanceof h.Bosh))throw{name:"StropheSessionError",message:'The "attach" method can only be used with a BOSH connection.'};this._proto._attach(a,b,c,d,e,f,g)},restore:function(a,b,c,d,e){if(!this._sessionCachingSupported())throw{name:"StropheSessionError",message:'The "restore" method can only be used with a BOSH connection.'};this._proto._restore(a,b,c,d,e)},_sessionCachingSupported:function(){if(this._proto instanceof h.Bosh){if(!JSON)return!1;try{window.sessionStorage.setItem("_strophe_","_strophe_"),window.sessionStorage.removeItem("_strophe_")}catch(a){return!1}return!0}return!1},xmlInput:function(a){},xmlOutput:function(a){},rawInput:function(a){},rawOutput:function(a){},send:function(a){if(null!==a){if("function"==typeof a.sort)for(var b=0;b<a.length;b++)this._queueData(a[b]);else this._queueData("function"==typeof a.tree?a.tree():a);this._proto._send()}},flush:function(){clearTimeout(this._idleTimeout),this._onIdle()},sendIQ:function(a,b,c,d){var e=null,f=this;"function"==typeof a.tree&&(a=a.tree());var g=a.getAttribute("id");g||(g=this.getUniqueId("sendIQ"),a.setAttribute("id",g));var i=a.getAttribute("to"),j=this.jid,k=this.addHandler(function(a){e&&f.deleteTimedHandler(e);var d=!1,g=a.getAttribute("from");if((g===i||null===i&&(g===h.getBareJidFromJid(j)||g===h.getDomainFromJid(j)||g===j))&&(d=!0),!d)throw{name:"StropheError",message:"Got answer to IQ from wrong jid:"+g+"\nExpected jid: "+i};var k=a.getAttribute("type");if("result"==k)b&&b(a);else{if("error"!=k)throw{name:"StropheError",message:"Got bad IQ type of "+k};c&&c(a)}},null,"iq",["error","result"],g);return d&&(e=this.addTimedHandler(d,function(){return f.deleteHandler(k),c&&c(null),!1})),this.send(a),g},_queueData:function(a){if(null===a||!a.tagName||!a.childNodes)throw{name:"StropheError",message:"Cannot queue non-DOMElement."};this._data.push(a)},_sendRestart:function(){this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},addTimedHandler:function(a,b){var c=new h.TimedHandler(a,b);return this.addTimeds.push(c),c},deleteTimedHandler:function(a){this.removeTimeds.push(a)},addHandler:function(a,b,c,d,e,f,g){var i=new h.Handler(a,b,c,d,e,f,g);return this.addHandlers.push(i),i},deleteHandler:function(a){this.removeHandlers.push(a);var b=this.addHandlers.indexOf(a);b>=0&&this.addHandlers.splice(b,1)},disconnect:function(a){if(this._changeConnectStatus(h.Status.DISCONNECTING,a),h.info("Disconnect was called because: "+a),this.connected){var b=!1;this.disconnecting=!0,this.authenticated&&(b=g({xmlns:h.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(b)}else h.info("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests()},_changeConnectStatus:function(a,b){for(var c in h._connectionPlugins)if(h._connectionPlugins.hasOwnProperty(c)){var d=this[c];if(d.statusChanged)try{d.statusChanged(a,b)}catch(e){h.error(""+c+" plugin caused an exception changing status: "+e)}}if(this.connect_callback)try{this.connect_callback(a,b)}catch(f){h.error("User connection callback caused an exception: "+f)}},_doDisconnect:function(a){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),h.info("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(h.Status.DISCONNECTED,a),this.connected=!1},_dataRecv:function(a,b){h.info("_dataRecv called");var c=this._proto._reqToData(a);if(null!==c){this.xmlInput!==h.Connection.prototype.xmlInput&&this.xmlInput(c.nodeName===this._proto.strip&&c.childNodes.length?c.childNodes[0]:c),this.rawInput!==h.Connection.prototype.rawInput&&this.rawInput(b?b:h.serialize(c));for(var d,e;this.removeHandlers.length>0;)e=this.removeHandlers.pop(),d=this.handlers.indexOf(e),d>=0&&this.handlers.splice(d,1);for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())return void this._doDisconnect();var f,g,i=c.getAttribute("type");if(null!==i&&"terminate"==i){if(this.disconnecting)return;return f=c.getAttribute("condition"),g=c.getElementsByTagName("conflict"),null!==f?("remote-stream-error"==f&&g.length>0&&(f="conflict"),this._changeConnectStatus(h.Status.CONNFAIL,f)):this._changeConnectStatus(h.Status.CONNFAIL,"unknown"),void this._doDisconnect(f)}var j=this;h.forEachChild(c,null,function(a){var b,c;for(c=j.handlers,j.handlers=[],b=0;b<c.length;b++){var d=c[b];try{!d.isMatch(a)||!j.authenticated&&d.user?j.handlers.push(d):d.run(a)&&j.handlers.push(d)}catch(e){h.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}})}},mechanisms:{},_connect_cb:function(a,b,c){h.info("_connect_cb was called"),this.connected=!0;var d=this._proto._reqToData(a);if(d){this.xmlInput!==h.Connection.prototype.xmlInput&&this.xmlInput(d.nodeName===this._proto.strip&&d.childNodes.length?d.childNodes[0]:d),this.rawInput!==h.Connection.prototype.rawInput&&this.rawInput(c?c:h.serialize(d));var e=this._proto._connect_cb(d);if(e!==h.Status.CONNFAIL){this._authentication.sasl_scram_sha1=!1,this._authentication.sasl_plain=!1,this._authentication.sasl_digest_md5=!1,this._authentication.sasl_anonymous=!1,this._authentication.legacy_auth=!1;var f;f=d.getElementsByTagNameNS?d.getElementsByTagNameNS(h.NS.STREAM,"features").length>0:d.getElementsByTagName("stream:features").length>0||d.getElementsByTagName("features").length>0;var g,i,j=d.getElementsByTagName("mechanism"),k=[],l=!1;if(!f)return void this._proto._no_auth_received(b);if(j.length>0)for(g=0;g<j.length;g++)i=h.getText(j[g]),this.mechanisms[i]&&k.push(this.mechanisms[i]);return this._authentication.legacy_auth=d.getElementsByTagName("auth").length>0,(l=this._authentication.legacy_auth||k.length>0)?void(this.do_authentication!==!1&&this.authenticate(k)):void this._proto._no_auth_received(b)}}},authenticate:function(a){var c;for(c=0;c<a.length-1;++c){for(var e=c,g=c+1;g<a.length;++g)a[g].prototype.priority>a[e].prototype.priority&&(e=g);if(e!=c){var i=a[c];a[c]=a[e],a[e]=i}}var j=!1;for(c=0;c<a.length;++c)if(a[c].test(this)){this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge_cb.bind(this),null,"challenge",null,null),this._sasl_mechanism=new a[c],this._sasl_mechanism.onStart(this);var k=d("auth",{xmlns:h.NS.SASL,mechanism:this._sasl_mechanism.name});if(this._sasl_mechanism.isClientFirst){var l=this._sasl_mechanism.onChallenge(this,null);k.t(b.encode(l))}this.send(k.tree()),j=!0;break}j||(null===h.getNodeFromJid(this.jid)?(this._changeConnectStatus(h.Status.CONNFAIL,"x-strophe-bad-non-anon-jid"),
this.disconnect("x-strophe-bad-non-anon-jid")):(this._changeConnectStatus(h.Status.AUTHENTICATING,null),this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1"),this.send(f({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:h.NS.AUTH}).c("username",{}).t(h.getNodeFromJid(this.jid)).tree())))},_sasl_challenge_cb:function(a){var c=b.decode(h.getText(a)),e=this._sasl_mechanism.onChallenge(this,c),f=d("response",{xmlns:h.NS.SASL});return""!==e&&f.t(b.encode(e)),this.send(f.tree()),!0},_auth1_cb:function(a){var b=f({type:"set",id:"_auth_2"}).c("query",{xmlns:h.NS.AUTH}).c("username",{}).t(h.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return h.getResourceFromJid(this.jid)||(this.jid=h.getBareJidFromJid(this.jid)+"/strophe"),b.up().c("resource",{}).t(h.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(b.tree()),!1},_sasl_success_cb:function(a){if(this._sasl_data["server-signature"]){var c,d=b.decode(h.getText(a)),e=/([a-z]+)=([^,]+)(,|$)/,f=d.match(e);if("v"==f[1]&&(c=f[2]),c!=this._sasl_data["server-signature"])return this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_data={},this._sasl_failure_cb(null)}h.info("SASL authentication succeeded."),this._sasl_mechanism&&this._sasl_mechanism.onSuccess(),this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null);var g=[],i=function(a,b){for(;a.length;)this.deleteHandler(a.pop());return this._sasl_auth1_cb.bind(this)(b),!1};return g.push(this._addSysHandler(function(a){i.bind(this)(g,a)}.bind(this),null,"stream:features",null,null)),g.push(this._addSysHandler(function(a){i.bind(this)(g,a)}.bind(this),h.NS.STREAM,"features",null,null)),this._sendRestart(),!1},_sasl_auth1_cb:function(a){this.features=a;var b,c;for(b=0;b<a.childNodes.length;b++)c=a.childNodes[b],"bind"==c.nodeName&&(this.do_bind=!0),"session"==c.nodeName&&(this.do_session=!0);if(!this.do_bind)return this._changeConnectStatus(h.Status.AUTHFAIL,null),!1;this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var d=h.getResourceFromJid(this.jid);return this.send(d?f({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:h.NS.BIND}).c("resource",{}).t(d).tree():f({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:h.NS.BIND}).tree()),!1},_sasl_bind_cb:function(a){if("error"==a.getAttribute("type")){h.info("SASL binding failed.");var b,c=a.getElementsByTagName("conflict");return c.length>0&&(b="conflict"),this._changeConnectStatus(h.Status.AUTHFAIL,b),!1}var d,e=a.getElementsByTagName("bind");return e.length>0?(d=e[0].getElementsByTagName("jid"),void(d.length>0&&(this.jid=h.getText(d[0]),this.do_session?(this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2"),this.send(f({type:"set",id:"_session_auth_2"}).c("session",{xmlns:h.NS.SESSION}).tree())):(this.authenticated=!0,this._changeConnectStatus(h.Status.CONNECTED,null))))):(h.info("SASL binding failed."),this._changeConnectStatus(h.Status.AUTHFAIL,null),!1)},_sasl_session_cb:function(a){if("result"==a.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(h.Status.CONNECTED,null);else if("error"==a.getAttribute("type"))return h.info("Session creation failed."),this._changeConnectStatus(h.Status.AUTHFAIL,null),!1;return!1},_sasl_failure_cb:function(a){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_mechanism&&this._sasl_mechanism.onFailure(),this._changeConnectStatus(h.Status.AUTHFAIL,null),!1},_auth2_cb:function(a){return"result"==a.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(h.Status.CONNECTED,null)):"error"==a.getAttribute("type")&&(this._changeConnectStatus(h.Status.AUTHFAIL,null),this.disconnect("authentication failed")),!1},_addSysTimedHandler:function(a,b){var c=new h.TimedHandler(a,b);return c.user=!1,this.addTimeds.push(c),c},_addSysHandler:function(a,b,c,d,e){var f=new h.Handler(a,b,c,d,e);return f.user=!1,this.addHandlers.push(f),f},_onDisconnectTimeout:function(){return h.info("_onDisconnectTimeout was called"),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1},_onIdle:function(){for(var a,b,c,d;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;)b=this.removeTimeds.pop(),a=this.timedHandlers.indexOf(b),a>=0&&this.timedHandlers.splice(a,1);var e=(new Date).getTime();for(d=[],a=0;a<this.timedHandlers.length;a++)b=this.timedHandlers[a],(this.authenticated||!b.user)&&(c=b.lastCalled+b.period,0>=c-e?b.run()&&d.push(b):d.push(b));this.timedHandlers=d,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout(this._onIdle.bind(this),100))}},h.SASLMechanism=function(a,b,c){this.name=a,this.isClientFirst=b,this.priority=c},h.SASLMechanism.prototype={test:function(a){return!0},onStart:function(a){this._connection=a},onChallenge:function(a,b){throw new Error("You should implement challenge handling!")},onFailure:function(){this._connection=null},onSuccess:function(){this._connection=null}},h.SASLAnonymous=function(){},h.SASLAnonymous.prototype=new h.SASLMechanism("ANONYMOUS",!1,10),h.SASLAnonymous.test=function(a){return null===a.authcid},h.Connection.prototype.mechanisms[h.SASLAnonymous.prototype.name]=h.SASLAnonymous,h.SASLPlain=function(){},h.SASLPlain.prototype=new h.SASLMechanism("PLAIN",!0,20),h.SASLPlain.test=function(a){return null!==a.authcid},h.SASLPlain.prototype.onChallenge=function(a){var b=a.authzid;return b+="\x00",b+=a.authcid,b+="\x00",b+=a.pass},h.Connection.prototype.mechanisms[h.SASLPlain.prototype.name]=h.SASLPlain,h.SASLSHA1=function(){},h.SASLSHA1.prototype=new h.SASLMechanism("SCRAM-SHA-1",!0,40),h.SASLSHA1.test=function(a){return null!==a.authcid},h.SASLSHA1.prototype.onChallenge=function(d,e,f){var g=f||c.hexdigest(1234567890*Math.random()),h="n="+d.authcid;return h+=",r=",h+=g,d._sasl_data.cnonce=g,d._sasl_data["client-first-message-bare"]=h,h="n,,"+h,this.onChallenge=function(c,d){for(var e,f,g,h,i,j,k,l,m,n,o,p="c=biws,",q=c._sasl_data["client-first-message-bare"]+","+d+",",r=c._sasl_data.cnonce,s=/([a-z]+)=([^,]+)(,|$)/;d.match(s);){var t=d.match(s);switch(d=d.replace(t[0],""),t[1]){case"r":e=t[2];break;case"s":f=t[2];break;case"i":g=t[2]}}if(e.substr(0,r.length)!==r)return c._sasl_data={},c._sasl_failure_cb();for(p+="r="+e,q+=p,f=b.decode(f),f+="\x00\x00\x00",h=j=a.core_hmac_sha1(c.pass,f),k=1;g>k;k++){for(i=a.core_hmac_sha1(c.pass,a.binb2str(j)),l=0;5>l;l++)h[l]^=i[l];j=i}for(h=a.binb2str(h),m=a.core_hmac_sha1(h,"Client Key"),n=a.str_hmac_sha1(h,"Server Key"),o=a.core_hmac_sha1(a.str_sha1(a.binb2str(m)),q),c._sasl_data["server-signature"]=a.b64_hmac_sha1(n,q),l=0;5>l;l++)m[l]^=o[l];return p+=",p="+b.encode(a.binb2str(m))}.bind(this),h},h.Connection.prototype.mechanisms[h.SASLSHA1.prototype.name]=h.SASLSHA1,h.SASLMD5=function(){},h.SASLMD5.prototype=new h.SASLMechanism("DIGEST-MD5",!1,30),h.SASLMD5.test=function(a){return null!==a.authcid},h.SASLMD5.prototype._quote=function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'},h.SASLMD5.prototype.onChallenge=function(a,b,d){for(var e,f=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/,g=d||c.hexdigest(""+1234567890*Math.random()),h="",i=null,j="",k="";b.match(f);)switch(e=b.match(f),b=b.replace(e[0],""),e[2]=e[2].replace(/^"(.+)"$/,"$1"),e[1]){case"realm":h=e[2];break;case"nonce":j=e[2];break;case"qop":k=e[2];break;case"host":i=e[2]}var l=a.servtype+"/"+a.domain;null!==i&&(l=l+"/"+i);var m=c.hash(a.authcid+":"+h+":"+this._connection.pass)+":"+j+":"+g,n="AUTHENTICATE:"+l,o="";return o+="charset=utf-8,",o+="username="+this._quote(a.authcid)+",",o+="realm="+this._quote(h)+",",o+="nonce="+this._quote(j)+",",o+="nc=00000001,",o+="cnonce="+this._quote(g)+",",o+="digest-uri="+this._quote(l)+",",o+="response="+c.hexdigest(c.hexdigest(m)+":"+j+":00000001:"+g+":auth:"+c.hexdigest(n))+",",o+="qop=auth",this.onChallenge=function(){return""}.bind(this),o},h.Connection.prototype.mechanisms[h.SASLMD5.prototype.name]=h.SASLMD5,{Strophe:h,$build:d,$msg:e,$iq:f,$pres:g,SHA1:a,Base64:b,MD5:c}}),function(b,c){return"function"==typeof a&&a.amd?void a("strophe-bosh",["strophe-core"],function(a){return c(a.Strophe,a.$build)}):c(Strophe,$build)}(this,function(a,b){return a.Request=function(b,c,d,e){this.id=++a._requestId,this.xmlData=b,this.data=a.serialize(b),this.origFunc=c,this.func=c,this.rid=d,this.date=NaN,this.sends=e||0,this.abort=!1,this.dead=null,this.age=function(){if(!this.date)return 0;var a=new Date;return(a-this.date)/1e3},this.timeDead=function(){if(!this.dead)return 0;var a=new Date;return(a-this.dead)/1e3},this.xhr=this._newXHR()},a.Request.prototype={getResponse:function(){var b=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){if(b=this.xhr.responseXML.documentElement,"parsererror"==b.tagName)throw a.error("invalid response received"),a.error("responseText: "+this.xhr.responseText),a.error("responseXML: "+a.serialize(this.xhr.responseXML)),"parsererror"}else this.xhr.responseText&&(a.error("invalid response received"),a.error("responseText: "+this.xhr.responseText),a.error("responseXML: "+a.serialize(this.xhr.responseXML)));return b},_newXHR:function(){var a=null;return window.XMLHttpRequest?(a=new XMLHttpRequest,a.overrideMimeType&&a.overrideMimeType("text/xml; charset=utf-8")):window.ActiveXObject&&(a=new ActiveXObject("Microsoft.XMLHTTP")),a.onreadystatechange=this.func.bind(null,this),a}},a.Bosh=function(a){this._conn=a,this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.hold=1,this.wait=60,this.window=5,this.errors=0,this._requests=[]},a.Bosh.prototype={strip:null,_buildBody:function(){var c=b("body",{rid:this.rid++,xmlns:a.NS.HTTPBIND});return null!==this.sid&&c.attrs({sid:this.sid}),this._conn.options.keepalive&&this._cacheSession(),c},_reset:function(){this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.errors=0,window.sessionStorage.removeItem("strophe-bosh-session")},_connect:function(b,c,d){this.wait=b||this.wait,this.hold=c||this.hold,this.errors=0;var e=this._buildBody().attrs({to:this._conn.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":a.NS.BOSH});d&&e.attrs({route:d});var f=this._conn._connect_cb;this._requests.push(new a.Request(e.tree(),this._onRequestStateChange.bind(this,f.bind(this._conn)),e.tree().getAttribute("rid"))),this._throttledRequestHandler()},_attach:function(b,c,d,e,f,g,h){this._conn.jid=b,this.sid=c,this.rid=d,this._conn.connect_callback=e,this._conn.domain=a.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=f||this.wait,this.hold=g||this.hold,this.window=h||this.window,this._conn._changeConnectStatus(a.Status.ATTACHED,null)},_restore:function(b,c,d,e,f){var g=JSON.parse(window.sessionStorage.getItem("strophe-bosh-session"));if(!("undefined"!=typeof g&&null!==g&&g.rid&&g.sid&&g.jid)||"undefined"!=typeof b&&a.getBareJidFromJid(g.jid)!=a.getBareJidFromJid(b))throw{name:"StropheSessionError",message:"_restore: no restoreable session."};this._conn.restored=!0,this._attach(g.jid,g.sid,g.rid,c,d,e,f)},_cacheSession:function(){this._conn.authenticated?this._conn.jid&&this.rid&&this.sid&&window.sessionStorage.setItem("strophe-bosh-session",JSON.stringify({jid:this._conn.jid,rid:this.rid,sid:this.sid})):window.sessionStorage.removeItem("strophe-bosh-session")},_connect_cb:function(b){var c,d,e=b.getAttribute("type");if(null!==e&&"terminate"==e)return c=b.getAttribute("condition"),a.error("BOSH-Connection failed: "+c),d=b.getElementsByTagName("conflict"),null!==c?("remote-stream-error"==c&&d.length>0&&(c="conflict"),this._conn._changeConnectStatus(a.Status.CONNFAIL,c)):this._conn._changeConnectStatus(a.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(c),a.Status.CONNFAIL;this.sid||(this.sid=b.getAttribute("sid"));var f=b.getAttribute("requests");f&&(this.window=parseInt(f,10));var g=b.getAttribute("hold");g&&(this.hold=parseInt(g,10));var h=b.getAttribute("wait");h&&(this.wait=parseInt(h,10))},_disconnect:function(a){this._sendTerminate(a)},_doDisconnect:function(){this.sid=null,this.rid=Math.floor(4294967295*Math.random()),window.sessionStorage.removeItem("strophe-bosh-session")},_emptyQueue:function(){return 0===this._requests.length},_hitError:function(b){this.errors++,a.warn("request errored, status: "+b+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()},_no_auth_received:function(b){b=b?b.bind(this._conn):this._conn._connect_cb.bind(this._conn);var c=this._buildBody();this._requests.push(new a.Request(c.tree(),this._onRequestStateChange.bind(this,b.bind(this._conn)),c.tree().getAttribute("rid"))),this._throttledRequestHandler()},_onDisconnectTimeout:function(){this._abortAllRequests()},_abortAllRequests:function(){for(var a;this._requests.length>0;)a=this._requests.pop(),a.abort=!0,a.xhr.abort(),a.xhr.onreadystatechange=function(){}},_onIdle:function(){var b=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===b.length&&!this._conn.disconnecting&&(a.info("no requests during idle cycle, sending blank request"),b.push(null)),!this._conn.paused){if(this._requests.length<2&&b.length>0){for(var c=this._buildBody(),d=0;d<b.length;d++)null!==b[d]&&("restart"===b[d]?c.attrs({to:this._conn.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":a.NS.BOSH}):c.cnode(b[d]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new a.Request(c.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),c.tree().getAttribute("rid"))),this._throttledRequestHandler()}if(this._requests.length>0){var e=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(a.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(a.TIMEOUT*this.wait)&&(a.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(a.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}},_onRequestStateChange:function(b,c){if(a.debug("request id "+c.id+"."+c.sends+" state changed to "+c.xhr.readyState),c.abort)return void(c.abort=!1);var d;if(4==c.xhr.readyState){d=0;try{d=c.xhr.status}catch(e){}if("undefined"==typeof d&&(d=0),this.disconnecting&&d>=400)return void this._hitError(d);var f=this._requests[0]==c,g=this._requests[1]==c;(d>0&&500>d||c.sends>5)&&(this._removeRequest(c),a.debug("request id "+c.id+" should now be removed")),200==d?((g||f&&this._requests.length>0&&this._requests[0].age()>Math.floor(a.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),a.debug("request id "+c.id+"."+c.sends+" got 200"),b(c),this.errors=0):(a.error("request id "+c.id+"."+c.sends+" error "+d+" happened"),(0===d||d>=400&&600>d||d>=12e3)&&(this._hitError(d),d>=400&&500>d&&(this._conn._changeConnectStatus(a.Status.DISCONNECTING,null),this._conn._doDisconnect()))),d>0&&500>d||c.sends>5||this._throttledRequestHandler()}},_processRequest:function(b){var c=this,d=this._requests[b],e=-1;try{4==d.xhr.readyState&&(e=d.xhr.status)}catch(f){a.error("caught an error in _requests["+b+"], reqStatus: "+e)}if("undefined"==typeof e&&(e=-1),d.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();var g=d.age(),h=!isNaN(g)&&g>Math.floor(a.TIMEOUT*this.wait),i=null!==d.dead&&d.timeDead()>Math.floor(a.SECONDARY_TIMEOUT*this.wait),j=4==d.xhr.readyState&&(1>e||e>=500);if((h||i||j)&&(i&&a.error("Request "+this._requests[b].id+" timed out (secondary), restarting"),d.abort=!0,d.xhr.abort(),d.xhr.onreadystatechange=function(){},this._requests[b]=new a.Request(d.xmlData,d.origFunc,d.rid,d.sends),d=this._requests[b]),0===d.xhr.readyState){a.debug("request id "+d.id+"."+d.sends+" posting");try{d.xhr.open("POST",this._conn.service,this._conn.options.sync?!1:!0),d.xhr.setRequestHeader("Content-Type","text/xml; charset=utf-8")}catch(k){return a.error("XHR open failed."),this._conn.connected||this._conn._changeConnectStatus(a.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}var l=function(){if(d.date=new Date,c._conn.options.customHeaders){var a=c._conn.options.customHeaders;for(var b in a)a.hasOwnProperty(b)&&d.xhr.setRequestHeader(b,a[b])}d.xhr.send(d.data)};if(d.sends>1){var m=1e3*Math.min(Math.floor(a.TIMEOUT*this.wait),Math.pow(d.sends,3));setTimeout(l,m)}else l();d.sends++,this._conn.xmlOutput!==a.Connection.prototype.xmlOutput&&this._conn.xmlOutput(d.xmlData.nodeName===this.strip&&d.xmlData.childNodes.length?d.xmlData.childNodes[0]:d.xmlData),this._conn.rawOutput!==a.Connection.prototype.rawOutput&&this._conn.rawOutput(d.data)}else a.debug("_processRequest: "+(0===b?"first":"second")+" request has readyState of "+d.xhr.readyState)},_removeRequest:function(b){a.debug("removing request");var c;for(c=this._requests.length-1;c>=0;c--)b==this._requests[c]&&this._requests.splice(c,1);b.xhr.onreadystatechange=function(){},this._throttledRequestHandler()},_restartRequest:function(a){var b=this._requests[a];null===b.dead&&(b.dead=new Date),this._processRequest(a)},_reqToData:function(a){try{return a.getResponse()}catch(b){if("parsererror"!=b)throw b;this._conn.disconnect("strophe-parsererror")}},_sendTerminate:function(b){a.info("_sendTerminate was called");var c=this._buildBody().attrs({type:"terminate"});b&&c.cnode(b.tree());var d=new a.Request(c.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),c.tree().getAttribute("rid"));this._requests.push(d),this._throttledRequestHandler()},_send:function(){clearTimeout(this._conn._idleTimeout),this._throttledRequestHandler(),this._conn._idleTimeout=setTimeout(this._conn._onIdle.bind(this._conn),100)},_sendRestart:function(){this._throttledRequestHandler(),clearTimeout(this._conn._idleTimeout)},_throttledRequestHandler:function(){a.debug(this._requests?"_throttledRequestHandler called with "+this._requests.length+" requests":"_throttledRequestHandler called with undefined requests"),this._requests&&0!==this._requests.length&&(this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window&&this._processRequest(1))}},a}),function(b,c){return"function"==typeof a&&a.amd?void a("strophe-websocket",["strophe-core"],function(a){return c(a.Strophe,a.$build)}):c(Strophe,$build)}(this,function(a,b){return a.Websocket=function(a){this._conn=a,this.strip="wrapper";var b=a.service;if(0!==b.indexOf("ws:")&&0!==b.indexOf("wss:")){var c="";c+="ws"===a.options.protocol&&"https:"!==window.location.protocol?"ws":"wss",c+="://"+window.location.host,c+=0!==b.indexOf("/")?window.location.pathname+b:b,a.service=c}},a.Websocket.prototype={_buildStream:function(){return b("open",{xmlns:a.NS.FRAMING,to:this._conn.domain,version:"1.0"})},_check_streamerror:function(b,c){var d;if(d=b.getElementsByTagNameNS?b.getElementsByTagNameNS(a.NS.STREAM,"error"):b.getElementsByTagName("stream:error"),0===d.length)return!1;for(var e=d[0],f="",g="",h="urn:ietf:params:xml:ns:xmpp-streams",i=0;i<e.childNodes.length;i++){var j=e.childNodes[i];if(j.getAttribute("xmlns")!==h)break;"text"===j.nodeName?g=j.textContent:f=j.nodeName}var k="WebSocket stream error: ";return k+=f?f:"unknown",g&&(k+=" - "+f),a.error(k),this._conn._changeConnectStatus(c,f),this._conn._doDisconnect(),!0},_reset:function(){},_connect:function(){this._closeSocket(),this.socket=new WebSocket(this._conn.service,"xmpp"),this.socket.onopen=this._onOpen.bind(this),this.socket.onerror=this._onError.bind(this),this.socket.onclose=this._onClose.bind(this),this.socket.onmessage=this._connect_cb_wrapper.bind(this)},_connect_cb:function(b){var c=this._check_streamerror(b,a.Status.CONNFAIL);return c?a.Status.CONNFAIL:void 0},_handleStreamStart:function(b){var c=!1,d=b.getAttribute("xmlns");"string"!=typeof d?c="Missing xmlns in <open />":d!==a.NS.FRAMING&&(c="Wrong xmlns in <open />: "+d);var e=b.getAttribute("version");return"string"!=typeof e?c="Missing version in <open />":"1.0"!==e&&(c="Wrong version in <open />: "+e),c?(this._conn._changeConnectStatus(a.Status.CONNFAIL,c),this._conn._doDisconnect(),!1):!0},_connect_cb_wrapper:function(b){if(0===b.data.indexOf("<open ")||0===b.data.indexOf("<?xml")){var c=b.data.replace(/^(<\?.*?\?>\s*)*/,"");if(""===c)return;var d=(new DOMParser).parseFromString(c,"text/xml").documentElement;this._conn.xmlInput(d),this._conn.rawInput(b.data),this._handleStreamStart(d)&&this._connect_cb(d)}else if(0===b.data.indexOf("<close ")){this._conn.rawInput(b.data),this._conn.xmlInput(b);var e=b.getAttribute("see-other-uri");e?(this._conn._changeConnectStatus(a.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=e,this._connect()):(this._conn._changeConnectStatus(a.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect())}else{var f=this._streamWrap(b.data),g=(new DOMParser).parseFromString(f,"text/xml").documentElement;this.socket.onmessage=this._onMessage.bind(this),this._conn._connect_cb(g,null,b.data)}},_disconnect:function(c){if(this.socket&&this.socket.readyState!==WebSocket.CLOSED){c&&this._conn.send(c);var d=b("close",{xmlns:a.NS.FRAMING});this._conn.xmlOutput(d);var e=a.serialize(d);this._conn.rawOutput(e);try{this.socket.send(e)}catch(f){a.info("Couldn't send <close /> tag.")}}this._conn._doDisconnect()},_doDisconnect:function(){a.info("WebSockets _doDisconnect was called"),this._closeSocket()},_streamWrap:function(a){return"<wrapper>"+a+"</wrapper>"},_closeSocket:function(){if(this.socket)try{this.socket.close()}catch(a){}this.socket=null},_emptyQueue:function(){return!0},_onClose:function(){this._conn.connected&&!this._conn.disconnecting?(a.error("Websocket closed unexcectedly"),this._conn._doDisconnect()):a.info("Websocket closed")},_no_auth_received:function(b){a.error("Server did not send any auth methods"),this._conn._changeConnectStatus(a.Status.CONNFAIL,"Server did not send any auth methods"),b&&(b=b.bind(this._conn))(),this._conn._doDisconnect()},_onDisconnectTimeout:function(){},_abortAllRequests:function(){},_onError:function(b){a.error("Websocket error "+b),this._conn._changeConnectStatus(a.Status.CONNFAIL,"The WebSocket connection could not be established was disconnected."),this._disconnect()},_onIdle:function(){var b=this._conn._data;if(b.length>0&&!this._conn.paused){for(var c=0;c<b.length;c++)if(null!==b[c]){var d,e;d="restart"===b[c]?this._buildStream().tree():b[c],e=a.serialize(d),this._conn.xmlOutput(d),this._conn.rawOutput(e),this.socket.send(e)}this._conn._data=[]}},_onMessage:function(b){var c,d,e='<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';if(b.data===e)return this._conn.rawInput(e),this._conn.xmlInput(b),void(this._conn.disconnecting||this._conn._doDisconnect());if(0===b.data.search("<open ")){if(c=(new DOMParser).parseFromString(b.data,"text/xml").documentElement,!this._handleStreamStart(c))return}else d=this._streamWrap(b.data),c=(new DOMParser).parseFromString(d,"text/xml").documentElement;return this._check_streamerror(c,a.Status.ERROR)?void 0:this._conn.disconnecting&&"presence"===c.firstChild.nodeName&&"unavailable"===c.firstChild.getAttribute("type")?(this._conn.xmlInput(c),void this._conn.rawInput(a.serialize(c))):void this._conn._dataRecv(c,b.data)},_onOpen:function(){a.info("Websocket open");var b=this._buildStream();this._conn.xmlOutput(b.tree());var c=a.serialize(b);this._conn.rawOutput(c),this.socket.send(c)},_reqToData:function(a){return a},_send:function(){this._conn.flush()},_sendRestart:function(){clearTimeout(this._conn._idleTimeout),this._conn._onIdle.bind(this._conn)()}},a}),b?b(Strophe,$build,$msg,$iq,$pres):void 0}(function(a,b,c,d,e){window.Strophe=a,window.$build=b,window.$msg=c,window.$iq=d,window.$pres=e})},{}],22:[function(b,c,d){!function(b,e){"object"==typeof d?c.exports=d=e():"function"==typeof a&&a.amd?a([],e):b.CryptoJS=e()}(this,function(){var a=a||function(a,b){var c={},d=c.lib={},e=d.Base=function(){function a(){}return{extend:function(b){a.prototype=this;var c=new a;return b&&c.mixIn(b),c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)}),c.init.prototype=c,c.$super=this,c},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),f=d.WordArray=e.extend({init:function(a,c){a=this.words=a||[],this.sigBytes=c!=b?c:4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes,e=a.sigBytes;if(this.clamp(),d%4)for(var f=0;e>f;f++){var g=255&c[f>>>2]>>>24-8*(f%4);b[d+f>>>2]|=g<<24-8*((d+f)%4)}else if(c.length>65535)for(var f=0;e>f;f+=4)b[d+f>>>2]=c[f>>>2];else b.push.apply(b,c);return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-8*(c%4),b.length=a.ceil(c/4)},clone:function(){var a=e.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;b>d;d+=4)c.push(0|4294967296*a.random());return new f.init(c,b)}}),g=c.enc={},h=g.Hex={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=255&b[e>>>2]>>>24-8*(e%4);d.push((f>>>4).toString(16)),d.push((15&f).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-4*(d%8);return new f.init(c,b/2)}},i=g.Latin1={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=255&b[e>>>2]>>>24-8*(e%4);d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-8*(d%4);return new f.init(c,b)}},j=g.Utf8={stringify:function(a){try{return decodeURIComponent(escape(i.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data")}},parse:function(a){return i.parse(unescape(encodeURIComponent(a)))}},k=d.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,g=this.blockSize,h=4*g,i=e/h;i=b?a.ceil(i):a.max((0|i)-this._minBufferSize,0);var j=i*g,k=a.min(4*j,e);if(j){for(var l=0;j>l;l+=g)this._doProcessBlock(d,l);var m=d.splice(0,j);c.sigBytes-=k}return new f.init(m,k)},clone:function(){var a=e.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});d.Hasher=k.extend({cfg:e.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){k.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new l.HMAC.init(a,c).finalize(b)}}});var l=c.algo={};return c}(Math);return a})},{}],23:[function(b,c,d){!function(e,f){"object"==typeof d?c.exports=d=f(b("./core"),b("./sha1"),b("./hmac")):"function"==typeof a&&a.amd?a(["./core","./sha1","./hmac"],f):f(e.CryptoJS)}(this,function(a){return a.HmacSHA1})},{"./core":22,"./hmac":24,"./sha1":25}],24:[function(b,c,d){!function(e,f){"object"==typeof d?c.exports=d=f(b("./core")):"function"==typeof a&&a.amd?a(["./core"],f):f(e.CryptoJS)}(this,function(a){!function(){var b=a,c=b.lib,d=c.Base,e=b.enc,f=e.Utf8,g=b.algo;g.HMAC=d.extend({init:function(a,b){a=this._hasher=new a.init,"string"==typeof b&&(b=f.parse(b));var c=a.blockSize,d=4*c;b.sigBytes>d&&(b=a.finalize(b)),b.clamp();for(var e=this._oKey=b.clone(),g=this._iKey=b.clone(),h=e.words,i=g.words,j=0;c>j;j++)h[j]^=1549556828,i[j]^=909522486;e.sigBytes=g.sigBytes=d,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher,c=b.finalize(a);b.reset();var d=b.finalize(this._oKey.clone().concat(c));return d}})}()})},{"./core":22}],25:[function(b,c,d){!function(e,f){"object"==typeof d?c.exports=d=f(b("./core")):"function"==typeof a&&a.amd?a(["./core"],f):f(e.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.algo,g=[],h=f.SHA1=e.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],h=c[3],i=c[4],j=0;80>j;j++){if(16>j)g[j]=0|a[b+j];else{var k=g[j-3]^g[j-8]^g[j-14]^g[j-16];g[j]=k<<1|k>>>31}var l=(d<<5|d>>>27)+i+g[j];l+=20>j?(e&f|~e&h)+1518500249:40>j?(e^f^h)+1859775393:60>j?(e&f|e&h|f&h)-1894007588:(e^f^h)-899497514,i=h,h=f,f=e<<30|e>>>2,e=d,d=l}c[0]=0|c[0]+d,c[1]=0|c[1]+e,c[2]=0|c[2]+f,c[3]=0|c[3]+h,c[4]=0|c[4]+i},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),b[(d+64>>>9<<4)+15]=c,a.sigBytes=4*b.length,this._process(),this._hash},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a}});b.SHA1=e._createHelper(h),b.HmacSHA1=e._createHmacHelper(h)}(),a.SHA1})},{"./core":22}],26:[function(a,b,c){},{}],27:[function(a,b,c){arguments[4][26][0].apply(c,arguments)},{dup:26}],28:[function(a,b,c){(function(b){function d(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(c){return!1}}function e(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a){return this instanceof f?(this.length=0,this.parent=void 0,"number"==typeof a?g(this,a):"string"==typeof a?h(this,a,arguments.length>1?arguments[1]:"utf8"):i(this,a)):arguments.length>1?new f(a,arguments[1]):new f(a)}function g(a,b){if(a=p(a,0>b?0:0|q(b)),!f.TYPED_ARRAY_SUPPORT)for(var c=0;b>c;c++)a[c]=0;return a}function h(a,b,c){("string"!=typeof c||""===c)&&(c="utf8");var d=0|s(b,c);return a=p(a,d),a.write(b,c),a}function i(a,b){if(f.isBuffer(b))return j(a,b);if(Y(b))return k(a,b);if(null==b)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(b.buffer instanceof ArrayBuffer)return l(a,b);if(b instanceof ArrayBuffer)return m(a,b)}return b.length?n(a,b):o(a,b)}function j(a,b){var c=0|q(b.length);return a=p(a,c),b.copy(a,0,0,c),a}function k(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function l(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function m(a,b){return f.TYPED_ARRAY_SUPPORT?(b.byteLength,a=f._augment(new Uint8Array(b))):a=l(a,new Uint8Array(b)),a}function n(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function o(a,b){var c,d=0;"Buffer"===b.type&&Y(b.data)&&(c=b.data,d=0|q(c.length)),a=p(a,d);for(var e=0;d>e;e+=1)a[e]=255&c[e];return a}function p(a,b){f.TYPED_ARRAY_SUPPORT?(a=f._augment(new Uint8Array(b)),a.__proto__=f.prototype):(a.length=b,a._isBuffer=!0);var c=0!==b&&b<=f.poolSize>>>1;return c&&(a.parent=Z),a}function q(a){if(a>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function r(a,b){if(!(this instanceof r))return new r(a,b);var c=new f(a,b);return delete c.parent,c}function s(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;
if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return R(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return U(a).length;default:if(d)return R(a).length;b=(""+b).toLowerCase(),d=!0}}function t(a,b,c){var d=!1;if(b=0|b,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),0>b&&(b=0),c>this.length&&(c=this.length),b>=c)return"";for(;;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");a[c+g]=h}return g}function v(a,b,c,d){return V(R(b,a.length-c),a,c,d)}function w(a,b,c,d){return V(S(b),a,c,d)}function x(a,b,c,d){return w(a,b,c,d)}function y(a,b,c,d){return V(U(b),a,c,d)}function z(a,b,c,d){return V(T(b,a.length-c),a,c,d)}function A(a,b,c){return 0===b&&c===a.length?W.fromByteArray(a):W.fromByteArray(a.slice(b,c))}function B(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;c>e;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(c>=e+h){var i,j,k,l;switch(h){case 1:128>f&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(55296>l||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&1114112>l&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if($>=b)return String.fromCharCode.apply(String,a);for(var c="",d=0;b>d;)c+=String.fromCharCode.apply(String,a.slice(d,d+=$));return c}function D(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(127&a[e]);return d}function E(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function F(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=Q(a[f]);return e}function G(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function H(a,b,c){if(a%1!==0||0>a)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,g){if(!f.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>e||g>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range")}function J(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);f>e;e++)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function K(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);f>e;e++)a[c+e]=b>>>8*(d?e:3-e)&255}function L(a,b,c,d,e,f){if(b>e||f>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range");if(0>c)throw new RangeError("index out of range")}function M(a,b,c,d,e){return e||L(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(a,b,c,d,23,4),c+4}function N(a,b,c,d,e){return e||L(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(a,b,c,d,52,8),c+8}function O(a){if(a=P(a).replace(aa,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function P(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Q(a){return 16>a?"0"+a.toString(16):a.toString(16)}function R(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;d>g;g++){if(c=a.charCodeAt(g),c>55295&&57344>c){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(56320>c){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=e-55296<<10|c-56320|65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,128>c){if((b-=1)<0)break;f.push(c)}else if(2048>c){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(65536>c){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(1114112>c))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function S(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function T(a,b){for(var c,d,e,f=[],g=0;g<a.length&&!((b-=2)<0);g++)c=a.charCodeAt(g),d=c>>8,e=c%256,f.push(e),f.push(d);return f}function U(a){return W.toByteArray(O(a))}function V(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}var W=a("base64-js"),X=a("ieee754"),Y=a("is-array");c.Buffer=f,c.SlowBuffer=r,c.INSPECT_MAX_BYTES=50,f.poolSize=8192;var Z={};f.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array),f.isBuffer=function(a){return!(null==a||!a._isBuffer)},f.compare=function(a,b){if(!f.isBuffer(a)||!f.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,g=Math.min(c,d);g>e&&a[e]===b[e];)++e;return e!==g&&(c=a[e],d=b[e]),d>c?-1:c>d?1:0},f.isEncoding=function(a){switch(String(a).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}},f.concat=function(a,b){if(!Y(a))throw new TypeError("list argument must be an Array of Buffers.");if(0===a.length)return new f(0);var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var d=new f(b),e=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(d,e),e+=g.length}return d},f.byteLength=s,f.prototype.length=void 0,f.prototype.parent=void 0,f.prototype.toString=function(){var a=0|this.length;return 0===a?"":0===arguments.length?B(this,0,a):t.apply(this,arguments)},f.prototype.equals=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===f.compare(this,a)},f.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},f.prototype.compare=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:f.compare(this,a)},f.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e<a.length;e++)if(a[c+e]===b[-1===d?0:e-d]){if(-1===d&&(d=e),e-d+1===b.length)return c+d}else d=-1;return-1}if(b>2147483647?b=2147483647:-2147483648>b&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(0>b&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(f.isBuffer(a))return c(this,a,b);if("number"==typeof a)return f.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},f.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},f.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},f.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b=0|b,isFinite(c)?(c=0|c,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(0>c||0>b)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;f.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a);var d;if(f.TYPED_ARRAY_SUPPORT)d=f._augment(this.subarray(a,b));else{var e=b-a;d=new f(e,void 0);for(var g=0;e>g;g++)d[g]=this[g+a]}return d.length&&(d.parent=this.parent||this),d},f.prototype.readUIntLE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return d},f.prototype.readUIntBE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},f.prototype.readUInt8=function(a,b){return b||H(a,1,this.length),this[a]},f.prototype.readUInt16LE=function(a,b){return b||H(a,2,this.length),this[a]|this[a+1]<<8},f.prototype.readUInt16BE=function(a,b){return b||H(a,2,this.length),this[a]<<8|this[a+1]},f.prototype.readUInt32LE=function(a,b){return b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},f.prototype.readUInt32BE=function(a,b){return b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},f.prototype.readIntLE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return e*=128,d>=e&&(d-=Math.pow(2,8*b)),d},f.prototype.readIntBE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},f.prototype.readInt8=function(a,b){return b||H(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},f.prototype.readInt16LE=function(a,b){b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt16BE=function(a,b){b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt32LE=function(a,b){return b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},f.prototype.readInt32BE=function(a,b){return b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},f.prototype.readFloatLE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!0,23,4)},f.prototype.readFloatBE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!1,23,4)},f.prototype.readDoubleLE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!0,52,8)},f.prototype.readDoubleBE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!1,52,8)},f.prototype.writeUIntLE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f<c&&(e*=256);)this[b+f]=a/e&255;return b+c},f.prototype.writeUIntBE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=c-1,f=1;for(this[b+e]=255&a;--e>=0&&(f*=256);)this[b+e]=a/f&255;return b+c},f.prototype.writeUInt8=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,1,255,0),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},f.prototype.writeUInt16LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeUInt16BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeUInt32LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):K(this,a,b,!0),b+4},f.prototype.writeUInt32BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=0>a?1:0;for(this[b]=255&a;++f<c&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0>a?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeInt8=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,1,127,-128),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),0>a&&(a=255+a+1),this[b]=255&a,b+1},f.prototype.writeInt16LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeInt16BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeInt32LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):K(this,a,b,!0),b+4},f.prototype.writeInt32BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,2147483647,-2147483648),0>a&&(a=4294967295+a+1),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeFloatLE=function(a,b,c){return M(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){return M(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){return N(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){return N(this,a,b,!1,c)},f.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&c>d&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(0>b)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var e,g=d-c;if(this===a&&b>c&&d>b)for(e=g-1;e>=0;e--)a[e+b]=this[e+c];else if(1e3>g||!f.TYPED_ARRAY_SUPPORT)for(e=0;g>e;e++)a[e+b]=this[e+c];else a._set(this.subarray(c,c+g),b);return g},f.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),b>c)throw new RangeError("end < start");if(c!==b&&0!==this.length){if(0>b||b>=this.length)throw new RangeError("start out of bounds");if(0>c||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=R(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},f.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(f.TYPED_ARRAY_SUPPORT)return new f(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var _=f.prototype;f._augment=function(a){return a.constructor=f,a._isBuffer=!0,a._set=a.set,a.get=_.get,a.set=_.set,a.write=_.write,a.toString=_.toString,a.toLocaleString=_.toString,a.toJSON=_.toJSON,a.equals=_.equals,a.compare=_.compare,a.indexOf=_.indexOf,a.copy=_.copy,a.slice=_.slice,a.readUIntLE=_.readUIntLE,a.readUIntBE=_.readUIntBE,a.readUInt8=_.readUInt8,a.readUInt16LE=_.readUInt16LE,a.readUInt16BE=_.readUInt16BE,a.readUInt32LE=_.readUInt32LE,a.readUInt32BE=_.readUInt32BE,a.readIntLE=_.readIntLE,a.readIntBE=_.readIntBE,a.readInt8=_.readInt8,a.readInt16LE=_.readInt16LE,a.readInt16BE=_.readInt16BE,a.readInt32LE=_.readInt32LE,a.readInt32BE=_.readInt32BE,a.readFloatLE=_.readFloatLE,a.readFloatBE=_.readFloatBE,a.readDoubleLE=_.readDoubleLE,a.readDoubleBE=_.readDoubleBE,a.writeUInt8=_.writeUInt8,a.writeUIntLE=_.writeUIntLE,a.writeUIntBE=_.writeUIntBE,a.writeUInt16LE=_.writeUInt16LE,a.writeUInt16BE=_.writeUInt16BE,a.writeUInt32LE=_.writeUInt32LE,a.writeUInt32BE=_.writeUInt32BE,a.writeIntLE=_.writeIntLE,a.writeIntBE=_.writeIntBE,a.writeInt8=_.writeInt8,a.writeInt16LE=_.writeInt16LE,a.writeInt16BE=_.writeInt16BE,a.writeInt32LE=_.writeInt32LE,a.writeInt32BE=_.writeInt32BE,a.writeFloatLE=_.writeFloatLE,a.writeFloatBE=_.writeFloatBE,a.writeDoubleLE=_.writeDoubleLE,a.writeDoubleBE=_.writeDoubleBE,a.fill=_.fill,a.inspect=_.inspect,a.toArrayBuffer=_.toArrayBuffer,a};var aa=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":29,ieee754:30,"is-array":31}],29:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g||b===l?62:b===h||b===m?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0),l="-".charCodeAt(0),m="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],30:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],31:[function(a,b,c){var d=Array.isArray,e=Object.prototype.toString;b.exports=d||function(a){return!!a&&"[object Array]"==e.call(a)}},{}],32:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;d>i;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(0>d)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],33:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],34:[function(a,b,c){b.exports=function(a){return!(null==a||!(a._isBuffer||a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)))}},{}],35:[function(a,b,c){b.exports=Array.isArray||function(a){return"[object Array]"==Object.prototype.toString.call(a)}},{}],36:[function(a,b,c){function d(){k=!1,h.length?j=h.concat(j):l=-1,j.length&&e()}function e(){if(!k){var a=setTimeout(d);k=!0;for(var b=j.length;b;){for(h=j,j=[];++l<b;)h&&h[l].run();l=-1,b=j.length}h=null,k=!1,clearTimeout(a)}}function f(a,b){this.fun=a,this.array=b}function g(){}var h,i=b.exports={},j=[],k=!1,l=-1;i.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];j.push(new f(a,b)),1!==j.length||k||setTimeout(e,0)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.binding=function(a){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(a){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],37:[function(a,b,c){b.exports=a("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":38}],38:[function(a,b,c){(function(c){function d(a){return this instanceof d?(i.call(this,a),j.call(this,a),a&&a.readable===!1&&(this.readable=!1),a&&a.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,a&&a.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",e)):new d(a)}function e(){this.allowHalfOpen||this._writableState.ended||c.nextTick(this.end.bind(this))}function f(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}b.exports=d;var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},h=a("core-util-is");h.inherits=a("inherits");var i=a("./_stream_readable"),j=a("./_stream_writable");h.inherits(d,i),f(g(j.prototype),function(a){d.prototype[a]||(d.prototype[a]=j.prototype[a])})}).call(this,a("_process"))},{"./_stream_readable":40,"./_stream_writable":42,_process:36,"core-util-is":43,inherits:33}],39:[function(a,b,c){function d(a){return this instanceof d?void e.call(this,a):new d(a)}b.exports=d;var e=a("./_stream_transform"),f=a("core-util-is");f.inherits=a("inherits"),f.inherits(d,e),d.prototype._transform=function(a,b,c){c(null,a)}},{"./_stream_transform":41,"core-util-is":43,inherits:33}],40:[function(a,b,c){(function(c){function d(b,c){var d=a("./_stream_duplex");b=b||{};var e=b.highWaterMark,f=b.objectMode?16:16384;this.highWaterMark=e||0===e?e:f,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!b.objectMode,c instanceof d&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.defaultEncoding=b.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(C||(C=a("string_decoder/").StringDecoder),this.decoder=new C(b.encoding),this.encoding=b.encoding)}function e(b){a("./_stream_duplex");return this instanceof e?(this._readableState=new d(b,this),this.readable=!0,void A.call(this)):new e(b)}function f(a,b,c,d,e){var f=j(b,c);if(f)a.emit("error",f);else if(B.isNullOrUndefined(c))b.reading=!1,b.ended||k(a,b);else if(b.objectMode||c&&c.length>0)if(b.ended&&!e){var h=new Error("stream.push() after EOF");a.emit("error",h)}else if(b.endEmitted&&e){var h=new Error("stream.unshift() after end event");a.emit("error",h)}else!b.decoder||e||d||(c=b.decoder.write(c)),e||(b.reading=!1),b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&l(a)),n(a,b);else e||(b.reading=!1);return g(b)}function g(a){return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function h(a){if(a>=E)a=E;else{a--;for(var b=1;32>b;b<<=1)a|=a>>b;a++}return a}function i(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:isNaN(a)||B.isNull(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:0>=a?0:(a>b.highWaterMark&&(b.highWaterMark=h(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function j(a,b){var c=null;return B.isBuffer(b)||B.isString(b)||B.isNullOrUndefined(b)||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function k(a,b){if(b.decoder&&!b.ended){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,l(a)}function l(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(D("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?c.nextTick(function(){m(a)}):m(a))}function m(a){D("emit readable"),a.emit("readable"),s(a)}function n(a,b){b.readingMore||(b.readingMore=!0,c.nextTick(function(){o(a,b)}))}function o(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length<b.highWaterMark&&(D("maybeReadMore read 0"),a.read(0),c!==b.length);)c=b.length;b.readingMore=!1}function p(a){return function(){var b=a._readableState;D("pipeOnDrain",b.awaitDrain),b.awaitDrain&&b.awaitDrain--,0===b.awaitDrain&&z.listenerCount(a,"data")&&(b.flowing=!0,s(a))}}function q(a,b){b.resumeScheduled||(b.resumeScheduled=!0,c.nextTick(function(){r(a,b)}))}function r(a,b){b.resumeScheduled=!1,a.emit("resume"),s(a),b.flowing&&!b.reading&&a.read(0)}function s(a){var b=a._readableState;if(D("flow",b.flowing),b.flowing)do var c=a.read();while(null!==c&&b.flowing)}function t(a,b){var c,d=b.buffer,e=b.length,f=!!b.decoder,g=!!b.objectMode;if(0===d.length)return null;if(0===e)c=null;else if(g)c=d.shift();else if(!a||a>=e)c=f?d.join(""):y.concat(d,e),d.length=0;else if(a<d[0].length){var h=d[0];c=h.slice(0,a),d[0]=h.slice(a)}else if(a===d[0].length)c=d.shift();else{c=f?"":new y(a);for(var i=0,j=0,k=d.length;k>j&&a>i;j++){var h=d[0],l=Math.min(a-i,h.length);f?c+=h.slice(0,l):h.copy(c,i,0,l),l<h.length?d[0]=h.slice(l):d.shift(),i+=l}}return c}function u(a){var b=a._readableState;if(b.length>0)throw new Error("endReadable called on non-empty stream");b.endEmitted||(b.ended=!0,c.nextTick(function(){b.endEmitted||0!==b.length||(b.endEmitted=!0,a.readable=!1,a.emit("end"))}))}function v(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}function w(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}b.exports=e;var x=a("isarray"),y=a("buffer").Buffer;e.ReadableState=d;var z=a("events").EventEmitter;z.listenerCount||(z.listenerCount=function(a,b){return a.listeners(b).length});var A=a("stream"),B=a("core-util-is");B.inherits=a("inherits");var C,D=a("util");D=D&&D.debuglog?D.debuglog("stream"):function(){},B.inherits(e,A),e.prototype.push=function(a,b){var c=this._readableState;return B.isString(a)&&!c.objectMode&&(b=b||c.defaultEncoding,b!==c.encoding&&(a=new y(a,b),b="")),f(this,c,a,b,!1)},e.prototype.unshift=function(a){var b=this._readableState;return f(this,b,a,"",!0)},e.prototype.setEncoding=function(b){return C||(C=a("string_decoder/").StringDecoder),this._readableState.decoder=new C(b),this._readableState.encoding=b,this};var E=8388608;e.prototype.read=function(a){D("read",a);var b=this._readableState,c=a;if((!B.isNumber(a)||a>0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return D("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?u(this):l(this),null;if(a=i(a,b),0===a&&b.ended)return 0===b.length&&u(this),null;var d=b.needReadable;D("need readable",d),(0===b.length||b.length-a<b.highWaterMark)&&(d=!0,D("length less than watermark",d)),(b.ended||b.reading)&&(d=!1,D("reading or ended",d)),d&&(D("do read"),b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1),d&&!b.reading&&(a=i(c,b));var e;return e=a>0?t(a,b):null,B.isNull(e)&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),c!==a&&b.ended&&0===b.length&&u(this),B.isNull(e)||this.emit("data",e),e},e.prototype._read=function(a){this.emit("error",new Error("not implemented"))},e.prototype.pipe=function(a,b){function d(a){D("onunpipe"),a===l&&f()}function e(){D("onend"),a.end()}function f(){D("cleanup"),a.removeListener("close",i),a.removeListener("finish",j),a.removeListener("drain",q),a.removeListener("error",h),a.removeListener("unpipe",d),l.removeListener("end",e),l.removeListener("end",f),l.removeListener("data",g),!m.awaitDrain||a._writableState&&!a._writableState.needDrain||q()}function g(b){D("ondata");var c=a.write(b);!1===c&&(D("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++,l.pause())}function h(b){D("onerror",b),k(),a.removeListener("error",h),0===z.listenerCount(a,"error")&&a.emit("error",b)}function i(){a.removeListener("finish",j),k()}function j(){D("onfinish"),a.removeListener("close",i),k()}function k(){D("unpipe"),l.unpipe(a)}var l=this,m=this._readableState;switch(m.pipesCount){case 0:m.pipes=a;break;case 1:m.pipes=[m.pipes,a];
break;default:m.pipes.push(a)}m.pipesCount+=1,D("pipe count=%d opts=%j",m.pipesCount,b);var n=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,o=n?e:f;m.endEmitted?c.nextTick(o):l.once("end",o),a.on("unpipe",d);var q=p(l);return a.on("drain",q),l.on("data",g),a._events&&a._events.error?x(a._events.error)?a._events.error.unshift(h):a._events.error=[h,a._events.error]:a.on("error",h),a.once("close",i),a.once("finish",j),a.emit("pipe",l),m.flowing||(D("pipe resume"),l.resume()),a},e.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;d>e;e++)c[e].emit("unpipe",this);return this}var e=w(b.pipes,a);return-1===e?this:(b.pipes.splice(e,1),b.pipesCount-=1,1===b.pipesCount&&(b.pipes=b.pipes[0]),a.emit("unpipe",this),this)},e.prototype.on=function(a,b){var d=A.prototype.on.call(this,a,b);if("data"===a&&!1!==this._readableState.flowing&&this.resume(),"readable"===a&&this.readable){var e=this._readableState;if(!e.readableListening)if(e.readableListening=!0,e.emittedReadable=!1,e.needReadable=!0,e.reading)e.length&&l(this,e);else{var f=this;c.nextTick(function(){D("readable nexttick read 0"),f.read(0)})}}return d},e.prototype.addListener=e.prototype.on,e.prototype.resume=function(){var a=this._readableState;return a.flowing||(D("resume"),a.flowing=!0,a.reading||(D("resume read 0"),this.read(0)),q(this,a)),this},e.prototype.pause=function(){return D("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(D("pause"),this._readableState.flowing=!1,this.emit("pause")),this},e.prototype.wrap=function(a){var b=this._readableState,c=!1,d=this;a.on("end",function(){if(D("wrapped end"),b.decoder&&!b.ended){var a=b.decoder.end();a&&a.length&&d.push(a)}d.push(null)}),a.on("data",function(e){if(D("wrapped data"),b.decoder&&(e=b.decoder.write(e)),e&&(b.objectMode||e.length)){var f=d.push(e);f||(c=!0,a.pause())}});for(var e in a)B.isFunction(a[e])&&B.isUndefined(this[e])&&(this[e]=function(b){return function(){return a[b].apply(a,arguments)}}(e));var f=["error","close","destroy","pause","resume"];return v(f,function(b){a.on(b,d.emit.bind(d,b))}),d._read=function(b){D("wrapped _read",b),c&&(c=!1,a.resume())},d},e._fromList=t}).call(this,a("_process"))},{"./_stream_duplex":38,_process:36,buffer:28,"core-util-is":43,events:32,inherits:33,isarray:35,stream:48,"string_decoder/":49,util:27}],41:[function(a,b,c){function d(a,b){this.afterTransform=function(a,c){return e(b,a,c)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function e(a,b,c){var d=a._transformState;d.transforming=!1;var e=d.writecb;if(!e)return a.emit("error",new Error("no writecb in Transform class"));d.writechunk=null,d.writecb=null,i.isNullOrUndefined(c)||a.push(c),e&&e(b);var f=a._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&a._read(f.highWaterMark)}function f(a){if(!(this instanceof f))return new f(a);h.call(this,a),this._transformState=new d(a,this);var b=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("prefinish",function(){i.isFunction(this._flush)?this._flush(function(a){g(b,a)}):g(b)})}function g(a,b){if(b)return a.emit("error",b);var c=a._writableState,d=a._transformState;if(c.length)throw new Error("calling transform done when ws.length != 0");if(d.transforming)throw new Error("calling transform done when still transforming");return a.push(null)}b.exports=f;var h=a("./_stream_duplex"),i=a("core-util-is");i.inherits=a("inherits"),i.inherits(f,h),f.prototype.push=function(a,b){return this._transformState.needTransform=!1,h.prototype.push.call(this,a,b)},f.prototype._transform=function(a,b,c){throw new Error("not implemented")},f.prototype._write=function(a,b,c){var d=this._transformState;if(d.writecb=c,d.writechunk=a,d.writeencoding=b,!d.transforming){var e=this._readableState;(d.needTransform||e.needReadable||e.length<e.highWaterMark)&&this._read(e.highWaterMark)}},f.prototype._read=function(a){var b=this._transformState;i.isNull(b.writechunk)||!b.writecb||b.transforming?b.needTransform=!0:(b.transforming=!0,this._transform(b.writechunk,b.writeencoding,b.afterTransform))}},{"./_stream_duplex":38,"core-util-is":43,inherits:33}],42:[function(a,b,c){(function(c){function d(a,b,c){this.chunk=a,this.encoding=b,this.callback=c}function e(b,c){var d=a("./_stream_duplex");b=b||{};var e=b.highWaterMark,f=b.objectMode?16:16384;this.highWaterMark=e||0===e?e:f,this.objectMode=!!b.objectMode,c instanceof d&&(this.objectMode=this.objectMode||!!b.writableObjectMode),this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var g=b.decodeStrings===!1;this.decodeStrings=!g,this.defaultEncoding=b.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){n(c,a)},this.writecb=null,this.writelen=0,this.buffer=[],this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function f(b){var c=a("./_stream_duplex");return this instanceof f||this instanceof c?(this._writableState=new e(b,this),this.writable=!0,void x.call(this)):new f(b)}function g(a,b,d){var e=new Error("write after end");a.emit("error",e),c.nextTick(function(){d(e)})}function h(a,b,d,e){var f=!0;if(!(w.isBuffer(d)||w.isString(d)||w.isNullOrUndefined(d)||b.objectMode)){var g=new TypeError("Invalid non-string/buffer chunk");a.emit("error",g),c.nextTick(function(){e(g)}),f=!1}return f}function i(a,b,c){return!a.objectMode&&a.decodeStrings!==!1&&w.isString(b)&&(b=new v(b,c)),b}function j(a,b,c,e,f){c=i(b,c,e),w.isBuffer(c)&&(e="buffer");var g=b.objectMode?1:c.length;b.length+=g;var h=b.length<b.highWaterMark;return h||(b.needDrain=!0),b.writing||b.corked?b.buffer.push(new d(c,e,f)):k(a,b,!1,g,c,e,f),h}function k(a,b,c,d,e,f,g){b.writelen=d,b.writecb=g,b.writing=!0,b.sync=!0,c?a._writev(e,b.onwrite):a._write(e,f,b.onwrite),b.sync=!1}function l(a,b,d,e,f){d?c.nextTick(function(){b.pendingcb--,f(e)}):(b.pendingcb--,f(e)),a._writableState.errorEmitted=!0,a.emit("error",e)}function m(a){a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0}function n(a,b){var d=a._writableState,e=d.sync,f=d.writecb;if(m(d),b)l(a,d,e,b,f);else{var g=r(a,d);g||d.corked||d.bufferProcessing||!d.buffer.length||q(a,d),e?c.nextTick(function(){o(a,d,g,f)}):o(a,d,g,f)}}function o(a,b,c,d){c||p(a,b),b.pendingcb--,d(),t(a,b)}function p(a,b){0===b.length&&b.needDrain&&(b.needDrain=!1,a.emit("drain"))}function q(a,b){if(b.bufferProcessing=!0,a._writev&&b.buffer.length>1){for(var c=[],d=0;d<b.buffer.length;d++)c.push(b.buffer[d].callback);b.pendingcb++,k(a,b,!0,b.length,b.buffer,"",function(a){for(var d=0;d<c.length;d++)b.pendingcb--,c[d](a)}),b.buffer=[]}else{for(var d=0;d<b.buffer.length;d++){var e=b.buffer[d],f=e.chunk,g=e.encoding,h=e.callback,i=b.objectMode?1:f.length;if(k(a,b,!1,i,f,g,h),b.writing){d++;break}}d<b.buffer.length?b.buffer=b.buffer.slice(d):b.buffer.length=0}b.bufferProcessing=!1}function r(a,b){return b.ending&&0===b.length&&!b.finished&&!b.writing}function s(a,b){b.prefinished||(b.prefinished=!0,a.emit("prefinish"))}function t(a,b){var c=r(a,b);return c&&(0===b.pendingcb?(s(a,b),b.finished=!0,a.emit("finish")):s(a,b)),c}function u(a,b,d){b.ending=!0,t(a,b),d&&(b.finished?c.nextTick(d):a.once("finish",d)),b.ended=!0}b.exports=f;var v=a("buffer").Buffer;f.WritableState=e;var w=a("core-util-is");w.inherits=a("inherits");var x=a("stream");w.inherits(f,x),f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},f.prototype.write=function(a,b,c){var d=this._writableState,e=!1;return w.isFunction(b)&&(c=b,b=null),w.isBuffer(a)?b="buffer":b||(b=d.defaultEncoding),w.isFunction(c)||(c=function(){}),d.ended?g(this,d,c):h(this,d,a,c)&&(d.pendingcb++,e=j(this,d,a,b,c)),e},f.prototype.cork=function(){var a=this._writableState;a.corked++},f.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.buffer.length||q(this,a))},f.prototype._write=function(a,b,c){c(new Error("not implemented"))},f.prototype._writev=null,f.prototype.end=function(a,b,c){var d=this._writableState;w.isFunction(a)?(c=a,a=null,b=null):w.isFunction(b)&&(c=b,b=null),w.isNullOrUndefined(a)||this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||u(this,d,c)}}).call(this,a("_process"))},{"./_stream_duplex":38,_process:36,buffer:28,"core-util-is":43,inherits:33,stream:48}],43:[function(a,b,c){(function(a){function b(a){return Array.isArray(a)}function d(a){return"boolean"==typeof a}function e(a){return null===a}function f(a){return null==a}function g(a){return"number"==typeof a}function h(a){return"string"==typeof a}function i(a){return"symbol"==typeof a}function j(a){return void 0===a}function k(a){return l(a)&&"[object RegExp]"===r(a)}function l(a){return"object"==typeof a&&null!==a}function m(a){return l(a)&&"[object Date]"===r(a)}function n(a){return l(a)&&("[object Error]"===r(a)||a instanceof Error)}function o(a){return"function"==typeof a}function p(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function q(b){return a.isBuffer(b)}function r(a){return Object.prototype.toString.call(a)}c.isArray=b,c.isBoolean=d,c.isNull=e,c.isNullOrUndefined=f,c.isNumber=g,c.isString=h,c.isSymbol=i,c.isUndefined=j,c.isRegExp=k,c.isObject=l,c.isDate=m,c.isError=n,c.isFunction=o,c.isPrimitive=p,c.isBuffer=q}).call(this,{isBuffer:a("/Users/igorkhomenko/workspace/quickblox-javascript-sdk/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js")})},{"/Users/igorkhomenko/workspace/quickblox-javascript-sdk/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js":34}],44:[function(a,b,c){b.exports=a("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":39}],45:[function(a,b,c){c=b.exports=a("./lib/_stream_readable.js"),c.Stream=a("stream"),c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":38,"./lib/_stream_passthrough.js":39,"./lib/_stream_readable.js":40,"./lib/_stream_transform.js":41,"./lib/_stream_writable.js":42,stream:48}],46:[function(a,b,c){b.exports=a("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":41}],47:[function(a,b,c){b.exports=a("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":42}],48:[function(a,b,c){function d(){e.call(this)}b.exports=d;var e=a("events").EventEmitter,f=a("inherits");f(d,e),d.Readable=a("readable-stream/readable.js"),d.Writable=a("readable-stream/writable.js"),d.Duplex=a("readable-stream/duplex.js"),d.Transform=a("readable-stream/transform.js"),d.PassThrough=a("readable-stream/passthrough.js"),d.Stream=d,d.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()}function d(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===e.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",d),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",d),a._isStdio||b&&b.end===!1||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{events:32,inherits:33,"readable-stream/duplex.js":37,"readable-stream/passthrough.js":44,"readable-stream/readable.js":45,"readable-stream/transform.js":46,"readable-stream/writable.js":47}],49:[function(a,b,c){function d(a){if(a&&!i(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function g(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var h=a("buffer").Buffer,i=h.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},j=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};j.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived<this.charLength)return"";a=a.slice(c,a.length),b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var d=b.charCodeAt(b.length-1);if(!(d>=55296&&56319>=d)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&56319>=d){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(2>=b&&c>>4==14){this.charLength=3;break}if(3>=b&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:28}],50:[function(a,b,c){function d(a,b){this._id=a,this._clearFn=b}var e=a("process/browser.js").nextTick,f=Function.prototype.apply,g=Array.prototype.slice,h={},i=0;c.setTimeout=function(){return new d(f.call(setTimeout,window,arguments),clearTimeout)},c.setInterval=function(){return new d(f.call(setInterval,window,arguments),clearInterval)},c.clearTimeout=c.clearInterval=function(a){a.close()},d.prototype.unref=d.prototype.ref=function(){},d.prototype.close=function(){this._clearFn.call(window,this._id)},c.enroll=function(a,b){clearTimeout(a._idleTimeoutId),a._idleTimeout=b},c.unenroll=function(a){clearTimeout(a._idleTimeoutId),a._idleTimeout=-1},c._unrefActive=c.active=function(a){clearTimeout(a._idleTimeoutId);var b=a._idleTimeout;b>=0&&(a._idleTimeoutId=setTimeout(function(){a._onTimeout&&a._onTimeout()},b))},c.setImmediate="function"==typeof setImmediate?setImmediate:function(a){var b=i++,d=arguments.length<2?!1:g.call(arguments,1);return h[b]=!0,e(function(){h[b]&&(d?a.apply(null,d):a.call(null),c.clearImmediate(b))}),b},c.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(a){delete h[a]}},{"process/browser.js":36}],51:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],52:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)F(b,String(g))?f.push(m(a,b,c,d,String(g),!0)):f.push("");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.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]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":51,_process:36,inherits:33}],53:[function(a,b,c){(function(){"use strict";var b;b=a("../lib/xml2js"),c.stripBOM=function(a){return"\ufeff"===a[0]?a.substring(1):a}}).call(this)},{"../lib/xml2js":55}],54:[function(a,b,c){(function(){"use strict";var a;a=new RegExp(/(?!xmlns)^.*:/),c.normalize=function(a){return a.toLowerCase()},c.firstCharLowerCase=function(a){return a.charAt(0).toLowerCase()+a.slice(1)},c.stripPrefix=function(b){return b.replace(a,"")},c.parseNumbers=function(a){return isNaN(a)||(a=a%1===0?parseInt(a,10):parseFloat(a)),a},c.parseBooleans=function(a){return/^(?:true|false)$/i.test(a)&&(a="true"===a.toLowerCase()),a}}).call(this)},{}],55:[function(a,b,c){(function(){"use strict";var b,d,e,f,g,h,i,j,k,l,m,n=function(a,b){function c(){this.constructor=a}for(var d in b)o.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},o={}.hasOwnProperty,p=function(a,b){return function(){return a.apply(b,arguments)}};k=a("sax"),f=a("events"),d=a("xmlbuilder"),b=a("./bom"),i=a("./processors"),l=a("timers").setImmediate,g=function(a){return"object"==typeof a&&null!=a&&0===Object.keys(a).length},h=function(a,b){var c,d,e;for(c=0,d=a.length;d>c;c++)e=a[c],b=e(b);return b},j=function(a){return a.indexOf("&")>=0||a.indexOf(">")>=0||a.indexOf("<")>=0},m=function(a){return"<![CDATA["+e(a)+"]]>"},e=function(a){return a.replace("]]>","]]]]><![CDATA[>")},c.processors=i,c.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,async:!1,strict:!0,attrNameProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,async:!1,strict:!0,attrNameProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}},c.ValidationError=function(a){function b(a){this.message=a}return n(b,a),b}(Error),c.Builder=function(){function a(a){var b,d,e;this.options={},d=c.defaults[.2];for(b in d)o.call(d,b)&&(e=d[b],this.options[b]=e);for(b in a)o.call(a,b)&&(e=a[b],this.options[b]=e)}return a.prototype.buildObject=function(a){var b,e,f,g,h;return b=this.options.attrkey,e=this.options.charkey,1===Object.keys(a).length&&this.options.rootName===c.defaults[.2].rootName?(h=Object.keys(a)[0],a=a[h]):h=this.options.rootName,f=function(a){return function(c,d){var g,h,i,k,l,n;if("object"!=typeof d)a.options.cdata&&j(d)?c.raw(m(d)):c.txt(d);else for(l in d)if(o.call(d,l))if(h=d[l],l===b){if("object"==typeof h)for(g in h)n=h[g],c=c.att(g,n)}else if(l===e)c=a.options.cdata&&j(h)?c.raw(m(h)):c.txt(h);else if(Array.isArray(h))for(k in h)o.call(h,k)&&(i=h[k],c="string"==typeof i?a.options.cdata&&j(i)?c.ele(l).raw(m(i)).up():c.ele(l,i).up():f(c.ele(l),i).up());else c="object"==typeof h?f(c.ele(l),h).up():"string"==typeof h&&a.options.cdata&&j(h)?c.ele(l).raw(m(h)).up():c.ele(l,h.toString()).up();return c}}(this),g=d.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless}),f(g,a).end(this.options.renderOpts)},a}(),c.Parser=function(a){function d(a){this.parseString=p(this.parseString,this),this.reset=p(this.reset,this),this.assignOrPush=p(this.assignOrPush,this),this.processAsync=p(this.processAsync,this);var b,d,e;if(!(this instanceof c.Parser))return new c.Parser(a);this.options={},d=c.defaults[.2];for(b in d)o.call(d,b)&&(e=d[b],this.options[b]=e);for(b in a)o.call(a,b)&&(e=a[b],this.options[b]=e);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(i.normalize)),this.reset()}return n(d,a),d.prototype.processAsync=function(){var a;return this.remaining.length<=this.options.chunkSize?(a=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(a),this.saxParser.close()):(a=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(a),l(this.processAsync))},d.prototype.assignOrPush=function(a,b,c){return b in a?(a[b]instanceof Array||(a[b]=[a[b]]),a[b].push(c)):this.options.explicitArray?a[b]=[c]:a[b]=c},d.prototype.reset=function(){var a,b,c,d;return this.removeAllListeners(),this.saxParser=k.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(a){return function(b){return a.saxParser.resume(),a.saxParser.errThrown?void 0:(a.saxParser.errThrown=!0,a.emit("error",b))}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,d=[],a=this.options.attrkey,b=this.options.charkey,this.saxParser.onopentag=function(c){return function(e){var f,g,i,j,k;if(i={},i[b]="",!c.options.ignoreAttrs){k=e.attributes;for(f in k)o.call(k,f)&&(a in i||c.options.mergeAttrs||(i[a]={}),g=e.attributes[f],j=c.options.attrNameProcessors?h(c.options.attrNameProcessors,f):f,c.options.mergeAttrs?c.assignOrPush(i,j,g):i[a][j]=g)}return i["#name"]=c.options.tagNameProcessors?h(c.options.tagNameProcessors,e.name):e.name,c.options.xmlns&&(i[c.options.xmlnskey]={uri:e.uri,local:e.local}),d.push(i)}}(this),this.saxParser.onclosetag=function(a){return function(){var c,e,f,i,j,k,l,m,n,p,q;if(l=d.pop(),k=l["#name"],a.options.explicitChildren&&a.options.preserveChildrenOrder||delete l["#name"],l.cdata===!0&&(c=l.cdata,delete l.cdata),p=d[d.length-1],l[b].match(/^\s*$/)&&!c?(e=l[b],delete l[b]):(a.options.trim&&(l[b]=l[b].trim()),a.options.normalize&&(l[b]=l[b].replace(/\s{2,}/g," ").trim()),l[b]=a.options.valueProcessors?h(a.options.valueProcessors,l[b]):l[b],1===Object.keys(l).length&&b in l&&!a.EXPLICIT_CHARKEY&&(l=l[b])),g(l)&&(l=""!==a.options.emptyTag?a.options.emptyTag:e),null!=a.options.validator){q="/"+function(){var a,b,c;for(c=[],a=0,b=d.length;b>a;a++)j=d[a],c.push(j["#name"]);return c}().concat(k).join("/");try{l=a.options.validator(q,p&&p[k],l)}catch(r){f=r,a.emit("error",f)}}if(a.options.explicitChildren&&!a.options.mergeAttrs&&"object"==typeof l)if(a.options.preserveChildrenOrder){if(p){p[a.options.childkey]=p[a.options.childkey]||[],m={};for(i in l)o.call(l,i)&&(m[i]=l[i]);p[a.options.childkey].push(m),delete l["#name"],1===Object.keys(l).length&&b in l&&!a.EXPLICIT_CHARKEY&&(l=l[b])}}else j={},a.options.attrkey in l&&(j[a.options.attrkey]=l[a.options.attrkey],delete l[a.options.attrkey]),!a.options.charsAsChildren&&a.options.charkey in l&&(j[a.options.charkey]=l[a.options.charkey],delete l[a.options.charkey]),Object.getOwnPropertyNames(l).length>0&&(j[a.options.childkey]=l),l=j;return d.length>0?a.assignOrPush(p,k,l):(a.options.explicitRoot&&(n=l,l={},l[k]=n),a.resultObject=l,a.saxParser.ended=!0,a.emit("end",a.resultObject))}}(this),c=function(a){return function(c){var e,f;return f=d[d.length-1],f?(f[b]+=c,a.options.explicitChildren&&a.options.preserveChildrenOrder&&a.options.charsAsChildren&&""!==c.replace(/\\n/g,"").trim()&&(f[a.options.childkey]=f[a.options.childkey]||[],e={"#name":"__text__"},e[b]=c,f[a.options.childkey].push(e)),f):void 0}}(this),this.saxParser.ontext=c,this.saxParser.oncdata=function(a){return function(a){var b;return b=c(a),b?b.cdata=!0:void 0}}(this)},d.prototype.parseString=function(a,c){var d;if(null!=c&&"function"==typeof c&&(this.on("end",function(a){return this.reset(),c(null,a)}),this.on("error",function(a){return this.reset(),c(a)})),a=a.toString(),""===a.trim())return this.emit("end",null),!0;try{return a=b.stripBOM(a),this.options.async?(this.remaining=a,l(this.processAsync),this.saxParser):this.saxParser.write(a).close()}catch(e){if(d=e,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",d),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw d}},d}(f.EventEmitter),c.parseString=function(a,b,d){var e,f,g;return null!=d?("function"==typeof d&&(e=d),"object"==typeof b&&(f=b)):("function"==typeof b&&(e=b),f={}),g=new c.Parser(f),g.parseString(a,e)}}).call(this)},{"./bom":53,"./processors":54,events:32,sax:56,timers:50,xmlbuilder:73}],56:[function(a,b,c){(function(b){!function(c){function d(a,b){if(!(this instanceof d))return new d(a,b);var e=this;f(e),e.q=e.c="",e.bufferCheckPosition=c.MAX_BUFFER_LENGTH,e.opt=b||{},e.opt.lowercase=e.opt.lowercase||e.opt.lowercasetags,e.looseCase=e.opt.lowercase?"toLowerCase":"toUpperCase",e.tags=[],e.closed=e.closedRoot=e.sawRoot=!1,e.tag=e.error=null,e.strict=!!a,e.noscript=!(!a&&!e.opt.noscript),e.state=S.BEGIN,e.strictEntities=e.opt.strictEntities,e.ENTITIES=e.strictEntities?Object.create(c.XML_ENTITIES):Object.create(c.ENTITIES),e.attribList=[],e.opt.xmlns&&(e.ns=Object.create(P)),e.trackPosition=e.opt.position!==!1,e.trackPosition&&(e.position=e.line=e.column=0),n(e,"onready")}function e(a){for(var b=Math.max(c.MAX_BUFFER_LENGTH,10),d=0,e=0,f=B.length;f>e;e++){var g=a[B[e]].length;if(g>b)switch(B[e]){case"textNode":p(a);break;case"cdata":o(a,"oncdata",a.cdata),a.cdata="";break;case"script":o(a,"onscript",a.script),a.script="";break;default:r(a,"Max buffer length exceeded: "+B[e])}d=Math.max(d,g)}a.bufferCheckPosition=c.MAX_BUFFER_LENGTH-d+a.position}function f(a){for(var b=0,c=B.length;c>b;b++)a[B[b]]=""}function g(a){p(a),""!==a.cdata&&(o(a,"oncdata",a.cdata),a.cdata=""),""!==a.script&&(o(a,"onscript",a.script),a.script="")}function h(a,b){return new i(a,b)}function i(a,b){if(!(this instanceof i))return new i(a,b);C.apply(this),this._parser=new d(a,b),this.writable=!0,this.readable=!0;
var c=this;this._parser.onend=function(){c.emit("end")},this._parser.onerror=function(a){c.emit("error",a),c._parser.error=null},this._decoder=null,E.forEach(function(a){Object.defineProperty(c,"on"+a,{get:function(){return c._parser["on"+a]},set:function(b){return b?void c.on(a,b):(c.removeAllListeners(a),c._parser["on"+a]=b)},enumerable:!0,configurable:!1})})}function j(a){return a.split("").reduce(function(a,b){return a[b]=!0,a},{})}function k(a){return"[object RegExp]"===Object.prototype.toString.call(a)}function l(a,b){return k(a)?!!b.match(a):a[b]}function m(a,b){return!l(a,b)}function n(a,b,c){a[b]&&a[b](c)}function o(a,b,c){a.textNode&&p(a),n(a,b,c)}function p(a){a.textNode=q(a.opt,a.textNode),a.textNode&&n(a,"ontext",a.textNode),a.textNode=""}function q(a,b){return a.trim&&(b=b.trim()),a.normalize&&(b=b.replace(/\s+/g," ")),b}function r(a,b){return p(a),a.trackPosition&&(b+="\nLine: "+a.line+"\nColumn: "+a.column+"\nChar: "+a.c),b=new Error(b),a.error=b,n(a,"onerror",b),a}function s(a){return a.sawRoot&&!a.closedRoot&&t(a,"Unclosed root tag"),a.state!==S.BEGIN&&a.state!==S.BEGIN_WHITESPACE&&a.state!==S.TEXT&&r(a,"Unexpected end"),p(a),a.c="",a.closed=!0,n(a,"onend"),d.call(a,a.strict,a.opt),a}function t(a,b){if("object"!=typeof a||!(a instanceof d))throw new Error("bad call to strictFail");a.strict&&r(a,b)}function u(a){a.strict||(a.tagName=a.tagName[a.looseCase]());var b=a.tags[a.tags.length-1]||a,c=a.tag={name:a.tagName,attributes:{}};a.opt.xmlns&&(c.ns=b.ns),a.attribList.length=0}function v(a,b){var c=a.indexOf(":"),d=0>c?["",a]:a.split(":"),e=d[0],f=d[1];return b&&"xmlns"===a&&(e="xmlns",f=""),{prefix:e,local:f}}function w(a){if(a.strict||(a.attribName=a.attribName[a.looseCase]()),-1!==a.attribList.indexOf(a.attribName)||a.tag.attributes.hasOwnProperty(a.attribName))return a.attribName=a.attribValue="";if(a.opt.xmlns){var b=v(a.attribName,!0),c=b.prefix,d=b.local;if("xmlns"===c)if("xml"===d&&a.attribValue!==N)t(a,"xml: prefix must be bound to "+N+"\nActual: "+a.attribValue);else if("xmlns"===d&&a.attribValue!==O)t(a,"xmlns: prefix must be bound to "+O+"\nActual: "+a.attribValue);else{var e=a.tag,f=a.tags[a.tags.length-1]||a;e.ns===f.ns&&(e.ns=Object.create(f.ns)),e.ns[d]=a.attribValue}a.attribList.push([a.attribName,a.attribValue])}else a.tag.attributes[a.attribName]=a.attribValue,o(a,"onattribute",{name:a.attribName,value:a.attribValue});a.attribName=a.attribValue=""}function x(a,b){if(a.opt.xmlns){var c=a.tag,d=v(a.tagName);c.prefix=d.prefix,c.local=d.local,c.uri=c.ns[d.prefix]||"",c.prefix&&!c.uri&&(t(a,"Unbound namespace prefix: "+JSON.stringify(a.tagName)),c.uri=d.prefix);var e=a.tags[a.tags.length-1]||a;c.ns&&e.ns!==c.ns&&Object.keys(c.ns).forEach(function(b){o(a,"onopennamespace",{prefix:b,uri:c.ns[b]})});for(var f=0,g=a.attribList.length;g>f;f++){var h=a.attribList[f],i=h[0],j=h[1],k=v(i,!0),l=k.prefix,m=k.local,n=""==l?"":c.ns[l]||"",p={name:i,value:j,prefix:l,local:m,uri:n};l&&"xmlns"!=l&&!n&&(t(a,"Unbound namespace prefix: "+JSON.stringify(l)),p.uri=l),a.tag.attributes[i]=p,o(a,"onattribute",p)}a.attribList.length=0}a.tag.isSelfClosing=!!b,a.sawRoot=!0,a.tags.push(a.tag),o(a,"onopentag",a.tag),b||(a.noscript||"script"!==a.tagName.toLowerCase()?a.state=S.TEXT:a.state=S.SCRIPT,a.tag=null,a.tagName=""),a.attribName=a.attribValue="",a.attribList.length=0}function y(a){if(!a.tagName)return t(a,"Weird empty close tag."),a.textNode+="</>",void(a.state=S.TEXT);if(a.script){if("script"!==a.tagName)return a.script+="</"+a.tagName+">",a.tagName="",void(a.state=S.SCRIPT);o(a,"onscript",a.script),a.script=""}var b=a.tags.length,c=a.tagName;a.strict||(c=c[a.looseCase]());for(var d=c;b--;){var e=a.tags[b];if(e.name===d)break;t(a,"Unexpected close tag")}if(0>b)return t(a,"Unmatched closing tag: "+a.tagName),a.textNode+="</"+a.tagName+">",void(a.state=S.TEXT);a.tagName=c;for(var f=a.tags.length;f-->b;){var g=a.tag=a.tags.pop();a.tagName=a.tag.name,o(a,"onclosetag",a.tagName);var h={};for(var i in g.ns)h[i]=g.ns[i];var j=a.tags[a.tags.length-1]||a;a.opt.xmlns&&g.ns!==j.ns&&Object.keys(g.ns).forEach(function(b){var c=g.ns[b];o(a,"onclosenamespace",{prefix:b,uri:c})})}0===b&&(a.closedRoot=!0),a.tagName=a.attribValue=a.attribName="",a.attribList.length=0,a.state=S.TEXT}function z(a){var b,c=a.entity,d=c.toLowerCase(),e="";return a.ENTITIES[c]?a.ENTITIES[c]:a.ENTITIES[d]?a.ENTITIES[d]:(c=d,"#"===c.charAt(0)&&("x"===c.charAt(1)?(c=c.slice(2),b=parseInt(c,16),e=b.toString(16)):(c=c.slice(1),b=parseInt(c,10),e=b.toString(10))),c=c.replace(/^0+/,""),e.toLowerCase()!==c?(t(a,"Invalid character entity"),"&"+a.entity+";"):String.fromCodePoint(b))}function A(a){var b=this;if(this.error)throw this.error;if(b.closed)return r(b,"Cannot write after close. Assign an onready handler.");if(null===a)return s(b);for(var c=0,d="";b.c=d=a.charAt(c++);)switch(b.trackPosition&&(b.position++,"\n"===d?(b.line++,b.column=0):b.column++),b.state){case S.BEGIN:if(b.state=S.BEGIN_WHITESPACE,"\ufeff"===d)continue;case S.BEGIN_WHITESPACE:"<"===d?(b.state=S.OPEN_WAKA,b.startTagPosition=b.position):m(F,d)&&(t(b,"Non-whitespace before first tag."),b.textNode=d,b.state=S.TEXT);continue;case S.TEXT:if(b.sawRoot&&!b.closedRoot){for(var f=c-1;d&&"<"!==d&&"&"!==d;)d=a.charAt(c++),d&&b.trackPosition&&(b.position++,"\n"===d?(b.line++,b.column=0):b.column++);b.textNode+=a.substring(f,c-1)}"<"!==d||b.sawRoot&&b.closedRoot&&!b.strict?(!m(F,d)||b.sawRoot&&!b.closedRoot||t(b,"Text data outside of root node."),"&"===d?b.state=S.TEXT_ENTITY:b.textNode+=d):(b.state=S.OPEN_WAKA,b.startTagPosition=b.position);continue;case S.SCRIPT:"<"===d?b.state=S.SCRIPT_ENDING:b.script+=d;continue;case S.SCRIPT_ENDING:"/"===d?b.state=S.CLOSE_TAG:(b.script+="<"+d,b.state=S.SCRIPT);continue;case S.OPEN_WAKA:if("!"===d)b.state=S.SGML_DECL,b.sgmlDecl="";else if(l(F,d));else if(l(Q,d))b.state=S.OPEN_TAG,b.tagName=d;else if("/"===d)b.state=S.CLOSE_TAG,b.tagName="";else if("?"===d)b.state=S.PROC_INST,b.procInstName=b.procInstBody="";else{if(t(b,"Unencoded <"),b.startTagPosition+1<b.position){var g=b.position-b.startTagPosition;d=new Array(g).join(" ")+d}b.textNode+="<"+d,b.state=S.TEXT}continue;case S.SGML_DECL:(b.sgmlDecl+d).toUpperCase()===L?(o(b,"onopencdata"),b.state=S.CDATA,b.sgmlDecl="",b.cdata=""):b.sgmlDecl+d==="--"?(b.state=S.COMMENT,b.comment="",b.sgmlDecl=""):(b.sgmlDecl+d).toUpperCase()===M?(b.state=S.DOCTYPE,(b.doctype||b.sawRoot)&&t(b,"Inappropriately located doctype declaration"),b.doctype="",b.sgmlDecl=""):">"===d?(o(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=S.TEXT):l(I,d)?(b.state=S.SGML_DECL_QUOTED,b.sgmlDecl+=d):b.sgmlDecl+=d;continue;case S.SGML_DECL_QUOTED:d===b.q&&(b.state=S.SGML_DECL,b.q=""),b.sgmlDecl+=d;continue;case S.DOCTYPE:">"===d?(b.state=S.TEXT,o(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=d,"["===d?b.state=S.DOCTYPE_DTD:l(I,d)&&(b.state=S.DOCTYPE_QUOTED,b.q=d));continue;case S.DOCTYPE_QUOTED:b.doctype+=d,d===b.q&&(b.q="",b.state=S.DOCTYPE);continue;case S.DOCTYPE_DTD:b.doctype+=d,"]"===d?b.state=S.DOCTYPE:l(I,d)&&(b.state=S.DOCTYPE_DTD_QUOTED,b.q=d);continue;case S.DOCTYPE_DTD_QUOTED:b.doctype+=d,d===b.q&&(b.state=S.DOCTYPE_DTD,b.q="");continue;case S.COMMENT:"-"===d?b.state=S.COMMENT_ENDING:b.comment+=d;continue;case S.COMMENT_ENDING:"-"===d?(b.state=S.COMMENT_ENDED,b.comment=q(b.opt,b.comment),b.comment&&o(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+d,b.state=S.COMMENT);continue;case S.COMMENT_ENDED:">"!==d?(t(b,"Malformed comment"),b.comment+="--"+d,b.state=S.COMMENT):b.state=S.TEXT;continue;case S.CDATA:"]"===d?b.state=S.CDATA_ENDING:b.cdata+=d;continue;case S.CDATA_ENDING:"]"===d?b.state=S.CDATA_ENDING_2:(b.cdata+="]"+d,b.state=S.CDATA);continue;case S.CDATA_ENDING_2:">"===d?(b.cdata&&o(b,"oncdata",b.cdata),o(b,"onclosecdata"),b.cdata="",b.state=S.TEXT):"]"===d?b.cdata+="]":(b.cdata+="]]"+d,b.state=S.CDATA);continue;case S.PROC_INST:"?"===d?b.state=S.PROC_INST_ENDING:l(F,d)?b.state=S.PROC_INST_BODY:b.procInstName+=d;continue;case S.PROC_INST_BODY:if(!b.procInstBody&&l(F,d))continue;"?"===d?b.state=S.PROC_INST_ENDING:b.procInstBody+=d;continue;case S.PROC_INST_ENDING:">"===d?(o(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=S.TEXT):(b.procInstBody+="?"+d,b.state=S.PROC_INST_BODY);continue;case S.OPEN_TAG:l(R,d)?b.tagName+=d:(u(b),">"===d?x(b):"/"===d?b.state=S.OPEN_TAG_SLASH:(m(F,d)&&t(b,"Invalid character in tag name"),b.state=S.ATTRIB));continue;case S.OPEN_TAG_SLASH:">"===d?(x(b,!0),y(b)):(t(b,"Forward-slash in opening tag not followed by >"),b.state=S.ATTRIB);continue;case S.ATTRIB:if(l(F,d))continue;">"===d?x(b):"/"===d?b.state=S.OPEN_TAG_SLASH:l(Q,d)?(b.attribName=d,b.attribValue="",b.state=S.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case S.ATTRIB_NAME:"="===d?b.state=S.ATTRIB_VALUE:">"===d?(t(b,"Attribute without value"),b.attribValue=b.attribName,w(b),x(b)):l(F,d)?b.state=S.ATTRIB_NAME_SAW_WHITE:l(R,d)?b.attribName+=d:t(b,"Invalid attribute name");continue;case S.ATTRIB_NAME_SAW_WHITE:if("="===d)b.state=S.ATTRIB_VALUE;else{if(l(F,d))continue;t(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",o(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",">"===d?x(b):l(Q,d)?(b.attribName=d,b.state=S.ATTRIB_NAME):(t(b,"Invalid attribute name"),b.state=S.ATTRIB)}continue;case S.ATTRIB_VALUE:if(l(F,d))continue;l(I,d)?(b.q=d,b.state=S.ATTRIB_VALUE_QUOTED):(t(b,"Unquoted attribute value"),b.state=S.ATTRIB_VALUE_UNQUOTED,b.attribValue=d);continue;case S.ATTRIB_VALUE_QUOTED:if(d!==b.q){"&"===d?b.state=S.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=d;continue}w(b),b.q="",b.state=S.ATTRIB_VALUE_CLOSED;continue;case S.ATTRIB_VALUE_CLOSED:l(F,d)?b.state=S.ATTRIB:">"===d?x(b):"/"===d?b.state=S.OPEN_TAG_SLASH:l(Q,d)?(t(b,"No whitespace between attributes"),b.attribName=d,b.attribValue="",b.state=S.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case S.ATTRIB_VALUE_UNQUOTED:if(m(K,d)){"&"===d?b.state=S.ATTRIB_VALUE_ENTITY_U:b.attribValue+=d;continue}w(b),">"===d?x(b):b.state=S.ATTRIB;continue;case S.CLOSE_TAG:if(b.tagName)">"===d?y(b):l(R,d)?b.tagName+=d:b.script?(b.script+="</"+b.tagName,b.tagName="",b.state=S.SCRIPT):(m(F,d)&&t(b,"Invalid tagname in closing tag"),b.state=S.CLOSE_TAG_SAW_WHITE);else{if(l(F,d))continue;m(Q,d)?b.script?(b.script+="</"+d,b.state=S.SCRIPT):t(b,"Invalid tagname in closing tag."):b.tagName=d}continue;case S.CLOSE_TAG_SAW_WHITE:if(l(F,d))continue;">"===d?y(b):t(b,"Invalid characters in closing tag");continue;case S.TEXT_ENTITY:case S.ATTRIB_VALUE_ENTITY_Q:case S.ATTRIB_VALUE_ENTITY_U:switch(b.state){case S.TEXT_ENTITY:var h=S.TEXT,i="textNode";break;case S.ATTRIB_VALUE_ENTITY_Q:var h=S.ATTRIB_VALUE_QUOTED,i="attribValue";break;case S.ATTRIB_VALUE_ENTITY_U:var h=S.ATTRIB_VALUE_UNQUOTED,i="attribValue"}";"===d?(b[i]+=z(b),b.entity="",b.state=h):l(J,d)?b.entity+=d:(t(b,"Invalid character entity"),b[i]+="&"+b.entity+d,b.entity="",b.state=h);continue;default:throw new Error(b,"Unknown state: "+b.state)}return b.position>=b.bufferCheckPosition&&e(b),b}c.parser=function(a,b){return new d(a,b)},c.SAXParser=d,c.SAXStream=i,c.createStream=h,c.MAX_BUFFER_LENGTH=65536;var B=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];c.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(a){function b(){this.__proto__=a}return b.prototype=a,new b}),Object.getPrototypeOf||(Object.getPrototypeOf=function(a){return a.__proto__}),Object.keys||(Object.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),d.prototype={end:function(){s(this)},write:A,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){g(this)}};try{var C=a("stream").Stream}catch(D){var C=function(){}}var E=c.EVENTS.filter(function(a){return"error"!==a&&"end"!==a});i.prototype=Object.create(C.prototype,{constructor:{value:i}}),i.prototype.write=function(c){if("function"==typeof b&&"function"==typeof b.isBuffer&&b.isBuffer(c)){if(!this._decoder){var d=a("string_decoder").StringDecoder;this._decoder=new d("utf8")}c=this._decoder.write(c)}return this._parser.write(c.toString()),this.emit("data",c),!0},i.prototype.end=function(a){return a&&a.length&&this.write(a),this._parser.end(),!0},i.prototype.on=function(a,b){var c=this;return c._parser["on"+a]||-1===E.indexOf(a)||(c._parser["on"+a]=function(){var b=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);b.splice(0,0,a),c.emit.apply(c,b)}),C.prototype.on.call(c,a,b)};var F="\r\n ",G="0124356789",H="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",I="'\"",J=G+H+"#",K=F+">",L="[CDATA[",M="DOCTYPE",N="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",P={xml:N,xmlns:O};F=j(F),G=j(G),H=j(H);var Q=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,R=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;I=j(I),J=j(J),K=j(K);var S=0;c.STATE={BEGIN:S++,BEGIN_WHITESPACE:S++,TEXT:S++,TEXT_ENTITY:S++,OPEN_WAKA:S++,SGML_DECL:S++,SGML_DECL_QUOTED:S++,DOCTYPE:S++,DOCTYPE_QUOTED:S++,DOCTYPE_DTD:S++,DOCTYPE_DTD_QUOTED:S++,COMMENT_STARTING:S++,COMMENT:S++,COMMENT_ENDING:S++,COMMENT_ENDED:S++,CDATA:S++,CDATA_ENDING:S++,CDATA_ENDING_2:S++,PROC_INST:S++,PROC_INST_BODY:S++,PROC_INST_ENDING:S++,OPEN_TAG:S++,OPEN_TAG_SLASH:S++,ATTRIB:S++,ATTRIB_NAME:S++,ATTRIB_NAME_SAW_WHITE:S++,ATTRIB_VALUE:S++,ATTRIB_VALUE_QUOTED:S++,ATTRIB_VALUE_CLOSED:S++,ATTRIB_VALUE_UNQUOTED:S++,ATTRIB_VALUE_ENTITY_Q:S++,ATTRIB_VALUE_ENTITY_U:S++,CLOSE_TAG:S++,CLOSE_TAG_SAW_WHITE:S++,SCRIPT:S++,SCRIPT_ENDING:S++},c.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},c.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(c.ENTITIES).forEach(function(a){var b=c.ENTITIES[a],d="number"==typeof b?String.fromCharCode(b):b;c.ENTITIES[a]=d});for(var S in c.STATE)c.STATE[c.STATE[S]]=S;S=c.STATE,String.fromCodePoint||!function(){var a=String.fromCharCode,b=Math.floor,c=function(){var c,d,e=16384,f=[],g=-1,h=arguments.length;if(!h)return"";for(var i="";++g<h;){var j=Number(arguments[g]);if(!isFinite(j)||0>j||j>1114111||b(j)!=j)throw RangeError("Invalid code point: "+j);65535>=j?f.push(j):(j-=65536,c=(j>>10)+55296,d=j%1024+56320,f.push(c,d)),(g+1==h||f.length>e)&&(i+=a.apply(null,f),f.length=0)}return i};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:c,configurable:!0,writable:!0}):String.fromCodePoint=c}()}("undefined"==typeof c?sax={}:c)}).call(this,a("buffer").Buffer)},{buffer:28,stream:48,string_decoder:49}],57:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing attribute name of element "+a.name);if(null==c)throw new Error("Missing attribute value for attribute "+b+" of element "+a.name);this.name=this.stringify.attName(b),this.value=this.stringify.attValue(c)}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){return" "+this.name+'="'+this.value+'"'},a}()}).call(this)},{"lodash/object/create":127}],58:[function(a,b,c){(function(){var c,d,e,f,g;g=a("./XMLStringifier"),d=a("./XMLDeclaration"),e=a("./XMLDocType"),f=a("./XMLElement"),b.exports=c=function(){function a(a,b){var c,d;if(null==a)throw new Error("Root element needs a name");null==b&&(b={}),this.options=b,this.stringify=new g(b),d=new f(this,"doc"),c=d.element(a),c.isRoot=!0,c.documentObject=this,this.rootObject=c,b.headless||(c.declaration(b),(null!=b.pubID||null!=b.sysID)&&c.doctype(b))}return a.prototype.root=function(){return this.rootObject},a.prototype.end=function(a){return this.toString(a)},a.prototype.toString=function(a){var b,c,d,e,f,g,h,i;return e=(null!=a?a.pretty:void 0)||!1,b=null!=(g=null!=a?a.indent:void 0)?g:" ",d=null!=(h=null!=a?a.offset:void 0)?h:0,c=null!=(i=null!=a?a.newline:void 0)?i:"\n",f="",null!=this.xmldec&&(f+=this.xmldec.toString(a)),null!=this.doctype&&(f+=this.doctype.toString(a)),f+=this.rootObject.toString(a),e&&f.slice(-c.length)===c&&(f=f.slice(0,-c.length)),f},a}()}).call(this)},{"./XMLDeclaration":65,"./XMLDocType":66,"./XMLElement":67,"./XMLStringifier":71}],59:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/object/create"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing CDATA text");this.text=this.stringify.cdata(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<![CDATA["+this.text+"]]>",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":68,"lodash/object/create":127}],60:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/object/create"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing comment text");this.text=this.stringify.comment(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!-- "+this.text+" -->",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":68,"lodash/object/create":127}],61:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c,d,e,f){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");if(null==c)throw new Error("Missing DTD attribute name");if(!d)throw new Error("Missing DTD attribute type");if(!e)throw new Error("Missing DTD attribute default");if(0!==e.indexOf("#")&&(e="#"+e),!e.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");if(f&&!e.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT");this.elementName=this.stringify.eleName(b),this.attributeName=this.stringify.attName(c),this.attributeType=this.stringify.dtdAttType(d),this.defaultValue=this.stringify.dtdAttDefault(f),this.defaultValueType=e}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!ATTLIST "+this.elementName+" "+this.attributeName+" "+this.attributeType,"#DEFAULT"!==this.defaultValueType&&(g+=" "+this.defaultValueType),this.defaultValue&&(g+=' "'+this.defaultValue+'"'),g+=">",f&&(g+=d),g},a}()}).call(this)},{"lodash/object/create":127}],62:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.eleName(b),this.value=this.stringify.dtdElementValue(c)}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!ELEMENT "+this.name+" "+this.value+">",f&&(g+=d),g},a}()}).call(this)},{"lodash/object/create":127}],63:[function(a,b,c){(function(){var c,d,e;d=a("lodash/object/create"),e=a("lodash/lang/isObject"),b.exports=c=function(){function a(a,b,c,d){if(this.stringify=a.stringify,null==c)throw new Error("Missing entity name");if(null==d)throw new Error("Missing entity value");if(this.pe=!!b,this.name=this.stringify.eleName(c),e(d)){if(!d.pubID&&!d.sysID)throw new Error("Public and/or system identifiers are required for an external entity");if(d.pubID&&!d.sysID)throw new Error("System identifier is required for a public external entity");if(null!=d.pubID&&(this.pubID=this.stringify.dtdPubID(d.pubID)),null!=d.sysID&&(this.sysID=this.stringify.dtdSysID(d.sysID)),null!=d.nData&&(this.nData=this.stringify.dtdNData(d.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity")}else this.value=this.stringify.dtdEntityValue(d)}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!ENTITY",this.pe&&(g+=" %"),g+=" "+this.name,this.value?g+=' "'+this.value+'"':(this.pubID&&this.sysID?g+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.sysID&&(g+=' SYSTEM "'+this.sysID+'"'),this.nData&&(g+=" NDATA "+this.nData)),g+=">",f&&(g+=d),g},a}()}).call(this)},{"lodash/lang/isObject":123,"lodash/object/create":127}],64:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing notation name");if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity");this.name=this.stringify.eleName(b),null!=c.pubID&&(this.pubID=this.stringify.dtdPubID(c.pubID)),null!=c.sysID&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<!NOTATION "+this.name,this.pubID&&this.sysID?g+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.pubID?g+=' PUBLIC "'+this.pubID+'"':this.sysID&&(g+=' SYSTEM "'+this.sysID+'"'),g+=">",f&&(g+=d),g},a}()}).call(this)},{"lodash/object/create":127}],65:[function(a,b,c){(function(){var c,d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("lodash/object/create"),f=a("lodash/lang/isObject"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c,d,e){var g;b.__super__.constructor.call(this,a),f(c)&&(g=c,c=g.version,d=g.encoding,e=g.standalone),c||(c="1.0"),null!=c&&(this.version=this.stringify.xmlVersion(c)),null!=d&&(this.encoding=this.stringify.xmlEncoding(d)),null!=e&&(this.standalone=this.stringify.xmlStandalone(e))}return g(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<?xml",null!=this.version&&(g+=' version="'+this.version+'"'),null!=this.encoding&&(g+=' encoding="'+this.encoding+'"'),null!=this.standalone&&(g+=' standalone="'+this.standalone+'"'),g+="?>",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":68,"lodash/lang/isObject":123,"lodash/object/create":127}],66:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l;k=a("lodash/object/create"),l=a("lodash/lang/isObject"),c=a("./XMLCData"),d=a("./XMLComment"),e=a("./XMLDTDAttList"),g=a("./XMLDTDEntity"),f=a("./XMLDTDElement"),h=a("./XMLDTDNotation"),j=a("./XMLProcessingInstruction"),b.exports=i=function(){function a(a,b,c){var d,e;this.documentObject=a,this.stringify=this.documentObject.stringify,this.children=[],l(b)&&(d=b,b=d.pubID,c=d.sysID),null==c&&(e=[b,c],c=e[0],b=e[1]),null!=b&&(this.pubID=this.stringify.dtdPubID(b)),null!=c&&(this.sysID=this.stringify.dtdSysID(c))}return a.prototype.clone=function(){return k(a.prototype,this)},a.prototype.element=function(a,b){var c;return c=new f(this,a,b),this.children.push(c),this},a.prototype.attList=function(a,b,c,d,f){var g;return g=new e(this,a,b,c,d,f),this.children.push(g),this},a.prototype.entity=function(a,b){var c;return c=new g(this,!1,a,b),this.children.push(c),this},a.prototype.pEntity=function(a,b){var c;return c=new g(this,!0,a,b),this.children.push(c),this},a.prototype.notation=function(a,b){var c;return c=new h(this,a,b),this.children.push(c),this},a.prototype.cdata=function(a){var b;return b=new c(this,a),this.children.push(b),this},a.prototype.comment=function(a){var b;return b=new d(this,a),this.children.push(b),this},a.prototype.instruction=function(a,b){var c;return c=new j(this,a,b),this.children.push(c),this},a.prototype.root=function(){return this.documentObject.root()},a.prototype.document=function(){return this.documentObject},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;if(i=(null!=a?a.pretty:void 0)||!1,e=null!=(k=null!=a?a.indent:void 0)?k:" ",h=null!=(l=null!=a?a.offset:void 0)?l:0,g=null!=(m=null!=a?a.newline:void 0)?m:"\n",b||(b=0),o=new Array(b+h+1).join(e),j="",i&&(j+=o),j+="<!DOCTYPE "+this.root().name,this.pubID&&this.sysID?j+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.sysID&&(j+=' SYSTEM "'+this.sysID+'"'),this.children.length>0){for(j+=" [",i&&(j+=g),n=this.children,d=0,f=n.length;f>d;d++)c=n[d],j+=c.toString(a,b+1);j+="]"}return j+=">",i&&(j+=g),j},a.prototype.ele=function(a,b){return this.element(a,b)},a.prototype.att=function(a,b,c,d,e){return this.attList(a,b,c,d,e)},a.prototype.ent=function(a,b){return this.entity(a,b)},a.prototype.pent=function(a,b){return this.pEntity(a,b)},a.prototype.not=function(a,b){return this.notation(a,b)},a.prototype.dat=function(a){return this.cdata(a)},a.prototype.com=function(a){return this.comment(a)},a.prototype.ins=function(a,b){return this.instruction(a,b)},a.prototype.up=function(){return this.root()},a.prototype.doc=function(){return this.document()},a}()}).call(this)},{"./XMLCData":59,"./XMLComment":60,"./XMLDTDAttList":61,"./XMLDTDElement":62,"./XMLDTDEntity":63,"./XMLDTDNotation":64,"./XMLProcessingInstruction":69,"lodash/lang/isObject":123,"lodash/object/create":127}],67:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k=function(a,b){function c(){this.constructor=a}for(var d in b)l.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},l={}.hasOwnProperty;g=a("lodash/object/create"),j=a("lodash/lang/isObject"),i=a("lodash/lang/isFunction"),h=a("lodash/collection/every"),e=a("./XMLNode"),c=a("./XMLAttribute"),f=a("./XMLProcessingInstruction"),b.exports=d=function(a){function b(a,c,d){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing element name");this.name=this.stringify.eleName(c),this.children=[],this.instructions=[],this.attributes={},null!=d&&this.attribute(d)}return k(b,a),b.prototype.clone=function(){var a,c,d,e,f,h,i,j;d=g(b.prototype,this),d.isRoot&&(d.documentObject=null),d.attributes={},i=this.attributes;for(c in i)l.call(i,c)&&(a=i[c],d.attributes[c]=a.clone());for(d.instructions=[],j=this.instructions,e=0,f=j.length;f>e;e++)h=j[e],d.instructions.push(h.clone());return d.children=[],this.children.forEach(function(a){var b;return b=a.clone(),b.parent=d,d.children.push(b)}),d},b.prototype.attribute=function(a,b){var d,e;if(null!=a&&(a=a.valueOf()),j(a))for(d in a)l.call(a,d)&&(e=a[d],this.attribute(d,e));else i(b)&&(b=b.apply()),this.options.skipNullAttributes&&null==b||(this.attributes[a]=new c(this,a,b));return this},b.prototype.removeAttribute=function(a){var b,c,d;if(null==a)throw new Error("Missing attribute name");if(a=a.valueOf(),Array.isArray(a))for(c=0,d=a.length;d>c;c++)b=a[c],delete this.attributes[b];else delete this.attributes[a];return this},b.prototype.instruction=function(a,b){var c,d,e,g,h;if(null!=a&&(a=a.valueOf()),null!=b&&(b=b.valueOf()),Array.isArray(a))for(c=0,h=a.length;h>c;c++)d=a[c],this.instruction(d);else if(j(a))for(d in a)l.call(a,d)&&(e=a[d],this.instruction(d,e));else i(b)&&(b=b.apply()),g=new f(this,a,b),this.instructions.push(g);return this},b.prototype.toString=function(a,b){var c,d,e,f,g,i,j,k,m,n,o,p,q,r,s,t,u,v,w,x;for(p=(null!=a?a.pretty:void 0)||!1,f=null!=(r=null!=a?a.indent:void 0)?r:" ",o=null!=(s=null!=a?a.offset:void 0)?s:0,n=null!=(t=null!=a?a.newline:void 0)?t:"\n",
b||(b=0),x=new Array(b+o+1).join(f),q="",u=this.instructions,e=0,j=u.length;j>e;e++)g=u[e],q+=g.toString(a,b);p&&(q+=x),q+="<"+this.name,v=this.attributes;for(m in v)l.call(v,m)&&(c=v[m],q+=c.toString(a));if(0===this.children.length||h(this.children,function(a){return""===a.value}))q+="/>",p&&(q+=n);else if(p&&1===this.children.length&&null!=this.children[0].value)q+=">",q+=this.children[0].value,q+="</"+this.name+">",q+=n;else{for(q+=">",p&&(q+=n),w=this.children,i=0,k=w.length;k>i;i++)d=w[i],q+=d.toString(a,b+1);p&&(q+=x),q+="</"+this.name+">",p&&(q+=n)}return q},b.prototype.att=function(a,b){return this.attribute(a,b)},b.prototype.ins=function(a,b){return this.instruction(a,b)},b.prototype.a=function(a,b){return this.attribute(a,b)},b.prototype.i=function(a,b){return this.instruction(a,b)},b}(e)}).call(this)},{"./XMLAttribute":57,"./XMLNode":68,"./XMLProcessingInstruction":69,"lodash/collection/every":75,"lodash/lang/isFunction":121,"lodash/lang/isObject":123,"lodash/object/create":127}],68:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l,m,n={}.hasOwnProperty;m=a("lodash/lang/isObject"),l=a("lodash/lang/isFunction"),k=a("lodash/lang/isEmpty"),g=null,c=null,d=null,e=null,f=null,i=null,j=null,b.exports=h=function(){function b(b){this.parent=b,this.options=this.parent.options,this.stringify=this.parent.stringify,null===g&&(g=a("./XMLElement"),c=a("./XMLCData"),d=a("./XMLComment"),e=a("./XMLDeclaration"),f=a("./XMLDocType"),i=a("./XMLRaw"),j=a("./XMLText"))}return b.prototype.clone=function(){throw new Error("Cannot clone generic XMLNode")},b.prototype.element=function(a,b,c){var d,e,f,g,h,i,j;if(g=null,null==b&&(b={}),b=b.valueOf(),m(b)||(i=[b,c],c=i[0],b=i[1]),null!=a&&(a=a.valueOf()),Array.isArray(a))for(e=0,h=a.length;h>e;e++)d=a[e],g=this.element(d);else if(l(a))g=this.element(a.apply());else if(m(a))for(f in a)n.call(a,f)&&(j=a[f],l(j)&&(j=j.apply()),m(j)&&k(j)&&(j=null),j||this.options.ignoreDecorators||!this.stringify.convertListKey||0!==f.indexOf(this.stringify.convertListKey)?!this.options.ignoreDecorators&&this.stringify.convertAttKey&&0===f.indexOf(this.stringify.convertAttKey)?g=this.attribute(f.substr(this.stringify.convertAttKey.length),j):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&0===f.indexOf(this.stringify.convertPIKey)?g=this.instruction(f.substr(this.stringify.convertPIKey.length),j):m(j)?!this.options.ignoreDecorators&&this.stringify.convertListKey&&0===f.indexOf(this.stringify.convertListKey)&&Array.isArray(j)?g=this.element(j):(g=this.element(f),g.element(j)):g=this.element(f,j):g=this);else g=!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===a.indexOf(this.stringify.convertTextKey)?this.text(c):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&0===a.indexOf(this.stringify.convertCDataKey)?this.cdata(c):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&0===a.indexOf(this.stringify.convertCommentKey)?this.comment(c):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&0===a.indexOf(this.stringify.convertRawKey)?this.raw(c):this.node(a,b,c);if(null==g)throw new Error("Could not create any elements with: "+a);return g},b.prototype.insertBefore=function(a,b,c){var d,e,f;if(this.isRoot)throw new Error("Cannot insert elements at root level");return e=this.parent.children.indexOf(this),f=this.parent.children.splice(e),d=this.parent.element(a,b,c),Array.prototype.push.apply(this.parent.children,f),d},b.prototype.insertAfter=function(a,b,c){var d,e,f;if(this.isRoot)throw new Error("Cannot insert elements at root level");return e=this.parent.children.indexOf(this),f=this.parent.children.splice(e+1),d=this.parent.element(a,b,c),Array.prototype.push.apply(this.parent.children,f),d},b.prototype.remove=function(){var a,b;if(this.isRoot)throw new Error("Cannot remove the root element");return a=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[a,a-a+1].concat(b=[])),b,this.parent},b.prototype.node=function(a,b,c){var d,e;return null!=a&&(a=a.valueOf()),null==b&&(b={}),b=b.valueOf(),m(b)||(e=[b,c],c=e[0],b=e[1]),d=new g(this,a,b),null!=c&&d.text(c),this.children.push(d),d},b.prototype.text=function(a){var b;return b=new j(this,a),this.children.push(b),this},b.prototype.cdata=function(a){var b;return b=new c(this,a),this.children.push(b),this},b.prototype.comment=function(a){var b;return b=new d(this,a),this.children.push(b),this},b.prototype.raw=function(a){var b;return b=new i(this,a),this.children.push(b),this},b.prototype.declaration=function(a,b,c){var d,f;return d=this.document(),f=new e(d,a,b,c),d.xmldec=f,d.root()},b.prototype.doctype=function(a,b){var c,d;return c=this.document(),d=new f(c,a,b),c.doctype=d,d},b.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},b.prototype.root=function(){var a;if(this.isRoot)return this;for(a=this.parent;!a.isRoot;)a=a.parent;return a},b.prototype.document=function(){return this.root().documentObject},b.prototype.end=function(a){return this.document().toString(a)},b.prototype.prev=function(){var a;if(this.isRoot)throw new Error("Root node has no siblings");if(a=this.parent.children.indexOf(this),1>a)throw new Error("Already at the first node");return this.parent.children[a-1]},b.prototype.next=function(){var a;if(this.isRoot)throw new Error("Root node has no siblings");if(a=this.parent.children.indexOf(this),-1===a||a===this.parent.children.length-1)throw new Error("Already at the last node");return this.parent.children[a+1]},b.prototype.importXMLBuilder=function(a){var b;return b=a.root().clone(),b.parent=this,b.isRoot=!1,this.children.push(b),this},b.prototype.ele=function(a,b,c){return this.element(a,b,c)},b.prototype.nod=function(a,b,c){return this.node(a,b,c)},b.prototype.txt=function(a){return this.text(a)},b.prototype.dat=function(a){return this.cdata(a)},b.prototype.com=function(a){return this.comment(a)},b.prototype.doc=function(){return this.document()},b.prototype.dec=function(a,b,c){return this.declaration(a,b,c)},b.prototype.dtd=function(a,b){return this.doctype(a,b)},b.prototype.e=function(a,b,c){return this.element(a,b,c)},b.prototype.n=function(a,b,c){return this.node(a,b,c)},b.prototype.t=function(a){return this.text(a)},b.prototype.d=function(a){return this.cdata(a)},b.prototype.c=function(a){return this.comment(a)},b.prototype.r=function(a){return this.raw(a)},b.prototype.u=function(){return this.up()},b}()}).call(this)},{"./XMLCData":59,"./XMLComment":60,"./XMLDeclaration":65,"./XMLDocType":66,"./XMLElement":67,"./XMLRaw":70,"./XMLText":72,"lodash/lang/isEmpty":120,"lodash/lang/isFunction":121,"lodash/lang/isObject":123}],69:[function(a,b,c){(function(){var c,d;d=a("lodash/object/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing instruction target");this.target=this.stringify.insTarget(b),c&&(this.value=this.stringify.insValue(c))}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="<?",g+=this.target,this.value&&(g+=" "+this.value),g+="?>",f&&(g+=d),g},a}()}).call(this)},{"lodash/object/create":127}],70:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/object/create"),c=a("./XMLNode"),b.exports=d=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing raw text");this.value=this.stringify.raw(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+=this.value,f&&(g+=d),g},b}(c)}).call(this)},{"./XMLNode":68,"lodash/object/create":127}],71:[function(a,b,c){(function(){var a,c=function(a,b){return function(){return a.apply(b,arguments)}},d={}.hasOwnProperty;b.exports=a=function(){function a(a){this.assertLegalChar=c(this.assertLegalChar,this);var b,e,f;this.allowSurrogateChars=null!=a?a.allowSurrogateChars:void 0,e=(null!=a?a.stringify:void 0)||{};for(b in e)d.call(e,b)&&(f=e[b],this[b]=f)}return a.prototype.eleName=function(a){return a=""+a||"",this.assertLegalChar(a)},a.prototype.eleText=function(a){return a=""+a||"",this.assertLegalChar(this.elEscape(a))},a.prototype.cdata=function(a){if(a=""+a||"",a.match(/]]>/))throw new Error("Invalid CDATA text: "+a);return this.assertLegalChar(a)},a.prototype.comment=function(a){if(a=""+a||"",a.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+a);return this.assertLegalChar(a)},a.prototype.raw=function(a){return""+a||""},a.prototype.attName=function(a){return""+a||""},a.prototype.attValue=function(a){return a=""+a||"",this.attEscape(a)},a.prototype.insTarget=function(a){return""+a||""},a.prototype.insValue=function(a){if(a=""+a||"",a.match(/\?>/))throw new Error("Invalid processing instruction value: "+a);return a},a.prototype.xmlVersion=function(a){if(a=""+a||"",!a.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+a);return a},a.prototype.xmlEncoding=function(a){if(a=""+a||"",!a.match(/[A-Za-z](?:[A-Za-z0-9._-]|-)*/))throw new Error("Invalid encoding: "+a);return a},a.prototype.xmlStandalone=function(a){return a?"yes":"no"},a.prototype.dtdPubID=function(a){return""+a||""},a.prototype.dtdSysID=function(a){return""+a||""},a.prototype.dtdElementValue=function(a){return""+a||""},a.prototype.dtdAttType=function(a){return""+a||""},a.prototype.dtdAttDefault=function(a){return null!=a?""+a||"":a},a.prototype.dtdEntityValue=function(a){return""+a||""},a.prototype.dtdNData=function(a){return""+a||""},a.prototype.convertAttKey="@",a.prototype.convertPIKey="?",a.prototype.convertTextKey="#text",a.prototype.convertCDataKey="#cdata",a.prototype.convertCommentKey="#comment",a.prototype.convertRawKey="#raw",a.prototype.convertListKey="#list",a.prototype.assertLegalChar=function(a){var b,c;if(b=this.allowSurrogateChars?/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/:/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/,c=a.match(b))throw new Error("Invalid character ("+c+") in string: "+a+" at index "+c.index);return a},a.prototype.elEscape=function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
")},a.prototype.attEscape=function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,""")},a}()}).call(this)},{}],72:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/object/create"),c=a("./XMLNode"),b.exports=d=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing element text");this.value=this.stringify.eleText(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+=this.value,f&&(g+=d),g},b}(c)}).call(this)},{"./XMLNode":68,"lodash/object/create":127}],73:[function(a,b,c){(function(){var c,d;d=a("lodash/object/assign"),c=a("./XMLBuilder"),b.exports.create=function(a,b,e,f){return f=d({},b,e,f),new c(a,f).root()}}).call(this)},{"./XMLBuilder":58,"lodash/object/assign":126}],74:[function(a,b,c){function d(a){var b=a?a.length:0;return b?a[b-1]:void 0}b.exports=d},{}],75:[function(a,b,c){function d(a,b,c){var d=h(a)?e:g;return c&&i(a,b,c)&&(b=void 0),("function"!=typeof b||void 0!==c)&&(b=f(b,c,3)),d(a,b)}var e=a("../internal/arrayEvery"),f=a("../internal/baseCallback"),g=a("../internal/baseEvery"),h=a("../lang/isArray"),i=a("../internal/isIterateeCall");b.exports=d},{"../internal/arrayEvery":77,"../internal/baseCallback":81,"../internal/baseEvery":85,"../internal/isIterateeCall":110,"../lang/isArray":119}],76:[function(a,b,c){function d(a,b){if("function"!=typeof a)throw new TypeError(e);return b=f(void 0===b?a.length-1:+b||0,0),function(){for(var c=arguments,d=-1,e=f(c.length-b,0),g=Array(e);++d<e;)g[d]=c[b+d];switch(b){case 0:return a.call(this,g);case 1:return a.call(this,c[0],g);case 2:return a.call(this,c[0],c[1],g)}var h=Array(b+1);for(d=-1;++d<b;)h[d]=c[d];return h[b]=g,a.apply(this,h)}}var e="Expected a function",f=Math.max;b.exports=d},{}],77:[function(a,b,c){function d(a,b){for(var c=-1,d=a.length;++c<d;)if(!b(a[c],c,a))return!1;return!0}b.exports=d},{}],78:[function(a,b,c){function d(a,b){for(var c=-1,d=a.length;++c<d;)if(b(a[c],c,a))return!0;return!1}b.exports=d},{}],79:[function(a,b,c){function d(a,b,c){for(var d=-1,f=e(b),g=f.length;++d<g;){var h=f[d],i=a[h],j=c(i,b[h],h,a,b);(j===j?j===i:i!==i)&&(void 0!==i||h in a)||(a[h]=j)}return a}var e=a("../object/keys");b.exports=d},{"../object/keys":128}],80:[function(a,b,c){function d(a,b){return null==b?a:e(b,f(b),a)}var e=a("./baseCopy"),f=a("../object/keys");b.exports=d},{"../object/keys":128,"./baseCopy":82}],81:[function(a,b,c){function d(a,b,c){var d=typeof a;return"function"==d?void 0===b?a:g(a,b,c):null==a?h:"object"==d?e(a):void 0===b?i(a):f(a,b)}var e=a("./baseMatches"),f=a("./baseMatchesProperty"),g=a("./bindCallback"),h=a("../utility/identity"),i=a("../utility/property");b.exports=d},{"../utility/identity":131,"../utility/property":132,"./baseMatches":92,"./baseMatchesProperty":93,"./bindCallback":98}],82:[function(a,b,c){function d(a,b,c){c||(c={});for(var d=-1,e=b.length;++d<e;){var f=b[d];c[f]=a[f]}return c}b.exports=d},{}],83:[function(a,b,c){var d=a("../lang/isObject"),e=function(){function a(){}return function(b){if(d(b)){a.prototype=b;var c=new a;a.prototype=void 0}return c||{}}}();b.exports=e},{"../lang/isObject":123}],84:[function(a,b,c){var d=a("./baseForOwn"),e=a("./createBaseEach"),f=e(d);b.exports=f},{"./baseForOwn":87,"./createBaseEach":100}],85:[function(a,b,c){function d(a,b){var c=!0;return e(a,function(a,d,e){return c=!!b(a,d,e)}),c}var e=a("./baseEach");b.exports=d},{"./baseEach":84}],86:[function(a,b,c){var d=a("./createBaseFor"),e=d();b.exports=e},{"./createBaseFor":101}],87:[function(a,b,c){function d(a,b){return e(a,b,f)}var e=a("./baseFor"),f=a("../object/keys");b.exports=d},{"../object/keys":128,"./baseFor":86}],88:[function(a,b,c){function d(a,b,c){if(null!=a){void 0!==c&&c in e(a)&&(b=[c]);for(var d=0,f=b.length;null!=a&&f>d;)a=a[b[d++]];return d&&d==f?a:void 0}}var e=a("./toObject");b.exports=d},{"./toObject":116}],89:[function(a,b,c){function d(a,b,c,h,i,j){return a===b?!0:null==a||null==b||!f(a)&&!g(b)?a!==a&&b!==b:e(a,b,d,c,h,i,j)}var e=a("./baseIsEqualDeep"),f=a("../lang/isObject"),g=a("./isObjectLike");b.exports=d},{"../lang/isObject":123,"./baseIsEqualDeep":90,"./isObjectLike":113}],90:[function(a,b,c){function d(a,b,c,d,m,p,q){var r=h(a),s=h(b),t=k,u=k;r||(t=o.call(a),t==j?t=l:t!=l&&(r=i(a))),s||(u=o.call(b),u==j?u=l:u!=l&&(s=i(b)));var v=t==l,w=u==l,x=t==u;if(x&&!r&&!v)return f(a,b,t);if(!m){var y=v&&n.call(a,"__wrapped__"),z=w&&n.call(b,"__wrapped__");if(y||z)return c(y?a.value():a,z?b.value():b,d,m,p,q)}if(!x)return!1;p||(p=[]),q||(q=[]);for(var A=p.length;A--;)if(p[A]==a)return q[A]==b;p.push(a),q.push(b);var B=(r?e:g)(a,b,c,d,m,p,q);return p.pop(),q.pop(),B}var e=a("./equalArrays"),f=a("./equalByTag"),g=a("./equalObjects"),h=a("../lang/isArray"),i=a("../lang/isTypedArray"),j="[object Arguments]",k="[object Array]",l="[object Object]",m=Object.prototype,n=m.hasOwnProperty,o=m.toString;b.exports=d},{"../lang/isArray":119,"../lang/isTypedArray":125,"./equalArrays":102,"./equalByTag":103,"./equalObjects":104}],91:[function(a,b,c){function d(a,b,c){var d=b.length,g=d,h=!c;if(null==a)return!g;for(a=f(a);d--;){var i=b[d];if(h&&i[2]?i[1]!==a[i[0]]:!(i[0]in a))return!1}for(;++d<g;){i=b[d];var j=i[0],k=a[j],l=i[1];if(h&&i[2]){if(void 0===k&&!(j in a))return!1}else{var m=c?c(k,l,j):void 0;if(!(void 0===m?e(l,k,c,!0):m))return!1}}return!0}var e=a("./baseIsEqual"),f=a("./toObject");b.exports=d},{"./baseIsEqual":89,"./toObject":116}],92:[function(a,b,c){function d(a){var b=f(a);if(1==b.length&&b[0][2]){var c=b[0][0],d=b[0][1];return function(a){return null==a?!1:a[c]===d&&(void 0!==d||c in g(a))}}return function(a){return e(a,b)}}var e=a("./baseIsMatch"),f=a("./getMatchData"),g=a("./toObject");b.exports=d},{"./baseIsMatch":91,"./getMatchData":106,"./toObject":116}],93:[function(a,b,c){function d(a,b){var c=h(a),d=i(a)&&j(b),n=a+"";return a=m(a),function(h){if(null==h)return!1;var i=n;if(h=l(h),(c||!d)&&!(i in h)){if(h=1==a.length?h:e(h,g(a,0,-1)),null==h)return!1;i=k(a),h=l(h)}return h[i]===b?void 0!==b||i in h:f(b,h[i],void 0,!0)}}var e=a("./baseGet"),f=a("./baseIsEqual"),g=a("./baseSlice"),h=a("../lang/isArray"),i=a("./isKey"),j=a("./isStrictComparable"),k=a("../array/last"),l=a("./toObject"),m=a("./toPath");b.exports=d},{"../array/last":74,"../lang/isArray":119,"./baseGet":88,"./baseIsEqual":89,"./baseSlice":96,"./isKey":111,"./isStrictComparable":114,"./toObject":116,"./toPath":117}],94:[function(a,b,c){function d(a){return function(b){return null==b?void 0:b[a]}}b.exports=d},{}],95:[function(a,b,c){function d(a){var b=a+"";return a=f(a),function(c){return e(c,a,b)}}var e=a("./baseGet"),f=a("./toPath");b.exports=d},{"./baseGet":88,"./toPath":117}],96:[function(a,b,c){function d(a,b,c){var d=-1,e=a.length;b=null==b?0:+b||0,0>b&&(b=-b>e?0:e+b),c=void 0===c||c>e?e:+c||0,0>c&&(c+=e),e=b>c?0:c-b>>>0,b>>>=0;for(var f=Array(e);++d<e;)f[d]=a[d+b];return f}b.exports=d},{}],97:[function(a,b,c){function d(a){return null==a?"":a+""}b.exports=d},{}],98:[function(a,b,c){function d(a,b,c){if("function"!=typeof a)return e;if(void 0===b)return a;switch(c){case 1:return function(c){return a.call(b,c)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)};case 5:return function(c,d,e,f,g){return a.call(b,c,d,e,f,g)}}return function(){return a.apply(b,arguments)}}var e=a("../utility/identity");b.exports=d},{"../utility/identity":131}],99:[function(a,b,c){function d(a){return g(function(b,c){var d=-1,g=null==b?0:c.length,h=g>2?c[g-2]:void 0,i=g>2?c[2]:void 0,j=g>1?c[g-1]:void 0;for("function"==typeof h?(h=e(h,j,5),g-=2):(h="function"==typeof j?j:void 0,g-=h?1:0),i&&f(c[0],c[1],i)&&(h=3>g?void 0:h,g=1);++d<g;){var k=c[d];k&&a(b,k,h)}return b})}var e=a("./bindCallback"),f=a("./isIterateeCall"),g=a("../function/restParam");b.exports=d},{"../function/restParam":76,"./bindCallback":98,"./isIterateeCall":110}],100:[function(a,b,c){function d(a,b){return function(c,d){var h=c?e(c):0;if(!f(h))return a(c,d);for(var i=b?h:-1,j=g(c);(b?i--:++i<h)&&d(j[i],i,j)!==!1;);return c}}var e=a("./getLength"),f=a("./isLength"),g=a("./toObject");b.exports=d},{"./getLength":105,"./isLength":112,"./toObject":116}],101:[function(a,b,c){function d(a){return function(b,c,d){for(var f=e(b),g=d(b),h=g.length,i=a?h:-1;a?i--:++i<h;){var j=g[i];if(c(f[j],j,f)===!1)break}return b}}var e=a("./toObject");b.exports=d},{"./toObject":116}],102:[function(a,b,c){function d(a,b,c,d,f,g,h){var i=-1,j=a.length,k=b.length;if(j!=k&&!(f&&k>j))return!1;for(;++i<j;){var l=a[i],m=b[i],n=d?d(f?m:l,f?l:m,i):void 0;if(void 0!==n){if(n)continue;return!1}if(f){if(!e(b,function(a){return l===a||c(l,a,d,f,g,h)}))return!1}else if(l!==m&&!c(l,m,d,f,g,h))return!1}return!0}var e=a("./arraySome");b.exports=d},{"./arraySome":78}],103:[function(a,b,c){function d(a,b,c){switch(c){case e:case f:return+a==+b;case g:return a.name==b.name&&a.message==b.message;case h:return a!=+a?b!=+b:a==+b;case i:case j:return a==b+""}return!1}var e="[object Boolean]",f="[object Date]",g="[object Error]",h="[object Number]",i="[object RegExp]",j="[object String]";b.exports=d},{}],104:[function(a,b,c){function d(a,b,c,d,f,h,i){var j=e(a),k=j.length,l=e(b),m=l.length;if(k!=m&&!f)return!1;for(var n=k;n--;){var o=j[n];if(!(f?o in b:g.call(b,o)))return!1}for(var p=f;++n<k;){o=j[n];var q=a[o],r=b[o],s=d?d(f?r:q,f?q:r,o):void 0;if(!(void 0===s?c(q,r,d,f,h,i):s))return!1;p||(p="constructor"==o)}if(!p){var t=a.constructor,u=b.constructor;if(t!=u&&"constructor"in a&&"constructor"in b&&!("function"==typeof t&&t instanceof t&&"function"==typeof u&&u instanceof u))return!1}return!0}var e=a("../object/keys"),f=Object.prototype,g=f.hasOwnProperty;b.exports=d},{"../object/keys":128}],105:[function(a,b,c){var d=a("./baseProperty"),e=d("length");b.exports=e},{"./baseProperty":94}],106:[function(a,b,c){function d(a){for(var b=f(a),c=b.length;c--;)b[c][2]=e(b[c][1]);return b}var e=a("./isStrictComparable"),f=a("../object/pairs");b.exports=d},{"../object/pairs":130,"./isStrictComparable":114}],107:[function(a,b,c){function d(a,b){var c=null==a?void 0:a[b];return e(c)?c:void 0}var e=a("../lang/isNative");b.exports=d},{"../lang/isNative":122}],108:[function(a,b,c){function d(a){return null!=a&&f(e(a))}var e=a("./getLength"),f=a("./isLength");b.exports=d},{"./getLength":105,"./isLength":112}],109:[function(a,b,c){function d(a,b){return a="number"==typeof a||e.test(a)?+a:-1,b=null==b?f:b,a>-1&&a%1==0&&b>a}var e=/^\d+$/,f=9007199254740991;b.exports=d},{}],110:[function(a,b,c){function d(a,b,c){if(!g(c))return!1;var d=typeof b;if("number"==d?e(c)&&f(b,c.length):"string"==d&&b in c){var h=c[b];return a===a?a===h:h!==h}return!1}var e=a("./isArrayLike"),f=a("./isIndex"),g=a("../lang/isObject");b.exports=d},{"../lang/isObject":123,"./isArrayLike":108,"./isIndex":109}],111:[function(a,b,c){function d(a,b){var c=typeof a;if("string"==c&&h.test(a)||"number"==c)return!0;if(e(a))return!1;var d=!g.test(a);return d||null!=b&&a in f(b)}var e=a("../lang/isArray"),f=a("./toObject"),g=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,h=/^\w*$/;b.exports=d},{"../lang/isArray":119,"./toObject":116}],112:[function(a,b,c){function d(a){return"number"==typeof a&&a>-1&&a%1==0&&e>=a}var e=9007199254740991;b.exports=d},{}],113:[function(a,b,c){function d(a){return!!a&&"object"==typeof a}b.exports=d},{}],114:[function(a,b,c){function d(a){return a===a&&!e(a)}var e=a("../lang/isObject");b.exports=d},{"../lang/isObject":123}],115:[function(a,b,c){function d(a){for(var b=i(a),c=b.length,d=c&&a.length,j=!!d&&h(d)&&(f(a)||e(a)),l=-1,m=[];++l<c;){var n=b[l];(j&&g(n,d)||k.call(a,n))&&m.push(n)}return m}var e=a("../lang/isArguments"),f=a("../lang/isArray"),g=a("./isIndex"),h=a("./isLength"),i=a("../object/keysIn"),j=Object.prototype,k=j.hasOwnProperty;b.exports=d},{"../lang/isArguments":118,"../lang/isArray":119,"../object/keysIn":129,"./isIndex":109,"./isLength":112}],116:[function(a,b,c){function d(a){return e(a)?a:Object(a)}var e=a("../lang/isObject");b.exports=d},{"../lang/isObject":123}],117:[function(a,b,c){function d(a){if(f(a))return a;var b=[];return e(a).replace(g,function(a,c,d,e){b.push(d?e.replace(h,"$1"):c||a)}),b}var e=a("./baseToString"),f=a("../lang/isArray"),g=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,h=/\\(\\)?/g;b.exports=d},{"../lang/isArray":119,"./baseToString":97}],118:[function(a,b,c){function d(a){return f(a)&&e(a)&&h.call(a,"callee")&&!i.call(a,"callee")}var e=a("../internal/isArrayLike"),f=a("../internal/isObjectLike"),g=Object.prototype,h=g.hasOwnProperty,i=g.propertyIsEnumerable;b.exports=d},{"../internal/isArrayLike":108,"../internal/isObjectLike":113}],119:[function(a,b,c){var d=a("../internal/getNative"),e=a("../internal/isLength"),f=a("../internal/isObjectLike"),g="[object Array]",h=Object.prototype,i=h.toString,j=d(Array,"isArray"),k=j||function(a){return f(a)&&e(a.length)&&i.call(a)==g};b.exports=k},{"../internal/getNative":107,"../internal/isLength":112,"../internal/isObjectLike":113}],120:[function(a,b,c){function d(a){return null==a?!0:g(a)&&(f(a)||j(a)||e(a)||i(a)&&h(a.splice))?!a.length:!k(a).length}var e=a("./isArguments"),f=a("./isArray"),g=a("../internal/isArrayLike"),h=a("./isFunction"),i=a("../internal/isObjectLike"),j=a("./isString"),k=a("../object/keys");b.exports=d},{"../internal/isArrayLike":108,"../internal/isObjectLike":113,"../object/keys":128,"./isArguments":118,"./isArray":119,"./isFunction":121,"./isString":124}],121:[function(a,b,c){function d(a){return e(a)&&h.call(a)==f}var e=a("./isObject"),f="[object Function]",g=Object.prototype,h=g.toString;b.exports=d},{"./isObject":123}],122:[function(a,b,c){function d(a){return null==a?!1:e(a)?k.test(i.call(a)):f(a)&&g.test(a)}var e=a("./isFunction"),f=a("../internal/isObjectLike"),g=/^\[object .+?Constructor\]$/,h=Object.prototype,i=Function.prototype.toString,j=h.hasOwnProperty,k=RegExp("^"+i.call(j).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");b.exports=d},{"../internal/isObjectLike":113,"./isFunction":121}],123:[function(a,b,c){function d(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}b.exports=d},{}],124:[function(a,b,c){function d(a){return"string"==typeof a||e(a)&&h.call(a)==f}var e=a("../internal/isObjectLike"),f="[object String]",g=Object.prototype,h=g.toString;b.exports=d},{"../internal/isObjectLike":113}],125:[function(a,b,c){function d(a){return f(a)&&e(a.length)&&!!D[F.call(a)]}var e=a("../internal/isLength"),f=a("../internal/isObjectLike"),g="[object Arguments]",h="[object Array]",i="[object Boolean]",j="[object Date]",k="[object Error]",l="[object Function]",m="[object Map]",n="[object Number]",o="[object Object]",p="[object RegExp]",q="[object Set]",r="[object String]",s="[object WeakMap]",t="[object ArrayBuffer]",u="[object Float32Array]",v="[object Float64Array]",w="[object Int8Array]",x="[object Int16Array]",y="[object Int32Array]",z="[object Uint8Array]",A="[object Uint8ClampedArray]",B="[object Uint16Array]",C="[object Uint32Array]",D={};D[u]=D[v]=D[w]=D[x]=D[y]=D[z]=D[A]=D[B]=D[C]=!0,D[g]=D[h]=D[t]=D[i]=D[j]=D[k]=D[l]=D[m]=D[n]=D[o]=D[p]=D[q]=D[r]=D[s]=!1;var E=Object.prototype,F=E.toString;b.exports=d},{"../internal/isLength":112,"../internal/isObjectLike":113}],126:[function(a,b,c){var d=a("../internal/assignWith"),e=a("../internal/baseAssign"),f=a("../internal/createAssigner"),g=f(function(a,b,c){return c?d(a,b,c):e(a,b)});b.exports=g},{"../internal/assignWith":79,"../internal/baseAssign":80,"../internal/createAssigner":99}],127:[function(a,b,c){function d(a,b,c){var d=f(a);return c&&g(a,b,c)&&(b=void 0),b?e(d,b):d}var e=a("../internal/baseAssign"),f=a("../internal/baseCreate"),g=a("../internal/isIterateeCall");b.exports=d},{"../internal/baseAssign":80,"../internal/baseCreate":83,"../internal/isIterateeCall":110}],128:[function(a,b,c){var d=a("../internal/getNative"),e=a("../internal/isArrayLike"),f=a("../lang/isObject"),g=a("../internal/shimKeys"),h=d(Object,"keys"),i=h?function(a){var b=null==a?void 0:a.constructor;return"function"==typeof b&&b.prototype===a||"function"!=typeof a&&e(a)?g(a):f(a)?h(a):[]}:g;b.exports=i},{"../internal/getNative":107,"../internal/isArrayLike":108,"../internal/shimKeys":115,"../lang/isObject":123}],129:[function(a,b,c){function d(a){if(null==a)return[];i(a)||(a=Object(a));var b=a.length;b=b&&h(b)&&(f(a)||e(a))&&b||0;for(var c=a.constructor,d=-1,j="function"==typeof c&&c.prototype===a,l=Array(b),m=b>0;++d<b;)l[d]=d+"";for(var n in a)m&&g(n,b)||"constructor"==n&&(j||!k.call(a,n))||l.push(n);return l}var e=a("../lang/isArguments"),f=a("../lang/isArray"),g=a("../internal/isIndex"),h=a("../internal/isLength"),i=a("../lang/isObject"),j=Object.prototype,k=j.hasOwnProperty;b.exports=d},{"../internal/isIndex":109,"../internal/isLength":112,"../lang/isArguments":118,"../lang/isArray":119,"../lang/isObject":123}],130:[function(a,b,c){function d(a){a=f(a);for(var b=-1,c=e(a),d=c.length,g=Array(d);++b<d;){var h=c[b];g[b]=[h,a[h]]}return g}var e=a("./keys"),f=a("../internal/toObject");b.exports=d},{"../internal/toObject":116,"./keys":128}],131:[function(a,b,c){function d(a){return a}b.exports=d},{}],132:[function(a,b,c){function d(a){return g(a)?e(a):f(a)}var e=a("../internal/baseProperty"),f=a("../internal/basePropertyDeep"),g=a("../internal/isKey");b.exports=d},{"../internal/baseProperty":94,"../internal/basePropertyDeep":95,"../internal/isKey":111}]},{},[16])(16)});