UNPKG

lib-jitsi-meet-dist

Version:

It's the library of [Jitsi Meet API](https://github.com/jitsi/lib-jitsi-meet) that contains two core file: `external_api.min.js`、`lib-jitsi-meet.min.js`

1 lines 706 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JitsiMeetJS=t():e.JitsiMeetJS=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=147)}([function(e,t){e.exports={ADD_ICE_CANDIDATE_FAILED:"xmpp.add_ice_candidate_failed",AUDIO_MUTED_BY_FOCUS:"xmpp.audio_muted_by_focus",AUTHENTICATION_REQUIRED:"xmpp.authentication_required",BRIDGE_DOWN:"xmpp.bridge_down",CALL_ACCEPTED:"xmpp.callaccepted.jingle",CALL_INCOMING:"xmpp.callincoming.jingle",CALL_ENDED:"xmpp.callended.jingle",CHAT_ERROR_RECEIVED:"xmpp.chat_error_received",CONFERENCE_PROPERTIES_CHANGED:"xmpp.conference_properties_changed",CONNECTION_ESTABLISHED:"xmpp.connection.connected",CONNECTION_FAILED:"xmpp.connection.failed",CONNECTION_INTERRUPTED:"xmpp.connection.interrupted",CONNECTION_RESTORED:"xmpp.connection.restored",CONNECTION_ICE_FAILED:"xmpp.connection.ice.failed",CONNECTION_STATUS_CHANGED:"xmpp.connection.status.changed",DISPLAY_NAME_CHANGED:"xmpp.display_name_changed",EMUC_ROOM_ADDED:"xmpp.emuc_room_added",EMUC_ROOM_REMOVED:"xmpp.emuc_room_removed",ETHERPAD:"xmpp.etherpad",FOCUS_DISCONNECTED:"xmpp.focus_disconnected",FOCUS_LEFT:"xmpp.focus_left",GRACEFUL_SHUTDOWN:"xmpp.graceful_shutdown",ICE_RESTARTING:"rtc.ice_restarting",ICE_RESTART_SUCCESS:"rtc.ice_restart_success",KICKED:"xmpp.kicked",LOCAL_ROLE_CHANGED:"xmpp.localrole_changed",MEETING_ID_SET:"xmpp.meeting_id_set",MESSAGE_RECEIVED:"xmpp.message_received",INVITE_MESSAGE_RECEIVED:"xmpp.invite_message_received",PRIVATE_MESSAGE_RECEIVED:"xmpp.private_message_received",MUC_MEMBER_BOT_TYPE_CHANGED:"xmpp.muc_member_bot_type_changed",MUC_DESTROYED:"xmpp.muc_destroyed",MUC_JOINED:"xmpp.muc_joined",MUC_MEMBER_JOINED:"xmpp.muc_member_joined",MUC_MEMBER_LEFT:"xmpp.muc_member_left",MUC_LOBBY_MEMBER_JOINED:"xmpp.muc_lobby_member_joined",MUC_LOBBY_MEMBER_UPDATED:"xmpp.muc_lobby_member_updated",MUC_LOBBY_MEMBER_LEFT:"xmpp.muc_lobby_member_left",MUC_DENIED_ACCESS:"xmpp.muc_denied access",MUC_LEFT:"xmpp.muc_left",MUC_ROLE_CHANGED:"xmpp.muc_role_changed",MUC_LOCK_CHANGED:"xmpp.muc_lock_changed",MUC_MEMBERS_ONLY_CHANGED:"xmpp.muc_members_only_changed",PARTICIPANT_AUDIO_MUTED:"xmpp.audio_muted",PARTICIPANT_VIDEO_MUTED:"xmpp.video_muted",PARTICIPANT_VIDEO_TYPE_CHANGED:"xmpp.video_type",PARTCIPANT_FEATURES_CHANGED:"xmpp.partcipant_features_changed",PASSWORD_REQUIRED:"xmpp.password_required",PHONE_NUMBER_CHANGED:"conference.phoneNumberChanged",PRESENCE_RECEIVED:"xmpp.presence_received",PRESENCE_STATUS:"xmpp.presence_status",PROMPT_FOR_LOGIN:"xmpp.prompt_for_login",READY_TO_JOIN:"xmpp.ready_to_join",RECORDER_STATE_CHANGED:"xmpp.recorderStateChanged",REMOTE_STATS:"xmpp.remote_stats",RENEGOTIATION_FAILED:"xmpp.renegotiation_failed",RESERVATION_ERROR:"xmpp.room_reservation_error",ROOM_CONNECT_ERROR:"xmpp.room_connect_error",ROOM_CONNECT_NOT_ALLOWED_ERROR:"xmpp.room_connect_error.not_allowed",ROOM_JOIN_ERROR:"xmpp.room_join_error",ROOM_CONNECT_MEMBERS_ONLY_ERROR:"xmpp.room_connect_error.members_only",ROOM_MAX_USERS_ERROR:"xmpp.room_max_users_error",SENDING_CHAT_MESSAGE:"xmpp.sending_chat_message",SENDING_PRIVATE_CHAT_MESSAGE:"xmpp.sending_private_chat_message",SESSION_ACCEPT_TIMEOUT:"xmpp.session_accept_timeout",SPEAKER_STATS_RECEIVED:"xmpp.speaker_stats_received",CONFERENCE_TIMESTAMP_RECEIVED:"xmpp.conference_timestamp_received",START_MUTED_FROM_FOCUS:"xmpp.start_muted_from_focus",SUBJECT_CHANGED:"xmpp.subject_changed",SUSPEND_DETECTED:"xmpp.suspend_detected",TRANSCRIPTION_STATUS_CHANGED:"xmpp.transcription_status_changed",TRANSPORT_INFO:"xmpp.transportinfo.jingle",VIDEO_SIP_GW_AVAILABILITY_CHANGED:"xmpp.videoSIPGWAvailabilityChanged",VIDEO_SIP_GW_SESSION_STATE_CHANGED:"xmpp.videoSIPGWSessionStateChanged",ICE_CONNECTION_STATE_CHANGED:"xmpp.ice_connection_state_changed",JSON_MESSAGE_RECEIVED:"xmmp.json_message_received"}},function(e,t,n){"use strict";n.r(t),n.d(t,"AUDIO_INPUT_STATE_CHANGE",(function(){return i})),n.d(t,"AUTH_STATUS_CHANGED",(function(){return r})),n.d(t,"BEFORE_STATISTICS_DISPOSED",(function(){return s})),n.d(t,"CONFERENCE_ERROR",(function(){return o})),n.d(t,"CONFERENCE_FAILED",(function(){return a})),n.d(t,"CONFERENCE_JOINED",(function(){return c})),n.d(t,"CONFERENCE_LEFT",(function(){return d})),n.d(t,"CONNECTION_ESTABLISHED",(function(){return u})),n.d(t,"CONNECTION_INTERRUPTED",(function(){return l})),n.d(t,"CONNECTION_RESTORED",(function(){return h})),n.d(t,"DATA_CHANNEL_OPENED",(function(){return p})),n.d(t,"DISPLAY_NAME_CHANGED",(function(){return m})),n.d(t,"DOMINANT_SPEAKER_CHANGED",(function(){return f})),n.d(t,"CONFERENCE_CREATED_TIMESTAMP",(function(){return g})),n.d(t,"DTMF_SUPPORT_CHANGED",(function(){return _})),n.d(t,"ENDPOINT_MESSAGE_RECEIVED",(function(){return v})),n.d(t,"JVB121_STATUS",(function(){return S})),n.d(t,"KICKED",(function(){return y})),n.d(t,"PARTICIPANT_KICKED",(function(){return E})),n.d(t,"LAST_N_ENDPOINTS_CHANGED",(function(){return b})),n.d(t,"LOCK_STATE_CHANGED",(function(){return T})),n.d(t,"SERVER_REGION_CHANGED",(function(){return C})),n.d(t,"_MEDIA_SESSION_STARTED",(function(){return R})),n.d(t,"_MEDIA_SESSION_ACTIVE_CHANGED",(function(){return A})),n.d(t,"MEMBERS_ONLY_CHANGED",(function(){return w})),n.d(t,"MESSAGE_RECEIVED",(function(){return I})),n.d(t,"NO_AUDIO_INPUT",(function(){return P})),n.d(t,"NOISY_MIC",(function(){return O})),n.d(t,"PRIVATE_MESSAGE_RECEIVED",(function(){return D})),n.d(t,"PARTICIPANT_CONN_STATUS_CHANGED",(function(){return N})),n.d(t,"PARTCIPANT_FEATURES_CHANGED",(function(){return M})),n.d(t,"PARTICIPANT_PROPERTY_CHANGED",(function(){return L})),n.d(t,"P2P_STATUS",(function(){return k})),n.d(t,"PHONE_NUMBER_CHANGED",(function(){return x})),n.d(t,"PROPERTIES_CHANGED",(function(){return j})),n.d(t,"RECORDER_STATE_CHANGED",(function(){return F})),n.d(t,"VIDEO_SIP_GW_AVAILABILITY_CHANGED",(function(){return U})),n.d(t,"VIDEO_SIP_GW_SESSION_STATE_CHANGED",(function(){return H})),n.d(t,"START_MUTED_POLICY_CHANGED",(function(){return J})),n.d(t,"STARTED_MUTED",(function(){return B})),n.d(t,"SUBJECT_CHANGED",(function(){return G})),n.d(t,"SUSPEND_DETECTED",(function(){return V})),n.d(t,"TALK_WHILE_MUTED",(function(){return $})),n.d(t,"TRACK_ADDED",(function(){return K})),n.d(t,"TRACK_AUDIO_LEVEL_CHANGED",(function(){return q})),n.d(t,"TRACK_MUTE_CHANGED",(function(){return W})),n.d(t,"TRACK_REMOVED",(function(){return z})),n.d(t,"TRANSCRIPTION_STATUS_CHANGED",(function(){return Q})),n.d(t,"USER_JOINED",(function(){return X})),n.d(t,"USER_LEFT",(function(){return Y})),n.d(t,"USER_ROLE_CHANGED",(function(){return Z})),n.d(t,"USER_STATUS_CHANGED",(function(){return ee})),n.d(t,"BOT_TYPE_CHANGED",(function(){return te})),n.d(t,"LOBBY_USER_JOINED",(function(){return ne})),n.d(t,"LOBBY_USER_UPDATED",(function(){return ie})),n.d(t,"LOBBY_USER_LEFT",(function(){return re}));const i="conference.audio_input_state_changed",r="conference.auth_status_changed",s="conference.beforeStatisticsDisposed",o="conference.error",a="conference.failed",c="conference.joined",d="conference.left",u="conference.connectionEstablished",l="conference.connectionInterrupted",h="conference.connectionRestored",p="conference.dataChannelOpened",m="conference.displayNameChanged",f="conference.dominantSpeaker",g="conference.createdTimestamp",_="conference.dtmfSupportChanged",v="conference.endpoint_message_received",S="conference.jvb121Status",y="conference.kicked",E="conference.participant_kicked",b="conference.lastNEndpointsChanged",T="conference.lock_state_changed",C="conference.server_region_changed",R="conference.media_session.started",A="conference.media_session.active_changed",w="conference.membersOnlyChanged",I="conference.messageReceived",P="conference.no_audio_input",O="conference.noisy_mic",D="conference.privateMessageReceived",N="conference.participant_conn_status_changed",M="conference.partcipant_features_changed",L="conference.participant_property_changed",k="conference.p2pStatus",x="conference.phoneNumberChanged",j="conference.propertiesChanged",F="conference.recorderStateChanged",U="conference.videoSIPGWAvailabilityChanged",H="conference.videoSIPGWSessionStateChanged",J="conference.start_muted_policy_changed",B="conference.started_muted",G="conference.subjectChanged",V="conference.suspendDetected",$="conference.talk_while_muted",K="conference.trackAdded",q="conference.audioLevelsChanged",W="conference.trackMuteChanged",z="conference.trackRemoved",Q="conference.transcriptionStatusChanged",X="conference.userJoined",Y="conference.userLeft",Z="conference.roleChanged",ee="conference.statusChanged",te="conference.bot_type_changed",ne="conference.lobby.userJoined",ie="conference.lobby.userUpdated",re="conference.lobby.userLeft"},function(e,t,n){(function(t){var n;n=function(){"use strict";var e=void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var r=function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},s=function(e){if("string"!=typeof e)throw new Error("str2binl was passed a non-string");for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return t},o=function(e,t,n,i,s,o){return r((a=r(r(t,e),r(i,o)))<<(c=s)|a>>>32-c,n);var a,c},a=function(e,t,n,i,r,s,a){return o(t&n|~t&i,e,t,r,s,a)},c=function(e,t,n,i,r,s,a){return o(t&i|n&~i,e,t,r,s,a)},d=function(e,t,n,i,r,s,a){return o(t^n^i,e,t,r,s,a)},u=function(e,t,n,i,r,s,a){return o(n^(t|~i),e,t,r,s,a)},l=function(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var n,i,s,o,l=1732584193,h=-271733879,p=-1732584194,m=271733878,f=0;f<e.length;f+=16)n=l,i=h,s=p,o=m,l=a(l,h,p,m,e[f+0],7,-680876936),m=a(m,l,h,p,e[f+1],12,-389564586),p=a(p,m,l,h,e[f+2],17,606105819),h=a(h,p,m,l,e[f+3],22,-1044525330),l=a(l,h,p,m,e[f+4],7,-176418897),m=a(m,l,h,p,e[f+5],12,1200080426),p=a(p,m,l,h,e[f+6],17,-1473231341),h=a(h,p,m,l,e[f+7],22,-45705983),l=a(l,h,p,m,e[f+8],7,1770035416),m=a(m,l,h,p,e[f+9],12,-1958414417),p=a(p,m,l,h,e[f+10],17,-42063),h=a(h,p,m,l,e[f+11],22,-1990404162),l=a(l,h,p,m,e[f+12],7,1804603682),m=a(m,l,h,p,e[f+13],12,-40341101),p=a(p,m,l,h,e[f+14],17,-1502002290),h=a(h,p,m,l,e[f+15],22,1236535329),l=c(l,h,p,m,e[f+1],5,-165796510),m=c(m,l,h,p,e[f+6],9,-1069501632),p=c(p,m,l,h,e[f+11],14,643717713),h=c(h,p,m,l,e[f+0],20,-373897302),l=c(l,h,p,m,e[f+5],5,-701558691),m=c(m,l,h,p,e[f+10],9,38016083),p=c(p,m,l,h,e[f+15],14,-660478335),h=c(h,p,m,l,e[f+4],20,-405537848),l=c(l,h,p,m,e[f+9],5,568446438),m=c(m,l,h,p,e[f+14],9,-1019803690),p=c(p,m,l,h,e[f+3],14,-187363961),h=c(h,p,m,l,e[f+8],20,1163531501),l=c(l,h,p,m,e[f+13],5,-1444681467),m=c(m,l,h,p,e[f+2],9,-51403784),p=c(p,m,l,h,e[f+7],14,1735328473),h=c(h,p,m,l,e[f+12],20,-1926607734),l=d(l,h,p,m,e[f+5],4,-378558),m=d(m,l,h,p,e[f+8],11,-2022574463),p=d(p,m,l,h,e[f+11],16,1839030562),h=d(h,p,m,l,e[f+14],23,-35309556),l=d(l,h,p,m,e[f+1],4,-1530992060),m=d(m,l,h,p,e[f+4],11,1272893353),p=d(p,m,l,h,e[f+7],16,-155497632),h=d(h,p,m,l,e[f+10],23,-1094730640),l=d(l,h,p,m,e[f+13],4,681279174),m=d(m,l,h,p,e[f+0],11,-358537222),p=d(p,m,l,h,e[f+3],16,-722521979),h=d(h,p,m,l,e[f+6],23,76029189),l=d(l,h,p,m,e[f+9],4,-640364487),m=d(m,l,h,p,e[f+12],11,-421815835),p=d(p,m,l,h,e[f+15],16,530742520),h=d(h,p,m,l,e[f+2],23,-995338651),l=u(l,h,p,m,e[f+0],6,-198630844),m=u(m,l,h,p,e[f+7],10,1126891415),p=u(p,m,l,h,e[f+14],15,-1416354905),h=u(h,p,m,l,e[f+5],21,-57434055),l=u(l,h,p,m,e[f+12],6,1700485571),m=u(m,l,h,p,e[f+3],10,-1894986606),p=u(p,m,l,h,e[f+10],15,-1051523),h=u(h,p,m,l,e[f+1],21,-2054922799),l=u(l,h,p,m,e[f+8],6,1873313359),m=u(m,l,h,p,e[f+15],10,-30611744),p=u(p,m,l,h,e[f+6],15,-1560198380),h=u(h,p,m,l,e[f+13],21,1309151649),l=u(l,h,p,m,e[f+4],6,-145523070),m=u(m,l,h,p,e[f+11],10,-1120210379),p=u(p,m,l,h,e[f+2],15,718787259),h=u(h,p,m,l,e[f+9],21,-343485551),l=r(l,n),h=r(h,i),p=r(p,s),m=r(m,o);return[l,h,p,m]},h={hexdigest:function(e){return function(e){for(var t="",n=0;n<4*e.length;n++)t+="0123456789abcdef".charAt(e[n>>2]>>n%4*8+4&15)+"0123456789abcdef".charAt(e[n>>2]>>n%4*8&15);return t}(l(s(e),8*e.length))},hash:function(e){return function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(l(s(e),8*e.length))}};function p(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;var n,i,r,s,o,a,c,d,u=new Array(80),l=1732584193,h=-271733879,p=-1732584194,g=271733878,S=-1009589776;for(n=0;n<e.length;n+=16){for(s=l,o=h,a=p,c=g,d=S,i=0;i<80;i++)u[i]=i<16?e[n+i]:v(u[i-3]^u[i-8]^u[i-14]^u[i-16],1),r=_(_(v(l,5),m(i,h,p,g)),_(_(S,u[i]),f(i))),S=g,g=p,p=v(h,30),h=l,l=r;l=_(l,s),h=_(h,o),p=_(p,a),g=_(g,c),S=_(S,d)}return[l,h,p,g,S]}function m(e,t,n,i){return e<20?t&n|~t&i:e<40?t^n^i:e<60?t&n|t&i|n&i:t^n^i}function f(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function g(e,t){var n=S(e);n.length>16&&(n=p(n,8*e.length));for(var i=new Array(16),r=new Array(16),s=0;s<16;s++)i[s]=909522486^n[s],r[s]=1549556828^n[s];var o=p(i.concat(S(t)),512+8*t.length);return p(r.concat(o),672)}function _(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function v(e,t){return e<<t|e>>>32-t}function S(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function y(e){for(var t,n,i="",r=0;r<4*e.length;r+=3)for(t=(e[r>>2]>>8*(3-r%4)&255)<<16|(e[r+1>>2]>>8*(3-(r+1)%4)&255)<<8|e[r+2>>2]>>8*(3-(r+2)%4)&255,n=0;n<4;n++)8*r+6*n>32*e.length?i+="=":i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return i}function E(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}var b={b64_hmac_sha1:function(e,t){return y(g(e,t))},b64_sha1:function(e){return y(p(S(e),8*e.length))},binb2str:E,core_hmac_sha1:g,str_hmac_sha1:function(e,t){return E(g(e,t))},str_sha1:function(e){return E(p(S(e),8*e.length))}},T=function(e){var t,n,i="",r=e.length;for(t=0;t<r;t++)(n=e.charCodeAt(t))>=0&&n<=127?i+=e.charAt(t):n>2047?(i+=String.fromCharCode(224|n>>12&15),i+=String.fromCharCode(128|n>>6&63),i+=String.fromCharCode(128|n>>0&63)):(i+=String.fromCharCode(192|n>>6&31),i+=String.fromCharCode(128|n>>0&63));return i},C=function(e){for(var t in e=e||{})if(Object.prototype.hasOwnProperty.call(e,t)){var i="",r="",s="",o=e[t],a="object"===n(o),c=escape(unescape(a?o.value:o));a&&(i=o.expires?";expires="+o.expires:"",r=o.domain?";domain="+o.domain:"",s=o.path?";path="+o.path:""),document.cookie=t+"="+c+i+r+s}};function R(e,t){return new I.Builder(e,t)}function A(e){return new I.Builder("iq",e)}function w(e){return new I.Builder("presence",e)}var I={VERSION:"@VERSION@",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(e){for(var t=0;t<I.XHTML.tags.length;t++)if(e===I.XHTML.tags[t])return!0;return!1},validAttribute:function(e,t){if(void 0!==I.XHTML.attributes[e]&&I.XHTML.attributes[e].length>0)for(var n=0;n<I.XHTML.attributes[e].length;n++)if(t===I.XHTML.attributes[e][n])return!0;return!1},validCSS:function(e){for(var t=0;t<I.XHTML.css.length;t++)if(e===I.XHTML.css[t])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,CONNTIMEOUT:10,BINDREQUIRED:11},ErrorCondition:{BAD_FORMAT:"bad-format",CONFLICT:"conflict",MISSING_JID_NODE:"x-strophe-bad-non-anon-jid",NO_AUTH_MECH:"no-auth-mech",UNKNOWN_REASON:"unknown"},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(e,t){I.NS[e]=t},forEachChild:function(e,t,n){for(var i=0;i<e.childNodes.length;i++){var r=e.childNodes[i];r.nodeType!==I.ElementType.NORMAL||t&&!this.isTagEqual(r,t)||n(r)}},isTagEqual:function(e,t){return e.tagName===t},_xmlGenerator:null,_makeGenerator:function(){var e;return void 0===document.implementation.createDocument||document.implementation.createDocument&&document.documentMode&&document.documentMode<10?(e=this._getIEXmlDom()).appendChild(e.createElement("strophe")):e=document.implementation.createDocument("jabber:client","strophe",null),e},xmlGenerator:function(){return I._xmlGenerator||(I._xmlGenerator=I._makeGenerator()),I._xmlGenerator},_getIEXmlDom:function(){for(var e=null,t=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"],n=0;n<t.length&&null===e;n++)try{e=new ActiveXObject(t[n])}catch(t){e=null}return e},xmlElement:function(e){if(!e)return null;for(var t=I.xmlGenerator().createElement(e),i=1;i<arguments.length;i++){var r=arguments[i];if(r)if("string"==typeof r||"number"==typeof r)t.appendChild(I.xmlTextNode(r));else if("object"===n(r)&&"function"==typeof r.sort)for(var s=0;s<r.length;s++){var o=r[s];"object"===n(o)&&"function"==typeof o.sort&&void 0!==o[1]&&null!==o[1]&&t.setAttribute(o[0],o[1])}else if("object"===n(r))for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&void 0!==r[a]&&null!==r[a]&&t.setAttribute(a,r[a])}return t},xmlescape:function(e){return e=(e=(e=(e=(e=e.replace(/\&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/'/g,"&apos;")).replace(/"/g,"&quot;")},xmlunescape:function(e){return e=(e=(e=(e=(e=e.replace(/\&amp;/g,"&")).replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&apos;/g,"'")).replace(/&quot;/g,'"')},xmlTextNode:function(e){return I.xmlGenerator().createTextNode(e)},xmlHtmlNode:function(e){var t;return DOMParser?t=(new DOMParser).parseFromString(e,"text/xml"):((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)),t},getText:function(e){if(!e)return null;var t="";0===e.childNodes.length&&e.nodeType===I.ElementType.TEXT&&(t+=e.nodeValue);for(var n=0;n<e.childNodes.length;n++)e.childNodes[n].nodeType===I.ElementType.TEXT&&(t+=e.childNodes[n].nodeValue);return I.xmlescape(t)},copyElement:function(e){var t;if(e.nodeType===I.ElementType.NORMAL){t=I.xmlElement(e.tagName);for(var n=0;n<e.attributes.length;n++)t.setAttribute(e.attributes[n].nodeName,e.attributes[n].value);for(var i=0;i<e.childNodes.length;i++)t.appendChild(I.copyElement(e.childNodes[i]))}else e.nodeType===I.ElementType.TEXT&&(t=I.xmlGenerator().createTextNode(e.nodeValue));return t},createHtml:function(e){var t;if(e.nodeType===I.ElementType.NORMAL){var i=e.nodeName.toLowerCase();if(I.XHTML.validTag(i))try{t=I.xmlElement(i);for(var r=0;r<I.XHTML.attributes[i].length;r++){var s=I.XHTML.attributes[i][r],o=e.getAttribute(s);if(null!=o&&""!==o&&!1!==o&&0!==o)if("style"===s&&"object"===n(o)&&void 0!==o.cssText&&(o=o.cssText),"style"===s){for(var a=[],c=o.split(";"),d=0;d<c.length;d++){var u=c[d].split(":"),l=u[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase();if(I.XHTML.validCSS(l)){var h=u[1].replace(/^\s*/,"").replace(/\s*$/,"");a.push(l+": "+h)}}a.length>0&&(o=a.join("; "),t.setAttribute(s,o))}else t.setAttribute(s,o)}for(var p=0;p<e.childNodes.length;p++)t.appendChild(I.createHtml(e.childNodes[p]))}catch(e){t=I.xmlTextNode("")}else{t=I.xmlGenerator().createDocumentFragment();for(var m=0;m<e.childNodes.length;m++)t.appendChild(I.createHtml(e.childNodes[m]))}}else if(e.nodeType===I.ElementType.FRAGMENT){t=I.xmlGenerator().createDocumentFragment();for(var f=0;f<e.childNodes.length;f++)t.appendChild(I.createHtml(e.childNodes[f]))}else e.nodeType===I.ElementType.TEXT&&(t=I.xmlTextNode(e.nodeValue));return t},escapeNode:function(e){return"string"!=typeof e?e:e.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(e){return"string"!=typeof e?e:e.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(e){return e.indexOf("@")<0?null:e.split("@")[0]},getDomainFromJid:function(e){var t=I.getBareJidFromJid(e);if(t.indexOf("@")<0)return t;var n=t.split("@");return n.splice(0,1),n.join("@")},getResourceFromJid:function(e){if(!e)return null;var t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))},getBareJidFromJid:function(e){return e?e.split("/")[0]:null},_handleError:function(e){void 0!==e.stack&&I.fatal(e.stack),e.sourceURL?I.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?I.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):I.fatal("error: "+e.message)},log:function(e,t){e===this.LogLevel.FATAL&&"object"===n(window.console)&&"function"==typeof window.console.error&&window.console.error(t)},debug:function(e){this.log(this.LogLevel.DEBUG,e)},info:function(e){this.log(this.LogLevel.INFO,e)},warn:function(e){this.log(this.LogLevel.WARN,e)},error:function(e){this.log(this.LogLevel.ERROR,e)},fatal:function(e){this.log(this.LogLevel.FATAL,e)},serialize:function(e){if(!e)return null;"function"==typeof e.tree&&(e=e.tree());var t=i(Array(e.attributes.length).keys()).map((function(t){return e.attributes[t].nodeName}));t.sort();var n=t.reduce((function(t,n){return"".concat(t," ").concat(n,'="').concat(I.xmlescape(e.attributes.getNamedItem(n).value),'"')}),"<".concat(e.nodeName));if(e.childNodes.length>0){n+=">";for(var r=0;r<e.childNodes.length;r++){var s=e.childNodes[r];switch(s.nodeType){case I.ElementType.NORMAL:n+=I.serialize(s);break;case I.ElementType.TEXT:n+=I.xmlescape(s.nodeValue);break;case I.ElementType.CDATA:n+="<![CDATA["+s.nodeValue+"]]>"}}n+="</"+e.nodeName+">"}else n+="/>";return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(e,t){I._connectionPlugins[e]=t},Builder:function(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=I.NS.CLIENT:t||(t={xmlns:I.NS.CLIENT})),this.nodeTree=I.xmlElement(e,t),this.node=this.nodeTree}};I.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return I.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},root:function(){return this.node=this.nodeTree,this},attrs:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===e[t]?this.node.removeAttribute(t):this.node.setAttribute(t,e[t]));return this},c:function(e,t,n){var i=I.xmlElement(e,t,n);return this.node.appendChild(i),"string"!=typeof n&&"number"!=typeof n&&(this.node=i),this},cnode:function(e){var t,n=I.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}var i=t?n.importNode(e,!0):I.copyElement(e);return this.node.appendChild(i),this.node=i,this},t:function(e){var t=I.xmlTextNode(e);return this.node.appendChild(t),this},h:function(e){var t=document.createElement("body");t.innerHTML=e;for(var n=I.createHtml(t);n.childNodes.length>0;)this.node.appendChild(n.childNodes[0]);return this}},I.Handler=function(e,t,n,i,r,s,o){this.handler=e,this.ns=t,this.name=n,this.type=i,this.id=r,this.options=o||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},this.options.matchBare&&(I.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'),this.options.matchBareFromJid=this.options.matchBare,delete this.options.matchBare),this.options.matchBareFromJid?this.from=s?I.getBareJidFromJid(s):null:this.from=s,this.user=!0},I.Handler.prototype={getNamespace:function(e){var t=e.getAttribute("xmlns");return t&&this.options.ignoreNamespaceFragment&&(t=t.split("#")[0]),t},namespaceMatch:function(e){var t=this,n=!1;return!this.ns||(I.forEachChild(e,null,(function(e){t.getNamespace(e)===t.ns&&(n=!0)})),n||this.getNamespace(e)===this.ns)},isMatch:function(e){var t=e.getAttribute("from");this.options.matchBareFromJid&&(t=I.getBareJidFromJid(t));var n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!I.isTagEqual(e,this.name)||this.type&&(Array.isArray(this.type)?-1===this.type.indexOf(n):n!==this.type)||this.id&&e.getAttribute("id")!==this.id||this.from&&t!==this.from)},run:function(e){var t=null;try{t=this.handler(e)}catch(e){throw I._handleError(e),e}return t},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},I.TimedHandler=function(e,t){this.period=e,this.handler=t,this.lastCalled=(new Date).getTime(),this.user=!0},I.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+")}"}},I.Connection=function(e,t){var n=this;this.service=e,this.options=t||{};var i=this.options.protocol||"";for(var r in 0===e.indexOf("ws:")||0===e.indexOf("wss:")||0===i.indexOf("ws")?this._proto=new I.Websocket(this):this._proto=new I.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.protocolErrorHandlers={HTTP:{},websocket:{}},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((function(){return n._onIdle()}),100),C(this.options.cookies),this.registerSASLMechanisms(this.options.mechanisms),I._connectionPlugins)if(Object.prototype.hasOwnProperty.call(I._connectionPlugins,r)){var s=function(){};s.prototype=I._connectionPlugins[r],this[r]=new s,this[r].init(this)}},I.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.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(e){var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t+""},addProtocolErrorHandler:function(e,t,n){this.protocolErrorHandlers[e][t]=n},connect:function(e,t,n,i,r,s,o){this.jid=e,this.authzid=I.getBareJidFromJid(this.jid),this.authcid=o||I.getNodeFromJid(this.jid),this.pass=t,this.servtype="xmpp",this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=I.getDomainFromJid(this.jid),this._changeConnectStatus(I.Status.CONNECTING,null),this._proto._connect(i,r,s)},attach:function(e,t,n,i,r,s,o){if(!(this._proto instanceof I.Bosh)){var a=new Error('The "attach" method can only be used with a BOSH connection.');throw a.name="StropheSessionError",a}this._proto._attach(e,t,n,i,r,s,o)},restore:function(e,t,n,i,r){if(!this._sessionCachingSupported()){var s=new Error('The "restore" method can only be used with a BOSH connection.');throw s.name="StropheSessionError",s}this._proto._restore(e,t,n,i,r)},_sessionCachingSupported:function(){if(this._proto instanceof I.Bosh){if(!JSON)return!1;try{sessionStorage.setItem("_strophe_","_strophe_"),sessionStorage.removeItem("_strophe_")}catch(e){return!1}return!0}return!1},xmlInput:function(e){},xmlOutput:function(e){},rawInput:function(e){},rawOutput:function(e){},nextValidRid:function(e){},send:function(e){if(null!==e){if("function"==typeof e.sort)for(var t=0;t<e.length;t++)this._queueData(e[t]);else"function"==typeof e.tree?this._queueData(e.tree()):this._queueData(e);this._proto._send()}},flush:function(){clearTimeout(this._idleTimeout),this._onIdle()},sendPresence:function(e,t,n,i){var r=this,s=null;"function"==typeof e.tree&&(e=e.tree());var o=e.getAttribute("id");if(o||(o=this.getUniqueId("sendPresence"),e.setAttribute("id",o)),"function"==typeof t||"function"==typeof n){var a=this.addHandler((function(e){s&&r.deleteTimedHandler(s),"error"===e.getAttribute("type")?n&&n(e):t&&t(e)}),null,"presence",null,o);i&&(s=this.addTimedHandler(i,(function(){return r.deleteHandler(a),n&&n(null),!1})))}return this.send(e),o},sendIQ:function(e,t,n,i){var r=this,s=null;"function"==typeof e.tree&&(e=e.tree());var o=e.getAttribute("id");if(o||(o=this.getUniqueId("sendIQ"),e.setAttribute("id",o)),"function"==typeof t||"function"==typeof n){var a=this.addHandler((function(e){s&&r.deleteTimedHandler(s);var i=e.getAttribute("type");if("result"===i)t&&t(e);else{if("error"!==i){var o=new Error("Got bad IQ type of ".concat(i));throw o.name="StropheError",o}n&&n(e)}}),null,"iq",["error","result"],o);i&&(s=this.addTimedHandler(i,(function(){return r.deleteHandler(a),n&&n(null),!1})))}return this.send(e),o},_queueData:function(e){if(null===e||!e.tagName||!e.childNodes){var t=new Error("Cannot queue non-DOMElement.");throw t.name="StropheError",t}this._data.push(e)},_sendRestart:function(){var e=this;this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout((function(){return e._onIdle()}),100)},addTimedHandler:function(e,t){var n=new I.TimedHandler(e,t);return this.addTimeds.push(n),n},deleteTimedHandler:function(e){this.removeTimeds.push(e)},addHandler:function(e,t,n,i,r,s,o){var a=new I.Handler(e,t,n,i,r,s,o);return this.addHandlers.push(a),a},deleteHandler:function(e){this.removeHandlers.push(e);var t=this.addHandlers.indexOf(e);t>=0&&this.addHandlers.splice(t,1)},registerSASLMechanisms:function(e){this.mechanisms={},(e=e||[I.SASLAnonymous,I.SASLExternal,I.SASLMD5,I.SASLOAuthBearer,I.SASLXOAuth2,I.SASLPlain,I.SASLSHA1]).forEach(this.registerSASLMechanism.bind(this))},registerSASLMechanism:function(e){this.mechanisms[e.prototype.name]=e},disconnect:function(e){if(this._changeConnectStatus(I.Status.DISCONNECTING,e),I.warn("Disconnect was called because: "+e),this.connected){var t=!1;this.disconnecting=!0,this.authenticated&&(t=w({xmlns:I.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(t)}else I.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()},_changeConnectStatus:function(e,t,n){for(var i in I._connectionPlugins)if(Object.prototype.hasOwnProperty.call(I._connectionPlugins,i)){var r=this[i];if(r.statusChanged)try{r.statusChanged(e,t)}catch(e){I.error("".concat(i," plugin caused an exception changing status: ").concat(e))}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){I._handleError(e),I.error("User connection callback caused an exception: ".concat(e))}},_doDisconnect:function(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),I.debug("_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(I.Status.DISCONNECTED,e),this.connected=!1},_dataRecv:function(e,t){var n=this;I.debug("_dataRecv called");var i=this._proto._reqToData(e);if(null!==i){for(this.xmlInput!==I.Connection.prototype.xmlInput&&(i.nodeName===this._proto.strip&&i.childNodes.length?this.xmlInput(i.childNodes[0]):this.xmlInput(i)),this.rawInput!==I.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(I.serialize(i)));this.removeHandlers.length>0;){var r=this.removeHandlers.pop(),s=this.handlers.indexOf(r);s>=0&&this.handlers.splice(s,1)}for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())this._doDisconnect();else{var o=i.getAttribute("type");if(null!==o&&"terminate"===o){if(this.disconnecting)return;var a=i.getAttribute("condition"),c=i.getElementsByTagName("conflict");return null!==a?("remote-stream-error"===a&&c.length>0&&(a="conflict"),this._changeConnectStatus(I.Status.CONNFAIL,a)):this._changeConnectStatus(I.Status.CONNFAIL,I.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(a)}I.forEachChild(i,null,(function(e){var t=n.handlers;n.handlers=[];for(var i=0;i<t.length;i++){var r=t[i];try{(!r.isMatch(e)||!n.authenticated&&r.user||r.run(e))&&n.handlers.push(r)}catch(e){I.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}}))}}},mechanisms:{},_connect_cb:function(e,t,n){var i;I.debug("_connect_cb was called"),this.connected=!0;try{i=this._proto._reqToData(e)}catch(e){if(e.name!==I.ErrorCondition.BAD_FORMAT)throw e;this._changeConnectStatus(I.Status.CONNFAIL,I.ErrorCondition.BAD_FORMAT),this._doDisconnect(I.ErrorCondition.BAD_FORMAT)}if(i&&(this.xmlInput!==I.Connection.prototype.xmlInput&&(i.nodeName===this._proto.strip&&i.childNodes.length?this.xmlInput(i.childNodes[0]):this.xmlInput(i)),this.rawInput!==I.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(I.serialize(i))),this._proto._connect_cb(i)!==I.Status.CONNFAIL))if(i.getElementsByTagNameNS?i.getElementsByTagNameNS(I.NS.STREAM,"features").length>0:i.getElementsByTagName("stream:features").length>0||i.getElementsByTagName("features").length>0){var r=[],s=i.getElementsByTagName("mechanism");if(s.length>0)for(var o=0;o<s.length;o++){var a=I.getText(s[o]);this.mechanisms[a]&&r.push(this.mechanisms[a])}0!==r.length||0!==i.getElementsByTagName("auth").length?!1!==this.do_authentication&&this.authenticate(r):this._proto._no_auth_received(t)}else this._proto._no_auth_received(t)},sortMechanismsByPriority:function(e){for(var t=0;t<e.length-1;++t){for(var n=t,i=t+1;i<e.length;++i)e[i].prototype.priority>e[n].prototype.priority&&(n=i);if(n!==t){var r=e[t];e[t]=e[n],e[n]=r}}return e},authenticate:function(e){this._attemptSASLAuth(e)||this._attemptLegacyAuth()},_attemptSASLAuth:function(e){e=this.sortMechanismsByPriority(e||[]);for(var t=!1,n=0;n<e.length;++n)if(e[n].prototype.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 e[n],this._sasl_mechanism.onStart(this);var i=R("auth",{xmlns:I.NS.SASL,mechanism:this._sasl_mechanism.name});if(this._sasl_mechanism.isClientFirst){var r=this._sasl_mechanism.onChallenge(this,null);i.t(btoa(r))}this.send(i.tree()),t=!0;break}return t},_sasl_challenge_cb:function(e){var t=atob(I.getText(e)),n=this._sasl_mechanism.onChallenge(this,t),i=R("response",{xmlns:I.NS.SASL});return""!==n&&i.t(btoa(n)),this.send(i.tree()),!0},_attemptLegacyAuth:function(){null===I.getNodeFromJid(this.jid)?(this._changeConnectStatus(I.Status.CONNFAIL,I.ErrorCondition.MISSING_JID_NODE),this.disconnect(I.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(I.Status.AUTHENTICATING,null),this._addSysHandler(this._onLegacyAuthIQResult.bind(this),null,null,null,"_auth_1"),this.send(A({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:I.NS.AUTH}).c("username",{}).t(I.getNodeFromJid(this.jid)).tree()))},_onLegacyAuthIQResult:function(e){var t=A({type:"set",id:"_auth_2"}).c("query",{xmlns:I.NS.AUTH}).c("username",{}).t(I.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return I.getResourceFromJid(this.jid)||(this.jid=I.getBareJidFromJid(this.jid)+"/strophe"),t.up().c("resource",{}).t(I.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(t.tree()),!1},_sasl_success_cb:function(e){var t=this;if(this._sasl_data["server-signature"]){var n,i=atob(I.getText(e)).match(/([a-z]+)=([^,]+)(,|$)/);if("v"===i[1]&&(n=i[2]),n!==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)}I.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 r=[],s=function(e,n){for(;e.length;)t.deleteHandler(e.pop());return t._onStreamFeaturesAfterSASL(n),!1};return r.push(this._addSysHandler((function(e){return s(r,e)}),null,"stream:features",null,null)),r.push(this._addSysHandler((function(e){return s(r,e)}),I.NS.STREAM,"features",null,null)),this._sendRestart(),!1},_onStreamFeaturesAfterSASL:function(e){this.features=e;for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];"bind"===n.nodeName&&(this.do_bind=!0),"session"===n.nodeName&&(this.do_session=!0)}return this.do_bind?(this.options.explicitResourceBinding?this._changeConnectStatus(I.Status.BINDREQUIRED,null):this.bind(),!1):(this._changeConnectStatus(I.Status.AUTHFAIL,null),!1)},bind:function(){if(this.do_bind){this._addSysHandler(this._onResourceBindResultIQ.bind(this),null,null,null,"_bind_auth_2");var e=I.getResourceFromJid(this.jid);e?this.send(A({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:I.NS.BIND}).c("resource",{}).t(e).tree()):this.send(A({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:I.NS.BIND}).tree())}else I.log(I.LogLevel.INFO,'Strophe.Connection.prototype.bind called but "do_bind" is false')},_onResourceBindResultIQ:function(e){var t;if("error"===e.getAttribute("type"))return I.warn("Resource binding failed."),e.getElementsByTagName("conflict").length>0&&(t=I.ErrorCondition.CONFLICT),this._changeConnectStatus(I.Status.AUTHFAIL,t,e),!1;var n=e.getElementsByTagName("bind");if(!(n.length>0))return I.warn("Resource binding failed."),this._changeConnectStatus(I.Status.AUTHFAIL,null,e),!1;var i=n[0].getElementsByTagName("jid");i.length>0&&(this.jid=I.getText(i[0]),this.do_session?this._establishSession():(this.authenticated=!0,this._changeConnectStatus(I.Status.CONNECTED,null)))},_establishSession:function(){if(!this.do_session)throw new Error("Strophe.Connection.prototype._establishSession "+"called but apparently ".concat(I.NS.SESSION," wasn't advertised by the server"));this._addSysHandler(this._onSessionResultIQ.bind(this),null,null,null,"_session_auth_2"),this.send(A({type:"set",id:"_session_auth_2"}).c("session",{xmlns:I.NS.SESSION}).tree())},_onSessionResultIQ:function(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(I.Status.CONNECTED,null);else if("error"===e.getAttribute("type"))return I.warn("Session creation failed."),this._changeConnectStatus(I.Status.AUTHFAIL,null,e),!1;return!1},_sasl_failure_cb:function(e){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(I.Status.AUTHFAIL,null,e),!1},_auth2_cb:function(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(I.Status.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(I.Status.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1},_addSysTimedHandler:function(e,t){var n=new I.TimedHandler(e,t);return n.user=!1,this.addTimeds.push(n),n},_addSysHandler:function(e,t,n,i,r){var s=new I.Handler(e,t,n,i,r);return s.user=!1,this.addHandlers.push(s),s},_onDisconnectTimeout:function(){return I.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(I.Status.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1},_onIdle:function(){for(var e=this;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;){var t=this.removeTimeds.pop(),n=this.timedHandlers.indexOf(t);n>=0&&this.timedHandlers.splice(n,1)}for(var i=(new Date).getTime(),r=[],s=0;s<this.timedHandlers.length;s++){var o=this.timedHandlers[s];!this.authenticated&&o.user||(o.lastCalled+o.period-i<=0?o.run()&&r.push(o):r.push(o))}this.timedHandlers=r,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout((function(){return e._onIdle()}),100))}},I.SASLMechanism=function(e,t,n){this.name=e,this.isClientFirst=t,this.priority=n},I.SASLMechanism.prototype={test:function(e){return!0},onStart:function(e){this._connection=e},onChallenge:function(e,t){throw new Error("You should implement challenge handling!")},onFailure:function(){this._connection=null},onSuccess:function(){this._connection=null}},I.SASLAnonymous=function(){},I.SASLAnonymous.prototype=new I.SASLMechanism("ANONYMOUS",!1,20),I.SASLAnonymous.prototype.test=function(e){return null===e.authcid},I.SASLPlain=function(){},I.SASLPlain.prototype=new I.SASLMechanism("PLAIN",!0,50),I.SASLPlain.prototype.test=function(e){return null!==e.authcid},I.SASLPlain.prototype.onChallenge=function(e){var t=e.authzid;return t+="\0",t+=e.authcid,t+="\0",t+=e.pass,T(t)},I.SASLSHA1=function(){},I.SASLSHA1.prototype=new I.SASLMechanism("SCRAM-SHA-1",!0,70),I.SASLSHA1.prototype.test=function(e){return null!==e.authcid},I.SASLSHA1.prototype.onChallenge=function(e,t,n){var i=n||h.hexdigest(""+1234567890*Math.random()),r="n="+T(e.authcid);return r+=",r=",r+=i,e._sasl_data.cnonce=i,e._sasl_data["client-first-message-bare"]=r,r="n,,"+r,this.onChallenge=function(e,t){for(var n,i,r,s,o,a,c,d,u="c=biws,",l="".concat(e._sasl_data["client-first-message-bare"],",").concat(t,","),h=e._sasl_data.cnonce,p=/([a-z]+)=([^,]+)(,|$)/;t.match(p);){var m=t.match(p);switch(t=t.replace(m[0],""),m[1]){case"r":n=m[2];break;case"s":i=m[2];break;case"i":r=m[2]}}if(n.substr(0,h.length)!==h)return e._sasl_data={},e._sasl_failure_cb();l+=u+="r="+n,i=atob(i),i+="\0\0\0";var f=T(e.pass);for(s=a=b.core_hmac_sha1(f,i),c=1;c<r;c++){for(o=b.core_hmac_sha1(f,b.binb2str(a)),d=0;d<5;d++)s[d]^=o[d];a=o}s=b.binb2str(s);var g=b.core_hmac_sha1(s,"Client Key"),_=b.str_hmac_sha1(s,"Server Key"),v=b.core_hmac_sha1(b.str_sha1(b.binb2str(g)),l);for(e._sasl_data["server-signature"]=b.b64_hmac_sha1(_,l),d=0;d<5;d++)g[d]^=v[d];return u+=",p="+btoa(b.binb2str(g))},r},I.SASLMD5=function(){},I.SASLMD5.prototype=new I.SASLMechanism("DIGEST-MD5",!1,60),I.SASLMD5.prototype.test=function(e){return null!==e.authcid},I.SASLMD5.prototype._quote=function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'},I.SASLMD5.prototype.onChallenge=function(e,t,n){for(var i=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/,r=n||h.hexdigest(""+1234567890*Math.random()),s="",o=null,a="";t.match(i);){var c=t.match(i);switch(t=t.replace(c[0],""),c[2]=c[2].replace(/^"(.+)"$/,"$1"),c[1]){case"realm":s=c[2];break;case"nonce":a=c[2];break;case"qop":c[2];break;case"host":o=c[2]}}var d=e.servtype+"/"+e.domain;null!==o&&(d=d+"/"+o);var u=T(e.authcid+":"+s+":"+this._connection.pass),l=h.hash(u)+":"+a+":"+r,p="AUTHENTICATE:"+d,m="";return m+="charset=utf-8,",m+="username="+this._quote(T(e.authcid))+",",m+="realm="+this._quote(s)+",",m+="nonce="+this._quote(a)+",",m+="nc=00000001,",m+="cnonce="+this._quote(r)+",",m+="digest-uri="+this._quote(d)+",",m+="response="+h.hexdigest(h.hexdigest(l)+":"+a+":00000001:"+r+":auth:"+h.hexdigest(p))+",",m+="qop=auth",this.onChallenge=function(){return""},m},I.SASLOAuthBearer=function(){},I.SASLOAuthBearer.prototype=new I.SASLMechanism("OAUTHBEARER",!0,40),I.SASLOAuthBearer.prototype.test=function(e){return null!==e.pass},I.SASLOAuthBearer.prototype.onChallenge=function(e){var t="n,";return null!==e.authcid&&(t=t+"a="+e.authzid),t+=",",t+="",t+="auth=Bearer ",t+=e.pass,t+="",T(t+="")},I.SASLExternal=function(){},I.SASLExternal.prototype=new I.SASLMechanism("EXTERNAL",!0,10),I.SASLExternal.prototype.onChallenge=function(e){return e.authcid===e.authzid?"":e.authzid},I.SASLXOAuth2=function(){},I.SASLXOAuth2.prototype=new I.SASLMechanism("X-OAUTH2",!0,30),I.SASLXOAuth2.prototype.test=function(e){return null!==e.pass},I.SASLXOAuth2.prototype.onChallenge=function(e){var t="\0";return null!==e.authcid&&(t+=e.authzid),t+="\0",t+=e.pass,T(t)};var P={Strophe:I,$build:R,$iq:A,$msg:function(e){return new I.Builder("message",e)},$pres:w,SHA1:b,MD5:h,b64_hmac_sha1:b.b64_hmac_sha1,b64_sha1:b.b64_sha1,str_hmac_sha1:b.str_hmac_sha1,str_sha1:b.str_sha1},O=P.Strophe,D=P.$build;O.Request=function(e,t,n,i){this.id=++O._requestId,this.xmlData=e,this.data=O.serialize(e),this.origFunc=t,this.func=t,this.rid=n,this.date=NaN,this.sends=i||0,this.abort=!1,this.dead=null,this.age=function(){return this.date?(new Date-this.date)/1e3:0},this.timeDead=function(){return this.dead?(new Date-this.dead)/1e3:0},this.xhr=this._newXHR()},O.Request.prototype={getResponse:function(){var e=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){if("parsererror"===(e=this.xhr.responseXML.documentElement).tagName)throw O.error("invalid response received"),O.error("responseText: "+this.xhr.responseText),O.error("responseXML: "+O.serialize(this.xhr.responseXML)),new Error("parsererror")}else if(this.xhr.responseText){if(O.debug("Got responseText but no responseXML; attempting to parse it with DOMParser..."),!(e=(new DOMParser).parseFromString(this.xhr.responseText,"application/xml").documentElement))throw new Error("Parsing produced null node");if(e.querySelector("parsererror")){O.error("invalid response received: "+e.querySelector("parsererror").textContent),O.error("responseText: "+this.xhr.responseText);var t=new Error;throw t.name=O.ErrorCondition.BAD_FORMAT,t}}return e},_newXHR:function(){var e=null;return window.XMLHttpRequest?(e=new XMLHttpRequest).overrideMimeType&&e.overrideMimeType("text/xml; charset=utf-8"):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP")),e.onreadystatechange=this.func.bind(null,this),e}},O.Bosh=function(e){this._conn=e,this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.hold=1,this.wait=60,this.window=5,this.errors=0,this.inactivity=null,this.lastResponseHeaders=null,this._requests=[]},O.Bosh.prototype={strip:null,_buildBody:function(){var e=D("body",{rid:this.rid++,xmlns:O.NS.HTTPBIND});return null!==this.sid&&e.attrs({sid:this.sid}),this._conn.options.keepalive&&this._conn._sessionCachingSupported()&&this._cacheSession(),e},_reset:function(){this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.errors=0,this._conn._sessionCachingSupported()&&window.sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)},_connect:function(e,t,n){this.wait=e||this.wait,this.hold=t||this.hold,this.errors=0;var i=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":O.NS.BOSH});n&&i.attrs({route:n});var r=this._conn._connect_cb;this._requests.push(new O.Request(i.tree(),this._onRequestStateChange.bind(this,r.bind(this._conn)),i.tree().getAttribute("rid"))),this._throttledRequestHandler()},_attach:function(e,t,n,i,r,s,o){this._conn.jid=e,this.sid=t,this.rid=n,this._conn.connect_callback=i,this._conn.domain=O.getDomainFromJid(this._conn.jid),this._conn.aut