//>>built
define("dojox/html/format",["dojo/_base/kernel","./entities","dojo/_base/array","dojo/_base/window","dojo/_base/sniff"],function(h,E,K,L,F){var G=h.getObject("dojox.html.format",!0);G.prettyPrint=function(M,r,v,H,N){var g=[],n=0,A=[],t="\t",k="",I=[],B,O=/[=]([^"']+?)(\s|>)/g,P=/style=("[^"]*"|'[^']*'|\S*)/gi,Q=/[\w-]+=("[^"]*"|'[^']*'|\S*)/gi;if(r&&0<r&&10>r)for(t="",B=0;B<r;B++)t+=" ";r=L.doc.createElement("div");r.innerHTML=M;var R=E.encode,S=E.decode,C=r.ownerDocument.createElement("div"),T=function(a){a=
a.cloneNode(!1);C.appendChild(a);a=C.innerHTML;C.innerHTML="";return a},w=function(){var a;for(a=0;a<n;a++)g.push(t)},x=function(){g.push("\n")},y=function(a){var c;a=a.split("\n");for(c=0;c<a.length;c++)a[c]=h.trim(a[c]);a=a.join(" ");a=h.trim(a);if(""!==a){var l=[];if(v&&0<v){var d="";for(c=0;c<n;c++)d+=t;c=d.length;d=v;for(v>c&&(d-=c);a;)if(a.length>v){for(c=d;0<c&&" "!==a.charAt(c);c--);if(!c)for(c=d;c<a.length&&" "!==a.charAt(c);c++);var b=a.substring(0,c);b=h.trim(b);a=h.trim(a.substring(c==
a.length?a.length:c+1,a.length));if(b){var f="";for(c=0;c<n;c++)f+=t;b=f+b+"\n"}l.push(b)}else{f="";for(c=0;c<n;c++)f+=t;a=f+a+"\n";l.push(a);a=null}return l.join("")}f="";for(c=0;c<n;c++)f+=t;return a=f+a+"\n"}return""},U=function(a){var c=a.nodeName.toLowerCase(),l=h.trim(T(a));a=l.substring(0,l.indexOf("\x3e")+1);a=a.replace(O,'\x3d"$1"$2');a=a.replace(P,function(b){var f=b.substring(0,6);b=b.substring(6,b.length);var p=b.charAt(0);b=h.trim(b.substring(1,b.length-1));b=b.split(";");var q=[];K.forEach(b,
function(m){if(m=h.trim(m))m=m.substring(0,m.indexOf(":")).toLowerCase()+m.substring(m.indexOf(":"),m.length),q.push(m)});q=q.sort();b=q.join("; ");var e=h.trim(b);return e&&";"!==e?f+p+(b+";")+p:""});var d=[];a=a.replace(Q,function(b){d.push(h.trim(b));return""});d=d.sort();a="\x3c"+c;d.length&&(a+=" "+d.join(" "));-1!=l.indexOf("\x3c/")?(A.push(c),a+="\x3e"):(a=N?a+" /\x3e":a+"\x3e",A.push(!1));a:switch(c){case "a":case "b":case "strong":case "s":case "strike":case "i":case "u":case "em":case "sup":case "sub":case "span":case "font":case "big":case "cite":case "q":case "small":c=
!0;break a;default:c=!1}I.push(c);k&&!c&&(g.push(y(k)),k="");c?k+=a:(w(),g.push(a),x(),n++)},J=function(a){var c=a.childNodes;if(c){var l;for(l=0;l<c.length;l++){var d=c[l];if(1===d.nodeType){var b=h.trim(d.tagName.toLowerCase());if(!F("ie")||d.parentNode==a)if(!b||"/"!==b.charAt(0)){U(d);if("script"===b){b=g;var f=b.push,p=void 0,q=p=void 0,e=void 0;if(e=d.innerHTML){e&&(e=e.replace(/&quot;/gi,'"'),e=e.replace(/&gt;/gi,"\x3e"),e=e.replace(/&lt;/gi,"\x3c"),e=e.replace(/&amp;/gi,"\x26"));d=0;var m=
e.split("\n"),D=[];for(e=0;e<m.length;e++){var u=m[e],z=-1<u.indexOf("\n");if(u=h.trim(u)){z=d;for(p=0;p<u.length;p++)q=u.charAt(p),"{"===q?d++:"}"===q&&(d--,z=d);p="";for(q=0;q<n+z;q++)p+=t;D.push(p+u+"\n")}else z&&0===e&&D.push("\n")}e=D.join("")}f.call(b,e)}else"pre"===b?(b=d.innerHTML,F("mozilla")&&(b=b.replace("\x3cbr\x3e","\n"),b=b.replace("\x3cpre\x3e",""),b=b.replace("\x3c/pre\x3e","")),"\n"!==b.charAt(b.length-1)&&(b+="\n"),g.push(b)):J(d);b=I.pop();k&&!b&&(g.push(y(k)),k="");(f=A.pop())?
(f="\x3c/"+f+"\x3e",b?k+=f:(n--,w(),g.push(f),x())):n--}}else 3===d.nodeType||4===d.nodeType?k+=R(d.nodeValue,H):8===d.nodeType&&(b=S(d.nodeValue,H),w(),g.push("\x3c!--"),x(),n++,g.push(y(b)),n--,w(),g.push("--\x3e"),x())}}};J(r);k&&(g.push(y(k)),k="");return g.join("")};return G});