//>>built
define("dojox/xmpp/util",["dijit","dojo","dojox","dojo/require!dojox/string/Builder,dojox/encoding/base64"],function(h,g,d){g.provide("dojox.xmpp.util");g.require("dojox.string.Builder");g.require("dojox.encoding.base64");d.xmpp.util.xmlEncode=function(a){return g.string.escape(a)};d.xmpp.util.encodeJid=function(a){for(var b=new d.string.Builder,f=0;f<a.length;f++){var e=a.charAt(f),c=e;switch(e){case " ":c="\\20";break;case '"':c="\\22";break;case "#":c="\\23";break;case "\x26":c="\\26";break;case "'":c=
"\\27";break;case "/":c="\\2f";break;case ":":c="\\3a";break;case "\x3c":c="\\3c";break;case "\x3e":c="\\3e"}b.append(c)}return b.toString()};d.xmpp.util.decodeJid=function(a){return a=a.replace(/\\([23][02367acef])/g,function(b){switch(b){case "\\20":return" ";case "\\22":return'"';case "\\23":return"#";case "\\26":return"\x26";case "\\27":return"'";case "\\2f":return"/";case "\\3a":return":";case "\\3c":return"\x3c";case "\\3e":return"\x3e"}return"ARG"})};d.xmpp.util.createElement=function(a,b,
f){var e=new d.string.Builder("\x3c");e.append(a+" ");for(var c in b)e.append(c+'\x3d"'),e.append(b[c]),e.append('" ');f?e.append("/\x3e"):e.append("\x3e");return e.toString()};d.xmpp.util.stripHtml=function(a){for(var b=0;b<arguments.length;b++);return a.replace(/<[^>]*?>/gi,"")};d.xmpp.util.decodeHtmlEntities=function(a){var b=g.doc.createElement("textarea");b.innerHTML=a.replace(/</g,"\x26lt;").replace(/>/g,"\x26gt;");return b.value};d.xmpp.util.htmlToPlain=function(a){a=d.xmpp.util.decodeHtmlEntities(a);
a=a.replace(/<br\s*[i\/]{0,1}>/gi,"\n");return a=d.xmpp.util.stripHtml(a)};d.xmpp.util.Base64={};d.xmpp.util.Base64.encode=function(a){for(var b=d.encoding.base64,f=b.encode,e=[],c=0;c<a.length;++c)e.push(a.charCodeAt(c));return f.call(b,e)};d.xmpp.util.Base64.decode=function(a){return function(b){var f=[];g.forEach(b,function(e){f.push(String.fromCharCode(e))});return f.join("")}(d.encoding.base64.decode(a))}});