pcjs/versions/c1pjs/1.30.1/c1p.js

568 lines
77 KiB
JavaScript

(function(){/*
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
Jeff Parsons 2012-2016
This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
PCjs is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PCjs. If not,
see <http://www.gnu.org/licenses/gpl.html>.
You are required to include the above copyright notice in every source code file of every
copy or modified version of this work, and to display that copyright notice on every screen
that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
Some PCjs files also attempt to load external resource files, such as character-image files,
ROM files, and disk image files. Those external resource files are not considered part of PCjs
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
*/
var e;function p(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var f=a&15,f=f+(0<=f&&9>=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d}function aa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function ba(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}var ca={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};
function da(a){return a.replace(/[&<>"']/g,function(a){return ca[a]})}var q=Date.now||function(){return+new Date};
function r(a,b){var c=0,d=null;if("object"==typeof resources&&(d=resources[a]))b&&b(a,d,c);else if("function"==typeof resources)resources(a,function(c,d){b&&b(a,c,d)});else{var f=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");f.onreadystatechange=function(){4===f.readyState&&(d=f.responseText,200==f.status||!f.status&&d.length&&"file:"==(window?window.location.protocol:"file:")||(c=f.status||-1),b&&b(a,d,c))};f.open("GET",a,!0);f.send()}}
function t(a){window&&window.alert(a)}function u(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var v={init:[],show:[],exit:[]},ea=!1,fa=!1,w=!0;function ga(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function x(a){v.init.push(a)}
function z(a){if(w)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function A(a){!w&&a?(w=!0,ea&&ha("init"),fa&&ha("show")):w=a}function ha(a){v[a]&&z(v[a])}ga("onload",function(){ea=!0;z(v.init)});ga("onpageshow",function(){fa=!0;z(v.show)});ga(u("Opera")||u("iOS")?"onunload":"onbeforeunload",function(){z(v.exit)});
function B(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;b=this.id.indexOf(".");0>b?this.wa=this.id:(this.Ba=this.id.substr(0,b),this.wa=this.id.substr(b+1));this[a]=c;this.u={ready:!1,ta:!1,xa:!1,H:!1,error:!1};this.va=null;this.u.error=!1;this.A={};C.push(this)}var ia=void 0,ja={};
if(window){ia||(ia=window.location.search.substr(1));for(var ka,la=/\+/g,ma=/([^&=]+)=?([^&]*)/g;ka=ma.exec(ia);)ja[decodeURIComponent(ka[1].replace(la," "))]=decodeURIComponent(ka[2].replace(la," "))}function na(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function D(a){var b;b||(b=B);a.prototype=na(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var E=window.PCjs.Machines||(window.PCjs.Machines={}),C=window.PCjs.Components||(window.PCjs.Components=[])}else E={},C=[];function F(a,b){if(void 0!==a){var c;b&&0<(c=b.indexOf("."))&&(a=b.substr(0,c+1)+a);for(c=0;c<C.length;c++)if(C[c].id===a)return C[c]}return null}
function G(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}function H(a,b){b=I(b.parentNode,"c1pjs-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,f=0;f<d.length;f++){var g=d[f];if(1===g.nodeType){var h=g.getAttribute("class");if(h)for(var l=h.split(" "),k=0;k<l.length;k++)switch(h=l[k],h){case "c1pjs-binding":(h=G(g))&&h.binding&&a.J(h.type,h.binding,g,h.value),k=l.length}}}}
function I(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var f=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)f.test(a[b].className)&&c.push(a[b]);return c}
B.prototype={constructor:B,parent:null,toString:function(){return this.name?this.name:this.id||this.type},J:function(a,b,c){switch(b){case "clear":return this.A[b]||(this.A[b]=c,c.onclick=function(a){return function(){a.A.print&&(a.A.print.value="")}}(this)),!0;case "print":return this.A[b]||(this.ya=this.A[b]=c,c.value="",this.F=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.ua=function(a){this.F(a,this.wa)}),!0;default:return!1}},log:function(){},F:function(){},status:function(a){this.F(this.wa+": "+a)},ua:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},N:function(a){this.u.error||(this.u.ready=!1!==a,this.u.ready&&(a=this.va,this.va=null,a&&a()))}};function oa(a,b){if(a.u.xa)return a.u.ta=!1,a.u.xa=!1;if(a.u.error)return a.F(a.toString()+" error"),!1;a.u.ta=b;return a.u.ta}function J(a,b){b&&(a.u.ready?b():a.va=b);return a.u.ready}
function pa(a,b){a.u.error=!0;a.ua(b)}Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});function K(a){B.call(this,"C1PPanel",a);this.u.H=!1}D(K);
K.prototype.J=function(a,b,c,d){return this.I&&this.I.J(a,b,c,d)||this.f&&this.f.J(a,b,c,d)||this.b&&this.b.J(a,b,c,d)?!0:B.prototype.J.call(this,a,b,c,d)};K.prototype.$=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b,this.f=L(b,"cpu"),this.b=L(b,"keyboard"),qa())};function qa(){for(var a=!1,b=I(document,"c1pjs","panel"),c=0;c<b.length;c++){var d=b[c],f=G(d),g=F(f.id);g||(a=!0,g=new K(f));H(g,d);a&&g.N()}}x(qa);
function ra(a){B.call(this,"C1PCPU",a);sa(this);this.u.H=!1;this.u.Z=!1;this.sa=a.autoStart;this.ia=0;this.Aa=2;this.speed=this.ia;this.oa=30;this.na=5;this.ea=8;this.qa=["Slow","Fast","Max"];this.ab=["(1Mhz)","(up to "+this.ea+"Mhz)","(unlimited)"];this.O=[];this.K=[];this.ja=65536;this.ka=0;this.Y=65536;this.ca=0;this.v=[this.Hb,this.$c,this.Sd,this.l,this.l,this.bd,this.xb,this.l,this.ed,this.Zc,this.wb,this.l,this.l,this.Wc,this.ub,this.l,this.Gb,this.ad,this.l,this.l,this.l,this.cd,this.yb,this.l,
this.Kb,this.Yc,this.l,this.l,this.l,this.Xc,this.vb,this.l,this.xc,this.qb,this.l,this.l,this.Db,this.sb,this.ld,this.l,this.gd,this.pb,this.kd,this.l,this.Cb,this.mb,this.hd,this.l,this.Eb,this.rb,this.l,this.l,this.l,this.tb,this.md,this.l,this.Cd,this.ob,this.l,this.l,this.l,this.nb,this.jd,this.l,this.sd,this.lc,this.l,this.l,this.l,this.nc,this.Tc,this.l,this.dd,this.kc,this.Sc,this.l,this.wc,this.hc,this.Qc,this.l,this.Ib,this.mc,this.l,this.l,this.l,this.oc,this.Uc,this.l,this.Mb,this.jc,
this.l,this.l,this.l,this.ic,this.Rc,this.l,this.td,this.La,this.l,this.l,this.l,this.Na,this.qd,this.l,this.fd,this.Ka,this.pd,this.l,this.vc,this.Ha,this.nd,this.l,this.Jb,this.Ma,this.l,this.l,this.l,this.Oa,this.rd,this.l,this.Ed,this.Ja,this.l,this.l,this.l,this.Ia,this.od,this.l,this.l,this.Id,this.l,this.l,this.Qd,this.Kd,this.Nd,this.l,this.gc,this.l,this.Wd,this.l,this.Pd,this.Fd,this.Md,this.l,this.zb,this.Jd,this.l,this.l,this.Rd,this.Ld,this.Od,this.l,this.Yd,this.Hd,this.Xd,this.l,this.l,
this.Gd,this.l,this.l,this.Nc,this.Cc,this.Ic,this.l,this.Oc,this.Ec,this.Jc,this.l,this.Ud,this.Bc,this.Td,this.l,this.Lc,this.yc,this.Gc,this.l,this.Ab,this.Dc,this.l,this.l,this.Pc,this.Fc,this.Kc,this.l,this.Nb,this.Ac,this.Vd,this.l,this.Mc,this.zc,this.Hc,this.l,this.$b,this.Sb,this.l,this.l,this.ac,this.Ub,this.dc,this.l,this.uc,this.Rb,this.fc,this.l,this.Zb,this.Ob,this.bc,this.l,this.Fb,this.Tb,this.l,this.l,this.l,this.Vb,this.ec,this.l,this.Lb,this.Qb,this.l,this.l,this.l,this.Pb,this.cc,
this.l,this.Xb,this.Ta,this.l,this.l,this.Yb,this.Va,this.rc,this.l,this.tc,this.Sa,this.Vc,this.l,this.Wb,this.Pa,this.pc,this.l,this.Bb,this.Ua,this.l,this.l,this.l,this.Wa,this.sc,this.l,this.Dd,this.Ra,this.l,this.l,this.l,this.Qa,this.qc,this.l];this.$a=[7,6,0,0,0,3,5,0,3,2,2,0,0,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,3,6,0,0,3,3,5,0,4,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,6,6,0,0,0,3,5,0,3,2,2,0,3,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,6,6,0,0,0,3,5,0,4,2,2,0,5,4,6,0,2,5,0,0,0,4,6,0,2,
4,0,0,0,4,7,0,0,6,0,0,3,3,3,0,2,0,2,0,4,4,4,0,2,5,0,0,4,4,4,0,2,4,2,0,0,4,0,0,2,6,2,0,3,3,3,0,2,2,2,0,4,4,4,0,2,5,0,0,4,4,4,0,2,4,2,0,4,4,4,0,2,6,0,0,3,3,5,0,2,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,2,6,0,0,3,3,5,0,2,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0]}D(ra);e=ra.prototype;e.reset=function(a){this.u.Z&&M(this);sa(this);this.c=this.a[65532]|this.a[65533]<<8;this.u.error=!1;a&&(!0===this.sa||null===this.sa&&void 0===this.A.run)&&N(this)};
e.J=function(a,b,c){a=!1;switch(b){case "run":this.A[b]=c;c.onclick=function(a){return function(){a.u.Z?M(a):N(a)}}(this);a=!0;break;case "A":case "X":case "Y":case "S":case "PC":case "C":case "Z":case "I":case "D":case "B":case "V":case "N":case "speed":this.A[b]=c;a=!0;break;case "setSpeed":this.A[b]=c,c.onclick=function(a){return function(){ta(a,2<=a.speed?a.ia:a.speed+1,!0)}}(this),a=!0}return a};e.X=function(a,b){this.a=a;(this.Fa=b)?t("unsupported CPU address buffer offset ("+this.Fa+")"):this.N()};
e.$=function(a,b){if(a&&!this.u.H){this.I=b;if(a=L(b,"video"))this.za=function(a){return function(){ua(a)}}(a),this.da=function(a){return function(){a.da()}}(a);this.u.H=!0;this.reset(!0);this.update()}};function va(a,b,c,d,f){0>wa(a.O,b,c,d,f)&&(a.ja>b&&(a.ja=b),a.ka<c&&(a.ka=c),a.O.push([b,c,d,f]))}function O(a,b,c,d,f){0>wa(a.K,b,c,d,f)&&(a.Y>b&&(a.Y=b),a.ca<c&&(a.ca=c),a.K.push([b,c,d,f]))}
function wa(a,b,c,d,f){for(var g=0;g<a.length;g++)if(a[g][0]==b&&a[g][1]==c&&a[g][2]==d&&a[g][3]==f)return g;return-1}function ta(a,b,c){void 0!==b&&(a.speed=b,a.A.setSpeed&&(a.A.setSpeed.innerHTML=a.qa[2<=b?0:b+1]),a.F("running at "+a.qa[b].toLowerCase()+" speed "+a.ab[b]),c&&a.da());a.S=0;a.Ca=q();xa(a)}e.za=function(){};e.da=function(){};function P(a,b,c,d){void 0!==a.A[b]&&(void 0===d&&(d=1),c="0000"+c.toString(16),a.A[b].innerHTML=c.slice(c.length-d).toUpperCase())}
function ya(a){P(a,"A",a.g,2);P(a,"X",a.m,2);P(a,"Y",a.o,2);var b=za(a);P(a,"C",b&1?1:0);P(a,"Z",b&2?1:0);P(a,"I",b&4?1:0);P(a,"D",b&8?1:0);P(a,"B",b&16?1:0);P(a,"V",b&64?1:0);P(a,"N",b&128?1:0);P(a,"S",a.s,4);P(a,"PC",a.c,4);a.A.speed&&a.ba&&(a.A.speed.innerHTML=a.ba.toFixed(1)+"Mhz")}
function xa(a,b){var c=30;c<a.oa&&(c=a.oa);c<a.na&&(c=a.na);var d=1;b&&a.speed>a.ia&&a.ba&&(d=a.ba);d>a.ea&&2>a.speed&&(d=a.ea);a.bb=Math.round(1E3/30);a.fa=Math.floor(1E6/c*d);a.la=Math.floor(1E6/30*d);a.Ea=Math.floor(1E6/a.oa*d);a.Da=Math.floor(1E6/a.na*d);b||(a.P=a.la,a.U=a.Ea,a.T=a.Da);a.ma=0}function Aa(a){1E6<=a.ma&&xa(a,!0);a.V=0;a.cb=q()}
function Ba(a){var b=q(),c=a.bb;a.V&&(c=Math.round(c*a.V/a.la));c-=b-a.cb;if(b-=a.Ca)a.ba=Math.round(a.S/(100*b))/10,864E5<=b&&ta(a);0>c?c=0:1==a.speed?a.ba<=a.ea&&(c=0):2==a.speed&&(c=0);a.ma+=a.V;return c}
function N(a){if(oa(a,!0)){a.u.Z||(ta(a),a.I&&a.I.start(),a.u.Z=!0,a.A.run&&(a.A.run.innerHTML="Halt"),a.da());Aa(a);try{do{a.step(a.fa);var b=a.L-a.G;a.S+=b;a.V+=b;a.L=a.G=0;a.U-=a.fa;0>=a.U&&(a.U+=a.Ea,a.za());a.T-=a.fa;0>=a.T&&(a.T+=a.Da,ya(a));a.P-=a.fa;if(0>=a.P){a.P+=a.la;break}}while(a.u.Z)}catch(c){M(a);a.update();oa(a,!1);pa(a,c.stack||c.message);return}setTimeout(function(a){return function(){N(a)}}(a),Ba(a))}else a.update(),a.I&&a.I.stop(a.Ca,a.S)}
e.step=function(a){this.b=this.j=-1;this.L=this.G=a;do{a=this.a[this.c];this.c++;this.v[a].call(this);if(0<=this.b){if(this.b>=this.ja&&this.b<=this.ka)for(var b=this.b,c=this.c,d=0;d<this.O.length;d++)b>=this.O[d][0]&&b<=this.O[d][1]&&this.O[d][3].call(this.O[d][2],b,c);this.b=-1}else if(0<=this.j){if(this.j>=this.Y&&this.j<=this.ca)for(b=this.j,c=this.c,d=0;d<this.K.length;d++)b>=this.K[d][0]&&b<=this.K[d][1]&&this.K[d][3].call(this.K[d][2],b,c);this.j=-1}this.G-=this.$a[a]}while(0<this.G);return!0};
function M(a){a.u.ta&&(a.u.xa=!0);a.L-=a.G;a.G=0;a.u.Z&&(a.u.Z=!1,a.A.run&&(a.A.run.innerHTML="Run"))}e.update=function(){this.za();ya(this)};function Ca(a){return a.u.Z?a.S+a.L-a.G:0}e.W=function(a){return this.a[a]};e.R=function(a,b){this.a[a]=b};function za(a){var b=a.f&256?1:0,b=b|(a.i&255?0:2),b=b|((a.w&255^a.C^a.w>>1)&128?64:0),b=b|(a.h&128?128:0);return a.B&60|b}
function Q(a,b,c){var d=a.f&256?1:0,f=(b&15)+(c&15)+d;10<=f&&(f=f+6&15|16);f+=(b&240)+(c&240);a.C=b^c;a.w=f;a.h=f&255;160<=f&&(f+=96);512<=f&&(f-=256);a.f=f;a.i=b+c+d&255;a.G--;return f&255}function R(a,b,c){var d=a.f&256?0:1,f=(b&15)-(c&15)-d;0>f&&(f=(f-6&15)-16);f+=(b&240)-(c&240);0>f&&(f-=96);a.h=a.i=(a.f=b-c-d)&255;a.C=b^c;a.w=a.f;a.f^=256;a.G--;return f&255}function sa(a){a.g=0;a.m=0;a.o=0;a.s=256;a.B=0;a.h=0;a.i=0;a.C=0;a.w=0;a.f=0;a.c=0;a.b=-1;a.j=-1;a.ba=0;a.S=a.L=a.G=0}
e.Hb=function(){this.c++;this.a[this.s--]=this.c>>8;this.s|=256;this.a[this.s--]=this.c&255;this.s|=256;this.B|=16;this.B=za(this);this.a[this.s--]=this.B;this.s|=256;this.B&=239;this.b=65534;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.$c=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g|=this.a[this.b]};e.bd=function(){this.b=this.a[this.c++];this.h=this.i=this.g|=this.a[this.b]};
e.xb=function(){this.j=this.a[this.c++];this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.ed=function(){this.B=za(this);this.a[this.s--]=this.B;this.s|=256};e.Zc=function(){this.b=this.c++;this.h=this.i=this.g|=this.a[this.b]};e.wb=function(){this.f=this.g<<1;this.h=this.i=this.g=this.f&255};e.Wc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g|=this.a[this.b]};
e.ub=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.Gb=function(){this.c+=(this.h&128?0:(this.G--,this.a[this.c]<<24>>24))+1};e.ad=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.h=this.i=this.g|=this.a[this.b]};e.cd=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g|=this.a[this.b]};
e.yb=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.Kb=function(){this.f=0};e.Yc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.h=this.i=this.g|=this.a[this.b]};e.Xc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g|=this.a[this.b]};e.vb=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};
e.xc=function(){this.b=this.c++;this.a[this.s--]=this.c>>8;this.s|=256;this.a[this.s--]=this.c&255;this.s|=256;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.qb=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g&=this.a[this.b]};e.Db=function(){this.b=this.a[this.c++];this.i=this.g&this.a[this.b];this.h=this.h&127|this.a[this.b]&128;this.w=0;this.C=this.a[this.b]&64?128:0};e.sb=function(){this.b=this.a[this.c++];this.h=this.i=this.g&=this.a[this.b]};
e.ld=function(){this.j=this.a[this.c++];this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.gd=function(){this.s=this.s+1&255|256;this.B=this.a[this.s];this.f=this.B&1?256:0;this.i=this.B&2?0:1;this.h=this.B&128;this.w=0;this.C=this.B&64?128:0};e.pb=function(){this.b=this.c++;this.h=this.i=this.g&=this.a[this.b]};
e.kd=function(){this.f=this.f&65280|this.g;this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.g=this.f&255};e.Cb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.i=this.g&this.a[this.b];this.h=this.h&127|this.a[this.b]&128;this.w=0;this.C=this.a[this.b]&64?128:0};e.mb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g&=this.a[this.b]};
e.hd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.Eb=function(){this.c+=(this.h&128?(this.G--,this.a[this.c]<<24>>24):0)+1};e.rb=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.h=this.i=this.g&=this.a[this.b]};e.tb=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g&=this.a[this.b]};
e.md=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.Cd=function(){this.f=256};e.ob=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.h=this.i=this.g&=this.a[this.b]};e.nb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g&=this.a[this.b]};
e.jd=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.sd=function(){this.s=this.s+1&255|256;this.B=this.a[this.s];this.f=this.B&1?256:0;this.i=this.B&2?0:1;this.h=this.B&128;this.w=0;this.C=this.B&64?128:0;this.s=this.s+2&255|256;this.c=this.a[this.s-1|256]|this.a[this.s]<<8};
e.lc=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g^=this.a[this.b]};e.nc=function(){this.b=this.a[this.c++];this.h=this.i=this.g^=this.a[this.b]};e.Tc=function(){this.j=this.a[this.c++];this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};e.dd=function(){this.a[this.s--]=this.g;this.s|=256};e.kc=function(){this.b=this.c++;this.h=this.i=this.g^=this.a[this.b]};
e.Sc=function(){this.f=this.f&65279|(this.g&1?256:0);this.g=(this.f=this.f&65280|this.g>>1)&255;this.h=this.i=this.f&255};e.wc=function(){this.b=this.c;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.hc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g^=this.a[this.b]};e.Qc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.Ib=function(){this.c+=((this.w&255^this.C^this.w>>1)&128?0:(this.G--,this.a[this.c]<<24>>24))+1};e.mc=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.h=this.i=this.g^=this.a[this.b]};e.oc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g^=this.a[this.b]};e.Uc=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.Mb=function(){this.B&=251};e.jc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.h=this.i=this.g^=this.a[this.b]};e.ic=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g^=this.a[this.b]};e.Rc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.td=function(){this.s=this.s+2&255|256;this.c=(this.a[this.s-1|256]|this.a[this.s]<<8)+1};e.La=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.ib=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.g=Q(this,this.g,this.a[this.b])};
e.Na=function(){this.b=this.a[this.c++];this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.kb=function(){this.b=this.a[this.c++];this.g=Q(this,this.g,this.a[this.b])};e.qd=function(){this.j=this.a[this.c++];this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.fd=function(){this.s=this.s+1&255|256;this.h=this.i=this.g=this.a[this.s]};
e.Ka=function(){this.b=this.c++;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.hb=function(){this.b=this.c++;this.g=Q(this,this.g,this.a[this.b])};e.pd=function(){this.f=this.f&65280|this.g;this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.g=this.f&255};e.vc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.c=this.a[this.b]|this.a[this.b+1]<<8};
e.Ha=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.eb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.g=Q(this,this.g,this.a[this.b])};e.nd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};
e.Jb=function(){this.c+=((this.w&255^this.C^this.w>>1)&128?(this.G--,this.a[this.c]<<24>>24):0)+1};e.Ma=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.jb=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.g=Q(this,this.g,this.a[this.b])};
e.Oa=function(){this.b=this.a[this.c++]+this.m&255;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.lb=function(){this.b=this.a[this.c++]+this.m&255;this.g=Q(this,this.g,this.a[this.b])};e.rd=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.Ed=function(){this.B|=4};
e.Ja=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.gb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.g=Q(this,this.g,this.a[this.b])};e.Ia=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};
e.fb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.g=Q(this,this.g,this.a[this.b])};e.od=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.Id=function(){this.j=this.a[this.c++]+this.m&255;this.j=this.a[this.j]|this.a[this.j+1]<<8;this.a[this.j]=this.g};e.Qd=function(){this.j=this.a[this.c++];this.a[this.j]=this.o};
e.Kd=function(){this.j=this.a[this.c++];this.a[this.j]=this.g};e.Nd=function(){this.j=this.a[this.c++];this.a[this.j]=this.m};e.gc=function(){this.h=this.i=this.o=this.o-1&255};e.Wd=function(){this.h=this.i=this.g=this.m};e.Pd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.o};e.Fd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.g};e.Md=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.m};
e.zb=function(){this.c+=(this.f&256?0:(this.G--,this.a[this.c]<<24>>24))+1};e.Jd=function(){this.j=this.a[this.c++];this.j=(this.a[this.j]|this.a[this.j+1]<<8)+this.o;this.a[this.j]=this.g};e.Rd=function(){this.j=this.a[this.c++]+this.m&255;this.a[this.j]=this.o};e.Ld=function(){this.j=this.a[this.c++]+this.m&255;this.a[this.j]=this.g};e.Od=function(){this.j=this.a[this.c++]+this.o&255;this.a[this.j]=this.m};e.Yd=function(){this.h=this.i=this.g=this.o};
e.Hd=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.a[this.j]=this.g};e.Xd=function(){this.s=this.m|256};e.Gd=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.a[this.j]=this.g};e.Nc=function(){this.b=this.c++;this.h=this.i=this.o=this.a[this.b]};e.Cc=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g=this.a[this.b]};e.Ic=function(){this.b=this.c++;this.h=this.i=this.m=this.a[this.b]};
e.Oc=function(){this.b=this.a[this.c++];this.h=this.i=this.o=this.a[this.b]};e.Ec=function(){this.b=this.a[this.c++];this.h=this.i=this.g=this.a[this.b]};e.Jc=function(){this.b=this.a[this.c++];this.h=this.i=this.m=this.a[this.b]};e.Ud=function(){this.h=this.i=this.o=this.g};e.Bc=function(){this.b=this.c++;this.h=this.i=this.g=this.a[this.b]};e.Td=function(){this.h=this.i=this.m=this.g};e.Lc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.o=this.a[this.b]};
e.yc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g=this.a[this.b]};e.Gc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.m=this.a[this.b]};e.Ab=function(){this.c+=(this.f&256?(this.G--,this.a[this.c]<<24>>24):0)+1};e.Dc=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.h=this.i=this.g=this.a[this.b]};e.Pc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.o=this.a[this.b]};
e.Fc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g=this.a[this.b]};e.Kc=function(){this.b=this.a[this.c++]+this.o&255;this.h=this.i=this.m=this.a[this.b]};e.Nb=function(){this.C=this.w=0};e.Ac=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.h=this.i=this.g=this.a[this.b]};e.Vd=function(){this.h=this.i=this.m=this.s&255};e.Mc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.o=this.a[this.b]};
e.zc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g=this.a[this.b]};e.Hc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.h=this.i=this.m=this.a[this.b]};e.$b=function(){this.b=this.c++;this.h=this.i=this.f=this.o-this.a[this.b];this.f^=256};e.Sb=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};
e.ac=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.o-this.a[this.b];this.f^=256};e.Ub=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.dc=function(){this.j=this.a[this.c++];this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.uc=function(){this.h=this.i=this.o=this.o+1&255};e.Rb=function(){this.b=this.c++;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.fc=function(){this.h=this.i=this.m=this.m-1&255};
e.Zb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.o-this.a[this.b];this.f^=256};e.Ob=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.bc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.Fb=function(){this.c+=(this.i&255?(this.G--,this.a[this.c]<<24>>24):0)+1};
e.Tb=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.Vb=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.ec=function(){this.j=this.a[this.c++]+this.m&255;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};
e.Lb=function(){this.B&=-9;this.v[97]=this.La;this.v[101]=this.Na;this.v[105]=this.Ka;this.v[109]=this.Ha;this.v[113]=this.Ma;this.v[117]=this.Oa;this.v[121]=this.Ja;this.v[125]=this.Ia;this.v[225]=this.Ta;this.v[229]=this.Va;this.v[233]=this.Sa;this.v[237]=this.Pa;this.v[241]=this.Ua;this.v[245]=this.Wa;this.v[249]=this.Ra;this.v[253]=this.Qa};e.Qb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};
e.Pb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.cc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.Xb=function(){this.b=this.c++;this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Ta=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.yd=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.g=R(this,this.g,this.a[this.b])};e.Yb=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Va=function(){this.b=this.a[this.c++];this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Ad=function(){this.b=this.a[this.c++];this.g=R(this,this.g,this.a[this.b])};e.rc=function(){this.j=this.a[this.c++];this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};e.tc=function(){this.h=this.i=this.m=this.m+1&255};
e.Sa=function(){this.b=this.c++;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.xd=function(){this.b=this.c++;this.g=R(this,this.g,this.a[this.b])};e.Vc=function(){};e.Wb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Pa=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.ud=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.g=R(this,this.g,this.a[this.b])};e.pc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};e.Bb=function(){this.c+=(this.i&255?0:(this.G--,this.a[this.c]<<24>>24))+1};
e.Ua=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.zd=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.o;this.g=R(this,this.g,this.a[this.b])};
e.Wa=function(){this.b=this.a[this.c++]+this.m&255;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Bd=function(){this.b=this.a[this.c++]+this.m&255;this.g=R(this,this.g,this.a[this.b])};e.sc=function(){this.j=this.a[this.c++]+this.m&255;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};
e.Dd=function(){this.B|=8;this.v[97]=this.ib;this.v[101]=this.kb;this.v[105]=this.hb;this.v[109]=this.eb;this.v[113]=this.jb;this.v[117]=this.lb;this.v[121]=this.gb;this.v[125]=this.fb;this.v[225]=this.yd;this.v[229]=this.Ad;this.v[233]=this.xd;this.v[237]=this.ud;this.v[241]=this.zd;this.v[245]=this.Bd;this.v[249]=this.wd;this.v[253]=this.vd};
e.Ra=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.wd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.g=R(this,this.g,this.a[this.b])};
e.Qa=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.vd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.g=R(this,this.g,this.a[this.b])};e.qc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};
e.Sd=function(){var a;a=this.a[this.c++];switch(a){case 0:this.F("HALT");M(this);break;case 1:a=this.c;for(var b="";a<this.a.length;){var c=this.a[a++];if(!c)break;b+=String.fromCharCode(c)}this.c=a;b=b.replace(/%A/g,p(this.g,2)).replace(/%X/g,p(this.m,2)).replace(/%Y/g,p(this.o,2));this.F(b);this.P=0;this.L-=this.G;this.G=0;break;default:this.c-=2,this.F("undefined opSim: "+p(a,2,!0)+" at "+p(this.c,4,!0)),M(this)}};
e.l=function(){var a=this.a[--this.c];this.F("undefined opcode: "+p(a,2,!0)+" at "+p(this.c,4,!0));M(this)};x(function(){for(var a=I(document,"c1pjs","cpu"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new ra(d);H(d,c)}});
function S(a){B.call(this,"C1PROM",a);this.b=this.a=null;this.c=a.size;if(this.g=a.image){a=this.g;var b=ba(this.g);"json"!=b&&"hex"!=b&&(a="http://"+(window?window.location.host:"www.pcjs.org")+"/api/v1/dump?file="+this.g+"&format=bytes");var c=this;r(a,function(a,b,g){Da(c,a,b,g)})}}D(S);
S.prototype.X=function(a,b,c,d){this.a=a;this.h=b;a=c-b+1;this.c||(this.c=a);a!=this.c?pa(this,"computer-specified ROM size ("+p(a,4,!0)+") does not match component-specified size ("+p(this.c,4,!0)+")"):(d&&(this.f=d,O(d,b,c,this,this.R)),Ea(this))};S.prototype.$=function(a){a&&!this.u.H&&(this.u.H=!0)};S.prototype.R=function(a,b){void 0!==b&&(a-=this.h,this.a[this.h+a]=this.b?this.b[a]:0)};
function Da(a,b,c,d){if(d)a.F('Error loading ROM "'+b+'" ('+d+")");else{if("["==c.charAt(0)||"{"==c.charAt(0))try{var f=eval("("+c+")"),g=f.bytes;g?a.b=g:a.b=f}catch(h){a.F('Error processing ROM "'+b+'": '+h.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),c=0;c<b.length;c++)a.b[c]=parseInt(b[c],16);Ea(a)}}
function Ea(a){if(!J(a))if(!a.g)a.N();else if(a.b&&a.a){var b=a.b.length;if(b!=a.c)pa(a,"ROM image size ("+p(b,4,!0)+") does not match component-specified size ("+p(a.c,4,!0)+")");else{for(var c=0;c<b;c++)a.a[a.h+c]=a.b[c];a.N()}}}x(function(){for(var a=I(document,"c1pjs","rom"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new S(d);H(d,c)}});function Fa(a){B.call(this,"C1PRAM",a)}D(Fa);Fa.prototype.X=function(a){this.a=a;this.N()};
x(function(){for(var a=I(document,"c1pjs","ram"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Fa(d);H(d,c)}});
function Ga(a){B.call(this,"C1PKeyboard",a);this.u.H=!1;this.ea=a.model;this.L=8;this.na=10;this.ma=13;this.O=27;this.ka=this.L;this.la=this.na;this.fa=this.ma;this.K=this.O;this.v=241;this.G=224;this.ia=3;this.ja=15;this.s=1;this.m={};this.m["break"]=this.G;this.m.esc=this.K;this.m["ctrl-c"]=this.ia;this.m["ctrl-o"]=this.ja;this.b=[];this.b[49]=30464;this.b[33]=30704;this.b[50]=30208;this.b[34]=30448;this.b[51]=29952;this.b[35]=30192;this.b[52]=29696;this.b[36]=29936;this.b[53]=29440;this.b[37]=
29680;this.b[54]=29184;this.b[38]=29424;this.b[55]=28928;this.b[39]=29168;this.b[56]=26368;this.b[40]=26608;this.b[57]=26112;this.b[41]=26352;this.b[48]=25856;this.b[58]=25600;this.b[42]=25840;this.b[45]=25344;this.b[61]=25584;this.b[46]=22272;this.b[62]=22512;this.b[108]=22016;this.b[76]=22256;this.b[92]=22256;this.b[111]=21760;this.b[79]=22E3;this.b[this.ka]=22E3;this.b[this.la]=21504;this.b[this.fa]=21248;this.b[119]=18176;this.b[87]=18416;this.b[101]=17920;this.b[69]=18160;this.b[114]=17664;this.b[82]=
17904;this.b[116]=17408;this.b[84]=17648;this.b[121]=17152;this.b[89]=17392;this.b[117]=16896;this.b[85]=17136;this.b[105]=16640;this.b[73]=16880;this.b[115]=14080;this.b[83]=14320;this.b[100]=13824;this.b[68]=14064;this.b[102]=13568;this.b[70]=13808;this.b[103]=13312;this.b[71]=13552;this.b[104]=13056;this.b[72]=13296;this.b[106]=12800;this.b[74]=13040;this.b[107]=12544;this.b[75]=12784;this.b[91]=12784;this.b[120]=9984;this.b[88]=10224;this.b[99]=9728;this.b[67]=9968;this.b[118]=9472;this.b[86]=
9712;this.b[98]=9216;this.b[66]=9456;this.b[110]=8960;this.b[78]=9200;this.b[94]=9200;this.b[109]=8704;this.b[77]=8944;this.b[93]=8944;this.b[44]=8448;this.b[60]=8688;this.b[113]=5888;this.b[81]=6128;this.b[97]=5632;this.b[65]=5872;this.b[122]=5376;this.b[90]=5616;this.b[32]=5120;this.b[47]=4864;this.b[63]=5104;this.b[59]=4608;this.b[43]=4848;this.b[112]=4352;this.b[80]=4592;this.b[64]=4592;this.b[this.v]=1536;this.b[this.K]=1280;this.b[240]=512;this.b[242]=256;this.b[244]=0;this.reset()}D(Ga);
e=Ga.prototype;e.reset=function(){this.pa(this.ea);this.c=this.s;this.S=0;this.g=[this.s,0,0,0,0,0,0,0];this.w=[];if(this.h)for(var a in this.h)isNaN(+a)||this.h[a]&&clearTimeout(this.h[a]);this.h=[];this.ca=this.i=0;this.T=-1;this.P=this.g;this.V=this.C=0;this.j=""};
e.J=function(a,b,c){if(void 0===this.A[b])switch(b){case "keyDown":return this.A[b]=c,c.onkeydown=function(a){return function(b){return Ha(a,b,!0)}}(this),!0;case "keyPress":return this.A[b]=c,c.onkeypress=function(a){return function(b){var c=!0;b=b||window.event;b=b.which||b.keyCode;a.j="";a.c&8?a.c&=-9:c=!T(a,b);return c}}(this),!0;case "keyUp":return this.A[b]=c,c.onkeyup=function(a){return function(b){return Ha(a,b,!1)}}(this),!0;case "break":return this.A[b]=c,c.onclick=function(a){return function(){a.I&&
a.I.reset(!0)}}(this),!0;default:if(void 0!==this.m[b])return this.A[b]=c,c.onclick=function(a,b,c){return function(){a.f&&a.f.da();return!T(a,c)}}(this,b,this.m[b]),!0}return!1};e.X=function(a,b,c,d){this.a=a;this.Y=b;this.oa=c-b+1;this.sa=this.Y+this.oa;d&&(this.f=d,O(d,b,c,this,this.R));this.N()};e.pa=function(a){this.o=a;this.B=255;600!=this.o&&(this.B=0,this.F("updated keyboard model: "+this.o))};e.$=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b)};
e.N=function(){this.U=(this.qa=u("iOS"))||u("Android");B.prototype.N.call(this)};function Ia(a,b){b=b?100:250;a.f&&a.f.ba&&(b/=a.f.ba);return b}function Ja(a,b){!a.i||void 0!==b&&b==a.i||(clearTimeout(a.h[a.i]),U(a,a.i,!1,4))}function V(a,b,c){a.j=b;Ka(a,c||300)}function Ka(a,b){if(0<a.j.length){var c=a.j.charCodeAt(0);10==c&&(c=13);65<=c&&90>=c&&(c+=32);a.j=a.j.substr(1);T(a,c)}0<a.j.length&&setTimeout(function(a){return function(){Ka(a,b)}}(a),b)}
function Ha(a,b,c){var d,f=!c;b=b.keyCode;c&&(a.ca=b);16==b?(a.c&=-5,c&&(a.c|=4),b+=224,f=!1):18==b?(a.c&=-3,c&&(a.c|=2),b+=224,f=!1):b==a.v-224?(a.c&=-65,c&&(a.c|=64),b+=224,f=!1):20==b?(c=!c,a.c&=~a.s,c&&(a.c|=a.s),b+=224,f=!1):91==b?(a.c&=-9,c&&(a.c|=8),f=!1,d=!0):d=9==b?f=!1:b==a.O||b==a.L?c?!T(a,b):!1:!0;f&&(a.c&=-9,a.U||b!=a.ca||Ja(a));void 0===d&&(d=!U(a,b,c,2));return d}
function T(a,b){var c=!1;b==a.G?a.I&&(a.I.reset(!0),c=!0):(a.U&&65<=b&&90>=b&&(b+=32),Ja(a,b),U(a,b,!0,0)&&(a.f.speed==a.f.Aa?U(a,b,!1,1):(c=!1,a.h[b]&&(clearTimeout(a.h[b]),c=!0),c=Ia(a,c),a.h[a.i=b]=setTimeout(function(a){return function(){U(a,b,!1,3)}}(a),c)),c=!0));return c}
function U(a,b,c,d){var f=!1;c||(a.h[b]=null,a.i==b&&(a.i=0));var g=0,h=a.b[b];void 0===h&&(1<=b&&26>=b&&(b+=64,g=a.v),h=a.b[b]);void 0!==h&&(b=h>>12,f=h>>8&15,g||(g=h&255),c?(a.g[b]|=1<<f,a.g[0]=g==a.v?a.g[0]|64:240==g?a.g[0]|4:242==g?a.g[0]|2:a.g[0]&-71):(a.g[b]&=~(1<<f),a.g[0]&=-71,a.g[0]|=a.c&70),c=!d&&!a.w.length,a.w.push(a.g.slice()),La(a,c),f=!0);return f}e.W=function(){};e.R=function(a){this.S=this.f.W(a)^this.B;this.C++;La(this,!1,a)};
function La(a,b,c){var d=Ca(a.f);b||(a.f.speed==a.f.Aa?b=void 0!==c&&32<=a.C:(b=d-a.V,b=0>b||8192<=b));b&&(b=a.w.shift(),void 0!==b&&(a.P=b),a.C=0,a.V=d);for(b=d=0;8>b;b++)a.S&1<<b&&(d|=a.P[b]);d^=a.B;if(void 0!==c)a.a[c]=d;else if(c=a.Y,d!=a.T)for(;c<a.sa;c++)a.a[c]=d;a.T=d}x(function(){for(var a=I(document,"c1pjs","keyboard"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Ga(d);H(d,c)}});
function Ma(a,b,c,d){B.call(this,"C1PVideo",a);this.S=a.model;this.L=a.charCols;this.O=a.charRows;this.U=a.screenWidth;this.V=a.screenHeight;this.j=a.charWidth;this.m=a.charHeight;Na(this);this.i=b;this.B=c;this.g=d;b=["","moz","ms","webkit"];a=a.smoothing;(c=ja.smoothing)&&(a="true"==c);if(null!=a)for(c=0;c<b.length;c++)if(d=(d=b[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.B[d]){this.B[d]=a;break}}D(Ma);e=Ma.prototype;
e.reset=function(a){this.pa(this.S);if(this.a)for(var b=this.v;b<this.C;b++)this.a[b]=a?Math.floor(256*Math.random()):32};e.J=function(a,b,c){switch(b){case "refresh":return this.A[b]=c,c.onclick=function(a){return function(){Oa(a);ua(a)}}(this),!0}return!1};e.X=function(a,b,c,d){this.a=a;this.v=b;this.T=c-b+1;this.C=this.v+this.T;d&&(this.f=d,va(d,56832,56832,this,this.W),O(d,56832,56832,this,this.R));this.reset(!0)};
function Na(a,b,c,d,f){a.s=void 0!==b?b:a.L;a.Y=void 0!==c?c:a.O;a.c=a.s*a.Y;a.C=a.v+a.c;a.K=void 0!==d?d:0;a.P=void 0!==f?f:c;a.G=Math.floor(a.U/a.s);a.I=Math.floor(a.V/a.P)}e.da=function(){this.i.focus()};e.pa=function(a){this.o=a;600==this.o?(Na(this,this.L,this.O,3,25),1024==this.c&&this.f&&(this.h=this.C+this.c-1,O(this.f,this.h,this.h,this,this.Ya))):(this.F("updated video model: "+this.o),Na(this,64,32));Oa(this);ua(this)};
e.$=function(a,b){if(a&&!this.u.H&&J(this)){if(this.u.H=!0,this.b=L(b,"keyboard"))this.b.J("canvas","keyDown",this.i),this.b.J("canvas","keyPress",this.i),this.b.J("canvas","keyUp",this.i)}else!a&&this.u.H&&(this.u.H=!1)};e.N=function(){this.j||(this.j=Math.floor(this.g.width/16));this.m||(this.m=Math.floor(this.g.height/16));B.prototype.N.call(this)};e.W=function(a){var b=this.f.W(a);this.f.R(a,b&127|(Math.floor(Ca(this.f)/8333)&1?128:0))};e.R=function(){};
e.Ya=function(a,b){if(void 0!==b){this.pa(540);this.b&&this.b.pa(542);a=this.f;b=a.K;var c=[],d=wa(b,this.h,this.h,this,this.Ya);if(0<=d){c.push(b[d][0]);c.push(b[d][1]);b.splice(d,1);for(var f=65536,g=0,d=0;d<b.length;d++)f>b[d][0]&&(f=b[d][0]),g<b[d][1]&&(g=b[d][1]);c.push(f);c.push(g)}4==c.length&&(a.Y=c[2],a.ca=c[3])}};function Oa(a){a.w=Array(a.c);for(var b=0;b<=a.c;b++)a.w[b]=-1}
function ua(a){var b=0;if(a.u.H)for(;b<a.c;){var c=a.a[a.v+b];if(a.w[b]!=c){var d=Math.floor(b/a.s);if(d>=a.K&&(d-=a.K,d<a.P)){var f=c*a.j;a.B.drawImage(a.g,f%a.g.width,Math.floor(f/a.g.width)*a.m,a.j,a.m,b%a.s*a.G,d*a.I,a.G,a.I)}a.w[b]=c}b++}}
x(function(){for(var a=I(document,"c1pjs","video"),b=0;b<a.length;b++){var c=a[b],d=G(c),f=document.createElement("canvas");if(!f||!f.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}f.setAttribute("class","c1pjs-canvas");f.setAttribute("width",d.screenWidth);f.setAttribute("height",d.screenHeight);f.setAttribute("contenteditable","true");f.setAttribute("autocapitalize","off");f.setAttribute("autocorrect","off");f.style.backgroundColor=d.screenColor;
f.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(f.style.height=(c.clientWidth*d.screenHeight/d.screenWidth|0)+"px",c.onresize=function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,f,d.screenWidth,d.screenHeight));c.appendChild(f);var g=new Image,h=f.getContext("2d"),f=new Ma(d,f,h,g);g.onload=function(a){return function(){a.N()}}(f,d.charSet);g.src=d.charSet;H(f,c)}});
function Pa(a){B.call(this,"C1PSerialPort",a);this.u.H=!1;this.m=a.demo;this.reset(!0)}D(Pa);e=Pa.prototype;e.reset=function(a){if(a||2!=this.g){this.h=-1;this.i=0;this.c="";if(this.m){a=1;if(this.Ba){var b=this.Ba.match(/\d+/);null!==b&&(a=parseInt(b[0],10))}this.c='10 PRINT "HELLO OSI #'+a+'"\n'}this.j=!0;this.g=0}};e.start=function(){this.b&&this.m&&(V(this.b," C\n\n",3E3),setTimeout(function(a){return function(){a.g=1;V(a.b,"LOAD\n")}}(this),12E3));this.m=!1};
e.J=function(a,b,c){var d=this;switch(b){case "listSerial":return this.A[b]=c,!0;case "loadSerial":return this.A[b]=c,c.onclick=function(){d.A.listSerial&&r(d.A.listSerial.value,function(a,b,c){Qa(d,a,b,c)})},!0;case "mountSerial":return!u("Mobi")&&window&&"FileReader"in window?(this.A[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){var b=a.currentTarget[1].files[0],c=new FileReader;c.onload=function(){Qa(d,
b.name,c.result.toString(),0)};c.readAsText(b);return!1}):c.parentNode.removeChild(c),!0}return!1};e.X=function(a,b,c,d){this.a=a;this.o=b;this.v=c-b+1;this.s=this.o+this.v;if(this.f=d)va(d,b,c,this,this.W),O(d,b,c,this,this.R);this.N()};e.$=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b,this.b=L(b,"keyboard"))};
function Qa(a,b,c,d){if(c){a.i=0;a.c=c;a.j=!0;a.g=0;if(-1!==b.indexOf(".json",b.length-5))try{d="";var f=eval("("+c+")").bytes;for(c=0;c<f.length;c++)d+=String.fromCharCode(f[c]);a.c=d;a.j=!1}catch(g){a.F('Error processing file "'+b+'": '+g.message);return}a.I&&a.b&&a.f.u.Z?(a.F("auto-loading "+b),a.f.da(),"."!=a.c.charAt(0)?(a.g=1,V(a.b,"NEW\nLOAD\n")):(a.g=2,a.I.reset(!0),V(a.b,"ML"))):a.F(b+" ready to load")}else a.F('Error loading file "'+b+'" ('+d+")")}
e.W=function(a,b){void 0!==b&&(a&1?Ra(this):this.c&&!this.i&&Ra(this))};e.R=function(){};function Ra(a){if(void 0!==a.c){a.h=-1;if(a.i<a.c.length){var b=a.c.charCodeAt(a.i++)&255;a.j&&10==b&&(b=13);a.h=b}else a.c="",a.i=0,1==a.g&&a.b&&V(a.b," \nRUN\n"),a.g=0;for(b=a.o+0;b<a.s;b+=2)a.a[b]=0<=a.h?1:0;for(b=a.o+1;b<a.s;b+=2)a.a[b]=0<=a.h?a.h:0}}x(function(){for(var a=I(document,"c1pjs","serial"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Pa(d);H(d,c)}});
function Sa(a){B.call(this,"C1PDiskController",a);this.u.H=!1;this.reset(!0)}D(Sa);e=Sa.prototype;e.reset=function(a){Ta(this);this.b=-1;a&&(this.c=[],this.c[0]={Zd:0,Ga:40,Za:!0,ha:20,aa:0,ga:-1,ra:[]})};
function Ta(a){a.v={D:64,read:function(){},update:function(a){return function(b){void 0!==b&&(this.D=b);a.j.D&4||W(a,0,this)}}(a)};a.g={D:255,read:function(){this.update()},update:function(a){return function(b){void 0===b?b=a.g.D:Ua(a,b,a.i.D);b=(b|190)&-2;if(0<=a.b&&a.c[a.b].ra.length){var c=a.c[a.b];c.Za&&(b&=-33);c.aa||(b&=-3);10>=--c.ha&&(0<c.ha?(b&=-129,Va(a)):(c.ha=100,0<=a.b&&(a.c[a.b].ga=0,Wa(a))))}this.D=b;a.j.D&4&&W(a,0,this)}}(a)};a.j={D:0,read:function(){},update:function(a){return function(b){void 0!==
b&&(this.D=b&-193);W(a,1,this);a.g.update();a.v.update()}}(a)};a.w={D:255,read:function(){},update:function(a){return function(b){void 0!==b&&(this.D=b);a.m.D&4||W(a,2,this)}}(a)};a.i={D:255,read:function(){},update:function(a){return function(b){void 0===b?b=a.i.D:Ua(a,a.g.D,b);if(0<=a.b&&a.b<a.c.length){var c=a.c[a.b];c.ra.length&&a.i.D&8&&!(b&8)&&(b&4?c.aa--:c.aa++,c.aa>=c.Ga&&(c.aa=c.Ga),0>c.aa&&(c.aa=0),c.ha=20,a.g.update(a.g.D|128),Va(a))}this.D=b;a.m.D&4&&W(a,2,this)}}(a)};a.m={D:0,read:function(){},
update:function(a){return function(b){void 0!==b&&(this.D=b&-193);W(a,3,this);a.i.update();a.w.update()}}(a)};a.B={D:0,read:function(){},update:function(a){return function(b){void 0!==b&&(3==(b&3)&&(a.h.D=14),this.D=b);a.h.update()}}(a)};a.h={D:14,read:function(){},update:function(a){return function(b){void 0===b&&(b=a.h.D);b&=-2;0<=a.b&&0<=a.c[a.b].ga&&(b|=1);this.D=b;W(a,16,this)}}(a)};a.s={D:0,read:function(a){return function(){Wa(a)}}(a),update:function(a){return function(b){void 0!==b&&(this.D=
b);W(a,17,this)}}(a)};a.C={D:0,read:function(){},update:function(){return function(){}}(a)}}e.J=function(a,b,c){switch(b){case "listDisk":return this.A[b]=c,!0;case "loadDisk":return this.A[b]=c,c.onclick=function(a){return function(){if(a.A.listDisk){var b=a.A.listDisk.value,c=b;".json"!=b.substr(b.length-5)&&(c="http://"+window.location.host+"/api/v1/dump?disk="+b);a.F("loading "+aa(b)+"...");r(c,function(b,c,d){Xa(a,b,c,d)})}}}(this),!0}return!1};
e.X=function(a,b,c,d){this.a=a;this.o=b;if(this.f=d)va(d,b,c,this,this.W),O(d,b,c,this,this.R);this.N()};e.$=function(a){a&&!this.u.H&&(this.u.H=!0)};
function Xa(a,b,c,d){if(d)a.F("disk load error ("+d+")");else{d=[];a.F("mounting "+b+"...");try{if(d=eval("("+c+")"),d.length)if(d[0].length){var f=d[0];if(void 0===f[0].trackNum)a.F("data error: "+f[0]);else if(a.c[0]){for(c=0;c<f.length;c++){var g,h=f[c],l=h.sectors;if(void 0===(g=h.trackNum)||void 0===l)throw Error("track "+c+" missing data");g!=c&&t("track "+g+" out of order (expected "+c+")");d=[];var k,n,m;if(g){Ya(d,h,"trackSig");Za(d,h);X(d,h,"trackType");for(var y=0;y<l.length;y++){k=l[y];
n=k.sectorData;X(d,k,"sectorSig");X(d,k,"sectorNum");X(d,k,"sectorPages");for(m=0;m<n.length;m++)d.push(n[m]);Ya(d,k,"sectorEndSig")}}else for(k=l[0],n=k.sectorData,X(d,h,"trackLoad",2),X(d,k,"sectorPages"),m=0;m<n.length;m++)d.push(n[m]);f[g].Xa=d}a.c[0].ra=f;a.F("mount of "+b+" complete")}else a.F("no available drives")}else a.F("no tracks: "+b);else a.F("no data: "+b)}catch(eb){a.F("disk data error: "+eb.message)}}}
function Za(a,b){b=b.trackNum;if(void 0===b)throw Error("missing bcd value: trackNum");a.push(Math.floor(b/10)<<4|b%10)}function X(a,b,c,d){b=b[c];if(void 0===b)throw Error("missing binary value: "+c);2==d&&a.push(b>>8&255);a.push(b&255)}function Ya(a,b,c){b=b[c];if(void 0===b)throw Error("missing signature: "+c);for(c=0;c<b.length;c++)a.push(b.charCodeAt(c))}
function $a(a,b,c){b&=63;16>b?b&=3:32>b&&(b&=17);switch(b){case 0:a=a.j.D&4?a.g:a.v;break;case 1:a=a.j;break;case 2:a=a.m.D&4?a.i:a.w;break;case 3:a=a.m;break;case 16:a=c?a.B:a.h;break;case 17:a=a.s;break;default:a=a.C}return a}e.W=function(a,b){void 0!==b&&$a(this,a-this.o,!1).read()};e.R=function(a,b){void 0!==b&&(b=this.f.W(a),$a(this,a-this.o,!0).update(b))};function Ua(a,b,c){var d=-1;void 0!==b&&void 0!==c&&(d=0,c&32||(d|=2),a.g.D&64||(d|=1));a.b!=d&&(a.b=d,a.h.update())}
function Va(a){0<=a.b&&(a.c[a.b].ga=-1,a.s.update(255),a.h.update())}function Wa(a){var b;if(0<=a.b){b=a.c[a.b];var c=b.ra[b.aa];void 0!==c&&(0<=b.ga&&b.ga<c.Xa.length?(b.ha=100,b=c.Xa[b.ga++],a.s.update(b),a.h.update()):(b.ha=10,Va(a)))}}function W(a,b,c){a.f.R(b+a.o,c.D)}x(function(){for(var a=I(document,"c1pjs","disk"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Sa(d);H(d,c)}});function Y(a,b){B.call(this,"C1PComputer",a);this.M=b}D(Y);
Y.prototype.reset=function(a){var b=null,c;for(c in this.M)for(var d=0;d<this.M[c].length;d++){var f=this.M[c][d];f&&f.reset&&(f.reset(),"cpu"==c&&(b=f))}b&&(b.update(),a&&N(b))};Y.prototype.start=function(){for(var a in this.M)if("cpu"!=a)for(var b=0;b<this.M[a].length;b++){var c=this.M[a][b];c&&c.start&&c.start()}};Y.prototype.stop=function(a,b){for(var c in this.M)if("cpu"!=c)for(var d=0;d<this.M[c].length;d++){var f=this.M[c][d];f&&f.stop&&f.stop(a,b)}};
Y.prototype.J=function(a,b,c){switch(b){case "reset":return this.A[b]=c,c.onclick=function(a){return function(){a.reset()}}(this),!0}return!1};function L(a,b){return a.M[b]?a.M[b][0]:null}function ab(a){var b=null,c;for(c in a.M)for(var d=0;d<a.M[c].length;d++){var f=a.M[c][d];if(f){if(!J(f)){J(f,function(a){return function(){ab(a)}}(a));return}"cpu"==c?b=f:f.$&&f.$(!0,a)}}a.N();a.F("C1Pjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>");b&&b.$(!0,a)}
x(function(){for(var a=I(document,"c1pjs","computer"),b=0;b<a.length;b++){for(var c=a[b],d=G(c),f,g={},h,l=0,k=0,n=0;n<d.modules.length;n++){var m=d.modules[n];if(!n){if("cpu"!=m.type)break;l=m.start;k=m.end;h=Array(k+1-l);for(f=l;f<h.length;f++)h[f]=0}if(f=F(m.refID,d.id)){var y=m.type;void 0===g[y]&&(g[y]=[]);g[y].push(f);f.X&&void 0!==m.start&&f.X(h,m.start,m.end,g.cpu[0])}else{t('no component for <module refid="'+m.refID+'">');return}}if(!h){t('<module type="cpu"> definition must appear first in the <computer> specification');
break}if(f=F("debugger",d.id))g["debugger"]=[f],f.X&&f.X(h,l,k,g.cpu[0]);l=new Y(d,g);if(k=F("panel",d.id))if(g.panel=[k],k.ya){f=d.id;d=void 0;g=[];f&&(f=0<(d=f.indexOf("."))?f.substr(0,d+1):"");for(d=0;d<C.length;d++)n=C[d],f&&n.id.indexOf(f)||g.push(n);d=g;for(g=0;g<d.length;g++)f=d[g],f!=k&&(f.ua=k.ua,f.F=k.F,f.ya=k.ya)}H(l,c);ab(l)}});var Z=0;function bb(a,b,c,d,f,g){f("Loading "+a+"...");r(a,function(h,l,k){k?(l||(l="unable to load "+a+" ("+k+")"),g(l,null)):cb(l,a,b,c,d,f,g)})}
function cb(a,b,c,d,f,g,h){function l(a,g){if(g)h(g,null);else{c&&(E[c]&&b&&(E[c][b]=a),(g=b)&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+g+'"}',"object"==typeof resources&&(g=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':"")));f||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,
"$1C1Pjs$2"),a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1c1pjs$2"));g=null;if("<"==a.charAt(0))try{f||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(m){g=null,a=m.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?f?db(a,g,l):l(a,null):h("no data"+(b?" for file: "+
b:""),null)}
function db(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var f=d[2];b("Loading "+f+"...");r(f,function(g,h,l){if(l||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+l+")");else{if(g=d[3])if(l=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=l[0],n,m=/( [a-z]+=)(['"])(.*?)\2/g;n=m.exec(g);)k=0>k.indexOf(n[1])?k.replace(">",n[0]+">"):k.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);l[0]!=k&&(h=h.replace(l[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,"");
a=a.replace(d[0],h);db(a,b,c)}})}else c(a,null)}
function fb(a,b,c){function d(a){if(void 0===h){var b=g&&I(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=da(a))}function f(a){d("Error: "+a);l&&(--Z||A(!0));l=!1}var g,h,l=!0;Z++;E[a]={};try{if(g=document.getElementById(a)){var k;if("object"==typeof resources&&(k=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],m=document.createElement("style");m.type="text/css";m.styleSheet?m.styleSheet.cssText=k:m.appendChild(document.createTextNode(k));n.appendChild(m)}c||(c="/versions/c1pjs/1.30.1/components.xsl");
k=function(h,k){k?bb(c,null,null,!1,d,function(h,l){l?(E[a]&&c&&(E[a][c]=h),d("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--Z||A(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(h=new XSLTProcessor,h.importStylesheet(l),(l=h.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Z||A(!0)):f("invalid machine element: "+a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):
f(h)}):f(h)};"<"!=b.charAt(0)?bb(b,a,void 0,!0,d,k):cb(b,null,a,void 0,!1,d,k)}else f("missing machine element: "+a)}catch(y){f(y.message)}return l}window.embedC1P=function(a,b,c){A(!1);return fb(a,b,c)};window.enableEvents=A;window.sendEvent=ha;})();