a,c){if(g.hasOwnProperty(b))c(null,g[b]);else{vard=newXMLHttpRequest;d.open("GET",b,true);d.onreadystatechange=function(){varf;d.readyState===4&&(d.status===0&&!d.responseText?c("File "+b+" is empty."):d.status===200||d.status===0?(f=a==="binary"?typeofVBArray!=="undefined"?(newVBArray(d.responseBody)).toArray():e.byteArrayFromString(d.responseText,"binary"):d.responseText,g[b]=f,c(null,f)):c(d.responseText||d.statusText))};d.overrideMimeType&&(a!=="binary"?d.overrideMimeType("text/plain; charset="+
a):d.overrideMimeType("text/plain; charset=x-user-defined"));try{d.send(null)}catch(f){c(f.message)}}};this.read=function(b,a,c,d){if(g.hasOwnProperty(b))d(null,g[b].slice(a,a+c));else{varf=newXMLHttpRequest;f.open("GET",b,true);f.onreadystatechange=function(){varj;f.readyState===4&&(f.status===0&&!f.responseText?d("File "+b+" is empty."):f.status===200||f.status===0?(j=typeofVBArray!=="undefined"?(newVBArray(f.responseBody)).toArray():e.byteArrayFromString(f.responseText,"binary"),g[b]=j,d(null,
c){g[b]=a;vard=newXMLHttpRequest;d.open("PUT",b,true);d.onreadystatechange=function(){d.readyState===4&&(d.status===0&&!d.responseText?c("File "+b+" is empty."):d.status>=200&&d.status<300||d.status===0?c(null):c("Status "+String(d.status)+": "+d.responseText||d.statusText))};a=a.buffer&&!d.sendAsBinary?a.buffer:e.byteArrayToString(a,"binary");try{d.sendAsBinary?d.sendAsBinary(a):d.send(a)}catch(f){e.log("HUH? "+f+" "+a),c(f.message)}};this.deleteFile=function(b,a){varc=newXMLHttpRequest;c.open("DELETE",
b,true);c.onreadystatechange=function(){c.readyState===4&&(c.status<200&&c.status>=300?a(c.responseText):a(null))};c.send(null)};this.loadXML=function(b,a){varc=newXMLHttpRequest;c.open("GET",b,true);c.overrideMimeType("text/xml");c.onreadystatechange=function(){c.readyState===4&&(c.status===0&&!c.responseText?a("File "+b+" is empty."):c.status===200||c.status===0?a(null,c.responseXML):a(c.responseText))};try{c.send(null)}catch(d){a(d.message)}};this.isFile=function(b,a){e.getFileSize(b,function(b){a(b!==
c(null,a)):c(a+" is not a file.")};this.writeFile=function(a,h,c){vara=newPackages.java.io.FileOutputStream(a),d,f=h.length;for(d=0;d<f;d+=1)a.write(h[d]);a.close();c(null)};this.deleteFile=function(a,h){(newPackages.java.io.File(a))["delete"]()?h(null):h("Could not delete "+a)};this.read=function(b,h,c,d){a&&(b=a+"/"+b);varf;f=b;varj="binary";(newPackages.java.io.File(f)).isFile()?(j==="binary"&&(j="latin1"),f=readFile(f,j)):f=null;f?d(null,this.byteArrayFromString(f.substring(h,h+c),"binary")):
runtime.readFileSync(j[g]+"/manifest.js","utf8"))&&b.length)try{e[f]=eval(b)}catch(i){e[f]=null,runtime.log("Cannot load manifest for "+f+".")}elsee[f]=null;b=null;if((f=e[f])&&f.indexOf&&f.indexOf(d)!==-1)try{b=runtime.readFileSync(j[g]+"/"+d,"utf8")}catch(l){throwruntime.log("Error loading "+a+" "+l),l;}}if(b===void0)throw"Cannot load class "+a;try{b=eval(a+" = eval(code);")}catch(k){throwruntime.log("Error loading "+a+" "+k),k;}returnb}(g),!b||Runtime.getFunctionName(b)!==a[a.length-1]))throwruntime.log("Loaded code is not for "+
a[a.length-1]),"Loaded code is not for "+a[a.length-1];k[g]=true}}})();
core.UnitTestRunner=function(){functioni(a){g+=1;runtime.log("fail",a)}functionk(a,b){vare;try{if(a.length!==b.length)returnfalse;for(e=0;e<a.length;e+=1)if(a[e]!==b[e])returnfalse}catch(c){returnfalse}returntrue}functione(a,b,e){(typeofb!=="string"||typeofe!=="string")&&runtime.log("WARN: shouldBe() expects string arguments");varc,d;try{d=eval(b)}catch(f){c=f}a=eval(e);c?i(b+" should be "+a+". Threw exception "+c):(a===0?d===a&&1/d===1/a:d===a||(typeofa==="number"&&isNaN(a)?typeofd===
"number"&&isNaN(d):Object.prototype.toString.call(a)===Object.prototype.toString.call([])&&k(d,a)))?runtime.log("pass",b+" is "+e):typeofd===typeofa?i(b+" should be "+a+". Was "+(d===0&&1/d<0?"-0":String(d))+"."):i(b+" should be "+a+" (of type "+typeofa+"). Was "+d+" (of type "+typeofd+").")}varg=0;this.shouldBeNull=function(a,b){e(a,b,"null")};this.shouldBeNonNull=function(a,b){vare,c;try{c=eval(b)}catch(d){e=d}e?i(b+" should be non-null. Threw exception "+e):c!==null?runtime.log("pass",b+
" is non-null."):i(b+" should be non-null. Was "+c)};this.shouldBe=e;this.countFailedTests=function(){returng}};
core.UnitTester=function(){vari=0,k={};this.runTests=function(e,g){functiona(e){if(e.length===0)k[b]=f,i+=c.countFailedTests(),g();else{p=e[0];varj=Runtime.getFunctionName(p);runtime.log("Running "+j);l=c.countFailedTests();d.setUp();p(function(){d.tearDown();f[j]=l===c.countFailedTests();a(e.slice(1))})}}varb=Runtime.getFunctionName(e),h,c=newcore.UnitTestRunner,d=newe(c),f={},j,p,m,l;if(b.hasOwnProperty(k))runtime.log("Test "+b+" has already run.");else{runtime.log("Running "+b+": "+d.description());
1980<<25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}functionb(a,c){varb,f,d,e,j,h,i,m=this;this.load=function(c){if(m.data!==void0)c(null,m.data);else{vard=j+34+b+f+256;d+i>p&&(d=p-i);runtime.read(a,i,d,function(b,f){if(b)c(b,f);elsea:{vard=f,g=newcore.ByteArray(d),o=g.readUInt32LE(),r;if(o!==67324752)c("File entry signature is wrong."+o.toString()+" "+d.length.toString(),null);else{g.pos+=22;o=g.readUInt16LE();r=g.readUInt16LE();g.pos+=o+r;if(e){d=
d.slice(g.pos,g.pos+j);if(j!==d.length){c("The amount of compressed bytes read was "+d.length.toString()+" instead of "+j.toString()+" for "+m.filename+" in "+a+".",null);breaka}d=l(d,h)}elsed=d.slice(g.pos,g.pos+h);h!==d.length?c("The amount of bytes read was "+d.length.toString()+" instead of "+h.toString()+" for "+m.filename+" in "+a+".",null):(m.data=d,c(null,d))}}})}};this.set=function(a,c,b,f){m.filename=a;m.data=c;m.compressed=b;m.date=f};this.error=null;if(c)c.readUInt32LE()!==33639248?
this.error="Central directory entry has wrong signature at position "+(c.pos-4).toString()+' for file "'+a+'": '+c.data.length.toString():(c.pos+=6,e=c.readUInt16LE(),this.date=g(c.readUInt32LE()),c.readUInt32LE(),j=c.readUInt32LE(),h=c.readUInt32LE(),b=c.readUInt16LE(),f=c.readUInt16LE(),d=c.readUInt16LE(),c.pos+=8,i=c.readUInt32LE(),this.filename=runtime.byteArrayToString(c.data.slice(c.pos,c.pos+b),"utf8"),c.pos+=b+f+d)}functionh(a,c){if(a.length!==22)c("Central directory length should be 22.",
u);else{varf=newcore.ByteArray(a),d;d=f.readUInt32LE();d!==101010256?c("Central directory signature is wrong: "+d.toString(),u):f.readUInt16LE()!==0?c("Zip files with non-zero disk numbers are not supported.",u):f.readUInt16LE()!==0?c("Zip files with non-zero disk numbers are not supported.",u):(d=f.readUInt16LE(),m=f.readUInt16LE(),d!==m?c("Number of entries is inconsistent.",u):(d=f.readUInt32LE(),f=f.readUInt16LE(),f=p-22-d,runtime.read(i,f,p-f,function(a,f){a:{vard=newcore.ByteArray(f),e,
null,f,d;for(d=0;d<j.length;d+=1)if(f=j[d],f.filename===a){b=f;break}b?b.data?c(null,b.data):b.load(c):c(a+" not found.",null)};this.save=function(a,c,f,d){vare,g;for(e=0;e<j.length;e+=1)if(g=j[e],g.filename===a){g.set(a,c,f,d);return}g=newb(i);g.set(a,c,f,d);j.push(g)};this.write=function(a){f(0,function(b){if(b)a(b);else{varb=newcore.ByteArrayWriter("utf8"),f,e,g,h=[0];for(f=0;f<j.length;f+=1)b.appendByteArrayWriter(c(j[f])),h.push(b.getLength());g=b.getLength();for(f=0;f<j.length;f+=1)e=j[f],
b.appendByteArrayWriter(d(e,h[f]));f=b.getLength()-g;b.appendArray([80,75,5,6,0,0,0,0]);b.appendUInt16LE(j.length);b.appendUInt16LE(j.length);b.appendUInt32LE(f);b.appendUInt32LE(g);b.appendArray([0,0]);runtime.writeFile(i,b.getByteArray(),a)}})};this.getEntries=function(){returnj.slice()};p=-1;k===null?j=[]:runtime.getFileSize(i,function(a){p=a;p<0?k("File '"+i+"' cannot be read.",u):runtime.read(i,p-22,22,function(a,c){a||k===null?k(a,u):h(c,k)})})};
xmldom.RelaxNGParser=function(){functioni(a,c){this.message=function(){c&&(a+=c.nodeType===1?" Element ":" Node ",a+=c.nodeName,c.nodeValue&&(a+=" with value '"+c.nodeValue+"'"),a+=".");returna}}functionk(a){if(a.e.length<=2)returna;varc={name:a.name,e:a.e.slice(0,2)};returnk({name:a.name,e:[c].concat(a.e.slice(2))})}functione(a){vara=a.split(":",2),b="",d;a.length===1?a=["",a[0]]:b=a[0];for(dinc)c[d]===b&&(a[0]=d);returna}functiong(a,c){varj;varf;for(varb=0,d,h,i=a.name;a.e&&b<a.e.length;)if(d=
a.e[b],d.name==="ref"){h=c[d.a.name];if(!h)throwd.a.name+" was not defined.";d=a.e.slice(b+1);a.e=a.e.slice(0,b);a.e=a.e.concat(h.e);a.e=a.e.concat(d)}elseb+=1,g(d,c);d=a.e;if(i==="choice"&&(!d||!d[1]||d[1].name==="empty"))!d||!d[0]||d[0].name==="empty"?(deletea.e,a.name="empty"):(d[1]=d[0],d[0]={name:"empty"});if(i==="group"||i==="interleave")if(d[0].name==="empty")d[1].name==="empty"?(deletea.e,a.name="empty"):(i=a.name=d[1].name,a.names=d[1].names,f=a.e=d[1].e,d=f);elseif(d[1].name==="empty")i=
[],m=d(f&&f.documentElement,k,void0),l,u,n={};for(l=0;l<m.e.length;l+=1)u=m.e[l],u.name==="define"?n[u.a.name]=u:u.name==="start"&&(h=u);if(!h)return[newi("No Relax NG start element was found.")];g(h,n);for(linn)n.hasOwnProperty(l)&&g(n[l],n);for(l=0;l<k.length;l+=1)g(k[l],n);if(e)b.rootPattern=e(h.e[0],k);a(h,k);for(l=0;l<k.length;l+=1)a(k[l],k);b.start=h;b.elements=k;b.nsmap=c;returnnull}};
case"notAllowed":returns;case"text":returnE;case"choice":returnj(t(a.e[0],c),t(a.e[1],c));case"interleave":d=t(a.e[0],c);for(f=1;f<a.e.length;f+=1)d=p(d,t(a.e[f],c));returnd;case"group":returnm(t(a.e[0],c),t(a.e[1],c));case"oneOrMore":returnu(t(a.e[0],c));case"attribute":returnq(r(a.e[0]),t(a.e[1],c));case"value":returnn(a.text);case"data":returnd=a.a&&a.a.type,d===void0&&(d=""),y(d);case"list":returnh()}throw"No support for "+a.name;};this.makePattern=function(a,c){varb={},
d;for(dinc)c.hasOwnProperty(d)&&(b[d]=c[d]);returnd=C(a,b)};this.validate=function(a,c){varb;a.currentNode=a.root;b=z(null,G,a);b.nullable?c(null):(runtime.log("Error in Relax NG validation: "+b),c(["Error in Relax NG validation: "+b]))};this.init=function(a){G=a}};
// Input 16
runtime.loadClass("xmldom.RelaxNGParser");
xmldom.RelaxNG2=function(){functioni(a,b){this.message=function(){b&&(a+=b.nodeType===1?" Element ":" Node ",a+=b.nodeName,b.nodeValue&&(a+=" with value '"+b.nodeValue+"'"),a+=".");returna}}functionk(c,b,f,e){returnc.name==="empty"?null:a(c,b,f,e)}functione(a,d){if(a.e.length!==2)throw"Element with wrong # of elements: "+a.e.length;h+=1;for(varf=d.currentNode,e=f?f.nodeType:0,g=null;e>1;){if(e!==8&&(e!==3||!/^\s+$/.test(d.currentNode.nodeValue)))returnh-=1,[newi("Not allowed node of type "+
e+".")];e=(f=d.nextSibling())?f.nodeType:0}if(!f)returnh-=1,[newi("Missing element "+a.names)];if(a.names&&a.names.indexOf(b[f.namespaceURI]+":"+f.localName)===-1)returnh-=1,[newi("Found "+f.nodeName+" instead of "+a.names+".",f)];if(d.firstChild()){for(g=k(a.e[1],d,f);d.nextSibling();)if(e=d.currentNode.nodeType,(!d.currentNode||!(d.currentNode.nodeType===3&&/^\s+$/.test(d.currentNode.nodeValue)))&&e!==8)returnh-=1,[newi("Spurious content.",d.currentNode)];if(d.parentNode()!==f)returnh-=1,
[newi("Implementation error.")]}elseg=k(a.e[1],d,f);h-=1;d.nextSibling();returng}varg,a,b,h=0;a=function(b,d,f,g){varh=b.name,m=null;if(h==="text")a:{for(varl=(b=d.currentNode)?b.nodeType:0;b!==f&&l!==3;){if(l===1){m=[newi("Element not allowed here.",b)];breaka}l=(b=d.nextSibling())?b.nodeType:0}d.nextSibling();m=null}elseif(h==="data")m=null;elseif(h==="value")g!==b.text&&(m=[newi("Wrong value, should be '"+b.text+"', not '"+g+"'",f)]);elseif(h==="list")m=null;elseif(h==="attribute")a:{if(b.e.length!==
2)throw"Attribute with wrong # of elements: "+b.e.length;h=b.localnames.length;for(m=0;m<h;m+=1){g=f.getAttributeNS(b.namespaces[m],b.localnames[m]);g===""&&!f.hasAttributeNS(b.namespaces[m],b.localnames[m])&&(g=void0);if(l!==void0&&g!==void0){m=[newi("Attribute defined too often.",f)];breaka}l=g}m=l===void0?[newi("Attribute not found: "+b.names,f)]:k(b.e[1],d,f,l)}elseif(h==="element")m=e(b,d,f);elseif(h==="oneOrMore"){g=0;dol=d.currentNode,h=a(b.e[0],d,f),g+=1;while(!h&&l!==d.currentNode);
g>1?(d.currentNode=l,m=null):m=h}elseif(h==="choice"){if(b.e.length!==2)throw"Choice with wrong # of options: "+b.e.length;l=d.currentNode;if(b.e[0].name==="empty"){if(h=a(b.e[1],d,f,g))d.currentNode=l;m=null}else{if(h=k(b.e[0],d,f,g))d.currentNode=l,h=a(b.e[1],d,f,g);m=h}}elseif(h==="group"){if(b.e.length!==2)throw"Group with wrong # of members: "+b.e.length;m=a(b.e[0],d,f)||a(b.e[1],d,f)}elseif(h==="interleave")a:{for(varl=b.e.length,g=[l],u=l,n,q,r,y;u>0;){n=0;q=d.currentNode;for(m=0;m<l;m+=
1)if(r=d.currentNode,g[m]!==true&&g[m]!==r)y=b.e[m],(h=a(y,d,f))?(d.currentNode=r,g[m]===void0&&(g[m]=false)):r===d.currentNode||y.name==="oneOrMore"||y.name==="choice"&&(y.e[0].name==="oneOrMore"||y.e[1].name==="oneOrMore")?(n+=1,g[m]=r):(n+=1,g[m]=true);if(q===d.currentNode&&n===u)break;if(n===0){for(m=0;m<l;m+=1)if(g[m]===false){m=[newi("Interleave does not match.",f)];breaka}break}for(m=u=0;m<l;m+=1)g[m]!==true&&(u+=1)}m=null}elsethrowh+" not allowed in nonEmptyPattern.";returnm};this.validate=