/*
Created by Austin Cheney originally on 3 Mar 2009.
This code may not be used or redistributed unless the following
conditions are met:

* The use of difflib.js, diffview.js, and prettydiff.js must contain the
following copyright:
   Copyright (c) 2007, Snowtide Informatics Systems, Inc.
   All rights reserved.

   * Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the
     distribution.
   * Neither the name of the Snowtide Informatics Systems nor the names
     of its contributors may be used to endorse or promote products
     derived from this software without specific prior written
     permission.

   - used as diffview function and difflib function
      <http://mailmarkup.org/prettydiff/difflib.js>
      <http://mailmarkup.org/prettydiff/diffview.js>

* The author of the fulljsmin.js and date of creation must be stated as:
   Franck Marcia - 31 Aug 2006

   - used as jsmin function:
      <http://mailmarkup.org/prettydiff/fulljsmin.js>

* The fulljsmin.js is used with permission from the author of jsminc.c
and such must be stated as:
   Copyright (c) 2002 Douglas Crockford  (www.crockford.com)

* The author of js-beautify.js must be stated as:
   Written by Einars Lielmanis, <einars@gmail.com>
   http://elfz.laacz.lv/beautify/
 
   Originally converted to javascript by Vital, <vital76@gmail.com>
   http://my.opera.com/Vital/blog/2007/11/21/
      javascript-beautify-on-javascript-translated

   - used as js_beautify function
      <http://mailmarkup.org/prettydiff/js-beautify.js>

* cleanCSS.js is originally written by Anthony Lieuallen
    http://tools.arantius.com/tabifier

   - used as cleanCSS function
      <http://mailmarkup.org/prettydiff/cleanCSS.js>

* charcomp.js is written by Austin Cheney.  Use of this function
   requires that credit be given to Austin Cheney.
   http://mailmarkup.org/

   - used as charcomp function
      <http://mailmarkup.org/prettydiff/charcomp.js>

* charDecoder.js is written by Austin Cheney.  Use of this function
   requires that credit be given to Austin Cheney.
   http://mailmarkup.org/

   - used as charDecoder function
      <http://mailmarkup.org/prettydiff/charDecoder.js>

* csvbeauty.js is written by Austin Cheney.  Use of this function
   requires that credit be given to Austin Cheney.
   http://mailmarkup.org/

   - used as csvbeauty function
      <http://mailmarkup.org/prettydiff/csvbeauty.js>

* csvmin.js is written by Austin Cheney.  Use of this function requires
   that credit be given to Austin Cheney.
   http://mailmarkup.org/

   - used as csvmin function
      <http://mailmarkup.org/prettydiff/csvmin.js>

* markupmin.js is written by Austin Cheney.  Use of this function
   requires that credit be given to Austin Cheney.
   http://mailmarkup.org/

   - used as markupmin function
      <http://mailmarkup.org/prettydiff/markupmin.js>

* markup_beauty.js is written by Austin Cheney.  Use of this function
   requires that credit be given to Austin Cheney.
   http://mailmarkup.org/

   - used as markup-beauty function
      <http://mailmarkup.org/prettydiff/markup_beauty.js>

* $ function is written by Dustin Diaz.
   http://www.dustindiaz.com/

------------------------------------------------------------------------
* The code mentioned above has significantly expanded documentation in
each of the respective function's external JS file as linked from the
documentation page:
   <http://mailmarkup.org/prettydiff/documentation.html>

* The compilation of cssClean, csvbeauty, csvmin, jsmin, jsdifflib,
markup_beauty, markupmin, and js-beautify in this manner is a result of
the prettydiff() function contained in prettydiff.js.  The per character
highlighting is the result of the charcomp() and its linediff() function
also contained in prettydiff.js. Any use or redistribution of these
functions must mention the following:
   Prettydiff created by Austin Cheney originally on 3 Mar 2009.
   <http://mailmarkup.org/>

   Contact the author at:
   cheney@mailmarkup.org

* In addition to the previously stated requirements any use of any
component, aside from directly using the full files in their entirety,
must restate the license mentioned at the top of each concerned file.


If each and all these conditions are met use and redistribution of
prettydiff and its required assets is unlimited without author
permission.

Special thanks to Kiran Makam for providing the IE acceptable solution
of accessing a class attribute via the DOM.
*/
"use strict";String.prototype.has=function(c){return this.indexOf(c)>-1;};var $=function(){var i,element,elements=[];for(i=0;i<arguments.length;i+=1){element=arguments[i];if(typeof(element)==='string'){element=document.getElementById(element);}if(arguments.length===1){return element;}elements.push(element);}return elements;},prettydiff=function(){var startTime=(function(){var d=new Date(),t=d.getTime();return t;}()),css_summary,js_summary,markup_summary,diffdiv=$('diffoutput'),url=location.href.toString().split("#")[0],bt=$('baseText'),nt=$('newText'),bo=$('bo'),no=$('no'),bl=$('baselabel'),nl=$('newlabel'),side=$('sidebyside'),inline=$('inline'),javascript=$('ctype-javascript'),css=$('ctype-css'),csv=$('ctype-csv'),markup=$('ctype-markup'),ptext=$('ctype-text'),insb=$('inscript-yes'),insd=$('inscriptd-yes'),mb=$('modebeautify'),mm=$('modeminify'),md=$('modediff'),bi=$('beautyinput'),bd=$('beautyoutput'),mi=$('minifyinput'),mo=$('minifyoutput'),is=$('minifyinputsize'),ws=$('minifywinsize'),os=$('minifyoutputsize'),xs=$('minifywinratiosize'),rs=$('minifyratiosize'),ii=$('minifyinputlines'),ud=$('minifyunixdiff'),wd=$('minifywindiff'),sm=$('min-tolerate-slop'),sd=$('dif-tolerate-slop'),bv=$('beau-char'),bw=$('beau-other'),bs=$('beau-space'),ba=$('beau-tab'),bz=$('beau-line'),by=$('beau-quan'),bc=($('incomment-no').checked)?'noindent':'indent',dv=$('diff-char'),dw=$('diff-other'),ds=$('diff-space'),da=$('diff-tab'),dz=$('diff-line'),dy=$('diff-quan'),ps=$('diff-save'),ht=($('html-yes').checked)?true:false,htd=($('htmld-yes').checked)?"true":"false",csvchar=($('csvchar').value==='')?',':$('csvchar').value,mslop=(mm.checked&&sm.checked)?'slop':'clean',dslop=(md.checked&&sd.checked)?'slop':'clean',ins=((mb.checked&&insb.checked)||(md.checked&&insd.checked))?true:false,bn,nn,zs,zc,err="Please paste code into this textarea.",err1="Please paste code into the textarea above or to the left of me.",spacetest=new RegExp(/^\s+$/g),savewindow,whitespace={" ":true,"\t":true,"\n":true,"\f":true,"\r":true},errorcount=function(){if(!md.checked){return"";}var a,b=0,c="s",tdtag=diffdiv.getElementsByTagName('td'),trtag=diffdiv.getElementsByTagName('tr');for(a=0;a<tdtag.length;a+=1){if(tdtag[a].getElementsByTagName('em').length===0&&(tdtag[a].className==="insert"||tdtag[a].className==="delete"||tdtag[a].className==="replace")){b+=1;}else if(tdtag[a].getElementsByTagName('em').length>0&&tdtag[a].className==="delete"){b+=tdtag[a].getElementsByTagName('em').length;}}for(a=0;a<trtag.length;a+=1){if(trtag[a].getElementsByTagName('td')[0]&&trtag[a].getElementsByTagName('td')[1]&&trtag[a].getElementsByTagName('td')[0].className==="replace"&&trtag[a].getElementsByTagName('td')[1].className==="replace"){b+=trtag[a].getElementsByTagName('td')[1].getElementsByTagName('em').length;}}if(b===1){c="";}return"<p><strong>Number of differences:</strong> <em>"+b+"</em> difference"+c+"</p>";},proctime=function(){var d="",e="",g=new Date(),b=((g.getTime()-startTime)/ 1000).toPrecision(3),plural=function(x,y){if(x>1){x=x+y+"s ";}else{x=x+y+" ";}return x;},minute=function(){d=(b / 60).toFixed(1);d=Number(d.toString().split(".")[0]);b=(b-(d*60)).toFixed(3);d=plural(d," minute");};if(b>=60&&b<3600){minute();}else if(b>=3600){e=(b / 3600).toFixed(1);e=Number(e.toString().split(".")[0]);b=b-(e*3600);e=plural(e," hour");minute();}diffdiv.style.display="block";diffdiv.innerHTML="<h2>Summary</h2><p><strong>Execution time:</strong> <em>"+e+d+b+"</em> seconds</p>"+errorcount()+diffdiv.innerHTML;},charDecoder=function(input){var b,d,a=0,c=input,x=[],y=[],uni=new RegExp(/u\+[0-9a-f]{4,5}\+/),unit=new RegExp(/u\![0-9a-f]{4,5}\+/),htmln=new RegExp(/\&\#[0-9]{1,6}\;/),htmlt=new RegExp(/\&\![0-9]{1,6}\;/);if(c.search(unit)===-1&&c.search(uni)===-1&&c.search(htmlt)===-1&&c.search(htmln)===-1){return input;}for(b=a;b<input.length;b+=1){if(c.search(htmln)===-1||(c.search(uni)<c.search(htmln)&&c.search(uni)!==-1)){d=c.search(uni);y.push(d+"|h");for(a=d;a<c.length;a+=1){if(c[a]==="+"&&c[a-1]==="u"){c=c.split("");c.splice(a,1,"!");c=c.join("");}if(c[a]==="+"&&c[a-1]!=="u"){a+=1;break;}}x.push(c.slice(d+2,a-1));c=c.replace(unit,'');}else if(c.search(uni)===-1||(c.search(htmln)<c.search(uni)&&c.search(htmln)!==-1)){d=c.search(htmln);y.push(d+"|d");for(a=d;a<c.length;a+=1){if(c[a]==="#"){c=c.split("");c.splice(a,1,"!");c=c.join("");}if(c[a]===";"){a+=1;break;}}x.push(c.slice(d+2,a-1));c=c.replace(htmlt,'');}if(c.search(uni)===-1&&c.search(htmln)===-1){break;}}c=c.replace(/u\![0-9a-f]{4,5}\+/g,"").replace(/\&\![0-9]{1,6}\;/g,"").split("");for(b=0;b<x.length;b+=1){y[b]=y[b].split("|");if(y[b][1]==="h"){x[b]=parseInt(x[b],16);}bo.innerHTML="&#"+parseInt(x[b],10)+";";x[b]=bo.innerHTML;c.splice(y[b][0],0,x[b]);}return c.join("");},csvbeauty=function(source,ch){if(ch===""){ch=",";}else{ch=charDecoder(ch);}var err,a=0,c=[],error="Error: Unterminated String begging at character number ",str=(function(){var b,src;do{source=source.replace(ch,"{csvcomma}");}while(source.indexOf(ch)!==-1);source=source.replace(/"{2}/g,"{csvquote}");src=source;source=source.split("");for(;a<source.length;a+=1){if(source[a]==="\""){for(b=a+1;b<source.length;b+=1){if(source[b]==="\""){c.push(src.slice(a,b+1));source[a]="{csvstring}";source[b]="";a=b+1;break;}source[b]="";}if(b===source.length){err=source.join("").slice(a,a+9);source=error;return;}}}source=source.join("").replace(/\{csvquote\}/g,"\"\"");}());if(source===error){if(a!==source.length-1){return source+a+", '"+err+"'.";}else{return source+a+".";}}source=source.replace(/\n/g,"\n\n");if(source.charAt(source.length-ch.length)===ch){source=source.slice(0,source.length+1-ch.length)+"{|}";}source=source.replace(/\{csvcomma\}/g,",");do{source=source.replace(ch,"\n");}while(source.indexOf(ch)!==-1);for(a=0;a<c.length;a+=1){c[a]=c[a].replace(/\n/g,"{ }");source=source.replace("{csvstring}",c[a]);}source=source.replace(/\{csvcomma\}/g,",").replace(/\{csvquote\}/g,"\"");return source;},csvmin=function(source,ch){var a,b,c,err,d="",error="Error: Unterminated String begging at character number ",src=function(){for(a=0;a<source.length;a+=1){c=[];if(source[a].indexOf("\"")!==-1){source[a]=source[a].split("");for(b=0;b<source[a].length;b+=1){if(source[a][b]==="\""){c.push(b);}}if(c.length===1){d=error;source[a]=source[a].join("");err=source[a].slice(c[0],c[0]+9);return;}else if(c.length>2){for(d=1;d<c.length-1;d+=1){source[a][c[d]]="\"\"";}}source[a]=source[a].join("");}}};if(ch===""){ch=",";}else{ch=charDecoder(ch);}source=source.split("\n");src();if(d===error){return error+(source.join(ch).indexOf(source[a])+c[0])+" or value number "+(a+1)+", '"+err+"'.";}source=source.join(ch).replace("\n{|}","{|}").replace(/\n/g,ch);do{source=source.replace("{ }","\n");}while(source.indexOf("{ }")!==-1);source=source.replace(/\n{2}/g,"\n");if(source.indexOf("{|}")===source.length-3){source=source.slice(0,source.length-3)+ch;}do{source=source.replace(ch+""+ch,"\n");}while(source.indexOf(ch+""+ch)!==-1);return source;},difflib={defaultJunkFunction:function(c){return c in whitespace;},stripLinebreaks:function(str){return str.replace(/^[\n\r]*|[\n\r]*$/g,"");},stringAsLines:function(str){var i,lfpos=str.indexOf("\n"),crpos=str.indexOf("\r"),linebreak=((lfpos>-1&&crpos>-1)||crpos<0)?"\n":"\r",lines=str.split(linebreak);for(i=0;i<lines.length;i+=1){lines[i]=difflib.stripLinebreaks(lines[i]);}return lines;},reduce:function(func,list,initial){var value,idx;if(initial!==null){value=initial;idx=0;}else if(list){value=list[0];idx=1;}else{return null;}for(;idx<list.length;idx+=1){value=func(value,list[idx]);}return value;},ntuplecomp:function(a,b){var i,mlen=Math.max(a.length,b.length);for(i=0;i<mlen;i+=1){if(a[i]<b[i]){return-1;}if(a[i]>b[i]){return 1;}}return a.length===b.length?0:(a.length<b.length?-1:1);},calculate_ratio:function(matches,length){return length?2.0*matches / length:1.0;},isindict:function(dict){return function(key){return key in dict;};},dictget:function(dict,key,defaultValue){return key in dict?dict[key]:defaultValue;},SequenceMatcher:function(a,b,isjunk){this.set_seqs=function(a,b){this.set_seq1(a);this.set_seq2(b);};this.set_seq1=function(a){if(a===this.a){return;}this.a=a;this.opcodes=null;this.matching_blocks=this.opcodes;};this.set_seq2=function(b){if(b===this.b){return;}this.b=b;this.fullbcount=null;this.opcodes=this.fullbcount;this.matching_blocks=this.opcodes;this.chain_b();};this.chain_b=function(){var i,elt,indices,b=this.b,n=b.length,b2j=this.b2j={},populardict={},isjunk=this.isjunk,junkdict={};for(i=0;i<b.length;i+=1){elt=b[i];if(elt in b2j){indices=b2j[elt];if(n>=200&&indices.length*100>n){populardict[elt]=1;delete b2j[elt];}else{indices.push(i);}}else{b2j[elt]=[i];}}for(elt in populardict){if(populardict.hasOwnProperty(elt)){delete b2j[elt];}}if(isjunk){for(elt in populardict){if(isjunk(elt)){junkdict[elt]=1;delete populardict[elt];}}for(elt in b2j){if(isjunk(elt)){junkdict[elt]=1;delete b2j[elt];}}}this.isbjunk=difflib.isindict(junkdict);this.isbpopular=difflib.isindict(populardict);};this.find_longest_match=function(alo,ahi,blo,bhi){var i,newj2len,jdict,jkey,k,a=this.a,b=this.b,b2j=this.b2j,isbjunk=this.isbjunk,besti=alo,bestj=blo,bestsize=0,j=null,j2len={},nothing=[];for(i=alo;i<ahi;i+=1){newj2len={};jdict=difflib.dictget(b2j,a[i],nothing);for(jkey in jdict){if(jdict.hasOwnProperty(jkey)){j=jdict[jkey];if(j>=blo){if(j>=bhi){break;}k=difflib.dictget(j2len,j-1,0)+1;newj2len[j]=k;if(k>bestsize){besti=i-k+1;bestj=j-k+1;bestsize=k;}}}}j2len=newj2len;}while(besti>alo&&bestj>blo&&!isbjunk(b[bestj-1])&&a[besti-1]===b[bestj-1]){besti-=1;bestj-=1;bestsize+=1;}while(besti+bestsize<ahi&&bestj+bestsize<bhi&&!isbjunk(b[bestj+bestsize])&&a[besti+bestsize]===b[bestj+bestsize]){bestsize+=1;}while(besti>alo&&bestj>blo&&isbjunk(b[bestj-1])&&a[besti-1]===b[bestj-1]){besti-=1;bestj-=1;bestsize+=1;}while(besti+bestsize<ahi&&bestj+bestsize<bhi&&isbjunk(b[bestj+bestsize])&&a[besti+bestsize]===b[bestj+bestsize]){bestsize+=1;}return[besti,bestj,bestsize];};this.get_matching_blocks=function(){if(this.matching_blocks!==null){return this.matching_blocks;}var idx,alo,ahi,blo,bhi,qi,i,j,k,x,i2,j2,k2,la=this.a.length,lb=this.b.length,queue=[[0,la,0,lb]],matching_blocks=[],block=0,k1=block,j1=k1,i1=j1,non_adjacent=[];while(queue.length){qi=queue.pop();alo=qi[0];ahi=qi[1];blo=qi[2];bhi=qi[3];x=this.find_longest_match(alo,ahi,blo,bhi);i=x[0];j=x[1];k=x[2];if(k){matching_blocks.push(x);if(alo<i&&blo<j){queue.push([alo,i,blo,j]);}if(i+k<ahi&&j+k<bhi){queue.push([i+k,ahi,j+k,bhi]);}}}matching_blocks.sort(difflib.ntuplecomp);for(idx in matching_blocks){if(matching_blocks.hasOwnProperty(idx)){block=matching_blocks[idx];i2=block[0];j2=block[1];k2=block[2];if(i1+k1===i2&&j1+k1===j2){k1+=k2;}else{if(k1){non_adjacent.push([i1,j1,k1]);}i1=i2;j1=j2;k1=k2;}}}if(k1){non_adjacent.push([i1,j1,k1]);}non_adjacent.push([la,lb,0]);this.matching_blocks=non_adjacent;return this.matching_blocks;};this.get_opcodes=function(){if(this.opcodes!==null){return this.opcodes;}var idx,block,ai,bj,size,tag,blocks=this.get_matching_blocks(),i=0,j=0,answer=[];this.opcodes=answer;for(idx in blocks){if(blocks.hasOwnProperty(idx)){block=blocks[idx];ai=block[0];bj=block[1];size=block[2];tag='';if(i<ai&&j<bj){tag='replace';}else if(i<ai){tag='delete';}else if(j<bj){tag='insert';}if(tag){answer.push([tag,i,ai,j,bj]);}i=ai+size;j=bj+size;if(size){answer.push(['equal',ai,i,bj,j]);}}}return answer;};this.get_grouped_opcodes=function(n){var idx,nn,code,tag,i1,i2,j1,j2,groups=[],codes=this.get_opcodes();if(!n){n=3;}if(!codes){codes=[["equal",0,1,0,1]];}if(codes[0][0]==='equal'){code=codes[0];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];codes[0]=[tag,Math.max(i1,i2-n),i2,Math.max(j1,j2-n),j2];}if(codes[codes.length-1][0]==='equal'){code=codes[codes.length-1];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];codes[codes.length-1]=[tag,i1,Math.min(i2,i1+n),j1,Math.min(j2,j1+n)];}nn=n+n;for(idx in codes){if(codes.hasOwnProperty(idx)){code=codes[idx];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];if(tag==='equal'&&i2-i1>nn){groups.push([tag,i1,Math.min(i2,i1+n),j1,Math.min(j2,j1+n)]);i1=Math.max(i1,i2-n);j1=Math.max(j1,j2-n);}groups.push([tag,i1,i2,j1,j2]);}}if(groups&&groups[groups.length-1][0]==='equal'){groups.pop();}return groups;};this.ratio=function(){var m=difflib.reduce(function(sum,triple){return sum+triple[triple.length-1];},this.get_matching_blocks(),0);return difflib.calculate_ratio(m,this.a.length+this.b.length);};this.quick_ratio=function(){var i,elt,fullbcount,avail={},availhas=difflib.isindict(avail),numb=0,matchex=numb;if(this.fullbcount===null){fullbcount={};this.fullbcount=fullbcount;for(i=0;i<this.b.length;i+=1){elt=this.b[i];fullbcount[elt]=difflib.dictget(fullbcount,elt,0)+1;}}fullbcount=this.fullbcount;for(i=0;i<this.a.length;i+=1){elt=this.a[i];if(availhas(elt)){numb=avail[elt];}else{numb=difflib.dictget(fullbcount,elt,0);}avail[elt]=numb-1;if(numb>0){matchex+=1;}}return difflib.calculate_ratio(matchex,this.a.length+this.b.length);};this.real_quick_ratio=function(){var la=this.a.length,lb=this.b.length;return difflib.calculate_ratio(Math.min(la,lb),la+lb);};this.isjunk=isjunk?isjunk:difflib.defaultJunkFunction;this.b=null;this.a=this.b;this.set_seqs(a,b);}},diffview={buildView:function(params){var baseTextLines=params.baseTextLines,newTextLines=params.newTextLines,opcodes=params.opcodes,baseTextName=params.baseTextName?params.baseTextName:"Base Text",newTextName=params.newTextName?params.newTextName:"New Text",contextSize=params.contextSize,inline=(params.viewType===0||params.viewType===1)?params.viewType:0,thead=["<table class='diff'><thead><tr><th></th>"],tbody=[],tfoot=["<tr><th class='author' colspan='"],tdata=[],header,node=[],sode=[],rows=[],idx,change,code,b,be,n,ne,rowcnt,i,jump,celt=function(name,clazz){var e=[];e[0]="<";e[1]=name;e[2]=" class='";e[3]=clazz;e[4]="'></";e[5]=name;e[6]=">";return e.join("");},telt=function(name,text){var e=[];text=text.replace(/\&/g,"&amp;");text=text.replace(/\>/g,"&gt;");text=text.replace(/</g,"&lt;");e[0]="<";e[1]=name;e[2]=">";e[3]=text;e[4]="</";e[5]=name;e[6]=">";return e.join("");},ctelt=function(name,clazz,text){var e=[];text=text.replace(/\&/g,"&amp;");text=text.replace(/\>/g,"&gt;");text=text.replace(/</g,"&lt;");e[0]="<";e[1]=name;e[2]=" class='";e[3]=clazz;e[4]="'>";e[5]=text;e[6]="</";e[7]=name;e[8]=">";return e.join("");},addCells=function(row,tidx,tend,textLines,change){if(tidx<tend){textLines[tidx]=textLines[tidx].replace(/\t/g,"\u00a0\u00a0\u00a0\u00a0");row.push(telt("th",(tidx+1).toString()));row.push(ctelt("td",change,textLines[tidx]));return tidx+1;}else{row.push("<th></th>");row.push(celt("td","empty"));return tidx;}},addCellsInline=function(row,tidx,tidx2,textLines,change){row.push(telt("th",tidx===null?"":(tidx+1).toString()));row.push(telt("th",tidx2===null?"":(tidx2+1).toString()));if(tidx===null){tidx=tidx2;}row.push(ctelt("td",change,textLines[tidx].replace(/\t/g,"\u00a0\u00a0\u00a0\u00a0")));};if(baseTextLines===null){return"Error: Cannot build diff view; baseTextLines is not defined.";}if(newTextLines===null){return"Error: Cannot build diff view; newTextLines is not defined.";}if(!opcodes){return"Error: Cannot build diff view; opcodes is not defined.";}if(inline){header=["<th></th>"];header.push(ctelt("th","texttitle",baseTextName+" vs. "+newTextName));}else{header=[ctelt("th","texttitle",baseTextName)];header.push("<th></th>");header.push(ctelt("th","texttitle",newTextName));}header.push("</tr></thead><tbody>");thead.push(header.join(""));if(inline){tfoot.push("3");}else{tfoot.push("4");}tfoot.push("'>Original diff view created as DOM objects by <a href='http://snowtide.com/jsdifflib'>jsdifflib</a>.  Diff view recreated as a JavaScript array by <a href='http://mailmarkup.org/'>Austin Cheney</a>.</th></tr></tbody></table>");for(idx=0;idx<opcodes.length;idx+=1){code=opcodes[idx];change=code[0];b=code[1];be=code[2];n=code[3];ne=code[4];rowcnt=Math.max(be-b,ne-n);sode=["<tr>"];sode.push(telt("th","..."));if(!inline){sode.push(ctelt("td","skip",""));}sode.push(telt("th","..."));sode.push(ctelt("td","skip",""));sode.push("</tr>");for(i=0;i<rowcnt;i+=1){if(contextSize&&opcodes.length>1&&((idx>0&&String(i)===contextSize)||(idx===0&&i===0))&&change==="equal"){jump=rowcnt-((idx===0?1:2)*contextSize);if(jump>1){node.push(sode.join(""));b+=jump;n+=jump;i+=jump-1;if(idx+1===opcodes.length){break;}}}if(inline){node.push("<tr>");if(change==="insert"){addCellsInline(node,null,n,newTextLines,change);node.push("</tr>");}else if(change==="replace"){if(b<be){addCellsInline(node,b,null,baseTextLines,"delete");node.push("</tr>");}if(b<be&&n<ne){node.push("<tr>");}if(n<ne){addCellsInline(node,null,n,newTextLines,"insert");node.push("</tr>");}}else if(change==="delete"){addCellsInline(node,b,null,baseTextLines,change);node.push("</tr>");}else if(b<be||n<ne){addCellsInline(node,b,n,baseTextLines,change);node.push("</tr>");}b+=1;n+=1;}else{node.push("<tr>");b=addCells(node,b,be,baseTextLines,change);n=addCells(node,n,ne,newTextLines,change);node.push("</tr>");}}}rows.push(node.join(""));tbody.push(rows.join(""));tdata=[thead.join(""),tbody.join(""),tfoot.join("")];return tdata.join("");}},jsmin=function(comment,input,level,type,slop){switch(type){case"css":if(new RegExp(/if\s*\(\s*[a-z0-9]+\s*((={2,3})|(\!={1,2}))\s*[a-z0-9]+\s*\)\s*\{/i).test(input)===true&&new RegExp(/var\s+[a-z]+[a-z0-9]*/i).test(input)===true){return"Error: Input appears to be JavaScript, but the application is set to minify CSS.";}else if(new RegExp(/>\s*<\/[a-z]+>/i).test(input)===true&&new RegExp(/[a-z]+[a-z0-9]*\s*\{\s*[a-z]+(\-[a-z]+)*\s*\:\s*[a-z]+(\-[a-z]+)*\s*;/i).test(input)===false){return"Error: Input appears to be markup, but the application is set to minify CSS.";}if(input!==undefined){input=input.replace(/http:\/\//g,"http:xx");}break;case"javascript":if(new RegExp(/>\s*<\/[a-z]+>/i).test(input)===true&&new RegExp(/document\.write/).test(input)===false&&new RegExp(/if\s*\(\s*[a-z0-9]+\s*((={2,3})|(\!={1,2}))\s*[a-z0-9]+\s*\)\s*\{/i).test(input)===false){return"Error: Input appears to be markup, but the application is set to minify JavaScript.";}else if(new RegExp(/[a-z]+[a-z0-9]*\s*\{\s*[a-z]+(\-[a-z]+)*\s*\:\s*[a-z]+(\-[a-z]+)*\s*;/i).test(input)===true&&new RegExp(/if\s*\(\s*[a-z0-9]+\s*((={2,3})|(\!={1,2}))\s*[a-z0-9]+\s*\)\s*\{/i).test(input)===false){return"Error: Input appears to be CSS, but the application is set to minify JavaScript.";}if(input!==undefined){input=input.replace(/\/\/(\s)*-->/g,"//-->");}break;default:return"Error: The type argument is not provided a value of either 'css' or 'javascript'.";}if(input===undefined){input=comment;comment='';level=2;}else if(level===undefined||level<1||level>3){level=2;}if(comment.length>0){comment+='\n';}var ret,error="",a='',b='',EOF=-1,LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',DIGITS='0123456789',OTHERS,ALNUM,theLookahead=EOF,isAlphanum=function(c){return c!==EOF&&(ALNUM.has(c)||c.charCodeAt(0)>126);},isValue=function(c){return c!==EOF&&(']"\')'.has(c));},get=function(){var c=theLookahead;if(get.i===get.l){return EOF;}theLookahead=EOF;if(c===EOF){c=input.charAt(get.i);get.i+=1;}if(c>=' '||c==='\n'){return c;}if(c==='\r'){return'\n';}return' ';},ifcorrect=function(x){var i,z,a,b,q,c=[],d=[],quotefinder=function(e,f){var g,h,j,m;if(e[0]<f[0]){for(g=0;g<e.length;g+=2){for(j=0;j<f.length;j+=1){if(e[g]<f[j]&&f[j]<e[g+1]){f.splice(j,1);}}}for(g=0;g<f;g+=2){for(j=0;j<e.length;j+=1){if(e[j]>f[g]&&e[j]<f[g+1]){e.splice(j,1);}}}}else{for(g=0;g<f;g+=2){for(j=0;j<e.length-1;j+=1){if(e[j]>f[g]&&e[j]<f[g+1]){e.splice(j,1);}}}for(g=0;g<e.length;g+=2){for(j=0;j<f.length;j+=1){if(f[j]>e[g]&&f[j]<e[g+1]){f.splice(j,1);}}}}if(e.length>=f.length){h=e.length;}else{h=f.length;}m=e.concat(f);for(g=0;g<m.length;g+=1){if(e[g]<f[g]){f.splice(g,0,e[g]);if(e[g+1]<f[g]){f.splice(g,0,e[g+1]);}}else{for(j=g;j<m.length;j+=1){if(e[g]<f[j]){f.splice(j,0,e[g]);break;}}}}return f;},quotetest=function(y){var e;for(e=0;e<q.length;e+=2){if(y>q[e]&&y<q[e+1]){return true;}}return false;},correction=function(){for(a=i;a<x.length;a+=1){if(x[a]===')'){break;}}if(x[a+1]===';'&&quotetest(a+1)===false){x[a+1]='';}};x=x.split('');for(z=0;z<x.length;z+=1){if(x[z]==="\""){c.push(z);}if(x[z]==='\''){d.push(z);}}q=quotefinder(c,d);for(i=0;i<x.length;i+=1){b=x[i]+x[i+1]+x[i+2]+x[i+3]+x[i+4]+x[i+5]+x[i+6]+x[i+7];if((b==='function'||b.slice(0,2)==='if'||b.slice(0,5)==='while'||b.slice(0,3)==='for')&&quotetest(i)===false){correction();}else if(((x[i]!=="+"&&x[i+1]==="+"&&x[i+2]===";")&&quotetest(i+2)===false)||((x[i]!=="-"&&x[i+1]==="-"&&x[i+2]===";")&&quotetest(i+2)===false)){x[i+2]="";}else if((((x[i]===";"||x[i]==='\n')&&x[i+1]==="+"&&x[i+2]!=="+")&&quotetest(i+2)===false)||((x[i]===";"&&x[i+1]==="-"&&x[i+2]!=="-")&&quotetest(i+2)===false)){x[i]="";}}if(x[0]===';'){x[0]='';}return x.join('');},peek=function(){theLookahead=get();return theLookahead;},next=function(){var c=get();if(c==='/'){switch(peek()){case'/':for(;;){c=get();if(c<='\n'){return c;}}break;case'*':get();for(;;){switch(get()){case"'":c=get().replace(/'/,'');break;case'"':c=get().replace(/"/,'');break;case'*':if(peek()==='/'){get();return' ';}break;case EOF:error='Error: Unterminated JavaScript comment.';return error;}}break;default:return c;}}return c;},action=function(d){var r=[];if(d===1){r.push(a);}if(d<3){a=b;if(a==='\''||a==='"'){for(;;){r.push(a);a=get();if(a===b){break;}if(a<='\n'){error='Error: This does not appear to be JavaScript. Try submitting as plain text or markup.';return error;}if(a==='\\'){r.push(a);a=get();}}}}b=next();if(b==='/'&&'(,=:[!&|'.has(a)){r.push(a);r.push(b);for(;;){a=get();if(a==='/'){break;}else if(a==='\\'){r.push(a);a=get();}else if(a<='\n'){error='Error: unterminated JavaScript Regular Expression literal';return error;}r.push(a);}b=next();}return r.join('');},m=function(){if(error!==""){return error;}var r=[];a='\n';r.push(action(3));while(a!==EOF){if(a===' '&&!(type==='css'&&b==='#')){if(isAlphanum(b)){r.push(action(1));}else{r.push(action(2));}}else if(a==='\n'){switch(b){case'{':case'[':case'(':case'+':case'-':r.push(action(1));break;case' ':if(slop==='slop'){r.push(action(3)+action(2)+';');}else{r.push(action(3));}break;default:if(isAlphanum(b)){r.push(action(1));}else{if(level===1&&b!=='\n'){r.push(action(1));}else{r.push(action(2));}}}}else{switch(b){case' ':if(isAlphanum(a)){r.push(action(1));break;}r.push(action(3));break;case'\n':if(level===1&&a!=='\n'){r.push(action(1));}else if(a==='}'){if(level===3){r.push(action(3));}else{r.push(action(1));}}else if(isAlphanum(a)||isValue(a)){if(slop==='slop'){r.push(action(3)+action(1)+';');}else{r.push(action(3));}}else{r.push(action(3));}break;default:r.push(action(1));break;}}}return r.join('');};if(type==="css"){OTHERS='-._\\';}else{OTHERS='_$//';}ALNUM=LETTERS+DIGITS+OTHERS;get.i=0;get.l=input.length;if(slop==="slop"){ret=ifcorrect(m(input).replace(/\);\{/g,'){').replace(/;+\s*/g,';').replace(/\);\+(?!\+)/g,')+').replace(/\);\-(?!\-)/g,')-').replace(/\s+\+(?!\+)/g,'+').replace(/\s+\-(?!\-)/g,'-').replace(/\s+((?=\+\+)|(?=\-\-))/g,';'));}else{ret=m(input);}if(type==="css"){ret=ret.replace(/\: #/g,":#").replace(/\; #/g,";#").replace(/\, #/g,",#").replace(/\s+/g," ").replace(/\} /g,'}').replace(/\{ /g,'{').replace(/http:xx/g,"http://").replace(/\)/g,") ").replace(/\) ;/g,");");}else{ret=ret.replace(/x{2}-->/g,"//-->");}if(ret.charAt(0)===" "||ret.charAt(0)==="\n"||ret.charAt(0)==="\t"){ret=ret.slice(1,ret.length);}if(error!==""){return error;}else{return comment+ret;}},cleanCSS=function(x,size,character,comment){if(new RegExp(/if\s*\(\s*[a-z0-9]+\s*((={2,3})|(\!={1,2}))\s*[a-z0-9]+\s*\)\s*\{/i).test(x)===true&&new RegExp(/var\s+[a-z]+[a-z0-9]*/i).test(x)===true){css_summary=function(){return;};return"Error: Input appears to be JavaScript, but the application is set to beautify CSS.";}else if(new RegExp(/>\s*<\/[a-z]+>/i).test(x)===true&&new RegExp(/[a-z]+[a-z0-9]*\s*\{\s*[a-z]+(\-[a-z]+)*\s*\:\s*[a-z]+(\-[a-z]+)*\s*;/i).test(x)===false){css_summary=function(){return;};return"Error: Input appears to be markup, but the application is set to beautify CSS.";}var q=x.length,level=0,tab='',dashfix,dashfind=new RegExp(/url\(['"\d\w\.\/]*( -\d)['"\d\w\.\/]*\)/),tabmaker=(function(){var i;for(i=0;i<Number(size);i+=1){tab+=character;}}()),finishTabifier=function(z){z=z.replace(/\n\s*\n/g,'\n').replace(/^[\s\n]*/,'').replace(/[\s\n]*$/,'');x=z;level=0;},tabs=function(){var j,s='';for(j=0;j<level;j+=1){s+=tab;}return s;},out=tabs(),li=level,cleanAsync=function(){var i,a;for(i=0;i<x.length;i+=1){if('{'===x.charAt(i)){level+=1;out+=' {\n'+tabs();}else if('}'===x.charAt(i)){out=out.replace(/\s*$/,"");level-=1;if(x.charAt(i+1)+x.charAt(i+2)!=="*/"){out+="\n"+tabs()+"}\n"+tabs();}else{out+="\n"+tabs()+"}";}}else if("/*"===x.charAt(i)+x.charAt(i+1)&&comment==="noindent"){for(a=i;a<x.length;a+=1){out=out.replace(/\s*$/,"");if(a===i){out+="\n";}out+=x.charAt(a);if("*/"===x.charAt(a-2)+x.charAt(a-1)){break;}i=a;}}else if(';'===x.charAt(i)&&"}"!==x.charAt(i+1)){out+=';\n'+tabs();}else if('\n'===x.charAt(i)){out+='\n'+tabs();}else{out+=x.charAt(i);}}if(i<x.length){setTimeout(cleanAsync,0);}else{level=li;out=out.replace(/[\s\n]*$/,'');finishTabifier(out);}},colonspace=function(){var i,d,j,space=new RegExp(/\s/);x=x.split('');d=x.length;for(i=0;i<d;i+=1){if(x[i]==='{'){for(j=i;j<d;j+=1){if(x[j-1]!==" "&&x[j]==="#"){x[j]=" #";}if(x[j]===':'&&x[j+1]!=='/'&&x[j+2]!=='/'&&x[j+1]!=="#"){x[j]=': ';if(space.test(x[j+1])===true){x[j+1]='';}}if(x[j]==='}'){i=j;break;}}}}x=x.join('');return x;};if('\n'===x[0]){x=x.substr(1);}x=x.replace(/([\^\/])?\n*/g,'$1').replace(/\n\s+/g,'\n').replace(/[  ]+/g,' ').replace(/\s?([;:{},+>])\s?/g,'$1').replace(/\{(\.*):(\.*)\}/g,'{$1: $2}').replace(/http:xx/g,'http://').replace(/,/g,', ').replace(/\b\*/g,' *').replace(/\n[\s]+/g,'\n').replace(/[ ]+/g,' ').replace(/\s*-(?=\d)()/g,' -').replace(/\*\//,"*/\n").replace(/\*\//g,"*/\n").replace(/\*\/\s+/g,"*/\n");if(dashfind.test(x)===true){dashfix=function(){var a=dashfind.exec(x)[0],b=x.indexOf(a),c=a.length,d=a.replace(/\s-(?=\d)/g,"-");x=x.replace(a,d);};do{dashfix();}while(dashfind.test(x)===true);}cleanAsync();colonspace();if(comment==="noindent"){x=x.replace(/\n\s+\*\//g,"\n*/");}css_summary=function(){var a=0,b=[],c=x.split("\n"),d=c.length,e=[],f=q.toString().split("").reverse(),g=x.length.toString().split("").reverse();for(;a<d;a+=1){if(c[a].charAt(0)==="/"&&c[a].charAt(1)==="*"){for(;a<d;a+=1){if(c[a].charAt(c[a].length-2)==="*"&&c[a].charAt(c[a].length-1)==="/"){break;}}}else if(c[a].indexOf("url")!==-1&&c[a].indexOf("url(\"\")")===-1&&c[a].indexOf("url('')")===-1&&c[a].indexOf("url()")===-1){b.push(c[a]);}}d=b.length;for(a=0;a<d;a+=1){b[a]=b[a].substr(b[a].indexOf("url(")+4,b[a].length);b[a]=b[a].substr(0,b[a].indexOf(")"));if(b[a].charAt(0)==="\""||b[a].charAt(0)==="'"){b[a]=b[a].substr(1,b[a].length);}if(b[a].charAt(b[a].length-1)==="\""||b[a].charAt(b[a].length-1)==="'"){b[a]=b[a].substr(0,b[a].length-1);}}for(a=0;a<d;a+=1){e[a]=1;for(c=a+1;c<d;c+=1){if(b[a]===b[c]){e[a]+=1;b[c]="";}}}for(a=0;a<d;a+=1){if(b[a]!==""){e[a]=e[a]+"x";if(e[a]!=="1x"){e[a]="<em>"+e[a]+"</em>";}b[a]="<li>"+e[a]+" - "+b[a]+"</li>";}}if(d===0){b="";}else{b="<h4>List of HTTP requests:</h4><ul>"+b.join("")+"</ul>";}c=f.length;for(a=2;a<c;a+=3){f[a]=","+f[a];}c=g.length;for(a=2;a<c;a+=3){g[a]=","+g[a];}f=f.reverse().join("");g=g.reverse().join("");if(f.charAt(0)===","){f=f.slice(1,f.length);}if(g.charAt(0)===","){g=g.slice(1,g.length);}return"<p><strong>Total input size:</strong> <em>"+f+"</em> characters</p><p><strong>Total output size:</strong> <em>"+g+"</em> characters<p><strong>Number of HTTP requests:</strong> <em>"+d+"</em></p>"+b;};return x;},js_beautify=function(js_source_text,options){if(new RegExp(/>\s*<\/[a-z]+>/i).test(js_source_text)===true&&new RegExp(/^(\s*<)/).test(js_source_text)===true&&new RegExp(/(>\s*)$/).test(js_source_text)===true){js_summary=function(){return;};return"Error: Input appears to be markup, but the application is set to beautify JavaScript.";}else if(new RegExp(/[a-z]+[a-z0-9]*\s*\{\s*[a-z]+(\-[a-z]+)*\s*\:\s*[a-z]+(\-[a-z]+)*\s*;/i).test(js_source_text)===true&&new RegExp(/if\s*\(\s*[a-z0-9]+\s*((={2,3})|(\!={1,2}))\s*[a-z0-9]+\s*\)\s*\{/i).test(js_source_text)===false){js_summary=function(){return;};return"Error: Input appears to be CSS, but the application is set to beautify JavaScript.";}options=options||{};var i,input,output,rvalue,token_text,last_type,last_text,last_word,current_mode,modes,indent_string,whitespace,wordchar,punct,parser_pos,end_delim,line_starters,in_case,prefix,token_type,do_block_just_closed,t,var_line,var_line_tainted,if_line_flag,indent_level,start_delim,opt_preserve_newlines=typeof options.preserve_newlines==='undefined'?true:options.preserve_newlines,size=js_source_text.length,opt_indent_size=(options.indent_size)?options.indent_size:4,opt_indent_char=(options.indent_char)?options.indent_char:' ',opt_indent_level=(options.indent_level)?options.indent_level:0,opt_indent_comm=(options.indent_comm)?options.indent_comm:"indent",fixSelfAnon=function(x){if(rvalue.indexOf(x+" (function")===-1){return;}var a=[],b,c="",d=[],e,f,g=new RegExp(/\s/),h=[];for(b=0;b<rvalue.length;b+=1){if(rvalue.charAt(b)==="\""||rvalue.charAt(b)==="'"){if(c===""){c=b;}else if(rvalue.charAt(c)==="\""&&rvalue.charAt(b)==="\""){d.push(c+"|"+b);c="";}else if(rvalue.charAt(c)==="\'"&&rvalue.charAt(b)==="\'"){d.push(c+"|"+b);c="";}}if(rvalue.charAt(b)===x&&rvalue.charAt(b+1)===" "&&rvalue.charAt(b+2)==="("&&rvalue.charAt(b+3)==="f"&&rvalue.charAt(b+4)==="u"&&rvalue.charAt(b+5)==="n"&&rvalue.charAt(b+6)==="c"&&rvalue.charAt(b+7)==="t"&&rvalue.charAt(b+8)==="i"&&rvalue.charAt(b+9)==="o"&&rvalue.charAt(b+10)==="n"){a.push(b);f="";for(e=b;e>-1;e-=1){if(rvalue.charAt(e)==="\n"){break;}if(g.test(rvalue.charAt(e))===true&&g.test(rvalue.charAt(e-1))===true&&rvalue.charAt(e)!=="\n"){f+=rvalue.charAt(e);}}h.push(f);}}for(e=0;e<d.length;e+=1){for(c=0;c<a.length;c+=1){if(a[c]>d[e].split("|")[0]&&a[c]<d[e].split("|")[1]){a[c]=-1;}}}rvalue=rvalue.split("");for(c=0;c<a.length;c+=1){if(a[c]!==-1){rvalue[a[c]+1]="\n"+h[c];}}rvalue=rvalue.join("");},trim_output=function(){while(output.length&&(output[output.length-1]===' '||output[output.length-1]===indent_string)){output.pop();}},print_newline=function(ignore_repeated){ignore_repeated=typeof ignore_repeated==='undefined'?true:ignore_repeated;if_line_flag=false;trim_output();if(!output.length){return;}if(output[output.length-1]!=="\n"||!ignore_repeated){output.push("\n");}for(var i=0;i<indent_level;i+=1){output.push(indent_string);}},print_space=function(){var last_output=output.length?output[output.length-1]:' ';if(last_output!==' '&&last_output!=='\n'&&last_output!==indent_string&&last_output!=="("&&last_output!=="."){output.push(' ');}},print_token=function(){output.push(token_text);},indent=function(){indent_level+=1;},unindent=function(){if(indent_level){indent_level-=1;}},remove_indent=function(){if(output.length&&output[output.length-1]===indent_string){output.pop();}},set_mode=function(mode){modes.push(current_mode);current_mode=mode;},restore_mode=function(){do_block_just_closed=current_mode==='DO_BLOCK';current_mode=modes.pop();},in_array=function(what,arr){for(var i=0;i<arr.length;i+=1){if(arr[i]===what){return true;}}return false;},get_next_token=function(){var t,resulting_string,sep,esc,comment,n_newlines=0,c='',wanted_newline=false;do{if(parser_pos>=input.length){return['','TK_EOF'];}c=input.charAt(parser_pos);parser_pos+=1;if(c==="\n"){n_newlines+=1;}}while(in_array(c,whitespace));if(opt_preserve_newlines){if(n_newlines>1){for(i=0;i<2;i+=1){print_newline(i===0);}}wanted_newline=(n_newlines===1);}if(in_array(c,wordchar)){if(parser_pos<input.length){while(in_array(input.charAt(parser_pos),wordchar)){c+=input.charAt(parser_pos);parser_pos+=1;if(parser_pos===input.length){break;}}}if(parser_pos!==input.length&&c.match(/^[0-9]+[Ee]$/)&&input.charAt(parser_pos)==='-'){parser_pos+=1;t=get_next_token(parser_pos);c+='-'+t[0];return[c,'TK_WORD'];}if(c==='in'){return[c,'TK_OPERATOR'];}if(wanted_newline&&last_type!=='TK_OPERATOR'&&!if_line_flag){print_newline();}return[c,'TK_WORD'];}if(c==='('||c==='['){return[c,'TK_START_EXPR'];}if(c===')'||c===']'){return[c,'TK_END_EXPR'];}if(c==='{'){return[c,'TK_START_BLOCK'];}if(c==='}'){return[c,'TK_END_BLOCK'];}if(c===';'){return[c,'TK_SEMICOLON'];}if(c==='/'){comment='';if(input.charAt(parser_pos)==='*'){parser_pos+=1;if(parser_pos<input.length){while(!(input.charAt(parser_pos)==='*'&&input.charAt(parser_pos+1)&&input.charAt(parser_pos+1)==='/')&&parser_pos<input.length){comment+=input.charAt(parser_pos);parser_pos+=1;if(parser_pos>=input.length){break;}}}parser_pos+=2;return['/*'+comment+'*/','TK_BLOCK_COMMENT'];}if(input.charAt(parser_pos)==='/'){comment=c;while(input.charAt(parser_pos)!=="\x0d"&&input.charAt(parser_pos)!=="\x0a"){comment+=input.charAt(parser_pos);parser_pos+=1;if(parser_pos>=input.length){break;}}parser_pos+=1;if(wanted_newline){print_newline();}return[comment,'TK_COMMENT'];}}if(c==="'"||c==='"'||(c==='/'&&((last_type==='TK_WORD'&&last_text==='return')||(last_type==='TK_START_EXPR'||last_type==='TK_END_BLOCK'||last_type==='TK_OPERATOR'||last_type==='TK_EOF'||last_type==='TK_SEMICOLON')))){sep=c;esc=false;resulting_string='';if(parser_pos<input.length){while(esc||input.charAt(parser_pos)!==sep){resulting_string+=input.charAt(parser_pos);if(!esc){esc=input.charAt(parser_pos)==='\\';}else{esc=false;}parser_pos+=1;if(parser_pos>=input.length){break;}}}parser_pos+=1;resulting_string=sep+resulting_string+sep;if(sep==='/'){while(parser_pos<input.length&&in_array(input.charAt(parser_pos),wordchar)){resulting_string+=input.charAt(parser_pos);parser_pos+=1;}}return[resulting_string,'TK_STRING'];}if(in_array(c,punct)){while(parser_pos<input.length&&in_array(c+input.charAt(parser_pos),punct)){c+=input.charAt(parser_pos);parser_pos+=1;if(parser_pos>=input.length){break;}}return[c,'TK_OPERATOR'];}return[c,'TK_UNKNOWN'];};indent_string='';do{opt_indent_size-=1;indent_string+=opt_indent_char;}while(opt_indent_size>0);indent_level=opt_indent_level;input=js_source_text;last_word='';last_type='TK_START_EXPR';last_text='';output=[];do_block_just_closed=false;var_line=false;var_line_tainted=false;whitespace="\n\r\t ".split('');wordchar='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'.split('');punct='+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::'.split(' ');line_starters='continue,try,throw,return,var,if,switch,case,default,for,while,break,function'.split(',');current_mode='BLOCK';modes=[current_mode];parser_pos=0;in_case=false;while(true){t=get_next_token(parser_pos);token_text=t[0];token_type=t[1];if(token_type==='TK_EOF'){break;}switch(token_type){case'TK_START_EXPR':var_line=false;set_mode('EXPRESSION');if(last_type!=='TK_WORD'&&last_type!=='TK_OPERATOR'&&last_type!=='TK_START_EXPR'&&last_type!=='TK_END_EXPR'){print_space();}else if(in_array(last_word,line_starters)){print_space();}else if(last_word==='catch'){print_space();}print_token();break;case'TK_END_EXPR':print_token();restore_mode();break;case'TK_START_BLOCK':if(last_word==='do'){set_mode('DO_BLOCK');}else{set_mode('BLOCK');}if(last_type!=='TK_OPERATOR'&&last_type!=='TK_START_EXPR'){if(last_type==='TK_START_BLOCK'){print_newline();}else{print_space();}}print_token();indent();break;case'TK_END_BLOCK':if(last_type==='TK_START_BLOCK'){trim_output();unindent();}else{unindent();print_newline();}print_token();restore_mode();break;case'TK_WORD':if(do_block_just_closed){if(last_text!=="["){print_space();}if(in_array(token_text,line_starters)){token_text=token_text+" ";}print_token();break;}if(token_text==='case'||token_text==='default'){if(last_text===':'){remove_indent();}else{unindent();print_newline();indent();}print_token();in_case=true;break;}prefix='NONE';if(last_type==='TK_END_BLOCK'){if(!in_array(token_text.toLowerCase(),['else','catch','finally'])){prefix='NEWLINE';}else{prefix='SPACE';print_space();}}else if(last_type==='TK_SEMICOLON'&&(current_mode==='BLOCK'||current_mode==='DO_BLOCK')){prefix='NEWLINE';}else if(last_type==='TK_SEMICOLON'&&current_mode==='EXPRESSION'){prefix='SPACE';}else if(last_type==='TK_STRING'){prefix='NEWLINE';}else if(last_type==='TK_WORD'){prefix='SPACE';}else if(last_type==='TK_START_BLOCK'){prefix='NEWLINE';}else if(last_type==='TK_END_EXPR'){print_space();prefix='NEWLINE';}if(last_type!=='TK_END_BLOCK'&&in_array(token_text.toLowerCase(),['else','catch','finally'])){print_newline();}else if(in_array(token_text,line_starters)||prefix==='NEWLINE'){if(last_text==='else'){print_space();}else if((last_type==='TK_START_EXPR'||last_text==='=')&&token_text==='function'){}else if(last_type==='TK_WORD'&&(last_text==='return'||last_text==='throw')){print_space();}else if(last_type!=='TK_END_EXPR'){if((last_type!=='TK_START_EXPR'||token_text!=='var')&&last_text!==':'){if(token_text==='if'&&last_type==='TK_WORD'&&last_word==='else'){print_space();}else{print_newline();}}}else{if(in_array(token_text,line_starters)&&last_text!==')'){print_newline();}}}else if(prefix==='SPACE'){print_space();}print_token();last_word=token_text;if(token_text==='var'){var_line=true;var_line_tainted=false;}if(token_text==='if'||token_text==='else'){if_line_flag=true;}break;case'TK_SEMICOLON':print_token();var_line=false;break;case'TK_STRING':if(last_type==='TK_START_BLOCK'||last_type==='TK_END_BLOCK'||last_type==='TK_SEMICOLON'){print_newline();}else if(last_type==='TK_WORD'){print_space();}print_token();break;case'TK_OPERATOR':start_delim=true;end_delim=true;if(var_line&&token_text!==','){var_line_tainted=true;if(token_text===':'){var_line=false;}}if(token_text===':'&&in_case){print_token();print_newline();break;}if(token_text==='::'){print_token();break;}in_case=false;if(token_text===','){if(var_line){if(var_line_tainted){print_token();print_newline();var_line_tainted=false;}else{print_token();print_space();}}else if(last_type==='TK_END_BLOCK'){print_token();print_newline();}else{if(current_mode==='BLOCK'){print_token();print_newline();}else{print_token();print_space();}}break;}else if(token_text==='--'||token_text==='++'){if(last_text===';'){start_delim=true;end_delim=false;}else{start_delim=false;end_delim=false;}}else if(token_text==='!'&&last_type==='TK_START_EXPR'){start_delim=false;end_delim=false;}else if(last_type==='TK_OPERATOR'){start_delim=false;end_delim=false;}else if(last_type==='TK_END_EXPR'){start_delim=true;end_delim=true;}else if(token_text==='.'){start_delim=false;end_delim=false;}else if(token_text===':'){if(last_text.match(/^\d+$/)){start_delim=true;}else{start_delim=false;}}if(start_delim){print_space();}print_token();if(end_delim){print_space();}break;case'TK_BLOCK_COMMENT':print_newline();if(opt_indent_comm==="noindent"){for(i=indent_level+1;i>0;i-=1){remove_indent();}}print_token();print_newline();break;case'TK_COMMENT':if(opt_indent_comm==="noindent"){for(i=indent_level+1;i>0;i-=1){remove_indent();}}else{print_space();}print_token();print_newline();break;case'TK_UNKNOWN':print_token();break;}last_type=token_type;last_text=token_text;}rvalue=output.join('');fixSelfAnon("}");fixSelfAnon(";");rvalue=rvalue.replace(/\} \(\)/g,'}()').replace(/\t/g,'    ');js_summary=function(){var a,c=size.toString().split("").reverse(),d=rvalue.length.toString().split("").reverse(),b=c.length;for(a=2;a<b;a+=3){c[a]=","+c[a];}b=d.length;for(a=2;a<b;a+=3){d[a]=","+d[a];}c=c.reverse().join("");d=d.reverse().join("");if(c.charAt(0)===","){c=c.slice(1,c.length);}if(d.charAt(0)===","){d=d.slice(1,d.length);}return"<p><strong>Total input size:</strong> <em>"+c+"</em> characters</p><p><strong>Total output size:</strong> <em>"+d+"</em> characters</p>";};return rvalue;},markupmin=function(x,slop,comments,presume_html){if(new RegExp(/if\s*\(\s*[a-z0-9]+\s*((={2,3})|(\!={1,2}))\s*[a-z0-9]+\s*\)\s*\{/i).test(x)===true&&new RegExp(/((\}(\(\))?\)*;\s*)|([a-z0-9]("|'));?)$/i).test(x)===true){return"Error: Input appears to be JavaScript, but the application is set to minify markup.";}else if(new RegExp(/[a-z]+[a-z0-9]*\s*\{\s*[a-z]+(\-[a-z]+)*\s*\:\s*[a-z]+(\-[a-z]+)*\s*;/i).test(x)===true&&new RegExp(/>\s*<\/[a-z]+>/i).test(x)===false){return"Error: Input appears to be CSS, but the application is set to minify markup.";}var i,a,b,c,y,Y,verbose=new RegExp(/^\s+$/),white=new RegExp(/\s/),markupspace=function(){var d='';Y=x.length;for(a=i;a<Y;a+=1){if(x[a]===">"){break;}else{d=d+x[a];x[a]='';}}d=d.replace(/\s+/g," ").replace(/\s*,\s+/g,", ").replace(/\s*;\s*/g,";").replace(/\s*\/\s*/g,"/").replace(/\s*\.\s*/g,".").replace(/\s*=\s*/g,"=").replace(/\s*:\s*/g,":").replace(/\=" /g,'="').replace(/\=' /g,"='").replace(/ \="/g,'="').replace(/ \='/g,"='")+">";i=a;x[i]=d;},markupcomment=function(){c='';Y=x.length;for(b=i;b<Y;b+=1){if(x[b]==="-"&&x[b+1]==="-"&&x[b+2]===">"){x[b]="";x[b+1]="";x[b+2]="";break;}else if(comments!=="comments"&&comments!=="beautify"){x[b]="";}else{c=c+x[b];x[b]="";}}if(comments==="comments"||comments==="beautify"){c=" "+c+"-->";x[i]=c;}},markupscript=function(z){if(jsmin===undefined){return;}var e=[],f,h='',j="</"+z,m;Y=x.length;for(c=i;c<Y;c+=1){if((y.slice(c,c+j.length)).toLowerCase()===j){f=c;break;}}for(c=i;c<f;c+=1){if(x[c-1]!==">"){e.push(x[c]);x[c]="";}else{break;}}m=e[0];e.splice(0,1);if(white.test(e[0])===true){e.splice(0,1);}for(;f<Y;f+=1){if(x[f]!==">"){h=h+x[f];x[f]='';}else{break;}}h=h+">";i=f;if(e.join('')===""){x[i]=m+h;return;}e=e.join('');if(slop!=='none'){if(y==="style"){e=jsmin('',e,3,'css',slop);}else{e=jsmin('',e,3,'javascript',slop);}}Y=e.length;for(c=0;c<Y;c+=1){if(white.test(e.charAt(c))===true){e=e.substr(c+1);}else{break;}}x[i]=m+e+h;},preserve=function(end){b='';Y=x.length;for(c=i;c<Y;c+=1){if(x[c-1]+x[c]===end){break;}}for(a=i;a<c;a+=1){b+=x[a];x[a]='';}x[i]=b;i=c;},content=function(){b='';Y=x.length;for(a=i;a<Y;a+=1){if(x[a]==="<"){break;}else{b=b+x[a];x[a]='';}}i=a-1;x[i]=b.replace(/\s+/g," ");},it=(function(){y=x;x=x.split('');for(i=0;i<x.length;i+=1){if((y.slice(i,i+7)).toLowerCase()==="<script"&&comments!=="comments"&&comments!=="beautify"){markupspace();markupscript("script");}else if((y.slice(i,i+6)).toLowerCase()==="<style"&&comments!=="comments"&&comments!=="beautify"){markupspace();markupscript("style");}else if(y.slice(i,i+4)==="<!--"&&x[i+4]!=="#"){markupcomment();}else if(y.slice(i,i+5)==="<?php"){preserve("?>");}else if(y.slice(i,i+2)==="<%"){preserve("%>");}else if((x[i]==="<"&&x[i+1]!=="!")||(x[i]==="<"&&x[i+1]==="!"&&x[i+2]!=="-")){markupspace();}else if(x[i]===undefined){x[i]="";}else if(x[i-1]!==undefined&&x[i-1].charAt(x[i-1].length-1)===">"){content();}}}());if(comments!=="beautify"){i=[];Y=x.length;for(a=0;a<Y;a+=1){if(x[a]!==""){i.push(x[a]);}}x=[];Y=i.length;for(a=0;a<Y;a+=1){if(verbose.test(i[a])===false||(verbose.test(i[a])===true&&verbose.test(i[a+1])===false)){x.push(i[a]);}}Y=x.length;for(a=2;a<Y;a+=1){if(presume_html!=="true"&&(((x[a].charAt(0)==="<"&&x[a].charAt(x[a].length-2)!=="/"&&x[a-2].charAt(0)==="<"&&x[a-2].charAt(x[a-2].length-2)!=="/")||(x[a].indexOf("</")===0&&x[a-2].indexOf("</")===0))&&verbose.test(x[a-1])===true)){x[a-1]="";}}}x=x.join('').replace(/-->\s+/g,'-->').replace(/\s+<\?php/g,' <?php').replace(/\s+<%/g,' <%').replace(/>\s+/g,'> ').replace(/\s+</g,' <').replace(/ >/g,'>').replace(/< /g,'<').replace(/ \/>/g,'/>');if(white.test(x.charAt(0))===true){x=x.slice(1,x.length);}return x;},markup_beauty=function(source,indent_size,indent_character,indent_comment,indent_script,presume_html){if(new RegExp(/^(\s*<)/).test(source)===false&&new RegExp(/if\s*\(\s*\(*[\$_a-z0-9]+\s*/i).test(source)===true&&new RegExp(/((\}(\(\))?\)*;?\s*)|([a-z0-9]("|')?\)*);?(\s*\})*)$/i).test(source)===true){markup_summary=function(){return;};return"Error: Input appears to be JavaScript, but the application is set to beautify markup.";}else if(new RegExp(/[a-z]+[a-z0-9]*\s*\{\s*[a-z]+(\-[a-z]+)*\s*\:\s*[a-z]+(\-[a-z]+)*\s*;/i).test(source)===true&&new RegExp(/>\s*<\/[a-z]+>/i).test(source)===false){markup_summary=function(){return;};return"Error: Input appears to be CSS, but the application is set to beautify markup.";}var i,Z,tab='',token=[],build=[],cinfo=[],level=[],summary=[],x=markupmin(source,'none','beautify',presume_html).split(''),loop=x.length,elements=(function(){var a,b=function(end){var d,e,f='',c=i,z=end.charAt(end.length-2),y=end.split('').reverse(),g=function(){for(;c<loop;c+=1){if(z!=="-"&&z!=="?"&&z!=="%"&&x[c]===">"){break;}else if(x[c-1]+x[c]===z+">"){break;}}Z=y.length;for(d=0;d<Z;d+=1){if(x[c-d]!==y[d]){e=false;c+=1;break;}e=true;}};g();if(e!==true){do{g();}while(e!==true);}else if(e===true){Z=c+1;for(d=i;d<Z;d+=1){f=f+x[d];}}if(x[i-2]===">"&&x[i-1]===" "){f=" "+f;}i=c-1;return f;},cgather=function(z){var c,d='';for(c=i;c<loop;c+=1){if(z==="script"&&(x[c]+x[c+1]+x[c+2].toLowerCase()+x[c+3].toLowerCase()+x[c+4].toLowerCase()+x[c+5].toLowerCase()+x[c+6].toLowerCase()+x[c+7].toLowerCase()==="</script")){break;}else if(z==="style"&&(x[c]+x[c+1]+x[c+2].toLowerCase()+x[c+3].toLowerCase()+x[c+4].toLowerCase()+x[c+5].toLowerCase()+x[c+6].toLowerCase()==="</style")){break;}else if(z==="other"&&x[c]==="<"){break;}else{d=d+x[c];}}i=c-1;return d;},type_define=(function(){for(i=0;i<loop;i+=1){if(x[i]==="<"&&x[i+1]==="!"&&x[i+2]==="-"&&x[i+3]==="-"&&x[i+4]!=="#"){build.push(b('-->'));token.push("T_comment");}else if(x[i]==="<"&&x[i+1]==="!"&&x[i+2]==="-"&&x[i+3]==="-"&&x[i+4]==="#"){build.push(b('-->'));token.push("T_ssi");}else if(x[i]==="<"&&x[i+1]==="!"&&x[i+2]!=="-"){build.push(b('>'));token.push("T_sgml");}else if(x[i]==="<"&&x[i+1]==="?"&&x[i+2].toLowerCase()==="x"&&x[i+3].toLowerCase()==="m"&&x[i+4].toLowerCase()==="l"){build.push(b('?>'));token.push("T_xml");}else if(x[i]==="<"&&x[i+1]==="?"&&x[i+2].toLowerCase()==="p"&&x[i+3].toLowerCase()==="h"&&x[i+4].toLowerCase()==="p"){build.push(b('?>'));token.push("T_php");}else if(x[i]==="<"&&x[i+1].toLowerCase()==="s"&&x[i+2].toLowerCase()==="c"&&x[i+3].toLowerCase()==="r"&&x[i+4].toLowerCase()==="i"&&x[i+5].toLowerCase()==="p"&&x[i+6].toLowerCase()==="t"){build.push(b('>'));token.push("T_script");}else if(x[i]==="<"&&x[i+1].toLowerCase()==="s"&&x[i+2].toLowerCase()==="t"&&x[i+3].toLowerCase()==="y"&&x[i+4].toLowerCase()==="l"&&x[i+5].toLowerCase()==="e"){build.push(b('>'));token.push("T_style");}else if(x[i]==="<"&&x[i+1]==="%"){build.push(b('%>'));token.push("T_asp");}else if(x[i]==="<"&&x[i+1]==="/"){build.push(b('>'));token.push("T_tag_end");}else if(x[i]==="<"&&(x[i+1]!=="!"||x[i+1]!=="?"||x[i+1]!=="/"||x[i+1]!=="%")){for(a=i;a<loop;a+=1){if(x[a]==="/"&&x[a+1]===">"){build.push(b('/>'));token.push("T_singleton");break;}else if(x[a]!=="/"&&x[a+1]===">"){build.push(b('>'));token.push("T_tag_start");break;}}}else if(x[i-1]===">"&&(x[i]!=="<"||(x[i]!==" "&&x[i+1]!=="<"))){if(token[token.length-1]==="T_script"){build.push(cgather("script"));token.push("T_content");}else if(token[token.length-1]==="T_style"){build.push(cgather("style"));token.push("T_content");}else if(x[i-1]+x[i]+x[i+1]!=="> <"){build.push(cgather("other"));token.push("T_content");}}}}());summary=summary.concat(build);}()),code_type=(function(){Z=token.length;for(i=0;i<Z;i+=1){if(token[i]==="T_sgml"||token[i]==="T_xml"){cinfo.push("parse");}else if(token[i]==="T_asp"||token[i]==="T_php"||token[i]==="T_ssi"){cinfo.push("server");}else if(token[i]==="T_comment"){cinfo.push("comment");}else if((token[i]==="T_content"&&build[i]!==" ")&&token[i-1]==="T_script"){cinfo.push("external");}else if(token[i]==="T_content"&&token[i-1]==="T_style"){cinfo.push("external");}else if(token[i]==="T_content"&&build[i].charAt(0)===" "&&build[i].charAt(build[i].length-1)===" "){cinfo.push("mixed_both");}else if(token[i]==="T_content"&&build[i].charAt(0)===" "&&build[i].charAt(build[i].length-1)!==" "){cinfo.push("mixed_start");}else if(token[i]==="T_content"&&build[i].charAt(0)!==" "&&build[i].charAt(build[i].length-1)===" "){cinfo.push("mixed_end");}else if(token[i]==="T_content"){cinfo.push("content");}else if(token[i]==="T_tag_start"){cinfo.push("start");}else if(token[i]==="T_style"){cinfo.push("start");}else if(token[i]==="T_script"){cinfo.push("start");}else if(token[i]==="T_singleton"){cinfo.push("singleton");}else if(token[i]==="T_tag_end"){cinfo.push("end");}}}()),tab_check=(function(){var a;indent_size=Number(indent_size);if(indent_size!==Number(indent_size)){indent_size=4;}Z=indent_size;for(a=0;a<Z;a+=1){tab+=indent_character;}return tab;}()),cheat=(function(){if(presume_html!==true&&presume_html!=="true"){return;}var a,b;loop=cinfo.length;for(i=0;i<loop;i+=1){if(cinfo[i]==="start"){a=build[i].indexOf(" ");if(build[i].length===3){b=build[i].charAt(1).toLowerCase();}else if(a===-1){b=build[i].slice(1,cinfo[i].length-2).toLowerCase();}else if(a===0){b=build[i].slice(1,build[i].length);a=b.indexOf(" ");b=b.slice(1,a).toLowerCase();}else{b=build[i].slice(1,a).toLowerCase();}if(b==="br"||b==="meta"||b==="link"||b==="img"||b==="hr"||b==="base"||b==="basefont"||b==="area"||b==="col"||b==="frame"||b==="input"||b==="param"){cinfo[i]="singleton";token[i]="T_singleton";}}}}()),tab_level=(function(q){loop=cinfo.length;var a,b=function(){var m=0;for(a=i-1;a>0;a-=1){if(cinfo[a]==="start"){m+=1;}else if(cinfo[a]==="end"){m-=1;}if(level[a]!==0&&level[a]!=="x"){return level.push(level[a]+m);}}return level.push(0);},e=function(){var yy=1,z=function(y){for(;y>0;y-=1){if(level[y]!=="x"){return level.push(level[y]+1);}}},v=function(){var y;for(y=i-1;y>0;y-=1){if(level[y]!=="x"){break;}}if(cinfo[i-1]==="start"&&level[i-1]!=="x"){return level.push(level[i-1]);}else if(build[i].charAt(0)===" "){return level.push(level[y]-1);}},w=function(){var k,q,y=i-1,t=function(){var s,l=0;for(s=i-1;s>0;s-=1){if((cinfo[s]==="start"&&cinfo[s+1]==="start"&&level[s]===level[s+1]-1)||(cinfo[s]==="start"&&cinfo[s-1]!=="start"&&level[s]===level[s-1])){break;}}for(k=s+1;k<i;k+=1){if(cinfo[k]==="mixed_start"&&cinfo[k+1]==="end"){l+=1;}}if(cinfo[s-1]==="end"&&level[s-1]!=="x"&&l===0){l+=1;}if(l!==0){if(level[i-1]==="x"){return l-1;}else{return l;}}else{for(;s<i;s+=1){if(cinfo[s]==="start"){l+=1;}else if(cinfo[s]==="end"){l-=1;}}return l;}},u=function(){for(;y>0;y-=1){if(cinfo[y]!=="mixed_end"||(cinfo[y]==="start"&&level[y]!=="x")){if(cinfo[y-1]==="end"){q="r";if(cinfo[i-1]==="mixed_both"&&level[i-1]===level[y]-t()){return level.push(level[y]-(t()+1));}else if(cinfo[i-2]==="start"&&(cinfo[i-1]==="mixed_end"||cinfo[i-1]==="mixed_both")){return level.push(level[y]);}else if(level[y]!=="x"){if(cinfo[y]==="mixed_both"&&y!==i-t()){if(y===i-1){return level.push(level[y]-1);}else{return level.push(level[y]+t());}}else if(cinfo[i-1]==="mixed_end"&&t()===0){return level.push(level[y]-1);}else{return level.push(level[y]-t());}}}else{q=y;return;}}}},r=function(){var l=0;for(k=i;k>0;k-=1){if(cinfo[k]==="end"){l+=1;}else if(cinfo[k]==="start"){l-=1;}if(l===0){return k;}}};if(cinfo[i-1]==="end"&&level[i-1]!=="x"){if(cinfo[i-2]==="start"&&level[i-2]==="x"){for(k=i-2;k>0;k-=1){if(level[k]!=="x"){break;}}if(cinfo[k]==="start"){if(cinfo[i-1]==="end"&&level[i-1]!=="x"&&cinfo[i-2]==="start"&&level[i-2]==="x"){return level.push(level[k]-1);}else{return level.push(level[k]);}}else{return level.push(level[k]-1);}}else if(cinfo[i-2]==="start"&&level[i-2]!=="x"){return level.push(level[i-2]-1);}else{return level.push(level[i-1]-1);}}else{u();if(q==="r"){return;}else{y=0;for(q=r();q>0;q-=1){if(cinfo[q]==="start"){y+=1;}else if(cinfo[q]==="end"){y-=1;}if(level[q]!=="x"){if(cinfo[q]==="end"&&cinfo[q-1]==="start"&&level[q-1]!=="x"){return level.push(level[q]);}else if(level[i-1]==="x"&&build[i].charAt(0)!==" "&&cinfo[i-1]!=="mixed_end"&&(cinfo[i-2]!=="end"||level[i-2]!=="x")&&(cinfo[i-3]!=="end"||level[i-3]!=="x")){return level.push("x");}else{return level.push(level[q]+(y-1));}}}y=0;for(q=i;q>-1;q-=1){if(cinfo[q]==="start"){y+=1;}else if(cinfo[q]==="end"){y-=1;}}return level.push(y);}}};if(cinfo[i-1]==="end"||cinfo[i-1]==="mixed_both"||cinfo[i-1]==="mixed_end"){return w();}else if(cinfo[i-1]==="mixed_start"||cinfo[i-1]==="content"){return level.push("x");}else if(cinfo[i-1]==="external"){yy=-1;for(a=i-2;a>0;a-=1){if(cinfo[a]==="start"){yy+=1;}else if(cinfo[a]==="end"){yy-=1;}if(level[a]!=="x"){break;}}if(cinfo[a]==="end"){yy+=1;}return level.push(level[a]+yy);}else if(build[i].charAt(0)!==" "){if((cinfo[i-1]==="singleton"||cinfo[i-1]==="content")&&level[i-1]==="x"){return level.push("x");}yy=0;for(a=i-1;a>0;a-=1){if(cinfo[a]==="singleton"&&level[a]==="x"&&((cinfo[a-1]==="singleton"&&level[a-1]!=="x")||cinfo[a-1]!=="singleton")){yy+=1;}if(level[a]!==0&&level[a]!=="x"&&cinfo[i-1]!=="start"){if(cinfo[a]==="mixed_both"||cinfo[a]==="mixed_start"){return level.push(level[a]-yy);}else if(level[a]===yy||(cinfo[a]==="singleton"&&(cinfo[a-1]==="content"||cinfo[a-1]==="mixed_start"))){return level.push(level[a]);}else{return level.push(level[a]-1);}}else if(cinfo[a]==="start"&&level[a]==="x"){return z(a);}else if(cinfo[i-1]==="start"){return level.push(level[a]);}}return level.push(0);}else{return v();}},f=function(z){var k,l,m,n=(function(){var j;if(z===1){k=0;l=0;m=0;}else{for(j=z-1;j>0;j-=1){if(cinfo[j]!=="comment"){k=j;break;}}if(k===1){l=0;m=0;}else{for(j=k-1;j>0;j-=1){if(cinfo[j]!=="comment"){l=j;break;}}if(l===1){m=0;}else{for(j=l-1;j>0;j-=1){if(cinfo[j]!=="comment"){m=j;break;}}}}}}()),p=function(){var j,v,u=-1,m=function(){for(v=i;v<loop;v+=1){if(cinfo[v]==="end"&&(cinfo[i]!=="start"||(cinfo[v+1]==="content"&&build[v+1].charAt(0)!==" "))){return-1;}else if(cinfo[v]==="mixed_both"||cinfo[v]==="mixed_start"||cinfo[v]==="singleton"||cinfo[v]==="start"||build[i].charAt(build[i].length-1)===" "){return 0;}}};v=1;for(j=k;j>0;j-=1){if(cinfo[j]==="start"){u-=1;if(level[j]==="x"){v+=1;}}else if(cinfo[j]==="end"){u+=1;v-=1;}if(level[j]===0){k=0;for(l=i-1;l>j;l-=1){if(cinfo[l]==="start"){k+=1;}else if(cinfo[l]==="end"){k-=1;}}if(k>0){if(level[j+1]==="x"){return level.push(((u)*-1)-1);}else if(cinfo[j]!=="external"){return level.push((u+1)*-1);}}else{for(k=i-1;k>0;k-=1){if(level[k]!=="x"){return level.push(level[k]);}}}}if(level[j]!=="x"&&level[i-1]!=="x"){if(cinfo[j]==="start"||cinfo[j]==="end"){return level.push(level[j]+v);}else{return level.push(level[j]+v-1);}}else if(u===-1&&level[j]==="x"){break;}else if(u===1&&level[j]!=="x"&&cinfo[j]!=="mixed_start"&&cinfo[j]!=="content"){if(cinfo[j-1]==="mixed_end"||(level[i-1]==="x"&&cinfo[i-1]==="end"&&cinfo[j]!=="end")){return level.push(level[j]-u-1);}else{return level.push(level[j]-u);}}else if(u===0&&level[j]!=="x"){l=0;for(k=j-1;k>0;k-=1){if(level[k]===level[j]-1){break;}}for(;k<i;k+=1){if(cinfo[k]==="start"){l+=1;}else if(cinfo[k]==="end"){l-=1;}}if(l===0){return level.push(level[j]-1);}else{return level.push(level[j]);}}}l=0;u=0;for(j=k;j>0;j-=1){if(cinfo[j]==="end"){l+=-1;if(level[j]!=="x"){u+=1;}}else if(cinfo[j]==="start"){l+=1;if(level[j]==="x"){u+=1;}else{if(l>0){if(u>0){if(level[i-1]==="x"){return level.push(level[j]+l);}else{return level.push(level[j]+l-u);}}else{return level.push(level[j]+l+m());}}else{return level.push(level[j]+l);}}}}return level.push(level[j]+1);};if(i-1===0&&cinfo[0]==="start"){return level.push(1);}else if(cinfo[i-1]==="mixed_start"||cinfo[i-1]==="content"){return level.push("x");}else if(cinfo[k]==="mixed_start"||cinfo[k]==="content"){return level.push("x");}else if(cinfo[i-1]==="comment"&&level[i-1]===0){for(a=i-1;a>-1;a-=1){if(cinfo[a]!=="comment"){break;}}if(a===-1){return level.push(0);}else if(cinfo[a]==="start"){return level.push(level[k]+1);}else if(cinfo[i]==="start"&&level[a]==="x"){for(m=a-1;m>-1;m-=1){if(level[m]!=="x"){if(cinfo[a]==="end"){return level.push(level[m]);}else{return level.push(level[m]+1);}}}}else{return level.push(level[k]);}}else if(cinfo[i-1]==="comment"&&level[i-1]!=="x"){return level.push(level[i-1]);}else if((cinfo[k]==="start"&&level[k]==="x")||(cinfo[k]!=="mixed_end"&&cinfo[k]!=="mixed_both"&&level[k]==="x")){if(level[i-1]==="x"&&cinfo[i-1]!=="start"&&build[i-1].charAt(build[i-1].length-1)!==" "&&build[i].charAt(0)!==" "){return level.push("x");}else{return p();}}else if((cinfo[m]==="mixed_start"||cinfo[m]==="content")&&cinfo[l]==="end"&&(cinfo[k]==="mixed_end"||cinfo[k]==="mixed_both")){return b();}else if(cinfo[k]==="end"&&level[k]!=="x"&&(cinfo[k-1]!=="start"||(cinfo[k-1]==="start"&&level[k-1]!=="x"))){return level.push(level[k]);}else if(cinfo[m]!=="mixed_start"&&cinfo[m]!=="content"&&(cinfo[k]==="mixed_end"||cinfo[k]==="mixed_both")){l=0;p=0;m=0;for(a=k;a>0;a-=1){if(cinfo[a]==="end"){l=1;}if(cinfo[a]==="start"){p+=1;}if(level[a]===0&&a!==0){m=a;}if(cinfo[k]==="mixed_both"&&level[a]!=="x"){return level.push(level[a]);}else if(cinfo[a]!=="comment"&&cinfo[a]!=="content"&&cinfo[a]!=="external"&&cinfo[a]!=="mixed_end"&&level[a]!=="x"){if((cinfo[a]!=="start"&&(cinfo[i-1]==="mixed_end"||cinfo[i-1]==="content"))||(cinfo[a-1]==="end"&&level[a-1]!=="x"&&cinfo[a-2]!=="start"&&level[a-2]!=="x")){if((level[a]===level[a-1]&&cinfo[a-1]!=="end"&&level[a+1]!=="x")||(cinfo[i-2]==="start"&&level[i-2]!=="x"&&level[i-1]==="x")){return level.push(level[a]+1);}else if(p<=1){return level.push(level[a]);}}else if(l===1){if(p>1){if(m!==0){k=0;for(m;m<i;m+=1){if(cinfo[m]==="start"){k+=1;}else if(cinfo[m]==="end"){k-=1;}}return level.push(level[a]+k);}else{return level.push(level[a]+1);}}else{return level.push(level[a]);}}else{return level.push(level[a]+p);}}}}else if(cinfo[k]==="start"&&level[k]!=="x"){for(a=i-1;a>-1;a-=1){if(cinfo[a]!=="comment"&&cinfo[a]!=="content"&&cinfo[a]!=="external"&&cinfo[a]!=="mixed_end"){if(cinfo[i+1]&&build[i].charAt(0)!==" "&&(cinfo[i+1]==="content"||cinfo[i+1]==="mixed_end")){return level.push("x");}else{return level.push(level[a]+1);}}}return level.push(0);}else{return b();}},h=function(){var z;if(cinfo[i]!=="start"&&level[i-1]==="x"&&cinfo[i-1]!=="content"&&build[i].charAt(0)!==" "&&cinfo[i-1]!=="mixed_start"&&cinfo[i-1]!=="mixed_end"){return level.push("x");}else if(cinfo[i]!=="start"&&build[i]===" "){build[i]="";return level.push("x");}else{if(cinfo[i-1]!=="comment"){f(i);}else{for(z=i-1;z>0;z-=1){if(cinfo[z]!=="comment"){break;}}f(z+1);}}};for(i=0;i<loop;i+=1){if(i===0){level.push(0);}else if(cinfo[i]==="comment"&&indent_comment!=='noindent'){h();}else if(cinfo[i]==="comment"&&indent_comment==='noindent'){level.push(0);}else if(cinfo[i]==="external"){level.push(0);if(token[i-1]==="T_script"){build[i]=js_beautify(build[i],{indent_size:indent_size,indent_char:indent_character});}else if(token[i-1]==="T_style"){build[i]=cleanCSS(build[i],indent_size,indent_character);}}else if(cinfo[i]==="content"){level.push("x");}else if(cinfo[i]==="parse"){h();}else if(cinfo[i]==="server"){h();}else if(cinfo[i]==="mixed_both"){h();}else if(cinfo[i]==="mixed_start"){h();}else if(cinfo[i]==="mixed_end"){build[i]=build[i].slice(0,build[i].length-1);level.push("x");}else if(cinfo[i]==="start"){h();}else if(cinfo[i]==="end"){e();}else if(cinfo[i]==="singleton"){h();}}}()),write_tabs=(function(){var a,indent='',tab_math=function(x){for(a=0;a<level[i];a+=1){indent+=tab;}if(cinfo[i]==="mixed_both"){x=x.slice(0,x.length-1);}x="\n"+indent+x;indent='';return x;},end_math=function(x){var b;if(cinfo[i-1]!=="start"){for(b=i;b>0;b-=1){if(level[b]!=="x"){break;}}for(a=1;a<level[b]+1;a+=1){indent+=tab;}x="\n"+indent+x;indent='';}return x;},script_math=function(x){var b,c;a=0;if(level[i-1]==="x"){for(b=i-1;b>0;b-=1){if(cinfo[b]==="start"){a+=1;}else if(cinfo[b]==="end"){a-=1;}if(level[b]!=="x"){break;}}if(cinfo[b]==="end"){a+=1;}for(c=0;c<level[b]+a;c+=1){indent+=tab;}}else{for(c=0;c<level[i-1]+1;c+=1){indent+=tab;}}x="\n"+indent+x.replace(/\n/g,"\n"+indent);indent='';return x;};loop=build.length;for(i=1;i<loop;i+=1){if(cinfo[i]==="end"&&(cinfo[i-1]!=="content"&&cinfo[i-1]!=="mixed_start")){if(build[i].charAt(0)===" "){build[i]=build[i].substr(1);}if(level[i]!=="x"){build[i]=end_math(build[i]);}}else if(cinfo[i]==="external"&&indent_script===true){build[i]=script_math(build[i]);}else if(level[i]!=="x"&&(cinfo[i-1]!=="content"&&cinfo[i-1]!=="mixed_start")){if(build[i].charAt(0)===" "){build[i]=build[i].substr(1);}build[i]=tab_math(build[i]);}}}());markup_summary=function(){var a,b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c,d=build.join("").length.toString().split("").reverse(),e=source.length.toString().split("").reverse(),f,g,h,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],j,k,l,m=[],n,z=cinfo.length;for(a=0;a<z;a+=1){switch(cinfo[a]){case"end":b[1]+=1;i[1]+=summary[a].length;break;case"singleton":b[2]+=1;i[2]+=summary[a].length;if(((build[a].indexOf("<embed ")!==-1||build[a].indexOf("<img ")!==-1||build[a].indexOf("<iframe ")!==-1)&&(build[a].indexOf("src")!==-1&&build[a].indexOf("src=\"\"")===-1&&build[a].indexOf("src=''")===-1))||(build[a].indexOf("<link ")!==-1&&build[a].indexOf("rel")!==-1&&build[a].indexOf("canonical")===-1)){m.push(build[a]);}break;case"comment":b[3]+=1;i[3]+=summary[a].length;break;case"content":b[4]+=1;i[4]+=summary[a].length;break;case"mixed_start":b[5]+=1;i[5]+=summary[a].length;break;case"mixed_end":b[6]+=1;i[6]+=summary[a].length;break;case"mixed_both":b[7]+=1;i[7]+=summary[a].length;break;case"parse":b[10]+=1;i[10]+=summary[a].length;break;case"server":b[14]+=1;i[14]+=summary[a].length;break;case"external":b[17]+=1;i[17]+=summary[a].length;if(((build[a].indexOf("<sc")!==-1||build[a].indexOf("<embed ")!==-1||build[a].indexOf("<img ")!==-1||build[a].indexOf("<iframe ")!==-1)&&(build[a].indexOf("src")!==-1&&build[a].indexOf("src=\"\"")===-1&&build[a].indexOf("src=''")===-1))||(build[a].indexOf("<link ")!==-1&&build[a].indexOf("rel")!==-1&&build[a].indexOf("canonical")===-1)){m.push(build[a]);}break;}switch(token[a]){case"T_tag_start":b[0]+=1;i[0]+=summary[a].length;if(((build[a].indexOf("<embed ")!==-1||build[a].indexOf("<img ")!==-1||build[a].indexOf("<iframe ")!==-1)&&(build[a].indexOf("src")!==-1&&build[a].indexOf("src=\"\"")===-1&&build[a].indexOf("src=''")===-1))||(build[a].indexOf("<link ")!==-1&&build[a].indexOf("rel")!==-1&&build[a].indexOf("canonical")===-1)){m.push(build[a]);}break;case"T_sgml":b[8]+=1;i[8]+=summary[a].length;break;case"T_xml":b[9]+=1;i[9]+=summary[a].length;break;case"T_ssi":b[11]+=1;i[11]+=summary[a].length;break;case"T_asp":b[12]+=1;i[12]+=summary[a].length;break;case"T_php":b[13]+=1;i[13]+=summary[a].length;break;case"T_script":b[15]+=1;i[15]+=summary[a].length;if(build[a].indexOf(" src")!==-1){m.push(build[a]);}break;case"T_style":b[16]+=1;i[16]+=summary[a].length;break;}}f=[b[0]+b[1]+b[2]+b[3],b[4]+b[5]+b[6]+b[7],b[15]+b[16]+b[17]];j=[i[0]+i[1]+i[2]+i[3],i[4]+i[5]+i[6]+i[7],i[15]+i[16]+i[17]];g=[f[0],f[0],f[0],f[0],f[1],f[1],f[1],f[1],b[10],b[10],b[10],b[14],b[14],b[14],b[14],f[2],f[2],f[2]];k=[j[0],j[0],j[0],j[0],j[1],j[1],j[1],j[1],i[10],i[10],i[10],i[14],i[14],i[14],i[14],j[2],j[2],j[2]];c=["*** Start Tags","End Tags","Singleton Tags","Comments","Flat String","String with Space at Start","String with Space at End","String with Space at Start and End","SGML","XML","Total Parsing Declarations","SSI","ASP","PHP","Total Server Side Tags","*** Script Tags","*** Style Tags","JavaScript/CSS Code"];z=c.length;for(a=0;a<z;a+=1){if(g[a]===0){h="0.00%";}else if(b[a]===g[a]){h="100.00%"}else{h=((b[a]/ g[a])*100).toPrecision(2)+"%";}if(k[a]===0){l="0.00%";}else if(i[a]===k[a]){l="100.00%"}else{l=((i[a]/ k[a])*100).toPrecision(2)+"%";}c[a]="<tr><th>"+c[a]+"</th><td>"+b[a].toString()+"</td><td>"+h+"</td><td>"+((b[a]/ cinfo.length)*100).toPrecision(2)+"%</td><td>"+i[a]+"</td><td>"+l+"</td><td>"+((i[a]/ summary.join("").length)*100).toPrecision(2)+"%</td></tr>";}g=function(x){if(f[x]===0){return"0.00%";}else{return"100.00%";}};k=function(x){if(j[x]===0){return"0.00%";}else{return"100.00%";}};h=function(x){var y,z;switch(x){case 0:if((f[x]/ cinfo.length)<0.7){y="bad";}else{y="good";}if((j[x]/ summary.join("").length)>0.4){z="bad";}else{z="good";}break;case 1:if((f[x]/ cinfo.length)<0.25){y="bad";}else{y="good";}if((j[x]/ summary.join("").length)<0.6){z="bad";}else{z="good";}break;case 2:if((f[x]/ cinfo.length)>0.05){y="bad";}else{y="good";}if((j[x]/ summary.join("").length)>0.05){z="bad";}else{z="good";}break;}return"</th><td>"+f[x]+"</td><td>"+g(x)+"</td><td class='"+y+"'>"+((f[x]/ cinfo.length)*100).toPrecision(2)+"%</td><td>"+j[x]+"</td><td>"+k(x)+"</td><td class='"+z+"'>"+((j[x]/ summary.join("").length)*100).toPrecision(2)+"%</td></tr>";};n=[];z=m.length;for(a=0;a<z;a+=1){n[a]="<li>"+m[a].replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;")+"</li>";}if(n.length>0){n="<h4>HTML elements making HTTP requests:</h4><ul>"+n.join("")+"</ul>";}else{n="";}c.splice(18,0,"<tr><th>Total Script and Style Tags/Code"+h(2));c.splice(15,0,"<tr><th colspan='7'>Style and Script Code/Tags</th></tr>");c.splice(11,0,"<tr><th colspan='7'>Server Side Tags</th></tr>");c.splice(8,0,"<tr><th>Total Content"+h(1)+"<tr><th colspan='7'>Parsing Declarations</th></tr>");c.splice(4,0,"<tr><th>Total Common Tags"+h(0)+"<tr><th colspan='7'>Content</th></tr>");c.splice(0,0,"<div id='doc'><table id='markup_analysis'><caption>Analysis of markup pieces.</caption><thead><tr><th>Type</th><th>Quantity of Tags</th><th>Percentage Quantity in Section</th><th>Percentage Quantity of Total</th><th>** Character Size</th><th>Percentage Size in Section</th><th>Percentage Size of Total</th></tr></thead><tbody><tr><th>Total Pieces</th><td>"+cinfo.length+"</td><td>100.00%</td><td>100%</td><td>"+summary.join("").length+"</td><td>100%</td><td>100%</td></tr><tr><th colspan='7'>Common Tags</th></tr>");c.push("</tbody></table></div><p>* The number of requests is determined from the input submitted only and does not count the additional HTTP requests supplied from dynamically executed code, frames, iframes, css, or other external entities.</p><p>** Character size is measured from the individual pieces of tags and content spcifically between minification and beautification.</p><p>*** The number of starting &lt;script&gt; and &lt;style&gt; tags is subtracted from the total number of start tags. The combination of those three values from the table above should equal the number of end tags or the code is in error.</p>"+n);if(b[0]+b[15]+b[16]!==b[1]){n="s";a=(b[0]+b[15]+b[16])-b[1];if(a>0){if(a===1){n="";}a=a+" more start tag"+n+" than end tag"+n+"! ";}else{if(a===-1){n="";}a=(a*-1)+" more end tag"+n+" than start tag"+n+"! ";}c.splice(0,0,"<p><em>"+a+"The combined total number of start tags, script tags, and style tags should equal the number of end tags. For HTML try the 'Presume SGML type HTML' option.</em></p>");}n=(summary.join("").length / 7500).toFixed(0);if(n>0){n=(m.length-n)*4;}else{n=0;}if(j[1]===0){f[1]=0.00000001;j[1]=0.00000001;}b=(((f[0]+f[2]-n)/ cinfo.length)/(f[1]/ cinfo.length));a=function(x,y){return(((j[0]+x)/ summary.join("").length)/((j[1]*y)/ summary.join("").length));};k=(b / a(j[2],1)).toPrecision(2);l=(b / a(i[15],1)).toPrecision(2);g=(b / a(j[2],4)).toPrecision(2);h=(b / a(i[15],4)).toPrecision(2);if(k===l){l="";h="";}else{l=", or <strong>"+l+"</strong> if inline script code and style tags are removed";h=", or <strong>"+h+"</strong> if inline script code and style tags are removed";}c.splice(0,0,"<p>If the input is content it receives an efficiency score of <strong>"+k+"</strong>"+l+". The efficiency score if this input is a large form or application is <strong>"+g+"</strong>"+h+". Efficient markup achieves scores higher than 2.00 and excellent markup achieves scores higher than 4.00. The score reflects the highest number of tags to pieces of content where the weight of those tags is as small as possible compared to the weight of the content. The score is a performance metric only and is not associated with validity or well-formedness, but semantic code typically achieves the highest scores. All values are rounded to the nearest hundreth.</p>");z=d.length;for(a=2;a<z;a+=3){d[a]=","+d[a];}z=e.length;for(a=2;a<z;a+=3){e[a]=","+e[a];}d=d.reverse().join("");e=e.reverse().join("");if(d.charAt(0)===","){d=d.slice(1,d.length);}if(e.charAt(0)===","){e=e.slice(1,e.length);}c.splice(0,0,"<p><strong>Total input size:</strong> <em>"+e+"</em> characters</p><p><strong>Total output size:</strong> <em>"+d+"</em> characters</p><p><strong>* Total number of HTTP requests in supplied HTML:</strong> <em>"+m.length+"</em></p>");return c.join("");};return build.join("");},charcomp=function(c,d){var i,j,k=0,n,p,r=0,ax,bx,zx,em=new RegExp(/<em>/g),entity,compare,a=c.innerHTML.replace(/\&nbsp;/g," "),b=d.innerHTML.replace(/\&nbsp;/g," ");a=a.replace(/\'/g,"$#39;").replace(/\"/g,"$#34;");b=b.replace(/\'/g,"$#39;").replace(/\"/g,"$#34;");if(a===b){return;}else{ax=a.split('');bx=b.split('');if(ax.length>=bx.length){zx=ax.length;}else if(bx.length>ax.length){zx=bx.length;}entity=function(z){for(n=k;n<zx;n+=1){if(z[n]+z[n+1]+z[n+2]+z[n+3]==="&gt;"){z[n]='&gt;';z.splice(n+1,3);}else if(z[n]+z[n+1]+z[n+2]+z[n+3]==="&lt;"){z[n]='&lt;';z.splice(n+1,3);}else if(z[n]+z[n+1]+z[n+2]+z[n+3]+z[n+4]+z[n+5]==="&nbsp;"){z[n]=' ';z.splice(n+1,5);}else if(z[n]+z[n+1]+z[n+2]+z[n+3]+z[n+4]==="$#34;"){z[n]="&#34;";z.splice(n+1,4);}else if(z[n]+z[n+1]+z[n+2]+z[n+3]+z[n+4]==="$#39;"){z[n]="&#39;";z.splice(n+1,4);}}};entity(ax);entity(bx);for(i=0;i<zx;i+=1){if(ax[i]==="&"&&bx[i]!=="&"){bx.splice(i,0,"","","","");}else if(bx[i]==="&"&&ax[i]!=="&"){ax.splice(i,0,"","","","");}}compare=function(){for(i=k;i<zx;i+=1){if(ax[i]===bx[i]){r=i;}else{if(ax[i]!==bx[i]&&em.test(ax[i])===false&&em.test(bx[i])===false&&em.test(ax[i-1])===false&&em.test(bx[i-1])===false){if(ax[i]!==undefined&&bx[i]!==undefined){ax[i]="<em>"+ax[i];bx[i]="<em>"+bx[i];}else if(ax[i]===undefined&&bx[i]!==undefined){ax[i]="<em> ";bx[i]="<em>"+bx[i];}else if(ax[i]!==undefined&&bx[i]===undefined){ax[i]="<em>"+ax[i];bx[i]="<em> ";}n=1;}else if(ax[i]===undefined&&(bx[i]===''||bx[i]===' ')){ax[i]=' ';}else if(bx[i]===undefined&&(ax[i]===''||ax[i]===' ')){bx[i]=' ';}break;}}for(j=i+1;j<zx;j+=1){if(ax[j]===bx[j]){ax[j-1]=ax[j-1]+"</em>";bx[j-1]=bx[j-1]+"</em>";k=j;n=0;break;}else if(ax[j]!==undefined&&bx[j]===undefined){bx[j]=" ";}else if(ax[j]===undefined&&bx[j]!==undefined){ax[j]=" ";}}if(j===zx&&n===1){if(ax[j-1].indexOf("</em>")===-1){ax[ax.length-1]=ax[ax.length-1]+"</em>";}if(bx[j-1].indexOf("</em>")===-1){bx[bx.length-1]=bx[bx.length-1]+"</em>";}}};for(p=0;p<zx;p+=1){if(r+1!==zx){compare();}}c.innerHTML=ax.join('');d.innerHTML=bx.join('');}},linediff=function(){var q,row=diffdiv.getElementsByTagName('tr'),cell=[];for(q=0;q<row.length;q+=1){cell=row[q].getElementsByTagName('td');if(cell.length!==0){if(side.checked){if(cell[0].className==='replace'&&cell[1].className==='replace'){charcomp(cell[0],cell[1]);}}else if(inline.checked){if(cell[0].className==='delete'&&row[q+1].getElementsByTagName('td')[0].className==='insert'){charcomp(cell[0],row[q+1].getElementsByTagName('td')[0]);q+=1;}}}}},calc_indent=(function(){if(mb.checked){if(bs.checked){zc=" ";}else if(ba.checked){zc="\t";}else if(bz.checked){zc="\n";}else if(bw.checked&&bv.value!==""){zc=bv.value;}else{zc=" ";}if(Number(by.value)!==Number(by.value)||(Number(by.value)===0&&by.value!=="0")){zs="4";}else{zs=Number(by.value);}}else if(md.checked){if(ds.checked){zc=" ";}else if(da.checked){zc="\t";}else if(dz.checked){zc="\n";}else if(dw.checked&&dv.value!==""){zc=dv.value;}else{zc=" ";}if(Number(dy.value)!==Number(dy.value)||(Number(dy.value)===0&&by.value!=="0")){zs="4";}else{zs=Number(dy.value);}}}()),beautype=function(x,y){if(x.value===""||x.value===err||spacetest.exec(x.value)!==null){x.value=err;y.value=err1;}else if(css.checked){y.value=cleanCSS(x.value,zs,zc,bc);}else if(csv.checked){y.value=csvbeauty(x.value,csvchar);}else if(markup.checked){y.value=markup_beauty(x.value,zs,zc,bc,ins,ht);y.value=y.value.replace(/\n[\t]* \/>/g,'');}else if(ptext.checked){y.value=x.value;}else{y.value=js_beautify(x.value,{indent_size:zs,indent_char:zc,indent_comm:bc});}},minitype=function(x,y){var sizediff=function(){var a,b=0,c=x.value.split('');for(a=0;a<c.length;a+=1){if(c[a]==="\n"){b+=1;}}is.value=x.value.replace(/\r/g,'').length;ws.value=x.value.replace(/\r/g,'').length+b;os.value=y.value.length;ud.value=String(Number(is.value)-Number(os.value));wd.value=String(Number(ws.value)-Number(os.value));ii.value=String(Number(ws.value)-Number(is.value)+1);rs.value=String(100-(Math.round((Number(os.value)/ Number(is.value))*10000))/ 100).slice(0,5)+"%";xs.value=String(100-(Math.round((Number(os.value)/ Number(ws.value))*10000))/ 100).slice(0,5)+"%";};if(x.value===""||x.value===err||spacetest.exec(x.value)!==null){x.value=err;y.value=err1;is.value="";os.value="";rs.value="";}else if(css.checked){y.value=jsmin('',x.value,3,'css',mslop);sizediff();}else if(csv.checked){y.value=csvmin(x.value,csvchar);sizediff();}else if(markup.checked){y.value=markupmin(x.value,mslop);sizediff();}else if(ptext.checked){y.value=x.value;is.value="";os.value="";rs.value="";}else{y.value=jsmin('',x.value,3,'javascript',mslop);sizediff();}},difftype=function(x,y){if(x.value===""||x.value===err||spacetest.exec(x.value)!==null){x.value=err;y.value=err1;}else if(css.checked){y.value=jsmin('',x.value,3,'css',dslop);y.value=cleanCSS(y.value,zs,zc,bc);}else if(csv.checked){y.value=csvmin(x.value,csvchar);y.value=csvbeauty(x.value,csvchar);}else if(markup.checked){y.value=markup_beauty(x.value,zs,zc,bc,ins,htd);y.value=y.value.replace(/\n[\t]* \/>/g,'');}else if(ptext.checked){y.value=x.value;}else{y.value=jsmin('',x.value,3,'javascript',dslop);y.value=js_beautify(y.value,{indent_size:zs,indent_char:zc,indent_comm:bc});}},funcdiff=(function(){diffdiv.style.display="none";if(mm.checked){minitype(mi,mo);diffdiv.innerHTML="";proctime();}else if(md.checked){difftype(bt,bo);difftype(nt,no);}else{beautype(bi,bd);if(markup.checked){diffdiv.innerHTML=markup_summary();}else if(css.checked){diffdiv.innerHTML=css_summary();}else if(javascript.checked){diffdiv.innerHTML=js_summary();}proctime();}if(bo.value===err1||no.value===err1||!md.checked){return;}else{var base=difflib.stringAsLines(bo.value),newtxt=difflib.stringAsLines(no.value),sm=new difflib.SequenceMatcher(base,newtxt),opcodes=sm.get_opcodes(),contextSize=$("contextSize").value;if(bl.value===""||spacetest.exec(bl.value)!==null){bn="Base Text";}else{bn=bl.value;}if(nl.value===""||spacetest.exec(nl.value)!==null){nn="New Text";}else{nn=nl.value;}contextSize=contextSize?contextSize:null;diffdiv.innerHTML='';diffdiv.innerHTML="<p>Accessibility note.  &lt;em&gt; tags in the output represent character differences per lines compared.</p>"+(diffview.buildView({baseTextLines:base,newTextLines:newtxt,opcodes:opcodes,baseTextName:bn,newTextName:nn,contextSize:contextSize,viewType:inline.checked?1:0}));location.href=url+"#diffoutput";linediff();}if(ps.checked===false){diffdiv.style.display="block";proctime();}else{savewindow=(function(){var w,c;c='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><title>Pretty Diff - The difference tool</title><meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"/><meta http-equiv="Content-Style-Type" content="text/css"/><style type="text/css">body{background-color:#a8b8c8;color:#000;font-family:"Arial";font-size:10px;}button{display:block;font-size:2em;font-weight:bold;margin:1em auto;padding:1em 2em;}button:hover{background:#ccf;}button:active{background:#c00;}h1{font-size:2em;}h1 span{color:#c00;font-size:.5em;}p{clear:both;font-size:1.2em;margin-top:.2em;}#diffoutput{width:100%;}p em{color:#c00;font-weight:bold;}table.diff{border-collapse:collapse;border:.1em solid darkgray;font-size:1em;white-space:pre;}table.diff tbody{font-family:"Courier New",Courier,"Lucida Console",monospace;font-size:1.1em;}table.diff tbody th{font-family:verdana,arial,"Bitstream Vera Sans",helvetica,sans-serif;background:#eed;font-weight:normal;border:.1em solid #bbc;color:#886;padding:.5em .6em 0em 2.4em;text-align:right;vertical-align:top;}table.diff thead{border-bottom:.1em solid #bbc;background:#efefef;font-family:Verdana;}table.diff thead th.texttitle{text-align:left;}table.diff tbody td{letter-spacing:.1em;padding:.5em .5em 0em .5em;vertical-align:top;}table.diff tbody td em{font-style:normal;padding:.05em 0em;margin:0-.09em;}table.diff .empty{background-color:#ddd;}table.diff .replace{background-color:#fd8;}table.diff .replace em{background-color:#ffc;border:.1em solid #cc3;}table.diff .delete{background-color:#e99;}table.diff .delete em{background-color:#fcf;border:.1em solid #900;}table.diff .equal{background-color:#fff;}table.diff .skip{background-color:#efefef;border:.1em solid #aaa;border-right:.1em solid #bbc;}table.diff .insert{background-color:#9e9;}table.diff .insert em{background-color:#ef9;border:1px solid #090;}table.diff th.author{text-align:right;border-top:.1em solid #bbc;background:#efefef;}@media print{html{font-size:.8em;}html table.diff{font-size:.8em;white-space:normal;}}</style></head><body><h1><a href="http://prettydiff.com/">Pretty Diff - The difference tool</a></h1>'+errorcount()+diffdiv.innerHTML+'</body></html>';w=this.open('','diffsave','menubar=yes,toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,width=800,height=800');w.document.write(c);}());}}());},prettyvis=function(a){var bt=$('diffBase'),nt=$('diffNew'),bd=$('Beautify'),md=$('Minify'),dops=$('diffops'),mops=$('miniops'),bops=$('beauops'),dqp=$('diffquanp'),dqt=$('difftypep'),bi=$('beautyinput'),mi=$('minifyinput'),bo=$('baseText'),b=a.getAttribute('id'),js=$('ctype-javascript'),cs=$('ctype-css'),cv=$('ctype-csv'),mk=$('ctype-markup'),pt=$('ctype-text'),dj=$('diffjsop'),ins=$('scriptindent'),ind=$('scriptindentd'),ht=$('htmlspecific'),htd=$('htmlspecificd'),optioncheck=function(){js.disabled=false;if(pt.checked){js.checked=true;}cs.disabled=false;cv.disabled=false;mk.disabled=false;pt.disabled=true;pt.checked=false;};switch(b){case"modebeautify":optioncheck();if(bi.value===""&&mi.value!==""){bi.value=mi.value;}else if(bi.value===""&&bo.value!==""){bi.value=bo.value;}bt.style.display="none";nt.style.display="none";bd.style.display="block";md.style.display="none";dops.style.display="none";mops.style.display="none";if(cv.checked){bops.style.display="none";}else{bops.style.display="block";}if(mk.checked){ins.style.display="block";ht.style.display="block";}else{ins.style.display="none";ht.style.display="none";}break;case"modeminify":optioncheck();if(mi.value===""&&bi.value!==""){mi.value=bi.value;}else if(mi.value===""&&bo.value!==""){mi.value=bo.value;}bt.style.display="none";nt.style.display="none";bd.style.display="none";md.style.display="block";dops.style.display="none";bops.style.display="none";if(js.checked||mk.checked){mops.style.display="block";}else{mops.style.display="none";}break;case"modediff":js.disabled=false;cs.disabled=false;cv.disabled=false;mk.disabled=false;pt.disabled=false;if(bo.value===""&&bi.value!==""){bo.value=bi.value;}else if(bo.value===""&&mi.value!==""){bo.value=mi.value;}bt.style.display="block";nt.style.display="block";bd.style.display="none";md.style.display="none";dops.style.display="block";mops.style.display="none";bops.style.display="none";if(js.checked||mk.checked){dj.style.display="block";}else{dj.style.display="none";}if(mk.checked){ind.style.display="block";htd.style.display="block";}else{ind.style.display="none";htd.style.display="none";}if(cv.checked||pt.checked){dqp.style.display="none";dqt.style.display="none";}else{dqp.style.display="block";dqt.style.display="block";}break;case"diffwide":bt.className="diffwide";nt.className="diffwide";bd.className="wide";md.className="wide";break;case"difftall":bt.className="difftall";nt.className="difftall";bd.className="tall";md.className="tall";break;}},reload=function(){var db=$('diffbeautify'),op=$('ctype-text'),bt=$('diffBase'),nt=$('diffNew'),bd=$('Beautify'),md=$('Minify'),dops=$('diffops'),mops=$('miniops'),bops=$('beauops'),mm=$('modeminify'),dd=$('modediff'),bb=$('modebeautify'),dt=$('difftall'),csv=$('ctype-csv'),js=$('ctype-javascript'),mk=$('ctype-markup'),csvp=$('csvcharp'),ins=$('scriptindent'),ind=$('scriptindentd'),ht=$('htmlspecific'),htd=$('htmlspecificd'),bx=$('beau-other'),dx=$('diff-other'),bc=$('beau-char'),dc=$('diff-char');if(csv.checked){csvp.style.display="block";}if(mm.checked){bd.style.display="none";md.style.display="block";bops.style.display="none";if(mk.checked||js.checked){mops.style.display="block";}else{mops.style.display="none";}}else if(dd.checked){bd.style.display="none";bt.style.display="block";nt.style.display="block";dops.style.display="block";bops.style.display="none";if(op.checked){db.style.display="none";}else{db.style.display="block";}if(mk.checked){ind.style.display="block";htd.style.display="block";}else{ind.style.display="none";htd.style.display="none";}}else if(bb.checked){if(mk.checked){ins.style.display="block";ht.style.display="block";}else{ins.style.display="none";ht.style.display="none";}}if(dt.checked){bt.className="difftall";nt.className="difftall";bd.className="tall";md.className="tall";}if(bx.checked){bc.style.background="#eef8ff";}if(dx.checked){dc.style.background="#eef8ff";}},codeOps=function(x){var diffbeautify=$('diffbeautify'),csvp=$('csvcharp'),ins=$('scriptindent'),ind=$('scriptindentd'),csvo=$('ctype-csv'),js=$('ctype-javascript'),mk=$('ctype-markup'),pt=$('ctype-text'),dj=$('diffjsop'),dqp=$('diffquanp'),dqt=$('difftypep'),mo=$('modeminify'),bo=$('modebeautify'),di=$('modediff'),mops=$('miniops'),bops=$('beauops'),ht=$('htmlspecific'),htd=$('htmlspecificd');if(mo.checked){if(js.checked||mk.checked){mops.style.display="block";}else{mops.style.display="none";}}else if(di.checked){if(csvo.checked||pt.checked){dqp.style.display="none";dqt.style.display="none";}else{dqp.style.display="block";dqt.style.display="block";}if(js.checked||mk.checked){dj.style.display="block";}else{dj.style.display="none";}if(mk.checked){ind.style.display="block";htd.style.display="block";}else{ind.style.display="none";htd.style.display="none";}}else if(bo.checked){if(mk.checked){ins.style.display="block";ht.style.display="block";}else{ins.style.display="none";ht.style.display="none";}if(csvo.checked){csvp.style.display="block";bops.style.display="none";}else{csvp.style.display="none";bops.style.display="block";}}if(x===false){diffbeautify.style.display="block";}else{diffbeautify.style.display="none";}},indentchar=function(x){var mb=$('modebeautify'),md=$('modediff'),bx=$('beau-other'),dx=$('diff-other'),bc=$('beau-char'),dc=$('diff-char');if(mb.checked&&x==="beau-char"){bx.checked=true;}else if(md.checked&&x==="diff-char"){dx.checked=true;}if(bx.checked){bc.style.background="#eef8ff";}else{bc.style.background="#eee";}if(dx.checked){dc.style.background="#eef8ff";}else{dc.style.background="#eee";}};